SUMO - Simulation of Urban MObility
GUIOSGBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // Builds OSG nodes from microsim objects
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef GUIOSGBuilder_h
21 #define GUIOSGBuilder_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #ifdef HAVE_OSG
34 
35 #include <map>
36 #include <osg/ref_ptr>
37 #include "GUIOSGView.h"
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 namespace osg {
44 class Node;
45 class Group;
46 class PositionAttitudeTransform;
47 }
48 namespace osgUtil {
49 class Tessellator;
50 }
51 class MSVehicleType;
52 class MSEdge;
53 class GUIJunctionWrapper;
54 
55 
56 // ===========================================================================
57 // class definitions
58 // ===========================================================================
63 class GUIOSGBuilder {
64 public:
65  static osg::Group* buildOSGScene(osg::Node* const tlg, osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu);
66 
67  static void buildDecal(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
68 
69  static void buildLight(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
70 
71  static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const double size = 0.5);
72 
73  static GUIOSGView::OSGMovable buildMovable(const MSVehicleType& type);
74 
75 private:
76  static void buildOSGEdgeGeometry(const MSEdge& edge,
77  osg::Group& addTo, osgUtil::Tessellator& tessellator);
78 
79  static void buildOSGJunctionGeometry(GUIJunctionWrapper& junction,
80  osg::Group& addTo, osgUtil::Tessellator& tessellator);
81 
82  static void setShapeState(osg::ref_ptr<osg::ShapeDrawable> shape);
83 
84 private:
85  static std::map<std::string, osg::ref_ptr<osg::Node> > myCars;
86 
87 };
88 
89 
90 #endif
91 
92 #endif
93 
94 /****************************************************************************/
95 
A decal (an image) that can be shown.
The car-following model and parameter.
Definition: MSVehicleType.h:74
A road/street connecting two junctions.
Definition: MSEdge.h:80