Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 : // This program and the accompanying materials are made available under the
5 : // terms of the Eclipse Public License 2.0 which is available at
6 : // https://www.eclipse.org/legal/epl-2.0/
7 : // This Source Code may also be made available under the following Secondary
8 : // Licenses when the conditions for such availability set forth in the Eclipse
9 : // Public License 2.0 are satisfied: GNU General Public License, version 2
10 : // or later which is available at
11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 : /****************************************************************************/
14 : /// @file GUISUMOAbstractView.h
15 : /// @author Daniel Krajzewicz
16 : /// @author Jakob Erdmann
17 : /// @author Michael Behrisch
18 : /// @author Andreas Gaubatz
19 : /// @date Sept 2002
20 : ///
21 : // The base class for a view
22 : /****************************************************************************/
23 : #pragma once
24 : #include <config.h>
25 :
26 : #include <string>
27 : #include <vector>
28 : #include <map>
29 : #include <utils/foxtools/fxheader.h>
30 : // fx3d includes windows.h so we need to guard against macro pollution
31 : #ifdef WIN32
32 : #define NOMINMAX
33 : #endif
34 : #include <fx3d.h>
35 : #ifdef WIN32
36 : #undef NOMINMAX
37 : #endif
38 :
39 : #include <utils/geom/Boundary.h>
40 : #include <utils/geom/Position.h>
41 : #include <utils/common/RGBColor.h>
42 : #include <utils/common/SUMOTime.h>
43 : #include <utils/gui/globjects/GUIGlObjectTypes.h>
44 : #include <foreign/rtree/SUMORTree.h>
45 :
46 :
47 : // ===========================================================================
48 : // class declarations
49 : // ===========================================================================
50 : class GUIGlChildWindow;
51 : class GUIVehicle;
52 : class GUIPerspectiveChanger;
53 : class GUIMainWindow;
54 : class GUIGLObjectPopupMenu;
55 : class GUIGlObject;
56 : class GUIDialog_EditViewport;
57 : class GUIDialog_ViewSettings;
58 : class GUIVisualizationSettings;
59 : class GUILane;
60 :
61 : /// @brief comparator for resolving clicks
62 : struct ComparatorClickPriority {
63 0 : bool operator()(const GUIGlObject* const a, const GUIGlObject* const b) const {
64 0 : if (a->getClickPriority() == b->getClickPriority()) {
65 : // sorty by GUIGlID as second criterion to simplify
66 : // duplicate removal
67 0 : return a->getGlID() > b->getGlID();
68 : } else {
69 0 : return a->getClickPriority() > b->getClickPriority();
70 : }
71 : }
72 : };
73 :
74 : // ===========================================================================
75 : // class definitions
76 : // ===========================================================================
77 : /**
78 : * @class GUISUMOAbstractView
79 : * This class is meant to be pure virtual later;
80 : * It shall be the main class to inherit views of the simulation (micro-
81 : * or macroscopic ones) from it.
82 : */
83 : class GUISUMOAbstractView : public FXGLCanvas {
84 0 : FXDECLARE(GUISUMOAbstractView)
85 :
86 : public:
87 : /// @brief constructor
88 : GUISUMOAbstractView(FXComposite* p, GUIMainWindow& app, GUIGlChildWindow* parent, const SUMORTree& grid, FXGLVisual* glVis, FXGLCanvas* share);
89 :
90 : /// @brief destructor
91 : virtual ~GUISUMOAbstractView();
92 :
93 : /// @brief recalculate boundaries
94 0 : virtual void recalculateBoundaries() { };
95 :
96 : /// @brief builds the view toolbars
97 0 : virtual void buildViewToolBars(GUIGlChildWindow*) { }
98 :
99 : /// @brief recenters the view
100 : virtual void recenterView();
101 :
102 : /** @brief centers to the chosen artifact
103 : * @param[in] id The id of the artifact to center to
104 : * @param[in] applyZoom Whether to zoom in
105 : * @param[in] zoomDist The distance in m to use for the zoom, values < 0 means: use the centeringBoundary
106 : * @note caller is responsible for calling update
107 : */
108 : virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist = 20);
109 :
110 : /** @brief centers to the chosen position
111 : * @param[in] pos Position to center view
112 : * @param[in] applyZoom Whether to zoom in
113 : * @param[in] zoomDist The distance in m to use for the zoom, values < 0 means: use the centeringBoundary
114 : * @note caller is responsible for calling update
115 : */
116 : virtual void centerTo(const Position& pos, bool applyZoom, double zoomDist = 20);
117 :
118 : /// @brief centers to the chosen artifact
119 : void centerTo(const Boundary& bound);
120 :
121 : /// @brief applies the given viewport settings
122 : virtual void setViewportFromToRot(const Position& lookFrom, const Position& lookAt, double rotation);
123 :
124 : /// @brief copy the viewport to the given view
125 : virtual void copyViewportTo(GUISUMOAbstractView* view);
126 :
127 : /// @brief meter-to-pixels conversion method
128 : double m2p(double meter) const;
129 :
130 : /// @brief pixels-to-meters conversion method
131 : double p2m(double pixel) const;
132 :
133 : /// @brief get main window
134 : GUIMainWindow* getMainWindow() const;
135 :
136 : /// @brief return windows cursor position
137 : Position getWindowCursorPosition() const;
138 :
139 : /// @brief Returns the gl-id of the object under the given coordinates
140 : void setWindowCursorPosition(FXint x, FXint y);
141 :
142 : /// @brief A reimplementation due to some internal reasons
143 : FXbool makeCurrent();
144 :
145 : /// @brief returns true, if the edit button was pressed
146 : bool isInEditMode();
147 :
148 : /// @brief get changer
149 : GUIPerspectiveChanger& getChanger() const;
150 :
151 : /// @brief get visible boundary
152 : Boundary getVisibleBoundary() const;
153 :
154 : /// @brief return whether this is a 3D view
155 : virtual bool is3DView() const;
156 :
157 : /// @brief zoom interface for 3D view
158 : virtual void zoom2Pos(Position& camera, Position& lookAt, double zoom);
159 :
160 : /// @brief mouse functions
161 : //@{
162 : virtual long onConfigure(FXObject*, FXSelector, void*);
163 : virtual long onPaint(FXObject*, FXSelector, void*);
164 : virtual long onLeftBtnPress(FXObject*, FXSelector, void*);
165 : virtual long onLeftBtnRelease(FXObject*, FXSelector, void*);
166 : virtual long onMiddleBtnPress(FXObject*, FXSelector, void*);
167 : virtual long onMiddleBtnRelease(FXObject*, FXSelector, void*);
168 : virtual long onRightBtnPress(FXObject*, FXSelector, void*);
169 : virtual long onRightBtnRelease(FXObject*, FXSelector, void*);
170 : virtual long onDoubleClicked(FXObject*, FXSelector, void*);
171 : virtual long onMouseWheel(FXObject*, FXSelector, void*);
172 : virtual long onMouseMove(FXObject*, FXSelector, void*);
173 : virtual long onMouseLeft(FXObject*, FXSelector, void*);
174 : //@}
175 :
176 : /// @brief keyboard functions
177 : //@{
178 : virtual long onKeyPress(FXObject* o, FXSelector sel, void* data);
179 : virtual long onKeyRelease(FXObject* o, FXSelector sel, void* data);
180 : //@}
181 :
182 : /// @brief interaction with the simulation
183 : virtual long onCmdCloseLane(FXObject*, FXSelector, void*);
184 : virtual long onCmdCloseEdge(FXObject*, FXSelector, void*);
185 : virtual long onCmdAddRerouter(FXObject*, FXSelector, void*);
186 :
187 : /// @brief highlight edges according to reachability
188 : virtual long onCmdShowReachability(FXObject*, FXSelector, void*);
189 :
190 : /// @brief hook to react on change in visualization settings
191 : virtual long onVisualizationChange(FXObject*, FXSelector, void*);
192 :
193 : /// @brief filter out duplicate and forbidden objects
194 : std::vector<GUIGlObject*> filterContextObjects(const std::vector<GUIGlObject*>& objects);
195 :
196 : /// @brief open object dialog at the cursor position
197 : virtual void openObjectDialogAtCursor(const FXEvent* ev);
198 :
199 : /// @brief open object dialog for the given object
200 : void openObjectDialog(const std::vector<GUIGlObject*>& objects, const bool filter = true);
201 :
202 : /// @brief A method that updates the tooltip
203 : void updateToolTip();
204 :
205 : /// @brief @name Dealing with snapshots
206 : ///@{
207 :
208 : /** @brief Sets the snapshot time to file map
209 : * @param[in] snaps The snapshots to take at certain times
210 : * @param[in] w The snapshot image width
211 : * @param[in] w The snapshot image height
212 : */
213 : void addSnapshot(SUMOTime time, const std::string& file, const int w = -1, const int h = -1);
214 :
215 : /** @brief Takes a snapshots and writes it into the given file
216 : *
217 : * The format to use is determined from the extension.
218 : * If compiled with ffmpeg and a video format is requested it will instantiate a video encoder.
219 : * @param[in] destFile The name of the file to write the snapshot into
220 : * @param[in] w The snapshot image width
221 : * @param[in] w The snapshot image height
222 : * @return The error message, if an error occurred; "" otherwise
223 : */
224 : std::string makeSnapshot(const std::string& destFile, const int w = -1, const int h = -1);
225 :
226 : /// @brief Adds a frame to a video snapshot which will be initialized if necessary
227 : virtual void saveFrame(const std::string& destFile, FXColor* buf);
228 :
229 : /// @brief Ends a video snapshot
230 0 : virtual void endSnapshot() {}
231 :
232 : /// @brief Checks whether it is time for a snapshot
233 : virtual void checkSnapshots();
234 :
235 : void waitForSnapshots(const SUMOTime snapshotTime);
236 :
237 : /// @brief get the current simulation time
238 : virtual SUMOTime getCurrentTimeStep() const;
239 :
240 : ///@}
241 :
242 : /// @brief get the viewport and create it on first access
243 : GUIDialog_EditViewport* getViewportEditor();
244 :
245 : /// @brief update the viewport chooser with the current view values
246 : virtual void updateViewportValues();
247 :
248 : /// @brief show viewport editor
249 : virtual void showViewportEditor();
250 :
251 : /// @brief show viewsscheme editor
252 : void showViewschemeEditor();
253 :
254 : /// @brief set color scheme
255 : virtual bool setColorScheme(const std::string&);
256 :
257 : /// @brief get visualization settings (read only)
258 : const GUIVisualizationSettings& getVisualisationSettings() const;
259 :
260 : /// @brief edit visualization settings (allow modify VisualizationSetings, use carefully)
261 : GUIVisualizationSettings* editVisualisationSettings() const;
262 :
263 : /// @brief recalibrate color scheme according to the current value range
264 0 : virtual void buildColorRainbow(const GUIVisualizationSettings& /*s*/, GUIColorScheme& /*scheme*/, int /*active*/, GUIGlObjectType /*objectType*/,
265 : const GUIVisualizationRainbowSettings& /*rs*/) {
266 0 : }
267 :
268 : /// @brief return list of loaded edgeData attributes
269 0 : virtual std::vector<std::string> getEdgeDataAttrs() const {
270 0 : return std::vector<std::string>();
271 : }
272 :
273 : /// @brief return list of loaded edgeData ids (being computed in the current simulation)
274 0 : virtual std::vector<std::string> getMeanDataIDs() const {
275 0 : return std::vector<std::string>();
276 : }
277 :
278 : /// @brief return list of available attributes for the given meanData id
279 0 : virtual std::vector<std::string> getMeanDataAttrs(const std::string& meanDataID) const {
280 : UNUSED_PARAMETER(meanDataID);
281 0 : return std::vector<std::string>();
282 : }
283 :
284 : /// @brief return list of loaded edgeRelation and tazRelation attributes
285 0 : virtual std::vector<std::string> getRelDataAttrs() const {
286 0 : return std::vector<std::string>();
287 : }
288 :
289 : /// @brief return list of available edge parameters
290 0 : virtual std::vector<std::string> getEdgeLaneParamKeys(bool /*edgeKeys*/) const {
291 0 : return std::vector<std::string>();
292 : }
293 :
294 : /// @brief return list of available vehicle parameters
295 0 : virtual std::vector<std::string> getVehicleParamKeys(bool /*vTypeKeys*/) const {
296 0 : return std::vector<std::string>();
297 : }
298 :
299 : /// @brief return list of available vehicle parameters
300 0 : virtual std::vector<std::string> getPOIParamKeys() const {
301 0 : return std::vector<std::string>();
302 : }
303 :
304 : /// @brief remove viewport
305 : void remove(GUIDialog_EditViewport*);
306 :
307 : /// @brief remove view settings
308 : void remove(GUIDialog_ViewSettings*);
309 :
310 : /// @brief get grid width
311 : // @todo: check why this is here
312 : double getGridWidth() const;
313 :
314 : /// @brief get grid height
315 : // @todo: check why this is here
316 : double getGridHeight() const;
317 :
318 : /// @brief star track
319 : virtual void startTrack(int /*id*/);
320 :
321 : /// @brief stop track
322 : virtual void stopTrack();
323 :
324 : /// @brief get tracked id
325 : virtual GUIGlID getTrackedID() const;
326 :
327 : /// @brief on gaming click
328 : virtual void onGamingClick(Position /*pos*/);
329 : virtual void onGamingRightClick(Position /*pos*/);
330 :
331 : /// @brief @name Additional visualisations
332 : ///@{
333 :
334 : /** @brief Adds an object to call its additional visualisation method
335 : * @param[in] which The object to add
336 : * @return Always true
337 : * @see GUIGlObject::drawGLAdditional
338 : */
339 : bool addAdditionalGLVisualisation(GUIGlObject* const which);
340 :
341 : /** @brief Removes an object from the list of objects that show additional things
342 : * @param[in] which The object to remove
343 : * @return True if the object was known, false otherwise
344 : * @see GUIGlObject::drawGLAdditional
345 : */
346 : bool removeAdditionalGLVisualisation(GUIGlObject* const which);
347 :
348 : /** @brief Check if an object is added in the additional GL visualitation
349 : * @param[in] which The object to check
350 : * @see GUIGlObject::drawGLAdditional
351 : */
352 : bool isAdditionalGLVisualisationEnabled(GUIGlObject* const which) const;
353 :
354 : ///@}
355 :
356 : /// @brief get position of current popup
357 : const Position& getPopupPosition() const;
358 :
359 : /// @brief destroys the popup
360 : void destroyPopup();
361 :
362 : /// @brief replace PopUp
363 : void replacePopup(GUIGLObjectPopupMenu* popUp);
364 :
365 : ///@struct Decal
366 : /// @brief A decal (an image) that can be shown
367 2072 : struct Decal {
368 :
369 : /// @brief Constructor
370 2048 : Decal() {};
371 :
372 : /// @brief The path to the file the image is located at
373 : std::string filename;
374 :
375 : /// @brief The center of the image in x-direction (net coordinates, in m)
376 : double centerX = 0;
377 :
378 : /// @brief The center of the image in y-direction (net coordinates, in m)
379 : double centerY = 0;
380 :
381 : /// @brief The center of the image in z-direction (net coordinates, in m)
382 : double centerZ = 0;
383 :
384 : /// @brief The width of the image (net coordinates in x-direction, in m)
385 : double width = 0;
386 :
387 : /// @brief The height of the image (net coordinates in y-direction, in m)
388 : double height = 0;
389 :
390 : /// @brief The altitude of the image (net coordinates in z-direction, in m)
391 : double altitude = 0;
392 :
393 : /// @brief The rotation of the image in the ground plane (in degrees)
394 : double rot = 0;
395 :
396 : /// @brief The tilt of the image to the ground plane (in degrees)
397 : double tilt = 0;
398 :
399 : /// @brief The roll of the image to the ground plane (in degrees)
400 : double roll = 0;
401 :
402 : /// @brief The layer of the image
403 : double layer = 0;
404 :
405 : /// @brief Whether this image was initialised (inserted as a texture)
406 : bool initialised = false;
407 :
408 : /// @brief Whether this image should be skipped in 2D-views
409 : bool skip2D = false;
410 :
411 : /// @brief Whether this image should be skipped in 2D-views
412 : bool screenRelative = false;
413 :
414 : /// @brief whether the decal shall be drawn in screen coordinates, rather than network coordinates
415 : int glID = -1;
416 :
417 : /// @brief The image pointer for later cleanup
418 : FXImage* image = nullptr;
419 : };
420 :
421 : /// @brief The list of decals to show
422 : std::vector<Decal>& getDecals();
423 :
424 : /// @brief The mutex to use before accessing the decals list in order to avoid thread conflicts
425 : FXMutex& getDecalsLockMutex();
426 :
427 : /// @brief get coloring schemes combo
428 : MFXComboBoxIcon* getColoringSchemesCombo();
429 :
430 : /// @brief Returns the cursor's x/y position within the network
431 : virtual Position getPositionInformation() const;
432 :
433 : /**@brief Returns a position that is mapped to the closest grid point if the grid is active
434 : * @brief note: formats are pos(x,y,0) por pos(0,0,z)
435 : */
436 : Position snapToActiveGrid(const Position& pos, bool snapXY = true) const;
437 :
438 : /// @brief Translate screen position to network position
439 : Position screenPos2NetPos(int x, int y) const;
440 :
441 : /// @brief add decals
442 : void addDecals(const std::vector<Decal>& decals);
443 :
444 : /// @brief Returns the delay of the parent application
445 : double getDelay() const;
446 :
447 : /// @brief Sets the delay of the parent application
448 : void setDelay(double delay);
449 :
450 : /// @brief Sets the breakpoints of the parent application
451 : void setBreakpoints(const std::vector<SUMOTime>& breakpoints);
452 :
453 : /// @brief retrieve breakpoints if provided by the application
454 0 : virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
455 0 : return std::vector<SUMOTime>();
456 : }
457 :
458 : /// @brief retrieve FPS
459 : double getFPS() const;
460 :
461 : /// @brief get GUIGlChildWindow
462 : GUIGlChildWindow* getGUIGlChildWindow();
463 :
464 : /// @brief Draw (or not) the JuPedSim pedestrian network
465 : /// @param s The visualization settings
466 0 : virtual void drawPedestrianNetwork(const GUIVisualizationSettings& /*s*/) const { };
467 :
468 : /// @brief Change the color of the JuPedSim pedestrian network
469 : /// @param s The visualization settings
470 0 : virtual void changePedestrianNetworkColor(const GUIVisualizationSettings& /*s*/) const { };
471 :
472 : protected:
473 : /// @brief FOX needs this
474 0 : FOX_CONSTRUCTOR(GUISUMOAbstractView)
475 :
476 : /// @brief performs the painting of the simulation
477 : void paintGL();
478 :
479 : /// @brief update position information labels
480 : virtual void updatePositionInformationLabel() const;
481 :
482 : /// @brief paint GL
483 : virtual int doPaintGL(int /*mode*/, const Boundary& /*boundary*/);
484 :
485 : /// @brief doInit
486 : virtual void doInit();
487 :
488 : /// @brief paints a grid
489 : void paintGLGrid() const;
490 :
491 : /// @brief Draws a line with ticks, and the length information.
492 : void displayLegend();
493 :
494 : /// @brief Draws the configured legends
495 : void displayLegends();
496 :
497 : /// @brief Draws a legend for the given scheme
498 : void displayColorLegend(const GUIColorScheme& scheme, bool leftSide);
499 :
500 : /// @brief Draws frames-per-second indicator
501 : void drawFPS();
502 :
503 : /// @brief returns the GUILane at cursor position (implementation depends on view)
504 : virtual GUILane* getLaneUnderCursor();
505 :
506 : /// @brief returns the id of object under cursor to show their tooltip
507 : virtual GUIGlID getToolTipID();
508 :
509 : /// @brief returns the id of the front object under the cursor using GL_SELECT
510 : GUIGlID getObjectUnderCursor();
511 :
512 : /// @brief returns the id of the objects under the cursor using GL_SELECT (including overlapped objects)
513 : std::vector<GUIGlID> getObjectsUnderCursor();
514 :
515 : /// @brief returns the GUIGlObject under the cursor using GL_SELECT (including overlapped objects)
516 : std::vector<GUIGlObject*> getGUIGlObjectsUnderCursor();
517 :
518 : /// @brief returns the GUIGlObject under the gripped cursor using GL_SELECT (including overlapped objects)
519 : std::vector<GUIGlObject*> getGUIGlObjectsUnderSnappedCursor();
520 :
521 : /// @brief returns the id of the object at position using GL_SELECT
522 : GUIGlID getObjectAtPosition(Position pos);
523 :
524 : /// @brief returns the ids of the object at position within the given (rectangular) radius using GL_SELECT
525 : std::vector<GUIGlID> getObjectsAtPosition(Position pos, double radius);
526 :
527 : /// @brief returns the GUIGlObjects at position within the given (rectangular) radius using GL_SELECT
528 : std::vector<GUIGlObject*> getGUIGlObjectsAtPosition(Position pos, double radius);
529 :
530 : /// @brief returns the ids of all objects in the given boundary
531 : std::vector<GUIGlID> getObjectsInBoundary(Boundary bound);
532 :
533 : /// @brief filter internal lanes in Objects under cursor
534 : std::vector<GUIGlObject*> filterInternalLanes(const std::vector<GUIGlObject*>& objects) const;
535 :
536 : /// @brief invokes the tooltip for the given object
537 : bool showToolTipFor(const GUIGlID idToolTip);
538 :
539 : /// @brief Draws the stored decals
540 : void drawDecals();
541 :
542 : /// @brief open popup dialog
543 : void openPopupDialog();
544 :
545 : /// @brief helper function for buildColorRainbow
546 : void buildMinMaxRainbow(const GUIVisualizationSettings& s, GUIColorScheme& scheme, const GUIVisualizationRainbowSettings& rs, double minValue, double maxValue, bool hasMissingData);
547 :
548 : /// @brief applies gl-transformations to fit the Boundary given by myChanger onto the canvas.
549 : /// If fixRatio is true, this boundary will be enlarged to prevent anisotropic stretching.
550 : /// (this should be set to false when doing selections)
551 : Boundary applyGLTransform(bool fixRatio = true);
552 :
553 : /// @brief check whether we can read image data or position with gdal
554 : FXImage* checkGDALImage(Decal& d);
555 :
556 : /// @brief The application
557 : GUIMainWindow* myApp;
558 :
559 : /// @brief The parent window
560 : GUIGlChildWindow* myGlChildWindowParent;
561 :
562 : /// @brief The visualization speed-up
563 : const SUMORTree* myGrid;
564 :
565 : /// @brief The perspective changer
566 : GUIPerspectiveChanger* myChanger = nullptr;
567 :
568 : /// @brief Panning flag
569 : bool myPanning = false;
570 :
571 : /// @brief Information whether too-tip informations shall be generated
572 : bool myInEditMode = false;
573 :
574 : /// @brief Offset to the mouse-hotspot from the mouse position
575 : int myMouseHotspotX, myMouseHotspotY;
576 :
577 : /// @brief The current popup-menu
578 : GUIGLObjectPopupMenu* myPopup = nullptr;
579 :
580 : /// @brief clicked poup position
581 : Position myClickedPopupPosition = Position::INVALID;
582 :
583 : /// @brief The current popup-menu position
584 : Position myPopupPosition = Position(0, 0);
585 :
586 : /// @brief vector with current objects dialog
587 : std::vector<GUIGlObject*> myCurrentObjectsDialog;
588 :
589 : /// @brief visualization settings
590 : GUIVisualizationSettings* myVisualizationSettings;
591 :
592 : /// @brief Internal information whether doInit() was called
593 : bool myAmInitialised = false;
594 :
595 : /// @brief viewport chooser
596 : GUIDialog_EditViewport* myGUIDialogEditViewport = nullptr;
597 :
598 : /// @brief Position of the cursor relative to the window
599 : FXint myWindowCursorPositionX, myWindowCursorPositionY;
600 :
601 : /// @brief Visualization changer
602 : GUIDialog_ViewSettings* myGUIDialogViewSettings = nullptr;
603 :
604 : /// @brief @name Optionally shown decals
605 : ///@{
606 :
607 : /// @brief The list of decals to show
608 : std::vector<Decal> myDecals;
609 :
610 : /// @brief The mutex to use before accessing the decals list in order to avoid thread conflicts
611 : FXMutex myDecalsLockMutex;
612 :
613 : ///@}
614 :
615 : /// @brief Snapshots
616 : std::map<SUMOTime, std::vector<std::tuple<std::string, int, int> > > mySnapshots;
617 :
618 : /// @brief The mutex to use before accessing the decals list in order to avoid thread conflicts
619 : FXMutex mySnapshotsMutex;
620 :
621 : /// @brief the semaphore when waiting for snapshots to finish
622 : FXCondition mySnapshotCondition;
623 :
624 : /// @brief poly draw lock
625 : mutable FXMutex myPolyDrawLock;
626 :
627 : /// @brief List of objects for which GUIGlObject::drawGLAdditional is called
628 : std::map<GUIGlObject*, int> myAdditionallyDrawn;
629 :
630 : /// @brief counter for measuring rendering time
631 : long myFrameDrawTime = 0;
632 :
633 : private:
634 : /// @brief struct used for sorting objects by layer
635 : struct LayerObject : public std::pair<double, std::pair<GUIGlObjectType, std::string> > {
636 :
637 : public:
638 : /// @brief constructor for shapes
639 : LayerObject(double layer, GUIGlObject* object);
640 :
641 : /// @brief constructor for non-shape elements
642 : LayerObject(GUIGlObject* object);
643 :
644 : /// @brief get GLObject
645 : GUIGlObject* getGLObject() const;
646 :
647 : private:
648 : /// @brief GLObject
649 : GUIGlObject* myGLObject;
650 : };
651 :
652 : // @brief sensitivity for "<>AtPosition(...) functions
653 : static const double SENSITIVITY;
654 : };
|