40 const std::vector<GNEJunction*>& junctionParents,
41 const std::vector<GNEEdge*>& edgeParents,
42 const std::vector<GNELane*>& laneParents,
43 const std::vector<GNEAdditional*>& additionalParents,
44 const std::vector<GNEDemandElement*>& demandElementParents,
45 const std::vector<GNEGenericData*>& genericDataParents) :
47 GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, demandElementParents, genericDataParents),
48 myShapeEdited(false) {
68GNENetworkElement::GNENetworkElement::isNetworkElementValid()
const {
75GNENetworkElement::GNENetworkElement::getNetworkElementProblem()
const {
180 geometryPointRadius = s.neteditSizeSettings.junctionGeometryPointRadius;
182 geometryPointRadius = s.neteditSizeSettings.edgeGeometryPointRadius;
184 geometryPointRadius = s.neteditSizeSettings.laneGeometryPointRadius;
186 geometryPointRadius = s.neteditSizeSettings.connectionGeometryPointRadius;
188 geometryPointRadius = s.neteditSizeSettings.crossingGeometryPointRadius;
190 const auto geometryPointRadiusSquared = (geometryPointRadius * geometryPointRadius);
193 for (
int i = 0; i < (int)shape.size(); i++) {
194 if (shape[i].distanceSquaredTo2D(mousePos) < geometryPointRadiusSquared) {
205 const Boundary b = shape.getBoxBoundary();
212 if (shape.isClosed()) {
213 simplifiedShape.push_back(simplifiedShape[0]);
224 straigthenShape.push_back(shape.back());
232 shape.closePolygon();
249 for (
int i = index; i < (int)shape.size(); i++) {
250 newShape.push_back(shape[i]);
252 for (
int i = 0; i < index; i++) {
253 newShape.push_back(shape[i]);
263 for (
int i = 0; i < (int)shape.size(); i++) {
265 newShape.push_back(shape[i]);
312 const std::string headerName =
TLF(
"% (Edited shape)",
getFullName());
318 new FXMenuSeparator(ret);
323 if (shape.size() <= 2) {
324 simplifyShape->disable();
334 if (shape.size() <= 2) {
335 straightenShape->disable();
344 if ((shape.
isClosed() && (shape.size() <= 4)) || (!shape.
isClosed() && (shape.size() <= 2))) {
349 setFirstPoint->disable();
353 new FXMenuSeparator(ret);
363 for (
const auto& shapePosition : shape) {
@ MID_COPY_TEST_COORDINATES
Copy test coordinates.
@ MID_GNE_SHAPEEDITED_DELETE_GEOMETRY_POINT
delete geometry point in shape edited
@ MID_GNE_SHAPEEDITED_STRAIGHTEN
straighten shape edited geometry
@ MID_GNE_SHAPEEDITED_OPEN
open closed shape edited
@ MID_GNE_SHAPEEDITED_SIMPLIFY
simplify shape edited geometry
@ MID_GNE_SHAPEEDITED_FINISH
finish editing shape edited
@ MID_GNE_SHAPEEDITED_CLOSE
close opened shape edited
@ MID_GNE_SHAPEEDITED_SET_FIRST_POINT
Set a vertex of shape edited as first vertex.
GUIViewObjectsHandler gViewObjectsHandler
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
bool isInitialised() const
check if Boundary is Initialised
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
virtual void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)=0
remove geometry point in the clicked position
void requireSaveAdditionals()
inform that additionals has to be saved
void requireSaveDataElements()
inform that data elements has to be saved
void requireSaveDemandElements()
inform that demand elements has to be saved
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
GNEViewNet * getViewNet() const
get view net
bool checkDrawingBoundarySelection() const
void closeShapeEdited(GNEUndoList *undoList)
close shape edited
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void setFirstGeometryPointShapeEdited(const int index, GNEUndoList *undoList)
set first geometry point shape edited
void openShapeEdited(GNEUndoList *undoList)
open shape edited
virtual std::string getAttribute(SumoXMLAttr key) const =0
void selectGLObject()
select element
void setShapeEdited(const bool value)
set shape edited
int getGeometryPointUnderCursorShapeEdited() const
get index geometry point under cursor of shape edited
void markAsFrontElement()
mark element as front element
bool myShapeEdited
flag to check if element shape is being edited
virtual PositionVector getAttributePositionVector(SumoXMLAttr key) const =0
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void simplifyShapeEdited(GNEUndoList *undoList)
simplify shape edited
void straigthenShapeEdited(GNEUndoList *undoList)
straigthen shape edited
GUIGLObjectPopupMenu * getShapeEditedPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, const PositionVector &shape)
get shape edited popup menu
void deleteGeometryPointShapeEdited(const int index, GNEUndoList *undoList)
delete geometry point shape edited
void resetShapeEdited(GNEUndoList *undoList)
reset shape edited
virtual const std::string getOptionalName() const
Returns the name of the object (default "")
GNENetworkElement(GNENet *net, const std::string &id, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, const std::vector< GNEJunction * > &junctionParents, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents)
Constructor.
void setNetworkElementID(const std::string &newID)
set network element id
bool isShapeEdited() const
check if shape is being edited
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
int getVertexIndex(const PositionVector &shape, const Position &pos)
return index of a vertex of shape, or of a new vertex if position is over an shape's edge
virtual ~GNENetworkElement()
Destructor.
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
bool isGLObjectLocked() const
check if element is locked
SelectionInformation * getSelectionInformation() const
get modul for selection information
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isObjectLocked(GUIGlObjectType objectType, const bool selected) const
check if given GLObject is locked for inspect, select, delete and move
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
void setFrontAttributeCarrier(GNEAttributeCarrier *AC)
set front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
GNEViewNetHelper::LockManager & getLockManager()
get lock manager
GNESelectorFrame * getSelectorFrame() const
get frame for select elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
FXIcon * getGLIcon() const
get icon associated with this GL Object
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
const std::string & getFullName() const
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
FXFont * getBoldFont()
get bold front
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
const Boundary & getSelectionBoundary() const
get selection boundary
bool isObjectSelected(const GUIGlObject *GLObject) const
check if element was already selected
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
int indexOfClosest(const Position &p, bool twoD=false) const
void push_front(const Position &p)
insert in front a Position
bool isClosed() const
check if PositionVector is closed
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static const double polygonGeometryPointRadius
moving geometry point radius