91 GNEFrame(horizontalFrameParent, viewNet, "Selection") {
105 FXGroupBox* selectionHintGroupBox =
new FXGroupBox(myContentFrame,
"Information",
GUIDesignGroupBoxFrame);
107 new FXLabel(selectionHintGroupBox,
" - Hold <SHIFT> for \n rectangle selection.\n - Press <DEL> to\n delete selected items.", 0,
GUIDesignLabelFrameInformation);
142 for (
auto i : selectedAC) {
158 std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToSelect;
159 std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToUnselect;
163 ACToUnselect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
169 switch (setOperation) {
171 ACToUnselect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
174 if (ACToUnselect.find(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i)) != ACToUnselect.end()) {
175 ACToSelect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
179 ACToSelect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
185 std::vector<GNEEdge*> edgesToSelect;
187 for (
auto i : ACToSelect) {
189 edgesToSelect.push_back(dynamic_cast<GNEEdge*>(i.second));
193 for (
auto i : edgesToSelect) {
195 ACToSelect.insert(std::make_pair(i->getGNEJunctionSource()->getID(), i->getGNEJunctionSource()));
196 for (
auto j : i->getGNEJunctionSource()->getGNEConnections()) {
197 ACToSelect.insert(std::make_pair(j->getID(), j));
199 for (
auto j : i->getGNEJunctionSource()->getGNECrossings()) {
200 ACToSelect.insert(std::make_pair(j->getID(), j));
203 ACToSelect.insert(std::make_pair(i->getGNEJunctionDestiny()->getID(), i->getGNEJunctionDestiny()));
204 for (
auto j : i->getGNEJunctionDestiny()->getGNEConnections()) {
205 ACToSelect.insert(std::make_pair(j->getID(), j));
207 for (
auto j : i->getGNEJunctionDestiny()->getGNECrossings()) {
208 ACToSelect.insert(std::make_pair(j->getID(), j));
213 if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
216 for (
auto i : ACToUnselect) {
221 for (
auto i : ACToSelect) {
242 std::vector<GNEAttributeCarrier*>
244 std::vector<GNEAttributeCarrier*> result;
247 for (
auto it : allACbyTag) {
249 result.push_back(it);
250 }
else if (tagValue.hasAttribute(ACAttr) && tagValue.getAttribute(ACAttr).isNumerical()) {
252 std::istringstream buf(it->getAttribute(ACAttr));
257 result.push_back(it);
262 result.push_back(it);
267 result.push_back(it);
273 std::string acVal = it->getAttributeForSelection(ACAttr);
276 if (acVal.find(expr) != std::string::npos) {
277 result.push_back(it);
281 if (acVal.find(expr) == std::string::npos) {
282 result.push_back(it);
287 result.push_back(it);
292 result.push_back(it);
307 mySelectorFrameParent(selectorFrameParent) {
309 FXMatrix* mLockGLObjectTypes =
new FXMatrix(
this, 3, (LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
350 if ((type >= 100) && (type < 199)) {
361 locked =
new FXMenuCheck(parent, (
"lock\t\tLock " + label2 +
" selection").c_str(), 0, 0, LAYOUT_FILL_X | LAYOUT_RIGHT);
371 myModificationModeType(SET_ADD) {
373 myAddRadioButton =
new FXRadioButton(
this,
"add\t\tSelected objects are added to the previous selection",
375 myRemoveRadioButton =
new FXRadioButton(
this,
"remove\t\tSelected objects are removed from the previous selection",
377 myKeepRadioButton =
new FXRadioButton(
this,
"keep\t\tRestrict previous selection by the current selection",
379 myReplaceRadioButton =
new FXRadioButton(
this,
"replace\t\tReplace previous selection by the current selection",
436 myCurrentElementSet(ELEMENTSET_NETELEMENT) {
522 for (
auto i : listOfTags) {
527 for (
auto i : listOfTags) {
532 for (
auto i : listOfTags) {
566 for (
auto i : listOfTags) {
573 for (
auto i : listOfTags) {
580 for (
auto i : listOfTags) {
598 for (
auto it : tagValue) {
604 if (tagValue.canBlockMovement()) {
608 if (tagValue.canBlockShape()) {
612 if (tagValue.canCloseShape()) {
616 if (tagValue.hasParent()) {
640 tagPropertiesCopy.addAttribute(
GNE_ATTR_GENERIC, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_STRING,
"",
"");
642 if (tagValue.canBlockMovement()) {
644 tagPropertiesCopy.addAttribute(
GNE_ATTR_BLOCK_MOVEMENT, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_BOOL,
"",
"false");
647 if (tagValue.canBlockShape()) {
649 tagPropertiesCopy.addAttribute(
GNE_ATTR_BLOCK_SHAPE, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_BOOL,
"",
"false");
652 if (tagValue.canCloseShape()) {
654 tagPropertiesCopy.addAttribute(
GNE_ATTR_CLOSE_SHAPE, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_BOOL,
"",
"true");
657 if (tagValue.hasParent()) {
659 tagPropertiesCopy.addAttribute(
GNE_ATTR_PARENT, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_STRING,
"",
"");
663 for (
auto i : tagPropertiesCopy) {
695 char compOp = expr[0];
696 if (compOp ==
'<' || compOp ==
'>' || compOp ==
'=') {
697 expr = expr.substr(1);
702 if (GNEAttributeCarrier::canParse<double>(expr.c_str())) {
714 char compOp = expr[0];
715 if (compOp ==
'=' || compOp ==
'!' || compOp ==
'^') {
716 expr = expr.substr(1);
735 FXDialogBox* additionalNeteditAttributesHelpDialog =
new FXDialogBox(
this,
"Netedit Parameters Help",
GUIDesignDialogBox);
738 std::ostringstream help;
740 <<
"- The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection\n" 741 <<
" according to the current 'Modification Mode'.\n" 742 <<
" 1. Select an object type from the first input box\n" 743 <<
" 2. Select an attribute from the second input box\n" 744 <<
" 3. Enter a 'match expression' in the third input box and press <return>\n" 746 <<
"- The empty expression matches all objects\n" 747 <<
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n" 748 <<
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n" 750 <<
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n" 751 <<
" '' (no operator) matches if string is a substring of that object'ts attribute.\n" 752 <<
" '=' matches if string is an exact match.\n" 753 <<
" '!' matches if string is not a substring.\n" 754 <<
" '^' matches if string is not an exact match.\n" 757 <<
" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n" 758 <<
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n" 759 <<
" edge; speed; '>10' -> match all edges with a speed above 10\n";
771 WRITE_DEBUG(
"Opening help dialog of selector frame");
773 additionalNeteditAttributesHelpDialog->create();
775 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
779 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
781 WRITE_DEBUG(
"Close help dialog of selector frame");
838 FXFileDialog opendialog(
this,
"Open List of Selected Items");
840 opendialog.setSelectMode(SELECTFILE_EXISTING);
841 opendialog.setPatternList(
"Selection files (*.txt)\nAll files (*)");
845 if (opendialog.execute()) {
846 std::vector<GNEAttributeCarrier*> loadedACs;
848 std::string file = opendialog.getFilename().text();
849 std::ostringstream msg;
850 std::ifstream strm(file.c_str());
856 while (strm.good()) {
860 if (line.length() != 0) {
869 loadedACs.push_back(AC);
875 if (loadedACs.size() > 0) {
906 WRITE_DEBUG(
"Opening FXMessageBox 'error storing selection'");
908 FXMessageBox::error(
this, MBOX_OK,
"Storing Selection failed",
"%s", e.what());
910 WRITE_DEBUG(
"Closed FXMessageBox 'error storing selection' with 'OK'");
932 for (
auto i : junctions) {
935 for (
auto j : i->getGNEIncomingEdges()) {
940 for (
auto k : j->getLanes()) {
945 for (
auto k : j->getGNEConnections()) {
950 for (
auto j : i->getGNECrossings()) {
956 for (
auto i : additionals) {
970 for (
auto i : copyOfSelectedAC) {
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
~SelectionOperation()
destructor
void close()
Closes the device and removes it from the dictionary.
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool selectEdges()
whether inspection, selection and inversion should apply to edges or to lanes
#define GUIDesignComboBoxNCol
number of column of every combo box
~MatchAttribute()
destructor
static std::vector< SumoXMLTag > allowedAdditionalTags(bool onlyDrawables)
get all editable for tag additional elements
FXRadioButton * myReplaceRadioButton
replace radio button
FXComboBox * mySetComboBox
Combo Box with the element sets.
SetOperation getModificationMode() const
get current modification mode
block shape of a graphic element (Used mainly in GNEShapes)
void handleIDs(const std::vector< GNEAttributeCarrier *> &ACs, ModificationMode::SetOperation setop=ModificationMode::SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
const Polygons & getPolygons() const
Returns all polygons.
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true)
get a single attribute carrier based on a GLID
SetOperation
FOX-declaration.
const std::string & getString(const T key) const
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
FXRadioButton * myAddRadioButton
add radio button
Close shape of a polygon (Used by GNEPolys)
std::vector< GNEConnection * > retrieveConnections(bool onlySelected=false) const
return all connections
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
FXString gCurrentFolder
The folder used as last.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a Point of interest
select tag in selector frame
void disableMatchAttribute()
disable match attributes
ElementSetType myCurrentElementSet
current element set selected
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers()
get all selected attribute carriers
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
GNEViewNet * getViewNet() const
get view net
void enableMatchAttribute()
enable match attributes
FXRealSpinner * mySelectionScaling
Spinner for selection scaling.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
#define GUIDesignComboBox
GNEViewNet * myViewNet
View Net for changes.
bool IsObjectTypeLocked(GUIGlObjectType type) const
check if an object is locked
~GNESelectorFrame()
Destructor.
FXComboBox * myMatchTagComboBox
tag of the match box
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
changes the visual scaling of selected items
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
FXComboBox * myMatchAttrComboBox
attributes of the match box
GNEUndoList * getUndoList() const
get the undoList object
long onCmdSelMBString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
SelectionOperation()
FOX needs this.
long onCmdSelectModificationMode(FXObject *, FXSelector, void *)
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
#define GUIDesignHorizontalSeparator
FXDEFMAP(GNESelectorFrame::ModificationMode) ModificationModeMap[]
#define GUIDesignTextField
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
LockGLObjectTypes(GNESelectorFrame *selectorFrameParent)
constructor
FXTextField * myMatchString
string of the match
static std::vector< SumoXMLTag > allowedShapeTags(bool onlyDrawables)
get all editable for tag shape elements
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
block movement of a graphic element
bool autoSelectNodes()
whether to autoselect nodes or to lanes
std::map< GUIGlObjectType, ObjectTypeEntry > myTypeEntries
check boxes for type-based selection locking and selected object counts
void updateLockGLObjectTypes()
update selected items
ElementSet()
FOX needs this.
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag, bool onlySelected=false)
return shape by type shapes
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
long onCmdSelectElementSet(FXObject *, FXSelector, void *)
Called when the user change the set of element to search (netElement, Additional or shape) ...
FXRadioButton * myKeepRadioButton
keep button
SumoXMLAttr myCurrentAttribute
current SumoXMLTag Attribute
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
ElementSetType
FOX-declaration.
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag type=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
SumoXMLTag myCurrentTag
current SumoXMLTag tag
begin/end of the description of an edge
long onCmdSelMBTag(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
void setSelectionScaling(double selectionScale)
set selection scaling
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
#define GUIDesignTextFieldNCol
Num of column of text field.
reserved GLO type to pack all additionals
long onCmdInvert(FXObject *, FXSelector, void *)
Called when the user presses the Invert-button.
ModificationMode * getModificationModeModul() const
get modification mode modul
LockGLObjectTypes * myLockGLObjectTypes
modul for lock selected items
virtual void show()
show Frame
~VisualScaling()
destructor
#define GUIDesignDialogBox
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
MatchAttribute * myMatchAttribute
modul for matchA ttribute
long onCmdSelMBAttribute(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false) const
return all additionals
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
static StringBijection< GUIGlObjectType > TypeNames
associates object types with strings
VisualScaling()
FOX needs this.
ElementSetType getElementSet() const
get current selected element set
virtual void hide()
hide Frame
std::vector< GNECrossing * > retrieveCrossings(bool onlySelected=false) const
return all crossings
GNENet * getNet() const
get the net object
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
GUIGlID getGlID() const
Returns the numerical id of the object.
#define GUIDesignButtonOK
Static storage of an output device and its base (abstract) implementation.
#define GUIDesignSpinDial
ModificationMode * myModificationMode
modul for change modification mode
parent of an additional element
FXRadioButton * myRemoveRadioButton
remove radio button
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
static std::vector< SumoXMLTag > allowedNetElementsTags(bool onlyDrawables)
get all editable for tag net elements
static const TagValues & getTagProperties(SumoXMLTag tag)
get Tag Properties
#define GUIDesignLabelLeft
std::vector< GNEAttributeCarrier * > getMatches(SumoXMLTag ACTag, SumoXMLAttr ACAttr, char compOp, double val, const std::string &expr)
return ACs of the given type with matching attrs
select attribute in selector frame
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
#define GUIDesignRadioButton
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
ElementSet * myElementSet
modul for select element set
MatchAttribute()
FOX needs this.
ModificationMode()
FOX needs this.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
~LockGLObjectTypes()
destructor
begin/end of the description of a polygon
~ModificationMode()
destructor
SetOperation myModificationModeType
how to modify selection
const POIs & getPOIs() const
Returns all pois.