 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
74 myAdditionalFrameParent(additionalFrameParent) {
79 myStopSelectingButton->disable();
80 myAbortSelectingButton->disable();
82 myCandidateLaneColor =
RGBColor(0, 64, 0, 255);
93 abortConsecutiveLaneSelector();
102 abortConsecutiveLaneSelector();
113 myStopSelectingButton->enable();
114 myAbortSelectingButton->enable();
116 addSelectedLane(lane, clickedPosition);
124 const auto& tagValues = myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties();
126 if (mySelectedLanes.size() < 2) {
127 WRITE_WARNING(myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties().getTagStr() +
" requieres at least two lanes.");
129 abortConsecutiveLaneSelector();
133 std::map<SumoXMLAttr, std::string> valuesMap = myAdditionalFrameParent->myAdditionalAttributes->getAttributesAndValues(
true);
135 myAdditionalFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(valuesMap,
nullptr);
137 valuesMap[
SUMO_ATTR_ID] = myAdditionalFrameParent->generateID(
nullptr);
139 std::vector<std::string> laneIDs;
140 for (
auto i : mySelectedLanes) {
141 laneIDs.push_back(i.first->getID());
149 if (!myAdditionalFrameParent->buildAdditionalCommonAttributes(valuesMap, tagValues)) {
153 if (myAdditionalFrameParent->myAdditionalAttributes->areValuesValid() ==
false) {
154 myAdditionalFrameParent->myAdditionalAttributes->showWarningMessage();
160 if (
GNEAdditionalHandler::buildAdditional(myAdditionalFrameParent->myViewNet,
true, myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties().getTag(), SUMOSAXAttrs,
nullptr)) {
162 abortConsecutiveLaneSelector();
174 for (
auto i : myCandidateLanes) {
175 i->setSpecialColor(
nullptr);
178 myCandidateLanes.clear();
180 for (
auto i : mySelectedLanes) {
181 i.first->setSpecialColor(
nullptr);
184 mySelectedLanes.clear();
186 myStopSelectingButton->disable();
187 myAbortSelectingButton->disable();
189 myAdditionalFrameParent->getViewNet()->update();
196 if (lane ==
nullptr) {
200 for (
auto i : mySelectedLanes) {
201 if (i.first == lane) {
207 if (mySelectedLanes.size() > 0) {
208 if (myCandidateLanes.empty()) {
211 }
else if ((myCandidateLanes.size() > 0) && (std::find(myCandidateLanes.begin(), myCandidateLanes.end(), lane) == myCandidateLanes.end())) {
221 for (
auto i : myCandidateLanes) {
222 if (!isLaneSelected(i)) {
223 i->setSpecialColor(
nullptr);
227 myCandidateLanes.clear();
231 if ((lane == i->getLaneFrom()) && (!isLaneSelected(i->getLaneTo()))) {
233 i->getLaneTo()->setSpecialColor(&myCandidateLaneColor);
234 myCandidateLanes.push_back(i->getLaneTo());
238 myAdditionalFrameParent->getViewNet()->update();
245 if (mySelectedLanes.size() > 1) {
246 mySelectedLanes.pop_back();
255 return myStopSelectingButton->isEnabled();
267 return mySelectedLaneColor;
271 const std::vector<std::pair<GNELane*, double> >&
273 return mySelectedLanes;
279 stopConsecutiveLaneSelector();
286 abortConsecutiveLaneSelector();
293 for (
auto i : mySelectedLanes) {
294 if (i.first == lane) {
307 myAdditionalFrameParent(additionalFrameParent) {
336 std::vector<std::string> vectorOfIds;
337 if (myUseSelectedEdgesCheckButton->getCheck()) {
339 std::vector<GNEEdge*> selectedEdges = myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(
true);
341 for (
auto i : selectedEdges) {
342 vectorOfIds.push_back(i->getID());
346 for (
int i = 0; i < myList->getNumItems(); i++) {
347 if (myList->isItemSelected(i)) {
348 vectorOfIds.push_back(myList->getItem(i)->getText().text());
359 myList->clearItems();
362 std::vector<GNEEdge*> vectorOfEdges = myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(
false);
364 for (
auto i : vectorOfEdges) {
366 if (i->getID().find(search) != std::string::npos) {
367 myList->appendItem(i->getID().c_str());
371 myUseSelectedEdgesCheckButton->setCheck(
false);
390 if (myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(
true).size() > 0) {
391 myUseSelectedEdgesCheckButton->enable();
393 myUseSelectedEdgesCheckButton->disable();
400 if (myUseSelectedEdgesCheckButton->getCheck()) {
401 myEdgesSearch->hide();
403 myClearEdgesSelection->hide();
404 myInvertEdgesSelection->hide();
406 myEdgesSearch->show();
408 myClearEdgesSelection->show();
409 myInvertEdgesSelection->show();
422 showSelectorEdgeChildrenModul(myEdgesSearch->getText().text());
435 for (
int i = 0; i < myList->getNumItems(); i++) {
436 if (myList->getItem(i)->isSelected()) {
437 myList->deselectItem(i);
446 for (
int i = 0; i < myList->getNumItems(); i++) {
447 if (myList->getItem(i)->isSelected()) {
448 myList->deselectItem(i);
450 myList->selectItem(i);
462 myAdditionalFrameParent(additionalFrameParent) {
491 std::vector<std::string> vectorOfIds;
492 if (myUseSelectedLanesCheckButton->getCheck()) {
494 std::vector<GNELane*> selectedLanes = myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(
true);
496 for (
auto i : selectedLanes) {
497 vectorOfIds.push_back(i->getID());
501 for (
int i = 0; i < myList->getNumItems(); i++) {
502 if (myList->isItemSelected(i)) {
503 vectorOfIds.push_back(myList->getItem(i)->getText().text());
513 myList->clearItems();
514 std::vector<GNELane*> vectorOfLanes = myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(
false);
515 for (
auto i : vectorOfLanes) {
516 if (i->getID().find(search) != std::string::npos) {
517 myList->appendItem(i->getID().c_str());
521 myUseSelectedLanesCheckButton->setCheck(
false);
536 if (myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(
true).size() > 0) {
537 myUseSelectedLanesCheckButton->enable();
539 myUseSelectedLanesCheckButton->disable();
546 if (myUseSelectedLanesCheckButton->getCheck()) {
547 myLanesSearch->hide();
549 clearLanesSelection->hide();
550 invertLanesSelection->hide();
552 myLanesSearch->show();
554 clearLanesSelection->show();
555 invertLanesSelection->show();
581 for (
int i = 0; i < myList->getNumItems(); i++) {
582 if (myList->getItem(i)->isSelected()) {
583 myList->deselectItem(i);
592 for (
int i = 0; i < myList->getNumItems(); i++) {
593 if (myList->getItem(i)->isSelected()) {
594 myList->deselectItem(i);
596 myList->selectItem(i);
607 GNEFrame(horizontalFrameParent, viewNet,
"Additionals") {
757 return netElement->
getID();
763 return tagProperties.getTagStr() +
"_" + netElement->
getID() +
"_" +
toString(additionalIndex);
770 return tagProperties.getTagStr() +
"_" +
toString(additionalIndex);
798 double end = GNEAttributeCarrier::parse<double>(valuesMap[
SUMO_ATTR_END]);
876 if (lane !=
nullptr) {
917 if (lane ==
nullptr) {
932 std::vector<std::string> laneIDs;
934 laneIDs.push_back(i.first->getID());
bool showSelectorParentModul(SumoXMLTag additionalTypeParent)
Show list of SelectorParent Modul.
void showSelectorEdgeChildrenModul(std::string search="")
Show SelectorEdgeChildren Modul.
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEFrameAttributesModuls::AttributesCreator * myAdditionalAttributes
internal additional attributes
An Element which don't belongs to GNENet but has influency in the simulation.
#define GUIDesignTextFieldNCol
Num of column of text field.
struct with the attribute Properties
const std::vector< std::pair< GNELane *, double > > & getSelectedLanes() const
get current selected lanes
const std::string getID() const
function to support debugging
#define WRITE_WARNING(msg)
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
SelectorLaneChildren()
FOX needs this.
bool buildAdditionalCommonAttributes(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build common additional attributes
FXButton * invertLanesSelection
button for invert selection
long onCmdAbortSelection(FXObject *, FXSelector, void *)
Called when the user press abort selection button.
void updateUseSelectedEdges()
Update use selectedEdges.
bool stopConsecutiveLaneSelector()
stop selection of consecutive lanes
void setIDSelected(const std::string &id)
select manually a element of the list
void removeLastSelectedLane()
remove last added point
~SelectorLaneChildren()
destructor
FXButton * myInvertEdgesSelection
button for invert selection
GNEFrameModuls::TagSelector * myAdditionalTagSelector
item selector
bool addAdditional(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
add additional element
void showSelectorLaneParentsModul()
show SelectorLaneParents modul
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
FXDEFMAP(GNEAdditionalFrame::SelectorLaneParents) ConsecutiveLaneSelectorMap[]
std::string getEdgeIdsSelected() const
get list of selecte id's in string format
bool areValuesValid() const
check if parameters of attributes are valid
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
long onCmdStopSelection(FXObject *, FXSelector, void *)
begin/end of the description of a single lane
void setStatusBarText(const std::string &text)
set staturBar text
#define GUIDesignListFixedHeight
design for FXLists with height fixed
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
bool buildAdditionalOverEdge(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over an edge (parent of lane)
#define GUIDesignTextField
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
long onCmdSelectEdge(FXObject *, FXSelector, void *)
called when user select a edge of the list
void updateUseSelectedLanes()
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
SelectorEdgeChildren()
FOX needs this.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
PositionVector shape
The shape of the netElement element.
const RGBColor & getSelectedLaneColor() const
get selected lane color
void showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &myTagProperties)
show AttributesCreator modul
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
void showSelectorLaneChildrenModul(std::string search="")
Show list of SelectorLaneChildren Modul.
void hideAttributesCreatorModul()
hide group box
~SelectorEdgeChildren()
destructor
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons)
std::map< SumoXMLAttr, std::string > getAttributesAndValues(bool includeAll) const
get attributes and their values
GNENet * getNet() const
get the net object
static bool buildAdditional(GNEViewNet *viewNet, bool allowUndoRedo, SumoXMLTag tag, const SUMOSAXAttributes &attrs, HierarchyInsertedAdditionals *insertedAdditionals)
Build additionals.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
clear selection of elements
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Encapsulated Xerces-SAX-attributes.
class used to group all variables related with objects under cursor after a click over view
abort selection of consecutive egdes/lanes
bool buildAdditionalOverLane(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over a single lane
double getLengthGeometryFactor() const
get length geometry factor
GNEEdge & getParentEdge()
Returns underlying parent edge.
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
GNEAdditionalFrame::SelectorLaneParents * getConsecutiveLaneSelector() const
getConsecutive Lane Selector
~GNEAdditionalFrame()
Destructor.
begin/end of the description of an edge
SumoXMLTag getParentTag() const
if Tag owns a parent, return parent tag
#define GUIDesignCheckButton
checkButton placed in left position
A point in 2D or 3D with translation and scaling methods.
GNEViewNet * myViewNet
View Net.
const std::map< int, std::string > & getPredefinedTagsMML() const
get predefinedTagsMML
bool isShown() const
return true if modul is shown
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties &tagValue)
show Netedit attributes modul
GNEFrameModuls::SelectorParent * myAdditionalParent
Modul for select a single additional parent.
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
bool addSelectedLane(GNELane *lane, const Position &clickedPosition)
return true if lane can be selected as consecutive lane
void hideSelectorEdgeChildrenModul()
hide SelectorEdgeChildren Modul
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
SelectorLaneChildren * mySelectorLaneChildren
Modul for select lane children.
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
const NetElementGeometry & getGeometry() const
bool getNeteditAttributesAndValues(std::map< SumoXMLAttr, std::string > &valuesMap, const GNELane *lane) const
fill valuesMap with netedit attributes
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
std::string getIdSelected() const
get currently additional parent selected
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
long onCmdUseSelectedLanes(FXObject *, FXSelector, void *)
an e2 detector over multiple lanes (used by Netedit)
~SelectorLaneParents()
destructor
void hideSelectorLaneParentsModul()
hide SelectorLaneParents
void showSelectorLaneChildrenModul()
show selector lane child and update use selected edges/lanes
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void setCurrentTag(SumoXMLTag newTag)
set current type manually
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
void tagSelected()
Tag selected in TagSelector.
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show
FXList * myList
List of SelectorEdgeChildren.
bool buildAdditionalOverView(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over view
SelectorLaneParents * mySelectorLaneParents
Modul for select lane parents (currently only consecutives)
FXList * myList
List of SelectorLaneChildren.
bool isLaneSelected(GNELane *lane) const
check if certain lane is selected
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
FXButton * clearLanesSelection
button for clear selection
stop selection of consecutive egdes/lanes
invert selection of eleents
bool buildAdditionalOverLanes(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over lanes
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
SelectorEdgeChildren * mySelectorEdgeChildren
Modul for select edge children.
FXTextField * myLanesSearch
text field for search lane IDs
C++ TraCI client API implementation.
bool hasParent() const
return true if tag correspond to an element that can had another element as parent
void hideSelectorLaneChildrenModul()
hide SelectorLaneChildren Modul
FXButton * myClearEdgesSelection
button for clear selection
static const RGBColor GREEN
GNEAdditionalFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
bool buildAdditionalWithParent(std::map< SumoXMLAttr, std::string > &valuesMap, GNEAdditional *parent, const GNEAttributeCarrier::TagProperties &tagValues)
build additional with Parent
std::string getLaneIdsSelected() const
get list of selecte lane ids in string format
void abortConsecutiveLaneSelector()
abort selection of consecutive lanes
bool isSelectingLanes() const
return true if modul is selecting lane
void hideNeteditAttributesModul()
hide Netedit attributes modul
A calibrator placed over edge.
long onCmdSelectLane(FXObject *, FXSelector, void *)
called when user select a lane of the list
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
virtual void show()
show Frame
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
GNEAdditional * getAdditionalFront() const
get front additional element (or a pointer to nullptr if there isn't)
void refreshSelectorParentModul()
Refresh list of Additional Parents Modul.
void hideSelectorParentModul()
hide SelectorParent Modul
void startConsecutiveLaneSelector(GNELane *lane, const Position &clickedPosition)
start selection of consecutive lanes
parent of an additional element
FXTextField * myEdgesSearch
text field for search edge IDs