59 myPolygonFrameParent(polygonFrameParent) {
64 myLatLonRadioButton->setCheck(TRUE);
72 myLabelCartesianPosition =
new FXLabel(getCollapsableFrame(),
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude", 0,
GUIDesignLabelFrameInformation);
83 myCoordinatesTextField->enable();
84 myCoordinatesTextField->setText(
"");
85 myCoordinatesTextField->enable();
86 myCreateGEOPOIButton->enable();
88 myCoordinatesTextField->setText(
"No geo-conversion defined");
89 myCoordinatesTextField->disable();
90 myCreateGEOPOIButton->disable();
105 std::string input = myCoordinatesTextField->getText().text();
106 std::string inputWithoutSpaces;
107 for (
const auto& i : input) {
109 inputWithoutSpaces.push_back(i);
113 if (input.size() != inputWithoutSpaces.size()) {
114 myCoordinatesTextField->setText(inputWithoutSpaces.c_str());
116 if (inputWithoutSpaces.size() > 0) {
117 myCreateGEOPOIButton->setText(
"Create GEO POI");
119 myCreateGEOPOIButton->setText(
"Create GEO POI (clipboard)");
122 if (GNEAttributeCarrier::canParse<Position>(myCoordinatesTextField->getText().text())) {
123 myCoordinatesTextField->setTextColor(FXRGB(0, 0, 0));
124 myCoordinatesTextField->killFocus();
126 Position geoPos = GNEAttributeCarrier::parse<Position>(myCoordinatesTextField->getText().text());
127 if (myLatLonRadioButton->getCheck() == TRUE) {
133 myLabelCartesianPosition->setText((
"Cartesian equivalence:\n- X = " +
toString(geoPos.
x()) +
"\n- Y = " +
toString(geoPos.
y())).c_str());
135 myCoordinatesTextField->setTextColor(FXRGB(255, 0, 0));
136 myLabelCartesianPosition->setText(
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude");
145 if (obj == myLonLatRadioButton) {
146 myLonLatRadioButton->setCheck(TRUE);
147 myLatLonRadioButton->setCheck(FALSE);
148 }
else if (obj == myLatLonRadioButton) {
149 myLonLatRadioButton->setCheck(FALSE);
150 myLatLonRadioButton->setCheck(TRUE);
153 onCmdSetCoordinates(0, 0, 0);
161 if (myPolygonFrameParent->myShapeAttributes->areValuesValid()) {
162 std::string geoPosStr = myCoordinatesTextField->getText().text();
163 if (geoPosStr.empty()) {
167 myCoordinatesTextField->setText(geoPosStr.c_str());
169 onCmdSetCoordinates(0, 0, 0);
170 geoPosStr = myCoordinatesTextField->getText().text();
171 myCoordinatesTextField->setText(
"");
172 myCreateGEOPOIButton->setText(
"Create GEO POI (clipboard)");
174 if (GNEAttributeCarrier::canParse<Position>(geoPosStr)) {
176 myPolygonFrameParent->createBaseShapeObject(
SUMO_TAG_POI);
178 myPolygonFrameParent->myShapeAttributes->getAttributesAndValues(myPolygonFrameParent->myBaseShape,
true);
180 myPolygonFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(myPolygonFrameParent->myBaseShape,
nullptr);
182 if (!myPolygonFrameParent->myBaseShape->hasStringAttribute(
SUMO_ATTR_ID)) {
183 myPolygonFrameParent->myBaseShape->addStringAttribute(
SUMO_ATTR_ID, myPolygonFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateShapeID(
SUMO_TAG_POI));
186 myPolygonFrameParent->myBaseShape->addBoolAttribute(
SUMO_ATTR_GEO,
true);
187 Position geoPos = GNEAttributeCarrier::parse<Position>(geoPosStr);
189 if (myLatLonRadioButton->getCheck() == TRUE) {
195 myPolygonFrameParent->addShape();
197 if (myCenterViewAfterCreationCheckButton->getCheck() == TRUE) {
200 centerPosition.
add(geoPos);
201 centerPosition = centerPosition.
grow(10);
202 myPolygonFrameParent->myViewNet->getViewParent()->getView()->centerTo(centerPosition);
206 myPolygonFrameParent->myShapeAttributes->refreshAttributesCreator();
217 GNEFrame(horizontalFrameParent, viewNet,
"Shapes"),
257 updateTemporalShape =
false;
357 updateTemporalShape =
true;
372 std::string vectorOfIds;
373 for (
int i = 0; i < list->getNumItems(); i++) {
374 if (list->isItemSelected(i)) {
375 if (vectorOfIds.size() > 0) {
378 vectorOfIds += (list->getItem(i)->getText()).text();
FXDEFMAP(GNEPolygonFrame::GEOPOICreator) GEOPOICreatorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CHOOSEN_OPERATION
set type of selection
@ MID_GNE_CREATE
create element
#define GUIDesignTextField
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignRadioButton
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
#define WRITE_WARNING(msg)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ GNE_TAG_POILANE
Point of interest over Lane.
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
bool hasStringAttribute(const SumoXMLAttr attr) const
has function
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
void addPositionVectorAttribute(const SumoXMLAttr attr, const PositionVector &value)
add PositionVector attribute into current SumoBaseObject node
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
bool getBoolAttribute(const SumoXMLAttr attr) const
get bool attribute
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
FXGroupBoxModule (based on FXGroupBox)
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
bool areValuesValid() const
check if parameters of attributes are valid
void refreshAttributesCreator()
refresh attribute creator
void showAttributesCreatorModule(GNEAttributeCarrier *templateAC, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
void getAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, bool includeAll) const
get attributes and their values
void hideAttributesCreatorModule()
hide group box
void hideNeteditAttributesModule()
hide Netedit attributes modul
bool getNeteditAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, const GNELane *lane) const
fill valuesMap with netedit attributes
void showNeteditAttributesModule(const GNETagProperties &tagValue)
show Netedit attributes modul
GNEViewNet * myViewNet
View Net.
virtual void show()
show Frame
virtual void hide()
hide Frame
bool getDeleteLastCreatedPoint()
get flag delete last created point
const PositionVector & getTemporalShape() const
get Temporal shape
void hideDrawingShape()
hide Drawing mode
void addNewPoint(const Position &P)
add new point to temporal shape
void removeLastPoint()
remove last added point
void showDrawingShape()
show Drawing mode
bool isDrawing() const
return true if currently a shape is drawed
void refreshTagSelector()
refresh tagSelector (used when frameParent is show)
GNEAttributeCarrier * getCurrentTemplateAC() const
get current templateAC
const PositionVector & getLaneShape() const
get elements shape
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
const std::string & getID() const
get ID
long onCmdCreateGEOPOI(FXObject *, FXSelector, void *)
called when user type in search box
void hideGEOPOICreatorModule()
hide GEOPOICreator Module
~GEOPOICreator()
destructor
void showGEOPOICreatorModule()
Show list of GEOPOICreator Module.
long onCmdSetFormat(FXObject *, FXSelector, void *)
called when user select a format radio button
long onCmdSetCoordinates(FXObject *, FXSelector, void *)
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, bool &updateTemporalShape)
process click over Viewnet
void createBaseShapeObject(const SumoXMLTag shapeTag)
GNEFrameAttributeModules::AttributesCreator * myShapeAttributes
shape internal attributes
CommonXMLStructure::SumoBaseObject * myBaseShape
SumoBaseObject used for create shape.
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
void tagSelected()
Tag selected in TagSelector.
GNEFrameAttributeModules::NeteditAttributes * myNeteditAttributes
Netedit parameter.
GNEFrameModules::DrawingShape * myDrawingShape
Drawing shape.
~GNEPolygonFrame()
Destructor.
GNEFrameModules::TagSelector * myShapeTagSelector
shape tag selector
GNEPolygonFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
GNEFrameModules::DrawingShape * getDrawingShapeModule() const
get drawing mode editor
GEOPOICreator * myGEOPOICreator
GEOPOICreator.
bool shapeDrawed()
build a shaped element using the drawed shape return true if was successfully created
void addShape()
add shape (using base shape)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
class used to group all variables related with objects under cursor after a click over view
GNELane * getLaneFront() const
get front lane or a pointer to nullptr
GNENet * getNet() const
get the net object
void setStatusBarText(const std::string &text)
set staturBar text
static std::string copyFromClipboard(const FXApp &app)
Copies text from the clipboard.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
C++ TraCI client API implementation.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void swapXY()
swap position X and Y
double y() const
Returns the y-position.
void closePolygon()
ensures that the last position equals the first
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D