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

Method OnZoomToSelected

Explore/MapLayerTree.cpp:593–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591}
592
593void MapTree::OnZoomToSelected(wxCommandEvent& event)
594{
595 // set map extent to selected objects in mouse clicked layer
596 wxString map_name = map_titles[new_order[select_id]];
597 BackgroundMapLayer* ml = GetMapLayer(map_name);
598 double minx, miny, maxx, maxy;
599 if (ml == NULL) {
600 // selected layer is current map
601 canvas->GetExtentOfSelected(minx, miny, maxx, maxy);
602 } else {
603 // other layer
604 ml->GetExtentOfSelected(minx, miny, maxx, maxy);
605 // re projection if needed
606 OGRSpatialReference* destSR = canvas->GetSpatialReference();
607 OGRSpatialReference* sourceSR = ml->GetSpatialReference();
608#ifdef __PROJ6__
609 if (sourceSR) {
610 sourceSR->SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
611 }
612 if (destSR) {
613 destSR->SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
614 }
615#endif
616 OGRCoordinateTransformation *poCT = OGRCreateCoordinateTransformation(sourceSR, destSR);
617 if (poCT!= NULL) {
618 //poCT->Transform(1, &minx, &miny);
619 //poCT->Transform(1, &maxx, &maxx);
620 }
621 }
622 canvas->ExtentTo(minx, miny, maxx, maxy);
623 canvas->RedrawMap();
624 canvas->ResetBrushing();
625}
626
627void MapTree::OnSetAssociateLayer(wxCommandEvent& event)
628{

Callers

nothing calls this directly

Calls 5

ExtentToMethod · 0.80
RedrawMapMethod · 0.80
ResetBrushingMethod · 0.80
GetExtentOfSelectedMethod · 0.45
GetSpatialReferenceMethod · 0.45

Tested by

no test coverage detected