mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
1 parent
9c26664522
commit
dd2fdad5dd
12 files changed
+357
-13
No files matched your search
@@ -30,11 +30,14 @@
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiColorEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeAttributes.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPolygon, "RimPolygon" );
|
||||
CAF_PDM_SOURCE_INIT( RimPolygon, "Polygon", "RimPolygon" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -43,10 +46,10 @@ RimPolygon::RimPolygon()
|
||||
: objectChanged( this )
|
||||
, coordinatesChanged( this )
|
||||
{
|
||||
CAF_PDM_InitObject( "Polygon", ":/PolylinesFromFile16x16.png" );
|
||||
CAF_PDM_InitScriptableObject( "Polygon", ":/PolylinesFromFile16x16.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_isReadOnly, "IsReadOnly", false, "Read Only" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_pointsInDomainCoords, "PointsInDomainCoords", "Points" );
|
||||
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_pointsInDomainCoords, "PointsInDomainCoords", "Coordinates", "Points" );
|
||||
|
||||
CAF_PDM_InitField( &m_editPolygonButton, "EditPolygonButton", false, "Edit" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_editPolygonButton );
|
||||
|
||||
@@ -25,18 +25,21 @@
|
||||
#include "RimPolygonFile.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPolygonCollection, "RimPolygonCollection" );
|
||||
CAF_PDM_SOURCE_INIT( RimPolygonCollection, "PolygonCollection", "RimPolygonCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolygonCollection::RimPolygonCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Polygons", ":/PolylinesFromFile16x16.png" );
|
||||
CAF_PDM_InitScriptableObject( "Polygons", ":/PolylinesFromFile16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_polygons, "Polygons", "Polygons" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_polygons, "Polygons", "Polygons" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_polygonFiles, "PolygonFiles", "Polygon Files" );
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcIdenticalGridCaseGroup.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcPressureTable.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFishbonesCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcPolygonCollection.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -60,6 +61,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcIdenticalGridCaseGroup.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcPressureTable.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFishbonesCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcPolygonCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025- Equinor ASA
|
||||
//
|
||||
// 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 "RimcPolygonCollection.h"
|
||||
|
||||
#include "Polygons/RimPolygon.h"
|
||||
#include "Polygons/RimPolygonCollection.h"
|
||||
|
||||
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimPolygonCollection, RimcPolygonCollection_createPolygon, "CreatePolygon" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcPolygonCollection_createPolygon::RimcPolygonCollection_createPolygon( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Create and Add New Polygon", "", "", "Create and Add New Polygon" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_name, "Name", "Name" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_coordinates, "Coordinates", "Coordinates" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcPolygonCollection_createPolygon::execute()
|
||||
{
|
||||
auto polygonCollection = self<RimPolygonCollection>();
|
||||
|
||||
QString name = m_name();
|
||||
std::vector<cvf::Vec3d> coords = m_coordinates();
|
||||
|
||||
RimPolygon* polygon = polygonCollection->appendUserDefinedPolygon();
|
||||
if ( !name.isEmpty() )
|
||||
{
|
||||
polygon->setName( name );
|
||||
}
|
||||
|
||||
polygon->setPointsInDomainCoords( coords );
|
||||
|
||||
polygonCollection->updateConnectedEditors();
|
||||
|
||||
return polygon;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcPolygonCollection_createPolygon::resultIsPersistent() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcPolygonCollection_createPolygon::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimPolygon );
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025- Equinor ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcPolygonCollection_createPolygon : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcPolygonCollection_createPolygon( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<std::vector<cvf::Vec3d>> m_coordinates;
|
||||
};
|
||||
Reference in new issue
Block a user