78 FXIMPLEMENT(
GNEDeleteFrame, FXVerticalFrame, GNEDeleteFrameMap, ARRAYNUMBER(GNEDeleteFrameMap))
84 GNEFrame(horizontalFrameParent, viewNet, "Delete"),
88 myCurrentElementLabel =
new FXLabel(myGroupBoxCurrentElement,
"No item under cursor", 0,
GUIDesignLabelLeft);
95 myAutomaticallyDeleteAdditionalsCheckButton->setCheck(
true);
99 myMarkedElementLabel =
new FXLabel(myGroupBoxTreeList,
"No item marked", 0,
GUIDesignLabelLeft);
104 myInformationLabel =
new FXLabel(myGroupBoxInformation,
" - Left click to delete element.\n - Hold <CTRL> and left click\n to mark element.\n - Left click in another element\n dismark marked element.", 0,
GUIDesignLabelLeft);
119 switch (dynamic_cast<GUIGlObject*>(
myMarkedAC)->getType()) {
125 junctionItem->setExpanded(
true);
127 for (
int i = 0; i < (int)junction->
getGNEEdges().size(); i++) {
131 edgeItem->setExpanded(
true);
133 for (
int j = 0; j < (int)edge->
getLanes().size(); j++) {
137 laneItem->setExpanded(
true);
143 additionalItem->setExpanded(
true);
149 incomingConnections->setExpanded(
false);
154 connectionItem->setExpanded(
true);
161 outgoingConnections->setExpanded(
false);
166 connectionItem->setExpanded(
true);
175 additionalItem->setExpanded(
true);
184 crossingItem->setExpanded(
true);
193 edgeItem->setExpanded(
true);
195 for (
int i = 0; i < (int)edge->
getLanes().size(); i++) {
199 laneItem->setExpanded(
true);
205 additionalItem->setExpanded(
true);
211 incomingConnections->setExpanded(
false);
216 connectionItem->setExpanded(
true);
223 outgoingConnections->setExpanded(
false);
228 connectionItem->setExpanded(
true);
237 additionalItem->setExpanded(
true);
243 rerouters->setExpanded(
true);
249 rerouterItem->setExpanded(
true);
259 laneItem->setExpanded(
true);
265 additionalItem->setExpanded(
true);
271 incomingConnections->setExpanded(
false);
276 connectionItem->setExpanded(
true);
283 outgoingConnections->setExpanded(
false);
288 connectionItem->setExpanded(
true);
298 POIItem->setExpanded(
true);
306 polygonItem->setExpanded(
true);
314 crossingItem->setExpanded(
true);
322 additionalItem->setExpanded(
true);
330 connectionItem->setExpanded(
true);
344 if (shown() ==
false) {
350 switch (dynamic_cast<GUIGlObject*>(ac)->getType()) {
354 int numberOfAdditionals = 0;
356 numberOfAdditionals += (int)i->getAdditionalChilds().size();
357 for (
auto j : i->getLanes()) {
359 numberOfAdditionals += (int)i->getAdditionalChilds().size();
366 if (numberOfAdditionals > 0) {
369 WRITE_WARNING(
"Opening FXMessageBox 'Force deletion needed'");
371 std::string plural = numberOfAdditionals > 1 ?
"s" :
"";
373 FXMessageBox::warning(
getViewNet()->getApp(), MBOX_OK, (
"Problem deleting " +
toString(junction->
getTag())).c_str(),
"%s",
374 (
toString(junction->
getTag()) +
" '" + junction->
getID() +
"' cannot be deleted because owns " +
375 toString(numberOfAdditionals) +
" additional child" + plural +
".\n Check 'Force deletion of additionals' to force deletion.").c_str());
378 WRITE_WARNING(
"Closed FXMessageBox 'Force deletion needed' with 'OK'");
392 numberOfAdditionals += (int)i->getAdditionalChilds().size();
398 if (numberOfAdditionals > 0) {
401 WRITE_WARNING(
"Opening FXMessageBox 'Force deletion needed'");
403 std::string plural = numberOfAdditionals > 1 ?
"s" :
"";
405 FXMessageBox::warning(
getViewNet()->getApp(), MBOX_OK, (
"Problem deleting " +
toString(edge->
getTag())).c_str(),
"%s",
407 toString(numberOfAdditionals) +
" additional child" + plural +
".\n Check 'Force deletion of additionals' to force deletion.").c_str());
410 WRITE_WARNING(
"Closed FXMessageBox 'Force deletion needed' with 'OK'");
412 }
else if (numberOfRerouters > 0) {
415 WRITE_WARNING(
"Opening FXMessageBox 'Force deletion needed'");
417 std::string plural = numberOfRerouters > 1 ?
"s" :
"";
419 FXMessageBox::warning(
getViewNet()->getApp(), MBOX_OK, (
"Problem deleting " +
toString(edge->
getTag())).c_str(),
"%s",
420 (
toString(edge->
getTag()) +
" '" + edge->
getID() +
"' cannot be deleted because is part of " +
424 WRITE_WARNING(
"Closed FXMessageBox 'Force deletion needed' with 'OK'");
443 WRITE_WARNING(
"Opening FXMessageBox 'Force deletion needed'");
446 FXMessageBox::warning(
getViewNet()->getApp(), MBOX_OK, (
"Problem deleting " +
toString(lane->
getTag())).c_str(),
"%s",
448 toString(lane->
getAdditionalChilds().size()) +
" additional childs.\n Check 'Force deletion of Additionals' to force deletion.").c_str());
451 WRITE_WARNING(
"Closed FXMessageBox 'Force deletion needed' with 'OK'");
524 FXEvent* e = (FXEvent*) eventData;
525 FXTreeItem* item =
myTreelist->getItemAt(e->win_x, e->win_y);
538 }
else if (dynamic_cast<GNEAdditional*>(
myClickedAC)) {
572 FXMenuPane* pane =
new FXMenuPane(
myTreelist);
577 new FXMenuSeparator(pane);
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
long onCmdCenterChildItem(FXObject *, FXSelector, void *)
called when user select option "center item" of child Menu
std::set< FXTreeItem * > myTreeItemsWithoutAC
set used to save tree items without AC assigned (for example, Incoming/Outcoming connections) ...
void deletePOI(GNEPOI *POI, GNEUndoList *undoList)
remove POI
FXDEFMAP(GNEDeleteFrame) GNEDeleteFrameMap[]
void removeAttributeCarrier(GNEAttributeCarrier *ac)
remove attribute carrier (element)
FXTreeList * myTreelist
tree list to show the childs of the element to erase
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
void updateCurrentLabel(GNEAttributeCarrier *ac)
update current label
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
GNEAdditionalFrame * getAdditionalFrame() const
get frame for GNE_MODE_ADDITIONAL
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void showChildsOfMarkedAttributeCarrier()
show childs of marked attribute carrier
FXLabel * myCurrentElementLabel
label for current element
#define GUIDesignTreeListFrame
Tree list used in frames to represent childs of elements.
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return list of additionals associated with this edge
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
GNEViewParent * getViewParent() const
get the net object
long onCmdShowChildMenu(FXObject *, FXSelector, void *eventData)
#define UNUSED_PARAMETER(x)
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
GNEUndoList * getUndoList() const
get the undoList object
GNEViewNet * myViewNet
the window to inform when the tls is modfied
const std::vector< GNERerouter * > & getGNERerouters() const
get rerouters vinculated with this edge
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
int getNumberOfGNERerouters() const
get number of rerouters that has this edge as parameters
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
~GNEDeleteFrame()
Destructor.
In GNEDeleteFrame, delete element.
void deleteLane(GNELane *lane, GNEUndoList *undoList)
removes lane
void deleteGeometryOrEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList)
removes geometry when pos is close to a geometry node, deletes the whole edge otherwise ...
FXCheckButton * myAutomaticallyDeleteAdditionalsCheckButton
checkbox for enable/disble automatically delete additionals childs
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
void markAttributeCarrier(GNEAttributeCarrier *ac)
mark attribute carrier (element)
GNEAttributeCarrier * myClickedAC
current attribute carrier selected in three
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_MODE_INSPECT
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
In GNEDeleteFrame, inspect element.
const std::string getID() const
function to support debugging
GNEAttributeCarrier * myMarkedAC
pointer to marked attributeCarrier (element)
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
GNEViewNet * getViewNet() const
get view net
A road/street connecting two junctions (netedit-version)
long onCmdDeleteChildItem(FXObject *, FXSelector, void *)
called when user select option "delte item" of child menu
void deletePolygon(GNEPoly *polygon, GNEUndoList *undoList)
remove Polygon
long onCmdInspectChildItem(FXObject *, FXSelector, void *)
called when user select option "inspect item" of child menu
FXIcon * getIcon() const
get FXIcon assigned to this object
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
virtual void show()
show Frame
An Element which don't belongs to GNENet but has influency in the simulation.
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
GUIMainWindow * getApp() const
get App (GUIMainWindow)
GNEAttributeCarrier * getMarkedAttributeCarrier() const
returns marked atrribute carrier
GNENet * getNet() const
get the net object
virtual void hide()
hide Frame
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
void show()
show inspector frame
SumoXMLTag getTag() const
get XML Tag assigned to this object
tree list with the childs
#define GUIDesignLabelLeft
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
In GNEDeleteFrame, center element.
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the Tree items with their AC
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXLabel * myMarkedElementLabel
label for marked element
automatically delete additional childs
void createPopUpMenu(int X, int Y, GNEAttributeCarrier *ac)