From 4b318b8bf64b1c92b9eacd790b69b5dff6cee2a3 Mon Sep 17 00:00:00 2001 From: Zernova Marina <36417100+mzernova@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:29:33 +0000 Subject: [PATCH] Data Exchange - RWMesh_CafReader deferred loading issue for no faces #339 Fixed issue when trying to apply deferred loading for edges or vertexes. --- src/RWMesh/RWMesh_TriangulationReader.cxx | 10 ++++++++++ src/RWMesh/RWMesh_TriangulationSource.cxx | 8 +------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/RWMesh/RWMesh_TriangulationReader.cxx b/src/RWMesh/RWMesh_TriangulationReader.cxx index 2ac19a28aa..3762d1d8a0 100644 --- a/src/RWMesh/RWMesh_TriangulationReader.cxx +++ b/src/RWMesh/RWMesh_TriangulationReader.cxx @@ -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; diff --git a/src/RWMesh/RWMesh_TriangulationSource.cxx b/src/RWMesh/RWMesh_TriangulationSource.cxx index 3cbde10564..d68024348d 100644 --- a/src/RWMesh/RWMesh_TriangulationSource.cxx +++ b/src/RWMesh/RWMesh_TriangulationSource.cxx @@ -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; }