1 /* 2 Copyright (C) 2010-2014 Kristian Duske 3 4 This file is part of TrenchBroom. 5 6 TrenchBroom is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 TrenchBroom is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef TrenchBroom_CyclingMapView 21 #define TrenchBroom_CyclingMapView 22 23 #include "TrenchBroom.h" 24 #include "VecMath.h" 25 #include "View/CameraLinkHelper.h" 26 #include "View/MapViewContainer.h" 27 #include "View/ViewTypes.h" 28 29 #include <wx/panel.h> 30 31 #include <vector> 32 33 namespace TrenchBroom { 34 class Logger; 35 36 namespace Renderer { 37 class MapRenderer; 38 } 39 40 namespace View { 41 class GLContextManager; 42 class MapViewBase; 43 class MapViewToolBox; 44 45 class CyclingMapView : public MapViewContainer, public CameraLinkableView { 46 public: 47 typedef enum { 48 View_3D = 1, 49 View_XY = 2, 50 View_XZ = 4, 51 View_YZ = 8, 52 View_ZZ = View_XZ | View_YZ, 53 View_2D = View_XY | View_ZZ, 54 View_ALL = View_3D | View_2D 55 } View; 56 private: 57 Logger* m_logger; 58 MapDocumentWPtr m_document; 59 60 typedef std::vector<MapViewBase*> MapViewList; 61 MapViewList m_mapViews; 62 MapViewBase* m_currentMapView; 63 public: 64 CyclingMapView(wxWindow* parent, Logger* logger, MapDocumentWPtr document, MapViewToolBox& toolBox, Renderer::MapRenderer& mapRenderer, GLContextManager& contextManager, View views); 65 private: 66 void createGui(MapViewToolBox& toolBox, Renderer::MapRenderer& mapRenderer, GLContextManager& contextManager, View views); 67 private: 68 void bindEvents(); 69 void OnCycleMapView(wxCommandEvent& event); 70 private: 71 void switchToMapView(MapViewBase* mapView); 72 private: // implement ViewEffectsService interface 73 void doFlashSelection(); 74 private: // implement MapView interface 75 bool doGetIsCurrent() const; 76 void doSetToolBoxDropTarget(); 77 void doClearDropTarget(); 78 bool doCanSelectTall(); 79 void doSelectTall(); 80 void doFocusCameraOnSelection(bool animate); 81 void doMoveCameraToPosition(const Vec3& position, bool animate); 82 void doMoveCameraToCurrentTracePoint(); 83 bool doCanMaximizeCurrentView() const; 84 bool doCurrentViewMaximized() const; 85 void doToggleMaximizeCurrentView(); 86 private: // implement MapViewContainer interface 87 MapView* doGetCurrentMapView() const; 88 private: // implement CameraLinkableView interface 89 void doLinkCamera(CameraLinkHelper& linkHelper); 90 }; 91 } 92 } 93 94 #endif /* defined(TrenchBroom_CyclingMapView) */ 95