74 FXIMPLEMENT(
GNEPolygonFrame, FXVerticalFrame, GNEPolygonFrameMap, ARRAYNUMBER(GNEPolygonFrameMap))
83 GNEFrame(horizontalFrameParent, viewNet, "Shapes"),
103 myShapeMatchBox->appendItem(
toString(i).c_str());
107 myShapeMatchBox->setNumVisible((
int)myShapeMatchBox->getNumItems());
113 setParametersOfShape(myActualShapeType);
116 myDrawingMode->showDrawingMode();
118 myDrawingMode->hideDrawingMode();
147 if (
addPOI(valuesOfElement)) {
226 bool shapeNameCorrect =
false;
234 shapeNameCorrect =
true;
238 if (shapeNameCorrect ==
false) {
266 std::string vectorOfIds;
267 for (
int i = 0; i < list->getNumItems(); i++) {
268 if (list->isItemSelected(i)) {
269 if (vectorOfIds.size() > 0) {
272 vectorOfIds += (list->getItem(i)->getText()).text();
307 double layer = GNEAttributeCarrier::parse<double>(polyValues.at(
SUMO_ATTR_LAYER));
308 double angle = GNEAttributeCarrier::parse<double>(polyValues.at(
SUMO_ATTR_ANGLE));
311 bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(
SUMO_ATTR_FILL));
337 double layer = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_LAYER));
339 double angle = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_ANGLE));
341 double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_WIDTH));
342 double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_HEIGHT));
346 if (
myViewNet->
getNet()->
addPOI(
id, type, color, pos,
false,
"", 0, 0, layer, angle, imgFile, widthPOI, heightPOI)) {
366 double layer = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_LAYER));
367 double angle = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_ANGLE));
370 double posLane = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_POSITION));
372 double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_WIDTH));
373 double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_HEIGHT));
377 if (
myViewNet->
getNet()->
addPOI(
id, type, color,
Position(),
false, lane->
getID(), posLane, posLat, layer, angle, imgFile, widthPOI, heightPOI)) {
540 if (GNEAttributeCarrier::canParse<int>(
myTextFieldInt->getText().text())) {
542 int intValue = GNEAttributeCarrier::parse<int>(
myTextFieldInt->getText().text());
552 if (GNEAttributeCarrier::canParse<double>(
myTextFieldReal->getText().text())) {
554 double doubleValue = GNEAttributeCarrier::parse<double>(
myTextFieldReal->getText().text());
556 if (doubleValue < 0) {
563 if (GNEAttributeCarrier::canParse<double>(
myTextFieldReal->getText().text())) {
565 double doubleValue = GNEAttributeCarrier::parse<double>(
myTextFieldReal->getText().text());
578 if (GNEAttributeCarrier::canParse<RGBColor>(
myTextFieldStrings->getText().text()) ==
false) {
585 myInvalidValue =
"input contains invalid characters for a filename";
628 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
629 colordialog.setTarget(
this);
632 if (colordialog.execute()) {
646 myIndexParameterList(0),
648 maxNumberOfListParameters(2) {
695 WRITE_WARNING(
"Attribute '" +
toString(ShapeAttributeSingle) +
"' doesn't have a defined type. Check definition in GNEAttributeCarrier");
718 std::map<SumoXMLAttr, std::string>
720 std::map<SumoXMLAttr, std::string> values;
731 std::string errorMessage;
736 if (attributeValue.size() != 0) {
737 errorMessage = attributeValue;
741 if (extra.size() == 0) {
742 errorMessage =
"Invalid input parameter of " +
toString(
myShapeTag) +
": " + errorMessage;
780 FXTable* myTable =
new FXTable(helpDialog,
this,
MID_TABLE, TABLE_READONLY);
782 myTable->setVisibleColumns(3);
784 myTable->setBackColor(FXRGB(255, 255, 255));
785 myTable->setColumnText(0,
"Name");
786 myTable->setColumnText(1,
"Value");
787 myTable->setColumnText(2,
"Definition");
788 myTable->getRowHeader()->setWidth(0);
789 FXHeader* header = myTable->getColumnHeader();
790 header->setItemJustify(0, JUSTIFY_CENTER_X);
791 header->setItemSize(0, 120);
792 header->setItemJustify(1, JUSTIFY_CENTER_X);
793 header->setItemSize(1, 80);
794 int maxSizeColumnDefinitions = 0;
800 myTable->setItem(i, 0,
new FXTableItem(
toString(shapeAttr).c_str()));
802 FXTableItem* type =
new FXTableItem(
"");
804 type->setText(
"int");
806 type->setText(
"float");
808 type->setText(
"time");
810 type->setText(
"bool");
812 type->setText(
"color");
814 type->setText(
"string");
816 type->setJustify(FXTableItem::CENTER_X);
817 myTable->setItem(i, 1, type);
820 definition->setJustify(FXTableItem::LEFT);
821 myTable->setItem(i, 2, definition);
827 header->setItemJustify(2, JUSTIFY_CENTER_X);
828 header->setItemSize(2, maxSizeColumnDefinitions * 6);
831 helpDialog->create();
AddShapeResult processClick(const Position &clickedPosition, GNELane *lane)
process click over Viewnet
ShapeAttributeSingle()
FOX needs this.
void showDrawingMode()
show Drawing mode
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::string getValue() const
return value
#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 shape return true if was sucesfully created ...
int getNumberOfAddedAttributes() const
get number of added attributes
#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 shapeType
~ShapeAttributeSingle()
destructor
~GNEPolygonFrame()
Destructor.
FXTextField * myTextFieldInt
textField to modify the default value of int/float/string parameters
SumoXMLTag myShapeTag
current XML attribute
block shape of a graphic element (Used mainly in GNEShapes)
AddShapeResult
FOX-declaration.
static const std::vector< SumoXMLTag > & allowedShapeTags()
get all editable for tag shape elements
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
long onCmdHelp(FXObject *, FXSelector, void *)
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
void remove2Update()
Removes the dialog to be updated.
void hideShapeParameters()
hide group box
static bool isPositive(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is only Positive (i.e. cannot take negative values)
GNEFrame::NeteditAttributes * myNeteditAttributes
Netedit parameter.
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get attributes and their values
long onCmdSetBooleanAttribute(FXObject *, FXSelector, void *)
called when user change the value of myBoolCheckButton
change parameter of type text
int myIndexParameter
Index for myVectorOfsingleShapeParameter.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
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...
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 Point of interest
void showParameter(SumoXMLTag shapeTag, SumoXMLAttr shapeAttr, std::string value)
show name and value of attribute of type string
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.
void hideDrawingMode()
hide Drawing mode
bool addPolygon(const std::map< SumoXMLAttr, std::string > &POIValues)
add Polygon
bool addPOI(const std::map< SumoXMLAttr, std::string > &POIValues)
add POI
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
#define GUIDesignComboBox
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
GNEViewNet * myViewNet
View Net for changes.
GNEPOILane * retrievePOILane(const std::string &id, bool failHard=true) const
get POILane by id
void addAttribute(SumoXMLTag shapeTag, SumoXMLAttr ShapeAttributeSingle)
add attribute
static bool isInt(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical or type int
GNEFrame::DrawingMode * myDrawingMode
drawing mode
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
GNEUndoList * getUndoList() const
get the undoList object
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
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)
bool areValuesValid() const
check if parameters of attributes are valid
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
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.
void addNewPoint(const Position &P)
add new point to temporal shape
#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
bool isBlockShapeEnabled() const
check if block shape is enabled
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
bool addPOILane(const std::map< SumoXMLAttr, std::string > &POIValues)
add POILane
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 geo, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
ShapeAttributes()
FOX needs this.
edge: the shape in xml-definition
const std::string getID() const
function to support debugging
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
FXDEFMAP(GNEPolygonFrame) GNEPolygonFrameMap[]
void p_abort()
reverts and discards ALL active command groups
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
open edit attribute dialog
FXComboBox * myShapeMatchBox
combo box with the list of shape elements
change parameter of tpye bool
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.
SumoXMLTag myActualShapeType
actual shape type selected in the match Box
SumoXMLTag myShapeTag
current shape tag
const PositionVector & getShape() const
returns the shape of the lane
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 shape 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
select type of additional
const std::string & isAttributeValid() const
returns a empty string if current value is valid, a string with information about invalid value in ot...
SumoXMLAttr getAttr() const
return Attr
std::vector< ShapeAttributeSingle * > myVectorOfsingleShapeParameter
vector with the shape parameters
GNEPolygonFrame::ShapeAttributes * myShapeAttributes
shape internal attributes
static std::string getDefinition(SumoXMLTag tag, SumoXMLAttr attr)
return definition of a certain SumoXMLAttr
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
virtual void hide()
hide Frame
void hideNeteditAttributes()
hide NeteditAttributes
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
void showNeteditAttributes(bool shapeEditing)
show NeteditAttributes
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
int myIndexParameterList
index for myIndexParameterList
SumoXMLTag getTag() const
return tag
#define GUIDesignButtonOK
void setStatusBarText(const std::string &text)
set staturBar text
void showShapeParameters()
show group box
SumoXMLAttr myShapeAttr
current XML attribute
begin/end of the description of a Point of interest over Lane (used by Netedit)
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
FXCheckButton * myBoolCheckButton
check button to enable/disable the value of boolean parameters
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
bool isDrawing() const
return true if currently a shape is drawed
long onCmdSetAttribute(FXObject *, FXSelector, void *)
GUISelectedStorage gSelected
A global holder of selected objects.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
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.
bool isBlockMovementEnabled() const
check if block movement is enabled
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