57 myShapeFrameParent(polygonFrameParent) {
62 myLatLonRadioButton->setCheck(TRUE);
70 myLabelCartesianPosition =
new FXLabel(getCollapsableFrame(),
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude", 0,
GUIDesignLabelFrameInformation);
81 myCoordinatesTextField->enable();
82 myCoordinatesTextField->setText(
"");
83 myCoordinatesTextField->enable();
84 myCreateGEOPOIButton->enable();
86 myCoordinatesTextField->setText(
TL(
"No geo-conversion defined"));
87 myCoordinatesTextField->disable();
88 myCreateGEOPOIButton->disable();
103 std::string input = myCoordinatesTextField->getText().text();
104 std::string inputWithoutSpaces;
105 for (
const auto& i : input) {
107 inputWithoutSpaces.push_back(i);
111 if (input.size() != inputWithoutSpaces.size()) {
112 myCoordinatesTextField->setText(inputWithoutSpaces.c_str());
114 if (inputWithoutSpaces.size() > 0) {
115 myCreateGEOPOIButton->setText(
TL(
"Create GEO POI"));
117 myCreateGEOPOIButton->setText(
TL(
"Create GEO POI (clipboard)"));
120 if (GNEAttributeCarrier::canParse<Position>(myCoordinatesTextField->getText().text())) {
121 myCoordinatesTextField->setTextColor(FXRGB(0, 0, 0));
122 myCoordinatesTextField->killFocus();
124 Position geoPos = GNEAttributeCarrier::parse<Position>(myCoordinatesTextField->getText().text());
125 if (myLatLonRadioButton->getCheck() == TRUE) {
131 myLabelCartesianPosition->setText((
"Cartesian equivalence:\n- X = " +
toString(geoPos.
x()) +
"\n- Y = " +
toString(geoPos.
y())).c_str());
133 myCoordinatesTextField->setTextColor(FXRGB(255, 0, 0));
134 myLabelCartesianPosition->setText(
TL(
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude"));
143 if (obj == myLonLatRadioButton) {
144 myLonLatRadioButton->setCheck(TRUE);
145 myLatLonRadioButton->setCheck(FALSE);
146 }
else if (obj == myLatLonRadioButton) {
147 myLonLatRadioButton->setCheck(FALSE);
148 myLatLonRadioButton->setCheck(TRUE);
151 onCmdSetCoordinates(0, 0, 0);
159 if (myShapeFrameParent->myShapeAttributes->areValuesValid()) {
160 std::string geoPosStr = myCoordinatesTextField->getText().text();
161 if (geoPosStr.empty()) {
165 myCoordinatesTextField->setText(geoPosStr.c_str());
167 onCmdSetCoordinates(0, 0, 0);
168 geoPosStr = myCoordinatesTextField->getText().text();
169 myCoordinatesTextField->setText(
"");
170 myCreateGEOPOIButton->setText(
TL(
"Create GEO POI (clipboard)"));
172 if (GNEAttributeCarrier::canParse<Position>(geoPosStr)) {
174 myShapeFrameParent->createBaseShapeObject(
SUMO_TAG_POI);
176 myShapeFrameParent->myShapeAttributes->getAttributesAndValues(myShapeFrameParent->myBaseShape,
true);
178 myShapeFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(myShapeFrameParent->myBaseShape,
nullptr);
180 if (!myShapeFrameParent->myBaseShape->hasStringAttribute(
SUMO_ATTR_ID)) {
181 myShapeFrameParent->myBaseShape->addStringAttribute(
SUMO_ATTR_ID, myShapeFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateAdditionalID(
SUMO_TAG_POI));
184 myShapeFrameParent->myBaseShape->addBoolAttribute(
SUMO_ATTR_GEO,
true);
185 Position geoPos = GNEAttributeCarrier::parse<Position>(geoPosStr);
187 if (myLatLonRadioButton->getCheck() == TRUE) {
192 myShapeFrameParent->myBaseShape->addDoubleAttribute(
SUMO_ATTR_LON, geoPos.
x());
193 myShapeFrameParent->myBaseShape->addDoubleAttribute(
SUMO_ATTR_LAT, geoPos.
y());
195 myShapeFrameParent->myBaseShape->addBoolAttribute(
SUMO_ATTR_GEO,
true);
197 myShapeFrameParent->addShape();
199 if (myCenterViewAfterCreationCheckButton->getCheck() == TRUE) {
202 centerPosition.
add(geoPos);
203 centerPosition = centerPosition.
grow(10);
204 myShapeFrameParent->myViewNet->getViewParent()->getView()->centerTo(centerPosition);
208 myShapeFrameParent->myShapeAttributes->refreshAttributesCreator();
219 GNEFrame(viewParent, viewNet,
"Shapes"),
259 updateTemporalShape =
false;
359 updateTemporalShape =
true;
374 std::string vectorOfIds;
375 for (
int i = 0; i < list->getNumItems(); i++) {
376 if (list->isItemSelected(i)) {
377 if (vectorOfIds.size() > 0) {
380 vectorOfIds += (list->getItem(i)->getText()).text();
FXDEFMAP(GNEShapeFrame::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)
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
const std::string getID() const
get ID (all Attribute Carriers have one)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void getAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, bool includeAll) const
get attributes and their values
bool areValuesValid() const
check if parameters of attributes are valid
void showAttributesCreatorModule(GNEAttributeCarrier *templateAC, const std::vector< SumoXMLAttr > &hiddenAttributes)
show GNEAttributesCreator modul
void hideAttributesCreatorModule()
hide group box
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
void refreshAttributesCreator()
refresh attribute creator
bool isDrawing() const
return true if currently a shape is drawed
void addNewPoint(const Position &P)
add new point to temporal shape
bool getDeleteLastCreatedPoint()
get flag delete last created point
void removeLastPoint()
remove last added point
void showDrawingShape()
show Drawing mode
void hideDrawingShape()
hide Drawing mode
const PositionVector & getTemporalShape() const
get Temporal shape
GNEViewNet * myViewNet
FOX need this.
virtual void show()
show Frame
virtual void hide()
hide Frame
const PositionVector & getLaneShape() const
get elements shape
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
void showNeteditAttributesModule(GNEAttributeCarrier *templateAC)
show Netedit attributes modul
void hideNeteditAttributesModule()
hide Netedit attributes modul
bool getNeteditAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, const GNELane *lane) const
fill valuesMap with netedit attributes
~GEOPOICreator()
destructor
long onCmdSetFormat(FXObject *, FXSelector, void *)
called when user select a format radio button
void hideGEOPOICreatorModule()
hide GEOPOICreator Module
long onCmdSetCoordinates(FXObject *, FXSelector, void *)
void showGEOPOICreatorModule()
Show list of GEOPOICreator Module.
long onCmdCreateGEOPOI(FXObject *, FXSelector, void *)
called when user type in search box
void tagSelected()
Tag selected in GNETagSelector.
GNEDrawingShape * getDrawingShapeModule() const
get drawing mode editor
GNEAttributesCreator * myShapeAttributes
shape internal attributes
void addShape()
add shape (using base shape)
void createBaseShapeObject(const SumoXMLTag shapeTag)
GNEDrawingShape * myDrawingShape
Drawing shape.
CommonXMLStructure::SumoBaseObject * myBaseShape
SumoBaseObject used for create shape.
GEOPOICreator * myGEOPOICreator
GEOPOICreator.
~GNEShapeFrame()
Destructor.
GNENeteditAttributes * myNeteditAttributes
Netedit parameter.
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, bool &updateTemporalShape)
process click over Viewnet
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
GNEShapeFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
bool shapeDrawed()
build a shaped element using the drawed shape return true if was successfully created
GNETagSelector * myShapeTagSelector
shape tag selector
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void refreshTagSelector()
refresh tagSelector (used when frameParent is show)
GNEAttributeCarrier * getCurrentTemplateAC() const
get current templateAC
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 statusBar text
A single child window which contains a view of the simulation area.
static std::string copyFromClipboard(const FXApp &app)
Copies text from the clipboard.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
MFXGroupBoxModule (based on FXGroupBox)
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