Eclipse SUMO - Simulation of Urban MObility
ShapeHandler.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 /****************************************************************************/
14 // The XML-Handler for network loading
15 /****************************************************************************/
16 #ifndef ShapeHandler_h
17 #define ShapeHandler_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <utils/common/RGBColor.h>
26 #include <utils/geom/Position.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class ShapeContainer;
34 class Parameterised;
35 class GeoConvHelper;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
49 class ShapeHandler : public SUMOSAXHandler {
50 public:
59  ShapeHandler(const std::string& file, ShapeContainer& sc, const GeoConvHelper* = nullptr);
60 
62  virtual ~ShapeHandler();
63 
65  static bool loadFiles(const std::vector<std::string>& files, ShapeHandler& sh);
66 
67 protected:
69 
70 
78  virtual void myStartElement(int element, const SUMOSAXAttributes& attrs);
79 
87  virtual void myEndElement(int element);
89 
91  virtual Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat) = 0;
92 
94  virtual bool addLanePosParams();
95 
96 protected:
98  void setDefaults(const std::string& prefix, const RGBColor& color, const double layer, const bool fill = false);
99 
101  void addPOI(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
102 
104  void addPoly(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
105 
108 
109 protected:
112 
114  std::string myPrefix;
115 
118 
121 
124 
127 
130 
132  ShapeHandler(const ShapeHandler& s) = delete;
133 
135  ShapeHandler& operator=(const ShapeHandler& s) = delete;
136 };
137 
138 
139 #endif
140 
141 /****************************************************************************/
142 
ShapeHandler::~ShapeHandler
virtual ~ShapeHandler()
Destructor.
Definition: ShapeHandler.cpp:56
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:42
ShapeHandler::myLastParameterised
Parameterised * myLastParameterised
element to receive parameters
Definition: ShapeHandler.h:126
ShapeHandler::getLastParameterised
Parameterised * getLastParameterised() const
get last parameterised object
Definition: ShapeHandler.cpp:267
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:41
ShapeHandler::getLanePos
virtual Position getLanePos(const std::string &poiID, const std::string &laneID, double lanePos, double lanePosLat)=0
get position for a given laneID (Has to be implemented in all child)
SUMOSAXHandler.h
ShapeHandler::addPoly
void addPoly(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a polygon
Definition: ShapeHandler.cpp:201
ShapeHandler::operator=
ShapeHandler & operator=(const ShapeHandler &s)=delete
invalidate assignment operator
ShapeHandler::myDefaultFill
bool myDefaultFill
Information whether polygons should be filled.
Definition: ShapeHandler.h:123
ShapeContainer
Storage for geometrical objects.
Definition: ShapeContainer.h:49
ShapeHandler::loadFiles
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
Definition: ShapeHandler.cpp:273
ShapeHandler::addLanePosParams
virtual bool addLanePosParams()
Whether some input attributes shall be automatically added as params (Can be implemented in all child...
Definition: ShapeHandler.cpp:294
ShapeHandler::myStartElement
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: ShapeHandler.cpp:60
GeoConvHelper
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:55
ShapeHandler::myGeoConvHelper
const GeoConvHelper * myGeoConvHelper
geo-conversion to use during loading
Definition: ShapeHandler.h:129
RGBColor.h
ShapeHandler::addPOI
void addPOI(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a POI
Definition: ShapeHandler.cpp:112
RGBColor
Definition: RGBColor.h:39
ShapeHandler::setDefaults
void setDefaults(const std::string &prefix, const RGBColor &color, const double layer, const bool fill=false)
set default values
Definition: ShapeHandler.cpp:285
ShapeHandler::ShapeHandler
ShapeHandler(const ShapeHandler &s)=delete
invalidate copy constructor
ShapeHandler::myDefaultColor
RGBColor myDefaultColor
The default color to use.
Definition: ShapeHandler.h:117
ShapeHandler::myEndElement
virtual void myEndElement(int element)
Called when a closing tag occurs.
Definition: ShapeHandler.cpp:104
ShapeHandler::myDefaultLayer
double myDefaultLayer
The default layer to use.
Definition: ShapeHandler.h:120
ShapeHandler::ShapeHandler
ShapeHandler(const std::string &file, ShapeContainer &sc, const GeoConvHelper *=nullptr)
Constructor.
Definition: ShapeHandler.cpp:44
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Position.h
ShapeHandler::myShapeContainer
ShapeContainer & myShapeContainer
reference to shape container in which all Shares are being added
Definition: ShapeHandler.h:111
config.h
ShapeHandler
The XML-Handler for network loading.
Definition: ShapeHandler.h:49
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
ShapeHandler::myPrefix
std::string myPrefix
The prefix to use.
Definition: ShapeHandler.h:114