Annotations. Fixed polyline vectors. Use explicit naming

This commit is contained in:
Bjørn Erik Jensen 2018-11-28 14:21:32 +01:00
parent 3b5011d573
commit 30b34bbe67
3 changed files with 35 additions and 13 deletions

View File

@ -23,6 +23,7 @@
#include "RimTextAnnotation.h"
#include "RimReachCircleAnnotation.h"
#include "RimPolylinesFromFileAnnotation.h"
#include "RimUserDefinedPolylinesAnnotation.h"
#include "RimProject.h"
#include "RimGridView.h"
@ -44,8 +45,8 @@ RimAnnotationCollection::RimAnnotationCollection()
CAF_PDM_InitFieldNoDefault(&m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations", "", "", "");
m_reachCircleAnnotations.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_polylineAnnotations, "PolylineAnnotations", "Polyline Annotations", "", "", "");
m_polylineAnnotations.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_userDefinedPolylineAnnotations, "UserDefinedPolylineAnnotations", "User Defined Polyline Annotations", "", "", "");
m_userDefinedPolylineAnnotations.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_polylineFromFileAnnotations, "PolylineFromFileAnnotations", "Polylines From File", "", "", "");
m_polylineFromFileAnnotations.uiCapability()->setUiHidden(true);
@ -72,9 +73,18 @@ void RimAnnotationCollection::addAnnotation(RimReachCircleAnnotation* annotation
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimPolylinesAnnotation* annotation)
void RimAnnotationCollection::addAnnotation(RimUserDefinedPolylinesAnnotation* annotation)
{
m_polylineAnnotations.push_back(annotation);
m_userDefinedPolylineAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimPolylinesFromFileAnnotation* annotation)
{
m_polylineFromFileAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
@ -104,9 +114,9 @@ std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnot
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylinesAnnotation*> RimAnnotationCollection::polylineAnnotations() const
std::vector<RimUserDefinedPolylinesAnnotation*> RimAnnotationCollection::userDefinedPolylineAnnotations() const
{
return m_polylineAnnotations.childObjects();
return m_userDefinedPolylineAnnotations.childObjects();
}
//--------------------------------------------------------------------------------------------------
@ -176,6 +186,14 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimAnnotationCollection::lineBasedAnnotationsCount() const
{
return m_reachCircleAnnotations.size() + m_userDefinedPolylineAnnotations.size() + m_polylineFromFileAnnotations.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
class QString;
class RimTextAnnotation;
class RimReachCircleAnnotation;
class RimPolylinesAnnotation;
class RimUserDefinedPolylinesAnnotation;
class RimPolylinesFromFileAnnotation;
class RimGridView;
@ -51,14 +51,17 @@ public:
bool snapAnnotations() const;
void addAnnotation(RimReachCircleAnnotation* annotation);
void addAnnotation(RimPolylinesAnnotation* annotation);
void addAnnotation(RimUserDefinedPolylinesAnnotation* annotation);
void addAnnotation(RimPolylinesFromFileAnnotation* annotation);
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
std::vector<RimPolylinesAnnotation*> polylineAnnotations() const;
std::vector<RimUserDefinedPolylinesAnnotation*> userDefinedPolylineAnnotations() const;
std::vector<RimPolylinesFromFileAnnotation*> polylinesFromFileAnnotations() const;
RimPolylinesFromFileAnnotation* importOrUpdatePolylinesFromFile(const QStringList& fileNames );
size_t lineBasedAnnotationsCount() const;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
@ -66,9 +69,9 @@ protected:
private:
void reloadPolylinesFromFile(const std::vector<RimPolylinesFromFileAnnotation *>& polyLinesObjsToReload);
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
caf::PdmChildArrayField<RimPolylinesAnnotation*> m_polylineAnnotations;
caf::PdmChildArrayField<RimPolylinesFromFileAnnotation*> m_polylineFromFileAnnotations;
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
caf::PdmChildArrayField<RimUserDefinedPolylinesAnnotation*> m_userDefinedPolylineAnnotations;
caf::PdmChildArrayField<RimPolylinesFromFileAnnotation*> m_polylineFromFileAnnotations;
caf::PdmField<double> m_annotationPlaneDepth;
caf::PdmField<bool> m_snapAnnotations;

View File

@ -33,6 +33,7 @@
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
#include "RimPolylinesFromFileAnnotation.h"
#include "RimUserDefinedPolylinesAnnotation.h"
#include "RimCalcScript.h"
#include "RimCase.h"
#include "RimCaseCollection.h"
@ -1023,7 +1024,7 @@ std::vector<RimPolylinesAnnotation*> RimProject::polylineAnnotations() const
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
for (const auto& annotation : annotationColl->polylineAnnotations())
for (const auto& annotation : annotationColl->userDefinedPolylineAnnotations())
{
annotations.push_back(annotation);
}