mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
commit
8873cdb1f7
@ -37,6 +37,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface/Core
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Annotations
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Completions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
@ -90,6 +91,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
ProjectDataModel/CMakeLists_files.cmake
|
||||
ProjectDataModel/Summary/CMakeLists_files.cmake
|
||||
ProjectDataModel/Flow/CMakeLists_files.cmake
|
||||
ProjectDataModel/Annotations/CMakeLists_files.cmake
|
||||
ProjectDataModel/Completions/CMakeLists_files.cmake
|
||||
|
||||
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
||||
|
@ -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
|
||||
|
@ -1,8 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
// 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
|
||||
@ -18,57 +16,67 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimAnnotationInView.h"
|
||||
#include "RicCreateReachCircleAnnotationFeature.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.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_PDM_SOURCE_INIT(RimAnnotationInView, "Annotation");
|
||||
CAF_CMD_SOURCE_INIT(RicCreateReachCircleAnnotationFeature, "RicCreateReachCircleAnnotationFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationInView::RimAnnotationInView()
|
||||
bool RicCreateReachCircleAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
CAF_PDM_InitObject("Well", ":/Well.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
return selObjs.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationInView::~RimAnnotationInView()
|
||||
void RicCreateReachCircleAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimReachCircleAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RicCreateReachCircleAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("Create Reach Circle Annotation");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationInView::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
RimAnnotationCollection* RicCreateReachCircleAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
// 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
|
||||
@ -20,35 +18,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimAnnotationCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationInView : public caf::PdmObject
|
||||
class RicCreateReachCircleAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
|
||||
RimAnnotationInView();
|
||||
~RimAnnotationInView() override;
|
||||
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
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;
|
||||
};
|
@ -33,8 +33,6 @@
|
||||
#include "cvfTransform.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
static RimSimWellInViewCollection* simWellInViewCollection() { return nullptr; }
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -0,0 +1,31 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
)
|
||||
|
||||
|
||||
source_group( "ProjectDataModel\\Annotations" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -30,7 +30,6 @@
|
||||
#include <QString>
|
||||
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationCollection, "RimAnnotationCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -111,7 +110,7 @@ std::vector<RimPolylinesAnnotation*> RimAnnotationCollection::polylineAnnotation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolyLinesFromFileAnnotation*> RimAnnotationCollection::polylinesFromFileAnnotations() const
|
||||
std::vector<RimPolylinesFromFileAnnotation*> RimAnnotationCollection::polylinesFromFileAnnotations() const
|
||||
{
|
||||
return m_polylineFromFileAnnotations.childObjects();
|
||||
}
|
||||
@ -119,16 +118,16 @@ std::vector<RimPolyLinesFromFileAnnotation*> RimAnnotationCollection::polylinesF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolyLinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylinesFromFile(const QStringList& fileNames)
|
||||
RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylinesFromFile(const QStringList& fileNames)
|
||||
{
|
||||
QStringList newFileNames;
|
||||
std::vector<RimPolyLinesFromFileAnnotation*> polyLinesObjsToReload;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polyLinesObjsToReload;
|
||||
size_t formationListBeforeImportCount = m_polylineFromFileAnnotations.size();
|
||||
|
||||
for(const QString& newFileName : fileNames)
|
||||
{
|
||||
bool isFound = false;
|
||||
for(RimPolyLinesFromFileAnnotation* polyLinesAnnot: m_polylineFromFileAnnotations)
|
||||
for(RimPolylinesFromFileAnnotation* polyLinesAnnot: m_polylineFromFileAnnotations)
|
||||
{
|
||||
if(polyLinesAnnot->fileName() == newFileName)
|
||||
{
|
||||
@ -146,7 +145,7 @@ RimPolyLinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
|
||||
for(const QString& newFileName : newFileNames)
|
||||
{
|
||||
RimPolyLinesFromFileAnnotation* newPolyLinesAnnot = new RimPolyLinesFromFileAnnotation;
|
||||
RimPolylinesFromFileAnnotation* newPolyLinesAnnot = new RimPolylinesFromFileAnnotation;
|
||||
newPolyLinesAnnot->setFileName(newFileName);
|
||||
m_polylineFromFileAnnotations.push_back(newPolyLinesAnnot);
|
||||
polyLinesObjsToReload.push_back(newPolyLinesAnnot);
|
||||
@ -155,7 +154,7 @@ RimPolyLinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
|
||||
QString totalErrorMessage;
|
||||
|
||||
for (RimPolyLinesFromFileAnnotation* polyLinesAnnot: polyLinesObjsToReload)
|
||||
for (RimPolylinesFromFileAnnotation* polyLinesAnnot: polyLinesObjsToReload)
|
||||
{
|
||||
QString errormessage;
|
||||
|
@ -29,7 +29,7 @@ class QString;
|
||||
class RimTextAnnotation;
|
||||
class RimReachCircleAnnotation;
|
||||
class RimPolylinesAnnotation;
|
||||
class RimPolyLinesFromFileAnnotation;
|
||||
class RimPolylinesFromFileAnnotation;
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
@ -50,9 +50,9 @@ public:
|
||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
||||
std::vector<RimPolylinesAnnotation*> polylineAnnotations() const;
|
||||
std::vector<RimPolyLinesFromFileAnnotation*> polylinesFromFileAnnotations() const;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polylinesFromFileAnnotations() const;
|
||||
|
||||
RimPolyLinesFromFileAnnotation* importOrUpdatePolylinesFromFile(const QStringList& fileNames );
|
||||
RimPolylinesFromFileAnnotation* importOrUpdatePolylinesFromFile(const QStringList& fileNames );
|
||||
void scheduleRedrawOfRelevantViews();
|
||||
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
|
||||
|
||||
@ -60,5 +60,5 @@ private:
|
||||
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
|
||||
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
|
||||
caf::PdmChildArrayField<RimPolylinesAnnotation*> m_polylineAnnotations;
|
||||
caf::PdmChildArrayField<RimPolyLinesFromFileAnnotation*> m_polylineFromFileAnnotations;
|
||||
caf::PdmChildArrayField<RimPolylinesFromFileAnnotation*> m_polylineFromFileAnnotations;
|
||||
};
|
@ -21,6 +21,7 @@
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
|
||||
#include "RimGridView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationInViewCollection, "Annotations");
|
||||
@ -32,7 +33,10 @@ RimAnnotationInViewCollection::RimAnnotationInViewCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/Plus.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "");
|
||||
m_textAnnotations.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
@ -43,6 +47,22 @@ RimAnnotationInViewCollection::~RimAnnotationInViewCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::addAnnotation(RimTextAnnotation* annotation)
|
||||
{
|
||||
m_textAnnotations.push_back(annotation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimTextAnnotation*> RimAnnotationInViewCollection::textAnnotations() const
|
||||
{
|
||||
return m_textAnnotations.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -70,13 +90,6 @@ void RimAnnotationInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle*
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
@ -27,6 +27,7 @@
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafTristate.h"
|
||||
|
||||
class RimTextAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -40,13 +41,16 @@ public:
|
||||
RimAnnotationInViewCollection();
|
||||
~RimAnnotationInViewCollection() override;
|
||||
|
||||
bool isActive() const;
|
||||
void addAnnotation(RimTextAnnotation* annotation);
|
||||
|
||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||
bool isActive() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
};
|
@ -57,12 +57,12 @@ caf::PdmFieldHandle* RimPolylinesAnnotation::objectToggleField()
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimUserDefinedPolyLinesAnnotation, "UserDefinedPolyLinesAnnotation");
|
||||
CAF_PDM_SOURCE_INIT(RimUserDefinedPolylinesAnnotation, "UserDefinedPolylinesAnnotation");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedPolyLinesAnnotation::RimUserDefinedPolyLinesAnnotation()
|
||||
RimUserDefinedPolylinesAnnotation::RimUserDefinedPolylinesAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLines Annotation", ":/WellCollection.png", "", "");
|
||||
|
||||
@ -72,7 +72,7 @@ RimUserDefinedPolyLinesAnnotation::RimUserDefinedPolyLinesAnnotation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedPolyLinesAnnotation::~RimUserDefinedPolyLinesAnnotation()
|
||||
RimUserDefinedPolylinesAnnotation::~RimUserDefinedPolylinesAnnotation()
|
||||
{
|
||||
|
||||
}
|
||||
@ -80,7 +80,7 @@ RimUserDefinedPolyLinesAnnotation::~RimUserDefinedPolyLinesAnnotation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigPolyLinesData> RimUserDefinedPolyLinesAnnotation::polyLinesData()
|
||||
cvf::ref<RigPolyLinesData> RimUserDefinedPolylinesAnnotation::polyLinesData()
|
||||
{
|
||||
cvf::ref<RigPolyLinesData> pld = new RigPolyLinesData;
|
||||
std::vector<std::vector<cvf::Vec3d> > lines;
|
||||
@ -93,7 +93,7 @@ cvf::ref<RigPolyLinesData> RimUserDefinedPolyLinesAnnotation::polyLinesData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimUserDefinedPolyLinesAnnotation::isEmpty()
|
||||
bool RimUserDefinedPolylinesAnnotation::isEmpty()
|
||||
{
|
||||
return m_points().empty();
|
||||
}
|
||||
@ -101,7 +101,7 @@ bool RimUserDefinedPolyLinesAnnotation::isEmpty()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolyLinesAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimUserDefinedPolylinesAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_points);
|
||||
|
||||
@ -111,7 +111,7 @@ void RimUserDefinedPolyLinesAnnotation::defineUiOrdering(QString uiConfigName, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolyLinesAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
void RimUserDefinedPolylinesAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
@ -126,12 +126,12 @@ void RimUserDefinedPolyLinesAnnotation::fieldChangedByUi(const caf::PdmFieldHand
|
||||
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPolyLinesFromFileAnnotation, "PolyLinesFromFileAnnotation");
|
||||
CAF_PDM_SOURCE_INIT(RimPolylinesFromFileAnnotation, "PolylinesFromFileAnnotation");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolyLinesFromFileAnnotation::RimPolyLinesFromFileAnnotation()
|
||||
RimPolylinesFromFileAnnotation::RimPolylinesFromFileAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLines Annotation", ":/WellCollection.png", "", "");
|
||||
|
||||
@ -144,7 +144,7 @@ RimPolyLinesFromFileAnnotation::RimPolyLinesFromFileAnnotation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolyLinesFromFileAnnotation::~RimPolyLinesFromFileAnnotation()
|
||||
RimPolylinesFromFileAnnotation::~RimPolylinesFromFileAnnotation()
|
||||
{
|
||||
|
||||
}
|
||||
@ -152,7 +152,7 @@ RimPolyLinesFromFileAnnotation::~RimPolyLinesFromFileAnnotation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolyLinesFromFileAnnotation::setFileName(const QString& fileName)
|
||||
void RimPolylinesFromFileAnnotation::setFileName(const QString& fileName)
|
||||
{
|
||||
m_polyLinesFileName = fileName;
|
||||
}
|
||||
@ -160,7 +160,7 @@ void RimPolyLinesFromFileAnnotation::setFileName(const QString& fileName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RimPolyLinesFromFileAnnotation::fileName()
|
||||
const QString& RimPolylinesFromFileAnnotation::fileName()
|
||||
{
|
||||
return m_polyLinesFileName();
|
||||
}
|
||||
@ -168,7 +168,7 @@ const QString& RimPolyLinesFromFileAnnotation::fileName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolyLinesFromFileAnnotation::readPolyLinesFile(QString * errorMessage)
|
||||
void RimPolylinesFromFileAnnotation::readPolyLinesFile(QString * errorMessage)
|
||||
{
|
||||
QFile dataFile(m_polyLinesFileName());
|
||||
|
||||
@ -239,7 +239,7 @@ void RimPolyLinesFromFileAnnotation::readPolyLinesFile(QString * errorMessage)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolyLinesFromFileAnnotation::isEmpty()
|
||||
bool RimPolylinesFromFileAnnotation::isEmpty()
|
||||
{
|
||||
bool isThisEmpty = true;
|
||||
for (const std::vector<cvf::Vec3d> & line :m_polyLinesData->polyLines())
|
||||
@ -253,7 +253,7 @@ bool RimPolyLinesFromFileAnnotation::isEmpty()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolyLinesFromFileAnnotation::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||
void RimPolylinesFromFileAnnotation::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||
{
|
||||
m_polyLinesFileName = RimTools::relocateFile(m_polyLinesFileName(), newProjectPath, oldProjectPath, nullptr, nullptr);
|
||||
|
||||
@ -262,7 +262,7 @@ void RimPolyLinesFromFileAnnotation::updateFilePathsFromProjectPath(const QStrin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolyLinesFromFileAnnotation::setDescriptionFromFileName()
|
||||
void RimPolylinesFromFileAnnotation::setDescriptionFromFileName()
|
||||
{
|
||||
QFileInfo fileInfo(m_polyLinesFileName());
|
||||
m_userDescription = fileInfo.fileName();
|
||||
@ -272,7 +272,7 @@ void RimPolyLinesFromFileAnnotation::setDescriptionFromFileName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPolyLinesFromFileAnnotation::userDescriptionField()
|
||||
caf::PdmFieldHandle* RimPolylinesFromFileAnnotation::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
@ -69,14 +69,14 @@ private:
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RimUserDefinedPolyLinesAnnotation : public RimPolylinesAnnotation
|
||||
class RimUserDefinedPolylinesAnnotation : public RimPolylinesAnnotation
|
||||
{
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimUserDefinedPolyLinesAnnotation();
|
||||
~RimUserDefinedPolyLinesAnnotation();
|
||||
RimUserDefinedPolylinesAnnotation();
|
||||
~RimUserDefinedPolylinesAnnotation();
|
||||
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() override;
|
||||
virtual bool isEmpty() override;
|
||||
@ -95,12 +95,12 @@ private:
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
class RimPolyLinesFromFileAnnotation : public RimPolylinesAnnotation
|
||||
class RimPolylinesFromFileAnnotation : public RimPolylinesAnnotation
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimPolyLinesFromFileAnnotation();
|
||||
~RimPolyLinesFromFileAnnotation();
|
||||
RimPolylinesFromFileAnnotation();
|
||||
~RimPolylinesFromFileAnnotation();
|
||||
|
||||
void setFileName(const QString& fileName);
|
||||
const QString& fileName();
|
@ -71,7 +71,7 @@ RimTextAnnotation::RimTextAnnotation()
|
||||
|
||||
CAF_PDM_InitField(&m_anchorPoint, "AnchorPoint", Vec3d::ZERO, "Anchor Point", "", "", "");
|
||||
CAF_PDM_InitField(&m_labelPoint, "LabelPoint", Vec3d::ZERO, "Label Point", "", "", "");
|
||||
CAF_PDM_InitField(&m_text, "Text", QString(), "Text", "", "", "");
|
||||
CAF_PDM_InitField(&m_text, "Text", QString("(New text)"), "Text", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
@ -122,12 +122,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||
)
|
||||
|
||||
|
||||
@ -254,12 +248,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "Rim3dWellLogFileCurve.h"
|
||||
#include "Rim3dWellLogRftCurve.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
@ -682,10 +683,14 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if (dynamic_cast<RimAnnotationCollection*>(uiItem))
|
||||
{
|
||||
menuBuilder << "RicCreateTextAnnotationFeature";
|
||||
menuBuilder << "RicCreateReachCircleAnnotationFeature";
|
||||
menuBuilder << "RicCreateUserDefinedPolylinesAnnotationFeature";
|
||||
menuBuilder << "RicImportPolylinesAnnotationFeature";
|
||||
menuBuilder << "RicNewTextAnnotationFeature";
|
||||
menuBuilder << "RicNewReachCircleAnnotationFeature";
|
||||
menuBuilder << "RicNewPolygonAnnotationFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimAnnotationInViewCollection*>(uiItem))
|
||||
{
|
||||
menuBuilder << "RicCreateTextAnnotationFeature";
|
||||
}
|
||||
|
||||
if (dynamic_cast<Rim3dView*>(uiItem))
|
||||
|
@ -1,144 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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 "RimPolylineAnnotation.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "RifWellPathFormationsImporter.h"
|
||||
#include "RifWellPathImporter.h"
|
||||
|
||||
#include "cafPdmUiEditorHandle.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPolylineAnnotation, "RimPolylineAnnotation");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineAnnotation::RimPolylineAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_points, "Points", {}, "Points", "", "", "");
|
||||
}
|
||||
|
||||
RimPolylineAnnotation::~RimPolylineAnnotation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineAnnotation::setPoints(const std::vector<Vec3d>& points)
|
||||
{
|
||||
m_points = points;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RimPolylineAnnotation::Vec3d>& RimPolylineAnnotation::points() const
|
||||
{
|
||||
return m_points();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_points);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
auto views = gridViewsContainingAnnotations();
|
||||
if (!views.empty())
|
||||
{
|
||||
if (changedField == &m_points)
|
||||
{
|
||||
for (auto& view : views)
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridView*> RimPolylineAnnotation::gridViewsContainingAnnotations() const
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
RimProject* project = nullptr;
|
||||
this->firstAncestorOrThisOfType(project);
|
||||
|
||||
if (!project) return views;
|
||||
|
||||
std::vector<RimGridView*> visibleGridViews;
|
||||
project->allVisibleGridViews(visibleGridViews);
|
||||
|
||||
for (auto& gridView : visibleGridViews)
|
||||
{
|
||||
if (gridView->annotationCollection()->isActive()) views.push_back(gridView);
|
||||
}
|
||||
return views;
|
||||
}
|
@ -31,8 +31,8 @@
|
||||
#include "RigGridBase.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCaseCollection.h"
|
||||
@ -683,7 +683,7 @@ void RimProject::allNotLinkedViews(std::vector<RimGridView*>& views)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::allVisibleViews(std::vector<Rim3dView*>& views)
|
||||
void RimProject::allVisibleViews(std::vector<Rim3dView*>& views) const
|
||||
{
|
||||
std::vector<RimCase*> cases;
|
||||
allCases(cases);
|
||||
@ -707,7 +707,7 @@ void RimProject::allVisibleViews(std::vector<Rim3dView*>& views)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::allVisibleGridViews(std::vector<RimGridView*>& views)
|
||||
void RimProject::allVisibleGridViews(std::vector<RimGridView*>& views) const
|
||||
{
|
||||
std::vector<Rim3dView*> visibleViews;
|
||||
this->allVisibleViews(visibleViews);
|
||||
@ -966,6 +966,8 @@ std::vector<RimWellPath*> RimProject::allWellPaths() const
|
||||
std::vector<RimTextAnnotation*> RimProject::textAnnotations() const
|
||||
{
|
||||
std::vector<RimTextAnnotation*> annotations;
|
||||
|
||||
// 'Global' text annotations
|
||||
for (const auto& oilField : oilFields())
|
||||
{
|
||||
auto annotationColl = oilField->annotationCollection();
|
||||
@ -974,6 +976,24 @@ std::vector<RimTextAnnotation*> RimProject::textAnnotations() const
|
||||
annotations.push_back(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
// 'Local' text annotations
|
||||
std::vector<RimGridView*> visibleViews;
|
||||
allVisibleGridViews(visibleViews);
|
||||
for (const auto& view : visibleViews)
|
||||
{
|
||||
std::vector<RimAnnotationInViewCollection*> annotationColls;
|
||||
view->descendantsIncludingThisOfType(annotationColls);
|
||||
|
||||
if (annotationColls.size() == 1)
|
||||
{
|
||||
for (const auto& annotation : annotationColls.front()->textAnnotations())
|
||||
{
|
||||
annotations.push_back(annotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return annotations;
|
||||
}
|
||||
|
||||
|
@ -115,8 +115,8 @@ public:
|
||||
std::vector<RimSummaryCaseCollection*> summaryGroups() const;
|
||||
RimSummaryCaseMainCollection* firstSummaryCaseMainCollection() const;
|
||||
|
||||
void allVisibleViews(std::vector<Rim3dView*>& views);
|
||||
void allVisibleGridViews(std::vector<RimGridView*>& views);
|
||||
void allVisibleViews(std::vector<Rim3dView*>& views) const;
|
||||
void allVisibleGridViews(std::vector<RimGridView*>& views) const;
|
||||
void allNotLinkedViews(std::vector<RimGridView*>& views);
|
||||
|
||||
void scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
|
Loading…
Reference in New Issue
Block a user