mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,15 +21,15 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@@ -37,47 +37,46 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateReachCircleAnnotationFeature, "RicCreateReachCircleAnnotationFeature");
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateReachCircleAnnotationFeature, "RicCreateReachCircleAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateReachCircleAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
return selObjs.size() == 1 || (selGroupColl.size() == 1
|
||||
&& selGroupColl.front()->uiCapability()->uiName() == RimAnnotationGroupCollection::REACH_CIRCLE_ANNOTATION_UI_NAME);
|
||||
return selObjs.size() == 1 ||
|
||||
( selGroupColl.size() == 1 && selGroupColl.front()->uiCapability()->uiName() ==
|
||||
RimAnnotationGroupCollection::REACH_CIRCLE_ANNOTATION_UI_NAME );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateReachCircleAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
void RicCreateReachCircleAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimReachCircleAnnotation();
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(coll->lineBasedAnnotationsCount());
|
||||
newAnnotation->appearance()->setColor(newColor);
|
||||
newAnnotation->enablePicking(true);
|
||||
coll->addAnnotation(newAnnotation);
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f( coll->lineBasedAnnotationsCount() );
|
||||
newAnnotation->appearance()->setColor( newColor );
|
||||
newAnnotation->enablePicking( true );
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateReachCircleAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicCreateReachCircleAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/ReachCircle16x16.png"));
|
||||
actionToSetup->setText("Create Reach Circle Annotation");
|
||||
actionToSetup->setIcon( QIcon( ":/ReachCircle16x16.png" ) );
|
||||
actionToSetup->setText( "Create Reach Circle Annotation" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -24,10 +24,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimAnnotationCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -38,8 +36,8 @@ class RicCreateReachCircleAnnotationFeature : public caf::CmdFeature
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
RimAnnotationCollection* annotationCollection() const;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateTextAnnotationFeature, "RicCreateTextAnnotationFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicCreateTextAnnotationFeature, "RicCreateTextAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -45,37 +44,37 @@ bool RicCreateTextAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjsGlobal = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selObjs2InView = caf::selectedObjectsByTypeStrict<RimAnnotationInViewCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
return selObjsGlobal.size() == 1 || selObjs2InView.size() == 1 ||
|
||||
(selGroupColl.size() == 1 &&
|
||||
selGroupColl.front()->uiCapability()->uiName() == RimAnnotationGroupCollection::TEXT_ANNOTATION_UI_NAME);
|
||||
( selGroupColl.size() == 1 &&
|
||||
selGroupColl.front()->uiCapability()->uiName() == RimAnnotationGroupCollection::TEXT_ANNOTATION_UI_NAME );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
void RicCreateTextAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
{
|
||||
auto coll = annotationCollectionBase();
|
||||
if (coll)
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
newAnnotation->enablePicking(true);
|
||||
coll->addAnnotation(newAnnotation);
|
||||
newAnnotation->enablePicking( true );
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicCreateTextAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/TextAnnotation16x16.png"));
|
||||
actionToSetup->setText("Create Text Annotation");
|
||||
actionToSetup->setIcon( QIcon( ":/TextAnnotation16x16.png" ) );
|
||||
actionToSetup->setText( "Create Text Annotation" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -84,13 +83,13 @@ void RicCreateTextAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
RimAnnotationCollectionBase* RicCreateTextAnnotationFeature::annotationCollectionBase() const
|
||||
{
|
||||
auto selColls = caf::selectedObjectsByTypeStrict<RimAnnotationCollectionBase*>();
|
||||
if (selColls.size() == 1) return selColls.front();
|
||||
if ( selColls.size() == 1 ) return selColls.front();
|
||||
|
||||
RimAnnotationCollectionBase* coll = nullptr;
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
if (selGroupColl.size() == 1)
|
||||
RimAnnotationCollectionBase* coll = nullptr;
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
if ( selGroupColl.size() == 1 )
|
||||
{
|
||||
selGroupColl.front()->firstAncestorOrThisOfType(coll);
|
||||
selGroupColl.front()->firstAncestorOrThisOfType( coll );
|
||||
}
|
||||
|
||||
return coll;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -24,12 +24,10 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimAnnotationCollection;
|
||||
class RimAnnotationCollectionBase;
|
||||
class RimAnnotationInViewCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -40,8 +38,8 @@ class RicCreateTextAnnotationFeature : public caf::CmdFeature
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
RimAnnotationCollectionBase* annotationCollectionBase() const;
|
||||
RimAnnotationCollectionBase* annotationCollectionBase() const;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateTextAnnotationIn3dViewFeature, "RicCreateTextAnnotationIn3dViewFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicCreateTextAnnotationIn3dViewFeature, "RicCreateTextAnnotationIn3dViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -50,28 +49,28 @@ bool RicCreateTextAnnotationIn3dViewFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered(bool isChecked)
|
||||
void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimEclipseContourMapView * contMapView = dynamic_cast<RimEclipseContourMapView*>(activeView);
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimEclipseContourMapView* contMapView = dynamic_cast<RimEclipseContourMapView*>( activeView );
|
||||
|
||||
if ( activeView )
|
||||
{
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::BoundingBox bbox = activeView->ownerCase()->activeCellsBoundingBox();
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::BoundingBox bbox = activeView->ownerCase()->activeCellsBoundingBox();
|
||||
|
||||
if (contMapView) domainCoord[2] = bbox.max().z() - bbox.extent().z() * 0.2;
|
||||
if ( contMapView ) domainCoord[2] = bbox.max().z() - bbox.extent().z() * 0.2;
|
||||
|
||||
auto coll = activeView->annotationCollection();
|
||||
|
||||
auto coll = activeView->annotationCollection();
|
||||
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
newAnnotation->setAnchorPoint(domainCoord);
|
||||
newAnnotation->setAnchorPoint( domainCoord );
|
||||
cvf::Vec3d labelPos = domainCoord;
|
||||
|
||||
if (activeView->viewer()->mainCamera()->direction().z() <= 0)
|
||||
|
||||
if ( activeView->viewer()->mainCamera()->direction().z() <= 0 )
|
||||
{
|
||||
labelPos.z() = bbox.max().z();
|
||||
}
|
||||
@@ -81,18 +80,20 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
|
||||
cvf::Vec3d horizontalRight = activeView->viewer()->mainCamera()->direction() ^ cvf::Vec3d::Z_AXIS;
|
||||
cvf::Vec3d horizontalUp = activeView->viewer()->mainCamera()->up() - (cvf::Vec3d::Z_AXIS * (activeView->viewer()->mainCamera()->up() * cvf::Vec3d::Z_AXIS) );
|
||||
cvf::Vec3d horizontalUp = activeView->viewer()->mainCamera()->up() -
|
||||
( cvf::Vec3d::Z_AXIS *
|
||||
( activeView->viewer()->mainCamera()->up() * cvf::Vec3d::Z_AXIS ) );
|
||||
bool isOk = horizontalRight.normalize();
|
||||
if (!isOk) horizontalRight = {1.0, 0.0, 0.0};
|
||||
if ( !isOk ) horizontalRight = {1.0, 0.0, 0.0};
|
||||
|
||||
double height = fabs(labelPos.z() - domainCoord.z());
|
||||
newAnnotation->setLabelPoint(labelPos + 2.0*height * (horizontalRight + horizontalUp));
|
||||
double height = fabs( labelPos.z() - domainCoord.z() );
|
||||
newAnnotation->setLabelPoint( labelPos + 2.0 * height * ( horizontalRight + horizontalUp ) );
|
||||
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->scheduleRedrawOfRelevantViews();
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,9 +101,8 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationIn3dViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicCreateTextAnnotationIn3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/TextAnnotation16x16.png"));
|
||||
actionToSetup->setText("Create Text Annotation");
|
||||
actionToSetup->setIcon( QIcon( ":/TextAnnotation16x16.png" ) );
|
||||
actionToSetup->setText( "Create Text Annotation" );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -30,7 +30,6 @@ class RicCreateTextAnnotationIn3dViewFeature : public caf::CmdFeature
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,15 +21,15 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature");
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -49,44 +47,45 @@ bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
return selObjs.size() == 1 || (selGroupColl.size() == 1 && selGroupColl.front()->uiCapability()->uiName() ==
|
||||
RimAnnotationGroupCollection::USED_DEFINED_POLYLINE_ANNOTATION_UI_NAME);
|
||||
return selObjs.size() == 1 ||
|
||||
( selGroupColl.size() == 1 && selGroupColl.front()->uiCapability()->uiName() ==
|
||||
RimAnnotationGroupCollection::USED_DEFINED_POLYLINE_ANNOTATION_UI_NAME );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(coll->lineBasedAnnotationsCount());
|
||||
newAnnotation->appearance()->setColor(newColor);
|
||||
newAnnotation->appearance()->setSphereColor(newColor);
|
||||
newAnnotation->enablePicking(true);
|
||||
coll->addAnnotation(newAnnotation);
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f( coll->lineBasedAnnotationsCount() );
|
||||
newAnnotation->appearance()->setColor( newColor );
|
||||
newAnnotation->appearance()->setSphereColor( newColor );
|
||||
newAnnotation->enablePicking( true );
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("Create User Defined Polyline Annotation");
|
||||
actionToSetup->setIcon( QIcon( ":/Plus.png" ) );
|
||||
actionToSetup->setText( "Create User Defined Polyline Annotation" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
|
||||
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -24,10 +24,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimAnnotationCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -38,8 +36,8 @@ class RicCreateUserDefinedPolylinesAnnotationFeature : public caf::CmdFeature
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
RimAnnotationCollection* annotationCollection() const;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@@ -34,15 +34,14 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicDeleteAnnotationFeature, "RicDeleteAnnotationFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteAnnotationFeature, "RicDeleteAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto textAnnots = caf::selectedObjectsByTypeStrict<RimTextAnnotation*>();
|
||||
auto textAnnots = caf::selectedObjectsByTypeStrict<RimTextAnnotation*>();
|
||||
auto lineBasedAnnots = caf::selectedObjectsByTypeStrict<RimLineBasedAnnotation*>();
|
||||
|
||||
return !textAnnots.empty() || !lineBasedAnnots.empty();
|
||||
@@ -51,35 +50,35 @@ bool RicDeleteAnnotationFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
void RicDeleteAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
{
|
||||
auto annotations = caf::selectedObjectsByTypeStrict<RimTextAnnotation*>();
|
||||
while(!annotations.empty())
|
||||
while ( !annotations.empty() )
|
||||
{
|
||||
auto annotation = annotations.front();
|
||||
|
||||
RimAnnotationCollection* coll;
|
||||
annotation->firstAncestorOrThisOfType(coll);
|
||||
if (coll)
|
||||
annotation->firstAncestorOrThisOfType( coll );
|
||||
if ( coll )
|
||||
{
|
||||
coll->addAnnotation()
|
||||
}
|
||||
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto coll = annotationInViewCollection();
|
||||
if (coll)
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,8 +86,8 @@ void RicDeleteAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicDeleteAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/minus-sign-red.png"));
|
||||
actionToSetup->setText("Delete Annotation");
|
||||
actionToSetup->setIcon( QIcon( ":/minus-sign-red.png" ) );
|
||||
actionToSetup->setText( "Delete Annotation" );
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
@@ -33,11 +33,10 @@
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportPolylinesAnnotationFeature, "RicImportPolylinesAnnotationFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicImportPolylinesAnnotationFeature, "RicImportPolylinesAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportPolylinesAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
@@ -45,57 +44,57 @@ bool RicImportPolylinesAnnotationFeature::isCommandEnabled()
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
return selObjs.size() == 1 ||
|
||||
(selGroupColl.size() == 1 && selGroupColl.front()->uiCapability()->uiName() ==
|
||||
RimAnnotationGroupCollection::POLYLINE_FROM_FILE_ANNOTATION_UI_NAME);
|
||||
( selGroupColl.size() == 1 && selGroupColl.front()->uiCapability()->uiName() ==
|
||||
RimAnnotationGroupCollection::POLYLINE_FROM_FILE_ANNOTATION_UI_NAME );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
void RicImportPolylinesAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Poly Lines Annotation",
|
||||
defaultDir,
|
||||
"Text File (*.txt);Polylines (*.dat);All Files (*.*)");
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "BINARY_GRID" );
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Poly Lines Annotation",
|
||||
defaultDir,
|
||||
"Text File (*.txt);Polylines (*.dat);All Files (*.*)" );
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
if ( fileNames.isEmpty() ) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory("BINARY_GRID", QFileInfo(fileNames.last()).absolutePath());
|
||||
app->setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( fileNames.last() ).absolutePath() );
|
||||
|
||||
// Find or create the AnnotationsCollection
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimAnnotationCollection* annotColl = proj->activeOilField()->annotationCollection();
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimAnnotationCollection* annotColl = proj->activeOilField()->annotationCollection();
|
||||
|
||||
if (!annotColl)
|
||||
if ( !annotColl )
|
||||
{
|
||||
annotColl = new RimAnnotationCollection;
|
||||
annotColl = new RimAnnotationCollection;
|
||||
proj->activeOilField()->annotationCollection = annotColl;
|
||||
}
|
||||
|
||||
// For each file,
|
||||
|
||||
RimPolylinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile(fileNames);
|
||||
|
||||
// For each file,
|
||||
|
||||
RimPolylinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile( fileNames );
|
||||
|
||||
proj->updateConnectedEditors();
|
||||
|
||||
if (lastCreatedOrUpdated)
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(lastCreatedOrUpdated);
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
|
||||
annotColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicImportPolylinesAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/PolylinesFromFile16x16.png"));
|
||||
actionToSetup->setText("Import Poly Lines Annotation");
|
||||
actionToSetup->setIcon( QIcon( ":/PolylinesFromFile16x16.png" ) );
|
||||
actionToSetup->setText( "Import Poly Lines Annotation" );
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportPolylinesAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
@@ -33,5 +33,3 @@ protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
#include "../WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
@@ -30,159 +30,152 @@
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfPart.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicTextAnnotation3dEditor);
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT( RicTextAnnotation3dEditor );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicTextAnnotation3dEditor::RicTextAnnotation3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
RicTextAnnotation3dEditor::RicTextAnnotation3dEditor() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicTextAnnotation3dEditor::~RicTextAnnotation3dEditor()
|
||||
{
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>( ownerViewer() );
|
||||
|
||||
if (m_cvfModel.notNull() && ownerRiuViewer)
|
||||
if ( m_cvfModel.notNull() && ownerRiuViewer )
|
||||
{
|
||||
|
||||
// Could result in some circularities ....
|
||||
ownerRiuViewer->removeStaticModel(m_cvfModel.p());
|
||||
ownerRiuViewer->removeStaticModel( m_cvfModel.p() );
|
||||
}
|
||||
|
||||
auto textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
if (textAnnot)
|
||||
auto textAnnot = dynamic_cast<RimTextAnnotation*>( this->pdmObject() );
|
||||
if ( textAnnot )
|
||||
{
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
textAnnot->m_labelPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->removeFieldEditor( this );
|
||||
textAnnot->m_labelPointXyd.uiCapability()->removeFieldEditor( this );
|
||||
}
|
||||
|
||||
delete m_labelManipulator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
void RicTextAnnotation3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>( this->pdmObject() );
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>( ownerViewer() );
|
||||
|
||||
if ( !textAnnot || !textAnnot->isActive())
|
||||
if ( !textAnnot || !textAnnot->isActive() )
|
||||
{
|
||||
m_cvfModel->removeAllParts();
|
||||
return;
|
||||
}
|
||||
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->addFieldEditor(this);
|
||||
textAnnot->m_labelPointXyd.uiCapability()->addFieldEditor(this);
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->addFieldEditor( this );
|
||||
textAnnot->m_labelPointXyd.uiCapability()->addFieldEditor( this );
|
||||
|
||||
|
||||
if (m_labelManipulator.isNull())
|
||||
if ( m_labelManipulator.isNull() )
|
||||
{
|
||||
m_labelManipulator = new RicPointTangentManipulator(ownerRiuViewer);
|
||||
m_anchorManipulator = new RicPointTangentManipulator(ownerRiuViewer);
|
||||
QObject::connect(m_labelManipulator,
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotLabelUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
QObject::connect(m_anchorManipulator,
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotAnchorUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
m_labelManipulator = new RicPointTangentManipulator( ownerRiuViewer );
|
||||
m_anchorManipulator = new RicPointTangentManipulator( ownerRiuViewer );
|
||||
QObject::connect( m_labelManipulator,
|
||||
SIGNAL( notifyUpdate( const cvf::Vec3d&, const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotLabelUpdated( const cvf::Vec3d&, const cvf::Vec3d& ) ) );
|
||||
QObject::connect( m_anchorManipulator,
|
||||
SIGNAL( notifyUpdate( const cvf::Vec3d&, const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotAnchorUpdated( const cvf::Vec3d&, const cvf::Vec3d& ) ) );
|
||||
|
||||
m_cvfModel = new cvf::ModelBasicList;
|
||||
ownerRiuViewer->addStaticModelOnce(m_cvfModel.p());
|
||||
ownerRiuViewer->addStaticModelOnce( m_cvfModel.p() );
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
double handleSize = 1.0;
|
||||
double handleSize = 1.0;
|
||||
{
|
||||
dispXf = ownerRiuViewer->ownerReservoirView()->displayCoordTransform();
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>(ownerRiuViewer->ownerReservoirView());
|
||||
handleSize = 0.7 * view->ownerCase()->characteristicCellSize();
|
||||
dispXf = ownerRiuViewer->ownerReservoirView()->displayCoordTransform();
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>( ownerRiuViewer->ownerReservoirView() );
|
||||
handleSize = 0.7 * view->ownerCase()->characteristicCellSize();
|
||||
}
|
||||
cvf::Vec3d labelPos(textAnnot->m_labelPointXyd());
|
||||
cvf::Vec3d labelPos( textAnnot->m_labelPointXyd() );
|
||||
labelPos.z() *= -1.0;
|
||||
m_labelManipulator->setOrigin(dispXf->transformToDisplayCoord( labelPos ));
|
||||
m_labelManipulator->setHandleSize(handleSize);
|
||||
m_labelManipulator->setOrigin( dispXf->transformToDisplayCoord( labelPos ) );
|
||||
m_labelManipulator->setHandleSize( handleSize );
|
||||
|
||||
cvf::Vec3d anchorPos(textAnnot->m_anchorPointXyd());
|
||||
cvf::Vec3d anchorPos( textAnnot->m_anchorPointXyd() );
|
||||
anchorPos.z() *= -1.0;
|
||||
m_anchorManipulator->setOrigin(dispXf->transformToDisplayCoord( anchorPos ));
|
||||
m_anchorManipulator->setHandleSize(handleSize);
|
||||
|
||||
m_anchorManipulator->setOrigin( dispXf->transformToDisplayCoord( anchorPos ) );
|
||||
m_anchorManipulator->setHandleSize( handleSize );
|
||||
|
||||
m_cvfModel->removeAllParts();
|
||||
m_labelManipulator->appendPartsToModel(m_cvfModel.p());
|
||||
m_anchorManipulator->appendPartsToModel(m_cvfModel.p());
|
||||
m_labelManipulator->appendPartsToModel( m_cvfModel.p() );
|
||||
m_anchorManipulator->appendPartsToModel( m_cvfModel.p() );
|
||||
|
||||
m_cvfModel->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::cleanupBeforeSettingPdmObject()
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
if (textAnnot)
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>( this->pdmObject() );
|
||||
if ( textAnnot )
|
||||
{
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
textAnnot->m_labelPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->removeFieldEditor( this );
|
||||
textAnnot->m_labelPointXyd.uiCapability()->removeFieldEditor( this );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::slotLabelUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent)
|
||||
void RicTextAnnotation3dEditor::slotLabelUpdated( const cvf::Vec3d& origin, const cvf::Vec3d& tangent )
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>( this->pdmObject() );
|
||||
|
||||
if ( !textAnnot)
|
||||
if ( !textAnnot )
|
||||
{
|
||||
return;
|
||||
}
|
||||
updatePoint(textAnnot->m_labelPointXyd.uiCapability(), origin);
|
||||
updatePoint( textAnnot->m_labelPointXyd.uiCapability(), origin );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::slotAnchorUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& dummy)
|
||||
void RicTextAnnotation3dEditor::slotAnchorUpdated( const cvf::Vec3d& origin, const cvf::Vec3d& dummy )
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>( this->pdmObject() );
|
||||
|
||||
if ( !textAnnot)
|
||||
if ( !textAnnot )
|
||||
{
|
||||
return;
|
||||
}
|
||||
updatePoint(textAnnot->m_anchorPointXyd.uiCapability(), origin);
|
||||
updatePoint( textAnnot->m_anchorPointXyd.uiCapability(), origin );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::updatePoint(caf::PdmUiFieldHandle* uiField, const cvf::Vec3d& newPos)
|
||||
void RicTextAnnotation3dEditor::updatePoint( caf::PdmUiFieldHandle* uiField, const cvf::Vec3d& newPos )
|
||||
{
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
{
|
||||
RiuViewer* viewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
dispXf = viewer->ownerReservoirView()->displayCoordTransform();
|
||||
RiuViewer* viewer = dynamic_cast<RiuViewer*>( ownerViewer() );
|
||||
dispXf = viewer->ownerReservoirView()->displayCoordTransform();
|
||||
}
|
||||
|
||||
cvf::Vec3d domainPos = dispXf->transformToDomainCoord( newPos);
|
||||
domainPos.z() = -domainPos.z();
|
||||
QVariant originVariant = caf::PdmValueFieldSpecialization < cvf::Vec3d >::convert(domainPos);
|
||||
cvf::Vec3d domainPos = dispXf->transformToDomainCoord( newPos );
|
||||
domainPos.z() = -domainPos.z();
|
||||
QVariant originVariant = caf::PdmValueFieldSpecialization<cvf::Vec3d>::convert( domainPos );
|
||||
|
||||
caf::PdmUiCommandSystemProxy::instance()->setUiValueToField(uiField, originVariant);
|
||||
caf::PdmUiCommandSystemProxy::instance()->setUiValueToField( uiField, originVariant );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
class RicPointTangentManipulator;
|
||||
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
namespace cvf {
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
}
|
||||
|
||||
@@ -42,18 +42,17 @@ public:
|
||||
~RicTextAnnotation3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
void configureAndUpdateUi( const QString& uiConfigName ) override;
|
||||
void cleanupBeforeSettingPdmObject() override;
|
||||
|
||||
private slots:
|
||||
void slotLabelUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& dummy);
|
||||
void slotAnchorUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& dummy);
|
||||
void slotLabelUpdated( const cvf::Vec3d& origin, const cvf::Vec3d& dummy );
|
||||
void slotAnchorUpdated( const cvf::Vec3d& origin, const cvf::Vec3d& dummy );
|
||||
|
||||
private:
|
||||
void updatePoint(caf::PdmUiFieldHandle* uiField, const cvf::Vec3d& newPos);
|
||||
void updatePoint( caf::PdmUiFieldHandle* uiField, const cvf::Vec3d& newPos );
|
||||
|
||||
QPointer<RicPointTangentManipulator> m_labelManipulator;
|
||||
QPointer<RicPointTangentManipulator> m_anchorManipulator;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user