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.
*/
//=============================================================================
bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape,
+ const Standard_Boolean theIsCheckGeom,
TCollection_AsciiString& theDump)
{
SetErrorCode(KO);
//Compute the parameters
bool isValid = false;
try {
- BRepCheck_Analyzer ana (aShape, false);
+ BRepCheck_Analyzer ana (aShape, theIsCheckGeom);
if (ana.IsValid()) {
theDump.Clear();
isValid = true;
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,
// 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;
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,
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:
## 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:
// 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
//
//
//
// $Header$
#include "MeasureGUI_CheckShapeDlg.h"
-#include "MeasureGUI_1Sel1TextView_QTD.h"
#include "utilities.h"
#include "SUIT_Session.h"
#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
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 );
Init();
}
-
//=================================================================================
// function : ~MeasureGUI_CheckShapeDlg()
// purpose : Destroys the object and frees any allocated resources
mySelBtn = myGrp->PushButton1;
mySelEdit = myGrp->LineEdit1;
MeasureGUI_Skeleton::Init();
+
+ connect(myGrp->CheckBoxGeom, SIGNAL(toggled(bool)),
+ this, SLOT(SelectionIntoArgument()));
}
//=================================================================================
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 )
// 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 )
#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 :
Q_OBJECT
public:
- MeasureGUI_CheckShapeDlg( GeometryGUI* GUI,
- QWidget* parent );
- ~MeasureGUI_CheckShapeDlg();
-protected:
+ 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