 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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()->generateAdditionalID(
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();
void hideDrawingShape()
hide Drawing mode
#define GUIDesignTextFieldNCol
Num of column of text field.
GNEFrameModules::DrawingShape * myDrawingShape
Drawing shape.
#define WRITE_WARNING(msg)
void addNewPoint(const Position &P)
add new point to temporal shape
@ SUMO_TAG_POLY
begin/end of the description of a polygon
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
CommonXMLStructure::SumoBaseObject * myBaseShape
SumoBaseObject used for create shape.
@ MID_CHOOSEN_OPERATION
set type of selection
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
GNEFrameModules::TagSelector * myShapeTagSelector
shape tag selector
void addShape()
add shape (using base shape)
void showNeteditAttributesModule(const GNETagProperties &tagValue)
show Netedit attributes modul
void refreshAttributesCreator()
refresh attribute creator
GNEPolygonFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
GNEFrameAttributeModules::NeteditAttributes * myNeteditAttributes
Netedit parameter.
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
void setStatusBarText(const std::string &text)
set staturBar text
bool getBoolAttribute(const SumoXMLAttr attr) const
get bool attribute
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
void showGEOPOICreatorModule()
Show list of GEOPOICreator Module.
void refreshTagSelector()
refresh tagSelector (used when frameParent is show)
void showDrawingShape()
show Drawing mode
#define GUIDesignTextField
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
bool shapeDrawed()
build a shaped element using the drawed shape return true if was successfully created
@ GNE_TAG_POILANE
Point of interest over Lane.
void hideGEOPOICreatorModule()
hide GEOPOICreator Module
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
SumoXMLTag
Numbers representing SUMO-XML - element names.
void removeLastPoint()
remove last added point
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
FXDEFMAP(GNEPolygonFrame::GEOPOICreator) GEOPOICreatorMap[]
GNENet * getNet() const
get the net object
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
GEOPOICreator * myGEOPOICreator
GEOPOICreator.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
const PositionVector & getLaneShape() const
get elements shape
void getAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, bool includeAll) const
get attributes and their values
long onCmdSetCoordinates(FXObject *, FXSelector, void *)
class used to group all variables related with objects under cursor after a click over view
void closePolygon()
ensures that the last position equals the first
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
A class that stores a 2D geometrical boundary.
GNEFrameModules::DrawingShape * getDrawingShapeModule() const
get drawing mode editor
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
#define GUIDesignCheckButton
checkButton placed in left position
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
GNEViewNet * myViewNet
View Net.
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ MID_GNE_SET_ATTRIBUTE
attribute edited
~GNEPolygonFrame()
Destructor.
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
void hideNeteditAttributesModule()
hide Netedit attributes modul
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool areValuesValid() const
check if parameters of attributes are valid
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string & getID() const
get ID
double y() const
Returns the y-position.
bool getDeleteLastCreatedPoint()
get flag delete last created point
bool isDrawing() const
return true if currently a shape is drawed
~GEOPOICreator()
destructor
bool getNeteditAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, const GNELane *lane) const
fill valuesMap with netedit attributes
#define GUIDesignRadioButton
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
@ MID_GNE_CREATE
create element
FXGroupBoxModule (based on FXGroupBox)
void addPositionVectorAttribute(const SumoXMLAttr attr, const PositionVector &value)
add PositionVector attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
GNELane * getLaneFront() const
get front lane or a pointer to nullptr
void swapXY()
swap position X and Y
void showAttributesCreatorModule(GNEAttributeCarrier *templateAC, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
Boundary & grow(double by)
extends the boundary by the given amount
C++ TraCI client API implementation.
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
static std::string copyFromClipboard(const FXApp &app)
Copies text from the clipboard.
GNEAttributeCarrier * getCurrentTemplateAC() const
get current templateAC
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
void tagSelected()
Tag selected in TagSelector.
virtual void show()
show Frame
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
GNEFrameAttributeModules::AttributesCreator * myShapeAttributes
shape internal attributes
bool hasStringAttribute(const SumoXMLAttr attr) const
has function
void createBaseShapeObject(const SumoXMLTag shapeTag)
long onCmdSetFormat(FXObject *, FXSelector, void *)
called when user select a format radio button
virtual void hide()
hide Frame
const PositionVector & getTemporalShape() const
get Temporal shape
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, bool &updateTemporalShape)
process click over Viewnet
void hideAttributesCreatorModule()
hide group box
long onCmdCreateGEOPOI(FXObject *, FXSelector, void *)
called when user type in search box