mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3869 Annotations. Closing polyline support
This commit is contained in:
parent
a87c4efd93
commit
9c750c5287
@ -79,7 +79,7 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
|||||||
auto linesInDomain = getPolylinesPointsInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
auto linesInDomain = getPolylinesPointsInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
||||||
auto linesInDisplay = transformPolylinesPointsToDisplay(linesInDomain, displayXf);
|
auto linesInDisplay = transformPolylinesPointsToDisplay(linesInDomain, displayXf);
|
||||||
|
|
||||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplay);
|
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplay, rimAnnotation->closePolyline());
|
||||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||||
part->setName("RivPolylineAnnotationPartMgr");
|
part->setName("RivPolylineAnnotationPartMgr");
|
||||||
part->setDrawable(drawableGeo.p());
|
part->setDrawable(drawableGeo.p());
|
||||||
|
@ -26,18 +26,18 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::DrawableGeo> RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine)
|
cvf::ref<cvf::DrawableGeo> RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine, bool closeLine)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<cvf::Vec3d>> polyLines;
|
std::vector<std::vector<cvf::Vec3d>> polyLines;
|
||||||
polyLines.push_back(polyLine);
|
polyLines.push_back(polyLine);
|
||||||
return createLineAlongPolylineDrawable(polyLines);
|
return createLineAlongPolylineDrawable(polyLines, closeLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::DrawableGeo>
|
cvf::ref<cvf::DrawableGeo>
|
||||||
RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines)
|
RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines, bool closeLine)
|
||||||
{
|
{
|
||||||
std::vector<cvf::uint> lineIndices;
|
std::vector<cvf::uint> lineIndices;
|
||||||
std::vector<cvf::Vec3f> vertices;
|
std::vector<cvf::Vec3f> vertices;
|
||||||
@ -57,6 +57,12 @@ cvf::ref<cvf::DrawableGeo>
|
|||||||
lineIndices.push_back(static_cast<cvf::uint>(verticesCount + i + 1));
|
lineIndices.push_back(static_cast<cvf::uint>(verticesCount + i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (closeLine && vertices.front() != vertices.back())
|
||||||
|
{
|
||||||
|
lineIndices.push_back(static_cast<cvf::uint>(verticesCount + polyLine.size() - 1));
|
||||||
|
lineIndices.push_back(static_cast<cvf::uint>(verticesCount));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vertices.empty()) return nullptr;
|
if (vertices.empty()) return nullptr;
|
||||||
|
@ -35,8 +35,8 @@ namespace cvf
|
|||||||
class RivPolylineGenerator : public cvf::Object
|
class RivPolylineGenerator : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
|
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine, bool closeLine = false);
|
||||||
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
|
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines, bool closeLine = false);
|
||||||
|
|
||||||
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
|
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
|
||||||
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
|
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
|
||||||
|
@ -35,6 +35,7 @@ RimPolylinesAnnotation::RimPolylinesAnnotation()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
|
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_closePolyline, "ClosePolyline", false, "Close Polyline", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -45,3 +46,11 @@ RimPolylinesAnnotation::~RimPolylinesAnnotation()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimPolylinesAnnotation::closePolyline() const
|
||||||
|
{
|
||||||
|
return m_closePolyline;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -41,4 +41,9 @@ public:
|
|||||||
|
|
||||||
virtual cvf::ref<RigPolyLinesData> polyLinesData() = 0;
|
virtual cvf::ref<RigPolyLinesData> polyLinesData() = 0;
|
||||||
virtual bool isEmpty() = 0;
|
virtual bool isEmpty() = 0;
|
||||||
|
|
||||||
|
bool closePolyline() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
caf::PdmField<bool> m_closePolyline;
|
||||||
};
|
};
|
||||||
|
@ -178,6 +178,8 @@ void RimPolylinesFromFileAnnotation::setDescriptionFromFileName()
|
|||||||
void RimPolylinesFromFileAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
void RimPolylinesFromFileAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
{
|
{
|
||||||
uiOrdering.add(&m_polyLinesFileName);
|
uiOrdering.add(&m_polyLinesFileName);
|
||||||
|
uiOrdering.add(&m_closePolyline);
|
||||||
|
|
||||||
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||||
appearance()->uiOrdering(uiConfigName, *appearanceGroup);
|
appearance()->uiOrdering(uiConfigName, *appearanceGroup);
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ class RimReachCircleAnnotation : public RimLineBasedAnnotation
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
RimReachCircleAnnotation();
|
RimReachCircleAnnotation();
|
||||||
|
~RimReachCircleAnnotation() override {}
|
||||||
|
|
||||||
Vec3d centerPoint() const;
|
Vec3d centerPoint() const;
|
||||||
double radius() const;
|
double radius() const;
|
||||||
|
@ -228,6 +228,7 @@ void RimUserDefinedPolylinesAnnotation::defineUiOrdering(QString uiConfigName, c
|
|||||||
uiOrdering.add(&m_name);
|
uiOrdering.add(&m_name);
|
||||||
uiOrdering.add(&m_targets);
|
uiOrdering.add(&m_targets);
|
||||||
uiOrdering.add(&m_enablePicking);
|
uiOrdering.add(&m_enablePicking);
|
||||||
|
uiOrdering.add(&m_closePolyline);
|
||||||
|
|
||||||
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||||
appearance()->uiOrdering(uiConfigName, *appearanceGroup);
|
appearance()->uiOrdering(uiConfigName, *appearanceGroup);
|
||||||
|
Loading…
Reference in New Issue
Block a user