 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
67 myTransformToPerson(
nullptr),
68 myTransformToPersonFlow(
nullptr) {
70 myPerson->buildPopupHeader(
this, app);
72 myPerson->buildCenterPopupEntry(
this);
73 myPerson->buildPositionCopyEntry(
this,
false);
75 new FXMenuCommand(
this, (
"Copy " + myPerson->getTagStr() +
" name to clipboard").c_str(),
nullptr,
this,
MID_COPY_NAME);
76 new FXMenuCommand(
this, (
"Copy " + myPerson->getTagStr() +
" typed name to clipboard").c_str(),
nullptr,
this,
MID_COPY_TYPED_NAME);
77 new FXMenuSeparator(
this);
79 myPerson->getViewNet()->buildSelectionACPopupEntry(
this, myPerson);
80 myPerson->buildShowParamsPopupEntry(
this);
84 FXMenuPane* transformOperation =
new FXMenuPane(
this);
85 this->insertMenuPaneChild(transformOperation);
86 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
92 myTransformToPerson->disable();
94 myTransformToPersonFlow->disable();
105 if (obj == myTransformToPerson) {
107 }
else if (obj == myTransformToPersonFlow) {
121 mySelectedPersons(selectedPerson),
122 myTransformToPerson(nullptr),
123 myTransformToPersonFlow(nullptr) {
130 new FXMenuCommand(
this, (
"Copy " + person->
getTagStr() +
" name to clipboard").c_str(),
nullptr,
this,
MID_COPY_NAME);
132 new FXMenuSeparator(
this);
139 FXMenuPane* transformOperation =
new FXMenuPane(
this);
141 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
155 for (
const auto& i : mySelectedPersons) {
156 if ((obj == myTransformToPerson) &&
157 (i->getTagProperty().getTag() == myPersonTag)) {
159 }
else if ((obj == myTransformToPersonFlow) &&
160 (i->getTagProperty().getTag() == myPersonTag)) {
173 {}, {}, {}, {}, {pType}, {}, {}, {}, {}, {}),
186 std::string departStr;
193 departStr.reserve(20 - departStr.size());
195 for (
int i = (
int)departStr.size(); i < 20; i++) {
196 departStr.insert(departStr.begin(),
'0');
241 i->writeDemandElement(device);
329 i->updatePartialGeometry(edge);
363 return Position((A.
x() + B.
x()) / 2, (A.
y() + B.
y()) / 2);
391 personBoundary =
Boundary(-0.1, -0.1, 0.1, 0.1);
393 personBoundary.
grow(20);
394 return personBoundary;
406 bool drawPerson =
true;
423 const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
443 glTranslated(personPosition.
x(), personPosition.
y(),
getType());
444 glRotated(90, 0, 0, 1);
448 glScaled(exaggeration, exaggeration, 1);
617 return canParse<RGBColor>(value);
619 double dummyDepartPos;
623 return error.empty();
627 if (canParse<double>(value)) {
628 return (parse<double>(value) >= 0);
635 if (canParse<double>(value)) {
636 return (parse<double>(value) >= 0);
643 }
else if (canParse<double>(value)) {
644 return (parse<double>(value) >= 0);
651 }
else if (canParse<double>(value)) {
652 return (parse<double>(value) > 0);
659 }
else if (canParse<double>(value)) {
660 return (parse<double>(value) > 0);
667 }
else if (canParse<double>(value)) {
668 return (parse<double>(value) >= 0);
673 if (canParse<int>(value)) {
674 return (parse<int>(value) >= 0);
680 return canParse<bool>(value);
745 for (
const auto& i :
via) {
821 personPlan(_personPlan),
849 color = parse<RGBColor>(value);
904 if (parse<bool>(value)) {
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
@ SVC_PEDESTRIAN
pedestrian
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
bool wasSet(int what) const
Returns whether the given parameter was set.
An Element which don't belongs to GNENet but has influency in the simulation.
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getAttributeDouble(SumoXMLAttr key) const
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
static const double personShapes
details for draw person as person shapes
GNEPerson(SumoXMLTag tag, GNEViewNet *viewNet, GNEDemandElement *pType, const SUMOVehicleParameter &personparameters)
constructor for persons
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color)
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string getID() const
function to support debugging
const std::string DEFAULT_PEDTYPE_ID
virtual double getColorValue(const GUIVisualizationSettings &, int) const
RGBColor color
The vehicle's color, TraCI may change this.
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
Static storage of an output device and its base (abstract) implementation.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
double angle
The current view rotation angle.
std::string getBegin() const
get begin time of demand element
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
static const Position INVALID
used to indicate that a position is valid
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
friend class GNEChange_EnableAttribute
std::string vtypeid
The vehicle's type id.
const int VEHPARS_NUMBER_SET
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
static const double personTriangles
details for draw person as triangles
const RGBColor & getColor() const
get color
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GUIColorer personColorer
The person colorer.
@ SUMO_ATTR_COLOR
A color information.
static OptionsCont & getOptions()
Retrieves the options.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
bool showDemandElements() const
check if show demand elements checkbox is enabled
void invalidatePath()
invalidate path
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
double length() const
Returns the length.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Structure representing possible vehicle parameter.
@ MID_COPY_NAME
Copy object name - popup entry.
@ SUMO_TAG_VTYPE
description of a vehicle type
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
@ GLO_PERSONFLOW
a person flow
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[]
const int VEHPARS_PROB_SET
void computePath()
compute path
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
double scaledSize(double scale, double constFactor=0.1) const
get scale size
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
SumoXMLTag tag
The vehicle tag.
@ SUMO_ATTR_BEGIN
weights: time range begin
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
A road/street connecting two junctions (netedit-version)
static void drawAction_drawAsCircle(const double length, const double width)
friend class GNEChange_Attribute
declare friend class
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void changeDemandElementID(const std::string &newID)
change ID of demand element
GNENet * getNet() const
get the net object
SumoXMLTag getTagSynonym() const
get tag synonym
static void setFlowParameters(const SumoXMLAttr attribute, int ¶meters)
configure flow parameters
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
GUIVisualizationDetailSettings detailSettings
detail settings
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
const PositionVector & getLaneShape() const
std::string getDepart() const
obtain depart parameter in string format
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNEEdge * getFromEdge() const
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
const int VEHPARS_COLOR_SET
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
std::string id
The vehicle's id.
GUIGlID getGlID() const
Returns the numerical id of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
A class that stores a 2D geometrical boundary.
double repetitionProbability
The probability for emitting a vehicle per second.
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
double arrivalPos
(optional) The position the vehicle shall arrive on
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position ¢er, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
double scale
information about a lane's width (temporary, used for a single view)
Supermode currentSupermode
the current supermode
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
static const double personExaggeration
Exaggeration for persons (only used in NETEDIT)
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
std::string time2string(SUMOTime t)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
GUIVisualizationSizeSettings personSize
void updateDemandElementBegin(const std::string &oldBegin, GNEDemandElement *demandElement)
update demand element begin in container
@ MID_GNE_PERSON_TRANSFORM
transform person to another person type (ej: person to personflow)
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
std::string getDepartPos() const
obtain depart pos parameter in string format
@ SUMO_TAG_VEHICLE
description of a vehicle
SUMOTime string2time(const std::string &r)
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
const int VEHPARS_VPH_SET
static void drawAction_drawAsTriangle(const double angle, const double length, const double width)
GNEViewNet * getViewNet() const
get view net
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
@ SVS_PEDESTRIAN
render as a pedestrian
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
void setParametersStr(const std::string ¶msString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const int VEHPARS_VTYPE_SET
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
double y() const
Returns the y-position.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
GNEEdge * getToEdge() const
obtain to edge of this demand element
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
@ GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
const int VEHPARS_DEPARTPOS_SET
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
DepartPosDefinition
Possible ways to choose the departure position.
GUISelectedStorage gSelected
A global holder of selected objects.
const std::string & getDemandElementID() const
returns DemandElement ID
personPlanSegment()
constructor
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
void replaceParentDemandElement(GNEShape *shapeTobeChanged, const std::string &newParentDemandElementID, int demandElementParentIndex)
replace the parent demand element of a shape
GUIVisualizationTextSettings personValue
static void drawAction_drawAsImage(const double angle, const double length, const double width, const std::string &file, const SUMOVehicleShape guiShape, const double exaggeration)
GUIVisualizationTextSettings personName
@ GNE_ATTR_SELECTED
element is selected
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
@ SUMO_ATTR_END
weights: time range end
Boundary & grow(double by)
extends the boundary by the given amount
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
const int VEHPARS_PERIOD_SET
void endGeometryMoving()
end geometry movement
@ DEPART_POS_GIVEN
The position is given.
void removeLockedObject(const GUIGlObjectType type)
set object unselected
const std::string & getTagStr() const
get tag assigned to this object in string format
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
Stores the information about how to visualize structures.
const int VEHPARS_END_SET
void updateGeometry()
update pre-computed geometry information
std::string getParentName() const
Returns the name of the parent object.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::string getAttribute(SumoXMLAttr key) const
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const T getColor(const double value) const
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
bool isAttributeEnabled(SumoXMLAttr key) const
void startGeometryMoving()
double departPos
(optional) The position the vehicle shall depart from
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
@ SUMO_TAG_TRIP
a single trip definition (used by router)
void deselect(GUIGlID id)
Deselects the object with the given id.
GNEViewParent * getViewParent() const
get the net object
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
static const double personCircles
details for draw person as circles
Position getPositionInView() const
Returns position of demand element in view.
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
void addedLockedObject(const GUIGlObjectType type)
set object selected