2
\file vdigit/select.cpp
4
\brief wxvdigit - Select lines (by query)
6
This program is free software under the GNU General Public
7
License (>=v2). Read the file COPYING that comes with GRASS
10
(C) 2008-2009 by Martin Landa, and the GRASS development team
12
\author Martin Landa <landa.martin gmail.com>
16
#include <grass/vedit.h>
22
\brief Select features by query (based on geometry)
25
- QUERY_LENGTH, select all lines longer then threshold (or shorter if threshold is negative)
26
- QUERY_DANGLE, select all dangles then threshold (or shorter if threshold is negative)
28
\todo Rewrite dangle part to use Vector library functionality
31
\param x1,y1,z1,x2,y2,z2 bounding box
32
\param query query (length, dangle, ...)
33
\param thresh threshold value (< 0 for 'shorter', > 0 for 'longer')
34
\param type feature type
35
\param box query features in bounding box
37
\return list of selected features
40
std::vector<int> Digit::SelectLinesByQuery(double x1, double y1, double z1,
41
double x2, double y2, double z2, bool box,
42
int query, int type, double thresh)
47
struct line_pnts *bbox;
49
if (!display->mapInfo) {
50
display->DisplayMsg();
57
List = Vect_new_list();
60
bbox = Vect_new_line_struct();
62
Vect_append_point(bbox, x1, y1, z1);
63
Vect_append_point(bbox, x2, y1, z2);
64
Vect_append_point(bbox, x2, y2, z1);
65
Vect_append_point(bbox, x1, y2, z2);
66
Vect_append_point(bbox, x1, y1, z1);
68
Vect_select_lines_by_polygon (display->mapInfo, bbox, 0, NULL, type, List);
69
if (List->n_values == 0) {
74
G_debug(3, "wxDigit.SelectLinesByQuery(): lines=%d", List->n_values);
76
Vedit_select_by_query(display->mapInfo,
77
type, layer, thresh, query,
80
ids = display->ListToVector(List); // TODO
82
G_debug(3, "wxDigit.SelectLinesByQuery(): lines=%d", List->n_values);
84
Vect_destroy_list(List);
86
Vect_destroy_line_struct(bbox);