59 myShapeFrameParent(polygonFrameParent) {
64 myLatLonRadioButton->setCheck(TRUE);
73 (
TL(
"Cartesian equivalence:") + std::string(
"\n") +
74 TL(
"- X = give valid longitude") + std::string(
"\n") +
75 TL(
"- Y = give valid latitude")).c_str(),
87 myCoordinatesTextField->enable();
88 myCoordinatesTextField->setText(
"");
89 myCoordinatesTextField->enable();
90 myCreateGEOPOIButton->enable();
92 myCoordinatesTextField->setText(
TL(
"No geo-conversion defined"));
93 myCoordinatesTextField->disable();
94 myCreateGEOPOIButton->disable();
109 std::string input = myCoordinatesTextField->getText().text();
110 std::string inputWithoutSpaces;
111 for (
const auto& i : input) {
113 inputWithoutSpaces.push_back(i);
117 if (input.size() != inputWithoutSpaces.size()) {
118 myCoordinatesTextField->setText(inputWithoutSpaces.c_str());
120 if (inputWithoutSpaces.size() > 0) {
121 myCreateGEOPOIButton->setText(
TL(
"Create GEO POI"));
123 myCreateGEOPOIButton->setText(
TL(
"Create GEO POI (clipboard)"));
126 if (GNEAttributeCarrier::canParse<Position>(myCoordinatesTextField->getText().text())) {
127 myCoordinatesTextField->setTextColor(FXRGB(0, 0, 0));
128 myCoordinatesTextField->killFocus();
130 Position geoPos = GNEAttributeCarrier::parse<Position>(myCoordinatesTextField->getText().text());
131 if (myLatLonRadioButton->getCheck() == TRUE) {
137 myLabelCartesianPosition->setText(
138 (
TL(
"Cartesian equivalence:") + std::string(
"\n- X = ") +
toString(geoPos.
x()) + std::string(
"\n- Y = ") +
toString(geoPos.
y())).c_str());
140 myCoordinatesTextField->setTextColor(FXRGB(255, 0, 0));
141 myLabelCartesianPosition->setText(
142 (
TL(
"Cartesian equivalence:") + std::string(
"\n") +
143 TL(
"- X = give valid longitude") + std::string(
"\n") +
144 TL(
"- Y = give valid latitude")).c_str());
153 if (obj == myLonLatRadioButton) {
154 myLonLatRadioButton->setCheck(TRUE);
155 myLatLonRadioButton->setCheck(FALSE);
156 }
else if (obj == myLatLonRadioButton) {
157 myLonLatRadioButton->setCheck(FALSE);
158 myLatLonRadioButton->setCheck(TRUE);
161 onCmdSetCoordinates(0, 0, 0);
169 if (myShapeFrameParent->myShapeAttributes->areValuesValid()) {
170 std::string geoPosStr = myCoordinatesTextField->getText().text();
171 if (geoPosStr.empty()) {
175 myCoordinatesTextField->setText(geoPosStr.c_str());
177 onCmdSetCoordinates(0, 0, 0);
178 geoPosStr = myCoordinatesTextField->getText().text();
179 myCoordinatesTextField->setText(
"");
180 myCreateGEOPOIButton->setText(
TL(
"Create GEO POI (clipboard)"));
182 if (GNEAttributeCarrier::canParse<Position>(geoPosStr)) {
184 myShapeFrameParent->createBaseShapeObject(
SUMO_TAG_POI);
186 myShapeFrameParent->myShapeAttributes->getAttributesAndValues(myShapeFrameParent->myBaseShape,
true);
188 myShapeFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(myShapeFrameParent->myBaseShape,
nullptr);
190 if (!myShapeFrameParent->myBaseShape->hasStringAttribute(
SUMO_ATTR_ID)) {
191 myShapeFrameParent->myBaseShape->addStringAttribute(
SUMO_ATTR_ID, myShapeFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateAdditionalID(
SUMO_TAG_POI));
194 myShapeFrameParent->myBaseShape->addBoolAttribute(
SUMO_ATTR_GEO,
true);
195 Position geoPos = GNEAttributeCarrier::parse<Position>(geoPosStr);
197 if (myLatLonRadioButton->getCheck() == TRUE) {
201 myShapeFrameParent->myBaseShape->addDoubleAttribute(
SUMO_ATTR_LON, geoPos.
x());
202 myShapeFrameParent->myBaseShape->addDoubleAttribute(
SUMO_ATTR_LAT, geoPos.
y());
204 myShapeFrameParent->myBaseShape->addBoolAttribute(
SUMO_ATTR_GEO,
true);
206 myShapeFrameParent->addShape();
208 if (myCenterViewAfterCreationCheckButton->getCheck() == TRUE) {
212 centerPosition.
add(geoPos);
213 centerPosition = centerPosition.
grow(10);
214 myShapeFrameParent->myViewNet->getViewParent()->getView()->centerTo(centerPosition);
218 myShapeFrameParent->myShapeAttributes->refreshAttributesCreator();
269 updateTemporalShape =
false;
298 std::string vectorOfIds;
299 for (
int i = 0; i < list->getNumItems(); i++) {
300 if (list->isItemSelected(i)) {
301 if (vectorOfIds.size() > 0) {
304 vectorOfIds += (list->getItem(i)->getText()).text();
422 updateTemporalShape =
true;
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_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
@ 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 hasBoolAttribute(const SumoXMLAttr attr) const
check if current SumoBaseObject has the given bool attribute
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)
add string attribute into current SumoBaseObject node
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
bool isUndoRedoAllowed() const
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
double getLengthGeometryFactor() const
get length geometry factor
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.
bool processClickPOI(SumoXMLTag POITag, const Position &clickedPosition, const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
process click for POIs over view
bool processClickPolygons(const Position &clickedPosition, bool &updateTemporalShape)
process click for Polygons
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ViewObjectsSelector &viewObjects, bool &updateTemporalShape)
process click over Viewnet
GNEDrawingShape * getDrawingShapeModule() const
get drawing mode editor
GNEAttributesCreator * myShapeAttributes
shape internal attributes
bool processClickPOILanes(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
process click for POILanes
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.
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
bool processClickPOIGeo(const Position &clickedPosition, const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
process click for POIGeo
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
GNEViewParent * getViewParent() 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.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
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.
A list item which allows for custom coloring.
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