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:
@@ -79,7 +79,7 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
||||
auto linesInDomain = getPolylinesPointsInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
||||
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;
|
||||
part->setName("RivPolylineAnnotationPartMgr");
|
||||
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;
|
||||
polyLines.push_back(polyLine);
|
||||
return createLineAlongPolylineDrawable(polyLines);
|
||||
return createLineAlongPolylineDrawable(polyLines, closeLine);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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::Vec3f> vertices;
|
||||
@@ -57,6 +57,12 @@ cvf::ref<cvf::DrawableGeo>
|
||||
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;
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace cvf
|
||||
class RivPolylineGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
|
||||
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
|
||||
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, bool closeLine = false);
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user