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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // Builds OSG nodes from microsim objects
18 /****************************************************************************/
19 #ifndef GUIOSGBuilder_h
20 #define GUIOSGBuilder_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #ifdef HAVE_OSG
33 
34 #include <map>
35 #include <osg/ref_ptr>
36 #include "GUIOSGView.h"
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 namespace osg {
43 class Node;
44 class Group;
45 class PositionAttitudeTransform;
46 }
47 namespace osgUtil {
48 class Tessellator;
49 }
50 class MSVehicleType;
51 class MSEdge;
52 class GUIJunctionWrapper;
53 
54 
55 // ===========================================================================
56 // class definitions
57 // ===========================================================================
62 class GUIOSGBuilder {
63 public:
64  static osg::Group* buildOSGScene(osg::Node* const tlg, osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu);
65 
66  static void buildDecal(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
67 
68  static void buildLight(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
69 
70  static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const double size = 0.5);
71 
72  static GUIOSGView::OSGMovable buildMovable(const MSVehicleType& type);
73 
74 private:
75  static void buildOSGEdgeGeometry(const MSEdge& edge,
76  osg::Group& addTo, osgUtil::Tessellator& tessellator);
77 
78  static void buildOSGJunctionGeometry(GUIJunctionWrapper& junction,
79  osg::Group& addTo, osgUtil::Tessellator& tessellator);
80 
81  static void setShapeState(osg::ref_ptr<osg::ShapeDrawable> shape);
82 
83 private:
84  static std::map<std::string, osg::ref_ptr<osg::Node> > myCars;
85 
86 };
87 
88 
89 #endif
90 
91 #endif
92 
93 /****************************************************************************/
94 
A decal (an image) that can be shown.
The car-following model and parameter.
Definition: MSVehicleType.h:72
A road/street connecting two junctions.
Definition: MSEdge.h:80