📄 frame.cpp
字号:
/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewScale(wxCommandEvent & event){ m_ctlMap->ShowScale(m_menuView->IsChecked(idViewScale));}//////////////////////////////////////////////////////////////////////////////////// \brief View->GPS History toggled/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewGPSHistory(wxCommandEvent & event){ if (!m_menuView->IsChecked(idViewGPSHistory)) m_ctlMap->ClearTrack(wxT("GPSHistory")); g_pConfig->Write(wxT("GPSHistory"), m_menuView->IsChecked(idViewGPSHistory)); g_pConfig->Flush();}//////////////////////////////////////////////////////////////////////////////////// \brief Zoom to a specified zoom level/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewZoomLevel(wxCommandEvent& event){ m_ctlMap->SetDetailLevel(event.GetId() - idViewZoom0);}//////////////////////////////////////////////////////////////////////////////////// \brief View->Zoom In selected, increase the detail level/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewZoomIn(wxCommandEvent& event){ m_ctlMap->MoreDetail();}//////////////////////////////////////////////////////////////////////////////////// \brief View->Zoom Out selected, decrease the detail level/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewZoomOut(wxCommandEvent& event){ m_ctlMap->LessDetail();}//////////////////////////////////////////////////////////////////////////////////// \brief View->Zoom All selected/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewZoomMax(wxCommandEvent& event){ m_ctlMap->SetDetailLevel(m_MapAppearanceSettings.GetDetailLevelCount());}//////////////////////////////////////////////////////////////////////////////////// \brief View->Zoom None selected/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewZoomMin(wxCommandEvent& event){ m_ctlMap->SetDetailLevel(0);}//////////////////////////////////////////////////////////////////////////////////// \brief Show/hide the marker indicating the current GPS coordinates/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewGPSMarker(wxCommandEvent& event){ m_bScreenTracksGPS = m_menuView->IsChecked(idViewGPSMarker); SetActive(wxT("MapTracksGPS"), m_bScreenTracksGPS);}//////////////////////////////////////////////////////////////////////////////////// \brief Toggle the marker indicating the current GPS coordinates/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewGPSMarkerToggle(wxCommandEvent& event){ m_bScreenTracksGPS = !m_bScreenTracksGPS; m_menuView->Check(idViewGPSMarker, m_bScreenTracksGPS); SetActive(wxT("MapTracksGPS"), m_bScreenTracksGPS);}//////////////////////////////////////////////////////////////////////////////////// \brief Show/hides the GPS status window/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewGPSWindow(wxCommandEvent& event){ if (m_menuView->IsChecked(idViewGPSWindow)) m_pfrmGPS->Show(); else m_pfrmGPS->Hide(); g_pConfig->Write(wxT("GPSWindowVisible"), m_menuView->IsChecked(idViewGPSWindow)); g_pConfig->Flush();}//////////////////////////////////////////////////////////////////////////////////// \brief Show/hides the What's Nearby window/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewWhatsNearByWindow(wxCommandEvent& event){ if (m_menuView->IsChecked(idViewWhatsNearByWindow)) { m_pfrmWhatsNearBy->SetCenter(m_ctlMap->GetCenterCoordinates()); m_pfrmWhatsNearBy->Show(); } else { m_pfrmWhatsNearBy->Hide(); } g_pConfig->Write(wxT("WhatsNearByWindowVisible"), m_menuView->IsChecked(idViewWhatsNearByWindow)); g_pConfig->Flush();}//////////////////////////////////////////////////////////////////////////////////// \brief Enters/exits full screen mode/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnViewFullScreen(wxCommandEvent& event){ ShowFullScreen(!IsFullScreen()); m_menuView->Check(idViewFullScreen, IsFullScreen());}///////////////////////////////////////////////////////////////////////////////// /// \brief Map->Set Address selected.////// Bring up a dialog box asking the user for an address. Center the map on/// that address./////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapSetAddress(wxCommandEvent & event){ wxString strErrorMsg; wxString strMarkerName; MapMarker cMarker; if (QueryAddress( wxT("Set Address"), this, m_ctlMap, wxT(""), /* no sense including current street address */ m_adrGPS.m_strCityName, m_adrGPS.m_strStateName, false, &cMarker, &strErrorMsg) != wxID_OK) return; if (cMarker.m_cAddress.m_bValid) { m_ctlMap->SetMarker(cMarker); } else { wxMessageDialog dlgError(this, strErrorMsg, wxT("Error"), wxOK | wxICON_ERROR); dlgError.ShowModal(); }}///////////////////////////////////////////////////////////////////////////////// /// \brief Map->Set Angle selected.////// Bring up a dialog box asking the user to enter the orientation of the map./////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapSetAngle(wxCommandEvent & event){ if (m_menuView->IsChecked(idViewAerialPhotos)) { ::wxMessageBox(wxT("Sorry, maps cannot be rotated when aerial photos are enabled."), wxT("Error"), wxOK | wxICON_ERROR, this); return; } wxTextEntryDialog dlg(this, wxT("Enter desired orientation in degrees"), wxT("Set Map Orientation"), wxString::Format(wxT("%.1f"), m_ctlMap->GetAngle())); dlg.SetValue(wxString::Format(wxT("%.1f"), m_ctlMap->GetAngle())); if (dlg.ShowModal() == wxID_OK) { double fAngle; fAngle = 0; dlg.GetValue().ToDouble(&fAngle); m_ctlMap->SetAngle(fAngle); }}//////////////////////////////////////////////////////////////////////////////////// \brief Map->Waypoints selected.////// Bring up the LocationDialog box, allowing the user to add/update/delete/// waypoints./////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapWaypoints(wxCommandEvent & event){ wxFont fntThis = GetFont(); LocationDialog dlgAddress(this, m_ctlMap, ADFLAG_MARKERMANAGEMENTBUTTONS, &fntThis); dlgAddress.m_strTitle = wxT("Waypoints"); dlgAddress.ShowModal(); SaveMarkers();}//////////////////////////////////////////////////////////////////////////////////// \brief Map->Get Directions selected./// Ask the user for two addresses and figure out the best way to get from/// the first address to the second. Results are shown in the directions/// miniframe./////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapGetDirections(wxCommandEvent & event){ if (m_menuMap->IsChecked(idMapGetDirections)) { if (!m_pfrmDirections->Setup()) m_pfrmDirections->Show(); else m_menuMap->Check(idMapGetDirections, false); } else { m_pfrmDirections->Close(); }}//////////////////////////////////////////////////////////////////////////////////// \brief One of the get directions accelerators has been pressed./// Toggle the map directions off, then on/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapGetDirectionsAccel(wxCommandEvent & event){ if (m_menuMap->IsChecked(idMapGetDirections)) { // first uncheck m_menuMap->Check(idMapGetDirections, 0); OnMapGetDirections(event); } // now check m_menuMap->Check(idMapGetDirections, 1); OnMapGetDirections(event);}//////////////////////////////////////////////////////////////////////////////////// \brief User pressed left arrow key - move map to the left/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapMoveCenterLeft(wxCommandEvent & event){ m_ctlMap->MoveCenterLeft();}//////////////////////////////////////////////////////////////////////////////////// \brief User pressed right arrow key - move map to the right/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapMoveCenterRight(wxCommandEvent & event){ m_ctlMap->MoveCenterRight();}//////////////////////////////////////////////////////////////////////////////////// \brief User pressed up arrow key - move map to the up/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapMoveCenterUp(wxCommandEvent & event){ m_ctlMap->MoveCenterUp();}//////////////////////////////////////////////////////////////////////////////////// \brief User pressed down arrow key - move map to the down/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnMapMoveCenterDown(wxCommandEvent & event){ m_ctlMap->MoveCenterDown();}//////////////////////////////////////////////////////////////////////////////////// \brief Tools->Measure selected. Enables/Disables Measure mode/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnToolsMeasure(wxCommandEvent& event){ if ( m_ToolMode == toolMeasure ) { m_ToolMode = toolNone; return; } m_ToolMode = toolMeasure;}//////////////////////////////////////////////////////////////////////////////////// \brief Updates the check mark next to Tools->Measure/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnUpdateToolsMeasure(wxUpdateUIEvent& event){ event.Check( m_ToolMode == toolMeasure );}//////////////////////////////////////////////////////////////////////////////////// \brief Tools->Zoom selected. Enables/disables zoom mode./////////////////////////////////////////////////////////////////////////////////void MapFrame::OnToolsZoom(wxCommandEvent& event){ if ( m_ToolMode == toolZoom ) { m_ToolMode = toolNone; return; } m_ToolMode = toolZoom;}//////////////////////////////////////////////////////////////////////////////////// \brief Updates the check mark next to Tools->Zoom/////////////////////////////////////////////////////////////////////////////////void MapFrame::OnUpdateToolsZoom(wxUpdateUIEvent& event){ event.Check( m_ToolMode == toolZoom );}//////////////////////////////////////////////////////////////////////////////////// \brief Tools->Download Maps selected////// Bring up a dialog box listing the counties, and download the Tiger/Line/// files for the counties the user selects. Files are pulled directly from/// the Census Bureau web site./////////////////////////////////////////////////////////////////////////////////void MapFrame::OnToolsDownloadTIGERLineMaps(wxCommandEvent & event){ wxFont fntThis = GetFont(); vector<wxString> vCounties; vector<wxString>::iterator i; vector<wxString> vDownloaded; MapControlDataImporter_GNISDECI diGNIS; MapControlDataImporter_TigerLine diTigerLine; vCounties = GetCountyNames(); for (i = vCounties.begin(); i != vCounties.end(); i++) { int iCountyCode; iCountyCode = CountyCodeByName(*i); if (diTigerLine.IsCountyLoaded(iCountyCode)) vDownloaded.push_back(*i); } CountyDialog dlgCounty(this, &fntThis, vDownloaded); if (dlgCounty.ShowModal() == wxID_OK) { vector<wxInt32> viStateCountyCodes; unsigned int i; map<wxString, bool> mapDownloading; int iCount; int iProgressPosition; iCount = 0; for (i = 0; i < dlgCounty.m_strSelCounties.size(); i++) { int iCountyCode; wxString strStateAbbrev; iCountyCode = CountyCodeByName(dlgCounty.m_strSelCounties[i]); strStateA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -