SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ShapeHandler.h
Go to the documentation of this file.
1 
2 /****************************************************************************/
8 // The XML-Handler for network loading
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef ShapeHandler_h
22 #define ShapeHandler_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <utils/common/RGBColor.h>
35 #include <utils/geom/Position.h>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class ShapeContainer;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
56 class ShapeHandler : public SUMOSAXHandler {
57 public:
58 
59 public:
69  ShapeHandler(const std::string& file, ShapeContainer& sc);
70 
72  virtual ~ShapeHandler();
73 
75  static bool loadFiles(const std::vector<std::string>& files, ShapeHandler& sh);
76 
77 
78 protected:
80 
81 
90  virtual void myStartElement(int element,
91  const SUMOSAXAttributes& attrs);
92 
93 
95 
96 
98  virtual Position getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos) = 0;
99 
100 protected:
101  void setDefaults(const std::string& prefix, const RGBColor& color, const SUMOReal layer, const bool fill = false);
102 
104  void addPOI(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
105 
107  void addPoly(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing);
108 
109 protected:
111 
112 private:
114  std::string myPrefix;
121 
122 private:
124  ShapeHandler(const ShapeHandler& s);
125 
128 
129 };
130 
131 
132 #endif
133 
134 /****************************************************************************/
135 
ShapeHandler(const std::string &file, ShapeContainer &sc)
Constructor.
ShapeHandler & operator=(const ShapeHandler &s)
SUMOReal myDefaultLayer
The default layer to use.
Definition: ShapeHandler.h:118
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:116
SAX-handler base for SUMO-files.
std::string myPrefix
The prefix to use.
Definition: ShapeHandler.h:114
The XML-Handler for network loading.
Definition: ShapeHandler.h:56
Encapsulated SAX-Attributes.
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:120
virtual Position getLanePos(const std::string &poiID, const std::string &laneID, SUMOReal lanePos)=0
get position for a given laneID
void addPoly(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a polygon
virtual ~ShapeHandler()
Destructor.
void setDefaults(const std::string &prefix, const RGBColor &color, const SUMOReal layer, const bool fill=false)
ShapeContainer & myShapeContainer
Definition: ShapeHandler.h:110
#define SUMOReal
Definition: config.h:214