 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
73 myAdditionalFrameParent(additionalFrameParent) {
78 myStopSelectingButton->disable();
79 myAbortSelectingButton->disable();
81 myCandidateLaneColor =
RGBColor(0, 64, 0, 255);
92 abortConsecutiveLaneSelector();
101 abortConsecutiveLaneSelector();
112 myStopSelectingButton->enable();
113 myAbortSelectingButton->enable();
115 addSelectedLane(lane, clickedPosition);
123 const auto& tagValues = myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties();
125 if (mySelectedLanes.size() < 2) {
126 WRITE_WARNING(myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties().getTagStr() +
" requires at least two lanes.");
128 abortConsecutiveLaneSelector();
132 std::map<SumoXMLAttr, std::string> valuesMap = myAdditionalFrameParent->myAdditionalAttributes->getAttributesAndValues(
true);
134 myAdditionalFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(valuesMap,
nullptr);
137 valuesMap[
SUMO_ATTR_ID] = myAdditionalFrameParent->generateID(
nullptr);
140 std::vector<std::string> laneIDs;
141 for (
auto i : mySelectedLanes) {
142 laneIDs.push_back(i.first->getID());
150 if (!myAdditionalFrameParent->buildAdditionalCommonAttributes(valuesMap, tagValues)) {
154 if (myAdditionalFrameParent->myAdditionalAttributes->areValuesValid() ==
false) {
155 myAdditionalFrameParent->myAdditionalAttributes->showWarningMessage();
161 if (
GNEAdditionalHandler::buildAdditional(myAdditionalFrameParent->myViewNet,
true, myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties().getTag(), SUMOSAXAttrs,
nullptr)) {
163 abortConsecutiveLaneSelector();
165 myAdditionalFrameParent->myAdditionalAttributes->refreshRows();
177 for (
auto i : myCandidateLanes) {
178 i->setSpecialColor(
nullptr);
181 myCandidateLanes.clear();
183 for (
auto i : mySelectedLanes) {
184 i.first->setSpecialColor(
nullptr);
187 mySelectedLanes.clear();
189 myStopSelectingButton->disable();
190 myAbortSelectingButton->disable();
192 myAdditionalFrameParent->getViewNet()->update();
199 if (lane ==
nullptr) {
203 for (
auto i : mySelectedLanes) {
204 if (i.first == lane) {
210 if (mySelectedLanes.size() > 0) {
211 if (myCandidateLanes.empty()) {
214 }
else if ((myCandidateLanes.size() > 0) && (std::find(myCandidateLanes.begin(), myCandidateLanes.end(), lane) == myCandidateLanes.end())) {
224 for (
auto i : myCandidateLanes) {
225 if (!isLaneSelected(i)) {
226 i->setSpecialColor(
nullptr);
230 myCandidateLanes.clear();
234 if ((lane == i->getLaneFrom()) && (!isLaneSelected(i->getLaneTo()))) {
236 i->getLaneTo()->setSpecialColor(&myCandidateLaneColor);
237 myCandidateLanes.push_back(i->getLaneTo());
241 myAdditionalFrameParent->getViewNet()->update();
248 if (mySelectedLanes.size() > 1) {
249 mySelectedLanes.pop_back();
258 return myStopSelectingButton->isEnabled();
270 return mySelectedLaneColor;
274 const std::vector<std::pair<GNELane*, double> >&
276 return mySelectedLanes;
282 stopConsecutiveLaneSelector();
289 abortConsecutiveLaneSelector();
296 for (
auto i : mySelectedLanes) {
297 if (i.first == lane) {
310 myAdditionalFrameParent(additionalFrameParent) {
339 std::vector<std::string> vectorOfIds;
340 if (myUseSelectedEdgesCheckButton->getCheck()) {
342 std::vector<GNEEdge*> selectedEdges = myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(
true);
344 for (
auto i : selectedEdges) {
345 vectorOfIds.push_back(i->getID());
349 for (
int i = 0; i < myList->getNumItems(); i++) {
350 if (myList->isItemSelected(i)) {
351 vectorOfIds.push_back(myList->getItem(i)->getText().text());
362 myList->clearItems();
365 std::vector<GNEEdge*> vectorOfEdges = myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(
false);
367 for (
auto i : vectorOfEdges) {
369 if (i->getID().find(search) != std::string::npos) {
370 myList->appendItem(i->getID().c_str());
374 myUseSelectedEdgesCheckButton->setCheck(
false);
393 if (myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(
true).size() > 0) {
394 myUseSelectedEdgesCheckButton->enable();
396 myUseSelectedEdgesCheckButton->disable();
403 if (myUseSelectedEdgesCheckButton->getCheck()) {
404 myEdgesSearch->hide();
406 myClearEdgesSelection->hide();
407 myInvertEdgesSelection->hide();
409 myEdgesSearch->show();
411 myClearEdgesSelection->show();
412 myInvertEdgesSelection->show();
425 showSelectorChildEdgesModul(myEdgesSearch->getText().text());
438 for (
int i = 0; i < myList->getNumItems(); i++) {
439 if (myList->getItem(i)->isSelected()) {
440 myList->deselectItem(i);
449 for (
int i = 0; i < myList->getNumItems(); i++) {
450 if (myList->getItem(i)->isSelected()) {
451 myList->deselectItem(i);
453 myList->selectItem(i);
465 myAdditionalFrameParent(additionalFrameParent) {
494 std::vector<std::string> vectorOfIds;
495 if (myUseSelectedLanesCheckButton->getCheck()) {
497 std::vector<GNELane*> selectedLanes = myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(
true);
499 for (
auto i : selectedLanes) {
500 vectorOfIds.push_back(i->getID());
504 for (
int i = 0; i < myList->getNumItems(); i++) {
505 if (myList->isItemSelected(i)) {
506 vectorOfIds.push_back(myList->getItem(i)->getText().text());
516 myList->clearItems();
517 std::vector<GNELane*> vectorOfLanes = myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(
false);
518 for (
auto i : vectorOfLanes) {
519 if (i->getID().find(search) != std::string::npos) {
520 myList->appendItem(i->getID().c_str());
524 myUseSelectedLanesCheckButton->setCheck(
false);
539 if (myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(
true).size() > 0) {
540 myUseSelectedLanesCheckButton->enable();
542 myUseSelectedLanesCheckButton->disable();
549 if (myUseSelectedLanesCheckButton->getCheck()) {
550 myLanesSearch->hide();
552 clearLanesSelection->hide();
553 invertLanesSelection->hide();
555 myLanesSearch->show();
557 clearLanesSelection->show();
558 invertLanesSelection->show();
584 for (
int i = 0; i < myList->getNumItems(); i++) {
585 if (myList->getItem(i)->isSelected()) {
586 myList->deselectItem(i);
595 for (
int i = 0; i < myList->getNumItems(); i++) {
596 if (myList->getItem(i)->isSelected()) {
597 myList->deselectItem(i);
599 myList->selectItem(i);
610 GNEFrame(horizontalFrameParent, viewNet,
"Additionals") {
755 return netElement->
getID();
761 return tagProperties.getTagStr() +
"_" + netElement->
getID() +
"_" +
toString(additionalIndex);
768 return tagProperties.getTagStr() +
"_" +
toString(additionalIndex);
796 double end = GNEAttributeCarrier::parse<double>(valuesMap[
SUMO_ATTR_END]);
878 if (lane !=
nullptr) {
923 if (lane ==
nullptr) {
940 std::vector<std::string> laneIDs;
942 laneIDs.push_back(i.first->getID());
bool showSelectorParentModul(SumoXMLTag additionalTypeParent)
Show list of SelectorParent Modul.
const std::vector< std::pair< GNELane *, double > > & getSelectedLanes() const
get current selected lanes
#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.
const RGBColor & getSelectedLaneColor() const
get selected lane color
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
#define GUIDesignTextFieldNCol
Num of column of text field.
void showSelectorParentLanesModul()
show SelectorParentLanes modul
struct with the attribute Properties
const std::string getID() const
function to support debugging
#define WRITE_WARNING(msg)
long onCmdStopSelection(FXObject *, FXSelector, void *)
SelectorChildEdges(GNEAdditionalFrame *additionalFrameParent)
FOX-declaration.
@ MID_GNE_ADDITIONALFRAME_USESELECTED
use selected elements
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool buildAdditionalCommonAttributes(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build common additional attributes
void hideSelectorChildEdgesModul()
hide SelectorChildEdges Modul
GNEEdge * getParentEdge() const
Returns underlying parent edge.
long onCmdAbortSelection(FXObject *, FXSelector, void *)
Called when the user press abort selection button.
void setIDSelected(const std::string &id)
select manually a element of the list
GNEFrameModuls::TagSelector * myAdditionalTagSelector
item selector
bool addAdditional(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
add additional element
bool areValuesValid() const
check if parameters of attributes are valid
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
@ SUMO_TAG_LANE
begin/end of the description of a single lane
void setStatusBarText(const std::string &text)
set staturBar text
FXButton * invertLanesSelection
button for invert selection
void showSelectorChildLanesModul()
show selector child lane and update use selected edges/lanes
FXButton * clearLanesSelection
button for clear selection
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
#define GUIDesignListFixedHeight
design for FXLists with height fixed
FXButton * myClearEdgesSelection
button for clear selection
@ MID_GNE_ADDITIONALFRAME_SEARCH
search element
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
@ SUMO_TAG_NOTHING
invalid tag
SelectorParentLanes * mySelectorParentLanes
Modul for select parent lanes (currently only consecutives)
bool buildAdditionalOverEdge(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over an edge (parent of lane)
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
#define GUIDesignTextField
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
std::string getEdgeIdsSelected() const
get list of selecte id's in string format
bool isShown() const
return true if modul is shown
bool stopConsecutiveLaneSelector()
stop selection of consecutive lanes
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
void hideAttributesCreatorModul()
hide group box
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
@ MID_GNE_ADDITIONALFRAME_CLEARSELECTION
clear selection of elements
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
bool isLaneSelected(GNELane *lane) const
check if certain lane is selected
long onCmdSelectEdge(FXObject *, FXSelector, void *)
called when user select a edge of the list
@ MID_GNE_ADDITIONALFRAME_SELECT
select element
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
~SelectorChildLanes()
destructor
void abortConsecutiveLaneSelector()
abort selection of consecutive lanes
FXList * myList
List of SelectorChildEdges.
const PositionVector & getLaneShape() const
Encapsulated Xerces-SAX-attributes.
class used to group all variables related with objects under cursor after a click over view
@ MID_GNE_ADDITIONALFRAME_ABORTSELECTION
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
void updateUseSelectedLanes()
@ SUMO_ATTR_EDGES
the edges of a route
~GNEAdditionalFrame()
Destructor.
@ SUMO_TAG_EDGE
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.
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
const std::map< int, std::string > & getPredefinedTagsMML() const
get predefinedTagsMML
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
@ SUMO_TAG_REROUTER
A rerouter.
void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties &tagValue)
show Netedit attributes modul
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
SelectorChildLanes * mySelectorChildLanes
Modul for select child lanes.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
void updateUseSelectedEdges()
Update use selectedEdges.
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 parent additional selected
void showSelectorChildEdgesModul(std::string search="")
Show SelectorChildEdges Modul.
void hideSelectorChildLanesModul()
hide SelectorChildLanes Modul
FXTextField * myLanesSearch
text field for search lane IDs
@ SUMO_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (used by Netedit)
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
SelectorChildEdges * mySelectorChildEdges
Modul for select child edges.
void refreshRows()
refresh rows (called after creating an element)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
@ SUMO_TAG_BUS_STOP
A bus stop.
void setCurrentTag(SumoXMLTag newTag)
set current type manually
FXDEFMAP(GNEAdditionalFrame::SelectorParentLanes) ConsecutiveLaneSelectorMap[]
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 SelectorChildLanes.
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
bool buildAdditionalOverView(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over view
FXTextField * myEdgesSearch
text field for search edge IDs
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
GNEAdditionalFrame::SelectorParentLanes * getConsecutiveLaneSelector() const
getConsecutive Lane Selector
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
@ MID_GNE_ADDITIONALFRAME_STOPSELECTION
stop selection of consecutive egdes/lanes
void hideSelectorParentLanesModul()
hide SelectorParentLanes
void removeLastSelectedLane()
remove last added point
@ MID_GNE_ADDITIONALFRAME_INVERTSELECTION
invert selection of eleents
void showSelectorChildLanesModul(std::string search="")
Show list of SelectorChildLanes Modul.
GNEFrameModuls::SelectorParent * myParentAdditional
Modul for select a single parent additional.
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)
void startConsecutiveLaneSelector(GNELane *lane, const Position &clickedPosition)
start selection of consecutive lanes
SelectorChildLanes(GNEAdditionalFrame *additionalFrameParent)
FOX-declaration.
~SelectorParentLanes()
destructor
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
@ SUMO_ATTR_END
weights: time range end
C++ TraCI client API implementation.
long onCmdUseSelectedLanes(FXObject *, FXSelector, void *)
bool hasParent() const
return true if tag correspond to an element that can had another element as parent
static const RGBColor GREEN
long onCmdSelectLane(FXObject *, FXSelector, void *)
called when user select a lane of the list
GNEAdditionalFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
bool buildAdditionalWithParent(std::map< SumoXMLAttr, std::string > &valuesMap, GNEAdditional *parent, const GNEAttributeCarrier::TagProperties &tagValues)
build additional with Parent
FXButton * myInvertEdgesSelection
button for invert selection
void hideNeteditAttributesModul()
hide Netedit attributes modul
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
std::string getLaneIdsSelected() const
get list of selecte lane ids in string format
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
~SelectorChildEdges()
destructor
virtual void show()
show Frame
bool isSelectingLanes() const
return true if modul is selecting lane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
bool addSelectedLane(GNELane *lane, const Position &clickedPosition)
return true if lane can be selected as consecutive lane
void showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &tagProperties, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
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)
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
void refreshSelectorParentModul()
Refresh list of Additional Parents Modul.
void hideSelectorParentModul()
hide SelectorParent Modul
@ GNE_ATTR_PARENT
parent of an additional element