Eclipse SUMO - Simulation of Urban MObility
GNEAttributeCarrier.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Abstract Base class for gui objects which carry attributes
16 /****************************************************************************/
17 #ifndef GNEAttributeCarrier_h
18 #define GNEAttributeCarrier_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
27 #include <utils/common/ToString.h>
33 
34 #include "GNEReferenceCounter.h"
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class GNENet;
41 class GNEUndoList;
42 class GNELane;
43 class GNEEdge;
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
55 
57  friend class GNEChange_Attribute;
59 
60 public:
61 
62  // @brief declare class TagProperties
63  class TagProperties;
64 
66  enum AttrProperty {
67  ATTRPROPERTY_INT = 1 << 0, // Attribute is an integer (Including Zero)
68  ATTRPROPERTY_FLOAT = 1 << 1, // Attribute is a float
69  ATTRPROPERTY_SUMOTIME = 1 << 2, // Attribute is a SUMOTime
70  ATTRPROPERTY_BOOL = 1 << 3, // Attribute is boolean (0/1, true/false)
71  ATTRPROPERTY_STRING = 1 << 4, // Attribute is a string
72  ATTRPROPERTY_POSITION = 1 << 5, // Attribute is a position defined by doubles (x,y or x,y,z)
73  ATTRPROPERTY_COLOR = 1 << 6, // Attribute is a color defined by a specifically word (Red, green) or by a special format (XXX,YYY,ZZZ)
74  ATTRPROPERTY_VCLASS = 1 << 7, // Attribute is a VClass (passenger, bus, motorcicle...)
75  ATTRPROPERTY_POSITIVE = 1 << 8, // Attribute is positive (Including Zero)
76  ATTRPROPERTY_NOTZERO = 1 << 9, // Attribute cannot be 0 (only for numerical attributes)
77  ATTRPROPERTY_UNIQUE = 1 << 10, // Attribute is unique (cannot be edited in a selection of similar elements (ID, Position...)
78  ATTRPROPERTY_FILENAME = 1 << 11, // Attribute is a filename (string that cannot contains certain characters)
79  ATTRPROPERTY_NONEDITABLE = 1 << 12, // Attribute is non editable (index of a lane)
80  ATTRPROPERTY_DISCRETE = 1 << 13, // Attribute is discrete (only certain values are allowed)
81  ATTRPROPERTY_PROBABILITY = 1 << 14, // Attribute is probability (only allowed values between 0 and 1, including both)
82  ATTRPROPERTY_ANGLE = 1 << 15, // Attribute is an angle (only takes values between 0 and 360, including both, another value will be automatically reduced
83  ATTRPROPERTY_LIST = 1 << 16, // Attribute is a list of other elements separated by spaces
84  ATTRPROPERTY_SECUENCIAL = 1 << 17, // Attribute is a special sequence of elements (for example: secuencial lanes in Multi Lane E2 detectors)
85  ATTRPROPERTY_WRITEXMLOPTIONAL = 1 << 18, // Attribute will not be written in XML file if current value is the same of their default Static/Mutable value
86  ATTRPROPERTY_DEFAULTVALUESTATIC = 1 << 19, // Attribute owns a static default value
87  ATTRPROPERTY_DEFAULTVALUEMUTABLE = 1 << 20, // Attribute owns a mutable default value (Default value depends of value of other attribute)
88  ATTRPROPERTY_COMBINABLE = 1 << 21, // Attribute is combinable with other attribute (example: Allow/disallow VClasses)
89  ATTRPROPERTY_SYNONYM = 1 << 22, // Attribute will be written with a different name in der XML
90  ATTRPROPERTY_RANGE = 1 << 23, // Attribute only accept a range of elements (example: Probability [0,1]
91  ATTRPROPERTY_EXTENDED = 1 << 24, // Attribute is extended (in Frame will not be shown, see VType attributes)
92  ATTRPROPERTY_UPDATEGEOMETRY = 1 << 25, // Attribute requiere update geometry at the end of function setAttribute(...)
93  ATTRPROPERTY_OPTIONAL = 1 << 26, // Attribute is optional, i.e. can be enabled/disabled using a checkbox in frame
94  ATTRPROPERTY_COMPLEX = 1 << 27, // Attribute is complex: Requiere a special function to check if their given value is valid
95  ATTRPROPERTY_ENABLITABLE = 1 << 28, // Attribute is enablitable: Can be enabled or disabled.
96  };
97 
100 
101  public:
104 
106  AttributeProperties(const SumoXMLAttr attribute, const int attributeProperty, const std::string& definition, std::string defaultValue = "");
107 
110 
113 
115  void setDiscreteValues(const std::vector<std::string>& discreteValues);
116 
118  void setSynonym(const SumoXMLAttr synonym);
119 
121  void setRange(const double minimum, const double maximum);
122 
124  void setTagPropertyParent(TagProperties* tagPropertyParent);
125 
127  SumoXMLAttr getAttr() const;
128 
130  const std::string& getAttrStr() const;
131 
133  const TagProperties& getTagPropertyParent() const;
134 
136  int getPositionListed() const;
137 
139  const std::string& getDefinition() const;
140 
142  const std::string& getDefaultValue() const;
143 
145  std::string getDescription() const;
146 
148  const std::vector<std::string>& getDiscreteValues() const;
149 
151  SumoXMLAttr getAttrSynonym() const;
152 
154  double getMinimumRange() const;
155 
157  double getMaximumRange() const;
158 
160  bool hasStaticDefaultValue() const;
161 
163  bool hasMutableDefaultValue() const;
164 
166  bool hasAttrSynonym() const;
167 
169  bool hasAttrRange() const;
170 
172  bool isInt() const;
173 
175  bool isFloat() const;
176 
178  bool isSUMOTime() const;
179 
181  bool isBool() const;
182 
184  bool isString() const;
185 
187  bool isposition() const;
188 
190  bool isProbability() const;
191 
193  bool isNumerical() const;
194 
196  bool isPositive() const;
197 
199  bool cannotBeZero() const;
200 
202  bool isColor() const;
203 
205  bool isFilename() const;
206 
208  bool isVClass() const;
209 
211  bool isSVCPermission() const;
212 
214  bool isList() const;
215 
217  bool isSecuential() const;
218 
220  bool isUnique() const;
221 
223  bool isWriteXMLOptional() const;
224 
226  bool isDiscrete() const;
227 
229  bool isCombinable() const;
230 
232  bool isNonEditable() const;
233 
235  bool isExtended() const;
236 
238  bool requiereUpdateGeometry() const;
239 
241  bool isOptional() const;
242 
244  bool isComplex() const;
245 
247  bool isEnablitable() const;
248 
249  private:
252 
255 
257  std::string myAttrStr;
258 
261 
263  std::string myDefinition;
264 
266  std::string myDefaultValue;
267 
269  std::vector<std::string> myDiscreteValues;
270 
273 
276 
279  };
280 
281  enum TagType {
282  TAGTYPE_NETELEMENT = 1 << 0, // Edges, Junctions, Lanes...
283  TAGTYPE_ADDITIONAL = 1 << 1, // Bus Stops, Charging Stations, Detectors...
284  TAGTYPE_SHAPE = 1 << 2, // POIs, Polygons
285  TAGTYPE_DEMANDELEMENT = 1 << 3, // Routes, Vehicles, Trips...
286  TAGTYPE_TAZ = 1 << 4, // Traffic Assignment Zones
287  TAGTYPE_STOPPINGPLACE = 1 << 5, // StoppingPlaces (BusStops, ChargingStations...)
288  TAGTYPE_DETECTOR = 1 << 6, // Detectors (E1, E2...)
289  TAGTYPE_VTYPE = 1 << 7, // Vehicle types (vType and pTye)
290  TAGTYPE_VEHICLE = 1 << 8, // Vehicles (Flows, trips...)
291  TAGTYPE_ROUTE = 1 << 9, // Routes and embedded routes
292  TAGTYPE_STOP = 1 << 10, // Stops
293  TAGTYPE_PERSON = 1 << 11, // Persons
294  TAGTYPE_PERSONPLAN = 1 << 12, // Person plans (Walks, rides, ...)
295  TAGTYPE_PERSONTRIP = 1 << 13, // Walks
296  TAGTYPE_WALK = 1 << 14, // Walks
297  TAGTYPE_RIDE = 1 << 15, // Rides
298  TAGTYPE_PERSONSTOP = 1 << 16, // Person stops
299  };
300 
301  enum TAGProperty {
302  TAGPROPERTY_DRAWABLE = 1 << 0, // Element can be drawed in view
303  TAGPROPERTY_BLOCKMOVEMENT = 1 << 1, // Element can block their movement
304  TAGPROPERTY_BLOCKSHAPE = 1 << 2, // Element can block their shape
305  TAGPROPERTY_CLOSESHAPE = 1 << 3, // Element can close their shape
306  TAGPROPERTY_GEOPOSITION = 1 << 4, // Element's position can be defined using a GEO position
307  TAGPROPERTY_GEOSHAPE = 1 << 5, // Element's shape acn be defined using a GEO Shape
308  TAGPROPERTY_DIALOG = 1 << 6, // Element can be edited using a dialog (GNECalibratorDialog, GNERerouterDialog...)
309  TAGPROPERTY_PARENT = 1 << 7, // Element will be writed in XML as child of another element (E3Entry -> E3Detector...)
310  TAGPROPERTY_MINIMUMCHILDREN = 1 << 8, // Element will be only writed in XML if has a minimum number of children
311  TAGPROPERTY_REPARENT = 1 << 9, // Element can be reparent
312  TAGPROPERTY_SYNONYM = 1 << 10, // Element will be written with a different name in der XML
313  TAGPROPERTY_AUTOMATICSORTING = 1 << 11, // Element sort automatic their Children (used by Additionals)
314  TAGPROPERTY_SELECTABLE = 1 << 12, // Element is selectable
315  TAGPROPERTY_MASKSTARTENDPOS = 1 << 13, // Element mask attributes StartPos and EndPos as "lenght" (Only used in the appropiate GNEFrame)
316  TAGPROPERTY_MASKXYZPOSITION = 1 << 14, // Element mask attributes X, Y and Z as "Position"
317  TAGPROPERTY_WRITECHILDRENSEPARATE = 1 << 15, // Element writes their children in a separated filename
318  TAGPROPERTY_NOGENERICPARAMETERS = 1 << 16, // Element doesn't accept Generic Parameters (by default all tags supports generic parameters)
319  TAGPROPERTY_RTREE = 1 << 17, // Element is placed in RTREE
320  TAGPROPERTY_SORTINGCHILDREN = 1 << 18, // Element can be sorted in their parent element manually (in ACHierarchy)
321  };
322 
325  public:
327  TagProperties();
328 
330  TagProperties(SumoXMLTag tag, int tagType, int tagProperty, GUIIcon icon, SumoXMLTag parentTag = SUMO_TAG_NOTHING, SumoXMLTag tagSynonym = SUMO_TAG_NOTHING);
331 
333  ~TagProperties();
334 
336  SumoXMLTag getTag() const;
337 
339  const std::string& getTagStr() const;
340 
342  void checkTagIntegrity() const;
343 
345  void addAttribute(const AttributeProperties& attributeProperty);
346 
348  void addDeprecatedAttribute(SumoXMLAttr attr);
349 
351  const AttributeProperties& getAttributeProperties(SumoXMLAttr attr) const;
352 
354  std::vector<AttributeProperties>::const_iterator begin() const;
355 
357  std::vector<AttributeProperties>::const_iterator end() const;
358 
360  int getNumberOfAttributes() const;
361 
363  const std::string& getDefaultValue(SumoXMLAttr attr) const;
364 
366  GUIIcon getGUIIcon() const;
367 
369  SumoXMLTag getParentTag() const;
370 
372  SumoXMLTag getTagSynonym() const;
373 
375  bool hasAttribute(SumoXMLAttr attr) const;
376 
378  bool isNetElement() const;
379 
381  bool isAdditional() const;
382 
384  bool isShape() const;
385 
387  bool isTAZ() const;
388 
390  bool isDemandElement() const;
391 
393  bool isStoppingPlace() const;
394 
396  bool isDetector() const;
397 
399  bool isVehicleType() const;
400 
402  bool isVehicle() const;
403 
405  bool isRoute() const;
406 
408  bool isStop() const;
409 
411  bool isPerson() const;
412 
414  bool isPersonPlan() const;
415 
417  bool isPersonTrip() const;
418 
420  bool isWalk() const;
421 
423  bool isRide() const;
424 
426  bool isPersonStop() const;
427 
429  bool isDrawable() const;
430 
432  bool isSelectable() const;
433 
435  bool canBlockMovement() const;
436 
438  bool canBlockShape() const;
439 
441  bool canCloseShape() const;
442 
444  bool hasGEOPosition() const;
445 
447  bool hasGEOShape() const;
448 
450  bool hasParent() const;
451 
453  bool hasTagSynonym() const;
454 
456  bool hasDialog() const;
457 
459  bool hasMinimumNumberOfChildren() const;
460 
462  bool hasGenericParameters() const;
463 
465  bool isPlacedInRTree() const;
466 
468  bool canBeSortedManually() const;
469 
471  bool canBeReparent() const;
472 
474  bool canAutomaticSortChildren() const;
475 
477  bool canWriteChildrenSeparate() const;
478 
480  bool canMaskStartEndPos() const;
481 
483  bool canMaskXYZPositions() const;
484 
486  bool isAttributeDeprecated(SumoXMLAttr attr) const;
487 
488  private:
491 
493  std::string myTagStr;
494 
497 
500 
502  std::vector<AttributeProperties> myAttributeProperties;
503 
506 
509 
512 
514  std::vector<SumoXMLAttr> myDeprecatedAttributes;
515  };
516 
521  GNEAttributeCarrier(const SumoXMLTag tag);
522 
524  virtual ~GNEAttributeCarrier();
525 
527  virtual void updateGeometry() = 0;
528 
532  virtual void selectAttributeCarrier(bool changeFlag = true) = 0;
533 
535  virtual void unselectAttributeCarrier(bool changeFlag = true) = 0;
536 
538  virtual bool isAttributeCarrierSelected() const = 0;
539 
541  virtual bool drawUsingSelectColor() const = 0;
542 
543  /* @brief method for getting the Attribute of an XML key
544  * @param[in] key The attribute key
545  * @return string with the value associated to key
546  */
547  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
548 
549  /* @brief method for setting the attribute and letting the object perform additional changes
550  * @param[in] key The attribute key
551  * @param[in] value The new value
552  * @param[in] undoList The undoList on which to register changes
553  */
554  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
555 
556  /* @brief method for check if new value for certain attribute is valid
557  * @param[in] key The attribute key
558  * @param[in] value The new value
559  */
560  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
561 
562  /* @brief method for enabling attribute
563  * @param[in] key The attribute key
564  * @param[in] undoList The undoList on which to register changes
565  * @note only certain attributes can be enabled, and can produce the disabling of other attributes
566  */
567  virtual void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) = 0;
568 
569  /* @brief method for check if the value for certain attribute is set
570  * @param[in] key The attribute key
571  */
572  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
573 
575  virtual std::string getPopUpID() const = 0;
576 
578  virtual std::string getHierarchyName() const = 0;
580 
584  static const std::string FEATURE_LOADED;
585 
587  static const std::string FEATURE_GUESSED;
588 
590  static const std::string FEATURE_MODIFIED;
591 
593  static const std::string FEATURE_APPROVED;
595 
597  static const size_t MAXNUMBEROFATTRIBUTES;
598 
600  static const double INVALID_POSITION;
601 
603  virtual std::string getAttributeForSelection(SumoXMLAttr key) const;
604 
606  const std::string& getTagStr() const;
607 
609  const TagProperties& getTagProperty() const;
610 
612  FXIcon* getIcon() const;
613 
615  const std::string getID() const;
616 
618  static const TagProperties& getTagProperties(SumoXMLTag tag);
619 
621  static std::vector<SumoXMLTag> allowedTags(bool onlyDrawables);
622 
624  static std::vector<SumoXMLTag> allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables);
625 
628 
630  virtual std::string getGenericParametersStr() const = 0;
631 
633  virtual std::vector<std::pair<std::string, std::string> > getGenericParameters() const = 0;
634 
636  virtual void setGenericParametersStr(const std::string& value) = 0;
637 
639 
641  static bool isGenericParametersValid(const std::string& value);
642 
644  template<typename T>
645  static bool canParse(const std::string& string) {
646  try {
647  parse<T>(string);
648  } catch (NumberFormatException&) {
649  return false;
650  } catch (EmptyData&) {
651  return false;
652  } catch (BoolFormatException&) {
653  return false;
654  }
655  return true;
656  }
657 
659  template<typename T>
660  static T parse(const std::string& string);
661 
663  template<typename T>
664  static bool canParse(GNENet* net, const std::string& value, bool report) {
665  try {
666  parse<T>(net, value);
667  } catch (FormatException& exception) {
668  if (report) {
669  WRITE_WARNING(exception.what())
670  }
671  return false;
672  }
673  return true;
674  }
675 
677  template<typename T>
678  static T parse(GNENet* net, const std::string& value);
679 
681  template<typename T>
682  static std::string parseIDs(const std::vector<T>& ACs);
683 
685  static bool lanesConsecutives(const std::vector<GNELane*>& lanes);
686 
688  template <typename T>
689  static T parseAttributeFromXML(const SUMOSAXAttributes& attrs, const std::string& objectID, const SumoXMLTag tag, const SumoXMLAttr attribute, bool& abort) {
690  bool parsedOk = true;
691  // declare string values
692  std::string defaultValue, parsedAttribute, warningMessage;
693  // obtain tag properties
694  const auto& tagProperties = getTagProperties(tag);
695  // first check if attribute is deprecated
696  if (tagProperties.isAttributeDeprecated(attribute)) {
697  // show warning if deprecateda ttribute is in the SUMOSAXAttributes
698  if (attrs.hasAttribute(attribute)) {
699  WRITE_WARNING("Attribute " + toString(attribute) + "' of " + tagProperties.getTagStr() + " is deprecated and will not be loaded.");
700  }
701  // return a dummy value
702  return parse<T>("");
703  }
704  // now check if we're obtaining attribute of an object with an already parsed ID
705  if (objectID != "") {
706  warningMessage = tagProperties.getTagStr() + " with ID '" + objectID + "'";
707  } else {
708  warningMessage = tagProperties.getTagStr();
709  }
710  // check if we're parsing block movement
711  if (attribute == GNE_ATTR_BLOCK_MOVEMENT) {
712  // first check if we can parse
713  if (tagProperties.canBlockMovement()) {
714  // First check if attribute can be parsed to bool
715  parsedAttribute = attrs.get<std::string>(attribute, objectID.c_str(), parsedOk, false);
716  // check that sucesfully parsed attribute can be converted to type double
717  if (!canParse<bool>(parsedAttribute)) {
718  abort = true;
719  // return default value
720  return parse<T>("0");
721  } else {
722  // return readed value
723  return parse<T>(parsedAttribute);
724  }
725  } else {
726  throw ProcessError("Trying to parsing block movement attribute in an AC that cannot be moved");
727  }
728  }
729  // now check if we're parsing a GEO Attribute
730  if (tagProperties.hasGEOPosition() && ((attribute == SUMO_ATTR_LON) || (attribute == SUMO_ATTR_LAT))) {
731  // first check if GEO Attribute is defined
732  if (attrs.hasAttribute(attribute)) {
733  // First check if attribute can be parsed to string
734  parsedAttribute = attrs.get<std::string>(attribute, objectID.c_str(), parsedOk, false);
735  // check that sucesfully parsed attribute can be converted to type double
736  if (!canParse<double>(parsedAttribute)) {
737  WRITE_WARNING("Format of GEO attribute '" + toString(attribute) + "' of " +
738  warningMessage + " is invalid; Cannot be parsed to float; " + tagProperties.getTagStr() + " cannot be created");
739  // return default value
740  return parse<T>("0");
741  } else {
742  // return readed value
743  return parse<T>(parsedAttribute);
744  }
745  }
746  parsedOk = false;
747  // return default value
748  return parse<T>("0");
749  }
750  // obtain attribute properties (Only for improving efficiency)
751  const auto& attrProperties = tagProperties.getAttributeProperties(attribute);
752  // set a special default value for numerical and boolean attributes (To avoid errors parsing)
753  if (attrProperties.isNumerical() || attrProperties.isBool()) {
754  defaultValue = "0";
755  } else if (attrProperties.isColor()) {
756  defaultValue = "black";
757  } else if (attrProperties.isposition()) {
758  defaultValue = "0,0";
759  }
760  // first check that attribute exists in XML
761  if (attrs.hasAttribute(attribute)) {
762  // First check if attribute can be parsed to string
763  parsedAttribute = attrs.get<std::string>(attribute, objectID.c_str(), parsedOk, false);
764  // check parsed attribute
765  if (!checkParsedAttribute(tagProperties, attrProperties, attribute, defaultValue, parsedAttribute, warningMessage)) {
766  abort = true;
767  }
768  } else if (tagProperties.canMaskXYZPositions() && (attribute == SUMO_ATTR_POSITION)) {
769  // obtain masked position attribute
770  if (!parseMaskedPositionAttribute(attrs, objectID, tagProperties, attrProperties, parsedAttribute, warningMessage)) {
771  abort = true;
772  }
773  } else {
774  // if attribute is optional and has a default value, obtain it. In other case, abort.
775  if (attrProperties.isWriteXMLOptional()) {
776  parsedAttribute = attrProperties.getDefaultValue();
777  } else {
778  WRITE_WARNING("Essential " + attrProperties.getDescription() + " attribute '" + toString(attribute) + "' of " +
779  warningMessage + " is missing; " + tagProperties.getTagStr() + " cannot be created");
780  // abort parsing (and creation) of element
781  abort = true;
782  // set default value (To avoid errors in parse<T>(parsedAttribute))
783  parsedAttribute = defaultValue;
784  }
785  }
786  // return parsed attribute
787  return parse<T>(parsedAttribute);
788  }
789 
790 protected:
793 
796 
799 
800 private:
802  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
803 
805  virtual void setEnabledAttribute(const int enabledAttributes) = 0;
806 
808  static void fillAttributeCarriers();
809 
811  static void fillNetElements();
812 
814  static void fillAdditionals();
815 
817  static void fillShapes();
818 
820  static void fillDemandElements();
821 
823  static void fillVehicleElements();
824 
826  static void fillStopElements();
827 
829  static void fillPersonElements();
830 
832  static void fillPersonStopElements();
833 
835  static void fillCommonVehicleAttributes(SumoXMLTag currentTag);
836 
838  static void fillCommonFlowAttributes(SumoXMLTag currentTag);
839 
841  static void fillCarFollowingModelAttributes(SumoXMLTag currentTag);
842 
844  static void fillJunctionModelAttributes(SumoXMLTag currentTag);
845 
847  static void fillLaneChangingModelAttributes(SumoXMLTag currentTag);
848 
850  static void fillCommonPersonAttributes(SumoXMLTag currentTag);
851 
853  static void fillCommonStopAttributes(SumoXMLTag currentTag);
854 
856  static bool checkParsedAttribute(const TagProperties& tagProperties, const AttributeProperties& attrProperties, const SumoXMLAttr attribute,
857  std::string& defaultValue, std::string& parsedAttribute, std::string& warningMessage);
858 
860  static bool parseMaskedPositionAttribute(const SUMOSAXAttributes& attrs, const std::string& objectID, const TagProperties& tagProperties,
861  const AttributeProperties& attrProperties, std::string& parsedAttribute, std::string& warningMessage);
862 
864  static std::map<SumoXMLTag, TagProperties> myTagProperties;
865 
867  GNEAttributeCarrier(const GNEAttributeCarrier&) = delete;
868 
870  GNEAttributeCarrier& operator=(const GNEAttributeCarrier& src) = delete;
871 };
872 
873 #endif
874 
875 /****************************************************************************/
876 
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
static const std::string FEATURE_APPROVED
feature has been approved but not changed (i.e. after being reguessed)
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
bool hasAttrRange() const
return true if Attr correspond to an element that only accept a range of values
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
SumoXMLTag
Numbers representing SUMO-XML - element names.
const std::string & getAttrStr() const
get XML Attribute
GUIIcon myIcon
icon associated to this Tag
bool isExtended() const
return true if atribute is extended
SumoXMLAttr getAttrSynonym() const
get tag synonym
GNEAttributeCarrier(const SumoXMLTag tag)
Constructor.
GNEAttributeCarrier & operator=(const GNEAttributeCarrier &src)=delete
Invalidated assignment operator.
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:36
bool hasMutableDefaultValue() const
return true if attribute owns a mutable default value
static void fillVehicleElements()
fill vehicle elements
bool isCombinable() const
return true if atribute is combinable with other Attribute
std::string myDefaultValue
default value (by default empty)
the function-object for an editing operation (abstract base)
struct with the attribute Properties
bool isFilename() const
return true if atribute is a filename
static bool checkParsedAttribute(const TagProperties &tagProperties, const AttributeProperties &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)
bool isPositive() const
return true if atribute is positive
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
static void fillStopElements()
fill Stop elements
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.
bool isComplex() const
return true if atribute is complex
void checkAttributeIntegrity()
check Attribute integrity (For example, throw an exception if tag has a Float default value...
bool isposition() const
return true if atribute is a position
static void fillAdditionals()
fill Additionals
static std::vector< SumoXMLTag > allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables)
get tags of all editable element types using TagProperty Type (TAGTYPE_NETELEMENT, TAGTYPE_ADDITIONAL, etc.)
static void fillPersonStopElements()
fill PersonStop elements
FXIcon * getIcon() const
get FXIcon associated to this AC
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:78
static void fillDemandElements()
fill Demand Elements
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
bool isNumerical() const
return true if atribute is numerical (int or float)
bool isSecuential() const
return true if atribute is sequential
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
SumoXMLAttr myAttrSynonym
Attribute written in XML (If is SUMO_ATTR_NOTHING), original Attribute will be written) ...
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool cannotBeZero() const
return true if atribute cannot be zero
virtual std::vector< std::pair< std::string, std::string > > getGenericParameters() const =0
return generic parameters as vector of pairs format
bool hasStaticDefaultValue() const
return true if attribute owns a static default value
int getPositionListed() const
get position in list (used in frames for listing attributes with certain sort)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
SumoXMLTag myTag
Sumo XML Tag vinculated wit this tag Property.
bool isProbability() const
return true if atribute is a probability
bool isNonEditable() const
return true if atribute isn&#39;t editable
virtual void selectAttributeCarrier(bool changeFlag=true)=0
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
bool isInt() const
return true if atribute is an integer
std::string myAttrStr
string with the Attribute in text format (to avoid unnecesaries toStrings(...) calls) ...
static TagProperties dummyTagProperty
dummy TagProperty used for reference some elements (for Example, dummyEdge)
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
virtual bool drawUsingSelectColor() const =0
check if attribute carrier must be drawn using selecting color.
void setDiscreteValues(const std::vector< std::string > &discreteValues)
set discrete values
bool isList() const
return true if atribute is a list
bool isColor() const
return true if atribute is a color
static std::vector< SumoXMLTag > allowedTags(bool onlyDrawables)
get tags of all editable element types
static const size_t MAXNUMBEROFATTRIBUTES
max number of attributes allowed for every tag
the function-object for an editing operation (abstract base)
virtual ~GNEAttributeCarrier()
Destructor.
static void fillShapes()
fill Shapes
virtual std::string getPopUpID() const =0
get PopPup ID (Used in AC Hierarchy)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
double getMaximumRange() const
get maximum range
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
std::vector< std::string > myDiscreteValues
discrete values that can take this Attribute (by default empty)
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.
const TagProperties & getTagPropertyParent() const
get reference to tagProperty parent
static const double INVALID_POSITION
invalid double position
bool isBool() const
return true if atribute is boolean
std::string getDescription() const
return a description of attribute
static void fillAttributeCarriers()
fill Attribute Carriers
static bool lanesConsecutives(const std::vector< GNELane *> &lanes)
check if lanes are consecutives
double getMinimumRange() const
get minimum range
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
static bool parseMaskedPositionAttribute(const SUMOSAXAttributes &attrs, const std::string &objectID, const TagProperties &tagProperties, const AttributeProperties &attrProperties, std::string &parsedAttribute, std::string &warningMessage)
parse and check masked (note: This function is only to improve legilibility)
static void fillNetElements()
fill Net Elements
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
static void fillPersonElements()
fill Person Elements
SumoXMLAttr getAttr() const
get XML Attribute
AttrProperty
struct with the tag Properties
bool isWriteXMLOptional() const
return true if atribute is write XML optional
block movement of a graphic element
static const std::string FEATURE_GUESSED
feature has been reguessed (may still be unchanged be we can&#39;t tell (yet)
bool isUnique() const
return true if atribute is unique
bool isVClass() const
return true if atribute is a VehicleClass
void setTagPropertyParent(TagProperties *tagPropertyParent)
set tag property parent
bool isSVCPermission() const
return true if atribute is a VehicleClass
bool isEnablitable() const
return true if atribute is enablitable
TagProperties * myTagPropertyParent
pointer to tagProperty parent
const std::string getID() const
function to support debugging
virtual void setEnabledAttribute(const int enabledAttributes)=0
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute) ...
static void fillCommonPersonAttributes(SumoXMLTag currentTag)
fill common person attributes (used by person and personFlows)
static void fillLaneChangingModelAttributes(SumoXMLTag currentTag)
fill Junction Model Attributes of Vehicle/Person Types
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
bool isDiscrete() const
return true if atribute is discrete
bool isFloat() const
return true if atribute is a float
static void fillCommonStopAttributes(SumoXMLTag currentTag)
fill stop person attributes (used by stops and personStps)
static bool canParse(GNENet *net, const std::string &value, bool report)
true if a value of type T can be parsed from string
int myTagProperty
Attribute properties.
static void fillCarFollowingModelAttributes(SumoXMLTag currentTag)
fill Car Following Model of Vehicle/Person Types
std::vector< AttributeProperties > myAttributeProperties
vector with the attribute values vinculated with this Tag
virtual std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
std::string myDefinition
text with a definition of attribute
struct with the attribute Properties
const std::vector< std::string > & getDiscreteValues() const
get discrete values
bool requiereUpdateGeometry() const
return true if atribute requieres a update geometry in setAttribute(...)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isString() const
return true if atribute is a string
static void fillJunctionModelAttributes(SumoXMLTag currentTag)
fill Junction Model Attributes of Vehicle/Person Types
void setSynonym(const SumoXMLAttr synonym)
set synonim
bool hasAttrSynonym() const
return true if Attr correspond to an element that will be written in XML with another name ...
virtual std::string getGenericParametersStr() const =0
return generic parameters in string format
bool isSUMOTime() const
return true if atribute is a SUMOTime
static const std::string FEATURE_LOADED
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
const std::string & getDefaultValue() const
get default value
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
virtual void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)=0
static void fillCommonVehicleAttributes(SumoXMLTag currentTag)
fill common vehicle attributes (used by vehicles, trips, routeFlows and flows)
std::vector< SumoXMLAttr > myDeprecatedAttributes
List with the deprecated Attributes.
const std::string & getDefinition() const
get default value
SumoXMLTag myTagSynonym
Tag written in XML (If is SUMO_TAG_NOTHING), original Tag name will be written)
static void fillCommonFlowAttributes(SumoXMLTag currentTag)
fill common flow attributes (used by flows, routeFlows and personFlows)
void setRange(const double minimum, const double maximum)
set range
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc.)
virtual void updateGeometry()=0
update pre-computed geometry information
static std::map< SumoXMLTag, TagProperties > myTagProperties
map with the tags properties
int myAttributeProperty
Property of attribute.
std::string myTagStr
Sumo XML Tag vinculated wit this tag Property in String format.
virtual void setGenericParametersStr(const std::string &value)=0
set generic parameters in string format
bool isOptional() const
return true if atribute is optional