void SectionItem::init() { road_ = roadSection_->getParentRoad(); // Observer Pattern // // road_->attachObserver(this); // SectionHandle (Start) // // if (getTopviewGraph()) // not for profilegraph { sectionHandle_ = new SectionHandle(this); sectionHandle_->setPos(road_->getGlobalPoint(roadSection_->getSStart())); sectionHandle_->setRotation(road_->getGlobalHeading(roadSection_->getSStart())); } // ContextMenu // // hideSectionAction_ = getHideMenu()->addAction(tr("Section")); connect(hideSectionAction_, SIGNAL(triggered()), this, SLOT(hideGraphElement())); hideParentRoadAction_ = getHideMenu()->addAction(tr("Road")); connect(hideParentRoadAction_, SIGNAL(triggered()), this, SLOT(hideParentRoad())); removeSectionAction_ = getRemoveMenu()->addAction(tr("Section")); connect(removeSectionAction_, SIGNAL(triggered()), this, SLOT(removeSection())); removeParentRoadAction_ = getRemoveMenu()->addAction(tr("Road")); connect(removeParentRoadAction_, SIGNAL(triggered()), this, SLOT(removeParentRoad())); }
void AccessMap::removeAllSections() { set<int> keys; for (TIntToStringSet::iterator it = m_sectionToNamesMap.begin(); it != m_sectionToNamesMap.end(); ++it) keys.insert(it->first); for (set<int>::iterator it = keys.begin(); it != keys.end(); ++it) removeSection(*it); }
bool SectionItem::deleteRequest() { if (removeSection()) { return true; } return false; }
bool JunctionElementItem::deleteRequest() { if (removeSection()) { return true; } return false; }
void JunctionElementItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { ODD::ToolId tool = getJunctionEditor()->getCurrentTool(); if (tool == ODD::TTE_ROAD_DELETE) { removeParentRoad(); return; } else if (tool == ODD::TTE_DELETE) { removeSection(); return; } else if (tool == ODD::TJE_SPLIT) { RSystemElementRoad *road = trackElement_->getParentRoad(); double s = road->getSFromGlobalPoint(event->scenePos(), trackElement_->getSStart(), trackElement_->getSEnd()); getProjectData()->getUndoStack()->beginMacro(QObject::tr("Split Track and Road")); // Split Track // // SplitTrackComponentCommand *splitTrackCommand = new SplitTrackComponentCommand(trackElement_, s, NULL); getProjectGraph()->executeCommand(splitTrackCommand); // Split Road // // SplitRoadCommand *splitRoadCommand = new SplitRoadCommand(road, s, NULL); getProjectGraph()->executeCommand(splitRoadCommand); getProjectData()->getUndoStack()->endMacro(); return; } // else if(tool == ODD::TTE_MOVE) // { // return; // does nothing // } } // parent: selection // JunctionComponentItem::mouseReleaseEvent(event); // pass to baseclass }
void JunctionElementItem::init() { // Selection/Highlighting // // setAcceptHoverEvents(true); if (getParentJunctionComponentItem()) { setFlag(QGraphicsItem::ItemIsMovable, false); // move the whole group } else { setFlag(QGraphicsItem::ItemIsMovable, true); } // Color & Path // // updateColor(); createPath(); // ContextMenu // // QAction *hideAction = getHideMenu()->addAction(tr("Track")); connect(hideAction, SIGNAL(triggered()), this, SLOT(hideGraphElement())); if (getParentJunctionComponentItem()) { QAction *hideParentTrackComponentAction = getHideMenu()->addAction(tr("Group")); connect(hideParentTrackComponentAction, SIGNAL(triggered()), this, SLOT(hideParentTrackComponent())); QAction *ungroupAction = getContextMenu()->addAction("Ungroup"); connect(ungroupAction, SIGNAL(triggered()), getParentJunctionComponentItem(), SLOT(ungroupComposite())); } QAction *hideRoadAction = getHideMenu()->addAction(tr("Road")); connect(hideRoadAction, SIGNAL(triggered()), this, SLOT(hideParentRoad())); QAction *removeSectionAction = getRemoveMenu()->addAction(tr("Track(s)")); connect(removeSectionAction, SIGNAL(triggered()), this, SLOT(removeSection())); QAction *removeRoadAction = getRemoveMenu()->addAction(tr("Road")); connect(removeRoadAction, SIGNAL(triggered()), this, SLOT(removeParentRoad())); }