Exported coordinate fix (#11283)

Make sure exported well path coordinates use local coord system when needed.
This commit is contained in:
jonjenssen 2024-03-12 16:57:16 +01:00 committed by GitHub
parent f411b5fabe
commit cb1e062e99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 27 additions and 1 deletions

View File

@ -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();

View File

@ -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 );

View 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 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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 );

View File

@ -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

View File

@ -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 );