]> OCCT Git - occt.git/commitdiff
Data Exchange - RWMesh_CafReader deferred loading issue for no faces #339
authorZernova Marina <36417100+mzernova@users.noreply.github.com>
Mon, 3 Feb 2025 22:29:33 +0000 (22:29 +0000)
committerGitHub <noreply@github.com>
Mon, 3 Feb 2025 22:29:33 +0000 (22:29 +0000)
Fixed issue when trying to apply deferred loading for edges or vertexes.

src/RWMesh/RWMesh_TriangulationReader.cxx
src/RWMesh/RWMesh_TriangulationSource.cxx

index 2ac19a28aa2e39a2f456b7c510b3741253d22797..3762d1d8a0552ed8bb519c0def7a8234956a7d82 100644 (file)
@@ -160,6 +160,11 @@ bool RWMesh_TriangulationReader::setNbEdges(const Handle(Poly_Triangulation)& th
                                             const Standard_Boolean            theToCopyData) const
 {
   Handle(RWMesh_TriangulationSource) aMesh = Handle(RWMesh_TriangulationSource)::DownCast(theMesh);
+  if (aMesh.IsNull())
+  {
+    Message::SendWarning("Only triangulation loading is supported.");
+    return false;
+  }
   if (theNbTris >= 1)
   {
     aMesh->ResizeEdges(theNbTris, theToCopyData);
@@ -175,6 +180,11 @@ Standard_Integer RWMesh_TriangulationReader::setEdge(const Handle(Poly_Triangula
                                                      const Standard_Integer theEdge) const
 {
   Handle(RWMesh_TriangulationSource) aMesh = Handle(RWMesh_TriangulationSource)::DownCast(theMesh);
+  if (aMesh.IsNull())
+  {
+    Message::SendWarning("Only triangulation loading is supported.");
+    return 0;
+  }
   if (theEdge < 1 || theEdge > theMesh->NbNodes())
   {
     return 0;
index 3cbde1056479e020b50fe2bae79be31a5e405d23..d68024348da0a29d9720604c58ec691934403835 100644 (file)
@@ -44,13 +44,7 @@ Standard_Boolean RWMesh_TriangulationSource::loadDeferredData(
   {
     return false;
   }
-  Handle(RWMesh_TriangulationSource) aDestTriangulation =
-    Handle(RWMesh_TriangulationSource)::DownCast(theDestTriangulation);
-  if (aDestTriangulation.IsNull())
-  {
-    return false;
-  }
-  if (myReader->Load(this, aDestTriangulation, theFileSystem))
+  if (myReader->Load(this, theDestTriangulation, theFileSystem))
   {
     return true;
   }