49 #ifdef CHECK_MEMORY_LEAKS 51 #endif // CHECK_MEMORY_LEAKS 76 FXIMPLEMENT(
GNEInspectorFrame, FXScrollWindow, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
77 FXIMPLEMENT(
GNEInspectorFrame::AttrInput, FXMatrix, AttrInputMap, ARRAYNUMBER(AttrInputMap))
78 FXIMPLEMENT(
GNEInspectorFrame::AttrEditor, FXDialogBox, AttrEditorMap, ARRAYNUMBER(AttrEditorMap))
85 GNEFrame(parent, viewNet, "Inspector"),
89 myGroupBoxForAttributes =
new FXGroupBox(myContentFrame,
"attributes", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
90 myGroupBoxForAttributes->hide();
94 vectorOfAttrInput.push_back(
new AttrInput(myGroupBoxForAttributes,
this));
98 myGroupBoxForTemplates =
new FXGroupBox(myContentFrame,
"templates", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
99 myGroupBoxForTemplates->hide();
102 myCopyTemplateButton =
new FXButton(myGroupBoxForTemplates,
"", 0,
this,
MID_GNE_COPY_TEMPLATE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3);
103 myCopyTemplateButton->hide();
106 mySetTemplateButton =
new FXButton(myGroupBoxForTemplates,
"Set as Template\t\t", 0,
this,
MID_GNE_SET_TEMPLATE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3);
107 mySetTemplateButton->hide();
110 myGroupBoxForEditor =
new FXGroupBox(myContentFrame,
"editor", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
111 myGroupBoxForEditor->hide();
114 myCheckBlocked =
new FXCheckButton(myGroupBoxForEditor,
"Block movement",
this,
MID_GNE_SET_BLOCKING);
115 myCheckBlocked->hide();
131 FXScrollWindow::show();
140 FXScrollWindow::hide();
152 if (
myACs.size() > 0) {
154 std::string headerString =
toString(
myACs.front()->getTag());
155 if (
myACs.size() > 1) {
156 headerString =
toString(
myACs.size()) +
" " + headerString +
"s";
165 (*i)->hiddeAttribute();
169 const std::vector<SumoXMLAttr>& attrs =
myACs.front()->getAttrs();
172 std::vector<GNEInspectorFrame::AttrInput*>::iterator itAttrs =
vectorOfAttrInput.begin();
175 for (std::vector<SumoXMLAttr>::const_iterator it = attrs.begin(); it != attrs.end(); it++) {
182 std::set<std::string> occuringValues;
183 for (std::vector<GNEAttributeCarrier*>::const_iterator it_ac =
myACs.begin(); it_ac !=
myACs.end(); it_ac++) {
184 occuringValues.insert((*it_ac)->getAttribute(*it));
187 std::ostringstream oss;
188 for (std::set<std::string>::iterator it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
189 if (it_val != occuringValues.begin()) {
195 (*itAttrs)->showAttribute(
myACs.front()->getTag(), *it, oss.str());
200 if (dynamic_cast<GNEEdge*>(
myACs.front())) {
206 if (
myACs.size() == 1) {
217 if (dynamic_cast<GNEAdditional*>(
myACs.front())) {
220 bool showGroupBoxForEditor =
false;
226 showGroupBoxForEditor =
true;
229 if (showGroupBoxForEditor ==
true) {
273 for (std::vector<GNEAttributeCarrier*>::iterator it =
myACs.begin(); it !=
myACs.end(); it++) {
285 assert(
myACs.size() == 1);
298 sender->handle(
this, FXSEL(SEL_COMMAND, ID_ENABLE), NULL);
300 caption =
"No Template Set";
301 sender->handle(
this, FXSEL(SEL_COMMAND, ID_DISABLE), NULL);
303 sender->handle(
this, FXSEL(SEL_COMMAND, FXLabel::ID_SETSTRINGVALUE), (
void*)&caption);
318 const std::vector<GNEAttributeCarrier*>&
328 FXMatrix(parent, 8, MATRIX_BY_COLUMNS | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH),
329 myInspectorFrameParent(inspectorFrameParent),
336 myLabel =
new FXLabel(
this,
"attributeLabel", 0, FRAME_THICK | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X);
367 if (value ==
"true") {
390 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
543 FXDialogBox(attrInputParent->getApp(), (
"Editing attribute '" +
toString(attrInputParent->
getAttr()) +
"'").c_str(), DECOR_CLOSE | DECOR_TITLE),
544 myAttrInputParent(attrInputParent),
545 myTextFieldAttr(textFieldAttr) {
559 for (
int i = 0; i < (int)choices.size(); i++) {
563 if (oldValue.find(choices.at(i)) != std::string::npos) {
569 new FXHorizontalSeparator(
this, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
572 frameButtons =
new FXHorizontalFrame(
this, LAYOUT_FILL_X);
575 myAcceptButton =
new FXButton(
frameButtons,
"Accept", 0,
this, FXDialogBox::ID_ACCEPT, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED);
578 myCancelButton =
new FXButton(
frameButtons,
"Cancel", 0,
this, FXDialogBox::ID_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED);
585 std::vector<std::string> attrSolution;
610 for (
int i = 0; i < (int)choices.size(); i++) {
611 if (oldValue.find(choices.at(i)) != std::string::npos) {
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
FXHorizontalFrame * frameButtons
frame for the buttons
SumoXMLTag
Numbers representing SUMO-XML - element names.
void hideFramesArea()
hide frames area if all GNEFrames are hidden
static bool isDiscrete(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is Discrete
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
FXGroupBox * myGroupBoxForTemplates
groupBox for templates
FXButton * myCopyTemplateButton
copy template button
long onCmdReset(FXObject *, FXSelector, void *)
call when user press button reset
void showFramesArea()
show frames area if at least a GNEFrame is showed
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
long onCmdCopyTemplate(FXObject *, FXSelector, void *)
copy edge attributes from edge template
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...
FXButton * myCancelButton
Button Cancel.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setBlocked(bool value)
Block or unblock additional element(i.e. cannot be moved with mouse)
GNEViewParent * getViewParent() const
get the net object
FXButton * mySetTemplateButton
set template button
FXMatrix * myCheckBoxMatrix
GNEAdditional * myAdditional
pointer to additional element
FXButton * myAcceptButton
Button Accept.
~GNEInspectorFrame()
Destructor.
GNEUndoList * getUndoList() const
get the undoList object
GNEViewNet * myViewNet
the window to inform when the tls is modfied
static const std::vector< std::string > & discreteChoices(SumoXMLTag tag, SumoXMLAttr attr)
return a list of discrete choices for this attribute or an empty vector
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
long onCmdSetBlocking(FXObject *, FXSelector, void *)
called when user toogle the blocking button
FXGroupBox * myGroupBoxForEditor
GropuBox for editor attributes.
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.
GNEEdge * myEdgeTemplate
the edge template
AttrEditor()
FOX needs this.
void inspect(const std::vector< GNEAttributeCarrier * > &ACs)
Inspect the given multi-selection.
void setEdgeTemplate(GNEEdge *tpl)
seh the template edge (we assume shared responsibility via reference counting)
AttrInput * myAttrInputParent
Pointer to AttrInput parent.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void incRef(const std::string &debugMsg="")
GNEViewNet * getViewNet() const
get view net
void decRef(const std::string &debugMsg="")
FXButton * myResetButton
Button Reset.
static bool isFloat(SumoXMLAttr attr)
whether an attribute is numerical of type float
A road/street connecting two junctions (netedit-version)
long onUpdCopyTemplate(FXObject *, FXSelector, void *)
update the copy button with the name of the template
static bool isInt(SumoXMLAttr attr)
whether an attribute is numerical or type int
An Element which don't belongs to GNENet but has influency in the simulation.
FXLabel * getFrameHeaderLabel() const
get the label for the frame's header
static bool discreteCombinableChoices(SumoXMLTag tag, SumoXMLAttr attr)
return whether the given attribute allows for a combination of discrete values
FXTextField * myTextFieldAttr
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
static bool isUnique(SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection)
const std::vector< GNEAttributeCarrier * > & getACs() const
get current list of ACs
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
static bool isString(SumoXMLAttr attr)
whether an attribute is of type string
std::vector< GNEAttributeCarrier * > myACs
the multi-selection currently being inspected
long onCmdSetTemplate(FXObject *, FXSelector, void *)
set current edge as new template
static bool isBool(SumoXMLAttr attr)
whether an attribute is of type bool
std::vector< FXCheckButton * > myVectorOfCheckBox
vector of CheckBoxs
FXGroupBox * myGroupBoxForAttributes
groupBox for attributes
std::vector< GNEInspectorFrame::AttrInput * > vectorOfAttrInput
list of Attribute inputs
bool isAdditionalMovable() const
check if additional element is movable
FXCheckButton * myCheckBlocked
pointer to check button block