2018-11-26 07:06:17 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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
|
2018-11-27 07:27:02 -06:00
|
|
|
#include "RimLineBasedAnnotation.h"
|
2018-11-26 07:06:17 -06:00
|
|
|
|
|
|
|
#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;
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2018-11-27 10:53:56 -06:00
|
|
|
class RimPolylinesAnnotation : public RimLineBasedAnnotation
|
2018-11-26 07:06:17 -06:00
|
|
|
{
|
|
|
|
using Vec3d = cvf::Vec3d;
|
|
|
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RimPolylinesAnnotation();
|
|
|
|
~RimPolylinesAnnotation();
|
|
|
|
|
2018-11-27 10:53:56 -06:00
|
|
|
bool isActive();
|
|
|
|
|
2018-11-26 07:06:17 -06:00
|
|
|
virtual cvf::ref<RigPolyLinesData> polyLinesData() = 0;
|
|
|
|
virtual bool isEmpty() = 0;
|
2018-11-27 10:53:56 -06:00
|
|
|
|
2018-11-26 07:06:17 -06:00
|
|
|
protected:
|
|
|
|
virtual caf::PdmFieldHandle* objectToggleField() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
caf::PdmField<bool> m_isActive;
|
|
|
|
};
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
|
2018-11-27 02:26:30 -06:00
|
|
|
class RimUserDefinedPolylinesAnnotation : public RimPolylinesAnnotation
|
2018-11-26 07:06:17 -06:00
|
|
|
{
|
|
|
|
using Vec3d = cvf::Vec3d;
|
|
|
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
2018-11-27 02:26:30 -06:00
|
|
|
RimUserDefinedPolylinesAnnotation();
|
|
|
|
~RimUserDefinedPolylinesAnnotation();
|
2018-11-26 07:06:17 -06:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
|
2018-11-27 02:26:30 -06:00
|
|
|
class RimPolylinesFromFileAnnotation : public RimPolylinesAnnotation
|
2018-11-26 07:06:17 -06:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
2018-11-27 02:26:30 -06:00
|
|
|
RimPolylinesFromFileAnnotation();
|
|
|
|
~RimPolylinesFromFileAnnotation();
|
2018-11-26 07:06:17 -06:00
|
|
|
|
|
|
|
void setFileName(const QString& fileName);
|
2018-11-27 10:53:56 -06:00
|
|
|
QString fileName() const;
|
2018-11-26 07:06:17 -06:00
|
|
|
void readPolyLinesFile(QString * errorMessage);
|
|
|
|
|
|
|
|
cvf::ref<RigPolyLinesData> polyLinesData() override { return m_polyLinesData;}
|
|
|
|
virtual bool isEmpty() override;
|
|
|
|
|
|
|
|
void setDescriptionFromFileName();
|
|
|
|
|
2018-11-27 07:27:02 -06:00
|
|
|
protected:
|
|
|
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
|
|
|
2018-11-26 07:06:17 -06:00
|
|
|
private:
|
|
|
|
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
|
|
|
|
caf::PdmField<QString> m_userDescription;
|
2018-11-27 10:53:56 -06:00
|
|
|
caf::PdmField<caf::FilePath> m_polyLinesFileName;
|
2018-11-26 07:06:17 -06:00
|
|
|
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;
|
|
|
|
};
|