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 : bool hide = false, double hideThreshold = 0,
266 : bool hide2 = false, double hideThreshold2 = 0) {
267 : UNUSED_PARAMETER(hide);
268 : UNUSED_PARAMETER(hideThreshold);
269 : UNUSED_PARAMETER(hide2);
270 : UNUSED_PARAMETER(hideThreshold2);
271 0 : }
272 :
273 : /// @brief return list of loaded edgeData attributes
274 0 : virtual std::vector<std::string> getEdgeDataAttrs() const {
275 0 : return std::vector<std::string>();
276 : }
277 :
278 : /// @brief return list of loaded edgeData ids (being computed in the current simulation)
279 0 : virtual std::vector<std::string> getMeanDataIDs() const {
280 0 : return std::vector<std::string>();
281 : }
282 :
283 : /// @brief return list of available attributes for the given meanData id
284 0 : virtual std::vector<std::string> getMeanDataAttrs(const std::string& meanDataID) const {
285 : UNUSED_PARAMETER(meanDataID);
286 0 : return std::vector<std::string>();
287 : }
288 :
289 : /// @brief return list of loaded edgeRelation and tazRelation attributes
290 0 : virtual std::vector<std::string> getRelDataAttrs() const {
291 0 : return std::vector<std::string>();
292 : }
293 :
294 : /// @brief return list of available edge parameters
295 0 : virtual std::vector<std::string> getEdgeLaneParamKeys(bool /*edgeKeys*/) 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> getVehicleParamKeys(bool /*vTypeKeys*/) const {
301 0 : return std::vector<std::string>();
302 : }
303 :
304 : /// @brief return list of available vehicle parameters
305 0 : virtual std::vector<std::string> getPOIParamKeys() const {
306 0 : return std::vector<std::string>();
307 : }
308 :
309 : /// @brief remove viewport
310 : void remove(GUIDialog_EditViewport*);
311 :
312 : /// @brief remove view settings
313 : void remove(GUIDialog_ViewSettings*);
314 :
315 : /// @brief get grid width
316 : // @todo: check why this is here
317 : double getGridWidth() const;
318 :
319 : /// @brief get grid height
320 : // @todo: check why this is here
321 : double getGridHeight() const;
322 :
323 : /// @brief star track
324 : virtual void startTrack(int /*id*/);
325 :
326 : /// @brief stop track
327 : virtual void stopTrack();
328 :
329 : /// @brief get tracked id
330 : virtual GUIGlID getTrackedID() const;
331 :
332 : /// @brief on gaming click
333 : virtual void onGamingClick(Position /*pos*/);
334 : virtual void onGamingRightClick(Position /*pos*/);
335 :
336 : /// @brief @name Additional visualisations
337 : ///@{
338 :
339 : /** @brief Adds an object to call its additional visualisation method
340 : * @param[in] which The object to add
341 : * @return Always true
342 : * @see GUIGlObject::drawGLAdditional
343 : */
344 : bool addAdditionalGLVisualisation(GUIGlObject* const which);
345 :
346 : /** @brief Removes an object from the list of objects that show additional things
347 : * @param[in] which The object to remove
348 : * @return True if the object was known, false otherwise
349 : * @see GUIGlObject::drawGLAdditional
350 : */
351 : bool removeAdditionalGLVisualisation(GUIGlObject* const which);
352 :
353 : /** @brief Check if an object is added in the additional GL visualitation
354 : * @param[in] which The object to check
355 : * @see GUIGlObject::drawGLAdditional
356 : */
357 : bool isAdditionalGLVisualisationEnabled(GUIGlObject* const which) const;
358 :
359 : ///@}
360 :
361 : /// @brief get position of current popup
362 : const Position& getPopupPosition() const;
363 :
364 : /// @brief destroys the popup
365 : void destroyPopup();
366 :
367 : /// @brief replace PopUp
368 : void replacePopup(GUIGLObjectPopupMenu* popUp);
369 :
370 : ///@struct Decal
371 : /// @brief A decal (an image) that can be shown
372 1925 : struct Decal {
373 :
374 : /// @brief Constructor
375 1904 : Decal() {};
376 :
377 : /// @brief The path to the file the image is located at
378 : std::string filename;
379 :
380 : /// @brief The center of the image in x-direction (net coordinates, in m)
381 : double centerX = 0;
382 :
383 : /// @brief The center of the image in y-direction (net coordinates, in m)
384 : double centerY = 0;
385 :
386 : /// @brief The center of the image in z-direction (net coordinates, in m)
387 : double centerZ = 0;
388 :
389 : /// @brief The width of the image (net coordinates in x-direction, in m)
390 : double width = 0;
391 :
392 : /// @brief The height of the image (net coordinates in y-direction, in m)
393 : double height = 0;
394 :
395 : /// @brief The altitude of the image (net coordinates in z-direction, in m)
396 : double altitude = 0;
397 :
398 : /// @brief The rotation of the image in the ground plane (in degrees)
399 : double rot = 0;
400 :
401 : /// @brief The tilt of the image to the ground plane (in degrees)
402 : double tilt = 0;
403 :
404 : /// @brief The roll of the image to the ground plane (in degrees)
405 : double roll = 0;
406 :
407 : /// @brief The layer of the image
408 : double layer = 0;
409 :
410 : /// @brief Whether this image was initialised (inserted as a texture)
411 : bool initialised = false;
412 :
413 : /// @brief Whether this image should be skipped in 2D-views
414 : bool skip2D = false;
415 :
416 : /// @brief Whether this image should be skipped in 2D-views
417 : bool screenRelative = false;
418 :
419 : /// @brief whether the decal shall be drawn in screen coordinates, rather than network coordinates
420 : int glID = -1;
421 :
422 : /// @brief The image pointer for later cleanup
423 : FXImage* image = nullptr;
424 : };
425 :
426 : /// @brief The list of decals to show
427 : std::vector<Decal>& getDecals();
428 :
429 : /// @brief The mutex to use before accessing the decals list in order to avoid thread conflicts
430 : FXMutex& getDecalsLockMutex();
431 :
432 : /// @brief get coloring schemes combo
433 : MFXComboBoxIcon* getColoringSchemesCombo();
434 :
435 : /// @brief Returns the cursor's x/y position within the network
436 : virtual Position getPositionInformation() const;
437 :
438 : /**@brief Returns a position that is mapped to the closest grid point if the grid is active
439 : * @brief note: formats are pos(x,y,0) por pos(0,0,z)
440 : */
441 : Position snapToActiveGrid(const Position& pos, bool snapXY = true) const;
442 :
443 : /// @brief Translate screen position to network position
444 : Position screenPos2NetPos(int x, int y) const;
445 :
446 : /// @brief add decals
447 : void addDecals(const std::vector<Decal>& decals);
448 :
449 : /// @brief Returns the delay of the parent application
450 : double getDelay() const;
451 :
452 : /// @brief Sets the delay of the parent application
453 : void setDelay(double delay);
454 :
455 : /// @brief Sets the breakpoints of the parent application
456 : void setBreakpoints(const std::vector<SUMOTime>& breakpoints);
457 :
458 : /// @brief retrieve breakpoints if provided by the application
459 0 : virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
460 0 : return std::vector<SUMOTime>();
461 : }
462 :
463 : /// @brief retrieve FPS
464 : double getFPS() const;
465 :
466 : /// @brief get GUIGlChildWindow
467 : GUIGlChildWindow* getGUIGlChildWindow();
468 :
469 : /// @brief Draw (or not) the JuPedSim pedestrian network
470 : /// @param s The visualization settings
471 0 : virtual void drawPedestrianNetwork(const GUIVisualizationSettings& /*s*/) const { };
472 :
473 : /// @brief Change the color of the JuPedSim pedestrian network
474 : /// @param s The visualization settings
475 0 : virtual void changePedestrianNetworkColor(const GUIVisualizationSettings& /*s*/) const { };
476 :
477 : protected:
478 : /// @brief FOX needs this
479 0 : FOX_CONSTRUCTOR(GUISUMOAbstractView)
480 :
481 : /// @brief performs the painting of the simulation
482 : void paintGL();
483 :
484 : /// @brief update position information labels
485 : virtual void updatePositionInformationLabel() const;
486 :
487 : /// @brief paint GL
488 : virtual int doPaintGL(int /*mode*/, const Boundary& /*boundary*/);
489 :
490 : /// @brief doInit
491 : virtual void doInit();
492 :
493 : /// @brief paints a grid
494 : void paintGLGrid() const;
495 :
496 : /// @brief Draws a line with ticks, and the length information.
497 : void displayLegend();
498 :
499 : /// @brief Draws the configured legends
500 : void displayLegends();
501 :
502 : /// @brief Draws a legend for the given scheme
503 : void displayColorLegend(const GUIColorScheme& scheme, bool leftSide);
504 :
505 : /// @brief Draws frames-per-second indicator
506 : void drawFPS();
507 :
508 : /// @brief returns the GUILane at cursor position (implementation depends on view)
509 : virtual GUILane* getLaneUnderCursor();
510 :
511 : /// @brief returns the id of object under cursor to show their tooltip
512 : virtual GUIGlID getToolTipID();
513 :
514 : /// @brief returns the id of the front object under the cursor using GL_SELECT
515 : GUIGlID getObjectUnderCursor();
516 :
517 : /// @brief returns the id of the objects under the cursor using GL_SELECT (including overlapped objects)
518 : std::vector<GUIGlID> getObjectsUnderCursor();
519 :
520 : /// @brief returns the GUIGlObject under the cursor using GL_SELECT (including overlapped objects)
521 : std::vector<GUIGlObject*> getGUIGlObjectsUnderCursor();
522 :
523 : /// @brief returns the GUIGlObject under the gripped cursor using GL_SELECT (including overlapped objects)
524 : std::vector<GUIGlObject*> getGUIGlObjectsUnderSnappedCursor();
525 :
526 : /// @brief returns the id of the object at position using GL_SELECT
527 : GUIGlID getObjectAtPosition(Position pos);
528 :
529 : /// @brief returns the ids of the object at position within the given (rectangular) radius using GL_SELECT
530 : std::vector<GUIGlID> getObjectsAtPosition(Position pos, double radius);
531 :
532 : /// @brief returns the GUIGlObjects at position within the given (rectangular) radius using GL_SELECT
533 : std::vector<GUIGlObject*> getGUIGlObjectsAtPosition(Position pos, double radius);
534 :
535 : /// @brief returns the ids of all objects in the given boundary
536 : std::vector<GUIGlID> getObjectsInBoundary(Boundary bound);
537 :
538 : /// @brief filter internal lanes in Objects under cursor
539 : std::vector<GUIGlObject*> filterInternalLanes(const std::vector<GUIGlObject*>& objects) const;
540 :
541 : /// @brief invokes the tooltip for the given object
542 : bool showToolTipFor(const GUIGlID idToolTip);
543 :
544 : /// @brief Draws the stored decals
545 : void drawDecals();
546 :
547 : /// @brief open popup dialog
548 : void openPopupDialog();
549 :
550 : /// @brief applies gl-transformations to fit the Boundary given by myChanger onto the canvas.
551 : /// If fixRatio is true, this boundary will be enlarged to prevent anisotropic stretching.
552 : /// (this should be set to false when doing selections)
553 : Boundary applyGLTransform(bool fixRatio = true);
554 :
555 : /// @brief check whether we can read image data or position with gdal
556 : FXImage* checkGDALImage(Decal& d);
557 :
558 : /// @brief The application
559 : GUIMainWindow* myApp;
560 :
561 : /// @brief The parent window
562 : GUIGlChildWindow* myGlChildWindowParent;
563 :
564 : /// @brief The visualization speed-up
565 : const SUMORTree* myGrid;
566 :
567 : /// @brief The perspective changer
568 : GUIPerspectiveChanger* myChanger = nullptr;
569 :
570 : /// @brief Panning flag
571 : bool myPanning = false;
572 :
573 : /// @brief Information whether too-tip informations shall be generated
574 : bool myInEditMode = false;
575 :
576 : /// @brief Offset to the mouse-hotspot from the mouse position
577 : int myMouseHotspotX, myMouseHotspotY;
578 :
579 : /// @brief The current popup-menu
580 : GUIGLObjectPopupMenu* myPopup = nullptr;
581 :
582 : /// @brief clicked poup position
583 : Position myClickedPopupPosition = Position::INVALID;
584 :
585 : /// @brief The current popup-menu position
586 : Position myPopupPosition = Position(0, 0);
587 :
588 : /// @brief vector with current objects dialog
589 : std::vector<GUIGlObject*> myCurrentObjectsDialog;
590 :
591 : /// @brief visualization settings
592 : GUIVisualizationSettings* myVisualizationSettings;
593 :
594 : /// @brief Internal information whether doInit() was called
595 : bool myAmInitialised = false;
596 :
597 : /// @brief viewport chooser
598 : GUIDialog_EditViewport* myGUIDialogEditViewport = nullptr;
599 :
600 : /// @brief Position of the cursor relative to the window
601 : FXint myWindowCursorPositionX, myWindowCursorPositionY;
602 :
603 : /// @brief Visualization changer
604 : GUIDialog_ViewSettings* myGUIDialogViewSettings = nullptr;
605 :
606 : /// @brief @name Optionally shown decals
607 : ///@{
608 :
609 : /// @brief The list of decals to show
610 : std::vector<Decal> myDecals;
611 :
612 : /// @brief The mutex to use before accessing the decals list in order to avoid thread conflicts
613 : FXMutex myDecalsLockMutex;
614 :
615 : ///@}
616 :
617 : /// @brief Snapshots
618 : std::map<SUMOTime, std::vector<std::tuple<std::string, int, int> > > mySnapshots;
619 :
620 : /// @brief The mutex to use before accessing the decals list in order to avoid thread conflicts
621 : FXMutex mySnapshotsMutex;
622 :
623 : /// @brief the semaphore when waiting for snapshots to finish
624 : FXCondition mySnapshotCondition;
625 :
626 : /// @brief poly draw lock
627 : mutable FXMutex myPolyDrawLock;
628 :
629 : /// @brief List of objects for which GUIGlObject::drawGLAdditional is called
630 : std::map<GUIGlObject*, int> myAdditionallyDrawn;
631 :
632 : /// @brief counter for measuring rendering time
633 : long myFrameDrawTime = 0;
634 :
635 : private:
636 : /// @brief struct used for sorting objects by layer
637 : struct LayerObject : public std::pair<double, std::pair<GUIGlObjectType, std::string> > {
638 :
639 : public:
640 : /// @brief constructor for shapes
641 : LayerObject(double layer, GUIGlObject* object);
642 :
643 : /// @brief constructor for non-shape elements
644 : LayerObject(GUIGlObject* object);
645 :
646 : /// @brief get GLObject
647 : GUIGlObject* getGLObject() const;
648 :
649 : private:
650 : /// @brief GLObject
651 : GUIGlObject* myGLObject;
652 : };
653 :
654 : // @brief sensitivity for "<>AtPosition(...) functions
655 : static const double SENSITIVITY;
656 : };
|