 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
63 myPersonPlanFrameParent(vehicleFrameParent) {
88 std::ostringstream information;
90 if (myPersonPlanFrameParent->myPersonSelector->isDemandElementSelectorShown()) {
92 switch (myPersonPlanFrameParent->myPersonPlanTagSelector->getCurrentTagProperties().getTag()) {
95 <<
"- Click over edges to\n"
100 <<
"- Click over an edge and\n"
101 <<
" a bus to create a trip.";
105 <<
"- Click over a sequenz of\n"
106 <<
" consecutive edges to\n"
107 <<
" create a walk.";
111 <<
"- Click over edges to\n"
112 <<
" create a walk.";
116 <<
"- Click over an edge and\n"
117 <<
" a bus to create a walk.";
121 <<
"- Click over a route";
125 <<
"- Click over edges to\n"
126 <<
" create a ride.";
130 <<
"- Click over an edge and\n"
131 <<
" a bus to create a ride";
137 information <<
"- There aren't persons or\n"
138 <<
" personFlows in network.";
141 myInformationLabel->setText(information.str().c_str());
150 myPersonPlanFrameParent(frameParent) {
175 std::string nameWithFirstCapitalizedLetter = name;
176 nameWithFirstCapitalizedLetter[0] = (char)toupper(nameWithFirstCapitalizedLetter.at(0));
177 setText((nameWithFirstCapitalizedLetter +
" creator").c_str());
178 myFinishCreationButton->setText((
"Finish " + name +
" creation").c_str());
179 myAbortCreationButton->setText((
"Abort " + name +
" creation").c_str());
186 refreshPersonPlanCreator();
195 myAbortCreationButton->disable();
196 myFinishCreationButton->disable();
197 myRemoveLastEdge->disable();
199 for (
const auto& i : myClickedEdges) {
200 for (
const auto& j : i->getLanes()) {
201 j->setSpecialColor(
nullptr);
205 myClickedEdges.clear();
207 myTemporalEdgePath.clear();
216 myFinishCreationButton->disable();
217 myAbortCreationButton->disable();
218 myRemoveLastEdge->disable();
220 for (
const auto& i : myClickedEdges) {
221 for (
const auto& j : i->getLanes()) {
222 j->setSpecialColor(
nullptr);
226 myClickedEdges.clear();
227 myTemporalEdgePath.clear();
229 if (myPersonPlanFrameParent->myPersonSelector->getCurrentDemandElement() &&
230 (myPersonPlanFrameParent->myPersonSelector->getCurrentDemandElement()->getDemandElementChildren().size() > 0)) {
232 SumoXMLTag lastPersonPlanElementTag = myPersonPlanFrameParent->myPersonSelector->getCurrentDemandElement()->getDemandElementChildren().back()->getTagProperty().getTag();
237 addEdge(&lastPersonPlanElement->
getLaneParents().front()->getParentEdge());
240 addEdge(&lastPersonPlanElement->
getAdditionalParents().front()->getLaneParents().front()->getParentEdge());
243 addEdge(&lastPersonPlanElement->
getAdditionalParents().front()->getLaneParents().front()->getParentEdge());
252 myCurrentBeginElementLabel->setText((myClickedEdges.front()->getID()).c_str());
261 std::vector<GNEEdge*>
263 return myClickedEdges;
267 const std::vector<GNEEdge*>&
269 return myTemporalEdgePath;
276 if (myClickedEdges.empty() || ((myClickedEdges.size() > 0) && (myClickedEdges.back() != edge))) {
277 myClickedEdges.push_back(edge);
279 myAbortCreationButton->enable();
281 myPersonPlanFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->disableUndoRedo(
"trip creation");
284 i->setSpecialColor(&myPersonPlanFrameParent->getEdgeCandidateSelectedColor());
287 if (myClickedEdges.size() > 1) {
289 myRemoveLastEdge->enable();
291 myFinishCreationButton->enable();
293 if (myPersonPlanFrameParent->myPersonPlanTagSelector->getCurrentTagProperties().isRide()) {
309 if (myTemporalEdgePath.size() > 1) {
319 GLHelper::drawLine(myTemporalEdgePath.at(0)->getNBEdge()->getLanes().front().shape.front(),
320 myTemporalEdgePath.at(0)->getNBEdge()->getLanes().front().shape.back());
322 for (
int i = 1; i < (int)myTemporalEdgePath.size(); i++) {
323 GLHelper::drawLine(myTemporalEdgePath.at(i - 1)->getNBEdge()->getLanes().front().shape.back(),
324 myTemporalEdgePath.at(i)->getNBEdge()->getLanes().front().shape.front());
325 GLHelper::drawLine(myTemporalEdgePath.at(i)->getNBEdge()->getLanes().front().shape.front(),
326 myTemporalEdgePath.at(i)->getNBEdge()->getLanes().front().shape.back());
336 if (myAbortCreationButton->isEnabled()) {
337 onCmdAbortPersonPlanCreation(
nullptr, 0,
nullptr);
344 if (myFinishCreationButton->isEnabled()) {
345 onCmdFinishPersonPlanCreation(
nullptr, 0,
nullptr);
352 if (myRemoveLastEdge->isEnabled()) {
353 onCmdRemoveLastElement(
nullptr, 0,
nullptr);
361 refreshPersonPlanCreator();
363 myPersonPlanFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->enableUndoRedo();
371 if (myClickedEdges.size() > 1) {
373 myPersonPlanFrameParent->personPlanCreated(
nullptr,
nullptr);
375 myPersonPlanFrameParent->myViewNet->update();
377 refreshPersonPlanCreator();
379 myPersonPlanFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->enableUndoRedo();
387 if (myClickedEdges.size() > 1) {
389 myClickedEdges.pop_back();
391 if (myPersonPlanFrameParent->myPersonPlanTagSelector->getCurrentTagProperties().isRide()) {
405 GNEFrame(horizontalFrameParent, viewNet,
"PersonPlans") {
499 }
else if (requireEdge && objectsUnderCursor.
getEdgeFront()) {
599 std::vector<std::string> types = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_VTYPES]);
600 std::vector<std::string> modes = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_MODES]);
614 std::vector<std::string> types = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_VTYPES]);
615 std::vector<std::string> modes = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_MODES]);
617 if (busStop ==
nullptr) {
662 if (busStop ==
nullptr) {
681 if (route !=
nullptr) {
690 std::vector<std::string> lines = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_LINES]);
704 std::vector<std::string> lines = GNEAttributeCarrier::parse<std::vector<std::string> >(valuesMap[
SUMO_ATTR_LINES]);
706 if (busStop ==
nullptr) {
void hideAttributeCarrierHierarchy()
hide AttributeCarrierHierarchy
const AttributeCarriers & getAttributeCarriers() const
retrieve all attribute carriers of Net
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".
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
void abortPersonPlanCreation()
abort person plan creation
void setDemandElement(GNEDemandElement *demandElement)
set current demand element
static void buildRideFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, const std::vector< std::string > &lines, double arrivalPos)
build ride using a from-to edges
~PersonPlanCreator()
destructor
~HelpCreation()
destructor
static void buildPersonTripBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, GNEAdditional *busStop, const std::vector< std::string > &types, const std::vector< std::string > &modes)
build trip using a from edge and a busStop
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
FXDEFMAP(GNEPersonPlanFrame::PersonPlanCreator) PersonPlanCreatorMap[]
GNEEdge * getEdgeFront() const
get front edge (or a pointer to nullptr if there isn't)
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
void removeLastAddedElement()
remove last added element
GNEFrameModuls::TagSelector * myPersonPlanTagSelector
personPlan selector
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 showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &myTagProperties)
show AttributesCreator modul
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)
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
std::map< SumoXMLAttr, std::string > getAttributesAndValues(bool includeAll) const
get attributes and their values
GNENet * getNet() const
get the net object
~GNEPersonPlanFrame()
Destructor.
static void buildWalkFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, double arrivalPos)
build walk using a from-to edges
FXButton * myFinishCreationButton
button for finish route creation
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
GNEFrameAttributesModuls::AttributesCreator * myPersonPlanAttributes
internal vehicle attributes
static void buildRideBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, GNEAdditional *busStop, const std::vector< std::string > &lines)
build ride using a from edge and a busStop
static const RGBColor ORANGE
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
vehicle is a passenger car (a "normal" car)
PersonPlanCreator()
FOX needs this.
GNEDemandElement * getCurrentDemandElement() const
get current demand element
void hidePersonPlanCreator()
show PersonPlanCreator
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
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
static void buildWalkRoute(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEDemandElement *routeParent, double arrivalPos)
build walk using a list of consecutive edges
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 *)
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".
static void buildPersonTripFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, const std::vector< std::string > &types, const std::vector< std::string > &modes, double arrivalPos)
build trip using a from-to edges
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators)
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.
void demandElementSelected()
selected demand element in DemandElementSelector
static void buildWalkBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, GNEAdditional *busStop)
build walk using a form edge an a busStop
GNEFrameModuls::DemandElementSelector * myPersonSelector
Person selectors.
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
void showTagSelector()
show item selector
finish edge path creation
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
virtual void show()
show Frame
HelpCreation * myHelpCreation
Help creation.
void hideHelpCreation()
hide HelpCreation
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
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