 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
61 myPolygonFrameParent(polygonFrameParent) {
66 myLatLonRadioButton->setCheck(TRUE);
74 myLabelCartesianPosition =
new FXLabel(
this,
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude", 0,
GUIDesignLabelFrameInformation);
85 myCoordinatesTextField->enable();
86 myCoordinatesTextField->setText(
"");
87 myCoordinatesTextField->enable();
88 myCreateGEOPOIButton->enable();
90 myCoordinatesTextField->setText(
"No geo-conversion defined");
91 myCoordinatesTextField->disable();
92 myCreateGEOPOIButton->disable();
107 std::string input = myCoordinatesTextField->getText().text();
108 std::string inputWithoutSpaces;
109 for (
const auto& i : input) {
111 inputWithoutSpaces.push_back(i);
115 if (input.size() != inputWithoutSpaces.size()) {
116 myCoordinatesTextField->setText(inputWithoutSpaces.c_str());
118 if (inputWithoutSpaces.size() > 0) {
119 myCreateGEOPOIButton->setText(
"Create GEO POI");
121 myCreateGEOPOIButton->setText(
"Create GEO POI (clipboard)");
124 if (GNEAttributeCarrier::canParse<Position>(myCoordinatesTextField->getText().text())) {
125 myCoordinatesTextField->setTextColor(FXRGB(0, 0, 0));
126 myCoordinatesTextField->killFocus();
128 Position geoPos = GNEAttributeCarrier::parse<Position>(myCoordinatesTextField->getText().text());
129 if (myLatLonRadioButton->getCheck() == TRUE) {
135 myLabelCartesianPosition->setText((
"Cartesian equivalence:\n- X = " +
toString(geoPos.
x()) +
"\n- Y = " +
toString(geoPos.
y())).c_str());
137 myCoordinatesTextField->setTextColor(FXRGB(255, 0, 0));
138 myLabelCartesianPosition->setText(
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude");
147 if (obj == myLonLatRadioButton) {
148 myLonLatRadioButton->setCheck(TRUE);
149 myLatLonRadioButton->setCheck(FALSE);
150 }
else if (obj == myLatLonRadioButton) {
151 myLonLatRadioButton->setCheck(FALSE);
152 myLatLonRadioButton->setCheck(TRUE);
155 onCmdSetCoordinates(0, 0, 0);
163 if (myPolygonFrameParent->myShapeAttributes->areValuesValid()) {
164 std::string geoPosStr = myCoordinatesTextField->getText().text();
165 if (geoPosStr.empty()) {
169 myCoordinatesTextField->setText(geoPosStr.c_str());
171 onCmdSetCoordinates(0, 0, 0);
172 geoPosStr = myCoordinatesTextField->getText().text();
173 myCoordinatesTextField->setText(
"");
174 myCreateGEOPOIButton->setText(
"Create GEO POI (clipboard)");
176 if (GNEAttributeCarrier::canParse<Position>(geoPosStr)) {
178 auto valuesOfElement = myPolygonFrameParent->myShapeAttributes->getAttributesAndValues(
true);
180 myPolygonFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(valuesOfElement,
nullptr);
182 valuesOfElement[
SUMO_ATTR_ID] = myPolygonFrameParent->myViewNet->getNet()->generateShapeID(myPolygonFrameParent->myShapeTagSelector->getCurrentTagProperties().getTag());
185 Position geoPos = GNEAttributeCarrier::parse<Position>(geoPosStr);
187 if (myLatLonRadioButton->getCheck() == TRUE) {
193 if (myPolygonFrameParent->addPOI(valuesOfElement)) {
195 if (myCenterViewAfterCreationCheckButton->getCheck() == TRUE) {
198 centerPosition.
add(geoPos);
199 centerPosition = centerPosition.
grow(10);
200 myPolygonFrameParent->myViewNet->getViewParent()->getView()->centerTo(centerPosition);
216 GNEFrame(horizontalFrameParent, viewNet,
"Shapes") {
254 std::map<SumoXMLAttr, std::string> valuesOfElement;
273 if (
addPOI(valuesOfElement)) {
328 std::string vectorOfIds;
329 for (
int i = 0; i < list->getNumItems(); i++) {
330 if (list->isItemSelected(i)) {
331 if (vectorOfIds.size() > 0) {
334 vectorOfIds += (list->getItem(i)->getText()).text();
418 double angle = GNEAttributeCarrier::parse<double>(polyValues.at(
SUMO_ATTR_ANGLE));
422 bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(
SUMO_ATTR_FILL));
425 double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) :
Shape::DEFAULT_LAYER;
428 if ((shape.size() > 0) &&
myViewNet->
getNet()->
addPolygon(
id, type, color, layer, angle, imgFile, relativePath, shape,
false, fill, lineWidth)) {
451 double angle = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_ANGLE));
454 double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_WIDTH));
455 double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_HEIGHT));
456 double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) :
Shape::DEFAULT_LAYER_POI;
457 bool geo = GNEAttributeCarrier::parse<bool>(POIValues.at(
SUMO_ATTR_GEO));
460 if (
myViewNet->
getNet()->
addPOI(
id, type, color, pos, geo,
"", 0, 0, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
481 double angle = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_ANGLE));
485 double posLane = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_POSITION));
487 double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_WIDTH));
488 double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_HEIGHT));
490 double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) :
Shape::DEFAULT_LAYER_POI;
493 if (
myViewNet->
getNet()->
addPOI(
id, type, color,
Position(),
false, lane->getID(), posLane, posLat, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
void hideGEOPOICreatorModul()
hide GEOPOICreator Modul
bool addPOI(const std::map< SumoXMLAttr, std::string > &POIValues)
add POI
#define GUIDesignTextFieldNCol
Num of column of text field.
void showDrawingShape()
show Drawing mode
const std::string getID() const
function to support debugging
#define WRITE_WARNING(msg)
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
begin/end of the description of a polygon
GNEFrameModuls::DrawingShape * myDrawingShape
Drawing shape.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void addNewPoint(const Position &P)
add new point to temporal shape
bool addPolygon(const std::map< SumoXMLAttr, std::string > &POIValues)
add Polygon
GNEPolygonFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
static const double DEFAULT_LAYER
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
bool areValuesValid() const
check if parameters of attributes are valid
void setStatusBarText(const std::string &text)
set staturBar text
begin/end of the description of a Point of interest
void hideDrawingShape()
hide Drawing mode
#define GUIDesignTextField
bool shapeDrawed()
build a shaped element using the drawed shape return true if was sucesfully created
void removeLastPoint()
remove last added point
bool getDeleteLastCreatedPoint()
get flag delete last created point
GNEFrameAttributesModuls::AttributesCreator * myShapeAttributes
shape internal attributes
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
PositionVector shape
The shape of the netElement element.
void showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &myTagProperties)
show AttributesCreator modul
void hideAttributesCreatorModul()
hide group box
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
std::string generateShapeID(SumoXMLTag shapeTag) const
generate Shape ID
FXDEFMAP(GNEPolygonFrame::GEOPOICreator) GEOPOICreatorMap[]
GNEPoly * retrievePolygon(const std::string &id, bool failHard=true) const
get Polygon by id
std::map< SumoXMLAttr, std::string > getAttributesAndValues(bool includeAll) const
get attributes and their values
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
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
GEOPOICreator * myGEOPOICreator
GEOPOICreator.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
GNEFrameModuls::TagSelector * myShapeTagSelector
shape tag selector
begin/end of the description of a Point of interest over Lane (used by Netedit)
long onCmdSetCoordinates(FXObject *, FXSelector, void *)
class used to group all variables related with objects under cursor after a click over view
AddShapeResult
enum with all possible values after try to create an shape using frame
void closePolygon()
ensures that the last position equals the first
static RGBColor parseColor(std::string coldef)
Parses a color information.
A class that stores a 2D geometrical boundary.
Close shape of a polygon (Used by GNEPolys)
#define GUIDesignCheckButton
checkButton placed in left position
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.
block shape of a graphic element (Used mainly in GNEShapes)
GNEViewNet * myViewNet
View Net.
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
~GNEPolygonFrame()
Destructor.
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties &tagValue)
show Netedit attributes modul
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
const NetElementGeometry & getGeometry() const
bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath, const PositionVector &shape, bool geo, bool fill, double lineWidth, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
bool getNeteditAttributesAndValues(std::map< SumoXMLAttr, std::string > &valuesMap, const GNELane *lane) const
fill valuesMap with netedit attributes
void p_abort()
reverts and discards ALL active command groups
bool addPOILane(const std::map< SumoXMLAttr, std::string > &POIValues)
add POILane
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void setCurrentTag(SumoXMLTag newTag)
set current type manually
double y() const
Returns the y-position.
~GEOPOICreator()
destructor
AddShapeResult processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show
#define GUIDesignRadioButton
block movement of a graphic element
GNEFrameModuls::DrawingShape * getDrawingShapeModul() const
get drawing mode editor
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, bool relativePath, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
bool isDrawing() const
return true if currently a shape is drawed
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
void swapXY()
swap position X and Y
Boundary & grow(double by)
extends the boundary by the given amount
C++ TraCI client API implementation.
static std::string copyFromClipboard(const FXApp &app)
Copies text from the clipboard.
void hideNeteditAttributesModul()
hide Netedit attributes modul
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...
void tagSelected()
Tag selected in TagSelector.
virtual void show()
show Frame
edge: the shape in xml-definition
long onCmdSetFormat(FXObject *, FXSelector, void *)
called when user select a format radio button
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
static const double DEFAULT_LAYER_POI
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
virtual void hide()
hide Frame
void showGEOPOICreatorModul()
Show list of GEOPOICreator Modul.
const PositionVector & getTemporalShape() const
get Temporal shape
long onCmdCreateGEOPOI(FXObject *, FXSelector, void *)
called when user type in search box