2007-10-22 20:18:10 +06:00
|
|
|
// GEOM GEOMGUI : GUI for Geometry component
|
2004-01-07 20:46:21 +05:00
|
|
|
//
|
2007-10-22 20:18:10 +06:00
|
|
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
2004-12-01 15:39:14 +05:00
|
|
|
//
|
2007-10-22 20:18:10 +06:00
|
|
|
// 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.
|
2004-12-01 15:39:14 +05:00
|
|
|
//
|
2007-10-22 20:18:10 +06:00
|
|
|
// 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.
|
2004-12-01 15:39:14 +05:00
|
|
|
//
|
2007-10-22 20:18:10 +06:00
|
|
|
// 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
|
2004-12-01 15:39:14 +05:00
|
|
|
//
|
2006-06-01 17:32:40 +06:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2004-01-07 20:46:21 +05:00
|
|
|
//
|
2007-10-22 20:18:10 +06:00
|
|
|
// File : MeasureGUI_DistanceDlg.cxx
|
|
|
|
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
|
2004-01-07 20:46:21 +05:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "MeasureGUI_DistanceDlg.h"
|
2007-10-22 20:18:10 +06:00
|
|
|
#include "MeasureGUI_Widgets.h"
|
|
|
|
|
2008-02-06 20:43:50 +05:00
|
|
|
#include <DlgRef.h>
|
2008-09-29 19:36:48 +06:00
|
|
|
#include <GEOMBase.h>
|
2008-09-15 14:14:51 +06:00
|
|
|
#include <GeometryGUI.h>
|
|
|
|
|
2007-10-22 20:18:10 +06:00
|
|
|
#include <SUIT_Session.h>
|
|
|
|
#include <SUIT_Desktop.h>
|
|
|
|
#include <SUIT_ResourceMgr.h>
|
|
|
|
#include <SUIT_ViewWindow.h>
|
|
|
|
#include <SUIT_ViewManager.h>
|
|
|
|
#include <SOCC_Prs.h>
|
|
|
|
#include <SOCC_ViewModel.h>
|
|
|
|
#include <SalomeApp_Tools.h>
|
2008-09-15 14:14:51 +06:00
|
|
|
#include <SalomeApp_Application.h>
|
|
|
|
#include <LightApp_SelectionMgr.h>
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
// OCCT Includes
|
2004-01-07 20:46:21 +05:00
|
|
|
#include <Geom_Plane.hxx>
|
|
|
|
#include <AIS_LengthDimension.hxx>
|
|
|
|
#include <BRepBuilderAPI_MakeEdge.hxx>
|
|
|
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
|
|
|
#include <gce_MakePln.hxx>
|
|
|
|
#include <Precision.hxx>
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// class : MeasureGUI_DistanceDlg()
|
2004-12-01 15:39:14 +05:00
|
|
|
// purpose : Constructs a MeasureGUI_DistanceDlg which is a child of 'parent', with the
|
2004-01-07 20:46:21 +05:00
|
|
|
// name 'name' and widget flags set to 'f'.
|
|
|
|
// The dialog will by default be modeless, unless you set 'modal' to
|
2007-10-22 20:18:10 +06:00
|
|
|
// true to construct a modal dialog.
|
2004-01-07 20:46:21 +05:00
|
|
|
//=================================================================================
|
2008-09-29 19:36:48 +06:00
|
|
|
MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* parent)
|
|
|
|
: MeasureGUI_Skeleton(GUI, parent)
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2008-09-29 19:36:48 +06:00
|
|
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
|
|
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MINDIST")));
|
|
|
|
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
setWindowTitle(tr("GEOM_MINDIST_TITLE"));
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
/***************************************************************/
|
2008-09-29 19:36:48 +06:00
|
|
|
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DISTANCE"));
|
|
|
|
mainFrame()->RadioButton1->setIcon(image0);
|
|
|
|
|
|
|
|
myGrp = new MeasureGUI_2Sel4LineEdit(centralWidget());
|
|
|
|
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->PushButton1->setIcon(image1);
|
|
|
|
myGrp->PushButton2->setIcon(image1);
|
|
|
|
myGrp->LineEdit1->setReadOnly(true);
|
|
|
|
myGrp->LineEdit2->setReadOnly(true);
|
|
|
|
myGrp->LineEdit4->setReadOnly(true);
|
|
|
|
myGrp->LineEdit5->setReadOnly(true);
|
|
|
|
myGrp->LineEdit6->setReadOnly(true);
|
|
|
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
|
|
|
layout->setMargin(0); layout->setSpacing(6);
|
|
|
|
layout->addWidget(myGrp);
|
2004-01-07 20:46:21 +05:00
|
|
|
/***************************************************************/
|
|
|
|
|
2008-02-06 20:43:50 +05:00
|
|
|
myHelpFileName = "using_measurement_tools_page.html#min_distance_anchor";
|
2006-05-06 14:44:32 +06:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
// Initialisation
|
2005-06-02 13:17:09 +06:00
|
|
|
Init();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ~MeasureGUI_DistanceDlg()
|
|
|
|
// purpose : Destroys the object and frees any allocated resources
|
|
|
|
//=================================================================================
|
|
|
|
MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg()
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : Init()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2005-06-02 13:17:09 +06:00
|
|
|
void MeasureGUI_DistanceDlg::Init()
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2008-09-29 19:36:48 +06:00
|
|
|
// init variables
|
|
|
|
myGrp->LineEdit1->setText("");
|
|
|
|
myGrp->LineEdit2->setText("");
|
|
|
|
myObj = myObj2 = GEOM::GEOM_Object::_nil();
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
mySelBtn = myGrp->PushButton1;
|
|
|
|
mySelEdit = myGrp->LineEdit1;
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
myEditCurrentArgument = myGrp->LineEdit1;
|
|
|
|
|
|
|
|
// signals and slots connections
|
|
|
|
connect(myGrp->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
|
|
|
connect(myGrp->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2005-06-02 13:17:09 +06:00
|
|
|
MeasureGUI_Skeleton::Init();
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=================================================================================
|
|
|
|
// function : SelectionIntoArgument()
|
|
|
|
// purpose : Called when selection has changed
|
|
|
|
//=================================================================================
|
|
|
|
void MeasureGUI_DistanceDlg::SelectionIntoArgument()
|
|
|
|
{
|
2008-09-15 14:14:51 +06:00
|
|
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
|
|
|
SALOME_ListIO aSelList;
|
|
|
|
aSelMgr->selectedObjects(aSelList);
|
|
|
|
|
2008-09-26 17:23:35 +06:00
|
|
|
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
|
|
|
|
|
|
|
|
if (aSelList.Extent() > 0) {
|
|
|
|
Standard_Boolean testResult = Standard_False;
|
|
|
|
aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
|
|
|
if (!testResult)
|
|
|
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
// clear selection
|
|
|
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
|
|
|
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
|
|
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
|
|
|
this, SLOT(SelectionIntoArgument()));
|
|
|
|
|
|
|
|
if (myEditCurrentArgument == myGrp->LineEdit1) {
|
2007-10-22 20:18:10 +06:00
|
|
|
myObj = aSelectedObject;
|
2008-09-29 19:36:48 +06:00
|
|
|
if (!myObj->_is_nil() && myObj2->_is_nil())
|
|
|
|
myGrp->PushButton2->click();
|
|
|
|
}
|
|
|
|
else {
|
2007-10-22 20:18:10 +06:00
|
|
|
myObj2 = aSelectedObject;
|
2008-09-29 19:36:48 +06:00
|
|
|
if (!myObj2->_is_nil() && myObj->_is_nil())
|
|
|
|
myGrp->PushButton1->click();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
processObject();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
// function : processObject()
|
2008-02-06 20:43:50 +05:00
|
|
|
// purpose : Fill dialogs fields in accordance with myObj and myObj2
|
2004-01-07 20:46:21 +05:00
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
void MeasureGUI_DistanceDlg::processObject()
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2008-09-29 19:36:48 +06:00
|
|
|
myGrp->LineEdit1->setText(!myObj->_is_nil() ? GEOMBase::GetName(myObj ) : "");
|
|
|
|
myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
gp_Pnt aPnt1, aPnt2;
|
|
|
|
double aDist = 0.;
|
2008-09-29 19:36:48 +06:00
|
|
|
if (getParameters(aDist, aPnt1, aPnt2)) {
|
|
|
|
myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist));
|
2008-02-06 20:43:50 +05:00
|
|
|
|
|
|
|
gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ();
|
2008-09-29 19:36:48 +06:00
|
|
|
myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X()));
|
|
|
|
myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y()));
|
|
|
|
myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z()));
|
2008-02-06 20:43:50 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
redisplayPreview();
|
|
|
|
}
|
2007-10-22 20:18:10 +06:00
|
|
|
else {
|
2008-09-29 19:36:48 +06:00
|
|
|
myGrp->LineEdit3->setText("");
|
|
|
|
myGrp->LineEdit4->setText("");
|
|
|
|
myGrp->LineEdit5->setText("");
|
|
|
|
myGrp->LineEdit6->setText("");
|
2004-12-01 15:39:14 +05:00
|
|
|
erasePreview();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
// function : getParameters()
|
|
|
|
// purpose : Get distance between objects
|
2004-01-07 20:46:21 +05:00
|
|
|
//=================================================================================
|
2008-09-29 19:36:48 +06:00
|
|
|
bool MeasureGUI_DistanceDlg::getParameters (double& theDistance,
|
2004-12-01 15:39:14 +05:00
|
|
|
gp_Pnt& thePnt1,
|
2008-09-29 19:36:48 +06:00
|
|
|
gp_Pnt& thePnt2)
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
QString msg;
|
2008-09-29 19:36:48 +06:00
|
|
|
if (isValid(msg)) {
|
2007-10-22 20:18:10 +06:00
|
|
|
try {
|
2004-12-01 15:39:14 +05:00
|
|
|
double x1, y1, z1, x2, y2, z2;
|
2008-09-29 19:36:48 +06:00
|
|
|
theDistance = GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->
|
|
|
|
GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
thePnt1.SetCoord(x1, y1, z1);
|
|
|
|
thePnt2.SetCoord(x2, y2, z2);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-09-29 19:36:48 +06:00
|
|
|
catch(const SALOME::SALOME_Exception& e) {
|
|
|
|
SalomeApp_Tools::QtCatchCorbaException(e);
|
2004-12-01 15:39:14 +05:00
|
|
|
return false;
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
return getOperation()->IsDone();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
return false;
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SetEditCurrentArgument()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void MeasureGUI_DistanceDlg::SetEditCurrentArgument()
|
|
|
|
{
|
2008-09-29 19:36:48 +06:00
|
|
|
QPushButton* send = (QPushButton*)sender();
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
if (send == myGrp->PushButton1) {
|
|
|
|
myEditCurrentArgument = myGrp->LineEdit1;
|
|
|
|
|
|
|
|
myGrp->PushButton2->setDown(false);
|
|
|
|
myGrp->LineEdit2->setEnabled(false);
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
2007-10-22 20:18:10 +06:00
|
|
|
else {
|
2008-09-29 19:36:48 +06:00
|
|
|
myEditCurrentArgument = myGrp->LineEdit2;
|
|
|
|
|
|
|
|
myGrp->PushButton1->setDown(false);
|
|
|
|
myGrp->LineEdit1->setEnabled(false);
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
// enable line edit
|
|
|
|
myEditCurrentArgument->setEnabled(true);
|
|
|
|
myEditCurrentArgument->setFocus();
|
|
|
|
// after setFocus(), because it will be setDown(false) when loses focus
|
|
|
|
send->setDown(true);
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
|
|
|
redisplayPreview();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : LineEditReturnPressed()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void MeasureGUI_DistanceDlg::LineEditReturnPressed()
|
|
|
|
{
|
2008-09-29 19:36:48 +06:00
|
|
|
QLineEdit* send = (QLineEdit*)sender();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
if (send == myGrp->LineEdit1 || send == myGrp->LineEdit2) {
|
|
|
|
myEditCurrentArgument = send;
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
|
|
|
SALOME_ListIO aSelList;
|
|
|
|
aSelMgr->selectedObjects(aSelList);
|
2008-09-15 14:14:51 +06:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
if (GEOMBase::SelectionByNameInDialogs(this, myGrp->LineEdit1->text(), aSelList))
|
|
|
|
myGrp->LineEdit1->setText(myGrp->LineEdit1->text());
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
// function : buildPrs()
|
2004-01-07 20:46:21 +05:00
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
double aDist = 0.;
|
2008-09-29 19:36:48 +06:00
|
|
|
gp_Pnt aPnt1(0, 0, 0), aPnt2(0, 0, 0);
|
2008-02-06 20:43:50 +05:00
|
|
|
|
|
|
|
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
if (myObj->_is_nil() || myObj2->_is_nil() ||
|
|
|
|
!getParameters(aDist, aPnt1, aPnt2) ||
|
|
|
|
vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
|
2004-12-01 15:39:14 +05:00
|
|
|
return 0;
|
2008-09-29 19:36:48 +06:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
try
|
|
|
|
{
|
2008-09-29 19:36:48 +06:00
|
|
|
if (aDist <= 1.e-9) {
|
|
|
|
BRepBuilderAPI_MakeVertex aMaker(aPnt1);
|
|
|
|
return getDisplayer()->BuildPrs(aMaker.Vertex());
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2007-10-22 20:18:10 +06:00
|
|
|
else {
|
2008-09-29 19:36:48 +06:00
|
|
|
BRepBuilderAPI_MakeEdge MakeEdge(aPnt1, aPnt2);
|
|
|
|
TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(aPnt1);
|
|
|
|
TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(aPnt2);
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
QString aLabel;
|
2008-09-29 19:36:48 +06:00
|
|
|
aLabel.sprintf("%.1f", aDist);
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
gp_Pnt aPnt3((aPnt1.X() + aPnt2.X()) / 2,
|
|
|
|
(aPnt1.Y() + aPnt2.Y()) / 2,
|
|
|
|
(aPnt1.Z() + aPnt2.Z()) / 2 + 100);
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
gp_Vec va(aPnt3, aPnt1);
|
|
|
|
gp_Vec vb(aPnt3, aPnt2);
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
if (va.IsParallel(vb, Precision::Angular())) {
|
|
|
|
aPnt3.SetY((aPnt1.Y() + aPnt2.Y()) / 2 + 100);
|
|
|
|
aPnt3.SetZ((aPnt1.Z() + aPnt2.Z()) / 2);
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
gce_MakePln gce_MP(aPnt1, aPnt2, aPnt3);
|
|
|
|
Handle(Geom_Plane) P = new Geom_Plane(gce_MP.Value());
|
|
|
|
|
|
|
|
Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension(
|
|
|
|
aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
|
|
|
|
anIO->SetArrowSize(aDist/20);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-09-29 19:36:48 +06:00
|
|
|
if (aPrs)
|
|
|
|
aPrs->AddObject(anIO);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
return aPrs;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
}
|
2008-09-29 19:36:48 +06:00
|
|
|
catch(Standard_Failure) {
|
2004-12-01 15:39:14 +05:00
|
|
|
return 0;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
// function : isValid()
|
2004-01-07 20:46:21 +05:00
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2008-09-29 19:36:48 +06:00
|
|
|
bool MeasureGUI_DistanceDlg::isValid (QString& msg)
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2008-09-29 19:36:48 +06:00
|
|
|
return MeasureGUI_Skeleton::isValid(msg) && !myObj2->_is_nil();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|