--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : BooleanGUI.cxx
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+using namespace std;
+#include "BooleanGUI.h"
+
+#include "QAD_Application.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
+#include "GeometryGUI_FuseDlg.h" // Method FUSE
+#include "GeometryGUI_CommonDlg.h" // Method COMMON
+#include "GeometryGUI_CutDlg.h" // Method CUT
+#include "GeometryGUI_SectionDlg.h" // Method SECTION
+
+//=======================================================================
+// function : BooleanGUI()
+// purpose : Constructor
+//=======================================================================
+BooleanGUI::BooleanGUI() :
+ QObject()
+{
+ myGeomGUI = GeometryGUI::GetGeometryGUI();
+ Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
+ myGeom = GEOM::GEOM_Gen::_narrow(comp);
+}
+
+
+//=======================================================================
+// function : ~BooleanGUI()
+// purpose : Destructor
+//=======================================================================
+BooleanGUI::~BooleanGUI()
+{
+}
+
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+{
+ myGeomGUI->EmitSignalDeactivateDialog();
+ SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
+
+ switch (theCommandID)
+ {
+ case 4011: // FUSE
+ {
+ GeometryGUI_FuseDlg *aDlg = new GeometryGUI_FuseDlg(parent, "", this, Sel);
+ break;
+ }
+ case 4012: // COMMON
+ {
+ GeometryGUI_CommonDlg *aDlg = new GeometryGUI_CommonDlg(parent, "", this, Sel);
+ break;
+ }
+ case 4013: // CUT
+ {
+ GeometryGUI_CutDlg *aDlg = new GeometryGUI_CutDlg(parent, "", this, Sel);
+ break;
+ }
+ case 4014: // SECTION
+ {
+ GeometryGUI_SectionDlg *aDlg = new GeometryGUI_SectionDlg(parent, "", this, Sel);
+ break;
+ }
+ default:
+ {
+ parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
+ break;
+ }
+ }
+ return true;
+}
+
+
+//=======================================================================
+// function : MakeBooleanAndDisplay()
+// purpose :
+//=======================================================================
+void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, const short operation)
+{
+ try {
+ GEOM::GEOM_Shape_ptr result = myGeom->MakeBoolean(Shape1, Shape2, operation);
+ if(result->_is_nil()) {
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
+ return;
+ }
+
+ TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
+ Standard_CString type;
+ myGeomGUI->GetShapeTypeString(S,type);
+ result->NameType(type);
+
+ if (myGeomGUI->Display(result, ""))
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ return;
+}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : BooleanGUI.h
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#ifndef BOOLEANGUI_H
+#define BOOLEANGUI_H
+
+#include "GeometryGUI.h"
+
+//=================================================================================
+// class : BooleanGUI
+// purpose :
+//=================================================================================
+class BooleanGUI : public QObject
+{
+ Q_OBJECT /* for QT compatibility */
+
+public :
+ BooleanGUI();
+ ~BooleanGUI();
+
+ bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
+
+ void MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1,
+ GEOM::GEOM_Shape_ptr Shape2,
+ const short operation);
+
+private:
+ GeometryGUI* myGeomGUI;
+ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
+
+};
+
+#endif
#include "VTKViewer_RenderWindowInteractor.h"
#include "VTKViewer_ViewFrame.h"
#include "GEOM_Actor.h"
-#include "GEOM_Client.hxx"
+//#include "GEOM_Client.hxx"
#include "GEOM_AISShape.hxx"
#include "GEOM_AssemblyBuilder.h"
#include "GEOM_InteractiveObject.hxx"
#include "GeometryGUI_aParameterDlg.h"
#include "GeometryGUI_PointDlg.h" // Method POINT
-#include "GeometryGUI_BoxDlg.h" // Method BOX
+
#include "GeometryGUI_VectorDlg.h" // Method VECTOR
#include "GeometryGUI_PlaneDlg.h" // Method PLANE
#include "GeometryGUI_PrismDlg.h" // Method PRISM
-#include "GeometryGUI_FuseDlg.h" // Method FUSE
-#include "GeometryGUI_CommonDlg.h" // Method COMMON
-#include "GeometryGUI_CutDlg.h" // Method CUT
-#include "GeometryGUI_SectionDlg.h" // Method SECTION
-
#include "GeometryGUI_LineDlg.h" // Method LINE
#include "GeometryGUI_ScaleDlg.h" // Method SCALE
#include "GeometryGUI_MirrorDlg.h" // Method MIRROR
-#include "GeometryGUI_SphereDlg.h" // Method SPHERE
+
#include "GeometryGUI_CircleDlg.h" // Method CIRCLE
#include "GeometryGUI_EllipseDlg.h" // Method ELLIPSE
#include "GeometryGUI_RevolDlg.h" // Method REVOL
#include "GeometryGUI_MultiRotationDlg.h" // Method MULTI ROTATION
#include "GeometryGUI_ArcDlg.h" // Method ARC
#include "GeometryGUI_PipeDlg.h" // Method PIPE
-#include "GeometryGUI_CylinderDlg.h" // Method CYLINDER
-#include "GeometryGUI_ConeDlg.h" // Method CONE
-#include "GeometryGUI_TorusDlg.h" // Method TORUS
#include "GeometryGUI_FillingDlg.h" // Method FILLING
#include "GeometryGUI_SewingDlg.h" // Method SEWING
#include "GeometryGUI_CompoundDlg.h" // Method GEOM::COMPOUND
#include "GeometryGUI_DistanceDlg.h" // Method DISTANCE
#include "GeometryGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE
+#include "BooleanGUI.h"
+#include "PrimitiveGUI.h"
static Handle(AIS_Shape) theConstructionShape = new AIS_Shape(TopoDS_Shape());
static Handle(GEOM_AISShape) theSelectedShape = new GEOM_AISShape(TopoDS_Shape(), "");
-static AIS_ListOfInteractive ListDisplayedObject;
-
-static bool Settings_AddInStudy = false;
-static bool Settings_Copy = false;
-static Standard_CString Fatherior = "";
-static GEOM_Client ShapeReader;
-
/* The object itself created in the static method 'GetOrCreateGeometryGUI()' */
static GeometryGUI* GeomGUI = 0;
-
//=======================================================================
// class : CustomItem
// purpose : Set Font to a text.
GeometryGUI::GeometryGUI() :
QObject()
{
+ mySettings_AddInStudy = false;
+ mySettings_Copy = false;
+ myFatherior = "";
}
//=======================================================================
/* study may have changed */
GeomGUI->myActiveStudy = desktop->getActiveStudy();
}
+
return GeomGUI;
}
Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
/* case SObject */
if ( IO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
Standard_Boolean& testResult,
bool onlyInActiveView )
{
- int nbSf = GeomGUI->myActiveStudy->getStudyFramesCount();
+ int nbSf = myActiveStudy->getStudyFramesCount();
for ( int i = 0; i < nbSf; i++ ) {
QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i);
if ( sf->getTypeView() == VIEW_VTK ) {
Standard_CString theIOR = GIO->getIOR();
if ( strcmp( IOR, theIOR ) == 0 ) {
if ( onlyInActiveView ) {
- if ( sf == GeomGUI->myActiveStudy->getActiveStudyFrame() ) {
+ if ( sf == myActiveStudy->getActiveStudyFrame() ) {
testResult = true;
return anActor;
}
/* case SObject */
if ( IO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
if ( IObject->hasEntry() )
{
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
//=================================================================================
bool GeometryGUI::CreateArrowForLinearEdge( const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone )
{
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE )
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE )
return false;
OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort();
}
-//=======================================================================
-// function : MakeBoxAndDisplay()
-// purpose :
-//=======================================================================
-void GeometryGUI::MakeBoxAndDisplay( const gp_Pnt P1, const gp_Pnt P2 )
-{
- try {
- GEOM::GEOM_Shape_var box = myComponentGeom->MakeBox( P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z() );
- box->NameType(tr("GEOM_BOX"));
- if ( Display( box, "") ) {
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
-}
+
//=======================================================================
void GeometryGUI::MakeWorkingPlane( const gp_Pnt P, const gp_Dir D)
{
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_OCC) {
- GeomGUI->myDesktop->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_OCC) {
+ myDesktop->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ;
return ;
}
OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort();
return ;
}
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, result);
Standard_CString type;
GetShapeTypeString(S,type);
result->NameType( type );
-//=======================================================================
-// function : MakeBooleanAndDisplay()
-// purpose :
-//=======================================================================
-void GeometryGUI::MakeBooleanAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, const short operation )
-{
- try {
- GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeBoolean( Shape1, Shape2, operation ) ;
- if (result->_is_nil()) {
- myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ;
- return ;
- }
-
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
- Standard_CString type;
- GetShapeTypeString(S,type);
- result->NameType( type );
-
- if ( Display( result, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
- return ;
-}
-
-//=====================================================================================
-// function : MakeSphere()
-// purpose :
-//=====================================================================================
-void GeometryGUI::MakeSphereAndDisplay( const gp_Pnt aCenterPoint, const double aRadius )
-{
- try {
- if( aRadius <= Precision::Confusion() ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("GEOM_WRN_WARNING"),
- tr ("GEOM_WRN_RADIUS_NULL"), tr ("GEOM_BUT_YES") );
- return ;
- }
- GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius);
- result->NameType(tr("GEOM_SPHERE"));
- if ( Display( result, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
- return ;
-}
-//=====================================================================================
-// function : MakeConeAndDisplay()
-// purpose :
-//=====================================================================================
-void GeometryGUI::MakeConeAndDisplay( const gp_Pnt BasePoint,
- const gp_Dir aDir,
- const double Radius1,
- const double Radius2,
- const double aHeight )
-{
- try {
- if( ( Radius1 <= Precision::Confusion() && Radius2 <= Precision::Confusion() ) || aHeight <= Precision::Confusion() )
- return ;
- GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( BasePoint.X(), BasePoint.Y(), BasePoint.Z() ) ;
- GEOM::PointStruct d = myComponentGeom->MakePointStruct( aDir.X(), aDir.Y(), aDir.Z() ) ;
- GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ;
-
- GEOM::GEOM_Shape_var result = myComponentGeom->MakeCone( pstruct, dstruct, Radius1, Radius2, aHeight ) ;
- if ( result->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
- return ;
- }
- result->NameType(tr("GEOM_CONE"));
- if ( Display( result, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
- return ;
-}
-//=====================================================================================
-// function : MakeCylinderAndDisplay()
-// purpose :
-//=====================================================================================
-void GeometryGUI::MakeCylinderAndDisplay( const gp_Pnt BasePoint,
- const gp_Dir aDir,
- const double Radius,
- const double aHeight )
-{
- try {
- if( Radius <= Precision::Confusion() || aHeight <= Precision::Confusion() )
- return ;
- GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( BasePoint.X(), BasePoint.Y(), BasePoint.Z() ) ;
- GEOM::PointStruct d = myComponentGeom ->MakePointStruct( aDir.X(), aDir.Y(), aDir.Z() ) ;
- GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ;
-
- GEOM::GEOM_Shape_var result = myComponentGeom->MakeCylinder(pstruct, dstruct, Radius, aHeight) ;
- if ( result->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
- return ;
- }
- result->NameType(tr("GEOM_CYLINDER"));
- if ( Display( result, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
- return ;
-}
-//=====================================================================================
-// function : MakeTorusAndDisplay()
-// purpose :
-//=====================================================================================
-void GeometryGUI::MakeTorusAndDisplay( const gp_Pnt BasePoint,
- const gp_Dir aDir,
- const double Radius1,
- const double Radius2 )
-{
- try {
- if( Radius1 <= Precision::Confusion() || Radius2 <= Precision::Confusion() )
- return ;
-
- GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( BasePoint.X(), BasePoint.Y(), BasePoint.Z() ) ;
- GEOM::PointStruct d = myComponentGeom ->MakePointStruct( aDir.X(), aDir.Y(), aDir.Z() ) ;
- GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ;
-
- GEOM::GEOM_Shape_var result = myComponentGeom->MakeTorus(pstruct, dstruct, Radius1, Radius2) ;
- if ( result->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
- return ;
- }
- result->NameType(tr("GEOM_TORUS"));
- if ( Display( result, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
- return ;
-}
//=====================================================================================
GEOM::GEOM_Shape_ptr result = myComponentGeom->MakePipe(aPath, aBase);
if ( !result->_is_nil() && Display( result, "") ) {
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, result);
Standard_CString type;
GetShapeTypeString(S,type);
result->NameType( type );
return ;
}
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, result);
Standard_CString type;
GetShapeTypeString(S,type);
result->NameType( type );
return ;
}
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, result);
Standard_CString type;
GetShapeTypeString(S,type);
result->NameType( type );
return ;
}
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, result);
Standard_CString type;
GetShapeTypeString(S,type);
result->NameType( type );
}
+//=======================================================================
+// function : GetShapeReader()
+// purpose :
+//=======================================================================
+GEOM_Client& GeometryGUI::GetShapeReader()
+{
+ return this->myShapeReader ;
+}
+
+
//=====================================================================================
// function : OnSubShapeGetAll()
// purpose : Explode a shape in all sub shapes with a SubShapeType
QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
op->start();
- TopoDS_Shape mainTopo = ShapeReader.GetShape(myComponentGeom, aShape);
+ TopoDS_Shape mainTopo = myShapeReader.GetShape(myComponentGeom, aShape);
TopoDS_Shape mainShape;
bool main = false;
while ( !main ) {
if ( aShape->IsMainShape() ) {
- mainShape = ShapeReader.GetShape(myComponentGeom, aShape);
+ mainShape = myShapeReader.GetShape(myComponentGeom, aShape);
main = true;
} else
aShape = myComponentGeom->GetIORFromString( aShape->MainName() );
/* Get each sub shape extracted CORBA and OCC */
aResult = listGeomShapes[j] ;
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, aResult);
if ( S.IsNull() ) {
myDesktop->putInfo (tr("GEOM_PRP_ABORT"));
bool allreadyexist = false;
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
Handle(GEOM_AISShape) result = new GEOM_AISShape( S, nameG );
- Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior, "GEOM");
+ Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myFatherior, "GEOM");
MESSAGE ( "SO->_is_nil() " << SO->_is_nil() )
if ( !allreadyexist )
ic->Display(result);
- } else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+ } else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
int themode = myRenderInter->GetDisplayMode();
- vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior,"GEOM");
+ Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myFatherior,"GEOM");
if ( SO->_is_nil() ) {
SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj );
}
GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
- TopoDS_Shape mainTopo = ShapeReader.GetShape(myComponentGeom, aShape);
+ TopoDS_Shape mainTopo = myShapeReader.GetShape(myComponentGeom, aShape);
TopoDS_Shape mainShape;
bool main = false;
while ( !main ) {
if ( aShape->IsMainShape() ) {
- mainShape = ShapeReader.GetShape(myComponentGeom, aShape);
+ mainShape = myShapeReader.GetShape(myComponentGeom, aShape);
main = true;
} else
aShape = myComponentGeom->GetIORFromString( aShape->MainName() );
sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ );
}
result = new GEOM_AISShape( Exp.Current(), nameG );
- IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior, "GEOM");
+ IO = new GEOM_InteractiveObject(aResult->Name(), myFatherior, "GEOM");
}
}
else {
sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ );
}
result = new GEOM_AISShape( compound, nameG );
- IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior, "GEOM");
+ IO = new GEOM_InteractiveObject(aResult->Name(), myFatherior, "GEOM");
}
SALOMEDS::SObject_var SO = aStudy->FindObjectIOR( aResult->Name() );
for( int i=0; i<listGeomShapes->length(); i++ ) {
GEOM::GEOM_Shape_var aShellOrFace = listGeomShapes[i] ;
- TopoDS_Shape S = ShapeReader.GetShape( this->myComponentGeom, aShellOrFace );
+ TopoDS_Shape S = myShapeReader.GetShape( this->myComponentGeom, aShellOrFace );
if( S.IsNull() ) {
return false ;
GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
GEOM::GEOM_Shape_var aResult = myComponentGeom->SuppressHole( aShape, ListOfIdFace, ListOfIdWire, ListOfIdEndFace ) ;
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, aResult);
Standard_CString type;
GetShapeTypeString(S,type);
aResult->NameType( type );
GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
GEOM::GEOM_Shape_var aResult = myComponentGeom->SuppressHolesInFaceOrShell( aShape, ListOfIdWires ) ;
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, aResult);
Standard_CString type;
GetShapeTypeString(S,type);
aResult->NameType( type );
-//=======================================================================
-// function : activeStudyChanged()
-// purpose : static
-//=======================================================================
-void GeometryGUI::activeStudyChanged( QAD_Desktop* parent )
-{
- MESSAGE ("GeometryGUI::activeStudyChanged init.")
- /* Create or retrieve an object GeomGUI */
- GeometryGUI::GetOrCreateGeometryGUI(parent);
- if(GeomGUI != 0) {
-
- if (GeomGUI->myState == CURRENT_SKETCH) {
- GeomGUI->mySketcher.Clear();
- GeomGUI->ResetState();
- }
-
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
- bool ViewOCC = false;
- if ( GeomGUI->myDesktop->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC )
- ViewOCC = true;
-
- Mb->setItemEnabled( 312, ViewOCC); //Sketch
- Mb->setItemEnabled( 309, ViewOCC); //SuppressFace
- Mb->setItemEnabled( 314, ViewOCC); //SuppressHole
-
- Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings
- Mb->setItemEnabled( 704, ViewOCC);// Isos Settings
-
- GeomGUI->EraseSimulationShape() ;
- GeomGUI->EmitSignalCloseAllDialogs() ;
- GeomGUI = 0 ;
- }
- // GeomGUI->SetSettings( parent );
- // MESSAGE ("GeometryGUI::activeStudyChanged done.")
- return ;
-}
//=======================================================================
return true ;
}
+
//=======================================================================
-// function : OnGUIEvent() [static]
-// purpose : manage all events on GUI
+// function : ConvertClickToPoint()
+// purpose : Returns the point clicked in 3D view
//=======================================================================
-bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+gp_Pnt GeometryGUI::ConvertClickToPoint( Standard_Real x,
+ Standard_Real y,
+ Handle(V3d_View) aView )
{
- /* Create or retrieve an object GeomGUI */
- GeometryGUI::GetOrCreateGeometryGUI(parent);
+ V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
+ aView->Eye(XEye, YEye, ZEye);
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-
- OCCViewer_Viewer3d* v3d;
- Handle(AIS_InteractiveContext) ic;
- vtkRenderer* Renderer;
+ aView->At(XAt, YAt, ZAt);
+ gp_Pnt EyePoint(XEye, YEye, ZEye);
+ gp_Pnt AtPoint(XAt, YAt, ZAt);
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
+ gp_Vec EyeVector(EyePoint, AtPoint);
+ gp_Dir EyeDir(EyeVector);
- bool ViewOCC = false;
+ gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir);
+ Standard_Real X, Y, Z;
+ aView->Convert(x, y, X, Y, Z);
+ gp_Pnt ConvertedPoint(X, Y, Z);
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- ic = v3d->getAISContext();
- ViewOCC = true;
- Mb->setItemEnabled( 312, ViewOCC);//Sketch
- Mb->setItemEnabled( 309, ViewOCC);//SuppressFace
- Mb->setItemEnabled( 314, ViewOCC);//SuppressHole
-
- Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings
- Mb->setItemEnabled( 704, ViewOCC);// Isos Settings
+ gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint);
+ gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(),
+ ConvertedPointOnPlane.Y(),
+ PlaneOfTheView);
+ return ResultPoint;
+}
- } else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- Renderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- // OnSuppressFaces, OnSuppressHole, SETTINGS - SHADING COLOR, SETTINGS - ISOS, SETTINGS : STEP VALUE FOR SPIN BOXES, SKETCHER, ISOS - POPUP VIEWER,
- Mb->setItemEnabled( 312, ViewOCC);//Sketch
- Mb->setItemEnabled( 309, ViewOCC);//SuppressFace
- Mb->setItemEnabled( 314, ViewOCC);//SuppressHole
-
- Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings
- Mb->setItemEnabled( 704, ViewOCC);// Isos Settings
- } else {
- return 0;
- }
- if (GeomGUI->myState == CURRENT_SKETCH && theCommandID != 10000 && theCommandID != 10001 && theCommandID != 10002 && theCommandID != 10003 && theCommandID != 10004 && theCommandID != 10006 && theCommandID != 10007 && theCommandID != 10008 && theCommandID != 10010 && theCommandID != 10011 && theCommandID != 10012 && theCommandID != 10013 && theCommandID != 10014 && theCommandID != 3133 && theCommandID != 3134)
- return false;
- switch (theCommandID)
- {
- case 31: // COPY
- GeomGUI->OnEditCopy();
- break;
-
- case 33: // DELETE
- GeomGUI->OnEditDelete();
- break;
- case 111:
- {
- GeomGUI->SetState(111);
- GeomGUI->Import();
- GeomGUI->ResetState();
- break;
- }
- case 112:
- {
- GeomGUI->SetState(112);
- GeomGUI->Import();
- GeomGUI->ResetState();
- break;
- }
- case 113: // IMPORT STEP
- {
- GeomGUI->SetState(113);
- GeomGUI->Import();
- GeomGUI->ResetState();
- break;
- }
- case 121: // EXPORT BREP
- {
- GeomGUI->SetState(121);
- GeomGUI->Export();
- GeomGUI->ResetState();
- break;
- }
- case 122: // EXPORT IGES
- {
- GeomGUI->SetState(122);
- GeomGUI->Export();
- GeomGUI->ResetState();
- break;
- }
+//================================================================================
+// function : SetDisplayedObjectList()
+// purpose :
+//================================================================================
+void GeometryGUI::SetDisplayedObjectList()
+{
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
+ return;
- case 123: // EXPORT STEP
- {
- GeomGUI->SetState(123);
- GeomGUI->Export();
- GeomGUI->ResetState();
- break;
- }
-
- case 303: // EXPLODE : use ic
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_SubShapeDlg *aDlg = new GeometryGUI_SubShapeDlg( parent, "", Sel, ic ) ;
- break ;
- }
-
- case 304: // GEOM::EDGE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_EdgeDlg *aDlg = new GeometryGUI_EdgeDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 305: // GEOM::WIRE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_WireDlg *aDlg = new GeometryGUI_WireDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 306: // GEOM::FACE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_FaceDlg *aDlg = new GeometryGUI_FaceDlg ( parent, "", Sel ) ;
- break ;
- }
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ myListDisplayedObject.Clear();
- case 315: // GEOM::SHELL
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_ShellDlg *aDlg = new GeometryGUI_ShellDlg ( parent, "", Sel ) ;
- break ;
- }
+ Handle (AIS_InteractiveContext) aContext = v3d->getAISContext();
+ aContext->DisplayedObjects( myListDisplayedObject );
+}
- case 316: // GEOM::SOLID
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_SolidDlg *aDlg = new GeometryGUI_SolidDlg ( parent, "", Sel ) ;
- break ;
- }
-
- case 308: // GEOM::COMPOUND
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_CompoundDlg *aDlg = new GeometryGUI_CompoundDlg ( parent, "", Sel ) ;
- break ;
- }
-
- case 309: // SUPPRESS FACES : use ic
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_SuppressFacesDlg *aDlg = new GeometryGUI_SuppressFacesDlg( parent, "", Sel, ic ) ;
- break ;
- }
-
- case 314: // SUPPRESS HOLES : use ic
- {
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_SuppressHoleDlg *aDlg = new GeometryGUI_SuppressHoleDlg( parent, "", Sel, ic ) ;
- }
- else {
- GeomGUI->myDesktop->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ;
- }
- break ;
- }
- case 501: // SEWING
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_SewingDlg *aDlg = new GeometryGUI_SewingDlg ( parent, "", Sel ) ;
- break ;
- }
-
- case 502: // ORIENTATION
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_OrientationDlg *aDlg = new GeometryGUI_OrientationDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 601: // PROPERTIES (Length, surface, volume)
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_PropertiesDlg *aDlg = new GeometryGUI_PropertiesDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 604: // CDG : Center of mass
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_CenterMassDlg *aDlg = new GeometryGUI_CenterMassDlg ( parent, "", Sel ) ;
- break ;
- }
-
- case 605: // INERTIA
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_InertiaDlg *aDlg = new GeometryGUI_InertiaDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 607: // MAXTOLERANCE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_MaxToleranceDlg *aDlg = new GeometryGUI_MaxToleranceDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 608: // WHATIS
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_WhatisDlg *aDlg = new GeometryGUI_WhatisDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 609: // CHECKSHAPE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_CheckShape *aDlg = new GeometryGUI_CheckShape( parent, "", Sel ) ;
- break ;
- }
-
- case 701: // SETTINGS - COPY
- {
- QMenuData* pp;
- QMenuItem* item = parent->menuBar()->findItem(701,&pp);
- bool check = !pp->isItemChecked(701);
- pp->setItemChecked(701,check);
- Settings_Copy = check;
- QAD_CONFIG->addSetting( "Geometry:SettingsCopy", Settings_Copy );
- break;
- }
- case 702: // SETTINGS - ADD IN STUDY
- {
- QMenuData* pp;
- QMenuItem* item = parent->menuBar()->findItem(702,&pp);
- bool check = !pp->isItemChecked(702);
- pp->setItemChecked(702,check);
- Settings_AddInStudy = check;
-
- QAD_CONFIG->addSetting( "Geometry:SettingsAddInStudy", Settings_AddInStudy );
- break;
- }
- case 703: // SETTINGS - SHADING COLOR
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
-
- QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed");
- QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
- QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue");
- QColor color;
- if( !SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty() ) {
- color = QColor (SCr.toInt(),
- SCg.toInt(),
- SCb.toInt());
- } else {
- Quantity_Color Default = Quantity_Color();
- color = QColor ( (int)Default.Red() * 255.0,
- (int)Default.Green()* 255.0,
- (int)Default.Blue() * 255.0 );
+//=====================================================================================
+// function : OnDisplayAll()
+// purpose :
+//=====================================================================================
+void GeometryGUI::OnDisplayAll(bool onlyPreviousDisplayedObject)
+{
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
+ return;
+
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
+
+ myContext->Display(v3d->getTrihedron());
+
+ if ( !onlyPreviousDisplayedObject ) {
+ AIS_ListOfInteractive List1;
+ myContext->ObjectsInCollector(List1);
+ AIS_ListIteratorOfListOfInteractive ite1(List1);
+ while (ite1.More()) {
+ if (ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
+ if ( aSh->hasIO() ) {
+ Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
+ if ( v3d->isInViewer(GIO, true) ) {
+ myContext->Display(aSh);
+ }
}
-
- QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
- if ( c.isValid() ) {
- GeomGUI->myShadingColor = Quantity_Color(c.red() / 255.0,
- c.green()/ 255.0,
- c.blue() / 255.0,
- Quantity_TOC_RGB);
-
- AIS_ListOfInteractive List;
- ic->DisplayedObjects(List);
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector(List1);
- List.Append(List1);
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- aSh->SetShadingColor( GeomGUI->myShadingColor );
- ic->Redisplay( aSh, Standard_True, Standard_True);
- }
- ite.Next();
+ }
+ ite1.Next();
+ }
+ } else {
+ AIS_ListIteratorOfListOfInteractive ite(myListDisplayedObject);
+ while (ite.More()) {
+ if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
+ if ( aSh->hasIO() ) {
+ Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
+ if ( v3d->isInViewer(GIO,true) ) {
+ myContext->Display(aSh);
}
-
- ic->UpdateCurrentViewer();
-
- QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", c.red() );
- QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", c.green() );
- QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", c.blue() );
}
- break;
}
+ ite.Next();
+ }
+ }
+}
-
- case 704: // SETTINGS - ISOS
- {
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
- QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
- if ( !IsoU.isEmpty() )
- ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
- else
- IsoU = "1";
- if ( !IsoV.isEmpty() )
- ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
- else
- IsoV = "1";
-
- GeometryGUI_NbIsosDlg * NbIsosDlg = new GeometryGUI_NbIsosDlg( QAD_Application::getDesktop(),
- tr("GEOM_MEN_ISOS"), TRUE );
- int UIso = IsoU.toInt();
- int VIso = IsoV.toInt();
-
- NbIsosDlg->SpinBoxU->setValue(UIso) ;
- NbIsosDlg->SpinBoxV->setValue(VIso) ;
- if ( NbIsosDlg->exec() ) {
- UIso = NbIsosDlg->SpinBoxU->text().toInt() ;
- VIso = NbIsosDlg->SpinBoxV->text().toInt() ;
+
+//=====================================================================================
+// function : OnVTKDisplayOnly()
+// purpose :
+//=====================================================================================
+void GeometryGUI::OnVTKDisplayOnly()
+{
+
+ // Erase all not selected actors
+
+ QApplication::setOverrideCursor( Qt::waitCursor );
+
+ vtkRenderer* aren = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ vtkActorCollection* theActors = aren->GetActors();
+ theActors->InitTraversal();
+ vtkActor *ac = theActors->GetNextActor();
+ while(!(ac==NULL)) {
+ if ( ac->IsA("SALOME_Actor") ) {
+ SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
+ if(!anActor->isHighlighted()) anActor->VisibilityOff();
+ }
+ ac = theActors->GetNextActor();
+ }
+
+ // Display selection
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry());
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var anIOR;
+
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso);
- ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso);
- QAD_CONFIG->addSetting( "Geometry:SettingsIsoU", NbIsosDlg->SpinBoxU->text() ); /* text format */
- QAD_CONFIG->addSetting( "Geometry:SettingsIsoV", NbIsosDlg->SpinBoxV->text() ); /* text format */
- }
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
- AIS_ListOfInteractive List;
- ic->DisplayedObjects(List);
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector(List1);
- List.Append(List1);
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+
+ if(myRenderInter->isInViewer(IObject)) {
+ myRenderInter->Display(IObject);
+ }
+ else {
+ // Create new actor
+ if ( !obj->_is_nil() ) {
+ if ( !obj->FindAttribute(anAttr, "AttributeIOR"))
+ break;
+ // If selected object contains displayable subobjects, then do nothing
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ SALOMEDS::GenericAttribute_var aTmpAttr;
- AIS_ListIteratorOfListOfInteractive ite(List);
- ic->InitCurrent();
- if ( ic->NbCurrents() )
- while (ite.More()) {
- if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
-
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- Handle (AIS_Drawer) CurDrawer;
- CurDrawer = aSh->Attributes();
- CurDrawer->UIsoAspect()->SetNumber( UIso );
- CurDrawer->VIsoAspect()->SetNumber( VIso );
- ic->SetLocalAttributes(aSh, CurDrawer);
- ic->Redisplay(aSh);
- }
- ite.Next();
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ if (CORBA::is_nil(aShape)) continue;
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ // open transaction
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+
+ SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
+ aStudyBuilder->Addreference(newObj1, obj);
+ // commit transaction
+ op->finish();
+
+ vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ int themode = myRenderInter->GetDisplayMode();
+ vtkActorCollection* theActors =
+ GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
+ theActors->InitTraversal();
+ vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
+ while(!(anActor==NULL)) {
+ GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
+ GActor->setIO( IObject );
+ GActor->setName( IObject->getName() );
+
+ theRenderer->AddActor(GActor);
+ vtkRenderWindow *renWin
+ = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow();
+ renWin->Render();
+ anActor = (vtkActor*)theActors->GetNextActor();
}
- ic->UpdateCurrentViewer();
- break;
+ }
}
-
- case 705: // SETTINGS : STEP VALUE FOR SPIN BOXES
- {
- //NRI if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- //NRI break;
-
- QString step = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
- if( step.isEmpty() )
- step = "100.0" ;
+ }
+ }
+ myActiveStudy->updateObjBrowser( true );
+ QApplication::restoreOverrideCursor();
+}
- Standard_Boolean res = false ;
- double dd = Parameter( res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3 ) ;
- if( res ) {
- QAD_CONFIG->addSetting( "Geometry:SettingsGeomStep", QString("%1").arg(dd) ) ;
- /* Emit signal to GeometryGUI_SpinBoxes */
- GeomGUI->SignalDefaultStepValueChanged( dd ) ;
- }
- else
- parent->putInfo(tr("GEOM_PRP_ABORT"));
- break ;
- }
-
- case 801: // ADD IN STUDY - POPUP VIEWER
- {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- const SALOME_ListIO& ListSelected = Sel->StoredIObjects();
- SALOME_ListIteratorOfListIO It( ListSelected );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- GeomGUI->AddInStudy(true, IObject);
- }
- /* Is set on the dialog box */
- QApplication::restoreOverrideCursor();
- break;
+//=====================================================================================
+// function : OnDisplayOnly()
+// purpose :
+//=====================================================================================
+void GeometryGUI::OnDisplayOnly()
+{
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
+ return;
+
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects(List);
+ AIS_ListIteratorOfListOfInteractive ite(List);
+ while (ite.More()) {
+ if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
+ if (!ic->IsSelected( aSh )) {
+ ic->Erase( aSh, Standard_True, Standard_True );
}
+ }
+ ite.Next();
+ }
- case 901: // RENAME
- {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( !obj->_is_nil() ) {
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ SALOME_ListIteratorOfListIO It1( Sel->StoredIObjects() );
+ for(;It1.More();It1.Next()) {
+ Handle(SALOME_InteractiveObject) IObject = It1.Value();
- QString nm = QString( aName->Value() );
- nm = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), nm );
- if ( !nm.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- GeomGUI->myActiveStudy->renameIObject( IObject, nm );
- QApplication::restoreOverrideCursor();
- }
+
+ SALOMEDS::SObject_var fatherSF =
+ aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry());
+ if ( v3d->isInViewer( IObject, true ) ) {
+ AIS_ListOfInteractive List1;
+ ic->ObjectsInCollector(List1);
+ AIS_ListIteratorOfListOfInteractive ite1(List1);
+ while (ite1.More()) {
+ if (ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
+ if ( aSh->hasIO() ) {
+ Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
+ if ( IObject->isSame( GIO ) ) {
+ ic->Display(aSh);
+ ic->AddOrRemoveCurrentObject(aSh, true);
+ break;
}
}
}
- break;
- }
-
- case 903: // DISPLAY OBJECT BROWSER
- {
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // VTK
- QApplication::setOverrideCursor( Qt::waitCursor );
-
- SALOMEDS::SObject_var fatherSF =
- aStudy->FindObjectID(GeomGUI->myActiveStudy->getActiveStudyFrame()->entry());
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
-
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+ ite1.Next();
+ }
+ } else {
+ if ( IObject->hasEntry() ) {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !obj->_is_nil() ) {
+ if (obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
-
- if(myRenderInter->isInViewer(IObject)) {
- myRenderInter->Display(IObject);
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( anIOR->Value() );
+ if (CORBA::is_nil(aShape)) continue;
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom, aShape);
+
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ // open transaction
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+
+ SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
+ aStudyBuilder->Addreference(newObj1, obj);
+ // commit transaction
+ op->finish();
}
- else {
- // Create new actor
- if ( !obj->_is_nil() ) {
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- bool useSubItems = false;
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- }
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
+
+ Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
+ Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myFatherior,"GEOM");
+
+ IO->setEntry(obj->GetID());
+ aSh->setIO( IO );
+ aSh->setName( aName->Value() );
+ ic->Display (aSh);
+ ic->AddOrRemoveCurrentObject(aSh, true);
+ }
+ }
+ }
+ }
+ }
+}
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- vtkActorCollection* theAllActors = theRenderer->GetActors();
- theAllActors->InitTraversal();
- vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
- Handle(SALOME_InteractiveObject) anIObj;
- // don't create new study object if it already exists
- bool isDisplayed = false;
- while(!(actor==NULL)) {
- SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
- if (Gactor!=NULL) {
- if (Gactor->hasIO()) {
- if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
- isDisplayed = true;
- anIObj = Gactor->getIO();
- if (!anIObj.IsNull()) myRenderInter->Display(anIObj);
- }
- }
- }
- actor=(vtkActor*)(theAllActors->GetNextActor());
- }
- if (!isDisplayed) {
- // open transaction
- QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy );
- op->start();
-
- SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
- aStudyBuilder->Addreference(newObj1, obj);
- // commit transaction
- op->finish();
-
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- int themode = myRenderInter->GetDisplayMode();
-
- vtkActorCollection* theActors =
- GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
- theActors->InitTraversal();
- vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
- while(!(anActor==NULL)) {
- GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
- Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), Fatherior,"GEOM");
- IO->setEntry(obj->GetID());
- GActor->setIO( IO );
- GActor->setName( IObject->getName() );
-
- theRenderer->AddActor(GActor);
- renWin->Render();
- anActor = (vtkActor*)theActors->GetNextActor();
- }
- }
- }
- // next item iteration
- if (useSubItems) {
- anIter->Next();
- anAttr = SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
- }
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
- }
- }
- }
- }
- }
- GeomGUI->myActiveStudy->updateObjBrowser( true );
- QApplication::restoreOverrideCursor();
-
- } else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
-
- SALOMEDS::SObject_var fatherSF =
- aStudy->FindObjectID( GeomGUI->myActiveStudy->getActiveStudyFrame()->entry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
+//===============================================================================
+// function : OnEditDelete()
+// purpose :
+//===============================================================================
+void GeometryGUI::OnEditDelete()
+{
+ if ( QAD_MessageBox::warn2
+ ( QAD_Application::getDesktop(),
+ tr ("GEOM_WRN_WARNING"),
+ tr ("GEOM_REALLY_DELETE"),
+ tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 )
+ return;
+
+ int nbSf = myActiveStudy->getStudyFramesCount();
+
+ Standard_Boolean found;
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ if ( IObject->hasEntry() ) {
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() );
+
+ /* Erase child graphical objects */
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
+ for (; it->More();it->Next()) {
+ SALOMEDS::SObject_var CSO= it->Value();
+ if (CSO->FindAttribute(anAttr, "AttributeIOR") ) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ /* Delete child(s) shape in Client : */
+ const TCollection_AsciiString ASCior(anIOR->Value()) ;
+ myShapeReader.RemoveShapeFromBuffer( ASCior ) ;
- if ( v3d->isInViewer( IObject, true ) ) {
- Standard_Boolean found;
- Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( IObject, found, true );
+ for ( int i = 0; i < nbSf; i++ ) {
+ QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i);
+ if ( sf->getTypeView() == VIEW_OCC ) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
+ Handle(GEOM_AISShape) Result = ConvertIORinGEOMAISShape( anIOR->Value(), found );
+ if ( found )
+ myContext->Erase( Result, true, false );
+ } else if ( sf->getTypeView() == VIEW_VTK ) {
+ //vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer();
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
+ GEOM_Actor* ac = ConvertIORinGEOMActor( anIOR->Value(), found );
if ( found ) {
- ic->Display(aSh);
- ic->AddOrRemoveCurrentObject(aSh, true);
- }
-
- } else {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
- if ( !obj->_is_nil() ) {
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- bool useSubItems = false;
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- }
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- // searchin for already displayed objects with the same shape
- AIS_ListOfInteractive aDisplayed;
- ic->DisplayedObjects(aDisplayed);
- AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
- Handle(AIS_Shape) anAISShape;
- for(;anIObjects.More();anIObjects.Next()) {
- anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
- if (!anAISShape.IsNull()) {
- if (anAISShape->Shape().IsSame(Shape)) break;
- anAISShape.Nullify();
- }
- }
- if (!anAISShape.IsNull()) {
- if (!ic->IsDisplayed(anAISShape)) ic->Display(anAISShape);
- } else {
- if (!useSubItems) {
- // open transaction
- QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy );
- op->start();
-
- SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
- aStudyBuilder->Addreference(newObj1, obj);
- // commit transaction
- op->finish();
- }
-
- Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
- aSh->SetShadingColor( GeomGUI->myShadingColor );
- Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(),
- Fatherior,
- "GEOM");
- IO->setEntry(obj->GetID());
- aSh->setIO( IO );
- aSh->setName( aName->Value() );
- ic->Display (aSh);
- if (!useSubItems) ic->AddOrRemoveCurrentObject(aSh, true);
- }
- }
- // next item iteration
- if (useSubItems) {
- anIter->Next();
- anAttr=SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
- }
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
- }
- }
+ //Renderer->RemoveActor(ac);
+ if ( ac->hasIO() )
+ myRenderInter->Remove( ac->getIO() );
}
}
}
- GeomGUI->myActiveStudy->updateObjBrowser( true );
- QApplication::restoreOverrideCursor();
}
- break;
- }
-
- case 3011: // POINT
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_PointDlg *aDlg = new GeometryGUI_PointDlg( parent, "", Sel, ic ) ;
- break;
}
- case 3012: // LINE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_LineDlg *aDlg = new GeometryGUI_LineDlg( parent, "", Sel ) ;
- break ;
+ /* Erase main graphical object */
+ for ( int i = 0; i < nbSf; i++ ) {
+ QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i);
+ if ( sf->getTypeView() == VIEW_OCC ) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
+ Handle(GEOM_AISShape) Result = ConvertIOinGEOMAISShape( IObject, found );
+ if ( found )
+ myContext->Erase( Result, true, false );
+ } else if ( sf->getTypeView() == VIEW_VTK ) {
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
+ myRenderInter->Remove( IObject );
+ }
}
- case 3013: // CIRCLE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_CircleDlg *aDlg = new GeometryGUI_CircleDlg( parent, "", Sel ) ;
- break ;
+ /* Delete main shape in Client : */
+ if (SO->FindAttribute(anAttr, "AttributeIOR") ) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ const TCollection_AsciiString ASCIor(anIOR->Value()) ;
+ myShapeReader.RemoveShapeFromBuffer( ASCIor ) ;
}
- case 3014: // ELLIPSE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_EllipseDlg *aDlg = new GeometryGUI_EllipseDlg( parent, "", Sel ) ;
- break ;
+ /* Erase objects in Study */
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
+ if ( !obj->_is_nil() ) {
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+ aStudyBuilder->RemoveObject(obj);
+ op->finish();
}
- case 3015: // ARC
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_ArcDlg *aDlg = new GeometryGUI_ArcDlg( parent, "", Sel ) ;
- break ;
- }
-
- case 3016: // VECTOR
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_VectorDlg *aDlg = new GeometryGUI_VectorDlg( parent, "", Sel ) ;
- break;
- }
-
- case 3017: // PLANE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_PlaneDlg *aDlg = new GeometryGUI_PlaneDlg( parent, "", Sel ) ;
- break;
- }
-
- case 3018: // WORKING PLANE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_WorkingPlaneDlg *aDlg = new GeometryGUI_WorkingPlaneDlg( parent, "", Sel ) ;
- break;
- }
-
- case 312: // SKETCHER
- {
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
- break;
+ } /* IObject->hasEntry() */
+ } /* more/next */
- GeomGUI->EmitSignalDeactivateDialog() ;
+ /* Clear any previous selection */
+ Sel->ClearIObjects() ;
+ myActiveStudy->updateObjBrowser();
+}
- ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002
-
- GeomGUI->mySketcher = Sketch( v3d->getViewer3d() );
- GeomGUI->SetState(CURRENT_SKETCH);
-
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
- QMenuData* pp;
-
- QMenuItem* item = Mb->findItem(10010,&pp);
- GeomGUI->mySketcher.SetParameterVisibility(LENGTH_PARAMETER,pp->isItemChecked(10010));
- item = Mb->findItem(10011,&pp);
- GeomGUI->mySketcher.SetParameterVisibility(ANGLE_PARAMETER,pp->isItemChecked(10011));
- item = Mb->findItem(10012,&pp);
- GeomGUI->mySketcher.SetParameterVisibility(RADIUS_PARAMETER,pp->isItemChecked(10012));
- item = Mb->findItem(10013,&pp);
- GeomGUI->mySketcher.SetParameterVisibility(XVALUE_PARAMETER,pp->isItemChecked(10013));
- item = Mb->findItem(10014,&pp);
- GeomGUI->mySketcher.SetParameterVisibility(YVALUE_PARAMETER,pp->isItemChecked(10014));
-
- GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT);
- item = Mb->findItem(3133,&pp);
- pp->setItemChecked(3133,false);
- item = Mb->findItem(3134,&pp);
- pp->setItemChecked(3134,false);
- break;
- }
-
- case 3021: // BOX
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_BoxDlg *aDlg = new GeometryGUI_BoxDlg( parent, "", Sel ) ;
- break;
- }
- case 3022: // CYLINDER
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_CylinderDlg *aDlg = new GeometryGUI_CylinderDlg( parent, "", Sel ) ;
- break;
- }
+//==============================================================================
+// function : OnEditCopy()
+// purpose :
+//==============================================================================
+void GeometryGUI::OnEditCopy()
+{
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR;
- case 3023: // SPHERE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_SphereDlg *aDlg = new GeometryGUI_SphereDlg( parent, "", Sel ) ;
- break;
- }
-
- case 3024: // TORUS
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_TorusDlg *aDlg = new GeometryGUI_TorusDlg( parent, "", Sel ) ;
- break;
- }
+ const SALOME_ListIO& List = Sel->StoredIObjects();
- case 3025: // CONE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_ConeDlg *aDlg = new GeometryGUI_ConeDlg( parent, "", Sel ) ;
- break;
- }
+ ConvertListOfIOInListOfIOR( List, listIOR);
- case 3131:
- {
- break;
- }
+ Sel->ClearIObjects();
- case 3133: // sketcher
- {
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(3133,&pp);
- pp->setItemChecked(3133,!pp->isItemChecked(3133));
- if (pp->isItemChecked(3133) == true)
- GeomGUI->mySketcher.SetTransitionStatus(TANGENT);
- else
- GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT);
+ for (unsigned int ind = 0; ind < listIOR->length();ind++) {
+ GEOM::GEOM_Shape_var aShapeInit = myComponentGeom->GetIORFromString(listIOR[ind]);
+ try {
+ GEOM::GEOM_Shape_var result = myComponentGeom->MakeCopy(aShapeInit) ;
+ result->NameType( aShapeInit->NameType() );
+ this->Display(result);
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ }
+
+ myDesktop->putInfo(tr("GEOM_PRP_READY"));
+}
- pp->setItemChecked(3134,false);
- break;
- }
- case 3134: // sketcher
- {
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(3134,&pp);
- pp->setItemChecked(3134,!pp->isItemChecked(3134));
- if (pp->isItemChecked(3134) == true)
- GeomGUI->mySketcher.SetTransitionStatus(PERPENDICULAR);
- else
- GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT);
+//=====================================================================================
+// function : DisplaySimulationShape()
+// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape
+//=====================================================================================
+void GeometryGUI::DisplaySimulationShape(const TopoDS_Shape& S)
+{
+ if( S.IsNull() )
+ return ;
+
+ //NRI DEBUG : 14/02/2002
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ return ;
- pp->setItemChecked(3133,false);
- break;
- }
-
- case 4011: // FUSE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_FuseDlg *aDlg = new GeometryGUI_FuseDlg( parent, "", Sel ) ;
- break;
- }
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+
+ try {
+ /* erase any previous */
+ ic->Erase( this->mySimulationShape, Standard_True, Standard_False );
+ ic->ClearPrs( this->mySimulationShape );
+ this->mySimulationShape = new AIS_Shape( TopoDS_Shape() ) ;
+ this->mySimulationShape->Set( S ) ;
+ this->mySimulationShape->SetColor(Quantity_NOC_VIOLET) ;
+ ic->Deactivate( this->mySimulationShape );
+ ic->Display( this->mySimulationShape, Standard_False );
+ ic->UpdateCurrentViewer();
+ }
+ catch(Standard_Failure) {
+ MESSAGE( "Exception catched in GeometryGUI::DisplaySimulationShape " ) ;
+ }
+ this->mySimulationShape->UnsetColor() ;
+ return ;
+}
- case 4012: // COMMON
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_CommonDlg *aDlg = new GeometryGUI_CommonDlg( parent, "", Sel ) ;
- break;
- }
- case 4013: // CUT
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_CutDlg *aDlg = new GeometryGUI_CutDlg( parent, "", Sel ) ;
- break;
- }
- case 4014: // SECTION
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_SectionDlg *aDlg = new GeometryGUI_SectionDlg( parent, "", Sel ) ;
- break;
- }
+//==================================================================================
+// function : EraseSimulationShape()
+// purpose : Clears the display of 'mySimulationShape' a pure graphical shape
+//==================================================================================
+void GeometryGUI::EraseSimulationShape()
+{
+ int count = myActiveStudy->getStudyFramesCount();
+ for ( int i = 0; i < count; i++ ) {
+ if (myActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC ) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+ ic->Erase( this->mySimulationShape, Standard_True, Standard_False );
+ ic->ClearPrs( this->mySimulationShape );
+ ic->UpdateCurrentViewer();
- case 4021: // TRANSLATION
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_TranslationDlg *aDlg = new GeometryGUI_TranslationDlg( parent, "", Sel ) ;
- break;
- }
+ } else if (myActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_VTK ) { // VTK
+ }
+ }
+ // MESSAGE ( " GeometryGUI::EraseSimulationShape done. " )
+}
- case 4022: // ROTATION
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_RotationDlg *aDlg = new GeometryGUI_RotationDlg( parent, "", Sel ) ;
- break;
- }
- case 4030: // MULTI TRANSLATION
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_MultiTranslationDlg *aDlg = new GeometryGUI_MultiTranslationDlg( parent, "", Sel ) ;
- break;
- }
- case 4040: // MULTI ROTATION
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_MultiRotationDlg *aDlg = new GeometryGUI_MultiRotationDlg( parent, "", Sel ) ;
- break;
- }
+//=====================================================================================
+// function : Import
+// purpose : BRep, Iges, Step
+//=====================================================================================
+bool GeometryGUI::Import( )
+{
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+
+ GEOM::GEOM_Shape_var aShape;
+ QString file;
+ QStringList filtersList ;
+
+ switch ( myState )
+ {
+ case 111 : // Import BREP
+ {
+ filtersList.append( tr("GEOM_MEN_IMPORT_BREP") );
+ filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
- case 4023: // MIRROR
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_MirrorDlg *aDlg = new GeometryGUI_MirrorDlg( parent, "", Sel ) ;
- break;
- }
-
- case 4024: // SCALE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_ScaleDlg *aDlg = new GeometryGUI_ScaleDlg( parent, "", Sel ) ;
- break;
- }
-
- case 4025: // PARTITION
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_PartitionDlg *aDlg = new GeometryGUI_PartitionDlg( parent, "", Sel ) ;
+ file = QAD_FileDlg::getFileName(myDesktop,
+ "",
+ filtersList,
+ tr("GEOM_MEN_IMPORT"),
+ true);
+ if ( !file.isEmpty() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ try {
+ aShape = myComponentGeom->ImportBREP( file.latin1() );
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ }
break;
}
+ case 112 : // Import IGES
+ {
+ filtersList.append( tr("GEOM_MEN_IMPORT_IGES") ) ;
+ filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
- case 4026: // ARCHIMEDE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_ArchimedeDlg *aDlg = new GeometryGUI_ArchimedeDlg( parent, "", Sel ) ;
+ file = QAD_FileDlg::getFileName(myDesktop,
+ "",
+ filtersList,
+ tr("GEOM_MEN_IMPORT"),
+ true);
+ if ( !file.isEmpty() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ try {
+ aShape = myComponentGeom->ImportIGES( file.latin1() );
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ }
break;
}
+ case 113 : // Import STEP
+ {
+ filtersList.append( tr("GEOM_MEN_IMPORT_STEP") ) ;
+ filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
- case 4027: // FILLET
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_FilletDlg *aDlg = new GeometryGUI_FilletDlg( parent, "", Sel, ic ) ;
- break;
- }
-
- case 4028: // CHAMFER
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_ChamferDlg *aDlg = new GeometryGUI_ChamferDlg( parent, "", Sel, ic ) ;
+ file = QAD_FileDlg::getFileName(myDesktop,
+ "",
+ filtersList,
+ tr("GEOM_MEN_IMPORT"),
+ true);
+ if ( !file.isEmpty() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ try {
+ aShape = myComponentGeom->ImportSTEP( file.latin1() );
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ }
break;
}
+ }
+
+ if ( !file.isEmpty() ) {
+ myDesktop->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) );
- case 4031: // PRISM
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_PrismDlg *aDlg = new GeometryGUI_PrismDlg( parent, "", Sel ) ;
- break;
- }
+ SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
+ SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID( myActiveStudy->getActiveStudyFrame()->entry());
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributePixMap_var aPixmap;
+ int aLocked = false;
+ if (father->_is_nil()) {
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+ aLocked = aStudy->GetProperties()->IsLocked();
+ if (aLocked) aStudy->GetProperties()->SetLocked(false);
+ father = aStudyBuilder->NewComponent("GEOM");
+ anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ // aName->SetValue( tr("GEOM_MEN_COMPONENT") );
+ aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) );
+ anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
+ aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
+ if (aLocked) aStudy->GetProperties()->SetLocked(true);
+ op->finish();
+ }
+// if (aLocked) return false;
+ aStudyBuilder->DefineComponentInstance( father, myComponentGeom );
+ father->ComponentIOR( myFatherior );
- case 4032: // REVOL
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_RevolDlg *aDlg = new GeometryGUI_RevolDlg( parent, "", Sel ) ;
- break;
- }
+ QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(this->myNbGeom++);
- case 4033: // FILLING
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_FillingDlg *aDlg = new GeometryGUI_FillingDlg( parent, "", Sel ) ;
- break;
- }
+ if ( Display ( aShape, strdup(nameShape.latin1())) ) {
+ myActiveStudy->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) );
+ myDesktop->putInfo( tr("GEOM_PRP_READY"));
+ }
+ }
+ QApplication::restoreOverrideCursor();
+ return true ;
+}
- case 4034: // PIPE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_PipeDlg *aDlg = new GeometryGUI_PipeDlg(parent, "", Sel ) ;
- break;
- }
-
- case 5001: // CHECK GEOMETRY
- {
- QAD_PyEditor* PyEditor = GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getPyEditor();
- PyEditor->setText("from GEOM_usinggeom import *\n");
- PyEditor->setText(">>> ");
- PyEditor->handleReturn();
- break;
- }
- case 6021: // SHADING - WIREFRAME
- {
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- VTKViewer_RenderWindowInteractor* myRenderInter=
- ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+//=====================================================================================
+// function : Export
+// purpose : BRep, Iges, Step
+//=====================================================================================
+bool GeometryGUI::Export( )
+{
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- QApplication::setOverrideCursor(waitCursor);
-
- int themode = myRenderInter->GetDisplayMode();
- if( themode==0 ) {
- myRenderInter->SetDisplayMode(1);
- GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") );
- } else {
- myRenderInter->SetDisplayMode(0);
- GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") );
- }
+ GEOM::GEOM_Shape_var aShape;
- QApplication::restoreOverrideCursor();
-
- } else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- AIS_DisplayMode mode = ( AIS_DisplayMode )ic->DisplayMode();
- QApplication::setOverrideCursor( Qt::waitCursor );
- AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame);
+ static QString filters[] = { tr("GEOM_MEN_IMPORT_BREP"),
+ tr("GEOM_MEN_IMPORT_IGES"),
+ tr("GEOM_MEN_IMPORT_STEP") };
+
+ SALOME_Selection* Sel = SALOME_Selection::Selection( this->myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- AIS_ListOfInteractive List;
- ic->DisplayedObjects(List);
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector(List1);
- List.Append(List1);
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- ic->SetDisplayMode(aSh,Standard_Integer(newmode),true);
+ switch ( myState )
+ {
+ case 121 :
+ {
+ for(;It.More();It.Next()) {
+ QApplication::restoreOverrideCursor();
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ Standard_Boolean found;
+ GEOM::GEOM_Shape_var aShape = ConvertIOinGEOMShape(IObject, found);
+ // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true);
+ if ( found ) {
+ QString file = QAD_FileDlg::getFileName(myDesktop,
+ QString( IObject->getName() ) + ".brep",
+ tr("GEOM_MEN_IMPORT_BREP"),
+ tr("GEOM_MEN_EXPORT"),
+ false);
+ if ( !file.isEmpty() && !aShape->_is_nil() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ // Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) );
+ try {
+ myComponentGeom->ExportBREP(strdup( file.latin1()), aShape);
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
}
- ite.Next();
}
-
- ic->SetDisplayMode( newmode, Standard_False);
- if ( newmode == 1 )
- GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") );
- else
- GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") );
-
- QApplication::restoreOverrideCursor();
}
- break;
+ break;
}
-
- case 6022: // DISPLAY ALL
+ case 122 :
{
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
- //VTK
- ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
- else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC )
- GeomGUI->OnDisplayAll();
+ for(;It.More();It.Next()) {
+ QApplication::restoreOverrideCursor();
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ Standard_Boolean found;
+ GEOM::GEOM_Shape_var aShape = ConvertIOinGEOMShape(IObject, found);
+ // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true);
+ if ( found ) {
+ QString file = QAD_FileDlg::getFileName(myDesktop,
+ QString( IObject->getName() ) + ".igs",
+ tr("GEOM_MEN_IMPORT_IGES"),
+ tr("GEOM_MEN_EXPORT"),
+ false);
+ if ( !file.isEmpty() && !aShape->_is_nil() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ try {
+ myComponentGeom->ExportIGES(strdup( file.latin1()), aShape);
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+// //VRV: OCC 4.0 migration
+// IGESControl_Controller::Init();
+// IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"),
+// Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
+// //VRV: OCC 4.0 migration
+
+// ICW.AddShape (Shape->Shape());
+// ICW.ComputeModel();
+// Standard_Boolean result = ICW.Write( strdup(file.latin1()) );
+ }
+ }
+ }
break;
}
-
- case 6023: // DISPLAY ONLY
- case 8023: // DISPLAY ONLY - POPUP VIEWER
+
+ case 123 :
{
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- // VTK
- GeomGUI->OnVTKDisplayOnly();
+// bool test = false ;
+// IFSelect_ReturnStatus status ;
+// //VRV: OCC 4.0 migration
+// STEPControl_Writer aWriter;
+// //VRV: OCC 4.0 migration
+ QString file;
+
+ for( ; It.More(); It.Next() ) {
+// GEOM::GEOM_Shape_var aShape = ConvertIOinGEOMShape(IObject, found);
+ QApplication::restoreOverrideCursor();
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ Standard_Boolean found;
+ GEOM::GEOM_Shape_var aShape = ConvertIOinGEOMShape(IObject, found);
+ // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true);
+ if ( found ) {
+ file = QAD_FileDlg::getFileName(myDesktop,
+ QString( IObject->getName() ) + ".stp",
+ tr("GEOM_MEN_IMPORT_STEP"),
+ tr("GEOM_MEN_EXPORT"),
+ false);
+ if ( !file.isEmpty() && !aShape->_is_nil() ) {
+
+ QApplication::setOverrideCursor( Qt::waitCursor ) ;
+ try {
+ myComponentGeom->ExportSTEP(strdup( file.latin1()), aShape);
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+// //VRV: OCC 4.0 migration
+// status = aWriter.Transfer( Shape->Shape(), STEPControl_ManifoldSolidBrep ) ;
+// //VRV: OCC 4.0 migration
+// test = true ;
+// if ( status != IFSelect_RetDone ) {
+// QApplication::restoreOverrideCursor() ;
+// return false ;
+// }
+ }
+ }
}
- else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
- GeomGUI->OnDisplayOnly();
+// if(test) {
+// status = aWriter.Write( strdup(file.latin1()) ) ;
+// QApplication::restoreOverrideCursor() ;
+// return status ;
+// }
break;
}
-
- case 6024: // ERASE ALL
- {
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- //VTK
- ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll();
- }
- else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- ic->EraseAll(Standard_True, Standard_False);
- ic->Display(v3d->getTrihedron());
- }
- //NRI SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- //NRI Sel->ClearInteractiveObjects();
- break;
- }
+ }
+ QApplication::restoreOverrideCursor() ;
+}
- case 6025 : // ERASE ONLY
- case 8022 : // ERASE - POPUP VIEWER
- {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- // VTK
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- Handle(SALOME_InteractiveObject) anIObject;
- for(;It.More();It.Next()) {
- anIObject = It.Value();
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
- if(myRenderInter->isInViewer(anIObject)) {
- myRenderInter->Erase(anIObject);
- } else {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !obj->_is_nil() ) {
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- bool useSubItems = false;
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- }
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- // searchin for already displayed objects with the same shape
- vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- vtkActorCollection* theAllActors = theRenderer->GetActors();
- theAllActors->InitTraversal();
- vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
- Handle(SALOME_InteractiveObject) anIObj;
- // don't create new study object if it already exists
- bool isDisplayed = false;
- while(!(actor==NULL)) {
- SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
- if (Gactor!=NULL) {
- if (Gactor->hasIO()) {
- if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
- isDisplayed = true;
- anIObj = Gactor->getIO();
- if (!anIObj.IsNull()) myRenderInter->Erase(anIObj);
- }
- }
- }
- actor=(vtkActor*)(theAllActors->GetNextActor());
- }
- }
- if (useSubItems) {
- anIter->Next();
- anAttr=SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
- }
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
- }
- }
- }
- }
- }
-// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-// for(;It.More();It.Next()) {
-// Handle(SALOME_InteractiveObject) IOS = It.Value();
- // GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);;
- }
- else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- // OCC
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- Handle(SALOME_InteractiveObject) anIObject;
- for(;It.More();It.Next()) {
- anIObject = It.Value();
- if ( v3d->isInViewer( anIObject, true ) ) {
- Standard_Boolean found;
- Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( anIObject, found, true );
- if ( found ) {
- ic->Erase(aSh);
- ic->AddOrRemoveCurrentObject(aSh, true);
- }
- } else {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !obj->_is_nil() ) {
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- bool useSubItems = false;
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- }
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- // searchin for already displayed objects with the same shape
- AIS_ListOfInteractive aDisplayed;
- ic->DisplayedObjects(aDisplayed);
- AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
- Handle(AIS_Shape) anAISShape;
- for(;anIObjects.More();anIObjects.Next()) {
- anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
- if (!anAISShape.IsNull()) {
- if (anAISShape->Shape().IsSame(Shape)) break;
- anAISShape.Nullify();
- }
- }
- if (!anAISShape.IsNull()) {
- if (ic->IsDisplayed(anAISShape)) ic->Erase(anAISShape);
- }
- }
- if (useSubItems) {
- anIter->Next();
- anAttr=SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
- }
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
- }
- }
- }
- }
- }
- }
- Sel->ClearIObjects();
- break;
- }
-
-
- case 6060: // BOUNDING BOX
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_BndBoxDlg *aDlg = new GeometryGUI_BndBoxDlg(parent, "", Sel ) ;
- break ;
- }
-
- case 6061: // MIN DISTANCE
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_DistanceDlg *aDlg = new GeometryGUI_DistanceDlg(parent, "", Sel ) ;
- break ;
- }
-
- case 8021: // WIREFRAME-SHADING
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // VTK
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-
- QApplication::setOverrideCursor( Qt::waitCursor );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- myRenderInter->SwitchRepresentation(IOS, false);
- }
- myRenderInter->Render();
- QApplication::restoreOverrideCursor();
- }
- else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean found;
- Handle(GEOM_AISShape) Shape = GeomGUI->ConvertIOinGEOMAISShape( IObject, found, true );
- if (!Shape.IsNull()) {
- AIS_DisplayMode mode = ( AIS_DisplayMode )Shape->DisplayMode();
- if ( mode == -1 )
- mode = ( AIS_DisplayMode )ic->DisplayMode();
-
- QApplication::setOverrideCursor( Qt::waitCursor );
- ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false);
- }
- QApplication::restoreOverrideCursor();
- }
- ic->UpdateCurrentViewer();
- }
- QApplication::restoreOverrideCursor();
- break;
- }
-
- case 8031: // COLOR - POPUP VIEWER
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // VTK
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-
- Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject();
- if(!FirstIOS.IsNull()) {
-
- QColor initcolor = myRenderInter->GetColor(FirstIOS);
-
- QColor c = QColorDialog::getColor( initcolor,
- QAD_Application::getDesktop() );
-
- if ( c.isValid() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- myRenderInter->SetColor(IOS,c);
- }
- }
- QApplication::restoreOverrideCursor();
- }
- }
- else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
- Standard_Boolean found;
- Handle(GEOM_AISShape) Shape = GeomGUI->ConvertIOinGEOMAISShape(IO, found, true);
- if ( found ) {
- Quantity_Color CSFColor;
- Shape->Color( CSFColor );
-
- QColor c = QColorDialog::getColor( QColor(CSFColor.Red() * 255.0,
- CSFColor.Green()* 255.0,
- CSFColor.Blue() * 255.0 ),
- QAD_Application::getDesktop() );
-
- if ( c.isValid() ) {
- CSFColor = Quantity_Color ( c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB );
- QApplication::setOverrideCursor( Qt::waitCursor );
-
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean found;
- Handle(GEOM_AISShape) Shape = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
- if ( found ) {
- Shape->SetColor ( CSFColor );
- Shape->SetShadingColor ( CSFColor );
- }
- }
- }
- }
- }
- QApplication::restoreOverrideCursor();
- break;
- }
-
- case 8032: // TRANSPARENCY - POPUP VIEWER
- {
- GeomGUI->EmitSignalDeactivateDialog() ;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- GeometryGUI_TransparencyDlg *aDlg = new GeometryGUI_TransparencyDlg( parent, "", Sel, ic ) ;
- break ;
- }
-
- case 8033: // ISOS - POPUP VIEWER
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- else {
- ic->InitCurrent();
- if ( ic->MoreCurrent() ) {
- Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
- QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
- QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
-
- if ( !IsoU.isEmpty() )
- ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
- else
- IsoU = "1";
- if ( !IsoV.isEmpty() )
- ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
- else
- IsoV = "1";
-
- GeometryGUI_NbIsosDlg * NbIsosDlg =
- new GeometryGUI_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE );
-
- NbIsosDlg->SpinBoxU->setValue(IsoU.toInt());
- NbIsosDlg->SpinBoxV->setValue(IsoV.toInt());
-
- if ( NbIsosDlg->exec() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- for ( ; ic->MoreCurrent (); ic->NextCurrent () ) {
- Handle (AIS_Drawer) CurDrawer;
-
- CurDrawer = ic->Current()->Attributes();
- CurDrawer->UIsoAspect()->SetNumber( NbIsosDlg->SpinBoxU->text().toInt() );
- CurDrawer->VIsoAspect()->SetNumber( NbIsosDlg->SpinBoxV->text().toInt() );
-
- ic->SetLocalAttributes(CurObject, CurDrawer);
- ic->Redisplay(CurObject);
- }
- }
- }
- }
- QApplication::restoreOverrideCursor();
- break;
- }
-
- case 9022 : // ERASE - OBJBROSER POPUP
- {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // VTK
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- Handle(SALOME_InteractiveObject) anIObject;
- for(;It.More();It.Next()) {
- anIObject = It.Value();
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
-// Handle(SALOME_InteractiveObject) IObject;
- if(myRenderInter->isInViewer(anIObject)) {
- myRenderInter->Erase(anIObject);
- } else {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !obj->_is_nil() ) {
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- bool useSubItems = false;
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- }
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- // searchin for already displayed objects with the same shape
- vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- vtkActorCollection* theAllActors = theRenderer->GetActors();
- theAllActors->InitTraversal();
- vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
- Handle(SALOME_InteractiveObject) anIObj;
- // don't create new study object if it already exists
- bool isDisplayed = false;
- while(!(actor==NULL)) {
- SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
- if (Gactor!=NULL) {
- if (Gactor->hasIO()) {
- if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
- isDisplayed = true;
- anIObj = Gactor->getIO();
- if (!anIObj.IsNull()) myRenderInter->Erase(anIObj);
- }
- }
- }
- actor=(vtkActor*)(theAllActors->GetNextActor());
- }
- }
- if (useSubItems) {
- anIter->Next();
- anAttr=SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
- }
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
- }
- }
- }
- }
-// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-// for(;It.More();It.Next()) {
-// Handle(SALOME_InteractiveObject) IOS = It.Value();
-// GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);;
- }
-// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-// for(;It.More();It.Next()) {
-// Handle(SALOME_InteractiveObject) IOS = It.Value();
-// GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);;
-// }
- }
- else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- // OCC
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- Handle(SALOME_InteractiveObject) anIObject;
- for(;It.More();It.Next()) {
- anIObject = It.Value();
- if ( v3d->isInViewer( anIObject, true ) ) {
- Standard_Boolean found;
- Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( anIObject, found, true );
- if ( found ) {
- ic->Erase(aSh);
- ic->AddOrRemoveCurrentObject(aSh, true);
- }
- } else {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !obj->_is_nil() ) {
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- bool useSubItems = false;
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- }
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- // searchin for already displayed objects with the same shape
- AIS_ListOfInteractive aDisplayed;
- ic->DisplayedObjects(aDisplayed);
- AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
- Handle(AIS_Shape) anAISShape;
- for(;anIObjects.More();anIObjects.Next()) {
- anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
- if (!anAISShape.IsNull()) {
- if (anAISShape->Shape().IsSame(Shape)) break;
- anAISShape.Nullify();
- }
- }
- if (!anAISShape.IsNull()) {
- if (ic->IsDisplayed(anAISShape)) ic->Erase(anAISShape);
- }
- }
- if (useSubItems) {
- anIter->Next();
- anAttr=SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
- }
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
- }
- }
- }
- }
- }
-// QAD_Viewer3d* v3d = GeomGUI->myActiveStudy->getActiveStudyFrame()->getViewerOCC();
-// Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
-// myContext->EraseSelected();
- }
-
- Sel->ClearIObjects();
- break;
- }
-
- case 9023 : // DISPLAY ONLY - OBJBROSER POPUP
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
- GeomGUI->OnVTKDisplayOnly();
- else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC )
- GeomGUI->OnDisplayOnly();
- break;
- }
-
- case 9024 : // OPEN - OBJBROSER POPUP
- {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- Handle(SALOME_InteractiveObject) anIObject;
- for(;It.More();It.Next()) {
- anIObject = It.Value();
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
- SALOMEDS::AttributePersistentRef_var aPersist;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !obj->_is_nil() ) {
- // this SObject may be GEOM module root SObject
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- SALOMEDS::GenericAttribute_var anAttr;
- bool useSubItems = false;
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) {
- useSubItems = true;
- obj = subobj;
- }
- else anIter->Next();
- }
- obj->FindAttribute(anAttr, "AttributePersistentRef");
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- if (!obj->FindAttribute(anAttr, "AttributeIOR") &&
- obj->FindAttribute(anAttr, "AttributePersistentRef")) {
- // load
- Engines::Component_var comp = GeomGUI->myDesktop->getEngine("FactoryServer","GEOM");
- if (!CORBA::is_nil(comp)) {
- SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
-
-
- SALOMEDS::StudyBuilder_var aStudyBuilder = GeomGUI->myActiveStudy->getStudyDocument()->NewBuilder();
- aStudyBuilder->LoadWith(GeomGUI->myActiveStudy->getStudyDocument()->FindComponent("GEOM"),driver);
-
- } else {
- MESSAGE("Component is null");
- }
- }
- if (useSubItems) {
- anIter->Next();
- obj = anIter->Value();
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
- }
- }
- }
- break;
- }
-
- case 10000 : // SKETCH Segment
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchSegment();
- break;
- }
- case 10001 : // SKETCH Arc
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchArc();
- break;
- }
- case 10002 : // SKETCH Set Angle
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchSetAngle();
- break;
- }
- case 10003 : // SKETCH Set X
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchSetx();
- break;
- }
- case 10004 : // SKETCH Set Y
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchSety();
- break;
- }
- case 10006 : // SKETCH Delete
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchDelete();
- break;
- }
- case 10007 : // SKETCH End
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchEnd();
- break;
- }
- case 10008 : // SKETCH Close
- {
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- break;
- GeomGUI->OnSketchClose();
- break;
- }
- case 10010 : // SKETCH OptionsOnofflengthdimension
- {
- GeomGUI->OnSketchOptionsOnofflengthdimension();
- break;
- }
- case 10011 : // SKETCH OptionsOnoffangledimension
- {
- GeomGUI->OnSketchOptionsOnoffangledimension();
- break;
- }
- case 10012 : // SKETCH OptionsOnoffradiusdimension
- {
- GeomGUI->OnSketchOptionsOnoffradiusdimension();
- break;
- }
- case 10013 : // SKETCH OptionsOnoffxdimension
- {
- GeomGUI->OnSketchOptionsOnoffxdimension();
- break;
- }
- case 10014 : // SKETCH OptionsOnoffydimension
- {
- GeomGUI->OnSketchOptionsOnoffydimension();
- break;
- }
-
- default:
- {
- parent->putInfo( tr("GEOM_PRP_COMMAND").arg(theCommandID ) );
- break;
- }
- }
-
- return true ;
-}
-//=======================================================================
-// function : ConvertClickToPoint()
-// purpose : Returns the point clicked in 3D view
-//=======================================================================
-gp_Pnt GeometryGUI::ConvertClickToPoint( Standard_Real x,
- Standard_Real y,
- Handle(V3d_View) aView )
+//=====================================================================================
+// function : Display()
+// purpose : Displays a CORBA shape
+//=====================================================================================
+bool GeometryGUI::Display( GEOM::GEOM_Shape_ptr aShape,
+ Standard_CString name)
{
- V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
- aView->Eye(XEye, YEye, ZEye);
-
- aView->At(XAt, YAt, ZAt);
- gp_Pnt EyePoint(XEye, YEye, ZEye);
- gp_Pnt AtPoint(XAt, YAt, ZAt);
-
- gp_Vec EyeVector(EyePoint, AtPoint);
- gp_Dir EyeDir(EyeVector);
-
- gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir);
- Standard_Real X, Y, Z;
- aView->Convert(x, y, X, Y, Z);
- gp_Pnt ConvertedPoint(X, Y, Z);
-
- gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint);
- gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(),
- ConvertedPointOnPlane.Y(),
- PlaneOfTheView);
- return ResultPoint;
-}
+ // MESSAGE ( "GeometryGUI::Display init ")
+ Handle(GEOM_InteractiveObject) IO;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ Sel->ClearIObjects();
+ if( aShape->_is_nil() ) {
+ QAD_MessageBox::warn1 ( QAD_Application::getDesktop(),
+ tr ("GEOM_WRN_WARNING"),
+ tr ("GEOM_PRP_ABORT"),
+ tr ("GEOM_BUT_OK") );
+ return false ;
+ }
+
+ TopoDS_Shape shape = myShapeReader.GetShape(myComponentGeom, aShape);
+ if ( shape.IsNull() )
+ return false;
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributePixMap_var aPixmap;
-//==================================================================================
-// function : 0nMousePress()
-// purpose : [static] manage mouse events
-//==================================================================================
-bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-{
- MESSAGE ( "GeometryGUI::OnMousePress")
- GeometryGUI::GetOrCreateGeometryGUI(parent);
+ SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
+ int aLocked = false;
+ if (father->_is_nil()) {
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+ aLocked = aStudy->GetProperties()->IsLocked();
+ if (aLocked) aStudy->GetProperties()->SetLocked(false);
+ father = aStudyBuilder->NewComponent("GEOM");
+ anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ // aName->SetValue( tr("GEOM_MEN_COMPONENT") );
+ aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) );
+ anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
+ aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
+ myActiveStudy->updateObjBrowser();
+ if (aLocked) aStudy->GetProperties()->SetLocked(true);
+ op->finish();
+ }
+// if (aLocked) return false;
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- return false;
+ aStudyBuilder->DefineComponentInstance( father, myComponentGeom );
+ father->ComponentIOR( myFatherior );
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
- OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort();
+ TCollection_AsciiString nameG("");
+ Standard_CString Type;
+ if ( TCollection_AsciiString(name).IsEqual(Standard_CString("")) ) {
+ if ( TCollection_AsciiString(aShape->NameType()).IsEqual(Standard_CString("")) ) {
+ Standard_CString type;
+ GetShapeTypeString(shape,type);
+ aShape->NameType( type );
+ nameG += TCollection_AsciiString( type ) + TCollection_AsciiString("_") +
+ TCollection_AsciiString( myNbGeom++ ) + TCollection_AsciiString("\0");
+ } else
+ nameG += TCollection_AsciiString( aShape->NameType()) + TCollection_AsciiString("_") +
+ TCollection_AsciiString( myNbGeom++ ) + TCollection_AsciiString("\0");
+ } else
+ nameG = TCollection_AsciiString(name);
- /* Get the clicked or selected point */
- gp_Pnt thePoint;
-
- if ( GeomGUI->myState == CURRENT_SKETCH) {
- GeomGUI->mySketcher.ValidateEdge();
- if (GeomGUI->mySketcher.GetmyEdgesNumber() == 1 ) {
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(313,&pp);
- pp->setItemEnabled( 313, true); // SKETCH CONTRAINTS
- }
- } else if( GeomGUI->myState == POINT_METHOD ) {
+ // VTK
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+
+ vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ int themode = myRenderInter->GetDisplayMode();
- GeomGUI->EraseSimulationShape() ;
- GeometryGUI_PointDlg *DialogPt = (GeometryGUI_PointDlg*)(GeomGUI->myActiveDialogBox) ;
+ vtkActorCollection* theActors =
+ GEOM_AssemblyBuilder::BuildActors(shape,0,themode,Standard_True);
+ theActors->InitTraversal();
+ vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
- if ( DialogPt->UseLocalContext() ) {
- ic->InitSelected();
- if ( pe->state() == Qt::ShiftButton )
- v3d->getAISSelector()->shiftSelect(); /* Append selection */
- else
- v3d->getAISSelector()->select(); /* New selection */
+ IO = new GEOM_InteractiveObject(aShape->Name(),
+ myFatherior,
+ "GEOM");
+ while(!(anActor==NULL)) {
+ GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
+ GActor->setIO( IO );
+ GActor->setName( nameG.ToCString() );
- if ( ic->MoreSelected() ) {
- thePoint = BRep_Tool::Pnt( TopoDS::Vertex(ic->SelectedShape()) );
- }
- else
- thePoint = ConvertClickToPoint(pe->x(), pe->y(), ( (OCCViewer_ViewPort3d*)vp)->getView() );
- }
- else
- thePoint = ConvertClickToPoint(pe->x(), pe->y(), ( (OCCViewer_ViewPort3d*)vp)->getView() );
-
- if( DialogPt != 0 ) {
- DialogPt->PointIntoCoordinates(thePoint, true) ; /* display point */
+ theRenderer->AddActor(GActor);
+ anActor = (vtkActor*)theActors->GetNextActor();
}
- else {
- // MESSAGE ("On Mouse Press : myActiveDialogBox is null" << endl) ;
- GeomGUI->myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
+ }
+ // OCC
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+ Handle(GEOM_AISShape) theResult = new GEOM_AISShape( shape, nameG.ToCString() );
+ theResult->SetShadingColor( myShadingColor );
+ IO = new GEOM_InteractiveObject(aShape->Name(),
+ myFatherior,
+ "GEOM");
+ theResult->setIO( IO );
+ theResult->setName( nameG.ToCString() );
+
+ /* Precaution : close any local context to permit the display */
+ if ( ic->HasOpenedContext() ) {
+ ic->CloseAllContexts();
}
+
+// if(isInfinite)
+// theResult->SetInfiniteState() ;
+
+ ic->Display(theResult);
}
- return false ;
-}
-
-
-//=======================================================================
-// function : OnMouseMove()
-// purpose : [static] manage mouse events
-//=======================================================================
-bool GeometryGUI::OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-{
- GeometryGUI::GetOrCreateGeometryGUI(parent);
-
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
- return false;
-
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
- OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort();
-
- if ( GeomGUI->myState == CURRENT_SKETCH)
- GeomGUI->mySketcher.MakeCurrentEdge( pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView() );
+ Sel->AddIObject( IO, false );
+ myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint();
+ if ( mySettings_AddInStudy )
+ AddInStudy( false, IO );
- return true;
-}
-
-
-//================================================================================
-// function : SetDisplayedObjectList()
-// purpose :
-//================================================================================
-void GeometryGUI::SetDisplayedObjectList()
-{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
- return;
-
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- ListDisplayedObject.Clear();
-
- Handle (AIS_InteractiveContext) aContext = v3d->getAISContext();
- aContext->DisplayedObjects( ListDisplayedObject );
+ return true;
}
-
//=====================================================================================
-// function : OnDisplayAll()
-// purpose :
+// function : AddInStudy()
+// purpose : anIOShape or a selected shape
//=====================================================================================
-void GeometryGUI::OnDisplayAll(bool onlyPreviousDisplayedObject)
+bool GeometryGUI::AddInStudy( bool selection,
+ const Handle(SALOME_InteractiveObject)& anIO)
{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
- return;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ if ( !( !mySettings_AddInStudy || selection ) ) {
+ Sel->ClearIObjects();
+ }
+
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributePixMap_var aPixmap;
+ SALOMEDS::AttributeIOR_var anIOR;
+ SALOMEDS::AttributeSelectable_var aSelAttr;
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
+ SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
+ int aLocked = false;
+ if (father->_is_nil()) {
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+ aLocked = aStudy->GetProperties()->IsLocked();
+ if (aLocked) aStudy->GetProperties()->SetLocked(false);
+ father = aStudyBuilder->NewComponent("GEOM");
+ anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ // aName->SetValue( tr("GEOM_MEN_COMPONENT") );
+ aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) );
+ anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
+ aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
+ if (aLocked) aStudy->GetProperties()->SetLocked(true);
+ op->finish();
+ }
+// if (aLocked) return false;
+
+ aStudyBuilder->DefineComponentInstance( father, myComponentGeom );
+ father->ComponentIOR( myFatherior );
- myContext->Display(v3d->getTrihedron());
+ SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry());
+
+ Handle(GEOM_AISShape) GAISShape;
+ GEOM_Actor* GActor;
+ Handle(GEOM_InteractiveObject) GIO;
+ bool found = false;
- if ( !onlyPreviousDisplayedObject ) {
- AIS_ListOfInteractive List1;
- myContext->ObjectsInCollector(List1);
- AIS_ListIteratorOfListOfInteractive ite1(List1);
- while (ite1.More()) {
- if (ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
- if ( aSh->hasIO() ) {
- Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
- if ( v3d->isInViewer(GIO, true) ) {
- myContext->Display(aSh);
+ // VTK
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+
+ vtkActorCollection* theActors = Renderer->GetActors();
+ theActors->InitTraversal();
+ vtkActor *ac = theActors->GetNextActor();
+ while(!(ac==NULL)) {
+ if ( ac->IsA("GEOM_Actor") ) {
+ GEOM_Actor* anActor = GEOM_Actor::SafeDownCast( ac );
+ if ( anActor->hasIO() ) {
+ Handle(SALOME_InteractiveObject) IO = anActor->getIO();
+ if ( IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
+ GIO = Handle(GEOM_InteractiveObject)::DownCast( IO );
+ if ( anIO->isSame( GIO ) ) {
+ found = true;
+ GActor = anActor;
+ break;
+ }
}
}
}
- ite1.Next();
+ ac = theActors->GetNextActor();
}
- } else {
- AIS_ListIteratorOfListOfInteractive ite(ListDisplayedObject);
+
+ if ( !found )
+ return false;
+ }
+ // OCC
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects(List);
+ AIS_ListIteratorOfListOfInteractive ite(List);
while (ite.More()) {
if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
if ( aSh->hasIO() ) {
- Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
- if ( v3d->isInViewer(GIO,true) ) {
- myContext->Display(aSh);
+ Handle(SALOME_InteractiveObject) IO = aSh->getIO();
+ if ( IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
+ GIO = Handle(GEOM_InteractiveObject)::DownCast( IO );
+ if ( anIO->isSame( GIO ) ) {
+ found = true;
+ GAISShape = aSh;
+ break;
+ }
}
}
}
ite.Next();
}
- }
-}
-
-
-
-
-//=====================================================================================
-// function : OnVTKDisplayOnly()
-// purpose :
-//=====================================================================================
-void GeometryGUI::OnVTKDisplayOnly()
-{
- // Erase all not selected actors
-
- QApplication::setOverrideCursor( Qt::waitCursor );
+ if ( !found )
+ return false;
+ }
- vtkRenderer* aren = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if(!anActor->isHighlighted()) anActor->VisibilityOff();
+ if ( !mySettings_AddInStudy || selection ) {
+ QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), anIO->getName() );
+ if ( !Name.isEmpty() ) {
+ // VTK
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ GActor->setName( strdup(Name.latin1()) );
+ }
+ // OCC
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ GAISShape->setName( strdup(Name.latin1()) );
+ }
+ } else {
+ return false;
}
- ac = theActors->GetNextActor();
}
- // Display selection
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(GeomGUI->myActiveStudy->getActiveStudyFrame()->entry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
+ // open transaction
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
+ SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father);
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GIO->getIOR() );
- if(myRenderInter->isInViewer(IObject)) {
- myRenderInter->Display(IObject);
- }
- else {
- // Create new actor
- if ( !obj->_is_nil() ) {
- if ( !obj->FindAttribute(anAttr, "AttributeIOR"))
- break;
- // If selected object contains displayable subobjects, then do nothing
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- SALOMEDS::GenericAttribute_var aTmpAttr;
-
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- if (CORBA::is_nil(aShape)) continue;
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
+ /* For the shape inserted into the study we set its field 'studyshapeid' */
+ /* so the shape will contain its corresponding entry in the study Ocaf doc. */
+ aShape->StudyShapeId(newObj->GetID()) ;
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- // open transaction
- QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy );
- op->start();
-
- SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
- aStudyBuilder->Addreference(newObj1, obj);
- // commit transaction
- op->finish();
-
- vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- int themode = myRenderInter->GetDisplayMode();
- vtkActorCollection* theActors =
- GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
- theActors->InitTraversal();
- vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
- while(!(anActor==NULL)) {
- GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
- GActor->setIO( IObject );
- GActor->setName( IObject->getName() );
-
- theRenderer->AddActor(GActor);
- vtkRenderWindow *renWin
- = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow();
- renWin->Render();
- anActor = (vtkActor*)theActors->GetNextActor();
- }
- }
- }
- }
+ GIO->setEntry(newObj->GetID());
+
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ anIOR->SetValue(aShape->Name());
+
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
+ aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+ if ( aShape->ShapeType() == GEOM::COMPOUND ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" );
+ } else if ( aShape->ShapeType() == GEOM::COMPSOLID ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" );
+ } else if ( aShape->ShapeType() == GEOM::SOLID ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" );
+ } else if ( aShape->ShapeType() == GEOM::SHELL ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" );
+ } else if ( aShape->ShapeType() == GEOM::FACE ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" );
+ } else if ( aShape->ShapeType() == GEOM::WIRE ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" );
+ } else if ( aShape->ShapeType() == GEOM::EDGE ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" );
+ } else if ( aShape->ShapeType() == GEOM::VERTEX ) {
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
}
- GeomGUI->myActiveStudy->updateObjBrowser( true );
- QApplication::restoreOverrideCursor();
-}
+ // VTK
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ GActor->setIO( GIO );
+ aName->SetValue(GActor->getName());
+ }
+ // OCC
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ GAISShape->setIO( GIO );
+ aName->SetValue(GAISShape->getName());
+ }
+ SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
+ aStudyBuilder->Addreference(newObj1,newObj);
-//=====================================================================================
-// function : OnDisplayOnly()
-// purpose :
-//=====================================================================================
-void GeometryGUI::OnDisplayOnly()
-{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
- return;
+ GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR;
+ listIOR = myComponentGeom->GetReferencedObjects(aShape);
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+ if (listIOR->length()>0) {
+ SALOMEDS::SObject_var Arguments = aStudyBuilder->NewObject(newObj);
+ anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue(tr("GEOM_ARGUMENTS"));
+ anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeSelectable");
+ aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
+ aSelAttr->SetSelectable(false);
- AIS_ListOfInteractive List;
- ic->DisplayedObjects(List);
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- if (!ic->IsSelected( aSh )) {
- ic->Erase( aSh, Standard_True, Standard_True );
+ bool ObjectReferenced = false;
+ for (unsigned int ind = 0; ind < listIOR->length();ind++) {
+ SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(listIOR[ind]);
+
+ if ( !theObj->_is_nil() ) {
+ SALOMEDS::SObject_var RefObject = aStudyBuilder->NewObject(Arguments);
+ aStudyBuilder->Addreference(RefObject, theObj);
+ ObjectReferenced = true;
}
}
- ite.Next();
- }
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ if ( !ObjectReferenced )
+ aStudyBuilder->RemoveObject(Arguments);
+ }
- SALOME_ListIteratorOfListIO It1( Sel->StoredIObjects() );
- for(;It1.More();It1.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It1.Value();
+ op->finish();
-
- SALOMEDS::SObject_var fatherSF =
- aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry());
- if ( v3d->isInViewer( IObject, true ) ) {
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector(List1);
- AIS_ListIteratorOfListOfInteractive ite1(List1);
- while (ite1.More()) {
- if (ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
- if ( aSh->hasIO() ) {
- Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
- if ( IObject->isSame( GIO ) ) {
- ic->Display(aSh);
- ic->AddOrRemoveCurrentObject(aSh, true);
- break;
- }
- }
- }
- ite1.Next();
- }
- } else {
- if ( IObject->hasEntry() ) {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !obj->_is_nil() ) {
- if (obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( anIOR->Value() );
- if (CORBA::is_nil(aShape)) continue;
- TopoDS_Shape Shape = ShapeReader.GetShape(myComponentGeom, aShape);
-
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- // open transaction
- QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
- op->start();
-
- SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
- aStudyBuilder->Addreference(newObj1, obj);
- // commit transaction
- op->finish();
- }
-
- Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
- Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), Fatherior,"GEOM");
-
- IO->setEntry(obj->GetID());
- aSh->setIO( IO );
- aSh->setName( aName->Value() );
- ic->Display (aSh);
- ic->AddOrRemoveCurrentObject(aSh, true);
- }
- }
- }
- }
+ if ( !mySettings_AddInStudy || selection ) {
+ myActiveStudy->updateObjBrowser();
+ } else {
+ myActiveStudy->updateObjBrowser(false);
+ Sel->AddIObject( GIO );
}
+
+ // MESSAGE ( " highlihght done" )
+ return true;
+
}
-//===============================================================================
-// function : OnEditDelete()
-// purpose :
-//===============================================================================
-void GeometryGUI::OnEditDelete()
+//=====================================================================================
+// function : GetShapeFromIOR()
+// purpose : exist also as static method !
+//=====================================================================================
+TopoDS_Shape GeometryGUI::GetShapeFromIOR( QString IOR )
{
- if ( QAD_MessageBox::warn2
- ( QAD_Application::getDesktop(),
- tr ("GEOM_WRN_WARNING"),
- tr ("GEOM_REALLY_DELETE"),
- tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 )
- return;
-
- int nbSf = myActiveStudy->getStudyFramesCount();
-
- Standard_Boolean found;
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if ( IObject->hasEntry() ) {
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
- SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() );
-
- /* Erase child graphical objects */
- SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
- for (; it->More();it->Next()) {
- SALOMEDS::SObject_var CSO= it->Value();
- if (CSO->FindAttribute(anAttr, "AttributeIOR") ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- /* Delete child(s) shape in Client : */
- const TCollection_AsciiString ASCior(anIOR->Value()) ;
- ShapeReader.RemoveShapeFromBuffer( ASCior ) ;
-
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_OCC ) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
- Handle(GEOM_AISShape) Result = GeomGUI->ConvertIORinGEOMAISShape( anIOR->Value(), found );
- if ( found )
- myContext->Erase( Result, true, false );
- } else if ( sf->getTypeView() == VIEW_VTK ) {
- //vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer();
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
- GEOM_Actor* ac = GeomGUI->ConvertIORinGEOMActor( anIOR->Value(), found );
- if ( found ) {
- //Renderer->RemoveActor(ac);
- if ( ac->hasIO() )
- myRenderInter->Remove( ac->getIO() );
- }
- }
- }
- }
- }
-
- /* Erase main graphical object */
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_OCC ) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
- Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape( IObject, found );
- if ( found )
- myContext->Erase( Result, true, false );
- } else if ( sf->getTypeView() == VIEW_VTK ) {
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
- myRenderInter->Remove( IObject );
- }
- }
-
- /* Delete main shape in Client : */
- if (SO->FindAttribute(anAttr, "AttributeIOR") ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- const TCollection_AsciiString ASCIor(anIOR->Value()) ;
- ShapeReader.RemoveShapeFromBuffer( ASCIor ) ;
- }
+ TopoDS_Shape result;
+ if( IOR.stripWhiteSpace().isEmpty() )
+ return result;
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ CORBA::ORB_var& _orb = init.orb() ;
+ CORBA::Object_var obj = _orb->string_to_object( (char*)(IOR.latin1()) );
+ if ( CORBA::is_nil( obj ) )
+ return result;
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( IOR );
+ if (!aShape->_is_nil()) {
+ result = myShapeReader.GetShape( myComponentGeom, aShape );
+ }
+ return result;
+}
- /* Erase objects in Study */
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
- if ( !obj->_is_nil() ) {
- QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
- op->start();
- aStudyBuilder->RemoveObject(obj);
- op->finish();
- }
- } /* IObject->hasEntry() */
- } /* more/next */
- /* Clear any previous selection */
- Sel->ClearIObjects() ;
- myActiveStudy->updateObjBrowser();
+//=======================================================================
+// function : Parameter()
+// purpose : return a parameter (float) from a dialog box
+//
+// avalue1 : is a float or integer used as a default value displayed
+// aTitle1 : is the title for aValue1
+// aTitle : is the main title
+// bottom : maximum value to be entered
+// top : minimum value to be entered
+// decimals : number of decimals
+//=======================================================================
+double GeometryGUI::Parameter( Standard_Boolean& res,
+ const char* aValue1,
+ const char* aTitle1,
+ const char* aTitle,
+ const double bottom,
+ const double top,
+ const int decimals )
+{
+ GeometryGUI_aParameterDlg * Dialog =
+ new GeometryGUI_aParameterDlg(aValue1,
+ aTitle1,
+ QAD_Application::getDesktop(),
+ aTitle,
+ TRUE,
+ 0,
+ bottom,
+ top,
+ decimals) ;
+ int r = Dialog->exec() ;
+ float X = 0.0 ;
+ if ( r == QDialog::Accepted ) {
+ res = Standard_True;
+ X = Dialog->getValue();
+ } else
+ res = Standard_False;
+ delete Dialog;
+ return X;
}
-//==============================================================================
-// function : OnEditCopy()
-// purpose :
-//==============================================================================
-void GeometryGUI::OnEditCopy()
+//=======================================================================
+// function : OnSketchSegment()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchSegment()
{
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR;
+ this->mySketcher.ChangeMode(SEGMENT);
+}
- const SALOME_ListIO& List = Sel->StoredIObjects();
- GeomGUI->ConvertListOfIOInListOfIOR( List, listIOR);
+//=======================================================================
+// function : OnSketchArc()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchArc()
+{
+ this->mySketcher.ChangeMode(ARC_CHORD);
+}
- Sel->ClearIObjects();
+//=======================================================================
+// function : OnSketchSetAngle()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchSetAngle()
+{
+ Standard_Real anAngle = this->mySketcher.GetSegmentAngle()/PI180;
+ Sketch::fitInResol(anAngle);
+ Standard_Boolean res = false ;
+ QString Value = QString("%1").arg( anAngle );
+ anAngle = Parameter(res, Value, tr("GEOM_MEN_ANGLE"), tr("GEOM_MEN_ENTER_ANGLE"), -180.0, +180.0, 6 )*PI180 ;
- for (unsigned int ind = 0; ind < listIOR->length();ind++) {
- GEOM::GEOM_Shape_var aShapeInit = myComponentGeom->GetIORFromString(listIOR[ind]);
- try {
- GEOM::GEOM_Shape_var result = myComponentGeom->MakeCopy(aShapeInit) ;
- result->NameType( aShapeInit->NameType() );
- this->Display(result);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
+ if( res ) {
+ this->mySketcher.SetSegmentAngle(anAngle);
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(3133,&pp);
+ pp->setItemChecked(3133,false);
+ item = Mb->findItem(3134,&pp);
+ pp->setItemChecked(3134,false);
}
- myDesktop->putInfo(tr("GEOM_PRP_READY"));
}
-
-//=====================================================================================
-// function : OnKeyPress()
-// purpose : [static]
-//=====================================================================================
-bool GeometryGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+//=======================================================================
+// function : OnSketchSetx()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchSetx()
{
- GeometryGUI::GetOrCreateGeometryGUI(parent);
-
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
- return false;
-
- return true ;
+ Standard_Boolean res = false;
+ double X = Parameter( res,
+ "0.",
+ tr("GEOM_MEN_X"),
+ tr("GEOM_MEN_SKETCHER_X"),
+ 2.0 * Precision::Confusion(),
+ 1E6,
+ 6 ) ;
+ if (res)
+ this->mySketcher.SetXDimension(X);
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(3133,&pp);
+ pp->setItemChecked(3133,false);
+ item = Mb->findItem(3134,&pp);
+ pp->setItemChecked(3134,false);
}
+//=======================================================================
+// function : OnSketchSety()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchSety()
+{
+ Standard_Boolean res = false;
+ double Y = Parameter( res,
+ "0.",
+ tr("GEOM_MEN_Y"),
+ tr("GEOM_MEN_SKETCHER_Y"),
+ 2.0 * Precision::Confusion(),
+ 1E6,
+ 6 ) ;
+ if (res)
+ this->mySketcher.SetYDimension(Y);
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(3133,&pp);
+ pp->setItemChecked(3133,false);
+ item = Mb->findItem(3134,&pp);
+ pp->setItemChecked(3134,false);
+}
-//=====================================================================================
-// function : DisplaySimulationShape()
-// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape
-//=====================================================================================
-void GeometryGUI::DisplaySimulationShape(const TopoDS_Shape& S)
+//=======================================================================
+// function : OnSketchDelete()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchDelete()
{
- if( S.IsNull() )
- return ;
-
- //NRI DEBUG : 14/02/2002
- if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
- return ;
-
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-
- try {
- /* erase any previous */
- ic->Erase( this->mySimulationShape, Standard_True, Standard_False );
- ic->ClearPrs( this->mySimulationShape );
- this->mySimulationShape = new AIS_Shape( TopoDS_Shape() ) ;
- this->mySimulationShape->Set( S ) ;
- this->mySimulationShape->SetColor(Quantity_NOC_VIOLET) ;
- ic->Deactivate( this->mySimulationShape );
- ic->Display( this->mySimulationShape, Standard_False );
- ic->UpdateCurrentViewer();
+ if (mySketcher.GetmyEdgesNumber() == 1 ) {
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(313,&pp);
+ pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS
+ mySketcher.SetTransitionStatus(NOCONSTRAINT);
}
- catch(Standard_Failure) {
- MESSAGE( "Exception catched in GeometryGUI::DisplaySimulationShape " ) ;
- }
- this->mySimulationShape->UnsetColor() ;
- return ;
-}
+ if (this->mySketcher.Delete())
+ ResetState();
+}
-//==================================================================================
-// function : EraseSimulationShape()
-// purpose : Clears the display of 'mySimulationShape' a pure graphical shape
-//==================================================================================
-void GeometryGUI::EraseSimulationShape()
+//=======================================================================
+// function : OnSketchClose()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchClose()
{
- int count = myActiveStudy->getStudyFramesCount();
- for ( int i = 0; i < count; i++ ) {
- if (myActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC ) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
- ic->Erase( this->mySimulationShape, Standard_True, Standard_False );
- ic->ClearPrs( this->mySimulationShape );
- ic->UpdateCurrentViewer();
-
- } else if (myActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_VTK ) { // VTK
- }
- }
- // MESSAGE ( " GeometryGUI::EraseSimulationShape done. " )
-}
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
+ TopoDS_Wire W = this->mySketcher.Close();
+ if ( !W.IsNull() ) {
+ //
+ GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR;
+ listShapes->length(0);
+ unsigned int i = 0;
+ BRepTools_WireExplorer Ex(W);
+ while ( Ex.More() ) {
+ TopoDS_Edge E = Ex.Current();
+ gp_Pnt pt1 , pt2 ;
-//=====================================================================================
-// function : Import
-// purpose : BRep, Iges, Step
-//=====================================================================================
-bool GeometryGUI::Import( )
-{
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-
- GEOM::GEOM_Shape_var aShape;
- QString file;
- QStringList filtersList ;
-
- switch ( GeomGUI->myState )
- {
- case 111 : // Import BREP
- {
- filtersList.append( tr("GEOM_MEN_IMPORT_BREP") );
- filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
+ pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E));
+ pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E));
+
+ gp_Pnt CenterPoint;
+ Handle(Geom_Curve) Curve;
+ Handle(Geom_Circle) Circle;
+ gp_Circ Circ;
+ Standard_Real First,Last;
+
+ Curve = BRep_Tool::Curve(E,First,Last);
+ if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) {
+ Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ
+ Circ = Circle->Circ(); // gp_Circ
+
+ Curve->D0( (First + Last) / 2. , CenterPoint );
+
+ GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
+ GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() );
+ GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
- file = QAD_FileDlg::getFileName(myDesktop,
- "",
- filtersList,
- tr("GEOM_MEN_IMPORT"),
- true);
- if ( !file.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- aShape = myComponentGeom->ImportBREP( file.latin1() );
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
- }
- break;
- }
- case 112 : // Import IGES
- {
- filtersList.append( tr("GEOM_MEN_IMPORT_IGES") ) ;
- filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
+ GEOM::GEOM_Shape_var arc;
- file = QAD_FileDlg::getFileName(myDesktop,
- "",
- filtersList,
- tr("GEOM_MEN_IMPORT"),
- true);
- if ( !file.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- aShape = myComponentGeom->ImportIGES( file.latin1() );
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
+ try {
+ arc = myComponentGeom->MakeArc(pI, pC, pE) ;
}
- break;
- }
- case 113 : // Import STEP
- {
- filtersList.append( tr("GEOM_MEN_IMPORT_STEP") ) ;
- filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
-
- file = QAD_FileDlg::getFileName(myDesktop,
- "",
- filtersList,
- tr("GEOM_MEN_IMPORT"),
- true);
- if ( !file.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- aShape = myComponentGeom->ImportSTEP( file.latin1() );
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
}
- break;
- }
- }
-
- if ( !file.isEmpty() ) {
- myDesktop->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) );
- SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
- SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID( myActiveStudy->getActiveStudyFrame()->entry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributePixMap_var aPixmap;
- int aLocked = false;
- if (father->_is_nil()) {
- QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
- op->start();
- aLocked = aStudy->GetProperties()->IsLocked();
- if (aLocked) aStudy->GetProperties()->SetLocked(false);
- father = aStudyBuilder->NewComponent("GEOM");
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- // aName->SetValue( tr("GEOM_MEN_COMPONENT") );
- aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) );
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
- if (aLocked) aStudy->GetProperties()->SetLocked(true);
- op->finish();
- }
-// if (aLocked) return false;
- aStudyBuilder->DefineComponentInstance( father, myComponentGeom );
- father->ComponentIOR( Fatherior );
+ listShapes->length(i+1);
+ listShapes[i] = strdup(arc->Name());
+ i++;
+ } else {
+ GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
+ GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
+ GEOM::GEOM_Shape_var segment;
- QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(this->myNbGeom++);
+ try {
+ segment = myComponentGeom->MakeEdge(pI,pE) ;
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
- if ( Display ( aShape, strdup(nameShape.latin1())) ) {
- myActiveStudy->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) );
- myDesktop->putInfo( tr("GEOM_PRP_READY"));
+ listShapes->length(i+1);
+ listShapes[i] = strdup(segment->Name());
+ i++;
+ }
+ Ex.Next();
}
+ GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ;
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, Wire);
+ Standard_CString type;
+ GetShapeTypeString(S,type);
+ Wire->NameType( type );
+
+ if ( Display(Wire, "" )) {
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
}
- QApplication::restoreOverrideCursor();
- return true ;
+ ResetState();
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(313,&pp);
+ pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS
+ mySketcher.SetTransitionStatus(NOCONSTRAINT);
}
-//=====================================================================================
-// function : Export
-// purpose : BRep, Iges, Step
-//=====================================================================================
-bool GeometryGUI::Export( )
-{
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- GEOM::GEOM_Shape_var aShape;
+//=======================================================================
+// function : OnSketchEnd()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchEnd()
+{
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
- static QString filters[] = { tr("GEOM_MEN_IMPORT_BREP"),
- tr("GEOM_MEN_IMPORT_IGES"),
- tr("GEOM_MEN_IMPORT_STEP") };
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( this->myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ TopoDS_Wire W = this->mySketcher.End();
+ if (!W.IsNull()) {
+ //
+ GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR;
+ listShapes->length(0);
+ unsigned int i = 0;
- switch ( GeomGUI->myState )
- {
- case 121 :
- {
- for(;It.More();It.Next()) {
- QApplication::restoreOverrideCursor();
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean found;
- GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found);
- // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true);
- if ( found ) {
- QString file = QAD_FileDlg::getFileName(myDesktop,
- QString( IObject->getName() ) + ".brep",
- tr("GEOM_MEN_IMPORT_BREP"),
- tr("GEOM_MEN_EXPORT"),
- false);
- if ( !file.isEmpty() && !aShape->_is_nil() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- // Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) );
- try {
- GeomGUI->myComponentGeom->ExportBREP(strdup( file.latin1()), aShape);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
- }
- }
- }
- break;
- }
- case 122 :
- {
- for(;It.More();It.Next()) {
- QApplication::restoreOverrideCursor();
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean found;
- GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found);
- // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true);
- if ( found ) {
- QString file = QAD_FileDlg::getFileName(myDesktop,
- QString( IObject->getName() ) + ".igs",
- tr("GEOM_MEN_IMPORT_IGES"),
- tr("GEOM_MEN_EXPORT"),
- false);
- if ( !file.isEmpty() && !aShape->_is_nil() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- GeomGUI->myComponentGeom->ExportIGES(strdup( file.latin1()), aShape);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
-// //VRV: OCC 4.0 migration
-// IGESControl_Controller::Init();
-// IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"),
-// Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
-// //VRV: OCC 4.0 migration
+ BRepTools_WireExplorer Ex(W);
+ while ( Ex.More() ) {
+ TopoDS_Edge E = TopoDS::Edge( Ex.Current() );
+
+ gp_Pnt pt1 , pt2 ;
+ pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E));
+ pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E));
-// ICW.AddShape (Shape->Shape());
-// ICW.ComputeModel();
-// Standard_Boolean result = ICW.Write( strdup(file.latin1()) );
- }
- }
- }
- break;
- }
+ gp_Pnt CenterPoint;
+ Handle(Geom_Curve) Curve;
+ Handle(Geom_Circle) Circle;
+ gp_Circ Circ;
+ Standard_Real First,Last;
+
+ Curve = BRep_Tool::Curve(E,First,Last);
+ if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) {
+ Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ
+ Circ = Circle->Circ(); // gp_Circ
+
+ Curve->D0( (First + Last) / 2. , CenterPoint );
- case 123 :
- {
-// bool test = false ;
-// IFSelect_ReturnStatus status ;
-// //VRV: OCC 4.0 migration
-// STEPControl_Writer aWriter;
-// //VRV: OCC 4.0 migration
- QString file;
+ GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
+ GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() );
+ GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
- for( ; It.More(); It.Next() ) {
-// GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found);
- QApplication::restoreOverrideCursor();
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean found;
- GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found);
- // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true);
- if ( found ) {
- file = QAD_FileDlg::getFileName(myDesktop,
- QString( IObject->getName() ) + ".stp",
- tr("GEOM_MEN_IMPORT_STEP"),
- tr("GEOM_MEN_EXPORT"),
- false);
- if ( !file.isEmpty() && !aShape->_is_nil() ) {
+ GEOM::GEOM_Shape_var arc;
- QApplication::setOverrideCursor( Qt::waitCursor ) ;
- try {
- GeomGUI->myComponentGeom->ExportSTEP(strdup( file.latin1()), aShape);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
-// //VRV: OCC 4.0 migration
-// status = aWriter.Transfer( Shape->Shape(), STEPControl_ManifoldSolidBrep ) ;
-// //VRV: OCC 4.0 migration
-// test = true ;
-// if ( status != IFSelect_RetDone ) {
-// QApplication::restoreOverrideCursor() ;
-// return false ;
-// }
- }
- }
+ try {
+ arc = myComponentGeom->MakeArc(pI, pC, pE) ;
}
-// if(test) {
-// status = aWriter.Write( strdup(file.latin1()) ) ;
-// QApplication::restoreOverrideCursor() ;
-// return status ;
-// }
- break;
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+
+ listShapes->length(i+1);
+ listShapes[i] = strdup(arc->Name());
+ i++;
+ } else {
+ GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
+ GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
+ GEOM::GEOM_Shape_var segment;
+
+ try {
+ segment = myComponentGeom->MakeEdge(pI,pE) ;
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+
+ listShapes->length(i+1);
+ listShapes[i] = strdup(segment->Name());
+ i++;
}
+ Ex.Next();
+ }
+ GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ;
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, Wire);
+ Standard_CString type;
+ GetShapeTypeString(S,type);
+ Wire->NameType( type );
+
+ if ( Display(Wire, "") ) {
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
- QApplication::restoreOverrideCursor() ;
+ }
+ ResetState();
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(313,&pp);
+ pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS
+ mySketcher.SetTransitionStatus(NOCONSTRAINT);
}
+//=======================================================================
+// function : OnSettingsNoconstraint()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSettingsNoconstraint()
+{
+ this->mySketcher.SetTransitionStatus(NOCONSTRAINT);
+}
-//=====================================================================================
-// function : Display()
-// purpose : Displays a CORBA shape
-//=====================================================================================
-bool GeometryGUI::Display( GEOM::GEOM_Shape_ptr aShape,
- Standard_CString name)
+//=======================================================================
+// function : OnSettingsPerpendicular()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSettingsPerpendicular()
{
- // MESSAGE ( "GeometryGUI::Display init ")
- Handle(GEOM_InteractiveObject) IO;
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- Sel->ClearIObjects();
+ this->mySketcher.SetTransitionStatus(PERPENDICULAR);
+}
- if( aShape->_is_nil() ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(),
- tr ("GEOM_WRN_WARNING"),
- tr ("GEOM_PRP_ABORT"),
- tr ("GEOM_BUT_OK") );
- return false ;
- }
-
- TopoDS_Shape shape = ShapeReader.GetShape(myComponentGeom, aShape);
+//=======================================================================
+// function : OnSettingsTangent()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSettingsTangent()
+{
+ this->mySketcher.SetTransitionStatus(TANGENT);
+}
- if ( shape.IsNull() )
- return false;
+//=======================================================================
+// function : OnSketchOptionsOnoffangledimension()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchOptionsOnoffangledimension()
+{
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(10011,&pp);
+ pp->setItemChecked(10011,!pp->isItemChecked(10011));
+ this->mySketcher.SetParameterVisibility(ANGLE_PARAMETER,pp->isItemChecked(10011));
+}
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributePixMap_var aPixmap;
+//=======================================================================
+// function : OnSketchOptionsOnofflengthdimension()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchOptionsOnofflengthdimension()
+{
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(10010,&pp);
+ pp->setItemChecked(10010,!pp->isItemChecked(10010));
+ this->mySketcher.SetParameterVisibility(LENGTH_PARAMETER,pp->isItemChecked(10010));
+}
- SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
- int aLocked = false;
- if (father->_is_nil()) {
- QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
- op->start();
- aLocked = aStudy->GetProperties()->IsLocked();
- if (aLocked) aStudy->GetProperties()->SetLocked(false);
- father = aStudyBuilder->NewComponent("GEOM");
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- // aName->SetValue( tr("GEOM_MEN_COMPONENT") );
- aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) );
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
- myActiveStudy->updateObjBrowser();
- if (aLocked) aStudy->GetProperties()->SetLocked(true);
- op->finish();
- }
-// if (aLocked) return false;
+//=======================================================================
+// function : OnSketchOptionsOnoffradiusdimension()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchOptionsOnoffradiusdimension()
+{
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(10012,&pp);
+ pp->setItemChecked(10012,!pp->isItemChecked(10012));
+ this->mySketcher.SetParameterVisibility(RADIUS_PARAMETER,pp->isItemChecked(10012));
+}
- aStudyBuilder->DefineComponentInstance( father, myComponentGeom );
- father->ComponentIOR( Fatherior );
- TCollection_AsciiString nameG("");
- Standard_CString Type;
- if ( TCollection_AsciiString(name).IsEqual(Standard_CString("")) ) {
- if ( TCollection_AsciiString(aShape->NameType()).IsEqual(Standard_CString("")) ) {
- Standard_CString type;
- GetShapeTypeString(shape,type);
- aShape->NameType( type );
- nameG += TCollection_AsciiString( type ) + TCollection_AsciiString("_") +
- TCollection_AsciiString( GeomGUI->myNbGeom++ ) + TCollection_AsciiString("\0");
- } else
- nameG += TCollection_AsciiString( aShape->NameType()) + TCollection_AsciiString("_") +
- TCollection_AsciiString( GeomGUI->myNbGeom++ ) + TCollection_AsciiString("\0");
- } else
- nameG = TCollection_AsciiString(name);
-
- // VTK
- if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
- vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- int themode = myRenderInter->GetDisplayMode();
+//=======================================================================
+// function : OnSketchOptionsOnoffxdimension()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchOptionsOnoffxdimension()
+{
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(10013,&pp);
+ pp->setItemChecked(10013,!pp->isItemChecked(10013));
+ this->mySketcher.SetParameterVisibility(XVALUE_PARAMETER,pp->isItemChecked(10013));
+}
- vtkActorCollection* theActors =
- GEOM_AssemblyBuilder::BuildActors(shape,0,themode,Standard_True);
- theActors->InitTraversal();
- vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
+//=======================================================================
+// function : OnSketchOptionsOnoffydimension()
+// purpose :
+//=======================================================================
+void GeometryGUI::OnSketchOptionsOnoffydimension()
+{
+ QMenuBar* Mb = this->myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(10014,&pp);
+ pp->setItemChecked(10014,!pp->isItemChecked(10014));
+ this->mySketcher.SetParameterVisibility(YVALUE_PARAMETER,pp->isItemChecked(10014));
+}
- IO = new GEOM_InteractiveObject(aShape->Name(),
- Fatherior,
- "GEOM");
- while(!(anActor==NULL)) {
- GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
- GActor->setIO( IO );
- GActor->setName( nameG.ToCString() );
+
+//=======================================================================
+// function : Archimede()
+// purpose :
+//=======================================================================
+void GeometryGUI::Archimede( const Handle(SALOME_InteractiveObject)& IO,
+ const double aWeight,
+ const double aWaterDensity,
+ const double aMeshingDeflection )
+{
+ try {
+ if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
+ Handle(GEOM_InteractiveObject) GIO =
+ Handle(GEOM_InteractiveObject)::DownCast( IO );
+ GEOM::GEOM_Shape_var Shape = myComponentGeom->GetIORFromString( GIO->getIOR() );
- theRenderer->AddActor(GActor);
- anActor = (vtkActor*)theActors->GetNextActor();
+ GEOM::GEOM_Shape_var Result = myComponentGeom->Archimede( Shape, aWeight, aWaterDensity, aMeshingDeflection);
+ Result->NameType(tr("GEOM_PLANE"));
+ if ( Display(Result, "") ) {
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ return;
}
- }
- // OCC
- else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
- Handle(GEOM_AISShape) theResult = new GEOM_AISShape( shape, nameG.ToCString() );
- theResult->SetShadingColor( myShadingColor );
- IO = new GEOM_InteractiveObject(aShape->Name(),
- Fatherior,
- "GEOM");
- theResult->setIO( IO );
- theResult->setName( nameG.ToCString() );
-
- /* Precaution : close any local context to permit the display */
- if ( ic->HasOpenedContext() ) {
- ic->CloseAllContexts();
+ if ( IO->hasEntry() ) {
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !obj->_is_nil() ) {
+ if (obj->FindAttribute(anAttr, "AttributeIOR")) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var Shape = myComponentGeom->GetIORFromString( anIOR->Value() );
+ GEOM::GEOM_Shape_var Result = myComponentGeom->Archimede( Shape, aWeight, aWaterDensity, aMeshingDeflection);
+ Result->NameType(tr("GEOM_PLANE"));
+ if ( Display(Result, "") ) {
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ }
+ }
}
-
-// if(isInfinite)
-// theResult->SetInfiniteState() ;
-
- ic->Display(theResult);
+
}
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+}
- Sel->AddIObject( IO, false );
- myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint();
- if ( Settings_AddInStudy )
- GeomGUI->AddInStudy( false, IO );
+
+//=====================================================================================
+// function : OnFilletGetAll()
+// purpose :
+//=====================================================================================
+bool GeometryGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR)
+{
+ GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
+ ListOfID->length(0);
+
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR );
+ if ( theObj->_is_nil() ) {
+ myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
+ return false ;
+ }
+ try {
+ if( Radius <= Precision::Confusion() )
+ return false;
+
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
+ GEOM::GEOM_Shape_var result = myComponentGeom->MakeFillet(aShape, Radius, SubShapeType, ListOfID) ;
+ if ( result->_is_nil() ) {
+ myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
+ return false;
+ }
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, result);
+ Standard_CString type;
+ GetShapeTypeString(S,type);
+ result->NameType( type );
+
+ if ( Display( result, "" ))
+ myDesktop->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
return true;
}
-
//=====================================================================================
-// function : AddInStudy()
-// purpose : anIOShape or a selected shape
+// function : OnFilletGetSelected()
+// purpose :
//=====================================================================================
-bool GeometryGUI::AddInStudy( bool selection,
- const Handle(SALOME_InteractiveObject)& anIO)
+bool GeometryGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo,
+ const char* ShapeTopoIOR,
+ const double Radius,
+ const int SubShapeType,
+ Standard_Integer& aLocalContextId,
+ bool& myUseLocalContext )
{
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( !( !Settings_AddInStudy || selection ) ) {
- Sel->ClearIObjects();
+ if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) {
+ return false;
}
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributePixMap_var aPixmap;
- SALOMEDS::AttributeIOR_var anIOR;
- SALOMEDS::AttributeSelectable_var aSelAttr;
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
- SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
- int aLocked = false;
- if (father->_is_nil()) {
- QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
- op->start();
- aLocked = aStudy->GetProperties()->IsLocked();
- if (aLocked) aStudy->GetProperties()->SetLocked(false);
- father = aStudyBuilder->NewComponent("GEOM");
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- // aName->SetValue( tr("GEOM_MEN_COMPONENT") );
- aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) );
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
- if (aLocked) aStudy->GetProperties()->SetLocked(true);
- op->finish();
+ if( myUseLocalContext == false ) {
+ /* No local context opened for fillet method */
+ myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
+ return false ;
}
-// if (aLocked) return false;
-
- aStudyBuilder->DefineComponentInstance( father, myComponentGeom );
- father->ComponentIOR( Fatherior );
- SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry());
-
- Handle(GEOM_AISShape) GAISShape;
- GEOM_Actor* GActor;
- Handle(GEOM_InteractiveObject) GIO;
- bool found = false;
-
- // VTK
- if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
+ ic->InitSelected();
+ int nbSelected = ic->NbSelected();
+ int i = 0;
+ ic->InitSelected();
- vtkActorCollection* theActors = Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("GEOM_Actor") ) {
- GEOM_Actor* anActor = GEOM_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = anActor->getIO();
- if ( IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
- GIO = Handle(GEOM_InteractiveObject)::DownCast( IO );
- if ( anIO->isSame( GIO ) ) {
- found = true;
- GActor = anActor;
- break;
- }
- }
+ while(ic->MoreSelected()) {
+ TopoDS_Shape s = ic->SelectedShape();
+ if ( s.ShapeType() == TopAbs_FACE ) {
+ TopExp_Explorer Exp( s, TopAbs_EDGE );
+ TopTools_MapOfShape M ;
+ while ( Exp.More() ) {
+ if( M.Add(Exp.Current() )) { /* if a new edge : do not add doublons indices */
+ ListOfID->length( i + 1 );
+ ListOfID[i] = GetIndex( Exp.Current(), ShapeTopo, (int)TopAbs_EDGE ) ;
+ i++ ;
}
- }
- ac = theActors->GetNextActor();
+ Exp.Next();
+ }
}
-
- if ( !found )
- return false;
- }
- // OCC
- else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-
- AIS_ListOfInteractive List;
- ic->DisplayedObjects(List);
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
- GIO = Handle(GEOM_InteractiveObject)::DownCast( IO );
- if ( anIO->isSame( GIO ) ) {
- found = true;
- GAISShape = aSh;
- break;
- }
- }
- }
- }
- ite.Next();
+ else {
+ ListOfID->length( i + 1 );
+ ListOfID[i] = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType );
+ i++;
}
-
- if ( !found )
- return false;
+ ic->NextSelected();
}
- if ( !Settings_AddInStudy || selection ) {
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), anIO->getName() );
- if ( !Name.isEmpty() ) {
- // VTK
- if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- GActor->setName( strdup(Name.latin1()) );
- }
- // OCC
- else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- GAISShape->setName( strdup(Name.latin1()) );
- }
- } else {
- return false;
- }
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
+ GEOM::GEOM_Shape_var aResult ;
+ try {
+ aResult = myComponentGeom->MakeFillet( aShape, Radius, 6, ListOfID );
+
+ /* local context from DialogBox */
+ ic->CloseLocalContext(aLocalContextId) ;
+ myUseLocalContext = false ;
+
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, aResult);
+ Standard_CString type;
+ GetShapeTypeString(S,type);
+ aResult->NameType( type );
+
+ if ( Display( aResult, "") )
+ myDesktop->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
}
- // open transaction
- QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
- op->start();
+ if ( myUseLocalContext ) {
+ /* local context from DialogBox */
+ ic->CloseLocalContext(aLocalContextId) ;
+ myUseLocalContext = false ;
+ }
- SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father);
+ this->OnDisplayAll(true);
+ myActiveStudy->updateObjBrowser();
+ myDesktop->putInfo (tr("GEOM_PRP_READY"));
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GIO->getIOR() );
+ return true ;
+}
- /* For the shape inserted into the study we set its field 'studyshapeid' */
- /* so the shape will contain its corresponding entry in the study Ocaf doc. */
- aShape->StudyShapeId(newObj->GetID()) ;
+//=====================================================================================
+// function : OnChamferGetAll()
+// purpose :
+//=====================================================================================
+bool GeometryGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR)
+{
+ GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
+ ListOfID->length(0);
- GIO->setEntry(newObj->GetID());
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR );
+ if ( theObj->_is_nil() ) {
+ myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
+ return false ;
+ }
+
+ try {
+ if( D1 <= Precision::Confusion() )
+ return false;
+ if( D2 <= Precision::Confusion() )
+ return false;
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- anIOR->SetValue(aShape->Name());
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
+ GEOM::GEOM_Shape_var result = myComponentGeom->MakeChamfer(aShape, D1, D2, SubShapeType, ListOfID) ;
+ if ( result->_is_nil() ) {
+ myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
+ return false;
+ }
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, result);
+ Standard_CString type;
+ GetShapeTypeString(S,type);
+ result->NameType( type );
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- if ( aShape->ShapeType() == GEOM::COMPOUND ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" );
- } else if ( aShape->ShapeType() == GEOM::COMPSOLID ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" );
- } else if ( aShape->ShapeType() == GEOM::SOLID ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" );
- } else if ( aShape->ShapeType() == GEOM::SHELL ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" );
- } else if ( aShape->ShapeType() == GEOM::FACE ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" );
- } else if ( aShape->ShapeType() == GEOM::WIRE ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" );
- } else if ( aShape->ShapeType() == GEOM::EDGE ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" );
- } else if ( aShape->ShapeType() == GEOM::VERTEX ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
+ if ( Display( result, "") )
+ myDesktop->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
}
+ return true;
+}
- // VTK
- if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- GActor->setIO( GIO );
- aName->SetValue(GActor->getName());
+//=====================================================================================
+// function : OnChamferGetSelected()
+// purpose :
+//=====================================================================================
+bool GeometryGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo,
+ const char* ShapeTopoIOR,
+ const double D1, const double D2, const int SubShapeType,
+ Standard_Integer& aLocalContextId,
+ bool& myUseLocalContext)
+{
+ if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) {
+ return false;
}
- // OCC
- else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- GAISShape->setIO( GIO );
- aName->SetValue(GAISShape->getName());
+
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+
+ if( myUseLocalContext == false ) {
+ /* No local context opened for chamfer method */
+ myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
+ return false ;
}
+
+ GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
+ ic->InitSelected();
+ int nbSelected = ic->NbSelected();
+ int i = 0;
+ ic->InitSelected();
- SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
- aStudyBuilder->Addreference(newObj1,newObj);
-
- GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR;
- listIOR = myComponentGeom->GetReferencedObjects(aShape);
-
- if (listIOR->length()>0) {
- SALOMEDS::SObject_var Arguments = aStudyBuilder->NewObject(newObj);
- anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(tr("GEOM_ARGUMENTS"));
- anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
-
- bool ObjectReferenced = false;
- for (unsigned int ind = 0; ind < listIOR->length();ind++) {
- SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(listIOR[ind]);
-
- if ( !theObj->_is_nil() ) {
- SALOMEDS::SObject_var RefObject = aStudyBuilder->NewObject(Arguments);
- aStudyBuilder->Addreference(RefObject, theObj);
- ObjectReferenced = true;
- }
+ while(ic->MoreSelected()) {
+ TopoDS_Shape s = ic->SelectedShape();
+ if ( s.ShapeType() == TopAbs_FACE ) {
+ TopExp_Explorer Exp( s, TopAbs_EDGE );
+ TopTools_MapOfShape M ;
+ while ( Exp.More() ) {
+ if( M.Add(Exp.Current() )) { /* if a new edge : do not add doublons indices */
+ ListOfID->length( i + 1 );
+ ListOfID[i] = GetIndex( Exp.Current(), ShapeTopo, (int)TopAbs_EDGE ) ;
+ i++ ;
+ }
+ Exp.Next();
+ }
}
-
- if ( !ObjectReferenced )
- aStudyBuilder->RemoveObject(Arguments);
+ else {
+ ListOfID->length( i + 1 );
+ ListOfID[i] = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ) ;
+ i++;
+ }
+ ic->NextSelected();
}
+
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
+ GEOM::GEOM_Shape_var aResult ;
+ try {
+ aResult = myComponentGeom->MakeChamfer( aShape, D1, D2, 6, ListOfID );
- op->finish();
+ /* local context from DialogBox */
+ ic->CloseLocalContext(aLocalContextId) ;
+ myUseLocalContext = false ;
+ TopoDS_Shape S = myShapeReader.GetShape(myComponentGeom, aResult);
+ Standard_CString type;
+ GetShapeTypeString(S,type);
+ aResult->NameType( type );
- if ( !Settings_AddInStudy || selection ) {
- myActiveStudy->updateObjBrowser();
- } else {
- myActiveStudy->updateObjBrowser(false);
- Sel->AddIObject( GIO );
+ if ( Display( aResult, "") )
+ myDesktop->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
}
- // MESSAGE ( " highlihght done" )
- return true;
-
-}
+ if ( myUseLocalContext ) {
+ /* local context from DialogBox */
+ ic->CloseLocalContext(aLocalContextId) ;
+ myUseLocalContext = false ;
+ }
+ this->OnDisplayAll(true);
+ myActiveStudy->updateObjBrowser();
+ myDesktop->putInfo (tr("GEOM_PRP_READY"));
+
+ return true ;
+}
//=====================================================================================
-// function : GetShapeFromIOR()
-// purpose : exist also as static method !
+// function : MakeCDGAndDisplay()
+// purpose :
//=====================================================================================
-TopoDS_Shape GeometryGUI::GetShapeFromIOR( QString IOR )
+void GeometryGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape)
{
- TopoDS_Shape result;
- if( IOR.stripWhiteSpace().isEmpty() )
- return result;
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_var& _orb = init.orb() ;
- CORBA::Object_var obj = _orb->string_to_object( (char*)(IOR.latin1()) );
- if ( CORBA::is_nil( obj ) )
- return result;
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( IOR );
- if (!aShape->_is_nil()) {
- result = ShapeReader.GetShape( myComponentGeom, aShape );
+ try {
+ GEOM::GEOM_Shape_var result = myComponentGeom->MakeCDG( Shape );
+ if ( result->_is_nil() ) {
+ myDesktop->putInfo(tr("GEOM_PRP_ABORT") );
+ return ;
+ }
+ result->NameType( tr("GEOM_POINT") );
+ if ( Display( result ) )
+ myDesktop->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
}
- return result;
+ return ;
+}
+
+bool GeometryGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) {
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject);
+ SALOMEDS::SObject_var RefSO;
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ for (; it->More();it->Next()) {
+ SALOMEDS::SObject_var SO= it->Value();
+ if (SO->FindAttribute(anAttr, "AttributeIOR") ) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ if ( strcmp( anIOR->Value(), IOR ) == 0 )
+ return true;
+ }
+ if ( SO->ReferencedObject( RefSO ) ) {
+ if (RefSO->FindAttribute(anAttr, "AttributeIOR") ) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ if ( strcmp( anIOR->Value(), IOR ) == 0 )
+ return true;
+ }
+ }
+ }
+ return false;
}
-//=====================================================================================
-// function : SetSettings()
-// purpose : [static]
-//=====================================================================================
-bool GeometryGUI::SetSettings( QAD_Desktop* parent )
+//=======================================================================
+// function : OnGUIEvent() [static]
+// purpose : manage all events on GUI
+//=======================================================================
+bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{
- /* Create or retrieve an object GeomGUI */
- GeometryGUI::GetOrCreateGeometryGUI(parent);
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+
+ OCCViewer_Viewer3d* v3d;
+ Handle(AIS_InteractiveContext) ic;
+ vtkRenderer* Renderer;
- //DCQ parent->menuBar()->setItemEnabled( 504, false); // CORRECTING
- //DCQ parent->menuBar()->setItemEnabled( 6062, false); // RADIUS
- //VSR parent->menuBar()->setItemEnabled( 701, false); // AUTOMATIC COPY
- parent->menuBar()->setItemEnabled( 313, false); // SKETCH CONTRAINTS
- parent->menuBar()->setItemEnabled( 3131, false); // SKETCH SET PLAN
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
- /* Shading Color */
- QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed");
- QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
- QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue");
- if( !SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty() )
- GeomGUI->myShadingColor = Quantity_Color ( SCr.toInt()/255., SCg.toInt()/255., SCb.toInt()/255.,
- Quantity_TOC_RGB );
+ bool ViewOCC = false;
- /* Wireframe or Shading */
- int DisplayMode = 0;
- if ( parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
- DisplayMode = ic->DisplayMode();
- } else if ( parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
- DisplayMode = myRenderInter->GetDisplayMode();
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ ic = v3d->getAISContext();
+ ViewOCC = true;
+ Mb->setItemEnabled( 312, ViewOCC);//Sketch
+ Mb->setItemEnabled( 309, ViewOCC);//SuppressFace
+ Mb->setItemEnabled( 314, ViewOCC);//SuppressHole
+
+ Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings
+ Mb->setItemEnabled( 704, ViewOCC);// Isos Settings
+
+ } else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ Renderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+
+ // OnSuppressFaces, OnSuppressHole, SETTINGS - SHADING COLOR, SETTINGS - ISOS, SETTINGS : STEP VALUE FOR SPIN BOXES, SKETCHER, ISOS - POPUP VIEWER,
+ Mb->setItemEnabled( 312, ViewOCC);//Sketch
+ Mb->setItemEnabled( 309, ViewOCC);//SuppressFace
+ Mb->setItemEnabled( 314, ViewOCC);//SuppressHole
+
+ Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings
+ Mb->setItemEnabled( 704, ViewOCC);// Isos Settings
+ } else {
+ return 0;
}
- if ( DisplayMode == 1 )
- parent->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") );
- else
- parent->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") );
+ if (myState == CURRENT_SKETCH && theCommandID != 10000 && theCommandID != 10001 && theCommandID != 10002 && theCommandID != 10003 && theCommandID != 10004 && theCommandID != 10006 && theCommandID != 10007 && theCommandID != 10008 && theCommandID != 10010 && theCommandID != 10011 && theCommandID != 10012 && theCommandID != 10013 && theCommandID != 10014 && theCommandID != 3133 && theCommandID != 3134)
+ return false;
- /* Copy */
-// QString Copy = QAD_CONFIG->getSetting("Geometry:SettingsCopy");
-// if ( !Copy.isEmpty() ) {
-// Settings_Copy = Copy.toInt();
-// QMenuData* pp;
-// parent->menuBar()->findItem(701,&pp);
-// pp->setItemChecked(701, Settings_Copy);
-// }
- QMenuData* pp;
- if ( parent->menuBar()->findItem(701,&pp) )
- pp->removeItem(701);
- /* Add in Study */
- QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy");
- if ( !AddInStudy.isEmpty() )
- Settings_AddInStudy = AddInStudy.toInt();
- else
- Settings_AddInStudy = 1;
- parent->menuBar()->findItem(702,&pp);
- pp->setItemChecked(702, Settings_AddInStudy);
+// QString theCommandID_str = itoa(theCommandID);
+// theCommandID_str.truncate(3);
+// int theCommandID_Group = theCommandID_str.toInt();
+ if (theCommandID == 3021 || theCommandID == 3022 || theCommandID == 3023 || theCommandID == 3024 || theCommandID == 3025) {
+ PrimitiveGUI* myPrimitiveGUI = new PrimitiveGUI();
+ myPrimitiveGUI->OnGUIEvent(theCommandID, parent);
+ return true ;
+ }
+ if (theCommandID == 4011 || theCommandID == 4012 || theCommandID == 4013 || theCommandID == 4014) {
+ BooleanGUI* myBooleanGUI = new BooleanGUI();
+ myBooleanGUI->OnGUIEvent(theCommandID, parent);
+ return true ;
+ }
- /* step value */
- QString S = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
- if( S.isEmpty() )
- QAD_CONFIG->addSetting( "Geometry:SettingsGeomStep", "100" );
-
- /* isos */
- QAD_Study* ActiveStudy = parent->getActiveStudy();
- int count = ActiveStudy->getStudyFramesCount();
- bool ViewOCC = false;
- for ( int i = 0; i < count; i++ ) {
- if ( ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC ) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-
- QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
- QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
- if ( !IsoU.isEmpty() )
- ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
- if ( !IsoV.isEmpty() )
- ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
+ switch (theCommandID)
+ {
+ case 31: // COPY
+ OnEditCopy();
+ break;
+
+ case 33: // DELETE
+ OnEditDelete();
+ break;
- ViewOCC = true;
- }
- }
+ case 111:
+ {
+ SetState(111);
+ Import();
+ ResetState();
+ break;
+ }
+ case 112:
+ {
+ SetState(112);
+ Import();
+ ResetState();
+ break;
+ }
+ case 113: // IMPORT STEP
+ {
+ SetState(113);
+ Import();
+ ResetState();
+ break;
+ }
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
+ case 121: // EXPORT BREP
+ {
+ SetState(121);
+ Export();
+ ResetState();
+ break;
+ }
- Mb->setItemEnabled( 312, ViewOCC); //Sketch
- Mb->setItemEnabled( 309, ViewOCC); //SuppressFace
- Mb->setItemEnabled( 314, ViewOCC); //SuppressHole
-
- Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings
- Mb->setItemEnabled( 704, ViewOCC);// Isos Settings
+ case 122: // EXPORT IGES
+ {
+ SetState(122);
+ Export();
+ ResetState();
+ break;
+ }
- return true;
-}
+ case 123: // EXPORT STEP
+ {
+ SetState(123);
+ Export();
+ ResetState();
+ break;
+ }
+
+ case 303: // EXPLODE : use ic
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_SubShapeDlg *aDlg = new GeometryGUI_SubShapeDlg( parent, "", Sel, ic ) ;
+ break ;
+ }
+
+ case 304: // GEOM::EDGE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_EdgeDlg *aDlg = new GeometryGUI_EdgeDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 305: // GEOM::WIRE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_WireDlg *aDlg = new GeometryGUI_WireDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 306: // GEOM::FACE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_FaceDlg *aDlg = new GeometryGUI_FaceDlg ( parent, "", Sel ) ;
+ break ;
+ }
+ case 315: // GEOM::SHELL
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_ShellDlg *aDlg = new GeometryGUI_ShellDlg ( parent, "", Sel ) ;
+ break ;
+ }
-//=====================================================================================
-// function : DefinePopup()
-// purpose : [static]
-//=====================================================================================
-void GeometryGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject )
-{
- /* Create or retrieve an object GeomGUI */
- GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop());
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
+ case 316: // GEOM::SOLID
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_SolidDlg *aDlg = new GeometryGUI_SolidDlg ( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 308: // GEOM::COMPOUND
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_CompoundDlg *aDlg = new GeometryGUI_CompoundDlg ( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 309: // SUPPRESS FACES : use ic
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_SuppressFacesDlg *aDlg = new GeometryGUI_SuppressFacesDlg( parent, "", Sel, ic ) ;
+ break ;
+ }
+
+ case 314: // SUPPRESS HOLES : use ic
+ {
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_SuppressHoleDlg *aDlg = new GeometryGUI_SuppressHoleDlg( parent, "", Sel, ic ) ;
+ }
+ else {
+ myDesktop->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ;
+ }
+ break ;
+ }
+ case 501: // SEWING
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_SewingDlg *aDlg = new GeometryGUI_SewingDlg ( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 502: // ORIENTATION
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_OrientationDlg *aDlg = new GeometryGUI_OrientationDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 601: // PROPERTIES (Length, surface, volume)
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_PropertiesDlg *aDlg = new GeometryGUI_PropertiesDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 604: // CDG : Center of mass
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_CenterMassDlg *aDlg = new GeometryGUI_CenterMassDlg ( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 605: // INERTIA
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_InertiaDlg *aDlg = new GeometryGUI_InertiaDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 607: // MAXTOLERANCE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_MaxToleranceDlg *aDlg = new GeometryGUI_MaxToleranceDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 608: // WHATIS
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_WhatisDlg *aDlg = new GeometryGUI_WhatisDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 609: // CHECKSHAPE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_CheckShape *aDlg = new GeometryGUI_CheckShape( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 701: // SETTINGS - COPY
+ {
+ QMenuData* pp;
+ QMenuItem* item = parent->menuBar()->findItem(701,&pp);
+ bool check = !pp->isItemChecked(701);
+ pp->setItemChecked(701,check);
+ mySettings_Copy = check;
+ QAD_CONFIG->addSetting( "Geometry:SettingsCopy", mySettings_Copy );
+ break;
+ }
- theObject = "";
- if ( Sel->IObjectCount() == 1 )
- {
- Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
- if (IO->hasEntry())
- {
- SALOMEDS::SObject_var sobj = GeomGUI->myActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry());
- if (!sobj->_is_nil())
- {
- SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent();
- if (strcmp(scomp->GetID(), IO->getEntry()) == 0)
- {
- // component is selected
- theObject = "Component";
- }
+ case 702: // SETTINGS - ADD IN STUDY
+ {
+ QMenuData* pp;
+ QMenuItem* item = parent->menuBar()->findItem(702,&pp);
+ bool check = !pp->isItemChecked(702);
+ pp->setItemChecked(702,check);
+ mySettings_AddInStudy = check;
+
+ QAD_CONFIG->addSetting( "Geometry:SettingsAddInStudy", mySettings_AddInStudy );
+ break;
+ }
+
+ case 703: // SETTINGS - SHADING COLOR
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+
+ QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed");
+ QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
+ QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue");
+ QColor color;
+ if( !SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty() ) {
+ color = QColor (SCr.toInt(),
+ SCg.toInt(),
+ SCb.toInt());
+ } else {
+ Quantity_Color Default = Quantity_Color();
+ color = QColor ( (int)Default.Red() * 255.0,
+ (int)Default.Green()* 255.0,
+ (int)Default.Blue() * 255.0 );
+ }
+
+ QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
+ if ( c.isValid() ) {
+ myShadingColor = Quantity_Color(c.red() / 255.0,
+ c.green()/ 255.0,
+ c.blue() / 255.0,
+ Quantity_TOC_RGB);
+
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects(List);
+ AIS_ListOfInteractive List1;
+ ic->ObjectsInCollector(List1);
+ List.Append(List1);
+
+ AIS_ListIteratorOfListOfInteractive ite(List);
+ while (ite.More()) {
+ if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
+ aSh->SetShadingColor( myShadingColor );
+ ic->Redisplay( aSh, Standard_True, Standard_True);
}
+ ite.Next();
+ }
+
+ ic->UpdateCurrentViewer();
+
+ QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", c.red() );
+ QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", c.green() );
+ QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", c.blue() );
}
- }
+ break;
+ }
- if ( ( theParent.compare("Viewer")==0 ) )
- {
- if ( GeomGUI->myState == CURRENT_SKETCH )
- theContext = "Sketch";
- else
- {
- if ( Sel->IObjectCount() > 0 )
- theContext = "";
- else
- theContext = "NothingSelected";
+
+ case 704: // SETTINGS - ISOS
+ {
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+
+ QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
+ QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
+ if ( !IsoU.isEmpty() )
+ ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
+ else
+ IsoU = "1";
+ if ( !IsoV.isEmpty() )
+ ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
+ else
+ IsoV = "1";
+
+ GeometryGUI_NbIsosDlg * NbIsosDlg = new GeometryGUI_NbIsosDlg( QAD_Application::getDesktop(),
+ tr("GEOM_MEN_ISOS"), TRUE );
+ int UIso = IsoU.toInt();
+ int VIso = IsoV.toInt();
+
+ NbIsosDlg->SpinBoxU->setValue(UIso) ;
+ NbIsosDlg->SpinBoxV->setValue(VIso) ;
+
+ if ( NbIsosDlg->exec() ) {
+ UIso = NbIsosDlg->SpinBoxU->text().toInt() ;
+ VIso = NbIsosDlg->SpinBoxV->text().toInt() ;
+
+ ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso);
+ ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso);
+ QAD_CONFIG->addSetting( "Geometry:SettingsIsoU", NbIsosDlg->SpinBoxU->text() ); /* text format */
+ QAD_CONFIG->addSetting( "Geometry:SettingsIsoV", NbIsosDlg->SpinBoxV->text() ); /* text format */
}
- }
- else
- theContext = "";
-
-}
-//=====================================================================================
-// function : CustomPopup()
-// purpose : [static]
-//=====================================================================================
-bool GeometryGUI::CustomPopup( QAD_Desktop* parent,
- QPopupMenu* popup,
- const QString& theContext,
- const QString& theParent,
- const QString& theObject )
-{
- /* Create or retrieve an object GeomGUI */
- GeometryGUI::GetOrCreateGeometryGUI(parent);
-
- /* Deactivate any non modal dialog box to get the neutral point */
- GeomGUI->EmitSignalDeactivateDialog() ;
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() );
- int nbSel = Sel->IObjectCount();
-
- if ( (nbSel == 0) && ( theContext.compare("Sketch")!=0 ) )
- return false;
-
-
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
- {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
- if ( theParent.compare("Viewer")==0 )
- {
- if ( theContext.compare("Sketch")==0 )
- {
- SketchStatus myCS = GeomGUI->mySketcher.GetCurrentStatus();
- popup->setCheckable(TRUE);
- if (myCS==SEGMENT)
- {
- popup->setItemChecked(10000,true);
- popup->setItemChecked(10001,false);
- }
- else if (myCS==ARC_CHORD)
- {
- popup->setItemChecked(10000,false);
- popup->setItemChecked(10001,true);
- }
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects(List);
+ AIS_ListOfInteractive List1;
+ ic->ObjectsInCollector(List1);
+ List.Append(List1);
+
+ AIS_ListIteratorOfListOfInteractive ite(List);
+ ic->InitCurrent();
+ if ( ic->NbCurrents() )
+ while (ite.More()) {
+ if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- return true;
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
+ Handle (AIS_Drawer) CurDrawer;
+ CurDrawer = aSh->Attributes();
+ CurDrawer->UIsoAspect()->SetNumber( UIso );
+ CurDrawer->VIsoAspect()->SetNumber( VIso );
+ ic->SetLocalAttributes(aSh, CurDrawer);
+ ic->Redisplay(aSh);
}
- else
- if (theObject.compare("Component") == 0)
- {
- popup->removeItem(QAD_DisplayOnly_Popup_ID);
- return true;
- }
- else
- {
- QFont f = QApplication::font();
- f.setBold( TRUE );
- if (nbSel==1)
- {
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- popup->removeItem(QAD_TopLabel_Popup_ID);
- popup->insertItem( new CustomItem ( QString(IObject->getName()), f ), QAD_TopLabel_Popup_ID, 0 );
- if ( IObject->hasEntry() )
- popup->setItemEnabled( 801, false );
- else
- popup->setItemEnabled( 801, true );
-
- if (IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject)))
- {
- Standard_Boolean found;
- Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
+ ite.Next();
+ }
+ ic->UpdateCurrentViewer();
+ break;
+ }
+
+ case 705: // SETTINGS : STEP VALUE FOR SPIN BOXES
+ {
+ //NRI if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ //NRI break;
+
+ QString step = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
+ if( step.isEmpty() )
+ step = "100.0" ;
- if ( found )
- {
- if ( Result->DisplayMode() == 1 )
- popup->changeItem(8021, tr("GEOM_MEN_WIREFRAME") );
- else
- popup->changeItem(8021, tr("GEOM_MEN_SHADING") );
- }
- }
+ Standard_Boolean res = false ;
+ double dd = Parameter( res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3 ) ;
+ if( res ) {
+ QAD_CONFIG->addSetting( "Geometry:SettingsGeomStep", QString("%1").arg(dd) ) ;
- if ( !(v3d->isInViewer( IObject ) && v3d->isVisible( IObject )) )
- popup->removeItem(QAD_Erase_Popup_ID);
- else
- popup->removeItem(QAD_Display_Popup_ID);
-
- }
- else
- {
- popup->removeItem(QAD_DisplayOnly_Popup_ID);
- popup->removeItem(QAD_TopLabel_Popup_ID);
- popup->insertItem( new CustomItem ( tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f ),
- QAD_TopLabel_Popup_ID, 0 );
- popup->setItemEnabled( 801, false );
- }
- }
- return true;
+ /* Emit signal to GeometryGUI_SpinBoxes */
+ SignalDefaultStepValueChanged( dd ) ;
}
- else
- if ( theParent.compare("ObjectBrowser")==0 )
- {
- popup->removeItem(QAD_TopLabel_Popup_ID);
- int id = popup->idAt(0); // separator
- if (id < 0) popup->removeItem(id);
-
- // checking for GEOM label in the selected list
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- Handle(SALOME_InteractiveObject) anIObject;
+ else
+ parent->putInfo(tr("GEOM_PRP_ABORT"));
- bool useSubItems = false;
- bool needOpen = false;
- bool needDisplay = false;
- bool needErase = false;
- SALOMEDS::GenericAttribute_var aTmpAttr;
- for(;It.More();It.Next())
- {
- anIObject = It.Value();
- if (!anIObject->hasEntry())
- continue;
-
- if (v3d->isInViewer(anIObject) && v3d->isVisible(anIObject))
- needErase = true;
- else
- needDisplay = true;
- SALOMEDS::SObject_var obj =
- GeomGUI->myActiveStudy->getStudyDocument()->FindObjectID( anIObject->getEntry() );
- if (!obj->_is_nil())
- {
- GEOM::GEOM_Shape_var aShape;
- if (obj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value();
- if (str && strlen(str))
- aShape = GeomGUI->myComponentGeom-> GetIORFromString(str);
- }
- else
- if (obj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
- needOpen = true;
- if (aShape->_is_nil())
- {
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->
- getStudyDocument()->NewChildIterator(obj);
- while (anIter->More())
- {
- SALOMEDS::SObject_var subobj = anIter->Value();
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR"))
- {
- useSubItems = true;
- needErase = true;
- needDisplay = true;
- }
- else
- if (subobj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
- {
- needOpen = true;
- useSubItems = true;
- }
- anIter->Next();
- }
- }
- }
- }
- // remove useless popup items
- if (nbSel != 1) popup->removeItem(901); // rename
- if (useSubItems) popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
- if (!needOpen)
- {
- int index = popup->indexOf(9024);
- popup->removeItem(9024); // open
- popup->removeItemAt(index); // separator under Open
+ break ;
+ }
+
+ case 801: // ADD IN STUDY - POPUP VIEWER
+ {
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ const SALOME_ListIO& ListSelected = Sel->StoredIObjects();
+ SALOME_ListIteratorOfListIO It( ListSelected );
+ for ( ; It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ AddInStudy(true, IObject);
+ }
+ /* Is set on the dialog box */
+ QApplication::restoreOverrideCursor();
+ break;
+ }
- if (!needDisplay) popup->removeItem(QAD_Display_Popup_ID);
- if (!needErase) popup->removeItem(QAD_Erase_Popup_ID);
- if (!needDisplay && !needErase)
- {
- int id = popup->idAt(popup->count()-1); // last item
- popup->removeItem(id); // separator
- }
- }
- else
- {
- popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
- popup->removeItem(QAD_Display_Popup_ID);
- popup->removeItem(QAD_Erase_Popup_ID);
- if (nbSel!=1)
- {
- int id = popup->idAt(popup->count()-1); // last item
- popup->removeItem(id); // separator
- }
+ case 901: // RENAME
+ {
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for ( ; It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ if ( !obj->_is_nil() ) {
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+
+ QString nm = QString( aName->Value() );
+ nm = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), nm );
+ if ( !nm.isEmpty() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ myActiveStudy->renameIObject( IObject, nm );
+ QApplication::restoreOverrideCursor();
}
- return true;
+ }
}
- // MESSAGE ( " CUSTOM POPUP VIEWER OCC done. ")
- }
- else
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
+ }
+ break;
+ }
+
+ case 903: // DISPLAY OBJECT BROWSER
{
- // MESSAGE ( " CUSTOM POPUP VIEWER VTK ")
- if ( ( theParent.compare("Viewer")==0 ) )
- {
-
- popup->setItemEnabled( 8033, false );
- if (theObject.compare("Component") == 0)
- {
- popup->removeItem(QAD_DisplayOnly_Popup_ID);
- return true;
- }
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ // VTK
+ QApplication::setOverrideCursor( Qt::waitCursor );
+
+ SALOMEDS::SObject_var fatherSF =
+ aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry());
- //int id = popup->idAt(0);
- QFont f = QApplication::font();
- f.setBold( TRUE );
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- if (nbSel==1)
- {
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- popup->removeItem(QAD_TopLabel_Popup_ID);
- popup->insertItem( new CustomItem ( QString(IObject->getName()), f ), QAD_TopLabel_Popup_ID, 0 );
- if ( IObject->hasEntry() )
- {
- popup->setItemEnabled( 801, false );
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
- SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !SO->_is_nil() )
- {
- if (SO->FindAttribute(anAttr, "AttributeIOR") )
- {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- Standard_Boolean found;
- GEOM_Actor* Result = GeomGUI->ConvertIORinGEOMActor(anIOR->Value(), found, true);
- if ( found )
- {
- if ( Result->getDisplayMode() == 1 )
- popup->changeItem(8021, "Wireframe" );
- else
- popup->changeItem(8021, "Shading" );
-
- if ( !Result->GetVisibility() )
- popup->removeItem(QAD_Erase_Popup_ID);
- else
- popup->removeItem(QAD_Display_Popup_ID);
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
+
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var anIOR;
+
+ if(myRenderInter->isInViewer(IObject)) {
+ myRenderInter->Display(IObject);
+ }
+ else {
+ // Create new actor
+ if ( !obj->_is_nil() ) {
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ bool useSubItems = false;
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ }
+
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+
+ vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ vtkActorCollection* theAllActors = theRenderer->GetActors();
+ theAllActors->InitTraversal();
+ vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
+ Handle(SALOME_InteractiveObject) anIObj;
+ // don't create new study object if it already exists
+ bool isDisplayed = false;
+ while(!(actor==NULL)) {
+ SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
+ if (Gactor!=NULL) {
+ if (Gactor->hasIO()) {
+ if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
+ isDisplayed = true;
+ anIObj = Gactor->getIO();
+ if (!anIObj.IsNull()) myRenderInter->Display(anIObj);
}
- else
- popup->removeItem(QAD_Erase_Popup_ID);
+ }
+ }
+ actor=(vtkActor*)(theAllActors->GetNextActor());
+ }
+ if (!isDisplayed) {
+ // open transaction
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+
+ SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
+ aStudyBuilder->Addreference(newObj1, obj);
+ // commit transaction
+ op->finish();
+
+ vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
+ int themode = myRenderInter->GetDisplayMode();
+
+ vtkActorCollection* theActors =
+ GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
+ theActors->InitTraversal();
+ vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
+ while(!(anActor==NULL)) {
+ GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
+ Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myFatherior,"GEOM");
+ IO->setEntry(obj->GetID());
+ GActor->setIO( IO );
+ GActor->setName( IObject->getName() );
+
+ theRenderer->AddActor(GActor);
+ renWin->Render();
+ anActor = (vtkActor*)theActors->GetNextActor();
}
+ }
}
+ // next item iteration
+ if (useSubItems) {
+ anIter->Next();
+ anAttr = SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
+ }
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
}
- else
- popup->setItemEnabled( 801, true );
- }
- else
- {
- popup->removeItem(QAD_DisplayOnly_Popup_ID);
- popup->removeItem(QAD_TopLabel_Popup_ID);
- popup->insertItem( new CustomItem ( tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f ), QAD_TopLabel_Popup_ID, 0 );
- popup->setItemEnabled( 801, false );
+ }
}
- return true;
- }
- else
- if ( theParent.compare("ObjectBrowser")==0 )
- {
- popup->removeItem(QAD_TopLabel_Popup_ID);
- int id = popup->idAt(0); // separator
- if (id < 0) popup->removeItem(id);
-
- // checking for GEOM label in the selected list
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- Handle(SALOME_InteractiveObject) anIObject;
+ }
+ myActiveStudy->updateObjBrowser( true );
+ QApplication::restoreOverrideCursor();
+
+ } else if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+
+ SALOMEDS::SObject_var fatherSF =
+ aStudy->FindObjectID( myActiveStudy->getActiveStudyFrame()->entry());
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var anIOR;
+
+ if ( v3d->isInViewer( IObject, true ) ) {
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) aSh = ConvertIOinGEOMAISShape( IObject, found, true );
+ if ( found ) {
+ ic->Display(aSh);
+ ic->AddOrRemoveCurrentObject(aSh, true);
+ }
- bool useSubItems = false;
- bool needOpen = false;
- bool needDisplay = false;
- bool needErase = false;
- SALOMEDS::GenericAttribute_var aTmpAttr;
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->
- getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
- for(;It.More();It.Next())
- {
- anIObject = It.Value();
- if ( !anIObject->hasEntry() )
- continue;
-
- if (myRenderInter->isInViewer(anIObject) && myRenderInter->isVisible(anIObject))
- needErase = true;
- else
- needDisplay = true;
+ } else {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
+ if ( !obj->_is_nil() ) {
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ bool useSubItems = false;
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ }
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ // searchin for already displayed objects with the same shape
+ AIS_ListOfInteractive aDisplayed;
+ ic->DisplayedObjects(aDisplayed);
+ AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
+ Handle(AIS_Shape) anAISShape;
+ for(;anIObjects.More();anIObjects.Next()) {
+ anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
+ if (!anAISShape.IsNull()) {
+ if (anAISShape->Shape().IsSame(Shape)) break;
+ anAISShape.Nullify();
+ }
+ }
+ if (!anAISShape.IsNull()) {
+ if (!ic->IsDisplayed(anAISShape)) ic->Display(anAISShape);
+ } else {
+ if (!useSubItems) {
+ // open transaction
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+
+ SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
+ aStudyBuilder->Addreference(newObj1, obj);
+ // commit transaction
+ op->finish();
+ }
- SALOMEDS::SObject_var obj = GeomGUI->myActiveStudy->getStudyDocument()
- ->FindObjectID( anIObject->getEntry() );
- if (!obj->_is_nil()) {
- GEOM::GEOM_Shape_var aShape;
- if (obj->FindAttribute(aTmpAttr, "AttributeIOR")){
- char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value();
- if (str && strlen(str))
- aShape = GeomGUI->myComponentGeom->GetIORFromString(str);
+ Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
+ aSh->SetShadingColor( myShadingColor );
+ Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(),
+ myFatherior,
+ "GEOM");
+ IO->setEntry(obj->GetID());
+ aSh->setIO( IO );
+ aSh->setName( aName->Value() );
+ ic->Display (aSh);
+ if (!useSubItems) ic->AddOrRemoveCurrentObject(aSh, true);
+ }
}
- else
- if (obj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
- needOpen = true;
- if (aShape->_is_nil())
- {
- SALOMEDS::ChildIterator_var anIter =
- GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- while (anIter->More())
- {
- SALOMEDS::SObject_var subobj = anIter->Value();
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR"))
- {
- useSubItems = true;
- needDisplay = true;
- needErase = true;
- }
- else
- if (subobj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
- {
- needOpen = true;
- useSubItems = true;
- }
- anIter->Next();
- }
+ // next item iteration
+ if (useSubItems) {
+ anIter->Next();
+ anAttr=SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
}
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
}
}
- // remove useless popup items
- if (nbSel != 1) popup->removeItem(901); // rename
- if (useSubItems) popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
- if (!needOpen)
- {
- int index = popup->indexOf(9024);
- popup->removeItem(9024); // open
- popup->removeItemAt(index); // separator under Open
-
- if (!needDisplay) popup->removeItem(QAD_Display_Popup_ID);
- if (!needErase) popup->removeItem(QAD_Erase_Popup_ID);
- if (!needDisplay && !needErase)
- {
- int id = popup->idAt(popup->count()-1); // last item
- popup->removeItem(id); // separator
- }
- }
- else
- {
- popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
- popup->removeItem(QAD_Display_Popup_ID);
- popup->removeItem(QAD_Erase_Popup_ID);
- if (nbSel!=1)
- {
- int id = popup->idAt(popup->count()-1); // last item
- popup->removeItem(id); // separator
- }
- }
- return true;
- // MESSAGE ( " CUSTOM POPUP VIEWER VTK done.")
- }
- } else
- { // other viewer types not supported.
- while (1)
- {
- int id = popup->idAt(0);
- if (id <= QAD_TopLabel_Popup_ID && id != -1)
- popup->removeItemAt(0);
- else
- break;
+ }
}
- popup->removeItem(QAD_DisplayOnly_Popup_ID);
- popup->removeItem(QAD_Display_Popup_ID);
- popup->removeItem(QAD_Erase_Popup_ID);
- int id = popup->idAt(popup->count()-1); // last item
- if (id < 0 && id != -1) popup->removeItem(id); // separator
- return false;
+ }
+ myActiveStudy->updateObjBrowser( true );
+ QApplication::restoreOverrideCursor();
}
- return false;
-}
+ break;
+ }
+
+ case 3011: // POINT
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_PointDlg *aDlg = new GeometryGUI_PointDlg( parent, "", Sel, ic ) ;
+ break;
+ }
+
+ case 3012: // LINE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_LineDlg *aDlg = new GeometryGUI_LineDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 3013: // CIRCLE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_CircleDlg *aDlg = new GeometryGUI_CircleDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 3014: // ELLIPSE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_EllipseDlg *aDlg = new GeometryGUI_EllipseDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 3015: // ARC
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_ArcDlg *aDlg = new GeometryGUI_ArcDlg( parent, "", Sel ) ;
+ break ;
+ }
+
+ case 3016: // VECTOR
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_VectorDlg *aDlg = new GeometryGUI_VectorDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 3017: // PLANE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_PlaneDlg *aDlg = new GeometryGUI_PlaneDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 3018: // WORKING PLANE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_WorkingPlaneDlg *aDlg = new GeometryGUI_WorkingPlaneDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 312: // SKETCHER
+ {
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
+ break;
+
+ EmitSignalDeactivateDialog() ;
+
+ ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002
+
+ mySketcher = Sketch( v3d->getViewer3d() );
+ SetState(CURRENT_SKETCH);
+
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
+ QMenuData* pp;
+
+ QMenuItem* item = Mb->findItem(10010,&pp);
+ mySketcher.SetParameterVisibility(LENGTH_PARAMETER,pp->isItemChecked(10010));
+ item = Mb->findItem(10011,&pp);
+ mySketcher.SetParameterVisibility(ANGLE_PARAMETER,pp->isItemChecked(10011));
+ item = Mb->findItem(10012,&pp);
+ mySketcher.SetParameterVisibility(RADIUS_PARAMETER,pp->isItemChecked(10012));
+ item = Mb->findItem(10013,&pp);
+ mySketcher.SetParameterVisibility(XVALUE_PARAMETER,pp->isItemChecked(10013));
+ item = Mb->findItem(10014,&pp);
+ mySketcher.SetParameterVisibility(YVALUE_PARAMETER,pp->isItemChecked(10014));
+
+ mySketcher.SetTransitionStatus(NOCONSTRAINT);
+ item = Mb->findItem(3133,&pp);
+ pp->setItemChecked(3133,false);
+ item = Mb->findItem(3134,&pp);
+ pp->setItemChecked(3134,false);
+ break;
+ }
+
+
+
+ case 3131:
+ {
+ break;
+ }
+
+ case 3133: // sketcher
+ {
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(3133,&pp);
+ pp->setItemChecked(3133,!pp->isItemChecked(3133));
+ if (pp->isItemChecked(3133) == true)
+ mySketcher.SetTransitionStatus(TANGENT);
+ else
+ mySketcher.SetTransitionStatus(NOCONSTRAINT);
+
+ pp->setItemChecked(3134,false);
+ break;
+ }
+
+ case 3134: // sketcher
+ {
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(3134,&pp);
+ pp->setItemChecked(3134,!pp->isItemChecked(3134));
+ if (pp->isItemChecked(3134) == true)
+ mySketcher.SetTransitionStatus(PERPENDICULAR);
+ else
+ mySketcher.SetTransitionStatus(NOCONSTRAINT);
+
+ pp->setItemChecked(3133,false);
+ break;
+ }
+
+ case 4021: // TRANSLATION
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_TranslationDlg *aDlg = new GeometryGUI_TranslationDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 4022: // ROTATION
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_RotationDlg *aDlg = new GeometryGUI_RotationDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 4030: // MULTI TRANSLATION
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_MultiTranslationDlg *aDlg = new GeometryGUI_MultiTranslationDlg( parent, "", Sel ) ;
+ break;
+ }
-void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
-{
- /* Create or retrieve an object GeomGUI */
- GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop());
-
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-
- OCCViewer_Viewer3d* v3d;
- Handle(AIS_InteractiveContext) ic;
- vtkRenderer* Renderer;
+ case 4040: // MULTI ROTATION
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_MultiRotationDlg *aDlg = new GeometryGUI_MultiRotationDlg( parent, "", Sel ) ;
+ break;
+ }
- if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- ic = v3d->getAISContext();
- } else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- Renderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- } else
- return;
+ case 4023: // MIRROR
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_MirrorDlg *aDlg = new GeometryGUI_MirrorDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 4024: // SCALE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_ScaleDlg *aDlg = new GeometryGUI_ScaleDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 4025: // PARTITION
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_PartitionDlg *aDlg = new GeometryGUI_PartitionDlg( parent, "", Sel ) ;
+ break;
+ }
- if (theIO.IsNull())
- MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed")
+ case 4026: // ARCHIMEDE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_ArchimedeDlg *aDlg = new GeometryGUI_ArchimedeDlg( parent, "", Sel ) ;
+ break;
+ }
- if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // VTK
-
- SALOMEDS::SObject_var fatherSF =
- aStudy->FindObjectID(GeomGUI->myActiveStudy->getActiveStudyFrame()->entry());
-
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( theIO->getEntry() );
+ case 4027: // FILLET
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_FilletDlg *aDlg = new GeometryGUI_FilletDlg( parent, "", Sel, ic ) ;
+ break;
+ }
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+ case 4028: // CHAMFER
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_ChamferDlg *aDlg = new GeometryGUI_ChamferDlg( parent, "", Sel, ic ) ;
+ break;
+ }
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
-
- if(myRenderInter->isInViewer(theIO)) {
- myRenderInter->Display(theIO, false);
- }
- else {
- // Create new actor
- if ( !obj->_is_nil() ) {
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- // this SObject may be GEOM module root SObject
+ case 4031: // PRISM
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_PrismDlg *aDlg = new GeometryGUI_PrismDlg( parent, "", Sel ) ;
+ break;
+ }
- bool useSubItems = false;
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- if (GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) {
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- if (!GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- } else anIter->Next();
+ case 4032: // REVOL
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_RevolDlg *aDlg = new GeometryGUI_RevolDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 4033: // FILLING
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_FillingDlg *aDlg = new GeometryGUI_FillingDlg( parent, "", Sel ) ;
+ break;
+ }
+
+ case 4034: // PIPE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_PipeDlg *aDlg = new GeometryGUI_PipeDlg(parent, "", Sel ) ;
+ break;
+ }
+
+ case 5001: // CHECK GEOMETRY
+ {
+ QAD_PyEditor* PyEditor = myActiveStudy->getActiveStudyFrame()->getRightFrame()->getPyEditor();
+ PyEditor->setText("from GEOM_usinggeom import *\n");
+ PyEditor->setText(">>> ");
+ PyEditor->handleReturn();
+ break;
+ }
+
+ case 6021: // SHADING - WIREFRAME
+ {
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ VTKViewer_RenderWindowInteractor* myRenderInter=
+ ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+
+ QApplication::setOverrideCursor(waitCursor);
+
+ int themode = myRenderInter->GetDisplayMode();
+ if( themode==0 ) {
+ myRenderInter->SetDisplayMode(1);
+ GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") );
+ } else {
+ myRenderInter->SetDisplayMode(0);
+ GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") );
+ }
+
+ QApplication::restoreOverrideCursor();
+
+ } else if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
+ AIS_DisplayMode mode = ( AIS_DisplayMode )ic->DisplayMode();
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame);
+
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects(List);
+ AIS_ListOfInteractive List1;
+ ic->ObjectsInCollector(List1);
+ List.Append(List1);
+
+ AIS_ListIteratorOfListOfInteractive ite(List);
+ while (ite.More()) {
+ if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
+ ic->SetDisplayMode(aSh,Standard_Integer(newmode),true);
}
+ ite.Next();
}
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
+ ic->SetDisplayMode( newmode, Standard_False);
+ if ( newmode == 1 )
+ GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") );
+ else
+ GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") );
+
+ QApplication::restoreOverrideCursor();
+ }
+ break;
+ }
+
+ case 6022: // DISPLAY ALL
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
+ //VTK
+ ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC )
+ OnDisplayAll();
+ break;
+ }
+
+ case 6023: // DISPLAY ONLY
+ case 8023: // DISPLAY ONLY - POPUP VIEWER
+ {
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ // VTK
+ OnVTKDisplayOnly();
+ }
+ else if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
+ OnDisplayOnly();
+ break;
+ }
+
+ case 6024: // ERASE ALL
+ {
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ //VTK
+ ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll();
+ }
+ else if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
+ ic->EraseAll(Standard_True, Standard_False);
+ ic->Display(v3d->getTrihedron());
+ }
+
+ //NRI SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ //NRI Sel->ClearInteractiveObjects();
+ break;
+ }
+
+ case 6025 : // ERASE ONLY
+ case 8022 : // ERASE - POPUP VIEWER
+ {
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ // VTK
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ Handle(SALOME_InteractiveObject) anIObject;
+ for(;It.More();It.Next()) {
+ anIObject = It.Value();
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
-
- vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- vtkActorCollection* theAllActors = theRenderer->GetActors();
- theAllActors->InitTraversal();
- vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
- Handle(SALOME_InteractiveObject) anIObj;
- // don't create new study object if it already exists
- bool isDisplayed = false;
- while(!(actor==NULL)) {
- SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
- if (Gactor!=NULL) {
- if (Gactor->hasIO()) {
- if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
- isDisplayed = true;
- anIObj = Gactor->getIO();
- if (!anIObj.IsNull()) myRenderInter->Display(anIObj, false);
+ if(myRenderInter->isInViewer(anIObject)) {
+ myRenderInter->Erase(anIObject);
+ } else {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !obj->_is_nil() ) {
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ bool useSubItems = false;
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ }
+
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ // searchin for already displayed objects with the same shape
+ vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ vtkActorCollection* theAllActors = theRenderer->GetActors();
+ theAllActors->InitTraversal();
+ vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
+ Handle(SALOME_InteractiveObject) anIObj;
+ // don't create new study object if it already exists
+ bool isDisplayed = false;
+ while(!(actor==NULL)) {
+ SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
+ if (Gactor!=NULL) {
+ if (Gactor->hasIO()) {
+ if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
+ isDisplayed = true;
+ anIObj = Gactor->getIO();
+ if (!anIObj.IsNull()) myRenderInter->Erase(anIObj);
+ }
+ }
+ }
+ actor=(vtkActor*)(theAllActors->GetNextActor());
+ }
}
+ if (useSubItems) {
+ anIter->Next();
+ anAttr=SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
+ }
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
}
}
- actor=(vtkActor*)(theAllActors->GetNextActor());
}
- if (!isDisplayed) {
- // open transaction
- QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy );
- op->start();
-
- SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
- aStudyBuilder->Addreference(newObj1, obj);
- // commit transaction
- op->finish();
-
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- int themode = myRenderInter->GetDisplayMode();
-
- vtkActorCollection* theActors =
- GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
- theActors->InitTraversal();
- vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
- while(!(anActor==NULL)) {
- GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
- Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), Fatherior,"GEOM");
- IO->setEntry(obj->GetID());
- GActor->setIO( IO );
- GActor->setName( theIO->getName() );
+ }
+ }
+// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+// for(;It.More();It.Next()) {
+// Handle(SALOME_InteractiveObject) IOS = It.Value();
+ // myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);;
+ }
+ else if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
+ // OCC
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ Handle(SALOME_InteractiveObject) anIObject;
+ for(;It.More();It.Next()) {
+ anIObject = It.Value();
+ if ( v3d->isInViewer( anIObject, true ) ) {
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) aSh = ConvertIOinGEOMAISShape( anIObject, found, true );
+ if ( found ) {
+ ic->Erase(aSh);
+ ic->AddOrRemoveCurrentObject(aSh, true);
+ }
+ } else {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !obj->_is_nil() ) {
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ bool useSubItems = false;
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ }
- theRenderer->AddActor(GActor);
- // renWin->Render();
- anActor = (vtkActor*)theActors->GetNextActor();
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ // searchin for already displayed objects with the same shape
+ AIS_ListOfInteractive aDisplayed;
+ ic->DisplayedObjects(aDisplayed);
+ AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
+ Handle(AIS_Shape) anAISShape;
+ for(;anIObjects.More();anIObjects.Next()) {
+ anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
+ if (!anAISShape.IsNull()) {
+ if (anAISShape->Shape().IsSame(Shape)) break;
+ anAISShape.Nullify();
+ }
+ }
+ if (!anAISShape.IsNull()) {
+ if (ic->IsDisplayed(anAISShape)) ic->Erase(anAISShape);
+ }
+ }
+ if (useSubItems) {
+ anIter->Next();
+ anAttr=SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
+ }
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
}
}
}
- // next item iteration
- if (useSubItems) {
- anIter->Next();
- anAttr = SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
- }
- } else anAttr = SALOMEDS::GenericAttribute::_nil();
}
}
+ Sel->ClearIObjects();
+ break;
}
- }
- // No viewer update should be done here!
- //myRenderInter->Render();
- //GeomGUI->myActiveStudy->updateObjBrowser( true );
- } else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
- SALOMEDS::SObject_var fatherSF =
- aStudy->FindObjectID( GeomGUI->myActiveStudy->getActiveStudyFrame()->entry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
+
- if ( v3d->isInViewer( theIO, true ) ) {
- Standard_Boolean found;
- Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( theIO, found, true );
- if ( found ) {
- ic->Display(aSh, false);
- ic->AddOrRemoveCurrentObject(aSh, false);
+ case 6060: // BOUNDING BOX
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_BndBoxDlg *aDlg = new GeometryGUI_BndBoxDlg(parent, "", Sel ) ;
+ break ;
}
-
- } else {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( theIO->getEntry() );
- if ( !obj->_is_nil() ) {
- MESSAGE("BuildPresentation(): SObject not null")
- if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
- MESSAGE("BuildPresentation(): SObject has IOR")
- // this SObject may be GEOM module root SObject
- bool useSubItems = false;
- SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj);
- if (GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) {
- while (anIter->More() && !useSubItems) {
- SALOMEDS::SObject_var subobj = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttr;
- if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
- if (!GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) {
- anAttr = aTmpAttr;
- obj = subobj;
- useSubItems = true;
- } else anIter->Next();
- } else anIter->Next();
+ case 6061: // MIN DISTANCE
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_DistanceDlg *aDlg = new GeometryGUI_DistanceDlg(parent, "", Sel ) ;
+ break ;
+ }
+
+ case 8021: // WIREFRAME-SHADING
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ // VTK
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IOS = It.Value();
+ myRenderInter->SwitchRepresentation(IOS, false);
+ }
+ myRenderInter->Render();
+ QApplication::restoreOverrideCursor();
+ }
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape( IObject, found, true );
+ if (!Shape.IsNull()) {
+ AIS_DisplayMode mode = ( AIS_DisplayMode )Shape->DisplayMode();
+ if ( mode == -1 )
+ mode = ( AIS_DisplayMode )ic->DisplayMode();
+
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false);
}
+ QApplication::restoreOverrideCursor();
}
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value());
- TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape);
- if (Shape.IsNull())
- MESSAGE("BuildPresentation(): TopoDS_Shape is null!")
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- MESSAGE("BuildPresentation(): SObject has Name")
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- // searchin for already displayed objects with the same shape
- AIS_ListOfInteractive aDisplayed;
- ic->DisplayedObjects(aDisplayed);
- AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
- Handle(AIS_Shape) anAISShape;
- for(;anIObjects.More();anIObjects.Next()) {
- anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
- if (!anAISShape.IsNull()) {
- if (anAISShape->Shape().IsSame(Shape)) break;
- anAISShape.Nullify();
- }
+ ic->UpdateCurrentViewer();
+ }
+ QApplication::restoreOverrideCursor();
+ break;
+ }
+
+ case 8031: // COLOR - POPUP VIEWER
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ // VTK
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+
+ Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject();
+ if(!FirstIOS.IsNull()) {
+
+ QColor initcolor = myRenderInter->GetColor(FirstIOS);
+
+ QColor c = QColorDialog::getColor( initcolor,
+ QAD_Application::getDesktop() );
+
+ if ( c.isValid() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IOS = It.Value();
+ myRenderInter->SetColor(IOS,c);
}
- if (!anAISShape.IsNull()) {
- if (!ic->IsDisplayed(anAISShape)) ic->Display(anAISShape, false);
- } else {
- if (!useSubItems) {
- // open transaction
- QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy );
- op->start();
- if (fatherSF->_is_nil())
- MESSAGE("BuildPresentation(): fatherSF is nil!")
- SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
- aStudyBuilder->Addreference(newObj1, obj);
- // commit transaction
- op->finish();
+ }
+ QApplication::restoreOverrideCursor();
+ }
+ }
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IO, found, true);
+ if ( found ) {
+ Quantity_Color CSFColor;
+ Shape->Color( CSFColor );
+
+ QColor c = QColorDialog::getColor( QColor(CSFColor.Red() * 255.0,
+ CSFColor.Green()* 255.0,
+ CSFColor.Blue() * 255.0 ),
+ QAD_Application::getDesktop() );
+
+ if ( c.isValid() ) {
+ CSFColor = Quantity_Color ( c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB );
+ QApplication::setOverrideCursor( Qt::waitCursor );
+
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true);
+ if ( found ) {
+ Shape->SetColor ( CSFColor );
+ Shape->SetShadingColor ( CSFColor );
}
- Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
- aSh->SetShadingColor( GeomGUI->myShadingColor );
- Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(),
- Fatherior,
- "GEOM");
- IO->setEntry(obj->GetID());
- aSh->setIO( IO );
- aSh->setName( aName->Value() );
- ic->Display (aSh, false);
- if (!useSubItems) ic->AddOrRemoveCurrentObject(aSh, false);
}
}
- // next item iteration
- if (useSubItems) {
- anIter->Next();
- anAttr=SALOMEDS::GenericAttribute::_nil();
- while (anIter->More() && anAttr->_is_nil()) {
- SALOMEDS::SObject_var subobject = anIter->Value();
- SALOMEDS::GenericAttribute_var aTmpAttribute;
- if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
- anAttr = aTmpAttribute;
- obj = subobject;
- } else anIter->Next();
+ }
+ }
+ QApplication::restoreOverrideCursor();
+ break;
+ }
+
+ case 8032: // TRANSPARENCY - POPUP VIEWER
+ {
+ EmitSignalDeactivateDialog() ;
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ GeometryGUI_TransparencyDlg *aDlg = new GeometryGUI_TransparencyDlg( parent, "", Sel, ic ) ;
+ break ;
+ }
+
+ case 8033: // ISOS - POPUP VIEWER
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ else {
+ ic->InitCurrent();
+ if ( ic->MoreCurrent() ) {
+ Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
+ QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
+ QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
+
+ if ( !IsoU.isEmpty() )
+ ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
+ else
+ IsoU = "1";
+ if ( !IsoV.isEmpty() )
+ ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
+ else
+ IsoV = "1";
+
+ GeometryGUI_NbIsosDlg * NbIsosDlg =
+ new GeometryGUI_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE );
+
+ NbIsosDlg->SpinBoxU->setValue(IsoU.toInt());
+ NbIsosDlg->SpinBoxV->setValue(IsoV.toInt());
+
+ if ( NbIsosDlg->exec() ) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ for ( ; ic->MoreCurrent (); ic->NextCurrent () ) {
+ Handle (AIS_Drawer) CurDrawer;
+
+ CurDrawer = ic->Current()->Attributes();
+ CurDrawer->UIsoAspect()->SetNumber( NbIsosDlg->SpinBoxU->text().toInt() );
+ CurDrawer->VIsoAspect()->SetNumber( NbIsosDlg->SpinBoxV->text().toInt() );
+
+ ic->SetLocalAttributes(CurObject, CurDrawer);
+ ic->Redisplay(CurObject);
}
- } else
- anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
}
}
+ QApplication::restoreOverrideCursor();
+ break;
}
- }
- // No viewer update should be done here!
- //GeomGUI->myActiveStudy->updateObjBrowser( true );
- //ic->UpdateCurrentViewer();
- }
-}
-
-//=======================================================================
-// function : Parameter()
-// purpose : return a parameter (float) from a dialog box
-//
-// avalue1 : is a float or integer used as a default value displayed
-// aTitle1 : is the title for aValue1
-// aTitle : is the main title
-// bottom : maximum value to be entered
-// top : minimum value to be entered
-// decimals : number of decimals
-//=======================================================================
-double GeometryGUI::Parameter( Standard_Boolean& res,
- const char* aValue1,
- const char* aTitle1,
- const char* aTitle,
- const double bottom,
- const double top,
- const int decimals )
-{
- GeometryGUI_aParameterDlg * Dialog =
- new GeometryGUI_aParameterDlg(aValue1,
- aTitle1,
- QAD_Application::getDesktop(),
- aTitle,
- TRUE,
- 0,
- bottom,
- top,
- decimals) ;
- int r = Dialog->exec() ;
- float X = 0.0 ;
- if ( r == QDialog::Accepted ) {
- res = Standard_True;
- X = Dialog->getValue();
- } else
- res = Standard_False;
- delete Dialog;
- return X;
-}
-
-
-//=======================================================================
-// function : OnSketchSegment()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchSegment()
-{
- this->mySketcher.ChangeMode(SEGMENT);
-}
+ case 9022 : // ERASE - OBJBROSER POPUP
+ {
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ // VTK
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ Handle(SALOME_InteractiveObject) anIObject;
+ for(;It.More();It.Next()) {
+ anIObject = It.Value();
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+
+// Handle(SALOME_InteractiveObject) IObject;
+ if(myRenderInter->isInViewer(anIObject)) {
+ myRenderInter->Erase(anIObject);
+ } else {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !obj->_is_nil() ) {
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ bool useSubItems = false;
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ }
+
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ // searchin for already displayed objects with the same shape
+ vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ vtkActorCollection* theAllActors = theRenderer->GetActors();
+ theAllActors->InitTraversal();
+ vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
+ Handle(SALOME_InteractiveObject) anIObj;
+ // don't create new study object if it already exists
+ bool isDisplayed = false;
+ while(!(actor==NULL)) {
+ SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
+ if (Gactor!=NULL) {
+ if (Gactor->hasIO()) {
+ if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
+ isDisplayed = true;
+ anIObj = Gactor->getIO();
+ if (!anIObj.IsNull()) myRenderInter->Erase(anIObj);
+ }
+ }
+ }
+ actor=(vtkActor*)(theAllActors->GetNextActor());
+ }
+ }
+ if (useSubItems) {
+ anIter->Next();
+ anAttr=SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
+ }
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
+ }
+ }
+ }
+// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+// for(;It.More();It.Next()) {
+// Handle(SALOME_InteractiveObject) IOS = It.Value();
+// myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);;
+ }
+// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+// for(;It.More();It.Next()) {
+// Handle(SALOME_InteractiveObject) IOS = It.Value();
+// myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);;
+// }
+ }
+ else if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ // OCC
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ Handle(SALOME_InteractiveObject) anIObject;
+ for(;It.More();It.Next()) {
+ anIObject = It.Value();
+ if ( v3d->isInViewer( anIObject, true ) ) {
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) aSh = ConvertIOinGEOMAISShape( anIObject, found, true );
+ if ( found ) {
+ ic->Erase(aSh);
+ ic->AddOrRemoveCurrentObject(aSh, true);
+ }
+ } else {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !obj->_is_nil() ) {
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ bool useSubItems = false;
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ }
+
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ // searchin for already displayed objects with the same shape
+ AIS_ListOfInteractive aDisplayed;
+ ic->DisplayedObjects(aDisplayed);
+ AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
+ Handle(AIS_Shape) anAISShape;
+ for(;anIObjects.More();anIObjects.Next()) {
+ anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
+ if (!anAISShape.IsNull()) {
+ if (anAISShape->Shape().IsSame(Shape)) break;
+ anAISShape.Nullify();
+ }
+ }
+ if (!anAISShape.IsNull()) {
+ if (ic->IsDisplayed(anAISShape)) ic->Erase(anAISShape);
+ }
+ }
+ if (useSubItems) {
+ anIter->Next();
+ anAttr=SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
+ }
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
+ }
+ }
+ }
+ }
+// QAD_Viewer3d* v3d = myActiveStudy->getActiveStudyFrame()->getViewerOCC();
+// Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
+// myContext->EraseSelected();
+ }
-//=======================================================================
-// function : OnSketchArc()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchArc()
-{
- this->mySketcher.ChangeMode(ARC_CHORD);
-}
-
-//=======================================================================
-// function : OnSketchSetAngle()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchSetAngle()
-{
- Standard_Real anAngle = this->mySketcher.GetSegmentAngle()/PI180;
- Sketch::fitInResol(anAngle);
- Standard_Boolean res = false ;
- QString Value = QString("%1").arg( anAngle );
- anAngle = Parameter(res, Value, tr("GEOM_MEN_ANGLE"), tr("GEOM_MEN_ENTER_ANGLE"), -180.0, +180.0, 6 )*PI180 ;
-
- if( res ) {
- this->mySketcher.SetSegmentAngle(anAngle);
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(3133,&pp);
- pp->setItemChecked(3133,false);
- item = Mb->findItem(3134,&pp);
- pp->setItemChecked(3134,false);
- }
-
-}
+ Sel->ClearIObjects();
+ break;
+ }
+
+ case 9023 : // DISPLAY ONLY - OBJBROSER POPUP
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
+ OnVTKDisplayOnly();
+ else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC )
+ OnDisplayOnly();
+ break;
+ }
+ case 9024 : // OPEN - OBJBROSER POPUP
+ {
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ Handle(SALOME_InteractiveObject) anIObject;
+ for(;It.More();It.Next()) {
+ anIObject = It.Value();
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() );
+ SALOMEDS::AttributePersistentRef_var aPersist;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !obj->_is_nil() ) {
+ // this SObject may be GEOM module root SObject
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ SALOMEDS::GenericAttribute_var anAttr;
+ bool useSubItems = false;
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) {
+ useSubItems = true;
+ obj = subobj;
+ }
+ else anIter->Next();
+ }
+ obj->FindAttribute(anAttr, "AttributePersistentRef");
-//=======================================================================
-// function : OnSketchSetx()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchSetx()
-{
- Standard_Boolean res = false;
- double X = Parameter( res,
- "0.",
- tr("GEOM_MEN_X"),
- tr("GEOM_MEN_SKETCHER_X"),
- 2.0 * Precision::Confusion(),
- 1E6,
- 6 ) ;
- if (res)
- this->mySketcher.SetXDimension(X);
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(3133,&pp);
- pp->setItemChecked(3133,false);
- item = Mb->findItem(3134,&pp);
- pp->setItemChecked(3134,false);
-}
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ if (!obj->FindAttribute(anAttr, "AttributeIOR") &&
+ obj->FindAttribute(anAttr, "AttributePersistentRef")) {
+ // load
+ Engines::Component_var comp = myDesktop->getEngine("FactoryServer","GEOM");
+ if (!CORBA::is_nil(comp)) {
+ SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
-//=======================================================================
-// function : OnSketchSety()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchSety()
-{
- Standard_Boolean res = false;
- double Y = Parameter( res,
- "0.",
- tr("GEOM_MEN_Y"),
- tr("GEOM_MEN_SKETCHER_Y"),
- 2.0 * Precision::Confusion(),
- 1E6,
- 6 ) ;
- if (res)
- this->mySketcher.SetYDimension(Y);
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(3133,&pp);
- pp->setItemChecked(3133,false);
- item = Mb->findItem(3134,&pp);
- pp->setItemChecked(3134,false);
-}
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myActiveStudy->getStudyDocument()->NewBuilder();
+ aStudyBuilder->LoadWith(myActiveStudy->getStudyDocument()->FindComponent("GEOM"),driver);
-//=======================================================================
-// function : OnSketchDelete()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchDelete()
-{
- if (GeomGUI->mySketcher.GetmyEdgesNumber() == 1 ) {
- QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(313,&pp);
- pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS
- GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT);
- }
+ } else {
+ MESSAGE("Component is null");
+ }
+ }
+ if (useSubItems) {
+ anIter->Next();
+ obj = anIter->Value();
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
+ }
+ }
+ break;
+ }
+
+ case 10000 : // SKETCH Segment
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchSegment();
+ break;
+ }
+ case 10001 : // SKETCH Arc
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchArc();
+ break;
+ }
+ case 10002 : // SKETCH Set Angle
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchSetAngle();
+ break;
+ }
+ case 10003 : // SKETCH Set X
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchSetx();
+ break;
+ }
+ case 10004 : // SKETCH Set Y
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchSety();
+ break;
+ }
+ case 10006 : // SKETCH Delete
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchDelete();
+ break;
+ }
+ case 10007 : // SKETCH End
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchEnd();
+ break;
+ }
+ case 10008 : // SKETCH Close
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ break;
+ OnSketchClose();
+ break;
+ }
+ case 10010 : // SKETCH OptionsOnofflengthdimension
+ {
+ OnSketchOptionsOnofflengthdimension();
+ break;
+ }
+ case 10011 : // SKETCH OptionsOnoffangledimension
+ {
+ OnSketchOptionsOnoffangledimension();
+ break;
+ }
+ case 10012 : // SKETCH OptionsOnoffradiusdimension
+ {
+ OnSketchOptionsOnoffradiusdimension();
+ break;
+ }
+ case 10013 : // SKETCH OptionsOnoffxdimension
+ {
+ OnSketchOptionsOnoffxdimension();
+ break;
+ }
+ case 10014 : // SKETCH OptionsOnoffydimension
+ {
+ OnSketchOptionsOnoffydimension();
+ break;
+ }
- if (this->mySketcher.Delete())
- GeomGUI->ResetState();
+ default:
+ {
+ parent->putInfo( tr("GEOM_PRP_COMMAND").arg(theCommandID ) );
+ break;
+ }
+ }
+
+ return true ;
}
-//=======================================================================
-// function : OnSketchClose()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchClose()
-{
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
-
- TopoDS_Wire W = this->mySketcher.Close();
- if ( !W.IsNull() ) {
- //
- GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR;
- listShapes->length(0);
- unsigned int i = 0;
-
- BRepTools_WireExplorer Ex(W);
- while ( Ex.More() ) {
- TopoDS_Edge E = Ex.Current();
- gp_Pnt pt1 , pt2 ;
-
- pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E));
- pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E));
-
- gp_Pnt CenterPoint;
- Handle(Geom_Curve) Curve;
- Handle(Geom_Circle) Circle;
- gp_Circ Circ;
- Standard_Real First,Last;
-
- Curve = BRep_Tool::Curve(E,First,Last);
- if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) {
- Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ
- Circ = Circle->Circ(); // gp_Circ
-
- Curve->D0( (First + Last) / 2. , CenterPoint );
-
- GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
- GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() );
- GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
+//=====================================================================================
+// function : OnKeyPress()
+// purpose : [static]
+//=====================================================================================
+bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+{
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
+ return false;
+ return true ;
+}
- GEOM::GEOM_Shape_var arc;
- try {
- arc = myComponentGeom->MakeArc(pI, pC, pE) ;
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
+//==================================================================================
+// function : 0nMousePress()
+// purpose : [static] manage mouse events
+//==================================================================================
+bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+{
+ MESSAGE ( "GeometryGUI::OnMousePress")
- listShapes->length(i+1);
- listShapes[i] = strdup(arc->Name());
- i++;
- } else {
- GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
- GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
- GEOM::GEOM_Shape_var segment;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
+ return false;
- try {
- segment = myComponentGeom->MakeEdge(pI,pE) ;
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+ OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort();
+
+ /* Get the clicked or selected point */
+ gp_Pnt thePoint;
- listShapes->length(i+1);
- listShapes[i] = strdup(segment->Name());
- i++;
- }
- Ex.Next();
+ if ( myState == CURRENT_SKETCH) {
+ mySketcher.ValidateEdge();
+ if (mySketcher.GetmyEdgesNumber() == 1 ) {
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
+ QMenuData* pp;
+ QMenuItem* item = Mb->findItem(313,&pp);
+ pp->setItemEnabled( 313, true); // SKETCH CONTRAINTS
}
- GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ;
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, Wire);
- Standard_CString type;
- GetShapeTypeString(S,type);
- Wire->NameType( type );
+ } else if( myState == POINT_METHOD ) {
- if ( Display(Wire, "" )) {
- QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ EraseSimulationShape() ;
+ GeometryGUI_PointDlg *DialogPt = (GeometryGUI_PointDlg*)(myActiveDialogBox) ;
+
+ if ( DialogPt->UseLocalContext() ) {
+ ic->InitSelected();
+ if ( pe->state() == Qt::ShiftButton )
+ v3d->getAISSelector()->shiftSelect(); /* Append selection */
+ else
+ v3d->getAISSelector()->select(); /* New selection */
+
+ if ( ic->MoreSelected() ) {
+ thePoint = BRep_Tool::Pnt( TopoDS::Vertex(ic->SelectedShape()) );
+ }
+ else
+ thePoint = ConvertClickToPoint(pe->x(), pe->y(), ( (OCCViewer_ViewPort3d*)vp)->getView() );
}
+ else
+ thePoint = ConvertClickToPoint(pe->x(), pe->y(), ( (OCCViewer_ViewPort3d*)vp)->getView() );
+
+ if( DialogPt != 0 ) {
+ DialogPt->PointIntoCoordinates(thePoint, true) ; /* display point */
+ }
+ else {
+ // MESSAGE ("On Mouse Press : myActiveDialogBox is null" << endl) ;
+ myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
+ }
}
- GeomGUI->ResetState();
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(313,&pp);
- pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS
- GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT);
-}
+ return false ;
+}
//=======================================================================
-// function : OnSketchEnd()
-// purpose :
+// function : OnMouseMove()
+// purpose : [static] manage mouse events
//=======================================================================
-void GeometryGUI::OnSketchEnd()
+bool GeometryGUI::OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
{
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
+ return false;
- TopoDS_Wire W = this->mySketcher.End();
- if (!W.IsNull()) {
- //
- GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR;
- listShapes->length(0);
- unsigned int i = 0;
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+ OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort();
- BRepTools_WireExplorer Ex(W);
- while ( Ex.More() ) {
- TopoDS_Edge E = TopoDS::Edge( Ex.Current() );
-
- gp_Pnt pt1 , pt2 ;
- pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E));
- pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E));
+ if ( myState == CURRENT_SKETCH)
+ mySketcher.MakeCurrentEdge(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
- gp_Pnt CenterPoint;
- Handle(Geom_Curve) Curve;
- Handle(Geom_Circle) Circle;
- gp_Circ Circ;
- Standard_Real First,Last;
-
- Curve = BRep_Tool::Curve(E,First,Last);
- if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) {
- Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ
- Circ = Circle->Circ(); // gp_Circ
-
- Curve->D0( (First + Last) / 2. , CenterPoint );
+ return true;
+}
- GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
- GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() );
- GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
- GEOM::GEOM_Shape_var arc;
+//=====================================================================================
+// function : SetSettings()
+// purpose : [static]
+//=====================================================================================
+bool GeometryGUI::SetSettings( QAD_Desktop* parent )
+{
+ //DCQ parent->menuBar()->setItemEnabled( 504, false); // CORRECTING
+ //DCQ parent->menuBar()->setItemEnabled( 6062, false); // RADIUS
+ //VSR parent->menuBar()->setItemEnabled( 701, false); // AUTOMATIC COPY
+ parent->menuBar()->setItemEnabled( 313, false); // SKETCH CONTRAINTS
+ parent->menuBar()->setItemEnabled( 3131, false); // SKETCH SET PLAN
- try {
- arc = myComponentGeom->MakeArc(pI, pC, pE) ;
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
-
- listShapes->length(i+1);
- listShapes[i] = strdup(arc->Name());
- i++;
- } else {
- GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() );
- GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() );
- GEOM::GEOM_Shape_var segment;
-
- try {
- segment = myComponentGeom->MakeEdge(pI,pE) ;
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
-
- listShapes->length(i+1);
- listShapes[i] = strdup(segment->Name());
- i++;
- }
- Ex.Next();
- }
+ /* Shading Color */
+ QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed");
+ QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
+ QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue");
+ if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ myShadingColor = Quantity_Color (SCr.toInt()/255., SCg.toInt()/255., SCb.toInt()/255., Quantity_TOC_RGB);
- GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ;
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, Wire);
- Standard_CString type;
- GetShapeTypeString(S,type);
- Wire->NameType( type );
+ /* Wireframe or Shading */
+ int DisplayMode = 0;
+ if ( parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
+ DisplayMode = ic->DisplayMode();
+ } else if ( parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+ DisplayMode = myRenderInter->GetDisplayMode();
+ }
- if ( Display(Wire, "") ) {
- QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ if ( DisplayMode == 1 )
+ parent->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") );
+ else
+ parent->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") );
+
+ /* Copy */
+// QString Copy = QAD_CONFIG->getSetting("Geometry:SettingsCopy");
+// if ( !Copy.isEmpty() ) {
+// mySettings_Copy = Copy.toInt();
+// QMenuData* pp;
+// parent->menuBar()->findItem(701,&pp);
+// pp->setItemChecked(701, mySettings_Copy);
+// }
+ QMenuData* pp;
+ if ( parent->menuBar()->findItem(701,&pp) )
+ pp->removeItem(701);
+
+ /* Add in Study */
+ QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy");
+ if ( !AddInStudy.isEmpty() )
+ mySettings_AddInStudy = AddInStudy.toInt();
+ else
+ mySettings_AddInStudy = 1;
+ parent->menuBar()->findItem(702,&pp);
+ pp->setItemChecked(702, mySettings_AddInStudy);
+
+ /* step value */
+ QString S = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
+ if( S.isEmpty() )
+ QAD_CONFIG->addSetting( "Geometry:SettingsGeomStep", "100" );
+
+ /* isos */
+ QAD_Study* ActiveStudy = parent->getActiveStudy();
+ int count = ActiveStudy->getStudyFramesCount();
+
+ bool ViewOCC = false;
+ for ( int i = 0; i < count; i++ ) {
+ if ( ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC ) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+
+ QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
+ QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
+ if ( !IsoU.isEmpty() )
+ ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
+ if ( !IsoV.isEmpty() )
+ ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
+
+ ViewOCC = true;
}
}
- GeomGUI->ResetState();
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(313,&pp);
- pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS
- GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT);
-}
-//=======================================================================
-// function : OnSettingsNoconstraint()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSettingsNoconstraint()
-{
- this->mySketcher.SetTransitionStatus(NOCONSTRAINT);
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
+
+ Mb->setItemEnabled( 312, ViewOCC); //Sketch
+ Mb->setItemEnabled( 309, ViewOCC); //SuppressFace
+ Mb->setItemEnabled( 314, ViewOCC); //SuppressHole
+
+ Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings
+ Mb->setItemEnabled( 704, ViewOCC);// Isos Settings
+
+ return true;
}
-//=======================================================================
-// function : OnSettingsPerpendicular()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSettingsPerpendicular()
-{
- this->mySketcher.SetTransitionStatus(PERPENDICULAR);
-}
-//=======================================================================
-// function : OnSettingsTangent()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSettingsTangent()
+//=====================================================================================
+// function : DefinePopup()
+// purpose : [static]
+//=====================================================================================
+void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject)
{
- this->mySketcher.SetTransitionStatus(TANGENT);
-}
+ SALOME_Selection* Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ theObject = "";
-//=======================================================================
-// function : OnSketchOptionsOnoffangledimension()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchOptionsOnoffangledimension()
-{
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(10011,&pp);
- pp->setItemChecked(10011,!pp->isItemChecked(10011));
- this->mySketcher.SetParameterVisibility(ANGLE_PARAMETER,pp->isItemChecked(10011));
-}
+ if(Sel->IObjectCount() == 1) {
+ Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
+ if(IO->hasEntry()) {
+ SALOMEDS::SObject_var sobj = myActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry());
+ if(!sobj->_is_nil()) {
+ SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent();
+ if(strcmp(scomp->GetID(), IO->getEntry()) == 0) {
+ // component is selected
+ theObject = "Component";
+ }
+ }
+ }
+ }
-//=======================================================================
-// function : OnSketchOptionsOnofflengthdimension()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchOptionsOnofflengthdimension()
-{
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(10010,&pp);
- pp->setItemChecked(10010,!pp->isItemChecked(10010));
- this->mySketcher.SetParameterVisibility(LENGTH_PARAMETER,pp->isItemChecked(10010));
+ if((theParent.compare("Viewer")==0)) {
+ if(myState == CURRENT_SKETCH)
+ theContext = "Sketch";
+ else {
+ if (Sel->IObjectCount() > 0)
+ theContext = "";
+ else
+ theContext = "NothingSelected";
+ }
+ }
+ else
+ theContext = "";
}
-//=======================================================================
-// function : OnSketchOptionsOnoffradiusdimension()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchOptionsOnoffradiusdimension()
-{
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(10012,&pp);
- pp->setItemChecked(10012,!pp->isItemChecked(10012));
- this->mySketcher.SetParameterVisibility(RADIUS_PARAMETER,pp->isItemChecked(10012));
-}
+//=====================================================================================
+// function : CustomPopup()
+// purpose : [static]
+//=====================================================================================
+bool GeometryGUI::CustomPopup( QAD_Desktop* parent,
+ QPopupMenu* popup,
+ const QString& theContext,
+ const QString& theParent,
+ const QString& theObject )
+{
+ /* Deactivate any non modal dialog box to get the neutral point */
+ EmitSignalDeactivateDialog() ;
+
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ int nbSel = Sel->IObjectCount();
+
+ if ( (nbSel == 0) && ( theContext.compare("Sketch")!=0 ) )
+ return false;
+
+
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
+ {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->
+ getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
+ if ( theParent.compare("Viewer")==0 )
+ {
+ if ( theContext.compare("Sketch")==0 )
+ {
+ SketchStatus myCS = mySketcher.GetCurrentStatus();
+ popup->setCheckable(TRUE);
+ if (myCS==SEGMENT)
+ {
+ popup->setItemChecked(10000,true);
+ popup->setItemChecked(10001,false);
+ }
+ else if (myCS==ARC_CHORD)
+ {
+ popup->setItemChecked(10000,false);
+ popup->setItemChecked(10001,true);
+ }
+
+ return true;
+ }
+ else
+ if (theObject.compare("Component") == 0)
+ {
+ popup->removeItem(QAD_DisplayOnly_Popup_ID);
+ return true;
+ }
+ else
+ {
+ QFont f = QApplication::font();
+ f.setBold( TRUE );
+ if (nbSel==1)
+ {
+ Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
+ popup->removeItem(QAD_TopLabel_Popup_ID);
+ popup->insertItem( new CustomItem ( QString(IObject->getName()), f ), QAD_TopLabel_Popup_ID, 0 );
+ if ( IObject->hasEntry() )
+ popup->setItemEnabled( 801, false );
+ else
+ popup->setItemEnabled( 801, true );
+
+ if (IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject)))
+ {
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) Result = ConvertIOinGEOMAISShape(IObject, found, true);
+
+ if ( found )
+ {
+ if ( Result->DisplayMode() == 1 )
+ popup->changeItem(8021, tr("GEOM_MEN_WIREFRAME") );
+ else
+ popup->changeItem(8021, tr("GEOM_MEN_SHADING") );
+ }
+ }
+
+ if ( !(v3d->isInViewer( IObject ) && v3d->isVisible( IObject )) )
+ popup->removeItem(QAD_Erase_Popup_ID);
+ else
+ popup->removeItem(QAD_Display_Popup_ID);
+
+ }
+ else
+ {
+ popup->removeItem(QAD_DisplayOnly_Popup_ID);
+ popup->removeItem(QAD_TopLabel_Popup_ID);
+ popup->insertItem( new CustomItem ( tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f ),
+ QAD_TopLabel_Popup_ID, 0 );
+ popup->setItemEnabled( 801, false );
+ }
+ }
+ return true;
+ }
+ else
+ if ( theParent.compare("ObjectBrowser")==0 )
+ {
+ popup->removeItem(QAD_TopLabel_Popup_ID);
+ int id = popup->idAt(0); // separator
+ if (id < 0) popup->removeItem(id);
+
+ // checking for GEOM label in the selected list
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ Handle(SALOME_InteractiveObject) anIObject;
+
+ bool useSubItems = false;
+ bool needOpen = false;
+ bool needDisplay = false;
+ bool needErase = false;
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ for(;It.More();It.Next())
+ {
+ anIObject = It.Value();
+ if (!anIObject->hasEntry())
+ continue;
+
+ if (v3d->isInViewer(anIObject) && v3d->isVisible(anIObject))
+ needErase = true;
+ else
+ needDisplay = true;
+ SALOMEDS::SObject_var obj =
+ myActiveStudy->getStudyDocument()->FindObjectID( anIObject->getEntry() );
+ if (!obj->_is_nil())
+ {
+ GEOM::GEOM_Shape_var aShape;
+ if (obj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value();
+ if (str && strlen(str))
+ aShape = myComponentGeom-> GetIORFromString(str);
+ }
+ else
+ if (obj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
+ needOpen = true;
+ if (aShape->_is_nil())
+ {
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->
+ getStudyDocument()->NewChildIterator(obj);
+ while (anIter->More())
+ {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR"))
+ {
+ useSubItems = true;
+ needErase = true;
+ needDisplay = true;
+ }
+ else
+ if (subobj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
+ {
+ needOpen = true;
+ useSubItems = true;
+ }
+ anIter->Next();
+ }
+ }
+ }
+ }
+ // remove useless popup items
+ if (nbSel != 1) popup->removeItem(901); // rename
+ if (useSubItems) popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
+ if (!needOpen)
+ {
+ int index = popup->indexOf(9024);
+ popup->removeItem(9024); // open
+ popup->removeItemAt(index); // separator under Open
+ if (!needDisplay) popup->removeItem(QAD_Display_Popup_ID);
+ if (!needErase) popup->removeItem(QAD_Erase_Popup_ID);
+ if (!needDisplay && !needErase)
+ {
+ int id = popup->idAt(popup->count()-1); // last item
+ popup->removeItem(id); // separator
+ }
+ }
+ else
+ {
+ popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
+ popup->removeItem(QAD_Display_Popup_ID);
+ popup->removeItem(QAD_Erase_Popup_ID);
+ if (nbSel!=1)
+ {
+ int id = popup->idAt(popup->count()-1); // last item
+ popup->removeItem(id); // separator
+ }
+ }
+ return true;
+ }
+ // MESSAGE ( " CUSTOM POPUP VIEWER OCC done. ")
+ }
+ else
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
+ {
+ // MESSAGE ( " CUSTOM POPUP VIEWER VTK ")
+ if ( ( theParent.compare("Viewer")==0 ) )
+ {
+
+ popup->setItemEnabled( 8033, false );
+ if (theObject.compare("Component") == 0)
+ {
+ popup->removeItem(QAD_DisplayOnly_Popup_ID);
+ return true;
+ }
-//=======================================================================
-// function : OnSketchOptionsOnoffxdimension()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchOptionsOnoffxdimension()
-{
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(10013,&pp);
- pp->setItemChecked(10013,!pp->isItemChecked(10013));
- this->mySketcher.SetParameterVisibility(XVALUE_PARAMETER,pp->isItemChecked(10013));
-}
+ //int id = popup->idAt(0);
+ QFont f = QApplication::font();
+ f.setBold( TRUE );
+
+ if (nbSel==1)
+ {
+ Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
+ popup->removeItem(QAD_TopLabel_Popup_ID);
+ popup->insertItem( new CustomItem ( QString(IObject->getName()), f ), QAD_TopLabel_Popup_ID, 0 );
+ if ( IObject->hasEntry() )
+ {
+ popup->setItemEnabled( 801, false );
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if ( !SO->_is_nil() )
+ {
+ if (SO->FindAttribute(anAttr, "AttributeIOR") )
+ {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ Standard_Boolean found;
+ GEOM_Actor* Result = ConvertIORinGEOMActor(anIOR->Value(), found, true);
+ if ( found )
+ {
+ if ( Result->getDisplayMode() == 1 )
+ popup->changeItem(8021, "Wireframe" );
+ else
+ popup->changeItem(8021, "Shading" );
+
+ if ( !Result->GetVisibility() )
+ popup->removeItem(QAD_Erase_Popup_ID);
+ else
+ popup->removeItem(QAD_Display_Popup_ID);
+ }
+ else
+ popup->removeItem(QAD_Erase_Popup_ID);
+ }
+ }
+ }
+ else
+ popup->setItemEnabled( 801, true );
+ }
+ else
+ {
+ popup->removeItem(QAD_DisplayOnly_Popup_ID);
+ popup->removeItem(QAD_TopLabel_Popup_ID);
+ popup->insertItem( new CustomItem ( tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f ), QAD_TopLabel_Popup_ID, 0 );
+ popup->setItemEnabled( 801, false );
+ }
+ return true;
+ }
+ else
+ if ( theParent.compare("ObjectBrowser")==0 )
+ {
+ popup->removeItem(QAD_TopLabel_Popup_ID);
+ int id = popup->idAt(0); // separator
+ if (id < 0) popup->removeItem(id);
+
+ // checking for GEOM label in the selected list
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ Handle(SALOME_InteractiveObject) anIObject;
+
+ bool useSubItems = false;
+ bool needOpen = false;
+ bool needDisplay = false;
+ bool needErase = false;
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->
+ getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
+ for(;It.More();It.Next())
+ {
+ anIObject = It.Value();
+ if ( !anIObject->hasEntry() )
+ continue;
+
+ if (myRenderInter->isInViewer(anIObject) && myRenderInter->isVisible(anIObject))
+ needErase = true;
+ else
+ needDisplay = true;
-//=======================================================================
-// function : OnSketchOptionsOnoffydimension()
-// purpose :
-//=======================================================================
-void GeometryGUI::OnSketchOptionsOnoffydimension()
-{
- QMenuBar* Mb = this->myDesktop->getMainMenuBar();
- QMenuData* pp;
- QMenuItem* item = Mb->findItem(10014,&pp);
- pp->setItemChecked(10014,!pp->isItemChecked(10014));
- this->mySketcher.SetParameterVisibility(YVALUE_PARAMETER,pp->isItemChecked(10014));
+ SALOMEDS::SObject_var obj = myActiveStudy->getStudyDocument()
+ ->FindObjectID( anIObject->getEntry() );
+ if (!obj->_is_nil()) {
+ GEOM::GEOM_Shape_var aShape;
+ if (obj->FindAttribute(aTmpAttr, "AttributeIOR")){
+ char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value();
+ if (str && strlen(str))
+ aShape = myComponentGeom->GetIORFromString(str);
+ }
+ else
+ if (obj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
+ needOpen = true;
+ if (aShape->_is_nil())
+ {
+ SALOMEDS::ChildIterator_var anIter =
+ myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ while (anIter->More())
+ {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR"))
+ {
+ useSubItems = true;
+ needDisplay = true;
+ needErase = true;
+ }
+ else
+ if (subobj->FindAttribute(aTmpAttr, "AttributePersistentRef"))
+ {
+ needOpen = true;
+ useSubItems = true;
+ }
+ anIter->Next();
+ }
+ }
+ }
+ }
+ // remove useless popup items
+ if (nbSel != 1) popup->removeItem(901); // rename
+ if (useSubItems) popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
+ if (!needOpen)
+ {
+ int index = popup->indexOf(9024);
+ popup->removeItem(9024); // open
+ popup->removeItemAt(index); // separator under Open
+
+ if (!needDisplay) popup->removeItem(QAD_Display_Popup_ID);
+ if (!needErase) popup->removeItem(QAD_Erase_Popup_ID);
+ if (!needDisplay && !needErase)
+ {
+ int id = popup->idAt(popup->count()-1); // last item
+ popup->removeItem(id); // separator
+ }
+ }
+ else
+ {
+ popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only
+ popup->removeItem(QAD_Display_Popup_ID);
+ popup->removeItem(QAD_Erase_Popup_ID);
+ if (nbSel!=1)
+ {
+ int id = popup->idAt(popup->count()-1); // last item
+ popup->removeItem(id); // separator
+ }
+ }
+ return true;
+ // MESSAGE ( " CUSTOM POPUP VIEWER VTK done.")
+ }
+ } else
+ { // other viewer types not supported.
+ while (1)
+ {
+ int id = popup->idAt(0);
+ if (id <= QAD_TopLabel_Popup_ID && id != -1)
+ popup->removeItemAt(0);
+ else
+ break;
+ }
+ popup->removeItem(QAD_DisplayOnly_Popup_ID);
+ popup->removeItem(QAD_Display_Popup_ID);
+ popup->removeItem(QAD_Erase_Popup_ID);
+ int id = popup->idAt(popup->count()-1); // last item
+ if (id < 0 && id != -1) popup->removeItem(id); // separator
+ return false;
+ }
+ return false;
}
//=======================================================================
-// function : Archimede()
-// purpose :
+// function : activeStudyChanged()
+// purpose : static
//=======================================================================
-void GeometryGUI::Archimede( const Handle(SALOME_InteractiveObject)& IO,
- const double aWeight,
- const double aWaterDensity,
- const double aMeshingDeflection )
+void GeometryGUI::activeStudyChanged(QAD_Desktop* parent)
{
- try {
- if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
- Handle(GEOM_InteractiveObject) GIO =
- Handle(GEOM_InteractiveObject)::DownCast( IO );
- GEOM::GEOM_Shape_var Shape = GeomGUI->myComponentGeom->GetIORFromString( GIO->getIOR() );
-
- GEOM::GEOM_Shape_var Result = GeomGUI->myComponentGeom->Archimede( Shape, aWeight, aWaterDensity, aMeshingDeflection);
- Result->NameType(tr("GEOM_PLANE"));
- if ( Display(Result, "") ) {
- QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
- }
- return;
- }
- if ( IO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( !obj->_is_nil() ) {
- if (obj->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var Shape = GeomGUI->myComponentGeom->GetIORFromString( anIOR->Value() );
- GEOM::GEOM_Shape_var Result = GeomGUI->myComponentGeom->Archimede( Shape, aWeight, aWaterDensity, aMeshingDeflection);
- Result->NameType(tr("GEOM_PLANE"));
- if ( Display(Result, "") ) {
- QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
- }
- }
- }
+ if(GeomGUI != 0) {
+ if(myState == CURRENT_SKETCH) {
+ mySketcher.Clear();
+ ResetState();
}
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
-}
-
-
-//=====================================================================================
-// EXPORTED METHODS
-//=====================================================================================
-extern "C"
-{
- bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
- {
- return GeometryGUI::OnGUIEvent(theCommandID, parent);
- }
-
- bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- return GeometryGUI::OnKeyPress (pe, parent, studyFrame);
- }
-
- bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- return GeometryGUI::OnMousePress (pe, parent, studyFrame);
- }
-
- bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- return GeometryGUI::OnMouseMove (pe, parent, studyFrame);
- }
+ QMenuBar* Mb = myDesktop->getMainMenuBar();
+ bool ViewOCC = false;
+ if(myDesktop->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
+ ViewOCC = true;
- bool SetSettings ( QAD_Desktop* parent )
- {
- return GeometryGUI::SetSettings( parent );
- }
+ Mb->setItemEnabled(312, ViewOCC); //Sketch
+ Mb->setItemEnabled(309, ViewOCC); //SuppressFace
+ Mb->setItemEnabled(314, ViewOCC); //SuppressHole
+
+ Mb->setItemEnabled(703, ViewOCC);// ShadingColor Settings
+ Mb->setItemEnabled(704, ViewOCC);// Isos Settings
- bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject )
- {
- return GeometryGUI::CustomPopup( parent, popup, theContext, theParent, theObject );
+ EraseSimulationShape();
+ EmitSignalCloseAllDialogs();
+ GeomGUI = 0;
}
+ return ;
+}
- void definePopup ( QString & theContext, QString & theParent, QString & theObject )
- {
- GeometryGUI::DefinePopup( theContext, theParent, theObject );
- }
+
+//=======================================================================
+// function : BuildPresentation()
+// purpose : static
+//=======================================================================
+void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
+{
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- bool activeStudyChanged ( QAD_Desktop* parent )
- {
- GeometryGUI::activeStudyChanged( parent );
- }
+ OCCViewer_Viewer3d* v3d;
+ Handle(AIS_InteractiveContext) ic;
+ vtkRenderer* Renderer;
- void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO )
- {
- GeometryGUI::BuildPresentation(theIO);
- }
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ ic = v3d->getAISContext();
+ } else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ Renderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ } else
+ return;
- void supportedViewType(int* buffer, int bufferSize)
- {
- if (!buffer || !bufferSize) return;
- buffer[0] = (int)VIEW_OCC;
- if (--bufferSize) buffer[1] = (int)VIEW_VTK;
- }
-}
+ if (theIO.IsNull())
+ MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed")
-//=====================================================================================
-// function : OnFilletGetAll()
-// purpose :
-//=====================================================================================
-bool GeometryGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR)
-{
- GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
- ListOfID->length(0);
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ // VTK
+
+ SALOMEDS::SObject_var fatherSF =
+ aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry());
+
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( theIO->getEntry() );
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR );
- if ( theObj->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
- return false ;
- }
-
- try {
- if( Radius <= Precision::Confusion() )
- return false;
+ VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
- GEOM::GEOM_Shape_var result = myComponentGeom->MakeFillet(aShape, Radius, SubShapeType, ListOfID) ;
- if ( result->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
- return false;
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var anIOR;
+
+ if(myRenderInter->isInViewer(theIO)) {
+ myRenderInter->Display(theIO, false);
}
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
- Standard_CString type;
- GetShapeTypeString(S,type);
- result->NameType( type );
+ else {
+ // Create new actor
+ if ( !obj->_is_nil() ) {
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ // this SObject may be GEOM module root SObject
- if ( Display( result, "" ))
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
+ bool useSubItems = false;
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ if (myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) {
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ if (!myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ } else anIter->Next();
+ }
+ }
+
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+
+ vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
+ vtkActorCollection* theAllActors = theRenderer->GetActors();
+ theAllActors->InitTraversal();
+ vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
+ Handle(SALOME_InteractiveObject) anIObj;
+ // don't create new study object if it already exists
+ bool isDisplayed = false;
+ while(!(actor==NULL)) {
+ SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
+ if (Gactor!=NULL) {
+ if (Gactor->hasIO()) {
+ if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
+ isDisplayed = true;
+ anIObj = Gactor->getIO();
+ if (!anIObj.IsNull()) myRenderInter->Display(anIObj, false);
+ }
+ }
+ }
+ actor=(vtkActor*)(theAllActors->GetNextActor());
+ }
+ if (!isDisplayed) {
+ // open transaction
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+
+ SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
+ aStudyBuilder->Addreference(newObj1, obj);
+ // commit transaction
+ op->finish();
+
+ vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
+ int themode = myRenderInter->GetDisplayMode();
+
+ vtkActorCollection* theActors =
+ GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
+ theActors->InitTraversal();
+ vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
+ while(!(anActor==NULL)) {
+ GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
+ Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myFatherior,"GEOM");
+ IO->setEntry(obj->GetID());
+ GActor->setIO( IO );
+ GActor->setName( theIO->getName() );
+
+ theRenderer->AddActor(GActor);
+ // renWin->Render();
+ anActor = (vtkActor*)theActors->GetNextActor();
+ }
+ }
+ }
+ // next item iteration
+ if (useSubItems) {
+ anIter->Next();
+ anAttr = SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
+ }
+ } else anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
+ }
+ }
+ }
+ // No viewer update should be done here!
+ //myRenderInter->Render();
+ //myActiveStudy->updateObjBrowser( true );
+ } else if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
+ SALOMEDS::SObject_var fatherSF =
+ aStudy->FindObjectID( myActiveStudy->getActiveStudyFrame()->entry());
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var anIOR;
+
+ if ( v3d->isInViewer( theIO, true ) ) {
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) aSh = ConvertIOinGEOMAISShape( theIO, found, true );
+ if ( found ) {
+ ic->Display(aSh, false);
+ ic->AddOrRemoveCurrentObject(aSh, false);
+ }
+
+ } else {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( theIO->getEntry() );
+ if ( !obj->_is_nil() ) {
+ MESSAGE("BuildPresentation(): SObject not null")
+ if ( obj->FindAttribute(anAttr, "AttributeIOR")) {
+ MESSAGE("BuildPresentation(): SObject has IOR")
+ // this SObject may be GEOM module root SObject
+
+ bool useSubItems = false;
+ SALOMEDS::ChildIterator_var anIter = myActiveStudy->getStudyDocument()->NewChildIterator(obj);
+ if (myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) {
+ while (anIter->More() && !useSubItems) {
+ SALOMEDS::SObject_var subobj = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttr;
+ if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
+ if (!myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) {
+ anAttr = aTmpAttr;
+ obj = subobj;
+ useSubItems = true;
+ } else anIter->Next();
+ } else anIter->Next();
+ }
+ }
+
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value());
+ TopoDS_Shape Shape = myShapeReader.GetShape(myComponentGeom,aShape);
+ if (Shape.IsNull())
+ MESSAGE("BuildPresentation(): TopoDS_Shape is null!")
+ if (obj->FindAttribute(anAttr, "AttributeName")) {
+ MESSAGE("BuildPresentation(): SObject has Name")
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ // searchin for already displayed objects with the same shape
+ AIS_ListOfInteractive aDisplayed;
+ ic->DisplayedObjects(aDisplayed);
+ AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
+ Handle(AIS_Shape) anAISShape;
+ for(;anIObjects.More();anIObjects.Next()) {
+ anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
+ if (!anAISShape.IsNull()) {
+ if (anAISShape->Shape().IsSame(Shape)) break;
+ anAISShape.Nullify();
+ }
+ }
+ if (!anAISShape.IsNull()) {
+ if (!ic->IsDisplayed(anAISShape)) ic->Display(anAISShape, false);
+ } else {
+ if (!useSubItems) {
+ // open transaction
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy );
+ op->start();
+ if (fatherSF->_is_nil())
+ MESSAGE("BuildPresentation(): fatherSF is nil!")
+ SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
+ aStudyBuilder->Addreference(newObj1, obj);
+ // commit transaction
+ op->finish();
+ }
+ Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
+ aSh->SetShadingColor( myShadingColor );
+ Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(),
+ myFatherior,
+ "GEOM");
+ IO->setEntry(obj->GetID());
+ aSh->setIO( IO );
+ aSh->setName( aName->Value() );
+ ic->Display (aSh, false);
+ if (!useSubItems) ic->AddOrRemoveCurrentObject(aSh, false);
+ }
+ }
+ // next item iteration
+ if (useSubItems) {
+ anIter->Next();
+ anAttr=SALOMEDS::GenericAttribute::_nil();
+ while (anIter->More() && anAttr->_is_nil()) {
+ SALOMEDS::SObject_var subobject = anIter->Value();
+ SALOMEDS::GenericAttribute_var aTmpAttribute;
+ if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
+ anAttr = aTmpAttribute;
+ obj = subobject;
+ } else anIter->Next();
+ }
+ } else
+ anAttr = SALOMEDS::GenericAttribute::_nil();
+ }
+ }
+ }
+ }
+ // No viewer update should be done here!
+ //myActiveStudy->updateObjBrowser( true );
+ //ic->UpdateCurrentViewer();
}
- return true;
}
+
//=====================================================================================
-// function : OnFilletGetSelected()
-// purpose :
+// EXPORTED METHODS
//=====================================================================================
-bool GeometryGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo,
- const char* ShapeTopoIOR,
- const double Radius,
- const int SubShapeType,
- Standard_Integer& aLocalContextId,
- bool& myUseLocalContext )
+extern "C"
{
- if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) {
- return false;
- }
-
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-
- if( myUseLocalContext == false ) {
- /* No local context opened for fillet method */
- myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
- return false ;
- }
-
- GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
- ic->InitSelected();
- int nbSelected = ic->NbSelected();
- int i = 0;
- ic->InitSelected();
-
- while(ic->MoreSelected()) {
- TopoDS_Shape s = ic->SelectedShape();
- if ( s.ShapeType() == TopAbs_FACE ) {
- TopExp_Explorer Exp( s, TopAbs_EDGE );
- TopTools_MapOfShape M ;
- while ( Exp.More() ) {
- if( M.Add(Exp.Current() )) { /* if a new edge : do not add doublons indices */
- ListOfID->length( i + 1 );
- ListOfID[i] = GetIndex( Exp.Current(), ShapeTopo, (int)TopAbs_EDGE ) ;
- i++ ;
- }
- Exp.Next();
- }
- }
- else {
- ListOfID->length( i + 1 );
- ListOfID[i] = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType );
- i++;
- }
- ic->NextSelected();
+ bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+ {
+ return GeometryGUI::GetOrCreateGeometryGUI(parent)->OnGUIEvent(theCommandID, parent);
}
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
- GEOM::GEOM_Shape_var aResult ;
- try {
- aResult = myComponentGeom->MakeFillet( aShape, Radius, 6, ListOfID );
-
- /* local context from DialogBox */
- ic->CloseLocalContext(aLocalContextId) ;
- myUseLocalContext = false ;
-
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult);
- Standard_CString type;
- GetShapeTypeString(S,type);
- aResult->NameType( type );
-
- if ( Display( aResult, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
+ bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+ {
+ return GeometryGUI::GetOrCreateGeometryGUI(parent)->OnKeyPress(pe, parent, studyFrame);
}
- if ( myUseLocalContext ) {
- /* local context from DialogBox */
- ic->CloseLocalContext(aLocalContextId) ;
- myUseLocalContext = false ;
+ bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+ {
+ return GeometryGUI::GetOrCreateGeometryGUI(parent)->OnMousePress(pe, parent, studyFrame);
}
- this->OnDisplayAll(true);
- myActiveStudy->updateObjBrowser();
- myDesktop->putInfo (tr("GEOM_PRP_READY"));
-
- return true ;
-}
-
-//=====================================================================================
-// function : OnChamferGetAll()
-// purpose :
-//=====================================================================================
-bool GeometryGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR)
-{
- GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
- ListOfID->length(0);
-
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR );
- if ( theObj->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
- return false ;
+ bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+ {
+ return GeometryGUI::GetOrCreateGeometryGUI(parent)->OnMouseMove(pe, parent, studyFrame);
}
-
- try {
- if( D1 <= Precision::Confusion() )
- return false;
- if( D2 <= Precision::Confusion() )
- return false;
-
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
- GEOM::GEOM_Shape_var result = myComponentGeom->MakeChamfer(aShape, D1, D2, SubShapeType, ListOfID) ;
- if ( result->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
- return false;
- }
-
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result);
- Standard_CString type;
- GetShapeTypeString(S,type);
- result->NameType( type );
- if ( Display( result, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
+ bool SetSettings (QAD_Desktop* parent)
+ {
+ return GeometryGUI::GetOrCreateGeometryGUI(parent)->SetSettings(parent);
}
- return true;
-}
-//=====================================================================================
-// function : OnChamferGetSelected()
-// purpose :
-//=====================================================================================
-bool GeometryGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo,
- const char* ShapeTopoIOR,
- const double D1, const double D2, const int SubShapeType,
- Standard_Integer& aLocalContextId,
- bool& myUseLocalContext)
-{
- if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) {
- return false;
- }
-
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-
- if( myUseLocalContext == false ) {
- /* No local context opened for chamfer method */
- myDesktop->putInfo(tr("GEOM_PRP_ABORT"));
- return false ;
+ bool customPopup (QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
+ const QString & theParent, const QString & theObject)
+ {
+ return GeometryGUI::GetOrCreateGeometryGUI(parent)->CustomPopup(parent, popup, theContext,
+ theParent, theObject);
}
-
- GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
- ic->InitSelected();
- int nbSelected = ic->NbSelected();
- int i = 0;
- ic->InitSelected();
- while(ic->MoreSelected()) {
- TopoDS_Shape s = ic->SelectedShape();
- if ( s.ShapeType() == TopAbs_FACE ) {
- TopExp_Explorer Exp( s, TopAbs_EDGE );
- TopTools_MapOfShape M ;
- while ( Exp.More() ) {
- if( M.Add(Exp.Current() )) { /* if a new edge : do not add doublons indices */
- ListOfID->length( i + 1 );
- ListOfID[i] = GetIndex( Exp.Current(), ShapeTopo, (int)TopAbs_EDGE ) ;
- i++ ;
- }
- Exp.Next();
- }
- }
- else {
- ListOfID->length( i + 1 );
- ListOfID[i] = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ) ;
- i++;
- }
- ic->NextSelected();
+ void definePopup (QString & theContext, QString & parent, QString & theObject)
+ {
+ GeometryGUI::GetGeometryGUI()->DefinePopup(theContext, parent, theObject);
}
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR );
- GEOM::GEOM_Shape_var aResult ;
- try {
- aResult = myComponentGeom->MakeChamfer( aShape, D1, D2, 6, ListOfID );
-
- /* local context from DialogBox */
- ic->CloseLocalContext(aLocalContextId) ;
- myUseLocalContext = false ;
-
- TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult);
- Standard_CString type;
- GetShapeTypeString(S,type);
- aResult->NameType( type );
-
- if ( Display( aResult, "") )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- }
-
- if ( myUseLocalContext ) {
- /* local context from DialogBox */
- ic->CloseLocalContext(aLocalContextId) ;
- myUseLocalContext = false ;
+ bool activeStudyChanged (QAD_Desktop* parent)
+ {
+ GeometryGUI::GetOrCreateGeometryGUI(parent)->activeStudyChanged(parent);
}
- this->OnDisplayAll(true);
- myActiveStudy->updateObjBrowser();
- myDesktop->putInfo (tr("GEOM_PRP_READY"));
-
- return true ;
-}
-
-//=====================================================================================
-// function : MakeCDGAndDisplay()
-// purpose :
-//=====================================================================================
-void GeometryGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape)
-{
- try {
- GEOM::GEOM_Shape_var result = myComponentGeom->MakeCDG( Shape );
- if ( result->_is_nil() ) {
- myDesktop->putInfo(tr("GEOM_PRP_ABORT") );
- return ;
- }
- result->NameType( tr("GEOM_POINT") );
- if ( Display( result ) )
- myDesktop->putInfo(tr("GEOM_PRP_DONE"));
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
+ void buildPresentation (const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ GeometryGUI::GetGeometryGUI()->BuildPresentation(theIO);
}
- return ;
-}
-bool GeometryGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) {
- SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
- SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject);
- SALOMEDS::SObject_var RefSO;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- for (; it->More();it->Next()) {
- SALOMEDS::SObject_var SO= it->Value();
- if (SO->FindAttribute(anAttr, "AttributeIOR") ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- if ( strcmp( anIOR->Value(), IOR ) == 0 )
- return true;
- }
- if ( SO->ReferencedObject( RefSO ) ) {
- if (RefSO->FindAttribute(anAttr, "AttributeIOR") ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- if ( strcmp( anIOR->Value(), IOR ) == 0 )
- return true;
- }
- }
+ void supportedViewType(int* buffer, int bufferSize)
+ {
+ if(!buffer || !bufferSize) return;
+ buffer[0] = (int)VIEW_OCC;
+ if (--bufferSize) buffer[1] = (int)VIEW_VTK;
}
- return false;
}
#include "GEOM_Actor.h"
#include "GEOM_Sketcher.h"
+#include "GEOM_Client.hxx"
+#include <AIS_ListOfInteractive.hxx>
+
// Open CASCADE Includes
#include <AIS_InteractiveContext.hxx>
#include <Standard.hxx>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
//=================================================================================
//
//=================================================================================
Q_OBJECT /* for QT compatibility */
private :
-
+ GEOM::GEOM_Gen_var myComponentGeom;
+ GEOM_Client myShapeReader;
QAD_Desktop* myDesktop;
QAD_Study* myActiveStudy;
- GEOM::GEOM_Gen_var myComponentGeom;
QDialog* myActiveDialogBox; /* Unique active dialog box */
Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */
vtkActorCollection* mySimulationActor; /* GEOM Actor used only during topo/geom simulations */
Quantity_Color myShadingColor;
+ AIS_ListOfInteractive myListDisplayedObject;
+
+ bool mySettings_AddInStudy;
+ bool mySettings_Copy;
+ Standard_CString myFatherior;
+
+
public :
GeometryGUI();
static GeometryGUI* GetOrCreateGeometryGUI( QAD_Desktop* desktop );
static GeometryGUI* GetGeometryGUI() ;
- QAD_Study* GetActiveStudy() ;
+ QAD_Study* GetActiveStudy();
QAD_Desktop* GetDesktop() ;
+ GEOM_Client& GetShapeReader();
- QDialog* GetActiveDialogBox() ; /* Returns the active DialogBox */
- void SetActiveDialogBox(QDialog* aDlg) ; /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */
-
- void SetState(int aState) ;
- void ResetState() ; /* Sets myState = -1 a private field to indicate wich method is active */
- bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
-
- bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR);
+ QDialog* GetActiveDialogBox(); /* Returns the active DialogBox */
+ void SetActiveDialogBox(QDialog* aDlg); /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */
- void OnEditCopy ();
- void OnEditDelete ();
- void OnVTKDisplayOnly ();
+ void SetState(int aState);
+ void ResetState(); /* Sets myState = -1 a private field to indicate wich method is active */
- void OnDisplayOnly ();
- void OnDisplayAll ( bool onlyPreviousDisplayedObject = false );
- void SetDisplayedObjectList();
-
bool AddInStudy( bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0 );
- bool Display( GEOM::GEOM_Shape_ptr aShape, Standard_CString name = "");
-
- /* Import and export topology methods */
- bool Import();
- bool Export();
-
+ bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
+ bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR);
static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType) ;
static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) ;
static void GetBipointDxDyDz( gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) ;
-
static bool GetShapeTypeString( const TopoDS_Shape& aShape, Standard_CString& aTypeString ) ;
static bool LinearEdgeExtremities( const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) ;
-
static gp_Pnt ConvertClickToPoint( Standard_Real x, Standard_Real y, Handle(V3d_View) aView ) ;
-
/* User dialog 1 parameter returned */
static double Parameter( Standard_Boolean& res,
const char* aValue1 = 0,
const int decimals = 6 ) ;
/* Managed by IAPP */
- Standard_EXPORT static bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ;
- Standard_EXPORT static bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent,
+ Standard_EXPORT bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ;
+ Standard_EXPORT bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent,
QAD_StudyFrame* studyFrame );
- Standard_EXPORT static bool OnMouseMove ( QMouseEvent* pe, QAD_Desktop* parent,
+ Standard_EXPORT bool OnMouseMove ( QMouseEvent* pe, QAD_Desktop* parent,
QAD_StudyFrame* studyFrame );
- Standard_EXPORT static bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent,
+ Standard_EXPORT bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent,
QAD_StudyFrame* studyFrame );
- Standard_EXPORT static void activeStudyChanged ( QAD_Desktop* parent );
- Standard_EXPORT static bool SetSettings ( QAD_Desktop* parent );
- Standard_EXPORT static void DefinePopup( QString & theContext,
+ Standard_EXPORT void activeStudyChanged ( QAD_Desktop* parent );
+ Standard_EXPORT bool SetSettings ( QAD_Desktop* parent );
+ Standard_EXPORT void DefinePopup( QString & theContext,
QString & theParent,
QString & theObject );
- Standard_EXPORT static bool CustomPopup ( QAD_Desktop* parent,
+ Standard_EXPORT bool CustomPopup ( QAD_Desktop* parent,
QPopupMenu* popup,
const QString& theContext,
const QString& theParent,
const QString& theObject );
- Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
-
- void Archimede( const Handle(SALOME_InteractiveObject)& IO, const double aWeight,
- const double aWaterDensity, const double aMeshingDeflection );
-
- void MakePointAndDisplay( const double x, const double y, const double z ) ;
- void MakeVectorAndDisplay( const gp_Pnt P1, const gp_Pnt P2 );
- void MakeBoxAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) ;
- void MakePlaneAndDisplay( const gp_Pnt P1, const Standard_Real dx,
- const Standard_Real dy, const Standard_Real dz, const Standard_Real TrimSize ) ;
- void MakeSphereAndDisplay( const gp_Pnt aCenterPoint, const double aRadius) ;
- void MakeCircleAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius) ;
- void MakeEllipseAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Major_Radius, const Standard_Real Minor_Radius) ;
- void MakeArcAndDisplay( gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint ) ;
- void MakeLineAndDisplay( const gp_Pnt InitPoint, const gp_Pnt LastPoint) ;
- void MakeCylinderAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir,
- const double Radius, const double aHeight ) ;
- void MakeConeAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir,
- const double Radius1, const double Radius2, const double aHeight ) ;
- void MakeTorusAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir,
- const double Radius1, const double Radius2 ) ;
- void MakeBooleanAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2,
- const short operation ) ;
- void MakeRevolutionAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
- const gp_Dir dir, Standard_Real revolAngle ) ;
- void MakePrismAndDisplay( GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2 ) ;
- void MakePipeAndDisplay( GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase ) ;
- void MakeFillingAndDisplay( GEOM::GEOM_Shape_ptr SectionShape, const short mindeg, const short maxdeg,
- const double tol3d, const double tol2d, const short nbiter ) ;
- void MakeRotationAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, const gp_Dir dir,
- const Standard_Real angle ) ;
- void MakeTranslationAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Vec V) ;
-
- void MakeMultiTranslation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const double Step, const short NbTimes ) ;
- void MakeMultiTranslation2DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir1, const double Step1, const short NbTimes1,
- const gp_Dir Dir2, const double Step2, const short NbTimes2 ) ;
- void MakeMultiRotation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes ) ;
- void MakeMultiRotation2DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const double Ang,
- const short NbTimes1, const double Step, const short NbTimes2 ) ;
- void MakeCDGAndDisplay( GEOM::GEOM_Shape_ptr Shape );
- void MakeScaleAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint,
- const Standard_Real factor) ;
- void MakeMirrorAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2 ) ;
- void MakeSewingAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
- const Standard_Real precision ) ;
- void MakeCompoundAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
- void MakeShellAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
- void MakeSolidAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
- void MakeLinearEdgeAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) ;
- void MakeOrientationChangeAndDisplay( GEOM::GEOM_Shape_ptr Shape ) ;
-
- void MakePartitionAndDisplay (const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
- const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR,
- const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR,
- const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR,
- const GEOM::shape_type limit ) ;
-
- void MakeWireAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
- void MakeWorkingPlane( const gp_Pnt P, const gp_Dir D) ;
- void MakeFaceAndDisplay( GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar ) ;
+ Standard_EXPORT void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
- /* Simulation management */
- bool CreateArrowForLinearEdge( const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone ) ;
- void DisplaySimulationShape(const TopoDS_Shape& S) ;
- void EraseSimulationShape() ;
/* Selection and objects management */
-
TopoDS_Shape GetShapeFromIOR( QString IOR );
bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) ;
int GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) ;
Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ;
+
+ /* Import and export topology methods */
+ bool Import();
+ bool Export();
+
+ void OnEditCopy();
+ void OnEditDelete();
+
+ void OnVTKDisplayOnly();
+ void OnDisplayOnly();
+ void OnDisplayAll(bool onlyPreviousDisplayedObject = false);
+ void SetDisplayedObjectList();
+ bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = "");
+
+ /* Simulation management */
+ bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone);
+ void DisplaySimulationShape(const TopoDS_Shape& S);
+ void EraseSimulationShape();
+
+
+ void MakePointAndDisplay(const double x, const double y, const double z);
+ void MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint);
+ void MakeCircleAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius);
+ void MakeEllipseAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Major_Radius,
+ const Standard_Real Minor_Radius);
+ void MakeArcAndDisplay(gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint);
+ void MakeVectorAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
+ void MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, const Standard_Real dy,
+ const Standard_Real dz, const Standard_Real TrimSize);
+ void MakeWorkingPlane(const gp_Pnt P, const gp_Dir D);
+
+
+ void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2);
+ void MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
+ const gp_Dir dir, Standard_Real revolAngle);
+ void MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, const short mindeg, const short maxdeg,
+ const double tol3d, const double tol2d, const short nbiter);
+ void MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase);
+
+
+ void MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
+ void MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
+ void MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar);
+ void MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
+ void MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
+ void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
+
+
/* Remove faces in a shape */
bool OnSuppressFaces( const TopoDS_Shape& ShapeTopo,
const char* ShapeTopoIOR,
const Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ;
-
/* Remove an hole in a topology (ListOfIdEndFace may be an empty list ) */
bool OnSuppressHole( const char* ShapeTopoIOR,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire,
- const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) ;
-
+ const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) ;
/* Remove one or more holes in a face or a shell */
bool OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) ;
-
/* Create a face corresponding to a hole on a shape */
bool OnFillingHole( const TopoDS_Shape& MainShape,
const char* ShapeTopoIOR,
const Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ;
-
+
+
+ void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V);
+ void MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
+ const gp_Dir dir, const Standard_Real angle);
+ void MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2);
+ void MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint,
+ const Standard_Real factor);
+ void MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
+ const gp_Dir Dir, const double Step, const short NbTimes);
+ void MakeMultiTranslation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
+ const gp_Dir Dir1, const double Step1, const short NbTimes1,
+ const gp_Dir Dir2, const double Step2, const short NbTimes2);
+ void MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
+ const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes);
+ void MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
+ const gp_Dir Dir, const gp_Pnt Loc, const double Ang,
+ const short NbTimes1, const double Step, const short NbTimes2);
+
+
+ void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
+ const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR,
+ const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR,
+ const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR,
+ const GEOM::shape_type limit ) ;
+ void Archimede(const Handle(SALOME_InteractiveObject)& IO, const double aWeight,
+ const double aWaterDensity, const double aMeshingDeflection);
/* Method for Fillet */
bool OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR) ;
bool OnFilletGetSelected(const TopoDS_Shape& ShapeTopo,
const int SubShapeType,
Standard_Integer& aLocalContextId,
bool& myUseLocalContext );
-
/* Methods for Chamfer */
bool OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) ;
bool OnChamferGetSelected(const TopoDS_Shape& ShapeTopo,
Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ;
- /* Non modal dialog boxes magement */
- void EmitSignalDeactivateDialog() ;
- void EmitSignalCloseAllDialogs() ;
+
+ void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
+ const Standard_Real precision);
+ void MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape);
+
+
+ void MakeCDGAndDisplay( GEOM::GEOM_Shape_ptr Shape );
/* Sketcher management */
void OnSketchSegment();
void OnSettingsPerpendicular();
void OnSettingsTangent();
+ /* Non modal dialog boxes magement */
+ void EmitSignalDeactivateDialog() ;
+ void EmitSignalCloseAllDialogs() ;
+
signals:
void SignalDeactivateActiveDialog() ;
void SignalCloseAllDialogs() ;
* Constructs a GeometryGUI_1Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
-GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin( QWidget* parent, const char* name, WFlags fl )
- : GeometryGUI_1Sel1Spin_QTD( parent, name, fl )
+GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_1Sel1Spin_QTD(parent, name, fl)
{
-
- SpinBox1->close( TRUE );
-
- SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
- Layout2->addWidget( SpinBox_DX, 0, 1 );
-
+ SpinBox1->close(TRUE);
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout2->addWidget(SpinBox_DX, 0, 1);
}
* Constructs a GeometryGUI_1Sel4Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
-GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin( QWidget* parent, const char* name, WFlags fl )
- : GeometryGUI_1Sel4Spin_QTD( parent, name, fl )
+GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_1Sel4Spin_QTD(parent, name, fl)
{
+ SpinBox1->close(TRUE);
+ SpinBox2->close(TRUE);
+ SpinBox3->close(TRUE);
+ SpinBox4->close(TRUE);
- SpinBox1->close( TRUE );
- SpinBox2->close( TRUE );
- SpinBox3->close( TRUE );
- SpinBox4->close( TRUE );
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout3->addWidget(SpinBox_DX, 0, 2);
- SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
- Layout3->addWidget( SpinBox_DX, 0, 2 );
+ SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY");
+ Layout3->addWidget(SpinBox_DY, 0, 4);
- SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY" ) ;
- Layout3->addWidget( SpinBox_DY, 0, 4 );
-
- SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ" ) ;
- Layout3->addWidget( SpinBox_DZ, 0, 6 );
-
- SpinBox_S = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_S" ) ;
- Layout4->addWidget( SpinBox_S, 0, 1 );
+ SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ");
+ Layout3->addWidget(SpinBox_DZ, 0, 6);
+ SpinBox_S = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_S");
+ Layout4->addWidget(SpinBox_S, 0, 1);
}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_1Spin.cxx
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#include "GeometryGUI_1Spin.h"
+
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qgroupbox.h>
+
+/*
+ * Constructs a GeometryGUI_1Spin which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+GeometryGUI_1Spin::GeometryGUI_1Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_1Spin_QTD(parent, name, fl)
+{
+ SpinBox1->close(TRUE);
+
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout1->addWidget(SpinBox_DX, 0, 1);
+
+}
+
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_1Spin::~GeometryGUI_1Spin()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_1Spin.h
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#ifndef GEOMETRYGUI_1SPIN_H
+#define GEOMETRYGUI_1SPIN_H
+
+#include "GeometryGUI_1Spin_QTD.h"
+#include "GeometryGUI_SpinBox.h"
+
+class GeometryGUI_1Spin : public GeometryGUI_1Spin_QTD
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_1Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ ~GeometryGUI_1Spin();
+
+ GeometryGUI_SpinBox* SpinBox_DX;
+
+};
+
+#endif // GEOMETRYGUI_1SPIN_H
--- /dev/null
+/****************************************************************************
+** Form implementation generated from reading ui file 'GeometryGUI_1Spin_QTD.ui'
+**
+** Created: jeu sep 25 12:22:29 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "GeometryGUI_1Spin_QTD.h"
+
+#include <qvariant.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ * Constructs a GeometryGUI_1Spin_QTD which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+GeometryGUI_1Spin_QTD::GeometryGUI_1Spin_QTD( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "GeometryGUI_1Spin_QTD" );
+ resize( 124, 55 );
+ setCaption( trUtf8( "GeometryGUI_1Spin_QTD" ) );
+ GeometryGUI_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Spin_QTDLayout");
+
+ GroupBox1 = new QGroupBox( this, "GroupBox1" );
+ GroupBox1->setTitle( trUtf8( "" ) );
+ 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");
+ QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout1->addItem( spacer, 3, 1 );
+
+ SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
+ SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
+
+ Layout1->addWidget( SpinBox1, 0, 1 );
+
+ 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 );
+
+ GroupBox1Layout->addLayout( Layout1, 0, 0 );
+
+ GeometryGUI_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_1Spin_QTD::~GeometryGUI_1Spin_QTD()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
--- /dev/null
+/****************************************************************************
+** Form interface generated from reading ui file 'GeometryGUI_1Spin_QTD.ui'
+**
+** Created: jeu sep 25 12:22:29 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef GEOMETRYGUI_1SPIN_QTD_H
+#define GEOMETRYGUI_1SPIN_QTD_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QGroupBox;
+class QLabel;
+class QSpinBox;
+
+class GeometryGUI_1Spin_QTD : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~GeometryGUI_1Spin_QTD();
+
+ QGroupBox* GroupBox1;
+ QSpinBox* SpinBox1;
+ QLabel* TextLabel1;
+
+
+protected:
+ QGridLayout* GeometryGUI_1Spin_QTDLayout;
+ QGridLayout* GroupBox1Layout;
+ QGridLayout* Layout1;
+};
+
+#endif // GEOMETRYGUI_1SPIN_QTD_H
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
-GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin( QWidget* parent, const char* name, WFlags fl )
- : GeometryGUI_2Sel1Spin_QTD( parent, name, fl )
+GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_2Sel1Spin_QTD(parent, name, fl)
{
-
- SpinBox1->close( TRUE );
-
- SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
- Layout2->addWidget( SpinBox_DX, 0, 1 );
-
+ SpinBox1->close(TRUE);
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout2->addWidget(SpinBox_DX, 0, 1);
}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_2Sel2Spin.cxx
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#include "GeometryGUI_2Sel2Spin.h"
+
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qgroupbox.h>
+
+/*
+ * Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+GeometryGUI_2Sel2Spin::GeometryGUI_2Sel2Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_2Sel2Spin_QTD(parent, name, fl)
+{
+ SpinBox1->close(TRUE);
+ SpinBox2->close(TRUE);
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout2->addWidget(SpinBox_DX, 0, 1);
+ SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
+ Layout2->addWidget(SpinBox_DY, 1, 1);
+}
+
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_2Sel2Spin::~GeometryGUI_2Sel2Spin()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_2Sel2Spin.h
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#ifndef GEOMETRYGUI_2SEL2SPIN_H
+#define GEOMETRYGUI_2SEL2SPIN_H
+
+#include "GeometryGUI_2Sel2Spin_QTD.h"
+#include "GeometryGUI_SpinBox.h"
+
+class GeometryGUI_2Sel2Spin : public GeometryGUI_2Sel2Spin_QTD
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_2Sel2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ ~GeometryGUI_2Sel2Spin();
+
+ GeometryGUI_SpinBox* SpinBox_DX;
+ GeometryGUI_SpinBox* SpinBox_DY;
+
+};
+
+#endif // GEOMETRYGUI_2SEL2SPIN_H
--- /dev/null
+/****************************************************************************
+** Form implementation generated from reading ui file 'GeometryGUI_2Sel2Spin_QTD.ui'
+**
+** Created: jeu sep 25 12:10:29 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "GeometryGUI_2Sel2Spin_QTD.h"
+
+#include <qvariant.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ * Constructs a GeometryGUI_2Sel2Spin_QTD which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+GeometryGUI_2Sel2Spin_QTD::GeometryGUI_2Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "GeometryGUI_2Sel2Spin_QTD" );
+ resize( 129, 145 );
+ setCaption( trUtf8( "GeometryGUI_2Sel2Spin_QTD" ) );
+ GeometryGUI_2Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel2Spin_QTDLayout");
+
+ GroupBox1 = new QGroupBox( this, "GroupBox1" );
+ GroupBox1->setTitle( trUtf8( "" ) );
+ 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");
+
+ LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
+
+ Layout1->addWidget( LineEdit1, 0, 2 );
+
+ Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
+
+ SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
+ SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( SpinBox2, 1, 1 );
+
+ TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
+ TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
+ TextLabel4->setText( trUtf8( "TL4" ) );
+
+ Layout2->addWidget( TextLabel4, 1, 0 );
+
+ TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
+ TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
+ TextLabel3->setText( trUtf8( "TL3" ) );
+
+ Layout2->addWidget( TextLabel3, 0, 0 );
+
+ SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
+ SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( SpinBox1, 0, 1 );
+
+ Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
+
+ 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 );
+
+ 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 );
+ QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout1->addItem( spacer, 3, 2 );
+
+ 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 );
+
+ LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
+
+ Layout1->addWidget( LineEdit2, 1, 2 );
+
+ GroupBox1Layout->addLayout( Layout1, 0, 0 );
+
+ GeometryGUI_2Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_2Sel2Spin_QTD::~GeometryGUI_2Sel2Spin_QTD()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
--- /dev/null
+/****************************************************************************
+** Form interface generated from reading ui file 'GeometryGUI_2Sel2Spin_QTD.ui'
+**
+** Created: jeu sep 25 12:10:29 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef GEOMETRYGUI_2SEL2SPIN_QTD_H
+#define GEOMETRYGUI_2SEL2SPIN_QTD_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QSpinBox;
+
+class GeometryGUI_2Sel2Spin_QTD : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_2Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~GeometryGUI_2Sel2Spin_QTD();
+
+ QGroupBox* GroupBox1;
+ QLineEdit* LineEdit1;
+ QSpinBox* SpinBox2;
+ QLabel* TextLabel4;
+ QLabel* TextLabel3;
+ QSpinBox* SpinBox1;
+ QPushButton* PushButton2;
+ QLabel* TextLabel2;
+ QLabel* TextLabel1;
+ QPushButton* PushButton1;
+ QLineEdit* LineEdit2;
+
+
+protected:
+ QGridLayout* GeometryGUI_2Sel2Spin_QTDLayout;
+ QGridLayout* GroupBox1Layout;
+ QGridLayout* Layout1;
+ QGridLayout* Layout2;
+};
+
+#endif // GEOMETRYGUI_2SEL2SPIN_QTD_H
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_2Sel3Spin.cxx
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#include "GeometryGUI_2Sel3Spin.h"
+
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qgroupbox.h>
+
+/*
+ * Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+GeometryGUI_2Sel3Spin::GeometryGUI_2Sel3Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_2Sel3Spin_QTD(parent, name, fl)
+{
+ SpinBox1->close(TRUE);
+ SpinBox2->close(TRUE);
+ SpinBox3->close(TRUE);
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout2->addWidget(SpinBox_DX, 0, 1);
+ SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
+ Layout2->addWidget(SpinBox_DY, 1, 1);
+ SpinBox_DZ = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DZ");
+ Layout2->addWidget(SpinBox_DZ, 2, 1);
+}
+
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_2Sel3Spin::~GeometryGUI_2Sel3Spin()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_2Sel3Spin.h
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#ifndef GEOMETRYGUI_2SEL3SPIN_H
+#define GEOMETRYGUI_2SEL3SPIN_H
+
+#include "GeometryGUI_2Sel3Spin_QTD.h"
+#include "GeometryGUI_SpinBox.h"
+
+class GeometryGUI_2Sel3Spin : public GeometryGUI_2Sel3Spin_QTD
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_2Sel3Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ ~GeometryGUI_2Sel3Spin();
+
+ GeometryGUI_SpinBox* SpinBox_DX;
+ GeometryGUI_SpinBox* SpinBox_DY;
+ GeometryGUI_SpinBox* SpinBox_DZ;
+
+};
+
+#endif // GEOMETRYGUI_2SEL3SPIN_H
--- /dev/null
+/****************************************************************************
+** Form implementation generated from reading ui file 'GeometryGUI_2Sel3Spin_QTD.ui'
+**
+** Created: jeu sep 25 16:18:43 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "GeometryGUI_2Sel3Spin_QTD.h"
+
+#include <qvariant.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ * Constructs a GeometryGUI_2Sel3Spin_QTD which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+GeometryGUI_2Sel3Spin_QTD::GeometryGUI_2Sel3Spin_QTD( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "GeometryGUI_2Sel3Spin_QTD" );
+ resize( 129, 173 );
+ setCaption( trUtf8( "GeometryGUI_2Sel3Spin_QTD" ) );
+ GeometryGUI_2Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel3Spin_QTDLayout");
+
+ GroupBox1 = new QGroupBox( this, "GroupBox1" );
+ GroupBox1->setTitle( trUtf8( "" ) );
+ 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");
+
+ LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
+
+ Layout1->addWidget( LineEdit1, 0, 2 );
+
+ 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 );
+
+ 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 );
+
+ Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
+
+ TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
+ TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
+ TextLabel3->setText( trUtf8( "TL3" ) );
+
+ Layout2->addWidget( TextLabel3, 0, 0 );
+
+ SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
+ SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( SpinBox2, 1, 1 );
+
+ TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
+ TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
+ TextLabel4->setText( trUtf8( "TL4" ) );
+
+ Layout2->addWidget( TextLabel4, 1, 0 );
+
+ TextLabel5 = new QLabel( GroupBox1, "TextLabel5" );
+ TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );
+ TextLabel5->setText( trUtf8( "TL4" ) );
+
+ Layout2->addWidget( TextLabel5, 2, 0 );
+
+ SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
+ SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( SpinBox1, 0, 1 );
+
+ SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" );
+ SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) );
+
+ Layout2->addWidget( SpinBox3, 2, 1 );
+
+ Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
+
+ 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 );
+ QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout1->addItem( spacer, 3, 2 );
+
+ LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
+
+ Layout1->addWidget( LineEdit2, 1, 2 );
+
+ 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 );
+
+ GroupBox1Layout->addLayout( Layout1, 0, 0 );
+
+ GeometryGUI_2Sel3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_2Sel3Spin_QTD::~GeometryGUI_2Sel3Spin_QTD()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
--- /dev/null
+/****************************************************************************
+** Form interface generated from reading ui file 'GeometryGUI_2Sel3Spin_QTD.ui'
+**
+** Created: jeu sep 25 16:18:43 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef GEOMETRYGUI_2SEL3SPIN_QTD_H
+#define GEOMETRYGUI_2SEL3SPIN_QTD_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QSpinBox;
+
+class GeometryGUI_2Sel3Spin_QTD : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_2Sel3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~GeometryGUI_2Sel3Spin_QTD();
+
+ QGroupBox* GroupBox1;
+ QLineEdit* LineEdit1;
+ QLabel* TextLabel1;
+ QLabel* TextLabel2;
+ QLabel* TextLabel3;
+ QSpinBox* SpinBox2;
+ QLabel* TextLabel4;
+ QLabel* TextLabel5;
+ QSpinBox* SpinBox1;
+ QSpinBox* SpinBox3;
+ QPushButton* PushButton1;
+ QLineEdit* LineEdit2;
+ QPushButton* PushButton2;
+
+
+protected:
+ QGridLayout* GeometryGUI_2Sel3Spin_QTDLayout;
+ QGridLayout* GroupBox1Layout;
+ QGridLayout* Layout1;
+ QGridLayout* Layout2;
+};
+
+#endif // GEOMETRYGUI_2SEL3SPIN_QTD_H
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_2Spin.cxx
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#include "GeometryGUI_2Spin.h"
+
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qgroupbox.h>
+
+/*
+ * Constructs a GeometryGUI_2Spin which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+GeometryGUI_2Spin::GeometryGUI_2Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_2Spin_QTD(parent, name, fl)
+{
+ SpinBox1->close(TRUE);
+ SpinBox2->close(TRUE);
+
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout1->addWidget(SpinBox_DX, 0, 1);
+
+ SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
+ Layout1->addWidget(SpinBox_DY, 1, 1);
+
+}
+
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_2Spin::~GeometryGUI_2Spin()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GeometryGUI_2Spin.h
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#ifndef GEOMETRYGUI_2SPIN_H
+#define GEOMETRYGUI_2SPIN_H
+
+#include "GeometryGUI_2Spin_QTD.h"
+#include "GeometryGUI_SpinBox.h"
+
+class GeometryGUI_2Spin : public GeometryGUI_2Spin_QTD
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ ~GeometryGUI_2Spin();
+
+ GeometryGUI_SpinBox* SpinBox_DX;
+ GeometryGUI_SpinBox* SpinBox_DY;
+
+};
+
+#endif // GEOMETRYGUI_2SPIN_H
--- /dev/null
+/****************************************************************************
+** Form implementation generated from reading ui file 'GeometryGUI_2Spin_QTD.ui'
+**
+** Created: jeu sep 25 12:10:30 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "GeometryGUI_2Spin_QTD.h"
+
+#include <qvariant.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ * Constructs a GeometryGUI_2Spin_QTD which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+GeometryGUI_2Spin_QTD::GeometryGUI_2Spin_QTD( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "GeometryGUI_2Spin_QTD" );
+ resize( 124, 83 );
+ setCaption( trUtf8( "GeometryGUI_2Spin_QTD" ) );
+ GeometryGUI_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Spin_QTDLayout");
+
+ GroupBox1 = new QGroupBox( this, "GroupBox1" );
+ GroupBox1->setTitle( trUtf8( "" ) );
+ 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");
+
+ SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
+ SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
+
+ Layout1->addWidget( SpinBox2, 1, 1 );
+ QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout1->addItem( spacer, 3, 1 );
+
+ SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
+ SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
+
+ Layout1->addWidget( SpinBox1, 0, 1 );
+
+ 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 );
+
+ 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 );
+
+ GroupBox1Layout->addLayout( Layout1, 0, 0 );
+
+ GeometryGUI_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+GeometryGUI_2Spin_QTD::~GeometryGUI_2Spin_QTD()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
--- /dev/null
+/****************************************************************************
+** Form interface generated from reading ui file 'GeometryGUI_2Spin_QTD.ui'
+**
+** Created: jeu sep 25 12:10:30 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef GEOMETRYGUI_2SPIN_QTD_H
+#define GEOMETRYGUI_2SPIN_QTD_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QGroupBox;
+class QLabel;
+class QSpinBox;
+
+class GeometryGUI_2Spin_QTD : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GeometryGUI_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~GeometryGUI_2Spin_QTD();
+
+ QGroupBox* GroupBox1;
+ QSpinBox* SpinBox2;
+ QSpinBox* SpinBox1;
+ QLabel* TextLabel1;
+ QLabel* TextLabel2;
+
+
+protected:
+ QGridLayout* GeometryGUI_2Spin_QTDLayout;
+ QGridLayout* GroupBox1Layout;
+ QGridLayout* Layout1;
+};
+
+#endif // GEOMETRYGUI_2SPIN_QTD_H
* Constructs a GeometryGUI_3Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
-GeometryGUI_3Spin::GeometryGUI_3Spin( QWidget* parent, const char* name, WFlags fl )
- : GeometryGUI_3Spin_QTD( parent, name, fl )
+GeometryGUI_3Spin::GeometryGUI_3Spin(QWidget* parent, const char* name, WFlags fl)
+ :GeometryGUI_3Spin_QTD(parent, name, fl)
{
+ SpinBox1->close(TRUE);
+ SpinBox2->close(TRUE);
+ SpinBox3->close(TRUE);
- SpinBox1->close( TRUE );
- SpinBox2->close( TRUE );
- SpinBox3->close( TRUE );
+ SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
+ Layout1->addWidget(SpinBox_DX, 0, 1);
- SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
- Layout1->addWidget( SpinBox_DX, 0, 1 );
-
- SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY" ) ;
- Layout1->addWidget( SpinBox_DY, 1, 1 );
-
- SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ" ) ;
- Layout1->addWidget( SpinBox_DZ, 2, 1 );
+ SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
+ Layout1->addWidget(SpinBox_DY, 1, 1);
+ SpinBox_DZ = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DZ");
+ Layout1->addWidget(SpinBox_DZ, 2, 1);
}
using namespace std;
#include "GeometryGUI_BoxDlg.h"
-#include <Precision.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include "GeometryGUI.h"
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_BoxDlg::GeometryGUI_BoxDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
+GeometryGUI_BoxDlg::GeometryGUI_BoxDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P")));
/***************************************************************/
/* Initialisations */
- Init(Sel);
+ myPrimitiveGUI = thePrimitiveGUI;
+ Init();
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_BoxDlg::Init(SALOME_Selection* Sel)
+void GeometryGUI_BoxDlg::Init()
{
/* init variables */
myConstructorId = 0;
GroupPoints->show();
this->show();
- return ;
+ return;
}
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
+
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText("");
/* filter for next selection */
mySelection->AddFilter(myVertexFilter);
- connect (mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
case 1:
case 0 :
{
if(myOkPoint1 && myOkPoint2)
- myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
+ myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
break;
}
case 1 :
double vz = GroupDimensions->SpinBox_DZ->GetValue();
myPoint1.SetCoord(0.0, 0.0, 0.0);
myPoint2.SetCoord(vx, vy, vz);
- myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
+ myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
break;
}
}
#include "GeometryGUI_2Sel_QTD.h"
#include "GeometryGUI_3Spin.h"
+#include "PrimitiveGUI.h"
+
#include <gp_Pnt.hxx>
//=================================================================================
Q_OBJECT
public:
- GeometryGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
+ GeometryGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_BoxDlg();
private :
- void Init(SALOME_Selection* Sel);
+ void Init();
void enterEvent(QEvent* e);
bool TestBoxDimensions(gp_Pnt P1, gp_Pnt P2);
+ PrimitiveGUI* myPrimitiveGUI;
+
double step;
int myConstructorId;
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
#include "GeometryGUI_CommonDlg.h"
#include "GeometryGUI.h"
-#include "QAD_Application.h"
#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include <qbuttongroup.h>
-#include <qframe.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qevent.h>
//=================================================================================
// class : GeometryGUI_CommonDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_CommonDlg::GeometryGUI_CommonDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+GeometryGUI_CommonDlg::GeometryGUI_CommonDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_COMMON")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "GeometryGUI_CommonDlg" );
- resize( 322, 220 );
- setCaption( tr( "GEOM_COMMON_TITLE" ) );
- setSizeGripEnabled( TRUE );
-
- GeometryGUI_CommonDlgLayout = new QGridLayout( this );
- GeometryGUI_CommonDlgLayout->setSpacing( 6 );
- GeometryGUI_CommonDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "GEOM_COMMON" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- GeometryGUI_CommonDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
- GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupConstructor1->setColumnLayout(0, Qt::Vertical );
- GroupConstructor1->layout()->setSpacing( 0 );
- GroupConstructor1->layout()->setMargin( 0 );
- GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
- GroupConstructor1Layout->setAlignment( Qt::AlignTop );
- GroupConstructor1Layout->setSpacing( 6 );
- GroupConstructor1Layout->setMargin( 11 );
- LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
- LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
- LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
- LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
- SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
- SelectButtonC1A1Shape->setText( tr( "" ) );
- SelectButtonC1A1Shape->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
- SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
- SelectButtonC1A2Shape->setText( tr( "" ) );
- SelectButtonC1A2Shape->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
- TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
- TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I" ).arg("2") );
- TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
- TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
- TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I" ).arg("1") );
- TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
- GeometryGUI_CommonDlgLayout->addWidget( GroupConstructor1, 1, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_1, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "GEOM_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GeometryGUI_CommonDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /* Initialisation */
- Init( Sel ) ;
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_COMMON")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption(tr("GEOM_COMMON_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_COMMON"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->close(TRUE);
+ RadioButton3->close(TRUE);
+
+ GroupCommon = new GeometryGUI_2Sel_QTD(this, "GroupCommon");
+ GroupCommon->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupCommon->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
+ GroupCommon->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
+ GroupCommon->PushButton1->setPixmap(image1);
+ GroupCommon->PushButton2->setPixmap(image1);
+
+ Layout1->addWidget(GroupCommon, 1, 0);
+ /***************************************************************/
+
+ /* Initialisation */
+ myBooleanGUI = theBooleanGUI;
+ Init();
}
GeometryGUI_CommonDlg::~GeometryGUI_CommonDlg()
{
/* no need to delete child widgets, Qt does it all for us */
- this->destroy(TRUE, TRUE) ;
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_CommonDlg::Init( SALOME_Selection* Sel )
-{
- mySelection = Sel ;
- myShape1.Nullify() ;
- myShape2.Nullify() ;
- myConstructorId = 0 ;
-
- myGeomGUI = GeometryGUI::GetGeometryGUI() ;
-
- GroupConstructor1->show();
- myConstructorId = 0 ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- Constructor1->setChecked( TRUE );
- myOkShape1 = myOkShape2 = false ;
-
- myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
- myGeom = GEOM::GEOM_Gen::_narrow(comp);
-
- // TODO previous selection into argument
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
- connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
- connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
-
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- /* to close dialog if study change */
- connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- myGeomGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* Displays Dialog */
+void GeometryGUI_CommonDlg::Init()
+{
+ /* init variables */
+ myEditCurrentArgument = GroupCommon->LineEdit1;
- return ;
-}
+ myShape1.Nullify();
+ myShape2.Nullify();
+ myOkShape1 = myOkShape2 = false;
+ /* signals and slots connections */
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupCommon->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupCommon->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void GeometryGUI_CommonDlg::ConstructorsClicked(int constructorId)
-{
- GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ;
-
- switch (constructorId)
- {
- case 0:
- {
- GroupConstructor1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- LineEditC1A2Shape->setText(tr("")) ;
- Constructor1->setChecked( TRUE );
- myOkShape1 = myOkShape2 = false ;
- break;
- }
- }
- return ;
+ connect(GroupCommon->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupCommon->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ /* displays Dialog */
+ GroupCommon->show();
+ this->show();
+
+ return;
}
+
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
+ this->ClickOnApply();
+ ClickOnCancel();
return ;
}
+
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::ClickOnApply()
{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkShape1 && myOkShape2) {
- myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1 ) ;
- }
- break ;
- }
- }
-
- // accept();
- return ;
-}
+ myGeomGUI->GetDesktop()->putInfo(tr(""));
+ if(myOkShape1 && myOkShape2)
+ myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1);
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void GeometryGUI_CommonDlg::ClickOnCancel()
-{
- myGeomGUI->EraseSimulationShape() ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->ResetState() ;
- reject() ;
- return ;
+ return;
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_CommonDlg::SelectionIntoArgument()
{
- myEditCurrentArgument->setText("") ;
- QString aString = ""; /* name of future selection */
-
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
- if ( nbSel != 1 ) {
- switch (myConstructorId)
- {
- case 0:
- {
- if ( myEditCurrentArgument == LineEditC1A1Shape ) {
- myOkShape1 = false ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
- myOkShape2 = false ;
- }
- break ;
- }
- }
- return ;
+ myEditCurrentArgument->setText("");
+ QString aString = "";
+
+ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1) {
+ if(myEditCurrentArgument == GroupCommon->LineEdit1)
+ myOkShape1 = false;
+ else if( myEditCurrentArgument == GroupCommon->LineEdit2)
+ myOkShape2 = false;
+ return;
}
- /* nbSel == 1 */
+ /* nbSel == 1 */
TopoDS_Shape S;
- Standard_Boolean testResult ;
- Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
- return ;
-
- if ( myEditCurrentArgument == LineEditC1A1Shape ) {
- myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult )
- return ;
- myShape1 = S ;
- LineEditC1A1Shape->setText(aString) ;
- myOkShape1 = true ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
- myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult )
- return ;
- myShape2 = S ;
- LineEditC1A2Shape->setText(aString) ;
- myOkShape2 = true ;
+ Standard_Boolean testResult;
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+ if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
+ return;
+
+ if(myEditCurrentArgument == GroupCommon->LineEdit1) {
+ myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
+ if(!testResult)
+ return;
+ myShape1 = S;
+ GroupCommon->LineEdit1->setText(aString);
+ myOkShape1 = true;
}
- return ;
+ else if(myEditCurrentArgument == GroupCommon->LineEdit2) {
+ myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
+ if(!testResult)
+ return;
+ myShape2 = S;
+ GroupCommon->LineEdit2->setText(aString);
+ myOkShape2 = true;
+ }
+ return;
}
+
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
void GeometryGUI_CommonDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if( send == SelectButtonC1A1Shape ) {
- LineEditC1A1Shape->setFocus() ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- }
- else if(send == SelectButtonC1A2Shape) {
- LineEditC1A2Shape->setFocus() ;
- myEditCurrentArgument = LineEditC1A2Shape;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
+
+ if(send == GroupCommon->PushButton1) {
+ GroupCommon->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupCommon->LineEdit1;
+ }
+ else if(send == GroupCommon->PushButton2) {
+ GroupCommon->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupCommon->LineEdit2;
+ }
+ SelectionIntoArgument();
+
+ return;
}
//=================================================================================
void GeometryGUI_CommonDlg::LineEditReturnPressed()
{
- QLineEdit* send = (QLineEdit*)sender();
- if( send == LineEditC1A1Shape )
- myEditCurrentArgument = LineEditC1A1Shape ;
- else if ( send == LineEditC1A2Shape )
- myEditCurrentArgument = LineEditC1A2Shape ;
+ QLineEdit* send = (QLineEdit*)sender();
+ if(send == GroupCommon->LineEdit1)
+ myEditCurrentArgument = GroupCommon->LineEdit1;
+ else if(send == GroupCommon->LineEdit2)
+ myEditCurrentArgument = GroupCommon->LineEdit2;
else
- return ;
-
- /* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
- /* so SelectionIntoArgument() is automatically called. */
- const QString objectUserName = myEditCurrentArgument->text() ;
- QWidget* thisWidget = (QWidget*)this ;
- if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
- myEditCurrentArgument->setText( objectUserName ) ;
- }
- return ;
-}
+ return;
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_CommonDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupConstructor1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
- }
- return ;
+ GeometryGUI_Skeleton::LineEditReturnPressed();
+ return;
}
-
//=================================================================================
-// function : closeEvent()
+// function : ActivateThisDialog()
// purpose :
//=================================================================================
-void GeometryGUI_CommonDlg::closeEvent( QCloseEvent* e )
+void GeometryGUI_CommonDlg::ActivateThisDialog()
{
- this->ClickOnCancel() ; /* same than click on cancel button */
+ GeometryGUI_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ return;
}
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
-void GeometryGUI_CommonDlg::enterEvent( QEvent * )
+void GeometryGUI_CommonDlg::enterEvent(QEvent * e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
-}
-
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_CommonDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate any active dialog */
- myGeomGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupConstructor1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- return ;
+ if (GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
}
#ifndef DIALOGBOX_COMMON_H
#define DIALOGBOX_COMMON_H
-#include "SALOME_Selection.h"
-#include "GEOM_ShapeTypeFilter.hxx"
+#include "GeometryGUI_Skeleton.h"
+#include "GeometryGUI_2Sel_QTD.h"
-#include <BRepAlgoAPI_Common.hxx>
-
-#include <qvariant.h>
-#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QFrame;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class GeometryGUI;
+#include "BooleanGUI.h"
+#include <BRepAlgoAPI_Common.hxx>
//=================================================================================
// class : GeometryGUI_CommonDlg
// purpose :
//=================================================================================
-class GeometryGUI_CommonDlg : public QDialog
+class GeometryGUI_CommonDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
- GeometryGUI_CommonDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ GeometryGUI_CommonDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_CommonDlg();
private:
+ void Init();
+ void enterEvent(QEvent * e);
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ BooleanGUI* myBooleanGUI;
- GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
- GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- TopoDS_Shape myShape1 ; /* topology used */
- TopoDS_Shape myShape2 ; /* topology used */
- GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
- GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
- bool myOkShape1 ;
- bool myOkShape2 ; /* to check when arguments are defined */
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+ TopoDS_Shape myShape1; /* topology used */
+ TopoDS_Shape myShape2; /* topology used */
+ GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
+ GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
+ bool myOkShape1;
+ bool myOkShape2; /* to check when arguments are defined */
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
-
- QGroupBox* GroupConstructor1;
- QLineEdit* LineEditC1A1Shape;
- QLineEdit* LineEditC1A2Shape;
- QPushButton* SelectButtonC1A1Shape;
- QPushButton* SelectButtonC1A2Shape;
- QLabel* TextLabelC1A2Shape;
- QLabel* TextLabelC1A1Shape;
-
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
+ GeometryGUI_2Sel_QTD* GroupCommon;
private slots:
-
- void ConstructorsClicked(int constructorId);
void ClickOnOk();
- void ClickOnCancel();
void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
+ void LineEditReturnPressed();
+ void ActivateThisDialog();
-protected:
- QGridLayout* GeometryGUI_CommonDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupConstructor1Layout;
};
#endif // DIALOGBOX_COMMON_H
using namespace std;
#include "GeometryGUI_ConeDlg.h"
+#include <BRepPrimAPI_MakeCone.hxx>
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <BRepAdaptor_Curve.hxx>
+
#include "GeometryGUI.h"
-#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
-#include "utilities.h"
-
-#include <BRepAdaptor_Curve.hxx>
-
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
//=================================================================================
// class : GeometryGUI_ConeDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_ConeDlg::GeometryGUI_ConeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+GeometryGUI_ConeDlg::GeometryGUI_ConeDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CONE_PV")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
- QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CONE_DXYZ")));
-
- if ( !name )
- setName( "GeometryGUI_ConeDlg" );
- resize( 303, 309 );
- setCaption( tr( "GEOM_CONE_TITLE" ) );
- setSizeGripEnabled( TRUE );
- GeometryGUI_ConeDlgLayout = new QGridLayout( this );
- GeometryGUI_ConeDlgLayout->setSpacing( 6 );
- GeometryGUI_ConeDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "GEOM_CONE" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
- Constructor2->setText( tr( "" ) );
- Constructor2->setMinimumSize( QSize( 50, 0 ) );
- Constructor2->setPixmap( image2 );
- Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
- QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
- GeometryGUI_ConeDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "GEOM_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GeometryGUI_ConeDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
- SelectButtonC1A2->setText( tr( "" ) );
- SelectButtonC1A2->setPixmap( image1 );
- GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
- LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
- LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
- TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
- TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
- TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
- TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
- TextLabelC1A3->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
- TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A3->setFrameShape( QLabel::NoFrame );
- TextLabelC1A3->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
-
- SpinBox_C1A3 = new GeometryGUI_SpinBox(GroupC1, "GeomSpinBox_C1A3" ) ;
- SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( SpinBox_C1A3 , 2, 2 );
-
- TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
- TextLabelC1A4->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
- TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A4->setFrameShape( QLabel::NoFrame );
- TextLabelC1A4->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
-
- SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ;
- SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( SpinBox_C1A4 , 3, 2 ) ;
-
- TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
- TextLabelC1A5->setText( tr( "GEOM_HEIGHT" ) );
- TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A5->setFrameShape( QLabel::NoFrame );
- TextLabelC1A5->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A5, 4, 0 );
-
- SpinBox_C1A5 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A5" ) ;
- SpinBox_C1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A5->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( SpinBox_C1A5 , 4, 2 ) ;
-
- GeometryGUI_ConeDlgLayout->addWidget( GroupC1, 1, 0 );
- /***************************************************************/
-
- GroupC2 = new QGroupBox( this, "GroupC2" );
- GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) );
- GroupC2->setColumnLayout(0, Qt::Vertical );
- GroupC2->layout()->setSpacing( 0 );
- GroupC2->layout()->setMargin( 0 );
- GroupC2Layout = new QGridLayout( GroupC2->layout() );
- GroupC2Layout->setAlignment( Qt::AlignTop );
- GroupC2Layout->setSpacing( 6 );
- GroupC2Layout->setMargin( 11 );
- TextLabel_Height = new QLabel(GroupC2 , "TextLabel_Height" );
- TextLabel_Height->setText( tr( "GEOM_HEIGHT" ) );
- GroupC2Layout->addWidget( TextLabel_Height, 2, 0 );
- TextLabel_Radius1 = new QLabel( GroupC2, "TextLabel_Radius1" );
- TextLabel_Radius1->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
- GroupC2Layout->addWidget( TextLabel_Radius1, 0, 0 );
- TextLabel_Radius2 = new QLabel( GroupC2, "TextLabel_Radius2" );
- TextLabel_Radius2->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
- GroupC2Layout->addWidget( TextLabel_Radius2, 1, 0 );
-
- SpinBox_Radius1 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius1" ) ;
- GroupC2Layout->addWidget( SpinBox_Radius1 , 0, 1 ) ;
-
- SpinBox_Radius2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius2" ) ;
- GroupC2Layout->addWidget( SpinBox_Radius2 , 1, 1 ) ;
-
- SpinBox_Height = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Height" ) ;
- GroupC2Layout->addWidget( SpinBox_Height , 2, 1 ) ;
-
- QSpacerItem* spacer1 = new QSpacerItem( 20, 60, QSizePolicy::Minimum, QSizePolicy::Fixed );
- GroupC2Layout->addItem( spacer1 );
-
- GeometryGUI_ConeDlgLayout->addWidget(GroupC2 , 1, 0 );
-
- /***************************************************************/
-
- /* Initialisations */
- Init(Sel) ;
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption(tr("GEOM_CONE_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_CONE"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->setPixmap(image1);
+ RadioButton3->close(TRUE);
+
+ GroupPoints = new GeometryGUI_2Sel3Spin(this, "GroupPoints");
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1"));
+ GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2"));
+ GroupPoints->TextLabel5->setText(tr("GEOM_HEIGHT"));
+ GroupPoints->PushButton1->setPixmap(image2);
+ GroupPoints->PushButton2->setPixmap(image2);
+
+ GroupDimensions = new GeometryGUI_3Spin(this, "GroupDimensions");
+ GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
+ GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1"));
+ GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2"));
+ GroupDimensions->TextLabel3->setText(tr("GEOM_HEIGHT"));
+
+ Layout1->addWidget(GroupPoints, 1, 0);
+ Layout1->addWidget(GroupDimensions, 1, 0);
+ /***************************************************************/
+
+ /* Initialisations */
+ myPrimitiveGUI = thePrimitiveGUI;
+ Init();
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_ConeDlg::Init( SALOME_Selection* Sel )
+void GeometryGUI_ConeDlg::Init()
{
+ /* init variables */
+ myConstructorId = 0;
+ myEditCurrentArgument = GroupPoints->LineEdit1;
- /* Get setting of step value from file configuration */
- double step ;
- QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
- step = St.toDouble() ;
-
- /* min, max, step and decimals for spin boxes */
- SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */
- SpinBox_C1A3->SetValue( 100.0 ) ;
- SpinBox_C1A4->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */
- SpinBox_C1A4->SetValue( 0.0 ) ;
- SpinBox_C1A5->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */
- SpinBox_C1A5->SetValue( 300.0 ) ;
-
- SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */
- SpinBox_Radius1->SetValue( 100.0 ) ;
- SpinBox_Radius2->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */
- SpinBox_Radius2->SetValue( 0.0 ) ;
- SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */
- SpinBox_Height->SetValue( 300.0 ) ;
-
- GroupC1->show();
- GroupC2->hide();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- myGeomGUI = GeometryGUI::GetGeometryGUI() ;
- myRadius1 = 100.0 ;
- myRadius2 = 0.0 ;
- myHeight = 300.0 ;
-
- myOkRadius1 = true ;
- myOkRadius2 = true ;
- myOkHeight = true ;
- myOkPoint1 = false ;
- myOkDir = false ;
+ myRadius1 = 100.0;
+ myRadius2 = 0.0;
+ myHeight = 300.0;
- mySimulationTopoDs.Nullify() ;
- myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
+ myOkRadius1 = myOkRadius2 = myOkHeight = true;
+ myOkPoint1 = myOkDir = false;
- // TODO : previous selection into argument ?
+ myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
+ myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
+ mySelection->AddFilter(myVertexFilter);
- /* Filter definitions */
- Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
- myGeom = GEOM::GEOM_Gen::_narrow(comp);
- myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
- myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
- /* first filter used */
- mySelection->AddFilter(myVertexFilter) ;
+ /* Get setting of step value from file configuration */
+ QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
+ step = St.toDouble();
+
+ /* min, max, step and decimals for spin boxes & initial values */
+ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
+ GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
+
+ GroupPoints->SpinBox_DX->SetValue(myRadius1);
+ GroupPoints->SpinBox_DY->SetValue(myRadius2);
+ GroupPoints->SpinBox_DZ->SetValue(myHeight);
+ GroupDimensions->SpinBox_DX->SetValue(myRadius1);
+ GroupDimensions->SpinBox_DY->SetValue(myRadius2);
+ GroupDimensions->SpinBox_DZ->SetValue(myHeight);
/* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
- connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_C1A5, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Radius1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Radius2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
-
- connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
- connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
-
- connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
+
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+
+ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- myGeomGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
+
+ /* displays Dialog */
+ GroupDimensions->hide();
+ GroupPoints->show();
+ this->show();
return ;
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_ConeDlg::ConstructorsClicked(int constructorId)
{
- mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
+ myConstructorId = constructorId;
+ mySelection->ClearFilters();
+ myGeomGUI->EraseSimulationShape();
+ disconnect(mySelection, 0, this, 0);
+ myOkHeight = myOkRadius1 = myOkRadius2 = true;
+ myRadius1 = 100.0;
+ myRadius2 = 0.0;
+ myHeight = 300.0;
switch(myConstructorId)
{
case 0 :
- {
- GroupC1->hide();
- GroupC2->show();
- myConstructorId = constructorId ;
- myOkHeight = myOkRadius1 = myOkRadius2 = myOkPoint1 = myOkDir = true ;
+ {
+ GroupDimensions->hide();
+ resize(0, 0);
+ GroupPoints->show();
+ myOkPoint1 = myOkDir = false;
+
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->LineEdit1->setText(tr(""));
+ GroupPoints->LineEdit2->setText(tr(""));
- SpinBox_Radius1->SetValue( 100.0 ) ; /* radius 1 */
- SpinBox_Radius2->SetValue( 0.0 ) ; /* radius 2 */
- SpinBox_Height->SetValue( 300.0 ) ; /* height */
+ GroupPoints->SpinBox_DX->SetValue(myRadius1);
+ GroupPoints->SpinBox_DY->SetValue(myRadius2);
+ GroupPoints->SpinBox_DZ->SetValue(myHeight);
- disconnect( mySelection, 0, this, 0 );
-
- myRadius1 = 100.0 ;
- myRadius2 = 0.0 ;
- myHeight = 300.0 ;
-
- myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
- myDir.SetCoord( 0.0, 0.0, 1.0 ) ;
-
- if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight ) {
- gp_Dir aDir = myDir ;
- /* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
- MakeConeSimulationAndDisplay() ;
- }
- break ;
+ /* filter for next selection */
+ mySelection->AddFilter(myVertexFilter);
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ break;
}
case 1 :
{
- GroupC2->hide();
- GroupC1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1 ;
- myOkHeight = myOkRadius1 = myOkRadius2 = true ;
- myOkPoint1 = myOkDir = false ;
-
- SpinBox_C1A3->SetValue( 100.0 ) ; /* radius 1 */
- SpinBox_C1A4->SetValue( 0.0 ) ; /* radius 2 */
- SpinBox_C1A5->SetValue( 300.0 ) ; /* height */
-
- myRadius1 = 100.0 ;
- myRadius2 = 0.0 ;
- myHeight = 300.0 ;
- disconnect( mySelection, 0, this, 0 );
- break ;
+ GroupPoints->hide();
+ resize( 0, 0 );
+ GroupDimensions->show();
+ myOkPoint1 = myOkDir = true;
+
+ GroupDimensions->SpinBox_DX->SetValue(myRadius1);
+ GroupDimensions->SpinBox_DY->SetValue(myRadius2);
+ GroupDimensions->SpinBox_DZ->SetValue(myHeight);
+
+ myPoint1.SetCoord(0.0, 0.0, 0.0);
+ myDir.SetCoord(0.0, 0.0, 1.0);
+
+ MakeConeSimulationAndDisplay();
+ break;
}
}
return ;
}
+
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
+ this->ClickOnApply();
+ ClickOnCancel();
+ return;
}
+
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ClickOnApply()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
+ myGeomGUI->GetDesktop()->putInfo(tr(""));
+ if (mySimulationTopoDs.IsNull())
+ return;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
- gp_Dir aDir = myDir ;
- /* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
- myGeomGUI->MakeConeAndDisplay( myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight) ) ;
- }
- break ;
- }
- case 1 :
- {
- if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
- gp_Dir aDir = myDir ;
- /* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
- myGeomGUI->MakeConeAndDisplay( myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight) ) ;
- }
- break ;
- }
- }
- // accept();
- return ;
-}
-
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void GeometryGUI_ConeDlg::ClickOnCancel()
-{
- mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->ResetState() ;
- reject() ;
+ if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
+ gp_Dir aDir = myDir;
+ /* allows user to reverse direction of construction with a negative height */
+ if(this->myHeight < -Precision::Confusion())
+ aDir.Reverse();
+ myPrimitiveGUI->MakeConeAndDisplay(myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight));
+ }
return ;
}
//=================================================================================
void GeometryGUI_ConeDlg::SelectionIntoArgument()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
-
- /* Future name of selection */
- QString aString = "";
-
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
- if ( nbSel != 1 ) {
- if ( myEditCurrentArgument == LineEditC1A1 ) {
- LineEditC1A1->setText("") ;
- myOkPoint1 = false ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2 ) {
- LineEditC1A2->setText("") ;
- myOkDir = false ;
- }
- return ;
+ myGeomGUI->EraseSimulationShape();
+ myEditCurrentArgument->setText("");
+ QString aString = ""; /* name of selection */
+
+ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1) {
+ if(myEditCurrentArgument == GroupPoints->LineEdit1)
+ myOkPoint1 = false;
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myOkDir = false;
+ return;
}
- /* nbSel == 1 ! */
+ /* nbSel == 1 */
TopoDS_Shape S;
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
- return ;
-
- /* gp_Pnt : not used */
- if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
- LineEditC1A1->setText(aString) ;
- myOkPoint1 = true ;
+ if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
+ return;
+
+ /* gp_Pnt : not used */
+ if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
+ GroupPoints->LineEdit1->setText(aString);
+ myOkPoint1 = true;
}
- else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) {
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
- LineEditC1A2->setText(aString) ;
- myOkDir = true ;
+ GroupPoints->LineEdit2->setText(aString);
+ myOkDir = true;
}
- if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
- MakeConeSimulationAndDisplay() ;
- }
- return ;
+ if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight)
+ MakeConeSimulationAndDisplay();
+ return;
}
+
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::SetEditCurrentArgument()
{
+ if(myConstructorId != 0)
+ return;
+
QPushButton* send = (QPushButton*)sender();
- mySelection->ClearFilters() ;
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- mySelection->AddFilter(myVertexFilter) ;
- }
- else if(send == SelectButtonC1A2) {
- LineEditC1A2->setFocus() ;
- myEditCurrentArgument = LineEditC1A2;
- mySelection->AddFilter(myEdgeFilter) ;
- }
- SelectionIntoArgument() ;
- break;
- }
- case 1:
- {
- break ;
- }
- }
- return ;
+ if(send == GroupPoints->PushButton1) {
+ GroupPoints->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ mySelection->AddFilter(myVertexFilter);
+ }
+ else if(send == GroupPoints->PushButton2) {
+ GroupPoints->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit2;
+ mySelection->AddFilter(myEdgeFilter);
+ }
+ this->SelectionIntoArgument();
+
+ return;
}
+
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::LineEditReturnPressed()
{
- QLineEdit* send = (QLineEdit*)sender();
- if( send == LineEditC1A1 )
- myEditCurrentArgument = LineEditC1A1 ;
- else if ( send == LineEditC1A2 )
- myEditCurrentArgument = LineEditC1A2 ;
+ QLineEdit* send = (QLineEdit*)sender();
+ if(send == GroupPoints->LineEdit1)
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ else if (send == GroupPoints->LineEdit2)
+ myEditCurrentArgument = GroupPoints->LineEdit2;
else
- return ;
-
- /* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
- /* so SelectionIntoArgument() is automatically called. */
- QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
- const QString objectUserName = LE->text() ;
- QWidget* thisWidget = (QWidget*)this ;
- if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
- LE->setText( objectUserName ) ;
- }
- return ;
-}
-
-//=================================================================================
-// function : ValueChangedInSpinBox()
-// purpose :
-//=================================================================================
-void GeometryGUI_ConeDlg::ValueChangedInSpinBox( double newValue )
-{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
+ return;
- QObject* send = (QObject*)sender();
-
- if( send == SpinBox_C1A3 || send == SpinBox_Radius1 ) { /* radius1 */
- myRadius1 = newValue ;
- myOkRadius1 = true ;
- } else if( send == SpinBox_C1A4 || send == SpinBox_Radius2 ) { /* radius2 */
- myRadius2 = newValue ;
- myOkRadius2 = true ;
- }
- else if( send == SpinBox_C1A5 || send == SpinBox_Height ) { /* algebric height */
- myHeight = newValue ;
- myOkHeight = true ;
- }
-
- if ( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight ) {
- MakeConeSimulationAndDisplay() ;
- }
-
- return ;
-}
-
-
-//=================================================================================
-// function : TextChangedInLineEdit()
-// purpose :
-//=================================================================================
-// void GeometryGUI_ConeDlg::TextChangedInLineEdit(const QString& newText)
-// {
-
-// myGeomGUI->EraseSimulationShape() ;
-// mySimulationTopoDs.Nullify() ;
-// QLineEdit* send = (QLineEdit*)sender();
-// QString newT = strdup(newText) ;
-// int i ;
-
-// if(send == LineEditC1A3) { /* radius1 */
-// if( myVa->validate(newT, i) == myVa->Acceptable ) {
-// myRadius1 = newText.toFloat() ;
-// myOkRadius1 = true ;
-// }
-// else {
-// myOkRadius1 = false ;
-// }
-// } else if(send == LineEditC1A4) { /* radius2 */
-// if( myVb->validate(newT, i) == myVb->Acceptable ) {
-// myRadius2 = newText.toFloat() ;
-// myOkRadius2 = true ;
-// }
-// else {
-// myOkRadius2 = false ;
-// }
-// } else if(send == LineEditC1A5) { /* algebric height */
-
-// if( myVc->validate(newT, i) == myVc->Acceptable ) {
-// myHeight = newText.toFloat() ;
-// if( fabs(myHeight) > Precision::Confusion() )
-// myOkHeight = true ;
-// else
-// myOkHeight = false ;
-// }
-// }else if(send == LineEdit_Radius1) { /* radius1 */
-// if( myVa->validate(newT, i) == myVa->Acceptable ) {
-// myRadius1 = newText.toFloat() ;
-// myOkRadius1 = true ;
-// }
-// else {
-// myOkRadius1 = false ;
-// }
-// } else if(send == LineEdit_Radius2) { /* radius2 */
-// if( myVb->validate(newT, i) == myVb->Acceptable ) {
-// myRadius2 = newText.toFloat() ;
-// myOkRadius2 = true ;
-// }
-// else {
-// myOkRadius2 = false ;
-// }
-// } else if(send == LineEdit_Height) { /* algebric height */
-
-// if( myVc->validate(newT, i) == myVc->Acceptable ) {
-// myHeight = newText.toFloat() ;
-// if( fabs(myHeight) > Precision::Confusion() )
-// myOkHeight = true ;
-// else
-// myOkHeight = false ;
-// }
-// }
-// if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
-// MakeConeSimulationAndDisplay() ;
-// }
-
-// return ;
-// }
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_ConeDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupC2->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
- mySelection->ClearFilters() ;
- }
- return ;
+ GeometryGUI_Skeleton::LineEditReturnPressed();
+ return;
}
//=================================================================================
void GeometryGUI_ConeDlg::ActivateThisDialog()
{
- /* Emit a signal to deactivate the active dialog */
- myGeomGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupC2->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
- return ;
+ GeometryGUI_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ if(!mySimulationTopoDs.IsNull())
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ return;
}
//=================================================================================
void GeometryGUI_ConeDlg::enterEvent(QEvent* e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
+ if (GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
}
//=================================================================================
-// function : closeEvent()
+// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
-void GeometryGUI_ConeDlg::closeEvent( QCloseEvent* e )
+void GeometryGUI_ConeDlg::ValueChangedInSpinBox(double newValue)
{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+ QObject* send = (QObject*)sender();
+
+ if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
+ myRadius1 = newValue;
+ myOkRadius1 = true;
+ }
+ else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
+ myRadius2 = newValue;
+ myOkRadius2 = true;
+ }
+ else if(send == GroupPoints->SpinBox_DZ || send == GroupDimensions->SpinBox_DZ) {
+ myHeight = newValue;
+ myOkHeight = true;
+ }
+
+ if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight)
+ MakeConeSimulationAndDisplay();
+ return;
}
//=================================================================================
void GeometryGUI_ConeDlg::MakeConeSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- gp_Dir aDir = myDir ;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+ gp_Dir aDir = myDir;
try {
/* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
-
- gp_Ax2 anAxis(this->myPoint1, aDir) ;
-
- if( fabs(myRadius1 - myRadius2) <= Precision::Confusion() ) {
- mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight) ).Shape() ;
- }
+ if(this->myHeight < -Precision::Confusion())
+ aDir.Reverse();
+
+ gp_Ax2 anAxis(this->myPoint1, aDir);
+
+ if(fabs(myRadius1 - myRadius2) <= Precision::Confusion())
+ mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight)).Shape();
else {
- if( fabs(myHeight) > Precision::Confusion() )
- mySimulationTopoDs = BRepPrimAPI_MakeCone( anAxis, myRadius1, myRadius2, fabs(myHeight) ).Shape() ;
+ if(fabs(myHeight) > Precision::Confusion())
+ mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape();
}
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
- MESSAGE( "Exception catched in MakeConeSimulationAndDisplay" ) ;
+ MESSAGE("Exception catched in MakeConeSimulationAndDisplay");
}
- return ;
+ return;
}
-
#ifndef DIALOGBOX_CONE_H
#define DIALOGBOX_CONE_H
-#include "SALOME_Selection.h"
-#include "GEOM_ShapeTypeFilter.hxx"
+#include "GeometryGUI_Skeleton.h"
+#include "GeometryGUI_2Sel3Spin.h"
+#include "GeometryGUI_3Spin.h"
+
+#include "PrimitiveGUI.h"
+
#include "GEOM_EdgeFilter.hxx"
-#include "GeometryGUI_SpinBox.h"
-
-#include <BRepPrimAPI_MakeCone.hxx>
-#include <BRepPrimAPI_MakeCylinder.hxx>
-#include <Precision.hxx>
-
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvalidator.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QSpinBox;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class GeometryGUI;
+
+#include <gp_Pnt.hxx>
+#include <gp_Dir.hxx>
//=================================================================================
// class : GeometryGUI_ConeDlg
// purpose :
//=================================================================================
-class GeometryGUI_ConeDlg : public QDialog
+class GeometryGUI_ConeDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
- GeometryGUI_ConeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ GeometryGUI_ConeDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_ConeDlg();
private:
+ void Init();
+ void enterEvent(QEvent* e);
+ void MakeConeSimulationAndDisplay();
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
- void MakeConeSimulationAndDisplay() ;
-
- GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
- GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- TopoDS_Shape mySimulationTopoDs ;
-
- gp_Pnt myPoint1 ; /* Topology used */
- gp_Dir myDir ;
- bool myOkPoint1 ;
- bool myOkDir ; /* to check when argument is defined */
-
- Standard_Real myRadius1 ;
- Standard_Real myRadius2 ;
- Standard_Real myHeight ;
- bool myOkRadius1 ;
- bool myOkRadius2 ;
- bool myOkHeight ;
- QDoubleValidator *myVa ; /* Double validator for numeric input myRadius1 */
- QDoubleValidator *myVb ; /* Double validator for numeric input myRadius2 */
- QDoubleValidator *myVc ; /* Double validator for numeric input myHeight */
-
- int myConstructorId ; /* Current constructor id = radio button id */
- QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */
- Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
- Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */
-
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QRadioButton* Constructor2;
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QGroupBox* GroupC1;
- QGroupBox* GroupC2;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A2;
- QLineEdit* LineEditC1A2;
- QLabel* TextLabelC1A2;
- QLabel* TextLabelC1A3;
- GeometryGUI_SpinBox* SpinBox_C1A3 ;
- QLabel* TextLabelC1A4;
- GeometryGUI_SpinBox* SpinBox_C1A4 ;
- QLabel* TextLabelC1A5;
- GeometryGUI_SpinBox* SpinBox_C1A5 ;
-
- QLabel* TextLabel_Radius1 ;
- QLabel* TextLabel_Radius2 ;
- QLabel* TextLabel_Height ;
- GeometryGUI_SpinBox* SpinBox_Radius1 ;
- GeometryGUI_SpinBox* SpinBox_Radius2 ;
- GeometryGUI_SpinBox* SpinBox_Height ;
+ PrimitiveGUI* myPrimitiveGUI;
-private slots:
+ double step;
+ int myConstructorId;
+ Handle(GEOM_ShapeTypeFilter) myVertexFilter;
+ Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
- void ConstructorsClicked(int constructorId);
+ gp_Pnt myPoint1; /* topology used */
+ gp_Dir myDir;
+ bool myOkPoint1; /* to check when arguments is defined */
+ bool myOkDir;
+
+ Standard_Real myRadius1;
+ Standard_Real myRadius2;
+ Standard_Real myHeight;
+ bool myOkRadius1;
+ bool myOkRadius2;
+ bool myOkHeight;
+
+ GeometryGUI_2Sel3Spin* GroupPoints;
+ GeometryGUI_3Spin* GroupDimensions;
+
+private slots:
void ClickOnOk();
- void ClickOnCancel();
void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
- void ValueChangedInSpinBox( double newValue ) ;
-
-protected:
- QGridLayout* GeometryGUI_ConeDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupC1Layout;
- QGridLayout* GroupC2Layout;
+ void ActivateThisDialog();
+ void LineEditReturnPressed();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ConstructorsClicked(int constructorId);
+ void ValueChangedInSpinBox(double newValue);
+
};
#endif // DIALOGBOX_CONE_H
#include "GeometryGUI_CutDlg.h"
#include "GeometryGUI.h"
-#include "QAD_Application.h"
#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include <qbuttongroup.h>
-#include <qframe.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qevent.h>
-
//=================================================================================
// class : GeometryGUI_CutDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_CutDlg::GeometryGUI_CutDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+GeometryGUI_CutDlg::GeometryGUI_CutDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CUT")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "GeometryGUI_CutDlg" );
- resize( 322, 220 );
- setCaption( tr( "GEOM_CUT_TITLE" ) );
- setSizeGripEnabled( TRUE );
-
- GeometryGUI_CutDlgLayout = new QGridLayout( this );
- GeometryGUI_CutDlgLayout->setSpacing( 6 );
- GeometryGUI_CutDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "GEOM_CUT" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- GeometryGUI_CutDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
- GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupConstructor1->setColumnLayout(0, Qt::Vertical );
- GroupConstructor1->layout()->setSpacing( 0 );
- GroupConstructor1->layout()->setMargin( 0 );
- GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
- GroupConstructor1Layout->setAlignment( Qt::AlignTop );
- GroupConstructor1Layout->setSpacing( 6 );
- GroupConstructor1Layout->setMargin( 11 );
- LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
- LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
- LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
- LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
- SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
- SelectButtonC1A1Shape->setText( tr( "" ) );
- SelectButtonC1A1Shape->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
- SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
- SelectButtonC1A2Shape->setText( tr( "" ) );
- SelectButtonC1A2Shape->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
- TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
- TextLabelC1A2Shape->setText( tr( "GEOM_TOOL_OBJECT" ) );
- TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
- TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
- TextLabelC1A1Shape->setText( tr( "GEOM_MAIN_OBJECT" ) );
- TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
- GeometryGUI_CutDlgLayout->addWidget( GroupConstructor1, 1, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_1, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "GEOM_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GeometryGUI_CutDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /* Initialisation */
- Init( Sel ) ;
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CUT")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption(tr("GEOM_CUT_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_CUT"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->close(TRUE);
+ RadioButton3->close(TRUE);
+
+ GroupCut = new GeometryGUI_2Sel_QTD(this, "GroupCut");
+ GroupCut->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupCut->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
+ GroupCut->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
+ GroupCut->PushButton1->setPixmap(image1);
+ GroupCut->PushButton2->setPixmap(image1);
+
+ Layout1->addWidget(GroupCut, 1, 0);
+ /***************************************************************/
+
+ /* Initialisation */
+ myBooleanGUI = theBooleanGUI;
+ Init();
}
GeometryGUI_CutDlg::~GeometryGUI_CutDlg()
{
/* no need to delete child widgets, Qt does it all for us */
- this->destroy(TRUE, TRUE) ;
}
-
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_CutDlg::Init( SALOME_Selection* Sel )
+void GeometryGUI_CutDlg::Init()
{
- mySelection = Sel ;
- myShape1.Nullify() ;
- myShape2.Nullify() ;
- myConstructorId = 0 ;
-
- myGeomGUI = GeometryGUI::GetGeometryGUI() ;
-
- GroupConstructor1->show();
- myConstructorId = 0 ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- Constructor1->setChecked( TRUE );
- myOkShape1 = myOkShape2 = false ;
-
- myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
- myGeom = GEOM::GEOM_Gen::_narrow(comp);
-
- // TODO previous selection into argument ?
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
- connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
- connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
-
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- /* to close dialog if study change */
- connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- myGeomGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* Displays Dialog */
+ /* init variables */
+ myEditCurrentArgument = GroupCut->LineEdit1;
- return ;
-}
+ myShape1.Nullify();
+ myShape2.Nullify();
+ myOkShape1 = myOkShape2 = false;
+ /* signals and slots connections */
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupCut->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupCut->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void GeometryGUI_CutDlg::ConstructorsClicked(int constructorId)
-{
- GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ;
-
- switch (constructorId)
- {
- case 0:
- {
- GroupConstructor1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- LineEditC1A2Shape->setText(tr("")) ;
- Constructor1->setChecked( TRUE );
- myOkShape1 = myOkShape2 = false ;
- break;
- }
- }
- return ;
+ connect(GroupCut->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupCut->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ /* displays Dialog */
+ GroupCut->show();
+ this->show();
+
+ return;
}
+
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
+ this->ClickOnApply();
+ ClickOnCancel();
return ;
}
+
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::ClickOnApply()
{
- myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkShape1 && myOkShape2) {
- myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2 ) ;
- }
- break ;
- }
- }
-
- // accept();
- return ;
-}
+ myGeomGUI->GetDesktop()->putInfo(tr(""));
+ if(myOkShape1 && myOkShape2)
+ myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2);
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void GeometryGUI_CutDlg::ClickOnCancel()
-{
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->ResetState() ;
- reject() ;
- return ;
+ return;
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_CutDlg::SelectionIntoArgument()
{
- myEditCurrentArgument->setText("") ;
- QString aString = ""; /* name of selection */
-
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
- if ( nbSel != 1 ) {
- switch (myConstructorId)
- {
- case 0:
- {
- if ( myEditCurrentArgument == LineEditC1A1Shape ) {
- myOkShape1 = false ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
- myOkShape2 = false ;
- }
- break ;
- }
- }
- return ;
+ myEditCurrentArgument->setText("");
+ QString aString = "";
+
+ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1) {
+ if(myEditCurrentArgument == GroupCut->LineEdit1)
+ myOkShape1 = false;
+ else if( myEditCurrentArgument == GroupCut->LineEdit2)
+ myOkShape2 = false;
+ return;
}
- /* nbSel == 1 */
+ /* nbSel == 1 */
TopoDS_Shape S;
- Standard_Boolean testResult ;
- Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
-
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
- return ;
-
- if ( myEditCurrentArgument == LineEditC1A1Shape ) {
- myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult )
- return ;
- myShape1 = S ;
- LineEditC1A1Shape->setText(aString) ;
- myOkShape1 = true ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
- myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult )
- return ;
- myShape2 = S ;
- LineEditC1A2Shape->setText(aString) ;
- myOkShape2 = true ;
+ Standard_Boolean testResult;
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+ if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
+ return;
+
+ if(myEditCurrentArgument == GroupCut->LineEdit1) {
+ myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
+ if(!testResult)
+ return;
+ myShape1 = S;
+ GroupCut->LineEdit1->setText(aString);
+ myOkShape1 = true;
}
-
- return ;
+ else if(myEditCurrentArgument == GroupCut->LineEdit2) {
+ myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
+ if(!testResult)
+ return;
+ myShape2 = S;
+ GroupCut->LineEdit2->setText(aString);
+ myOkShape2 = true;
+ }
+ return;
}
void GeometryGUI_CutDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
-
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if( send == SelectButtonC1A1Shape ) {
- LineEditC1A1Shape->setFocus() ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- }
- else if(send == SelectButtonC1A2Shape) {
- LineEditC1A2Shape->setFocus() ;
- myEditCurrentArgument = LineEditC1A2Shape;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
+ if(send == GroupCut->PushButton1) {
+ GroupCut->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupCut->LineEdit1;
+ }
+ else if(send == GroupCut->PushButton2) {
+ GroupCut->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupCut->LineEdit2;
+ }
+ SelectionIntoArgument();
+
+ return;
+}
//=================================================================================
//=================================================================================
void GeometryGUI_CutDlg::LineEditReturnPressed()
{
- QLineEdit* send = (QLineEdit*)sender();
- if( send == LineEditC1A1Shape )
- myEditCurrentArgument = LineEditC1A1Shape ;
- else if ( send == LineEditC1A2Shape )
- myEditCurrentArgument = LineEditC1A2Shape ;
+ QLineEdit* send = (QLineEdit*)sender();
+ if(send == GroupCut->LineEdit1)
+ myEditCurrentArgument = GroupCut->LineEdit1;
+ else if(send == GroupCut->LineEdit2)
+ myEditCurrentArgument = GroupCut->LineEdit2;
else
- return ;
-
- /* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
- /* so SelectionIntoArgument() is automatically called. */
- const QString objectUserName = myEditCurrentArgument->text() ;
- QWidget* thisWidget = (QWidget*)this ;
- if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
- myEditCurrentArgument->setText( objectUserName ) ;
- }
- return ;
-}
-
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_CutDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
+ return;
- GroupConstructors->setEnabled(false) ;
- GroupConstructor1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- }
- return ;
+ GeometryGUI_Skeleton::LineEditReturnPressed();
+ return;
}
-
//=================================================================================
-// function : closeEvent()
+// function : ActivateThisDialog()
// purpose :
//=================================================================================
-void GeometryGUI_CutDlg::closeEvent( QCloseEvent* e )
+void GeometryGUI_CutDlg::ActivateThisDialog()
{
- this->ClickOnCancel() ; /* same than click on cancel button */
+ GeometryGUI_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ return;
}
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
-void GeometryGUI_CutDlg::enterEvent( QEvent * )
+void GeometryGUI_CutDlg::enterEvent(QEvent * e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
-}
-
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_CutDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate any active dialog */
- myGeomGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupConstructor1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- return ;
+ if(GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
}
#ifndef DIALOGBOX_CUT_H
#define DIALOGBOX_CUT_H
-#include "SALOME_Selection.h"
-#include "GEOM_ShapeTypeFilter.hxx"
+#include "GeometryGUI_Skeleton.h"
+#include "GeometryGUI_2Sel_QTD.h"
-#include <BRepAlgoAPI_Cut.hxx>
-
-#include <qvariant.h>
-#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QFrame;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class GeometryGUI;
+#include "BooleanGUI.h"
+#include <BRepAlgoAPI_Cut.hxx>
//=================================================================================
// class : GeometryGUI_CutDlg
// purpose :
//=================================================================================
-class GeometryGUI_CutDlg : public QDialog
+class GeometryGUI_CutDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
- GeometryGUI_CutDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ GeometryGUI_CutDlg( QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_CutDlg();
private:
+ void Init();
+ void enterEvent(QEvent* e);
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ BooleanGUI* myBooleanGUI;
- GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
- GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- TopoDS_Shape myShape1 ; /* topology used to fuse */
- TopoDS_Shape myShape2 ; /* topology used to fuse */
- GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
- GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
- bool myOkShape1 ;
- bool myOkShape2 ; /* to check when arguments are defined */
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+ TopoDS_Shape myShape1; /* topology used to fuse */
+ TopoDS_Shape myShape2; /* topology used to fuse */
+ GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
+ GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
+ bool myOkShape1; /* to check when arguments are defined */
+ bool myOkShape2;
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
-
- QGroupBox* GroupConstructor1;
- QLineEdit* LineEditC1A1Shape;
- QLineEdit* LineEditC1A2Shape;
- QPushButton* SelectButtonC1A1Shape;
- QPushButton* SelectButtonC1A2Shape;
- QLabel* TextLabelC1A2Shape;
- QLabel* TextLabelC1A1Shape;
-
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
+ GeometryGUI_2Sel_QTD* GroupCut;
private slots:
-
- void ConstructorsClicked(int constructorId);
void ClickOnOk();
- void ClickOnCancel();
void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
+ void LineEditReturnPressed();
+ void ActivateThisDialog();
-protected:
- QGridLayout* GeometryGUI_CutDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupConstructor1Layout;
};
#endif // DIALOGBOX_CUT_H
using namespace std;
#include "GeometryGUI_CylinderDlg.h"
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <BRepAdaptor_Curve.hxx>
+
#include "GeometryGUI.h"
-#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
-#include "utilities.h"
-
-#include <BRepAdaptor_Curve.hxx>
-
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_CylinderDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CYLINDER_PV")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
- QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CYLINDER_DXYZ")));
-
- if ( !name )
- setName( "GeometryGUI_CylinderDlg" );
- resize( 303, 281 );
- setCaption( tr( "GEOM_CYLINDER_TITLE" ) );
- setSizeGripEnabled( TRUE );
- GeometryGUI_CylinderDlgLayout = new QGridLayout( this );
- GeometryGUI_CylinderDlgLayout->setSpacing( 6 );
- GeometryGUI_CylinderDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "GEOM_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GeometryGUI_CylinderDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "GEOM_CYLINDER" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
- Constructor2->setText( tr( "" ) );
- Constructor2->setMinimumSize( QSize( 50, 0 ) );
- Constructor2->setPixmap( image2 );
- Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
- QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer_3, 0, 3 );
- GeometryGUI_CylinderDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
- SelectButtonC1A2->setText( tr( "" ) );
- SelectButtonC1A2->setMinimumSize( QSize( 0, 0 ) );
- SelectButtonC1A2->setPixmap( image1 );
- GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
- LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
- LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
- TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
- TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
- TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
- TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
- TextLabelC1A3->setText( tr( "GEOM_RADIUS" ) );
- TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A3->setFrameShape( QLabel::NoFrame );
- TextLabelC1A3->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
-
- SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
- GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ) ;
-
- TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
- TextLabelC1A4->setText( tr( "GEOM_HEIGHT" ) );
- TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A4->setFrameShape( QLabel::NoFrame );
- TextLabelC1A4->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
-
- SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ;
- GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 );
-
- GeometryGUI_CylinderDlgLayout->addWidget( GroupC1, 1, 0 );
-
- /***************************************************************/
- GroupC2 = new QGroupBox( this, "GroupC2" );
- GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) );
- GroupC2->setColumnLayout(0, Qt::Vertical );
- GroupC2->layout()->setSpacing( 0 );
- GroupC2->layout()->setMargin( 0 );
- GroupC2Layout = new QGridLayout( GroupC2->layout() );
- GroupC2Layout->setAlignment( Qt::AlignTop );
- GroupC2Layout->setSpacing( 6 );
- GroupC2Layout->setMargin( 11 );
- TextLabel_Height = new QLabel(GroupC2 , "TextLabel_Height" );
- TextLabel_Height->setText( tr( "GEOM_HEIGHT" ) );
- GroupC2Layout->addWidget( TextLabel_Height, 1, 0 );
- TextLabel_Radius = new QLabel( GroupC2, "TextLabel_Radius" );
- TextLabel_Radius->setText( tr( "GEOM_RADIUS" ) );
- GroupC2Layout->addWidget( TextLabel_Radius, 0, 0 );
-
- SpinBox_Height = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Height" ) ;
- SpinBox_Height->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Height->sizePolicy().hasHeightForWidth() ) );
- GroupC2Layout->addWidget( SpinBox_Height, 1, 1 ) ;
-
- SpinBox_Radius = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius" ) ;
- SpinBox_Radius->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Radius->sizePolicy().hasHeightForWidth() ) );
- GroupC2Layout->addWidget( SpinBox_Radius, 0, 1 ) ;
-
- QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed );
- GroupC2Layout->addItem( spacer1 );
-
- GeometryGUI_CylinderDlgLayout->addWidget(GroupC2 , 1, 0 );
- /***************************************************************/
-
- Init(Sel) ; /* Initialisations */
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption(tr("GEOM_CYLINDER_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_CYLINDER"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->setPixmap(image1);
+ RadioButton3->close(TRUE);
+
+ GroupPoints = new GeometryGUI_2Sel2Spin(this, "GroupPoints");
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS"));
+ GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT"));
+ GroupPoints->PushButton1->setPixmap(image2);
+ GroupPoints->PushButton2->setPixmap(image2);
+
+ GroupDimensions = new GeometryGUI_2Spin(this, "GroupDimensions");
+ GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
+ GroupDimensions->TextLabel1->setText(tr("GEOM_HEIGHT"));
+ GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS"));
+
+ Layout1->addWidget(GroupPoints, 1, 0);
+ Layout1->addWidget(GroupDimensions, 1, 0);
+ /***************************************************************/
+
+ /* Initialisations */
+ myPrimitiveGUI = thePrimitiveGUI;
+ Init();
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_CylinderDlg::Init( SALOME_Selection* Sel )
+void GeometryGUI_CylinderDlg::Init()
{
+ /* init variables */
+ myConstructorId = 0;
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+
+ myRadius = 100.0;
+ myHeight = 300.0;
+ myOkRadius = myOkHeight = true;
+ myOkPoint1 = myOkDir = false;
+
+ myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
+ myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
+ mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */
- double step ;
- QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
- step = St.toDouble() ;
+ QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
+ step = St.toDouble();
/* min, max, step and decimals for spin boxes & initial values */
/* First constructor : radius */
- SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
+ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
/* First constructor : algebric height */
- SpinBox_C1A4->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
+ GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
/* Second constructor : radius */
- SpinBox_Radius->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
+ GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
/* Second constructor : algebric height */
- SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
-
- GroupC1->show();
- GroupC2->hide();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- myGeomGUI = GeometryGUI::GetGeometryGUI() ;
-
- SpinBox_C1A3->SetValue( 100.0 ) ;
- SpinBox_C1A4->SetValue( 300.0 ) ;
- SpinBox_Radius->SetValue( 100.0 ) ;
- SpinBox_Height->SetValue( 300.0 ) ;
- myRadius = 100.0 ;
- myHeight = 300.0 ;
-
- myOkRadius = true ;
- myOkHeight = true ;
- myOkPoint1 = false ;
- myOkDir = false ;
-
- mySimulationTopoDs.Nullify() ;
- myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- // TODO : previous selection into argument ?
-
- /* Filter definitions */
- Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
- myGeom = GEOM::GEOM_Gen::_narrow(comp);
- myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
- myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
-
- /* first filter used */
- mySelection->AddFilter(myVertexFilter) ;
+ GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
+
+ GroupPoints->SpinBox_DX->SetValue(myRadius);
+ GroupPoints->SpinBox_DY->SetValue(myHeight);
+ GroupDimensions->SpinBox_DX->SetValue(myRadius);
+ GroupDimensions->SpinBox_DY->SetValue(myHeight);
/* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
- connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Radius, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
-
- connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
- connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
-
- connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- myGeomGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
+
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+
+ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
+
+ /* displays Dialog */
+ GroupDimensions->hide();
+ GroupPoints->show();
+ this->show();
return ;
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CylinderDlg::ConstructorsClicked(int constructorId)
{
- mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
+ myConstructorId = constructorId;
+ mySelection->ClearFilters();
+ myGeomGUI->EraseSimulationShape();
+ disconnect(mySelection, 0, this, 0);
+ myOkHeight = myOkRadius = true;
+ myRadius = 100.0;
+ myHeight = 300.0;
switch(myConstructorId)
{
case 0 :
- {
- GroupC1->hide();
- GroupC2->show();
- myConstructorId = constructorId ;
- myOkHeight = myOkRadius = myOkPoint1 = myOkDir = true ;
+ {
+ GroupDimensions->hide();
+ resize(0, 0);
+ GroupPoints->show();
+ myOkPoint1 = myOkDir = false;
+
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->LineEdit1->setText(tr(""));
+ GroupPoints->LineEdit2->setText(tr(""));
- SpinBox_Radius->SetValue( 100.0 ) ;
- SpinBox_Height->SetValue( 300.0 ) ;
- myRadius = 100.0 ;
- myHeight = 300.0 ;
-
- disconnect( mySelection, 0, this, 0 );
-
- myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
- myDir.SetCoord( 0.0, 0.0, 1.0 ) ;
-
- if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- gp_Dir aDir = myDir ;
- /* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
- MakeCylinderSimulationAndDisplay() ;
- }
- break ;
+ GroupPoints->SpinBox_DX->SetValue(myRadius);
+ GroupPoints->SpinBox_DY->SetValue(myHeight);
+
+ /* filter for next selection */
+ mySelection->AddFilter(myVertexFilter);
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ break;
}
case 1 :
{
- GroupC2->hide();
- GroupC1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1 ;
- myOkHeight = myOkRadius = true ;
- myOkPoint1 = myOkDir = false ;
- LineEditC1A1->setText( tr("") );
-
- SpinBox_C1A3->SetValue( 100.0 ) ;
- SpinBox_C1A4->SetValue( 300.0 ) ;
- myRadius = 100.0 ;
- myHeight = 300.0 ;
- disconnect( mySelection, 0, this, 0 );
- break ;
+ GroupPoints->hide();
+ resize( 0, 0 );
+ GroupDimensions->show();
+ myOkPoint1 = myOkDir = true;
+
+ GroupDimensions->SpinBox_DX->SetValue(myRadius);
+ GroupDimensions->SpinBox_DY->SetValue(myHeight);
+ myPoint1.SetCoord(0.0, 0.0, 0.0);
+ myDir.SetCoord(0.0, 0.0, 1.0);
+
+ MakeCylinderSimulationAndDisplay();
+ break;
}
}
return ;
}
+
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
+ this->ClickOnApply();
+ ClickOnCancel();
+ return;
}
+
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::ClickOnApply()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
- switch(myConstructorId)
- {
- case 0 :
- {
- if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- gp_Dir aDir = myDir ;
- /* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
- myGeomGUI->MakeCylinderAndDisplay( myPoint1, aDir, myRadius, fabs(myHeight) ) ;
- }
- break ;
- }
- case 1 :
- {
- if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- gp_Dir aDir = myDir ;
- /* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
- myGeomGUI->MakeCylinderAndDisplay( myPoint1, aDir, myRadius, fabs(myHeight) ) ;
- }
- break ;
- }
- }
- // accept();
- return ;
-}
-
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void GeometryGUI_CylinderDlg::ClickOnCancel()
-{
- mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->ResetState() ;
- reject() ;
- return ;
+ myGeomGUI->GetDesktop()->putInfo(tr(""));
+ if (mySimulationTopoDs.IsNull())
+ return;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+
+ if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) {
+ gp_Dir aDir = myDir;
+ /* allows user to reverse direction of construction with a negative height */
+ if(this->myHeight < -Precision::Confusion())
+ aDir.Reverse();
+ myPrimitiveGUI->MakeCylinderAndDisplay(myPoint1, aDir, myRadius, fabs(myHeight));
+ }
+ return;
}
//=================================================================================
void GeometryGUI_CylinderDlg::SelectionIntoArgument()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
-
- QString aString = ""; /* name of future selection */
-
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
- if ( nbSel != 1 ) {
- if ( myEditCurrentArgument == LineEditC1A1 ) {
- LineEditC1A1->setText("") ;
- myOkPoint1 = false ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2 ) {
- LineEditC1A2->setText("") ;
- myOkDir = false ;
- }
- return ;
+ myGeomGUI->EraseSimulationShape();
+ myEditCurrentArgument->setText("");
+ QString aString = ""; /* name of selection */
+
+ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1) {
+ if(myEditCurrentArgument == GroupPoints->LineEdit1)
+ myOkPoint1 = false;
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myOkDir = false;
+ return;
}
/* nbSel == 1 */
- TopoDS_Shape S;
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
- return ;
+ TopoDS_Shape S;
+ if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
+ return;
/* gp_Pnt : not used */
- if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
- LineEditC1A1->setText(aString) ;
- myOkPoint1 = true ;
+ if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
+ GroupPoints->LineEdit1->setText(aString);
+ myOkPoint1 = true;
}
- else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) {
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
-
- LineEditC1A2->setText(aString) ;
- myOkDir = true ;
+ GroupPoints->LineEdit2->setText(aString);
+ myOkDir = true;
}
- if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- MakeCylinderSimulationAndDisplay() ;
- }
- return ;
+ if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight)
+ MakeCylinderSimulationAndDisplay();
+ return;
}
+
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::SetEditCurrentArgument()
{
+ if(myConstructorId != 0)
+ return;
+
QPushButton* send = (QPushButton*)sender();
- mySelection->ClearFilters() ;
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- mySelection->AddFilter(myVertexFilter) ;
- }
- else if(send == SelectButtonC1A2) {
- LineEditC1A2->setFocus() ;
- myEditCurrentArgument = LineEditC1A2;
- mySelection->AddFilter(myEdgeFilter) ;
- }
- SelectionIntoArgument() ;
- break;
- }
- case 1:
- {
- break ;
- }
- }
- return ;
+ if(send == GroupPoints->PushButton1) {
+ GroupPoints->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ mySelection->AddFilter(myVertexFilter);
+ }
+ else if(send == GroupPoints->PushButton2) {
+ GroupPoints->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit2;
+ mySelection->AddFilter(myEdgeFilter);
+ }
+ this->SelectionIntoArgument();
+
+ return;
}
+
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::LineEditReturnPressed()
{
- QLineEdit* send = (QLineEdit*)sender();
- if( send == LineEditC1A1 )
- myEditCurrentArgument = LineEditC1A1 ;
- else if ( send == LineEditC1A2 )
- myEditCurrentArgument = LineEditC1A2 ;
+ QLineEdit* send = (QLineEdit*)sender();
+ if(send == GroupPoints->LineEdit1)
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ else if (send == GroupPoints->LineEdit2)
+ myEditCurrentArgument = GroupPoints->LineEdit2;
else
- return ;
-
- /* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
- /* so SelectionIntoArgument() is automatically called. */
- QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
- const QString objectUserName = LE->text() ;
- QWidget* thisWidget = (QWidget*)this ;
- if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
- LE->setText( objectUserName ) ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : ValueChangedInSpinBox
-// purpose :
-//=================================================================================
-void GeometryGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
-{
-
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- QObject* send = (QObject*)sender();
-
- if(send == SpinBox_C1A3 ) { /* radius */
-
- myRadius = newValue ;
- myOkRadius = true ;
- if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- MakeCylinderSimulationAndDisplay() ;
- }
- } else if (send == SpinBox_C1A4 ) { /* algebric height */
-
- myHeight = newValue ;
- myOkHeight = true ;
- if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- MakeCylinderSimulationAndDisplay() ;
- }
- }
- else if (send == SpinBox_Height) { /* algebric height */
+ return;
- myOkHeight = true ;
- myHeight = newValue ;
- if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- MakeCylinderSimulationAndDisplay() ;
- }
- }
- else if (send == SpinBox_Radius) { /* radius */
- myRadius = newValue ;
- myOkRadius = true ;
- if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
- MakeCylinderSimulationAndDisplay() ;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_CylinderDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupC2->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
- mySelection->ClearFilters() ;
- }
- return ;
+ GeometryGUI_Skeleton::LineEditReturnPressed();
+ return;
}
//=================================================================================
void GeometryGUI_CylinderDlg::ActivateThisDialog()
{
- /* Emit a signal to deactivate the active dialog */
- myGeomGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupC2->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
- return ;
+ GeometryGUI_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ if(!mySimulationTopoDs.IsNull())
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ return;
}
//=================================================================================
void GeometryGUI_CylinderDlg::enterEvent(QEvent* e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
+ if (GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
}
//=================================================================================
-// function : closeEvent()
+// function : ValueChangedInSpinBox
// purpose :
//=================================================================================
-void GeometryGUI_CylinderDlg::closeEvent( QCloseEvent* e )
-{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
+void GeometryGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
+{
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+ QObject* send = (QObject*)sender();
+
+ /* radius */
+ if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
+ myRadius = newValue;
+ myOkRadius = true;
+ } /* algebric height */
+ else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
+ myHeight = newValue;
+ myOkHeight = true;
+ }
+
+ if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight)
+ MakeCylinderSimulationAndDisplay();
+ return;
}
//=================================================================================
void GeometryGUI_CylinderDlg::MakeCylinderSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- gp_Dir aDir = this->myDir ;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+ gp_Dir aDir = this->myDir;
try {
/* allows user to reverse direction of construction with a negative height */
- if( this->myHeight < -Precision::Confusion() ) {
- aDir.Reverse() ;
- }
- gp_Ax2 anAxis(this->myPoint1, aDir) ;
+ if(this->myHeight < -Precision::Confusion())
+ aDir.Reverse();
- mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, this->myRadius, fabs(myHeight) ).Shape() ;
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ gp_Ax2 anAxis(this->myPoint1, aDir);
+
+ mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape();
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
- MESSAGE( "Exception catched in MakeCylinderSimulationAndDisplay" ) ;
+ MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay");
}
- return ;
+ return;
}
-
#ifndef DIALOGBOX_CYLINDER_H
#define DIALOGBOX_CYLINDER_H
-#include "SALOME_Selection.h"
+#include "GeometryGUI_Skeleton.h"
+#include "GeometryGUI_2Sel2Spin.h"
+#include "GeometryGUI_2Spin.h"
-#include "GEOM_ShapeTypeFilter.hxx"
-#include "GEOM_EdgeFilter.hxx"
-#include "GeometryGUI_SpinBox.h"
-
-#include <BRepPrimAPI_MakeCylinder.hxx>
-#include <Precision.hxx>
-
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvalidator.h>
+#include "PrimitiveGUI.h"
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QSpinBox;
-class QRadioButton;
-class GeometryGUI;
+#include "GEOM_EdgeFilter.hxx"
+#include <gp_Pnt.hxx>
+#include <gp_Dir.hxx>
//=================================================================================
// class : GeometryGUI_CylinderDlg
// purpose :
//=================================================================================
-class GeometryGUI_CylinderDlg : public QDialog
+class GeometryGUI_CylinderDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
- GeometryGUI_CylinderDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ GeometryGUI_CylinderDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_CylinderDlg();
private:
+ void Init();
+ void enterEvent(QEvent* e);
+ void MakeCylinderSimulationAndDisplay();
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
- void MakeCylinderSimulationAndDisplay() ;
-
- GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
- GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
- TopoDS_Shape mySimulationTopoDs ;
- SALOME_Selection* mySelection ; /* User shape selection */
-
- gp_Pnt myPoint1 ; /* topology used */
- gp_Dir myDir ;
-
- Standard_Real myRadius ;
- Standard_Real myHeight ;
- bool myOkRadius ;
- bool myOkHeight ;
- QDoubleValidator *myVa ; /* Double validator for numeric input */
- QDoubleValidator *myVb ; /* Double validator for numeric input */
-
- bool myOkPoint1 ;
- bool myOkDir ; /* to check when arguments is defined */
- int myConstructorId ; /* Current constructor id = radio button id */
- QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */
- Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
- Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */
-
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QRadioButton* Constructor2;
- QGroupBox* GroupC1;
- QGroupBox* GroupC2;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A2;
- QLineEdit* LineEditC1A2;
- QLabel* TextLabelC1A2;
-
- QLabel* TextLabelC1A3;
- GeometryGUI_SpinBox* SpinBox_C1A3 ;
- QLabel* TextLabelC1A4 ;
- GeometryGUI_SpinBox* SpinBox_C1A4 ;
-
- QLabel* TextLabel_Radius ;
- GeometryGUI_SpinBox* SpinBox_Radius ;
- QLabel* TextLabel_Height ;
- GeometryGUI_SpinBox* SpinBox_Height ;
+ PrimitiveGUI* myPrimitiveGUI;
-private slots:
+ double step;
+ int myConstructorId;
+ Handle(GEOM_ShapeTypeFilter) myVertexFilter;
+ Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
- void ConstructorsClicked(int constructorId);
+ gp_Pnt myPoint1; /* topology used */
+ gp_Dir myDir;
+ bool myOkPoint1; /* to check when arguments is defined */
+ bool myOkDir;
+
+ Standard_Real myRadius;
+ Standard_Real myHeight;
+ bool myOkRadius;
+ bool myOkHeight;
+
+ GeometryGUI_2Sel2Spin* GroupPoints;
+ GeometryGUI_2Spin* GroupDimensions;
+
+private slots:
void ClickOnOk();
- void ClickOnCancel();
void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
- void ValueChangedInSpinBox( double newValue ) ;
-
-protected:
- QGridLayout* GeometryGUI_CylinderDlgLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupC1Layout;
- QGridLayout* GroupC2Layout;
+ void ActivateThisDialog();
+ void LineEditReturnPressed();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ConstructorsClicked(int constructorId);
+ void ValueChangedInSpinBox(double newValue);
+
};
#endif // DIALOGBOX_CYLINDER_H
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_FuseDlg::GeometryGUI_FuseDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
+GeometryGUI_FuseDlg::GeometryGUI_FuseDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FUSE")));
/***************************************************************/
/* Initialisation */
- Init(Sel);
+ myBooleanGUI = theBooleanGUI;
+ Init();
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_FuseDlg::Init(SALOME_Selection* Sel)
+void GeometryGUI_FuseDlg::Init()
{
/* init variables */
myEditCurrentArgument = GroupFuse->LineEdit1;
connect(GroupFuse->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupFuse->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument()));
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */
GroupFuse->show();
myGeomGUI->GetDesktop()->putInfo(tr(""));
if(myOkShape1 && myOkShape2)
- myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3);
+ myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3);
return;
}
//=================================================================================
void GeometryGUI_FuseDlg::enterEvent(QEvent* e)
{
- if (GroupConstructors->isEnabled())
+ if(GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
#include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel_QTD.h"
+#include "BooleanGUI.h"
+
#include <BRepAlgoAPI_Fuse.hxx>
//=================================================================================
Q_OBJECT
public:
- GeometryGUI_FuseDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
+ GeometryGUI_FuseDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_FuseDlg();
private:
- void Init(SALOME_Selection* Sel);
+ void Init();
void enterEvent(QEvent* e);
+ BooleanGUI* myBooleanGUI;
+
TopoDS_Shape myShape1; /* topology used to fuse */
TopoDS_Shape myShape2; /* topology used to fuse */
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
bool myOkShape1; /* to check when arguments are defined */
bool myOkShape2;
- GeometryGUI_2Sel_QTD* GroupFuse ;
+ GeometryGUI_2Sel_QTD* GroupFuse;
private slots:
void ClickOnOk();
void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void ActivateThisDialog() ;
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
+ void LineEditReturnPressed();
+ void ActivateThisDialog();
};
#include "GeometryGUI_SectionDlg.h"
#include "GeometryGUI.h"
-
-#include "QAD_Application.h"
#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
-
//=================================================================================
// class : GeometryGUI_SectionDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_SectionDlg::GeometryGUI_SectionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+GeometryGUI_SectionDlg::GeometryGUI_SectionDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SECTION")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "GeometryGUI_SectionDlg" );
- resize( 303, 224 );
- setCaption( tr( "GEOM_SECTION_TITLE" ) );
- setSizeGripEnabled( TRUE );
- GeometryGUI_SectionDlgLayout = new QGridLayout( this );
- GeometryGUI_SectionDlgLayout->setSpacing( 6 );
- GeometryGUI_SectionDlgLayout->setMargin( 11 );
-
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "GEOM_SECTION" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- GeometryGUI_SectionDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
- GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupConstructor1->setColumnLayout(0, Qt::Vertical );
- GroupConstructor1->layout()->setSpacing( 0 );
- GroupConstructor1->layout()->setMargin( 0 );
- GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
- GroupConstructor1Layout->setAlignment( Qt::AlignTop );
- GroupConstructor1Layout->setSpacing( 6 );
- GroupConstructor1Layout->setMargin( 11 );
- LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
- LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
- LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
- LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
- SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
- SelectButtonC1A1Shape->setText( tr( "" ) );
- SelectButtonC1A1Shape->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
- SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
- SelectButtonC1A2Shape->setText( tr( "" ) );
- SelectButtonC1A2Shape->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
- TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
- TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I" ).arg("2") );
- TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
- TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
- TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I" ).arg("1") );
- TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
- GeometryGUI_SectionDlgLayout->addWidget( GroupConstructor1, 1, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "GEOM_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GeometryGUI_SectionDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /* Initialisation */
- Init( Sel ) ;
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SECTION")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption(tr("GEOM_SECTION_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_SECTION"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->close(TRUE);
+ RadioButton3->close(TRUE);
+
+ GroupSection = new GeometryGUI_2Sel_QTD(this, "GroupSection");
+ GroupSection->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupSection->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
+ GroupSection->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
+ GroupSection->PushButton1->setPixmap(image1);
+ GroupSection->PushButton2->setPixmap(image1);
+
+ Layout1->addWidget(GroupSection, 1, 0);
+ /***************************************************************/
+
+ /* Initialisation */
+ myBooleanGUI = theBooleanGUI;
+ Init();
}
GeometryGUI_SectionDlg::~GeometryGUI_SectionDlg()
{
/* no need to delete child widgets, Qt does it all for us */
- this->destroy(TRUE, TRUE) ;
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_SectionDlg::Init( SALOME_Selection* Sel )
+void GeometryGUI_SectionDlg::Init()
{
- mySelection = Sel ;
- myShape1.Nullify() ;
- myShape2.Nullify() ;
- myConstructorId = 0 ;
-
- myGeomGUI = GeometryGUI::GetGeometryGUI() ;
-
- GroupConstructor1->show();
- myConstructorId = 0 ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- Constructor1->setChecked( TRUE );
- myOkShape1 = myOkShape2 = false ;
-
- myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
- myGeom = GEOM::GEOM_Gen::_narrow(comp);
-
- // TODO previous selection into argument ?
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-
- connect( GroupConstructors, SIGNAL(clicked(int) ),this, SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
- connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
- connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
-
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- /* to close dialog if study change */
- connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- myGeomGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* Displays Dialog */
+ /* init variables */
+ myEditCurrentArgument = GroupSection->LineEdit1;
- return ;
-}
+ myShape1.Nullify();
+ myShape2.Nullify();
+ myOkShape1 = myOkShape2 = false;
+ /* signals and slots connections */
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupSection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupSection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void GeometryGUI_SectionDlg::ConstructorsClicked(int constructorId)
-{
- GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ;
-
- switch (constructorId)
- {
- case 0:
- {
- GroupConstructor1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- LineEditC1A2Shape->setText(tr("")) ;
- Constructor1->setChecked( TRUE );
- myOkShape1 = myOkShape2 = false ;
- break;
- }
- }
- return ;
+ connect(GroupSection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupSection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ /* displays Dialog */
+ GroupSection->show();
+ this->show();
+
+ return;
}
+
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_SectionDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
+ this->ClickOnApply();
+ ClickOnCancel();
return ;
}
+
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_SectionDlg::ClickOnApply()
{
- myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkShape1 && myOkShape2) {
- myGeomGUI->MakeBooleanAndDisplay(myGeomShape1, myGeomShape2, 4 ) ;
- }
- break ;
- }
- }
- // accept();
- return ;
-}
+ myGeomGUI->GetDesktop()->putInfo(tr(""));
+ if(myOkShape1 && myOkShape2)
+ myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 4);
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void GeometryGUI_SectionDlg::ClickOnCancel()
-{
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->ResetState() ;
- reject() ;
- return ;
+ return;
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_SectionDlg::SelectionIntoArgument()
{
- myEditCurrentArgument->setText("") ;
- QString aString = ""; /* future the name of selection */
-
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
- if ( nbSel != 1 ) {
- switch (myConstructorId)
- {
- case 0:
- {
- if ( myEditCurrentArgument == LineEditC1A1Shape ) {
- myOkShape1 = false ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
- myOkShape2 = false ;
- }
- break ;
- }
- }
- return ;
+ myEditCurrentArgument->setText("");
+ QString aString = "";
+
+ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1) {
+ if(myEditCurrentArgument == GroupSection->LineEdit1)
+ myOkShape1 = false;
+ else if( myEditCurrentArgument == GroupSection->LineEdit2)
+ myOkShape2 = false;
+ return;
}
- /* nbSel == 1 */
+ /* nbSel == 1 */
TopoDS_Shape S;
- Standard_Boolean testResult ;
- Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
- return ;
-
- if ( myEditCurrentArgument == LineEditC1A1Shape ) {
- myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult )
- return ;
- myShape1 = S ;
- LineEditC1A1Shape->setText(aString) ;
- myOkShape1 = true ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
- myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult )
- return ;
- myShape2 = S ;
- LineEditC1A2Shape->setText(aString) ;
- myOkShape2 = true ;
+ Standard_Boolean testResult;
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+ if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
+ return;
+
+ if(myEditCurrentArgument == GroupSection->LineEdit1) {
+ myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
+ if(!testResult)
+ return;
+ myShape1 = S;
+ GroupSection->LineEdit1->setText(aString);
+ myOkShape1 = true;
}
-
- return ;
+ else if(myEditCurrentArgument == GroupSection->LineEdit2) {
+ myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
+ if(!testResult)
+ return;
+ myShape2 = S;
+ GroupSection->LineEdit2->setText(aString);
+ myOkShape2 = true;
+ }
+ return;
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
{
QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if( send == SelectButtonC1A1Shape ) {
- LineEditC1A1Shape->setFocus() ;
- myEditCurrentArgument = LineEditC1A1Shape ;
- }
- else if(send == SelectButtonC1A2Shape) {
- LineEditC1A2Shape->setFocus() ;
- myEditCurrentArgument = LineEditC1A2Shape;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
+ if(send == GroupSection->PushButton1) {
+ GroupSection->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupSection->LineEdit1;
+ }
+ else if(send == GroupSection->PushButton2) {
+ GroupSection->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupSection->LineEdit2;
+ }
+ SelectionIntoArgument();
+ return;
+}
//=================================================================================
//=================================================================================
void GeometryGUI_SectionDlg::LineEditReturnPressed()
{
- QLineEdit* send = (QLineEdit*)sender();
- if( send == LineEditC1A1Shape )
- myEditCurrentArgument = LineEditC1A1Shape ;
- else if ( send == LineEditC1A2Shape )
- myEditCurrentArgument = LineEditC1A2Shape ;
+ QLineEdit* send = (QLineEdit*)sender();
+ if(send == GroupSection->LineEdit1)
+ myEditCurrentArgument = GroupSection->LineEdit1;
+ else if(send == GroupSection->LineEdit2)
+ myEditCurrentArgument = GroupSection->LineEdit2;
else
- return ;
-
- /* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
- /* so SelectionIntoArgument() is automatically called. */
- const QString objectUserName = myEditCurrentArgument->text() ;
- QWidget* thisWidget = (QWidget*)this ;
- if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
- myEditCurrentArgument->setText( objectUserName ) ;
- }
- return ;
-}
-
-
+ return;
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_SectionDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
-
- GroupConstructors->setEnabled(false) ;
- GroupConstructor1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
- }
- return ;
+ GeometryGUI_Skeleton::LineEditReturnPressed();
+ return;
}
-
//=================================================================================
-// function : closeEvent()
+// function : ActivateThisDialog()
// purpose :
//=================================================================================
-void GeometryGUI_SectionDlg::closeEvent( QCloseEvent* e )
+void GeometryGUI_SectionDlg::ActivateThisDialog()
{
- this->ClickOnCancel() ; /* same than click on cancel button */
+ GeometryGUI_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ return;
}
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
-void GeometryGUI_SectionDlg::enterEvent( QEvent * )
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
-}
-
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_SectionDlg::ActivateThisDialog()
+void GeometryGUI_SectionDlg::enterEvent(QEvent * e)
{
- /* Emit a signal to deactivate any active dialog */
- myGeomGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupConstructor1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- return ;
+ if(GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
}
#ifndef DIALOGBOX_SECTION_H
#define DIALOGBOX_SECTION_H
-#include "SALOME_Selection.h"
-#include "GEOM_ShapeTypeFilter.hxx"
+#include "GeometryGUI_Skeleton.h"
+#include "GeometryGUI_2Sel_QTD.h"
-#include <BRepAlgoAPI_Section.hxx>
-
-#include <qvariant.h>
-#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class GeometryGUI;
+#include "BooleanGUI.h"
+#include <BRepAlgoAPI_Section.hxx>
//=================================================================================
// class : GeometryGUI_SectionDlg
// purpose :
//=================================================================================
-class GeometryGUI_SectionDlg : public QDialog{
+class GeometryGUI_SectionDlg : public GeometryGUI_Skeleton
+{
Q_OBJECT
public:
- GeometryGUI_SectionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ GeometryGUI_SectionDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_SectionDlg();
private:
+ void Init();
+ void enterEvent(QEvent* e);
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ BooleanGUI* myBooleanGUI;
- GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
- GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- TopoDS_Shape myShape1 ; /* topology used to fuse */
- TopoDS_Shape myShape2 ; /* topology used to fuse */
- GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
- GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
- bool myOkShape1 ;
- bool myOkShape2 ; /* to check when arguments are defined */
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+ TopoDS_Shape myShape1; /* topology used to fuse */
+ TopoDS_Shape myShape2; /* topology used to fuse */
+ GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
+ GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
+ bool myOkShape1; /* to check when arguments are defined */
+ bool myOkShape2;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QGroupBox* GroupConstructor1;
- QLineEdit* LineEditC1A2Shape;
- QLineEdit* LineEditC1A1Shape;
- QPushButton* SelectButtonC1A1Shape;
- QPushButton* SelectButtonC1A2Shape;
- QLabel* TextLabelC1A2Shape;
- QLabel* TextLabelC1A1Shape;
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
+ GeometryGUI_2Sel_QTD* GroupSection;
private slots:
-
- void ConstructorsClicked(int constructorId);
void ClickOnOk();
- void ClickOnCancel();
void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
+ void LineEditReturnPressed();
+ void ActivateThisDialog();
-protected:
- QGridLayout* GeometryGUI_SectionDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupConstructor1Layout;
- QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_SECTION_H
// TRUE to construct a modal dialog.
//=================================================================================
GeometryGUI_Skeleton::GeometryGUI_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
- :GeometryGUI_Skeleton_QTD(parent, name, modal, fl)
+ :GeometryGUI_Skeleton_QTD(parent, name, modal, fl)
{
if (!name)
setName("GeometryGUI_Skeleton");
GroupMedium->close(TRUE);
resize(0, 0);
- Init(Sel) ;
+ Init(Sel);
}
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
/* Move widget on the botton right corner of main widget */
-// int x, y ;
-// myGeomGUI->DefineDlgPosition( this, x, y ) ;
+// int x, y;
+// myGeomGUI->DefineDlgPosition( this, x, y );
/* displays Dialog */
RadioButton1->setChecked(TRUE);
- return ;
+ return;
}
//=================================================================================
void GeometryGUI_Skeleton::DeactivateActiveDialog()
{
- Layout1->setEnabled(false);
+ this->setEnabled(false);
mySelection->ClearFilters();
disconnect(mySelection, 0, this, 0);
myGeomGUI->EraseSimulationShape();
void GeometryGUI_Skeleton::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
- myGeomGUI->EmitSignalDeactivateDialog();
- Layout1->setEnabled(true);
+ myGeomGUI->EmitSignalDeactivateDialog();
+ this->setEnabled(true);
myGeomGUI->SetActiveDialogBox((QDialog*)this);
return;
}
using namespace std;
#include "GeometryGUI_SphereDlg.h"
-#include "GeometryGUI_SpinBox.h"
-#include "GeometryGUI.h"
+#include <BRepPrimAPI_MakeSphere.hxx>
-#include "QAD_Application.h"
+#include "GeometryGUI.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
-#include "utilities.h"
-
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qvalidator.h>
-#include <qpixmap.h>
-
-
//=================================================================================
// class : GeometryGUI_SphereDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_SphereDlg::GeometryGUI_SphereDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+GeometryGUI_SphereDlg::GeometryGUI_SphereDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_P")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
- QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_DXYZ")));
-
- if ( !name )
- setName( "GeometryGUI_SphereDlg" );
- resize( 303, 219 );
- setCaption( tr( "GEOM_SPHERE_TITLE" ) );
- setSizeGripEnabled( TRUE );
- GeometryGUI_SphereDlgLayout = new QGridLayout( this );
- GeometryGUI_SphereDlgLayout->setSpacing( 6 );
- GeometryGUI_SphereDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "GEOM_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GeometryGUI_SphereDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "GEOM_SPHERE" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
- Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
- Constructor2->setText( tr( "" ) );
- GroupConstructors->insert( Constructor2, 1 );
- Constructor2->setMinimumSize( QSize( 50, 0 ) );
- Constructor2->setPixmap( image2 );
- GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
- GeometryGUI_SphereDlgLayout->addWidget( GroupConstructors, 0, 0 );
- GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
- GroupConstructor1->setTitle( tr( "GEOM_SPHERE_CR" ) );
- GroupConstructor1->setColumnLayout(0, Qt::Vertical );
- GroupConstructor1->layout()->setSpacing( 0 );
- GroupConstructor1->layout()->setMargin( 0 );
- GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
- GroupConstructor1Layout->setAlignment( Qt::AlignTop );
- GroupConstructor1Layout->setSpacing( 6 );
- GroupConstructor1Layout->setMargin( 11 );
- LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" );
- LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 );
- SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "GEOM_CENTER" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 );
- TextLabelC1A2 = new QLabel( GroupConstructor1, "TextLabelC1A2" );
- TextLabelC1A2->setText( tr( "GEOM_RADIUS" ) );
- TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A2, 1, 0 );
-
- SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A2" ) ;
- GroupConstructor1Layout->addWidget( SpinBox_C1A2, 1, 2 );
-
- GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor1, 1, 0 );
-
- /***************************************************************/
- GroupConstructor2 = new QGroupBox( this, "GroupConstructor2" );
- GroupConstructor2->setTitle( tr( "GEOM_SPHERE_RO" ) );
- GroupConstructor2->setColumnLayout(0, Qt::Vertical );
- GroupConstructor2->layout()->setSpacing( 0 );
- GroupConstructor2->layout()->setMargin( 0 );
- GroupConstructor2Layout = new QGridLayout( GroupConstructor2->layout() );
- GroupConstructor2Layout->setAlignment( Qt::AlignTop );
- GroupConstructor2Layout->setSpacing( 6 );
- GroupConstructor2Layout->setMargin( 11 );
-
- SpinBox_C2A1 = new GeometryGUI_SpinBox( GroupConstructor2, "GeomSpinBox_C2A1" ) ;
- GroupConstructor2Layout->addWidget( SpinBox_C2A1, 0, 1 );
-
- TextLabelC2A1 = new QLabel( GroupConstructor2, "TextLabelC2A1" );
- TextLabelC2A1->setText( tr( "GEOM_RADIUS" ) );
- TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC2A1->setFrameShape( QLabel::NoFrame );
- TextLabelC2A1->setFrameShadow( QLabel::Plain );
- GroupConstructor2Layout->addWidget( TextLabelC2A1, 0, 0 );
- QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
- GroupConstructor2Layout->addItem( spacer_5, 1, 1 );
- GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor2, 1, 0 );
-
- Init(Sel) ; /* Initialisations */
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_P")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption(tr("GEOM_SPHERE_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_SPHERE"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->setPixmap(image1);
+ RadioButton3->close(TRUE);
+
+ GroupPoints = new GeometryGUI_1Sel1Spin(this, "GroupPoints");
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_SPHERE_CR"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_CENTER"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_RADIUS"));
+ GroupPoints->PushButton1->setPixmap(image2);
+
+ GroupDimensions = new GeometryGUI_1Spin(this, "GroupDimensions");
+ GroupDimensions->GroupBox1->setTitle(tr("GEOM_SPHERE_RO"));
+ GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS"));
+
+ Layout1->addWidget(GroupPoints, 1, 0);
+ Layout1->addWidget(GroupDimensions, 1, 0);
+ /***************************************************************/
+
+ /* Initialisations */
+ myPrimitiveGUI = thePrimitiveGUI;
+ Init();
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_SphereDlg::Init( SALOME_Selection* Sel )
+void GeometryGUI_SphereDlg::Init()
{
+ /* init variables */
+ myConstructorId = 0;
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+
+ myPoint1.SetCoord(0.0, 0.0, 0.0);
+ myRadius = 100.0;
+ myOkPoint1 = myOkRadius = false;
+
+ /* Vertices Filter for all arguments */
+ myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
+ mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */
- double step ;
- QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
- step = St.toDouble() ;
+ QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
+ step = St.toDouble();
/* min, max, step and decimals for spin boxes */
- SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
- SpinBox_C1A2->SetValue( 100.0 ) ;
- SpinBox_C2A1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
- SpinBox_C2A1->SetValue( 100.0 ) ;
-
- GroupConstructor1->show();
- GroupConstructor2->hide();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- myGeomGUI = GeometryGUI::GetGeometryGUI() ;
- myPoint1.SetCoord( 0.0, 0.0, 0.0 );
-
- myRadius = 100.0 ;
- myOkRadius = true ;
- myOkPoint1 = false ;
-
- mySimulationTopoDs.Nullify() ;
- myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
+ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupPoints->SpinBox_DX->SetValue(myRadius);
+ GroupDimensions->SpinBox_DX->SetValue(myRadius);
- /* Filters definition */
- Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
- myGeom = GEOM::GEOM_Gen::_narrow(comp);
- myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
- mySelection->AddFilter(myVertexFilter) ; /* first filter used */
-
/* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
+
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
-
- connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_C2A1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
-
- connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- myGeomGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
- return ;
-}
+ /* displays Dialog */
+ GroupDimensions->hide();
+ GroupPoints->show();
+ this->show();
+ return;
+}
//=================================================================================
//=================================================================================
void GeometryGUI_SphereDlg::ConstructorsClicked(int constructorId)
{
- myGeomGUI->EraseSimulationShape() ;
+ myConstructorId = constructorId;
+ mySelection->ClearFilters();
+ myGeomGUI->EraseSimulationShape();
+ disconnect(mySelection, 0, this, 0);
+ myRadius = 100.0;
+ myOkRadius = true;
switch (constructorId)
{
case 0:
{
- GroupConstructor1->show();
- GroupConstructor2->hide();
- myConstructorId = constructorId ;
- myEditCurrentArgument = SpinBox_C1A2 ;
- LineEditC1A1->setText(tr("")) ;
- SpinBox_C1A2->SetValue( 100.0 ) ;
- myRadius = 100.0 ;
- myOkRadius = true ;
- myOkPoint1 = false ;
+ GroupDimensions->hide();
+ resize(0, 0);
+ GroupPoints->show();
+
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->LineEdit1->setText("");
+
+ GroupPoints->SpinBox_DX->SetValue(myRadius);
+ myOkPoint1 = false;
+
/* filter for next selections */
- mySelection->ClearFilters() ;
- mySelection->AddFilter( myVertexFilter );
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ mySelection->AddFilter(myVertexFilter);
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
case 1:
{
- GroupConstructor1->hide();
- GroupConstructor2->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = SpinBox_C2A1 ;;
- SpinBox_C2A1->SetValue( 100.0 ) ;
- myRadius = 100.0 ;
- myOkRadius = true ;
- myPoint1.SetCoord( 0.0, 0.0, 0.0 ); /* at origin */
- myOkPoint1 = false ;
+ GroupPoints->hide();
+ resize( 0, 0 );
+ GroupDimensions->show();
+
+ GroupDimensions->SpinBox_DX->SetValue(myRadius);
+ myPoint1.SetCoord(0.0, 0.0, 0.0); /* at origin */
+ myOkPoint1 = true;
+
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
- /* no filters here */
- mySelection->ClearFilters() ;
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
break;
}
}
return ;
}
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void GeometryGUI_SphereDlg::ClickOnApply()
-{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
- switch(myConstructorId)
- {
- case 0 :
- {
- if( myOkPoint1 && myOkRadius ) {
- myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ;
- }
- break ;
- }
- case 1 :
- {
- if( myOkRadius )
- myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ;
- break ;
- }
- }
- return ;
-}
-
//=================================================================================
// function : ClickOnOk()
//=================================================================================
void GeometryGUI_SphereDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
+ this->ClickOnApply();
+ ClickOnCancel();
+ return;
}
+
//=================================================================================
-// function : ClickOnCancel()
+// function : ClickOnApply()
// purpose :
//=================================================================================
-void GeometryGUI_SphereDlg::ClickOnCancel()
+void GeometryGUI_SphereDlg::ClickOnApply()
{
- mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->ResetState() ;
- reject() ;
+ myGeomGUI->GetDesktop()->putInfo(tr(""));
+ if (mySimulationTopoDs.IsNull())
+ return;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+
+ if(myOkPoint1 && myOkRadius)
+ myPrimitiveGUI->MakeSphereAndDisplay(myPoint1, myRadius);
return ;
}
//=================================================================================
void GeometryGUI_SphereDlg::SelectionIntoArgument()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
-
- /* Future name of selection */
- QString aString = "";
-
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
- if ( nbSel != 1 ) {
- if ( myEditCurrentArgument == LineEditC1A1 ) {
- LineEditC1A1->setText("") ;
- myOkPoint1 = false ;
+ myGeomGUI->EraseSimulationShape();
+ myEditCurrentArgument->setText("");
+ QString aString = ""; /* name of selection */
+
+ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1) {
+ if(myEditCurrentArgument == GroupPoints->LineEdit1) {
+ GroupPoints->LineEdit1->setText("");
+ myOkPoint1 = false;
}
- return ;
+ return;
}
/* nbSel == 1 ! */
TopoDS_Shape S;
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
- return ;
+ if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
+ return;
/* Constructor 1 treatment */
- if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
- LineEditC1A1->setText(aString) ;
- myOkPoint1 = true ;
+ if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
+ GroupPoints->LineEdit1->setText(aString);
+ myOkPoint1 = true;
}
- if( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) {
+ if(myOkPoint1 && myOkRadius) {
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
return ;
}
//=================================================================================
void GeometryGUI_SphereDlg::LineEditReturnPressed()
{
- QLineEdit* send = (QLineEdit*)sender();
- if( send == LineEditC1A1 )
- myEditCurrentArgument = LineEditC1A1 ;
+ QLineEdit* send = (QLineEdit*)sender();
+ if(send == GroupPoints->LineEdit1)
+ myEditCurrentArgument = GroupPoints->LineEdit1;
else
- return ;
-
- /* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
- /* so SelectionIntoArgument() is automatically called. */
- QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
- const QString objectUserName = LE->text() ;
- QWidget* thisWidget = (QWidget*)this ;
- if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
- LE->setText( objectUserName ) ;
- }
- return ;
-}
+ return;
-
-//=================================================================================
-// function : ValueChangedInSpinBox()
-// purpose :
-//=================================================================================
-void GeometryGUI_SphereDlg::ValueChangedInSpinBox( double newValue )
-{
- myRadius = newValue ;
- myOkRadius = true ;
-
- if ( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) {
- mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
- }
- else {
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- }
-
- return ;
+ GeometryGUI_Skeleton::LineEditReturnPressed();
+ return;
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_SphereDlg::SetEditCurrentArgument()
{
- QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- mySelection->AddFilter(myVertexFilter) ;
- SelectionIntoArgument() ;
- }
- break;
- }
- case 1:
- {
- /* no selection button here */
- break;
- }
+ if(myConstructorId != 0)
+ return;
- }
- return ;
-}
+ QPushButton* send = (QPushButton*)sender();
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_SphereDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
-
- GroupConstructors->setEnabled(false) ;
- GroupConstructor1->setEnabled(false) ;
- GroupConstructor2->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
- mySelection->ClearFilters() ;
+ if(send == GroupPoints->PushButton1) {
+ GroupPoints->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ mySelection->AddFilter(myVertexFilter);
+ this->SelectionIntoArgument();
}
- return ;
+
+ return;
}
+
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_SphereDlg::ActivateThisDialog()
{
- /* Emit a signal to deactivate other active dialog */
- myGeomGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupConstructor1->setEnabled(true) ;
- GroupConstructor2->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
-
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
-
- return ;
+ GeometryGUI_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ if(!mySimulationTopoDs.IsNull())
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ return;
}
//=================================================================================
void GeometryGUI_SphereDlg::enterEvent(QEvent* e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
+ if (GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
}
//=================================================================================
-// function : closeEvent()
+// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
-void GeometryGUI_SphereDlg::closeEvent( QCloseEvent* e )
+void GeometryGUI_SphereDlg::ValueChangedInSpinBox(double newValue)
{
- this->ClickOnCancel() ; /* same than click on cancel button */
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+ myRadius = newValue;
+ myOkRadius = true;
+
+ if (myOkPoint1 && myOkRadius) {
+ mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ }
+ return;
}
-
-
-
#ifndef DIALOGBOX_SPHERE_H
#define DIALOGBOX_SPHERE_H
-#include "SALOME_Selection.h"
-#include "GEOM_ShapeTypeFilter.hxx"
+#include "GeometryGUI_Skeleton.h"
+#include "GeometryGUI_1Sel1Spin.h"
+#include "GeometryGUI_1Spin.h"
-#include <gp_Pnt.hxx>
-#include <TopoDS_Shape.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvalidator.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QSpinBox;
-class QPushButton;
-class GeometryGUI_SpinBox;
-class QRadioButton;
-class GeometryGUI;
+#include "PrimitiveGUI.h"
+#include <gp_Pnt.hxx>
//=================================================================================
// class : GeometryGUI_SphereDlg
// purpose :
//=================================================================================
-class GeometryGUI_SphereDlg : public QDialog
+class GeometryGUI_SphereDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
- GeometryGUI_SphereDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ GeometryGUI_SphereDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_SphereDlg();
private :
-
- GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
- GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
- TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
- SALOME_Selection* mySelection ; /* User shape selection */
- gp_Pnt myPoint1 ; /* Points containing the vector */
+ void Init();
+ void enterEvent(QEvent* e);
- Standard_Real myRadius ;
- bool myOkRadius ;
- QDoubleValidator *myVa ; /* Double validator for numeric input myRadius in LineEditC1A2 */
- QDoubleValidator *myVb ; /* Double validator for numeric input myRadius in LineEditC2A1 */
+ PrimitiveGUI* myPrimitiveGUI;
- bool myOkPoint1 ; /* Are true when myPoint is defined */
- QWidget* myEditCurrentArgument; /* Current LineEdit or SpinBox */
- int myConstructorId ; /* Current constructor id = radio button id */
- Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
+ double step;
+ int myConstructorId;
+ Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent( QEvent* e);
- void Init( SALOME_Selection* Sel ) ;
+ gp_Pnt myPoint1; /* Points containing the vector */
+ Standard_Real myRadius;
+ bool myOkRadius; /* Are true when myPoint is defined */
+ bool myOkPoint1;
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QRadioButton* Constructor2;
- QGroupBox* GroupConstructor1;
- QLineEdit* LineEditC1A1;
- QPushButton* SelectButtonC1A1;
- QLabel* TextLabelC1A1;
- QLabel* TextLabelC1A2;
- // QLineEdit* LineEditC1A2;
- QGroupBox* GroupConstructor2;
- // QLineEdit* LineEditC2A1;
- GeometryGUI_SpinBox* SpinBox_C1A2 ;
- GeometryGUI_SpinBox* SpinBox_C2A1 ;
- QLabel* TextLabelC2A1;
+ GeometryGUI_1Sel1Spin* GroupPoints;
+ GeometryGUI_1Spin* GroupDimensions;
private slots:
-
- void ConstructorsClicked(int constructorId);
void ClickOnOk();
- void ClickOnCancel();
void ClickOnApply();
- void LineEditReturnPressed() ;
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
- void ValueChangedInSpinBox( double newValue ) ;
+ void ActivateThisDialog();
+ void LineEditReturnPressed();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ConstructorsClicked(int constructorId);
+ void ValueChangedInSpinBox(double newValue);
-protected:
- QGridLayout* GeometryGUI_SphereDlgLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupConstructor1Layout;
- QGridLayout* GroupConstructor2Layout;
};
#endif // DIALOGBOX_SPHERE_H
using namespace std;
#include "GeometryGUI_TorusDlg.h"
+#include <BRepPrimAPI_MakeTorus.hxx>
+#include <BRepAdaptor_Curve.hxx>
+
#include "GeometryGUI.h"
-#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
-#include "utilities.h"
-
-#include <BRepAdaptor_Curve.hxx>
-
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
-
-
//=================================================================================
// class : GeometryGUI_TorusDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GeometryGUI_TorusDlg::GeometryGUI_TorusDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+GeometryGUI_TorusDlg::GeometryGUI_TorusDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
-
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_PV")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
- QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_DXYZ")));
-
- if ( !name )
- setName( "GeometryGUI_TorusDlg" );
- resize( 303, 219 );
- setCaption( tr( "GEOM_TORUS_TITLE" ) );
- setSizeGripEnabled( TRUE );
- GeometryGUI_TorusDlgLayout = new QGridLayout( this );
- GeometryGUI_TorusDlgLayout->setSpacing( 6 );
- GeometryGUI_TorusDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "GEOM_TORUS" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
- Constructor2->setText( tr( "" ) );
- Constructor2->setMinimumSize( QSize( 50, 0 ) );
- Constructor2->setPixmap( image2 );
- Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
- QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer_2, 0, 2 );
- GeometryGUI_TorusDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "GEOM_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GeometryGUI_TorusDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
-
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
- SelectButtonC1A2->setText( tr( "" ) );
- SelectButtonC1A2->setPixmap( image1 );
- GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
- LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
- LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
- TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
- TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
- TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
- TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
- TextLabelC1A3->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
- TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A3->setFrameShape( QLabel::NoFrame );
- TextLabelC1A3->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
-
- SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
- SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 );
-
- TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
- TextLabelC1A4->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
- TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A4->setFrameShape( QLabel::NoFrame );
- TextLabelC1A4->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
-
- SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ;
- SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) );
- GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 );
-
- GeometryGUI_TorusDlgLayout->addWidget( GroupC1, 1, 0 );
- /***************************************************************/
-
- GroupC2 = new QGroupBox( this, "GroupC2" );
- GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) );
- GroupC2->setColumnLayout(0, Qt::Vertical );
- GroupC2->layout()->setSpacing( 0 );
- GroupC2->layout()->setMargin( 0 );
- GroupC2Layout = new QGridLayout( GroupC2->layout() );
- GroupC2Layout->setAlignment( Qt::AlignTop );
- GroupC2Layout->setSpacing( 6 );
- GroupC2Layout->setMargin( 11 );
- TextLabel_Radius1 = new QLabel( GroupC2, "TextLabel_Radius1" );
- TextLabel_Radius1->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
- GroupC2Layout->addWidget( TextLabel_Radius1, 0, 0 );
- TextLabel_Radius2 = new QLabel( GroupC2, "TextLabel_Radius2" );
- TextLabel_Radius2->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
- GroupC2Layout->addWidget( TextLabel_Radius2, 1, 0 );
-
- SpinBox_Radius1 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius1" ) ;
- GroupC2Layout->addWidget( SpinBox_Radius1, 0, 1 );
-
- SpinBox_Radius2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius2" ) ;
- GroupC2Layout->addWidget( SpinBox_Radius2, 1, 1 );
-
- QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed );
- GroupC2Layout->addItem( spacer1 );
- GeometryGUI_TorusDlgLayout->addWidget(GroupC2 , 1, 0 );
-
- /***************************************************************/
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
- /* Initialisations */
- Init(Sel) ;
+ setCaption(tr("GEOM_TORUS_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_TORUS"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->setPixmap(image1);
+ RadioButton3->close(TRUE);
+
+ GroupPoints = new GeometryGUI_2Sel2Spin(this, "GroupPoints");
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1"));
+ GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2"));
+ GroupPoints->PushButton1->setPixmap(image2);
+ GroupPoints->PushButton2->setPixmap(image2);
+
+ GroupDimensions = new GeometryGUI_2Spin(this, "GroupDimensions");
+ GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
+ GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1"));
+ GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2"));
+
+ Layout1->addWidget(GroupPoints, 1, 0);
+ Layout1->addWidget(GroupDimensions, 1, 0);
+ /***************************************************************/
+
+ /* Initialisations */
+ myPrimitiveGUI = thePrimitiveGUI;
+ Init();
}
// function : Init()
// purpose :
//=================================================================================
-void GeometryGUI_TorusDlg::Init( SALOME_Selection* Sel )
+void GeometryGUI_TorusDlg::Init()
{
+ /* init variables */
+ myConstructorId = 0;
+ myEditCurrentArgument = GroupPoints->LineEdit1;
- /* Get setting of step value from file configuration */
- double step ;
- QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
- step = St.toDouble() ;
-
- /* min, max, step and decimals for spin boxes */
- SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
- SpinBox_C1A4->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
- SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
- SpinBox_Radius2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
-
- GroupC1->show();
- GroupC2->hide();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- myGeomGUI = GeometryGUI::GetGeometryGUI() ;
-
- SpinBox_C1A3->SetValue( 300.0 ) ;
- SpinBox_C1A4->SetValue( 100.0 ) ;
- SpinBox_Radius1->SetValue( 300.0 ) ;
- SpinBox_Radius2->SetValue( 100.0 ) ;
- myRadius1 = 300.0 ;
- myRadius2 = 100.0 ;
-
- myOkRadius1 = true ;
- myOkRadius2 = true ;
- myOkPoint1 = false ;
- myOkDir = false ;
+ myRadius1 = 300.0;
+ myRadius2 = 100.0;
+ myOkRadius1 = myOkRadius2 = true;
+ myOkPoint1 = myOkDir = false;
- mySimulationTopoDs.Nullify() ;
- myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
+ myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
+ myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
+ mySelection->AddFilter(myVertexFilter);
+
+ /* Get setting of step value from file configuration */
+ QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
+ step = St.toDouble();
- // TODO : previous selection into argument ?
+ /* min, max, step and decimals for spin boxes & initial values */
+ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
+ GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
- /* Filter definitions */
- Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
- myGeom = GEOM::GEOM_Gen::_narrow(comp);
- myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
- myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
- /* first filter used */
- mySelection->AddFilter(myVertexFilter) ;
+ GroupPoints->SpinBox_DX->SetValue(myRadius1);
+ GroupPoints->SpinBox_DY->SetValue(myRadius2);
+ GroupDimensions->SpinBox_DX->SetValue(myRadius1);
+ GroupDimensions->SpinBox_DY->SetValue(myRadius2);
/* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
- connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Radius1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Radius2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
-
- connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
- connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
-
- connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- myGeomGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
+
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+
+ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
+
+ /* displays Dialog */
+ GroupDimensions->hide();
+ GroupPoints->show();
+ this->show();
+
return ;
}
//=================================================================================
void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId)
{
- mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
+ myConstructorId = constructorId;
+ mySelection->ClearFilters();
+ myGeomGUI->EraseSimulationShape();
+ disconnect(mySelection, 0, this, 0);
+ myOkRadius1 = myOkRadius2 = true;
+ myRadius1 = 300.0;
+ myRadius2 = 100.0;
switch(myConstructorId)
{
case 0 :
- {
- GroupC1->hide();
- GroupC2->show();
- myConstructorId = constructorId ;
- myOkRadius1 = myOkPoint1 = myOkRadius2 = myOkDir = true ;
-
- SpinBox_C1A3->SetValue( 300.0 ) ; /* radius 1 */
- SpinBox_C1A4->SetValue( 100.0 ) ; /* radius 2 */
- myRadius1 = 300.0 ;
- myRadius2 = 100.0 ;
+ {
+ GroupDimensions->hide();
+ resize(0, 0);
+ GroupPoints->show();
+ myOkPoint1 = myOkDir = false;
+
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->LineEdit1->setText(tr(""));
+ GroupPoints->LineEdit2->setText(tr(""));
- disconnect( mySelection, 0, this, 0 );
-
- myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
- myDir.SetCoord( 0.0, 0.0, 1.0 ) ;
+ GroupPoints->SpinBox_DX->SetValue(myRadius1);
+ GroupPoints->SpinBox_DY->SetValue(myRadius2);
- if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
- gp_Dir aDir = myDir ;
-
- MakeTorusSimulationAndDisplay() ;
- }
+ /* filter for next selection */
+ mySelection->AddFilter(myVertexFilter);
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break ;
}
case 1 :
- {
- GroupC2->hide();
- GroupC1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1 ;
- myOkRadius1 = myOkRadius2 = true ;
- myOkPoint1 = myOkDir = false ;
-
- SpinBox_Radius1->SetValue( 300.0 ) ;
- SpinBox_Radius2->SetValue( 100.0 ) ;
- myRadius1 = 300.0 ;
- myRadius2 = 100.0 ;
-
- LineEditC1A1->setText( tr("") );
- disconnect( mySelection, 0, this, 0 );
+ {
+ GroupPoints->hide();
+ resize( 0, 0 );
+ GroupDimensions->show();
+ myOkPoint1 = myOkDir = true;
+
+ GroupDimensions->SpinBox_DX->SetValue(myRadius1);
+ GroupDimensions->SpinBox_DY->SetValue(myRadius2);
+ myPoint1.SetCoord(0.0, 0.0, 0.0);
+ myDir.SetCoord(0.0, 0.0, 1.0);
+
+ MakeTorusSimulationAndDisplay();
break ;
}
}
}
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void GeometryGUI_TorusDlg::ClickOnApply()
-{
- myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
- myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ;
- }
- break ;
- }
- case 1 :
- {
- if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
- myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ;
- }
- break ;
- }
- }
- // accept();
- return ;
-}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_TorusDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
+ this->ClickOnApply();
+ ClickOnCancel();
+ return;
}
+
//=================================================================================
-// function : ClickOnCancel()
+// function : ClickOnApply()
// purpose :
//=================================================================================
-void GeometryGUI_TorusDlg::ClickOnCancel()
+void GeometryGUI_TorusDlg::ClickOnApply()
{
- mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->ResetState() ;
- reject() ;
+ myGeomGUI->GetDesktop()->putInfo(tr(""));
+ if (mySimulationTopoDs.IsNull())
+ return;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+
+ if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 )
+ myPrimitiveGUI->MakeTorusAndDisplay(myPoint1, myDir, myRadius1, myRadius2);
return ;
}
//=================================================================================
void GeometryGUI_TorusDlg::SelectionIntoArgument()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
-
- QString aString = ""; /* Name of future selection */
+ myGeomGUI->EraseSimulationShape();
+ myEditCurrentArgument->setText("");
+ QString aString = ""; /* name of selection */
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
- if ( nbSel != 1 ) {
- if ( myEditCurrentArgument == LineEditC1A1 ) {
- LineEditC1A1->setText("") ;
- myOkPoint1 = false ;
- }
- else if ( myEditCurrentArgument == LineEditC1A2 ) {
- LineEditC1A2->setText("") ;
- myOkDir = false ;
- }
- return ;
+ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
+ if (nbSel != 1) {
+ if(myEditCurrentArgument == GroupPoints->LineEdit1)
+ myOkPoint1 = false;
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myOkDir = false;
+ return;
}
/* nbSel == 1 */
TopoDS_Shape S;
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
- return ;
+ if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
+ return;
/* gp_Pnt : not used */
- if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
- LineEditC1A1->setText(aString) ;
- myOkPoint1 = true ;
+ if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
+ GroupPoints->LineEdit1->setText(aString);
+ myOkPoint1 = true;
}
- else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) {
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
- LineEditC1A2->setText(aString) ;
- myOkDir = true ;
+ GroupPoints->LineEdit2->setText(aString);
+ myOkDir = true;
}
- if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
- MakeTorusSimulationAndDisplay() ;
- }
- return ;
+ if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2)
+ MakeTorusSimulationAndDisplay();
+ return;
}
//=================================================================================
void GeometryGUI_TorusDlg::SetEditCurrentArgument()
{
+ if(myConstructorId != 0)
+ return;
+
QPushButton* send = (QPushButton*)sender();
- mySelection->ClearFilters() ;
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- mySelection->AddFilter(myVertexFilter) ;
- }
- else if(send == SelectButtonC1A2) {
- LineEditC1A2->setFocus() ;
- myEditCurrentArgument = LineEditC1A2;
- mySelection->AddFilter(myEdgeFilter) ;
- }
- SelectionIntoArgument() ;
- break;
- }
- case 1:
- {
- break ;
- }
- }
- return ;
+ if(send == GroupPoints->PushButton1) {
+ GroupPoints->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ mySelection->AddFilter(myVertexFilter);
+ }
+ else if(send == GroupPoints->PushButton2) {
+ GroupPoints->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit2;
+ mySelection->AddFilter(myEdgeFilter);
+ }
+ this->SelectionIntoArgument();
+
+ return;
}
void GeometryGUI_TorusDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if( send == LineEditC1A1 )
- myEditCurrentArgument = LineEditC1A1 ;
- else if ( send == LineEditC1A2)
- myEditCurrentArgument = LineEditC1A2;
+ if(send == GroupPoints->LineEdit1)
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ else if (send == GroupPoints->LineEdit2)
+ myEditCurrentArgument = GroupPoints->LineEdit2;
else
- return ;
-
- /* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
- /* so SelectionIntoArgument() is automatically called. */
- QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
- const QString objectUserName = LE->text() ;
- QWidget* thisWidget = (QWidget*)this ;
- if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
- LE->setText( objectUserName ) ;
- }
-
- return ;
-}
-
+ return;
-//=================================================================================
-// function : ValueChangedInSpinBox
-// purpose :
-//=================================================================================
-void GeometryGUI_TorusDlg::ValueChangedInSpinBox( double newValue )
-{
- QObject* send = (QObject*)sender();
-
- if(send == SpinBox_C1A3 ) {
- myRadius1 = newValue ;
- myOkRadius1 = true ;
- }
- else if(send == SpinBox_C1A4 ) {
- myRadius2 = newValue ;
- myOkRadius2 = true ;
- }
- else if(send == SpinBox_Radius1 ) {
- myRadius1 = newValue ;
- myOkRadius1 = true ;
- }
- else if(send == SpinBox_Radius2 ) {
- myRadius2 = newValue ;
- myOkRadius2 = true ;
- }
-
- if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
- MakeTorusSimulationAndDisplay() ;
- }
- else {
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void GeometryGUI_TorusDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupC2->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
- mySelection->ClearFilters() ;
- }
- return ;
+ GeometryGUI_Skeleton::LineEditReturnPressed();
+ return;
}
//=================================================================================
void GeometryGUI_TorusDlg::ActivateThisDialog()
{
- /* Emit a signal to deactivate the active dialog */
- myGeomGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupC2->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
- return ;
+ GeometryGUI_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ if(!mySimulationTopoDs.IsNull())
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ return;
}
//=================================================================================
void GeometryGUI_TorusDlg::enterEvent(QEvent* e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
+ if (GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
}
//=================================================================================
-// function : closeEvent()
+// function : ValueChangedInSpinBox
// purpose :
//=================================================================================
-void GeometryGUI_TorusDlg::closeEvent( QCloseEvent* e )
+void GeometryGUI_TorusDlg::ValueChangedInSpinBox(double newValue)
{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+ QObject* send = (QObject*)sender();
+
+ if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
+ myRadius1 = newValue;
+ myOkRadius1 = true;
+ }
+ else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
+ myRadius2 = newValue;
+ myOkRadius2 = true;
+ }
+
+ if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2)
+ MakeTorusSimulationAndDisplay();
+ return;
}
//=================================================================================
void GeometryGUI_TorusDlg::MakeTorusSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape() ;
- mySimulationTopoDs.Nullify() ;
-
+ myGeomGUI->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+
try {
- gp_Ax2 anAxis(this->myPoint1, this->myDir) ;
- mySimulationTopoDs = BRepPrimAPI_MakeTorus( anAxis, this->myRadius1, this->myRadius2 ).Shape() ;
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ gp_Ax2 anAxis(this->myPoint1, this->myDir);
+ mySimulationTopoDs = BRepPrimAPI_MakeTorus(anAxis, this->myRadius1, this->myRadius2).Shape();
+ myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
- MESSAGE( "Exception catched in MakeTorusSimulationAndDisplay" ) ;
+ MESSAGE("Exception catched in MakeTorusSimulationAndDisplay");
}
- return ;
+ return;
}
-
#ifndef DIALOGBOX_TORUS_H
#define DIALOGBOX_TORUS_H
-#include "SALOME_Selection.h"
-#include "GEOM_ShapeTypeFilter.hxx"
+#include "GeometryGUI_Skeleton.h"
+#include "GeometryGUI_2Sel2Spin.h"
+#include "GeometryGUI_2Spin.h"
+
+#include "PrimitiveGUI.h"
+
#include "GEOM_EdgeFilter.hxx"
-#include "GeometryGUI_SpinBox.h"
-#include <TopoDS_Shape.hxx>
-#include <BRepPrimAPI_MakeTorus.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvalidator.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class QSpinBox ;
-class GeometryGUI;
-
-
//=================================================================================
// class : GeometryGUI_TorusDlg
// purpose :
//=================================================================================
-class GeometryGUI_TorusDlg : public QDialog
+class GeometryGUI_TorusDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
- GeometryGUI_TorusDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ GeometryGUI_TorusDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_TorusDlg();
private:
+ void Init();
+ void enterEvent(QEvent* e);
+ void MakeTorusSimulationAndDisplay();
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
- void MakeTorusSimulationAndDisplay() ;
-
- GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
- GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
- TopoDS_Shape mySimulationTopoDs ;
- SALOME_Selection* mySelection ; /* User shape selection */
-
- gp_Pnt myPoint1 ; /* Topology used */
- gp_Dir myDir ;
- bool myOkPoint1 ;
- bool myOkDir ; /* to check when arguments is defined */
-
- Standard_Real myRadius1 ;
- Standard_Real myRadius2 ;
- bool myOkRadius1 ;
- bool myOkRadius2 ;
- QDoubleValidator *myVa ; /* Double validator for numeric input myRadius1 */
- QDoubleValidator *myVb ; /* Double validator for numeric input myRadius2 */
-
- int myConstructorId ; /* Current constructor id = radio button id */
- QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */
- Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
- Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QRadioButton* Constructor2;
- QGroupBox* GroupC1;
- QGroupBox* GroupC2;
- QPushButton* SelectButtonC1A1;
- QPushButton* SelectButtonC1A2;
- QLineEdit* LineEditC1A1;
- QLineEdit* LineEditC1A2;
-
- GeometryGUI_SpinBox* SpinBox_C1A3 ;
- GeometryGUI_SpinBox* SpinBox_C1A4 ;
-
- QLabel* TextLabelC1A1;
- QLabel* TextLabelC1A2;
- QLabel* TextLabelC1A3;
- QLabel* TextLabelC1A4;
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-
- QLabel* TextLabel_Radius1 ;
- QLabel* TextLabel_Radius2 ;
- GeometryGUI_SpinBox* SpinBox_Radius1 ;
- GeometryGUI_SpinBox* SpinBox_Radius2 ;
+ PrimitiveGUI* myPrimitiveGUI;
-private slots:
+ double step;
+ int myConstructorId;
+ Handle(GEOM_ShapeTypeFilter) myVertexFilter;
+ Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
- void ConstructorsClicked(int constructorId);
+ gp_Pnt myPoint1; /* topology used */
+ gp_Dir myDir;
+ bool myOkPoint1; /* to check when arguments is defined */
+ bool myOkDir;
+
+ Standard_Real myRadius1;
+ Standard_Real myRadius2;
+ bool myOkRadius1;
+ bool myOkRadius2;
+
+ GeometryGUI_2Sel2Spin* GroupPoints;
+ GeometryGUI_2Spin* GroupDimensions;
+
+private slots:
void ClickOnOk();
- void ClickOnCancel();
void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
- void ValueChangedInSpinBox( double newValue ) ;
-
-protected:
- QGridLayout* GeometryGUI_TorusDlgLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupC1Layout;
- QGridLayout* GroupC2Layout;
+ void ActivateThisDialog();
+ void LineEditReturnPressed();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ConstructorsClicked(int constructorId);
+ void ValueChangedInSpinBox(double newValue);
+
};
#endif // DIALOGBOX_TORUS_H
# Libraries targets
LIB = libGEOMGUI.la
LIB_SRC = GeometryGUI.cxx \
+ BooleanGUI.cxx \
+ PrimitiveGUI.cxx \
GeometryGUI_SpinBox.cxx \
GeometryGUI_Skeleton_QTD.cxx \
GeometryGUI_Skeleton.cxx \
GeometryGUI_1Sel4Spin.cxx \
GeometryGUI_2Sel1Spin_QTD.cxx \
GeometryGUI_2Sel1Spin.cxx \
+ GeometryGUI_2Sel2Spin_QTD.cxx \
+ GeometryGUI_2Sel2Spin.cxx \
+ GeometryGUI_2Sel3Spin_QTD.cxx \
+ GeometryGUI_2Sel3Spin.cxx \
+ GeometryGUI_1Spin_QTD.cxx \
+ GeometryGUI_1Spin.cxx \
+ GeometryGUI_2Spin_QTD.cxx \
+ GeometryGUI_2Spin.cxx \
GeometryGUI_3Spin_QTD.cxx \
GeometryGUI_3Spin.cxx \
GeometryGUI_TransparencyDlg.cxx \
LIB_MOC = \
GeometryGUI.h \
+ BooleanGUI.h \
+ PrimitiveGUI.h \
GeometryGUI_SpinBox.h \
GeometryGUI_Skeleton_QTD.h \
GeometryGUI_Skeleton.h \
GeometryGUI_1Sel4Spin.h \
GeometryGUI_2Sel1Spin_QTD.h \
GeometryGUI_2Sel1Spin.h \
+ GeometryGUI_2Sel2Spin_QTD.h \
+ GeometryGUI_2Sel2Spin.h \
+ GeometryGUI_2Sel3Spin_QTD.h \
+ GeometryGUI_2Sel3Spin.h \
+ GeometryGUI_1Spin_QTD.h \
+ GeometryGUI_1Spin.h \
+ GeometryGUI_2Spin_QTD.h \
+ GeometryGUI_2Spin.h \
GeometryGUI_3Spin_QTD.h \
GeometryGUI_3Spin.h \
GeometryGUI_TransparencyDlg.h \
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : PrimitiveGUI.cxx
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+using namespace std;
+#include "PrimitiveGUI.h"
+
+#include "QAD_Application.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
+#include "GeometryGUI_BoxDlg.h" // Method BOX
+#include "GeometryGUI_CylinderDlg.h" // Method CYLINDER
+#include "GeometryGUI_SphereDlg.h" // Method SPHERE
+#include "GeometryGUI_TorusDlg.h" // Method TORUS
+#include "GeometryGUI_ConeDlg.h" // Method CONE
+
+//=======================================================================
+// function : PrimitiveGUI()
+// purpose : Constructor
+//=======================================================================
+PrimitiveGUI::PrimitiveGUI() :
+ QObject()
+{
+ myGeomGUI = GeometryGUI::GetGeometryGUI();
+ Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
+ myGeom = GEOM::GEOM_Gen::_narrow(comp);
+}
+
+
+//=======================================================================
+// function : ~PrimitiveGUI()
+// purpose : Destructor
+//=======================================================================
+PrimitiveGUI::~PrimitiveGUI()
+{
+}
+
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+{
+ myGeomGUI->EmitSignalDeactivateDialog();
+ SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
+
+ switch (theCommandID)
+ {
+ case 3021: // BOX
+ {
+ GeometryGUI_BoxDlg *aDlg = new GeometryGUI_BoxDlg(parent, "", this, Sel);
+ break;
+ }
+ case 3022: // CYLINDER
+ {
+ GeometryGUI_CylinderDlg *aDlg = new GeometryGUI_CylinderDlg(parent, "", this, Sel);
+ break;
+ }
+ case 3023: // SPHERE
+ {
+ GeometryGUI_SphereDlg *aDlg = new GeometryGUI_SphereDlg(parent, "", this, Sel);
+ break;
+ }
+ case 3024: // TORUS
+ {
+ GeometryGUI_TorusDlg *aDlg = new GeometryGUI_TorusDlg(parent, "", this, Sel);
+ break;
+ }
+ case 3025: // CONE
+ {
+ GeometryGUI_ConeDlg *aDlg = new GeometryGUI_ConeDlg(parent, "", this, Sel);
+ break;
+ }
+ default:
+ {
+ parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
+ break;
+ }
+ }
+ return true;
+}
+
+
+//=======================================================================
+// function : MakeBoxAndDisplay()
+// purpose :
+//=======================================================================
+void PrimitiveGUI::MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2)
+{
+ try {
+ GEOM::GEOM_Shape_var box = myGeom->MakeBox(P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z());
+ box->NameType(tr("GEOM_BOX"));
+ if(myGeomGUI->Display(box, ""))
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch(const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+}
+
+
+//=====================================================================================
+// function : MakeCylinderAndDisplay()
+// purpose :
+//=====================================================================================
+void PrimitiveGUI::MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
+ const double Radius, const double aHeight)
+{
+ try {
+ if(Radius <= Precision::Confusion() || aHeight <= Precision::Confusion())
+ return;
+
+ GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z());
+ GEOM::PointStruct d = myGeom->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z());
+ GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
+
+ GEOM::GEOM_Shape_var result = myGeom->MakeCylinder(pstruct, dstruct, Radius, aHeight);
+ if (result->_is_nil()) {
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
+ return;
+ }
+ result->NameType(tr("GEOM_CYLINDER"));
+ if(myGeomGUI->Display(result, ""))
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch(const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ return;
+}
+
+
+//=====================================================================================
+// function : MakeSphere()
+// purpose :
+//=====================================================================================
+void PrimitiveGUI::MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double aRadius)
+{
+ try {
+ if(aRadius <= Precision::Confusion())
+ return;
+
+ GEOM::GEOM_Shape_ptr result = myGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius);
+ result->NameType(tr("GEOM_SPHERE"));
+ if (myGeomGUI->Display(result, ""))
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ return;
+}
+
+
+//=====================================================================================
+// function : MakeTorusAndDisplay()
+// purpose :
+//=====================================================================================
+void PrimitiveGUI::MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
+ const double Radius1, const double Radius2)
+{
+ try {
+ if(Radius1 <= Precision::Confusion() || Radius2 <= Precision::Confusion())
+ return;
+
+ GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z());
+ GEOM::PointStruct d = myGeom ->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z());
+ GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
+
+ GEOM::GEOM_Shape_var result = myGeom->MakeTorus(pstruct, dstruct, Radius1, Radius2);
+ if(result->_is_nil()) {
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
+ return;
+ }
+ result->NameType(tr("GEOM_TORUS"));
+ if(myGeomGUI->Display(result, ""))
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch(const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ return;
+}
+
+
+//=====================================================================================
+// function : MakeConeAndDisplay()
+// purpose :
+//=====================================================================================
+void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
+ const double Radius1, const double Radius2, const double aHeight)
+{
+ try {
+ if((Radius1 <= Precision::Confusion() && Radius2 <= Precision::Confusion()) || aHeight <= Precision::Confusion())
+ return;
+
+ GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z());
+ GEOM::PointStruct d = myGeom->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z());
+ GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
+
+ GEOM::GEOM_Shape_var result = myGeom->MakeCone(pstruct, dstruct, Radius1, Radius2, aHeight);
+ if(result->_is_nil()) {
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
+ return;
+ }
+ result->NameType(tr("GEOM_CONE"));
+ if(myGeomGUI->Display(result, ""))
+ myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch(const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ return;
+}
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : PrimitiveGUI.h
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#ifndef PRIMITIVEGUI_H
+#define PRIMITIVEGUI_H
+
+#include "GeometryGUI.h"
+
+#include <Precision.hxx>
+
+//=================================================================================
+// class : PrimitiveGUI
+// purpose :
+//=================================================================================
+class PrimitiveGUI : public QObject
+{
+ Q_OBJECT /* for QT compatibility */
+
+public :
+ PrimitiveGUI();
+ ~PrimitiveGUI();
+
+ bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
+
+ void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
+ void MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
+ const double Radius, const double aHeight);
+ void MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double aRadius);
+ void MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
+ const double Radius1, const double Radius2);
+ void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
+ const double Radius1, const double Radius2, const double aHeight);
+
+private:
+ GeometryGUI* myGeomGUI;
+ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
+
+};
+
+#endif