89 FXIMPLEMENT(
GNEPolygonFrame, FXVerticalFrame, GNEShapeMap, ARRAYNUMBER(GNEShapeMap))
90 FXIMPLEMENT(
GNEPolygonFrame::ShapeAttributeSingle, FXHorizontalFrame, GNESingleShapeParameterMap, ARRAYNUMBER(GNESingleShapeParameterMap))
91 FXIMPLEMENT(
GNEPolygonFrame::ShapeAttributes, FXGroupBox, GNEAdditionalParametersMap, ARRAYNUMBER(GNEAdditionalParametersMap))
92 FXIMPLEMENT(
GNEPolygonFrame::NeteditAttributes, FXGroupBox, GNEEditorParametersMap, ARRAYNUMBER(GNEEditorParametersMap))
93 FXIMPLEMENT(
GNEPolygonFrame::DrawingMode, FXGroupBox, GNEDrawingModeMap, ARRAYNUMBER(GNEDrawingModeMap))
100 GNEFrame(horizontalFrameParent, viewNet, "Shapes"),
120 myShapeMatchBox->appendItem(
toString(i).c_str());
124 myShapeMatchBox->setNumVisible((
int)myShapeMatchBox->getNumItems());
130 setParametersOfShape(myActualShapeType);
133 myDrawingMode->show();
135 myDrawingMode->hide();
170 if (
addPOI(valuesOfElement)) {
233 bool additionalNameCorrect =
false;
241 additionalNameCorrect =
true;
245 if (additionalNameCorrect ==
false) {
291 double layer = GNEAttributeCarrier::parse<double>(polyValues.at(
SUMO_ATTR_LAYER));
292 double angle = GNEAttributeCarrier::parse<double>(polyValues.at(
SUMO_ATTR_ANGLE));
295 bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(
SUMO_ATTR_FILL));
321 double layer = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_LAYER));
322 double angle = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_ANGLE));
325 double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_WIDTH));
326 double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_HEIGHT));
349 myPolygonFrameParent(polygonFrameParent) {
356 std::ostringstream information;
358 <<
"- 'Start drawing' or ENTER\n" 359 <<
" draws polygon boundary.\n" 360 <<
"- 'Stop drawing' or ENTER\n" 361 <<
" creates polygon.\n" 362 <<
"- 'Abort drawing' or ESC\n" 363 <<
" removes drawed polygon.";
438 throw ProcessError(
"A new point cannot be added if drawing wasn't started");
450 throw ProcessError(
"Last point cannot be removed if drawing wasn't started");
644 if (GNEAttributeCarrier::canParse<int>(
myTextFieldInt->getText().text())) {
646 int intValue = GNEAttributeCarrier::parse<int>(
myTextFieldInt->getText().text());
656 if (GNEAttributeCarrier::canParse<double>(
myTextFieldReal->getText().text())) {
658 double doubleValue = GNEAttributeCarrier::parse<double>(
myTextFieldReal->getText().text());
660 if (doubleValue < 0) {
667 if (GNEAttributeCarrier::canParse<double>(
myTextFieldReal->getText().text())) {
669 double doubleValue = GNEAttributeCarrier::parse<double>(
myTextFieldReal->getText().text());
682 if (GNEAttributeCarrier::canParse<RGBColor>(
myTextFieldStrings->getText().text()) ==
false) {
689 myInvalidValue =
"input contains invalid characters for a filename";
732 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
733 colordialog.setTarget(
this);
736 if (colordialog.execute()) {
750 myIndexParameterList(0),
752 maxNumberOfListParameters(2) {
799 WRITE_WARNING(
"Attribute '" +
toString(ShapeAttributeSingle) +
"' doesn't have a defined type. Check definition in GNEAttributeCarrier");
822 std::map<SumoXMLAttr, std::string>
824 std::map<SumoXMLAttr, std::string> values;
835 std::string errorMessage;
840 if (attributeValue.size() != 0) {
841 errorMessage = attributeValue;
845 if (extra.size() == 0) {
846 errorMessage =
"Invalid input parameter of " +
toString(
myShapeTag) +
": " + errorMessage;
884 FXTable* myTable =
new FXTable(helpDialog,
this,
MID_TABLE, TABLE_READONLY);
886 myTable->setVisibleColumns(3);
888 myTable->setBackColor(FXRGB(255, 255, 255));
889 myTable->setColumnText(0,
"Name");
890 myTable->setColumnText(1,
"Value");
891 myTable->setColumnText(2,
"Definition");
892 myTable->getRowHeader()->setWidth(0);
893 FXHeader* header = myTable->getColumnHeader();
894 header->setItemJustify(0, JUSTIFY_CENTER_X);
895 header->setItemSize(0, 120);
896 header->setItemJustify(1, JUSTIFY_CENTER_X);
897 header->setItemSize(1, 80);
898 int maxSizeColumnDefinitions = 0;
904 myTable->setItem(i, 0,
new FXTableItem(
toString(shapeAttr).c_str()));
906 FXTableItem* type =
new FXTableItem(
"");
908 type->setText(
"int");
910 type->setText(
"float");
912 type->setText(
"time");
914 type->setText(
"bool");
916 type->setText(
"color");
918 type->setText(
"string");
920 type->setJustify(FXTableItem::CENTER_X);
921 myTable->setItem(i, 1, type);
924 definition->setJustify(FXTableItem::LEFT);
925 myTable->setItem(i, 2, definition);
931 header->setItemJustify(2, JUSTIFY_CENTER_X);
932 header->setItemSize(2, maxSizeColumnDefinitions * 6);
935 helpDialog->create();
1040 std::string vectorOfIds;
1041 for (
int i = 0; i < list->getNumItems(); i++) {
1042 if (list->isItemSelected(i)) {
1043 if (vectorOfIds.size() > 0) {
1046 vectorOfIds += (list->getItem(i)->getText()).
text();
ShapeAttributeSingle()
FOX needs this.
std::string getValue() const
return value
long onCmdStopDrawing(FXObject *, FXSelector, void *)
Called when the user press stop drawing button.
void show()
show Drawing mode
SumoXMLTag
Numbers representing SUMO-XML - element names.
#define GUIDesignComboBoxNCol
number of column of every combo box
static RGBColor parseColor(std::string coldef)
Parses a color information.
bool buildPoly(const PositionVector &drawedShape)
build Polygon using values of Fields and drawed shap return true if was sucesfully created ...
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical of type float
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
void setParametersOfShape(SumoXMLTag actualShapeType)
set parameters depending of the new additionalType
~ShapeAttributeSingle()
destructor
FXHorizontalFrame * myBlockShapeFrame
frame for Block shape
~GNEPolygonFrame()
Destructor.
FXTextField * myTextFieldInt
textField to modify the default value of int/float/string parameters
void stopDrawing()
stop drawing and create polygon or
SumoXMLTag myShapeTag
current XML attribute
block shape of a graphic element (Used mainly in GNEShapes)
GNEPolygonFrame::NeteditAttributes * getNetEditParameters() const
get editor parameters
AddShapeResult
FOX-declaration.
std::string generatePOIID() const
generate a POI ID
static const std::vector< SumoXMLTag > & allowedShapeTags()
get all editable for tag shape elements
FXLabel * myClosePolygonLabel
Label for open/close polygon.
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, const Position &pos, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
GNEPolygonFrame::NeteditAttributes * myEditorParameters
Netedit parameter.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
AddShapeResult processClick(const Position &clickedPosition)
process click over Viewnet
long onCmdHelp(FXObject *, FXSelector, void *)
void remove2Update()
Removes the dialog to be updated.
void addNewPoint(const Position &P)
add new point to temporal shape
void hideShapeParameters()
hide group box
long onCmdStartDrawing(FXObject *, FXSelector, void *)
static bool isPositive(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is only Positive (i.e. cannot take negative values)
long onCmdSetBooleanAttribute(FXObject *, FXSelector, void *)
called when user change the value of myBoolCheckButton
int myIndexParameter
Index for myVectorOfsingleShapeParameter.
GNEViewNet * myViewNet
pointer to viewNet
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...
FXLabel * myInformationLabel
Label with information.
FXTextField * myTextFieldReal
textField to modify the default value of real/times parameters
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a polygon
GNEPolygonFrame::DrawingMode * getDrawingMode() const
get drawing mode
FXCheckButton * myBlockMovementCheckButton
checkBox for block movement
FXLabel * myBlockMovementLabel
Label for block movement.
bool isBlockShapeEnabled() const
check if block shape is enabled
FXButton * myStopDrawingButton
button for stop drawing
static bool isValidFilename(const std::string &value)
true if value is a valid file value
static const std::vector< std::pair< SumoXMLAttr, std::string > > & allowedAttributes(SumoXMLTag tag)
get all editable attributes for tag and their default values.
bool addPolygon(const std::map< SumoXMLAttr, std::string > &POIValues)
add Polygon
bool addPOI(const std::map< SumoXMLAttr, std::string > &POIValues)
add POI
bool isBlockMovementEnabled() const
check if block movement is enabled
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
FXHorizontalFrame * myClosePolygonFrame
Frame for open/close polygon.
GNEUndoList * getUndoList() const
get the undoList object
additional match box messages
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
#define GUIDesignComboBox
GNEViewNet * myViewNet
the window to inform when the tls is modfied
void addAttribute(SumoXMLTag additionalTag, SumoXMLAttr ShapeAttributeSingle)
add attribute
long onCmdSetBlockMovement(FXObject *, FXSelector, void *)
void show(bool shapeEditing)
show NeteditAttributes
static bool isInt(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical or type int
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
void removeLastPoint()
remove last added point
FXButton * helpShape
button for help
FXTextField * myTextFieldStrings
textField to modify the default value of string parameters
~ShapeAttributes()
destructor
#define GUIDesignTextField
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
const std::string & isAttributeValid() const
returns a empty string if current value is valid, a string with information about invalid value in ot...
long onCmdsetClosingClosing(FXObject *, FXSelector, void *)
Called when the user change checkbox for open/closed polygon.
FXButton * mycolorEditor
Button for open color editor.
static bool isColor(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type color for a certain tag
PositionVector myTemporalShapeShape
current drawed shape
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.
A point in 2D or 3D with translation and scaling methods.
FXCheckButton * myClosePolygonCheckButton
checkbox to enable/disable closing polygon
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
static bool isFilename(SumoXMLTag tag, SumoXMLAttr attr)
whether a string attribute is a filename
void hideParameter()
hide all parameters
GNEPolygonFrame::DrawingMode * myDrawingMode
drawing mode
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get attributes and their values
void clearAttributes()
clear attributes
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
block movement of a graphic element
FXButton * myAbortDrawingButton
button for abort drawing
void hide()
hide NeteditAttributes
void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value)
show name and value of attribute of type string
bool isDrawing() const
return true if currently a shape is drawed
long onCmdSetBlockShape(FXObject *, FXSelector, void *)
Called when user changes the checkbox "set blocking shape".
ShapeAttributes()
FOX needs this.
edge: the shape in xml-definition
std::string generatePolyID() const
generate PolyID
FXCheckButton * myBlockShapeCheckButton
checkBox for block shape
void startDrawing()
start drawing
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
const PositionVector & getTemporalShape() const
get Temporal shape
int getNumberOfAddedAttributes() const
get number of added attributes
void p_abort()
reverts and discards ALL active command groups
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
GNEViewNet * getViewNet() const
get view net
bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, const PositionVector &shape, bool fill, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
SumoXMLTag getTag() const
return tag
bool areValuesValid() const
check if parameters of attributes are valid
FXComboBox * myShapeMatchBox
combo box with the list of additional elements
long onCmdAbortDrawing(FXObject *, FXSelector, void *)
Called when the user press abort drawing button.
void hide()
show Drawing mode
static bool isUnique(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection and don't have a default valu...
#define GUIDesignTextFieldNCol
Num of column of text field.
NeteditAttributes()
FOX needs this.
SumoXMLTag myActualShapeType
actual additional type selected in the match Box
SumoXMLTag myShapeTag
current additional tag
virtual void show()
show Frame
static bool isProbability(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is a probability (i.e. oly can values between [0, 1])
#define GUIDesignDialogBox
int maxNumberOfParameters
max number of parameters (Defined in constructor)
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
void show()
show additional frame and update use selected edges/lanes
static bool isBool(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool for a certain tag
bool isCloseShapeEnabled() const
check if clse shape is enabled
FXButton * myStartDrawingButton
button for start drawing
std::vector< ShapeAttributeSingle * > myVectorOfsingleShapeParameter
vector with the additional parameters
void abortDrawing()
abort drawing
FXLabel * myBlockShapeLabel
Label for block shape.
GNEPolygonFrame::ShapeAttributes * myShapeAttributes
additional internal attributes
static std::string getDefinition(SumoXMLTag tag, SumoXMLAttr attr)
return definition of a certain SumoXMLAttr
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
virtual void hide()
hide Frame
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
int myIndexParameterList
index for myIndexParameterList
#define GUIDesignButtonOK
void setStatusBarText(const std::string &text)
set staturBar text
SumoXMLAttr getAttr() const
return Attr
void showShapeParameters()
show group box
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
SumoXMLAttr myShapeAttr
current XML attribute
#define GUIDesignLabelLeft
FXDEFMAP(GNEPolygonFrame) GNEShapeMap[]
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
FXCheckButton * myBoolCheckButton
check button to enable/disable the value of boolean parameters
GNEPolygonFrame * myPolygonFrameParent
polygon frame parent
void closePolygon()
ensures that the last position equals the first
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
long onCmdSetAttribute(FXObject *, FXSelector, void *)
GUISelectedStorage gSelected
A global holder of selected objects.
DrawingMode()
FOX needs this.
~NeteditAttributes()
destructor
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occured errors.
begin/end of the description of a polygon
long onCmdSetColorAttribute(FXObject *, FXSelector, void *)
called when user press the "Color" button
std::string myInvalidValue
string which indicates the reason due current value is invalid
long onCmdSelectShape(FXObject *, FXSelector, void *)
FXLabel * myLabel
lael with the name of the parameter