Use polygon as data source for intersection

- Use polygon as data source for intersection
- Add padlock icon
- Show padlock icon on read only polygons
- Add Fwk function appendMenuItems() to make it possible to define context menu content in a PdmObject
- Context menu "Create Polygon Intersection"
- Updates to make visualization consistent with object and object collection enabled state
This commit is contained in:
Magne Sjaastad authored and GitHub committed 2024-02-25 09:21:48 +01:00
1 parent 09151ec6af
commit 28d281e1d6
45 files changed
+632 -125

No files matched your search

@@ -13,6 +13,7 @@ class PdmObjectHandle;
class PdmUiOrdering;
class PdmFieldHandle;
class PdmUiEditorAttribute;
class CmdFeatureMenuBuilder;
class PdmUiObjectHandle : public PdmUiItem, public PdmObjectCapability
{
@@ -44,6 +45,9 @@ public:
void updateUiIconFromToggleField();
/// Append actions to menu builder
virtual void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const {}
// Virtual interface to override in subclasses to support special behaviour if needed
public: // Virtual
virtual caf::PdmFieldHandle* userDescriptionField() { return nullptr; }
@@ -182,6 +182,7 @@ set(PROJECT_FILES
cafPdmUiTreeViewItemDelegate.h
cafPdmUiTreeViewItemDelegate.cpp
cafPdmUiTreeAttributes.h
cafPdmUiTreeAttributes.cpp
cafUiAppearanceSettings.cpp
cafUiIconFactory.cpp
cafPdmUiSliderTools.h
@@ -0,0 +1,61 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "cafPdmUiTreeAttributes.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::unique_ptr<caf::PdmUiTreeViewItemAttribute::Tag> caf::PdmUiTreeViewItemAttribute::createTag()
{
return std::make_unique<Tag>();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute,
const QString& iconResourceString )
{
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
{
treeItemAttribute->tags.clear();
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
tag->icon = caf::IconProvider( iconResourceString );
treeItemAttribute->tags.push_back( std::move( tag ) );
}
}
@@ -1,5 +1,3 @@
//##################################################################################################
//
// Custom Visualization Core library
@@ -73,12 +71,13 @@ public:
caf::Signal<size_t> clicked;
static std::unique_ptr<Tag> create() { return std::make_unique<Tag>(); }
private:
Tag& operator=( const Tag& rhs ) { return *this; }
};
static std::unique_ptr<Tag> createTag();
static void createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute, const QString& iconString );
std::vector<std::unique_ptr<Tag>> tags;
};
@@ -615,7 +615,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo
{
size_t indexInParentField = reorderability->indexOf( pdmObject );
{
auto tag = PdmUiTreeViewItemAttribute::Tag::create();
auto tag = PdmUiTreeViewItemAttribute::createTag();
tag->icon = caf::IconProvider( ":/caf/Up16x16.png" );
tag->selectedOnly = true;
if ( reorderability->canItemBeMovedUp( indexInParentField ) )
@@ -630,7 +630,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo
m_delegate->addTag( filterIndex, std::move( tag ) );
}
{
auto tag = PdmUiTreeViewItemAttribute::Tag::create();
auto tag = PdmUiTreeViewItemAttribute::createTag();
tag->icon = IconProvider( ":/caf/Down16x16.png" );
tag->selectedOnly = true;
if ( reorderability->canItemBeMovedDown( indexInParentField ) )