// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "GenerationGUI_PipeDlg.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+
+#include <qlabel.h>
+
#include <TopoDS_Edge.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#if OCC_VERSION_MAJOR >= 5
#include "GEOMImpl_Types.hxx"
-#include "QAD_Desktop.h"
#include "utilities.h"
//=================================================================================
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
- :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
+ const char* name, bool modal, WFlags fl)
+ :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PIPE")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+ QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE")));
+ QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_PIPE_TITLE"));
Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/
+ setHelpFileName("pipe_creation.htm");
+
/* Initialisations */
Init();
}
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName(tr("GEOM_PIPE"));
- globalSelection( GEOM_ALLSHAPES );
+ // globalSelection( GEOM_ALLSHAPES );
}
erasePreview();
myEditCurrentArgument->setText("");
- if(mySelection->IObjectCount() != 1) {
+ if(IObjectCount() != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkBase = false;
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
// nbSel == 1
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult );
+ GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
if (!testResult)
return;
return;
myBase = aSelectedObject;
+ myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
myOkBase = true;
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
myOkPath = false;
- if(!GEOMBase::GetShape(aSelectedObject, S) ||
- !(S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) )
+ if( !GEOMBase::GetShape(aSelectedObject, S) )
return;
+
+ QString aName = GEOMBase::GetName( aSelectedObject );
- myPath = aSelectedObject;
- myOkPath = true;
+ if ( testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase)
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+
+ aSelMgr->GetIndexes( firstIObject(), aMap );
+ if ( aMap.Extent() == 1 )
+ {
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ int anIndex = aMap( 1 );
+ myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aName.append( ":edge_" + QString::number( anIndex ) );
+ myOkPath = true;
+ aSelMgr->clearSelected();
+ }
+ else {
+ myOkPath = true;
+ if (S.ShapeType() != TopAbs_EDGE) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOkPath = false;
+ }
+ myPath = aSelectedObject;
+ }
+ }
+ myEditCurrentArgument->setText( aName );
}
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview();
}
void GenerationGUI_PipeDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
+ globalSelection( GEOM_ALLSHAPES );
myEditCurrentArgument = GroupPoints->LineEdit1;
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
+ globalSelection();
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
SelectionIntoArgument();
}
{
GEOMBase_Skeleton::ActivateThisDialog();
globalSelection( GEOM_ALLSHAPES );
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
displayPreview();
}