1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file GNEViewParent.h 11 /// @author Jakob Erdmann 12 /// @date Feb 2011 13 /// @version $Id$ 14 /// 15 // A single child window which contains a view of the edited network (adapted 16 // from GUISUMOViewParent) 17 // While we don't actually need MDI for netedit it is easier to adapt existing 18 // structures than to write everything from scratch. 19 /****************************************************************************/ 20 #ifndef GNEViewParent_h 21 #define GNEViewParent_h 22 23 24 // =========================================================================== 25 // included modules 26 // =========================================================================== 27 #include <config.h> 28 29 #include <utils/gui/windows/GUIGlChildWindow.h> 30 31 32 // =========================================================================== 33 // class declarations 34 // =========================================================================== 35 class GNEAdditionalFrame; 36 class GNEApplicationWindow; 37 class GNEConnectorFrame; 38 class GNECreateEdgeFrame; 39 class GNECrossingFrame; 40 class GNEDeleteFrame; 41 class GNEDialogACChooser; 42 class GNEInspectorFrame; 43 class GNENet; 44 class GNEFrame; 45 class GNEPolygonFrame; 46 class GNEProhibitionFrame; 47 class GNERouteFrame; 48 class GNESelectorFrame; 49 class GNETAZFrame; 50 class GNETLSEditorFrame; 51 class GNEUndoList; 52 class GNEVehicleFrame; 53 class GNEVehicleTypeFrame; 54 class GNEStopFrame; 55 56 // =========================================================================== 57 // class declarations 58 // =========================================================================== 59 /** 60 * @class GNEViewParent 61 * @brief A single child window which contains a view of the simulation area 62 * 63 * It is made of a tool-bar containing a field to change the type of display, 64 * buttons that allow to choose an artifact and some other view controlling 65 * options. 66 * 67 * The rest of the window is a canvas that contains the display itself 68 */ 69 class GNEViewParent : public GUIGlChildWindow { 70 /// @brief FOX-declaration 71 FXDECLARE(GNEViewParent) 72 73 public: 74 /**@brief Constructor 75 * also builds the view and calls create() 76 * 77 * @param[in] p The MDI-pane this window is shown within 78 * @param[in] mdimenu The MDI-menu for alignment 79 * @param[in] name The name of the window 80 * @param[in] parentWindow The main window 81 * @param[in] ic The icon of this window 82 * @param[in] opts Window options 83 * @param[in] x Initial x-position 84 * @param[in] y Initial x-position 85 * @param[in] w Initial width 86 * @param[in] h Initial height 87 * @param[in] share A canvas tor get the shared context from 88 * @param[in] net The network to show 89 */ 90 GNEViewParent(FXMDIClient* p, FXMDIMenu* mdimenu, 91 const FXString& name, GNEApplicationWindow* parentWindow, 92 FXGLCanvas* share, GNENet* net, GNEUndoList* undoList, 93 FXIcon* ic = nullptr, FXuint opts = 0, FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0); 94 95 /// @brief Destructor 96 ~GNEViewParent(); 97 98 /// @brief hide all frames 99 void hideAllFrames(); 100 101 /// @brief get current frame (note: it can be null) 102 GNEFrame* getCurrentShownFrame() const; 103 104 /// @brief get frame for GNE_NMODE_INSPECT 105 GNEInspectorFrame* getInspectorFrame() const; 106 107 /// @brief get frame for GNE_NMODE_SELECT 108 GNESelectorFrame* getSelectorFrame() const; 109 110 /// @brief get frame for GNE_NMODE_CONNECT 111 GNEConnectorFrame* getConnectorFrame() const; 112 113 /// @brief get frame for GNE_NMODE_TLS 114 GNETLSEditorFrame* getTLSEditorFrame() const; 115 116 /// @brief get frame for GNE_NMODE_ADDITIONAL 117 GNEAdditionalFrame* getAdditionalFrame() const; 118 119 /// @brief get frame for GNE_NMODE_CROSSING 120 GNECrossingFrame* getCrossingFrame() const; 121 122 /// @brief get frame for GNE_NMODE_TAZ 123 GNETAZFrame* getTAZFrame() const; 124 125 /// @brief get frame for GNE_NMODE_DELETE 126 GNEDeleteFrame* getDeleteFrame() const; 127 128 /// @brief get frame for GNE_NMODE_POLYGON 129 GNEPolygonFrame* getPolygonFrame() const; 130 131 /// @brief get frame for GNE_NMODE_PROHIBITION 132 GNEProhibitionFrame* getProhibitionFrame() const; 133 134 /// @brief get frame for GNE_NMODE_CREATEEDGE 135 GNECreateEdgeFrame* getCreateEdgeFrame() const; 136 137 /// @brief get frame for GNE_DMODE_ROUTE 138 GNERouteFrame* getRouteFrame() const; 139 140 /// @brief get frame for GNE_DMODE_VEHICLE 141 GNEVehicleFrame* getVehicleFrame() const; 142 143 /// @brief get frame for GNE_DMODE_VEHICLETYPE 144 GNEVehicleTypeFrame* getVehicleTypeFrame() const; 145 146 /// @brief get frame for GNE_DMODE_VEHICLETYPE 147 GNEStopFrame* getStopFrame() const; 148 149 /// @brief show frames area if at least a GNEFrame is showed 150 /// @note this function is called in GNEFrame::Show(); 151 void showFramesArea(); 152 153 /// @brief hide frames area if all GNEFrames are hidden 154 /// @note this function is called in GNEFrame::Show(); 155 void hideFramesArea(); 156 157 /// @brief get GUIMainWindow App 158 GUIMainWindow* getGUIMainWindow() const; 159 160 /// @brief get GNE Application Windows 161 GNEApplicationWindow* getGNEAppWindows() const; 162 163 /// @brief remove created chooser dialog 164 void eraseACChooserDialog(GNEDialogACChooser* chooserDialog); 165 166 /// @name FOX-callbacks 167 /// @{ 168 /// @brief Called if the user wants to make a snapshot (screenshot) 169 long onCmdMakeSnapshot(FXObject* sender, FXSelector, void*); 170 171 /// @brief Called when the user hits the close button (x) 172 long onCmdClose(FXObject*, FXSelector, void*); 173 174 /// @brief locator-callback 175 long onCmdLocate(FXObject*, FXSelector, void*); 176 177 /// @brief Called when user press a key 178 long onKeyPress(FXObject* o, FXSelector sel, void* data); 179 180 /// @brief Called when user releases a key 181 long onKeyRelease(FXObject* o, FXSelector sel, void* data); 182 183 /// @brief Called when user change the splitter between FrameArea and ViewNet 184 long onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*); 185 /// @} 186 187 protected: 188 /// @brief FOX needs this GNEViewParent()189 GNEViewParent() {} 190 191 private: 192 /// @brief struct for Frames 193 struct Frames { 194 /// @brief constructor 195 Frames(); 196 197 /// @brief hide frames 198 void hideFrames(); 199 200 /// @brief set new width in all frames 201 void setWidth(int frameWidth); 202 203 /// @brief return true if at least there is a frame shown 204 bool isFrameShown() const; 205 206 /// @brief get current frame show 207 GNEFrame* getCurrentShownFrame() const; 208 209 /// @brief frame for GNE_NMODE_INSPECT 210 GNEInspectorFrame* inspectorFrame; 211 212 /// @brief frame for GNE_NMODE_SELECT 213 GNESelectorFrame* selectorFrame; 214 215 /// @brief frame for GNE_NMODE_CONNECT 216 GNEConnectorFrame* connectorFrame; 217 218 /// @brief frame for GNE_NMODE_TLS 219 GNETLSEditorFrame* TLSEditorFrame; 220 221 /// @brief frame for GNE_NMODE_ADDITIONAL 222 GNEAdditionalFrame* additionalFrame; 223 224 /// @brief frame for GNE_NMODE_CROSSING 225 GNECrossingFrame* crossingFrame; 226 227 /// @brief frame for GNE_NMODE_TAZ 228 GNETAZFrame* TAZFrame; 229 230 /// @brief frame for GNE_NMODE_DELETE 231 GNEDeleteFrame* deleteFrame; 232 233 /// @brief frame for GNE_NMODE_POLYGON 234 GNEPolygonFrame* polygonFrame; 235 236 /// @brief frame for GNE_NMODE_PROHIBITION 237 GNEProhibitionFrame* prohibitionFrame; 238 239 /// @brief frame for GNE_NMODE_CREATEDGE 240 GNECreateEdgeFrame* createEdgeFrame; 241 242 /// @brief frame for GNE_DMODE_ROUTE 243 GNERouteFrame* routeFrame; 244 245 /// @brief frame for GNE_DMODE_VEHICLE 246 GNEVehicleFrame* vehicleFrame; 247 248 /// @brief frame for GNE_DMODE_VEHICLETYPE 249 GNEVehicleTypeFrame* vehicleTypeFrame; 250 251 /// @brief frame for GNE_DMODE_STOP 252 GNEStopFrame* stopFrame; 253 }; 254 255 /// @brief struct for ACChoosers dialog 256 struct ACChoosers { 257 /// @brief constructor 258 ACChoosers(); 259 260 /// @brief destructor 261 ~ACChoosers(); 262 263 /// @brief pointer to ACChooser dialog 264 GNEDialogACChooser* ACChooserJunction; 265 266 /// @brief pointer to ACChooser dialog 267 GNEDialogACChooser* ACChooserEdges; 268 269 /// @brief pointer to ACChooser dialog 270 GNEDialogACChooser* ACChooserTLS; 271 272 /// @brief pointer to ACChooser dialog 273 GNEDialogACChooser* ACChooserAdditional; 274 275 /// @brief pointer to ACChooser dialog 276 GNEDialogACChooser* ACChooserPOI; 277 278 /// @brief pointer to ACChooser dialog 279 GNEDialogACChooser* ACChooserPolygon; 280 281 /// @brief pointer to ACChooser dialog 282 GNEDialogACChooser* ACChooserProhibition; 283 }; 284 285 /// @brief pointer to GNEApplicationWindow 286 GNEApplicationWindow* myGNEAppWindows; 287 288 /// @brief frame to hold myView and myAttributePanel 289 FXHorizontalFrame* myViewArea; 290 291 /// @brief frame to hold GNEFrames 292 FXHorizontalFrame* myFramesArea; 293 294 /// @brief Splitter to divide ViewNet und GNEFrames 295 FXSplitter* myFramesSplitter; 296 297 /// @brief struct for frames 298 Frames myFrames; 299 300 /// @brief struct for ACChoosers 301 ACChoosers myACChoosers; 302 }; 303 304 305 #endif 306 307 /****************************************************************************/ 308