mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2163 Make intersection event handler
This commit is contained in:
@@ -77,55 +77,6 @@ void RicNewPolylineIntersectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
actionToSetup->setText("New Polyline Intersection");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPolylineIntersectionFeature::handleEvent(cvf::Object* eventObject)
|
||||
{
|
||||
std::vector<RimIntersection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
if (selection.size() == 1)
|
||||
{
|
||||
RicViewerEventObject* polylineUiEvent = dynamic_cast<RicViewerEventObject*>(eventObject);
|
||||
if (polylineUiEvent)
|
||||
{
|
||||
RimIntersection* intersection = selection[0];
|
||||
|
||||
RimView* rimView = nullptr;
|
||||
intersection->firstAncestorOrThisOfType(rimView);
|
||||
CVF_ASSERT(rimView);
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
|
||||
cvf::Vec3d domainCoord = transForm->transformToDomainCoord(polylineUiEvent->globalIntersectionPoint);
|
||||
|
||||
if (intersection->inputPolyLineFromViewerEnabled())
|
||||
{
|
||||
intersection->appendPointToPolyLine(domainCoord);
|
||||
|
||||
// Further Ui processing is stopped when true is returned
|
||||
return true;
|
||||
}
|
||||
else if (intersection->inputExtrusionPointsFromViewerEnabled())
|
||||
{
|
||||
intersection->appendPointToExtrusionDirection(domainCoord);
|
||||
|
||||
// Further Ui processing is stopped when true is returned
|
||||
return true;
|
||||
}
|
||||
else if (intersection->inputTwoAzimuthPointsFromViewerEnabled())
|
||||
{
|
||||
intersection->appendPointToAzimuthLine(domainCoord);
|
||||
|
||||
// Further Ui processing is stopped when true is returned
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -40,9 +40,9 @@ public:
|
||||
explicit RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
|
||||
virtual ~RicNewPolylineIntersectionFeatureCmd();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
virtual QString name() override;
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewPolylineIntersectionFeature : public caf::CmdFeature, public RicViewerEventInterface
|
||||
class RicNewPolylineIntersectionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
@@ -61,12 +61,9 @@ public:
|
||||
RicNewPolylineIntersectionFeature();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
virtual bool handleEvent(cvf::Object* eventObject);
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user