Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
ShapeHandler.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-2024 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// The XML-Handler for network loading
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
24#include <utils/geom/Position.h>
26
27
28// ===========================================================================
29// class declarations
30// ===========================================================================
31class ShapeContainer;
32class Parameterised;
33class GeoConvHelper;
34
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
48public:
57 ShapeHandler(const std::string& file, ShapeContainer& sc, const GeoConvHelper* = nullptr);
58
60 virtual ~ShapeHandler();
61
63 static bool loadFiles(const std::vector<std::string>& files, ShapeHandler& sh);
64
65protected:
67
68
76 virtual void myStartElement(int element, const SUMOSAXAttributes& attrs);
77
85 virtual void myEndElement(int element);
87
89 virtual Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos, bool friendlyPos, double lanePosLat) = 0;
90
92 virtual bool addLanePosParams();
93
94protected:
96 void setDefaults(const std::string& prefix, const RGBColor& color, const std::string& icon, const double layer, const bool fill = false);
97
99 void addPOI(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
100
102 void addPoly(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
103
106
107protected:
110
112 std::string myPrefix;
113
116
118 std::string myDefaultIcon;
119
122
125
128
131
133 ShapeHandler(const ShapeHandler& s) = delete;
134
137};
static methods for processing the coordinates conversion for the current net
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.
Storage for geometrical objects.
The XML-Handler for network loading.
virtual bool addLanePosParams()
Whether some input attributes shall be automatically added as params (Can be implemented in all child...
std::string myPrefix
The prefix to use.
ShapeHandler(const ShapeHandler &s)=delete
invalidate copy constructor
virtual void myEndElement(int element)
Called when a closing tag occurs.
void addPOI(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a POI
void addPoly(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a polygon
RGBColor myDefaultColor
The default color to use.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
ShapeContainer & myShapeContainer
reference to shape container in which all Shares are being added
Parameterised * myLastParameterised
element to receive parameters
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
virtual Position getLanePos(const std::string &poiID, const std::string &laneID, double lanePos, bool friendlyPos, double lanePosLat)=0
get position for a given laneID (Has to be implemented in all child)
void setDefaults(const std::string &prefix, const RGBColor &color, const std::string &icon, const double layer, const bool fill=false)
set default values
bool myDefaultFill
Information whether polygons should be filled.
virtual ~ShapeHandler()
Destructor.
Parameterised * getLastParameterised() const
get last parameterised object
std::string myDefaultIcon
The default icon to use.
ShapeHandler & operator=(const ShapeHandler &s)=delete
invalidate assignment operator
const GeoConvHelper * myGeoConvHelper
geo-conversion to use during loading
double myDefaultLayer
The default layer to use.