Salome HOME
Drawing of zones in OCC view improved.
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline.cxx
index 64ae5f201373ee3477dd27b216bac2131cc53232..fb723700621300e61e47ae44f4acbaadfd280279 100755 (executable)
@@ -262,6 +262,28 @@ HYDROData_Polyline::PolylineData HYDROData_Polyline::getPolylineData() const
   return aRes;
 }
 
+/**
+ * Returns true if polyline is closed
+ */
+bool HYDROData_Polyline::isClosed() const
+{
+  int aDim = getDimension();
+  PolylineData aPolylineData = getPolylineData();
+
+  if ( aDim == 0 || aPolylineData.isEmpty() )
+    return false;
+
+  PolylineData::const_iterator anIt = aPolylineData.constBegin();
+  for ( ; anIt != aPolylineData.constEnd(); ++anIt )
+  {
+    const PolylineSection& aSection = *anIt;
+    if ( !aSection.myIsClosed )
+      return false;
+  }
+
+  return true;
+}
+
 /**
  * Remove all polyline attributes except dimension.
  */
@@ -286,7 +308,7 @@ void HYDROData_Polyline::removeAll()
  * is ignored section type.
  * \return polyline painter path.
  */
-QPainterPath HYDROData_Polyline::painterPath()
+QPainterPath HYDROData_Polyline::painterPath() const
 {
   QPainterPath aPath;
   int aDim = getDimension();