90 GNEFrame(horizontalFrameParent, viewNet, "Selection") {
104 FXGroupBox* selectionHintGroupBox =
new FXGroupBox(myContentFrame,
"Information",
GUIDesignGroupBoxFrame);
106 new FXLabel(selectionHintGroupBox,
" - Hold <SHIFT> for \n rectangle selection.\n - Press <DEL> to\n delete selected items.",
nullptr,
GUIDesignLabelFrameInformation);
139 for (
auto i : selectedAC) {
153 std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToSelect;
154 std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToUnselect;
158 ACToUnselect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
164 switch (setOperation) {
166 ACToUnselect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
169 if (ACToUnselect.find(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i)) != ACToUnselect.end()) {
170 ACToSelect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
174 ACToSelect.insert(std::pair<std::string, GNEAttributeCarrier*>(i->getID(), i));
180 std::vector<GNEEdge*> edgesToSelect;
182 for (
auto i : ACToSelect) {
184 edgesToSelect.push_back(dynamic_cast<GNEEdge*>(i.second));
188 for (
auto i : edgesToSelect) {
190 ACToSelect.insert(std::make_pair(i->getGNEJunctionSource()->getID(), i->getGNEJunctionSource()));
191 for (
auto j : i->getGNEJunctionSource()->getGNEConnections()) {
192 ACToSelect.insert(std::make_pair(j->getID(), j));
194 for (
auto j : i->getGNEJunctionSource()->getGNECrossings()) {
195 ACToSelect.insert(std::make_pair(j->getID(), j));
198 ACToSelect.insert(std::make_pair(i->getGNEJunctionDestiny()->getID(), i->getGNEJunctionDestiny()));
199 for (
auto j : i->getGNEJunctionDestiny()->getGNEConnections()) {
200 ACToSelect.insert(std::make_pair(j->getID(), j));
202 for (
auto j : i->getGNEJunctionDestiny()->getGNECrossings()) {
203 ACToSelect.insert(std::make_pair(j->getID(), j));
208 if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
211 for (
auto i : ACToUnselect) {
212 if (i.second->getTagProperty().isSelectable()) {
216 for (
auto i : ACToSelect) {
217 if (i.second->getTagProperty().isSelectable()) {
235 std::vector<GNEAttributeCarrier*>
237 std::vector<GNEAttributeCarrier*> result;
240 for (
auto it : allACbyTag) {
242 result.push_back(it);
243 }
else if (tagValue.hasAttribute(ACAttr) && tagValue.getAttributeProperties(ACAttr).isNumerical()) {
245 std::istringstream buf(it->getAttribute(ACAttr));
250 result.push_back(it);
255 result.push_back(it);
260 result.push_back(it);
266 std::string acVal = it->getAttributeForSelection(ACAttr);
269 if (acVal.find(expr) != std::string::npos) {
270 result.push_back(it);
274 if (acVal.find(expr) == std::string::npos) {
275 result.push_back(it);
280 result.push_back(it);
285 result.push_back(it);
300 mySelectorFrameParent(selectorFrameParent) {
337 if ((type >= 100) && (type < 199)) {
392 myModificationModeType(SET_ADD) {
394 myAddRadioButton =
new FXRadioButton(
this,
"add\t\tSelected objects are added to the previous selection",
396 myRemoveRadioButton =
new FXRadioButton(
this,
"remove\t\tSelected objects are removed from the previous selection",
398 myKeepRadioButton =
new FXRadioButton(
this,
"keep\t\tRestrict previous selection by the current selection",
400 myReplaceRadioButton =
new FXRadioButton(
this,
"replace\t\tReplace previous selection by the current selection",
457 myCurrentElementSet(ELEMENTSET_NETELEMENT) {
541 std::vector<SumoXMLTag> listOfTags;
552 for (
auto i : listOfTags) {
581 std::vector<SumoXMLTag> listOfTags;
592 for (
auto i : listOfTags) {
607 for (
auto it : tagValue) {
613 if (tagValue.canBlockMovement()) {
617 if (tagValue.canBlockShape()) {
621 if (tagValue.canCloseShape()) {
625 if (tagValue.hasParent()) {
649 tagPropertiesCopy.addAttribute(
GNE_ATTR_GENERIC, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_STRING,
"",
"");
651 if (tagValue.canBlockMovement()) {
653 tagPropertiesCopy.addAttribute(
GNE_ATTR_BLOCK_MOVEMENT, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_BOOL,
"",
"false");
656 if (tagValue.canBlockShape()) {
658 tagPropertiesCopy.addAttribute(
GNE_ATTR_BLOCK_SHAPE, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_BOOL,
"",
"false");
661 if (tagValue.canCloseShape()) {
663 tagPropertiesCopy.addAttribute(
GNE_ATTR_CLOSE_SHAPE, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_BOOL,
"",
"true");
666 if (tagValue.hasParent()) {
668 tagPropertiesCopy.addAttribute(
GNE_ATTR_PARENT, GNEAttributeCarrier::AttrProperty::ATTRPROPERTY_STRING,
"",
"");
672 for (
auto i : tagPropertiesCopy) {
704 char compOp = expr[0];
705 if (compOp ==
'<' || compOp ==
'>' || compOp ==
'=') {
706 expr = expr.substr(1);
711 if (GNEAttributeCarrier::canParse<double>(expr.c_str())) {
723 char compOp = expr[0];
724 if (compOp ==
'=' || compOp ==
'!' || compOp ==
'^') {
725 expr = expr.substr(1);
744 FXDialogBox* additionalNeteditAttributesHelpDialog =
new FXDialogBox(
this,
"Netedit Parameters Help",
GUIDesignDialogBox);
747 std::ostringstream help;
749 <<
"- The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection\n" 750 <<
" according to the current 'Modification Mode'.\n" 751 <<
" 1. Select an object type from the first input box\n" 752 <<
" 2. Select an attribute from the second input box\n" 753 <<
" 3. Enter a 'match expression' in the third input box and press <return>\n" 755 <<
"- The empty expression matches all objects\n" 756 <<
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n" 757 <<
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n" 759 <<
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n" 760 <<
" '' (no operator) matches if string is a substring of that object'ts attribute.\n" 761 <<
" '=' matches if string is an exact match.\n" 762 <<
" '!' matches if string is not a substring.\n" 763 <<
" '^' matches if string is not an exact match.\n" 766 <<
" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n" 767 <<
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n" 768 <<
" edge; speed; '>10' -> match all edges with a speed above 10\n";
780 WRITE_DEBUG(
"Opening help dialog of selector frame");
782 additionalNeteditAttributesHelpDialog->create();
784 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
788 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
790 WRITE_DEBUG(
"Close help dialog of selector frame");
847 FXFileDialog opendialog(
this,
"Open List of Selected Items");
849 opendialog.setSelectMode(SELECTFILE_EXISTING);
850 opendialog.setPatternList(
"Selection files (*.txt)\nAll files (*)");
854 if (opendialog.execute()) {
855 std::vector<GNEAttributeCarrier*> loadedACs;
857 std::string file = opendialog.getFilename().text();
858 std::ostringstream msg;
859 std::ifstream strm(file.c_str());
865 while (strm.good()) {
869 if (line.length() != 0) {
878 loadedACs.push_back(AC);
884 if (loadedACs.size() > 0) {
913 WRITE_DEBUG(
"Opening FXMessageBox 'error storing selection'");
915 FXMessageBox::error(
this, MBOX_OK,
"Storing Selection failed",
"%s", e.what());
917 WRITE_DEBUG(
"Closed FXMessageBox 'error storing selection' with 'OK'");
939 for (
auto i : junctions) {
942 for (
auto j : i->getGNEIncomingEdges()) {
947 for (
auto k : j->getLanes()) {
952 for (
auto k : j->getGNEConnections()) {
957 for (
auto j : i->getGNECrossings()) {
963 for (
auto i : additionals) {
964 if (i->getTagProperty().isSelectable()) {
977 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
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
~SelectionOperation()
destructor
void close()
Closes the device and removes it from the dictionary.
std::map< GUIGlObjectType, ObjectTypeEntry * > myTypeEntries
check boxes for type-based selection locking and selected object counts
SumoXMLTag
Numbers representing SUMO-XML - element names.
#define GUIDesignComboBoxNCol
number of column of every combo box
~MatchAttribute()
destructor
long onCmdSetCheckBox(FXObject *, FXSelector, void *)
bool selectEdges() const
whether inspection, selection and inversion should apply to edges or to lanes
void addedLockedObject(const GUIGlObjectType type)
set object selected
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,
FXLabel * myLabelCounter
label counter
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
FXLabel * myLabelTypeName
label type nane
Close shape of a polygon (Used by GNEPolys)
static std::vector< SumoXMLTag > allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables)
get tags of all editable element types using TagProperty Type (TAGPROPERTY_NETELEMENT, TAGPROPERTY_ADDITIONAL, etc.)
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.
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.
~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
#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
void removeLockedObject(const GUIGlObjectType type)
set object unselected
FXDEFMAP(GNESelectorFrame::LockGLObjectTypes::ObjectTypeEntry) ObjectTypeEntryMap[]
FXTextField * myMatchString
string of the match
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
ObjectTypeEntry()
FOX needs this.
#define GUIDesignMatrixLockGLTypes
Matrix for pack GLTypes (used in GNESelectorFrame)
ElementSet()
FOX needs this.
#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
class for object types entries
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
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.
bool IsObjectTypeLocked(const GUIGlObjectType type) const
check if an object is locked
ElementSetType getElementSet() const
get current selected element set
virtual void hide()
hide Frame
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
FXMenuCheck * myCheckBoxLocked
check box to check if GLObject type is blocked
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.
void counterDown()
down count
#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
bool isGLTypeLocked() const
check if current GLType is blocked
~LockGLObjectTypes()
destructor
~ModificationMode()
destructor
SetOperation myModificationModeType
how to modify selection
const POIs & getPOIs() const
Returns all pois.