mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-18 14:00:33 +05:00
PAL12608: Add possibility to check geometry of a shape.
This commit is contained in:
parent
c163f8be1f
commit
6e638ed221
@ -2021,6 +2021,15 @@ module GEOM
|
||||
boolean CheckShape (in GEOM_Object theShape,
|
||||
out string theDescription);
|
||||
|
||||
/*!
|
||||
* Check a topology and a geometry of the given shape.
|
||||
* \param theShape Shape to check validity of.
|
||||
* \param theDescription Output. Description of problems in the shape, if they are.
|
||||
* \return TRUE, if the shape "seems to be valid".
|
||||
*/
|
||||
boolean CheckShapeWithGeometry (in GEOM_Object theShape,
|
||||
out string theDescription);
|
||||
|
||||
/*!
|
||||
* Obtain description of the given shape
|
||||
* \param theShape Shape to be described.
|
||||
|
@ -361,6 +361,7 @@ void GEOMImpl_IMeasureOperations::GetTolerance
|
||||
*/
|
||||
//=============================================================================
|
||||
bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape,
|
||||
const Standard_Boolean theIsCheckGeom,
|
||||
TCollection_AsciiString& theDump)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
@ -379,7 +380,7 @@ bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape,
|
||||
//Compute the parameters
|
||||
bool isValid = false;
|
||||
try {
|
||||
BRepCheck_Analyzer ana (aShape, false);
|
||||
BRepCheck_Analyzer ana (aShape, theIsCheckGeom);
|
||||
if (ana.IsValid()) {
|
||||
theDump.Clear();
|
||||
isValid = true;
|
||||
|
@ -39,38 +39,40 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape);
|
||||
|
||||
Standard_EXPORT void GetBasicProperties (Handle(GEOM_Object) theShape,
|
||||
Standard_Real& theLength,
|
||||
Standard_Real& theSurfArea,
|
||||
Standard_Real& theVolume);
|
||||
Standard_Real& theLength,
|
||||
Standard_Real& theSurfArea,
|
||||
Standard_Real& theVolume);
|
||||
|
||||
Standard_EXPORT void GetInertia (Handle(GEOM_Object) theShape,
|
||||
Standard_Real& I11, Standard_Real& I12, Standard_Real& I13,
|
||||
Standard_Real& I21, Standard_Real& I22, Standard_Real& I23,
|
||||
Standard_Real& I31, Standard_Real& I32, Standard_Real& I33,
|
||||
Standard_Real& Ix , Standard_Real& Iy , Standard_Real& Iz);
|
||||
Standard_Real& I11, Standard_Real& I12, Standard_Real& I13,
|
||||
Standard_Real& I21, Standard_Real& I22, Standard_Real& I23,
|
||||
Standard_Real& I31, Standard_Real& I32, Standard_Real& I33,
|
||||
Standard_Real& Ix , Standard_Real& Iy , Standard_Real& Iz);
|
||||
|
||||
Standard_EXPORT void GetBoundingBox (Handle(GEOM_Object) theShape,
|
||||
Standard_Real& Xmin, Standard_Real& Xmax,
|
||||
Standard_Real& Ymin, Standard_Real& Ymax,
|
||||
Standard_Real& Zmin, Standard_Real& Zmax);
|
||||
Standard_Real& Xmin, Standard_Real& Xmax,
|
||||
Standard_Real& Ymin, Standard_Real& Ymax,
|
||||
Standard_Real& Zmin, Standard_Real& Zmax);
|
||||
|
||||
Standard_EXPORT void GetTolerance (Handle(GEOM_Object) theShape,
|
||||
Standard_Real& FaceMin, Standard_Real& FaceMax,
|
||||
Standard_Real& EdgeMin, Standard_Real& EdgeMax,
|
||||
Standard_Real& VertMin, Standard_Real& VertMax);
|
||||
Standard_Real& FaceMin, Standard_Real& FaceMax,
|
||||
Standard_Real& EdgeMin, Standard_Real& EdgeMax,
|
||||
Standard_Real& VertMin, Standard_Real& VertMax);
|
||||
|
||||
Standard_EXPORT bool CheckShape (Handle(GEOM_Object) theShape,
|
||||
TCollection_AsciiString& theDump);
|
||||
const Standard_Boolean theIsCheckGeom,
|
||||
TCollection_AsciiString& theDump);
|
||||
|
||||
Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
|
||||
|
||||
Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2,
|
||||
Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1,
|
||||
Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2);
|
||||
Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1,
|
||||
Handle(GEOM_Object) theShape2,
|
||||
Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1,
|
||||
Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2);
|
||||
|
||||
Standard_EXPORT void PointCoordinates(Handle(GEOM_Object) theShape,
|
||||
Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ );
|
||||
|
||||
Standard_EXPORT void PointCoordinates( Handle(GEOM_Object) theShape,
|
||||
Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ );
|
||||
|
||||
private:
|
||||
void StructuralDump (const BRepCheck_Analyzer& theAna,
|
||||
const TopoDS_Shape& theShape,
|
||||
|
@ -219,7 +219,40 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckShape (GEOM::GEOM_Object_ptr theS
|
||||
|
||||
// Get shape parameters
|
||||
TCollection_AsciiString aDump;
|
||||
if (GetOperations()->CheckShape(aShape, aDump))
|
||||
if (GetOperations()->CheckShape(aShape, /*check_geom = */false, aDump))
|
||||
{
|
||||
theDescription = CORBA::string_dup("OK");
|
||||
return 1;
|
||||
}
|
||||
theDescription = CORBA::string_dup(aDump.ToCString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
CORBA::Boolean GEOM_IMeasureOperations_i::CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::String_out theDescription)
|
||||
{
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
if (theShape == NULL)
|
||||
{
|
||||
theDescription = CORBA::string_dup("null");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Get the reference shape
|
||||
Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
|
||||
(theShape->GetStudyID(), theShape->GetEntry());
|
||||
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
theDescription = CORBA::string_dup("null2");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get shape parameters
|
||||
TCollection_AsciiString aDump;
|
||||
if (GetOperations()->CheckShape(aShape, /*check_geom = */true, aDump))
|
||||
{
|
||||
theDescription = CORBA::string_dup("OK");
|
||||
return 1;
|
||||
|
@ -65,6 +65,9 @@ class GEOM_IMeasureOperations_i :
|
||||
CORBA::Boolean CheckShape (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::String_out theDescription);
|
||||
|
||||
CORBA::Boolean CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::String_out theDescription);
|
||||
|
||||
char* WhatIs (GEOM::GEOM_Object_ptr theShape);
|
||||
|
||||
CORBA::Double GetMinDistance (GEOM::GEOM_Object_ptr theShape1,
|
||||
|
@ -920,8 +920,12 @@ def MakeCDG(aShape):
|
||||
print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
def CheckShape(aShape):
|
||||
(IsValid, Status) = MeasuOp.CheckShape(aShape)
|
||||
def CheckShape(aShape, theIsCheckGeom = 0):
|
||||
if theIsCheckGeom:
|
||||
(IsValid, Status) = MeasuOp.CheckShapeWithGeometry(theShape)
|
||||
else:
|
||||
(IsValid, Status) = MeasuOp.CheckShape(theShape)
|
||||
|
||||
if MeasuOp.IsDone() == 0:
|
||||
print "CheckShape : ", MeasuOp.GetErrorCode()
|
||||
else:
|
||||
|
@ -1775,12 +1775,18 @@ def MakeCDG(theShape):
|
||||
|
||||
## Check a topology of the given shape.
|
||||
# @param theShape Shape to check validity of.
|
||||
# @return TRUE, if the shape "seems to be valid" from the topological point of view.
|
||||
# @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
|
||||
# if TRUE, the shape's geometry will be checked also.
|
||||
# @return TRUE, if the shape "seems to be valid".
|
||||
# If theShape is invalid, prints a description of problem.
|
||||
#
|
||||
# Example: see GEOM_TestMeasures.py
|
||||
def CheckShape(theShape):
|
||||
(IsValid, Status) = MeasuOp.CheckShape(theShape)
|
||||
def CheckShape(theShape, theIsCheckGeom = 0):
|
||||
if theIsCheckGeom:
|
||||
(IsValid, Status) = MeasuOp.CheckShapeWithGeometry(theShape)
|
||||
else:
|
||||
(IsValid, Status) = MeasuOp.CheckShape(theShape)
|
||||
|
||||
if MeasuOp.IsDone() == 0:
|
||||
print "CheckShape : ", MeasuOp.GetErrorCode()
|
||||
else:
|
||||
|
@ -17,7 +17,7 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
//
|
||||
//
|
||||
@ -27,7 +27,6 @@
|
||||
// $Header$
|
||||
|
||||
#include "MeasureGUI_CheckShapeDlg.h"
|
||||
#include "MeasureGUI_1Sel1TextView_QTD.h"
|
||||
|
||||
#include "utilities.h"
|
||||
#include "SUIT_Session.h"
|
||||
@ -40,10 +39,27 @@
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qcheckbox.h>
|
||||
|
||||
#define TEXTEDIT_FONT_FAMILY "Courier"
|
||||
#define TEXTEDIT_FONT_SIZE 11
|
||||
|
||||
MeasureGUI_1Sel1TextView1Check_QTD::MeasureGUI_1Sel1TextView1Check_QTD(QWidget* parent,
|
||||
const char* name, WFlags fl)
|
||||
: MeasureGUI_1Sel1TextView_QTD(parent, name, fl)
|
||||
{
|
||||
CheckBoxGeom = new QCheckBox(GroupBox1, "CheckBoxGeom");
|
||||
CheckBoxGeom->setText(tr("CHECK_SHAPE_GEOMETRY"));
|
||||
Layout1->addMultiCellWidget(CheckBoxGeom, 2, 2, 0, 2);
|
||||
|
||||
CheckBoxGeom->setChecked(false);
|
||||
}
|
||||
|
||||
MeasureGUI_1Sel1TextView1Check_QTD::~MeasureGUI_1Sel1TextView1Check_QTD()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// class : MeasureGUI_CheckShapeDlg()
|
||||
// purpose : Constructs a MeasureGUI_CheckShapeDlg which is a child of 'parent', with the
|
||||
@ -66,11 +82,11 @@ MeasureGUI_CheckShapeDlg::MeasureGUI_CheckShapeDlg( GeometryGUI* GUI, QWidget* p
|
||||
GroupConstructors->setTitle( tr( "GEOM_CHECK_SHAPE" ) );
|
||||
RadioButton1->setPixmap( image0 );
|
||||
|
||||
myGrp = new MeasureGUI_1Sel1TextView_QTD( this, "myGrp" );
|
||||
myGrp = new MeasureGUI_1Sel1TextView1Check_QTD( this, "myGrp" );
|
||||
myGrp->GroupBox1->setTitle( tr( "GEOM_CHECK_INFOS" ) );
|
||||
myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
|
||||
myGrp->TextEdit1->setReadOnly( TRUE );
|
||||
|
||||
|
||||
QFont aFont( TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE );
|
||||
aFont.setStyleHint( QFont::TypeWriter, QFont::PreferAntialias );
|
||||
myGrp->TextEdit1->setFont( aFont );
|
||||
@ -87,7 +103,6 @@ MeasureGUI_CheckShapeDlg::MeasureGUI_CheckShapeDlg( GeometryGUI* GUI, QWidget* p
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~MeasureGUI_CheckShapeDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -106,6 +121,9 @@ void MeasureGUI_CheckShapeDlg::Init()
|
||||
mySelBtn = myGrp->PushButton1;
|
||||
mySelEdit = myGrp->LineEdit1;
|
||||
MeasureGUI_Skeleton::Init();
|
||||
|
||||
connect(myGrp->CheckBoxGeom, SIGNAL(toggled(bool)),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -121,7 +139,13 @@ bool MeasureGUI_CheckShapeDlg::getParameters ( bool& theIsValid, QString& theMsg
|
||||
try
|
||||
{
|
||||
char* aMsg;
|
||||
theIsValid = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->CheckShape( myObj, aMsg );
|
||||
bool isCheckGeometry = myGrp->CheckBoxGeom->isChecked();
|
||||
GEOM::GEOM_IMeasureOperations_ptr aMeasureOp =
|
||||
GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||
if (isCheckGeometry)
|
||||
theIsValid = aMeasureOp->CheckShapeWithGeometry(myObj, aMsg);
|
||||
else
|
||||
theIsValid = aMeasureOp->CheckShape(myObj, aMsg);
|
||||
theMsg = aMsg;
|
||||
}
|
||||
catch( const SALOME::SALOME_Exception& e )
|
||||
|
@ -17,21 +17,21 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : MeasureGUI_CheckShapeDlg.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : GEOM
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_CHECKSHAPEDLG_H
|
||||
#define DIALOGBOX_CHECKSHAPEDLG_H
|
||||
|
||||
#include "MeasureGUI_Skeleton.h"
|
||||
#include "MeasureGUI_1Sel1TextView_QTD.h"
|
||||
|
||||
class MeasureGUI_1Sel1TextView_QTD;
|
||||
class QCheckBox;
|
||||
|
||||
#if defined WNT && defined MEASUREGUI_EXPORTS
|
||||
#define MEASUREGUI_EXPORT __declspec( dllexport )
|
||||
@ -39,6 +39,21 @@ class MeasureGUI_1Sel1TextView_QTD;
|
||||
#define MEASUREGUI_EXPORT
|
||||
#endif
|
||||
|
||||
//=================================================================================
|
||||
// class : MeasureGUI_1Sel1TextView1Check_QTD
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class MeasureGUI_1Sel1TextView1Check_QTD : public MeasureGUI_1Sel1TextView_QTD
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MeasureGUI_1Sel1TextView1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
|
||||
~MeasureGUI_1Sel1TextView1Check_QTD();
|
||||
|
||||
QCheckBox* CheckBoxGeom;
|
||||
};
|
||||
|
||||
//=================================================================================
|
||||
// class : MeasureGUI_CheckShapeDlg
|
||||
// purpose :
|
||||
@ -48,24 +63,19 @@ class MEASUREGUI_EXPORT MeasureGUI_CheckShapeDlg : public MeasureGUI_Skeleton
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MeasureGUI_CheckShapeDlg( GeometryGUI* GUI,
|
||||
QWidget* parent );
|
||||
~MeasureGUI_CheckShapeDlg();
|
||||
MeasureGUI_CheckShapeDlg(GeometryGUI* GUI, QWidget* parent);
|
||||
~MeasureGUI_CheckShapeDlg();
|
||||
|
||||
protected:
|
||||
|
||||
// redefined from GEOMBase_Helper and MeasureGUI_Skeleton
|
||||
virtual void processObject();
|
||||
virtual void processObject();
|
||||
|
||||
private:
|
||||
|
||||
void Init();
|
||||
bool getParameters( bool& theIsValid,
|
||||
QString& theMsg);
|
||||
void Init();
|
||||
bool getParameters(bool& theIsValid, QString& theMsg);
|
||||
|
||||
private:
|
||||
|
||||
MeasureGUI_1Sel1TextView_QTD* myGrp;
|
||||
|
||||
MeasureGUI_1Sel1TextView1Check_QTD* myGrp;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_CHECKSHAPEDLG_H
|
||||
|
Loading…
Reference in New Issue
Block a user