59 myContainer(container),
60 myTransformToContainer(
nullptr),
61 myTransformToContainerFlow(
nullptr) {
63 myContainer->buildPopupHeader(
this, app);
65 myContainer->buildCenterPopupEntry(
this);
66 myContainer->buildPositionCopyEntry(
this, app);
70 new FXMenuSeparator(
this);
72 myContainer->getNet()->getViewNet()->buildSelectionACPopupEntry(
this, myContainer);
73 myContainer->buildShowParamsPopupEntry(
this);
75 if (myContainer->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
77 FXMenuPane* transformOperation =
new FXMenuPane(
this);
78 this->insertMenuPaneChild(transformOperation);
79 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
85 myTransformToContainer->disable();
87 myTransformToContainerFlow->disable();
98 if (obj == myTransformToContainer) {
100 }
else if (obj == myTransformToContainerFlow) {
114 mySelectedContainers(selectedContainer),
115 myTransformToContainer(nullptr),
116 myTransformToContainerFlow(nullptr) {
125 new FXMenuSeparator(
this);
132 FXMenuPane* transformOperation =
new FXMenuPane(
this);
134 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
148 for (
const auto& container : mySelectedContainers) {
149 if ((obj == myTransformToContainer) &&
150 (container->getTagProperty().getTag() == myContainerTag)) {
152 }
else if ((obj == myTransformToContainerFlow) &&
153 (container->getTagProperty().getTag() == myContainerTag)) {
168 resetDefaultValues();
199 double posOverLane = 0;
214 departStr.reserve(20 - departStr.size());
216 for (
int i = (
int)departStr.size(); i < 20; i++) {
217 departStr.insert(departStr.begin(),
'0');
263 containerPlan->writeDemandElement(device);
283 return "Container needs at least one plan";
312 demandElement->updateGeometry();
353 containerBoundary =
Boundary(-0.1, -0.1, 0.1, 0.1);
355 containerBoundary.
grow(20);
356 return containerBoundary;
368 bool drawContainer =
true;
371 drawContainer =
false;
373 drawContainer =
false;
375 drawContainer =
false;
377 drawContainer =
false;
387 const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
401 glTranslated(containerPosition.
x(), containerPosition.
y(), 0);
402 glRotated(90, 0, 0, 1);
406 glScaled(exaggeration, exaggeration, 1);
423 if (containerPlan->getTagProperty().isContainerPlan() && (containerPlan->getParentJunctions().size() > 0) && !
myNet->
getPathManager()->
isPathValid(containerPlan)) {
469 demandElement->computePathElement();
526 return "containerTriggered";
643 return canParse<RGBColor>(value);
645 double dummyDepartPos;
649 return error.empty();
658 return error.empty();
664 }
else if (canParse<double>(value)) {
665 return (parse<double>(value) >= 0);
672 }
else if (canParse<double>(value)) {
673 return (parse<double>(value) > 0);
681 }
else if (canParse<double>(value)) {
682 return (parse<double>(value) > 0);
689 }
else if (canParse<double>(value)) {
690 return (parse<double>(value) >= 0);
695 if (canParse<int>(value)) {
696 return (parse<int>(value) >= 0);
702 return canParse<bool>(value);
786 for (
const auto& i :
via) {
813 glScaled(length * 0.2, width * 0.2, 1);
817 glVertex2d(-1, -0.5);
821 glTranslated(0, 0, .045);
823 glVertex2d(-0.1, 0.4);
824 glVertex2d(-0.1, -0.4);
825 glVertex2d(-0.9, -0.4);
826 glVertex2d(-0.9, 0.4);
845 const double halfLength = length / 2.0 * exaggeration;
846 const double halfWidth = width / 2.0 * exaggeration;
860 containerPlan(_containerPlan),
867 containerPlan(nullptr),
885 containerPlans->setMicrosimID(
getID());
889 if (
getID().size() > 0) {
897 color = parse<RGBColor>(value);
945 if (parse<bool>(value)) {
FXDEFMAP(GNEContainer::GNEContainerPopupMenu) containerPopupMenuMap[]
@ MID_GNE_CONTAINER_TRANSFORM
transform container to another container type (ej: container to containerflow)
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
@ MID_COPY_NAME
Copy object name - popup entry.
@ GLO_CONTAINER
a container
@ GLO_CONTAINERFLOW
a person flow
GUIIcon
An enumeration of icons used by the gui applications.
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_IGNORING
vehicles ignoring classes
const std::string DEFAULT_CONTAINERTYPE_ID
const int VEHPARS_PROB_SET
const int VEHPARS_VPH_SET
const int VEHPARS_END_SET
const int VEHPARS_COLOR_SET
const int VEHPARS_POISSON_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
DepartDefinition
Possible ways to depart.
@ NOW
The vehicle is discarded if emission fails (not fully implemented yet)
@ SPLIT
The departure is triggered by a train split.
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container 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_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_POISSON
poisson definition (used in flow)
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_CONTAINERSPERHOUR
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_COLOR
A color information.
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 pushName(unsigned int name)
push Name
static void popMatrix()
pop matrix
static RGBColor getColor()
gets the gl-color
static void popName()
pop Name
static void pushMatrix()
push matrix
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)
const std::string getID() const
get ID (all Attribute Carriers have one)
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 tagProperty associated with this Attribute Carrier
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
reference to tagProperty associated with this attribute carrier
Position getPositionInView() const
Returns position of demand element in view.
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
GNELane * getLastPathLane() const
get last path lane
void updateGeometry()
update pre-computed geometry information
std::string getBegin() const
get begin time of demand element
Position getAttributePosition(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
const RGBColor & getColor() const
get color
GNEContainer(SumoXMLTag tag, GNENet *net)
default constructor
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
void drawAction_drawAsPoly() const
draw container as poly
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
void computePathElement()
compute pathElement
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
draw container as image
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEContainer()
destructor
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getParentName() const
Returns the name of the parent object.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
SUMOVehicleClass getVClass() const
GNEMoveOperation * getMoveOperation()
get move operation
double getAttributeDouble(SumoXMLAttr key) const
bool isAttributeEnabled(SumoXMLAttr key) const
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNELane * getFirstPathLane() const
get first path lane
const Parameterised::Map & getACParametersMap() const
get parameters map
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
An Element which don't belong to GNENet but has influence in the simulation.
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void drawJunctionLine(const GNEDemandElement *element) const
draw line between junctions
virtual Position getPositionInView() const =0
Returns position of demand element in view.
Problem
enum class for demandElement problems
void adjustDefaultFlowAttributes(SUMOVehicleParameter *vehicleParameters)
adjust flow default attributes (called in vehicle/person/flow constructors)
void setFlowParameters(SUMOVehicleParameter *vehicleParameters, const SumoXMLAttr attribute, const bool value)
set flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers
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
get elements shape
double newFirstPos
new first position
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEPathManager * getPathManager()
get path manager
GNEViewNet * getViewNet() const
get view net
PathElement()=delete
invalidate default constructor
bool isPathValid(const PathElement *pathElement) const
check if path element is valid
static void transformToContainerFlow(GNEContainer *originalContainer)
transform routeFlow over an existent route
static void transformToContainer(GNEContainer *originalContainer)
transform container functions
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
SumoXMLTag getXMLTag() const
get XML tag
bool isStopContainer() const
return true if tag correspond to a container stop element
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, 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
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
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
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
static void drawDottedSquaredShape(const GUIVisualizationSettings &s, const DottedContourType type, 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)
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual double getColorValue(const GUIVisualizationSettings &, int) const
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
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.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
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, bool forceShow=false) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings containerSize
GUIVisualizationTextSettings personValue
GUIVisualizationDetailSettings detailSettings
detail settings
int containerQuality
The quality of container drawing.
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationSizeSettings personSize
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationTextSettings containerName
GUIColorer containerColorer
The container colorer.
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, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
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"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
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".
A point in 2D or 3D with translation and scaling methods.
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 length2D() const
Returns the length.
Position positionAtOffset2D(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 altTag=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)
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
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error, const std::string &attr="departure")
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
containerPlanSegment()
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
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool showDemandElements() const
check if show demand elements checkbox is enabled
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
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size