| 361 | |
| 362 | |
| 363 | CountPolygonInPolygon::CountPolygonInPolygon(BackgroundMapLayer* _ml, |
| 364 | Project* _project, |
| 365 | std::vector<wxString> join_variable_nm, |
| 366 | std::vector<Operation> _op) |
| 367 | : SpatialJoinWorker(_ml, _project) |
| 368 | { |
| 369 | is_spatial_assign = false; |
| 370 | join_operation = _op; |
| 371 | int n_vars = (int)join_operation.size(); |
| 372 | join_values.resize(n_vars); |
| 373 | join_variable = false; // default false: no need to join variables |
| 374 | for (int i=0; i<join_variable_nm.size(); ++i) { |
| 375 | join_variable = _ml->GetDoubleColumnData(join_variable_nm[i], join_values[i]); |
| 376 | } |
| 377 | num_polygons = project->GetNumRecords(); |
| 378 | |
| 379 | // using selected layer (polygons) to create rtree |
| 380 | int n = (int)ml->shapes.size(); |
| 381 | for (int i=0; i<n; i++) { |
| 382 | OGRGeometry* geom = ml->geoms[i]; |
| 383 | OGREnvelope bbox; |
| 384 | geom->getEnvelope(&bbox); |
| 385 | pt_2d ll(bbox.MinX, bbox.MinY); |
| 386 | pt_2d ur(bbox.MaxX, bbox.MaxY); |
| 387 | box_2d b(ll, ur); |
| 388 | rtree.insert(std::make_pair(b, i)); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | void CountPolygonInPolygon::sub_run(int start, int end) |
| 393 | { |
nothing calls this directly
no test coverage detected