 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
62 myPersonPlanFrameParent(vehicleFrameParent) {
87 std::ostringstream information;
89 if (myPersonPlanFrameParent->myPersonSelector->isDemandElementSelectorShown()) {
91 switch (myPersonPlanFrameParent->myPersonPlanTagSelector->getCurrentTagProperties().getTag()) {
94 <<
"- Click over edges to\n"
99 <<
"- Click over an edge and\n"
100 <<
" a bus to create a trip.";
104 <<
"- Click over a sequenz of\n"
105 <<
" consecutive edges to\n"
106 <<
" create a walk.";
110 <<
"- Click over edges to\n"
111 <<
" create a walk.";
115 <<
"- Click over an edge and\n"
116 <<
" a bus to create a walk.";
120 <<
"- Click over a route";
124 <<
"- Click over edges to\n"
125 <<
" create a ride.";
129 <<
"- Click over an edge and\n"
130 <<
" a bus to create a ride";
136 information <<
"- There aren't persons or\n"
137 <<
" personFlows in network.";
140 myInformationLabel->setText(information.str().c_str());
149 myPersonPlanFrameParent(frameParent) {
174 std::string nameWithFirstCapitalizedLetter = name;
175 nameWithFirstCapitalizedLetter[0] = (char)toupper(nameWithFirstCapitalizedLetter.at(0));
176 setText((nameWithFirstCapitalizedLetter +
" creator").c_str());
177 myFinishCreationButton->setText((
"Finish " + name +
" creation").c_str());
178 myAbortCreationButton->setText((
"Abort " + name +
" creation").c_str());
185 refreshPersonPlanCreator();
194 myAbortCreationButton->disable();
195 myFinishCreationButton->disable();
196 myRemoveLastEdge->disable();
198 for (
const auto& i : myClickedEdges) {
199 for (
const auto& j : i->getLanes()) {
200 j->setSpecialColor(
nullptr);
204 myClickedEdges.clear();
206 myTemporalEdgePath.clear();
215 myFinishCreationButton->disable();
216 myAbortCreationButton->disable();
217 myRemoveLastEdge->disable();
219 for (
const auto& i : myClickedEdges) {
220 for (
const auto& j : i->getLanes()) {
221 j->setSpecialColor(
nullptr);
225 myClickedEdges.clear();
226 myTemporalEdgePath.clear();
228 if (myPersonPlanFrameParent->myPersonSelector->getCurrentDemandElement() &&
229 (myPersonPlanFrameParent->myPersonSelector->getCurrentDemandElement()->getChildDemandElements().size() > 0)) {
231 SumoXMLTag lastPersonPlanElementTag = myPersonPlanFrameParent->myPersonSelector->getCurrentDemandElement()->getChildDemandElements().back()->getTagProperty().getTag();
236 addEdge(lastPersonPlanElement->
getParentLanes().front()->getParentEdge());
239 addEdge(lastPersonPlanElement->
getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
242 addEdge(lastPersonPlanElement->
getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
251 myCurrentBeginElementLabel->setText((myClickedEdges.front()->getID()).c_str());
260 std::vector<GNEEdge*>
262 return myClickedEdges;
266 const std::vector<GNEEdge*>&
268 return myTemporalEdgePath;
275 if (myClickedEdges.empty() || ((myClickedEdges.size() > 0) && (myClickedEdges.back() != edge))) {
276 myClickedEdges.push_back(edge);
278 myAbortCreationButton->enable();
280 myPersonPlanFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->disableUndoRedo(
"trip creation");
283 i->setSpecialColor(&myPersonPlanFrameParent->getEdgeCandidateSelectedColor());
286 if (myClickedEdges.size() > 1) {
288 myRemoveLastEdge->enable();
290 myFinishCreationButton->enable();
292 if (myPersonPlanFrameParent->myPersonPlanTagSelector->getCurrentTagProperties().isRide()) {
308 if (myTemporalEdgePath.size() > 1) {
318 GLHelper::drawLine(myTemporalEdgePath.at(0)->getNBEdge()->getLanes().front().shape.front(),
319 myTemporalEdgePath.at(0)->getNBEdge()->getLanes().front().shape.back());
321 for (
int i = 1; i < (int)myTemporalEdgePath.size(); i++) {
322 GLHelper::drawLine(myTemporalEdgePath.at(i - 1)->getNBEdge()->getLanes().front().shape.back(),
323 myTemporalEdgePath.at(i)->getNBEdge()->getLanes().front().shape.front());
324 GLHelper::drawLine(myTemporalEdgePath.at(i)->getNBEdge()->getLanes().front().shape.front(),
325 myTemporalEdgePath.at(i)->getNBEdge()->getLanes().front().shape.back());
335 if (myAbortCreationButton->isEnabled()) {
336 onCmdAbortPersonPlanCreation(
nullptr, 0,
nullptr);
343 if (myFinishCreationButton->isEnabled()) {
344 onCmdFinishPersonPlanCreation(
nullptr, 0,
nullptr);
351 if (myRemoveLastEdge->isEnabled()) {
352 onCmdRemoveLastElement(
nullptr, 0,
nullptr);
360 refreshPersonPlanCreator();
362 myPersonPlanFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->enableUndoRedo();
370 if (myClickedEdges.size() > 1) {
372 myPersonPlanFrameParent->personPlanCreated(
nullptr,
nullptr);
374 myPersonPlanFrameParent->myViewNet->update();
376 refreshPersonPlanCreator();
378 myPersonPlanFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->enableUndoRedo();
386 if (myClickedEdges.size() > 1) {
388 myClickedEdges.pop_back();
390 if (myPersonPlanFrameParent->myPersonPlanTagSelector->getCurrentTagProperties().isRide()) {
404 GNEFrame(horizontalFrameParent, viewNet,
"PersonPlans") {
498 }
else if (requireEdge && objectsUnderCursor.
getEdgeFront()) {
598 std::vector<std::string> types = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_VTYPES]);
599 std::vector<std::string> modes = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_MODES]);
611 std::vector<std::string> types = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_VTYPES]);
612 std::vector<std::string> modes = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_MODES]);
614 if (busStop ==
nullptr) {
655 if (busStop ==
nullptr) {
672 if (route !=
nullptr) {
681 std::vector<std::string> lines = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_LINES]);
693 std::vector<std::string> lines = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_LINES]);
695 if (busStop ==
nullptr) {
void hideAttributeCarrierHierarchy()
hide AttributeCarrierHierarchy
const AttributeCarriers & getAttributeCarriers() const
retrieve all attribute carriers of Net
@ SVC_PEDESTRIAN
pedestrian
void tagSelected()
Tag selected in TagSelector.
void showAttributeCarrierHierarchy(GNEAttributeCarrier *AC)
show AttributeCarrierHierarchy
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency in the simulation.
long onCmdFinishPersonPlanCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Finish route creation".
static void buildPersonTripFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, double arrivalPos, const std::vector< std::string > &types, const std::vector< std::string > &modes)
build trip using a from-to edges
PersonPlanCreator * getPersonPlanCreator() const
get PersonPlanCreator modul
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool addEdge(GNEEdge *edge)
add edge to route
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
void abortPersonPlanCreation()
abort person plan creation
void setDemandElement(GNEDemandElement *demandElement)
set current demand element
static void buildRideFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, const std::vector< std::string > &lines, double arrivalPos)
build ride using a from-to edges
~PersonPlanCreator()
destructor
~HelpCreation()
destructor
void refreshDemandElementSelector()
refresh demand element selector
bool areValuesValid() const
check if parameters of attributes are valid
FXLabel * myCurrentBeginElementLabel
Label with current begin element.
void setStatusBarText(const std::string &text)
set staturBar text
static void buildRideBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEAdditional *busStop, const std::vector< std::string > &lines)
build ride using a from edge and a busStop
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
FXDEFMAP(GNEPersonPlanFrame::PersonPlanCreator) PersonPlanCreatorMap[]
@ MID_GNE_EDGEPATH_ABORT
abort edge path creation
GNEEdge * getEdgeFront() const
get front edge (or a pointer to nullptr if there isn't)
void removeLastAddedElement()
remove last added element
GNEFrameModuls::TagSelector * myPersonPlanTagSelector
personPlan selector
@ SUMO_TAG_NOTHING
invalid tag
void refreshPersonPlanCreator()
show PersonPlanCreator
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
void setCurrentTagType(GNEAttributeCarrier::TagType tagType)
set current type manually
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::vector< GNEEdge * > getClickedEdges() const
get clicked edges
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void finishPersonPlanCreation()
finish person plan creation
void hideAttributesCreatorModul()
hide group box
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
A road/street connecting two junctions (netedit-version)
static void buildWalkRoute(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEDemandElement *route, double arrivalPos)
build walk using a list of consecutive edges
std::map< SumoXMLAttr, std::string > getAttributesAndValues(bool includeAll) const
get attributes and their values
GNENet * getNet() const
get the net object
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
~GNEPersonPlanFrame()
Destructor.
FXButton * myFinishCreationButton
button for finish route creation
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
GNEFrameAttributesModuls::AttributesCreator * myPersonPlanAttributes
internal vehicle attributes
static const RGBColor ORANGE
@ SUMO_TAG_PERSONSTOP_LANE
class used to group all variables related with objects under cursor after a click over view
const std::vector< GNEEdge * > & getEdgePath() const
get current edge path
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
PersonPlanCreator(GNEPersonPlanFrame *frameParent)
FOX-declaration.
GNEDemandElement * getCurrentDemandElement() const
get current demand element
void hidePersonPlanCreator()
show PersonPlanCreator
static void buildWalkBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEAdditional *busStop)
build walk using a from edge an a busStop
GNEFrameModuls::AttributeCarrierHierarchy * myPersonHierarchy
Person Hierarchy.
bool personPlanCreated(GNEAdditional *busStop, GNEDemandElement *route)
finish person plan creation
GNEViewNet * myViewNet
View Net.
GNEPersonPlanFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
void showHelpCreation()
show HelpCreation
void drawTemporalRoute() const
draw temporal route
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
bool isWalk() const
return true if tag correspond to a walk element
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
@ SUMO_TAG_PERSONTRIP_BUSSTOP
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > demandElements
map with the name and pointer to demand elements of net
void showPersonPlanCreator()
show PersonPlanCreator
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center and height of 23
FXButton * myRemoveLastEdge
button for removing last edge
void hideTagSelector()
hide item selector
long onCmdAbortPersonPlanCreation(FXObject *, FXSelector, void *)
void refreshRows()
refresh rows (called after creating an element)
bool isPersonTrip() const
return true if tag correspond to a person trip
long onCmdRemoveLastElement(FXObject *, FXSelector, void *)
Called when the user click over button "Remove last inserted edge".
@ SUMO_TAG_BUS_STOP
A bus stop.
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show
GNEDemandElement * getDemandElementFront() const
get front net element element (or a pointer to nullptr if there isn't)
PersonPlanCreator * myPersonPlanCreator
Person Plan Creator.
@ SUMO_TAG_PERSONTRIP_FROMTO
static void buildPersonTripBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEAdditional *busStop, const std::vector< std::string > &types, const std::vector< std::string > &modes)
build trip using a from edge and a busStop
void demandElementSelected()
selected demand element in DemandElementSelector
GNEFrameModuls::DemandElementSelector * myPersonSelector
Person selectors.
@ SUMO_TAG_ROUTE
begin/end of the description of a route
void edgePathCreatorName(const std::string &name)
update PersonPlanCreator name
void hideDemandElementSelector()
hide demand element selector
FXButton * myAbortCreationButton
button for abort route creation
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra route between a list of partial edges
bool addPersonPlan(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
add vehicle element
bool isRide() const
return true if tag correspond to a ride element
void refreshAttributeCarrierHierarchy()
refresh AttributeCarrierHierarchy
@ SUMO_TAG_PERSONSTOP_BUSSTOP
void showTagSelector()
show item selector
@ MID_GNE_EDGEPATH_FINISH
finish edge path creation
virtual void show()
show Frame
HelpCreation * myHelpCreation
Help creation.
void hideHelpCreation()
hide HelpCreation
void showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &tagProperties, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
static void buildWalkFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, double arrivalPos)
build walk using a from-to edges
virtual void hide()
hide Frame
GNEAdditional * getAdditionalFront() const
get front additional element (or a pointer to nullptr if there isn't)
void updateHelpCreation()
update HelpCreation
@ MID_GNE_EDGEPATH_REMOVELAST
remove last inserted element in path
static void buildWalkEdges(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, double arrivalPos)
build walk using a list of consecutive edges