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 /****************************************************************************/
15 // Builds OSG nodes from microsim objects
16 /****************************************************************************/
17 #ifndef GUIOSGBuilder_h
18 #define GUIOSGBuilder_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #ifdef HAVE_OSG
27 
28 #include <map>
29 #include <osg/ref_ptr>
30 #include "GUIOSGView.h"
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 namespace osg {
37 class Node;
38 class Group;
39 class PositionAttitudeTransform;
40 }
41 namespace osgUtil {
42 class Tessellator;
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 private:
78  static std::map<std::string, osg::ref_ptr<osg::Node> > myCars;
79 
80 };
81 
82 
83 #endif
84 
85 #endif
86 
87 /****************************************************************************/
88 
A decal (an image) that can be shown.
The car-following model and parameter.
Definition: MSVehicleType.h:66
A road/street connecting two junctions.
Definition: MSEdge.h:76