Eclipse SUMO - Simulation of Urban MObility
GUIOSGBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 /****************************************************************************/
18 // Builds OSG nodes from microsim objects
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #ifdef HAVE_OSG
24 
25 #include "GUIOSGView.h"
26 
27 #include <map>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 
34 namespace osg {
35 class Node;
36 class Group;
37 class PositionAttitudeTransform;
38 }
39 
40 namespace osgUtil {
41 class Tessellator;
42 }
43 
44 class MSVehicleType;
45 class MSEdge;
46 class GUIJunctionWrapper;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
56 class GUIOSGBuilder {
57 public:
58  static osg::Group* buildOSGScene(osg::Node* const tlg, osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu);
59 
60  static void buildDecal(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
61 
62  static void buildLight(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
63 
64  static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const double size = 0.5);
65 
66  static GUIOSGView::OSGMovable buildMovable(const MSVehicleType& type);
67 
68 private:
69  static void buildOSGEdgeGeometry(const MSEdge& edge,
70  osg::Group& addTo, osgUtil::Tessellator& tessellator);
71 
72  static void buildOSGJunctionGeometry(GUIJunctionWrapper& junction,
73  osg::Group& addTo, osgUtil::Tessellator& tessellator);
74 
75  static void setShapeState(osg::ref_ptr<osg::ShapeDrawable> shape);
76 
77  static std::map<std::string, osg::ref_ptr<osg::Node> > myCars;
78 };
79 
80 
81 #endif
A road/street connecting two junctions.
Definition: MSEdge.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:62
Definition: Node.h:39
A decal (an image) that can be shown.