Janitor : Remove unused code and reorganize includes

This commit is contained in:
Magne Sjaastad 2019-11-19 08:50:03 +01:00
parent 6f4ae69cc9
commit 710352e4bf
2 changed files with 25 additions and 163 deletions
ApplicationCode/ProjectDataModel

View File

@ -15,8 +15,10 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathGeometryDef.h"
#include "WellPathCommands/PointTangentManipulator/RicWellPathGeometry3dEditor.h"
#include "WellPathCommands/RicCreateWellTargetsPickEventHandler.h"
#include "RiaFieldHandleTools.h"
@ -33,7 +35,6 @@
#include "RiuViewerCommands.h"
#include "WellPathCommands/PointTangentManipulator/RicWellPathGeometry3dEditor.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiPushButtonEditor.h"
@ -388,162 +389,6 @@ std::vector<RimWellPathTarget*> RimWellPathGeometryDef::activeWellTargets() cons
return active;
}
#if 0 // Kept for reference a bit longer
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RimWellPathGeometryDef::lineArcEndpoints() const
{
double prevSegmentEndAzi = 0;
double prevSegmentEndInc = 0;
std::vector<RimWellPathTarget*> activeWellPathTargets = activeWellTargets();
CVF_ASSERT(activeWellPathTargets.size() > 1);
std::vector<cvf::Vec3d> endPoints;
endPoints.push_back( activeWellPathTargets[0]->targetPointXYZ() + referencePointXyz() );
for ( size_t tIdx = 0; tIdx < activeWellPathTargets.size() - 1; ++tIdx)
{
RimWellPathTarget* target1 = activeWellPathTargets[tIdx];
RimWellPathTarget* target2 = activeWellPathTargets[tIdx+1];
// Ignore targets in the same place
if ((target1->targetPointXYZ() - target2->targetPointXYZ()).length() < 1e-6) continue;
target1->flagRadius2AsIncorrect(false, 0);
target2->flagRadius1AsIncorrect(false, 0);
if ( target1->targetType() == RimWellPathTarget::POINT_AND_TANGENT
&& target2->targetType() == RimWellPathTarget::POINT_AND_TANGENT)
{
RiaSCurveCalculator sCurveCalc(target1->targetPointXYZ(),
target1->azimuth(),
target1->inclination(),
target1->radius2(),
target2->targetPointXYZ(),
target2->azimuth(),
target2->inclination(),
target2->radius1());
if ( sCurveCalc.solveStatus() != RiaSCurveCalculator::CONVERGED )
{
double p1p2Length = (target2->targetPointXYZ() - target1->targetPointXYZ()).length();
sCurveCalc = RiaSCurveCalculator::fromTangentsAndLength(target1->targetPointXYZ(),
target1->azimuth(),
target1->inclination(),
0.2*p1p2Length,
target2->targetPointXYZ(),
target2->azimuth(),
target2->inclination(),
0.2*p1p2Length);
RiaLogging::warning("Using fall-back calculation of well path geometry between active target number: " + QString::number(tIdx+1) + " and " + QString::number(tIdx+2));
target1->flagRadius2AsIncorrect(true, sCurveCalc.firstRadius());
target2->flagRadius1AsIncorrect(true, sCurveCalc.secondRadius());
}
endPoints.push_back( sCurveCalc.firstArcEndpoint() + referencePointXyz() );
endPoints.push_back( sCurveCalc.secondArcStartpoint() + referencePointXyz() );
endPoints.push_back( target2->targetPointXYZ() + referencePointXyz() );
}
else if ( target1->targetType() == RimWellPathTarget::POINT
&& target2->targetType() == RimWellPathTarget::POINT_AND_TANGENT)
{
RiaSCurveCalculator sCurveCalc(target1->targetPointXYZ(),
prevSegmentEndAzi,
prevSegmentEndInc,
target1->radius2(),
target2->targetPointXYZ(),
target2->azimuth(),
target2->inclination(),
target2->radius1());
if ( sCurveCalc.solveStatus() != RiaSCurveCalculator::CONVERGED )
{
double p1p2Length = (target2->targetPointXYZ() - target1->targetPointXYZ()).length();
sCurveCalc = RiaSCurveCalculator::fromTangentsAndLength(target1->targetPointXYZ(),
prevSegmentEndAzi,
prevSegmentEndInc,
0.2*p1p2Length,
target2->targetPointXYZ(),
target2->azimuth(),
target2->inclination(),
0.2*p1p2Length);
RiaLogging::warning("Using fall-back calculation of well path geometry between active target number: " + QString::number(tIdx+1) + " and " + QString::number(tIdx+2));
target1->flagRadius2AsIncorrect(true, sCurveCalc.firstRadius());
target2->flagRadius1AsIncorrect(true, sCurveCalc.secondRadius());
}
endPoints.push_back( sCurveCalc.firstArcEndpoint() + referencePointXyz() );
endPoints.push_back( sCurveCalc.secondArcStartpoint() + referencePointXyz() );
endPoints.push_back( target2->targetPointXYZ() + referencePointXyz() );
}
else if ( target1->targetType() == RimWellPathTarget::POINT_AND_TANGENT
&& target2->targetType() == RimWellPathTarget::POINT)
{
RiaJCurveCalculator jCurve(target1->targetPointXYZ(),
target1->azimuth(),
target1->inclination(),
target1->radius2(),
target2->targetPointXYZ());
if ( jCurve.curveStatus() == RiaJCurveCalculator::OK )
{
endPoints.push_back(jCurve.firstArcEndpoint() + referencePointXyz());
}
else if ( jCurve.curveStatus() == RiaJCurveCalculator::FAILED_RADIUS_TOO_LARGE )
{
target1->flagRadius2AsIncorrect(true, jCurve.radius());
}
endPoints.push_back( target2->targetPointXYZ() + referencePointXyz() );
prevSegmentEndAzi = jCurve.endAzimuth();
prevSegmentEndInc = jCurve.endInclination();
target2->setDerivedTangent(prevSegmentEndAzi, prevSegmentEndInc);
}
else if ( target1->targetType() == RimWellPathTarget::POINT
&& target2->targetType() == RimWellPathTarget::POINT)
{
RiaJCurveCalculator jCurve(target1->targetPointXYZ(),
prevSegmentEndAzi,
prevSegmentEndInc,
target1->radius2(),
target2->targetPointXYZ());
if ( jCurve.curveStatus() == RiaJCurveCalculator::OK )
{
endPoints.push_back(jCurve.firstArcEndpoint() + referencePointXyz());
}
else if ( jCurve.curveStatus() == RiaJCurveCalculator::FAILED_RADIUS_TOO_LARGE )
{
target1->flagRadius2AsIncorrect(true, jCurve.radius());
}
endPoints.push_back( target2->targetPointXYZ() + referencePointXyz() );
prevSegmentEndAzi = jCurve.endAzimuth();
prevSegmentEndInc = jCurve.endInclination();
target2->setDerivedTangent(prevSegmentEndAzi, prevSegmentEndInc);
}
else
{
CVF_ASSERT(false);
}
}
return endPoints;
}
#endif
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -1,13 +1,31 @@
#include "RimWellPathTarget.h"
#include "RimModeledWellPath.h"
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 - Equinor
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathGeometryDef.h"
#include "RimWellPathTarget.h"
#include "RiaOffshoreSphericalCoords.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiLineEditor.h"
#include <cmath>
CAF_PDM_SOURCE_INIT( RimWellPathTarget, "WellPathTarget" );
@ -281,8 +299,7 @@ void RimWellPathTarget::defineEditorAttribute( const caf::PdmFieldHandle* field,
{
if ( field == &m_targetPoint )
{
auto uiDisplayStringAttr =
dynamic_cast<caf::PdmUiLineEditorAttributeUiDisplayString*>( attribute );
auto uiDisplayStringAttr = dynamic_cast<caf::PdmUiLineEditorAttributeUiDisplayString*>( attribute );
if ( uiDisplayStringAttr )
{