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-2020 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 <map>
26 #include "GUIOSGView.h"
27 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 namespace osg {
33 class Node;
34 class Group;
35 class PositionAttitudeTransform;
36 }
37 namespace osgUtil {
38 class Tessellator;
39 }
40 class MSVehicleType;
41 class MSEdge;
42 class GUIJunctionWrapper;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
52 class GUIOSGBuilder {
53 public:
54  static osg::Group* buildOSGScene(osg::Node* const tlg, osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu);
55 
56  static void buildDecal(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
57 
58  static void buildLight(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
59 
60  static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const double size = 0.5);
61 
62  static GUIOSGView::OSGMovable buildMovable(const MSVehicleType& type);
63 
64 private:
65  static void buildOSGEdgeGeometry(const MSEdge& edge,
66  osg::Group& addTo, osgUtil::Tessellator& tessellator);
67 
68  static void buildOSGJunctionGeometry(GUIJunctionWrapper& junction,
69  osg::Group& addTo, osgUtil::Tessellator& tessellator);
70 
71  static void setShapeState(osg::ref_ptr<osg::ShapeDrawable> shape);
72 
73 private:
74  static std::map<std::string, osg::ref_ptr<osg::Node> > myCars;
75 
76 };
77 
78 
79 #endif
A road/street connecting two junctions.
Definition: MSEdge.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:62
Definition: Node.h:31
A decal (an image) that can be shown.