#949 Intersection : Convert coordinates using DisplayCoordTransform

This commit is contained in:
Magne Sjaastad
2016-11-02 14:44:35 +01:00
parent 6c43d29bdd
commit 9e0cf779b6
5 changed files with 42 additions and 26 deletions

View File

@@ -28,8 +28,10 @@
#include "RiuMainWindow.h"
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@@ -90,20 +92,24 @@ bool RicNewPolylineIntersectionFeature::handleEvent(cvf::Object* eventObject)
{
RimIntersection* intersection = selection[0];
RimCase* rimCase = NULL;
intersection->firstAncestorOrThisOfType(rimCase);
CVF_ASSERT(rimCase);
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(rimCase->displayModelOffset() + polylineUiEvent->localIntersectionPoint);
intersection->appendPointToPolyLine(domainCoord);
// Further Ui processing is stopped when true is returned
return true;
}
else if (intersection->inputExtrusionPointsFromViewerEnabled())
{
intersection->appendPointToExtrusionDirection(rimCase->displayModelOffset() + polylineUiEvent->localIntersectionPoint);
intersection->appendPointToExtrusionDirection(domainCoord);
// Further Ui processing is stopped when true is returned
return true;