mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Exported coordinate fix (#11283)
Make sure exported well path coordinates use local coord system when needed.
This commit is contained in:
parent
f411b5fabe
commit
cb1e062e99
@ -834,6 +834,10 @@ bool RifFaultReactivationModelExporter::exportModelSettings( const RimFaultReact
|
||||
auto [topPosition, bottomPosition] = model->faultTopBottom();
|
||||
auto faultNormal = model->modelNormal();
|
||||
|
||||
// make sure we export in local coordinates, if that is used
|
||||
topPosition = model->transformPointIfNeeded( topPosition );
|
||||
bottomPosition = model->transformPointIfNeeded( bottomPosition );
|
||||
|
||||
// make sure we move horizontally, and along the 2D model
|
||||
faultNormal.z() = 0.0;
|
||||
faultNormal.normalize();
|
||||
|
@ -65,7 +65,7 @@ bool JsonWriter::encodeFile( QString filePath, QMap<QString, QVariant> map )
|
||||
{
|
||||
QFile file;
|
||||
file.setFileName( filePath );
|
||||
if ( file.open( QIODevice::ReadWrite | QIODevice::Text ) )
|
||||
if ( file.open( QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate ) )
|
||||
{
|
||||
QString content = Json::encode( map, true );
|
||||
QTextStream out( &file );
|
||||
|
@ -139,6 +139,15 @@ std::pair<cvf::Vec3d, cvf::Vec3d> RigFaultReactivationModel::modelLocalNormalsXY
|
||||
return m_generator->modelLocalNormalsXY();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigFaultReactivationModel::transformPointIfNeeded( const cvf::Vec3d point ) const
|
||||
{
|
||||
if ( m_generator.get() == nullptr ) return point;
|
||||
return m_generator->transformPointIfNeeded( point );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
void setGenerator( std::shared_ptr<RigFaultReactivationModelGenerator> generator );
|
||||
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> modelLocalNormalsXY() const;
|
||||
cvf::Vec3d transformPointIfNeeded( const cvf::Vec3d point ) const;
|
||||
|
||||
void updateGeometry( size_t startCell, cvf::StructGridInterface::FaceType startFace );
|
||||
|
||||
|
@ -167,6 +167,16 @@ void RigFaultReactivationModelGenerator::setupLocalCoordinateTransform()
|
||||
m_localCoordTransform.setTranslation( center );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigFaultReactivationModelGenerator::transformPointIfNeeded( const cvf::Vec3d point ) const
|
||||
{
|
||||
if ( !m_useLocalCoordinates ) return point;
|
||||
|
||||
return point.getTransformedPoint( m_localCoordTransform );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// change corner order to be consistent so that index (0,1) and (2,3) gives the lower and upper horz. lines no matter what I or J face we
|
||||
/// have
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
void setUseLocalCoordinates( bool useLocalCoordinates );
|
||||
void setupLocalCoordinateTransform();
|
||||
|
||||
cvf::Vec3d transformPointIfNeeded( const cvf::Vec3d point ) const;
|
||||
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> modelLocalNormalsXY();
|
||||
|
||||
void generateGeometry( size_t startCellIndex, FaceType startFace, RigGriddedPart3d* frontPart, RigGriddedPart3d* backPart );
|
||||
|
Loading…
Reference in New Issue
Block a user