 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
60 myPolygonFrameParent(polygonFrameParent) {
65 myLatLonRadioButton->setCheck(TRUE);
73 myLabelCartesianPosition =
new FXLabel(
this,
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude", 0,
GUIDesignLabelFrameInformation);
84 myCoordinatesTextField->enable();
85 myCoordinatesTextField->setText(
"");
86 myCoordinatesTextField->enable();
87 myCreateGEOPOIButton->enable();
89 myCoordinatesTextField->setText(
"No geo-conversion defined");
90 myCoordinatesTextField->disable();
91 myCreateGEOPOIButton->disable();
106 std::string input = myCoordinatesTextField->getText().text();
107 std::string inputWithoutSpaces;
108 for (
const auto& i : input) {
110 inputWithoutSpaces.push_back(i);
114 if (input.size() != inputWithoutSpaces.size()) {
115 myCoordinatesTextField->setText(inputWithoutSpaces.c_str());
117 if (inputWithoutSpaces.size() > 0) {
118 myCreateGEOPOIButton->setText(
"Create GEO POI");
120 myCreateGEOPOIButton->setText(
"Create GEO POI (clipboard)");
123 if (GNEAttributeCarrier::canParse<Position>(myCoordinatesTextField->getText().text())) {
124 myCoordinatesTextField->setTextColor(FXRGB(0, 0, 0));
125 myCoordinatesTextField->killFocus();
127 Position geoPos = GNEAttributeCarrier::parse<Position>(myCoordinatesTextField->getText().text());
128 if (myLatLonRadioButton->getCheck() == TRUE) {
134 myLabelCartesianPosition->setText((
"Cartesian equivalence:\n- X = " +
toString(geoPos.
x()) +
"\n- Y = " +
toString(geoPos.
y())).c_str());
136 myCoordinatesTextField->setTextColor(FXRGB(255, 0, 0));
137 myLabelCartesianPosition->setText(
"Cartesian equivalence:\n- X = give valid longitude\n- Y = give valid latitude");
146 if (obj == myLonLatRadioButton) {
147 myLonLatRadioButton->setCheck(TRUE);
148 myLatLonRadioButton->setCheck(FALSE);
149 }
else if (obj == myLatLonRadioButton) {
150 myLonLatRadioButton->setCheck(FALSE);
151 myLatLonRadioButton->setCheck(TRUE);
154 onCmdSetCoordinates(0, 0, 0);
162 if (myPolygonFrameParent->myShapeAttributes->areValuesValid()) {
163 std::string geoPosStr = myCoordinatesTextField->getText().text();
164 if (geoPosStr.empty()) {
168 myCoordinatesTextField->setText(geoPosStr.c_str());
170 onCmdSetCoordinates(0, 0, 0);
171 geoPosStr = myCoordinatesTextField->getText().text();
172 myCoordinatesTextField->setText(
"");
173 myCreateGEOPOIButton->setText(
"Create GEO POI (clipboard)");
175 if (GNEAttributeCarrier::canParse<Position>(geoPosStr)) {
177 auto valuesMap = myPolygonFrameParent->myShapeAttributes->getAttributesAndValues(
true);
179 myPolygonFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(valuesMap,
nullptr);
182 valuesMap[
SUMO_ATTR_ID] = myPolygonFrameParent->myViewNet->getNet()->generateShapeID(myPolygonFrameParent->myShapeTagSelector->getCurrentTagProperties().getTag());
186 Position geoPos = GNEAttributeCarrier::parse<Position>(geoPosStr);
188 if (myLatLonRadioButton->getCheck() == TRUE) {
194 if (myPolygonFrameParent->addPOI(valuesMap)) {
196 if (myCenterViewAfterCreationCheckButton->getCheck() == TRUE) {
199 centerPosition.
add(geoPos);
200 centerPosition = centerPosition.
grow(10);
201 myPolygonFrameParent->myViewNet->getViewParent()->getView()->centerTo(centerPosition);
208 myPolygonFrameParent->myShapeAttributes->refreshRows();
219 GNEFrame(horizontalFrameParent, viewNet,
"Shapes") {
257 std::map<SumoXMLAttr, std::string> valuesMap;
339 std::string vectorOfIds;
340 for (
int i = 0; i < list->getNumItems(); i++) {
341 if (list->isItemSelected(i)) {
342 if (vectorOfIds.size() > 0) {
345 vectorOfIds += (list->getItem(i)->getText()).text();
431 double angle = GNEAttributeCarrier::parse<double>(polyValues.at(
SUMO_ATTR_ANGLE));
435 bool fill = GNEAttributeCarrier::parse<bool>(polyValues.at(
SUMO_ATTR_FILL));
438 double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) :
Shape::DEFAULT_LAYER;
441 if ((shape.size() > 0) &&
myViewNet->
getNet()->
addPolygon(
id, type, color, layer, angle, imgFile, relativePath, shape,
false, fill, lineWidth)) {
464 double angle = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_ANGLE));
467 double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_WIDTH));
468 double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_HEIGHT));
469 double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) :
Shape::DEFAULT_LAYER_POI;
470 bool geo = GNEAttributeCarrier::parse<bool>(POIValues.at(
SUMO_ATTR_GEO));
473 if (
myViewNet->
getNet()->
addPOI(
id, type, color, pos, geo,
"", 0, 0, layer, angle, imgFile, relativePath, widthPOI, heightPOI)) {
494 double angle = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_ANGLE));
498 double posLane = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_POSITION));
500 double widthPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_WIDTH));
501 double heightPOI = GNEAttributeCarrier::parse<double>(POIValues.at(
SUMO_ATTR_HEIGHT));
503 double layer = GNEAttributeCarrier::canParse<double>(layerStr) ? GNEAttributeCarrier::parse<double>(layerStr) :
Shape::DEFAULT_LAYER_POI;
506 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 successfully 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
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
const PositionVector & getLaneShape() const
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
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
void refreshRows()
refresh rows (called after creating an element)
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 showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &tagProperties, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
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