mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
139 lines
4.3 KiB
C
139 lines
4.3 KiB
C
|
/////////////////////////////////////////////////////////////////////////////////
|
||
|
//
|
||
|
// 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>
|
||
|
// for more details.
|
||
|
//
|
||
|
/////////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include "cafPdmChildArrayField.h"
|
||
|
#include "cafPdmField.h"
|
||
|
#include "cafPdmObject.h"
|
||
|
#include "cafPdmPointer.h"
|
||
|
#include "cafAppEnum.h"
|
||
|
#include "cafPdmUiOrdering.h"
|
||
|
|
||
|
// Include to make Pdm work for cvf::Color
|
||
|
#include "cafPdmFieldCvfColor.h"
|
||
|
#include "cafPdmChildField.h"
|
||
|
#include "cafPdmFieldCvfVec3d.h"
|
||
|
|
||
|
#include "cvfObject.h"
|
||
|
#include "cvfVector3.h"
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
class QString;
|
||
|
class RimGridView;
|
||
|
class RigPolyLinesData;
|
||
|
|
||
|
//==================================================================================================
|
||
|
///
|
||
|
///
|
||
|
//==================================================================================================
|
||
|
class RimPolylinesAnnotation : public caf::PdmObject
|
||
|
{
|
||
|
using Vec3d = cvf::Vec3d;
|
||
|
|
||
|
CAF_PDM_HEADER_INIT;
|
||
|
|
||
|
public:
|
||
|
RimPolylinesAnnotation();
|
||
|
~RimPolylinesAnnotation();
|
||
|
|
||
|
virtual cvf::ref<RigPolyLinesData> polyLinesData() = 0;
|
||
|
virtual bool isEmpty() = 0;
|
||
|
|
||
|
protected:
|
||
|
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||
|
|
||
|
private:
|
||
|
caf::PdmField<std::vector<Vec3d>> m_points;
|
||
|
caf::PdmField<bool> m_isActive;
|
||
|
};
|
||
|
|
||
|
//==================================================================================================
|
||
|
///
|
||
|
///
|
||
|
//==================================================================================================
|
||
|
|
||
|
class RimUserDefinedPolyLinesAnnotation : public RimPolylinesAnnotation
|
||
|
{
|
||
|
using Vec3d = cvf::Vec3d;
|
||
|
|
||
|
CAF_PDM_HEADER_INIT;
|
||
|
public:
|
||
|
RimUserDefinedPolyLinesAnnotation();
|
||
|
~RimUserDefinedPolyLinesAnnotation();
|
||
|
|
||
|
cvf::ref<RigPolyLinesData> polyLinesData() override;
|
||
|
virtual bool isEmpty() override;
|
||
|
|
||
|
protected:
|
||
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||
|
|
||
|
private:
|
||
|
caf::PdmField<std::vector<Vec3d>> m_points;
|
||
|
};
|
||
|
|
||
|
//==================================================================================================
|
||
|
///
|
||
|
///
|
||
|
//==================================================================================================
|
||
|
|
||
|
|
||
|
class RimPolyLinesFromFileAnnotation : public RimPolylinesAnnotation
|
||
|
{
|
||
|
CAF_PDM_HEADER_INIT;
|
||
|
public:
|
||
|
RimPolyLinesFromFileAnnotation();
|
||
|
~RimPolyLinesFromFileAnnotation();
|
||
|
|
||
|
void setFileName(const QString& fileName);
|
||
|
const QString& fileName();
|
||
|
void readPolyLinesFile(QString * errorMessage);
|
||
|
|
||
|
|
||
|
cvf::ref<RigPolyLinesData> polyLinesData() override { return m_polyLinesData;}
|
||
|
virtual bool isEmpty() override;
|
||
|
|
||
|
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||
|
void setDescriptionFromFileName();
|
||
|
|
||
|
private:
|
||
|
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||
|
|
||
|
caf::PdmField<QString> m_userDescription;
|
||
|
caf::PdmField<QString> m_polyLinesFileName;
|
||
|
cvf::ref<RigPolyLinesData> m_polyLinesData;
|
||
|
};
|
||
|
|
||
|
|
||
|
//==================================================================================================
|
||
|
///
|
||
|
///
|
||
|
//==================================================================================================
|
||
|
class RigPolyLinesData : public cvf::Object
|
||
|
{
|
||
|
public:
|
||
|
RigPolyLinesData() {}
|
||
|
|
||
|
const std::vector<std::vector<cvf::Vec3d> >& polyLines() const { return m_polylines;}
|
||
|
void setPolyLines(const std::vector<std::vector<cvf::Vec3d> >& polyLines) { m_polylines = polyLines;}
|
||
|
|
||
|
private:
|
||
|
std::vector<std::vector<cvf::Vec3d> > m_polylines;
|
||
|
};
|