#3757, #3723 Merge cleanup of 3d editor support

This commit is contained in:
Jacob Støren committed 2018-11-27 11:45:46 +01:00
commit 8873cdb1f7
29 files changed
+554 -359

No files matched your search

@@ -1,12 +1,16 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.cpp
)
list(APPEND CODE_HEADER_FILES
@@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RicCreateReachCircleAnnotationFeature.h"
#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 "RiuMainWindow.h"
#include <cafSelectionManagerTools.h>
#include <QAction>
CAF_CMD_SOURCE_INIT(RicCreateReachCircleAnnotationFeature, "RicCreateReachCircleAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateReachCircleAnnotationFeature::isCommandEnabled()
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateReachCircleAnnotationFeature::onActionTriggered(bool isChecked)
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimReachCircleAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateReachCircleAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("Create Reach Circle Annotation");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RicCreateReachCircleAnnotationFeature::annotationCollection() const
{
auto project = RiaApplication::instance()->project();
auto oilField = project->activeOilField();
return oilField ? oilField->annotationCollection() : nullptr;
}
@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
//==================================================================================================
///
//==================================================================================================
class RicCreateReachCircleAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
private:
RimAnnotationCollection* annotationCollection() const;
};
@@ -0,0 +1,104 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RicCreateTextAnnotationFeature.h"
#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 "RiuMainWindow.h"
#include <cafSelectionManagerTools.h>
#include <QAction>
CAF_CMD_SOURCE_INIT(RicCreateTextAnnotationFeature, "RicCreateTextAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateTextAnnotationFeature::isCommandEnabled()
{
auto selObjsGlobal = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
auto selObjs2InView = caf::selectedObjectsByTypeStrict<RimAnnotationInViewCollection*>();
return selObjsGlobal.size() == 1 || selObjs2InView.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTextAnnotationFeature::onActionTriggered(bool isChecked)
{
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimTextAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
{
auto coll = annotationInViewCollection();
if (coll)
{
auto newAnnotation = new RimTextAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTextAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("Create Text Annotation");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RicCreateTextAnnotationFeature::annotationCollection() const
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1 ? selObjs.front() : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection* RicCreateTextAnnotationFeature::annotationInViewCollection() const
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationInViewCollection*>();
return selObjs.size() == 1 ? selObjs.front() : nullptr;
}
@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
class RimAnnotationInViewCollection;
//==================================================================================================
///
//==================================================================================================
class RicCreateTextAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
RimAnnotationCollection* annotationCollection() const;
RimAnnotationInViewCollection* annotationInViewCollection() const;
};
@@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RicCreateUserDefinedPolylinesAnnotationFeature.h"
#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 "RiuMainWindow.h"
#include <cafSelectionManagerTools.h>
#include <QAction>
CAF_CMD_SOURCE_INIT(RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("Create User Defined Polyline Annotation");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
{
auto project = RiaApplication::instance()->project();
auto oilField = project->activeOilField();
return oilField ? oilField->annotationCollection() : nullptr;
}
@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
//==================================================================================================
///
//==================================================================================================
class RicCreateUserDefinedPolylinesAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
private:
RimAnnotationCollection* annotationCollection() const;
};
@@ -71,7 +71,7 @@ void RicImportPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
// For each file,
RimPolyLinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile(fileNames);
RimPolylinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile(fileNames);
proj->updateConnectedEditors();
@@ -76,7 +76,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicResampleDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewAnnotationFeature.h
)
@@ -151,7 +150,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicResampleDialog.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewAnnotationFeature.cpp
)
@@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RicCreateUserDefinedPolylinesAnnotationFeature.h"
#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 "RiuMainWindow.h"
#include <cafSelectionManagerTools.h>
#include <QAction>
CAF_CMD_SOURCE_INIT(RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("Create User Defined Polyline Annotation");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
{
auto project = RiaApplication::instance()->project();
auto oilField = project->activeOilField();
return oilField ? oilField->annotationCollection() : nullptr;
}
@@ -1,84 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
//==================================================================================================
///
//==================================================================================================
class RicNewAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
RimAnnotationCollection* annotationCollection() const;
};
//==================================================================================================
///
//==================================================================================================
class RicNewTextAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};
//==================================================================================================
///
//==================================================================================================
class RicNewReachCircleAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};
//==================================================================================================
///
//==================================================================================================
class RicNewPolylineAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};