MCPcopy Create free account
hub / github.com/GeoDaCenter/geoda / CountPointsInPolygon

Method CountPointsInPolygon

DialogTools/SpatialJoinDlg.cpp:138–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136
137
138CountPointsInPolygon::CountPointsInPolygon(BackgroundMapLayer* _ml,
139 Project* _project,
140 std::vector<wxString> join_variable_nm,
141 std::vector<Operation> _op)
142: SpatialJoinWorker(_ml, _project)
143{
144 is_spatial_assign = false;
145 join_operation = _op;
146 int n_vars = (int)join_operation.size();
147 join_values.resize(n_vars);
148 join_variable = false; // default false: no need to join variables
149 for (int i=0; i<join_variable_nm.size(); ++i) {
150 join_variable = _ml->GetDoubleColumnData(join_variable_nm[i], join_values[i]);
151 }
152
153 num_polygons = project->GetNumRecords();
154
155 // using selected layer (points) to create rtree
156 int n = (int)ml->shapes.size();
157 double x, y;
158 for (int i=0; i<n; i++) {
159 if (ml->shapes[i]) {
160 x = ml->shapes[i]->center_o.x;
161 y = ml->shapes[i]->center_o.y;
162 rtree.insert(std::make_pair(pt_2d(x,y), i));
163 }
164 }
165}
166
167void CountPointsInPolygon::sub_run(int start, int end)
168{

Callers

nothing calls this directly

Calls 4

GetDoubleColumnDataMethod · 0.80
sizeMethod · 0.45
GetNumRecordsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected