59 myTransformToPerson(
nullptr),
60 myTransformToPersonFlow(
nullptr) {
62 myPerson->buildPopupHeader(
this, app);
64 myPerson->buildCenterPopupEntry(
this);
65 myPerson->buildPositionCopyEntry(
this,
false);
69 new FXMenuSeparator(
this);
71 myPerson->getNet()->getViewNet()->buildSelectionACPopupEntry(
this, myPerson);
72 myPerson->buildShowParamsPopupEntry(
this);
74 if (myPerson->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
76 FXMenuPane* transformOperation =
new FXMenuPane(
this);
77 this->insertMenuPaneChild(transformOperation);
78 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
84 myTransformToPerson->disable();
86 myTransformToPersonFlow->disable();
97 if (obj == myTransformToPerson) {
99 }
else if (obj == myTransformToPersonFlow) {
113 mySelectedPersons(selectedPerson),
114 myTransformToPerson(nullptr),
115 myTransformToPersonFlow(nullptr) {
124 new FXMenuSeparator(
this);
131 FXMenuPane* transformOperation =
new FXMenuPane(
this);
133 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
147 for (
const auto& i : mySelectedPersons) {
148 if ((obj == myTransformToPerson) &&
149 (i->getTagProperty().getTag() == myPersonTag)) {
151 }
else if ((obj == myTransformToPersonFlow) &&
152 (i->getTagProperty().getTag() == myPersonTag)) {
165 {}, {}, {}, {}, {}, {}, {pType}, {}),
178 std::string departStr;
185 departStr.reserve(20 - departStr.size());
187 for (
int i = (
int)departStr.size(); i < 20; i++) {
188 departStr.insert(departStr.begin(),
'0');
233 i->writeDemandElement(device);
334 return Position((A.
x() + B.
x()) / 2, (A.
y() + B.
y()) / 2);
368 personBoundary =
Boundary(-0.1, -0.1, 0.1, 0.1);
370 personBoundary.
grow(20);
371 return personBoundary;
383 bool drawPerson =
true;
402 const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
424 glTranslated(personPosition.
x(), personPosition.
y(), 0);
425 glRotated(90, 0, 0, 1);
429 glScaled(exaggeration, exaggeration, 1);
585 return canParse<RGBColor>(value);
587 double dummyDepartPos;
591 return error.empty();
595 if (canParse<double>(value)) {
596 return (parse<double>(value) >= 0);
603 if (canParse<double>(value)) {
604 return (parse<double>(value) >= 0);
611 }
else if (canParse<double>(value)) {
612 return (parse<double>(value) >= 0);
619 }
else if (canParse<double>(value)) {
620 return (parse<double>(value) > 0);
627 }
else if (canParse<double>(value)) {
628 return (parse<double>(value) > 0);
635 }
else if (canParse<double>(value)) {
636 return (parse<double>(value) >= 0);
641 if (canParse<int>(value)) {
642 return (parse<int>(value) >= 0);
648 return canParse<bool>(value);
713 for (
const auto& i :
via) {
725 const std::map<std::string, std::string>&
795 personPlan(_personPlan),
817 personPlans->setMicrosimID(
getID());
827 color = parse<RGBColor>(value);
878 if (parse<bool>(value)) {
FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[]
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
@ MID_GNE_PERSON_TRANSFORM
transform person to another person type (ej: person to personflow)
@ MID_COPY_NAME
Copy object name - popup entry.
@ GLO_PERSONFLOW
a person flow
std::string time2string(SUMOTime t)
convert SUMOTime to string
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_PEDTYPE_ID
@ SVS_PEDESTRIAN
render as a pedestrian
const int VEHPARS_PROB_SET
const int VEHPARS_VPH_SET
const int VEHPARS_END_SET
const int VEHPARS_COLOR_SET
DepartPosDefinition
Possible ways to choose the departure position.
@ GIVEN
The position is given.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_NUMBER_SET
const int VEHPARS_PERIOD_SET
const int VEHPARS_VTYPE_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VTYPE
description of a vehicle type
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_PTYPE
description of a person type (used in NETEDIT)
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_PERSONSPERHOUR
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_EnableAttribute
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
An Element which don't belongs to GNENet but has influency in the simulation.
const GNEGeometry::SegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry (stacked)
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
const std::string & getID() const
get ID
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNEViewNet * getViewNet() const
get view net
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Position getPositionInView() const
Returns position of demand element in view.
GNEPerson(SumoXMLTag tag, GNENet *net, GNEDemandElement *pType, const SUMOVehicleParameter &personparameters)
constructor for persons
void updateGeometry()
update pre-computed geometry information
const RGBColor & getColor() const
get color
bool isAttributeEnabled(SumoXMLAttr key) const
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void endGeometryMoving()
end geometry movement
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
void computePath()
compute path
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
std::string getBegin() const
get begin time of demand element
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
SUMOVehicleClass getVClass() const
std::string getParentName() const
Returns the name of the parent object.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
double getAttributeDouble(SumoXMLAttr key) const
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void invalidatePath()
invalidate path
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
void startGeometryMoving()
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
static void setFlowParameters(const SumoXMLAttr attribute, int ¶meters)
configure flow parameters
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
SumoXMLTag getTagSynonym() const
get tag synonym
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static void drawAction_drawAsCircle(const double length, const double width)
static void drawAction_drawAsImage(const double angle, const double length, const double width, const std::string &file, const SUMOVehicleShape guiShape, const double exaggeration)
static void drawAction_drawAsTriangle(const double angle, const double length, const double width)
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual double getColorValue(const GUIVisualizationSettings &, int) const
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const T getColor(const double value) const
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings personValue
GUIVisualizationDetailSettings detailSettings
detail settings
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationSizeSettings personSize
bool drawDottedContour() const
check if dotted contour can be drawn
GUIColorer personColorer
The person colorer.
double scale
information about a lane's width (temporary, used for a single view)
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
double x() const
Returns the x-position.
double y() const
Returns the y-position.
double length() const
Returns the length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Structure representing possible vehicle parameter.
double repetitionProbability
The probability for emitting a vehicle per second.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
SumoXMLTag tag
The vehicle tag.
std::string vtypeid
The vehicle's type id.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
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.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
std::string getDepart() const
obtain depart parameter in string format
double departPos
(optional) The position the vehicle shall depart from
RGBColor color
The vehicle's color, TraCI may change this.
double arrivalPos
(optional) The position the vehicle shall arrive on
std::string id
The vehicle's id.
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.
bool wasSet(int what) const
Returns whether the given parameter was set.
std::string getDepartPos() const
obtain depart pos parameter in string format
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
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.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
personPlanSegment()
constructor
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool showDemandElements() const
check if show demand elements checkbox is enabled
static const double personShapes
details for draw person as person shapes
static const double personTriangles
details for draw person as triangles
static const double personCircles
details for draw person as circles
static const double personExaggeration
Exaggeration for persons (only used in NETEDIT)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double scaledSize(double scale, double constFactor=0.1) const
get scale size