mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #11952 from OPM/polygon_updates
Polygon command updates
This commit is contained in:
@@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimPolygonFile, "RimPolygonFileFile" );
|
||||
RimPolygonFile::RimPolygonFile()
|
||||
: objectChanged( this )
|
||||
{
|
||||
CAF_PDM_InitObject( "PolygonFile", ":/PolylinesFromFile16x16.png" );
|
||||
CAF_PDM_InitObject( "PolygonFile", ":/Folder.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fileName, "StimPlanFileName", "File Name" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_polygons, "Polygons", "Polygons" );
|
||||
|
||||
@@ -103,9 +103,9 @@ bool RimPolygonTools::exportPolygonCsv( const RimPolygon* polygon, const QString
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolygonTools::exportPolygonPol( const RimPolygon* polygon, const QString& filePath )
|
||||
bool RimPolygonTools::exportPolygonPol( const std::vector<RimPolygon*> polygons, const QString& filePath )
|
||||
{
|
||||
if ( !polygon ) return false;
|
||||
if ( polygons.empty() ) return false;
|
||||
|
||||
QFile file( filePath );
|
||||
if ( !file.open( QIODevice::WriteOnly | QIODevice::Text ) ) return false;
|
||||
@@ -122,20 +122,23 @@ bool RimPolygonTools::exportPolygonPol( const RimPolygon* polygon, const QString
|
||||
header.emplace_back( " ", RifTextDataTableDoubleFormatting( RIF_FLOAT, precision ) );
|
||||
formatter.header( header );
|
||||
|
||||
for ( const auto& point : polygon->pointsInDomainCoords() )
|
||||
for ( auto polygon : polygons )
|
||||
{
|
||||
formatter.add( point.x() );
|
||||
formatter.add( point.y() );
|
||||
formatter.add( -point.z() );
|
||||
for ( const auto& point : polygon->pointsInDomainCoords() )
|
||||
{
|
||||
formatter.add( point.x() );
|
||||
formatter.add( point.y() );
|
||||
formatter.add( -point.z() );
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
const double endOfPolygon = 999.0;
|
||||
formatter.add( endOfPolygon );
|
||||
formatter.add( endOfPolygon );
|
||||
formatter.add( endOfPolygon );
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
const double endOfPolygon = 999.0;
|
||||
formatter.add( endOfPolygon );
|
||||
formatter.add( endOfPolygon );
|
||||
formatter.add( endOfPolygon );
|
||||
formatter.rowCompleted();
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
file.close();
|
||||
|
||||
@@ -23,6 +23,8 @@ class RimPolygonInView;
|
||||
|
||||
class QString;
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
@@ -34,7 +36,7 @@ public:
|
||||
static void activate3dEditOfPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
|
||||
static void selectPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
|
||||
static bool exportPolygonCsv( const RimPolygon* polygon, const QString& filePath );
|
||||
static bool exportPolygonPol( const RimPolygon* polygon, const QString& filePath );
|
||||
static bool exportPolygonPol( const std::vector<RimPolygon*> polygons, const QString& filePath );
|
||||
|
||||
static QString polygonCacheName();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user