NPAL16559: EDF507: Implementation of a more advanced system of measurement.

This commit is contained in:
jfa 2007-10-12 09:13:37 +00:00
parent a6fd4353b7
commit 12b9928268
22 changed files with 1162 additions and 212 deletions

View File

@ -2361,6 +2361,12 @@ module GEOM
out double X1, out double Y1, out double Z1,
out double X2, out double Y2, out double Z2);
/*!
* Get angle between the given lines or linear edges.
* \param theShape1,theShape2 Shapes to find angle between. Lines or linear edges.
* \return Value of the angle between the given shapes.
*/
double GetAngle (in GEOM_Object theShape1, in GEOM_Object theShape2);
/*!
* Get point coordinates

View File

@ -35,6 +35,7 @@ SalomeApp.xml \
GEOMDS_Resources \
ImportExport \
ShHealing \
angle.png \
arc.png \
archimede.png \
axisinertia.png \

BIN
resources/angle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

View File

@ -17,6 +17,7 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
#include <GEOMImpl_IMeasureOperations.hxx>
@ -81,15 +82,17 @@
#include <Geom_BSplineSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_OffsetSurface.hxx>
#include <Geom_Line.hxx>
#include <gp_Pln.hxx>
#include <gp_Lin.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
//=============================================================================
/*!
* constructor:
* Constructor
*/
//=============================================================================
GEOMImpl_IMeasureOperations::GEOMImpl_IMeasureOperations (GEOM_Engine* theEngine, int theDocID)
@ -100,7 +103,7 @@ GEOMImpl_IMeasureOperations::GEOMImpl_IMeasureOperations (GEOM_Engine* theEngine
//=============================================================================
/*!
* destructor
* Destructor
*/
//=============================================================================
GEOMImpl_IMeasureOperations::~GEOMImpl_IMeasureOperations()
@ -1291,23 +1294,24 @@ Standard_Real GEOMImpl_IMeasureOperations::GetMinDistance
}
//=======================================================================
//function : PointCoordinates
//purpose : Get coordinates of point
/*!
* Get coordinates of point
*/
//=======================================================================
void GEOMImpl_IMeasureOperations::PointCoordinates( Handle(GEOM_Object) theShape,
Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ )
void GEOMImpl_IMeasureOperations::PointCoordinates (Handle(GEOM_Object) theShape,
Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ)
{
SetErrorCode( KO );
SetErrorCode(KO);
if ( theShape.IsNull() )
if (theShape.IsNull())
return;
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if ( aRefShape.IsNull() )
if (aRefShape.IsNull())
return;
TopoDS_Shape aShape = aRefShape->GetValue();
if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX)
{
SetErrorCode( "Shape must be a vertex" );
return;
@ -1321,15 +1325,84 @@ void GEOMImpl_IMeasureOperations::PointCoordinates( Handle(GEOM_Object) theShape
theX = aPnt.X();
theY = aPnt.Y();
theZ = aPnt.Z();
SetErrorCode( OK );
SetErrorCode(OK);
}
catch ( Standard_Failure )
catch (Standard_Failure)
{
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode( aFail->GetMessageString() );
}
}
//=======================================================================
/*!
* Compute angle (in degrees) between two lines
*/
//=======================================================================
Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine1,
Handle(GEOM_Object) theLine2)
{
SetErrorCode(KO);
Standard_Real anAngle = -1.0;
if (theLine1.IsNull() || theLine2.IsNull())
return anAngle;
Handle(GEOM_Function) aRefLine1 = theLine1->GetLastFunction();
Handle(GEOM_Function) aRefLine2 = theLine2->GetLastFunction();
if (aRefLine1.IsNull() || aRefLine2.IsNull())
return anAngle;
TopoDS_Shape aLine1 = aRefLine1->GetValue();
TopoDS_Shape aLine2 = aRefLine2->GetValue();
if (aLine1.IsNull() || aLine2.IsNull() ||
aLine1.ShapeType() != TopAbs_EDGE ||
aLine2.ShapeType() != TopAbs_EDGE)
{
SetErrorCode("Two edges must be given");
return anAngle;
}
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
TopoDS_Edge E1 = TopoDS::Edge(aLine1);
TopoDS_Edge E2 = TopoDS::Edge(aLine2);
double fp,lp;
Handle(Geom_Curve) C1 = BRep_Tool::Curve(E1,fp,lp);
Handle(Geom_Curve) C2 = BRep_Tool::Curve(E2,fp,lp);
if (!C1->IsKind(STANDARD_TYPE(Geom_Line)) ||
!C2->IsKind(STANDARD_TYPE(Geom_Line)))
{
SetErrorCode("The edges must be linear");
return anAngle;
}
Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast(C1);
Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(C2);
gp_Lin aLin1 = L1->Lin();
gp_Lin aLin2 = L2->Lin();
anAngle = aLin1.Angle(aLin2);
anAngle /= PI180; // convert radians into degrees
SetErrorCode(OK);
}
catch (Standard_Failure)
{
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
}
return anAngle;
}
//=======================================================================
//function : StructuralDump
//purpose : Structural (data exchange) style of output.

View File

@ -122,8 +122,10 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
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);
Standard_EXPORT Standard_Real GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2);
public:
Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape);

View File

@ -17,6 +17,7 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
#include "GEOM_IMeasureOperations_i.hh"
@ -392,8 +393,8 @@ CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance
* PointCoordinates
*/
//=============================================================================
void GEOM_IMeasureOperations_i::PointCoordinates(
GEOM::GEOM_Object_ptr theShape, CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z )
void GEOM_IMeasureOperations_i::PointCoordinates (GEOM::GEOM_Object_ptr theShape,
CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z)
{
//Set a not done flag
@ -412,3 +413,28 @@ void GEOM_IMeasureOperations_i::PointCoordinates(
// Get shape parameters
GetOperations()->PointCoordinates( aShape, X, Y, Z );
}
//=============================================================================
/*!
* GetAngle
*/
//=============================================================================
CORBA::Double GEOM_IMeasureOperations_i::GetAngle (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2)
{
//Set a not done flag
GetOperations()->SetNotDone();
if (theShape1 == NULL || theShape2 == NULL) return -1.0;
//Get the reference shapes
Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject
(theShape1->GetStudyID(), theShape1->GetEntry());
Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject
(theShape2->GetStudyID(), theShape2->GetEntry());
if (aShape1.IsNull() || aShape2.IsNull()) return -1.0;
// Get the angle
return GetOperations()->GetAngle(aShape1, aShape2);
}

View File

@ -85,9 +85,11 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i :
CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1,
CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2);
void PointCoordinates (GEOM::GEOM_Object_ptr theShape,
CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z);
void PointCoordinates( GEOM::GEOM_Object_ptr theShape,
CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z );
CORBA::Double GetAngle (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2);
::GEOMImpl_IMeasureOperations* GetOperations()
{ return (::GEOMImpl_IMeasureOperations*)GetImpl(); }

View File

@ -120,6 +120,30 @@ def TestMeasureOperations (geompy, math):
print "\nMinimal distance between Box and Cube = ", MinDist
MinDistComps = geompy.MinDistanceComponents(box, cube)
print "\nMinimal distance between Box and Cube = ", MinDistComps[0]
print "Its components are (", MinDistComps[1], ", ", MinDistComps[2], ", ", MinDistComps[3], ")"
####### Angle #######
OX = geompy.MakeVectorDXDYDZ(10, 0,0)
OXY = geompy.MakeVectorDXDYDZ(10,10,0)
# in one plane
Angle = geompy.GetAngle(OX, OXY)
print "\nAngle between OX and OXY = ", Angle
if math.fabs(Angle - 45.0) > 1e-05:
print " Error: returned angle is", Angle, "while must be 45.0"
# not in one plane
OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
Angle = geompy.GetAngle(OX, OXY_shift)
print "Angle between OX and OXY_shift = ", Angle
if math.fabs(Angle - 45.0) > 1e-05:
print " Error: returned angle is", Angle, "while must be 45.0"
####### Position (LCS) #######
Pos = geompy.GetPosition(box)

View File

@ -1976,12 +1976,35 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @return Value of the minimal distance between the given shapes.
#
# Example: see GEOM_TestMeasures.py
def MinDistance(self,theShape1, theShape2):
def MinDistance(self, theShape1, theShape2):
aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
if self.MeasuOp.IsDone() == 0:
print "MinDistance : ", self.MeasuOp.GetErrorCode()
return aTuple[0]
## Get minimal distance between the given shapes.
# @param theShape1,theShape2 Shapes to find minimal distance between.
# @return Value of the minimal distance between the given shapes.
#
# Example: see GEOM_TestMeasures.py
def MinDistanceComponents(self, theShape1, theShape2):
aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
if self.MeasuOp.IsDone() == 0:
print "MinDistanceComponents : ", self.MeasuOp.GetErrorCode()
aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
return aRes
## Get angle between the given shapes.
# @param theShape1,theShape2 Lines or linear edges to find angle between.
# @return Value of the angle between the given shapes.
#
# Example: see GEOM_TestMeasures.py
def GetAngle(self, theShape1, theShape2):
anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
if self.MeasuOp.IsDone() == 0:
print "GetAngle : ", self.MeasuOp.GetErrorCode()
return anAngle
## Get min and max tolerances of sub-shapes of theShape
# @param theShape Shape, to get tolerances of.
# @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]

View File

@ -43,12 +43,14 @@ dist_libMeasureGUI_la_SOURCES = \
MeasureGUI_1Sel12LineEdit_QTD.cxx \
MeasureGUI_1Sel1TextView_QTD.cxx \
MeasureGUI_2Sel1LineEdit_QTD.cxx \
MeasureGUI_2Sel4LineEdit_QTD.cxx \
MeasureGUI_Skeleton.cxx \
MeasureGUI_PropertiesDlg.cxx \
MeasureGUI_CenterMassDlg.cxx \
MeasureGUI_InertiaDlg.cxx \
MeasureGUI_BndBoxDlg.cxx \
MeasureGUI_DistanceDlg.cxx \
MeasureGUI_AngleDlg.cxx \
MeasureGUI_MaxToleranceDlg.cxx \
MeasureGUI_WhatisDlg.cxx \
MeasureGUI_CheckShapeDlg.cxx \
@ -62,12 +64,14 @@ MOC_FILES = \
MeasureGUI_1Sel12LineEdit_QTD_moc.cxx \
MeasureGUI_1Sel1TextView_QTD_moc.cxx \
MeasureGUI_2Sel1LineEdit_QTD_moc.cxx \
MeasureGUI_2Sel4LineEdit_QTD_moc.cxx \
MeasureGUI_Skeleton_moc.cxx \
MeasureGUI_PropertiesDlg_moc.cxx \
MeasureGUI_CenterMassDlg_moc.cxx \
MeasureGUI_InertiaDlg_moc.cxx \
MeasureGUI_BndBoxDlg_moc.cxx \
MeasureGUI_DistanceDlg_moc.cxx \
MeasureGUI_AngleDlg_moc.cxx \
MeasureGUI_MaxToleranceDlg_moc.cxx \
MeasureGUI_WhatisDlg_moc.cxx \
MeasureGUI_CheckShapeDlg_moc.cxx \

View File

@ -38,6 +38,7 @@
#include "MeasureGUI_InertiaDlg.h" // Method INERTIA
#include "MeasureGUI_BndBoxDlg.h" // Method BNDBOX
#include "MeasureGUI_DistanceDlg.h" // Method DISTANCE
#include "MeasureGUI_AngleDlg.h" // Method ANGLE
#include "MeasureGUI_MaxToleranceDlg.h" // Method MAXTOLERANCE
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
#include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE
@ -79,6 +80,7 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 703 : new MeasureGUI_InertiaDlg (getGeometryGUI(), parent); break; // INERTIA
case 7041: new MeasureGUI_BndBoxDlg (getGeometryGUI(), parent); break; // BOUNDING BOX
case 7042: new MeasureGUI_DistanceDlg (getGeometryGUI(), parent); break; // MIN DISTANCE
case 7043: new MeasureGUI_AngleDlg (getGeometryGUI(), parent); break; // ANGLE
case 705 : new MeasureGUI_MaxToleranceDlg(getGeometryGUI(), parent); break; // MAXTOLERANCE
case 706 : new MeasureGUI_WhatisDlg (getGeometryGUI(), parent); break; // WHATIS
case 707 : new MeasureGUI_CheckShapeDlg (getGeometryGUI(), parent); break; // CHECKSHAPE

View File

@ -1,57 +1,36 @@
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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
//
/****************************************************************************
** Form implementation generated from reading ui file 'MeasureGUI_2Sel1LineEdit_QTD.ui'
**
** Created: mar oct 28 16:11:14 2003
** by: The User Interface Compiler (uic)
** Created: Tue Oct 9 14:45:59 2007
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "MeasureGUI_2Sel1LineEdit_QTD.h"
#include <qvariant.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a MeasureGUI_2Sel1LineEdit_QTD which is a child of 'parent', with the
/*
* Constructs a MeasureGUI_2Sel1LineEdit_QTD as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
MeasureGUI_2Sel1LineEdit_QTD::MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent, const char* name, WFlags fl )
MeasureGUI_2Sel1LineEdit_QTD::MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "MeasureGUI_2Sel1LineEdit_QTD" );
resize( 129, 115 );
setCaption( trUtf8( "MeasureGUI_2Sel1LineEdit_QTD" ) );
MeasureGUI_2Sel1LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_2Sel1LineEdit_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
@ -59,38 +38,14 @@ MeasureGUI_2Sel1LineEdit_QTD::MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent, co
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
QSpacerItem* spacer = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 2 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout1->addWidget( TextLabel3, 2, 0 );
LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" );
Layout1->addMultiCellWidget( LineEdit3, 2, 2, 1, 2 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
@ -98,18 +53,40 @@ MeasureGUI_2Sel1LineEdit_QTD::MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent, co
Layout1->addWidget( LineEdit1, 0, 2 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel2, 1, 0 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
PushButton2->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton2, 1, 1 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel3, 2, 0 );
LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" );
Layout1->addMultiCellWidget( LineEdit3, 2, 2, 1, 2 );
Spacer8 = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( Spacer8, 3, 2 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
MeasureGUI_2Sel1LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 );
languageChange();
resize( QSize(129, 115).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
}
/*
/*
* Destroys the object and frees any allocated resources
*/
MeasureGUI_2Sel1LineEdit_QTD::~MeasureGUI_2Sel1LineEdit_QTD()
@ -117,3 +94,11 @@ MeasureGUI_2Sel1LineEdit_QTD::~MeasureGUI_2Sel1LineEdit_QTD()
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void MeasureGUI_2Sel1LineEdit_QTD::languageChange()
{
}

View File

@ -1,30 +1,12 @@
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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
//
/****************************************************************************
** Form interface generated from reading ui file 'MeasureGUI_2Sel1LineEdit_QTD.ui'
**
** Created: mar oct 28 16:11:14 2003
** by: The User Interface Compiler (uic)
** Created: Tue Oct 9 14:45:55 2007
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef MEASUREGUI_2SEL1LINEEDIT_QTD_H
#define MEASUREGUI_2SEL1LINEEDIT_QTD_H
@ -32,16 +14,18 @@
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QLineEdit;
class GEOM_MEASUREGUI_EXPORT MeasureGUI_2Sel1LineEdit_QTD : public QWidget
{
{
Q_OBJECT
public:
@ -49,20 +33,24 @@ public:
~MeasureGUI_2Sel1LineEdit_QTD();
QGroupBox* GroupBox1;
QLabel* TextLabel3;
QLineEdit* LineEdit3;
QLineEdit* LineEdit2;
QLabel* TextLabel2;
QLabel* TextLabel1;
QPushButton* PushButton1;
QLineEdit* LineEdit1;
QLabel* TextLabel2;
QPushButton* PushButton2;
QLineEdit* LineEdit2;
QLabel* TextLabel3;
QLineEdit* LineEdit3;
protected:
QGridLayout* MeasureGUI_2Sel1LineEdit_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QSpacerItem* Spacer8;
protected slots:
virtual void languageChange();
};
#endif // MEASUREGUI_2SEL1LINEEDIT_QTD_H

View File

@ -0,0 +1,131 @@
/****************************************************************************
** Form implementation generated from reading ui file 'MeasureGUI_2Sel4LineEdit_QTD.ui'
**
** Created: Tue Oct 9 14:32:18 2007
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "MeasureGUI_2Sel4LineEdit_QTD.h"
#include <qvariant.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a MeasureGUI_2Sel4LineEdit_QTD as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
MeasureGUI_2Sel4LineEdit_QTD::MeasureGUI_2Sel4LineEdit_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "MeasureGUI_2Sel4LineEdit_QTD" );
MeasureGUI_2Sel4LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_2Sel4LineEdit_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel1, 0, 0 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( PushButton1, 0, 1 );
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel2, 1, 0 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( PushButton2, 1, 1 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel3, 2, 0 );
LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" );
Layout1->addMultiCellWidget( LineEdit3, 2, 2, 1, 2 );
TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel4, 3, 0 );
LineEdit4 = new QLineEdit( GroupBox1, "LineEdit4" );
Layout1->addMultiCellWidget( LineEdit4, 3, 3, 1, 2 );
TextLabel5 = new QLabel( GroupBox1, "TextLabel5" );
TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel5, 4, 0 );
LineEdit5 = new QLineEdit( GroupBox1, "LineEdit5" );
Layout1->addMultiCellWidget( LineEdit5, 4, 4, 1, 2 );
TextLabel6 = new QLabel( GroupBox1, "TextLabel6" );
TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( TextLabel6, 5, 0 );
LineEdit6 = new QLineEdit( GroupBox1, "LineEdit6" );
Layout1->addMultiCellWidget( LineEdit6, 5, 5, 1, 2 );
Spacer8 = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( Spacer8, 6, 2 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
MeasureGUI_2Sel4LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 );
languageChange();
resize( QSize(129, 163).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
}
/*
* Destroys the object and frees any allocated resources
*/
MeasureGUI_2Sel4LineEdit_QTD::~MeasureGUI_2Sel4LineEdit_QTD()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void MeasureGUI_2Sel4LineEdit_QTD::languageChange()
{
}

View File

@ -0,0 +1,62 @@
/****************************************************************************
** Form interface generated from reading ui file 'MeasureGUI_2Sel4LineEdit_QTD.ui'
**
** Created: Tue Oct 9 14:31:27 2007
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef MEASUREGUI_2SEL4LINEEDIT_QTD_H
#define MEASUREGUI_2SEL4LINEEDIT_QTD_H
#include "GEOM_MeasureGUI.hxx"
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QGroupBox;
class QLabel;
class QPushButton;
class QLineEdit;
class GEOM_MEASUREGUI_EXPORT MeasureGUI_2Sel4LineEdit_QTD : public QWidget
{
Q_OBJECT
public:
MeasureGUI_2Sel4LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~MeasureGUI_2Sel4LineEdit_QTD();
QGroupBox* GroupBox1;
QLabel* TextLabel1;
QPushButton* PushButton1;
QLineEdit* LineEdit1;
QLabel* TextLabel2;
QPushButton* PushButton2;
QLineEdit* LineEdit2;
QLabel* TextLabel3;
QLineEdit* LineEdit3;
QLabel* TextLabel4;
QLineEdit* LineEdit4;
QLabel* TextLabel5;
QLineEdit* LineEdit5;
QLabel* TextLabel6;
QLineEdit* LineEdit6;
protected:
QGridLayout* MeasureGUI_2Sel4LineEdit_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QSpacerItem* Spacer8;
protected slots:
virtual void languageChange();
};
#endif // MEASUREGUI_2SEL4LINEEDIT_QTD_H

View File

@ -0,0 +1,330 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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
//
//
//
// File : MeasureGUI_AngleDlg.cxx
// Author : Julia DOROVSKIKH
// Module : GEOM
// $Header$
#include "MeasureGUI_AngleDlg.h"
#include "MeasureGUI_2Sel1LineEdit_QTD.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
#include "DlgRef_SpinBox.h"
#include "SUIT_Session.h"
#include "SUIT_ViewWindow.h"
#include "SOCC_Prs.h"
#include "SOCC_ViewModel.h"
#include "SalomeApp_Tools.h"
// OCCT Includes
#include <AIS_AngleDimension.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <Geom_Plane.hxx>
#include <gce_MakePln.hxx>
#include <Precision.hxx>
// QT Includes
#include <qlineedit.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include "GEOMImpl_Types.hxx"
#include "utilities.h"
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
//=================================================================================
// class : MeasureGUI_AngleDlg()
// purpose : Constructs a MeasureGUI_AngleDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
MeasureGUI_AngleDlg::MeasureGUI_AngleDlg (GeometryGUI* GUI, QWidget* parent)
: MeasureGUI_Skeleton(GUI, parent, "MeasureGUI_AngleDlg")
{
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_ANGLE")));
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
setCaption(tr("GEOM_MEASURE_ANGLE_TITLE"));
// Widgets
GroupConstructors->setTitle(tr("GEOM_MEASURE_ANGLE_ANGLE"));
RadioButton1->setPixmap(image0);
myGrp = new MeasureGUI_2Sel1LineEdit_QTD(this, "myGrp");
myGrp->GroupBox1->setTitle(tr("GEOM_MEASURE_ANGLE_OBJ"));
myGrp->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
myGrp->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
myGrp->TextLabel3->setText(tr("GEOM_MEASURE_ANGLE_IS"));
myGrp->LineEdit3->setReadOnly(TRUE);
myGrp->PushButton1->setPixmap(image1);
myGrp->PushButton2->setPixmap(image1);
myGrp->LineEdit1->setReadOnly(true);
myGrp->LineEdit2->setReadOnly(true);
Layout1->addWidget(myGrp, 1, 0);
// Help page reference
myHelpFileName = "files/salome2_sp3_measuregui_functions.htm#Angle";
// Initialisation
Init();
}
//=================================================================================
// function : ~MeasureGUI_AngleDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
MeasureGUI_AngleDlg::~MeasureGUI_AngleDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void MeasureGUI_AngleDlg::Init()
{
mySelBtn = myGrp->PushButton1;
mySelEdit = myGrp->LineEdit1;
mySelBtn2 = myGrp->PushButton2;
mySelEdit2 = myGrp->LineEdit2;
myEditCurrentArgument = mySelEdit;
connect(mySelEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
globalSelection(GEOM_LINE);
MeasureGUI_Skeleton::Init();
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void MeasureGUI_AngleDlg::SelectionIntoArgument()
{
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
if (!testResult)
aSelectedObject = GEOM::GEOM_Object::_nil();
if (myEditCurrentArgument == mySelEdit)
myObj = aSelectedObject;
else
myObj2 = aSelectedObject;
processObject();
}
//=================================================================================
// function : processObject()
// purpose : Fill dialogs fields in accordance with myObj and myObj2
//=================================================================================
void MeasureGUI_AngleDlg::processObject()
{
myGrp->LineEdit1->setText(!myObj->_is_nil() ? GEOMBase::GetName(myObj ) : "");
myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
double anAngle = 0.;
if (getParameters(anAngle))
{
myGrp->LineEdit3->setText(DlgRef_SpinBox::PrintDoubleValue(anAngle));
redisplayPreview();
}
else
{
myGrp->LineEdit3->setText("");
erasePreview();
}
}
//=================================================================================
// function : getParameters()
// purpose : Get angle between objects
//=================================================================================
bool MeasureGUI_AngleDlg::getParameters (double& theAngle)
{
QString msg;
if (isValid(msg)) {
try {
theAngle = GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->GetAngle(myObj, myObj2);
}
catch(const SALOME::SALOME_Exception& e) {
SalomeApp_Tools::QtCatchCorbaException(e);
return false;
}
return getOperation()->IsDone();
}
return false;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void MeasureGUI_AngleDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if (send == mySelBtn) {
mySelEdit->setFocus();
myEditCurrentArgument = mySelEdit;
}
else {
mySelEdit2->setFocus();
myEditCurrentArgument = mySelEdit2;
}
globalSelection(GEOM_LINE);
SelectionIntoArgument();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void MeasureGUI_AngleDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if (send == mySelEdit)
myEditCurrentArgument = mySelEdit;
else
myEditCurrentArgument = mySelEdit2;
if (GEOMBase::SelectionByNameInDialogs(this, mySelEdit->text(), selectedIO()))
mySelEdit->setText(mySelEdit->text());
}
//=================================================================================
// function : buildPrs()
// purpose :
//=================================================================================
SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
{
double anAngle = 0.;
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
if (myObj->_is_nil() || myObj2->_is_nil() || !getParameters(anAngle) ||
vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
return 0;
if (anAngle > Precision::Angular())
{
try
{
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
TopoDS_Shape S1, S2;
if (GEOMBase::GetShape(myObj , S1, TopAbs_EDGE) &&
GEOMBase::GetShape(myObj2, S2, TopAbs_EDGE))
{
TopoDS_Edge anEdge1 = TopoDS::Edge(S1);
TopoDS_Edge anEdge2 = TopoDS::Edge(S2);
// Build a plane for angle dimension presentation {P11, P12, P3}
TopoDS_Vertex V11, V12, V21, V22;
TopExp::Vertices(anEdge1, V11, V12);
TopExp::Vertices(anEdge2, V21, V22);
gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1));
gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex (anEdge1));
gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2));
gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex (anEdge2));
// *P3
// \
// \
// *P22
// /
// /
// P11 / P12
// *-----/----------*
// \ /
// \ /
// *P21
gp_Pnt aP3 (aP22.XYZ() + aP11.XYZ() - aP21.XYZ());
gce_MakePln gce_MP (aP11, aP12, aP3);
Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value());
// Build the angle dimension presentation
QString aLabel;
aLabel.sprintf("%.1f", anAngle);
Handle(AIS_AngleDimension) anIO = new AIS_AngleDimension
(anEdge1, anEdge2, aPlane, anAngle * PI180,
TCollection_ExtendedString((Standard_CString)aLabel.latin1()));
SOCC_Prs* aPrs =
dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
if (aPrs)
aPrs->AddObject(anIO);
return aPrs;
}
}
catch(Standard_Failure)
{
}
}
return 0;
}
//=================================================================================
// function : isValid()
// purpose :
//=================================================================================
bool MeasureGUI_AngleDlg::isValid(QString& msg)
{
return MeasureGUI_Skeleton::isValid(msg) && !myObj2->_is_nil();
}

View File

@ -0,0 +1,75 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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
//
//
//
// File : MeasureGUI_AngleDlg.h
// Author : Julia DOROVSKIKH
// Module : GEOM
#ifndef DIALOGBOX_ANGLE_H
#define DIALOGBOX_ANGLE_H
#include "MeasureGUI_Skeleton.h"
class MeasureGUI_2Sel1LineEdit_QTD;
#if defined WNT && defined MEASUREGUI_EXPORTS
#define MEASUREGUI_EXPORT __declspec( dllexport )
#else
#define MEASUREGUI_EXPORT
#endif
//=================================================================================
// class : MeasureGUI_AngleDlg
// purpose :
//=================================================================================
class MEASUREGUI_EXPORT MeasureGUI_AngleDlg : public MeasureGUI_Skeleton
{
Q_OBJECT
public:
MeasureGUI_AngleDlg (GeometryGUI* GUI, QWidget* parent);
~MeasureGUI_AngleDlg();
protected:
// redefined from GEOMBase_Helper and MeasureGUI_Skeleton
virtual void processObject();
virtual SALOME_Prs* buildPrs();
virtual void SelectionIntoArgument();
virtual void LineEditReturnPressed();
virtual void SetEditCurrentArgument();
virtual bool isValid (QString& msg);
private:
void Init();
bool getParameters (double& theAngle);
private:
QLineEdit* myEditCurrentArgument;
QLineEdit* mySelEdit2;
QPushButton* mySelBtn2;
MeasureGUI_2Sel1LineEdit_QTD* myGrp;
GEOM::GEOM_Object_var myObj2;
};
#endif // DIALOGBOX_ANGLE_H

View File

@ -27,7 +27,7 @@
// $Header$
#include "MeasureGUI_DistanceDlg.h"
#include "MeasureGUI_2Sel1LineEdit_QTD.h"
#include "MeasureGUI_2Sel4LineEdit_QTD.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
#include "DlgRef_SpinBox.h"
@ -78,12 +78,18 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( GeometryGUI* GUI, QWidget* paren
GroupConstructors->setTitle( tr( "GEOM_DISTANCE" ) );
RadioButton1->setPixmap( image0 );
myGrp = new MeasureGUI_2Sel1LineEdit_QTD( this, "myGrp" );
myGrp = new MeasureGUI_2Sel4LineEdit_QTD( this, "myGrp" );
myGrp->GroupBox1->setTitle( tr( "GEOM_MINDIST_OBJ" ) );
myGrp->TextLabel1->setText( tr( "GEOM_OBJECT_I" ).arg( "1" ) );
myGrp->TextLabel2->setText( tr( "GEOM_OBJECT_I" ).arg( "2" ) );
myGrp->TextLabel3->setText( tr( "GEOM_LENGTH" ) );
myGrp->TextLabel4->setText( tr( "GEOM_DX" ) );
myGrp->TextLabel5->setText( tr( "GEOM_DY" ) );
myGrp->TextLabel6->setText( tr( "GEOM_DZ" ) );
myGrp->LineEdit3->setReadOnly( TRUE );
myGrp->LineEdit4->setReadOnly( TRUE );
myGrp->LineEdit5->setReadOnly( TRUE );
myGrp->LineEdit6->setReadOnly( TRUE );
myGrp->PushButton1->setPixmap( image1 );
myGrp->PushButton2->setPixmap( image1 );
myGrp->LineEdit1->setReadOnly( true );
@ -152,7 +158,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
//=================================================================================
// function : processObject()
// purpose : Fill dialogs fileds in accordance with myObj and myObj2
// purpose : Fill dialogs fields in accordance with myObj and myObj2
//=================================================================================
void MeasureGUI_DistanceDlg::processObject()
{
@ -161,14 +167,23 @@ void MeasureGUI_DistanceDlg::processObject()
gp_Pnt aPnt1, aPnt2;
double aDist = 0.;
if ( getParameters( aDist, aPnt1, aPnt2 ) )
if (getParameters(aDist, aPnt1, aPnt2))
{
myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( aDist ) );
gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ();
myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( aVec.X() ) );
myGrp->LineEdit5->setText( DlgRef_SpinBox::PrintDoubleValue( aVec.Y() ) );
myGrp->LineEdit6->setText( DlgRef_SpinBox::PrintDoubleValue( aVec.Z() ) );
redisplayPreview();
}
else
{
myGrp->LineEdit3->setText( "" );
myGrp->LineEdit4->setText( "" );
myGrp->LineEdit5->setText( "" );
myGrp->LineEdit6->setText( "" );
erasePreview();
}
}

View File

@ -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
//
//
//
@ -33,7 +33,7 @@
#include "MeasureGUI_Skeleton.h"
class MeasureGUI_2Sel1LineEdit_QTD;
class MeasureGUI_2Sel4LineEdit_QTD;
class gp_Pnt;
//=================================================================================
@ -70,7 +70,7 @@ private:
QLineEdit* mySelEdit2;
QPushButton* mySelBtn2;
MeasureGUI_2Sel1LineEdit_QTD* myGrp;
MeasureGUI_2Sel4LineEdit_QTD* myGrp;
GEOM::GEOM_Object_var myObj2;
};

View File

@ -12,9 +12,6 @@
<height>115</height>
</rect>
</property>
<property name="caption">
<string>MeasureGUI_2Sel1LineEdit_QTD</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
@ -37,9 +34,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string></string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
@ -64,6 +58,86 @@
<property name="spacing">
<number>6</number>
</property>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QPushButton" row="0" column="1">
<property name="name">
<cstring>PushButton1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="0" column="2">
<property name="name">
<cstring>LineEdit1</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QPushButton" row="1" column="1">
<property name="name">
<cstring>PushButton2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="1" column="2">
<property name="name">
<cstring>LineEdit2</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>TextLabel3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="2" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit3</cstring>
</property>
</widget>
<spacer row="3" column="2">
<property name="name">
<cstring>Spacer8</cstring>
@ -81,101 +155,6 @@
</size>
</property>
</spacer>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>TextLabel3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL3</string>
</property>
</widget>
<widget class="QLineEdit" row="2" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit3</cstring>
</property>
</widget>
<widget class="QLineEdit" row="1" column="2">
<property name="name">
<cstring>LineEdit2</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL2</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL1</string>
</property>
</widget>
<widget class="QPushButton" row="0" column="1">
<property name="name">
<cstring>PushButton1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLineEdit" row="0" column="2">
<property name="name">
<cstring>LineEdit1</cstring>
</property>
</widget>
<widget class="QPushButton" row="1" column="1">
<property name="name">
<cstring>PushButton2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string></string>
</property>
</widget>
</grid>
</widget>
</grid>

View File

@ -0,0 +1,219 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>MeasureGUI_2Sel4LineEdit_QTD</class>
<widget class="QWidget">
<property name="name">
<cstring>MeasureGUI_2Sel4LineEdit_QTD</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>129</width>
<height>163</height>
</rect>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QGroupBox" row="0" column="0">
<property name="name">
<cstring>GroupBox1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>Layout1</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QPushButton" row="0" column="1">
<property name="name">
<cstring>PushButton1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="0" column="2">
<property name="name">
<cstring>LineEdit1</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QPushButton" row="1" column="1">
<property name="name">
<cstring>PushButton2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="1" column="2">
<property name="name">
<cstring>LineEdit2</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>TextLabel3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="2" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit3</cstring>
</property>
</widget>
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>TextLabel4</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="3" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit4</cstring>
</property>
</widget>
<widget class="QLabel" row="4" column="0">
<property name="name">
<cstring>TextLabel5</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="4" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit5</cstring>
</property>
</widget>
<widget class="QLabel" row="5" column="0">
<property name="name">
<cstring>TextLabel6</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="5" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit6</cstring>
</property>
</widget>
<spacer row="6" column="2">
<property name="name">
<cstring>Spacer8</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
</spacer>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -34,5 +34,8 @@ uic -o MeasureGUI_1Sel12LineEdit_QTD.cxx -impl MeasureGUI_1Sel12LineEdit_QTD.h M
uic -o MeasureGUI_2Sel1LineEdit_QTD.h MeasureGUI_2Sel1LineEdit_QTD.ui
uic -o MeasureGUI_2Sel1LineEdit_QTD.cxx -impl MeasureGUI_2Sel1LineEdit_QTD.h MeasureGUI_2Sel1LineEdit_QTD.ui
uic -o MeasureGUI_2Sel4LineEdit_QTD.h MeasureGUI_2Sel4LineEdit_QTD.ui
uic -o MeasureGUI_2Sel4LineEdit_QTD.cxx -impl MeasureGUI_2Sel4LineEdit_QTD.h MeasureGUI_2Sel4LineEdit_QTD.ui
#uic -o MeasureGUI_1Sel1TextView_QTD.h MeasureGUI_1Sel1TextView_QTD.ui
#uic -o MeasureGUI_1Sel1TextView_QTD.cxx -impl MeasureGUI_1Sel1TextView_QTD.h MeasureGUI_1Sel1TextView_QTD.ui