-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// OCCT Includes
#include <Geom_Plane.hxx>
#include <AIS_LengthDimension.hxx>
-#include <AIS_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
myEditCurrentArgument = myGrp->LineEdit1;
myDbls = new GEOM::ListOfDouble();
+ myGrp->LineEdit1->setEnabled(true);
+ myGrp->LineEdit2->setEnabled(false);
+
+ myObj1.nullify();
+ myObj2.nullify();
+
// signals and slots connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
- globalSelection();
+ activateSelection();
SelectionIntoArgument();
}
return false;
initName();
+ activateSelection();
return true;
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
- globalSelection();
+ activateSelection();
redisplayPreview();
}
//=================================================================================
void MeasureGUI_DistanceDlg::SelectionIntoArgument()
{
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
-
- GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
-
- if (aSelList.Extent() > 0) {
- aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
- }
+ QList<TopAbs_ShapeEnum> aTypes;
+ aTypes << TopAbs_VERTEX << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPSOLID << TopAbs_COMPOUND << TopAbs_SHAPE;
+ GEOM::GeomObjPtr aSelectedObject = getSelected( aTypes );
// clear selection
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
if (myEditCurrentArgument == myGrp->LineEdit1) {
myObj1 = aSelectedObject;
- if (!myObj1->_is_nil() && myObj2->_is_nil())
+ if (myObj1 && !myObj2)
myGrp->PushButton2->click();
}
else {
myObj2 = aSelectedObject;
- if (!myObj2->_is_nil() && myObj1->_is_nil())
+ if (myObj2 && !myObj1)
myGrp->PushButton1->click();
}
//=================================================================================
void MeasureGUI_DistanceDlg::processObject()
{
- myGrp->LineEdit1->setText(!myObj1->_is_nil() ? GEOMBase::GetName(myObj1) : "");
- myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
+ myGrp->LineEdit1->setText(myObj1 ? GEOMBase::GetName(myObj1.get()) : "");
+ myGrp->LineEdit2->setText(myObj2 ? GEOMBase::GetName(myObj2.get()) : "");
myGrp->ComboBox1->clear();
myDbls->length(0);
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
try {
- nbSols = anOper->ClosestPoints(myObj1, myObj2, myDbls);
+ nbSols = anOper->ClosestPoints(myObj1.get(), myObj2.get(), myDbls);
}
catch (const SALOME::SALOME_Exception& e) {
SalomeApp_Tools::QtCatchCorbaException(e);
int currSol = myGrp->ComboBox1->currentIndex();
- if (myObj1->_is_nil() || myObj2->_is_nil() ||
+ if (!myObj1 || !myObj2 ||
currSol == -1 || (currSol+1)*6 > myDbls->length() ||
vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
return 0;
//=================================================================================
bool MeasureGUI_DistanceDlg::isValid (QString& msg)
{
- return !myObj1->_is_nil() && !myObj2->_is_nil();
+ return myObj1 && myObj2;
}
//=================================================================================
GEOM::GEOM_IBasicOperations_var aBasicOper = getGeomEngine()->GetIBasicOperations(getStudyId());
GEOM::ListOfDouble_var aDbls;
- int nbSols = anOper->ClosestPoints(myObj1, myObj2, aDbls);
+ int nbSols = anOper->ClosestPoints(myObj1.get(), myObj2.get(), aDbls);
if (anOper->IsDone()) {
bool doPublishAll = true;
return true;
}
+//=================================================================================
+// function : activateSelection()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::activateSelection()
+{
+ globalSelection( GEOM_ALLSHAPES );
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_SHAPE ), needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE );
+ needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL );
+ needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPSOLID ), needTypes.push_back( TopAbs_COMPOUND );
+ localSelection(GEOM::GEOM_Object::_nil(), needTypes );
+}
+
//=================================================================================
// function : redisplayPreview()
// purpose :
QString MeasureGUI_DistanceDlg::getNewObjectName (int currObj) const
{
QString aName = tr("GEOM_MINDIST_NAME") + QString("_%1_").arg((currObj+1)/2);
- aName += GEOMBase::GetName(currObj%2 ? myObj1 : myObj2);
+ aName += GEOMBase::GetName(currObj%2 ? myObj1.get() : myObj2.get());
return aName;
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void MeasureGUI_DistanceDlg::addSubshapesToStudy()
+{
+ GEOMBase::PublishSubObject( myObj1.get() );
+ GEOMBase::PublishSubObject( myObj2.get() );
+}
+
//=================================================================================
// function : MeasureGUI_DistanceGroup
// purpose :