61#pragma warning(disable: 4355)
67 const auto staticTooltipMenu = selectorFrameParent->
getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
69 for (
int i = 0; i < selectorFrameParent->
getViewNet()->getNet()->getTagPropertiesDatabase()->getHierarchyDepth() + 1; i++) {
100 tagComboBox->enable();
111 tagComboBox->disable();
144 for (
size_t i = 0; i < parentHierarchy.size(); i++) {
147 comboBox->clearItems();
151 if (parentHierarchy.at(i)->getHierarchicalParent()) {
152 for (
const auto tagSibling : parentHierarchy.at(i)->getHierarchicalParent()->getHierarchicalChildren()) {
153 if (tagSibling->isDrawable()) {
175 if (parentHierarchy.back()->getHierarchicalChildren().size() > 0) {
177 comboBoxChildren->clearItems();
180 for (
const auto childTagProperty : parentHierarchy.back()->getHierarchicalChildren()) {
181 comboBoxChildren->appendTagItem(childTagProperty);
183 comboBoxChildren->show();
185 comboBoxChildren->hide();
195 for (
const auto& attribute : attributes) {
223 int tagComboBoxIndex = 0;
226 tagComboBoxIndex = i;
231 const auto selectedTag =
myTagComboBoxVector.at(tagComboBoxIndex)->getCurrentTagProperty();
262 std::vector<GNEAttributeCarrier*> matches;
275 char compOp = expr[0];
276 if (compOp ==
'<' || compOp ==
'>' || compOp ==
'=') {
277 expr = expr.substr(1);
294 char compOp = expr[0];
295 if (compOp ==
'=' || compOp ==
'!' || compOp ==
'^') {
296 expr = expr.substr(1);
317 std::ostringstream help;
319 <<
TL(
"- The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection") <<
"\n"
320 <<
TL(
" according to the current 'Modification Mode'.") <<
"\n"
321 <<
TL(
" 1. Select an object type from the first input box") <<
"\n"
322 <<
TL(
" 2. Select an attribute from the second input box") <<
"\n"
323 <<
TL(
" 3. Enter a 'match expression' in the third input box and press <return>") <<
"\n"
325 <<
TL(
"- The empty expression matches all objects") <<
"\n"
326 <<
TL(
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.") <<
"\n"
327 <<
TL(
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'") <<
"\n"
329 <<
TL(
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.") <<
"\n"
330 <<
TL(
" '' (no operator) matches if string is a substring of that object's attribute.") <<
"\n"
331 <<
TL(
" '=' matches if string is an exact match.") <<
"\n"
332 <<
TL(
" '!' matches if string is not a substring.") <<
"\n"
333 <<
TL(
" '^' matches if string is not an exact match.") <<
"\n"
336 <<
TL(
" junction; id; 'foo' -> match all junctions that have 'foo' in their id") <<
"\n"
337 <<
TL(
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'") <<
"\n"
338 <<
TL(
" edge; speed; '>10' -> match all edges with a speed above 10");
341 TL(
"Netedit parameters Help"), help);
346std::vector<GNEAttributeCarrier*>
348 std::vector<GNEAttributeCarrier*> result;
352 for (
const auto& AC : allACbyTag) {
355 if (expr ==
"" && compOp ==
'@') {
356 result.push_back(AC);
364 result.push_back(AC);
369 result.push_back(AC);
374 result.push_back(AC);
385 if (acVal.find(expr) != std::string::npos) {
386 result.push_back(AC);
390 if (acVal.find(expr) == std::string::npos) {
391 result.push_back(AC);
396 result.push_back(AC);
401 result.push_back(AC);
414std::vector<GNEAttributeCarrier*>
416 std::vector<GNEAttributeCarrier*> result;
418 for (
const auto& genericData : genericDatas) {
419 if (expr ==
"" && compOp ==
'@') {
420 result.push_back(genericData);
423 std::istringstream buf(genericData->getParameter(attr,
"0"));
428 result.push_back(genericData);
433 result.push_back(genericData);
438 result.push_back(genericData);
446 std::string acVal = genericData->getAttributeForSelection(
GNE_ATTR_PARENT);
449 if (acVal.find(expr) != std::string::npos) {
450 result.push_back(genericData);
454 if (acVal.find(expr) == std::string::npos) {
455 result.push_back(genericData);
460 result.push_back(genericData);
465 result.push_back(genericData);
486 TL(
"Show all attributes"),
487 FXRGBA(255, 255, 255, 255),
491 TL(
"No common attributes defined"));
493 const auto database =
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase();
522 if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
524 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
526 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
536 if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
538 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
540 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
550 if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
552 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
554 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
588 if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
590 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
592 }
else if (
myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
FXDEFMAP(GNEMatchAttribute) GNEMatchAttributeMap[]
@ NETWORK
Network mode (Edges, junctions, etc..).
@ DATA
Data mode (edgeData, LaneData etc..).
@ DEMAND
Demand mode (Routes, Vehicles etc..).
@ MID_GNE_SELECTORFRAME_SELECTATTRIBUTE
select attribute in selector frame
@ MID_GNE_SELECTORFRAME_SELECTTAG
select tag in selector frame
@ MID_GNE_SELECTORFRAME_PROCESSSTRING
process string
@ MID_GNE_SELECTORFRAME_TOGGLECOMMON
toogle only show common
#define GUIDesignTextColorRed
red color (for invalid text)
#define GUIDesignComboBox
#define GUIDesignTextField
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignComboBoxVisibleItems
#define GUIDesignTextColorBlack
black color (for correct text)
#define GUIDesignCheckButton
checkButton placed in left position
const std::string invalid_return< std::string >::value
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_NOCOMMON
no common attributes
@ GNE_ATTR_PARENT
parent of an additional element
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
const GNETagProperties * getTagPropertyParent() const
get reference to tagProperty parent
GNEViewNet * getViewNet() const
get view net
container with current edited properties
std::string myDemandMatchValue
current demand match value
CurrentEditedProperties()=delete
default constructor
~CurrentEditedProperties()
destructor
std::vector< const GNETagProperties * > myDemandTagProperties
current demand tag properties
const GNEAttributeProperties * getAttributePropertiesNoCommon() const
get attr properties no common
const GNEAttributeProperties * myDataAttributeProperties
current data attribute properties
std::vector< const GNETagProperties * > myNetworkTagProperties
current network tag properties
std::string myNetworkMatchValue
current network match value
GNETagProperties * myTagPropertiesAllAttributes
tag properties <all>
void setTagProperties(const GNETagProperties *tagProperty)
set tag property (depending of supermode)
const GNEAttributeProperties * myNetworkAttributeProperties
current network attribute properties
const std::string & getMatchValue() const
get match value (depending of supermode)
const GNETagProperties * getTagPropertiesAll() const
get special tag <all>
void setAttributeProperties(const GNEAttributeProperties *attrProperty)
set attribute property (depending of supermode)
std::string myDataMatchValue
current data match value
const GNEMatchAttribute * myMatchAttributeParent
pointer to match attribute parent
const GNEAttributeProperties * myAttributePropertiesNoCommon
attribute properties no common
const GNETagProperties * getTagProperties() const
get tag property (depending of supermode)
void setMatchValue(const std::string value)
set match value (depending of supermode)
const GNEAttributeProperties * getAttributeProperties() const
get attribute property (depending of supermode)
std::vector< const GNETagProperties * > myDataTagProperties
current data tag properties
const GNEAttributeProperties * myDemandAttributeProperties
current demand attribute properties
CurrentEditedProperties * myCurrentEditedProperties
current edited properties
~GNEMatchAttribute()
destructor
FXButton * myMatchStringButton
match string button
long onCmdAttributeSelected(FXObject *, FXSelector, void *)
Called when the user selects an attribute in the match box.
void showMatchAttribute()
show match attributes
std::vector< MFXComboBoxTagProperty * > myTagComboBoxVector
vector with tag property comboBoxes
std::vector< GNEAttributeCarrier * > getGenericMatches(const std::vector< GNEGenericData * > &genericDatas, const std::string &attr, const char compOp, const double val, const std::string &expr)
return GenericDatas of the given type with matching attrs
long onCmdProcessString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
GNESelectorFrame * mySelectorFrameParent
pointer to selector frame parent
long onCmdToogleOnlyCommon(FXObject *, FXSelector, void *)
Called when the user toogle the only common checkbox.
long onCmdTagSelected(FXObject *obj, FXSelector, void *)
Called when the user selects a tag in the match box.
FXTextField * myMatchString
string of the match
void hideMatchAttribute()
hide match attributes
FXCheckButton * myShowOnlyCommonAttributes
checkbox for enable/disable show only common attributes
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
void refreshMatchAttribute()
refresh match attribute
std::vector< GNEAttributeCarrier * > getMatches(const char compOp, const double val, const std::string &expr)
FOX need this.
void enableMatchAttribute()
enable match attributes
void disableMatchAttribute()
disable match attributes
MFXComboBoxAttrProperty * myAttributeComboBox
attribute property comboBox
GNEMatchAttribute(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
const std::vector< const GNETagProperties * > getHierarchicalParentsRecuersively() const
get all parents, beginning from current element (root not included) until this element
Supermode getSupermode() const
get supermode associated with this tag
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
MFXGroupBoxModule (based on FXGroupBox).
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
MFXGroupBoxModule(GNEFrame *frame, const std::string &text, const int options=Options::COLLAPSIBLE)
constructor for frames