mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
@@ -30,6 +30,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.h
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.h
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCE_GROUP_SOURCE_FILES
|
set(SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -64,6 +65,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.cpp
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.cpp
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.cpp
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "RicAppendPointsToPolygonFilterFeature.h"
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT( RicAppendPointsToPolygonFilterFeature, "RicAppendPointsToPolygonFilterFeature" );
|
||||||
|
|
||||||
|
#include "RimPolygonFilter.h"
|
||||||
|
#include "RimPolylineTarget.h"
|
||||||
|
|
||||||
|
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QClipboard>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicAppendPointsToPolygonFilterFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
caf::PdmObject* selectedObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||||
|
if ( !selectedObject ) return false;
|
||||||
|
|
||||||
|
RimPolygonFilter* polygonFilter = nullptr;
|
||||||
|
selectedObject->firstAncestorOrThisOfType( polygonFilter );
|
||||||
|
|
||||||
|
return ( polygonFilter != nullptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicAppendPointsToPolygonFilterFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
caf::PdmObject* selectedObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||||
|
if ( !selectedObject ) return;
|
||||||
|
|
||||||
|
RimPolygonFilter* polygonFilter = nullptr;
|
||||||
|
selectedObject->firstAncestorOrThisOfType( polygonFilter );
|
||||||
|
if ( !polygonFilter ) return;
|
||||||
|
|
||||||
|
QStringList listOfThreeDoubles;
|
||||||
|
|
||||||
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
|
if ( clipboard )
|
||||||
|
{
|
||||||
|
QString content = clipboard->text();
|
||||||
|
listOfThreeDoubles = content.split( "\n", QString::SkipEmptyParts );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<cvf::Vec3d> points;
|
||||||
|
caf::PdmValueFieldSpecialization<std::vector<cvf::Vec3d>>::setFromVariant( listOfThreeDoubles, points );
|
||||||
|
|
||||||
|
for ( const auto& p : points )
|
||||||
|
{
|
||||||
|
auto newTarget = new RimPolylineTarget;
|
||||||
|
newTarget->setAsPointTargetXYD( p );
|
||||||
|
polygonFilter->insertTarget( nullptr, newTarget );
|
||||||
|
}
|
||||||
|
|
||||||
|
polygonFilter->updateEditorsAndVisualization();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicAppendPointsToPolygonFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
actionToSetup->setText( "Append Points from Clipboard" );
|
||||||
|
|
||||||
|
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "cafCmdFeature.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicAppendPointsToPolygonFilterFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isCommandEnabled() override;
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
||||||
@@ -364,6 +364,7 @@ void RimPolygonFilter::defineCustomContextMenu( const caf::PdmFieldHandle* field
|
|||||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||||
|
|
||||||
menuBuilder << "RicDeletePolylineTargetFeature";
|
menuBuilder << "RicDeletePolylineTargetFeature";
|
||||||
|
menuBuilder << "RicAppendPointsToPolygonFilterFeature";
|
||||||
|
|
||||||
menuBuilder.appendToMenu( menu );
|
menuBuilder.appendToMenu( menu );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -881,6 +881,7 @@ void RimExtrudedCurveIntersection::appendPointToPolyLine( const cvf::Vec3d& poin
|
|||||||
m_userPolylineXyz.v().push_back( pointXyz );
|
m_userPolylineXyz.v().push_back( pointXyz );
|
||||||
|
|
||||||
m_userPolylineXyz.uiCapability()->updateConnectedEditors();
|
m_userPolylineXyz.uiCapability()->updateConnectedEditors();
|
||||||
|
m_userPolylineXydForUi.uiCapability()->updateConnectedEditors();
|
||||||
|
|
||||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user