Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIOSGBuilder.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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 "GUIOSGView.h"
26
27#include <map>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33
34namespace osg {
35class Node;
36class Group;
37class PositionAttitudeTransform;
38}
39
40namespace osgUtil {
41class Tessellator;
42}
43
44class MSVehicleType;
45class MSEdge;
47class SUMOPolygon;
48class PointOfInterest;
49
50// ===========================================================================
51// class definitions
52// ===========================================================================
57class GUIOSGBuilder {
58public:
59 static osg::Group* buildOSGScene(osg::Node* const tlg, osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu, osg::Node* const pole);
60
61 static void buildDecal(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
62
63 static void buildLight(const GUISUMOAbstractView::Decal& d, osg::Group& addTo);
64
66 static void buildTrafficLightDetails(MSTLLogicControl::TLSLogicVariants& vars, osg::Node* const tlg, osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu, osg::Node* poleBase, osg::Group& addTo);
67
68 static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, MSTLLogicControl::TLSLogicVariants& vars, const MSLink* link, osg::Node* const tlg,
69 osg::Node* const tly, osg::Node* const tlr, osg::Node* const tlu, osg::Node* const pole, const bool withPole = false, const double size = -1, double poleHeight = 1.8, double transparency = .3);
70
71 static GUIOSGView::OSGMovable buildMovable(const MSVehicleType& type);
72
73 static osg::Node* buildPlane(const float length = 1000.f); // OSG needs float coordinates here
74
75private:
76 static osg::PositionAttitudeTransform* createTrafficLightState(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const double withPole, const double size, osg::Vec4d color);
77
78 static void buildOSGEdgeGeometry(const MSEdge& edge,
79 osg::Group& addTo, osgUtil::Tessellator& tessellator);
80
81 static void buildOSGJunctionGeometry(GUIJunctionWrapper& junction,
82 osg::Group& addTo, osgUtil::Tessellator& tessellator);
83
84 static void buildPolygonGeometry(const SUMOPolygon& poly, osg::Group& addTo, osgUtil::Tessellator& tessellator);
85 static void buildPoIGeometry(const PointOfInterest& poi, osg::Group& addTo, osgUtil::Tessellator& tessellator);
86
87 static void setShapeState(osg::ref_ptr<osg::ShapeDrawable> shape);
88
89 static std::map<std::string, osg::ref_ptr<osg::Node> > myCars;
90};
91
92
93#endif
A road/street connecting two junctions.
Definition MSEdge.h:77
Storage for all programs of a single tls.
The car-following model and parameter.
Definition Node.h:39
A point-of-interest.
A decal (an image) that can be shown.