83 virtual const std::string&
getID()
const = 0;
207 static std::vector<SumoXMLTag>
allowedTags(
const bool onlyDrawables);
210 static std::vector<std::pair<SumoXMLTag, const std::string> >
getAllowedTagsByCategory(
const int tagPropertyCategory,
const bool onlyDrawables);
216 GNEAttributeCarrier::parse<T>(
string);
231 static T
parse(
const std::string&
string);
237 parse<T>(net, value);
253 static std::string
parseIDs(
const std::vector<T>& ACs);
259 template <
typename T>
261 bool parsedOk =
true;
263 std::string defaultValue, parsedAttribute, warningMessage;
267 if (tagProperties.isAttributeDeprecated(attribute)) {
270 WRITE_WARNING(
"Attribute " +
toString(attribute) +
"' of " + tagProperties.getTagStr() +
" is deprecated and will not be loaded.");
276 if (objectID !=
"") {
277 warningMessage = tagProperties.getTagStr() +
" with ID '" + objectID +
"'";
279 warningMessage = tagProperties.getTagStr();
284 if (tagProperties.canBlockMovement()) {
286 parsedAttribute = attrs.
get<std::string>(attribute, objectID.c_str(), parsedOk,
false);
288 if (!canParse<bool>(parsedAttribute)) {
291 return parse<T>(
"0");
294 return parse<T>(parsedAttribute);
297 throw ProcessError(
"Trying to parsing block movement attribute in an AC that cannot be moved");
305 parsedAttribute = attrs.
get<std::string>(attribute, objectID.c_str(), parsedOk,
false);
307 if (!canParse<double>(parsedAttribute)) {
309 warningMessage +
" is invalid; Cannot be parsed to float; " + tagProperties.getTagStr() +
" cannot be created");
311 return parse<T>(
"0");
314 return parse<T>(parsedAttribute);
319 return parse<T>(
"0");
322 const auto& attrProperties = tagProperties.getAttributeProperties(attribute);
324 if (attrProperties.isNumerical() || attrProperties.isBool()) {
326 }
else if (attrProperties.isColor()) {
327 defaultValue =
"black";
328 }
else if (attrProperties.isposition()) {
329 defaultValue =
"0,0";
334 parsedAttribute = attrs.
get<std::string>(attribute, objectID.c_str(), parsedOk,
false);
336 if (!
checkParsedAttribute(tagProperties, attrProperties, attribute, defaultValue, parsedAttribute, warningMessage)) {
339 }
else if (tagProperties.canMaskXYZPositions() && (attribute ==
SUMO_ATTR_POSITION)) {
346 if (attrProperties.isOptional()) {
347 parsedAttribute = attrProperties.getDefaultValue();
349 WRITE_WARNING(
"Essential " + attrProperties.getDescription() +
" attribute '" +
toString(attribute) +
"' of " +
350 warningMessage +
" is missing; " + tagProperties.getTagStr() +
" cannot be created");
354 parsedAttribute = defaultValue;
358 return parse<T>(parsedAttribute);
479 std::string& defaultValue, std::string& parsedAttribute, std::string& warningMessage);
#define WRITE_WARNING(msg)
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
GNEAttributeCarrier(const GNEAttributeCarrier &)=delete
Invalidated copy constructor.
static void fillPersonPlanBusStopEdge(SumoXMLTag currentTag)
fill person plan busStop -> edge
virtual std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
virtual void setEnabledAttribute(const int enabledAttributes)=0
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
static void fillCommonStopAttributes(SumoXMLTag currentTag, const bool parking)
fill stop person attributes (used by stops and personStps)
GNEAttributeCarrier(const SumoXMLTag tag, GNENet *net)
Constructor.
static void fillPersonPlanBusStopStop(SumoXMLTag currentTag)
fill person plan busStop -> stop
static void fillPersonPlanBusStopBusStop(SumoXMLTag currentTag)
fill person plan busStop -> edge
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
static void fillVehicleElements()
fill vehicle elements
static void fillDemandElements()
fill demand elements
static void fillPersonPlanEdgeEdge(SumoXMLTag currentTag)
fill person plan edge -> edge
static GNETagProperties dummyTagProperty
dummy TagProperty used for reference some elements (for Example, dummyEdge)
static void fillPersonElements()
fill person elements
void setACParameters(const std::string ¶meters, GNEUndoList *undoList)
set parameters (string)
static void fillDataElements()
fill Data elements
static void fillPersonPlanRides()
fill person plan rides
static void fillAdditionals()
fill additional elements
static void fillPersonPlanStopBusStop(SumoXMLTag currentTag)
fill person plan stop -> edge
static void fillLaneChangingModelAttributes(SumoXMLTag currentTag)
fill Junction Model Attributes of Vehicle/Person Types
virtual const std::string & getID() const =0
return ID of object
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
method for setting the attribute and nothing else (used in GNEChange_Attribute)
static void fillAttributeCarriers()
fill Attribute Carriers
static const std::string FEATURE_LOADED
static void fillCommonPersonAttributes(SumoXMLTag currentTag)
fill common person attributes (used by person and personFlows)
virtual std::string getPopUpID() const =0
get PopPup ID (Used in AC Hierarchy)
static void fillNetworkElements()
fill network elements
virtual void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)=0
static void fillPersonPlanEdgeStop(SumoXMLTag currentTag)
fill person plan edge -> stop
static void fillPersonStopElements()
fill personStop elements
static const std::string FEATURE_APPROVED
feature has been approved but not changed (i.e. after being reguessed)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
std::string getAlternativeValueForDisabledAttributes(SumoXMLAttr key) const
static T parse(GNENet *net, const std::string &value)
parses a complex value of type T from string (use for list of edges, list of lanes,...
static const GNETagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
void removeACParametersKeys(const std::vector< std::string > &keepKeys, GNEUndoList *undoList)
remove keys
const std::string & getTagStr() const
get tag assigned to this object in string format
static void fillPersonPlanEdgeBusStop(SumoXMLTag currentTag)
fill person plan edge -> edge
static const std::string FEATURE_GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
static void fillStopElements()
fill stop elements
virtual GUIGlObject * getGUIGlObject()=0
get GUIGlObject associated with this AttributeCarrier
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
static bool parseMaskedPositionAttribute(const SUMOSAXAttributes &attrs, const std::string &objectID, const GNETagProperties &tagProperties, const GNEAttributeProperties &attrProperties, std::string &parsedAttribute, std::string &warningMessage)
parse and check masked (note: This function is only to improve legilibility)
static void fillPersonTripAttributes(SumoXMLTag currentTag)
fill specific person trip attributes
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(GNENet *net, const std::string &value, bool report)
true if a value of type T can be parsed from string
static void fillPersonPlanStopStop(SumoXMLTag currentTag)
fill person plan stop -> stop
static void fillCommonVehicleAttributes(SumoXMLTag currentTag)
fill common vehicle attributes (used by vehicles, trips, routeFlows and flows)
void addACParameters(const std::string &key, const std::string &attribute, GNEUndoList *undoList)
add (or update attribute) key and attribute
FXIcon * getIcon() const
get FXIcon associated to this AC
static T parseAttributeFromXML(const SUMOSAXAttributes &attrs, const std::string &objectID, const SumoXMLTag tag, const SumoXMLAttr attribute, bool &abort)
Parse attribute from XML and show warnings if there are problems parsing it.
virtual const std::map< std::string, std::string > & getACParametersMap() const =0
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
virtual void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)=0
GNEAttributeCarrier & operator=(const GNEAttributeCarrier &src)=delete
Invalidated assignment operator.
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
static bool lanesConsecutives(const std::vector< GNELane * > &lanes)
check if lanes are consecutives
static void fillCommonFlowAttributes(SumoXMLTag currentTag, const bool forVehicles)
fill common flow attributes (used by flows, routeFlows and personFlows)
static void fillPersonPlanStopEdge(SumoXMLTag currentTag)
fill person plan stop -> edge
static std::vector< std::pair< SumoXMLTag, const std::string > > getAllowedTagsByCategory(const int tagPropertyCategory, const bool onlyDrawables)
get tags of all editable element types using TagProperty Type (NetworkEditMode::NETWORKELEMENT,...
static void fillPersonPlanWalks()
fill person plan walks
static void fillTAZElements()
fill TAZ elements
static const double INVALID_POSITION
invalid double position
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
static bool checkParsedAttribute(const GNETagProperties &tagProperties, const GNEAttributeProperties &attrProperties, const SumoXMLAttr attribute, std::string &defaultValue, std::string &parsedAttribute, std::string &warningMessage)
parse and check attribute (note: This function is only to improve legilibility)
GNENet * myNet
pointer to net
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
static void fillJunctionModelAttributes(SumoXMLTag currentTag)
fill Junction Model Attributes of Vehicle/Person Types
static void fillShapes()
fill shape elements
GNENet * getNet() const
get pointer to net
static void fillPersonPlanTrips()
fill person plan trips
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
static std::vector< SumoXMLTag > allowedTags(const bool onlyDrawables)
get tags of all editable element types
static void fillCarFollowingModelAttributes(SumoXMLTag currentTag)
fill Car Following Model of Vehicle/Person Types
virtual void updateGeometry()=0
update pre-computed geometry information
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
T getACParameters() const
get parameters
static void fillRideAttributes(SumoXMLTag currentTag)
fill specific ride attributes
virtual ~GNEAttributeCarrier()
Destructor.
virtual std::string getAttribute(SumoXMLAttr key) const =0
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
static std::map< SumoXMLTag, GNETagProperties > myTagProperties
map with the tags properties
static const size_t MAXNUMBEROFATTRIBUTES
max number of attributes allowed for every tag
the function-object for an editing operation (abstract base)
the function-object for an editing operation (abstract base)
A road/street connecting two junctions (netedit-version)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
A NBNetBuilder extended by visualisation and editing capabilities.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.