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-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 /****************************************************************************/
14 // Builds OSG nodes from microsim objects
15 /****************************************************************************/
16 #ifndef GUIOSGBuilder_h
17 #define GUIOSGBuilder_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #ifdef HAVE_OSG
26 
27 #include <map>
28 #include <osg/ref_ptr>
29 #include "GUIOSGView.h"
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 namespace osg {
36 class Node;
37 class Group;
38 class PositionAttitudeTransform;
39 }
40 namespace osgUtil {
41 class Tessellator;
42 }
43 class MSVehicleType;
44 class MSEdge;
45 class GUIJunctionWrapper;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
55 class GUIOSGBuilder {
56 public:
57  static osg::Group* buildOSGScene(osg::Node* const tlg, osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu);
58 
59  static void buildDecal(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
60 
61  static void buildLight(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
62 
63  static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const double size = 0.5);
64 
65  static GUIOSGView::OSGMovable buildMovable(const MSVehicleType& type);
66 
67 private:
68  static void buildOSGEdgeGeometry(const MSEdge& edge,
69  osg::Group& addTo, osgUtil::Tessellator& tessellator);
70 
71  static void buildOSGJunctionGeometry(GUIJunctionWrapper& junction,
72  osg::Group& addTo, osgUtil::Tessellator& tessellator);
73 
74  static void setShapeState(osg::ref_ptr<osg::ShapeDrawable> shape);
75 
76 private:
77  static std::map<std::string, osg::ref_ptr<osg::Node> > myCars;
78 
79 };
80 
81 
82 #endif
83 
84 #endif
85 
86 /****************************************************************************/
87 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
GUIJunctionWrapper
Definition: GUIJunctionWrapper.h:60
GUIOSGView.h
config.h
GUISUMOAbstractView::Decal
A decal (an image) that can be shown.
Definition: GUISUMOAbstractView.h:303