SUMO - Simulation of Urban MObility
ShapeHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // The XML-Handler for network loading
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 ShapeHandler_h
21 #define ShapeHandler_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 #include <utils/common/RGBColor.h>
34 #include <utils/geom/Position.h>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class ShapeContainer;
42 class Parameterised;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
56 class ShapeHandler : public SUMOSAXHandler {
57 public:
66  ShapeHandler(const std::string& file, ShapeContainer& sc);
67 
69  virtual ~ShapeHandler();
70 
72  static bool loadFiles(const std::vector<std::string>& files, ShapeHandler& sh);
73 
74 protected:
76 
77 
85  virtual void myStartElement(int element,
86  const SUMOSAXAttributes& attrs);
87 
95  virtual void myEndElement(int element);
97 
99  virtual Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat) = 0;
100 
102  virtual bool addLanePosParams() {
103  return false;
104  }
105 
106 protected:
108  void setDefaults(const std::string& prefix, const RGBColor& color, const double layer, const bool fill = false);
109 
111  void addPOI(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
112 
114  void addPoly(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
115 
116 protected:
118 
119 private:
121  std::string myPrefix;
122 
125 
128 
131 
134 
137 
138 private:
140  ShapeHandler(const ShapeHandler& s) = delete;
141 
143  ShapeHandler& operator=(const ShapeHandler& s) = delete;
144 };
145 
146 
147 #endif
148 
149 /****************************************************************************/
150 
double myDefaultLayer
The default layer to use.
Definition: ShapeHandler.h:127
ShapeHandler(const std::string &file, ShapeContainer &sc)
Constructor.
void setDefaults(const std::string &prefix, const RGBColor &color, const double layer, const bool fill=false)
set default values
virtual void myEndElement(int element)
Called when a closing tag occurs.
virtual Position getLanePos(const std::string &poiID, const std::string &laneID, double lanePos, double lanePosLat)=0
get position for a given laneID
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Storage for geometrical objects.
RGBColor myDefaultColor
The default color to use.
Definition: ShapeHandler.h:124
Parameterised * myLastParameterised
element to receive parameters
Definition: ShapeHandler.h:136
SAX-handler base for SUMO-files.
std::string myPrefix
The prefix to use.
Definition: ShapeHandler.h:121
The XML-Handler for network loading.
Definition: ShapeHandler.h:56
ShapeHandler & operator=(const ShapeHandler &s)=delete
invalidate assignment operator
Encapsulated SAX-Attributes.
virtual bool addLanePosParams()
Whether some input attributes shall be automatically added as params.
Definition: ShapeHandler.h:102
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void addPOI(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a POI
bool myDefaultFill
Information whether polygons should be filled.
Definition: ShapeHandler.h:130
An upper class for objects with additional parameters.
Definition: Parameterised.h:51
void addPoly(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a polygon
virtual ~ShapeHandler()
Destructor.
ShapeContainer & myShapeContainer
Definition: ShapeHandler.h:117
bool myReportFile
flag to check if problems hast to be handled as errors instead warnings
Definition: ShapeHandler.h:133