[GRASS-SVN] r47117 - grass/trunk/lib/rst/interp_float
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 15 01:34:56 EDT 2011
Author: mmetz
Date: 2011-07-14 22:34:56 -0700 (Thu, 14 Jul 2011)
New Revision: 47117
Modified:
grass/trunk/lib/rst/interp_float/vinput2d.c
Log:
adjust rst lib to new topo
Modified: grass/trunk/lib/rst/interp_float/vinput2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/vinput2d.c 2011-07-14 17:16:37 UTC (rev 47116)
+++ grass/trunk/lib/rst/interp_float/vinput2d.c 2011-07-15 05:34:56 UTC (rev 47117)
@@ -42,7 +42,7 @@
{
double dmax2; /* max distance between points squared */
double c1, c2, c3, c4;
- int i, line, k = 0, nnodes;
+ int i, line, k = 0;
double ns_res, ew_res;
int npoint, OUTRANGE;
int totsegm;
@@ -50,7 +50,7 @@
double xprev, yprev, zprev, x1, y1, z1, d1, xt, yt, z, sm;
struct line_pnts *Points;
struct line_cats *Cats;
- int times, j1, k1, ltype, cat, zctype = 0, sctype = 0;
+ int times, j1, ltype, cat, zctype = 0, sctype = 0;
struct field_info *Fi;
dbDriver *driver;
dbHandle handle;
@@ -174,29 +174,16 @@
}
}
- if (Vect_level(Map) == 1) {
- /* Insert all points including nodes (end points) */
- for (i = 0; i < Points->n_points; i++) {
- if (field == 0)
- z = Points->z[i];
- process_point(Points->x[i], Points->y[i], z, sm, info,
- params->zmult, xmin, xmax, ymin, ymax, zmin,
- zmax, &npoint, &OUTRANGE, &k);
+ /* Insert all points including nodes (end points) */
+ for (i = 0; i < Points->n_points; i++) {
+ if (field == 0)
+ z = Points->z[i];
+ process_point(Points->x[i], Points->y[i], z, sm, info,
+ params->zmult, xmin, xmax, ymin, ymax, zmin,
+ zmax, &npoint, &OUTRANGE, &k);
- }
}
- else {
- /* Insert all points except nodes (end points) */
- for (i = 1; i < Points->n_points - 1; i++) {
- if (field == 0)
- z = Points->z[i];
- process_point(Points->x[i], Points->y[i], z, sm, info,
- params->zmult, xmin, xmax, ymin, ymax, zmin,
- zmax, &npoint, &OUTRANGE, &k);
- }
- }
-
/* Check all segments */
xprev = Points->x[0];
yprev = Points->y[0];
@@ -229,72 +216,6 @@
}
}
- /* Process all nodes */
- G_message(_("Reading nodes from vector map ..."));
- nnodes = Vect_get_num_nodes(Map);
- for (k1 = 1; k1 <= nnodes; k1++) {
- G_debug(5, " node %d", k1);
- G_percent(k1, nnodes, 1);
- Vect_get_node_coor(Map, k1, &x1, &y1, &z);
-
- /* TODO: check more lines ? */
- if (field > 0) {
- line = abs(Vect_get_node_line(Map, k1, 0));
- ltype = Vect_read_line(Map, NULL, Cats, line);
- Vect_cat_get(Cats, field, &cat);
- if (zcol == NULL) { /* use categories */
- if (cat < 0)
- continue;
- z = (double)cat;
- }
- else { /* read att from db */
- int ret, intval;
-
- if (cat == 0)
- continue;
-
- if (zctype == DB_C_TYPE_INT) {
- ret = db_CatValArray_get_value_int(&zarray, cat, &intval);
- z = intval;
- }
- else { /* DB_C_TYPE_DOUBLE */
- ret = db_CatValArray_get_value_double(&zarray, cat, &z);
- }
-
- if (ret != DB_OK) {
- if (params->wheresql != NULL)
- /* G_message(_("Database record for cat %d not used due to SQL statement")); */
- /* do nothing in this case to not confuse user. Or implement second cat list */
- ;
- else
- G_warning(_("Database record for cat %d not found"),
- cat);
- continue;
- }
-
- if (scol != NULL) {
- if (sctype == DB_C_TYPE_INT) {
- ret =
- db_CatValArray_get_value_int(&sarray, cat,
- &intval);
- sm = intval;
- }
- else { /* DB_C_TYPE_DOUBLE */
- ret =
- db_CatValArray_get_value_double(&sarray, cat,
- &sm);
- }
- if (sm < 0.0)
- G_fatal_error(_("Negative value of smoothing detected: sm must be >= 0"));
- }
- G_debug(5, " z = %f sm = %f", z, sm);
- }
- }
-
- process_point(x1, y1, z, sm, info, params->zmult, xmin, xmax, ymin,
- ymax, zmin, zmax, &npoint, &OUTRANGE, &k);
- }
-
if (field > 0 && zcol != NULL)
db_CatValArray_free(&zarray);
if (scol != NULL) {
More information about the grass-commit
mailing list