![]() |
SUMO - Simulation of Urban MObility
|
A storage for loaded polygons and pois. More...
#include <PCPolyContainer.h>
Public Types | |
typedef NamedObjectCont< PointOfInterest * > | POIs |
typedef NamedObjectCont< SUMO::Polygon *> | Polygons |
Public Member Functions | |
bool | add (SUMO::Polygon *poly, bool ignorePruning=false) |
Adds a polygon to the storage. More... | |
bool | add (PointOfInterest *poi, bool ignorePruning=false) |
Adds a poi to the storage. More... | |
void | addLanePos (const std::string &poiID, const std::string &laneID, double lanePos) |
virtual bool | addPOI (const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, const Position &pos, double width, double height, bool ignorePruning=false) |
Builds a POI using the given values and adds it to the container. More... | |
virtual bool | addPolygon (const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, const PositionVector &shape, bool fill, bool ignorePruning=false) |
Builds a polygon using the given values and adds it to the container. More... | |
int | getEnumIDFor (const std::string &key) |
Retuns a unique id for a given name. More... | |
const POIs & | getPOIs () const |
Returns all pois. More... | |
const Polygons & | getPolygons () const |
Returns all polygons. More... | |
virtual void | movePOI (const std::string &id, const Position &pos) |
Assigns a new position to the named PoI. More... | |
PCPolyContainer (bool prune, const Boundary &pruningBoundary, const std::vector< std::string > &removeByNames) | |
Constructor. More... | |
virtual bool | removePOI (const std::string &id) |
Removes a PoI from the container. More... | |
virtual bool | removePolygon (const std::string &id) |
Removes a polygon from the container. More... | |
virtual void | reshapePolygon (const std::string &id, const PositionVector &shape) |
Assigns a shape to the named polygon. More... | |
void | save (const std::string &file, bool useGeo) |
Saves the stored polygons and pois into the given file. More... | |
void | saveDlrTDP (const std::string &prefix) |
Saves the stored polygons and pois into the given file in dlrTDP format. More... | |
~PCPolyContainer () | |
Destructor. More... | |
Protected Attributes | |
POIs | myPOIs |
stored POIs More... | |
Polygons | myPolygons |
stored Polygons More... | |
Private Member Functions | |
PCPolyContainer & | operator= (const PCPolyContainer &s) |
Invalidated assignment operator. More... | |
PCPolyContainer (const PCPolyContainer &s) | |
Invalidated copy constructor. More... | |
Static Private Member Functions | |
static void | writeDlrTDPHeader (OutputDevice &device, const OptionsCont &oc) |
Private Attributes | |
bool | myDoPrune |
Information whether the pruning boundary shall be used. More... | |
std::map< std::string, int > | myIDEnums |
An id to int map for proper enumeration. More... | |
std::map< std::string, std::pair< std::string, double > > | myLanePosPois |
An id to pos map for lane pos specs. More... | |
Boundary | myPruningBoundary |
The boundary that described the rectangle within which an object must be in order to be kept. More... | |
std::vector< std::string > | myRemoveByNames |
List of names of polygons/pois that shall be removed. More... | |
A storage for loaded polygons and pois.
Definition at line 52 of file PCPolyContainer.h.
|
inherited |
Definition at line 58 of file ShapeContainer.h.
|
inherited |
Definition at line 57 of file ShapeContainer.h.
PCPolyContainer::PCPolyContainer | ( | bool | prune, |
const Boundary & | pruningBoundary, | ||
const std::vector< std::string > & | removeByNames | ||
) |
Constructor.
[in] | prune | Whether added polygons/pois shall be pruned |
[in] | pruningBoundary | The pruning boundary (only valid if prune==true) |
[in] | removeByNames | Names of objects that shall not be added |
Definition at line 52 of file PCPolyContainer.cpp.
PCPolyContainer::~PCPolyContainer | ( | ) |
Destructor.
Definition at line 59 of file PCPolyContainer.cpp.
References NamedObjectCont< T >::clear(), ShapeContainer::myPOIs, and ShapeContainer::myPolygons.
|
private |
Invalidated copy constructor.
|
virtual |
Adds a polygon to the storage.
If pruning is enabled, "ignorePruning" is false and the polygon lies outside the pruning boundary, or if the polygon's name is within the names of objects to discard, the polygon is deleted and false is returned.
Afterwards it is tested whether a polygon with the same name is already stored. If so, an error message is printed, the polygon is deleted and false is returned, otherwise true.
[in] | poly | The polygon to add |
[in] | ignorePruning | Whether the polygon shall be kept, even though it would be pruned |
Reimplemented from ShapeContainer.
Definition at line 66 of file PCPolyContainer.cpp.
References ShapeContainer::add(), PositionVector::getBoxBoundary(), Named::getID(), SUMO::Polygon::getShape(), myDoPrune, myPruningBoundary, myRemoveByNames, and Boundary::partialWithin().
Referenced by PCLoaderOSM::addPOI(), PCLoaderOSM::addPolygon(), PCLoaderVisum::load(), PCLoaderArcView::load(), PCLoaderDlrNavteq::loadPOIFile(), and PCLoaderDlrNavteq::loadPolyFile().
|
virtual |
Adds a poi to the storage.
If pruning is enabled, "ignorePruning" is false and the poi lies outside the pruning boundary, or if the poi's name is within the names of objects to discard, the poi is deleted and false is returned.
Afterwards it is tested whether a poi with the same name is already stored. If so, an error message is printed, the poi is deleted and false is returned, otherwise true.
[in] | poly | The poi to add |
[in] | ignorePruning | Whether the poi shall be kept, even though it would be pruned |
Reimplemented from ShapeContainer.
Definition at line 86 of file PCPolyContainer.cpp.
References ShapeContainer::add(), Boundary::around(), Named::getID(), myDoPrune, myPruningBoundary, and myRemoveByNames.
void PCPolyContainer::addLanePos | ( | const std::string & | poiID, |
const std::string & | laneID, | ||
double | lanePos | ||
) |
Definition at line 105 of file PCPolyContainer.cpp.
References myLanePosPois.
|
virtualinherited |
Builds a POI using the given values and adds it to the container.
[in] | id | The name of the POI |
[in] | type | The (abstract) type of the POI |
[in] | color | The color of the POI |
[in] | layer | The layer of the POI |
[in] | angle | The rotation of the POI |
[in] | imgFile | The raster image of the POI |
[in] | pos | The position of the POI |
[in] | width | The width of the POI image |
[in] | height | The height of the POI image |
Reimplemented in GUIShapeContainer.
Definition at line 67 of file ShapeContainer.cpp.
References ShapeContainer::add().
Referenced by TraCI_POI::add(), and ShapeHandler::addPOI().
|
virtualinherited |
Builds a polygon using the given values and adds it to the container.
[in] | id | The name of the polygon |
[in] | type | The (abstract) type of the polygon |
[in] | color | The color of the polygon |
[in] | layer | The layer of the polygon |
[in] | angle | The rotation of the polygon |
[in] | imgFile | The raster image of the polygon |
[in] | shape | The shape of the polygon |
[in] | fill | Whether the polygon shall be filled |
Reimplemented in GUIShapeContainer.
Definition at line 58 of file ShapeContainer.cpp.
References ShapeContainer::add().
Referenced by TraCI_Polygon::add(), NLHandler::addDistrict(), and ShapeHandler::addPoly().
int PCPolyContainer::getEnumIDFor | ( | const std::string & | key | ) |
Retuns a unique id for a given name.
The unique id is generated by having an internal map of ids to running numbers. The first call to this method will return 0, all subsequent with the same key will return numbers increased by one at each call.
[in] | key | The key to get a running number for |
Definition at line 217 of file PCPolyContainer.cpp.
References myIDEnums.
Referenced by PCLoaderDlrNavteq::loadPolyFile().
|
inlineinherited |
Returns all pois.
Definition at line 133 of file ShapeContainer.h.
References ShapeContainer::add(), and ShapeContainer::myPOIs.
Referenced by TraCI_POI::getIDList(), TraCI_POI::getPoI(), TraCIServerAPI_POI::getPoI(), GUIShapeContainer::getPOIIds(), and TraCIServerAPI_POI::getTree().
|
inlineinherited |
Returns all polygons.
Definition at line 127 of file ShapeContainer.h.
References ShapeContainer::myPolygons.
Referenced by TraCI_Polygon::getIDList(), TraCI_Polygon::getPolygon(), TraCIServerAPI_Polygon::getPolygon(), GUIShapeContainer::getPolygonIDs(), TraCIServerAPI_Polygon::getTree(), and PCLoaderDlrNavteq::loadPolyFile().
|
virtualinherited |
Assigns a new position to the named PoI.
[in] | id | The id of the PoI to move |
[in] | pos | The PoI's new position |
Reimplemented in GUIShapeContainer.
Definition at line 88 of file ShapeContainer.cpp.
References NamedObjectCont< T >::get(), and ShapeContainer::myPOIs.
|
private |
Invalidated assignment operator.
|
virtualinherited |
Removes a PoI from the container.
[in] | id | The id of the PoI |
Reimplemented in GUIShapeContainer.
Definition at line 81 of file ShapeContainer.cpp.
References ShapeContainer::myPOIs, and NamedObjectCont< T >::remove().
Referenced by TraCI_POI::remove(), and GNEDeleteFrame::removeAttributeCarrier().
|
virtualinherited |
Removes a polygon from the container.
[in] | id | The id of the polygon |
Reimplemented in GUIShapeContainer.
Definition at line 75 of file ShapeContainer.cpp.
References ShapeContainer::myPolygons.
Referenced by TraCI_Polygon::remove().
|
virtualinherited |
Assigns a shape to the named polygon.
[in] | id | The id of the polygon to reshape |
[in] | shape | The polygon's new shape |
Reimplemented in GUIShapeContainer.
Definition at line 97 of file ShapeContainer.cpp.
References ShapeContainer::myPolygons, and SUMO::Polygon::setShape().
Referenced by TraCI_Polygon::setShape().
void PCPolyContainer::save | ( | const std::string & | file, |
bool | useGeo | ||
) |
Saves the stored polygons and pois into the given file.
[in] | file | The name of the file to write stored objects' definitions into |
[in] | useGeo | Whether to write output in geo-coordinates |
IOError | If the file could not be opened |
Definition at line 111 of file PCPolyContainer.cpp.
References OutputDevice::close(), OutputDevice::getDevice(), GeoConvHelper::getFinal(), OptionsCont::getFloat(), NamedObjectCont< T >::getMyMap(), OptionsCont::getOptions(), gPrecisionGeo, myLanePosPois, ShapeContainer::myPOIs, ShapeContainer::myPolygons, OutputDevice::setPrecision(), GeoConvHelper::usingGeoProjection(), WRITE_WARNING, GeoConvHelper::writeLocation(), and OutputDevice::writeXMLHeader().
void PCPolyContainer::saveDlrTDP | ( | const std::string & | prefix | ) |
Saves the stored polygons and pois into the given file in dlrTDP format.
[in] | prefix | The prefix of the file to write stored objects' definitions into |
Definition at line 164 of file PCPolyContainer.cpp.
References GeoConvHelper::cartesian2geo(), OutputDevice::close(), OutputDevice::getDevice(), GeoConvHelper::getFinal(), NamedObjectCont< T >::getMyMap(), OptionsCont::getOptions(), Position::mul(), ShapeContainer::myPOIs, ShapeContainer::myPolygons, OutputDevice::setPrecision(), GeoConvHelper::usingGeoProjection(), writeDlrTDPHeader(), Position::x(), and Position::y().
|
staticprivate |
Definition at line 142 of file PCPolyContainer.cpp.
References OptionsCont::getFullName(), OUTPUT_VERSION, and OptionsCont::writeConfiguration().
Referenced by saveDlrTDP().
|
private |
Information whether the pruning boundary shall be used.
Definition at line 136 of file PCPolyContainer.h.
Referenced by add().
|
private |
An id to int map for proper enumeration.
Definition at line 130 of file PCPolyContainer.h.
Referenced by getEnumIDFor().
|
private |
An id to pos map for lane pos specs.
Definition at line 127 of file PCPolyContainer.h.
Referenced by addLanePos(), and save().
|
protectedinherited |
stored POIs
Definition at line 148 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), GUIShapeContainer::addPOI(), ShapeContainer::getPOIs(), ShapeContainer::movePOI(), GUIShapeContainer::movePOI(), ShapeContainer::removePOI(), GUIShapeContainer::removePOI(), save(), saveDlrTDP(), and ~PCPolyContainer().
|
protectedinherited |
stored Polygons
Definition at line 145 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), GUIShapeContainer::addPolygon(), ShapeContainer::getPolygons(), ShapeContainer::removePolygon(), GUIShapeContainer::removePolygon(), ShapeContainer::reshapePolygon(), GUIShapeContainer::reshapePolygon(), save(), saveDlrTDP(), and ~PCPolyContainer().
|
private |
The boundary that described the rectangle within which an object must be in order to be kept.
Definition at line 133 of file PCPolyContainer.h.
Referenced by add().
|
private |
List of names of polygons/pois that shall be removed.
Definition at line 139 of file PCPolyContainer.h.
Referenced by add().