mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-19 00:00:36 +05:00
IPAL21497 Crash in Bounding Box Information dialog box when C++ container is in standalone mode
This commit is contained in:
parent
3ebcadd35c
commit
2b5e9d2459
@ -26,6 +26,8 @@
|
|||||||
#include "MeasureGUI_BndBoxDlg.h"
|
#include "MeasureGUI_BndBoxDlg.h"
|
||||||
#include "MeasureGUI_Widgets.h"
|
#include "MeasureGUI_Widgets.h"
|
||||||
|
|
||||||
|
#include "GeometryGUI.h"
|
||||||
|
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <GEOM_Function.hxx>
|
#include <GEOM_Function.hxx>
|
||||||
@ -166,24 +168,27 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax,
|
|||||||
try {
|
try {
|
||||||
Handle(Poly_Triangulation) Trtn = 0;
|
Handle(Poly_Triangulation) Trtn = 0;
|
||||||
|
|
||||||
Handle(GEOM_Object) anObject = GEOM_Engine::GetEngine()->GetObject(myObj->GetStudyID(), myObj->GetEntry());
|
GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
|
||||||
if (!anObject.IsNull())
|
if ( CORBA::is_nil(aGeomGen) )
|
||||||
{
|
return false;
|
||||||
Handle(GEOM_Function) aRefShape = anObject->GetLastFunction();
|
|
||||||
if (!aRefShape.IsNull())
|
char* IOR = GEOMBase::GetIORFromObject( myObj );
|
||||||
{
|
GEOM::GEOM_Object_var anObject = aGeomGen->GetIORFromString(IOR);
|
||||||
TopoDS_Shape aShape = aRefShape->GetValue();
|
if ( CORBA::is_nil(anObject) )
|
||||||
if (!aShape.IsNull())
|
return false;
|
||||||
{
|
|
||||||
|
TopoDS_Shape aShape;
|
||||||
|
GEOMBase::GetShape(anObject, aShape, TopAbs_SHAPE);
|
||||||
|
if ( aShape.IsNull() )
|
||||||
|
return false;
|
||||||
|
|
||||||
TopLoc_Location l;
|
TopLoc_Location l;
|
||||||
Handle(Poly_Triangulation) T;
|
Handle(Poly_Triangulation) T;
|
||||||
TopExp_Explorer ex;
|
TopExp_Explorer ex;
|
||||||
for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) {
|
for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) {
|
||||||
const TopoDS_Face& F = TopoDS::Face(ex.Current());
|
const TopoDS_Face& F = TopoDS::Face(ex.Current());
|
||||||
|
|
||||||
BRepAdaptor_Surface surf(F);
|
BRepAdaptor_Surface surf(F);
|
||||||
if (surf.GetType() == GeomAbs_Sphere)
|
if (surf.GetType() == GeomAbs_Sphere) {
|
||||||
{
|
|
||||||
T = BRep_Tool::Triangulation(F, l);
|
T = BRep_Tool::Triangulation(F, l);
|
||||||
if (!T.IsNull()) {
|
if (!T.IsNull()) {
|
||||||
Handle(Poly_Triangulation) NullTrtn = 0;
|
Handle(Poly_Triangulation) NullTrtn = 0;
|
||||||
@ -195,20 +200,10 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax,
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anOper->GetBoundingBox( myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax );
|
anOper->GetBoundingBox( myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax );
|
||||||
|
|
||||||
if (!Trtn.IsNull())
|
if (!Trtn.IsNull()) {
|
||||||
{
|
|
||||||
Handle(GEOM_Function) aRefShape = anObject->GetLastFunction();
|
|
||||||
if (!aRefShape.IsNull())
|
|
||||||
{
|
|
||||||
TopoDS_Shape aShape = aRefShape->GetValue();
|
|
||||||
if (!aShape.IsNull())
|
|
||||||
{
|
|
||||||
TopLoc_Location l;
|
TopLoc_Location l;
|
||||||
Handle(Poly_Triangulation) T;
|
Handle(Poly_Triangulation) T;
|
||||||
TopExp_Explorer ex;
|
TopExp_Explorer ex;
|
||||||
@ -218,8 +213,6 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch( const SALOME::SALOME_Exception& e ) {
|
catch( const SALOME::SALOME_Exception& e ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user