Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
PCPolyContainer.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2005-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/****************************************************************************/
20// A storage for loaded polygons and pois
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include <string>
26#include <map>
27#include <vector>
29
30
31// ===========================================================================
32// class declarations
33// ===========================================================================
34class Boundary;
35class SUMOPolygon;
36class PointOfInterest;
37class OptionsCont;
38class OutputDevice;
39
40
41// ===========================================================================
42// class definitions
43// ===========================================================================
49public:
55 PCPolyContainer(bool prune, const Boundary& pruningBoundary,
56 const std::vector<std::string>& removeByNames);
57
58
61
62
76 bool add(SUMOPolygon* poly, bool ignorePruning = false);
77
78
92 bool add(PointOfInterest* poi, bool ignorePruning = false);
93
95 void addLanePos(const std::string& poiID, const std::string& laneID, const double lanePos, const bool friendlyPos, const double lanePosLat);
96
102 void save(const std::string& file, bool useGeo);
103
107 void saveDlrTDP(const std::string& prefix);
108
109
118 int getEnumIDFor(const std::string& key);
119
120private:
122 struct LanePos {
124 LanePos();
125
127 LanePos(const std::string& laneID, double pos, bool friendlyPos, double posLat);
128
130 std::string laneID;
131
133 double pos;
134
137
139 double posLat;
140 };
141
143 std::map<std::string, LanePos> myLanePosPois;
144
146 std::map<std::string, int> myIDEnums;
147
150
153
155 std::vector<std::string> myRemoveByNames;
156
158 static void writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc);
159
162
165};
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
A storage for options typed value containers)
Definition OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
A storage for loaded polygons and pois.
std::map< std::string, LanePos > myLanePosPois
An id to pos map for lane pos specs.
static void writeDlrTDPHeader(OutputDevice &device, const OptionsCont &oc)
write DLR TDP Header
bool myDoPrune
Information whether the pruning boundary shall be used.
PCPolyContainer & operator=(const PCPolyContainer &s)=delete
Invalidated assignment operator.
~PCPolyContainer()
Destructor.
PCPolyContainer(const PCPolyContainer &s)
Invalidated copy constructor.
void save(const std::string &file, bool useGeo)
Saves the stored polygons and pois into the given file.
bool add(SUMOPolygon *poly, bool ignorePruning=false)
Adds a polygon to the storage.
void saveDlrTDP(const std::string &prefix)
Saves the stored polygons and pois into the given file in dlrTDP format.
std::vector< std::string > myRemoveByNames
List of names of polygons/pois that shall be removed.
std::map< std::string, int > myIDEnums
An id to int map for proper enumeration.
int getEnumIDFor(const std::string &key)
Retuns a unique id for a given name.
void addLanePos(const std::string &poiID, const std::string &laneID, const double lanePos, const bool friendlyPos, const double lanePosLat)
add lane pos
Boundary myPruningBoundary
The boundary that described the rectangle within which an object must be in order to be kept.
A point-of-interest.
Storage for geometrical objects.
double posLat
pos lateral over lane
LanePos()
default constructor
bool friendlyPos
friendly position
double pos
pos over lane