From: nri Date: Wed, 9 Jul 2003 08:28:22 +0000 (+0000) Subject: NRI : Bad merge X-Git-Tag: ihm_1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b7f1da9ebf6335d26a98ebfdade58391037c7538;p=modules%2Fgeom.git NRI : Bad merge --- diff --git a/GEOMClient/GEOM_Client.cxx b/GEOMClient/GEOM_Client.cxx deleted file mode 100644 index e3fb21cb3..000000000 --- a/GEOMClient/GEOM_Client.cxx +++ /dev/null @@ -1,253 +0,0 @@ -// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client -// -// 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 : GEOM_Client.cxx -// Author : Yves FRICAUD/Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_Client.hxx" -#include -#include "utilities.h" - -#include CORBA_SERVER_HEADER(GEOM_Gen) - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//======================================================================= -// function : Load() -// purpose : -//======================================================================= -static TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape ) -{ - TopoDS_Shape S; - /* get sequence of bytes of resulting brep shape from GEOM server */ - GEOM::GEOM_Shape::TMPFile_var SeqFile = aShape->GetShapeStream(); - int sizebuf = SeqFile->length(); - char* buf; - buf = (char*) &SeqFile[0]; - istrstream streamBrep(buf,sizebuf); - BRep_Builder aBuilder; - BRepTools::Read(S, streamBrep, aBuilder); - return S; -} - - -//======================================================================= -// function : Create() -// purpose : -//======================================================================= -GEOM_Client::GEOM_Client() -{ -} - - -//======================================================================= -// function : Find() -// purpose : -//======================================================================= -Standard_Integer GEOM_Client::Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) -{ - for ( Standard_Integer i = 1; i<= myIORs.Length(); i++ ) { - if (myIORs.Value(i).IsEqual(IOR)) { - S = myShapes.Value(i); - return i; - } - } - return 0; -} - - -//======================================================================= -// function : Bind() -// purpose : -//======================================================================= -void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S ) -{ - myIORs.Append(IOR); - myShapes.Append(S); -} - -//======================================================================= -// function : RemoveShapeFromBuffer() -// purpose : Remove shape from Client Buffer -//======================================================================= -void GEOM_Client::RemoveShapeFromBuffer( const TCollection_AsciiString& shapeIOR ) -{ - if( myIORs.IsEmpty() ) - return ; - - TopoDS_Shape S ; - Standard_Integer anIndex = Find( shapeIOR, S ) ; - if( anIndex != 0 ) { - myIORs.Remove(anIndex) ; - myShapes.Remove(anIndex) ; - } - return ; -} - - -//======================================================================= -// function : ClearClientBuffer() -// purpose : purge buffer -//======================================================================= -void GEOM_Client::ClearClientBuffer() -{ - if( myIORs.IsEmpty() ) - return ; - myIORs.Clear() ; - myShapes.Clear() ; - return ; -} - -//======================================================================= -// function : BufferLength() -// purpose : -//======================================================================= -unsigned int GEOM_Client::BufferLength() -{ - return myIORs.Length() ; -} - - -//======================================================================= -// function : GetShape() -// purpose : -//======================================================================= - -TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape ) -{ - - TopoDS_Shape S; - TCollection_AsciiString IOR(aShape->Name()); - Standard_Integer anIndex = Find(IOR, S); - - BRep_Builder B; - - if (anIndex !=0 ) { - return S ; - } - - /******* in case of a MAIN GEOM::SHAPE ********/ - if (aShape->IsMainShape()) { - S = Load(geom, aShape); - Bind(IOR,S); - return S; - } - - /******* in case of SUB GEOM::SHAPE ***********/ - // Load and Explore the Main Shape - TopoDS_Shape MainShape = GetShape (geom, geom->GetIORFromString(aShape->MainName())); - GEOM::GEOM_Shape::ListOfSubShapeID_var list = aShape->Index(); - - Standard_Integer j = 1; - TopExp_Explorer exp; - TopAbs_ShapeEnum ShapeType = TopAbs_ShapeEnum(aShape->ShapeType()); - - /* Case of only one subshape */ - if (list->length() == 1) - { - if (ShapeType == TopAbs_COMPOUND) - { - TopoDS_Iterator it; - TopTools_ListOfShape CL; - CL.Append( MainShape ); - TopTools_ListIteratorOfListOfShape itC; - for (itC.Initialize( CL ); itC.More(); itC.Next()) - { - for (it.Initialize( itC.Value() ); it.More(); it.Next()) - { - if ( it.Value().ShapeType() == TopAbs_COMPOUND) - { - if (j == list[0]) - { - S = it.Value(); - Bind(IOR, S); - return S; - } - j++; - CL.Append( it.Value() ); - } - } - } - } - else - { - TopTools_MapOfShape M; - for (exp.Init(MainShape, ShapeType); exp.More(); exp.Next()) { - if ( M.Add(exp.Current()) ) - { - if (j == list[0]) - { - S = exp.Current(); - Bind(IOR, S); - return S; - } - j++; - } - } - } - } - - /* Case of a compound containing two or more sub shapes (not a main shape compound !) */ - - /* Warning : the compound when representing sub shapes must be explored in a sub type */ - /* that is NOT ShapeType=aShape->ShapeType()= TopAbs_COMPOUND ! */ - /* We have to retrieve the exact sub type of shapes contained in the compound first ! */ - TopoDS_Iterator it ; - TopAbs_ShapeEnum exactSubType ; - S = Load( geom, aShape ); - it.Initialize( S, true, true ) ; - it.More(); - exactSubType = it.Value().ShapeType() ; - - TColStd_MapOfInteger MapIndex; - Standard_Integer nbSS = list->length(); - TopoDS_Compound Comp; - B.MakeCompound(Comp); - - for (Standard_Integer i=1; i<=nbSS; i++) - MapIndex.Add(list[i-1]); - - for (exp.Init(MainShape, exactSubType), j=1; exp.More() ; exp.Next(), j++) { - if ( MapIndex.Contains(j) ) { - B.Add( Comp, exp.Current() ); - } - } - Bind(IOR, Comp); - return Comp; -} diff --git a/GEOMClient/GEOM_Client.hxx b/GEOMClient/GEOM_Client.hxx deleted file mode 100644 index 09d4351b7..000000000 --- a/GEOMClient/GEOM_Client.hxx +++ /dev/null @@ -1,93 +0,0 @@ -// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client -// -// 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 : GEOM_Client.hxx -// Author : Yves FRICAUD -// Module : GEOM -// $Header$ - -#ifndef _GEOM_Client_HeaderFile -#define _GEOM_Client_HeaderFile - -#include -#include CORBA_SERVER_HEADER(GEOM_Shape) -#include CORBA_SERVER_HEADER(GEOM_Gen) -# -#ifndef _TColStd_SequenceOfAsciiString_HeaderFile -#include -#endif -#ifndef _TopTools_SequenceOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -class TCollection_AsciiString; -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -//===================================================================== -// GEOM_Client : class definition -//===================================================================== -class GEOM_Client { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - Standard_EXPORT GEOM_Client(); - Standard_EXPORT Standard_Integer Find( const TCollection_AsciiString& ShapeIOR, TopoDS_Shape& S ) ; - Standard_EXPORT void Bind( const TCollection_AsciiString& ShapeIOR, const TopoDS_Shape& S ) ; - Standard_EXPORT TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape ); - Standard_EXPORT void RemoveShapeFromBuffer( const TCollection_AsciiString& shapeIOR ) ; - Standard_EXPORT void ClearClientBuffer() ; - Standard_EXPORT unsigned int BufferLength() ; - -private: - // Fields PRIVATE - // - TColStd_SequenceOfAsciiString myIORs ; - TopTools_SequenceOfShape myShapes ; -}; - - -#endif diff --git a/GEOMClient/Makefile.in b/GEOMClient/Makefile.in deleted file mode 100644 index b3fff1fc6..000000000 --- a/GEOMClient/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client -# -# 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 : Makefile.in -# Author : Patrick GOLDBRONN (CEA) -# Module : GEOM -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@top_srcdir@/idl - - -@COMMENCE@ - -# header files -EXPORT_HEADERS = \ - GEOM_Client.hxx - -# Libraries targets - -LIB = libGeometryClient.la -LIB_SRC = GEOM_Client.cxx -LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl GEOM_Shape.idl GEOM_Gen.idl - -# Executables targets -BIN = -BIN_SRC = -BIN_CLIENT_IDL = -BIN_SERVER_IDL = - -# additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) -CXXFLAGS += $(OCC_CXXFLAGS) -LDFLAGS += $(OCC_LIBS) - - -@CONCLUDE@ - diff --git a/GEOMDS/GEOMDS.cdl b/GEOMDS/GEOMDS.cdl deleted file mode 100644 index 0e727a942..000000000 --- a/GEOMDS/GEOMDS.cdl +++ /dev/null @@ -1,53 +0,0 @@ --- GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management --- --- 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 : GEOMDS.cdl --- Author : Yves FRICAUD --- Module : GEOM - -package GEOMDS - - ---Purpose: - -uses - TDF, - TDocStd, - TDataStd, - TColStd, - TopoDS, - TCollection, - TNaming - - -is - class Application; - class Commands; - class Explorer; - - - class DataMapOfIntegerTransient instantiates DataMap from -TCollection(Integer from Standard, Transient from Standard, MapIntegerHasher -from TColStd); - -end GEOMDS; - diff --git a/GEOMDS/GEOMDS_Application.cdl b/GEOMDS/GEOMDS_Application.cdl deleted file mode 100644 index de1ec2bbc..000000000 --- a/GEOMDS/GEOMDS_Application.cdl +++ /dev/null @@ -1,49 +0,0 @@ --- GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management --- --- 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 : GEOMDS_Application.cdl --- Author : Yves FRICAUD --- Module : GEOM - -class Application from GEOMDS inherits Application from TDocStd - - ---Purpose: - -uses - Label from TDF, - SequenceOfExtendedString from TColStd, - CString from Standard, - Document from TDocStd - - -is - - Create - returns mutable Application from GEOMDS; - - Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd) - is redefined; - - ResourcesName (me: mutable) returns CString from Standard; - -end Application; diff --git a/GEOMDS/GEOMDS_Application.cxx b/GEOMDS/GEOMDS_Application.cxx deleted file mode 100644 index 00a6b057f..000000000 --- a/GEOMDS/GEOMDS_Application.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Application.cxx -// Author : Yves FRICAUD -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOMDS_Application.ixx" - -//======================================================================= -//function : GEOMDS_Application -//purpose : -//======================================================================= - -GEOMDS_Application::GEOMDS_Application() -{ -} - - -//======================================================================= -//function : Formats -//purpose : -//======================================================================= - -void GEOMDS_Application::Formats(TColStd_SequenceOfExtendedString& Formats) -{ - Formats.Append(TCollection_ExtendedString ("SALOME_GEOM")); -} - - -//======================================================================= -//function : ResourcesName -//purpose : -//======================================================================= - -Standard_CString GEOMDS_Application::ResourcesName() -{ - return Standard_CString ("Resources"); -} - - - - - diff --git a/GEOMDS/GEOMDS_Application.hxx b/GEOMDS/GEOMDS_Application.hxx deleted file mode 100644 index bc5fa691c..000000000 --- a/GEOMDS/GEOMDS_Application.hxx +++ /dev/null @@ -1,112 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Application.hxx -// Module : GEOM - -#ifndef _GEOMDS_Application_HeaderFile -#define _GEOMDS_Application_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMDS_Application_HeaderFile -#include -#endif - -#ifndef _TDocStd_Application_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -class TColStd_SequenceOfExtendedString; - - -class GEOMDS_Application : public TDocStd_Application { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT GEOMDS_Application(); -Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ; -Standard_EXPORT Standard_CString ResourcesName() ; -Standard_EXPORT ~GEOMDS_Application(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOMDS_Application_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMDS/GEOMDS_Application.ixx b/GEOMDS/GEOMDS_Application.ixx deleted file mode 100644 index c94573fb8..000000000 --- a/GEOMDS/GEOMDS_Application.ixx +++ /dev/null @@ -1,86 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Application.ixx -// Module : GEOM - -#include "GEOMDS_Application.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -GEOMDS_Application::~GEOMDS_Application() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMDS_Application_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDocStd_Application); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDocStd_Application); - static Handle_Standard_Type aType2 = STANDARD_TYPE(CDF_Application); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(CDF_Application); - static Handle_Standard_Type aType3 = STANDARD_TYPE(CDM_Application); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(CDM_Application); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMDS_Application", - sizeof(GEOMDS_Application), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -// DownCast method -// allow safe downcasting - - -const Handle(GEOMDS_Application) Handle(GEOMDS_Application)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMDS_Application) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMDS_Application))) { - _anOtherObject = Handle(GEOMDS_Application)((Handle(GEOMDS_Application)&)AnObject); - } - } - - return _anOtherObject ; -} - - -const Handle(Standard_Type)& GEOMDS_Application::DynamicType() const -{ - return STANDARD_TYPE(GEOMDS_Application) ; -} -Standard_Boolean GEOMDS_Application::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(GEOMDS_Application) == AType || TDocStd_Application::IsKind(AType)); -} -Handle_GEOMDS_Application::~Handle_GEOMDS_Application() {} \ No newline at end of file diff --git a/GEOMDS/GEOMDS_Application.jxx b/GEOMDS/GEOMDS_Application.jxx deleted file mode 100644 index 936d0a158..000000000 --- a/GEOMDS/GEOMDS_Application.jxx +++ /dev/null @@ -1,32 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Application.jxx -// Module : GEOM - -#ifndef _TColStd_SequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _GEOMDS_Application_HeaderFile -#include "GEOMDS_Application.hxx" -#endif diff --git a/GEOMDS/GEOMDS_Commands.cdl b/GEOMDS/GEOMDS_Commands.cdl deleted file mode 100644 index a4a2f8f06..000000000 --- a/GEOMDS/GEOMDS_Commands.cdl +++ /dev/null @@ -1,46 +0,0 @@ --- GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management --- --- 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 : GEOMDS_Commands.cdl --- Author : Yves FRICAUD --- Module : GEOM - -class Commands from GEOMDS - - ---Purpose: - -uses - Label from TDF, - Shape from TopoDS, - ExtendedString from TCollection - -is - Create ( Main : Label from TDF) returns Commands from GEOMDS; - - AddShape(me : in out; S : Shape from TopoDS; - Name : ExtendedString from TCollection) - returns Label from TDF; - -fields - myLab : Label from TDF; -end Commands; diff --git a/GEOMDS/GEOMDS_Commands.cxx b/GEOMDS/GEOMDS_Commands.cxx deleted file mode 100644 index 17f7e5764..000000000 --- a/GEOMDS/GEOMDS_Commands.cxx +++ /dev/null @@ -1,302 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GeomDS_Commands.cxx -// Author : Yves FRICAUD/Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "utilities.h" -#include "GEOMDS_Commands.ixx" - -#include -#include -#include -#include -#include -#include -#include - - -//======================================================================= -//function : GEOMDS_Commands -//purpose : -//======================================================================= -GEOMDS_Commands::GEOMDS_Commands(const TDF_Label& Main) - : myLab(Main) -{ -} - - -//======================================================================= -// function : Generated() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::Generated(const TopoDS_Shape& S, - const TCollection_ExtendedString& Name) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Generated(S); - TDataStd_Name::Set(NewLab,Name); - return NewLab; -} - - - -//======================================================================= -// function : Generated() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::Generated(const TopoDS_Shape& S1, - const TopoDS_Shape& S2, - const TCollection_ExtendedString& Name) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Generated(S1,S2); - TDataStd_Name::Set(NewLab,Name); - return NewLab; -} - - - -//======================================================================= -// function : AddShape() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::AddShape(const TopoDS_Shape& S, - const TCollection_ExtendedString& Name) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab,Name); - return NewLab; -} - - -//======================================================================= -// function : AddIndependentShape() -// purpose : SAME than AddShape() : will be renamed later -//======================================================================= -TDF_Label GEOMDS_Commands::AddIndependentShape(const TopoDS_Shape& S, - const TCollection_AsciiString& nameIOR) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab, nameIOR); - return NewLab; -} - - -//======================================================================= -// function : AddDependentShape() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::AddDependentShape(const TopoDS_Shape& S, - const TCollection_AsciiString& nameIOR, - const TDF_Label& mainLab) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab, nameIOR); - /* NewLab has a reference attribute to mainLab (the main shape in fact) */ - TDF_Reference::Set(NewLab, mainLab) ; - return NewLab; -} - - - -//======================================================================= -// function : AddConstructiveElement() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::AddConstructiveElement(const TopoDS_Shape& S, - const TCollection_ExtendedString& nameIOR, - const GEOMDS_ConstructiveType& aType) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab, nameIOR); - /* Add the Attribute Constructive Element coded with a TDataStd_Integer from an enum */ - TDataStd_Integer::Set(NewLab, Standard_Integer(aType)); - return NewLab; -} - - -//======================================================================= -// function : AddIORNameAttribute() -// purpose : Add attribute TDataStd_Name to a label -// : this attribute represents the name/IOR of object -// : Return false if attribute exist before -//======================================================================= -Standard_Boolean GEOMDS_Commands::AddIORNameAttribute(const TDF_Label& aLabel, - const TCollection_ExtendedString& nameIOR) -{ - if( this->HasIOR(aLabel) ) - return false ; - TDataStd_Name::Set(aLabel, nameIOR); - return true ; -} - - - -//======================================================================= -// function : IsConstructiveElement() 1/2 -// purpose : Return true if 'aLabel' is a constructive element -//======================================================================= -Standard_Boolean GEOMDS_Commands::IsConstructiveElement(const TDF_Label& aLabel) -{ - Handle(TDataStd_Integer) anAttType ; - if( aLabel.FindAttribute(TDataStd_Integer::GetID(), anAttType ) ) - return true ; - return false; -} - - -//======================================================================= -// function : IsConstructiveElement() 2/2 -// purpose : Return true if 'aLabel' is a constructive element and return the -// : topology ' returnTopo' and type 'returnType' -//======================================================================= -Standard_Boolean GEOMDS_Commands::IsConstructiveElement(const TDF_Label& aLabel, - TopoDS_Shape& returnTopo, - GEOMDS_ConstructiveType& returnType) -{ - Handle(TDataStd_Integer) anAttType ; - Handle(TNaming_NamedShape) anAttTopo ; - - if( aLabel.FindAttribute(TDataStd_Integer::GetID(), anAttType) && aLabel.FindAttribute(TNaming_NamedShape::GetID(), anAttTopo)) { - - returnTopo = TNaming_Tool::GetShape(anAttTopo) ; - returnType = GEOMDS_ConstructiveType( anAttType->Get() ) ; - return true ; - } - return false; -} - - -//======================================================================= -// function : GetShape() -// purpose : return true and 'returnTopo' if a topology is found on 'aLabel' -//======================================================================= -Standard_Boolean GEOMDS_Commands::GetShape(const TDF_Label& aLabel, - TopoDS_Shape& returnTopo) -{ - Handle(TNaming_NamedShape) anAttTopo ; - if( aLabel.FindAttribute(TNaming_NamedShape::GetID(), anAttTopo)) { - returnTopo = TNaming_Tool::GetShape(anAttTopo) ; - return true ; - } - return false; -} - - -//======================================================================= -// function : IsDependentShape() -// purpose : return true if the shape in the label is dependant (a sub shape) -//======================================================================= -Standard_Boolean GEOMDS_Commands::IsDependentShape(const TDF_Label& aLabel) -{ - Handle(TDF_Reference) anAttRef ; - if( aLabel.FindAttribute(TDF_Reference::GetID(), anAttRef)) - return true ; - return false; -} - - - -//======================================================================= -// function : GetMainShapeLabel() -// purpose : return true if an attribute Reference is found for 'aLabel' -// : so 'returnMainLabel' is defined. 'aLabel' is supposed to be -// : a dependent object, otherwise return false. -//======================================================================= -Standard_Boolean GEOMDS_Commands::GetMainShapeLabel(const TDF_Label& aLabel, - TDF_Label& returnMainLabel) -{ - Handle(TDF_Reference) anAttRef ; - if( aLabel.FindAttribute(TDF_Reference::GetID(), anAttRef)) { - returnMainLabel = anAttRef->Get() ; - return true ; - } - return false; -} - - -//======================================================================= -// function : ClearAllIOR() -// purpose : Clear all IOR from aLabel usually the main label. -// : Useful before reconstruction after a load of a document. -// : IOR is the attribute often called 'name' or 'nameIOR' -//======================================================================= -Standard_Boolean GEOMDS_Commands::ClearAllIOR(const TDF_Label& aLabel) -{ - TDF_ChildIterator it; - Handle(TDataStd_Name) anAttName ; - bool notTested = false ; - for( it.Initialize(aLabel, Standard_False); it.More(); it.Next() ) { - TDF_Label L = it.Value() ; - if( L.FindAttribute(TDataStd_Name::GetID(), anAttName) ) { - notTested = L.ForgetAttribute(TDataStd_Name::GetID()) ; - } - if(notTested) - MESSAGE("in GEOMDS_Commands::ClearAllIOR : IOR CLEARED" ) - } - return true ; -} - - -//======================================================================= -// function : HasIOR() -// purpose : Return true is 'aLabel' has an attribute IOR (nameIOR) -//======================================================================= -Standard_Boolean GEOMDS_Commands::HasIOR(const TDF_Label& aLabel) -{ - Handle(TDataStd_Name) anAttName ; - if( !aLabel.FindAttribute(TDataStd_Name::GetID(), anAttName) ) - return false ; - return true ; -} - -//======================================================================= -// function : ReturnNameIOR() -// purpose : Return true is 'aLabel' has an attribute IOR (nameIOR) -// : and define 'returnNameIOR' -//======================================================================= -Standard_Boolean GEOMDS_Commands::ReturnNameIOR(const TDF_Label& aLabel, - TCollection_ExtendedString& returnNameIOR) -{ - Handle(TDataStd_Name) anAttName ; - if( !aLabel.FindAttribute(TDataStd_Name::GetID(), anAttName) ) - return false ; - else { - returnNameIOR = anAttName->Get() ; - return true ; - } -} diff --git a/GEOMDS/GEOMDS_Commands.hxx b/GEOMDS/GEOMDS_Commands.hxx deleted file mode 100644 index 0e2403920..000000000 --- a/GEOMDS/GEOMDS_Commands.hxx +++ /dev/null @@ -1,150 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GeomDS_Commands.hxx -// Author : Yves FRICAUD/Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef _GEOMDS_Commands_HeaderFile -#define _GEOMDS_Commands_HeaderFile - -#ifndef _TDF_Label_HeaderFile -#include -#endif -class TDF_Label; -class TopoDS_Shape; -class TCollection_ExtendedString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - - -//============================================================================ -// class : GEOMDS_Commands -// purpose : -//============================================================================ -class GEOMDS_Commands { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // inline void operator delete(void *anAddress, size_t size) - // { - // if (anAddress) Standard::Free((Standard_Address&)anAddress,size); - // } - // Methods PUBLIC - // - - // used for specific entities - enum GEOMDS_ConstructiveType { VECTOR, LINE, PLANE } ; - - // Methods to add or create items in the data structure - Standard_EXPORT GEOMDS_Commands(const TDF_Label& Main); - Standard_EXPORT TDF_Label AddShape(const TopoDS_Shape& S, - const TCollection_ExtendedString& Name) ; - - Standard_EXPORT TDF_Label Generated(const TopoDS_Shape& S, - const TCollection_ExtendedString& Name) ; - Standard_EXPORT TDF_Label Generated(const TopoDS_Shape& S1, - const TopoDS_Shape& S2, - const TCollection_ExtendedString& Name) ; - - /* Shapes construction */ - Standard_EXPORT TDF_Label AddIndependentShape(const TopoDS_Shape& S, - const TCollection_AsciiString& nameIOR) ; - Standard_EXPORT TDF_Label AddDependentShape(const TopoDS_Shape& S, - const TCollection_AsciiString& nameIOR, - const TDF_Label& mainLab) ; - Standard_EXPORT TDF_Label AddConstructiveElement(const TopoDS_Shape& S, - const TCollection_ExtendedString& nameIOR, - const GEOMDS_ConstructiveType& aType); - - Standard_EXPORT Standard_Boolean AddIORNameAttribute(const TDF_Label& aLabel, - const TCollection_ExtendedString& nameIOR) ; - - /* Shapes query */ - - Standard_EXPORT Standard_Boolean IsConstructiveElement(const TDF_Label& aLabel) ; - - Standard_EXPORT Standard_Boolean IsConstructiveElement(const TDF_Label& aLabel, - TopoDS_Shape& returnTopo, - GEOMDS_ConstructiveType& returnType) ; - - Standard_EXPORT Standard_Boolean GetShape(const TDF_Label& aLabel, - TopoDS_Shape& returnTopo) ; - - Standard_EXPORT Standard_Boolean IsDependentShape(const TDF_Label& aLabel) ; - - Standard_EXPORT Standard_Boolean GetMainShapeLabel(const TDF_Label& aLabel, - TDF_Label& returnMainLabel) ; - - Standard_EXPORT Standard_Boolean ClearAllIOR(const TDF_Label& aLabel) ; - - Standard_EXPORT Standard_Boolean HasIOR(const TDF_Label& aLabel) ; - - Standard_EXPORT Standard_Boolean ReturnNameIOR(const TDF_Label& aLabel, - TCollection_ExtendedString& returnNameIOR) ; - -protected: - - // Methods PROTECTED - // - - // Fields PROTECTED - // - -private: - - // Methods PRIVATE - // - - // Fields PRIVATE - // - - TDF_Label myLab; - -}; - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMDS/GEOMDS_Commands.ixx b/GEOMDS/GEOMDS_Commands.ixx deleted file mode 100644 index 09d333363..000000000 --- a/GEOMDS/GEOMDS_Commands.ixx +++ /dev/null @@ -1,31 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Commands.ixx -// Module : GEOM - -#include "GEOMDS_Commands.jxx" - - - - diff --git a/GEOMDS/GEOMDS_Commands.jxx b/GEOMDS/GEOMDS_Commands.jxx deleted file mode 100644 index 017dcd329..000000000 --- a/GEOMDS/GEOMDS_Commands.jxx +++ /dev/null @@ -1,38 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Commands.jxx -// Module : GEOM - -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _GEOMDS_Commands_HeaderFile -#include "GEOMDS_Commands.hxx" -#endif \ No newline at end of file diff --git a/GEOMDS/GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient.hxx b/GEOMDS/GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient.hxx deleted file mode 100644 index b391e99fa..000000000 --- a/GEOMDS/GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient.hxx -// Module : GEOM - -#ifndef _GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_HeaderFile -#define _GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_Standard_Transient_HeaderFile -#include -#endif -#ifndef _Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile -#include "Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx" -#endif -class Standard_NoSuchObject; -class Standard_Transient; -class TColStd_MapIntegerHasher; -class GEOMDS_DataMapOfIntegerTransient; -class GEOMDS_DataMapNodeOfDataMapOfIntegerTransient; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient : public TCollection_BasicMapIterator { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient(); -Standard_EXPORT GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient(const GEOMDS_DataMapOfIntegerTransient& aMap); -Standard_EXPORT void Initialize(const GEOMDS_DataMapOfIntegerTransient& aMap) ; -Standard_EXPORT const Standard_Integer& Key() const; -Standard_EXPORT const Handle_Standard_Transient& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMDS/GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_0.cxx b/GEOMDS/GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_0.cxx deleted file mode 100644 index 24cb9de3d..000000000 --- a/GEOMDS/GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_0.cxx +++ /dev/null @@ -1,62 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_0.cxx -// Module : GEOM - -using namespace std; -#include "GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient.hxx" - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _Standard_Transient_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _GEOMDS_DataMapOfIntegerTransient_HeaderFile -#include "GEOMDS_DataMapOfIntegerTransient.hxx" -#endif -#ifndef _GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile -#include "GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx" -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem Handle_Standard_Transient -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_Type_() GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_Type_() -#define TCollection_DataMap GEOMDS_DataMapOfIntegerTransient -#define TCollection_DataMap_hxx -#include - diff --git a/GEOMDS/GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx b/GEOMDS/GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx deleted file mode 100644 index 437a40015..000000000 --- a/GEOMDS/GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx +++ /dev/null @@ -1,152 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx -// Module : GEOM - -#ifndef _GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile -#define _GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile -#include "Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx" -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_Standard_Transient_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class Standard_Transient; -class TColStd_MapIntegerHasher; -class GEOMDS_DataMapOfIntegerTransient; -class GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient; - - -class GEOMDS_DataMapNodeOfDataMapOfIntegerTransient : public TCollection_MapNode { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT inline GEOMDS_DataMapNodeOfDataMapOfIntegerTransient(const Standard_Integer& K,const Handle(Standard_Transient)& I,const TCollection_MapNodePtr& n); -Standard_EXPORT inline Standard_Integer& Key() const; -Standard_EXPORT inline Handle_Standard_Transient& Value() const; -Standard_EXPORT ~GEOMDS_DataMapNodeOfDataMapOfIntegerTransient(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myKey; -Handle_Standard_Transient myValue; - - -}; - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem Handle_Standard_Transient -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_Type_() GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_Type_() -#define TCollection_DataMap GEOMDS_DataMapOfIntegerTransient -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMDS/GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_0.cxx b/GEOMDS/GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_0.cxx deleted file mode 100644 index 12f74127c..000000000 --- a/GEOMDS/GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_0.cxx +++ /dev/null @@ -1,111 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_0.cxx -// Module : GEOM - -using namespace std; -#include "GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _Standard_Transient_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _GEOMDS_DataMapOfIntegerTransient_HeaderFile -#include "GEOMDS_DataMapOfIntegerTransient.hxx" -#endif -#ifndef _GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_HeaderFile -#include "GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient.hxx" -#endif -GEOMDS_DataMapNodeOfDataMapOfIntegerTransient::~GEOMDS_DataMapNodeOfDataMapOfIntegerTransient() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMDS_DataMapNodeOfDataMapOfIntegerTransient", - sizeof(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient) Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient))) { - _anOtherObject = Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)((Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMDS_DataMapNodeOfDataMapOfIntegerTransient::DynamicType() const -{ - return STANDARD_TYPE(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient) ; -} -Standard_Boolean GEOMDS_DataMapNodeOfDataMapOfIntegerTransient::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient::~Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient() {} -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem Handle_Standard_Transient -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_Type_() GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_Type_() -#define TCollection_DataMap GEOMDS_DataMapOfIntegerTransient -#define TCollection_DataMap_hxx -#include - diff --git a/GEOMDS/GEOMDS_DataMapOfIntegerTransient.hxx b/GEOMDS/GEOMDS_DataMapOfIntegerTransient.hxx deleted file mode 100644 index 52fb4b920..000000000 --- a/GEOMDS/GEOMDS_DataMapOfIntegerTransient.hxx +++ /dev/null @@ -1,140 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_DataMapOfIntegerTransient.hxx -// Module : GEOM - -#ifndef _GEOMDS_DataMapOfIntegerTransient_HeaderFile -#define _GEOMDS_DataMapOfIntegerTransient_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_Standard_Transient_HeaderFile -#include -#endif -#ifndef _Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile -#include "Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx" -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class Standard_Transient; -class TColStd_MapIntegerHasher; -class GEOMDS_DataMapNodeOfDataMapOfIntegerTransient; -class GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class GEOMDS_DataMapOfIntegerTransient : public TCollection_BasicMap { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT GEOMDS_DataMapOfIntegerTransient(const Standard_Integer NbBuckets = 1); -Standard_EXPORT GEOMDS_DataMapOfIntegerTransient& Assign(const GEOMDS_DataMapOfIntegerTransient& Other) ; -GEOMDS_DataMapOfIntegerTransient& operator =(const GEOMDS_DataMapOfIntegerTransient& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~GEOMDS_DataMapOfIntegerTransient() -{ - Clear(); -} - -Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const Handle(Standard_Transient)& I) ; -Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; -Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; -Standard_EXPORT const Handle_Standard_Transient& Find(const Standard_Integer& K) const; - const Handle_Standard_Transient& operator()(const Standard_Integer& K) const -{ - return Find(K); -} - -Standard_EXPORT Handle_Standard_Transient& ChangeFind(const Standard_Integer& K) ; - Handle_Standard_Transient& operator()(const Standard_Integer& K) -{ - return ChangeFind(K); -} - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - Standard_EXPORT GEOMDS_DataMapOfIntegerTransient(const GEOMDS_DataMapOfIntegerTransient& Other); - - -// Fields PRIVATE -// - - -}; - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMDS/GEOMDS_DataMapOfIntegerTransient_0.cxx b/GEOMDS/GEOMDS_DataMapOfIntegerTransient_0.cxx deleted file mode 100644 index da4ed5f16..000000000 --- a/GEOMDS/GEOMDS_DataMapOfIntegerTransient_0.cxx +++ /dev/null @@ -1,65 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_DataMapOfIntegerTransient_0.cxx -// Module : GEOM - -using namespace std; -#include "GEOMDS_DataMapOfIntegerTransient.hxx" - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _Standard_Transient_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile -#include "GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx" -#endif -#ifndef _GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_HeaderFile -#include "GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient.hxx" -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem Handle_Standard_Transient -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient -#define TCollection_DataMapNode_Type_() GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_Type_() -#define TCollection_DataMap GEOMDS_DataMapOfIntegerTransient -#define TCollection_DataMap_hxx -#include - diff --git a/GEOMDS/GEOMDS_Explorer.cdl b/GEOMDS/GEOMDS_Explorer.cdl deleted file mode 100644 index eb737cf95..000000000 --- a/GEOMDS/GEOMDS_Explorer.cdl +++ /dev/null @@ -1,52 +0,0 @@ --- GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management --- --- 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 : GEOMDS_Explorer.cdl --- Author : Yves FRICAUD --- Module : GEOM - -class Explorer from GEOMDS - - ---Purpose: - -uses - ChildIterator from TDF, - Label from TDF, - ExtendedString from TCollection, - Shape from TopoDS - - -is - Create ( Main : Label from TDF) returns Explorer from GEOMDS; - - More(me : in out) returns Boolean from Standard; - - Next(me : in out); - - Shape(me)returns Shape from TopoDS; - - Name(me) returns ExtendedString from TCollection; - -fields - myChildIterator : ChildIterator from TDF; -end Explorer; diff --git a/GEOMDS/GEOMDS_Explorer.cxx b/GEOMDS/GEOMDS_Explorer.cxx deleted file mode 100644 index 8a40ff226..000000000 --- a/GEOMDS/GEOMDS_Explorer.cxx +++ /dev/null @@ -1,126 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Explorer.cxx -// Author : Yves FRICAUD -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOMDS_Explorer.ixx" - -#include -#include -#include - - -//======================================================================= -//function : GEOMDS_Explorer -//purpose : -//======================================================================= - -GEOMDS_Explorer::GEOMDS_Explorer(const TDF_Label& Main) : myChildIterator(Main) -{ -} - - -//======================================================================= -//function : const; -//purpose : -//======================================================================= - -Standard_Boolean GEOMDS_Explorer::More() -{ - if (!myChildIterator.More()) - return 0; - Handle(TDataStd_Name) Att; - Handle(TNaming_NamedShape) NS; - TDF_Label L = myChildIterator.Value(); - if (( L.FindAttribute(TDataStd_Name::GetID(),Att) ) || - (L.FindAttribute(TNaming_NamedShape::GetID(),NS)) - ) - return 1; - // myChildIterator.Next(); - // More(); - return 0; - /* - if (!myChildIterator.More()) - return 0; - TDF_Label L = myChildIterator.Value(); - Handle(TNaming_NamedShape) NS; - for (TDF_ChildIterator it2(L); it2.More(); it2.Next()) { - TDF_Label L2 = it2.Value(); - if (L2.FindAttribute(TNaming_NamedShape::GetID(),NS)) { - return 1; - } - myChildIterator.Next(); - } - return 0; - */ -} - - -//======================================================================= -//function : Next -//purpose : -//======================================================================= - -void GEOMDS_Explorer::Next() -{ - myChildIterator.Next(); -} - - -//======================================================================= -//function : Shape -//purpose : -//======================================================================= - -TopoDS_Shape GEOMDS_Explorer::Shape() const -{ - Handle(TNaming_NamedShape) NS; - TDF_Label L = myChildIterator.Value(); - L.FindAttribute(TNaming_NamedShape::GetID(),NS); - TopoDS_Shape S = TNaming_Tool::GetShape(NS); - return S; -} - -//======================================================================= -//function : Name -//purpose : -//======================================================================= - -TCollection_ExtendedString GEOMDS_Explorer::Name() const -{ - TDF_Label L = myChildIterator.Value(); - Handle(TDataStd_Name) Att; - if ( L.FindAttribute(TDataStd_Name::GetID(),Att) ) - //L.FindAttribute(TDataStd_Name::GetID(),Att); - return Att->Get(); - else - return TCollection_ExtendedString(); -} - - - - diff --git a/GEOMDS/GEOMDS_Explorer.hxx b/GEOMDS/GEOMDS_Explorer.hxx deleted file mode 100644 index 29ce10bc9..000000000 --- a/GEOMDS/GEOMDS_Explorer.hxx +++ /dev/null @@ -1,101 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Explorer.hxx -// Module : GEOM - -#ifndef _GEOMDS_Explorer_HeaderFile -#define _GEOMDS_Explorer_HeaderFile - -#ifndef _TDF_ChildIterator_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class TDF_Label; -class TopoDS_Shape; -class TCollection_ExtendedString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class GEOMDS_Explorer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT GEOMDS_Explorer(const TDF_Label& Main); -Standard_EXPORT Standard_Boolean More() ; -Standard_EXPORT void Next() ; -Standard_EXPORT TopoDS_Shape Shape() const; -Standard_EXPORT TCollection_ExtendedString Name() const; - -protected: - - // Methods PROTECTED - // - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - // Fields PRIVATE - // -TDF_ChildIterator myChildIterator; - - -}; - - -// other inline functions and methods (like "C++: function call" methods) -// - -#endif diff --git a/GEOMDS/GEOMDS_Explorer.ixx b/GEOMDS/GEOMDS_Explorer.ixx deleted file mode 100644 index cd182b147..000000000 --- a/GEOMDS/GEOMDS_Explorer.ixx +++ /dev/null @@ -1,31 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Explorer.ixx -// Module : GEOM - -#include "GEOMDS_Explorer.jxx" - - - - diff --git a/GEOMDS/GEOMDS_Explorer.jxx b/GEOMDS/GEOMDS_Explorer.jxx deleted file mode 100644 index 3a0770d28..000000000 --- a/GEOMDS/GEOMDS_Explorer.jxx +++ /dev/null @@ -1,38 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : GEOMDS_Explorer.jxx -// Module : GEOM - -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _GEOMDS_Explorer_HeaderFile -#include "GEOMDS_Explorer.hxx" -#endif diff --git a/GEOMDS/Handle_GEOMDS_Application.hxx b/GEOMDS/Handle_GEOMDS_Application.hxx deleted file mode 100644 index 418b10298..000000000 --- a/GEOMDS/Handle_GEOMDS_Application.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : Handle_GEOMDS_Application.hxx -// Module : GEOM - -#ifndef _Handle_GEOMDS_Application_HeaderFile -#define _Handle_GEOMDS_Application_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDocStd_Application_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDocStd_Application); -class GEOMDS_Application; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SimpleOCAF_Application); - -class Handle(GEOMDS_Application) : public Handle(TDocStd_Application) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(GEOMDS_Application)():Handle(TDocStd_Application)() {} - Handle(GEOMDS_Application)(const Handle(GEOMDS_Application)& aHandle) : Handle(TDocStd_Application)(aHandle) - { - } - - Handle(GEOMDS_Application)(const GEOMDS_Application* anItem) : Handle(TDocStd_Application)((TDocStd_Application *)anItem) - { - } - - Handle(GEOMDS_Application)& operator=(const Handle(GEOMDS_Application)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMDS_Application)& operator=(const GEOMDS_Application* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMDS_Application* operator->() - { - return (GEOMDS_Application *)ControlAccess(); - } - - GEOMDS_Application* operator->() const - { - return (GEOMDS_Application *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMDS_Application)(); - - Standard_EXPORT static const Handle(GEOMDS_Application) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/GEOMDS/Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx b/GEOMDS/Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx deleted file mode 100644 index 911d6a490..000000000 --- a/GEOMDS/Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -// -// 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 : Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx -// Module : GEOM - -#ifndef _Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile -#define _Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMDS_DataMapNodeOfDataMapOfIntegerTransient; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient); - -class Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient) : public Handle(TCollection_MapNode) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)():Handle(TCollection_MapNode)() {} - Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)(const Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)(const GEOMDS_DataMapNodeOfDataMapOfIntegerTransient* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)& operator=(const Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)& operator=(const GEOMDS_DataMapNodeOfDataMapOfIntegerTransient* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMDS_DataMapNodeOfDataMapOfIntegerTransient* operator->() - { - return (GEOMDS_DataMapNodeOfDataMapOfIntegerTransient *)ControlAccess(); - } - - GEOMDS_DataMapNodeOfDataMapOfIntegerTransient* operator->() const - { - return (GEOMDS_DataMapNodeOfDataMapOfIntegerTransient *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient)(); - - Standard_EXPORT static const Handle(GEOMDS_DataMapNodeOfDataMapOfIntegerTransient) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/GEOMDS/Makefile.in b/GEOMDS/Makefile.in deleted file mode 100644 index 7fbc42390..000000000 --- a/GEOMDS/Makefile.in +++ /dev/null @@ -1,74 +0,0 @@ -# GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management -# -# 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 : Makefile.in -# Author : Patrick GOLDBRONN (CEA) -# Module : GEOM -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@top_srcdir@/idl - - -@COMMENCE@ - -# Libraries targets - -LIB = libGeometryDS.la -LIB_SRC = GEOMDS_Application.cxx \ - GEOMDS_Commands.cxx \ - GEOMDS_Explorer.cxx \ - GEOMDS_DataMapIteratorOfDataMapOfIntegerTransient_0.cxx \ - GEOMDS_DataMapNodeOfDataMapOfIntegerTransient_0.cxx \ - GEOMDS_DataMapOfIntegerTransient_0.cxx -LIB_CLIENT_IDL = -LIB_SERVER_IDL = - -# Executables targets -BIN = -BIN_SRC = -BIN_CLIENT_IDL = -BIN_SERVER_IDL = - -# header files -EXPORT_HEADERS= GEOMDS_Application.hxx \ - GEOMDS_DataMapOfIntegerTransient.hxx \ - Handle_GEOMDS_DataMapNodeOfDataMapOfIntegerTransient.hxx \ - Handle_GEOMDS_Application.hxx \ - GEOMDS_Commands.hxx \ - GEOMDS_Explorer.hxx - -# additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) -CXXFLAGS += $(OCC_CXXFLAGS) -LDFLAGS += $(OCC_LIBS) - -# additional file to be cleaned -MOSTLYCLEAN = -CLEAN = -DISTCLEAN = - -@CONCLUDE@ - diff --git a/GEOMFiltersSelection/GEOM_EdgeFilter.cxx b/GEOMFiltersSelection/GEOM_EdgeFilter.cxx deleted file mode 100644 index e61d3d30f..000000000 --- a/GEOMFiltersSelection/GEOM_EdgeFilter.cxx +++ /dev/null @@ -1,134 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_EdgeFilter.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_EdgeFilter.ixx" -#include "GEOM_Client.hxx" - -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "GEOM_ShapeTypeFilter.hxx" -#include "SALOME_TypeFilter.hxx" - -#include "utilities.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Study.h" - -// Open CASCADE Includes -#include -#include -#include -#include - - -static GEOM_Client ShapeReader; - - -/*! - enumeration TypeOfEdge is AnyEdge,Line,Circle; -*/ -GEOM_EdgeFilter::GEOM_EdgeFilter(const StdSelect_TypeOfEdge Edge, - GEOM::GEOM_Gen_ptr geom) -{ - myKind = Edge; - myComponentGeom = GEOM::GEOM_Gen::_narrow(geom); -} - -Standard_Boolean GEOM_EdgeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const -{ - Handle(SALOME_TypeFilter) GeomFilter = new SALOME_TypeFilter( "GEOM" ); - if ( !GeomFilter->IsOk(anObj) ) - return false; - - Handle(GEOM_ShapeTypeFilter) GeomShapeTypeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myComponentGeom ); - if ( !GeomShapeTypeFilter->IsOk(anObj) ) - return false; - - if ( anObj->hasEntry() ) { - QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->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 aShape = myComponentGeom->GetIORFromString( anIOR->Value() ); - if ( aShape->_is_nil() ) - return false; - - TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape ); - if ( Shape.IsNull() ) - return false; - - switch (myKind) { - case StdSelect_AnyEdge: - return Standard_True; - case StdSelect_Line: - { - BRepAdaptor_Curve curv(TopoDS::Edge(Shape)); - return (curv.GetType() == GeomAbs_Line); - } - break; - case StdSelect_Circle: - BRepAdaptor_Curve curv(TopoDS::Edge(Shape)); - return (curv.GetType() == GeomAbs_Circle); - } - } - } - } - - if ( anObj->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GObject = - Handle(GEOM_InteractiveObject)::DownCast(anObj); - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GObject->getIOR() ); - if ( aShape->_is_nil() ) - return false; - - TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape ); - if ( Shape.IsNull() ) - return false; - - switch (myKind) { - case StdSelect_AnyEdge: - return Standard_True; - case StdSelect_Line: - { - BRepAdaptor_Curve curv(TopoDS::Edge(Shape)); - return (curv.GetType() == GeomAbs_Line); - } - break; - case StdSelect_Circle: - BRepAdaptor_Curve curv(TopoDS::Edge(Shape)); - return (curv.GetType() == GeomAbs_Circle); - } - } - return false; -} diff --git a/GEOMFiltersSelection/GEOM_EdgeFilter.hxx b/GEOMFiltersSelection/GEOM_EdgeFilter.hxx deleted file mode 100644 index a464cdae9..000000000 --- a/GEOMFiltersSelection/GEOM_EdgeFilter.hxx +++ /dev/null @@ -1,117 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_EdgeFilter.hxx -// Module : GEOM - -#ifndef _GEOM_EdgeFilter_HeaderFile -#define _GEOM_EdgeFilter_HeaderFile - -#ifndef _Handle_GEOM_EdgeFilter_HeaderFile -#include "Handle_GEOM_EdgeFilter.hxx" -#endif - -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_Filter.hxx" - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Shape) -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -// Open CASCADE Includes -#include -#include -#include -#include - -class GEOM_EdgeFilter : public SALOME_Filter { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT GEOM_EdgeFilter(const StdSelect_TypeOfEdge Edge, - GEOM::GEOM_Gen_ptr geom); - -Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const; -Standard_EXPORT ~GEOM_EdgeFilter(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOM_EdgeFilter_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -StdSelect_TypeOfEdge myKind; -GEOM::GEOM_Gen_var myComponentGeom; - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMFiltersSelection/GEOM_EdgeFilter.ixx b/GEOMFiltersSelection/GEOM_EdgeFilter.ixx deleted file mode 100644 index 9e028014b..000000000 --- a/GEOMFiltersSelection/GEOM_EdgeFilter.ixx +++ /dev/null @@ -1,83 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_EdgeFilter.ixx -// Module : GEOM - -#include "GEOM_EdgeFilter.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -GEOM_EdgeFilter::~GEOM_EdgeFilter() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOM_EdgeFilter_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_Filter); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_Filter); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOM_EdgeFilter", - sizeof(GEOM_EdgeFilter), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOM_EdgeFilter) Handle(GEOM_EdgeFilter)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOM_EdgeFilter) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOM_EdgeFilter))) { - _anOtherObject = Handle(GEOM_EdgeFilter)((Handle(GEOM_EdgeFilter)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOM_EdgeFilter::DynamicType() const -{ - return STANDARD_TYPE(GEOM_EdgeFilter) ; -} -Standard_Boolean GEOM_EdgeFilter::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(GEOM_EdgeFilter) == AType || SALOME_Filter::IsKind(AType)); -} -Handle_GEOM_EdgeFilter::~Handle_GEOM_EdgeFilter() {} - diff --git a/GEOMFiltersSelection/GEOM_EdgeFilter.jxx b/GEOMFiltersSelection/GEOM_EdgeFilter.jxx deleted file mode 100644 index 267be7964..000000000 --- a/GEOMFiltersSelection/GEOM_EdgeFilter.jxx +++ /dev/null @@ -1,29 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_EdgeFilter.jxx -// Module : GEOM - -#ifndef _GEOM_EdgeFilter_HeaderFile -#include "GEOM_EdgeFilter.hxx" -#endif diff --git a/GEOMFiltersSelection/GEOM_FaceFilter.cxx b/GEOMFiltersSelection/GEOM_FaceFilter.cxx deleted file mode 100644 index aca4648e4..000000000 --- a/GEOMFiltersSelection/GEOM_FaceFilter.cxx +++ /dev/null @@ -1,184 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_FaceFilter.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_FaceFilter.ixx" -#include "GEOM_Client.hxx" - -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "GEOM_ShapeTypeFilter.hxx" -#include "SALOME_TypeFilter.hxx" - -#include "utilities.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Study.h" - -// Open CASCADE Includes -#include -#include -#include -#include -#include - - -static GEOM_Client ShapeReader; - -/*! - enumeration TypeOfFace is AnyFace,Plane,Cylinder,Sphere,Torus,Revol,Cone; -*/ -GEOM_FaceFilter::GEOM_FaceFilter(const StdSelect_TypeOfFace Face, - GEOM::GEOM_Gen_ptr geom) -{ - myKind = Face; - myComponentGeom = GEOM::GEOM_Gen::_narrow(geom); -} - -Standard_Boolean GEOM_FaceFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const -{ - Handle(SALOME_TypeFilter) GeomFilter = new SALOME_TypeFilter( "GEOM" ); - if ( !GeomFilter->IsOk(anObj) ) - return false; - - Handle(GEOM_ShapeTypeFilter) GeomShapeTypeFilter = new GEOM_ShapeTypeFilter( TopAbs_FACE, myComponentGeom ); - if ( !GeomShapeTypeFilter->IsOk(anObj) ) - return false; - - if ( anObj->hasEntry() ) { - QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->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 aShape = myComponentGeom->GetIORFromString( anIOR->Value() ); - if ( aShape->_is_nil() ) - return false; - - TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape ); - if ( Shape.IsNull() ) - return false; - - switch (myKind) { - case StdSelect_AnyFace: - return Standard_True; - case StdSelect_Plane: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Plane); - } - case StdSelect_Cylinder: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Cylinder); - } - case StdSelect_Sphere: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Sphere); - } - case StdSelect_Torus: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return ( surf.GetType() == GeomAbs_Torus); - } - case StdSelect_Revol: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return ( surf.GetType() == GeomAbs_Cylinder || - surf.GetType() == GeomAbs_Cone || - surf.GetType() == GeomAbs_Torus || - surf.GetType() == GeomAbs_Sphere || - surf.GetType() == GeomAbs_SurfaceOfRevolution ); - } - case StdSelect_Cone: // en attendant la liberation du cdl, on l'utilise pour Cone - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Cone); - } - } - } - } - } - - if ( anObj->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GObject = - Handle(GEOM_InteractiveObject)::DownCast(anObj); - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GObject->getIOR() ); - if ( aShape->_is_nil() ) - return false; - - TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape ); - if ( Shape.IsNull() ) - return false; - - switch (myKind) { - case StdSelect_AnyFace: - return Standard_True; - case StdSelect_Plane: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Plane); - } - case StdSelect_Cylinder: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Cylinder); - } - case StdSelect_Sphere: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Sphere); - } - case StdSelect_Torus: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return ( surf.GetType() == GeomAbs_Torus); - } - case StdSelect_Revol: - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return ( surf.GetType() == GeomAbs_Cylinder || - surf.GetType() == GeomAbs_Cone || - surf.GetType() == GeomAbs_Torus || - surf.GetType() == GeomAbs_Sphere || - surf.GetType() == GeomAbs_SurfaceOfRevolution ); - } - case StdSelect_Cone: // en attendant la liberation du cdl, on l'utilise pour Cone - { - BRepAdaptor_Surface surf(TopoDS::Face(Shape)); - return (surf.GetType() == GeomAbs_Cone); - } - } - } - return false; -} diff --git a/GEOMFiltersSelection/GEOM_FaceFilter.hxx b/GEOMFiltersSelection/GEOM_FaceFilter.hxx deleted file mode 100644 index d81e27413..000000000 --- a/GEOMFiltersSelection/GEOM_FaceFilter.hxx +++ /dev/null @@ -1,117 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_FaceFilter.hxx -// Module : GEOM - -#ifndef _GEOM_FaceFilter_HeaderFile -#define _GEOM_FaceFilter_HeaderFile - -#ifndef _Handle_GEOM_FaceFilter_HeaderFile -#include "Handle_GEOM_FaceFilter.hxx" -#endif - -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_Filter.hxx" - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Shape) -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -// Open CASCADE Includes -#include -#include -#include -#include - -class GEOM_FaceFilter : public SALOME_Filter { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT GEOM_FaceFilter(const StdSelect_TypeOfFace Face, - GEOM::GEOM_Gen_ptr geom); - -Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const; -Standard_EXPORT ~GEOM_FaceFilter(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOM_FaceFilter_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -StdSelect_TypeOfFace myKind; -GEOM::GEOM_Gen_var myComponentGeom; - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMFiltersSelection/GEOM_FaceFilter.ixx b/GEOMFiltersSelection/GEOM_FaceFilter.ixx deleted file mode 100644 index f6404a0d3..000000000 --- a/GEOMFiltersSelection/GEOM_FaceFilter.ixx +++ /dev/null @@ -1,83 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_FaceFilter.ixx -// Module : GEOM - -#include "GEOM_FaceFilter.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -GEOM_FaceFilter::~GEOM_FaceFilter() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOM_FaceFilter_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_Filter); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_Filter); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOM_FaceFilter", - sizeof(GEOM_FaceFilter), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOM_FaceFilter) Handle(GEOM_FaceFilter)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOM_FaceFilter) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOM_FaceFilter))) { - _anOtherObject = Handle(GEOM_FaceFilter)((Handle(GEOM_FaceFilter)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOM_FaceFilter::DynamicType() const -{ - return STANDARD_TYPE(GEOM_FaceFilter) ; -} -Standard_Boolean GEOM_FaceFilter::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(GEOM_FaceFilter) == AType || SALOME_Filter::IsKind(AType)); -} -Handle_GEOM_FaceFilter::~Handle_GEOM_FaceFilter() {} - diff --git a/GEOMFiltersSelection/GEOM_FaceFilter.jxx b/GEOMFiltersSelection/GEOM_FaceFilter.jxx deleted file mode 100644 index 144d1a3f5..000000000 --- a/GEOMFiltersSelection/GEOM_FaceFilter.jxx +++ /dev/null @@ -1,29 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_FaceFilter.jxx -// Module : GEOM - -#ifndef _GEOM_FaceFilter_HeaderFile -#include "GEOM_FaceFilter.hxx" -#endif diff --git a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.cxx b/GEOMFiltersSelection/GEOM_ShapeTypeFilter.cxx deleted file mode 100644 index 6ca272b01..000000000 --- a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.cxx +++ /dev/null @@ -1,109 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_ShapeTypeFilter.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_ShapeTypeFilter.ixx" -#include "GEOM_Client.hxx" - -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "SALOME_TypeFilter.hxx" - -#include "utilities.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Study.h" - -static GEOM_Client ShapeReader; - -GEOM_ShapeTypeFilter::GEOM_ShapeTypeFilter(TopAbs_ShapeEnum ShapeType, - GEOM::GEOM_Gen_ptr geom) -{ - myKind = ShapeType; - myComponentGeom = GEOM::GEOM_Gen::_narrow(geom); -} - -Standard_Boolean GEOM_ShapeTypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const -{ - Handle(SALOME_TypeFilter) GeomFilter = new SALOME_TypeFilter( "GEOM" ); - if ( !GeomFilter->IsOk(anObj) ) - return false; - if ( anObj->hasEntry() ) { - QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->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 aShape = myComponentGeom->GetIORFromString( anIOR->Value() ); - if ( aShape->_is_nil() ) - return false; - - TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape ); - if ( Shape.IsNull() ) - return false; - - MESSAGE ( " myKind = " << myKind ); - MESSAGE ( " Shape.ShapeType = " << Shape.ShapeType() ); - if ( myKind == TopAbs_SHAPE ) - return true; - - if ( Shape.ShapeType() == myKind ) - return true; - else - return false; - } - } - } - - if ( anObj->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GObject = - Handle(GEOM_InteractiveObject)::DownCast(anObj); - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GObject->getIOR() ); - if ( aShape->_is_nil() ) - return false; - - TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape ); - if ( Shape.IsNull() ) - return false; - - MESSAGE ( " myKind = " << myKind ); - MESSAGE ( " Shape.ShapeType = " << Shape.ShapeType() ); - if ( myKind == TopAbs_SHAPE ) - return true; - - if ( Shape.ShapeType() == myKind ) - return true; - else - return false; - } - return false; -} diff --git a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.hxx b/GEOMFiltersSelection/GEOM_ShapeTypeFilter.hxx deleted file mode 100644 index ffbc4e115..000000000 --- a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.hxx +++ /dev/null @@ -1,115 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_ShapeTypeFilter.hxx -// Module : GEOM - -#ifndef _GEOM_ShapeTypeFilter_HeaderFile -#define _GEOM_ShapeTypeFilter_HeaderFile - -#ifndef _Handle_GEOM_ShapeTypeFilter_HeaderFile -#include "Handle_GEOM_ShapeTypeFilter.hxx" -#endif - -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_Filter.hxx" - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Shape) -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -// Open CASCADE Includes -#include -#include -#include - -class GEOM_ShapeTypeFilter : public SALOME_Filter { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT GEOM_ShapeTypeFilter(TopAbs_ShapeEnum ShapeType, - GEOM::GEOM_Gen_ptr geom); -Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const; -Standard_EXPORT ~GEOM_ShapeTypeFilter(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOM_ShapeTypeFilter_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopAbs_ShapeEnum myKind; -GEOM::GEOM_Gen_var myComponentGeom; - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.ixx b/GEOMFiltersSelection/GEOM_ShapeTypeFilter.ixx deleted file mode 100644 index db4643d12..000000000 --- a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.ixx +++ /dev/null @@ -1,83 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_ShapeTypeFilter.ixx -// Module : GEOM - -#include "GEOM_ShapeTypeFilter.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -GEOM_ShapeTypeFilter::~GEOM_ShapeTypeFilter() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOM_ShapeTypeFilter_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_Filter); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_Filter); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOM_ShapeTypeFilter", - sizeof(GEOM_ShapeTypeFilter), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOM_ShapeTypeFilter) Handle(GEOM_ShapeTypeFilter)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOM_ShapeTypeFilter) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOM_ShapeTypeFilter))) { - _anOtherObject = Handle(GEOM_ShapeTypeFilter)((Handle(GEOM_ShapeTypeFilter)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOM_ShapeTypeFilter::DynamicType() const -{ - return STANDARD_TYPE(GEOM_ShapeTypeFilter) ; -} -Standard_Boolean GEOM_ShapeTypeFilter::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(GEOM_ShapeTypeFilter) == AType || SALOME_Filter::IsKind(AType)); -} -Handle_GEOM_ShapeTypeFilter::~Handle_GEOM_ShapeTypeFilter() {} - diff --git a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.jxx b/GEOMFiltersSelection/GEOM_ShapeTypeFilter.jxx deleted file mode 100644 index 8a51985a1..000000000 --- a/GEOMFiltersSelection/GEOM_ShapeTypeFilter.jxx +++ /dev/null @@ -1,29 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : GEOM_ShapeTypeFilter.jxx -// Module : GEOM - -#ifndef _GEOM_ShapeTypeFilter_HeaderFile -#include "GEOM_ShapeTypeFilter.hxx" -#endif diff --git a/GEOMFiltersSelection/Handle_GEOM_EdgeFilter.hxx b/GEOMFiltersSelection/Handle_GEOM_EdgeFilter.hxx deleted file mode 100644 index 6c8dd9c28..000000000 --- a/GEOMFiltersSelection/Handle_GEOM_EdgeFilter.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : Handle_GEOM_EdgeFilter.hxx -// Module : GEOM - -#ifndef _Handle_GEOM_EdgeFilter_HeaderFile -#define _Handle_GEOM_EdgeFilter_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_SALOME_Filter_HeaderFile -#include "Handle_SALOME_Filter.hxx" -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(SALOME_Filter); -class GEOM_EdgeFilter; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_EdgeFilter); - -class Handle(GEOM_EdgeFilter) : public Handle(SALOME_Filter) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(GEOM_EdgeFilter)():Handle(SALOME_Filter)() {} - Handle(GEOM_EdgeFilter)(const Handle(GEOM_EdgeFilter)& aHandle) : Handle(SALOME_Filter)(aHandle) - { - } - - Handle(GEOM_EdgeFilter)(const GEOM_EdgeFilter* anItem) : Handle(SALOME_Filter)((SALOME_Filter *)anItem) - { - } - - Handle(GEOM_EdgeFilter)& operator=(const Handle(GEOM_EdgeFilter)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOM_EdgeFilter)& operator=(const GEOM_EdgeFilter* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOM_EdgeFilter* operator->() - { - return (GEOM_EdgeFilter *)ControlAccess(); - } - - GEOM_EdgeFilter* operator->() const - { - return (GEOM_EdgeFilter *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOM_EdgeFilter)(); - - Standard_EXPORT static const Handle(GEOM_EdgeFilter) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/GEOMFiltersSelection/Handle_GEOM_FaceFilter.hxx b/GEOMFiltersSelection/Handle_GEOM_FaceFilter.hxx deleted file mode 100644 index 3acc213ac..000000000 --- a/GEOMFiltersSelection/Handle_GEOM_FaceFilter.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : Handle_GEOM_FaceFilter.hxx -// Module : GEOM - -#ifndef _Handle_GEOM_FaceFilter_HeaderFile -#define _Handle_GEOM_FaceFilter_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_SALOME_Filter_HeaderFile -#include "Handle_SALOME_Filter.hxx" -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(SALOME_Filter); -class GEOM_FaceFilter; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_FaceFilter); - -class Handle(GEOM_FaceFilter) : public Handle(SALOME_Filter) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(GEOM_FaceFilter)():Handle(SALOME_Filter)() {} - Handle(GEOM_FaceFilter)(const Handle(GEOM_FaceFilter)& aHandle) : Handle(SALOME_Filter)(aHandle) - { - } - - Handle(GEOM_FaceFilter)(const GEOM_FaceFilter* anItem) : Handle(SALOME_Filter)((SALOME_Filter *)anItem) - { - } - - Handle(GEOM_FaceFilter)& operator=(const Handle(GEOM_FaceFilter)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOM_FaceFilter)& operator=(const GEOM_FaceFilter* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOM_FaceFilter* operator->() - { - return (GEOM_FaceFilter *)ControlAccess(); - } - - GEOM_FaceFilter* operator->() const - { - return (GEOM_FaceFilter *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOM_FaceFilter)(); - - Standard_EXPORT static const Handle(GEOM_FaceFilter) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/GEOMFiltersSelection/Handle_GEOM_ShapeTypeFilter.hxx b/GEOMFiltersSelection/Handle_GEOM_ShapeTypeFilter.hxx deleted file mode 100644 index d20bf6d96..000000000 --- a/GEOMFiltersSelection/Handle_GEOM_ShapeTypeFilter.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// 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 : Handle_GEOM_ShapeTypeFilter.hxx -// Module : GEOM - -#ifndef _Handle_GEOM_ShapeTypeFilter_HeaderFile -#define _Handle_GEOM_ShapeTypeFilter_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_SALOME_Filter_HeaderFile -#include "Handle_SALOME_Filter.hxx" -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(SALOME_Filter); -class GEOM_ShapeTypeFilter; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_ShapeTypeFilter); - -class Handle(GEOM_ShapeTypeFilter) : public Handle(SALOME_Filter) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(GEOM_ShapeTypeFilter)():Handle(SALOME_Filter)() {} - Handle(GEOM_ShapeTypeFilter)(const Handle(GEOM_ShapeTypeFilter)& aHandle) : Handle(SALOME_Filter)(aHandle) - { - } - - Handle(GEOM_ShapeTypeFilter)(const GEOM_ShapeTypeFilter* anItem) : Handle(SALOME_Filter)((SALOME_Filter *)anItem) - { - } - - Handle(GEOM_ShapeTypeFilter)& operator=(const Handle(GEOM_ShapeTypeFilter)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOM_ShapeTypeFilter)& operator=(const GEOM_ShapeTypeFilter* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOM_ShapeTypeFilter* operator->() - { - return (GEOM_ShapeTypeFilter *)ControlAccess(); - } - - GEOM_ShapeTypeFilter* operator->() const - { - return (GEOM_ShapeTypeFilter *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOM_ShapeTypeFilter)(); - - Standard_EXPORT static const Handle(GEOM_ShapeTypeFilter) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/GEOMFiltersSelection/Makefile.in b/GEOMFiltersSelection/Makefile.in deleted file mode 100644 index 61fc51808..000000000 --- a/GEOMFiltersSelection/Makefile.in +++ /dev/null @@ -1,65 +0,0 @@ -# GEOM GEOMFiltersSelection : filter selector for the viewer -# -# 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 : Makefile.in -# Author : Patrick GOLDBRONN (CEA) -# Module : GEOM -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@top_srcdir@/idl - - -@COMMENCE@ - -# Libraries targets - -LIB = libGeometryFiltersSelection.la -LIB_SRC = GEOM_ShapeTypeFilter.cxx \ - GEOM_FaceFilter.cxx \ - GEOM_EdgeFilter.cxx - -LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl GEOM_Shape.idl GEOM_Gen.idl - -# header files -EXPORT_HEADERS= GEOM_ShapeTypeFilter.hxx \ - Handle_GEOM_ShapeTypeFilter.hxx \ - GEOM_FaceFilter.hxx \ - Handle_GEOM_FaceFilter.hxx \ - GEOM_EdgeFilter.hxx \ - Handle_GEOM_EdgeFilter.hxx - -# additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -CXXFLAGS += $(OCC_CXXFLAGS) -LDFLAGS += $(OCC_LIBS) - -# additional file to be cleaned -MOSTLYCLEAN = -CLEAN = -DISTCLEAN = - -@CONCLUDE@ - diff --git a/GEOMGUI/GeometryGUI.cxx b/GEOMGUI/GeometryGUI.cxx deleted file mode 100644 index 0e86012f5..000000000 --- a/GEOMGUI/GeometryGUI.cxx +++ /dev/null @@ -1,7147 +0,0 @@ -// 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.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI.h" - -// SALOME Includes -# include "Utils_ORB_INIT.hxx" -# include "Utils_SINGLETON.hxx" - -#include "QAD.h" -#include "QAD_Tools.h" -#include "QAD_Config.h" -#include "QAD_Settings.h" -#include "QAD_RightFrame.h" -#include "QAD_MessageBox.h" -#include "QAD_Resource.h" -#include "QAD_FileDlg.h" - -#include "OCCViewer_ViewPort.h" -#include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_Viewer3d.h" - -#include "SALOME_NamingService.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_InteractiveObject.hxx" - -#include "SALOMEGUI_ImportOperation.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" -#include "SALOMEGUI_NameDlg.h" -#include "utilities.h" - -// Open CASCADE Includes -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//VRV: OCC 4.0 migration -#include -#include -#include -//#include -//VRV: OCC 4.0 migration - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -// QT Includes -#define INCLUDE_MENUITEM_DEF -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "VTKViewer_RenderWindowInteractor.h" -#include "VTKViewer_ViewFrame.h" -#include "GEOM_Actor.h" -#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_RevolDlg.h" // Method REVOL -#include "GeometryGUI_RotationDlg.h" // Method ROTATION -#include "GeometryGUI_TranslationDlg.h" // Method TRANSLATION -#include "GeometryGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION -#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_EdgeDlg.h" // Method GEOM::EDGE -#include "GeometryGUI_OrientationDlg.h" // Method ORIENTATION -#include "GeometryGUI_PartitionDlg.h" // Method PARTITION -#include "GeometryGUI_SubShapeDlg.h" // Method EXPLODE -#include "GeometryGUI_WireDlg.h" // Method GEOM::WIRE -#include "GeometryGUI_WorkingPlaneDlg.h" // Method WORKING PLANE -#include "GeometryGUI_PropertiesDlg.h" // Method PROPERTIES -#include "GeometryGUI_CenterMassDlg.h" // Method CENTER MASS -#include "GeometryGUI_InertiaDlg.h" // Method INERTIA -#include "GeometryGUI_FaceDlg.h" // Method GEOM::FACE -#include "GeometryGUI_FilletDlg.h" // Method FILLET -#include "GeometryGUI_ChamferDlg.h" // Method CHAMFER -#include "GeometryGUI_FillingHoleDlg.h" // Method FILLING HOLE -#include "GeometryGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES -#include "GeometryGUI_CheckShape.h" // Method CHECKSHAPE -#include "GeometryGUI_ArchimedeDlg.h" // Method ARCHIMEDE -#include "GeometryGUI_TransparencyDlg.h" // Method TRANSPARENCY adjustement -#include "GeometryGUI_NbIsosDlg.h" // Method ISOS adjustement -#include "GeometryGUI_BndBoxDlg.h" // Method BNDBOX -#include "GeometryGUI_MaxToleranceDlg.h" // Method MAXTOLERANCE -#include "GeometryGUI_WhatisDlg.h" // Method WHATIS -#include "GeometryGUI_DistanceDlg.h" // Method DISTANCE -#include "GeometryGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE - - -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. -//======================================================================= -class CustomItem : public QCustomMenuItem -{ -public: - CustomItem( const QString& s, const QFont& f ) - : string( s ), font( f ){}; - ~CustomItem(){} - - void paint( QPainter* p, const QColorGroup& /*cg*/, bool /*act*/, bool /*enabled*/, int x, int y, int w, int h ) - { - p->setFont ( font ); - p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string ); - } - - QSize sizeHint() - { - return QFontMetrics( font ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string ); - } -private: - QString string; - QFont font; -}; - - - - -//======================================================================= -// function : GeometryGUI() -// purpose : Constructor -//======================================================================= -GeometryGUI::GeometryGUI() : - QObject() -{ -} - -//======================================================================= -// function : ~GeometryGUI() -// purpose : Destructor -//======================================================================= -GeometryGUI::~GeometryGUI() -{ -} - - -//======================================================================= -// function : GetGeometryGUI() static -// purpose : Returns current 'GeomGUI' a static pointer -//======================================================================= -GeometryGUI* GeometryGUI::GetGeometryGUI( ) -{ - return GeomGUI; -} - - -//===================================================================================== -// function : GetIndex() -// purpose : Get the index of a sub shape in a main shape : index start at 1 -//===================================================================================== -int GeometryGUI::GetIndex(const TopoDS_Shape& subshape, - const TopoDS_Shape& shape, - int /*ShapeType*/) -{ - if( shape.IsNull() || subshape.IsNull() ) - return -1 ; - - int index = 1; - if (subshape.ShapeType() == TopAbs_COMPOUND) - { - TopoDS_Iterator it; - TopTools_ListOfShape CL; - CL.Append( shape ); - TopTools_ListIteratorOfListOfShape itC; - for (itC.Initialize( CL ); itC.More(); itC.Next()) - { - for (it.Initialize( itC.Value() ); it.More(); it.Next()) - { - if ( it.Value().ShapeType() == TopAbs_COMPOUND) - { - if (it.Value().IsSame(subshape)) - return index; - else - index++; - CL.Append( it.Value() ); - } - } - } - } - else - { - TopExp_Explorer Exp ( shape, subshape.ShapeType() ); - TopTools_MapOfShape M; - while ( Exp.More() ) - { - if ( M.Add(Exp.Current()) ) - { - if ( Exp.Current().IsSame(subshape) ) - return index; - index++; - } - Exp.Next(); - } - } - return -1; -} - -//======================================================================= -// function : GetOrCreateGeometryGUI() -// purpose : Gets or create an object 'GeometryGUI' with initialisations -// : Returns 'GeomGUI' as a pointer -//======================================================================= -GeometryGUI* GeometryGUI::GetOrCreateGeometryGUI( QAD_Desktop* desktop ) -{ - if( GeomGUI == 0 ) { - GeomGUI = new GeometryGUI; - GeomGUI->myActiveDialogBox = 0 ; - GeomGUI->mySimulationShape = new AIS_Shape(TopoDS_Shape()); - GeomGUI->myState = -1 ; - GeomGUI->myDesktop = desktop ; - GeomGUI->myActiveStudy = desktop->getActiveStudy(); - GeomGUI->mySimulationActor = vtkActorCollection::New() ; - - GeomGUI->myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); - - Engines::Component_var comp = desktop->getEngine("FactoryServer", "Geometry"); - GeomGUI->myComponentGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* GetCurrentStudy */ - int studyId = GeomGUI->myActiveStudy->getStudyId(); - GeomGUI->myComponentGeom->GetCurrentStudy(studyId); - - GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); - } else { - /* study may have changed */ - GeomGUI->myActiveStudy = desktop->getActiveStudy(); - } - return GeomGUI; -} - - -//================================================================================= -// function : VertexToPoint() -// purpose : If S can be converted in a gp_Pnt returns true and the result is P -//================================================================================= -bool GeometryGUI::VertexToPoint( const TopoDS_Shape& S, gp_Pnt& P ) -{ - if( S.IsNull() || S.ShapeType() != TopAbs_VERTEX ) - return false ; - P = BRep_Tool::Pnt(TopoDS::Vertex( S )); - return true ; -} - - -//================================================================================= -// function : LinearEdgeExtremities() -// purpose : If S can be converted in a linear edge and if initial an final points -// : distance is sufficient, returns true else returns false. -// : Resulting points are respectively P1 and P2 -//================================================================================= -bool GeometryGUI::LinearEdgeExtremities( const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2 ) -{ - if( S.IsNull() || S.ShapeType() != TopAbs_EDGE ) - return false ; - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - if (curv.GetType() != GeomAbs_Line) - return false ; - - curv.D0( curv.FirstParameter(), P1 ); - curv.D0( curv.LastParameter(), P2 ); - - if( P1.Distance(P2) <= Precision::Confusion() ) - return false ; - - return true ; -} - -//================================================================================= -// function : GetBipointDxDyDz() -// purpose : -//================================================================================= -void GeometryGUI::GetBipointDxDyDz( gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz ) -{ - dx = P2.X() - P1.X() ; - dy = P2.Y() - P1.Y() ; - dz = P2.Z() - P1.Z() ; - return ; -} - -//======================================================================= -// function : GetTopoFromSelection() -// purpose : Define tds from a single selection and retuen true -//======================================================================= -bool GeometryGUI::GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) -{ - if(Sel->IObjectCount() != 1) - return false ; - - Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); - /* case SObject */ - 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); - tds = this->GetShapeFromIOR(anIOR->Value()); - if(tds.IsNull() ) - return false ; - else - return true ; - } - } - } - - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Standard_CString ior = ""; - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - ior = GIObject->getIOR(); - tds = this->GetShapeFromIOR(ior); - if(tds.IsNull() ) - return false ; - else - return true ; - } - - return false; -} - - - -//===================================================================================== -// function : PrepareSubShapeSelection() -// purpose : ( localContextId of the method is opened and defined here) -//===================================================================================== -bool GeometryGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId) -{ - //* Test the type of viewer */ - 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(); - - /* local context opening */ - SetDisplayedObjectList() ; - OnDisplayOnly(); - - returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ; - SALOME_Selection* Sel = SALOME_Selection::Selection( this->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); - if ( found && SubShapeType >= Shape->Shape().ShapeType()) { - ic->Load(Shape, (8 - SubShapeType), Standard_True); - ic->HilightWithColor(Shape, Quantity_NOC_RED); - } - } - myDesktop->putInfo (tr("GEOM_PRP_SELECT_SUBSHAPES")); - return true ; -} - - - -//===================================================================================== -// function : PrepareSubShapeSelectionArgumentShape() -// purpose : ( localContextId of the method is opened and defined here ) -//===================================================================================== -bool GeometryGUI::PrepareSubShapeSelectionArgumentShape( const TopoDS_Shape& aShape, - const int SubShapeType, - Standard_Integer& returnLocalContextId ) -{ - //* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - return false; - - if( aShape.IsNull() ) - return false ; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - /* local context opening */ - SetDisplayedObjectList() ; - OnDisplayOnly(); - - returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ; - - Handle(GEOM_AISShape) Shape = new GEOM_AISShape(aShape, "") ; - ic->Display(Shape, 0, (8 - SubShapeType)); - - // Not Load(...) but Display(...) - // ic->Load(Shape, (8 - SubShapeType), Standard_True); - ic->HilightWithColor(Shape, Quantity_NOC_RED); - - myDesktop->putInfo (tr("GEOM_PRP_SELECT_SUBSHAPES")); - return true ; -} - - - -//======================================================================= -// function : GetNameOfSelectedIObjects() -// purpose : Define the name geom++ or other name of mono or multi sel. -//======================================================================= -int GeometryGUI::GetNameOfSelectedIObjects( SALOME_Selection* Sel, - QString& aName ) -{ - int nbSel = Sel->IObjectCount() ; - if ( nbSel == 1 ) { - Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); - aName = IObject->getName(); - } else { - aName = tr( "%1_objects" ).arg( nbSel ); - } - return nbSel; -} - - -//======================================================================= -// function : ConvertIOinGEOMAISShape() -// purpose : -//======================================================================= -Handle(GEOM_AISShape) GeometryGUI::ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult, - bool onlyInActiveView ) -{ - Handle(GEOM_AISShape) res; - int nbSf = myActiveStudy->getStudyFramesCount(); - 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) ic = v3d->getAISContext(); - - 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()); - if ( aSh->hasIO() ) { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); - if ( GIO->isSame( IO ) ) { - if ( onlyInActiveView ) { - if ( sf == myActiveStudy->getActiveStudyFrame() ) { - testResult = true; - return aSh; - } - } else { - testResult = true; - return aSh; - } - } - } - } - ite.Next(); - } - } - } - testResult = false; - return res; -} - -//======================================================================= -// function : ConvertIORinGEOMAISShape() -// purpose : -//======================================================================= -Handle(GEOM_AISShape) GeometryGUI::ConvertIORinGEOMAISShape( const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView ) -{ -Handle(GEOM_AISShape) resultShape; -testResult = false; - int nbSf = myActiveStudy->getStudyFramesCount(); - 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) ic = v3d->getAISContext(); - - 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()); - if ( aSh->hasIO() ) - { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); - Standard_CString theIOR = GIO->getIOR(); - if ( strcmp( IOR, theIOR ) == 0 ) - { - if ( onlyInActiveView ) - { - if ( sf == myActiveStudy->getActiveStudyFrame() ) - { - testResult = true; - resultShape = aSh; - return resultShape; - } - } - else - { - testResult = true; - resultShape = aSh; - return resultShape; - } - } - } - } - ite.Next(); - } - } - } -return resultShape; -} -//======================================================================= -// function : ConvertIORinGEOMActor() -// purpose : -//======================================================================= -GEOM_Actor* GeometryGUI::ConvertIORinGEOMActor( const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView ) -{ - int nbSf = GeomGUI->myActiveStudy->getStudyFramesCount(); - for ( int i = 0; i < nbSf; i++ ) { - QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i); - if ( sf->getTypeView() == VIEW_VTK ) { - vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->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(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(anActor->getIO()); - Standard_CString theIOR = GIO->getIOR(); - if ( strcmp( IOR, theIOR ) == 0 ) { - if ( onlyInActiveView ) { - if ( sf == GeomGUI->myActiveStudy->getActiveStudyFrame() ) { - testResult = true; - return anActor; - } - } else { - testResult = true; - return anActor; - } - } - } - } - ac = theActors->GetNextActor(); - } - } - } - testResult = false; - return GEOM_Actor::New(); -} - -//======================================================================= -// function : ConvertIOinGEOMShape() -// purpose : -//======================================================================= -GEOM::GEOM_Shape_ptr GeometryGUI::ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult ) -{ - GEOM::GEOM_Shape_ptr aShape ; - testResult = false ; - - /* case SObject */ - 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); - aShape = myComponentGeom->GetIORFromString(anIOR->Value()) ; - testResult = true ; - return aShape; - } - } - } - /* case Graphical Object */ - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - Standard_CString ior = GIObject->getIOR(); - testResult = true ; - aShape = myComponentGeom->GetIORFromString(ior) ; - return aShape; - } - return aShape ; -} - - -//======================================================================= -// function : ConvertListOfIOInListOfIOR() -// purpose : -//======================================================================= -void GeometryGUI::ConvertListOfIOInListOfIOR( const SALOME_ListIO& aList, - GEOM::GEOM_Gen::ListOfIOR& listIOR ) -{ - int nbSel = aList.Extent(); - listIOR.length(nbSel) ; - int j=0; - SALOME_ListIteratorOfListIO It( aList ); - for ( int i=0; It.More(); It.Next(), i++ ) - { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - - if ( IObject->hasEntry() ) - { - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() && obj->FindAttribute(anAttr, "AttributeIOR") ) - { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - ORB_INIT &init = *SINGLETON_::Instance() ; - CORBA::ORB_var& _orb = init.orb() ; - CORBA::String_var theValue = anIOR->Value(); - CORBA::Object_var theObj = _orb->string_to_object(theValue); - if (theObj->_is_a("IDL:GEOM/GEOM_Shape:1.0")) - { - listIOR[j] = strdup(theValue) ; - j++; - } - } - } - else if ( IObject->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IObject ); - Standard_CString ior = GIObject->getIOR(); - listIOR[j] = strdup(ior) ; - j++; - } - } - listIOR.length(j) ; -} - - -//================================================================================= -// function : GetShapeTypeString() -// purpose : for a single shape -//================================================================================= -bool GeometryGUI::GetShapeTypeString( const TopoDS_Shape& aShape, Standard_CString& aTypeString ) -{ - if( aShape.IsNull() ) { - aTypeString = "aNullShape" ; - return false ; - } - switch (aShape.ShapeType() ) - { - case TopAbs_COMPOUND: - { aTypeString = strdup(tr("GEOM_COMPOUND")) ; return true ; } - case TopAbs_COMPSOLID: - { aTypeString = strdup(tr("GEOM_COMPOUNDSOLID")) ; return true ; } - case TopAbs_SOLID: - { aTypeString = strdup(tr("GEOM_SOLID")) ; return true ; } - case TopAbs_SHELL: - { aTypeString = strdup(tr("GEOM_SHELL")) ; return true ; } - case TopAbs_FACE: - { - BRepAdaptor_Surface surf(TopoDS::Face(aShape)); - if ( surf.GetType() == GeomAbs_Plane ) { - aTypeString = strdup(tr("GEOM_PLANE")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Cylinder ) { - aTypeString = strdup(tr("GEOM_SURFCYLINDER")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Sphere ) { - aTypeString = strdup(tr("GEOM_SURFSPHERE")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Torus ) { - aTypeString = strdup(tr("GEOM_SURFTORUS")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Cone ) { - aTypeString = strdup(tr("GEOM_SURFCONE")) ; - return true ; - } else { - aTypeString = strdup(tr("GEOM_FACE")) ; - return true ; - } - } - case TopAbs_WIRE: - { aTypeString = strdup(tr("GEOM_WIRE")) ; return true ; } - case TopAbs_EDGE: - { - BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); - if ( curv.GetType() == GeomAbs_Line ) { - if ( (Abs(curv.FirstParameter()) >= 1E6 ) || - (Abs(curv.LastParameter()) >= 1E6 )) { - aTypeString = strdup(tr("GEOM_LINE")) ; - } else - aTypeString = strdup(tr("GEOM_EDGE")) ; - return true ; - } else if ( curv.GetType() == GeomAbs_Circle ) { - if ( curv.IsClosed() ) - aTypeString = strdup(tr("GEOM_CIRCLE")) ; - else - aTypeString = strdup(tr("GEOM_ARC")) ; - return true ; - } else { - aTypeString = strdup(tr("GEOM_EDGE")) ; - return true ; - } - } - case TopAbs_VERTEX: - { aTypeString = strdup(tr("GEOM_VERTEX")) ; return true ; } - case TopAbs_SHAPE: - { aTypeString = strdup(tr("GEOM_SHAPE")) ; return true ; } - } - return false ; -} - - -//================================================================================= -// function : CreateArrowForLinearEdge() -// purpose : Create a cone topology to be used to display an arrow in the middle -// : of an edge showing its orientation. (For simulation and Viewer OCC only) -//================================================================================= -bool GeometryGUI::CreateArrowForLinearEdge( const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone ) -{ - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE ) - return false; - - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); - Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); - Standard_Real Width, Height ; - view3d->Size(Width, Height) ; - const Standard_Real aHeight = (Width + Height) / 50.0 ; - - try { - Standard_Real first, last ; - Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last); - if( !curv->IsCN(1) ) - return false ; - - const Standard_Real param = (first+last) / 2.0 ; - gp_Pnt middleParamPoint ; - gp_Vec V1 ; - curv->D1( param, middleParamPoint, V1) ; - if ( V1.Magnitude() < Precision::Confusion() ) - return false ; - - /* Topology orientation not geom orientation */ - if( tds.Orientation() == TopAbs_REVERSED ) - V1 *= -1.0 ; - - gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1) ) ; - const Standard_Real radius1 = aHeight / 5.0 ; - if( radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion() ) { - ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape() ; - return true ; - } - } - catch(Standard_Failure) { - // OCC failures are hard to catch in GUI. - // This because of the position for #include that is very critic to find - // in SALOME environment : compilation error ! - } - return false ; -} - - -//======================================================================= -// function : SelectionByNameInDialogs() -// purpose : Called when user has entered a name of object in a LineEdit. -// : The selection is changed. Dialog box will receive the -// : corresponding signal to manage this event. -//======================================================================= -bool GeometryGUI::SelectionByNameInDialogs( QWidget* aWidget, const QString& objectUserName, SALOME_Selection* Sel ) -{ - - /* Find SObject with name in component GEOM */ - SALOMEDS::Study_var ST = this->myActiveStudy->getStudyDocument() ; - SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject ; - listSO = ST->FindObjectByName( objectUserName, "GEOM" ) ; - - if ( listSO->length() < 1 ) { - const QString caption = tr("GEOM_WRN_WARNING") ; - const QString text = tr("GEOM_NAME_INCORRECT") ; - const QString button0 = tr("GEOM_BUT_OK") ; - QMessageBox::warning( aWidget, caption, text, button0 ) ; - return false ; - } - /* More than one object with same name */ - if ( listSO->length() > 1 ) { - const QString caption = tr("GEOM_WRN_WARNING") ; - const QString text = tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE") ; - const QString button0 = tr("GEOM_BUT_OK") ; - QMessageBox::warning( aWidget, caption, text, button0 ) ; - return false ; - } - - SALOMEDS::SObject_var theObj = listSO[0] ; - /* Create a SALOME_InteractiveObject with a SALOME::SObject */ - Standard_CString anEntry = theObj->GetID() ; - Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject( anEntry, "GEOM", strdup(objectUserName) ) ; - - /* Add as a selected object */ - /* Clear any previous selection : */ - /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */ - Sel->ClearIObjects() ; - Sel->AddIObject( SI ) ; - return true ; -} - - -//======================================================================= -// function : MakePointAndDisplay -// purpose : -//======================================================================= -void GeometryGUI::MakePointAndDisplay( const double x, const double y, const double z ) -{ - try { - GEOM::GEOM_Shape_var P = myComponentGeom->MakeVertex( x, y, z ); - P->NameType( tr("GEOM_VERTEX") ); - if ( Display( P, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//======================================================================= -// function : MakeVectorAndDisplay() -// purpose : -//======================================================================= -void GeometryGUI::MakeVectorAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) -{ - try { - GEOM::PointStruct pstruct1 = myComponentGeom->MakePointStruct( P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct pstruct2 = myComponentGeom->MakePointStruct( P2.X(), P2.Y(), P2.Z() ) ; - GEOM::GEOM_Shape_var Vector = myComponentGeom->MakeVector( pstruct1, pstruct2 ); - Vector->NameType(tr("GEOM_VECTOR")); - if ( Display( Vector, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//======================================================================= -// 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); - } -} - - - - -//======================================================================= -// function : MakePlaneAndDisplay() -// purpose : Plane point is P1 and dx, dy, dz define a normal vector -//======================================================================= -void GeometryGUI::MakePlaneAndDisplay( const gp_Pnt P1, const Standard_Real dx, - const Standard_Real dy, const Standard_Real dz, - const Standard_Real TrimSize ) -{ - try { - gp_Dir aDirection; - aDirection.SetCoord(dx, dy, dz) ; - gp_Ax2 Axis( P1, aDirection ); - - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct(aDirection.X(), aDirection.Y(), aDirection.Z()) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - GEOM::GEOM_Shape_ptr plane = myComponentGeom->MakePlane(pstruct, dstruct, TrimSize) ; - plane->NameType(tr("GEOM_PLANE")); - if ( Display( plane, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//======================================================================= -// function : MakeWorkingPlane() -// purpose : Change the point of view3d -//======================================================================= -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") ) ; - return ; - } - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); - Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); - view3d->SetAt( P.X(), P.Y(), P.Z() ); - view3d->SetProj( D.X(), D.Y(), D.Z() ); - myDesktop->putInfo(tr("GEOM_PRP_DONE")); -} - - -//======================================================================= -// function : MakePrismAndDisplay() -// purpose : P1 and P2 is to define a vector for prism -//======================================================================= -void GeometryGUI::MakePrismAndDisplay( GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2 ) -{ - try { - GEOM::PointStruct PS1 = myComponentGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct PS2 = myComponentGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z() ) ; - if( BaseShape->_is_nil() ) { - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakePrism( BaseShape, PS1, PS2 ) ; - 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 : MakeLineAndDisplay() -// purpose : Create an infinite oriented line (linear edge in fact) -//===================================================================================== -void GeometryGUI::MakeLineAndDisplay( const gp_Pnt InitPoint, const gp_Pnt LastPoint ) -{ - gp_Pnt P1,P2; - double dx, dy, dz ; - GetBipointDxDyDz( InitPoint, LastPoint, dx, dy, dz ) ; - Standard_Real length = InitPoint.Distance(LastPoint) ; - if( length <= Precision::Confusion() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - - Standard_Real coeff = 1E6 / length ; - - /* To create a line with length = 1E6 */ - /* Precision::Infinite() is 1E100 in OCC */ - P1.SetX( InitPoint.X() - (coeff * dx) ) ; - P1.SetY( InitPoint.Y() - (coeff * dy) ) ; - P1.SetZ( InitPoint.Z() - (coeff * dz) ) ; - - P2.SetX( LastPoint.X() + (coeff * dx) ) ; - P2.SetY( LastPoint.Y() + (coeff * dy) ) ; - P2.SetZ( LastPoint.Z() + (coeff * dz) ) ; - - try { - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z()) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeLine(pstruct, dstruct) ; - if(result->_is_nil()) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - result->NameType(tr("GEOM_LINE")); - - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_READY")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//======================================================================= -// 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 ; -} - - -//===================================================================================== -// function : MakePipeAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakePipeAndDisplay( GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase ) -{ - try { - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakePipe(aPath, aBase); - if ( !result->_is_nil() && Display( result, "") ) { - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - myDesktop->putInfo( tr("GEOM_PRP_DONE") ); - } - else { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - } - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeFillingAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeFillingAndDisplay( GEOM::GEOM_Shape_ptr SectionShape, - const short mindeg, - const short maxdeg, - const double tol3d, - const double tol2d, - const short nbiter ) -{ - try { - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeFilling( SectionShape, - mindeg, maxdeg, - tol3d, tol2d, nbiter ); - 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")); - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - - -//===================================================================================== -// function : MakeMirrorAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeMirrorAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2 ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMirrorByPlane( Shape1, Shape2 ); - if (result->_is_nil()) { - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType( Shape1->NameType() ); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeSewingAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeSewingAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, - const Standard_Real precision ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeSewing(listShapesIOR, precision) ; - 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")) ; - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//===================================================================================== -// function : MakeCompoundAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeCompoundAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCompound(listShapesIOR) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_COMPOUND")); - if( Display( result, "" )) - myDesktop->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeFaceAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeFaceAndDisplay( GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeFace( aWire, wantPlanar) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - if ( wantPlanar ) - result->NameType(tr("GEOM_PLANE")); - else - result->NameType(tr("GEOM_FACE")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//===================================================================================== -// function : MakeLinearEdgeAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeLinearEdgeAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) -{ - try { - GEOM::PointStruct ps1 = myComponentGeom->MakePointStruct( P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct ps2 = myComponentGeom->MakePointStruct( P2.X(), P2.Y(), P2.Z() ) ; - GEOM::GEOM_Shape_var result = myComponentGeom->MakeEdge( ps1, ps2 ) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_EDGE")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeOrientationChangeAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeOrientationChangeAndDisplay( GEOM::GEOM_Shape_ptr Shape ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->OrientationChange( Shape ) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType( Shape->NameType() ); - if ( Display( result, "" )) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//===================================================================================== -// function : MakeScaleAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeScaleAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint, const Standard_Real factor ) -{ - try { - GEOM::PointStruct P = myComponentGeom->MakePointStruct(centralPoint.X(), centralPoint.Y(), centralPoint.Z() ) ; - GEOM::GEOM_Shape_var result = myComponentGeom->MakeScaleTransform(Shape, P, factor) ; - // result->NameType(tr("GEOM_SCALE")); - result->NameType( Shape->NameType() ); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - else - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//======================================================================================= -// function : MakeRevolutionAndDisplay() -// purpose : -//======================================================================================= -void GeometryGUI::MakeRevolutionAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, const gp_Dir dir, const Standard_Real revolAngle ) -{ - try { - GEOM::AxisStruct axis = myComponentGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), dir.X(), dir.Y(), dir.Z() ) ; - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeRevolution(Shape, axis, revolAngle) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - 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 : MakeRotationAndDisplay() -// purpose : -//======================================================================================= -void GeometryGUI::MakeRotationAndDisplay( GEOM::GEOM_Shape_ptr Shape, - const gp_Pnt loc, - const gp_Dir dir, - const Standard_Real angle ) -{ - try { - const GEOM::AxisStruct axis = myComponentGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), dir.X(), dir.Y(), dir.Z() ) ; - GEOM::GEOM_Shape_var result = myComponentGeom->MakeRotation(Shape, axis, angle); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( Shape->NameType() ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeTranslationAndDisplay() -// purpose : Translate a shape -//================================================================================= -void GeometryGUI::MakeTranslationAndDisplay( GEOM::GEOM_Shape_ptr Shape, gp_Vec V ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeTranslation( Shape, V.X(), V.Y(), V.Z() ) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( Shape->NameType() ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - -//================================================================================= -// function : MakeMultiTranslation1DAndDisplay() -// purpose : Multi-Translate a shape -//================================================================================= -void GeometryGUI::MakeMultiTranslation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const double Step, const short NbTimes ) -{ - try { - GEOM::PointStruct d = myComponentGeom->MakePointStruct( Dir.X(), Dir.Y(), Dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiTranslation1D( Shape, dstruct, Step, NbTimes ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeMultiTranslation2DAndDisplay() -// purpose : Multi-Translate a shape -//================================================================================= -void GeometryGUI::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 ) -{ - try { - GEOM::PointStruct d1 = myComponentGeom->MakePointStruct( Dir1.X(), Dir1.Y(), Dir1.Z() ) ; - GEOM::DirStruct dstruct1 = myComponentGeom->MakeDirection(d1) ; - GEOM::PointStruct d2 = myComponentGeom->MakePointStruct( Dir2.X(), Dir2.Y(), Dir2.Z() ) ; - GEOM::DirStruct dstruct2 = myComponentGeom->MakeDirection(d2) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiTranslation2D( Shape, dstruct1, Step1, NbTimes1, dstruct2, Step2, NbTimes2 ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeMultiRotation1DAndDisplay() -// purpose : Multi-Rotate a shape -//================================================================================= -void GeometryGUI::MakeMultiRotation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes ) -{ - try { - GEOM::PointStruct d = myComponentGeom->MakePointStruct( Dir.X(), Dir.Y(), Dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( Loc.X(), Loc.Y(), Loc.Z() ) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiRotation1D( Shape, dstruct, pstruct, NbTimes ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeMultiRotation2DAndDisplay() -// purpose : Multi-Rotate a shape -//================================================================================= -void GeometryGUI::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 ) -{ - try { - GEOM::PointStruct d = myComponentGeom->MakePointStruct( Dir.X(), Dir.Y(), Dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( Loc.X(), Loc.Y(), Loc.Z() ) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiRotation2D( Shape, dstruct, pstruct, Ang, NbTimes1, Step, NbTimes2 ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//======================================================================================= -// function : MakeArcAndDisplay() -// purpose : Make an arc of circle from InitPoint to CirclePoint and passing on EndPoint -//======================================================================================= -void GeometryGUI::MakeArcAndDisplay( gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint ) -{ - gp_Vec v1( CirclePoint, InitPoint ) ; - gp_Vec v2( CirclePoint, EndPoint ) ; - if( v1.IsParallel(v2, Precision::Angular() ) ) - return ; - - try { - GEOM::PointStruct pI = myComponentGeom->MakePointStruct( InitPoint.X(), InitPoint.Y(), InitPoint.Z() ); - GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CirclePoint.X(), CirclePoint.Y(), CirclePoint.Z() ); - GEOM::PointStruct pE = myComponentGeom->MakePointStruct( EndPoint.X(), EndPoint.Y(), EndPoint.Z() ); - GEOM::GEOM_Shape_var result = myComponentGeom->MakeArc(pI, pC, pE) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - result->NameType(tr("GEOM_ARC")); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeCircleAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeCircleAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius ) -{ - try { - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() ) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct( dir.X(), dir.Y(), dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCircle(pstruct, dstruct, Radius) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType(tr("GEOM_CIRCLE")); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//===================================================================================== -// function : MakeWireAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeWireAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeWire(listShapesIOR) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_WIRE")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakePartitionAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::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) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->Partition(listShapesIOR, - listToolsIOR, - listKeepInsIOR, - listRemoveInsIOR, - (CORBA::Short) limit); - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_PARTITION")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - -//======================================================================= -// function : SetState() -// purpose : Sets myState = aState a private field indicating which methode is active -//======================================================================= -void GeometryGUI::SetState(int aState ) -{ this->myState = aState ; return ; } - - -//======================================================================= -// function : ResetState() -// purpose : Sets myState = -1 a private field indicating which methode is active -//======================================================================= -void GeometryGUI::ResetState() -{ this->myState = -1 ; return ; } - - -//======================================================================= -// function : EmitSignalDeactivateDialog() -// purpose : Emit a signal to deactivate the active dialog Box -//======================================================================= -void GeometryGUI::EmitSignalDeactivateDialog() -{ - emit this->SignalDeactivateActiveDialog() ; - return ; -} - -//======================================================================= -// function : EmitSignalCloseAllDialogs() -// purpose : Emit a signal to deactivate all non modal dialogs box -//======================================================================= -void GeometryGUI::EmitSignalCloseAllDialogs() -{ - emit this->SignalCloseAllDialogs() ; - return ; -} - - -//======================================================================= -// function : GetActiveDialogBox() -// purpose : -//======================================================================= -QDialog* GeometryGUI::GetActiveDialogBox() -{ - return this->myActiveDialogBox ; -} - - -//======================================================================= -// function : SetActiveDialogBox() -// purpose : -//======================================================================= -void GeometryGUI::SetActiveDialogBox(QDialog* aDlg) -{ - this->myActiveDialogBox = (QDialog*)aDlg ; - return ; -} - - -//======================================================================= -// function : GetActiveStudy() -// purpose : -//======================================================================= -QAD_Study* GeometryGUI::GetActiveStudy() -{ - return this->myActiveStudy ; -} - - -//======================================================================= -// function : GetActiveDesktop() -// purpose : -//======================================================================= -QAD_Desktop* GeometryGUI::GetDesktop() -{ - return this->myDesktop ; -} - - -//===================================================================================== -// function : OnSubShapeGetAll() -// purpose : Explode a shape in all sub shapes with a SubShapeType -//===================================================================================== -bool GeometryGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) -{ - 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 ; - } - - 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; - SALOMEDS::AttributePixMap_var aPixmap; - - /* We create a sub object for each sub shape as attribute of the main object */ - /* Each sub object contains list (length=1) containing its index in the main shape */ - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; - GEOM::GEOM_Shape_var aResult ; - - try { - listGeomShapes = myComponentGeom->SubShapeAll( aShape, SubShapeType ); - if( listGeomShapes->length() < 1 ) { - myDesktop->putInfo (tr("GEOM_PRP_ABORT")); - return false ; - } - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - - TopoDS_Shape mainTopo = ShapeReader.GetShape(myComponentGeom, aShape); - TopoDS_Shape mainShape; - bool main = false; - while ( !main ) { - if ( aShape->IsMainShape() ) { - mainShape = ShapeReader.GetShape(myComponentGeom, aShape); - main = true; - } else - aShape = myComponentGeom->GetIORFromString( aShape->MainName() ); - } - - /* Loop on each sub shape created */ - /* int i = 1 ; /* index for the nameType */ - for( int j=0; jlength(); j++) { - - /* Get each sub shape extracted CORBA and OCC */ - aResult = listGeomShapes[j] ; - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult); - - if ( S.IsNull() ) { - myDesktop->putInfo (tr("GEOM_PRP_ABORT")); - return false; - } - -// NRI : Following lines are commented according to bugID SAL695 (see history) -// BRepCheck_Analyzer anAnalyzer(S); -// if(!anAnalyzer.IsValid()) { -// myDesktop->putInfo (tr("GEOM_PRP_ABORT")); -// MESSAGE("#### An exploded shape number "<< j << " is not valid"); -// op->abort(); -// return false; -// } - - /* Set the nameType of sub shape */ - char* nameG = (char *)malloc(20); - Standard_CString Type; - if ( GetShapeTypeString(S, Type) ) { - aResult->NameType( Type ); - sprintf (nameG, "%s_%d", Type, GetIndex( S, mainShape, SubShapeType ) ); - } - else { - aResult->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ ); - } - SALOMEDS::SObject_var SO = aStudy->FindObjectIOR( aResult->Name() ); - - bool allreadyexist = false; - - if ( GeomGUI->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"); - - MESSAGE ( "SO->_is_nil() " << SO->_is_nil() ) - - if ( SO->_is_nil() ) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj ); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(nameG); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - MESSAGE( " Type " << S.ShapeType() ) - if ( S.ShapeType() == TopAbs_COMPOUND ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); - } else if ( S.ShapeType() == TopAbs_COMPSOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); - } else if ( S.ShapeType() == TopAbs_SOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); - } else if ( S.ShapeType() == TopAbs_SHELL ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); - } else if ( S.ShapeType() == TopAbs_FACE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); - } else if ( S.ShapeType() == TopAbs_WIRE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); - } else if ( S.ShapeType() == TopAbs_EDGE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); - } else if ( S.ShapeType() == TopAbs_VERTEX ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); - } - - MESSAGE ( " aPixmap->GetPixMap " << aPixmap->GetPixMap() ) - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - IO->setEntry(newObj->GetID()); - - aResult->StudyShapeId( newObj->GetID() ); - } else { - allreadyexist = true; - if ( ! SObjectExist(theObj, aResult->Name()) ) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - IO->setEntry(SO->GetID()); - aResult->StudyShapeId( SO->GetID() ); - } - } - - result->setIO( IO ); - result->setName( nameG ); - if ( !allreadyexist ) - ic->Display(result); - - } else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - int themode = myRenderInter->GetDisplayMode(); - vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); - - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior,"GEOM"); - - if ( SO->_is_nil() ) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj ); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(nameG); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - if ( S.ShapeType() == TopAbs_COMPOUND ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); - } else if ( S.ShapeType() == TopAbs_COMPSOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); - } else if ( S.ShapeType() == TopAbs_SOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); - } else if ( S.ShapeType() == TopAbs_SHELL ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); - } else if ( S.ShapeType() == TopAbs_FACE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); - } else if ( S.ShapeType() == TopAbs_WIRE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); - } else if ( S.ShapeType() == TopAbs_EDGE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); - } else if ( S.ShapeType() == TopAbs_VERTEX ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); - } - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - IO->setEntry(newObj->GetID()); - } else { - allreadyexist = true; - if ( ! SObjectExist(theObj, aResult->Name()) ) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - IO->setEntry(SO->GetID()); - } - } - - if ( !allreadyexist ) { - vtkActorCollection* theActors = - GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor ); - GActor->setIO( IO ); - GActor->setName( nameG ); - theRenderer->AddActor(GActor); - renWin->Render(); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - } - - /* commit transaction */ - op->finish(); - - myActiveStudy->updateObjBrowser(); - myDesktop->putInfo (tr("GEOM_PRP_READY")); - return true ; -} - - - -//===================================================================================== -// function : GetIndexSubShapeSelected() -// purpose : Define a ListOfID of sub shapes selected in ShapeTopo with SubShapeType -// : Method used by Dialogs -//===================================================================================== -bool GeometryGUI::GetIndexSubShapeSelected( const TopoDS_Shape& ShapeTopo, - const int SubShapeType, - GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) -{ - //* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - ListOfID.length(nbSelected); - - - //***************** DEFINE INDEX OF EACH SELECTION *********************// - int i = 0 ; - ic->InitSelected(); /* to restart */ - while( ic->MoreSelected() ) { - - /* Find index of sub shape into main shape */ - TopExp_Explorer Exp ( ShapeTopo, TopAbs_ShapeEnum(SubShapeType) ); - int index = 1; - bool found = false ; - while ( Exp.More() ) { - if ( (Exp.Current()).IsSame( ic->SelectedShape()) ) { - found = true ; - break; - } - index++; - Exp.Next(); - } - if( !found ) { - /* Manage local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - return false ; - } - ListOfID[i] = index ; - i++; - ic->NextSelected(); - } - //***************** END *********************// - - /* Manage local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - - return true ; -} - - -//===================================================================================== -// function : OnSubShapeGetSelected() -// purpose : -//===================================================================================== -bool GeometryGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) -{ - //* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - 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 ; - } - - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - if( myUseLocalContext == false ) { - /* local context is from DialogBox */ - MESSAGE("Error : No local context opened for sub shapes method" << endl ) ; - return false ; - } - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - TopoDS_Shape mainTopo = ShapeReader.GetShape(myComponentGeom, aShape); - - TopoDS_Shape mainShape; - bool main = false; - while ( !main ) { - if ( aShape->IsMainShape() ) { - mainShape = ShapeReader.GetShape(myComponentGeom, aShape); - main = true; - } else - aShape = myComponentGeom->GetIORFromString( aShape->MainName() ); - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - ListOfID->length(nbSelected); - - TopoDS_Compound compound; - ic->InitSelected(); /* to init again */ - BRep_Builder B; - B.MakeCompound( compound ); - - int i = 0; - /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */ - /* the compound is homogenous by selection */ - while(ic->MoreSelected()) { - int index = GetIndex( ic->SelectedShape(), mainShape, SubShapeType ); - ListOfID[i] = index ; - B.Add( compound, ic->SelectedShape() ); - i++; - ic->NextSelected(); - } - - /* Test if user has selected sub shapes */ - if( ListOfID->length() < 1 ) - return false ; - - GEOM::GEOM_Shape_var aResult ; - try { - aResult = myComponentGeom->SubShape( aShape, SubShapeType, ListOfID ); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - - char* nameG = (char *)malloc(20); - Standard_CString Type; - - Handle(GEOM_AISShape) result; - Handle(GEOM_InteractiveObject) IO ; - - // if ( ! SObjectExist(theObj, aResult->Name()) ) { - if ( nbSelected == 1 ) { - TopExp_Explorer Exp ( compound, TopAbs_ShapeEnum(SubShapeType) ); - if ( Exp.More() ) { - if ( GetShapeTypeString(Exp.Current(),Type) ) { - aResult->NameType( Type ); - sprintf (nameG, "%s_%d", Type, GetIndex( Exp.Current(), mainTopo, SubShapeType ) ); - } else { - aResult->NameType( tr("GEOM_SHAPE") ); - 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"); - } - } - else { - if ( GetShapeTypeString(compound,Type) ) { - aResult->NameType( Type ); - sprintf (nameG, "%s_%d", Type, this->myNbGeom++ ); - } else { - aResult->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ ); - } - result = new GEOM_AISShape( compound, nameG ); - IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior, "GEOM"); - } - - SALOMEDS::SObject_var SO = aStudy->FindObjectIOR( aResult->Name() ); - - /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - - 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; - SALOMEDS::AttributePixMap_var aPixmap; - - bool allreadyexist = false; - - if ( SO->_is_nil() ) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj ); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(result->getName()); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - if ( result->Shape().ShapeType() == TopAbs_COMPOUND ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); - } else if ( result->Shape().ShapeType() == TopAbs_COMPSOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); - } else if ( result->Shape().ShapeType() == TopAbs_SOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); - } else if ( result->Shape().ShapeType() == TopAbs_SHELL ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); - } else if ( result->Shape().ShapeType() == TopAbs_FACE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); - } else if ( result->Shape().ShapeType() == TopAbs_WIRE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); - } else if ( result->Shape().ShapeType() == TopAbs_EDGE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); - } else if ( result->Shape().ShapeType() == TopAbs_VERTEX ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); - } - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - - IO->setEntry(newObj->GetID()); - aResult->StudyShapeId(newObj->GetID()); - } else { - allreadyexist = true; - if ( ! SObjectExist(theObj, aResult->Name()) ) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - - IO->setEntry(SO->GetID()); - aResult->StudyShapeId(SO->GetID()); - } - } - - /* commit transaction */ - op->finish(); - - result->setIO( IO ); - result->setName( nameG ); - - if ( !allreadyexist ) - ic->Display(result); - - this->OnDisplayAll(true); - myActiveStudy->updateObjBrowser(); - myDesktop->putInfo (tr("GEOM_PRP_READY")); - - return true ; -} - - -//===================================================================================== -// function : OnSuppressFaces() -// purpose : To suppress faces from a shape -// : The result is one or more shells/faces as main shapes ! -//===================================================================================== -bool GeometryGUI::OnSuppressFaces( const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) -{ - /* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - 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 ; - } - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - if( myUseLocalContext == false ) { - /* local context is from DialogBox */ - MESSAGE("Error : No local context opened for suppress faces method" << endl ) ; - return false ; - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - ListOfID->length(nbSelected); - - /* Create a list of indices of faces to be suppressed */ - int i = 0; - const int SubShapeType = 4 ; /* GEOM::FACE type */ - ic->InitSelected(); /* to repositioning at beginning */ - while( ic->MoreSelected() ) { - int index = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ); - ListOfID[i] = index ; - i++; - ic->NextSelected(); - } - - /* Close local context opened in DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - - /* Here is the main shape */ - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; - - /* Call geom method that return a list of shells/faces as result of suppress */ - try { - listGeomShapes = myComponentGeom->SuppressFaces( aShape, ListOfID ); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* Test list of shells/faces */ - if( listGeomShapes->length() < 1 ) { - return false ; - } - - /* Loop on each object created */ - for( int i=0; ilength(); i++ ) { - - GEOM::GEOM_Shape_var aShellOrFace = listGeomShapes[i] ; - TopoDS_Shape S = ShapeReader.GetShape( this->myComponentGeom, aShellOrFace ); - - if( S.IsNull() ) { - return false ; - } - - char* nameG = (char *)malloc(20); - Standard_CString Type; - if ( GetShapeTypeString(S, Type) ) { - aShellOrFace->NameType( Type ); - sprintf (nameG, "%s_%d", Type, this->myNbGeom++); - } - else { - aShellOrFace->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ ); - } - - /* Display with name */ - if( !Display( aShellOrFace, nameG) ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return false ; - } - } - - myDesktop->putInfo (tr("GEOM_PRP_READY")); - return true ; -} - - -//===================================================================================== -// function : OnSuppressHole() -// purpose : To suppress an hole on a shape 'ShapeTopo'. -// : 'ListOfIdEndFace' may be an empty list. -// : This means that hole do not traverse ShapeTopo. -// : Warning : the hole to be suppressed must be defined by one or two single closed wires ! -//===================================================================================== -bool GeometryGUI::OnSuppressHole( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) -{ - /* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - try { - 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); - 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); - } - return true ; -} - - -//===================================================================================== -// function : OnSuppressHolesInFaceOrShell() -// purpose : To suppress one or more holes on a face -// : 'ListOfIdWires' contains indices or wires/holes. -//===================================================================================== -bool GeometryGUI::OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) -{ - /* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - try { - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var aResult = myComponentGeom->SuppressHolesInFaceOrShell( aShape, ListOfIdWires ) ; - - 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); - } - return true ; -} - - - -//======================================================================= -// 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 ; -} - - -//======================================================================= -// function : DefineDlgPosition() -// purpose : Define x and y the default position for a dialog box -//======================================================================= -bool GeometryGUI::DefineDlgPosition(QWidget* aDlg, int& x, int& y) -{ - /* Here the position is on the bottom right corner - 10 */ - QAD_Desktop* PP = QAD_Application::getDesktop() ; - x = abs ( PP->x() + PP->size().width() - aDlg->size().width() - 10 ) ; - y = abs ( PP->y() + PP->size().height() - aDlg->size().height() - 10 ) ; - return true ; -} - -//======================================================================= -// 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 = GeomGUI->myActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - OCCViewer_Viewer3d* v3d; - Handle(AIS_InteractiveContext) ic; - vtkRenderer* Renderer; - - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - - bool ViewOCC = false; - - 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 - - } 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; - } - - 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 ; - } - - 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 ); - } - - 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(); - } - - ic->UpdateCurrentViewer(); - - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", c.red() ); - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", c.green() ); - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", c.blue() ); - } - break; - } - - - 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() ; - - 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 */ - } - - 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))) { - - 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(); - } - 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" ; - - 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; - } - - 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::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 ); - GeomGUI->myActiveStudy->renameIObject( IObject, nm ); - QApplication::restoreOverrideCursor(); - } - } - } - } - 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(); - - 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 = 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); - - 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; - - if ( v3d->isInViewer( IObject, true ) ) { - Standard_Boolean found; - Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( IObject, found, true ); - 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(); - } - } - } - } - } - 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 ; - } - - case 3013: // CIRCLE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CircleDlg *aDlg = new GeometryGUI_CircleDlg( parent, "", Sel ) ; - break ; - } - - 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; - - GeomGUI->EmitSignalDeactivateDialog() ; - - ((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; - } - - 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; - } - - case 3025: // CONE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_ConeDlg *aDlg = new GeometryGUI_ConeDlg( parent, "", Sel ) ; - break; - } - - case 3131: - { - break; - } - - 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); - - 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); - - 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; - } - - 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; - } - - case 4021: // TRANSLATION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_TranslationDlg *aDlg = new GeometryGUI_TranslationDlg( parent, "", Sel ) ; - break; - } - - 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; - } - - 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 ) ; - break; - } - - case 4026: // ARCHIMEDE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_ArchimedeDlg *aDlg = new GeometryGUI_ArchimedeDlg( parent, "", Sel ) ; - break; - } - - 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 ) ; - break; - } - - case 4031: // PRISM - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_PrismDlg *aDlg = new GeometryGUI_PrismDlg( parent, "", Sel ) ; - break; - } - - case 4032: // REVOL - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_RevolDlg *aDlg = new GeometryGUI_RevolDlg( parent, "", Sel ) ; - break; - } - - case 4033: // FILLING - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_FillingDlg *aDlg = new GeometryGUI_FillingDlg( parent, "", Sel ) ; - break; - } - - 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(); - - 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") ); - } - - 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); - - 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(); - } - - 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; - } - - case 6022: // DISPLAY ALL - { - 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(); - break; - } - - case 6023: // DISPLAY ONLY - case 8023: // DISPLAY ONLY - POPUP VIEWER - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - // VTK - GeomGUI->OnVTKDisplayOnly(); - } - else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - GeomGUI->OnDisplayOnly(); - 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; - } - - 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","Geometry"); - 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 ) -{ - 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; -} - - - - -//================================================================================== -// function : 0nMousePress() -// purpose : [static] manage mouse events -//================================================================================== -bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) -{ - MESSAGE ( "GeometryGUI::OnMousePress") - 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(); - - /* 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 ) { - - GeomGUI->EraseSimulationShape() ; - GeometryGUI_PointDlg *DialogPt = (GeometryGUI_PointDlg*)(GeomGUI->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) ; - GeomGUI->myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - } - } - - 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() ); - - 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 ); -} - - - -//===================================================================================== -// 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); - } - } - } - ite1.Next(); - } - } else { - AIS_ListIteratorOfListOfInteractive ite(ListDisplayedObject); - 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); - } - } - } - ite.Next(); - } - } -} - - - - -//===================================================================================== -// function : OnVTKDisplayOnly() -// purpose : -//===================================================================================== -void GeometryGUI::OnVTKDisplayOnly() -{ - - // Erase all not selected actors - - QApplication::setOverrideCursor( Qt::waitCursor ); - - 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(); - } - 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; - - 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(); - - 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); - - 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(); - } - } - } - } - } - GeomGUI->myActiveStudy->updateObjBrowser( true ); - QApplication::restoreOverrideCursor(); -} - - - -//===================================================================================== -// 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(); - } - - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - - SALOME_ListIteratorOfListIO It1( Sel->StoredIObjects() ); - for(;It1.More();It1.Next()) { - Handle(SALOME_InteractiveObject) IObject = It1.Value(); - - - 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); - } - } - } - } - } -} - - -//=============================================================================== -// 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 = 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 ) ; - } - - /* 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 : OnEditCopy() -// purpose : -//============================================================================== -void GeometryGUI::OnEditCopy() -{ - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; - - const SALOME_ListIO& List = Sel->StoredIObjects(); - - GeomGUI->ConvertListOfIOInListOfIOR( List, listIOR); - - Sel->ClearIObjects(); - - 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")); -} - - - -//===================================================================================== -// function : OnKeyPress() -// purpose : [static] -//===================================================================================== -bool GeometryGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) -{ - GeometryGUI::GetOrCreateGeometryGUI(parent); - - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return false; - - return true ; -} - - - -//===================================================================================== -// 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 ; - - 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 ; -} - - - -//================================================================================== -// 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(); - - } else if (myActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_VTK ) { // VTK - } - } - // MESSAGE ( " GeometryGUI::EraseSimulationShape done. " ) -} - - - -//===================================================================================== -// 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") ) ; - - 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") ) ; - - 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") ) ; - - 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 )) ); - - 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") ); - 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 ); - - QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(this->myNbGeom++); - - 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 ; -} - - -//===================================================================================== -// 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; - - 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() ); - - 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 - -// ICW.AddShape (Shape->Shape()); -// ICW.ComputeModel(); -// Standard_Boolean result = ICW.Write( strdup(file.latin1()) ); - } - } - } - break; - } - - case 123 : - { -// 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 = 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() ) { - - 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 ; -// } - } - } - } -// if(test) { -// status = aWriter.Write( strdup(file.latin1()) ) ; -// QApplication::restoreOverrideCursor() ; -// return status ; -// } - break; - } - - } - QApplication::restoreOverrideCursor() ; -} - - -//===================================================================================== -// function : Display() -// purpose : Displays a CORBA shape -//===================================================================================== -bool GeometryGUI::Display( GEOM::GEOM_Shape_ptr aShape, - Standard_CString name) -{ - // 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 = ShapeReader.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; - - 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") ); - 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; - - 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(); - - vtkActorCollection* theActors = - GEOM_AssemblyBuilder::BuildActors(shape,0,themode,Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - - 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() ); - - theRenderer->AddActor(GActor); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - // 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(isInfinite) -// theResult->SetInfiniteState() ; - - ic->Display(theResult); - } - - Sel->AddIObject( IO, false ); - myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); - if ( Settings_AddInStudy ) - GeomGUI->AddInStudy( false, IO ); - - return true; -} - - -//===================================================================================== -// function : AddInStudy() -// purpose : anIOShape or a selected shape -//===================================================================================== -bool GeometryGUI::AddInStudy( bool selection, - const Handle(SALOME_InteractiveObject)& anIO) -{ - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - if ( !( !Settings_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; - - 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") ); - 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 ); - - 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(); - - 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; - } - } - } - } - ac = theActors->GetNextActor(); - } - - 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(); - } - - if ( !found ) - return false; - } - - 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; - } - } - - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father); - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GIO->getIOR() ); - - /* 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()) ; - - 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" ); - } - - // 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); - - 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; - } - } - - if ( !ObjectReferenced ) - aStudyBuilder->RemoveObject(Arguments); - } - - op->finish(); - - - if ( !Settings_AddInStudy || selection ) { - myActiveStudy->updateObjBrowser(); - } else { - myActiveStudy->updateObjBrowser(false); - Sel->AddIObject( GIO ); - } - - // MESSAGE ( " highlihght done" ) - return true; - -} - - -//===================================================================================== -// function : GetShapeFromIOR() -// purpose : exist also as static method ! -//===================================================================================== -TopoDS_Shape GeometryGUI::GetShapeFromIOR( QString IOR ) -{ - TopoDS_Shape result; - if( IOR.stripWhiteSpace().isEmpty() ) - return result; - ORB_INIT &init = *SINGLETON_::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 ); - } - return result; -} - - -//===================================================================================== -// function : SetSettings() -// purpose : [static] -//===================================================================================== -bool GeometryGUI::SetSettings( QAD_Desktop* parent ) -{ - /* Create or retrieve an object GeomGUI */ - GeometryGUI::GetOrCreateGeometryGUI(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 - - /* 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 ); - - /* 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 ( 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() ) { -// 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); - - /* 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; - } - } - - QMenuBar* Mb = GeomGUI->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 : 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() ); - - 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"; - } - } - } - } - - if ( ( theParent.compare("Viewer")==0 ) ) - { - if ( GeomGUI->myState == CURRENT_SKETCH ) - theContext = "Sketch"; - else - { - if ( Sel->IObjectCount() > 0 ) - theContext = ""; - else - theContext = "NothingSelected"; - } - } - 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); - } - - 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 = GeomGUI->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 = - 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 - - 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 (GeomGUI->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; - } - - //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 = 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); - } - 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*)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; - - 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; - 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; -} - -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; - - 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; - - if (theIO.IsNull()) - MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed") - - 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() ); - - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - 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 - - 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(); - } - } - - 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); - - 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); - } - } - } - 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() ); - - 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(); - //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); - } - - } 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(); - } - } - - 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(); - } - } - 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(); - } - 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(); - } - } else - anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - // 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); -} - - -//======================================================================= -// 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); - } - -} - - -//======================================================================= -// 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); -} - -//======================================================================= -// 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 : 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); - } - - if (this->mySketcher.Delete()) - GeomGUI->ResetState(); -} - - -//======================================================================= -// 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() ); - - GEOM::GEOM_Shape_var arc; - - 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(); - } - GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ; - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, Wire); - Standard_CString type; - GetShapeTypeString(S,type); - Wire->NameType( type ); - - if ( Display(Wire, "" )) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - } - 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 : OnSketchEnd() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchEnd() -{ - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - - 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; - - 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)); - - 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() ); - - GEOM::GEOM_Shape_var arc; - - 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(); - } - - GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ; - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, Wire); - Standard_CString type; - GetShapeTypeString(S,type); - Wire->NameType( type ); - - if ( Display(Wire, "") ) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - } - 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); -} - -//======================================================================= -// function : OnSettingsPerpendicular() -// purpose : -//======================================================================= -void GeometryGUI::OnSettingsPerpendicular() -{ - this->mySketcher.SetTransitionStatus(PERPENDICULAR); -} - -//======================================================================= -// function : OnSettingsTangent() -// purpose : -//======================================================================= -void GeometryGUI::OnSettingsTangent() -{ - this->mySketcher.SetTransitionStatus(TANGENT); -} - -//======================================================================= -// 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)); -} - -//======================================================================= -// 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)); -} - -//======================================================================= -// 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 : 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)); -} - -//======================================================================= -// 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)); -} - - -//======================================================================= -// 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 = 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")); - } - } - } - } - - } - 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); - } - - bool SetSettings ( QAD_Desktop* parent ) - { - return GeometryGUI::SetSettings( parent ); - } - - bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, - const QString & theParent, const QString & theObject ) - { - return GeometryGUI::CustomPopup( parent, popup, theContext, theParent, theObject ); - } - - void definePopup ( QString & theContext, QString & theParent, QString & theObject ) - { - GeometryGUI::DefinePopup( theContext, theParent, theObject ); - } - - bool activeStudyChanged ( QAD_Desktop* parent ) - { - GeometryGUI::activeStudyChanged( parent ); - } - - void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO ) - { - GeometryGUI::BuildPresentation(theIO); - } - - void supportedViewType(int* buffer, int bufferSize) - { - if (!buffer || !bufferSize) return; - buffer[0] = (int)VIEW_OCC; - if (--bufferSize) buffer[1] = (int)VIEW_VTK; - } -} - -//===================================================================================== -// 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 = 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 true; -} - -//===================================================================================== -// function : OnFilletGetSelected() -// purpose : -//===================================================================================== -bool GeometryGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const double Radius, - 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 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(); - } - - 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); - } - - 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 : 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 ; - } - - 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); - } - 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 ; - } - - 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(); - } - - 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 ; - } - - 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); - } - 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; - } - } - } - return false; -} diff --git a/GEOMGUI/GeometryGUI.h b/GEOMGUI/GeometryGUI.h deleted file mode 100644 index f2583f090..000000000 --- a/GEOMGUI/GeometryGUI.h +++ /dev/null @@ -1,341 +0,0 @@ -// 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.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef GeometryGUI_HeaderFile -#define GeometryGUI_HeaderFile - -// SALOME Includes -#include "QAD_Desktop.h" -#include "SALOME_Selection.h" -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "GEOM_AISShape.hxx" -#include "GEOM_Actor.h" -#include "GEOM_Sketcher.h" - -// Open CASCADE Includes -#include -#include -#include -#include -#include - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -//================================================================================= -// -//================================================================================= - enum { - POINT_METHOD, - CURRENT_SKETCH - } ; - - -//================================================================================= -// class : GeometryGUI -// purpose : -//================================================================================= -class GeometryGUI : public QObject -{ - Q_OBJECT /* for QT compatibility */ - -private : - - 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 */ - int myNbGeom ; /* Unique name for a geom entity */ - int myState ; /* Identify a method */ - Sketch mySketcher; - - Quantity_Color myShadingColor; - -public : - - GeometryGUI(); - ~GeometryGUI(); - - static GeometryGUI* GetOrCreateGeometryGUI( QAD_Desktop* desktop ); - static GeometryGUI* GetGeometryGUI() ; - - QAD_Study* GetActiveStudy() ; - QAD_Desktop* GetDesktop() ; - - 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); - - void OnEditCopy (); - void OnEditDelete (); - void OnVTKDisplayOnly (); - - 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(); - - - 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 char* aTitle1 = 0, - const char* aTitle = 0, - const double bottom = -1E6, - const double top = +1E6, - 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, - QAD_StudyFrame* studyFrame ); - Standard_EXPORT static bool OnMouseMove ( QMouseEvent* pe, QAD_Desktop* parent, - QAD_StudyFrame* studyFrame ); - Standard_EXPORT static 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, - QString & theParent, - QString & theObject ); - Standard_EXPORT static 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 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 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 ) ; - - /* 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 ) ; - GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult ) ; - - Handle(GEOM_AISShape) ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult, - bool onlyInActiveView = false ) ; - Handle(GEOM_AISShape) ConvertIORinGEOMAISShape( const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView = false ) ; - - GEOM_Actor* ConvertIORinGEOMActor( const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView = false ) ; - - void ConvertListOfIOInListOfIOR( const SALOME_ListIO& aList, - GEOM::GEOM_Gen::ListOfIOR& listIOR ) ; - - /* Method used by dialog boxes called when used has entered a name of object in a LineEdit */ - bool SelectionByNameInDialogs( QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel ) ; - - /* Method opening context for any sub shape selection */ - bool PrepareSubShapeSelection( const int SubShapeType, - Standard_Integer& returnLocalContextId ) ; - - /* Method opening context for sub shape selection on an argument shape */ - bool PrepareSubShapeSelectionArgumentShape( const TopoDS_Shape& aShape, - const int SubShapeType, - Standard_Integer& returnLocalContextId ) ; - - - /* Define a list of indices of sub shapes selected in a local context */ - bool GetIndexSubShapeSelected( const TopoDS_Shape& ShapeTopo, - const int SubShapeType, - GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) ; - - /* Methods for sub shapes explode */ - bool OnSubShapeGetAll( const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) ; - bool OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) ; - - /* 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 ) ; - - /* 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 ) ; - - /* 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 char* ShapeTopoIOR, - const double Radius, - 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, - const char* ShapeTopoIOR, - const double D1, const double D2, const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) ; - - /* Non modal dialog boxes magement */ - void EmitSignalDeactivateDialog() ; - void EmitSignalCloseAllDialogs() ; - - /* Sketcher management */ - void OnSketchSegment(); - void OnSketchArc(); - void OnSketchSetAngle(); - void OnSketchSetx(); - void OnSketchSety(); - - void OnSketchDelete(); - void OnSketchClose(); - void OnSketchEnd(); - - void OnSketchOptionsOnoffangledimension(); - void OnSketchOptionsOnofflengthdimension(); - void OnSketchOptionsOnoffradiusdimension(); - void OnSketchOptionsOnoffxdimension(); - void OnSketchOptionsOnoffydimension(); - - void OnSettingsNoconstraint(); - void OnSettingsPerpendicular(); - void OnSettingsTangent(); - -signals: - void SignalDeactivateActiveDialog() ; - void SignalCloseAllDialogs() ; - void SignalDefaultStepValueChanged( double newVal ) ; -}; - -#endif - diff --git a/GEOMGUI/GeometryGUI_ArcDlg.cxx b/GEOMGUI/GeometryGUI_ArcDlg.cxx deleted file mode 100644 index d9078f0c0..000000000 --- a/GEOMGUI/GeometryGUI_ArcDlg.cxx +++ /dev/null @@ -1,507 +0,0 @@ -// 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_ArcDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ArcDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Tools.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_ArcDlg() -// purpose : Constructs a GeometryGUI_ArcDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_ArcDlg::GeometryGUI_ArcDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_ARC"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_ArcDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_ARC_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ArcDlgLayout = new QGridLayout( this ); - GeometryGUI_ArcDlgLayout->setSpacing( 6 ); - GeometryGUI_ArcDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ARC" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_ArcDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_POINTS" ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg( "1" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_POINT_I" ).arg( "2" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_POINT_I" ).arg( "3" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - SelectButtonC1A3 = new QPushButton( GroupC1, "SelectButtonC1A3" ); - SelectButtonC1A3->setText( tr( "" ) ); - SelectButtonC1A3->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A3, 2, 1 ); - LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); - GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - GeometryGUI_ArcDlgLayout->addWidget( GroupC1, 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_ArcDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - - /* Move widget on the botton right corner of main widget */ - QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight); - /* Display Dialog */ - this->show() ; -} - - -//================================================================================= -// function : ~GeometryGUI_ArcDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ArcDlg::~GeometryGUI_ArcDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkPoint1 = myOkPoint2 = myOkPoint3 = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter(myVertexFilter) ; - - /* 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( SelectButtonC1A3, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - 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() ) ) ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ArcDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2 && myOkPoint3 ) { - myGeomGUI->MakeArcAndDisplay( myPoint1, myPoint2, myPoint3 ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ArcDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkPoint2 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A3 ) { - myEditCurrentArgument->setText("") ; - myOkPoint3 = false ; - } - return ; - } - - // nbSel == 1 ! - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint( S, this->myPoint1 ) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint( S, this->myPoint2 ) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint2 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A3 && myGeomGUI->VertexToPoint( S, this->myPoint3 ) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint3 = true ; - } - - /* Simulation */ - if( myOkPoint1 && myOkPoint2 && myOkPoint3 ) { - this->MakeArcSimulationAndDisplay() ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - mySelection->AddFilter(myVertexFilter) ; - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - else if(send == SelectButtonC1A3) { - LineEditC1A3->setFocus() ; - myEditCurrentArgument = LineEditC1A3; - } - SelectionIntoArgument() ; - break; - } - } -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC1A3 ) - myEditCurrentArgument = LineEditC1A3 ; - 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_ArcDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeArcSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::MakeArcSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - try { - if ( myPoint2.IsEqual( myPoint1, Precision::Confusion() ) ) { - myEditCurrentArgument->setText("") ; - return; - } - if ( myPoint2.IsEqual( myPoint3, Precision::Confusion() ) ) { - myEditCurrentArgument->setText("") ; - return; - } - - gp_Vec v1( this->myPoint2, this->myPoint1 ) ; - gp_Vec v2( this->myPoint2, this->myPoint3 ) ; - if( v1.IsParallel(v2, Precision::Angular() ) ) { - myEditCurrentArgument->setText("") ; - return ; - } - - GC_MakeArcOfCircle Arc( this->myPoint1, this->myPoint2, this->myPoint3 ); - if ( Arc.IsDone() ) { - Handle(Geom_TrimmedCurve) curve = Arc.Value() ; - mySimulationTopoDs = BRepBuilderAPI_MakeEdge(curve).Shape() ; - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeArcSimulationAndDisplay" ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_ArcDlg.h b/GEOMGUI/GeometryGUI_ArcDlg.h deleted file mode 100644 index 40384fee5..000000000 --- a/GEOMGUI/GeometryGUI_ArcDlg.h +++ /dev/null @@ -1,125 +0,0 @@ -// 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_ArcDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ARC_H -#define DIALOGBOX_ARC_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_ArcDlg -// purpose : -//================================================================================= -class GeometryGUI_ArcDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ArcDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ArcDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - gp_Pnt myPoint1 ; - gp_Pnt myPoint2 ; - gp_Pnt myPoint3; - - bool myOkPoint1 ; - bool myOkPoint2; - bool myOkPoint3; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeArcSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A3; - QPushButton* SelectButtonC1A3; - QLineEdit* LineEditC1A3; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void LineEditReturnPressed() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_ArcDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ARC_H diff --git a/GEOMGUI/GeometryGUI_ArchimedeDlg.cxx b/GEOMGUI/GeometryGUI_ArchimedeDlg.cxx deleted file mode 100644 index 4353623c1..000000000 --- a/GEOMGUI/GeometryGUI_ArchimedeDlg.cxx +++ /dev/null @@ -1,470 +0,0 @@ -// 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_ArchimedeDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ArchimedeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Tools.h" -#include "utilities.h" - -#include "SALOME_InteractiveObject.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_ArchimedeDlg() -// purpose : Constructs a GeometryGUI_ArchimedeDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_ArchimedeDlg::GeometryGUI_ArchimedeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_ARCHIMEDE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_ArchimedeDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_ARCHIMEDE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ArchimedeDlgLayout = new QGridLayout( this ); - GeometryGUI_ArchimedeDlgLayout->setSpacing( 6 ); - GeometryGUI_ArchimedeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ARCHIMEDE" ) ); - 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 ); - 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 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_ArchimedeDlgLayout->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_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_ArchimedeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - 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 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A2->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); - LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A3->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A3->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - - LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" ); - LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A4->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A4->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A4, 3, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_WEIGHT" ) ); - 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_WATER_DENSITY" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_MESHING_DEFLECTION" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - GeometryGUI_ArchimedeDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - -/* Move widget on the botton right corner of main widget */ - QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight); - /* Display Dialog */ - this->show() ; -} - - -//================================================================================= -// function : ~GeometryGUI_ArchimedeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ArchimedeDlg::~GeometryGUI_ArchimedeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::Init( SALOME_Selection* Sel ) -{ - LineEditC1A2->setMaxLength( 10 ); - LineEditC1A3->setMaxLength( 10 ); - LineEditC1A4->setMaxLength( 10 ); - this->myVa = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A2 ) ; - this->myVb = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A3 ) ; - this->myVc = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A4 ) ; - LineEditC1A2->setValidator( myVa ) ; - LineEditC1A3->setValidator( myVb ) ; - LineEditC1A4->setValidator( myVc ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - - this->myWeight = 100.0 ; - LineEditC1A2->setText("100.0") ; - this->myWaterDensity = 1.0 ; - LineEditC1A3->setText("1.0") ; - this->myMeshingDeflection = 0.01 ; - LineEditC1A4->setText("0.01") ; - - myOkWeight = myOkWaterDensity = myOkMeshingDeflection = true ; - myOkIO = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( LineEditC1A2, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - connect( LineEditC1A4, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ArchimedeDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkIO && myOkWeight && myOkWaterDensity && myOkMeshingDeflection ) { - myGeomGUI->Archimede( myIO, myWeight, myWaterDensity, myMeshingDeflection ); - } - } - break ; - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ArchimedeDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - myEditCurrentArgument->setText("") ; - myOkIO = false ; - } - else { - myEditCurrentArgument->setText(aString) ; - myIO = mySelection->firstIObject(); - myOkIO = true ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : TextChangedInLineEdit() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::TextChangedInLineEdit(const QString& newText) -{ - QLineEdit* send = (QLineEdit*)sender(); - QString newT = strdup(newText) ; - int i ; - - if(send == LineEditC1A2) { - if( myVa->validate(newT, i) == myVa->Acceptable ) { - this->myWeight = newText.toFloat() ; - myOkWeight = true ; - } - else { - myOkWeight = false ; - } - } - else if(send == LineEditC1A3) { - if( myVb->validate(newT, i) == myVb->Acceptable ) { - this->myWaterDensity = newText.toFloat() ; - myOkWaterDensity = true ; - } - else { - myOkWaterDensity = false ; - } - } - else if(send == LineEditC1A4) { - if( myVc->validate(newT, i) == myVc->Acceptable ) { - this->myMeshingDeflection = newText.toFloat() ; - myOkMeshingDeflection = true ; - } - else { - myOkMeshingDeflection = false ; - } - } - - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - diff --git a/GEOMGUI/GeometryGUI_ArchimedeDlg.h b/GEOMGUI/GeometryGUI_ArchimedeDlg.h deleted file mode 100644 index f233b43c8..000000000 --- a/GEOMGUI/GeometryGUI_ArchimedeDlg.h +++ /dev/null @@ -1,127 +0,0 @@ -// 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_ArchimedeDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ARCHIMEDE_H -#define DIALOGBOX_ARCHIMEDE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_ArchimedeDlg -// purpose : -//================================================================================= -class GeometryGUI_ArchimedeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ArchimedeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ArchimedeDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - Handle(SALOME_InteractiveObject) myIO ; - - Standard_Real myWeight ; - Standard_Real myWaterDensity ; - Standard_Real myMeshingDeflection ; - - bool myOkIO ; - bool myOkWeight ; - bool myOkWaterDensity ; - bool myOkMeshingDeflection ; - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QDoubleValidator *myVb ; /* Double validator for numeric input */ - QDoubleValidator *myVc ; /* Double validator for numeric input */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QLineEdit* LineEditC1A3; - QLineEdit* LineEditC1A4; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A4; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void TextChangedInLineEdit(const QString&) ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_ArchimedeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ARCHIMEDE_H diff --git a/GEOMGUI/GeometryGUI_BndBoxDlg.cxx b/GEOMGUI/GeometryGUI_BndBoxDlg.cxx deleted file mode 100644 index 4796a778c..000000000 --- a/GEOMGUI/GeometryGUI_BndBoxDlg.cxx +++ /dev/null @@ -1,487 +0,0 @@ -// 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_BndBoxDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_BndBoxDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_BndBoxDlg() -// purpose : Constructs a GeometryGUI_BndBoxDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_BndBoxDlg::GeometryGUI_BndBoxDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BOUNDING_BOX"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_BndBoxDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_BNDBOX_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_BndBoxDlgLayout = new QGridLayout( this ); - GeometryGUI_BndBoxDlgLayout->setSpacing( 6 ); - GeometryGUI_BndBoxDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_BNDBOX" ) ); - 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 ); - 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( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_BndBoxDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_BNDBOX_OBJDIM" ) ); - 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->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); -// GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); -// GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - QHBoxLayout* bl = new QHBoxLayout; - bl->setMargin(0); bl->setSpacing(6); - bl->addWidget(TextLabelC1A1); bl->addWidget(SelectButtonC1A1); bl->addWidget(LineEditC1A1); - GroupConstructor1Layout->addMultiCellLayout(bl, 0, 0, 0, 2); - - TextLabel_Min = new QLabel( GroupConstructor1, "TextLabel_Min" ); - TextLabel_Min->setText( tr( "GEOM_MIN" ) ); - TextLabel_Min->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Min->setFrameShape( QLabel::NoFrame ); - TextLabel_Min->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Min, 1, 1 ); - - TextLabel_Max = new QLabel( GroupConstructor1, "TextLabel_Max" ); - TextLabel_Max->setText( tr( "GEOM_MAX" ) ); - TextLabel_Max->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Max->setFrameShape( QLabel::NoFrame ); - TextLabel_Max->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Max, 1, 2 ); - - TextLabel_X = new QLabel( GroupConstructor1, "TextLabel_X" ); - TextLabel_X->setText( tr( "GEOM_X" ) ); - TextLabel_X->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_X->setFrameShape( QLabel::NoFrame ); - TextLabel_X->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_X, 2, 0 ); - LineEdit_MinX = new QLineEdit( GroupConstructor1, "LineEdit_MinX" ); - LineEdit_MinX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinX->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinX->setEnabled( FALSE ); - LineEdit_MinX->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinX, 2, 1 ); - LineEdit_MaxX = new QLineEdit( GroupConstructor1, "LineEdit_MaxX" ); - LineEdit_MaxX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxX->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxX->setEnabled( FALSE ); - LineEdit_MaxX->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxX, 2, 2 ); - - TextLabel_Y = new QLabel( GroupConstructor1, "TextLabel_Y" ); - TextLabel_Y->setText( tr( "GEOM_Y" ) ); - TextLabel_Y->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Y->setFrameShape( QLabel::NoFrame ); - TextLabel_Y->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Y, 3, 0 ); - LineEdit_MinY = new QLineEdit( GroupConstructor1, "LineEdit_MinY" ); - LineEdit_MinY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinY->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinY->setEnabled( FALSE ); - LineEdit_MinY->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinY, 3, 1 ); - LineEdit_MaxY = new QLineEdit( GroupConstructor1, "LineEdit_MaxY" ); - LineEdit_MaxY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxY->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxY->setEnabled( FALSE ); - LineEdit_MaxY->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxY, 3, 2 ); - - TextLabel_Z = new QLabel( GroupConstructor1, "TextLabel_Z" ); - TextLabel_Z->setText( tr( "GEOM_Z" ) ); - TextLabel_Z->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Z->setFrameShape( QLabel::NoFrame ); - TextLabel_Z->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Z, 4, 0 ); - LineEdit_MinZ = new QLineEdit( GroupConstructor1, "LineEdit_MinZ" ); - LineEdit_MinZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinZ->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinZ->setEnabled( FALSE ); - LineEdit_MinZ->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinZ, 4, 1 ); - LineEdit_MaxZ = new QLineEdit( GroupConstructor1, "LineEdit_MaxZ" ); - LineEdit_MaxZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxZ->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxZ->setEnabled( FALSE ); - LineEdit_MaxZ->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxZ, 4, 2 ); - - GeometryGUI_BndBoxDlgLayout->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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - GeometryGUI_BndBoxDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_BndBoxDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_BndBoxDlg::~GeometryGUI_BndBoxDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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() ) ) ; - - mySimulationTopoDs.Nullify() ; - - /* 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_BndBoxDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_BndBoxDlg::SelectionIntoArgument() -{ - LineEdit_MinX->setText("") ; - LineEdit_MinY->setText("") ; - LineEdit_MinZ->setText("") ; - LineEdit_MaxX->setText("") ; - LineEdit_MaxY->setText("") ; - LineEdit_MaxZ->setText("") ; - myEditCurrentArgument->setText("") ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - this->CalculateAndDisplayBndBox(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_BndBoxDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayBndBox() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::CalculateAndDisplayBndBox(const TopoDS_Shape& S) -{ - LineEdit_MinX->setText("") ; - LineEdit_MinY->setText("") ; - LineEdit_MinZ->setText("") ; - LineEdit_MaxX->setText("") ; - LineEdit_MaxY->setText("") ; - LineEdit_MaxZ->setText("") ; - if( S.IsNull() ) - return ; - - Standard_Real axmin,aymin,azmin,axmax,aymax,azmax; - Bnd_Box B; - try { - BRepBndLib::Add(S,B); - B.Get(axmin,aymin,azmin,axmax,aymax,azmax); - LineEdit_MinX->setText( tr("%1").arg( axmin, 12, 'f', 6 ) ) ; - LineEdit_MinY->setText( tr("%1").arg( aymin, 12, 'f', 6 ) ) ; - LineEdit_MinZ->setText( tr("%1").arg( azmin, 12, 'f', 6 ) ) ; - LineEdit_MaxX->setText( tr("%1").arg( axmax, 12, 'f', 6 ) ) ; - LineEdit_MaxY->setText( tr("%1").arg( aymax, 12, 'f', 6 ) ) ; - LineEdit_MaxZ->setText( tr("%1").arg( azmax, 12, 'f', 6 ) ) ; - - mySimulationTopoDs = BRepPrimAPI_MakeBox( gp_Pnt(axmin,aymin,azmin), - gp_Pnt(axmax,aymax,azmax) ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()" << endl ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_BndBoxDlg.h b/GEOMGUI/GeometryGUI_BndBoxDlg.h deleted file mode 100644 index 546dde539..000000000 --- a/GEOMGUI/GeometryGUI_BndBoxDlg.h +++ /dev/null @@ -1,119 +0,0 @@ -// 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_BndBoxDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_BNDBOX_H -#define DIALOGBOX_BNDBOX_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : DialogBox_PROPERTIES -// purpose : -//================================================================================= -class GeometryGUI_BndBoxDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_BndBoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_BndBoxDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateAndDisplayBndBox(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QLabel* TextLabel_Min; - QLabel* TextLabel_Max; - - QLabel* TextLabel_X; - QLabel* TextLabel_Y; - QLabel* TextLabel_Z; - - QLineEdit* LineEdit_MinX; - QLineEdit* LineEdit_MinY; - QLineEdit* LineEdit_MinZ; - - QLineEdit* LineEdit_MaxX; - QLineEdit* LineEdit_MaxY; - QLineEdit* LineEdit_MaxZ; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_BndBoxDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_BNDBOX_H diff --git a/GEOMGUI/GeometryGUI_BoxDlg.cxx b/GEOMGUI/GeometryGUI_BoxDlg.cxx deleted file mode 100644 index f7b4b6a74..000000000 --- a/GEOMGUI/GeometryGUI_BoxDlg.cxx +++ /dev/null @@ -1,639 +0,0 @@ -// 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_BoxDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_BoxDlg.h" -#include "GeometryGUI_SpinBox.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_BoxDlg() -// purpose : Constructs a GeometryGUI_BoxDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_BoxDlg::GeometryGUI_BoxDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BOX_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BOX_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_BoxDlg" ); - resize( 335, 220 ); - setCaption( tr( "GEOM_BOX_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_BoxDlgLayout = new QGridLayout( this ); - GeometryGUI_BoxDlgLayout->setSpacing( 6 ); - GeometryGUI_BoxDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_BOX" ) ); - 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_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_1, 0, 3 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); - GeometryGUI_BoxDlgLayout->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 = 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_BoxDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupPoints = new QGroupBox( this, "GroupPoints" ); - GroupPoints->setGeometry( QRect( 10, 10, 280, 90 ) ); - GroupPoints->setTitle( tr( "GEOM_DIAGONAL_POINTS" ) ); - GroupPoints->setFrameShape( QGroupBox::Box ); - GroupPoints->setFrameShadow( QGroupBox::Sunken ); - GroupPoints->setColumnLayout(0, Qt::Vertical ); - GroupPoints->layout()->setSpacing( 0 ); - GroupPoints->layout()->setMargin( 0 ); - GroupPointsLayout = new QGridLayout( GroupPoints->layout() ); - GroupPointsLayout->setAlignment( Qt::AlignTop ); - GroupPointsLayout->setSpacing( 6 ); - GroupPointsLayout->setMargin( 11 ); - SelectButtonPt2 = new QPushButton( GroupPoints, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - GroupPointsLayout->addWidget( SelectButtonPt2, 1, 1 ); - LineEditPt1 = new QLineEdit( GroupPoints, "LineEditPt1" ); - GroupPointsLayout->addWidget( LineEditPt1, 0, 2 ); - LineEditPt2 = new QLineEdit( GroupPoints, "LineEditPt2" ); - GroupPointsLayout->addWidget( LineEditPt2, 1, 2 ); - SelectButtonPt1 = new QPushButton( GroupPoints, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - SelectButtonPt1->setToggleButton( FALSE ); - GroupPointsLayout->addWidget( SelectButtonPt1, 0, 1 ); - TextLabelPt1 = new QLabel( GroupPoints, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointsLayout->addWidget( TextLabelPt1, 0, 0 ); - TextLabelPt2 = new QLabel( GroupPoints, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT_I" ).arg("2") ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - GroupPointsLayout->addWidget( TextLabelPt2, 1, 0 ); - GeometryGUI_BoxDlgLayout->addWidget( GroupPoints, 1, 0 ); - - /***************************************************************/ - GroupDimensions = new QGroupBox( this, "GroupDimensions" ); - GroupDimensions->setGeometry( QRect( 11, 75, 310, 80 ) ); - GroupDimensions->setTitle( tr( "GEOM_BOX_OBJ" ) ); - GroupDimensions->setColumnLayout(0, Qt::Vertical ); - GroupDimensions->setMinimumSize( QSize( 0, 90 ) ); - GroupDimensions->layout()->setSpacing( 0 ); - GroupDimensions->layout()->setMargin( 0 ); - GroupDimensionsLayout = new QGridLayout( GroupDimensions->layout() ); - GroupDimensionsLayout->setAlignment( Qt::AlignTop ); - GroupDimensionsLayout->setSpacing( 6 ); - GroupDimensionsLayout->setMargin( 11 ); - - TextLabel_DZ = new QLabel( GroupDimensions, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DZ, 0, 4 ); - TextLabel_DY = new QLabel( GroupDimensions, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DY, 0, 2 ); - TextLabel_DX = new QLabel( GroupDimensions, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DX, 0, 0 ); - - /* Spin boxes construction */ - SpinBox_DX = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DX" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DX, 0, 1 ); - SpinBox_DY = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DY" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DY, 0, 3 ); - SpinBox_DZ = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DZ" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DZ, 0, 5 ); - - QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed ); - GroupDimensionsLayout->addItem( spacer1, 1, 3 ); - - GeometryGUI_BoxDlgLayout->addWidget( GroupDimensions, 1, 0 ); - - /* Initialisations */ - Init(Sel) ; -} - - -//================================================================================= -// function : ~DialogBox_Box() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg() -{ - // no need to delete child widgets, Qt does it all for us - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::Init(SALOME_Selection *Sel) -{ - - - /* 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_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 200.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 200.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 200.0 ) ; - - GroupPoints->show(); - GroupDimensions->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditPt1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Vertices Filter for all arguments */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter( myVertexFilter ); /* filter for next selection */ - - /* 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( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditPt2, 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 */ -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_BoxDlg::ConstructorsClicked(int constructorId) -{ - - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupPoints->show(); - GroupDimensions->hide() ; - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditPt1 ; - Constructor1->setChecked( TRUE ); - LineEditPt1->setText("") ; - LineEditPt2->setText("") ; - myOkPoint1 = myOkPoint2 = false ; - - /* filter for next selection */ - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - GroupPoints->hide(); - GroupDimensions->show(); - myConstructorId = constructorId ; - myOkPoint1 = myOkPoint2 = false ; - - disconnect( mySelection, 0, this, 0 ); - - double initValue = 200.0 ; - SpinBox_DX->SetValue( initValue ) ; - SpinBox_DY->SetValue( initValue ) ; - SpinBox_DZ->SetValue( initValue ) ; - - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myPoint2.SetCoord( initValue, initValue,initValue ) ; - - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ClickOnApply() -{ -//NRI+ : 02/12/2202 - BugID 1065 -// if (mySimulationTopoDs.IsNull()) -// return; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - //NRI+ : 02/12/2202 - BugID 1065 mySelection->ClearFilters() ; - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - case 1 : - { - /* Recup args and call method */ - double vx = SpinBox_DX->GetValue() ; - double vy = SpinBox_DY->GetValue() ; - double vz = SpinBox_DZ->GetValue() ; - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(vx, vy, vz) ; - myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed -//================================================================================= -void GeometryGUI_BoxDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = "" ; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditPt1 ) { - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditPt2 ) { - myOkPoint2 = false ; - } - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText( aString ) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - myEditCurrentArgument->setText( aString ) ; - myOkPoint2 = true ; - } - - if( myOkPoint1 && myOkPoint2 && TestBoxDimensions( myPoint1, myPoint2 ) ) { - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: // default constructor - { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - } - else if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - case 1: - { - /* nothing to do here */ - break; - } - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ValueChangedInSpinBox( double newValue ) -{ - if(myConstructorId != 1) - return ; - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender() ; - double vx, vy, vz ; - - if( send == SpinBox_DX ) { - vx = newValue ; - vy = SpinBox_DY->GetValue() ; - vz = SpinBox_DZ->GetValue() ; - } else if ( send == SpinBox_DY ) { - vx = SpinBox_DX->GetValue() ; - vy = newValue ; - vz = SpinBox_DZ->GetValue() ; - } else if (send == SpinBox_DZ ) { - vx = SpinBox_DX->GetValue() ; - vy = SpinBox_DY->GetValue() ; - vz = newValue ; - } - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(vx, vy, vz) ; - - if ( TestBoxDimensions( myPoint1, myPoint2 ) ) { - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; - 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_BoxDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupDimensions->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupPoints->setEnabled(false) ; - - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ActivateThisDialog() -{ - - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupDimensions->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupPoints->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent [REDEFINED] -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : TestBoxDimensions() -// purpose : -//================================================================================= -bool GeometryGUI_BoxDlg::TestBoxDimensions(gp_Pnt P1, gp_Pnt P2) -{ - if ( ( fabs( P1.X() - P2.X() ) > Precision::Confusion() ) && - ( fabs( P1.Y() - P2.Y() ) > Precision::Confusion() ) && - ( fabs( P1.Z() - P2.Z() ) > Precision::Confusion() ) ) - return true ; - return false ; -} diff --git a/GEOMGUI/GeometryGUI_BoxDlg.h b/GEOMGUI/GeometryGUI_BoxDlg.h deleted file mode 100644 index 062591582..000000000 --- a/GEOMGUI/GeometryGUI_BoxDlg.h +++ /dev/null @@ -1,139 +0,0 @@ -// 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_BoxDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_BOX_H -#define DIALOGBOX_BOX_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QLabel; -class QPushButton; -class GeometryGUI_SpinBox; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_BoxDlg -// purpose : -//================================================================================= -class GeometryGUI_BoxDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_BoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_BoxDlg(); - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e ); - void Init(SALOME_Selection* Sel) ; - bool TestBoxDimensions( gp_Pnt P1, gp_Pnt P2 ) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI 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 */ - gp_Pnt myPoint2 ; - bool myOkPoint1 ; /* true when myPoint is defined */ - bool myOkPoint2 ; - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - - QGroupBox* GroupPoints; - QPushButton* SelectButtonPt1; - QPushButton* SelectButtonPt2; - QLineEdit* LineEditPt2; - QLineEdit* LineEditPt1; - QLabel* TextLabelPt1; - QLabel* TextLabelPt2; - - QGroupBox* GroupDimensions ; - QLabel* TextLabel_DX ; - QLabel* TextLabel_DY ; - QLabel* TextLabel_DZ ; - - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_BoxDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupPointsLayout; - QGridLayout* GroupDimensionsLayout; - -}; - -#endif // DIALOGBOX_BOX_H diff --git a/GEOMGUI/GeometryGUI_CenterMassDlg.cxx b/GEOMGUI/GeometryGUI_CenterMassDlg.cxx deleted file mode 100644 index 2e31ffd30..000000000 --- a/GEOMGUI/GeometryGUI_CenterMassDlg.cxx +++ /dev/null @@ -1,527 +0,0 @@ -// 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_CenterMassDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CenterMassDlg.h" -#include "GeometryGUI.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CenterMassDlg() -// purpose : Constructs a GeometryGUI_CenterMassDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_CenterMassDlg::GeometryGUI_CenterMassDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CENTERMASS"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_CenterMassDlg" ); - resize( 398, 219 ); - setCaption( tr( "GEOM_CMASS_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CenterMassDlgLayout = new QGridLayout( this ); - GeometryGUI_CenterMassDlgLayout->setSpacing( 6 ); - GeometryGUI_CenterMassDlgLayout->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_CenterMassDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CMASS" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); - GeometryGUI_CenterMassDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_OBJECT_RESULT" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEdit_X = new QLineEdit( GroupC1, "LineEdit_X" ); - LineEdit_X->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_X->sizePolicy().hasHeightForWidth() ) ); - LineEdit_X->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_X->setEnabled( FALSE ); - LineEdit_X->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_X, 1, 2 ); - TextLabel_Z = new QLabel( GroupC1, "TextLabel_Z" ); - TextLabel_Z->setText( tr( "GEOM_Z" ) ); - TextLabel_Z->setMinimumSize( QSize( 15, 0 ) ); - TextLabel_Z->setFrameShape( QLabel::NoFrame ); - TextLabel_Z->setFrameShadow( QLabel::Plain ); - TextLabel_Z->setMaximumSize( QSize( 15, 32767 ) ); - GroupC1Layout->addWidget( TextLabel_Z, 1, 5 ); - LineEdit_Z = new QLineEdit( GroupC1, "LineEdit_Z" ); - LineEdit_Z->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Z->sizePolicy().hasHeightForWidth() ) ); - LineEdit_Z->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_Z->setEnabled( FALSE ); - LineEdit_Z->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_Z, 1, 6 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - LineEdit_Y = new QLineEdit( GroupC1, "LineEdit_Y" ); - LineEdit_Y->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Y->sizePolicy().hasHeightForWidth() ) ); - LineEdit_Y->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_Y->setEnabled( FALSE ); - LineEdit_Y->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_Y, 1, 4 ); - TextLabel_Y = new QLabel( GroupC1, "TextLabel_Y" ); - TextLabel_Y->setText( tr( "GEOM_Y" ) ); - TextLabel_Y->setMinimumSize( QSize( 15, 0 ) ); - TextLabel_Y->setFrameShape( QLabel::NoFrame ); - TextLabel_Y->setFrameShadow( QLabel::Plain ); - TextLabel_Y->setMaximumSize( QSize( 15, 32767 ) ); - GroupC1Layout->addWidget( TextLabel_Y, 1, 3 ); - TextLabel_X = new QLabel( GroupC1, "TextLabel_X" ); - TextLabel_X->setText( tr( "GEOM_X" ) ); - TextLabel_X->setMinimumSize( QSize( 15, 0 ) ); - TextLabel_X->setFrameShape( QLabel::NoFrame ); - TextLabel_X->setFrameShadow( QLabel::Plain ); - TextLabel_X->setMaximumSize( QSize( 15, 32767 ) ); - GroupC1Layout->addWidget( TextLabel_X, 1, 1 ); - TextLabel_Center = new QLabel( GroupC1, "TextLabel_Center" ); - TextLabel_Center->setText( tr( "GEOM_CENTER" ) ); - TextLabel_Center->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Center->setFrameShape( QLabel::NoFrame ); - TextLabel_Center->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabel_Center, 1, 0 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setMinimumSize( QSize( 260, 0 ) ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 6 ); - GeometryGUI_CenterMassDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - -} - - -//================================================================================= -// function : ~GeometryGUI_CenterMassDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CenterMassDlg::~GeometryGUI_CenterMassDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::Init( SALOME_Selection* Sel ) -{ - LineEdit_X->setMaxLength( 9 ); - LineEdit_Y->setMaxLength( 9 ); - LineEdit_Z->setMaxLength( 9 ); - QDoubleValidator *Va = new QDoubleValidator( -999999, +999999, 3, LineEdit_X ) ; - QDoubleValidator *Vb = new QDoubleValidator( -999999, +999999, 3, LineEdit_Y ) ; - QDoubleValidator *Vc = new QDoubleValidator( -999999, +999999, 3, LineEdit_Z ) ; - LineEdit_X->setValidator( Va ) ; - LineEdit_Y->setValidator( Vb ) ; - LineEdit_Z->setValidator( Vc ) ; - - myConstructorId = 0 ; - - LineEdit_X->setText("") ; - LineEdit_Y->setText("") ; - LineEdit_Z->setText("") ; - - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - mySimulationTopoDs.Nullify() ; - myShape.Nullify() ; - myOkCenterMass = false ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CenterMassDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - if( myOkCenterMass) { - myGeomGUI->MakeCDGAndDisplay( myGeomShape ) ; - } - return ; -} - - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CenterMassDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - myEditCurrentArgument->setText("") ; - myOkCenterMass = false ; - Standard_Boolean testResult ; - - LineEdit_X->setText("") ; - LineEdit_Y->setText("") ; - LineEdit_Z->setText("") ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, this->myShape) ) - return ; - - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - if( this->CalculateAndDisplayCenterMass() ) { - myOkCenterMass = true ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_CenterMassDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayCenterMass() -// purpose : -//================================================================================= -bool GeometryGUI_CenterMassDlg::CalculateAndDisplayCenterMass() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - try { - - QString resString; - GProp_GProps System; - - if ( this->myShape.ShapeType() == TopAbs_VERTEX) { - myGeomGUI->VertexToPoint( this->myShape, this->myCenterMass ); - } - else if ( this->myShape.ShapeType() == TopAbs_EDGE || this->myShape.ShapeType() == TopAbs_WIRE ) { - BRepGProp::LinearProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; - } - else if ( this->myShape.ShapeType() == TopAbs_FACE || this->myShape.ShapeType() == TopAbs_SHELL ) { - BRepGProp::SurfaceProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; - } - else { - BRepGProp::VolumeProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; - } - - BRepBuilderAPI_MakeVertex V(this->myCenterMass) ; - mySimulationTopoDs = V.Shape() ; - - resString = tr("%1").arg( myCenterMass.X(), 12, 'f', 6 ) ; - LineEdit_X->setText(resString) ; - - resString = tr("%1").arg( myCenterMass.Y(), 12, 'f', 6 ) ; - LineEdit_Y->setText(resString) ; - - resString = tr("%1").arg( myCenterMass.Z(), 12, 'f', 6 ) ; - LineEdit_Z->setText(resString) ; - - - if( !mySimulationTopoDs.IsNull() ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return true ; - } - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayCenterMass()" << endl ) ; - } - return false ; -} - - diff --git a/GEOMGUI/GeometryGUI_CenterMassDlg.h b/GEOMGUI/GeometryGUI_CenterMassDlg.h deleted file mode 100644 index c56720724..000000000 --- a/GEOMGUI/GeometryGUI_CenterMassDlg.h +++ /dev/null @@ -1,121 +0,0 @@ -// 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_CenterMassDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_CMASS_H -#define DIALOGBOX_CMASS_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_CenterMassDlg -// purpose : -//================================================================================= -class GeometryGUI_CenterMassDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CenterMassDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CenterMassDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - bool CalculateAndDisplayCenterMass() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - TopoDS_Shape myShape ; /* Shape argument */ - gp_Pnt myCenterMass ; - bool myOkCenterMass ; /* true after center of mass simulation calculation */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEdit_X; - QLabel* TextLabel_Z; - QLineEdit* LineEdit_Z; - QLabel* TextLabelC1A1; - QLineEdit* LineEdit_Y; - QLabel* TextLabel_Y; - QLabel* TextLabel_X; - QLabel* TextLabel_Center; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void ClickOnOk() ; - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CenterMassDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_CMASS_H diff --git a/GEOMGUI/GeometryGUI_ChamferDlg.cxx b/GEOMGUI/GeometryGUI_ChamferDlg.cxx deleted file mode 100644 index 7029c86a8..000000000 --- a/GEOMGUI/GeometryGUI_ChamferDlg.cxx +++ /dev/null @@ -1,934 +0,0 @@ -// 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_ChamferDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ChamferDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -//================================================================================= -// class : GeometryGUI_ChamferDlg() -// purpose : Constructs a GeometryGUI_ChamferDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_ChamferDlg::GeometryGUI_ChamferDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - /***************************************************************/ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CHAMFER_ALL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CHAMFER_EDGE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CHAMFER_FACE"))); - - if ( !name ) - setName( "GeometryGUI_ChamferDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_CHAMFER_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ChamferDlgLayout = new QGridLayout( this ); - GeometryGUI_ChamferDlgLayout->setSpacing( 6 ); - GeometryGUI_ChamferDlgLayout->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_ChamferDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (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->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_CHAMFER_ALL" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_D1" ) ); - 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_D2" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - -// LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); -// LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - -// LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); -// LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - - SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - 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 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_CHAMFER_EDGES" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_D1" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" ); - TextLabelC2A3->setText( tr( "GEOM_D2" ) ); - TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A3->setFrameShape( QLabel::NoFrame ); - TextLabelC2A3->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - // LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); -// LineEditC2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - -// LineEditC2A3 = new QLineEdit( GroupC2, "LineEditC2A3" ); -// LineEditC2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC2Layout->addWidget( LineEditC2A3, 2, 2 ); - - SpinBox_C2A2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ; - SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 ); - - SpinBox_C2A3 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A3" ) ; - SpinBox_C2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A3->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A3, 2, 2 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - GroupC3 = new QGroupBox( this, "GroupC3" ); - GroupC3->setTitle( tr( "GEOM_CHAMFER_FACES" ) ); - GroupC3->setMinimumSize( QSize( 0, 0 ) ); - GroupC3->setFrameShape( QGroupBox::Box ); - GroupC3->setFrameShadow( QGroupBox::Sunken ); - GroupC3->setColumnLayout(0, Qt::Vertical ); - GroupC3->layout()->setSpacing( 0 ); - GroupC3->layout()->setMargin( 0 ); - GroupC3Layout = new QGridLayout( GroupC3->layout() ); - GroupC3Layout->setAlignment( Qt::AlignTop ); - GroupC3Layout->setSpacing( 6 ); - GroupC3Layout->setMargin( 11 ); - - TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" ); - TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A1->setFrameShape( QLabel::NoFrame ); - TextLabelC3A1->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 ); - - TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" ); - TextLabelC3A2->setText( tr( "GEOM_D1" ) ); - TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A2->setFrameShape( QLabel::NoFrame ); - TextLabelC3A2->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 ); - - TextLabelC3A3 = new QLabel( GroupC3, "TextLabelC3A3" ); - TextLabelC3A3->setText( tr( "GEOM_D2" ) ); - TextLabelC3A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A3->setFrameShape( QLabel::NoFrame ); - TextLabelC3A3->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A3, 2, 0 ); - - LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" ); - GroupC3Layout->addWidget( LineEditC3A1, 0, 2 ); - - // LineEditC3A2 = new QLineEdit( GroupC3, "LineEditC3A2" ); -// LineEditC3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC3Layout->addWidget( LineEditC3A2, 1, 2 ); - -// LineEditC3A3 = new QLineEdit( GroupC3, "LineEditC3A3" ); -// LineEditC3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC3Layout->addWidget( LineEditC3A3, 2, 2 ); - - SpinBox_C3A2 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ; - SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 ); - - SpinBox_C3A3 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A3" ) ; - SpinBox_C3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A3->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A3, 2, 2 ); - - SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" ); - SelectButtonC3A1->setText( tr( "" ) ); - SelectButtonC3A1->setPixmap( image1 ); - SelectButtonC3A1->setToggleButton( FALSE ); - SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupC3, 1, 0 ); - - /* Initialisation */ - Init( Sel, ic ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_ChamferDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ChamferDlg::~GeometryGUI_ChamferDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - /* 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_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD1 */ - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD2 */ - SpinBox_C1A3->SetValue( 50 ) ; - - SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C2A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A3->SetValue( 50 ) ; - - SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A2->SetValue( 50 ) ; - SpinBox_C3A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A3->SetValue( 50 ) ; - - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditC1A1 ; - myShape.Nullify() ; - myD1 = 50.0 ; - myOkD1 = true ; - myD2 = 50.0 ; - myOkD2 = true ; - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - mySimulationTopoDs.Nullify() ; - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC3A1, 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ChamferDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText(tr("")) ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId); - myGeomGUI->OnDisplayAll(true) ; - myUseLocalContext = false ; - } - } - - myOkShape = false ; - myD1 = 50.0 ; - myD2 = 50.0 ; - myOkD1 = true ; - myOkD2 = true ; - myConstructorId = constructorId ; - - switch (constructorId) - { - case 0: /* Chamfer All */ - { - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C1A3->SetValue( 50 ) ; - LineEditC1A1->setText(tr("")) ; - myShapeType = -1; - break; - } - - case 1: /* Chamfer edges */ - { - myShapeType = 6; - GroupC1->hide(); - GroupC2->show() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C2A3->SetValue( 50 ) ; - LineEditC2A1->setText(tr("")) ; - break ; - } - - case 2: /* Chamfer Faces */ - { - myShapeType = 4; - GroupC1->hide(); - GroupC2->hide() ; - GroupC3->show() ; - myEditCurrentArgument = LineEditC3A1 ; - SpinBox_C3A2->SetValue( 50 ) ; - SpinBox_C3A3->SetValue( 50 ) ; - LineEditC3A1->setText(tr("")) ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : /* Chamfer All */ - { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myGeomGUI->OnChamferGetAll( myShape, myD1, myD2, myShapeType, myShapeIOR ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 1 : /* Chamfer Edge */ - { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myGeomGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType, - myLocalContextId, myUseLocalContext ); - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 2 : /* Chamfer Face */ - { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myGeomGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType, - myLocalContextId, myUseLocalContext ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - - reject() ; - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_ChamferDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel == 1 ) { - - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - if ( !S.IsNull() && S.ShapeType() <= 2 ) { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; - } - } - } - - MakePreview(); - - } - } else - return; - - if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) { - /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ; - } -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC3A1 ) - myEditCurrentArgument = LineEditC3A1 ; - 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 : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - - case 1: - { - if(send ==SelectButtonC2A1 ) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send ==SelectButtonC3A1 ) { - LineEditC3A1->setFocus() ; - myEditCurrentArgument = LineEditC3A1; - SelectionIntoArgument() ; - } - break; - } - - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender(); - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - - if( send == SpinBox_C1A2 || send == SpinBox_C2A2 || send == SpinBox_C3A2 ) { /* D1 */ - myD1 = newValue ; - myOkD1 = true ; - MakePreview(); - return ; - } - if( send == SpinBox_C1A3 || send == SpinBox_C2A3 || send == SpinBox_C3A3 ) { /* D2 */ - myD2 = newValue ; - myOkD2 = true ; - MakePreview(); - return ; - } -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - this->ResetStateOfDialog() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupC3->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupC3->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - -void GeometryGUI_ChamferDlg::MakePreview() -{ - TopoDS_Shape tds ; - try - { - BRepFilletAPI_MakeChamfer MC(myShape); - switch (myConstructorId) - { - case 0: /* Chamfer All */ - { - TopTools_IndexedDataMapOfShapeListOfShape M; - TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,M); - for (int i = 1;i<=M.Extent();i++) - { - TopoDS_Edge E = TopoDS::Edge(M.FindKey(i)); - TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First()); - if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) - MC.Add(myD1, myD2,E,F); - } - tds = MC.Shape(); - break; - } -// case 1: /* Chamfer edges */ -// case 2: /* Chamfer Faces */ - } - if (!tds.IsNull()) - { - mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - - } - catch(Standard_Failure) - { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } -} diff --git a/GEOMGUI/GeometryGUI_ChamferDlg.h b/GEOMGUI/GeometryGUI_ChamferDlg.h deleted file mode 100644 index 22fe93ffa..000000000 --- a/GEOMGUI/GeometryGUI_ChamferDlg.h +++ /dev/null @@ -1,172 +0,0 @@ -// 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_ChamferDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CHAMFER_H -#define DIALOGBOX_CHAMFER_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -// Qt Includes -#include -#include -#include - -// Open CASCADE Includes -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_ChamferDlg -// purpose : -//================================================================================= -class GeometryGUI_ChamferDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ChamferDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_ChamferDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QDoubleValidator *myVb ; /* Double validator for numeric input */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - bool myOkShape ; - char* myShapeIOR ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - int myShapeType ; - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - void MakePreview(); - - bool myOkD1 ; - double myD1 ; - bool myOkD2 ; - double myD2 ; - - QButtonGroup* GroupConstructors; - - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - GeometryGUI_SpinBox* SpinBox_C1A2 ; - QLabel* TextLabelC1A2; - GeometryGUI_SpinBox* SpinBox_C1A3 ; - QLabel* TextLabelC1A3; - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - GeometryGUI_SpinBox* SpinBox_C2A2 ; - QLabel* TextLabelC2A2; - GeometryGUI_SpinBox* SpinBox_C2A3; - QLabel* TextLabelC2A3; - - QGroupBox* GroupC3; - QPushButton* SelectButtonC3A1; - QLineEdit* LineEditC3A1; - QLabel* TextLabelC3A1; - GeometryGUI_SpinBox* SpinBox_C3A2 ; - QLabel* TextLabelC3A2; - GeometryGUI_SpinBox* SpinBox_C3A3; - QLabel* TextLabelC3A3; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_ChamferDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; - QGridLayout* GroupC3Layout; -}; - -#endif // DIALOGBOX_CHAMFER_H - diff --git a/GEOMGUI/GeometryGUI_CheckShape.cxx b/GEOMGUI/GeometryGUI_CheckShape.cxx deleted file mode 100644 index dcb21a4ee..000000000 --- a/GEOMGUI/GeometryGUI_CheckShape.cxx +++ /dev/null @@ -1,402 +0,0 @@ -// 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_CheckShape.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CheckShape.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -// Open Cascade Include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_CheckShape() -// purpose : Constructs a GeometryGUI_CheckShape which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_CheckShape::GeometryGUI_CheckShape( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CHECKSHAPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "DialogBox_CHECKSHAPE" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_CHECK_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CheckShapeLayout = new QGridLayout( this ); - GeometryGUI_CheckShapeLayout->setSpacing( 6 ); - GeometryGUI_CheckShapeLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CHECK_SHAPE" ) ); - 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 ); - 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( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_CheckShapeLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_CHECK_INFOS") ); - 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_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - Text = new QTextView(GroupConstructor1); - Text->setTextFormat( Qt::PlainText ); - GroupConstructor1Layout->addMultiCellWidget( Text, 1, 1, 0, 2 ); - - GeometryGUI_CheckShapeLayout->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, 1 ); - // buttonApply = new QPushButton( GroupButtons, "buttonApply" ); -// buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); -// buttonApply->setAutoDefault( TRUE ); -// GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - 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_CheckShapeLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_CheckShape() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CheckShape::~GeometryGUI_CheckShape() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - SelectedName = ""; - - /* 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CheckShape::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CheckShape::SelectionIntoArgument() -{ - Text->setText("") ; - myEditCurrentArgument->setText("") ; - - SelectedName = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(SelectedName) ; - this->Check(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_CheckShape::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : Check() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::Check(const TopoDS_Shape S) -{ - - if( S.IsNull() ) - return ; - - try { - BRepCheck_Analyzer ana(S,false); - if (ana.IsValid()) - Text->setText( "This Shape seems to be valid." ); - else - Text->setText( "This Shape is not valid." ); - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in Check()" << endl ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_CheckShape.h b/GEOMGUI/GeometryGUI_CheckShape.h deleted file mode 100644 index ce9b51789..000000000 --- a/GEOMGUI/GeometryGUI_CheckShape.h +++ /dev/null @@ -1,110 +0,0 @@ -// 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_CheckShape.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CHECKSHAPE_H -#define DIALOGBOX_CHECKSHAPE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QTextView; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_CheckShape -// purpose : -//================================================================================= -class GeometryGUI_CheckShape : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CheckShape( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CheckShape(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void Check(const TopoDS_Shape S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QTextView* Text; - QString SelectedName; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CheckShapeLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_CHECKSHAPE_H diff --git a/GEOMGUI/GeometryGUI_CircleDlg.cxx b/GEOMGUI/GeometryGUI_CircleDlg.cxx deleted file mode 100644 index 026a62ec6..000000000 --- a/GEOMGUI/GeometryGUI_CircleDlg.cxx +++ /dev/null @@ -1,504 +0,0 @@ -// 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_CircleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CircleDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CircleDlg() -// purpose : Constructs a GeometryGUI_CircleDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_CircleDlg::GeometryGUI_CircleDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CIRCLE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_CircleDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_CIRCLE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CircleDlgLayout = new QGridLayout( this ); - GeometryGUI_CircleDlgLayout->setSpacing( 6 ); - GeometryGUI_CircleDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CIRCLE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_CircleDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_CENTER_POINT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); - GeometryGUI_CircleDlgLayout->addWidget( GroupC1, 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 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - 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 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - GeometryGUI_CircleDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_CircleDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CircleDlg::~GeometryGUI_CircleDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::Init( SALOME_Selection* Sel ) -{ - 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_C1A3->SetValue( 100.0 ) ; /* = myRadius */ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myRadius = 100.0 ; - myOkPoint1 = myOkDir = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - 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( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SpinBox_C1A3, 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CircleDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkDir) { - myGeomGUI->MakeCircleAndDisplay( myPoint1, myDir, myRadius) ; - } - break ; - } - } - // accept(); - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CircleDlg::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 ; - } - - /* 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 ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myOkPoint1 && myOkDir ) { - MakeCircleSimulationAndDisplay() ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::SetEditCurrentArgument() -{ - mySelection->ClearFilters() ; - QPushButton* send = (QPushButton*)sender(); - 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; - } - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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 : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ValueChangedInSpinBox( double newValue ) -{ - myRadius = newValue ; - - if (myOkPoint1 && myOkDir) { - MakeCircleSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeCircleSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::MakeCircleSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - - try { - gp_Ax2 axis( this->myPoint1, this->myDir ) ; - gp_Circ circ( axis, this->myRadius); - BRepBuilderAPI_MakeEdge MakeEdge( circ ); - mySimulationTopoDs = MakeEdge.Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeCircleSimulationAndDisplay" ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_CircleDlg.h b/GEOMGUI/GeometryGUI_CircleDlg.h deleted file mode 100644 index 8254f30b4..000000000 --- a/GEOMGUI/GeometryGUI_CircleDlg.h +++ /dev/null @@ -1,126 +0,0 @@ -// 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_CircleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CIRCLE_H -#define DIALOGBOX_CIRCLE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CircleDlg -// purpose : -//================================================================================= -class GeometryGUI_CircleDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CircleDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CircleDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - gp_Pnt myPoint1 ; - gp_Dir myDir ; - Standard_Real myRadius ; - bool myOkPoint1 ; - bool myOkDir ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */ - Handle(GEOM_EdgeFilter) myEdgeFilter; - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeCircleSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A2; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A3; - - GeometryGUI_SpinBox* SpinBox_C1A3; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_CircleDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_CIRCLE_H diff --git a/GEOMGUI/GeometryGUI_CommonDlg.cxx b/GEOMGUI/GeometryGUI_CommonDlg.cxx deleted file mode 100644 index 8b4d3a12d..000000000 --- a/GEOMGUI/GeometryGUI_CommonDlg.cxx +++ /dev/null @@ -1,467 +0,0 @@ -// 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_CommonDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CommonDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CommonDlg() -// purpose : Constructs a GeometryGUI_CommonDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_COMMON"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",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 ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_CommonDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -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", "Geometry"); - 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 */ - - return ; -} - - - -//================================================================================= -// 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 ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1 ) ; - } - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - 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 ; - } - - /* 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 ; - } - 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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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_CommonDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_CommonDlg::enterEvent( QEvent * ) -{ - 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 ; -} diff --git a/GEOMGUI/GeometryGUI_CommonDlg.h b/GEOMGUI/GeometryGUI_CommonDlg.h deleted file mode 100644 index 9e8844482..000000000 --- a/GEOMGUI/GeometryGUI_CommonDlg.h +++ /dev/null @@ -1,119 +0,0 @@ -// 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_CommonDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_COMMON_H -#define DIALOGBOX_COMMON_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CommonDlg -// purpose : -//================================================================================= -class GeometryGUI_CommonDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CommonDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CommonDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - 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 */ - - - 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CommonDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_COMMON_H diff --git a/GEOMGUI/GeometryGUI_CompoundDlg.cxx b/GEOMGUI/GeometryGUI_CompoundDlg.cxx deleted file mode 100644 index 1d061bf45..000000000 --- a/GEOMGUI/GeometryGUI_CompoundDlg.cxx +++ /dev/null @@ -1,375 +0,0 @@ -// 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_CompoundDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CompoundDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CompoundDlg() -// purpose : Constructs a GeometryGUI_CompoundDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_CompoundDlg::GeometryGUI_CompoundDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BUILD_COMPOUND"))); - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - if ( !name ) - setName( "GeometryGUI_CompoundDlg" ); - resize( 303, 175 ); - setCaption( tr( "GEOM_COMPOUND_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CompoundDlgLayout = new QGridLayout( this ); - GeometryGUI_CompoundDlgLayout->setSpacing( 6 ); - GeometryGUI_CompoundDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_COMPOUND" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image1 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_CompoundDlgLayout->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_CompoundDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image0 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - GeometryGUI_CompoundDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_CompoundDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CompoundDlg::~GeometryGUI_CompoundDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CompoundDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - myGeomGUI->MakeCompoundAndDisplay( myListShapes ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CompoundDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myOkListShapes = false; - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - - int nbSel = mySelection->IObjectCount() ; - if ( nbSel == 0 ) - return; - aString = tr( "%1_objects" ).arg( nbSel ); - - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_CompoundDlg.h b/GEOMGUI/GeometryGUI_CompoundDlg.h deleted file mode 100644 index 8bdbbc810..000000000 --- a/GEOMGUI/GeometryGUI_CompoundDlg.h +++ /dev/null @@ -1,106 +0,0 @@ -// 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_CompoundDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_COMPOUND_H -#define DIALOGBOX_COMPOUND_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CompoundDlg -// purpose : -//================================================================================= -class GeometryGUI_CompoundDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CompoundDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CompoundDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - bool myOkListShapes ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CompoundDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_COMPOUND_H diff --git a/GEOMGUI/GeometryGUI_ConeDlg.cxx b/GEOMGUI/GeometryGUI_ConeDlg.cxx deleted file mode 100644 index 50bb8cc81..000000000 --- a/GEOMGUI/GeometryGUI_ConeDlg.cxx +++ /dev/null @@ -1,788 +0,0 @@ -// 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_ConeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ConeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_ConeDlg() -// purpose : Constructs a GeometryGUI_ConeDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CONE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",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) ; -} - - -//================================================================================= -// function : ~GeometryGUI_ConeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ConeDlg::~GeometryGUI_ConeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 ; - - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - 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) ; - - /* 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() ) ) ; - - /* 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ConeDlg::ConstructorsClicked(int constructorId) -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - switch(myConstructorId) - { - case 0 : - { - GroupC1->hide(); - GroupC2->show(); - myConstructorId = constructorId ; - myOkHeight = myOkRadius1 = myOkRadius2 = myOkPoint1 = myOkDir = true ; - - SpinBox_Radius1->SetValue( 100.0 ) ; /* radius 1 */ - SpinBox_Radius2->SetValue( 0.0 ) ; /* radius 2 */ - SpinBox_Height->SetValue( 300.0 ) ; /* height */ - - 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 ; - } - 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 ; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - 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() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -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 ; - } - - /* 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 ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { - MakeConeSimulationAndDisplay() ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::SetEditCurrentArgument() -{ - 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 ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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() ; - - 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 ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeConeSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::MakeConeSimulationAndDisplay() -{ - 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() ; - } - else { - if( fabs(myHeight) > Precision::Confusion() ) - mySimulationTopoDs = BRepPrimAPI_MakeCone( anAxis, myRadius1, myRadius2, fabs(myHeight) ).Shape() ; - } - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeConeSimulationAndDisplay" ) ; - } - return ; -} - diff --git a/GEOMGUI/GeometryGUI_ConeDlg.h b/GEOMGUI/GeometryGUI_ConeDlg.h deleted file mode 100644 index 7811f1b58..000000000 --- a/GEOMGUI/GeometryGUI_ConeDlg.h +++ /dev/null @@ -1,152 +0,0 @@ -// 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_ConeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CONE_H -#define DIALOGBOX_CONE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QSpinBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_ConeDlg -// purpose : -//================================================================================= -class GeometryGUI_ConeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ConeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ConeDlg(); - -private: - - 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 ; - -private slots: - - void ConstructorsClicked(int constructorId); - 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; -}; - -#endif // DIALOGBOX_CONE_H diff --git a/GEOMGUI/GeometryGUI_CutDlg.cxx b/GEOMGUI/GeometryGUI_CutDlg.cxx deleted file mode 100644 index 103da4506..000000000 --- a/GEOMGUI/GeometryGUI_CutDlg.cxx +++ /dev/null @@ -1,472 +0,0 @@ -// 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_CutDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CutDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_CutDlg() -// purpose : Constructs a GeometryGUI_CutDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CUT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",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 ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_CutDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -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 ) -{ - 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", "Geometry"); - 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 */ - - return ; -} - - - -//================================================================================= -// 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 ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->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 ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - 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 ; - } - - /* 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 ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_CutDlg::enterEvent( QEvent * ) -{ - 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 ; -} diff --git a/GEOMGUI/GeometryGUI_CutDlg.h b/GEOMGUI/GeometryGUI_CutDlg.h deleted file mode 100644 index 1e7c6ed2e..000000000 --- a/GEOMGUI/GeometryGUI_CutDlg.h +++ /dev/null @@ -1,118 +0,0 @@ -// 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_CutDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CUT_H -#define DIALOGBOX_CUT_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CutDlg -// purpose : -//================================================================================= -class GeometryGUI_CutDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CutDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CutDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - 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 */ - - 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CutDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_CUT_H diff --git a/GEOMGUI/GeometryGUI_CylinderDlg.cxx b/GEOMGUI/GeometryGUI_CylinderDlg.cxx deleted file mode 100644 index 58e879861..000000000 --- a/GEOMGUI/GeometryGUI_CylinderDlg.cxx +++ /dev/null @@ -1,695 +0,0 @@ -// 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_CylinderDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CylinderDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CylinderDlg() -// purpose : Constructs a GeometryGUI_CylinderDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_CYLINDER_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",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 */ -} - - -//================================================================================= -// function : ~GeometryGUI_CylinderDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CylinderDlg::~GeometryGUI_CylinderDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 & initial values */ - /* First constructor : radius */ - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - /* First constructor : algebric height */ - SpinBox_C1A4->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - /* Second constructor : radius */ - SpinBox_Radius->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", "Geometry"); - 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) ; - - /* 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CylinderDlg::ConstructorsClicked(int constructorId) -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - switch(myConstructorId) - { - case 0 : - { - GroupC1->hide(); - GroupC2->show(); - myConstructorId = constructorId ; - myOkHeight = myOkRadius = myOkPoint1 = myOkDir = true ; - - 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 ; - } - 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 ; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->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 ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -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 ; - } - - /* 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 ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - MakeCylinderSimulationAndDisplay() ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::SetEditCurrentArgument() -{ - 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 ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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 */ - - 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 ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeCylinderSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::MakeCylinderSimulationAndDisplay() -{ - 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) ; - - mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, this->myRadius, fabs(myHeight) ).Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeCylinderSimulationAndDisplay" ) ; - } - return ; -} - diff --git a/GEOMGUI/GeometryGUI_CylinderDlg.h b/GEOMGUI/GeometryGUI_CylinderDlg.h deleted file mode 100644 index fafab604e..000000000 --- a/GEOMGUI/GeometryGUI_CylinderDlg.h +++ /dev/null @@ -1,146 +0,0 @@ -// 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_CylinderDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CYLINDER_H -#define DIALOGBOX_CYLINDER_H - -#include "SALOME_Selection.h" - -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QSpinBox; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CylinderDlg -// purpose : -//================================================================================= -class GeometryGUI_CylinderDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CylinderDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CylinderDlg(); - -private: - - 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 ; - -private slots: - - void ConstructorsClicked(int constructorId); - 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; -}; - -#endif // DIALOGBOX_CYLINDER_H diff --git a/GEOMGUI/GeometryGUI_DistanceDlg.cxx b/GEOMGUI/GeometryGUI_DistanceDlg.cxx deleted file mode 100644 index a87d68e0b..000000000 --- a/GEOMGUI/GeometryGUI_DistanceDlg.cxx +++ /dev/null @@ -1,589 +0,0 @@ -// 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_DistanceDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_DistanceDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "utilities.h" - -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" - -// Open CASCADE Includes -#include -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_DistanceDlg() -// purpose : Constructs a GeometryGUI_DistanceDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_DistanceDlg::GeometryGUI_DistanceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_MINDIST"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_DistanceDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_MINDIST_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - GeometryGUI_DistanceDlgLayout = new QGridLayout( this ); - GeometryGUI_DistanceDlgLayout->setSpacing( 6 ); - GeometryGUI_DistanceDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_DISTANCE" ) ); - 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_DistanceDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_MINDIST_OBJ" ) ); - 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_DistanceDlgLayout->addWidget( GroupConstructor1, 1, 0 ); - - TextLabel_Length = new QLabel( GroupConstructor1, "TextLabel_Length" ); - TextLabel_Length->setText( tr( "GEOM_LENGTH" ) ); - TextLabel_Length->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Length->setFrameShape( QLabel::NoFrame ); - TextLabel_Length->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Length, 2, 0 ); - LineEdit_Length = new QLineEdit( GroupConstructor1, "LineEdit_Length" ); - LineEdit_Length->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Length->sizePolicy().hasHeightForWidth() ) ); - // LineEdit_Length->setEnabled( FALSE ); - LineEdit_Length->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Length, 2, 2 ); - - /***************************************************************/ - 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_DistanceDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_DistanceDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_DistanceDlg::~GeometryGUI_DistanceDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::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", "Geometry"); - 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_DistanceDlg::ConstructorsClicked(int constructorId) -{ - EraseDistance(); - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::ClickOnApply() -{ - EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - this->MakeDistanceSimulationAndDisplay(myShape1 ,myShape2) ; - } - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::ClickOnCancel() -{ - EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_DistanceDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - LineEdit_Length->setText("") ; - myEditCurrentArgument->setText("") ; /* by default */ - QString aString = ""; /* 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 ; - } - - /* 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 ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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_DistanceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_DistanceDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::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() ) ); - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - - -//================================================================================= -// function : MakeDistanceSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape& S1, const TopoDS_Shape& S2) -{ - LineEdit_Length->setText("") ; - EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; - - BRepExtrema_DistShapeShape dst( S1, S2 ); - if (dst.IsDone()) { - int i; - for (i=1; i<= dst.NbSolution(); i++) { - gp_Pnt P1,P2; - P1 = (dst.PointOnShape1(i)); - P2 = (dst.PointOnShape2(i)); - - Standard_Real Dist = P1.Distance(P2); - if (Dist<=1.e-9) { - BRepBuilderAPI_MakeVertex MakeVertex(P1); - mySimulationTopoDs = MakeVertex.Vertex(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - LineEdit_Length->setText("0.0") ; - } else { - BRepBuilderAPI_MakeEdge MakeEdge(P1, P2); - mySimulationTopoDs = MakeEdge.Edge(); - - TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(P1); - TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(P2); - - QString S; - S.sprintf("%.1f",Dist); - Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension (V1,V2, new Geom_Plane (0.,0.,1.,0.), - Dist, TCollection_ExtendedString(strdup(S))); - - LineEdit_Length->setText(S) ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - return ; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - ic->Display( Distance ); - ic->UpdateCurrentViewer(); - } - } - } else - myGeomGUI->GetDesktop()->putInfo( tr( "GEOM_PRP_MIN_DIST" ) ); -} - - -//================================================================================= -// function : EraseDistance() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::EraseDistance() -{ - int count = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); - for ( int i = 0; i < count; i++ ) - if (myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - AIS_ListOfInteractive L; - ic->DisplayedObjects(AIS_KOI_Relation,-1,L); - AIS_ListIteratorOfListOfInteractive ite(L); - while (ite.More()) { - ic->Remove( ite.Value() ); - ic->UpdateCurrentViewer(); - ite.Next(); - } - } -} diff --git a/GEOMGUI/GeometryGUI_DistanceDlg.h b/GEOMGUI/GeometryGUI_DistanceDlg.h deleted file mode 100644 index 742fe38e2..000000000 --- a/GEOMGUI/GeometryGUI_DistanceDlg.h +++ /dev/null @@ -1,125 +0,0 @@ -// 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_DistanceDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_DISTANCE_H -#define DIALOGBOX_DISTANCE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_DistanceDlg -// purpose : -//================================================================================= -class GeometryGUI_DistanceDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_DistanceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_DistanceDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void MakeDistanceSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) ; - void EraseDistance() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; - TopoDS_Shape myShape2 ; - GEOM::GEOM_Shape_var myGeomShape1 ; - GEOM::GEOM_Shape_var myGeomShape2 ; - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1Shape; - QLineEdit* LineEditC1A2Shape; - QPushButton* SelectButtonC1A1Shape; - QPushButton* SelectButtonC1A2Shape; - QLabel* TextLabelC1A2Shape; - QLabel* TextLabelC1A1Shape; - - QLabel* TextLabel_Length; - QLineEdit* LineEdit_Length; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_DistanceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_DISTANCE_H diff --git a/GEOMGUI/GeometryGUI_EdgeDlg.cxx b/GEOMGUI/GeometryGUI_EdgeDlg.cxx deleted file mode 100644 index 305895df0..000000000 --- a/GEOMGUI/GeometryGUI_EdgeDlg.cxx +++ /dev/null @@ -1,462 +0,0 @@ -// 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_EdgeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_EdgeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_EdgeDlg() -// purpose : Constructs a GeometryGUI_EdgeDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_EdgeDlg::GeometryGUI_EdgeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BUILD_EDGE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_EdgeDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_EDGE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_EdgeDlgLayout = new QGridLayout( this ); - GeometryGUI_EdgeDlgLayout->setSpacing( 6 ); - GeometryGUI_EdgeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_EDGE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_EdgeDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_POINTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_POINT_I" ).arg("2") ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - GeometryGUI_EdgeDlgLayout->addWidget( GroupC1, 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_EdgeDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_EdgeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_EdgeDlg::~GeometryGUI_EdgeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - // GroupC2->hide(); - // GroupC3->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - 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( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_EdgeDlg::ConstructorsClicked(int constructorId) -{ - switch (constructorId) - { - case 0: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeLinearEdgeAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_EdgeDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkPoint2 = false ; - } - return ; - } - - // nbSel == 1 ! - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint2 = true ; - } - - if( myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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 : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - // TODO other constructors - // - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_EdgeDlg.h b/GEOMGUI/GeometryGUI_EdgeDlg.h deleted file mode 100644 index facdddc5f..000000000 --- a/GEOMGUI/GeometryGUI_EdgeDlg.h +++ /dev/null @@ -1,118 +0,0 @@ -// 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_EdgeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_EDGE_H -#define DIALOGBOX_EDGE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_EdgeDlg -// purpose : -//================================================================================= -class GeometryGUI_EdgeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_EdgeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_EdgeDlg(); - -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 */ - gp_Pnt myPoint2 ; - - bool myOkPoint1 ; /* true when myPoint is defined */ - bool myOkPoint2 ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_EdgeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_EDGE_H diff --git a/GEOMGUI/GeometryGUI_FaceDlg.cxx b/GEOMGUI/GeometryGUI_FaceDlg.cxx deleted file mode 100644 index bcf6b900f..000000000 --- a/GEOMGUI/GeometryGUI_FaceDlg.cxx +++ /dev/null @@ -1,420 +0,0 @@ -// 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_FaceDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FaceDlg.h" -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_FaceDlg() -// purpose : Constructs a GeometryGUI_FaceDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_FaceDlg::GeometryGUI_FaceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BUILD_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FaceDlg" ); - resize( 303, 208 ); - setCaption( tr( "GEOM_FACE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_FaceDlgLayout = new QGridLayout( this ); - GeometryGUI_FaceDlgLayout->setSpacing( 6 ); - GeometryGUI_FaceDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FACE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_FaceDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_FACE_FFW" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_WIRE" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_FACE_OPT" ) ); - CheckBox1->setChecked( TRUE ); - GroupC1Layout->addWidget( CheckBox1, 1, 2); - GeometryGUI_FaceDlgLayout->addWidget( GroupC1, 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_FaceDlgLayout->addWidget( GroupButtons, 2, 0 ); - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_FaceDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FaceDlg::~GeometryGUI_FaceDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - CheckBox1->setChecked( TRUE ); - - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkShape = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myWireFilter = new GEOM_ShapeTypeFilter( TopAbs_WIRE, myGeom ); - mySelection->AddFilter(myWireFilter) ; /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FaceDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape) { - myGeomGUI->MakeFaceAndDisplay(this->myGeomShape, this->CheckBox1->isChecked() ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->ResetState() ; - disconnect( mySelection, 0, this, 0 ); - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_FaceDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myOkShape = false; - myEditCurrentArgument->setText("") ; - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; - - // nbSel == 1 ! - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(this->mySelection, this->myShape) ) - return ; - - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - - myEditCurrentArgument->setText(aString) ; - this->myOkShape = true ; - - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myWireFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_FaceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - mySelection->ClearFilters() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_FaceDlg.h b/GEOMGUI/GeometryGUI_FaceDlg.h deleted file mode 100644 index 2b33a5161..000000000 --- a/GEOMGUI/GeometryGUI_FaceDlg.h +++ /dev/null @@ -1,113 +0,0 @@ -// 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_FaceDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FACE_H -#define DIALOGBOX_FACE_H - - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_FaceDlg -// purpose : -//================================================================================= -class GeometryGUI_FaceDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FaceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_FaceDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; /* topology used to fuse */ - GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */ - bool myOkShape ; /* to check when arguments is defined */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myWireFilter; /* Filter selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QCheckBox* CheckBox1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_FaceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_FACE_H diff --git a/GEOMGUI/GeometryGUI_FilletDlg.cxx b/GEOMGUI/GeometryGUI_FilletDlg.cxx deleted file mode 100644 index f1b313220..000000000 --- a/GEOMGUI/GeometryGUI_FilletDlg.cxx +++ /dev/null @@ -1,842 +0,0 @@ -// 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_FilletDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FilletDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - - -//================================================================================= -// class : GeometryGUI_FilletDlg() -// purpose : Constructs a GeometryGUI_FilletDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_FilletDlg::GeometryGUI_FilletDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - /***************************************************************/ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_FILLET_ALL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_FILLET_EDGE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_FILLET_FACE"))); - - if ( !name ) - setName( "GeometryGUI_FilletDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_FILLET_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_FilletDlgLayout = new QGridLayout( this ); - GeometryGUI_FilletDlgLayout->setSpacing( 6 ); - GeometryGUI_FilletDlgLayout->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_FilletDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FILLET" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (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->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_FILLET_ALL" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_FILLET_EDGES" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - SpinBox_C2A2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ; - SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - GroupC3 = new QGroupBox( this, "GroupC3" ); - GroupC3->setTitle( tr( "GEOM_FILLET_FACES" ) ); - GroupC3->setMinimumSize( QSize( 0, 0 ) ); - GroupC3->setFrameShape( QGroupBox::Box ); - GroupC3->setFrameShadow( QGroupBox::Sunken ); - GroupC3->setColumnLayout(0, Qt::Vertical ); - GroupC3->layout()->setSpacing( 0 ); - GroupC3->layout()->setMargin( 0 ); - GroupC3Layout = new QGridLayout( GroupC3->layout() ); - GroupC3Layout->setAlignment( Qt::AlignTop ); - GroupC3Layout->setSpacing( 6 ); - GroupC3Layout->setMargin( 11 ); - - TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" ); - TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A1->setFrameShape( QLabel::NoFrame ); - TextLabelC3A1->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 ); - - TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" ); - TextLabelC3A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A2->setFrameShape( QLabel::NoFrame ); - TextLabelC3A2->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 ); - - LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" ); - GroupC3Layout->addWidget( LineEditC3A1, 0, 2 ); - - SpinBox_C3A2 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ; - SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 ); - - SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" ); - SelectButtonC3A1->setText( tr( "" ) ); - SelectButtonC3A1->setPixmap( image1 ); - SelectButtonC3A1->setToggleButton( FALSE ); - SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupC3, 1, 0 ); - - /* Initialisation */ - Init( Sel, ic ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_FilletDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FilletDlg::~GeometryGUI_FilletDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - /* 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_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A2->SetValue( 50 ) ; - - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditC1A1 ; - myShape.Nullify() ; - myRadius = 50.0 ; - myOkRadius = true ; - myIC = ic ; - myLocalContextId = -1 ; - myUseLocalContext = false ; - myOkShape = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - mySimulationTopoDs.Nullify() ; - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC3A1, 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FilletDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText(tr("")) ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - myGeomGUI->OnDisplayAll(true) ; - this->myUseLocalContext = false ; - } - } - - myOkShape = false ; - myRadius = 50.0 ; - myOkRadius = true ; - myConstructorId = constructorId ; - - // connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - switch (constructorId) - { - case 0: /* Fillet All */ - { - myShapeType = -1; - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A2->SetValue( 50 ) ;; - LineEditC1A1->setText(tr("")) ; - break; - } - - case 1: /* Fillet edges */ - { - myShapeType = 6; - GroupC1->hide(); - GroupC2->show() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A2->SetValue( 50 ) ;; - LineEditC2A1->setText(tr("")) ; - break ; - } - - case 2: /* Fillet Faces */ - { - myShapeType = 4; - GroupC1->hide(); - GroupC2->hide() ; - GroupC3->show() ; - myEditCurrentArgument = LineEditC3A1 ; - SpinBox_C3A2->SetValue( 50 ) ;; - LineEditC3A1->setText(tr("")) ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : /* Fillet All */ - { - if(myOkRadius) { - if( myOkShape ) { - testResult = myGeomGUI->OnFilletGetAll( myShape, myRadius, myShapeType, myShapeIOR ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 1 : /* Fillet Edge */ - { - if(myOkRadius) { - if( myOkShape ) { - testResult = myGeomGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext ); - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 2 : /* Fillet Face */ - { - if(myOkRadius) { - if( myOkShape ) { - testResult = myGeomGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - reject() ; - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC3A1 ) - myEditCurrentArgument = LineEditC3A1 ; - 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 : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_FilletDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel == 1 ) { - - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - if ( !S.IsNull() && S.ShapeType() <= 2 ) { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; - } - } - } - } - - MakePreview(); - - } else - return; - - if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) { - /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ; - } -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - - case 1: - { - if(send ==SelectButtonC2A1 ) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send ==SelectButtonC3A1 ) { - LineEditC3A1->setFocus() ; - myEditCurrentArgument = LineEditC3A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ValueChangedInSpinBox( double newValue ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myRadius = newValue ; - myOkRadius = true ; - - MakePreview(); -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - this->ResetStateOfDialog() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupC3->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupC3->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - - -void GeometryGUI_FilletDlg::MakePreview() -{ - TopoDS_Shape tds ; - try - { - BRepFilletAPI_MakeFillet fill(myShape); - switch (myConstructorId) - { - case 0: /* Fillet All */ - { - TopExp_Explorer Exp ( myShape, TopAbs_EDGE ); - for (Exp; Exp.More(); Exp.Next()) - { - TopoDS_Edge E =TopoDS::Edge(Exp.Current()); - fill.Add(E); - } - for (int i = 1;i<=fill.NbContours();i++) - fill.SetRadius(myRadius,i); - - tds = fill.Shape(); - break; - } -// case 1: /* Fillet edges */ -// case 2: /* Fillet Faces */ - } - if (!tds.IsNull()) - { - mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - } - catch(Standard_Failure) - { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } -} diff --git a/GEOMGUI/GeometryGUI_FilletDlg.h b/GEOMGUI/GeometryGUI_FilletDlg.h deleted file mode 100644 index 775bcc9f6..000000000 --- a/GEOMGUI/GeometryGUI_FilletDlg.h +++ /dev/null @@ -1,163 +0,0 @@ -// 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_FilletDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FILLET_H -#define DIALOGBOX_FILLET_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -// Qt Includes -#include -#include -#include - -// Open CASCADE Includes -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_FilletDlg -// purpose : -//================================================================================= -class GeometryGUI_FilletDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FilletDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_FilletDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - QDoubleValidator *myVa ; /* Double validator for numeric input */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - void MakePreview(); - - TopoDS_Shape myShape ; - bool myOkShape ; - char* myShapeIOR ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - int myShapeType ; - - bool myOkRadius ; - double myRadius ; - - QButtonGroup* GroupConstructors; - - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - GeometryGUI_SpinBox* SpinBox_C1A2 ; - QLabel* TextLabelC1A2; - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - GeometryGUI_SpinBox* SpinBox_C2A2 ; - QLabel* TextLabelC2A2; - - QGroupBox* GroupC3; - QPushButton* SelectButtonC3A1; - QLineEdit* LineEditC3A1; - QLabel* TextLabelC3A1; - GeometryGUI_SpinBox* SpinBox_C3A2 ; - QLabel* TextLabelC3A2; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void LineEditReturnPressed() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_FilletDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; - QGridLayout* GroupC3Layout; -}; - -#endif // DIALOGBOX_FILLET_H - diff --git a/GEOMGUI/GeometryGUI_FillingDlg.cxx b/GEOMGUI/GeometryGUI_FillingDlg.cxx deleted file mode 100644 index 7d1e32a5b..000000000 --- a/GEOMGUI/GeometryGUI_FillingDlg.cxx +++ /dev/null @@ -1,644 +0,0 @@ -// 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_FillingDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FillingDlg.h" - -#include "GeometryGUI.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_FillingDlg() -// purpose : Constructs a GeometryGUI_FillingDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_FillingDlg::GeometryGUI_FillingDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_FILLING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FillingDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_FILLING_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_FillingDlgLayout = new QGridLayout( this ); - GeometryGUI_FillingDlgLayout->setSpacing( 6 ); - GeometryGUI_FillingDlgLayout->setMargin( 11 ); - - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FILLING" ) ); - 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 ); - - 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 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - - GeometryGUI_FillingDlgLayout->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_FillingDlgLayout->addWidget( GroupButtons, 2, 0 ); - -// GroupC1 = new QGroupBox( this, "GroupC1" ); -// GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) ); -// GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); -// 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 ); - -// LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); -// LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 5 ); - -// TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); -// TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) ); -// TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A2->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A2->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - -// LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); -// LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 1, 2 ); - -// TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); -// TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) ); -// TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A3->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A3->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A3, 1, 4 ); - -// TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" ); -// TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) ); -// TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A5->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A5->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A5, 2, 4 ); - -// LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); -// LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A3->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addWidget( LineEditC1A3, 1, 5 ); - -// LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" ); -// LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A5->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addWidget( LineEditC1A5, 2, 5 ); - -// TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); -// TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) ); -// TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) ); -// TextLabelC1A1->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A1->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 ); - -// SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); -// SelectButtonC1A1->setText( tr( "" ) ); -// SelectButtonC1A1->setPixmap( image1 ); - -// GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 ); - -// TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); -// TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) ); -// TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A4->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A4->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 ); - -// TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" ); -// TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) ); -// TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A6->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A6->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 ); - -// LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" ); -// LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A4->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 ); - -// LineEditC1A6 = new QLineEdit( GroupC1, "LineEditC1A6" ); -// LineEditC1A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A6->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A6->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A6, 3, 3, 1, 2 ); -// QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); -// GroupC1Layout->addItem( spacer_3, 1, 3 ); -// QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); -// GroupC1Layout->addItem( spacer_4, 2, 3 ); -// QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); -// GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 5 ); - -// GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 ); - - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - 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 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 6 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" ); - TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) ); - TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A5->setFrameShape( QLabel::NoFrame ); - TextLabelC1A5->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A5, 2, 5 ); - - LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" ); - LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A5->setMinimumSize( QSize( 40, 0 ) ); - - GroupC1Layout->addWidget( LineEditC1A5, 2, 6 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) ); - TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 ); - - TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" ); - TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) ); - TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A6->setFrameShape( QLabel::NoFrame ); - TextLabelC1A6->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupC1Layout->addItem( spacer_3, 1, 3 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupC1Layout->addMultiCell( spacer_4, 2, 2, 3, 4 ); - QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 6 ); - - SpinBox_C1A2 = new QSpinBox( GroupC1, "SpinBox_C1A2" ); - SpinBox_C1A2->setMinValue( 1 ); - SpinBox_C1A2->setMaxValue( 15 ); - SpinBox_C1A2->setWrapping( TRUE ); - - GroupC1Layout->addMultiCellWidget( SpinBox_C1A2, 1, 1, 1, 2 ); - - LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" ); - LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A4->setMinimumSize( QSize( 40, 0 ) ); - - GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addMultiCellWidget( TextLabelC1A3, 1, 1, 4, 5 ); - - SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" ); - SpinBox_C1A3->setMinValue( 1 ); - SpinBox_C1A3->setMaxValue( 15 ); - SpinBox_C1A3->setWrapping( TRUE ); - - GroupC1Layout->addWidget( SpinBox_C1A3, 1, 6 ); - - SpinBox_C1A6 = new QSpinBox( GroupC1, "SpinBox_C1A6" ); - SpinBox_C1A6->setMinValue( 1 ); - SpinBox_C1A6->setMaxValue( 30 ); - SpinBox_C1A6->setWrapping( TRUE ); - - GroupC1Layout->addMultiCellWidget( SpinBox_C1A6, 3, 3, 1, 2 ); - - GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 ); - - /* Initialisations */ - Init(Sel) ; -} - - -//================================================================================= -// function : ~GeometryGUI_FillingDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FillingDlg::~GeometryGUI_FillingDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::Init( SALOME_Selection* Sel ) -{ - - LineEditC1A4->setMaxLength( 10 ); /* myTol3D */ - LineEditC1A5->setMaxLength( 10 ); /* myTol2D */ - QDoubleValidator *Vc = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A4 ) ; - QDoubleValidator *Vd = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A5 ) ; - LineEditC1A4->setValidator( Vc) ; - LineEditC1A5->setValidator( Vd) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - SpinBox_C1A2->setValue(2) ; /* myMinDeg */ - SpinBox_C1A3->setValue(5) ; /* myMaxDeg */ - LineEditC1A4->setText("0.0001") ; /* myTol3D */ - LineEditC1A5->setText("0.0001") ; /* myTol2D */ - SpinBox_C1A6->setValue(5) ; /* myNbIter */ - - this->myMinDeg = 2 ; - this->myMaxDeg = 5 ; - this->myTol3D = 0.0001 ; - this->myTol2D = 0.0001 ; - this->myNbIter = 5 ; - - myOkSectionShape = false ; - mySectionShape.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myCompoundFilter = new GEOM_ShapeTypeFilter( TopAbs_COMPOUND, myGeom ); - /* first filter used */ - mySelection->AddFilter(myCompoundFilter) ; - - /* 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( LineEditC1A1, 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 ) ; - /* Displays Dialog */ - this->show() ; - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FillingDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - this->myMinDeg = SpinBox_C1A2->value() ; - this->myMaxDeg = SpinBox_C1A3->value() ; - this->myTol3D = LineEditC1A4->text().toDouble(); - this->myTol2D = LineEditC1A5->text().toDouble(); - this->myNbIter = SpinBox_C1A6->value() ; - if(myOkSectionShape) { - myGeomGUI->MakeFillingAndDisplay( myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_FillingDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkSectionShape = false ; - } - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 && S.ShapeType() == TopAbs_COMPOUND ) { - myEditCurrentArgument->setText(aString) ; - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myOkSectionShape = true ; - } - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myCompoundFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_FillingDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_FillingDlg.h b/GEOMGUI/GeometryGUI_FillingDlg.h deleted file mode 100644 index b41726884..000000000 --- a/GEOMGUI/GeometryGUI_FillingDlg.h +++ /dev/null @@ -1,127 +0,0 @@ -// 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_FillingDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FILLING_H -#define DIALOGBOX_FILLING_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QSpinBox; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_FillingDlg -// purpose : -//================================================================================= -class GeometryGUI_FillingDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FillingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_FillingDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Shape_var myGeomShape ; /* is mySectionShape */ - TopoDS_Shape mySectionShape ; - Standard_Integer myMinDeg ; - Standard_Integer myMaxDeg ; - Standard_Real myTol3D ; - Standard_Real myTol2D ; - Standard_Integer myNbIter ; - - bool myOkSectionShape ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myCompoundFilter ; /* Filter selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A5; - - QLineEdit* LineEditC1A5; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A4; - QLabel* TextLabelC1A6; - QLineEdit* LineEditC1A4; - - QSpinBox* SpinBox_C1A2; - QSpinBox* SpinBox_C1A3; - QSpinBox* SpinBox_C1A6; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_FillingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_FILLING_H diff --git a/GEOMGUI/GeometryGUI_FillingHoleDlg.cxx b/GEOMGUI/GeometryGUI_FillingHoleDlg.cxx deleted file mode 100644 index 2b81c4283..000000000 --- a/GEOMGUI/GeometryGUI_FillingHoleDlg.cxx +++ /dev/null @@ -1,542 +0,0 @@ -// 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_FillingHoleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FillingHoleDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_FillingHoleDlg() -// purpose : Constructs a GeometryGUI_FillingHoleDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_FillingHoleDlg::GeometryGUI_FillingHoleDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SEWING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FillingHoleDlg" ); - resize( 303, 203 ); - setCaption( tr( "Filling hole" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_FillingHoleDlgLayout = new QGridLayout( this ); - GeometryGUI_FillingHoleDlgLayout->setSpacing( 6 ); - GeometryGUI_FillingHoleDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_FillingHoleDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - Layout2 = new QHBoxLayout; - Layout2->setSpacing( 6 ); - Layout2->setMargin( 0 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "Main object" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - Layout2->addWidget( TextLabelC1A1 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout2->addWidget( SelectButtonC1A1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout2->addWidget( LineEditC1A1 ); - GroupC1Layout->addLayout( Layout2, 0, 0 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "Select edges of hole on main object" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox1, 1, 0 ); - GeometryGUI_FillingHoleDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - 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 ); - buttonClose = new QPushButton( GroupButtons, "buttonClose" ); - buttonClose->setText( tr( "&Close" ) ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose, 0, 3 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "&Ok" ) ); - buttonOk->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "&Apply" ) ); - buttonApply->setAutoDefault( TRUE ); - buttonApply->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_2, 0, 2 ); - GeometryGUI_FillingHoleDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisations */ - Init(Sel, ic) ; - -} - - -//================================================================================= -// function : ~GeometryGUI_FillingHoleDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FillingHoleDlg::~GeometryGUI_FillingHoleDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FillingHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; - - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = false ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) ); - connect( GroupConstructors, SIGNAL( clicked(int) ), this, SLOT( ConstructorsClicked(int) )); - - connect( LineEditC1A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - connect( CheckBox1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserSelection() )); - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() )); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnClose() )); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FillingHoleDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : Same than click on apply but close this dialog. -//================================================================================= -void GeometryGUI_FillingHoleDlg::ClickOnOk() -{ - this->ClickOnApply() ; - accept(); - - return ; -} - - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FillingHoleDlg::ClickOnApply() -{ - bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if( myOkShape && myOkSelectSubMode ) { - testResult = myGeomGUI->OnFillingHole( myShape, myShapeIOR, myLocalContextId, myUseLocalContext ) ; - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("Operation aborted")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("Operation done")); - } - /* Reset arguments to allow a new selection */ - this->ResetStateOfDialog() ; - break ; - } - } - return ; -} - - - -//================================================================================= -// function : ClickOnClose() -// purpose : -//================================================================================= -void GeometryGUI_FillingHoleDlg::ClickOnClose() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 (LineEditC1A1) -//================================================================================= -void GeometryGUI_FillingHoleDlg::SelectionIntoArgument() -{ - - /* Reset argument and local context when selection as changed */ - this->ResetStateOfDialog() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; - - /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - -// if( !IO->hasEntry() ) { -// myGeomGUI->GetDesktop()->putInfo(tr("Main shape must be in the study before")) ; -// return ; -// } - - /* Test the exact type of topology to fill an hole */ - if ( !S.IsNull() && ( S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_COMPOUND ) ) { - - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; - return; - } - - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - LineEditC1A1->setText(aString) ; - return; - } - } - } - - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FillingHoleDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FillingHoleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_FillingHoleDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FillingHoleDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : Mouse enter onto the dialog to activate it -//================================================================================= -void GeometryGUI_FillingHoleDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FillingHoleDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnClose() ; - return ; -} - - -//================================================================================= -// function : ActivateUserSelection() -// purpose : Activate selection of faces when CheckBox1->isChecked()... -//================================================================================= -void GeometryGUI_FillingHoleDlg::ActivateUserSelection() -{ - - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("Select main shape first")) ; - return ; - } - - this->myOkSelectSubMode = CheckBox1->isChecked() ; - - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - - if( myOkShape && myOkSelectSubMode ) { - /* local context is defined into the method : GEOM::EDGE sub selection */ - TopAbs_ShapeEnum aType = TopAbs_EDGE ; - myGeomGUI->PrepareSubShapeSelection( int(aType), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("Select edges to fill an hole and click on Ok/Apply")) ; - } - return ; -} - - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : Completely reset the state of method including local context -//================================================================================= -void GeometryGUI_FillingHoleDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Select sub shapes mode not checked */ - this->myOkSelectSubMode = false ; - this->CheckBox1->setChecked( FALSE ); - - /* Close its local contact if opened */ - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - - diff --git a/GEOMGUI/GeometryGUI_FillingHoleDlg.h b/GEOMGUI/GeometryGUI_FillingHoleDlg.h deleted file mode 100644 index 8e0b758df..000000000 --- a/GEOMGUI/GeometryGUI_FillingHoleDlg.h +++ /dev/null @@ -1,133 +0,0 @@ -// 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_FillingHoleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef GEOMETRYGUI_FILLINGHOLE_H -#define GEOMETRYGUI_FILLINGHOLE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_FillingHoleDlg -// purpose : -//================================================================================= -class GeometryGUI_FillingHoleDlg : public QDialog -{ - Q_OBJECT - -public : - GeometryGUI_FillingHoleDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_FillingHoleDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - char* myShapeIOR ; - bool myOkShape ; - - bool myOkSelectSubMode ; /* true = sub mode selection activated */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QCheckBox* CheckBox1; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonApply; - QPushButton* buttonClose; - - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnApply() ; - void ClickOnClose(); - - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ActivateUserSelection() ; - -protected: - - QGridLayout* GeometryGUI_FillingHoleDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* Layout2; - QGridLayout* GroupButtonsLayout; -}; - -#endif // GEOMETRYGUI_FILLINGHOLE_H diff --git a/GEOMGUI/GeometryGUI_FuseDlg.cxx b/GEOMGUI/GeometryGUI_FuseDlg.cxx deleted file mode 100644 index 773cd5893..000000000 --- a/GEOMGUI/GeometryGUI_FuseDlg.cxx +++ /dev/null @@ -1,477 +0,0 @@ -// 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_FuseDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FuseDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_FuseDlg() -// purpose : Constructs a GeometryGUI_FuseDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_FuseDlg::GeometryGUI_FuseDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_FUSE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FuseDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_FUSE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - GeometryGUI_FuseDlgLayout = new QGridLayout( this ); - GeometryGUI_FuseDlgLayout->setSpacing( 6 ); - GeometryGUI_FuseDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FUSE" ) ); - 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_FuseDlgLayout->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_FuseDlgLayout->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_FuseDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_FuseDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FuseDlg::~GeometryGUI_FuseDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::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", "Geometry"); - 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( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FuseDlg::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 ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3 ) ; - } - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_FuseDlg::SelectionIntoArgument() -{ - - myEditCurrentArgument->setText("") ; /* by default */ - QString aString = ""; /* 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 ; - } - - /* 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 ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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_FuseDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_FuseDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::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 ; -} diff --git a/GEOMGUI/GeometryGUI_FuseDlg.h b/GEOMGUI/GeometryGUI_FuseDlg.h deleted file mode 100644 index 67a2911b1..000000000 --- a/GEOMGUI/GeometryGUI_FuseDlg.h +++ /dev/null @@ -1,119 +0,0 @@ -// 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_FuseDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FUSE_H -#define DIALOGBOX_FUSE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_FuseDlg -// purpose : -//================================================================================= -class GeometryGUI_FuseDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FuseDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_FuseDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - 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 */ - - - 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_FuseDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_FUSE_H diff --git a/GEOMGUI/GeometryGUI_InertiaDlg.cxx b/GEOMGUI/GeometryGUI_InertiaDlg.cxx deleted file mode 100644 index 9f55075a7..000000000 --- a/GEOMGUI/GeometryGUI_InertiaDlg.cxx +++ /dev/null @@ -1,566 +0,0 @@ -// 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_InertiaDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM - -using namespace std; -#include "GeometryGUI_InertiaDlg.h" - -#include "GeometryGUI.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_InertiaDlg() -// purpose : Constructs a GeometryGUI_InertiaDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_InertiaDlg::GeometryGUI_InertiaDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_INERTIA"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_InertiaDlg" ); - resize( 356, 303 ); - setCaption( tr( "GEOM_INERTIA_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_InertiaDlgLayout = new QGridLayout( this ); - GeometryGUI_InertiaDlgLayout->setSpacing( 6 ); - GeometryGUI_InertiaDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_INERTIA_CONSTR" ) ); - 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_InertiaDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_OBJECT_RESULT" ) ); - 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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - 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() ) ); - LineEditC1A1->setMinimumSize( QSize( 220, 0 ) ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 4 ); - TextLabel_Matrix = new QLabel( GroupC1, "TextLabel_Matrix" ); - TextLabel_Matrix->setText( tr( "GEOM_MATRIX" ) ); - TextLabel_Matrix->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Matrix->setFrameShape( QLabel::NoFrame ); - TextLabel_Matrix->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabel_Matrix, 1, 0 ); - TextLabelMatrix_11 = new QLabel( GroupC1, "TextLabelMatrix_11" ); - TextLabelMatrix_11->setText( tr( "GEOM_INERTIA_I" ).arg("1") ); - TextLabelMatrix_11->setMinimumSize( QSize( 0, 0 ) ); - TextLabelMatrix_11->setFrameShape( QLabel::NoFrame ); - TextLabelMatrix_11->setFrameShadow( QLabel::Plain ); - TextLabelMatrix_11->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addWidget( TextLabelMatrix_11, 1, 1 ); - TextLabelMatrix_21 = new QLabel( GroupC1, "TextLabelMatrix_21" ); - TextLabelMatrix_21->setText( tr( "GEOM_INERTIA_I" ).arg("2") ); - TextLabelMatrix_21->setMinimumSize( QSize( 0, 0 ) ); - TextLabelMatrix_21->setFrameShape( QLabel::NoFrame ); - TextLabelMatrix_21->setFrameShadow( QLabel::Plain ); - TextLabelMatrix_21->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addWidget( TextLabelMatrix_21, 2, 1 ); - TextLabelMatrix_31 = new QLabel( GroupC1, "TextLabelMatrix_31" ); - TextLabelMatrix_31->setText( tr( "GEOM_INERTIA_I" ).arg("3") ); - TextLabelMatrix_31->setMinimumSize( QSize( 0, 0 ) ); - TextLabelMatrix_31->setFrameShape( QLabel::NoFrame ); - TextLabelMatrix_31->setFrameShadow( QLabel::Plain ); - TextLabelMatrix_31->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addWidget( TextLabelMatrix_31, 3, 1 ); - LineEdit_L1C1 = new QLineEdit( GroupC1, "LineEdit_L1C1" ); - LineEdit_L1C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C1->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L1C1->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L1C1->setEnabled( FALSE ); - LineEdit_L1C1->setReadOnly( TRUE ); - LineEdit_L1C1->setText( tr( "" ) ); - GroupC1Layout->addWidget( LineEdit_L1C1, 1, 2 ); - LineEdit_L1C2 = new QLineEdit( GroupC1, "LineEdit_L1C2" ); - LineEdit_L1C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C2->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L1C2->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L1C2->setEnabled( FALSE ); - LineEdit_L1C2->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L1C2, 1, 3 ); - LineEdit_L1C3 = new QLineEdit( GroupC1, "LineEdit_L1C3" ); - LineEdit_L1C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C3->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L1C3->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L1C3->setEnabled( FALSE ); - LineEdit_L1C3->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L1C3, 1, 4 ); - LineEdit_L2C1 = new QLineEdit( GroupC1, "LineEdit_L2C1" ); - LineEdit_L2C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C1->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L2C1->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L2C1->setEnabled( FALSE ); - LineEdit_L2C1->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L2C1, 2, 2 ); - LineEdit_L2C2 = new QLineEdit( GroupC1, "LineEdit_L2C2" ); - LineEdit_L2C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C2->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L2C2->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L2C2->setEnabled( FALSE ); - LineEdit_L2C2->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L2C2, 2, 3 ); - LineEdit_L2C3 = new QLineEdit( GroupC1, "LineEdit_L2C3" ); - LineEdit_L2C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C3->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L2C3->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L2C3->setEnabled( FALSE ); - LineEdit_L2C3->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L2C3, 2, 4 ); - LineEdit_L3C1 = new QLineEdit( GroupC1, "LineEdit_L3C1" ); - LineEdit_L3C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C1->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L3C1->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L3C1->setEnabled( FALSE ); - LineEdit_L3C1->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L3C1, 3, 2 ); - LineEdit_L3C2 = new QLineEdit( GroupC1, "LineEdit_L3C2" ); - LineEdit_L3C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C2->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L3C2->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L3C2->setEnabled( FALSE ); - LineEdit_L3C2->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L3C2, 3, 3 ); - LineEdit_L3C3 = new QLineEdit( GroupC1, "LineEdit_L3C3" ); - LineEdit_L3C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C3->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L3C3->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L3C3->setEnabled( FALSE ); - LineEdit_L3C3->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L3C3, 3, 4 ); - LineEdit_IX = new QLineEdit( GroupC1, "LineEdit_IX" ); - LineEdit_IX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IX->sizePolicy().hasHeightForWidth() ) ); - LineEdit_IX->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_IX->setEnabled( FALSE ); - LineEdit_IX->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_IX, 4, 2 ); - LineEdit_IY = new QLineEdit( GroupC1, "LineEdit_IY" ); - LineEdit_IY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IY->sizePolicy().hasHeightForWidth() ) ); - LineEdit_IY->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_IY->setEnabled( FALSE ); - LineEdit_IY->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_IY, 4, 3 ); - LineEdit_IZ = new QLineEdit( GroupC1, "LineEdit_IZ" ); - LineEdit_IZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IZ->sizePolicy().hasHeightForWidth() ) ); - LineEdit_IZ->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_IZ->setEnabled( FALSE ); - LineEdit_IZ->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_IZ, 4, 4 ); - TextLabel_IXIYIZ = new QLabel( GroupC1, "TextLabel_IXIYIZ" ); - TextLabel_IXIYIZ->setText( tr( "GEOM_INERTIA_IXYZ" ) ); - TextLabel_IXIYIZ->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_IXIYIZ->setFrameShape( QLabel::NoFrame ); - TextLabel_IXIYIZ->setFrameShadow( QLabel::Plain ); - TextLabel_IXIYIZ->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addMultiCellWidget( TextLabel_IXIYIZ, 4, 4, 0, 1 ); - GeometryGUI_InertiaDlgLayout->addWidget( GroupC1, 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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - GeometryGUI_InertiaDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_InertiaDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_InertiaDlg::~GeometryGUI_InertiaDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::Init( SALOME_Selection* Sel ) -{ - - LineEdit_L1C1->setMaxLength( 10 ); - LineEdit_L1C2->setMaxLength( 10 ); - LineEdit_L1C3->setMaxLength( 10 ); - LineEdit_L2C1->setMaxLength( 10 ); - LineEdit_L2C2->setMaxLength( 10 ); - LineEdit_L2C3->setMaxLength( 10 ); - LineEdit_L3C1->setMaxLength( 10 ); - LineEdit_L3C2->setMaxLength( 10 ); - LineEdit_L3C3->setMaxLength( 10 ); - - LineEdit_IX->setMaxLength( 10 ); - LineEdit_IY->setMaxLength( 10 ); - LineEdit_IZ->setMaxLength( 10 ); - - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, 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 */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_InertiaDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_InertiaDlg::SelectionIntoArgument() -{ - LineEdit_L1C1->setText("") ; - LineEdit_L1C2->setText("") ; - LineEdit_L1C3->setText("") ; - LineEdit_L2C1->setText("") ; - LineEdit_L2C2->setText("") ; - LineEdit_L2C3->setText("") ; - LineEdit_L3C1->setText("") ; - LineEdit_L3C2->setText("") ; - LineEdit_L3C3->setText("") ; - - LineEdit_IX->setText("") ; - LineEdit_IY->setText("") ; - LineEdit_IZ->setText("") ; - - myEditCurrentArgument->setText("") ; - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) || S.IsNull() ) - return ; - - LineEditC1A1->setText(aString) ; - this->CalculateAndDisplayInertia(S) ; - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_InertiaDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayInertia() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::CalculateAndDisplayInertia(const TopoDS_Shape& S) -{ - LineEdit_L1C1->setText("") ; - LineEdit_L1C2->setText("") ; - LineEdit_L1C3->setText("") ; - LineEdit_L2C1->setText("") ; - LineEdit_L2C2->setText("") ; - LineEdit_L2C3->setText("") ; - LineEdit_L3C1->setText("") ; - LineEdit_L3C2->setText("") ; - LineEdit_L3C3->setText("") ; - - LineEdit_IX->setText("") ; - LineEdit_IY->setText("") ; - LineEdit_IZ->setText("") ; - - - if( S.IsNull() ) - return ; - - try { - - QString resString; - GProp_GProps System; - - if ( S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) { - BRepGProp::LinearProperties(S, System); - } - else if ( S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL ) { - BRepGProp::SurfaceProperties(S, System); - } - else { - BRepGProp::VolumeProperties(S, System); - } - - gp_Mat I = System.MatrixOfInertia() ; - GProp_PrincipalProps Pr = System.PrincipalProperties(); - Standard_Real Ix,Iy,Iz; - Pr.Moments(Ix,Iy,Iz); - - /* matrix 3x3 */ - resString = tr("%1").arg( I(1,1), 12, 'f', 6 ) ; - LineEdit_L1C1->setText(resString) ; - resString = tr("%1").arg( I(1,2), 12, 'f', 6 ) ; - LineEdit_L1C2->setText(resString) ; - resString = tr("%1").arg( I(1,3), 12, 'f', 6 ) ; - LineEdit_L1C3->setText(resString) ; - - resString = tr("%1").arg( I(2,1), 12, 'f', 6 ) ; - LineEdit_L2C1->setText(resString) ; - resString = tr("%1").arg( I(2,2), 12, 'f', 6 ) ; - LineEdit_L2C2->setText(resString) ; - resString = tr("%1").arg( I(2,3), 12, 'f', 6 ) ; - LineEdit_L2C3->setText(resString) ; - - resString = tr("%1").arg( I(3,1), 12, 'f', 6 ) ; - LineEdit_L3C1->setText(resString) ; - resString = tr("%1").arg( I(3,2), 12, 'f', 6 ) ; - LineEdit_L3C2->setText(resString) ; - resString = tr("%1").arg( I(3,3), 12, 'f', 6 ) ; - LineEdit_L3C3->setText(resString) ; - - /* moments */ - resString = tr("%1").arg( Ix, 12, 'f', 6 ) ; - LineEdit_IX->setText(resString) ; - resString = tr("%1").arg( Ix, 12, 'f', 6 ) ; - LineEdit_IY->setText(resString) ; - resString = tr("%1").arg( Iz, 12, 'f', 6 ) ; - LineEdit_IZ->setText(resString) ; - - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayInertia()" << endl ) ; - } - return ; -} - - diff --git a/GEOMGUI/GeometryGUI_InertiaDlg.h b/GEOMGUI/GeometryGUI_InertiaDlg.h deleted file mode 100644 index c64f81700..000000000 --- a/GEOMGUI/GeometryGUI_InertiaDlg.h +++ /dev/null @@ -1,124 +0,0 @@ -// 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_InertiaDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_INERTIA_H -#define DIALOGBOX_INERTIA_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_InertiaDlg -// purpose : -//================================================================================= -class GeometryGUI_InertiaDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_InertiaDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_InertiaDlg(); - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateAndDisplayInertia(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabel_Matrix; - QLabel* TextLabelMatrix_11; - QLabel* TextLabelMatrix_21; - QLabel* TextLabelMatrix_31; - QLineEdit* LineEdit_L1C1; - QLineEdit* LineEdit_L1C2; - QLineEdit* LineEdit_L1C3; - QLineEdit* LineEdit_L2C1; - QLineEdit* LineEdit_L2C2; - QLineEdit* LineEdit_L2C3; - QLineEdit* LineEdit_L3C1; - QLineEdit* LineEdit_L3C2; - QLineEdit* LineEdit_L3C3; - QLineEdit* LineEdit_IX; - QLineEdit* LineEdit_IY; - QLineEdit* LineEdit_IZ; - QLabel* TextLabel_IXIYIZ; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_InertiaDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_INERTIA_H diff --git a/GEOMGUI/GeometryGUI_LineDlg.cxx b/GEOMGUI/GeometryGUI_LineDlg.cxx deleted file mode 100644 index 03fd750a0..000000000 --- a/GEOMGUI/GeometryGUI_LineDlg.cxx +++ /dev/null @@ -1,518 +0,0 @@ -// 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_LineDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_LineDlg.h" - -#include "GeometryGUI.h" - -#include - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_LineDlg() -// purpose : Constructs a GeometryGUI_LineDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_LineDlg::GeometryGUI_LineDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_LINE_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_LINE_PV"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_LINE_EDGE"))); - - if ( !name ) - setName( "GeometryGUI_LineDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_LINE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_LineDlgLayout = new QGridLayout( this ); - GeometryGUI_LineDlgLayout->setSpacing( 6 ); - GeometryGUI_LineDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_LINE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 5 ); - GeometryGUI_LineDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_POINTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_POINT_I" ).arg("2") ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - GeometryGUI_LineDlgLayout->addWidget( GroupC1, 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_LineDlgLayout->addWidget( GroupButtons, 2, 0 ); - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_LineDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_LineDlg::~GeometryGUI_LineDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - // GroupC2->hide(); - // GroupC3->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, 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( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_LineDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupC1->show(); - // - // - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - Constructor1->setChecked( TRUE ); - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; - myOkPoint1 = myOkPoint2 = false ; - /* filter for next selections */ - mySelection->ClearFilters() ; - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - break; - } - case 2: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeLineAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - case 1 : - { - break ; - } - case 2 : - { - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender() ; - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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 : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_LineDlg::SelectionIntoArgument() -{ - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkPoint2 = false ; - } - return ; - } - - // nbSel == 1 ! - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor 1 treatment */ - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint2 = true ; - } - - if( myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Try to add an arrow at simulation shape */ - bool notNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - -//================================================================================= -// function : AddArrowToSimulation() -// purpose : An arrow (cone topology) is added to 'modifiedShape' -// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'. -// : If an arrow can't be added returns false and 'modifiedShape' isn't modified ! -//================================================================================= -bool GeometryGUI_LineDlg::AddArrowToSimulation( TopoDS_Shape& modifiedShape ) -{ - TopoDS_Shape arrow ; - /* Try to add a cone simulation shape to show direction of a linear edge */ - if( myGeomGUI->CreateArrowForLinearEdge( modifiedShape, arrow ) ) { - TopoDS_Compound Comp ; - BRep_Builder B; - B.MakeCompound (Comp); - B.Add( Comp, modifiedShape ) ; - B.Add( Comp, arrow ) ; - modifiedShape = Comp ; - return true ; - } - return false ; -} - diff --git a/GEOMGUI/GeometryGUI_LineDlg.h b/GEOMGUI/GeometryGUI_LineDlg.h deleted file mode 100644 index 830ccdc28..000000000 --- a/GEOMGUI/GeometryGUI_LineDlg.h +++ /dev/null @@ -1,125 +0,0 @@ -// 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_LineDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_LINE_H -#define DIALOGBOX_LINE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_LineDlg -// purpose : -//================================================================================= -class GeometryGUI_LineDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_LineDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_LineDlg(); - -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 */ - gp_Pnt myPoint2 ; - - bool myOkPoint1 ; /* Are true when myPoint is defined */ - bool myOkPoint2 ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - - bool AddArrowToSimulation( TopoDS_Shape& modifiedShape ) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A2; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_LineDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_LINE_H diff --git a/GEOMGUI/GeometryGUI_MaxToleranceDlg.cxx b/GEOMGUI/GeometryGUI_MaxToleranceDlg.cxx deleted file mode 100644 index b703dcf49..000000000 --- a/GEOMGUI/GeometryGUI_MaxToleranceDlg.cxx +++ /dev/null @@ -1,547 +0,0 @@ -// 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_MaxToleranceDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MaxToleranceDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -// Open CASCADE Includes -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_MaxToleranceDlg() -// purpose : Constructs a GeometryGUI_MaxToleranceDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_MaxToleranceDlg::GeometryGUI_MaxToleranceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_TOLERANCE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_MaxToleranceDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_TOLERANCE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MaxToleranceDlgLayout = new QGridLayout( this ); - GeometryGUI_MaxToleranceDlgLayout->setSpacing( 6 ); - GeometryGUI_MaxToleranceDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_TOLERANCE" ) ); - 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 ); - 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( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_TOLERANCE_CONSTR" ) ); - 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_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); -// GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - QHBoxLayout* bl = new QHBoxLayout; - bl->setMargin(0); bl->setSpacing(6); - bl->addWidget(TextLabelC1A1); bl->addWidget(SelectButtonC1A1); bl->addWidget(LineEditC1A1); - GroupConstructor1Layout->addMultiCellLayout(bl, 0, 0, 0, 2); - - TextLabel_Min = new QLabel( GroupConstructor1, "TextLabel_Min" ); - TextLabel_Min->setText( tr( "GEOM_MIN" ) ); - TextLabel_Min->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Min->setFrameShape( QLabel::NoFrame ); - TextLabel_Min->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Min, 1, 1 ); - - TextLabel_Max = new QLabel( GroupConstructor1, "TextLabel_Max" ); - TextLabel_Max->setText( tr( "GEOM_MAX" ) ); - TextLabel_Max->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Max->setFrameShape( QLabel::NoFrame ); - TextLabel_Max->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Max, 1, 2 ); - - TextLabel_Face = new QLabel( GroupConstructor1, "TextLabel_Face" ); - TextLabel_Face->setText( tr( "GEOM_TOLERANCE_FACE" ) ); - TextLabel_Face->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Face->setFrameShape( QLabel::NoFrame ); - TextLabel_Face->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Face, 2, 0 ); - LineEdit_MinFace = new QLineEdit( GroupConstructor1, "LineEdit_MinFace" ); - LineEdit_MinFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinFace->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinFace->setEnabled( FALSE ); - LineEdit_MinFace->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinFace, 2, 1 ); - LineEdit_MaxFace = new QLineEdit( GroupConstructor1, "LineEdit_MaxFace" ); - LineEdit_MaxFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxFace->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxFace->setEnabled( FALSE ); - LineEdit_MaxFace->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxFace, 2, 2 ); - - TextLabel_Edge = new QLabel( GroupConstructor1, "TextLabel_Edge" ); - TextLabel_Edge->setText( tr( "GEOM_TOLERANCE_EDGE" ) ); - TextLabel_Edge->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Edge->setFrameShape( QLabel::NoFrame ); - TextLabel_Edge->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Edge, 3, 0 ); - LineEdit_MinEdge = new QLineEdit( GroupConstructor1, "LineEdit_MinEdge" ); - LineEdit_MinEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinEdge->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinEdge->setEnabled( FALSE ); - LineEdit_MinEdge->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinEdge, 3, 1 ); - LineEdit_MaxEdge = new QLineEdit( GroupConstructor1, "LineEdit_MaxEdge" ); - LineEdit_MaxEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxEdge->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxEdge->setEnabled( FALSE ); - LineEdit_MaxEdge->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxEdge, 3, 2 ); - - TextLabel_Vertex = new QLabel( GroupConstructor1, "TextLabel_Vertex" ); - TextLabel_Vertex->setText( tr( "GEOM_TOLERANCE_VERTEX" ) ); - TextLabel_Vertex->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Vertex->setFrameShape( QLabel::NoFrame ); - TextLabel_Vertex->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Vertex, 4, 0 ); - LineEdit_MinVertex = new QLineEdit( GroupConstructor1, "LineEdit_MinVertex" ); - LineEdit_MinVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinVertex->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinVertex->setEnabled( FALSE ); - LineEdit_MinVertex->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinVertex, 4, 1 ); - LineEdit_MaxVertex = new QLineEdit( GroupConstructor1, "LineEdit_MaxVertex" ); - LineEdit_MaxVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxVertex->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxVertex->setEnabled( FALSE ); - LineEdit_MaxVertex->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxVertex, 4, 2 ); - - GeometryGUI_MaxToleranceDlgLayout->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, 1 ); - // buttonApply = new QPushButton( GroupButtons, "buttonApply" ); -// buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); -// buttonApply->setAutoDefault( TRUE ); -// GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - 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_MaxToleranceDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_MaxToleranceDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MaxToleranceDlg::~GeometryGUI_MaxToleranceDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - 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 */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MaxToleranceDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_MaxToleranceDlg::SelectionIntoArgument() -{ - LineEdit_MinFace->setText("") ; - LineEdit_MinEdge->setText("") ; - LineEdit_MinVertex->setText("") ; - LineEdit_MaxFace->setText("") ; - LineEdit_MaxEdge->setText("") ; - LineEdit_MaxVertex->setText("") ; - myEditCurrentArgument->setText("") ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - this->CalculateMaxTolerance(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_MaxToleranceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateMaxTolerance() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::CalculateMaxTolerance(const TopoDS_Shape& S) -{ - LineEdit_MinFace->setText("") ; - LineEdit_MinEdge->setText("") ; - LineEdit_MinVertex->setText("") ; - LineEdit_MaxFace->setText("") ; - LineEdit_MaxEdge->setText("") ; - LineEdit_MaxVertex->setText("") ; - if( S.IsNull() ) - return ; - - Standard_Real T,TMF,TME,TMV,TmF,TmE,TmV; - Standard_Integer nbF,nbE,nbV; - TMF=TME=TMV=-RealLast(); - TmF=TmE=TmV=RealLast(); - nbF=nbE=nbV=0; - - bool m_isFace = false; - bool m_isEdge = false; - bool m_isVertex = false; - try - { - for( TopExp_Explorer ExF(S,TopAbs_FACE); ExF.More(); ExF.Next() ) - { - m_isFace = true; - TopoDS_Face Face=TopoDS::Face(ExF.Current()); - T=BRep_Tool::Tolerance(Face); - if(T>TMF) TMF=T; - if(TTME) TME=T; - if(TTMV) TMV=T; - if(TsetText( tr("%1").arg( TmF, 5, 'e', 8 ) ) ; - LineEdit_MaxFace->setText( tr("%1").arg( TMF, 5, 'e', 8 ) ) ; - } - else - { - LineEdit_MinFace->setText( "" ) ; - LineEdit_MaxFace->setText( "" ) ; - } - if (m_isEdge) - { - LineEdit_MinEdge->setText( tr("%1").arg( TmE, 5, 'e', 8 ) ) ; - LineEdit_MaxEdge->setText( tr("%1").arg( TME, 5, 'e', 8 ) ) ; - } - else - { - LineEdit_MinEdge->setText( "" ) ; - LineEdit_MaxEdge->setText( "" ) ; - } - if (m_isVertex) - { - LineEdit_MinVertex->setText( tr("%1").arg( TmV, 5, 'e', 8 ) ) ; - LineEdit_MaxVertex->setText( tr("%1").arg( TMV, 5, 'e', 8 ) ) ; - } - else - { - LineEdit_MinVertex->setText( "" ) ; - LineEdit_MaxVertex->setText( "" ) ; - } - } - catch(Standard_Failure) - { - MESSAGE("Catch intercepted in CalculateMaxTolerance()" << endl ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_MaxToleranceDlg.h b/GEOMGUI/GeometryGUI_MaxToleranceDlg.h deleted file mode 100644 index 7da3e4111..000000000 --- a/GEOMGUI/GeometryGUI_MaxToleranceDlg.h +++ /dev/null @@ -1,119 +0,0 @@ -// 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_MaxToleranceDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MAXTOLERANCE_H -#define DIALOGBOX_MAXTOLERANCE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : DialogBox_PROPERTIES -// purpose : -//================================================================================= -class GeometryGUI_MaxToleranceDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MaxToleranceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MaxToleranceDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateMaxTolerance(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QLabel* TextLabel_Min; - QLabel* TextLabel_Max; - - QLabel* TextLabel_Face; - QLabel* TextLabel_Edge; - QLabel* TextLabel_Vertex; - - QLineEdit* LineEdit_MinFace; - QLineEdit* LineEdit_MinEdge; - QLineEdit* LineEdit_MinVertex; - - QLineEdit* LineEdit_MaxFace; - QLineEdit* LineEdit_MaxEdge; - QLineEdit* LineEdit_MaxVertex; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_MaxToleranceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_MAXTOLERANCE_H diff --git a/GEOMGUI/GeometryGUI_MirrorDlg.cxx b/GEOMGUI/GeometryGUI_MirrorDlg.cxx deleted file mode 100644 index 8095f6747..000000000 --- a/GEOMGUI/GeometryGUI_MirrorDlg.cxx +++ /dev/null @@ -1,525 +0,0 @@ -// 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_MirrorDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MirrorDlg.h" - -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -//================================================================================= -// class : GeometryGUI_MirrorDlg() -// purpose : Constructs a GeometryGUI_MirrorDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_MirrorDlg::GeometryGUI_MirrorDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_MIRROR"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_MirrorDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_MIRROR_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MirrorDlgLayout = new QGridLayout( this ); - GeometryGUI_MirrorDlgLayout->setSpacing( 6 ); - GeometryGUI_MirrorDlgLayout->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_MirrorDlgLayout->addWidget( GroupButtons, 2, 0 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) ); - 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 ); - GeometryGUI_MirrorDlgLayout->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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_PLANE_MIRROR" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - GeometryGUI_MirrorDlgLayout->addWidget( GroupC1, 1, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_MirrorDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MirrorDlg::~GeometryGUI_MirrorDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - mySimulationTopoDs.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - GroupC1->show(); - - myEditCurrentArgument = LineEditC1A1 ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - /* Filter definition */ - - myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); - - // 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MirrorDlg::ConstructorsClicked(int constructorId) -{ - GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupC1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - LineEditC1A2->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeMirrorAndDisplay(myGeomShape1 ,myGeomShape2 ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_MirrorDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2->setText(aString) ; - myOkShape2 = true ; - } - - if(myOkShape1 && myOkShape2) { - MakeMirrorSimulationAndDisplay( myShape1, myShape2 ) ; - } - - return ; -} - - - -//================================================================================= -// function : MakeMirrorSimulationAndDisplay() -// purpose : S1 is a shape and S2 a mirror. -//================================================================================= -void GeometryGUI_MirrorDlg::MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) -{ - this->mySimulationTopoDs.Nullify() ; - - try { - Handle(Geom_Surface) surf = BRep_Tool::Surface(TopoDS::Face(S2)) ; - Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf) ; - const gp_Ax3 pos = myPlane->Position() ; - const gp_Pnt loc = pos.Location() ; /* location of the plane */ - const gp_Dir dir = pos.Direction() ; /* Main direction of the plane (Z axis) */ - - /* plane used for mirroring */ - gp_Ax2 pln(loc, dir) ; - gp_Trsf theTransformation ; - theTransformation.SetMirror(pln) ; - BRepBuilderAPI_Transform myBRepTransformation( S1, theTransformation, Standard_False ) ; - - this->mySimulationTopoDs = myBRepTransformation.Shape() ; - if( this->mySimulationTopoDs.IsNull() ) - return ; - else - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMirrorSimulationAndDisplay" ) ; - return ; - } - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - switch (myConstructorId) - { - case 0: - { - if( send == SelectButtonC1A1 ) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - mySelection->ClearFilters() ; - SelectionIntoArgument() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myFaceFilter) ; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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_MirrorDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_MirrorDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate any active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} diff --git a/GEOMGUI/GeometryGUI_MirrorDlg.h b/GEOMGUI/GeometryGUI_MirrorDlg.h deleted file mode 100644 index adc4d7d33..000000000 --- a/GEOMGUI/GeometryGUI_MirrorDlg.h +++ /dev/null @@ -1,118 +0,0 @@ -// 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_MirrorDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MIRROR_H -#define DIALOGBOX_MIRROR_H - -#include "SALOME_Selection.h" -#include "GEOM_FaceFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_MirrorDlg -// purpose : -//================================================================================= -class GeometryGUI_MirrorDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MirrorDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MirrorDlg(); - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); /* Mouse enter the QWidget */ - void Init( SALOME_Selection* Sel ) ; - void MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) ; - - 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 */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_FaceFilter) myFaceFilter; /* To filter selections */ - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - -private slots : - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_MirrorDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_MIRROR_H diff --git a/GEOMGUI/GeometryGUI_MultiRotationDlg.cxx b/GEOMGUI/GeometryGUI_MultiRotationDlg.cxx deleted file mode 100644 index 23498d30d..000000000 --- a/GEOMGUI/GeometryGUI_MultiRotationDlg.cxx +++ /dev/null @@ -1,986 +0,0 @@ -// 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_MultiTranslationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MultiRotationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_MultiRotationDlg() -// purpose : Constructs a GeometryGUI_MultiRotationDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_MultiRotationDlg::GeometryGUI_MultiRotationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_MULTIROTATION_SIMPLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); - - if ( !name ) - setName( "GeometryGUI_MultiTranlationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_MULTIROTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MultiRotationDlgLayout = new QGridLayout( this ); - GeometryGUI_MultiRotationDlgLayout->setSpacing( 6 ); - GeometryGUI_MultiRotationDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) ); - 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 ); - - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (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->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - - GeometryGUI_MultiRotationDlgLayout->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_MultiRotationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - 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_NB_TIMES" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - /* a QSpinBox */ - SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" ) ; - SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setToggleButton( FALSE ); - SelectButtonC1A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - - GeometryGUI_MultiRotationDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_VECTOR" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" ); - TextLabelC2A3->setText( tr( "GEOM_ANGLE" ) ); - TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A3->setFrameShape( QLabel::NoFrame ); - TextLabelC2A3->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 ); - - TextLabelC2A4 = new QLabel( GroupC2, "TextLabelC2A4" ); - TextLabelC2A4->setText( tr( "GEOM_NB_TIMES" ) ); - TextLabelC2A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A4->setFrameShape( QLabel::NoFrame ); - TextLabelC2A4->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A4, 3, 0 ); - - TextLabelC2A5 = new QLabel( GroupC2, "TextLabelC2A5" ); - TextLabelC2A5->setText( tr( "GEOM_STEP" ) ); - TextLabelC2A5->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A5->setFrameShape( QLabel::NoFrame ); - TextLabelC2A5->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A5, 5, 0 ); - - TextLabelC2A6 = new QLabel( GroupC2, "TextLabelC2A6" ); - TextLabelC2A6->setText( tr( "GEOM_NB_TIMES" ) ); - TextLabelC2A6->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A6->setFrameShape( QLabel::NoFrame ); - TextLabelC2A6->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A6, 6, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); - GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - - /* a GeometryGUI_SpinBox */ - SpinBox_C2A3 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A3" ) ; - SpinBox_C2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A3->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A3, 2, 2 ); - /* a QSpinBox */ - SpinBox_C2A4 = new QSpinBox( GroupC2, "SpinBox_C2A4" ) ; - SpinBox_C2A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A4->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A4, 3, 2 ); - - /* a GeometryGUI_SpinBox */ - SpinBox_C2A5 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A5" ) ; - SpinBox_C2A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A5->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A5, 5, 2 ); - /* a QSpinBox */ - SpinBox_C2A6 = new QSpinBox( GroupC2, "SpinBox_C2A6" ) ; - SpinBox_C2A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A6->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A6, 6, 2 ); - - CheckBoxReverse = new QCheckBox( GroupC2, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) ); - GroupC2Layout->addWidget( CheckBoxReverse, 4, 0 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - - SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" ); - SelectButtonC2A2->setText( tr( "" ) ); - SelectButtonC2A2->setPixmap( image1 ); - SelectButtonC2A2->setToggleButton( FALSE ); - SelectButtonC2A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 ); - - GeometryGUI_MultiRotationDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_MultiRotationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MultiRotationDlg::~GeometryGUI_MultiRotationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 geom spin boxes */ - SpinBox_C2A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* angle : constructor 2 */ - SpinBox_C2A3->SetValue( 45.0 ) ; - SpinBox_C2A5->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step : constructor 2 */ - SpinBox_C2A5->SetValue( 50.0 ) ; - - /* min, max, step for QT spin boxes */ - SpinBox_C1A3->setMinValue( 2 ); /* myNbTimes : constructor 1 */ - SpinBox_C1A3->setMaxValue( 10000 ); - SpinBox_C1A3->setWrapping( TRUE ); - SpinBox_C1A3->setValue(2) ; - - SpinBox_C2A4->setMinValue( 2 ); /* myNbTimes1 : constructor 2 */ - SpinBox_C2A4->setMaxValue( 10000 ); - SpinBox_C2A4->setWrapping( TRUE ); - SpinBox_C2A4->setValue(2) ; - - SpinBox_C2A6->setMinValue( 2 ); /* myNbTimes2 : constructor 2 */ - SpinBox_C2A6->setMaxValue( 10000 ); - SpinBox_C2A6->setWrapping( TRUE ); - SpinBox_C2A6->setValue(2) ; - - myAng = 45.0 ; - myStep = 50.0 ; - myNbTimes1 = 2; - myNbTimes2 = 2; - - GroupC1->show(); - GroupC2->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - myOkBase = myOkDir = false ; - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : set previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - - /* 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( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - /* GeometryGUI_SpinBox */ - connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A5, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ; - - /* QSpinBox */ - connect( SpinBox_C1A3, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; /* Not const ! */ - connect( SpinBox_C2A4, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - connect( SpinBox_C2A6, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - - connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ; - - 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 */ - - return ; -} - -//================================================================================= -// function : ReverseAngle() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_MultiRotationDlg::ReverseAngle(int state) -{ - myAng = -myAng ; - SpinBox_C2A3->SetValue( myAng ) ; - if( myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) -{ - myEditCurrentArgument->setText(tr("")) ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myAng = 45.0 ; - myStep = 50.0 ; - myNbTimes1 = 2; - myNbTimes2 = 2; - - myOkBase = myOkDir = false ; - myConstructorId = constructorId ; - - switch (constructorId) - { - case 0: /* Rotate simple */ - { - GroupC1->show(); - GroupC2->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A3->setValue( 2 ) ; - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; - break; - } - - case 1: /* Rotate double */ - { - GroupC1->hide(); - GroupC2->show() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A3->SetValue( 45.0 ) ; - SpinBox_C2A4->setValue( 2 ) ; - SpinBox_C2A5->SetValue( 50.0 ) ; - SpinBox_C2A6->setValue( 2 ) ; - LineEditC2A1->setText(tr("")) ; - LineEditC2A2->setText(tr("")) ; - break ; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkDir) { - myGeomGUI->MakeMultiRotation1DAndDisplay( myGeomShape, myDir, myLoc, myNbTimes1 ) ; - } - break ; - } - case 1 : - { - if(myOkBase && myOkDir) { - myGeomGUI->MakeMultiRotation2DAndDisplay( myGeomShape, myDir, myLoc, myAng, myNbTimes1, myStep, myNbTimes2 ) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender() ; - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1; - else if ( send == LineEditC2A2 ) - myEditCurrentArgument = LineEditC2A2 ; - 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 : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_MultiRotationDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Name of future selection */ - QString aString = ""; - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - - TopoDS_Shape S; - Standard_Boolean testResult ; - - switch (myConstructorId) - { - case 0 : - { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - myEditCurrentArgument->setText(aString) ; - myOkDir = true ; - } - - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC2A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - myEditCurrentArgument->setText(aString) ; - myOkDir = true ; - } - - if ( myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0 : - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - case 1 : - { - if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC2A2) { - LineEditC2A2->setFocus() ; - myEditCurrentArgument = LineEditC2A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : ValueChangedInt() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ValueChangedInt( int newIntValue ) -{ - QSpinBox* send = (QSpinBox*)sender(); - - if( send == SpinBox_C1A3 ) { - myNbTimes1 = newIntValue ; - } - else if(send == SpinBox_C2A4 ) { - myNbTimes1 = newIntValue ; - } - else if(send == SpinBox_C2A6 ) { - myNbTimes2 = newIntValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : (specifig for GeometryGUI_SpinBox) -//================================================================================= -void GeometryGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue ) -{ - GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender(); - - if( send == SpinBox_C2A3 ) { - myAng = newValue ; - } - else if( send == SpinBox_C2A5 ) { - myStep = newValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::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() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::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() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ - return ; -} - - -//================================================================================= -// function : MakeMultiRotationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - gp_Trsf theTransformation ; - gp_Trsf theTransformation1 ; - gp_Trsf theTransformation2 ; - mySimulationTopoDs.Nullify() ; - - int i ; - int j ; - Standard_Real DX ; - Standard_Real DY ; - Standard_Real DZ ; - GProp_GProps System ; - gp_Pnt myPoint ; - TopoDS_Compound compound; - BRep_Builder B; - - B.MakeCompound( compound ); - - if ( myBase.ShapeType() == TopAbs_VERTEX) { - myGeomGUI->VertexToPoint( myBase, myPoint ); - } - else if ( myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE ) { - BRepGProp::LinearProperties(myBase, System); - myPoint = System.CentreOfMass() ; - } - else if ( myBase.ShapeType() == TopAbs_FACE || myBase.ShapeType() == TopAbs_SHELL ) { - BRepGProp::SurfaceProperties(myBase, System); - myPoint = System.CentreOfMass() ; - } - else { - BRepGProp::VolumeProperties(myBase, System); - myPoint = System.CentreOfMass() ; - } - - TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); - - try { - switch (myConstructorId) - { - case 0 : - { - gp_Ax1 AX1( myLoc, myDir ) ; - Standard_Real angle = 360/myNbTimes1; - for ( i = 0; i < myNbTimes1; i++ ) { - theTransformation.SetRotation(AX1, i*angle*PI180) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); - } - mySimulationTopoDs = compound; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - case 1 : - { - gp_Ax1 AX2( myLoc, myDir ) ; - Handle(Geom_Line) Line = new Geom_Line(AX2); - gp_Pnt P2 = GeomAPI_ProjectPointOnCurve( myPoint, Line ) ; - if ( myPoint.IsEqual(P2, Precision::Confusion() ) ) - return; - gp_Vec Vec(P2, myPoint) ; - Vec.Normalize(); - - for ( i = 0; i < myNbTimes2; i++ ) { - for ( j = 0; j < myNbTimes1; j++ ) { - DX = i * myStep * Vec.X() ; - DY = i * myStep * Vec.Y() ; - DZ = i * myStep * Vec.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; - - theTransformation1.SetTranslation(myVec) ; - theTransformation2.SetRotation(AX2, j*myAng*PI180) ; - BRepBuilderAPI_Transform myBRepTransformation1(S, theTransformation1, Standard_False) ; - BRepBuilderAPI_Transform myBRepTransformation2(myBRepTransformation1.Shape(), theTransformation2, Standard_False) ; - B.Add( compound, myBRepTransformation2.Shape() ); - } - } - mySimulationTopoDs = compound ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - } - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMultitranslationSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_MultiRotationDlg.h b/GEOMGUI/GeometryGUI_MultiRotationDlg.h deleted file mode 100644 index 13f6804ad..000000000 --- a/GEOMGUI/GeometryGUI_MultiRotationDlg.h +++ /dev/null @@ -1,162 +0,0 @@ -// 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_MultiRotationDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MULTIROTATION_H -#define DIALOGBOX_MULTIROTATION_H - - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QSpinBox; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_MultiRotationDlg -// purpose : -//================================================================================= -class GeometryGUI_MultiRotationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MultiRotationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MultiRotationDlg(); - -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 */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Vec myVec ; - int myNbTimes1 ; - int myNbTimes2 ; - Standard_Real myAng ; - Standard_Real myStep ; - gp_Dir myDir ; - gp_Pnt myLoc ; - - bool myOkBase ; - bool myOkDir ; - bool myOkAng ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeMultiRotationSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QSpinBox* SpinBox_C1A3; /* int : Nb times */ - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QPushButton* SelectButtonC2A2; - QLabel* TextLabelC2A1; - QLabel* TextLabelC2A2; - QLabel* TextLabelC2A3; - QLabel* TextLabelC2A4; - QLabel* TextLabelC2A5; - QLabel* TextLabelC2A6; - - QLineEdit* LineEditC2A1; - QLineEdit* LineEditC2A2; - GeometryGUI_SpinBox* SpinBox_C2A3 ; /* double : angle */ - QSpinBox* SpinBox_C2A4; /* int : Nb times 1 */ - GeometryGUI_SpinBox* SpinBox_C2A5 ; /* double : step value */ - QSpinBox* SpinBox_C2A6; /* int : Nb times 2 */ - - QCheckBox* CheckBoxReverse; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseAngle(int) ; - void ValueChangedInSpinBox( double newValue ) ; /* for GeometryGUI_SpinBox */ - void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */ - -protected: - QGridLayout* GeometryGUI_MultiRotationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; -}; - -#endif // DIALOGBOX_MULTIROTATION_H diff --git a/GEOMGUI/GeometryGUI_MultiTranslationDlg.cxx b/GEOMGUI/GeometryGUI_MultiTranslationDlg.cxx deleted file mode 100644 index 32e40e317..000000000 --- a/GEOMGUI/GeometryGUI_MultiTranslationDlg.cxx +++ /dev/null @@ -1,1063 +0,0 @@ -// 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_MultiTranslationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MultiTranslationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_MultiTranslationDlg() -// purpose : Constructs a GeometryGUI_MultiTranslationDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_MultiTranslationDlg::GeometryGUI_MultiTranslationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_MULTITRANSLATION_SIMPLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); - - if ( !name ) - setName( "GeometryGUI_MultiTranlationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_MULTITRANSLATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MultiTranslationDlgLayout = new QGridLayout( this ); - GeometryGUI_MultiTranslationDlgLayout->setSpacing( 6 ); - GeometryGUI_MultiTranslationDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_MULTITRANSLATION" ) ); - 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 ); - - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (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->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - - GeometryGUI_MultiTranslationDlgLayout->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_MultiTranslationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_MULTITRANSLATION_SIMPLE" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_VECTOR_U" ) ); - 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_STEP_U" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_NB_TIMES_U" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - /* a GeometryGUI_SpinBox */ - 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 ); - /* a QSpinBox */ - SpinBox_C1A4 = new QSpinBox( GroupC1, "SpinBox_C1A4" ) ; - SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 ); - - CheckBoxReverse0 = new QCheckBox( GroupC1, "CheckBoxReverse0" ); - CheckBoxReverse0->setText( tr( "GEOM_REVERSE_U" ) ); - GroupC1Layout->addWidget( CheckBoxReverse0, 5, 0 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setToggleButton( FALSE ); - SelectButtonC1A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - - GeometryGUI_MultiTranslationDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_MULTITRANSLATION_DOUBLE" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_VECTOR_U" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" ); - TextLabelC2A3->setText( tr( "GEOM_VECTOR_V" ) ); - TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A3->setFrameShape( QLabel::NoFrame ); - TextLabelC2A3->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 ); - - TextLabelC2A4 = new QLabel( GroupC2, "TextLabelC2A4" ); - TextLabelC2A4->setText( tr( "GEOM_STEP_U" ) ); - TextLabelC2A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A4->setFrameShape( QLabel::NoFrame ); - TextLabelC2A4->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A4, 3, 0 ); - - TextLabelC2A5 = new QLabel( GroupC2, "TextLabelC2A5" ); - TextLabelC2A5->setText( tr( "GEOM_NB_TIMES_U" ) ); - TextLabelC2A5->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A5->setFrameShape( QLabel::NoFrame ); - TextLabelC2A5->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A5, 4, 0 ); - - TextLabelC2A6 = new QLabel( GroupC2, "TextLabelC2A6" ); - TextLabelC2A6->setText( tr( "GEOM_STEP_V" ) ); - TextLabelC2A6->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A6->setFrameShape( QLabel::NoFrame ); - TextLabelC2A6->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A6, 6, 0 ); - - TextLabelC2A7 = new QLabel( GroupC2, "TextLabelC2A7" ); - TextLabelC2A7->setText( tr( "GEOM_NB_TIMES_V" ) ); - TextLabelC2A7->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A7->setFrameShape( QLabel::NoFrame ); - TextLabelC2A7->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A7, 7, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); - GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - - LineEditC2A3 = new QLineEdit( GroupC2, "LineEditC2A3" ); - GroupC2Layout->addWidget( LineEditC2A3, 2, 2 ); - - /* a GeometryGUI_SpinBox */ - SpinBox_C2A4 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A4" ) ; - SpinBox_C2A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A4->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A4, 3, 2 ); - /* a QSpinBox */ - SpinBox_C2A5 = new QSpinBox( GroupC2, "SpinBox_C2A5" ) ; - SpinBox_C2A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A5->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A5, 4, 2 ); - - /* a GeometryGUI_SpinBox */ - SpinBox_C2A6 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A6" ) ; - SpinBox_C2A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A6->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A6, 6, 2 ); - /* a QSpinBox */ - SpinBox_C2A7 = new QSpinBox( GroupC2, "SpinBox_C2A7" ) ; - SpinBox_C2A7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A7->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A7, 7, 2 ); - - - CheckBoxReverse1 = new QCheckBox( GroupC2, "CheckBoxReverse1" ); - CheckBoxReverse1->setText( tr( "GEOM_REVERSE_U" ) ); - GroupC2Layout->addWidget( CheckBoxReverse1, 5, 0 ); - - CheckBoxReverse2 = new QCheckBox( GroupC2, "CheckBoxReverse2" ); - CheckBoxReverse2->setText( tr( "GEOM_REVERSE_V" ) ); - GroupC2Layout->addWidget( CheckBoxReverse2, 8, 0 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - - SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" ); - SelectButtonC2A2->setText( tr( "" ) ); - SelectButtonC2A2->setPixmap( image1 ); - SelectButtonC2A2->setToggleButton( FALSE ); - SelectButtonC2A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 ); - - SelectButtonC2A3 = new QPushButton( GroupC2, "SelectButtonC2A3" ); - SelectButtonC2A3->setText( tr( "" ) ); - SelectButtonC2A3->setPixmap( image1 ); - SelectButtonC2A3->setToggleButton( FALSE ); - SelectButtonC2A3->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A3, 2, 1 ); - - GeometryGUI_MultiTranslationDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_MultiTranslationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MultiTranslationDlg::~GeometryGUI_MultiTranslationDlg() -{ - // no need to delete child widgets, Qt does it all for us - this->destroy(TRUE, TRUE) ; -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 geom spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step U : constructor 1 */ - SpinBox_C1A3->SetValue( 50 ) ; - SpinBox_C2A4->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step U : constructor 2 */ - SpinBox_C2A4->SetValue( 50 ) ; - SpinBox_C2A6->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step V : constructor 2 */ - SpinBox_C2A6->SetValue( 50 ) ; - - /* min, max, step for QT spin boxes */ - SpinBox_C1A4->setMinValue( 1 ); /* myNbTimes1 : constructor 1 */ - SpinBox_C1A4->setMaxValue( 10000 ); - SpinBox_C1A4->setWrapping( TRUE ); - SpinBox_C1A4->setValue(2) ; - - SpinBox_C2A5->setMinValue( 1 ); /* myNbTimes1 : constructor 2 */ - SpinBox_C2A5->setMaxValue( 10000 ); - SpinBox_C2A5->setWrapping( TRUE ); - SpinBox_C2A5->setValue(2) ; - - SpinBox_C2A7->setMinValue( 1 ); /* myNbTimes2 : constructor 2 */ - SpinBox_C2A7->setMaxValue( 10000 ); - SpinBox_C2A7->setWrapping( TRUE ); - SpinBox_C2A7->setValue(2) ; - - myStep1 = 50.0 ; - myStep2 = 50.0 ; - myNbTimes1 = 2 ; - myNbTimes2 = 2 ; - - GroupC1->show(); - GroupC2->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - myOkBase = myOkDir1 = myOkDir2 = false ; - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : set previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - - /* 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( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A3, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - /* GeometryGUI_SpinBox */ - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A6, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A3, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - /* QSpinBox */ - connect( SpinBox_C1A4, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; /* Not const ! */ - connect( SpinBox_C2A5, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - connect( SpinBox_C2A7, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - - connect( CheckBoxReverse0, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle1(int) ) ) ; - connect( CheckBoxReverse1, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle1(int) ) ) ; - connect( CheckBoxReverse2, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle2(int) ) ) ; - - 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 */ - - return ; -} - -//================================================================================= -// function : ReverseAngle1() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ReverseAngle1(int state) -{ - myStep1 = -myStep1 ; - SpinBox_C1A3->SetValue( myStep1 ) ; - SpinBox_C2A4->SetValue( myStep1 ) ; - if( myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ReverseAngle2() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ReverseAngle2(int state) -{ - myStep2 = -myStep2 ; - SpinBox_C2A6->SetValue( myStep2 ) ; - if( myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) -{ - myEditCurrentArgument->setText(tr("")) ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myStep1 = 50.0 ; - myStep2 = 50.0 ; - myNbTimes1 = 2; - myNbTimes2 = 2; - - myOkBase = myOkDir1 = myOkDir2 = false ; - myConstructorId = constructorId ; - - switch (constructorId) - { - case 0: /* Translate simple */ - { - GroupC1->show(); - GroupC2->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A3->SetValue(50) ; - SpinBox_C1A4->setValue(2) ; - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; - break; - } - - case 1: /* Translate double */ - { - GroupC1->hide(); - GroupC2->show() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A4->SetValue(50) ; - SpinBox_C2A5->setValue(2) ; - SpinBox_C2A6->SetValue(50) ; - SpinBox_C2A7->setValue(2) ; - LineEditC2A1->setText(tr("")) ; - LineEditC2A2->setText(tr("")) ; - LineEditC2A3->setText(tr("")) ; - break ; - } - - } - - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkDir1 ) { - myGeomGUI->MakeMultiTranslation1DAndDisplay( myGeomShape, myDir1, myStep1, myNbTimes1 ) ; - } - break ; - } - case 1 : - { - if(myOkBase && myOkDir1 && myOkDir2 ) { - myGeomGUI->MakeMultiTranslation2DAndDisplay( myGeomShape, myDir1, myStep1, myNbTimes1, myDir2, myStep2, myNbTimes2 ) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender() ; - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1; - else if ( send == LineEditC2A2 ) - myEditCurrentArgument = LineEditC2A2 ; - else if ( send == LineEditC2A3 ) - myEditCurrentArgument = LineEditC2A3 ; - 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 : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_MultiTranslationDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - - TopoDS_Shape S; - Standard_Boolean testResult ; - - switch (myConstructorId) - { - case 0 : - { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir1 = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir1 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir1 = true ; - } - - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC2A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir1 = false ; - } - else if ( myEditCurrentArgument == LineEditC2A3 ) { - myEditCurrentArgument->setText("") ; - myOkDir2 = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir1 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir1 = true ; - } - else if ( myEditCurrentArgument == LineEditC2A3 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir2 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir2 = true ; - } - - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0 : - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - case 1 : - { - if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC2A2) { - LineEditC2A2->setFocus() ; - myEditCurrentArgument = LineEditC2A2; - mySelection->AddFilter(myEdgeFilter) ; - } - else if(send == SelectButtonC2A3) { - LineEditC2A3->setFocus() ; - myEditCurrentArgument = LineEditC2A3; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : ValueChangedInt() -// purpose : (General QT SpinBox) -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ValueChangedInt( int newIntValue ) -{ - QSpinBox* send = (QSpinBox*)sender(); - - /* First constructor */ - if( send == SpinBox_C1A4 ) { - myNbTimes1 = newIntValue ; - } - /* Second constructor */ - else if( send == SpinBox_C2A5 ) { - myNbTimes1 = newIntValue ; - } - else if( send == SpinBox_C2A7 ) { - myNbTimes2 = newIntValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : (specifig for GeometryGUI_SpinBox) -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newValue ) -{ - GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender(); - - /* First constructor */ - if( send == SpinBox_C1A3 ) { - myStep1 = newValue ; - } - /* Second constructor */ - else if( send == SpinBox_C2A4 ) { - myStep1 = newValue ; - } - else if( send == SpinBox_C2A6 ) { - myStep2 = newValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::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() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::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() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ - return ; -} - - -//================================================================================= -// function : MakeMultiTranslationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - gp_Trsf theTransformation ; - mySimulationTopoDs.Nullify() ; - - int i ; - int j ; - Standard_Real DX ; - Standard_Real DY ; - Standard_Real DZ ; - GProp_GProps System ; - gp_Pnt myPoint ; - TopoDS_Compound compound; - BRep_Builder B; - - B.MakeCompound( compound ); - TopoDS_Shape S ; - - try { - - BRepGProp::LinearProperties(myBase, System); - myPoint = System.CentreOfMass() ; - S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); - - switch (myConstructorId) - { - case 0 : - { - gp_Vec Vec(myDir1) ; - Vec.Normalize(); - - for ( i = 0; i < myNbTimes1; i++ ) { - DX = i * myStep1 * Vec.X() ; - DY = i * myStep1 * Vec.Y() ; - DZ = i * myStep1 * Vec.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; - - theTransformation.SetTranslation(myVec) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); - } - mySimulationTopoDs = compound; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - case 1 : - { - gp_Vec Vec1(myDir1) ; - Vec1.Normalize(); - gp_Vec Vec2(myDir2) ; - Vec2.Normalize(); - - for ( i = 0; i < myNbTimes1; i++ ) { - for ( j = 0; j < myNbTimes2; j++ ) { - DX = i * myStep1 * Vec1.X() + j * myStep2 * Vec2.X() ; - DY = i * myStep1 * Vec1.Y() + j * myStep2 * Vec2.Y() ; - DZ = i * myStep1 * Vec1.Z() + j * myStep2 * Vec2.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; - - theTransformation.SetTranslation(myVec) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); - } - } - mySimulationTopoDs = compound ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - } - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMultitranslationSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_MultiTranslationDlg.h b/GEOMGUI/GeometryGUI_MultiTranslationDlg.h deleted file mode 100644 index d0b366dc9..000000000 --- a/GEOMGUI/GeometryGUI_MultiTranslationDlg.h +++ /dev/null @@ -1,169 +0,0 @@ -// 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_MultiTranslationDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MULTITRANSLATION_H -#define DIALOGBOX_MULTITRANSLATION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QSpinBox; -class QLineEdit; -class QPushButton; -class QSpinBox; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_MultiTranslationDlg -// purpose : -//================================================================================= -class GeometryGUI_MultiTranslationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MultiTranslationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MultiTranslationDlg(); - -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 */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Vec myVec ; - int myNbTimes1 ; - int myNbTimes2 ; - Standard_Real myStep1 ; - Standard_Real myStep2 ; - gp_Dir myDir1 ; - gp_Dir myDir2 ; - - bool myOkBase ; - bool myOkDir1 ; - bool myOkDir2 ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeMultiTranslationSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A4; - GeometryGUI_SpinBox* SpinBox_C1A3 ; - QSpinBox* SpinBox_C1A4 ; - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A2; - QLineEdit* LineEditC2A1; - QLineEdit* LineEditC2A2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A3; - QPushButton* SelectButtonC2A3; - QLabel* TextLabelC2A1; - QLabel* TextLabelC2A2; - QLabel* TextLabelC2A3; - - QLabel* TextLabelC2A4; - QLabel* TextLabelC2A5; - QLabel* TextLabelC2A6; - QLabel* TextLabelC2A7; - GeometryGUI_SpinBox* SpinBox_C2A4 ; - QSpinBox* SpinBox_C2A5; - GeometryGUI_SpinBox* SpinBox_C2A6 ; - QSpinBox* SpinBox_C2A7 ; - - QCheckBox* CheckBoxReverse0; - QCheckBox* CheckBoxReverse1; - QCheckBox* CheckBoxReverse2; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void LineEditReturnPressed() ; - void ReverseAngle1(int) ; - void ReverseAngle2(int) ; - void ValueChangedInSpinBox( double newValue ) ; /* for GeometryGUI_SpinBox */ - void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */ - -protected: - QGridLayout* GeometryGUI_MultiTranslationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; -}; - -#endif // DIALOGBOX_MULTITRANSLATION_H diff --git a/GEOMGUI/GeometryGUI_NbIsosDlg.cxx b/GEOMGUI/GeometryGUI_NbIsosDlg.cxx deleted file mode 100644 index 849cb1a1d..000000000 --- a/GEOMGUI/GeometryGUI_NbIsosDlg.cxx +++ /dev/null @@ -1,135 +0,0 @@ -// 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_NbIsosDlg.cxx -// Author : -// Module : GEOM -// $Header: - -using namespace std; -#include "GeometryGUI_NbIsosDlg.h" -#include "GeometryGUI.h" -#include "QAD_Tools.h" - -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_NbIsosDlg() -// purpose : Constructs a GeometryGUI_NbIsosDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_NbIsosDlg::GeometryGUI_NbIsosDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - if ( !name ) - setName( "GeometryGUI_NbIsosDlg" ); - setCaption( name ); - setSizeGripEnabled( TRUE ); - QGridLayout* MyDialogLayout = new QGridLayout( this ); - MyDialogLayout->setSpacing( 6 ); - MyDialogLayout->setMargin( 11 ); - - /***************************************************************/ - QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - TextLabel1 = new QLabel( GroupC1, "TextLabel1" ); - TextLabel1->setText( tr( "GEOM_MEN_ISOU") ); - GroupC1Layout->addWidget( TextLabel1, 0, 0 ); - - SpinBoxU = new QSpinBox( GroupC1, "SpinBoxU" ); - SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - SpinBoxU->setMinValue( 1 ); - SpinBoxU->setValue( 1 ); - GroupC1Layout->addWidget( SpinBoxU, 0, 1 ); - - TextLabel2 = new QLabel( GroupC1, "TextLabel2" ); - TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ; - GroupC1Layout->addWidget( TextLabel2, 0, 2 ); - - SpinBoxV = new QSpinBox( GroupC1, "SpinBoxV"); - SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - SpinBoxV->setValue( 1 ); - SpinBoxV->setMinValue( 1 ); - GroupC1Layout->addWidget( SpinBoxV, 0, 3 ); - - /***************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ; - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - - GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ; - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); - /***************************************************************/ - - MyDialogLayout->addWidget( GroupC1, 0, 0 ); - MyDialogLayout->addWidget( GroupButtons, 1, 0 ); - - /* Retrieve GeomGUI */ - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - // signals and slots connections - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - - /* Move widget on the botton right corner of main widget */ - QAD_Tools::centerWidget( this, parent ); -} - - -//================================================================================= -// function : ~GeometryGUI_NbIsosDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_NbIsosDlg::~GeometryGUI_NbIsosDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - diff --git a/GEOMGUI/GeometryGUI_NbIsosDlg.h b/GEOMGUI/GeometryGUI_NbIsosDlg.h deleted file mode 100644 index a5d3498cd..000000000 --- a/GEOMGUI/GeometryGUI_NbIsosDlg.h +++ /dev/null @@ -1,61 +0,0 @@ -// 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_NbIsosDlg.h -// Author : -// Module : GEOM -// $Header: - -#ifndef GEOMETRYGUI_NBISOSDLG_H -#define GEOMETRYGUI_NBISOSDLG_H - -#include - -class QLabel; -class QSpinBox; -class QPushButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_NbIsosDlg -// purpose : -//================================================================================= -class GeometryGUI_NbIsosDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_NbIsosDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_NbIsosDlg(); - - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - - QPushButton* buttonOk; - QPushButton* buttonCancel; - QLabel* TextLabel1 ; - QLabel* TextLabel2 ; - QSpinBox* SpinBoxU ; - QSpinBox* SpinBoxV ; -}; - -#endif // GEOMETRYGUI_NBISOSDLG_H diff --git a/GEOMGUI/GeometryGUI_OrientationDlg.cxx b/GEOMGUI/GeometryGUI_OrientationDlg.cxx deleted file mode 100644 index ba04a75dc..000000000 --- a/GEOMGUI/GeometryGUI_OrientationDlg.cxx +++ /dev/null @@ -1,608 +0,0 @@ -// 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_OrientationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_OrientationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_OrientationDlg() -// purpose : Constructs a GeometryGUI_OrientationDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_OrientationDlg::GeometryGUI_OrientationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_ORIENTATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - if ( !name ) - setName( "GeometryGUI_OrientationDlg" ); - resize( 303, 242 ); - setCaption( tr( "GEOM_ORIENTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_OrientationDlgLayout = new QGridLayout( this ); - GeometryGUI_OrientationDlgLayout->setSpacing( 6 ); - GeometryGUI_OrientationDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ORIENTATION" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_OrientationDlgLayout->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_OrientationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - /* Spin box construction */ - SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_VECTOR_LENGTH" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_ORIENTATION_OPT" ) ); - GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 2 ); - GeometryGUI_OrientationDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - -} - -//================================================================================= -// function : ~GeometryGUI_OrientationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_OrientationDlg::~GeometryGUI_OrientationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::Init( SALOME_Selection* Sel ) -{ - - double step ; - 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( 25.0 ) ; /* = myLength */ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - CheckBoxReverse->setChecked( FALSE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - myLength = 25.0 ; - myOkShape = false ; - myOkLength = true; - mySimulationTopoDs.Nullify() ; - myShape.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseOrientation(int) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( SpinBox_C1A2, 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_OrientationDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ClickOnApply() -{ - /* Leave simulation display in this method ! */ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape && CheckBoxReverse->isChecked() && myOkLength == true ) { - myGeomGUI->MakeOrientationChangeAndDisplay( myGeomShape ) ; - CheckBoxReverse->setChecked( FALSE ); - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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 : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_OrientationDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - this->mySimulationTopoDs.Nullify() ; - - /* Name of future selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - this->myOkShape = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor */ - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - - if( myOkShape && myOkLength ) { - MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ValueChangedInSpinBox( double newValue ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender() ; - if( send == SpinBox_C1A2 ) { - this->myLength = newValue ; - myOkLength = true ; - } - - if ( myConstructorId == 0 && myOkShape && myOkLength == true ) { - MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupC1->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupC1->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - - -//=========================================================================================== -// function : ReverseOrientation() -// purpose : -//=========================================================================================== -void GeometryGUI_OrientationDlg::ReverseOrientation(int state) -{ - if( this->myOkShape && myOkLength == true ) { - MakeOrientationSimulationAndDisplay( this->myShape, this-> myLength ) ; - } - return ; -} - - -//=========================================================================================== -// function : MakeOrientationSimulationAndDisplay() -// purpose : Create 'aCompound1' and 'aCompound2' each contains edges oriented -// : respectively FORWARD and REVERSE for all faces of 'aTopoDS' -// : These edges represent normal vectors on faces of 'aTopoDS' -// : For a unique edge an arrow is displayed to show its orientation. -//=========================================================================================== -void GeometryGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - TopoDS_Compound aCompound1, aCompound2 ; - TopoDS_Compound NullComp ; - BRep_Builder aBuilder1, aBuilder2; - aCompound1 = aCompound2 = NullComp ; - aBuilder1.MakeCompound(aCompound1) ; - aBuilder2.MakeCompound(aCompound2) ; - - if( aTopoDS.IsNull() ) - return ; - - /* Case of an edge */ - if( aTopoDS.ShapeType() == TopAbs_EDGE ) { - /* Try to display a cone simulation shape to show direction of edge */ - TopoDS_Shape tmpShape = aTopoDS ; - if( this->CheckBoxReverse->isChecked() ) { - if( aTopoDS.Orientation() == TopAbs_FORWARD) - tmpShape.Orientation(TopAbs_REVERSED) ; - else - tmpShape.Orientation(TopAbs_FORWARD) ; - } - if( myGeomGUI->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; - } - - - gp_Pnt P1, P2 ; - gp_Vec V, V1, V2 ; - TopExp_Explorer ex( aTopoDS, TopAbs_FACE ); - int test = 0 ; - while (ex.More()) { - - const TopoDS_Face& F = TopoDS::Face(ex.Current()); - /* find the center of the minmax */ - BRepAdaptor_Surface SF(F); - Standard_Real u, v, x; - - u = SF.FirstUParameter(); - x = SF.LastUParameter(); - if ( Precision::IsInfinite(u) ) { - if( Precision::IsInfinite(x) ) u = 0.0 ; else u = x ; - } - else if ( !Precision::IsInfinite(x) ) - u = (u+x) / 2.0 ; - - v = SF.FirstVParameter(); - x = SF.LastVParameter(); - if ( Precision::IsInfinite(v) ) { - if ( Precision::IsInfinite(x) ) v = 0.0 ; else v = x ; - } - else if ( !Precision::IsInfinite(x) ) - v = (v+x) / 2.0 ; - - SF.D1( u, v, P1, V1, V2 ); - V = V1.Crossed(V2); - x = V.Magnitude(); - if ( x > 1.e-10 ) - V.Multiply( length/x ); - else { - V.SetCoord( length/2.0, 0.0, 0.0 ) ; - MESSAGE ("Null normal in Orientation " << endl ) ; - } - - P2 = P1; - /* test orientation of each face and displays forward (aCompound1) */ - if( F.Orientation() == TopAbs_FORWARD ) - P2.Translate(V); - else - P2.Translate(-V) ; - BRepBuilderAPI_MakeEdge anEdge(P1, P2) ; - aBuilder1.Add( aCompound1, anEdge ) ; - - P2 = P1; - /* test orientation of each face and displays forward (aCompound2) */ - if( F.Orientation() == TopAbs_FORWARD ) - P2.Translate(-V); - else - P2.Translate(V) ; - anEdge = BRepBuilderAPI_MakeEdge(P1, P2) ; - aBuilder2.Add( aCompound2, anEdge ) ; - - ex.Next(); - test++ ; - } - - /* display simulation compounds */ - if( test > 0 && this->CheckBoxReverse->isChecked() ) { - mySimulationTopoDs = aCompound1 ; - } - else if ( test > 0 && !CheckBoxReverse->isChecked() ) { - mySimulationTopoDs = aCompound2 ; - } - if(!mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - - return ; -} diff --git a/GEOMGUI/GeometryGUI_OrientationDlg.h b/GEOMGUI/GeometryGUI_OrientationDlg.h deleted file mode 100644 index 81b439e1a..000000000 --- a/GEOMGUI/GeometryGUI_OrientationDlg.h +++ /dev/null @@ -1,124 +0,0 @@ -// 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_OrientationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ORIENTATION_H -#define DIALOGBOX_ORIENTATION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : DialogBox_ORIENTATION -// purpose : -//================================================================================= -class GeometryGUI_OrientationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_OrientationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_OrientationDlg(); - -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 */ - GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */ - TopoDS_Shape myShape ; /* topology used */ - Standard_Real myLength ; /* to simulate normal vector */ - bool myOkShape ; - bool myOkLength ; - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeOrientationSimulationAndDisplay( const TopoDS_Shape& aTopoDS, Standard_Real length ) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - GeometryGUI_SpinBox* SpinBox_C1A2 ; - - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QCheckBox* CheckBoxReverse; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseOrientation(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_OrientationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ORIENTATION_H diff --git a/GEOMGUI/GeometryGUI_PartitionDlg.cxx b/GEOMGUI/GeometryGUI_PartitionDlg.cxx deleted file mode 100644 index db30aec01..000000000 --- a/GEOMGUI/GeometryGUI_PartitionDlg.cxx +++ /dev/null @@ -1,530 +0,0 @@ -// 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_PartitionDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PartitionDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MIN_EDIT_SIZE 150 - -//================================================================================= -// class : GeometryGUI_PartitionDlg() -// purpose : Constructs a GeometryGUI_PartitionDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_PartitionDlg::GeometryGUI_PartitionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PARTITION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); -// QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PARTITION_KEEP_FACES"))); - - if ( !name ) - setName( "GeometryGUI_PartitionDlg" ); - setCaption( tr( "GEOM_PARTITION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - QGridLayout* GeometryGUI_PartitionDlgLayout = new QGridLayout( this ); - GeometryGUI_PartitionDlgLayout->setSpacing( 6 ); - GeometryGUI_PartitionDlgLayout->setMargin( 11 ); - - /***************************************************************/ - /* Constructor group */ - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - QGridLayout* GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - GroupConstructorsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 0 ); - - GeometryGUI_PartitionDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - /* Arguments group */ - /***************************************************************/ - /* Shapes and Tools */ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_PARTITION" ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setMinimumSize(MIN_EDIT_SIZE, 0); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_TOOL_OBJECT" ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setMinimumSize(MIN_EDIT_SIZE, 0); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - /* Limit */ - TextLabelComboBox1 = new QLabel( GroupC1, "TextLabelComboBox1" ); - TextLabelComboBox1->setText( tr( "RECONSTRUCTION_LIMIT") ); - GroupC1Layout->addWidget( TextLabelComboBox1, 2, 0 ); - ComboBox1 = new QComboBox( FALSE, GroupC1, "ComboBox1" ); - ComboBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - ComboBox1->setMinimumSize(MIN_EDIT_SIZE, 0); - GroupC1Layout->addWidget( ComboBox1, 2, 2 ); - - GeometryGUI_PartitionDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - /* Result suppresion */ - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "SUPPRESS_RESULT") ); - GroupC2->setColumnLayout(0, Qt::Vertical ); - GroupC2->layout()->setSpacing( 0 ); - GroupC2->layout()->setMargin( 0 ); - QGridLayout* GroupC2Layout = new QGridLayout( GroupC2->layout() ); - GroupC2Layout->setAlignment( Qt::AlignTop ); - GroupC2Layout->setSpacing( 6 ); - GroupC2Layout->setMargin( 11 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "SUPPRESS_RESULT_INSIDE") ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setPixmap( image1 ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "SUPPRESS_RESULT_OUTSIDE") ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" ); - SelectButtonC2A2->setPixmap( image1 ); - GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 ); - LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); - GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - - GeometryGUI_PartitionDlgLayout->addWidget( GroupC2, 2, 0 ); - - /***************************************************************/ - /* , , buttons */ - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - - GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 ); - - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - - GeometryGUI_PartitionDlgLayout->addWidget( GroupButtons, 3, 0 ); - - /***************************************************************/ - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_PartitionDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PartitionDlg::~GeometryGUI_PartitionDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::Init( SALOME_Selection* Sel ) -{ - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* type for sub shape selection */ -// ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SHAPE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SOLID" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SHELL" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_FACE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_WIRE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_EDGE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_VERTEX" ) ); - - /* Current item is 'Shape' */ - ComboBox1->setCurrentItem(0); - myLimit = ComboBox1->currentItem(); - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( ComboBox1, SIGNAL( activated(int) ), this, SLOT( ComboTextChanged() ) ); - - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SelectButtonC2A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A2, 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 */ - - ComboTextChanged(); - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - if (myOkListShapes || myOkListTools || myOkKeepShape || myOkRemoveShape) - { - GEOM::shape_type limit; - switch (myLimit) { -// case 0: limit = GEOM::SOLID ; break; - case 0: limit = GEOM::SHAPE ; break; - case 1: limit = GEOM::SHELL ; break; - case 2: limit = GEOM::FACE ; break; - case 3: limit = GEOM::WIRE ; break; - case 4: limit = GEOM::EDGE ; break; - case 5: limit = GEOM::VERTEX; break; - default:limit = GEOM::SHAPE; - } - myGeomGUI->MakePartitionAndDisplay (myListShapes, - myListTools, - myListKeepInside, - myListRemoveInside, - limit); - - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : -//================================================================================= -// void GeometryGUI_PartitionDlg::ConstructorsClicked(int constructorId) -// { -// } - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_PartitionDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - - if ( nbSel < 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkListShapes = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkListTools = false ; - } - else if ( myEditCurrentArgument == LineEditC2A1 ) { - myOkListTools = false ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myOkListTools = false ; - } - return ; - } - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ; - myEditCurrentArgument->setText(aString) ; - myOkListTools = true ; - } - else if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ; - myEditCurrentArgument->setText(aString) ; - myOkKeepShape = true ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ; - myEditCurrentArgument->setText(aString) ; - myOkRemoveShape = true ; - } - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - if (send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2 ; - } - else if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1 ; - } - else if(send == SelectButtonC2A2) { - LineEditC2A2->setFocus() ; - myEditCurrentArgument = LineEditC2A2 ; - } - SelectionIntoArgument() ; - - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC2A2 ) - myEditCurrentArgument = LineEditC2A2 ; - 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_PartitionDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - -//======================================================================= -//function : ComboTextChanged -//purpose : -//======================================================================= - -void GeometryGUI_PartitionDlg::ComboTextChanged() -{ - - myLimit = ComboBox1->currentItem(); - GroupC2->setEnabled( ComboBox1->currentItem() < 3 ); - - return ; -} diff --git a/GEOMGUI/GeometryGUI_PartitionDlg.h b/GEOMGUI/GeometryGUI_PartitionDlg.h deleted file mode 100644 index 72725819b..000000000 --- a/GEOMGUI/GeometryGUI_PartitionDlg.h +++ /dev/null @@ -1,127 +0,0 @@ -// 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_PartitionDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PARTITION_H -#define DIALOGBOX_PARTITION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QComboBox; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_PartitionDlg -// purpose : -//================================================================================= -class GeometryGUI_PartitionDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PartitionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PartitionDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - GEOM::GEOM_Gen::ListOfIOR myListTools ; - GEOM::GEOM_Gen::ListOfIOR myListRemoveInside ; - GEOM::GEOM_Gen::ListOfIOR myListKeepInside ; - - bool myOkListShapes ; /* to check when argument is defined */ - bool myOkListTools ; /* to check when argument is defined */ - bool myOkKeepShape ; /* to check when argument is defined */ - bool myOkRemoveShape ; /* to check when argument is defined */ - int myLimit; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - /* common buttons */ - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - /* constructor radiobuttons */ - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - /* Arguments group */ - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; - - /* limit */ - QComboBox* ComboBox1; - QLabel* TextLabelComboBox1; - - /* Keep Inside and Remove Inside feilds */ - QGroupBox* GroupC2; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A2; - QLabel* TextLabelC2A2; - QPushButton* SelectButtonC2A2; - -private slots: - - //void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ComboTextChanged() ; -}; - -#endif // DIALOGBOX_PARTITION_H diff --git a/GEOMGUI/GeometryGUI_PipeDlg.cxx b/GEOMGUI/GeometryGUI_PipeDlg.cxx deleted file mode 100644 index 8f24507c0..000000000 --- a/GEOMGUI/GeometryGUI_PipeDlg.cxx +++ /dev/null @@ -1,514 +0,0 @@ -// 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_PipeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PipeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_PipeDlg() -// purpose : Constructs a GeometryGUI_PipeDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_PipeDlg::GeometryGUI_PipeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PIPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_PipeDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_PIPE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PipeDlgLayout = new QGridLayout( this ); - GeometryGUI_PipeDlgLayout->setSpacing( 6 ); - GeometryGUI_PipeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PIPE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_PipeDlgLayout->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_PipeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_BASE_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_PATH_OBJECT" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - GeometryGUI_PipeDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_PipeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PipeDlg::~GeometryGUI_PipeDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - GroupC1->show(); - myConstructorId = 0 ; - myEditCurrentArgument = LineEditC1A1 ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - mySimulationTopoDs.Nullify() ; - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PipeDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - //GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - - -//================================================================================= -// function : ClickOnAply() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakePipeAndDisplay(myGeomShape2 ,myGeomShape1) ; - } - break ; - } - } - // accept(); - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_PipeDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 && - S.ShapeType() != TopAbs_COMPSOLID && - S.ShapeType() != TopAbs_COMPOUND && - S.ShapeType() != TopAbs_SOLID && - S.ShapeType() != TopAbs_SHAPE ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 && ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2->setText(aString) ; - myOkShape2 = true ; - } - - if (myOkShape1 && myOkShape2 && !myShape1.IsNull() && !myShape2.IsNull()) - { - //Make preview - TopoDS_Shape tds ; - TopoDS_Wire aWire ; - - if( myShape2.ShapeType() == TopAbs_WIRE ) - aWire = TopoDS::Wire(myShape2) ; - else - if ( myShape2.ShapeType() == TopAbs_EDGE ) - { - TopoDS_Edge aEdge = TopoDS::Edge(myShape2) ; - aWire = BRepBuilderAPI_MakeWire(aEdge); - - } - - try - { - tds = BRepOffsetAPI_MakePipe(aWire,myShape1 ) ; - if ( BRepAlgoAPI::IsValid(tds) ) - { - //Draw Pipe - mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - } - catch(Standard_Failure) - { - } - } -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( send == SelectButtonC1A1 ) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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_PipeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_PipeDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate any active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_PipeDlg.h b/GEOMGUI/GeometryGUI_PipeDlg.h deleted file mode 100644 index bbae793a9..000000000 --- a/GEOMGUI/GeometryGUI_PipeDlg.h +++ /dev/null @@ -1,119 +0,0 @@ -// 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_PipeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PIPE_H -#define DIALOGBOX_PIPE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_PipeDlg -// purpose : -//================================================================================= -class GeometryGUI_PipeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PipeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PipeDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - 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 */ - // Handle(GEOM_ShapeTypeFilter) myEdgFilter ; /* Filter selection */ - // Handle(GEOM_ShapeTypeFilter) myWireFilter ; /* Filter selection */ - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A2; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_PipeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_PIPE_H diff --git a/GEOMGUI/GeometryGUI_PlaneDlg.cxx b/GEOMGUI/GeometryGUI_PlaneDlg.cxx deleted file mode 100644 index 7816d7b06..000000000 --- a/GEOMGUI/GeometryGUI_PlaneDlg.cxx +++ /dev/null @@ -1,879 +0,0 @@ -// 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_PlaneDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PlaneDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_PlaneDlg() -// purpose : Constructs a GeometryGUI_PlaneDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_PlaneDlg::GeometryGUI_PlaneDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - /***************************************************************/ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PLANE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PLANE_DXYZ"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PLANE_FACE"))); - - if ( !name ) - setName( "GeometryGUI_PlaneDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_PLANE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PlaneDlgLayout = new QGridLayout( this ); - GeometryGUI_PlaneDlgLayout->setSpacing( 6 ); - GeometryGUI_PlaneDlgLayout->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_PlaneDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PLANE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (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->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupPointDirection = new QGroupBox( this, "GroupPointDirection" ); - GroupPointDirection->setTitle( tr( "GEOM_PLANE_PV" ) ); - GroupPointDirection->setColumnLayout(0, Qt::Vertical ); - GroupPointDirection->layout()->setSpacing( 0 ); - GroupPointDirection->layout()->setMargin( 0 ); - GroupPointDirectionLayout = new QGridLayout( GroupPointDirection->layout() ); - GroupPointDirectionLayout->setAlignment( Qt::AlignTop ); - GroupPointDirectionLayout->setSpacing( 6 ); - GroupPointDirectionLayout->setMargin( 11 ); - LineEditDirection = new QLineEdit( GroupPointDirection, "LineEditDirection" ); - LineEditDirection->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditDirection->sizePolicy().hasHeightForWidth() ) ); - GroupPointDirectionLayout->addWidget( LineEditDirection, 1, 2 ); - LineEditPt1 = new QLineEdit( GroupPointDirection, "LineEditPt1" ); - LineEditPt1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditPt1->sizePolicy().hasHeightForWidth() ) ); - GroupPointDirectionLayout->addWidget( LineEditPt1, 0, 2 ); - SelectButtonPt1 = new QPushButton( GroupPointDirection, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - GroupPointDirectionLayout->addWidget( SelectButtonPt1, 0, 1 ); - SelectButtonDirection = new QPushButton( GroupPointDirection, "SelectButtonDirection" ); - SelectButtonDirection->setText( tr( "" ) ); - SelectButtonDirection->setPixmap( image1 ); - GroupPointDirectionLayout->addWidget( SelectButtonDirection, 1, 1 ); - TextLabelDirection = new QLabel( GroupPointDirection, "TextLabelDirection" ); - TextLabelDirection->setText( tr( "GEOM_VECTOR" ) ); - TextLabelDirection->setMinimumSize( QSize( 50, 0 ) ); - TextLabelDirection->setFrameShape( QLabel::NoFrame ); - TextLabelDirection->setFrameShadow( QLabel::Plain ); - GroupPointDirectionLayout->addWidget( TextLabelDirection, 1, 0 ); - TextLabelPt1 = new QLabel( GroupPointDirection, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT" ) ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointDirectionLayout->addWidget( TextLabelPt1, 0, 0 ); - - SpinBox_C1Size = new GeometryGUI_SpinBox( GroupPointDirection, "SpinBox_C1Size" ); - GroupPointDirectionLayout->addWidget( SpinBox_C1Size, 2, 2 ); - TextLabelC1Size = new QLabel( GroupPointDirection, "TextLabelC1Size" ); - TextLabelC1Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC1Size->setMinimumSize( QSize( 60, 0 ) ); - GroupPointDirectionLayout->addWidget( TextLabelC1Size, 2, 0 ); - - GeometryGUI_PlaneDlgLayout->addWidget( GroupPointDirection, 1, 0 ); - - /***************************************************************/ - GroupPointPlusCoordinates = new QGroupBox( this, "GroupPointPlusCoordinates" ); - GroupPointPlusCoordinates->setTitle( tr( "GEOM_PLANE_PVC" ) ); - GroupPointPlusCoordinates->setColumnLayout(0, Qt::Vertical ); - GroupPointPlusCoordinates->layout()->setSpacing( 0 ); - GroupPointPlusCoordinates->layout()->setMargin( 0 ); - GroupPointPlusCoordinatesLayout = new QGridLayout( GroupPointPlusCoordinates->layout() ); - GroupPointPlusCoordinatesLayout->setAlignment( Qt::AlignTop ); - GroupPointPlusCoordinatesLayout->setSpacing( 6 ); - GroupPointPlusCoordinatesLayout->setMargin( 11 ); - - LineEditPt2 = new QLineEdit( GroupPointPlusCoordinates, "LineEditPt2" ); - LineEditPt2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditPt2->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( LineEditPt2, 0, 0, 5, 8 ); - - SelectButtonPt2 = new QPushButton( GroupPointPlusCoordinates, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - SelectButtonPt2->setMaximumSize( QSize( 28, 32767 ) ); - GroupPointPlusCoordinatesLayout->addWidget( SelectButtonPt2, 0, 4 ); - - TextLabelPt2 = new QLabel( GroupPointPlusCoordinates, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT" ) ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt2->setFrameShape( QLabel::NoFrame ); - TextLabelPt2->setFrameShadow( QLabel::Plain ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( TextLabelPt2, 0, 0, 0, 3 ); - - SpinBox_DX = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DX" ); - SpinBox_DX->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DX->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( SpinBox_DX, 1, 1, 3, 4 ); - - SpinBox_DY = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DY" ); - SpinBox_DY->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DY->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addWidget( SpinBox_DY, 1, 6 ); - - SpinBox_DZ = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DZ" ); - SpinBox_DZ->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DZ->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addWidget( SpinBox_DZ, 1, 8 ); - - TextLabel_DX = new QLabel( GroupPointPlusCoordinates, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DX, 1, 2 ); - - TextLabel_DY = new QLabel( GroupPointPlusCoordinates, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DY, 1, 5 ); - - TextLabel_DZ = new QLabel( GroupPointPlusCoordinates, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DZ, 1, 7 ); - - TextLabelCoordinates = new QLabel( GroupPointPlusCoordinates, "TextLabelCoordinates" ); - TextLabelCoordinates->setText( tr( "GEOM_COOR" ) ); - TextLabelCoordinates->setMinimumSize( QSize( 50, 0 ) ); - TextLabelCoordinates->setFrameShape( QLabel::NoFrame ); - TextLabelCoordinates->setFrameShadow( QLabel::Plain ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabelCoordinates, 1, 0 ); - - TextLabelC2Size = new QLabel( GroupPointPlusCoordinates, "TextLabelC2Size" ); - TextLabelC2Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC2Size->setMinimumSize( QSize( 60, 0 ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( TextLabelC2Size, 2, 2, 0, 1 ); - - SpinBox_C2Size = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_C2Size" ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( SpinBox_C2Size, 2, 2, 5, 8 ); - - QSpacerItem* spacer_c = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupPointPlusCoordinatesLayout->addMultiCell( spacer_c, 2, 2, 2, 4 ); - QSpacerItem* spacer_d = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupPointPlusCoordinatesLayout->addItem( spacer_d, 1, 1 ); - - GeometryGUI_PlaneDlgLayout->addWidget( GroupPointPlusCoordinates, 1, 0 ); - - /***************************************************************/ - - GroupFace = new QGroupBox( this, "GroupFace" ); - GroupFace->setTitle( tr( "GEOM_FACE" ) ); - GroupFace->setColumnLayout(0, Qt::Vertical ); - GroupFace->layout()->setSpacing( 0 ); - GroupFace->layout()->setMargin( 0 ); - GroupFaceLayout = new QGridLayout( GroupFace->layout() ); - GroupFaceLayout->setAlignment( Qt::AlignTop ); - GroupFaceLayout->setSpacing( 6 ); - GroupFaceLayout->setMargin( 11 ); - - TextLabelFace = new QLabel( GroupFace, "TextLabelFace" ); - TextLabelFace->setFrameShadow( QLabel::Plain ); - TextLabelFace->setFrameShape( QLabel::NoFrame ); - TextLabelFace->setText( tr( "GEOM_SELECTION" ) ); - TextLabelFace->setMinimumSize( QSize( 50, 0 ) ); - GroupFaceLayout->addMultiCellWidget( TextLabelFace, 0, 0, 0, 1 ); - - SelectButtonFace = new QPushButton( GroupFace, "SelectButtonFace" ); - SelectButtonFace->setText( tr( "" ) ); - SelectButtonFace->setPixmap( image1 ); - SelectButtonFace->setMaximumSize( QSize( 28, 32767 ) ); - GroupFaceLayout->addWidget( SelectButtonFace, 0, 2 ); - - LineEditFace = new QLineEdit( GroupFace, "LineEditFace" ); - LineEditFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditFace->sizePolicy().hasHeightForWidth() ) ); - GroupFaceLayout->addWidget( LineEditFace, 0, 3 ); - - TextLabelC3Size = new QLabel( GroupFace, "TextLabelC3Size" ); - TextLabelC3Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC3Size->setMinimumSize( QSize( 60, 0 ) ); - GroupFaceLayout->addWidget( TextLabelC3Size, 1, 0 ); - - SpinBox_C3Size = new GeometryGUI_SpinBox( GroupFace, "SpinBox_C3Size" ); - SpinBox_C3Size->setCaption( tr( "" ) ); - GroupFaceLayout->addWidget( SpinBox_C3Size, 1, 3 ); - - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupFaceLayout->addMultiCell( spacer, 1, 1, 1, 2 ); - QSpacerItem* spacer_e = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupFaceLayout->addItem( spacer_e, 2, 3 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupFace, 1, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_PlaneDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PlaneDlg::~GeometryGUI_PlaneDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::Init( SALOME_Selection* Sel ) -{ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 1.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 1.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 1.0 ) ; - - this->myTrimSize = 2000.0 ; - SpinBox_C1Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C1Size->SetValue( myTrimSize ) ; - SpinBox_C2Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C2Size->SetValue( myTrimSize ) ; - SpinBox_C3Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C3Size->SetValue( myTrimSize ) ; - - GroupPointDirection->show(); - GroupPointPlusCoordinates->hide() ; - GroupFace->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditPt1 ; - mySimulationTopoDs.Nullify() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); - /* Filter for the next selection */ - mySelection->AddFilter( myVertexFilter ) ; - - /* 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( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditDirection, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( LineEditPt2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditFace, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonFace, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonDirection, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( SpinBox_C1Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - connect( SpinBox_C2Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - connect( SpinBox_C3Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - - 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PlaneDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false ; - mySelection->ClearFilters() ; - myConstructorId = constructorId ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - switch (constructorId) - { - case 0: /* plane from a point and a direction (vector, edge...) */ - { - GroupPointDirection->show(); - GroupPointPlusCoordinates->hide() ; - GroupFace->hide() ; - myEditCurrentArgument = LineEditPt1 ; - LineEditPt1->setText(tr("")) ; - LineEditDirection->setText(tr("")) ; - - /* for the first argument */ - mySelection->AddFilter(myVertexFilter) ; - break; - } - - case 1: /* plane from a point and vector coordinates */ - { - GroupPointDirection->hide() ; - GroupPointPlusCoordinates->show() ; - GroupFace->hide() ; - myEditCurrentArgument = LineEditPt2 ; - LineEditPt2->setText(tr("")) ; - SpinBox_DX->SetValue( 1.0 ) ; - SpinBox_DY->SetValue( 1.0 ) ; - SpinBox_DZ->SetValue( 1.0 ) ; - myOkCoordinates = true ; - - /* for the first argument */ - mySelection->AddFilter(myVertexFilter) ; - break ; - } - - case 2: /* plane from a planar face selection */ - { - GroupPointDirection->hide() ; - GroupPointPlusCoordinates->hide() ; - GroupFace->show() ; - myEditCurrentArgument = LineEditFace ; - LineEditFace->setText(tr("")) ; - - /* for the first argument */ - mySelection->AddFilter(myFaceFilter) ; - break ; - } - - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : /* args are myPoint1 and myDx, myDy, myDz from a vector(edge) */ - { - if(myOkPoint1 && myOkDirection) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - break ; - } - - case 1 : /* args are myPoint1 and myDx, myDy, myDz from a Spin Box */ - { - if(myOkPoint1) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - break ; - } - - case 2 : /* arg is a planar face selection */ - { - if(myOkPlanarFace) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_PlaneDlg::SelectionIntoArgument() -{ - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditPt1 ) { - LineEditPt1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditDirection ) { - LineEditDirection->setText("") ; - myOkDirection = false ; - } - break ; - } - case 1: - { - if ( myEditCurrentArgument == LineEditPt2 ) { - LineEditPt2->setText("") ; - myOkPoint1 = false ; - } - break ; - } - - case 2: - { - if ( myEditCurrentArgument == LineEditFace ) { - LineEditFace->setText("") ; - if ( aString.compare("") == 0 ) - myOkPlanarFace = false ; - else - myOkPlanarFace = true ; - } - break ; - } - - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - - /* FIRST CONSTRUCTOR */ - if ( myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditDirection ) { - /* We verify if the selection is a linear edge */ - gp_Pnt Pfirst, Plast ; - if( myGeomGUI->LinearEdgeExtremities(S, Pfirst, Plast ) ) { - myGeomGUI->GetBipointDxDyDz( Pfirst, Plast, myDx, myDy, myDz) ; - LineEditDirection->setText(aString) ; - myOkDirection = true ; - this->myTrimSize = SpinBox_C1Size->GetValue() ; - } - } - - /* SECOND CONSTRUCTOR */ - else if ( myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt2->setText(aString) ; - /* Get arguments */ - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - this->myTrimSize = SpinBox_C2Size->GetValue() ; - myOkPoint1 = true ; - myOkCoordinates = true ; - } - - /* THIRD CONSTRUCTOR */ - else if ( myEditCurrentArgument == LineEditFace) { - if( myOkPlanarFace ) { - LineEditFace->setText(aString) ; - BRepAdaptor_Surface surf(TopoDS::Face(S)); - gp_Pln Plane = surf.Plane(); - - gp_Pnt myPoint1 = Plane.Location(); - gp_Ax1 ax = Plane.Axis(); - myDx = (ax.Direction()).X() ; - myDy = (ax.Direction()).Y() ; - myDz = (ax.Direction()).Z() ; - this->myTrimSize = SpinBox_C3Size->GetValue() ; - } - } - - /* Call method simulation */ - if( ( myOkPoint1 && myOkDirection) || ( myOkPoint1 && myOkCoordinates ) || myOkPlanarFace ) { - if ( myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion()*Precision::Confusion() ) { - MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - } - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - mySelection->AddFilter(myVertexFilter) ; - } - else if(send == SelectButtonDirection) { - LineEditDirection->setFocus() ; - myEditCurrentArgument = LineEditDirection; - /* Edge filter here */ - mySelection->AddFilter(myEdgeFilter) ; - SelectionIntoArgument() ; - } - break; - } - - case 1: - { - if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; - /* Vertex filter here */ - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send == SelectButtonFace) { - LineEditFace->setFocus() ; - myEditCurrentArgument = LineEditFace; - /* Face filter here */ - mySelection->AddFilter(myFaceFilter) ; - SelectionIntoArgument() ; - } - break; - } - - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender() ; - - if( send == SpinBox_DX ) { - myDx = newValue ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DY ) { - myDx = SpinBox_DX->GetValue() ; - myDy = newValue ; - myDz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DZ ) { - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = newValue ; - } else if( send == SpinBox_C1Size || send == SpinBox_C2Size || send == SpinBox_C3Size ) { - myTrimSize = newValue ; - } else - return ; - - if ( myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion() * Precision::Confusion() ) { - MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditDirection ) - myEditCurrentArgument = LineEditDirection ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; - else if ( send == LineEditFace ) - myEditCurrentArgument = LineEditFace ; - 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_PlaneDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupPointDirection->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupFace->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupPointDirection->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupFace->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; -} - - - -//================================================================================= -// function : MakePlaneSimulationAndDisplay(() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::MakePlaneSimulationAndDisplay( const gp_Pnt& P1, - const Standard_Real dx, - const Standard_Real dy, - const Standard_Real dz, - const Standard_Real trimsize ) -{ - try { - gp_Dir aDirection( dx, dy, dz ) ; - /* We make a trimmed plane */ - gp_Pln gplane(P1, aDirection) ; - mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -trimsize, +trimsize, -trimsize, +trimsize) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakePlaneSimulation" << endl ) ; - return ; - } - - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_PlaneDlg.h b/GEOMGUI/GeometryGUI_PlaneDlg.h deleted file mode 100644 index fb5c0f6ee..000000000 --- a/GEOMGUI/GeometryGUI_PlaneDlg.h +++ /dev/null @@ -1,179 +0,0 @@ -// 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_PlaneDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PLANE_H -#define DIALOGBOX_PLANE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_FaceFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_PlaneDlg -// purpose : -//================================================================================= -class GeometryGUI_PlaneDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PlaneDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PlaneDlg(); - -private : - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - - 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 ; /* Point on the plane */ - - Standard_Real myDx ; - Standard_Real myDy ; - Standard_Real myDz ; - Standard_Real myTrimSize ; - - bool myOkPoint1 ; /* true when argument is defined */ - bool myOkDirection ; - bool myOkCoordinates ; - bool myOkPlanarFace ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filters selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ - Handle(GEOM_FaceFilter) myFaceFilter; /* Filters selection */ - - // Constructors - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - // Constructor with a point + direction (vector) - QGroupBox* GroupPointDirection; - - QLabel* TextLabelPt1; - QPushButton* SelectButtonPt1; - QLineEdit* LineEditPt1; - - QLabel* TextLabelDirection; - QPushButton* SelectButtonDirection; - QLineEdit* LineEditDirection; - - QLabel* TextLabelC1Size; - GeometryGUI_SpinBox* SpinBox_C1Size ; - - // Constructor with a point + dx, dy, dz coordinates - QGroupBox* GroupPointPlusCoordinates; - - QLabel* TextLabelPt2; - QPushButton* SelectButtonPt2; - QLineEdit* LineEditPt2; - - QLabel* TextLabelCoordinates; - QLabel* TextLabel_DX; - QLabel* TextLabel_DY; - QLabel* TextLabel_DZ; - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - - QLabel* TextLabelC2Size; - GeometryGUI_SpinBox* SpinBox_C2Size ; - - // Constructor with a face - QGroupBox* GroupFace; - - QLabel* TextLabelFace; - QPushButton* SelectButtonFace; - QLineEdit* LineEditFace; - - QLabel* TextLabelC3Size; - GeometryGUI_SpinBox* SpinBox_C3Size ; - - // BUTTONS - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void MakePlaneSimulationAndDisplay( const gp_Pnt& P, - const Standard_Real dx, - const Standard_Real dy, - const Standard_Real dz, - const Standard_Real trimSize ) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_PlaneDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupPointDirectionLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupPointPlusCoordinatesLayout; - QGridLayout* GroupFaceLayout; - QHBoxLayout* Layout2 ; -}; - -#endif // DIALOGBOX_PLANE_H diff --git a/GEOMGUI/GeometryGUI_PointDlg.cxx b/GEOMGUI/GeometryGUI_PointDlg.cxx deleted file mode 100644 index 3c3d05ac7..000000000 --- a/GEOMGUI/GeometryGUI_PointDlg.cxx +++ /dev/null @@ -1,786 +0,0 @@ -// 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_PointDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PointDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_RightFrame.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" -#include "QAD_Tools.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_PointDlg() -// purpose : Constructs a GeometryGUI_PointDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_PointDlg::GeometryGUI_PointDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - const Handle (AIS_InteractiveContext)& ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_POINT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_POINT_EDGE"))); - - if ( !name ) - setName( "GeometryGUI_PointDlg" ); - resize( 303, 185 ); - setCaption( tr( "GEOM_POINT_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PointDlgLayout = new QGridLayout( this ); - GeometryGUI_PointDlgLayout->setSpacing( 6 ); - GeometryGUI_PointDlgLayout->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_PointDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "Constructors" ) ); - 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 ); - - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( FALSE ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); - - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setChecked( TRUE ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 3 ); - - GeometryGUI_PointDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - - /***************************************************************/ - GroupCoordinates = new QGroupBox( this, "GroupCoordinates" ); - GroupCoordinates->setTitle( tr( "GEOM_COORDINATES" ) ); - GroupCoordinates->setColumnLayout(0, Qt::Vertical ); - GroupCoordinates->layout()->setSpacing( 0 ); - GroupCoordinates->layout()->setMargin( 0 ); - GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() ); - GroupCoordinatesLayout->setAlignment( Qt::AlignTop ); - GroupCoordinatesLayout->setSpacing( 6 ); - GroupCoordinatesLayout->setMargin( 11 ); - - TextLabel_X = new QLabel( GroupCoordinates, "TextLabel_X" ); - TextLabel_X->setText( tr( "GEOM_X" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_X, 0, 0 ); - TextLabel_Y = new QLabel( GroupCoordinates, "TextLabel_Y" ); - TextLabel_Y->setText( tr( "GEOM_Y" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_Y, 0, 2 ); - TextLabel_Z = new QLabel( GroupCoordinates, "TextLabel_Z" ); - TextLabel_Z->setText( tr( "GEOM_Z" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_Z, 0, 4 ); - - /* Spin boxes construction */ - SpinBox_X = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_X" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_X, 0, 1 ); - SpinBox_Y = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_Y" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_Y, 0, 3 ); - SpinBox_Z = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_Z" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_Z, 0, 5 ); - GeometryGUI_PointDlgLayout->addWidget( GroupCoordinates, 1, 0 ); - - /***************************************************************/ - GroupWithEdge = new QGroupBox( this, "GroupWithEdge" ); - GroupWithEdge->setTitle( tr( "GEOM_PARAM_POINT" ) ); - GroupWithEdge->setFrameShape( QGroupBox::Box ); - GroupWithEdge->setFrameShadow( QGroupBox::Sunken ); - GroupWithEdge->setColumnLayout(0, Qt::Vertical ); - GroupWithEdge->layout()->setSpacing( 0 ); - GroupWithEdge->layout()->setMargin( 0 ); - GroupWithEdgeLayout = new QGridLayout( GroupWithEdge->layout() ); - GroupWithEdgeLayout->setAlignment( Qt::AlignTop ); - GroupWithEdgeLayout->setSpacing( 6 ); - GroupWithEdgeLayout->setMargin( 11 ); - - LineEdit_Edge = new QLineEdit( GroupWithEdge, "LineEdit_Edge" ); - GroupWithEdgeLayout->addWidget( LineEdit_Edge, 0, 2 ); - - SelectButton_Edge = new QPushButton( GroupWithEdge, "SelectButton_Edge" ); - SelectButton_Edge->setText( tr( "" ) ); - SelectButton_Edge->setPixmap( image1 ); - SelectButton_Edge->setToggleButton( FALSE ); - GroupWithEdgeLayout->addWidget( SelectButton_Edge, 0, 1 ); - - /* Spin box */ - SpinBox_Parameter = new GeometryGUI_SpinBox( GroupWithEdge, "SpinBox_Parameter" ); - GroupWithEdgeLayout->addWidget( SpinBox_Parameter, 1, 2 ); - - TextLabel_Edge = new QLabel( GroupWithEdge, "TextLabel_Edge" ); - TextLabel_Edge->setText( tr( "GEOM_EDGE" ) ); - TextLabel_Edge->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Edge->setFrameShape( QLabel::NoFrame ); - TextLabel_Edge->setFrameShadow( QLabel::Plain ); - GroupWithEdgeLayout->addWidget( TextLabel_Edge, 0, 0 ); - - TextLabel_Parameter = new QLabel( GroupWithEdge, "TextLabel_Parameter" ); - TextLabel_Parameter->setText( tr( "GEOM_PARAMETER" ) ); - TextLabel_Parameter->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Parameter->setFrameShape( QLabel::NoFrame ); - TextLabel_Parameter->setFrameShadow( QLabel::Plain ); - GroupWithEdgeLayout->addWidget( TextLabel_Parameter, 1, 0 ); - - GeometryGUI_PointDlgLayout->addWidget( GroupWithEdge, 1, 0 ); - /***************************************************************/ - - /* Initialisation and display */ - Init(Sel, ic) ; - - /* Move widget on the botton right corner of main widget */ - QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight); - /* Display Dialog */ - this->show() ; -} - - -//======================================================================= -// function : ~GeometryGUI_PointDlg() -// purpose : Destructor -//======================================================================= -GeometryGUI_PointDlg::~GeometryGUI_PointDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::Init(SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic) -{ - - /* 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_X->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_X->SetValue( 0.0 ) ; - SpinBox_Y->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_Y->SetValue( 0.0 ) ; - SpinBox_Z->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_Z->SetValue( 0.0 ) ; - - /* spin box for parameter on edge */ - double specificStep = 0.1 ; - SpinBox_Parameter->RangeStepAndValidator( -999999.99999, 999999.99999, specificStep, 5 ) ; - SpinBox_Parameter->SetValue( 0.50 ) ; - myParameter = 0.50 ; - - GroupCoordinates->show(); - GroupWithEdge->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - /* filter for the second constructor */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - - bool displayPoint = false ; - mySelection = Sel ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - myGeomGUI->SetState(POINT_METHOD) ; - - mySelection = Sel; - myOkEdge = false ; - - /* manages local context selection */ - myIC = ic ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode) ; - myUseLocalContext = true ; - } else { - myUseLocalContext = false ; - } - - - myPoint.SetCoord( 0.0, 0.0, 0.0 ) ; - TopoDS_Shape S; - - if( myGeomGUI->GetTopoFromSelection(mySelection, S) ) { - - /* Filter a possibly previous selection and try to put it into coordinates */ - if( myGeomGUI->VertexToPoint( S, myPoint) ) - displayPoint = false ; - else - displayPoint = true ; - } - else { - displayPoint = true ; - } - - mySimulationTopoDs.Nullify() ; - PointIntoCoordinates(myPoint, displayPoint) ; - - /* 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( SelectButton_Edge, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) ) ; - - connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - - connect( SpinBox_Parameter, SIGNAL ( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - connect( LineEdit_Edge, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ),this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - // connect( mySelection, SIGNAL ( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; done in constructor clicked ! - - /* 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 this Dialog */ -} - - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::ValueChangedInSpinBox( double newValue ) -{ - GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender() ; - double vx, vy, vz ; - if( send == SpinBox_X ) { - vx = newValue ; - vy = SpinBox_Y->GetValue() ; - vz = SpinBox_Z->GetValue() ; - } else if ( send == SpinBox_Y ) { - vx = SpinBox_X->GetValue() ; - vy = newValue ; - vz = SpinBox_Z->GetValue() ; - } else if (send == SpinBox_Z ) { - vx = SpinBox_X->GetValue() ; - vy = SpinBox_Y->GetValue() ; - vz = newValue ; - } else if (send == SpinBox_Parameter ) { - myParameter = newValue ; - } else - return ; - - - switch (myConstructorId) { - case 0: // default constructor - { - myPoint.SetCoord(vx, vy, vz) ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs = BRepBuilderAPI_MakeVertex (myPoint).Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break ; - } - case 1: - { - this->SelectionIntoArgument() ; - break ; - } - } - - return ; -} - - - -//======================================================================= -// funcion : PointIntoCoordinates() -// purpose : Sets user point coordinates into this dialog Spin boxes -// : and displays it or not according to 'bool displayPoint' -//======================================================================= -void GeometryGUI_PointDlg::PointIntoCoordinates(gp_Pnt P, bool displayPoint) -{ - switch (myConstructorId) { - case 0 : { - SpinBox_X->SetValue( P.X() ) ; - SpinBox_Y->SetValue( P.Y() ) ; - SpinBox_Z->SetValue( P.Z() ) ; - this->myPoint.SetCoord( P.X(), P.Y(), P.Z() ) ; - if( displayPoint ) { - mySimulationTopoDs = BRepBuilderAPI_MakeVertex(P).Shape() ; - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - break ; - } - case 1 : - { - // TODO - break ; - } - } - - return ; -} - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PointDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - myConstructorId = constructorId ; - switch (constructorId) - { - case 0: - { - if ( myUseLocalContext == false && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode) ; - myUseLocalContext = true ; - } - mySelection->ClearFilters() ; - GroupCoordinates->show(); - GroupWithEdge->hide() ; - /* Display point simulation */ - PointIntoCoordinates( this->myPoint, true ) ; - disconnect( mySelection, 0, this, 0 ); - break; - } - case 1: - { - if ( myUseLocalContext == true && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myIC->CloseLocalContext(myLocalContextId) ; - myUseLocalContext = false ; - } - LineEdit_Edge->setText("") ; - mySelection->AddFilter( myEdgeFilter ); - GroupCoordinates->hide(); - GroupWithEdge->show() ; - myOkEdge = false ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEdit_Edge ) { - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = send->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - LineEdit_Edge->setText( objectUserName ) ; - } - } - return ; -} - - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//======================================================================= -// function : ClickOnApply() -// purpose : -//======================================================================= -void GeometryGUI_PointDlg::ClickOnApply() -{ - - myGeomGUI->EraseSimulationShape() ; - - /* Close local context */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myIC->CloseLocalContext(myLocalContextId) ; - myUseLocalContext = false ; - } - - switch (myConstructorId) { - - case 0 : - { - /* Recup args and call method */ - double x = SpinBox_X->GetValue() ; - double y = SpinBox_Y->GetValue() ; - double z = SpinBox_Z->GetValue() ; - - myGeomGUI->MakePointAndDisplay(x,y,z) ; /* WARNING : no display if a local context is opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - /* no display if a local context is opened */ - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode); - myUseLocalContext = true ; - } - break ; - } - case 1 : - { - if( myOkEdge == true ) { - /* this constructor method has no idl interface : we use same than constructor 0 */ - myGeomGUI->MakePointAndDisplay( myPoint.X(), myPoint.Y(), myPoint.Z() ) ; - } - break ; - } - } - - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed (for constructors not using local context) -//================================================================================= -void GeometryGUI_PointDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - LineEdit_Edge->setText("") ; - QString aString = "" ; /* future name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - this->myOkEdge = false ; - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - switch (myConstructorId) - { - case 0: - break ; - case 1: - { - LineEdit_Edge->setText(aString) ; - if( S.ShapeType() == TopAbs_EDGE ) { - if( CalculateVertexOnCurve( TopoDS::Edge(S), myParameter, mySimulationTopoDs) ) { - if ( myGeomGUI->VertexToPoint( mySimulationTopoDs, myPoint ) ) { - this->myOkEdge = true ; - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - } - } - break ; - } - } - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: // default constructor - break; - case 1: - { - if(send == SelectButton_Edge) { - LineEdit_Edge->setFocus() ; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//======================================================================= -// function : UseLocalContext() -// purpose : Return true when this method has opened a local context -// : Used from GeometryGUI -//======================================================================= -bool GeometryGUI_PointDlg::UseLocalContext() -{ - return this->myUseLocalContext ; -} - - -//======================================================================= -// function : closeEvent() -// purpose : -//======================================================================= -void GeometryGUI_PointDlg::closeEvent(QCloseEvent* e) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void GeometryGUI_PointDlg::ClickOnCancel() -{ - if ( myConstructorId == 0 && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if ( myIC->HasOpenedContext() ) { - myIC->CloseLocalContext(myLocalContextId) ; - myUseLocalContext = false ; - } - } - mySelection->ClearFilters() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : to reactivate this dialog box when mouse enter onto the window -//================================================================================= -void GeometryGUI_PointDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : public slot to deactivate if active -//================================================================================= -void GeometryGUI_PointDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - mySelection->ClearFilters() ; - GroupConstructors->setEnabled(false) ; - GroupCoordinates->setEnabled(false) ; - GroupWithEdge->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - if ( myConstructorId == 0 && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myIC->CloseLocalContext(myLocalContextId) ; - myUseLocalContext = false ; - } - } - - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::ActivateThisDialog( ) -{ - - if ( !GroupConstructors->isEnabled() ) { /* if not active */ - - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupCoordinates->setEnabled(true) ; - GroupWithEdge->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - myGeomGUI->SetState(POINT_METHOD) ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if ( myConstructorId == 0 ) { - - mySelection->ClearFilters() ; - if( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode); - myUseLocalContext = true ; - } - } - - if ( myConstructorId == 1 ) - mySelection->AddFilter( myEdgeFilter ); - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - } - return ; -} - - -//================================================================================= -// function : CalculateVertexOnCurve() -// purpose : Calculate a Vertex on the curve given by 'anEdge'. -// : The position of resultVertex is given by aParameter. -// : For a linear edge, aParameter=0.0 gives the first vertex of edge -// : aParameter=1.0 gives the last vertex of edge -// : aParameter=0.5 gives the vertex on the middle of edge -// : It is possible to get vertices out of edge using values > 1.0 or < 0.0 -//================================================================================= -bool GeometryGUI_PointDlg::CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex) -{ - if( anEdge.IsNull() || !BRepAlgoAPI::IsValid(anEdge) ) - return false ; - - Standard_Real first, last ; - Handle(Geom_Curve) curv = BRep_Tool::Curve(anEdge, first, last); - if( !curv->IsCN(0) ) - return false ; - - Standard_Real param; - if( anEdge.Orientation() == TopAbs_FORWARD ) { - param = first + (last-first) * aParameter ; - } - else { - param = last + (first-last) * aParameter ; - } - gp_Pnt paramPoint ; - curv->D0( param, paramPoint ) ; - resultVertex = BRepBuilderAPI_MakeVertex(paramPoint); - return true ; -} - diff --git a/GEOMGUI/GeometryGUI_PointDlg.h b/GEOMGUI/GeometryGUI_PointDlg.h deleted file mode 100644 index 2de8161ee..000000000 --- a/GEOMGUI/GeometryGUI_PointDlg.h +++ /dev/null @@ -1,153 +0,0 @@ -// 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_PointDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_POINT_H -#define DIALOGBOX_POINT_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QSpinBox; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_PointDlg -// purpose : -//================================================================================= -class GeometryGUI_PointDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PointDlg( QWidget* parent = 0, const char* name = 0, - SALOME_Selection* Sel = 0, - const Handle(AIS_InteractiveContext)& ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_PointDlg(); - -private : - - SALOME_Selection* mySelection ; /* Current selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used to display a simulation */ - gp_Pnt myPoint ; /* Is 'mySimulationTopoDs' */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - - /* Interactive and local context management see also : bool UseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context from IAPP */ - Standard_Integer myLocalContextId ; /* identify a local context for this method */ - TopAbs_ShapeEnum myLocalContextMode ; /* identify a selection mode into local context */ - bool myUseLocalContext ; /* true when method as opened a local context */ - - int myConstructorId ; /* Current constructor id = radio button id */ - double myParameter ; /* Parameter used to create a vertex on edge (point on curve) */ - bool myOkEdge ; /* true when an edge is selected by user */ - - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* filter for selection */ - - void Init(SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic) ; /* Initialize dialog */ - void enterEvent(QEvent* e); - void closeEvent(QCloseEvent* e) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupCoordinates; - QLabel* TextLabel_X; - QLabel* TextLabel_Y; - QLabel* TextLabel_Z; - - GeometryGUI_SpinBox* SpinBox_X ; - GeometryGUI_SpinBox* SpinBox_Y ; - GeometryGUI_SpinBox* SpinBox_Z ; - - QGroupBox* GroupWithEdge; - QLabel* TextLabel_Edge; - QPushButton* SelectButton_Edge; - QLineEdit* LineEdit_Edge; - QLabel* TextLabel_Parameter; - GeometryGUI_SpinBox* SpinBox_Parameter; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - bool CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex) ; - -public: - void PointIntoCoordinates(gp_Pnt P, bool displayPoint) ; - bool UseLocalContext() ; /* return true if method has opened a local context */ - -protected: - QGridLayout* GeometryGUI_PointDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupCoordinatesLayout; - QGridLayout* GroupWithEdgeLayout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_POINT_H diff --git a/GEOMGUI/GeometryGUI_PrismDlg.cxx b/GEOMGUI/GeometryGUI_PrismDlg.cxx deleted file mode 100644 index 05f58e48f..000000000 --- a/GEOMGUI/GeometryGUI_PrismDlg.cxx +++ /dev/null @@ -1,608 +0,0 @@ -// 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_PrismDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PrismDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_PrismDlg() -// purpose : Constructs a GeometryGUI_PrismDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_PrismDlg::GeometryGUI_PrismDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PRISM"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_PrismDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_PRISM_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PrismDlgLayout = new QGridLayout( this ); - GeometryGUI_PrismDlgLayout->setSpacing( 6 ); - GeometryGUI_PrismDlgLayout->setMargin( 11 ); - - /**************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PRISM" ) ); - 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 ); - 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 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 2 ); - GeometryGUI_PrismDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /**************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_PRISM_BSV" ) ); - 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 ); - LineEditC1A2Line = new QLineEdit( GroupConstructor1, "LineEditC1A2Line" ); - LineEditC1A2Line->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Line->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addMultiCellWidget( LineEditC1A2Line, 1, 1, 2, 3 ); - LineEditC1A1Base = new QLineEdit( GroupConstructor1, "LineEditC1A1Base" ); - LineEditC1A1Base->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Base->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addMultiCellWidget( LineEditC1A1Base, 0, 0, 2, 3 ); - SelectButtonC1A1Base = new QPushButton( GroupConstructor1, "SelectButtonC1A1Base" ); - SelectButtonC1A1Base->setText( tr( "" ) ); - SelectButtonC1A1Base->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A1Base, 0, 1 ); - SelectButtonC1A2Line = new QPushButton( GroupConstructor1, "SelectButtonC1A2Line" ); - SelectButtonC1A2Line->setText( tr( "" ) ); - SelectButtonC1A2Line->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A2Line, 1, 1 ); - TextLabelBase = new QLabel( GroupConstructor1, "TextLabelBase" ); - TextLabelBase->setText( tr( "GEOM_BASE" ) ); - TextLabelBase->setMinimumSize( QSize( 50, 0 ) ); - TextLabelBase->setFrameShape( QLabel::NoFrame ); - TextLabelBase->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelBase, 0, 0 ); - TextLabelVector = new QLabel( GroupConstructor1, "TextLabelVector" ); - TextLabelVector->setText( tr( "GEOM_VECTOR" ) ); - TextLabelVector->setMinimumSize( QSize( 50, 0 ) ); - TextLabelVector->setFrameShape( QLabel::NoFrame ); - TextLabelVector->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelVector, 1, 0 ); - - SpinBox_C1A3Height = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A3Height" ) ; - SpinBox_C1A3Height->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_C1A3Height->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( SpinBox_C1A3Height, 2, 3 ); - - CheckBoxC3A1Reverse = new QCheckBox( GroupConstructor1, "CheckBoxC3A1Reverse" ); - CheckBoxC3A1Reverse->setText( tr( "GEOM_REVERSE" ) ); - GroupConstructor1Layout->addMultiCellWidget( CheckBoxC3A1Reverse, 2, 2, 0, 1 ); - TextLabelHeight = new QLabel( GroupConstructor1, "TextLabelHeight" ); - TextLabelHeight->setText( tr( "GEOM_HEIGHT" ) ); - TextLabelHeight->setMinimumSize( QSize( 50, 0 ) ); - TextLabelHeight->setFrameShape( QLabel::NoFrame ); - TextLabelHeight->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelHeight, 2, 2 ); - GeometryGUI_PrismDlgLayout->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_PrismDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_PrismDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PrismDlg::~GeometryGUI_PrismDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::Init( SALOME_Selection* Sel ) -{ - - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_C1A3Height->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A3Height->SetValue( 100.0 ) ; /* = myHeight */ - - myHeight = 100.000 ; - mySelection = Sel ; - mySimulationTopoDs.Nullify() ; - myBaseTopo.Nullify() ; - myConstructorId = 0 ; - myDx = myDy = myDz = 0.0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - GroupConstructor1->show(); - myConstructorId = 0 ; - myEditCurrentArgument = LineEditC1A1Base ; - Constructor1->setChecked( TRUE ); - myOkBase = myOkLine = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* Retrieves geom component */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - /* Filters definition */ - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - - - // TODO first selection into selection ? - - /* 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( SelectButtonC1A1Base, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2Line, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1Base, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2Line, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( CheckBoxC3A1Reverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseVector(int) ) ) ; - - connect( SpinBox_C1A3Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PrismDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: /* base shape + an edge used as a vector */ - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Base ; - LineEditC1A2Line->setText(tr("")) ; - - SpinBox_C1A3Height->SetValue(100) ; - myHeight = 100.0 ; - - Constructor1->setChecked( TRUE ); - myOkBase = myOkLine = false ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ClickOnApply() -{ - gp_Pnt P1, P2 ; - - if( !myOkBase || !myOkLine ) - return ; - - try { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - gp_Vec Vec(myDx, myDy, myDz ); - Vec.Normalize() ; - Vec *= myHeight ; - P1.SetCoord( 0.0, 0.0, 0.0 ) ; - P2.SetCoord( Vec.X(), Vec.Y(), Vec.Z() ) ; - switch(myConstructorId) - { - case 0 : - { - if( myOkBase && myOkLine ) { - myGeomGUI->MakePrismAndDisplay( myGeomShape, P1, P2 ) ; - } - break ; - } - } - } - catch(Standard_Failure) { - MESSAGE("Exception intercepted in GeometryGUI_PrismDlg" << endl ) ; - return ; - } - - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_PrismDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future the name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Base ) { - LineEditC1A1Base->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Line ) { - LineEditC1A2Line->setText("") ; - myOkLine = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - gp_Pnt aPoint1, aPoint2 ; - - if ( myEditCurrentArgument == LineEditC1A1Base ) { - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - Standard_Boolean testResult ; - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult) - return ; - if ( S.ShapeType() <= 2 ) - return; - - LineEditC1A1Base->setText(aString) ; - myBaseTopo = S ; - myOkBase = true ; - } - - else if ( myEditCurrentArgument == LineEditC1A2Line && myGeomGUI->LinearEdgeExtremities(S, aPoint1, aPoint2) ) { - myGeomGUI->GetBipointDxDyDz( aPoint1, aPoint2, myDx, myDy, myDz ) ; - myEditCurrentArgument->setText(aString) ; - myOkLine = true ; - } - - if( myOkBase && myOkLine ) { - MakePrismSimulationAndDisplay( myBaseTopo ) ; - } - return ; -} - - - -//================================================================================= -// function : MakePrismSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::MakePrismSimulationAndDisplay( const TopoDS_Shape& S ) -{ - try { - gp_Vec Vec(myDx, myDy, myDz ); - Vec.Normalize() ; - Vec *= myHeight ; - mySimulationTopoDs = BRepPrimAPI_MakePrism(S, Vec, Standard_False).Shape() ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakePrismSimulationAndDisplay" << endl ) ; - return ; - } - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( send == SelectButtonC1A1Base ) { - LineEditC1A1Base->setFocus() ; - myEditCurrentArgument = LineEditC1A1Base ; - } - else if(send == SelectButtonC1A2Line) { - LineEditC1A2Line->setFocus() ; - myEditCurrentArgument = LineEditC1A2Line; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender(); - - if( send == SpinBox_C1A3Height ) { - myHeight = newValue ; - if( myOkBase && myOkLine ) { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - MakePrismSimulationAndDisplay( myBaseTopo ) ; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Base ) - myEditCurrentArgument = LineEditC1A1Base ; - else if ( send == LineEditC1A2Line ) - myEditCurrentArgument = LineEditC1A2Line ; - 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_PrismDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_PrismDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::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() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : ReverseVector() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_PrismDlg::ReverseVector(int state) -{ - myDx = -myDx ; - myDy = -myDy ; - myDz = -myDz ; - if(myOkBase && myOkLine) { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - MakePrismSimulationAndDisplay( myBaseTopo ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_PrismDlg.h b/GEOMGUI/GeometryGUI_PrismDlg.h deleted file mode 100644 index 8425fc152..000000000 --- a/GEOMGUI/GeometryGUI_PrismDlg.h +++ /dev/null @@ -1,129 +0,0 @@ -// 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_PrismDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PRISM_H -#define DIALOGBOX_PRISM_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_PrismDlg -// purpose : -//================================================================================= -class GeometryGUI_PrismDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PrismDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PrismDlg(); - -private : - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void MakePrismSimulationAndDisplay( const TopoDS_Shape& S) ; - - 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 */ - Standard_Real myDx ; - Standard_Real myDy ; - Standard_Real myDz ; - Standard_Real myHeight ; /* Height used for prism (extrusion) */ - TopoDS_Shape myBaseTopo ; /* topology used as base of prism */ - GEOM::GEOM_Shape_var myGeomShape ; /* that is myBaseTopo */ - bool myOkBase ; - bool myOkLine ; /* to check when arguments myDx, myDy, myDz are defined */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - - QLineEdit* LineEditC1A1Base; - QLineEdit* LineEditC1A2Line; - QPushButton* SelectButtonC1A1Base; - QPushButton* SelectButtonC1A2Line; - QLabel* TextLabelBase; - QLabel* TextLabelVector; - GeometryGUI_SpinBox* SpinBox_C1A3Height; - QCheckBox* CheckBoxC3A1Reverse; - QLabel* TextLabelHeight; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseVector(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_PrismDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_PRISM_H diff --git a/GEOMGUI/GeometryGUI_PropertiesDlg.cxx b/GEOMGUI/GeometryGUI_PropertiesDlg.cxx deleted file mode 100644 index 87b172b2a..000000000 --- a/GEOMGUI/GeometryGUI_PropertiesDlg.cxx +++ /dev/null @@ -1,467 +0,0 @@ -// 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_PropertiesDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PropertiesDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -//================================================================================= -// class : GeometryGUI_PropertiesDlg() -// purpose : Constructs a GeometryGUI_PropertiesDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_PropertiesDlg::GeometryGUI_PropertiesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BASICPROPERTIES"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_PropertiesDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_PROPERTIES_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PropertiesDlgLayout = new QGridLayout( this ); - GeometryGUI_PropertiesDlgLayout->setSpacing( 6 ); - GeometryGUI_PropertiesDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PROPERTIES" ) ); - 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 ); - 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( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_PropertiesDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_PROPERTIES_CONSTR" ) ); - 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_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabel_Length = new QLabel( GroupConstructor1, "TextLabel_Length" ); - TextLabel_Length->setText( tr( "GEOM_LENGTH" ) ); - TextLabel_Length->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Length->setFrameShape( QLabel::NoFrame ); - TextLabel_Length->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Length, 1, 0 ); - LineEdit_Length = new QLineEdit( GroupConstructor1, "LineEdit_Length" ); - LineEdit_Length->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Length->sizePolicy().hasHeightForWidth() ) ); - // LineEdit_Length->setEnabled( FALSE ); - LineEdit_Length->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Length, 1, 2 ); - LineEdit_Surface = new QLineEdit( GroupConstructor1, "LineEdit_Surface" ); - LineEdit_Surface->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Surface->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_Surface->setEnabled( FALSE ); - LineEdit_Surface->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Surface, 2, 2 ); - TextLabel_Surface = new QLabel( GroupConstructor1, "TextLabel_Surface" ); - TextLabel_Surface->setText( tr( "GEOM_PROPERTIES_SURFACE" ) ); - TextLabel_Surface->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Surface->setFrameShape( QLabel::NoFrame ); - TextLabel_Surface->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Surface, 2, 0 ); - TextLabel_Volume = new QLabel( GroupConstructor1, "TextLabel_Volume" ); - TextLabel_Volume->setText( tr( "GEOM_PROPERTIES_VOLUME" ) ); - TextLabel_Volume->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Volume->setFrameShape( QLabel::NoFrame ); - TextLabel_Volume->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Volume, 3, 0 ); - LineEdit_Volume = new QLineEdit( GroupConstructor1, "LineEdit_Volume" ); - LineEdit_Volume->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Volume->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_Volume->setEnabled( FALSE ); - LineEdit_Volume->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Volume, 3, 2 ); - GeometryGUI_PropertiesDlgLayout->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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - GeometryGUI_PropertiesDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_PropertiesDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PropertiesDlg::~GeometryGUI_PropertiesDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - 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 */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PropertiesDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_PropertiesDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - LineEdit_Length->setText("") ; - LineEdit_Surface->setText("") ; - LineEdit_Volume->setText("") ; - myEditCurrentArgument->setText("") ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - - /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - this->CalculateAndDisplayProperties(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_PropertiesDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayProperties() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::CalculateAndDisplayProperties(const TopoDS_Shape& S) -{ - LineEdit_Length->setText("") ; - LineEdit_Surface->setText("") ; - LineEdit_Volume->setText("") ; - if( S.IsNull() ) - return ; - - Standard_Real result; - GProp_GProps LProps; - GProp_GProps SProps; - QString resString; - - try - { - BRepGProp::LinearProperties(S,LProps); - result = LProps.Mass(); - if (!IsEqual( result, 0.0)) - { - resString = tr("%1").arg( result, 12, 'f', 6 ) ; - LineEdit_Length->setText(resString) ; - } - - BRepGProp::SurfaceProperties(S, SProps); - result = SProps.Mass(); - if (!IsEqual( result, 0.0)) - { - resString = tr("%1").arg( result, 12, 'f', 6 ) ; - LineEdit_Surface->setText(resString) ; - } - - result = 0.0; - if (S.ShapeType() < TopAbs_SHELL) - { - for( TopExp_Explorer Exp(S,TopAbs_SOLID); Exp.More(); Exp.Next() ) - { - GProp_GProps VProps; - BRepGProp::VolumeProperties(Exp.Current(), VProps); - result += VProps.Mass(); - } - } - if (!IsEqual( result, 0.0 )) - { - resString = tr("%1").arg( result, 12, 'f', 6 ) ; - LineEdit_Volume->setText(resString) ; - } - } - catch(Standard_Failure) - { - MESSAGE("Catch intercepted in CalculateAndDisplayProperties()" << endl ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_PropertiesDlg.h b/GEOMGUI/GeometryGUI_PropertiesDlg.h deleted file mode 100644 index 2251e2882..000000000 --- a/GEOMGUI/GeometryGUI_PropertiesDlg.h +++ /dev/null @@ -1,116 +0,0 @@ -// 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_PropertiesDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_PROPERTIES_H -#define DIALOGBOX_PROPERTIES_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_PropertiesDlg -// purpose : -//================================================================================= -class GeometryGUI_PropertiesDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PropertiesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PropertiesDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateAndDisplayProperties(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QLabel* TextLabel_Length; - QLabel* TextLabel_Surface; - QLabel* TextLabel_Volume; - - QLineEdit* LineEdit_Length; - QLineEdit* LineEdit_Surface; - QLineEdit* LineEdit_Volume; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_PropertiesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_PROPERTIES_H diff --git a/GEOMGUI/GeometryGUI_RevolDlg.cxx b/GEOMGUI/GeometryGUI_RevolDlg.cxx deleted file mode 100644 index a5a799bb2..000000000 --- a/GEOMGUI/GeometryGUI_RevolDlg.cxx +++ /dev/null @@ -1,560 +0,0 @@ -// 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_RevolDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_RevolDlg.h" - -#include - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_RevolDlg() -// purpose : Constructs a GeometryGUI_RevolDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_RevolDlg::GeometryGUI_RevolDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_REVOL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_RevolDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_REVOLUTION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_RevolDlgLayout = new QGridLayout( this ); - GeometryGUI_RevolDlgLayout->setSpacing( 6 ); - GeometryGUI_RevolDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_REVOLUTION" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_RevolDlgLayout->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_RevolDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_AXIS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 2, 3 ); - - CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) ); - GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 1 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_ANGLE" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 2 ); - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 3 ); - - GeometryGUI_RevolDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_RevolDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_RevolDlg::~GeometryGUI_RevolDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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( -999.999, 999.999, step, 3 ) ; - SpinBox_C1A3->SetValue( 45.0 ) ; /* = myAngle */ - myAngle = 45.0 ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - myOkBase = false ; - myOkAxis = false ; - - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - - /* 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( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ; - - 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 */ - - return ; -} - -//================================================================================= -// function : ReverseAngle() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_RevolDlg::ReverseAngle(int state) -{ - myAngle = -myAngle ; - SpinBox_C1A3->SetValue( myAngle ) ; - - if(myOkBase && myOkAxis) { - MakeRevolutionSimulationAndDisplay(myBase) ; - } else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_RevolDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkAxis) { - myGeomGUI->MakeRevolutionAndDisplay( myGeomShape, myLoc, myDir, myAngle*PI180 ) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_RevolDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkAxis = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - - /* test if appropriate shape for revol */ - TopAbs_ShapeEnum aType = S.ShapeType() ; - if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType != TopAbs_COMPOUND ) - return ; - - LineEditC1A1->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, myLoc, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - LineEditC1A2->setText(aString) ; - myOkAxis = true ; - } - - if( myOkBase && myOkAxis ) { - MakeRevolutionSimulationAndDisplay( myBase) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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 : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ValueChangedInSpinBox( double newValue ) -{ - myAngle = newValue ; - if ( myOkBase && myOkAxis ) { - MakeRevolutionSimulationAndDisplay(myBase) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeRevolutionSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::MakeRevolutionSimulationAndDisplay( const TopoDS_Shape& S) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - if( S.IsNull() ) - return ; - - TopAbs_ShapeEnum aType = S.ShapeType() ; - if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType !=TopAbs_COMPOUND ) - return ; - - try { - gp_Ax1 AX( this->myLoc, this->myDir); - mySimulationTopoDs = BRepPrimAPI_MakeRevol(S, AX, this->myAngle*PI180 ); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeRevolutionSimulationAndDisplay" ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_RevolDlg.h b/GEOMGUI/GeometryGUI_RevolDlg.h deleted file mode 100644 index 5d4096c45..000000000 --- a/GEOMGUI/GeometryGUI_RevolDlg.h +++ /dev/null @@ -1,133 +0,0 @@ -// 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_RevolDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_REVOLUTION_H -#define DIALOGBOX_REVOLUTION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_RevolDlg -// purpose : -//================================================================================= -class GeometryGUI_RevolDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_RevolDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_RevolDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Pnt myLoc ; - gp_Dir myDir ; - - Standard_Real myAngle ; - - bool myOkBase ; - bool myOkAxis ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeRevolutionSimulationAndDisplay( const TopoDS_Shape& S) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - GeometryGUI_SpinBox* SpinBox_C1A3 ; /* for angle */ - QLabel* TextLabelC1A3; - QCheckBox* CheckBoxReverse; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseAngle(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_RevolDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_REVOLUTION_H diff --git a/GEOMGUI/GeometryGUI_RotationDlg.cxx b/GEOMGUI/GeometryGUI_RotationDlg.cxx deleted file mode 100644 index 85ec8d835..000000000 --- a/GEOMGUI/GeometryGUI_RotationDlg.cxx +++ /dev/null @@ -1,548 +0,0 @@ -// 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_RotationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_RotationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_RotationDlg() -// purpose : Constructs a GeometryGUI_RotationDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_RotationDlg::GeometryGUI_RotationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_ROTATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_RotationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_ROTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_RotationDlgLayout = new QGridLayout( this ); - GeometryGUI_RotationDlgLayout->setSpacing( 6 ); - GeometryGUI_RotationDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_RotationDlgLayout->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_RotationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 2, 3 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_AXIS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 3 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_ANGLE" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 2 ); - CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) ); - GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 1 ); - GeometryGUI_RotationDlgLayout->addWidget( GroupC1, 1, 0 ); - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_RotationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_RotationDlg::~GeometryGUI_RotationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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( -999.999, 999.999, step, 3 ) ; - SpinBox_C1A3->SetValue( 45.0 ) ; /* = myAngle */ - myAngle = 45.0 ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkBase = myOkAxis = false ; - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : set previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ; - - 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 */ - - return ; -} - -//================================================================================= -// function : ReverseAngle() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_RotationDlg::ReverseAngle(int state) -{ - myAngle = -myAngle ; - SpinBox_C1A3->SetValue( myAngle ) ; - if( myOkBase && myOkAxis ) { - MakeRotationSimulationAndDisplay( myBase ) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_RotationDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkAxis) { - myGeomGUI->MakeRotationAndDisplay( myGeomShape, myLoc, myDir, myAngle*PI180) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_RotationDlg::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("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkAxis = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - LineEditC1A1->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, myLoc, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - LineEditC1A2->setText(aString) ; - myOkAxis = true ; - } - - if( myOkBase && myOkAxis ) { - MakeRotationSimulationAndDisplay( myBase) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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 : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ValueChangedInSpinBox( double newValue ) -{ - myAngle = newValue ; - if (myOkBase && myOkAxis) { - MakeRotationSimulationAndDisplay(myBase) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeRotationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::MakeRotationSimulationAndDisplay( const TopoDS_Shape& S) -{ - myGeomGUI->EraseSimulationShape() ; - - if( S.IsNull() ) - return ; - - try { - gp_Ax1 AX( this->myLoc, this->myDir ) ; - gp_Trsf theTransformation ; - theTransformation.SetRotation(AX, this->myAngle*PI180 ) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - this->mySimulationTopoDs = myBRepTransformation.Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeRotationSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_RotationDlg.h b/GEOMGUI/GeometryGUI_RotationDlg.h deleted file mode 100644 index 36d6e3985..000000000 --- a/GEOMGUI/GeometryGUI_RotationDlg.h +++ /dev/null @@ -1,132 +0,0 @@ -// 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_RotationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ROTATION_H -#define DIALOGBOX_ROTATION_H - - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_RotationDlg -// purpose : -//================================================================================= -class GeometryGUI_RotationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_RotationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_RotationDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Pnt myLoc ; - gp_Dir myDir ; - Standard_Real myAngle ; - - bool myOkBase ; - bool myOkAxis ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeRotationSimulationAndDisplay( const TopoDS_Shape& S) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - GeometryGUI_SpinBox* SpinBox_C1A3 ; /* for angle */ - QLabel* TextLabelC1A3; - QCheckBox* CheckBoxReverse; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseAngle(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_RotationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ROTATION_H diff --git a/GEOMGUI/GeometryGUI_ScaleDlg.cxx b/GEOMGUI/GeometryGUI_ScaleDlg.cxx deleted file mode 100644 index 4119f08e9..000000000 --- a/GEOMGUI/GeometryGUI_ScaleDlg.cxx +++ /dev/null @@ -1,535 +0,0 @@ -// 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_ScaleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ScaleDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_ScaleDlg() -// purpose : Constructs a GeometryGUI_ScaleDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_ScaleDlg::GeometryGUI_ScaleDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SCALE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_ScaleDlg" ); - resize( 303, 253 ); - setCaption( tr( "GEOM_SCALE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ScaleDlgLayout = new QGridLayout( this ); - GeometryGUI_ScaleDlgLayout->setSpacing( 6 ); - GeometryGUI_ScaleDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SCALE" ) ); - 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 ); - GeometryGUI_ScaleDlgLayout->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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_CENTRAL_POINT" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); - GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_SCALE_FACTOR" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - GeometryGUI_ScaleDlgLayout->addWidget( GroupC1, 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_ScaleDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - -//================================================================================= -// function : ~GeometryGUI_ScaleDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ScaleDlg::~GeometryGUI_ScaleDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::Init( SALOME_Selection* Sel ) -{ - - LineEditC1A3->setMaxLength( 10 ); - QDoubleValidator *Va = new QDoubleValidator( -999999, +999999, 3, LineEditC1A3 ) ; - LineEditC1A3->setValidator( Va ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkBaseTopo = false ; - myFactor = 2.0 ; - LineEditC1A3->setText("2.0") ; - mySimulationTopoDs.Nullify() ; - myBaseTopo.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - 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( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ScaleDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupC1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - Constructor1->setChecked( TRUE ); - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; - myOkPoint1 = myOkBaseTopo = false ; - myFactor = 2.0 ; - /* filter for next selections */ - mySelection->ClearFilters() ; - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if( myOkBaseTopo && myOkPoint1 ) - myGeomGUI->MakeScaleAndDisplay(myGeomShape, myPoint1, myFactor ) ; - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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 : TextChangedInLineEdit() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::TextChangedInLineEdit(const QString& newText) -{ - QLineEdit* send = (QLineEdit*)sender(); - if(send == LineEditC1A3) { - myGeomGUI->EraseSimulationShape() ; - myFactor = newText.toFloat(); - if( fabs(myFactor) > 0.00001 && myOkBaseTopo && myOkPoint1 ) - MakeScaleSimulationAndDisplay(myBaseTopo) ; - } - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ScaleDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkBaseTopo = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkPoint1 = false ; - } - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor */ - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBaseTopo = S ; - myOkBaseTopo = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - - if( myOkBaseTopo && myOkPoint1 ) { - MakeScaleSimulationAndDisplay( myBaseTopo ) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - SelectionIntoArgument() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeScaleSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::MakeScaleSimulationAndDisplay( const TopoDS_Shape& S ) -{ - this->mySimulationTopoDs.Nullify() ; - - try { - gp_Trsf theTransformation ; - theTransformation.SetScale( myPoint1, myFactor) ; - BRepBuilderAPI_Transform myBRepTransformation( S, theTransformation, Standard_False) ; - mySimulationTopoDs = myBRepTransformation.Shape() ; - if( mySimulationTopoDs.IsNull() ) - return ; - else - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeScaleSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_ScaleDlg.h b/GEOMGUI/GeometryGUI_ScaleDlg.h deleted file mode 100644 index e261ed585..000000000 --- a/GEOMGUI/GeometryGUI_ScaleDlg.h +++ /dev/null @@ -1,121 +0,0 @@ -// 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_ScaleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SCALE_H -#define DIALOGBOX_SCALE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_ScaleDlg -// purpose : -//================================================================================= -class GeometryGUI_ScaleDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ScaleDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ScaleDlg(); - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e ); - void Init(SALOME_Selection* Sel) ; - void MakeScaleSimulationAndDisplay( const TopoDS_Shape& S ) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI 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 */ - TopoDS_Shape myBaseTopo ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBaseTopo */ - Standard_Real myFactor ; - bool myOkPoint1 ; /* true when myPoint1 is defined */ - bool myOkBaseTopo ; /* true when myBaseTopo is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QLineEdit* LineEditC1A3; - QLabel* TextLabelC1A3; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots : - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void TextChangedInLineEdit(const QString& newText) ; - -protected: - QGridLayout* GeometryGUI_ScaleDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SCALE_H diff --git a/GEOMGUI/GeometryGUI_SectionDlg.cxx b/GEOMGUI/GeometryGUI_SectionDlg.cxx deleted file mode 100644 index e67438c92..000000000 --- a/GEOMGUI/GeometryGUI_SectionDlg.cxx +++ /dev/null @@ -1,471 +0,0 @@ -// 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_SectionDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SectionDlg.h" - -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_SectionDlg() -// purpose : Constructs a GeometryGUI_SectionDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SECTION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",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 ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_SectionDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -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 ) -{ - 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", "Geometry"); - 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 */ - - return ; -} - - - -//================================================================================= -// 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 ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->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 ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - 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 ; - } - - /* 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 ; - } - - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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_SectionDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// 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() -{ - /* 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 ; -} diff --git a/GEOMGUI/GeometryGUI_SectionDlg.h b/GEOMGUI/GeometryGUI_SectionDlg.h deleted file mode 100644 index 5ac5b2a8f..000000000 --- a/GEOMGUI/GeometryGUI_SectionDlg.h +++ /dev/null @@ -1,116 +0,0 @@ -// 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_SectionDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header: - -#ifndef DIALOGBOX_SECTION_H -#define DIALOGBOX_SECTION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SectionDlg -// purpose : -//================================================================================= -class GeometryGUI_SectionDlg : public QDialog{ - Q_OBJECT - -public: - GeometryGUI_SectionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_SectionDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - 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 */ - - - 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - - -protected: - QGridLayout* GeometryGUI_SectionDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SECTION_H diff --git a/GEOMGUI/GeometryGUI_SewingDlg.cxx b/GEOMGUI/GeometryGUI_SewingDlg.cxx deleted file mode 100644 index a3cdbc8fe..000000000 --- a/GEOMGUI/GeometryGUI_SewingDlg.cxx +++ /dev/null @@ -1,393 +0,0 @@ -// 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_SewingDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SewingDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_SewingDlg() -// purpose : Constructs a GeometryGUI_SewingDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_SewingDlg::GeometryGUI_SewingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SEWING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_SewingDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_SEWING_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SewingDlgLayout = new QGridLayout( this ); - GeometryGUI_SewingDlgLayout->setSpacing( 6 ); - GeometryGUI_SewingDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SEWING" ) ); - 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 ); - 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 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_SewingDlgLayout->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_SewingDlgLayout->addWidget( GroupButtons, 2, 0 ); - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - 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 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A2->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_PRECISION" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - GeometryGUI_SewingDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_SewingDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SewingDlg::~GeometryGUI_SewingDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::Init( SALOME_Selection* Sel ) -{ - LineEditC1A1->setMaxLength( 10 ); - QDoubleValidator *Va = new QDoubleValidator( -0.000001, +10000.0, 3, LineEditC1A1 ) ; - LineEditC1A1->setValidator( Va ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - this->myPrecision = 0.00001 ; - LineEditC1A2->setText("0.00001") ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( LineEditC1A2, SIGNAL (returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - 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 */ - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SewingDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - myGeomGUI->MakeSewingAndDisplay( myListShapes, myPrecision ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_SewingDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myOkListShapes = false; - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel < 2 ) { - return ; - } - - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::LineEditReturnPressed() -{ - this->myPrecision = LineEditC1A2->text().toFloat(); - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - diff --git a/GEOMGUI/GeometryGUI_SewingDlg.h b/GEOMGUI/GeometryGUI_SewingDlg.h deleted file mode 100644 index 8e2545bd6..000000000 --- a/GEOMGUI/GeometryGUI_SewingDlg.h +++ /dev/null @@ -1,111 +0,0 @@ -// 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_SewingDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SEWING_H -#define DIALOGBOX_SEWING_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SewingDlg -// purpose : -//================================================================================= -class GeometryGUI_SewingDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SewingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_SewingDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - Standard_Real myPrecision ; - bool myOkListShapes ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_SewingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_SEWING_H diff --git a/GEOMGUI/GeometryGUI_ShellDlg.cxx b/GEOMGUI/GeometryGUI_ShellDlg.cxx deleted file mode 100644 index b7b288b5a..000000000 --- a/GEOMGUI/GeometryGUI_ShellDlg.cxx +++ /dev/null @@ -1,375 +0,0 @@ -// 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_ShellDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ShellDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_ShellDlg() -// purpose : Constructs a GeometryGUI_ShellDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_ShellDlg::GeometryGUI_ShellDlg( QWidget* parent, const char* name, SALOME_Selection* Sel = 0, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SHELL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - if ( !name ) - setName( "GeometryGUI_ShellDlg" ); - resize( 303, 190 ); - setCaption( tr( "GEOM_SHELL_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ShellDlgLayout = new QGridLayout( this ); - GeometryGUI_ShellDlgLayout->setSpacing( 6 ); - GeometryGUI_ShellDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SHELL" ) ); - 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_ShellDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_SHELL_LIST" ) ); - 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 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_FACES" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - GeometryGUI_ShellDlgLayout->addWidget( GroupC1, 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_ShellDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_ShellDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ShellDlg::~GeometryGUI_ShellDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( 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 */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ShellDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - // myGeomGUI->MakeShellAndDisplay( myListShapes ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ShellDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - myEditCurrentArgument->setText("") ; - myOkListShapes = false; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel < 1 ) { - return ; - } - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - diff --git a/GEOMGUI/GeometryGUI_ShellDlg.h b/GEOMGUI/GeometryGUI_ShellDlg.h deleted file mode 100644 index 0e3fc1940..000000000 --- a/GEOMGUI/GeometryGUI_ShellDlg.h +++ /dev/null @@ -1,107 +0,0 @@ -// 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_ShellDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SHELL_H -#define DIALOGBOX_SHELL_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_ShellDlg -// purpose : -//================================================================================= -class GeometryGUI_ShellDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ShellDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ShellDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - bool myOkListShapes ; /* to check when argument is defined */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_ShellDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SHELL_H diff --git a/GEOMGUI/GeometryGUI_SphereDlg.cxx b/GEOMGUI/GeometryGUI_SphereDlg.cxx deleted file mode 100644 index c0e53c9ce..000000000 --- a/GEOMGUI/GeometryGUI_SphereDlg.cxx +++ /dev/null @@ -1,560 +0,0 @@ -// 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_SphereDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SphereDlg.h" -#include "GeometryGUI_SpinBox.h" - -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_SphereDlg() -// purpose : Constructs a GeometryGUI_SphereDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SPHERE_P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",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 */ -} - - -//================================================================================= -// function : ~GeometryGUI_SphereDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SphereDlg::~GeometryGUI_SphereDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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_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 ) ; - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - 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( 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 */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SphereDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - 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 ; - /* filter for next selections */ - mySelection->ClearFilters() ; - 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 ; - mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - /* no filters here */ - mySelection->ClearFilters() ; - 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() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -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 ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor 1 treatment */ - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditC1A1->setText(aString) ; - myOkPoint1 = true ; - } - - if( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) { - mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_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 ; -} - - - -//================================================================================= -// 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; - } - - } - return ; -} - -//================================================================================= -// 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() ; - } - 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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - - diff --git a/GEOMGUI/GeometryGUI_SphereDlg.h b/GEOMGUI/GeometryGUI_SphereDlg.h deleted file mode 100644 index cd5027971..000000000 --- a/GEOMGUI/GeometryGUI_SphereDlg.h +++ /dev/null @@ -1,131 +0,0 @@ -// 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_SphereDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SPHERE_H -#define DIALOGBOX_SPHERE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include -#include - -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; - - -//================================================================================= -// class : GeometryGUI_SphereDlg -// purpose : -//================================================================================= -class GeometryGUI_SphereDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SphereDlg( QWidget* parent = 0, const char* name = 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 */ - - 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 */ - - 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 */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - - 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; - -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 ) ; - -protected: - QGridLayout* GeometryGUI_SphereDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupConstructor2Layout; -}; - -#endif // DIALOGBOX_SPHERE_H diff --git a/GEOMGUI/GeometryGUI_SpinBox.cxx b/GEOMGUI/GeometryGUI_SpinBox.cxx deleted file mode 100644 index eec132f44..000000000 --- a/GEOMGUI/GeometryGUI_SpinBox.cxx +++ /dev/null @@ -1,101 +0,0 @@ -// 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_SpinBox.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SpinBox.h" -#include "GeometryGUI.h" -#include -//#include -//#include "utilities.h" - -//================================================================================= -// class : GeometryGUI_SpinBox() -// purpose : constructor of specific widget accepting floats in double precision. -//================================================================================= -GeometryGUI_SpinBox::GeometryGUI_SpinBox( QWidget* parent, const char* name ) -: QAD_SpinBoxDbl( parent, name) -{ - /* when step value is changed in myGeomGUI */ - connect( GeometryGUI::GetGeometryGUI(), SIGNAL( SignalDefaultStepValueChanged( double )), this, SLOT( SetStep( double ) ) ); -} - - -//================================================================================= -// function : SetStep() [SLOT] -// purpose : -//================================================================================= -void GeometryGUI_SpinBox::SetStep( double newStep ) -{ - setLineStep( newStep ); -} - -//================================================================================= -// function : ~GeometryGUI_SpinBox() -// purpose : destructor -//================================================================================= -GeometryGUI_SpinBox::~GeometryGUI_SpinBox() -{ -} - -//================================================================================= -// function : SetValue() -// purpose : -//================================================================================= -void GeometryGUI_SpinBox::SetValue( double v ) -{ - setValue( v ); -} - -//================================================================================= -// function : GetValue() -// purpose : returns a double -//================================================================================= -double GeometryGUI_SpinBox::GetValue( ) -{ - return value(); -} - -//================================================================================= -// function : GetString() -// purpose : returns a QString -//================================================================================= -QString GeometryGUI_SpinBox::GetString( ) -{ - return cleanText(); -} - -//================================================================================= -// function : RangeStepAndValidator() -// purpose : -//================================================================================= -void GeometryGUI_SpinBox::RangeStepAndValidator( double min, double max, double step, unsigned short decimals ) -{ - setRange( min, max ); - setLineStep( step ); - ( ( QDoubleValidator* )validator() )->setRange( min, max, decimals ) ; -} diff --git a/GEOMGUI/GeometryGUI_SpinBox.h b/GEOMGUI/GeometryGUI_SpinBox.h deleted file mode 100644 index d5c60d14f..000000000 --- a/GEOMGUI/GeometryGUI_SpinBox.h +++ /dev/null @@ -1,60 +0,0 @@ -// 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_SpinBox.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef GEOMSPINBOX_H -#define GEOMSPINBOX_H - -#include "QAD_SpinBoxDbl.h" - -class GeometryGUI ; - -//================================================================================= -// class : GeometryGUI_SpinBox -// purpose : Derivated from QSpinBox class and modified to accept floats -//================================================================================= -class GeometryGUI_SpinBox : public QAD_SpinBoxDbl -{ - Q_OBJECT - -public : - GeometryGUI_SpinBox( QWidget* parent, const char* name = 0 ); - ~GeometryGUI_SpinBox(); - - void RangeStepAndValidator( double min = -1000000.0, - double max = +1000000.0, - double step = 100.0, - unsigned short decimals = 3 ); - void SetValue( double v ); - double GetValue(); - QString GetString(); - -public slots: - void SetStep( double newStep ); - -}; -#endif // GEOMSPINBOX_H diff --git a/GEOMGUI/GeometryGUI_SubShapeDlg.cxx b/GEOMGUI/GeometryGUI_SubShapeDlg.cxx deleted file mode 100644 index c68781ed6..000000000 --- a/GEOMGUI/GeometryGUI_SubShapeDlg.cxx +++ /dev/null @@ -1,745 +0,0 @@ -// 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_SubShapeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SubShapeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include - -//================================================================================= -// class : GeometryGUI_SubShapeDlg() -// purpose : Constructs a GeometryGUI_SubShapeDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_SubShapeDlg::GeometryGUI_SubShapeDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SUBSHAPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_SUBSHAPE" ); - resize( 303, 239 ); - setCaption( tr( "GEOM_SUBSHAPE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SubShapeDlgLayout = new QGridLayout( this ); - GeometryGUI_SubShapeDlgLayout->setSpacing( 6 ); - GeometryGUI_SubShapeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SUB_SHAPE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_SubShapeDlgLayout->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_SubShapeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelComboBox1 = new QLabel( GroupC1, "TextLabelComboBox1" ); - TextLabelComboBox1->setText( tr( "GEOM_SUBSHAPE_TYPE" ) ); - GroupC1Layout->addMultiCellWidget( TextLabelComboBox1, 1, 1, 0, 1 ); - ComboBox1 = new QComboBox( FALSE, GroupC1, "ComboBox1" ); - ComboBox1->setMaxCount( 100 ); - GroupC1Layout->addMultiCellWidget( ComboBox1, 1, 1, 2, 3 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addMultiCellWidget( CheckBox1, 2, 2, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - GeometryGUI_SubShapeDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - /* Initialisations */ - Init(Sel, ic) ; -} - - -//================================================================================= -// function : ~GeometryGUI_SubShapeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SubShapeDlg::~GeometryGUI_SubShapeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; - - myIC = ic ; - myUseLocalContext = false ; - myLocalContextId = -1; - myAbort = false ; - myOkShape = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* type for sub shape selection */ - ComboBox1->insertItem("Compound"); - ComboBox1->insertItem("Compsolid"); - ComboBox1->insertItem("Solid"); - ComboBox1->insertItem("Shell"); - ComboBox1->insertItem("Face"); - ComboBox1->insertItem("Wire"); - ComboBox1->insertItem("Edge"); - ComboBox1->insertItem("Vertex"); - ComboBox1->insertItem("Shape"); - - myWithShape = true; - myShapeType = ComboBox1->currentItem(); - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = CheckBox1->isChecked(); - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( CheckBox1, SIGNAL (stateChanged(int) ), this, SLOT( AllOrNotAll() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - - connect( ComboBox1, SIGNAL( activated(int) ), this, SLOT( ComboTextChanged() ) ); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SubShapeDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - - /* User has aborted or not operation of explode all with many sub shapes */ - if( this->myAbort == false ) - this->ClickOnCancel() ; - else - this->myAbort = false ; - - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - bool testResult = false ; - - this->myAbort = false ; /* Not aborted by default */ - - switch(myConstructorId) - { - case 0 : - { - /* Explode all sub shapes */ - if( myOkShape && !myOkSelectSubMode ) { - - /* More than 30 subshapes : ask confirmation */ - unsigned int nb = NumberOfSubShapes( myShape, myShapeType ) ; - if( nb > 30 ) { - const QString caption = tr("GEOM_CONFIRM") ; - const QString text = tr("GEOM_CONFIRM_INFO").arg(nb) ; - const QString button0 = tr("GEOM_BUT_EXPLODE") ; - const QString button1 = tr("GEOM_BUT_CANCEL") ; - - if( QMessageBox::warning( this, caption, text, button0, button1 ) == 0 ) - testResult = myGeomGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ; - else - this->myAbort = true ; /* aborted */ - } - else { - testResult = myGeomGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ; - } - } - /* explode only selected sub shapes */ - else if( myOkShape && myOkSelectSubMode ) { - testResult = myGeomGUI->OnSubShapeGetSelected( myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext ) ; - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - this->myAbort = true; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId) ; - myGeomGUI->OnDisplayAll(true) ; - this->myUseLocalContext = false ; - } - } - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 (LineEditC1A1) -//================================================================================= -void GeometryGUI_SubShapeDlg::SelectionIntoArgument() -{ - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - QString aString = ""; /* future name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - - if ( nbSel != 1 ) { - LineEditC1A1->setText("") ; - myOkShape = false; - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - if ( !S.IsNull() && S.ShapeType() != TopAbs_VERTEX ) - { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) - { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - else - { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - LineEditC1A1->setText(aString) ; - } - } - } - - int SelectedShapeType = ComboBox1->currentItem(); - int count = ComboBox1->count(); - if ( myWithShape ) count = count - 1; - - int i = 0; - while ( i <= myShape.ShapeType() ) { - ComboBox1->removeItem(0); - i++; - } - - if (myShape.ShapeType()==TopAbs_COMPOUND) - { - if (myWithShape == false) { - ComboBox1->insertItem("Shape"); - myWithShape = true; - } - } - else - { - if (myWithShape == true) { - ComboBox1->removeItem( ComboBox1->count() -1 ); - myWithShape = false; - } - } - - int count1 = ComboBox1->count(); - if ( myWithShape ) count1 = count1 - 1; - - if ( SelectedShapeType > myShape.ShapeType() ) { - if ( SelectedShapeType == 8 ) { - if ( myShape.ShapeType() != TopAbs_COMPOUND ) { - ComboBox1->setCurrentItem(0); - myShapeType = 8 - count1; - } - } else { - ComboBox1->setCurrentItem( count1 - count + SelectedShapeType ); - myShapeType = 8 - count1 + ComboBox1->currentItem(); - } - } else { - ComboBox1->setCurrentItem(0); - myShapeType = 8 - count1; - } - } -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_SubShapeDlg::DeactivateActiveDialog() -{ - /* Check if active */ - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : AllOrNotAll() -// purpose : Allow user selection of all or only selected sub shapes -// : Called when 'CheckBox1' state change -//================================================================================= -void GeometryGUI_SubShapeDlg::AllOrNotAll() -{ - - /* No sub shape selection if main shape not selected */ - if( !this->myOkShape ) { - ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; - return ; - } - - if (myShapeType ==TopAbs_SHAPE && myShape.ShapeType()==TopAbs_COMPOUND) - { - /* Select sub shapes mode not checked */ - myOkSelectSubMode = false ; - CheckBox1->setChecked( FALSE ); - //no meaning to allow user selection for type = shape - //TODO - add another message - //myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; - return ; - } - - myOkSelectSubMode = CheckBox1->isChecked() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - return; - } - - if( myOkShape && myOkSelectSubMode ) { - /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ; - } - return ; -} - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : Completely reset the state of method including local context -//================================================================================= -void GeometryGUI_SubShapeDlg::ResetStateOfDialog() -{ - /* To leave current selection if explode all as been aborted by user */ - if( this->myAbort == true ) { - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - } - else { - ; /* nothing to do : keep selection argument */ - } - - int SelectedShapeType = ComboBox1->currentItem(); - int count = ComboBox1->count(); - if ( myWithShape ) count = count - 1; - /* type for sub shape selection */ - ComboBox1->clear(); - ComboBox1->insertItem("Compound"); - ComboBox1->insertItem("Compsolid"); - ComboBox1->insertItem("Solid"); - ComboBox1->insertItem("Shell"); - ComboBox1->insertItem("Face"); - ComboBox1->insertItem("Wire"); - ComboBox1->insertItem("Edge"); - ComboBox1->insertItem("Vertex"); - ComboBox1->insertItem("Shape"); - this->myWithShape=true; - ComboBox1->setCurrentItem( 8 - count + SelectedShapeType ); - - - /* unpress buttons : due to abort box*/ - this->buttonApply->setDown(FALSE) ; - this->buttonOk->setDown(FALSE) ; - - /* Select sub shapes mode not checked */ - this->myOkSelectSubMode = false ; - this->CheckBox1->setChecked( FALSE ); - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - - - -//================================================================================= -// function : ComboTextChanged() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ComboTextChanged() -{ - if ( myOkShape ) - this->myShapeType = ComboBox1->currentItem() + myShape.ShapeType() + 1; - else - this->myShapeType = ComboBox1->currentItem(); - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = FALSE ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - - -//================================================================================= -// function : NumberOfSubShapes() -// purpose : -//================================================================================= -unsigned int GeometryGUI_SubShapeDlg::NumberOfSubShapes( const TopoDS_Shape& S, const int shapeType ) -{ - if( S.IsNull() ) - return 0 ; - - unsigned int index = 0 ; - TopExp_Explorer Exp( S, TopAbs_ShapeEnum(shapeType) ); - TopTools_MapOfShape M; - while ( Exp.More() ) { - if ( M.Add(Exp.Current()) ) - index++; - Exp.Next(); - } - M.Clear() ; - return index ; -} - - diff --git a/GEOMGUI/GeometryGUI_SubShapeDlg.h b/GEOMGUI/GeometryGUI_SubShapeDlg.h deleted file mode 100644 index 7435721de..000000000 --- a/GEOMGUI/GeometryGUI_SubShapeDlg.h +++ /dev/null @@ -1,139 +0,0 @@ -// 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_SubShapeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SUBSHAPE_H -#define DIALOGBOX_SUBSHAPE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QComboBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SubShapeDlg -// purpose : -//================================================================================= -class GeometryGUI_SubShapeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SubShapeDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_SubShapeDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void ResetStateOfDialog() ; - - unsigned int NumberOfSubShapes( const TopoDS_Shape& S, const int shapeType ) ; - - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - char* myShapeIOR ; - bool myOkShape ; - int myShapeType ; /* define a type of topology mode of sub selection */ - - bool myWithShape ; /* check if Shape item exists */ - - bool myOkSelectSubMode ; /* true = sub mode selection activated */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - bool myAbort ; /* Indicate if sub Shape All has been aborted by user */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelComboBox1; - QComboBox* ComboBox1; - - QCheckBox* CheckBox1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void AllOrNotAll() ; - void ComboTextChanged() ; - -protected: - QGridLayout* GeometryGUI_SubShapeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_SUBSHAPE_H diff --git a/GEOMGUI/GeometryGUI_SuppressFacesDlg.cxx b/GEOMGUI/GeometryGUI_SuppressFacesDlg.cxx deleted file mode 100644 index 2fcdbcd98..000000000 --- a/GEOMGUI/GeometryGUI_SuppressFacesDlg.cxx +++ /dev/null @@ -1,523 +0,0 @@ -// 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_SuppressFacesDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SuppressFacesDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_SuppressFacesDlg() -// purpose : Constructs a GeometryGUI_SuppressFacesDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_SuppressFacesDlg::GeometryGUI_SuppressFacesDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SUPRESS_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_SuppressFacesDlg" ); - resize( 322, 203 ); - setCaption( tr( "GEOM_SUPRESSFACE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SuppressFacesDlgLayout = new QGridLayout( this ); - GeometryGUI_SuppressFacesDlgLayout->setSpacing( 6 ); - GeometryGUI_SuppressFacesDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SUPRESSFACE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_SuppressFacesDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - Layout2 = new QHBoxLayout; - Layout2->setSpacing( 6 ); - Layout2->setMargin( 0 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - Layout2->addWidget( TextLabelC1A1 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout2->addWidget( SelectButtonC1A1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout2->addWidget( LineEditC1A1 ); - GroupC1Layout->addLayout( Layout2, 0, 0 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_SUPRESSFACE_SELECT" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox1, 1, 0 ); - GeometryGUI_SuppressFacesDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - 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 ); - // - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_2, 0, 2 ); - buttonClose = new QPushButton( GroupButtons, "buttonClose" ); - buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose, 0, 3 ); - GeometryGUI_SuppressFacesDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisations */ - Init(Sel, ic) ; - -} - - -//================================================================================= -// function : ~GeometryGUI_SuppressFacesDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SuppressFacesDlg::~GeometryGUI_SuppressFacesDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; - - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = false ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) ); - connect( GroupConstructors, SIGNAL( clicked(int) ), this, SLOT( ConstructorsClicked(int) )); - - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - connect( CheckBox1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserSelection() )); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() )); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnClose() )); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : Same than click on apply but close this dialog. -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ClickOnOk() -{ - this->ClickOnApply() ; - accept(); - - return ; -} - - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ClickOnApply() -{ - bool testResult = false ; - switch(myConstructorId) - { - case 0 : - { - if( myOkShape && myOkSelectSubMode ) { - testResult = myGeomGUI->OnSuppressFaces( myShape, myShapeIOR, myLocalContextId, myUseLocalContext ) ; - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset arguments to allow a new selection */ - this->ResetStateOfDialog() ; - break ; - } - } - return ; -} - - - -//================================================================================= -// function : ClickOnClose() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ClickOnClose() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 (LineEditC1A1) -//================================================================================= -void GeometryGUI_SuppressFacesDlg::SelectionIntoArgument() -{ - - /* Reset argument and local context when selection as changed */ - this->ResetStateOfDialog() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; - - /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - /* Test the exact type of topology to suppress faces into */ - if ( !S.IsNull() && ( S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_COMPOUND ) ) { - - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; - return; - } - - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - LineEditC1A1->setText(aString) ; - return; - } - } - } - - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : Mouse enter onto the dialog to activate it -//================================================================================= -void GeometryGUI_SuppressFacesDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnClose() ; - return ; -} - - -//================================================================================= -// function : ActivateUserSelection() -// purpose : Activate selection of faces when CheckBox1->isChecked()... -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ActivateUserSelection() -{ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; - return ; - } - - this->myOkSelectSubMode = CheckBox1->isChecked() ; - - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - - if( myOkShape && myOkSelectSubMode ) { - /* local context is defined into the method : 4 = FACES sub selection */ - myGeomGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ; - } - } else { - CheckBox1->setChecked( false ); - } - - return ; -} - - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : Completely reset the state of method including local context -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Select sub shapes mode not checked */ - this->myOkSelectSubMode = false ; - this->CheckBox1->setChecked( FALSE ); - - /* Close its local contact if opened */ - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_SuppressFacesDlg.h b/GEOMGUI/GeometryGUI_SuppressFacesDlg.h deleted file mode 100644 index 6e332c6e7..000000000 --- a/GEOMGUI/GeometryGUI_SuppressFacesDlg.h +++ /dev/null @@ -1,130 +0,0 @@ -// 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_SuppressFacesDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SUPPRESSFACES_H -#define DIALOGBOX_SUPPRESSFACES_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SuppressFacesDlg -// purpose : -//================================================================================= -class GeometryGUI_SuppressFacesDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SuppressFacesDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_SuppressFacesDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - char* myShapeIOR ; - bool myOkShape ; - - bool myOkSelectSubMode ; /* true = sub mode selection activated */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonApply; - QPushButton* buttonClose; - - QCheckBox* CheckBox1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnApply() ; - void ClickOnClose(); - - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ActivateUserSelection() ; - -protected: - QGridLayout* GeometryGUI_SuppressFacesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* Layout2; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SUPPRESSFACES_H diff --git a/GEOMGUI/GeometryGUI_SuppressHoleDlg.cxx b/GEOMGUI/GeometryGUI_SuppressHoleDlg.cxx deleted file mode 100644 index b821aeea7..000000000 --- a/GEOMGUI/GeometryGUI_SuppressHoleDlg.cxx +++ /dev/null @@ -1,969 +0,0 @@ -// 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_SuppressHoleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SuppressHoleDlg.h" -#include "GeometryGUI.h" - -#include "TopExp_Explorer.hxx" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_SuppressHoleDlg() -// purpose : Constructs a GeometryGUI_SuppressHoleDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_SuppressHoleDlg::GeometryGUI_SuppressHoleDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SUPRESS_HOLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SUPRESS_HOLE_FACE_SHELL"))); - - if ( !name ) - setName( "GeometryGUI_SuppressHoleDlg" ); - resize( 303, 204 ); - setCaption( tr( "GEOM_SUPPRESSHOLE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SuppressHoleLayout = new QGridLayout( this ); - GeometryGUI_SuppressHoleLayout->setSpacing( 6 ); - GeometryGUI_SuppressHoleLayout->setMargin( 11 ); - - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "" ) ); - 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 ); - - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setChecked( TRUE ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 3 ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupConstructors, 0, 0 ); - - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - buttonOk->setAccel( 276824143 ); - GroupButtonsLayout->addWidget( buttonOk ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_2 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - buttonApply->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply ); - buttonClose = new QPushButton( GroupButtons, "buttonClose" ); - buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupButtons, 2, 0 ); - - /* First constructor */ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - Layout2 = new QHBoxLayout; - Layout2->setSpacing( 6 ); - Layout2->setMargin( 0 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - Layout2->addWidget( TextLabelC1A1 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout2->addWidget( SelectButtonC1A1 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout2->addWidget( LineEditC1A1 ); - - GroupC1Layout->addLayout( Layout2, 0, 0 ); - - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_SUPPRESSHOLE_SELECTFACE" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox1, 1, 0 ); - - CheckBox2 = new QCheckBox( GroupC1, "CheckBox2" ); - CheckBox2->setText( tr( "GEOM_SUPPRESSHOLE_SELECTWIRE" ) ); - CheckBox2->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox2, 2, 0 ); - - CheckBox3 = new QCheckBox( GroupC1, "CheckBox3" ); - CheckBox3->setText( tr( "GEOM_SUPPRESSHOLE_SELECTFACE_END" ) ); - CheckBox3->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox3, 3, 0 ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupC1, 1, 0 ); - - /* Second constructor */ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - 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 ); - - Layout3 = new QHBoxLayout; - Layout3->setSpacing( 6 ); - Layout3->setMargin( 0 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_SUPPRESSHOLE_FACE_SHELL" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - Layout3->addWidget( TextLabelC2A1 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout3->addWidget( SelectButtonC2A1 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - LineEditC2A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout3->addWidget( LineEditC2A1 ); - - GroupC2Layout->addLayout( Layout3, 0, 0 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupC2Layout->addItem( spacer_3, 2, 0 ); - - CheckBoxC2_1 = new QCheckBox( GroupC2, "CheckBoxC2_1" ); - CheckBoxC2_1->setText( tr( "GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE" ) ); - CheckBoxC2_1->setChecked( FALSE ); - - GroupC2Layout->addWidget( CheckBoxC2_1, 1, 0 ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupC2, 1, 0 ); - - - /* Initialisations */ - Init(Sel, ic) ; -} - - -//================================================================================= -// function : ~GeometryGUI_SuppressHoleDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SuppressHoleDlg::~GeometryGUI_SuppressHoleDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - GroupC1->show(); - GroupC2->hide(); - - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; - - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - myOkSelectFace = false ; - - myListOfIdFace = new GEOM::GEOM_Shape::ListOfSubShapeID; - myListOfIdWire = new GEOM::GEOM_Shape::ListOfSubShapeID; - myListOfIdEndFace = new GEOM::GEOM_Shape::ListOfSubShapeID; - - myListOfIdFace->length(0) ; - myListOfIdWire->length(0) ; - myListOfIdEndFace->length(0) ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* Select sub modes not checked */ - CheckBox1->setChecked( FALSE ); /* sub mode GEOM::FACE */ - CheckBox2->setChecked( FALSE ); /* sub mode GEOM::WIRE */ - CheckBox3->setChecked( FALSE ); /* sub mode END GEOM::FACE */ - - CheckBoxC2_1->setChecked( FALSE ); /* sub mode GEOM::WIRE(S) */ - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) ); - connect( GroupConstructors, SIGNAL( clicked(int) ), this, SLOT( ConstructorsClicked(int) )); - - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - connect( SelectButtonC2A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - - connect( CheckBox1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserFaceSelection() )); - connect( CheckBox2, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserWireSelection() )); - connect( CheckBox3, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserEndFaceSelection() )); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - /* for the second constructor */ - connect( CheckBoxC2_1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserWiresOnFaceShellSelection() )); - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() )); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnClose() )); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ConstructorsClicked(int constructorId) -{ - switch (constructorId) - { - case 0: - { - GroupC1->show(); - GroupC2->hide(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - LineEditC1A1->setText(tr("")) ; - myOkShape = false ; - myOkSelectFace = false ; - this->ResetPartial() ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - GroupC1->hide(); - GroupC2->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC2A1 ; - LineEditC2A1->setText(tr("")) ; - myOkShape = false ; - this->ResetPartial() ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - this->ResetPartial() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : Same than click on apply but close this dialog. -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ClickOnOk() -{ - this->ClickOnApply() ; - accept(); - - return ; -} - - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - bool testResult = false ; - - if( !myOkShape ) - return ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( !myOkSelectFace ) - return ; - - if( CheckBox2->isChecked() ) { - - if( !CheckBox3->isChecked() ) { - - /* Call method to get sub shape selection of GEOM::WIRE */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - if( !aTest || myListOfIdWire->length() != 1 ) { - CheckBox2->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - myListOfIdEndFace->length(0) ; /* no end face */ - QApplication::setOverrideCursor( Qt::waitCursor ); - testResult = myGeomGUI->OnSuppressHole( myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace ) ; - QApplication::restoreOverrideCursor(); - } - } - else { /* CheckBox3->isChecked() */ - - /* Call method to get sub shape selection of END GEOM::FACE */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - if( !aTest || myListOfIdEndFace->length() != 1 ) { - CheckBox3->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - QApplication::setOverrideCursor( Qt::waitCursor ); - testResult = myGeomGUI->OnSuppressHole( myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace ) ; - QApplication::restoreOverrideCursor(); - } - } - } - break ; - } - - case 1: /* second constructor */ - { - if( CheckBoxC2_1->isChecked() ) { - - /* Call method to get sub shape selection of one or more GEOM::WIRE(s) on a face or a shell */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - - if( !aTest || myListOfIdWire->length() < 1 ) { - CheckBoxC2_1->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - QApplication::setOverrideCursor( Qt::waitCursor ); - testResult = myGeomGUI->OnSuppressHolesInFaceOrShell( myShapeIOR, myListOfIdWire ) ; - QApplication::restoreOverrideCursor(); - } - } - break ; - } - } - - - if( !testResult ) - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - else - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_DONE") ) ; - - /* Reset arguments to allow a new selection */ - this->ResetStateOfDialog() ; - return ; -} - - - -//================================================================================= -// function : ClickOnClose() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ClickOnClose() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 and SelectButtonC2A1 -//================================================================================= -void GeometryGUI_SuppressHoleDlg::SelectionIntoArgument() -{ - - /* Reset argument and local context when selection as changed */ - this->ResetStateOfDialog() ; - - QString aString = ""; /* Name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; - - /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) { - return ; - } - - /* Test the exact type of topology to suppress faces into. */ - /* For the second constructor a face or shell selection is needed */ - if ( myConstructorId == 0 || ( myConstructorId == 1 && ( S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL ) ) ) { - - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - - /* The Geom IOR string of selection */ - myShapeIOR = GIObject->getIOR(); - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; - return; - } - - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; - return; - } - } - } - - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - case 1: - { - if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1) - myEditCurrentArgument = LineEditC2A1; - 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_SuppressHoleDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : Mouse enter onto the dialog to activate it -//================================================================================= -void GeometryGUI_SuppressHoleDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnClose() ; - return ; -} - - -//================================================================================= -// function : ActivateUserFaceSelection() -// purpose : Called when CheckBox1 state has changed. (Face selection is ckecked) -// : Be careful user must first select a face then a wire ! -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserFaceSelection() -{ - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the viewer type VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - if( CheckBox1->isChecked() ) { - - /* local context is opened into the method : Prepare GEOM::FACE sub selection */ - myGeomGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE") ) ; - } - else { - this->ResetPartial() ; - } - - return ; -} - - -//================================================================================= -// function : ActivateUserWireSelection() -// purpose : Called when CheckBox2 state has changed. (Wire selection is ckecked) -// : Be careful user must first select a face then a wire ! -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserWireSelection() -{ - - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - if( CheckBox1->isChecked() ) { - - /* Get sub shape selection GEOM::FACE : local context is closed */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - if( !aTest || myListOfIdFace->length() != 1 ) { - CheckBox1->setChecked(FALSE) ; - myOkSelectFace = false ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - myOkSelectFace = true ; - } - } - else { - this->ResetPartial() ; - return ; - } - - - if( CheckBox2->isChecked() ) { - - /* Get the face selection */ - this->myFace = FaceFromList(myShape, myListOfIdFace) ; - /* Local context is opened into the method : Prepare GEOM::WIRE sub selection into a face */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myFace, int(TopAbs_WIRE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTWIRE") ) ; - } - else { - this->ResetPartial() ; - } - - return ; -} - - - -//================================================================================= -// function : ActivateUserlEndFaceSelection() -// purpose : Called when CheckBox3 state has changed. ( Optional End Face selection ) -// : Be careful user must first select a face then a wire then this optional end face ! -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() -{ - - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - - if( CheckBox2->isChecked() ) { - /* Call method to get sub shape selection for the GEOM::WIRE into myFace : local context is closed */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(this->myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - - if( !aTest || myListOfIdWire->length() != 1 ) { - CheckBox2->setChecked(FALSE) ; - CheckBox3->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - return ; - } - } - else { - this->ResetPartial() ; - return ; - } - - - if( CheckBox3->isChecked() ) { - /* Local context is opened into the method : prepare GEOM::FACE(end) into myShape sub selection */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_FACE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE_END") ) ; - } - else { - this->ResetPartial() ; - } - - return ; -} - - - -//================================================================================= -// function : ActivateUserWiresOnFaceShellSelection() -// purpose : Called when CheckBoxC2_1 state has changed. -// : Only for second constructor ! -// : Prepare selection for wire(s) on main object that is a face or a shell -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection() -{ - - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - if( CheckBoxC2_1->isChecked() ) { - /* Local context is opened to prepare GEOM::WIRE(S) selection into 'myShape' that is a (main) face */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_WIRE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE") ) ; - } - else { - this->ResetPartial() ; - } - return ; -} - - - -//================================================================================= -// function : FaceFromList() -// purpose : Return the face (selected by user) that is a sub shape of 'aShape' -// : and which unique index is in 'ListOfSub'. -// : This allows opening a local context with this face loaded. -// : See : myGeomGUI->PrepareSubShapeSelectionArgumentShape(...) -//================================================================================= -TopoDS_Shape GeometryGUI_SuppressHoleDlg::FaceFromList( const TopoDS_Shape& aShape, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub ) -{ - TopoDS_Shape tds ; - tds.Nullify() ; - if( ListOfSub.length() != 1 || aShape.IsNull() ) - return tds ; - - int i = ListOfSub[0] ; - TopExp_Explorer exp ; - int j = 1 ; - for( exp.Init(aShape, TopAbs_FACE); exp.More(); exp.Next() ) { - if(j == i) - return exp.Current() ; - j++ ; - } - return tds ; -} - - - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : Completely reset the state of method including local context -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Partial reset and more ...*/ - this->ResetPartial() ; - - return ; -} - - -//================================================================================= -// function : ResetPartial() -// purpose : Partially reset to keep only main selection -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ResetPartial() -{ - /* Select sub shape modes not checked */ - this->myOkSelectFace = false ; - this->CheckBox1->setChecked( FALSE ); - this->CheckBox2->setChecked( FALSE ); - this->CheckBox3->setChecked( FALSE ); - this->CheckBoxC2_1->setChecked( FALSE ); - - myListOfIdFace->length(0) ; - myListOfIdWire->length(0) ; - myListOfIdEndFace->length(0) ; - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - - return ; -} diff --git a/GEOMGUI/GeometryGUI_SuppressHoleDlg.h b/GEOMGUI/GeometryGUI_SuppressHoleDlg.h deleted file mode 100644 index 3e6e8554a..000000000 --- a/GEOMGUI/GeometryGUI_SuppressHoleDlg.h +++ /dev/null @@ -1,162 +0,0 @@ -// 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_SuppressHoleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef GEOMETRYGUI_SUPPRESSHOLE_H -#define GEOMETRYGUI_SUPPRESSHOLE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_SuppressHoleDlg -// purpose : -//================================================================================= -class GeometryGUI_SuppressHoleDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SuppressHoleDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_SuppressHoleDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget (to reactivate it) */ - - void ResetStateOfDialog() ; - void ResetPartial() ; - - /* Return the face selected by user from the main shape and index in a ListOfSub */ - TopoDS_Shape FaceFromList( const TopoDS_Shape& aShape, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub ) ; - - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; /* Main shape selected */ - TopoDS_Shape myFace ; /* Face selected */ - - char* myShapeIOR ; - bool myOkShape ; - - bool myOkSelectFace ; /* true = sub mode GEOM::FACE selection done */ - bool myOkSelectWire ; /* true = sub mode GEOM::WIRE selection done (first wire) */ - - GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdFace ; /* After selection contains index of face into myShape */ - GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdWire ; /* After selection contains index of wire into myFace */ - GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdEndFace ; /* After selection contains index of end face into myShape */ - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonApply; - QPushButton* buttonClose; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QCheckBox* CheckBox1; - QCheckBox* CheckBox2; - QCheckBox* CheckBox3; - - /* Second constructor */ - QRadioButton* Constructor2; - QGroupBox* GroupC2; - QLabel* TextLabelC2A1; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QCheckBox* CheckBoxC2_1; - - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnApply() ; - void ClickOnClose(); - - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ActivateUserFaceSelection() ; - void ActivateUserWireSelection() ; - void ActivateUserEndFaceSelection() ; - - /* For the second constructor */ - void ActivateUserWiresOnFaceShellSelection() ; - - -protected: - - QGridLayout* GeometryGUI_SuppressHoleLayout; - QGridLayout* GroupConstructorsLayout; - QHBoxLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* Layout2; - - QGridLayout* GroupC2Layout; - QHBoxLayout* Layout3; -}; - -#endif // GEOMETRYGUI_SUPPRESSHOLE_H diff --git a/GEOMGUI/GeometryGUI_Swig.cxx b/GEOMGUI/GeometryGUI_Swig.cxx deleted file mode 100644 index 4a03d3dcb..000000000 --- a/GEOMGUI/GeometryGUI_Swig.cxx +++ /dev/null @@ -1,338 +0,0 @@ -// 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_Swig.cxx -// Author : Nicolas REJNERI, Paul RASCLE -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_Swig.hxx" -#include "utilities.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Study.h" -#include "QAD_StudyFrame.h" -#include "QAD_RightFrame.h" -#include "SALOMEGUI_ImportOperation.h" - -#include "OCCViewer_Viewer3d.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "VTKViewer_RenderWindowInteractor.h" -#include "VTKViewer_ViewFrame.h" - -#include "GEOM_Actor.h" -#include "GEOM_Client.hxx" -#include "GEOM_AISShape.hxx" -#include "GEOM_AssemblyBuilder.h" -#include "GEOM_InteractiveObject.hxx" - -static GEOM_Client ShapeReader; - -GeometryGUI_Swig::GeometryGUI_Swig() -{ - // MESSAGE("Constructeur"); -} - -GeometryGUI_Swig::~GeometryGUI_Swig() -{ - // MESSAGE("Destructeur"); -} - -void GeometryGUI_Swig::createAndDisplayGO(const char* Entry) -{ - // MESSAGE("createAndDisplayGO"); - QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - Standard_CString Fatherior = ""; - SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); - aStudyBuilder->DefineComponentInstance( father, Geom ); - father->ComponentIOR( Fatherior ); - - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(ActiveStudy->getActiveStudyFrame()->entry()); - - SALOMEDS::SObject_var obj = aStudy->FindObjectID(Entry); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - // Create new actor - if ( !obj->FindAttribute(anAttr, "AttributeIOR")) - return; - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = Geom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape); - - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( ActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - - if ( ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { // VTK - //vtkQGLRenderWindowInteractor* myRenderInter = ActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor(); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - 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( aName->Value() ); - - myRenderInter->Display(GActor); - anActor = (vtkActor*)theActors->GetNextActor(); - } - myRenderInter->Update(); - } - else if ( ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) // OCC - { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - // QAD_Viewer3d* v3d = ActiveStudy->getActiveStudyFrame()->getViewerOCC(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - 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); - } - } - } - ActiveStudy->updateObjBrowser( true ); -} - -int GeometryGUI_Swig::getIndexTopology(const char* SubIOR, const char* IOR) -{ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - GEOM::GEOM_Shape_var aMainShape = Geom->GetIORFromString(IOR); - TopoDS_Shape shape = ShapeReader.GetShape(Geom, aMainShape); - - GEOM::GEOM_Shape_var aSubShape = Geom->GetIORFromString(SubIOR); - TopoDS_Shape subshape = ShapeReader.GetShape(Geom, aSubShape); - - TopExp_Explorer Exp ( shape, subshape.ShapeType() ); - int index = 1; - TopTools_MapOfShape M; - while ( Exp.More() ) { - if ( M.Add(Exp.Current()) ) { - if ( Exp.Current().IsSame(subshape) ) - return index; - index++; - } - Exp.Next(); - } - return -1; -} - -const char* GeometryGUI_Swig::getShapeTypeString(const char* IOR) -{ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - GEOM::GEOM_Shape_var aShape = Geom->GetIORFromString(IOR); - TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape); - - if( shape.IsNull() ) { - return "Null Shape" ; - } - - switch (shape.ShapeType() ) - { - case TopAbs_COMPOUND: - { return "Compound" ;} - case TopAbs_COMPSOLID: - { return "Compound Solid" ;} - case TopAbs_SOLID: - { return "Solid" ;} - case TopAbs_SHELL: - { return "Shell" ;} - case TopAbs_FACE: - { - BRepAdaptor_Surface surf(TopoDS::Face(shape)); - if ( surf.GetType() == GeomAbs_Plane ) { - return "Plane" ; - } else if ( surf.GetType() == GeomAbs_Cylinder ) { - return "Cylindrical Face" ; - } else if ( surf.GetType() == GeomAbs_Sphere ) { - return "Spherical Face" ; - } else if ( surf.GetType() == GeomAbs_Torus ) { - return "Toroidal Face" ; - } else if ( surf.GetType() == GeomAbs_Cone ) { - return "Conical Face" ; - } else { - return "GEOM::FACE" ; - } - } - case TopAbs_WIRE: - { return "Wire" ;} - case TopAbs_EDGE: - { - BRepAdaptor_Curve curv(TopoDS::Edge(shape)); - if ( curv.GetType() == GeomAbs_Line ) { - if ( (Abs(curv.FirstParameter()) >= 1E6 ) || - (Abs(curv.LastParameter()) >= 1E6 )) { - return "Line" ; - } else - return "Edge" ; - } else if ( curv.GetType() == GeomAbs_Circle ) { - if ( curv.IsClosed() ) - return "Circle" ; - else - return "Arc" ; - } else { - return "Edge" ; - } - } - case TopAbs_VERTEX: - { return "Vertex" ;} - case TopAbs_SHAPE: - { return "Shape" ;} - } -} - - -const char* GeometryGUI_Swig::getShapeTypeIcon(const char* IOR) -{ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - GEOM::GEOM_Shape_var aShape = Geom->GetIORFromString(IOR); - - if( aShape->_is_nil() ) { - return "None" ; - } - - switch (aShape->ShapeType() ) - { - case TopAbs_COMPOUND: - { return "ICON_OBJBROWSER_COMPOUND" ;} - case TopAbs_COMPSOLID: - { return "ICON_OBJBROWSER_COMPSOLID" ;} - case TopAbs_SOLID: - { return "ICON_OBJBROWSER_SOLID" ;} - case TopAbs_SHELL: - { return "ICON_OBJBROWSER_SHELL" ;} - case TopAbs_FACE: - { return "ICON_OBJBROWSER_FACE" ;} - case TopAbs_WIRE: - { return "ICON_OBJBROWSER_WIRE" ;} - case TopAbs_EDGE: - { return "ICON_OBJBROWSER_EDGE" ;} - case TopAbs_VERTEX: - { return "ICON_OBJBROWSER_VERTEX" ;} - } - return "None"; -} - -void GeometryGUI_Swig::setDisplayMode(const char* Entry, int mode) -{ - QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy(); - Handle(SALOME_InteractiveObject) IO = - myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry ); - - if ( myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { // VTK - VTKViewer_RenderWindowInteractor* myRenderInter = - ((VTKViewer_ViewFrame*)myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - myRenderInter->SwitchRepresentation(IO, mode); - myRenderInter->Update(); - } - else if ( myStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) // OCC - { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - v3d->SwitchRepresentation(IO, mode); - } -} - -void GeometryGUI_Swig::setColor(const char* Entry, int red, int green, int blue) -{ - QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy(); - QColor c = QColor (red, green, blue); - Handle(SALOME_InteractiveObject) IO = - myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry ); - - if ( myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { // VTK - VTKViewer_RenderWindowInteractor* myRenderInter = - ((VTKViewer_ViewFrame*)myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - myRenderInter->SetColor(IO,c); - myRenderInter->Update(); - } - else if ( myStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) // OCC - { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - v3d->SetColor(IO,c); - } -} - -void GeometryGUI_Swig::setTransparency(const char* Entry, float transp) -{ - QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy(); - Handle(SALOME_InteractiveObject) IO = - myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry ); - - if ( myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { // VTK - VTKViewer_RenderWindowInteractor* myRenderInter = - ((VTKViewer_ViewFrame*)myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - myRenderInter->SetTransparency(IO,transp); - myRenderInter->Update(); - } - else if ( myStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) // OCC - { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - v3d->SetTransparency(IO,transp); - } -} diff --git a/GEOMGUI/GeometryGUI_Swig.hxx b/GEOMGUI/GeometryGUI_Swig.hxx deleted file mode 100644 index f2e608d5a..000000000 --- a/GEOMGUI/GeometryGUI_Swig.hxx +++ /dev/null @@ -1,56 +0,0 @@ -// 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_Swig.hxx -// Author : Nicolas REJNERI, Paul RASCLE -// Module : GEOM -// $Header$ - -#ifndef _GeometryGUI_SWIG_HXX_ -#define _GeometryGUI_SWIG_HXX_ - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -class GEOM_Client; - -class GeometryGUI_Swig -{ -public: - GeometryGUI_Swig(); - ~GeometryGUI_Swig(); - - void createAndDisplayGO(const char* Entry); - void setDisplayMode(const char* Entry, int mode); - void setColor(const char* Entry, int red, int green, int blue); - void setTransparency(const char* Entry, float transp); - - int getIndexTopology(const char *SubEntry, const char *Entry); - const char* getShapeTypeString(const char *Entry); - const char* getShapeTypeIcon(const char *Ior); -}; - - -#endif diff --git a/GEOMGUI/GeometryGUI_Swig.i b/GEOMGUI/GeometryGUI_Swig.i deleted file mode 100644 index 2d6a9e4b0..000000000 --- a/GEOMGUI/GeometryGUI_Swig.i +++ /dev/null @@ -1,47 +0,0 @@ -// 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_Swig.i -// Author : Nicolas REJNERI, Paul RASCLE -// Module : GEOM -// $Header$ - -%{ -#include "GeometryGUI_Swig.hxx" -%} - -class GeometryGUI_Swig -{ - public: - GeometryGUI_Swig(); - ~GeometryGUI_Swig(); - - void createAndDisplayGO(const char* Entry); - int getIndexTopology(const char *SubEntry, const char *Entry); - const char* getShapeTypeString(const char *Entry); - - void setDisplayMode(const char* Entry, int mode); - void setColor(const char* Entry, int red, int green, int blue); - void setTransparency(const char* Entry, float transp); - const char* getShapeTypeIcon(const char *Ior); -}; diff --git a/GEOMGUI/GeometryGUI_TorusDlg.cxx b/GEOMGUI/GeometryGUI_TorusDlg.cxx deleted file mode 100644 index 02e192314..000000000 --- a/GEOMGUI/GeometryGUI_TorusDlg.cxx +++ /dev/null @@ -1,670 +0,0 @@ -// 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_TorusDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_TorusDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -//================================================================================= -// class : GeometryGUI_TorusDlg() -// purpose : Constructs a GeometryGUI_TorusDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -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 ) -{ - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_TORUS_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",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 ); - - /***************************************************************/ - - /* Initialisations */ - Init(Sel) ; -} - - -//================================================================================= -// function : ~GeometryGUI_TorusDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_TorusDlg::~GeometryGUI_TorusDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 ; - - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - 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) ; - - /* 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 */ - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId) -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - 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 ; - - disconnect( mySelection, 0, this, 0 ); - - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myDir.SetCoord( 0.0, 0.0, 1.0 ) ; - - if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { - gp_Dir aDir = myDir ; - - MakeTorusSimulationAndDisplay() ; - } - 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 ); - break ; - } - } - return ; -} - - -//================================================================================= -// 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 ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_TorusDlg::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 ; - } - - /* 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 ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { - MakeTorusSimulationAndDisplay() ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::SetEditCurrentArgument() -{ - 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 ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2) - myEditCurrentArgument = LineEditC1A2; - 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_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 ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeTorusSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::MakeTorusSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - try { - 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" ) ; - } - return ; -} - diff --git a/GEOMGUI/GeometryGUI_TorusDlg.h b/GEOMGUI/GeometryGUI_TorusDlg.h deleted file mode 100644 index bae34d8ee..000000000 --- a/GEOMGUI/GeometryGUI_TorusDlg.h +++ /dev/null @@ -1,148 +0,0 @@ -// 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_TorusDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_TORUS_H -#define DIALOGBOX_TORUS_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include -#include - -#include -#include -#include - -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 -{ - Q_OBJECT - -public: - GeometryGUI_TorusDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_TorusDlg(); - -private: - - 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 ; - -private slots: - - void ConstructorsClicked(int constructorId); - 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; -}; - -#endif // DIALOGBOX_TORUS_H diff --git a/GEOMGUI/GeometryGUI_TranslationDlg.cxx b/GEOMGUI/GeometryGUI_TranslationDlg.cxx deleted file mode 100644 index d3ebd94ba..000000000 --- a/GEOMGUI/GeometryGUI_TranslationDlg.cxx +++ /dev/null @@ -1,563 +0,0 @@ -// 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_TranslationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_TranslationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_TranslationDlg() -// purpose : Constructs a GeometryGUI_TranslationDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_TranslationDlg::GeometryGUI_TranslationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_TRANSLATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_TranslationDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_TRANSLATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_TranslationDlgLayout = new QGridLayout( this ); - GeometryGUI_TranslationDlgLayout->setSpacing( 6 ); - GeometryGUI_TranslationDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_TRANSLATION" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_TranslationDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_TRANSLATION" ) ) ; - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - Layout1 = new QHBoxLayout; - Layout1->setSpacing( 6 ); - Layout1->setMargin( 0 ); - - TextLabel_DX = new QLabel( GroupC1, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - Layout1->addWidget( TextLabel_DX ); - - SpinBox_DX = new GeometryGUI_SpinBox( GroupC1, "SpinBox_DX" ); - SpinBox_DX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DX->sizePolicy().hasHeightForWidth() ) ); - Layout1->addWidget( SpinBox_DX ); - - TextLabel_DY = new QLabel( GroupC1, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - Layout1->addWidget( TextLabel_DY ); - - SpinBox_DY = new GeometryGUI_SpinBox( GroupC1, "SpinBox_DY" ); - SpinBox_DY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DY->sizePolicy().hasHeightForWidth() ) ); - Layout1->addWidget( SpinBox_DY ); - - TextLabel_DZ = new QLabel( GroupC1, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - Layout1->addWidget( TextLabel_DZ ); - - SpinBox_DZ = new GeometryGUI_SpinBox( GroupC1, "SpinBox_DZ" ); - SpinBox_DZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DZ->sizePolicy().hasHeightForWidth() ) ); - Layout1->addWidget( SpinBox_DZ ); - - GroupC1Layout->addMultiCellLayout( Layout1, 1, 1, 0, 2 ); - - GeometryGUI_TranslationDlgLayout->addWidget( GroupC1, 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_TranslationDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - - -//================================================================================= -// function : ~GeometryGUI_TranslationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_TranslationDlg::~GeometryGUI_TranslationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::Init( SALOME_Selection* Sel ) -{ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 100.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 100.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 100.0 ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkBase = false ; - - this->myVec.SetCoord( 100.0, 100.0, 100.0 ) ; - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - // myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - - /* 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( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_TranslationDlg::ConstructorsClicked(int constructorId) -{ - // myGeomGUI->EraseSimulationShape() ; - switch (constructorId) - { - case 0: - { - break; - } - case 1: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase) { - myGeomGUI->MakeTranslationAndDisplay( myGeomShape, myVec ) ; - } - break ; - } - case 1 : - { - break ; - } - } - - // accept(); - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_TranslationDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkBase = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - LineEditC1A1->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - - if( myOkBase ) { - MakeTranslationSimulationAndDisplay() ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - SelectionIntoArgument() ; - } - break; - } - case 1: - { - break; - } - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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 : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ValueChangedInSpinBox( double newValue ) -{ - - QObject* send = (QObject*)sender() ; - Standard_Real Dx, Dy, Dz ; - - if( send == SpinBox_DX ) { - Dx = newValue ; - Dy = SpinBox_DY->GetValue() ; - Dz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DY ) { - Dx = SpinBox_DX->GetValue() ; - Dy = newValue ; - Dz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DZ ) { - Dx = SpinBox_DX->GetValue() ; - Dy = SpinBox_DY->GetValue() ; - Dz = newValue ; - } - - this->myVec.SetCoord(Dx, Dy, Dz) ; - if ( myOkBase ) { - MakeTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeTranslationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::MakeTranslationSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - gp_Trsf theTransformation ; - theTransformation.SetTranslation(this->myVec) ; - - BRepBuilderAPI_Transform myBRepTransformation(this->myBase, theTransformation, Standard_False) ; - mySimulationTopoDs = myBRepTransformation.Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_TranslationDlg.h b/GEOMGUI/GeometryGUI_TranslationDlg.h deleted file mode 100644 index 617bc4802..000000000 --- a/GEOMGUI/GeometryGUI_TranslationDlg.h +++ /dev/null @@ -1,127 +0,0 @@ -// 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_TranslationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_TRANSLATION_H -#define DIALOGBOX_TRANSLATION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_TranslationDlg -// purpose : -//================================================================================= -class GeometryGUI_TranslationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_TranslationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_TranslationDlg(); - -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 */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - bool myOkBase ; - gp_Vec myVec ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeTranslationSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabel_DX; - QLabel* TextLabel_DY; - QLabel* TextLabel_DZ; - - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_TranslationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; - - QHBoxLayout* Layout1 ; -}; - -#endif // DIALOGBOX_TRANSLATION_H diff --git a/GEOMGUI/GeometryGUI_TransparencyDlg.cxx b/GEOMGUI/GeometryGUI_TransparencyDlg.cxx deleted file mode 100644 index 8925aeb1a..000000000 --- a/GEOMGUI/GeometryGUI_TransparencyDlg.cxx +++ /dev/null @@ -1,249 +0,0 @@ -// 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_TransparencyDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM - -using namespace std; -#include "GeometryGUI_TransparencyDlg.h" -#include "GeometryGUI.h" - -#include "QAD_RightFrame.h" -#include "SALOME_ListIteratorOfListIO.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "VTKViewer_ViewFrame.h" -#include "VTKViewer_RenderWindowInteractor.h" - -//================================================================================= -// class : GeometryGUI_TransparencyDlg() -// purpose : Constructs a GeometryGUI_SUBSHAPE which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// -// : WARNING : this dialog is modal ! -// -//================================================================================= -GeometryGUI_TransparencyDlg::GeometryGUI_TransparencyDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - const Handle(AIS_InteractiveContext)& ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - if ( !name ) - setName( "GeometryGUI_TransparencyDlg" ); - resize( 152, 107 ); - setCaption( tr( "GEOM_TRANSPARENCY_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_TransparencyDlgLayout = new QGridLayout( this ); - GeometryGUI_TransparencyDlgLayout->setSpacing( 6 ); - GeometryGUI_TransparencyDlgLayout->setMargin( 11 ); - - /*************************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0 ); - GroupButtonsLayout->addWidget( buttonOk, 0, 1 ); - GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2 ); - - /*************************************************************************/ - QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" ); - TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) ); - TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) ); - GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); - GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - - TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" ); - TextLabelTransparent->setText( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ) ); - TextLabelTransparent->setAlignment( int( QLabel::AlignRight ) ); - GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); - - Slider1 = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "Slider1" ); - Slider1->setMinimumSize( 300, 0 ); - Slider1->setTickmarks( QSlider::Left ); - GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 ); - /*************************************************************************/ - - GeometryGUI_TransparencyDlgLayout->addWidget( GroupC1, 0, 0 ); - GeometryGUI_TransparencyDlgLayout->addWidget( GroupButtons, 1, 0 ); - - /* Initialisations */ - this->myGeomGUI = GeometryGUI::GetGeometryGUI() ; - this->myIc = ic ; - this->mySel = Sel ; - - /* First call valueChanged() method for initialisation */ - /* The default value of transparency will change with the selection */ - this->myFirstInit = true ; -// Slider1->setMaxValue( 10 ); -// Slider1->setValue( 5 ) ; - this->ValueHasChanged( Slider1->value() ) ; - - // signals and slots connections : after ValueHasChanged() - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( Slider1, SIGNAL( valueChanged(int) ), this, SLOT( ValueHasChanged(int) ) ); - - /* 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 this Dialog */ -} - - - - -//================================================================================= -// function : ~GeometryGUI_TransparencyDlg() -// purpose : -//================================================================================= -GeometryGUI_TransparencyDlg::~GeometryGUI_TransparencyDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//======================================================================= -// function : ClickOnOk() -// purpose : -//======================================================================= -void GeometryGUI_TransparencyDlg::ClickOnOk() -{ - accept() ; - return ; -} - - -//======================================================================= -// function : ClickOnClose() -// purpose : -//======================================================================= -void GeometryGUI_TransparencyDlg::ClickOnClose() -{ - accept() ; - return ; -} - - -//================================================================================= -// function : ValueHasChanged() -// purpose : Called when value of slider change -// : or the first time as initilisation -//================================================================================= -void GeometryGUI_TransparencyDlg::ValueHasChanged( int newValue ) -{ - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - // VTK - // vtkQGLRenderWindowInteractor* myRenderInter= myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor(); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - SALOME_ListIteratorOfListIO It( this->mySel->StoredIObjects() ); - - Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); - if( !FirstIOS.IsNull() ) { - - /* The first time as initialisation */ - if( this->myFirstInit ) { - this->myFirstInit = false ; - float transp = ( myRenderInter->GetTransparency(FirstIOS))*10.0 ; - this->Slider1->setValue( int(transp) ) ; - } - } - - QApplication::setOverrideCursor( Qt::waitCursor ); - for( ;It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) IOS = It.Value(); - myRenderInter->SetTransparency( IOS, newValue/10.0 ); - } - QApplication::restoreOverrideCursor(); - } - - else if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - // OCC - SALOME_ListIteratorOfListIO It( this->mySel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject() ; - if( !FirstIOS.IsNull() ) { - - /* The first time as initialisation */ - if( this->myFirstInit ) { - this->myFirstInit = false ; - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(FirstIOS, found); - if( !found ) { - return ; - } - float transp = ( int( Shape->Transparency() * 10.0 + 0.001) ); - this->Slider1->setValue(int(transp) ) ; - return ; - } - } - - QApplication::setOverrideCursor( Qt::waitCursor ); - for( ;It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found); - if( !found ) { - QApplication::restoreOverrideCursor(); - return ; - } - this->myIc->SetTransparency( Shape, newValue / 10.0, false ); - myIc->Redisplay( Shape, Standard_False, Standard_True ); - } - myIc->UpdateCurrentViewer(); - } - QApplication::restoreOverrideCursor(); - return ; -} diff --git a/GEOMGUI/GeometryGUI_TransparencyDlg.h b/GEOMGUI/GeometryGUI_TransparencyDlg.h deleted file mode 100644 index c9a2c2046..000000000 --- a/GEOMGUI/GeometryGUI_TransparencyDlg.h +++ /dev/null @@ -1,96 +0,0 @@ -// 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_TransparencyDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_TRANSPARENCYDLG_H -#define DIALOGBOX_TRANSPARENCYDLG_H - -#include -#include - -#include "SALOME_Selection.h" -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "GEOM_AISShape.hxx" - - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QFrame; -class QLabel; -class QPushButton; -class QSlider; -class GeometryGUI; - - - -//================================================================================= -// class : GeometryGUI_TransparencyDlg -// purpose : -// : WARNING : that is a MODAL dialog. -//================================================================================= -class GeometryGUI_TransparencyDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_TransparencyDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - const Handle(AIS_InteractiveContext)& ic = 0, - bool modal = TRUE, - WFlags fl = 0 ); - - ~GeometryGUI_TransparencyDlg(); - -private : - - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - bool myFirstInit ; /* Inform for the first init */ - SALOME_Selection* mySel; /* User selection */ - Handle(AIS_InteractiveContext) myIc ; /* Interactive context */ - - QPushButton* buttonOk; - QLabel* TextLabelOpaque; - QLabel* TextLabelTransparent; - QSlider* Slider1; - -public slots: - - void ClickOnOk(); - void ClickOnClose(); - void ValueHasChanged( int newValue ) ; - -protected: - QGridLayout* GeometryGUI_TransparencyDlgLayout; - QHBoxLayout* Layout1; - QHBoxLayout* Layout2; -}; - -#endif // DIALOGBOX_TRANSPARENCYDLG_H - diff --git a/GEOMGUI/GeometryGUI_VectorDlg.cxx b/GEOMGUI/GeometryGUI_VectorDlg.cxx deleted file mode 100644 index 81cb1f66c..000000000 --- a/GEOMGUI/GeometryGUI_VectorDlg.cxx +++ /dev/null @@ -1,708 +0,0 @@ -// 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_VectorDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_VectorDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -//================================================================================= -// class : GeometryGUI_VectorDlg() -// purpose : Constructs a GeometryGUI_VectorDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_VectorDlg::GeometryGUI_VectorDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_VECTOR_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_VECTOR_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_VectorDlg" ); - resize( 303, 221 ); - setCaption( tr( "GEOM_VECTOR_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_VectorDlgLayout = new QGridLayout( this ); - GeometryGUI_VectorDlgLayout->setSpacing( 6 ); - GeometryGUI_VectorDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupPoints = new QGroupBox( this, "GroupPoints" ); - GroupPoints->setGeometry( QRect( 10, 10, 280, 90 ) ); - GroupPoints->setTitle( tr( "GEOM_POINTS" ) ); - GroupPoints->setFrameShape( QGroupBox::Box ); - GroupPoints->setFrameShadow( QGroupBox::Sunken ); - GroupPoints->setColumnLayout(0, Qt::Vertical ); - GroupPoints->layout()->setSpacing( 0 ); - GroupPoints->layout()->setMargin( 0 ); - GroupPointsLayout = new QGridLayout( GroupPoints->layout() ); - GroupPointsLayout->setAlignment( Qt::AlignTop ); - GroupPointsLayout->setSpacing( 6 ); - GroupPointsLayout->setMargin( 11 ); - SelectButtonPt2 = new QPushButton( GroupPoints, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - GroupPointsLayout->addWidget( SelectButtonPt2, 1, 1 ); - LineEditPt1 = new QLineEdit( GroupPoints, "LineEditPt1" ); - GroupPointsLayout->addWidget( LineEditPt1, 0, 2 ); - LineEditPt2 = new QLineEdit( GroupPoints, "LineEditPt2" ); - GroupPointsLayout->addWidget( LineEditPt2, 1, 2 ); - SelectButtonPt1 = new QPushButton( GroupPoints, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - SelectButtonPt1->setToggleButton( FALSE ); - GroupPointsLayout->addWidget( SelectButtonPt1, 0, 1 ); - TextLabelPt1 = new QLabel( GroupPoints, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointsLayout->addWidget( TextLabelPt1, 0, 0 ); - TextLabelPt2 = new QLabel( GroupPoints, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT_I" ).arg("2") ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - GroupPointsLayout->addWidget( TextLabelPt2, 1, 0 ); - GeometryGUI_VectorDlgLayout->addWidget( GroupPoints, 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_VectorDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_VECTOR" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setChecked( TRUE ); - Constructor1->setPixmap( image0 ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - GeometryGUI_VectorDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupCoordinates = new QGroupBox( this, "GroupCoordinates" ); - GroupCoordinates->setGeometry( QRect( 10, 70, 280, 80 ) ); - GroupCoordinates->setTitle( tr( "GEOM_COORDINATES" ) ); - GroupCoordinates->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupCoordinates->sizePolicy().hasHeightForWidth() ) ); - GroupCoordinates->setColumnLayout(0, Qt::Vertical ); - GroupCoordinates->layout()->setSpacing( 0 ); - GroupCoordinates->layout()->setMargin( 0 ); - GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() ); - GroupCoordinatesLayout->setAlignment( Qt::AlignTop ); - GroupCoordinatesLayout->setSpacing( 6 ); - GroupCoordinatesLayout->setMargin( 11 ); - - TextLabel_DZ = new QLabel( GroupCoordinates, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_DZ, 0, 4 ); - TextLabel_DY = new QLabel( GroupCoordinates, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_DY, 0, 2 ); - TextLabel_DX = new QLabel( GroupCoordinates, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_DX, 0, 0 ); - - /* Spin boxes construction */ - SpinBox_DX = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_DX" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_DX, 0, 1 ); - SpinBox_DY = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_DY" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_DY, 0, 3 ); - SpinBox_DZ = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_DZ" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_DZ, 0, 5 ); - - QSpacerItem* spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); - GroupCoordinatesLayout->addItem( spacer2, 1, 3 ); - - /* QCheckBox to reverse vector */ - CheckBoxReverseVector = new QCheckBox( GroupCoordinates, "CheckBoxReverseVector" ); - CheckBoxReverseVector->setText( tr( "GEOM_REVERSE_VECTOR" ) ); - GroupCoordinatesLayout->addMultiCellWidget( CheckBoxReverseVector, 1, 1, 1, 5 ); - /* same position than GroupPoints */ - GeometryGUI_VectorDlgLayout->addWidget( GroupCoordinates, 1, 0 ); - - Init(Sel) ; /* Initialisations */ - -} - - -//================================================================================= -// function : ~GeometryGUI_VectorDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_VectorDlg::~GeometryGUI_VectorDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::Init( SALOME_Selection* Sel ) -{ - - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 0.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 0.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 200.0 ) ; - - GroupPoints->show(); - GroupCoordinates->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - CheckBoxReverseVector->setChecked( FALSE ); - - myEditCurrentArgument = LineEditPt1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection in argument ? - - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, 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( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditPt2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( CheckBoxReverseVector, SIGNAL (stateChanged(int) ), this, SLOT( ReverseVector(int) ) ) ; - - 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 */ - - return ; -} - -//================================================================================= -// function : ReverseVector() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_VectorDlg::ReverseVector(int state) -{ - if( myConstructorId == 1 ) { - - myDx = -myDx ; - myDy = -myDy ; - myDz = -myDz ; - - SpinBox_DX->SetValue( myDx ) ; - SpinBox_DY->SetValue( myDy ) ; - SpinBox_DZ->SetValue( myDz ) ; - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - /* In the appropriate constructor */ - if( myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Add arrow in simulation */ - bool noNeedToTest = AddArrowToSimulation(mySimulationTopoDs) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - } - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_VectorDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - - switch (constructorId) - { - case 0: - { - GroupPoints->show(); - GroupCoordinates->hide() ; - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditPt1 ; - Constructor1->setChecked( TRUE ); - LineEditPt1->setText(tr("")) ; - LineEditPt2->setText(tr("")) ; - myOkPoint1 = myOkPoint2 = false ; - - /* filter for next selections */ - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - GroupPoints->hide(); - GroupCoordinates->show(); - myConstructorId = constructorId ; - CheckBoxReverseVector->setChecked( FALSE ); - myOkPoint1 = myOkPoint2 = false ; - - myEditCurrentArgument = SpinBox_DX ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myDx = 0.0 ; - myDy = 0.0 ; - myDz = 200.0 ; - - myPoint2.SetCoord( myDx, myDy, myDz ) ; - SpinBox_DX->SetValue( myDx ) ; - SpinBox_DY->SetValue( myDy ) ; - SpinBox_DZ->SetValue( myDz ) ; - - /* filter for next selections */ - mySelection->AddFilter( myEdgeFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - if( myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Add arrow in simulation */ - bool noNeedToTest = AddArrowToSimulation(mySimulationTopoDs) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeVectorAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - case 1 : - { - /* Recup args and call method */ - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - myGeomGUI->MakeVectorAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_VectorDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of shape */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditPt1 ) { - LineEditPt1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditPt2 ) { - LineEditPt2->setText("") ; - myOkPoint2 = false ; - } - return ; - } - - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructors treatment */ - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - LineEditPt2->setText(aString) ; - myOkPoint2 = true ; - } - else if( myConstructorId == 1) { - gp_Pnt P1, P2 ; - /* linear edge selection verified */ - if( myGeomGUI->LinearEdgeExtremities(S, P1, P2) ) { - - myGeomGUI->GetBipointDxDyDz( P1, P2, myDx, myDy, myDz ) ; - SpinBox_DX->SetValue( myDx ) ; - SpinBox_DY->SetValue( myDy ) ; - SpinBox_DZ->SetValue( myDz ) ; - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - } - } - - Standard_Real d = myPoint1.Distance(myPoint2) ; - - if( ( myConstructorId == 0 && myOkPoint1 && myOkPoint2 && d > Precision::Confusion() ) || - ( myConstructorId == 1 && d > Precision::Confusion() ) ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Add arrow in simulation */ - bool noNeedToTest = AddArrowToSimulation( mySimulationTopoDs ) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - } - else if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ValueChangedInSpinBox( double newValue ) -{ - if(myConstructorId != 1) - return ; - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender() ; - if (send == SpinBox_DX) { - myDx = newValue ; - } else if( send == SpinBox_DY ) { - myDy = newValue ; - } else if( send == SpinBox_DZ ) { - myDz = newValue ; - } - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - - if ( myConstructorId == 1 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) { // mySimulationTopoDs - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Create simulation vector with an arrow */ - this->AddArrowToSimulation(mySimulationTopoDs ) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; - 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 : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupCoordinates->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupPoints->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupCoordinates->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupPoints->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : AddArrowToSimulation() -// purpose : An arrow (cone topology) is added to 'modifiedShape' -// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'. -// : If an arrow can't be added returns false and 'modifiedShape' isn't modified ! -//================================================================================= -bool GeometryGUI_VectorDlg::AddArrowToSimulation( TopoDS_Shape& modifiedShape ) -{ - TopoDS_Shape arrow ; - /* Try to add a cone simulation shape to show direction of a linear edge */ - if( myGeomGUI->CreateArrowForLinearEdge( modifiedShape, arrow ) ) { - TopoDS_Compound Comp ; - BRep_Builder B; - B.MakeCompound (Comp); - B.Add( Comp, modifiedShape ) ; - B.Add( Comp, arrow ) ; - modifiedShape = Comp ; - return true ; - } - return false ; -} diff --git a/GEOMGUI/GeometryGUI_VectorDlg.h b/GEOMGUI/GeometryGUI_VectorDlg.h deleted file mode 100644 index 03582f257..000000000 --- a/GEOMGUI/GeometryGUI_VectorDlg.h +++ /dev/null @@ -1,150 +0,0 @@ -// 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_VectorDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_VECTOR_H -#define DIALOGBOX_VECTOR_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QCheckBox; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_VectorDlg -// purpose : -//================================================================================= -class GeometryGUI_VectorDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_VectorDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_VectorDlg(); - - bool AddArrowToSimulation( TopoDS_Shape& modifiedShape ) ; - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; /* mouse enter the QWidget */ - - 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 */ - gp_Pnt myPoint2 ; - double myDx ; - double myDy ; - double myDz ; - bool myOkPoint1 ; /* Are true when myPoint is defined */ - bool myOkPoint2 ; - QWidget* myEditCurrentArgument; /* Current LineEdit or Spin box */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ - - QGroupBox* GroupPoints; - QPushButton* SelectButtonPt1; - QPushButton* SelectButtonPt2; - QLabel* TextLabelPt1; - QLabel* TextLabelPt2; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor2; - QRadioButton* Constructor1; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - - QLineEdit* LineEditPt1; - QLineEdit* LineEditPt2; - - QGroupBox* GroupCoordinates; - - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - QLabel* TextLabel_DZ; - QLabel* TextLabel_DX; - QLabel* TextLabel_DY; - - QCheckBox* CheckBoxReverseVector; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseVector(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_VectorDlgLayout; - QGridLayout* GroupPointsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupCoordinatesLayout; - -}; - -#endif // DIALOGBOX_VECTOR_H diff --git a/GEOMGUI/GeometryGUI_WhatisDlg.cxx b/GEOMGUI/GeometryGUI_WhatisDlg.cxx deleted file mode 100644 index b0cdeb7f4..000000000 --- a/GEOMGUI/GeometryGUI_WhatisDlg.cxx +++ /dev/null @@ -1,449 +0,0 @@ -// 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_WhatisDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_WhatisDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -// Open CASCADE Includes -//#include -#include -#include -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_WhatisDlg() -// purpose : Constructs a GeometryGUI_WhatisDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_WhatisDlg::GeometryGUI_WhatisDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_WHATIS"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_WhatisDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_WHATIS_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_WhatisDlgLayout = new QGridLayout( this ); - GeometryGUI_WhatisDlgLayout->setSpacing( 6 ); - GeometryGUI_WhatisDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_WHATIS" ) ); - 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 ); - 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( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_WhatisDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_WHATIS_OBJECT" ) ); - 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_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - Text = new QTextView(GroupConstructor1); - Text->setTextFormat( Qt::PlainText ); - GroupConstructor1Layout->addMultiCellWidget( Text, 1, 1, 0, 2 ); - - GeometryGUI_WhatisDlgLayout->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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - GeometryGUI_WhatisDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_WhatisDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_WhatisDlg::~GeometryGUI_WhatisDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - SelectedName = ""; - - /* 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_WhatisDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_WhatisDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - Text->setText("") ; - myEditCurrentArgument->setText("") ; - - SelectedName = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - LineEditC1A1->setText(SelectedName) ; - this->CalculateWhatis(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_WhatisDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateWhatis() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::CalculateWhatis(const TopoDS_Shape& S) -{ - - if( S.IsNull() ) - return ; - - TCollection_AsciiString Astr; - Astr = Astr + " Number of shapes in " + strdup(SelectedName.latin1()) + ": \n"; - - try { - // BRepTools_ShapeSet BS; - // BS.Add(S); - // BS.DumpExtent(Astr); - - int iType, nbTypes [TopAbs_SHAPE]; - for (iType = 0; iType < TopAbs_SHAPE; ++iType) - nbTypes[ iType ] = 0; - nbTypes[ S.ShapeType() ]++; - - TopTools_MapOfShape aMapOfShape; - aMapOfShape.Add( S ); - TopTools_ListOfShape aListOfShape; - aListOfShape.Append( S ); - - TopTools_ListIteratorOfListOfShape itL(aListOfShape); - for (; itL.More(); itL.Next()) - { - TopoDS_Iterator it(itL.Value()); - for (; it.More(); it.Next()) - { - TopoDS_Shape s = it.Value(); - if (aMapOfShape.Add( s )) - { - aListOfShape.Append( s ); - nbTypes[ s.ShapeType() ] ++; - } - } - } - - Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbTypes[ TopAbs_VERTEX ]) + "\n"; - Astr = Astr + " EDGE : " + TCollection_AsciiString(nbTypes[ TopAbs_EDGE ]) + "\n"; - Astr = Astr + " WIRE : " + TCollection_AsciiString(nbTypes[ TopAbs_WIRE ]) + "\n"; - Astr = Astr + " FACE : " + TCollection_AsciiString(nbTypes[ TopAbs_FACE ]) + "\n"; - Astr = Astr + " SHELL : " + TCollection_AsciiString(nbTypes[ TopAbs_SHELL ]) + "\n"; - Astr = Astr + " SOLID : " + TCollection_AsciiString(nbTypes[ TopAbs_SOLID ]) + "\n"; - Astr = Astr + " COMPSOLID : " + TCollection_AsciiString(nbTypes[ TopAbs_COMPSOLID ]) + "\n"; - Astr = Astr + " COMPOUND : " + TCollection_AsciiString(nbTypes[ TopAbs_COMPOUND ]) + "\n"; - Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent()) + "\n"; - - Text->setText( Astr.ToCString() ); - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateWhatis()" << endl ) ; - } - return ; -} diff --git a/GEOMGUI/GeometryGUI_WhatisDlg.h b/GEOMGUI/GeometryGUI_WhatisDlg.h deleted file mode 100644 index 02a4e9f4a..000000000 --- a/GEOMGUI/GeometryGUI_WhatisDlg.h +++ /dev/null @@ -1,111 +0,0 @@ -// 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_WhatisDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_WHATIS_H -#define DIALOGBOX_WHATIS_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QTextView; -class GeometryGUI; - -//================================================================================= -// class : DialogBox_PROPERTIES -// purpose : -//================================================================================= -class GeometryGUI_WhatisDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_WhatisDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_WhatisDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateWhatis(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QTextView* Text; - QString SelectedName; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_WhatisDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_WHATIS_H diff --git a/GEOMGUI/GeometryGUI_WireDlg.cxx b/GEOMGUI/GeometryGUI_WireDlg.cxx deleted file mode 100644 index c1ec5dc90..000000000 --- a/GEOMGUI/GeometryGUI_WireDlg.cxx +++ /dev/null @@ -1,375 +0,0 @@ -// 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_WireDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_WireDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_WireDlg() -// purpose : Constructs a GeometryGUI_WireDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_WireDlg::GeometryGUI_WireDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_BUILD_WIRE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_WireDlg" ); - resize( 303, 185 ); - setCaption( tr( "GEOM_WIRE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_WireDlgLayout = new QGridLayout( this ); - GeometryGUI_WireDlgLayout->setSpacing( 6 ); - GeometryGUI_WireDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_WIRE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_WireDlgLayout->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_WireDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_WIRE_CONNECT" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - GeometryGUI_WireDlgLayout->addWidget( GroupC1, 1, 0 ); - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_WireDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_WireDlg::~GeometryGUI_WireDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_WireDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - myGeomGUI->MakeWireAndDisplay( myListShapes ) ; - } - break ; - } - } - // accept(); - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_WireDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myEditCurrentArgument->setText("") ; - myOkListShapes = false; - QString aString = ""; /* Future name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if(nbSel < 1) - return ; - - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - diff --git a/GEOMGUI/GeometryGUI_WireDlg.h b/GEOMGUI/GeometryGUI_WireDlg.h deleted file mode 100644 index 5346ccaca..000000000 --- a/GEOMGUI/GeometryGUI_WireDlg.h +++ /dev/null @@ -1,106 +0,0 @@ -// 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_WireDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_WIRE_H -#define DIALOGBOX_WIRE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_WireDlg -// purpose : -//================================================================================= -class GeometryGUI_WireDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_WireDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_WireDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - bool myOkListShapes ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_WireDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_WIRE_H diff --git a/GEOMGUI/GeometryGUI_WorkingPlaneDlg.cxx b/GEOMGUI/GeometryGUI_WorkingPlaneDlg.cxx deleted file mode 100644 index ac173cd84..000000000 --- a/GEOMGUI/GeometryGUI_WorkingPlaneDlg.cxx +++ /dev/null @@ -1,423 +0,0 @@ -// 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_WorkingPlaneDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM - -using namespace std; -#include "GeometryGUI_WorkingPlaneDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_WorkingPlaneDlg() -// purpose : Constructs a GeometryGUI_WorkingPlaneDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -GeometryGUI_WorkingPlaneDlg::GeometryGUI_WorkingPlaneDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_WPLANE_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_WorkingPlaneDlg" ); - resize( 303, 185 ); - setCaption( tr( "GEOM_WPLANE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_WorkingPlaneDlgLayout = new QGridLayout( this ); - GeometryGUI_WorkingPlaneDlgLayout->setSpacing( 6 ); - GeometryGUI_WorkingPlaneDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_WPLANE" ) ); - 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 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_WorkingPlaneDlgLayout->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_WorkingPlaneDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_WPLANE_FACE" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - 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 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_SELECTION" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - GeometryGUI_WorkingPlaneDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_WorkingPlaneDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_WorkingPlaneDlg::~GeometryGUI_WorkingPlaneDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkPlane = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - /* Filter definition */ - myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); - mySelection->AddFilter( myFaceFilter ); /* filter for next selection */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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 */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ClickOnApply() -{ - mySelection->ClearFilters() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPlane) { - myGeomGUI->MakeWorkingPlane( this->myLoc, this->myDir ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myEditCurrentArgument->setText("") ; - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkPlane = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - BRepAdaptor_Surface surf(TopoDS::Face(S)); - gp_Pln Plane = surf.Plane(); - myLoc = Plane.Location(); - myDir = Plane.Axis().Direction(); - - LineEditC1A1->setText(aString) ; - myOkPlane = true ; - } - - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - mySelection->AddFilter(myFaceFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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_WorkingPlaneDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/GEOMGUI/GeometryGUI_WorkingPlaneDlg.h b/GEOMGUI/GeometryGUI_WorkingPlaneDlg.h deleted file mode 100644 index 2f54705a8..000000000 --- a/GEOMGUI/GeometryGUI_WorkingPlaneDlg.h +++ /dev/null @@ -1,113 +0,0 @@ -// 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_WorkingPlaneDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_WORKINGPLANE_H -#define DIALOGBOX_WORKINGPLANE_H - -#include "SALOME_Selection.h" -#include "GEOM_FaceFilter.hxx" - -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_WorkingPlaneDlg -// purpose : -//================================================================================= -class GeometryGUI_WorkingPlaneDlg : public QDialog -{ - Q_OBJECT -public: - GeometryGUI_WorkingPlaneDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_WorkingPlaneDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - Handle(GEOM_FaceFilter) myFaceFilter; /* filter for selection */ - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - gp_Pnt myLoc; - gp_Dir myDir; - bool myOkPlane ; /* to check when arguments are defined */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_WorkingPlaneDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_WORKINGPLANE_H diff --git a/GEOMGUI/GeometryGUI_aParameterDlg.cxx b/GEOMGUI/GeometryGUI_aParameterDlg.cxx deleted file mode 100644 index ef9f50514..000000000 --- a/GEOMGUI/GeometryGUI_aParameterDlg.cxx +++ /dev/null @@ -1,166 +0,0 @@ -// 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_aParameterDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_aParameterDlg.h" -#include "GeometryGUI.h" -#include "QAD_SpinBoxDbl.h" -#include "QAD_Tools.h" - -#include - -#include -#include -#include -#include -#include -#include - -//====================================================================================== -// function : GeometryGUI_aParameterDlg() -// purpose : Constructs a GeometryGUI_aParametertDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f' -// -// avalue1 : is a float or integer used as default value in edit line -// aTitle1 : is the prompt for aValue1 -// aTitle : is the title for the user in dialog box -// -// bottom : the minimal value to be entered -// top : the maximum value to be entered -// decimals : number of decimals to be entered -// -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -// -//====================================================================================== -GeometryGUI_aParameterDlg::GeometryGUI_aParameterDlg( const char *aValue1, - const char *aTitle1, - QWidget* parent, - const char* name, - bool modal, - WFlags fl, - const double bottom, - const double top, - const int decimals ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - if ( !name ) - setName( "MyParameterDialog" ); - resize( 288, 81 ); - setCaption( name ); /* appears on the title bar */ - setSizeGripEnabled( TRUE ); - - QGridLayout* topLayout = new QGridLayout( this ); - topLayout->setSpacing( 6 ); - topLayout->setMargin( 11 ); - - QGroupBox* mainGrp = new QGroupBox( this, "mainGrp" ); - mainGrp->setColumnLayout(0, Qt::Vertical ); - mainGrp->layout()->setSpacing( 0 ); - mainGrp->layout()->setMargin( 0 ); - QGridLayout* mainGrpLayout = new QGridLayout( mainGrp->layout() ); - mainGrpLayout->setAlignment( Qt::AlignTop ); - mainGrpLayout ->setSpacing( 6 ); - mainGrpLayout->setMargin( 11 ); - topLayout->addWidget( mainGrp, 0, 0 ); - - /* aTitle1 : text prompt on left of edit line */ - QLabel* TextLabel1 = new QLabel( mainGrp, "TextLabel1" ); - TextLabel1->setText( tr( aTitle1 ) ); - mainGrpLayout->addWidget( TextLabel1, 0, 0 ); - - mySpinBox = new QAD_SpinBoxDbl( mainGrp, "mySpinBox" ); - mySpinBox->setPrecision( 12); - mySpinBox->setRange( bottom, top ); - (( QDoubleValidator* )(mySpinBox->validator()))->setRange(bottom, top, decimals); - mySpinBox->setValue(QString(aValue1).toDouble()); - mainGrpLayout->addWidget( mySpinBox, 0, 1 ); - - QGroupBox* btnGrp = new QGroupBox( this, "btnGrp" ); - btnGrp->setColumnLayout(0, Qt::Vertical ); - btnGrp->layout()->setSpacing( 0 ); - btnGrp->layout()->setMargin( 0 ); - QGridLayout* btnGrpLayout = new QGridLayout( btnGrp->layout() ); - btnGrpLayout->setAlignment( Qt::AlignTop ); - btnGrpLayout->setSpacing( 6 ); - btnGrpLayout->setMargin( 11 ); - topLayout->addWidget( btnGrp, 1, 0 ); - - /* Ok button */ - myButtonOk = new QPushButton( btnGrp, "buttonOk" ); - myButtonOk->setText( tr("GEOM_BUT_OK") ); - myButtonOk->setAutoDefault( TRUE ); - myButtonOk->setDefault( TRUE ); - btnGrpLayout->addWidget( myButtonOk, 0, 0 ); - - btnGrpLayout->addItem( new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 ); - - /* Cancel button */ - myButtonCancel = new QPushButton( btnGrp, "buttonCancel" ); - myButtonCancel->setText( tr("GEOM_BUT_CANCEL") ); - myButtonCancel->setAutoDefault( TRUE ); - btnGrpLayout->addWidget( myButtonCancel, 0, 2 ); - - /* signals and slots connections */ - connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - - /* Retrieve GeomGUI */ - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* Move widget on the botton right corner of main widget */ - QAD_Tools::centerWidget(this, parent); -} - - -//====================================================================================== -// function : ~GeometryGUI_aParameterDlg() destructor -// purpose : Destroys the object and frees any allocated resources -//====================================================================================== -GeometryGUI_aParameterDlg::~GeometryGUI_aParameterDlg() -{ // no need to delete child widgets, Qt does it all for us -} - -//====================================================================================== -// function : GeometryGUI_aParameterDlg::setValue -// purpose : sets value -//====================================================================================== -void GeometryGUI_aParameterDlg::setValue( double val ) -{ - mySpinBox->setValue( val ); -} - -//====================================================================================== -// function : GeometryGUI_aParameterDlg::getValue -// purpose : gets value -//====================================================================================== -double GeometryGUI_aParameterDlg::getValue() -{ - return mySpinBox->value(); -} - diff --git a/GEOMGUI/GeometryGUI_aParameterDlg.h b/GEOMGUI/GeometryGUI_aParameterDlg.h deleted file mode 100644 index 6e65998a4..000000000 --- a/GEOMGUI/GeometryGUI_aParameterDlg.h +++ /dev/null @@ -1,71 +0,0 @@ -// 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_aParameterDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef GeometryGUI_aParameterDLG_H -#define GeometryGUI_aParameterDLG_H - -#include - -class QPushButton; -class GeometryGUI; -class QAD_SpinBoxDbl; - -//================================================================================= -// class : GeometryGUI_aParameterDlg -// purpose : -//================================================================================= -class GeometryGUI_aParameterDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_aParameterDlg( const char* aValue1 = "25", - const char* aTitle1 = "Value :", - QWidget* parent = 0, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0, - const double bottom = -1E6, - const double top = +1E6, - const int decimals = 6 ) ; - - ~GeometryGUI_aParameterDlg(); - - void setValue( double val ); - double getValue(); - -private: - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - - QPushButton* myButtonOk; - QPushButton* myButtonCancel; - QAD_SpinBoxDbl* mySpinBox; - -}; - -#endif // GeometryGUI_aParameterDlg.h diff --git a/GEOMGUI/GeometryGUI_icons.po b/GEOMGUI/GeometryGUI_icons.po deleted file mode 100644 index 6cf22ad83..000000000 --- a/GEOMGUI/GeometryGUI_icons.po +++ /dev/null @@ -1,364 +0,0 @@ -# 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_icons.po -# Module : GEOM - -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2001-06-14 09:11:49 PM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -#Select -msgid "ICON_SELECT" -msgstr "select1.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_Geometry" -msgstr "geometry.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_COMPOUND" -msgstr "tree_compound.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_COMPSOLID" -msgstr "tree_compsolid.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_EDGE" -msgstr "tree_edge.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_FACE" -msgstr "tree_face.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_SHAPE" -msgstr "tree_shape.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_SHELL" -msgstr "tree_shell.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_SOLID" -msgstr "tree_solid.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_VERTEX" -msgstr "tree_vertex.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_WIRE" -msgstr "tree_wire.png" - -#BoxDlg -msgid "ICON_DLG_BOX_2P" -msgstr "box2points.png" - -#BoxDlg -msgid "ICON_DLG_BOX_DXYZ" -msgstr "boxdxyz.png" - -#CylinderDlg -msgid "ICON_DLG_CYLINDER_PV" -msgstr "cylinderpointvector.png" - -#CylinderDlg -msgid "ICON_DLG_CYLINDER_DXYZ" -msgstr "cylinderdxyz.png" - -#SphereDlg -msgid "ICON_DLG_SPHERE_P" -msgstr "spherepoint.png" - -#SphereDlg -msgid "ICON_DLG_SPHERE_DXYZ" -msgstr "spheredxyz.png" - -#torusDlg -msgid "ICON_DLG_TORUS_PV" -msgstr "toruspointvector.png" - -#ConeDlg -msgid "ICON_DLG_CONE_PV" -msgstr "conepointvector.png" - -#torusDlg -msgid "ICON_DLG_TORUS_DXYZ" -msgstr "torusdxyz.png" - -#ConeDlg -msgid "ICON_DLG_CONE_DXYZ" -msgstr "conedxyz.png" - -#LineDlg -msgid "ICON_DLG_LINE_2P" -msgstr "line2points.png" - -#LineDlg -msgid "ICON_DLG_LINE_EDGE" -msgstr "lineedge.png" - -#LineDlg -msgid "ICON_DLG_LINE_PV" -msgstr "linepointvector.png" - -#CircleDlg -msgid "ICON_DLG_CIRCLE_PV" -msgstr "circlepointvector.png" - -#VectorDlg -msgid "ICON_DLG_VECTOR_2P" -msgstr "vector2points.png" - -#vectorDlg -msgid "ICON_DLG_VECTOR_DXYZ" -msgstr "vectordxyz.png" - -#PlaneDlg -msgid "ICON_DLG_PLANE_DXYZ" -msgstr "planedxyz.png" - -#PlaneDlg -msgid "ICON_DLG_PLANE_FACE" -msgstr "planeface.png" - -#PlaneDlg -msgid "ICON_DLG_PLANE_PV" -msgstr "planepointvector.png" - -#WorkingPlaneDlg -msgid "ICON_DLG_WPLANE_FACE" -msgstr "planeworkingface.png" - -#PointDlg -msgid "ICON_DLG_POINT" -msgstr "point2.png" - -#PoinDlg -msgid "ICON_DLG_POINT_EDGE" -msgstr "pointonedge.png" - -#ArcDlg -msgid "ICON_DLG_ARC" -msgstr "arc.png" - -#ArchimedeDlg -msgid "ICON_DLG_ARCHIMEDE" -msgstr "archimede.png" - -#PartitionDlg -msgid "ICON_DLG_PARTITION" -msgstr "partition.png" - -#PartitionDlg -msgid "ICON_DLG_PARTITION_KEEP_FACES" -msgstr "partitionkeep.png" - -#CenterMassDlg -msgid "ICON_DLG_CENTERMASS" -msgstr "centergravity.png" - -#BoundingBoxDlg -msgid "ICON_DLG_BOUNDING_BOX" -msgstr "bounding.png" - -#CommonDlg -msgid "ICON_DLG_COMMON" -msgstr "common.png" - -#CompoundDlg -msgid "ICON_DLG_BUILD_COMPOUND" -msgstr "build_compound.png" - -#CutDlg -msgid "ICON_DLG_CUT" -msgstr "cut.png" - -#EdgeDlg -msgid "ICON_DLG_BUILD_EDGE" -msgstr "build_edge.png" - -#FaceDlg -msgid "ICON_DLG_BUILD_FACE" -msgstr "build_face.png" - -#ShellDlg -msgid "ICON_DLG_BUILD_SHELL" -msgstr "build_shell.png" - -#WireDlg -msgid "ICON_DLG_BUILD_WIRE" -msgstr "build_wire.png" - -#FillingDlg -msgid "ICON_DLG_FILLING" -msgstr "filling.png" - -#FuseDlg -msgid "ICON_DLG_FUSE" -msgstr "fuse.png" - -#InertiaDlg -msgid "ICON_DLG_INERTIA" -msgstr "axisinertia.png" - -#ToleranceDlg -msgid "ICON_DLG_TOLERANCE" -msgstr "tolerance.png" - -#BasicPropertiesDlg -msgid "ICON_DLG_BASICPROPERTIES" -msgstr "basicproperties.png" - -#WhatisDlg -msgid "ICON_DLG_WHATIS" -msgstr "whatis.png" - -#MinDistDlg -msgid "ICON_DLG_MINDIST" -msgstr "mindist.png" - -#MirrorDlg -msgid "ICON_DLG_MIRROR" -msgstr "mirrorPlane.png" - -#TranslationDlg -msgid "ICON_DLG_TRANSLATION" -msgstr "translation.png" - -#RotationDlg -msgid "ICON_DLG_ROTATION" -msgstr "rotate.png" - -#ScaleDlg -msgid "ICON_DLG_SCALE" -msgstr "scale.png" - -#OrientationDlg -msgid "ICON_DLG_ORIENTATION" -msgstr "orientation.png" - -#SewingDlg -msgid "ICON_DLG_SEWING" -msgstr "sewing.png" - -#PipeDlg -msgid "ICON_DLG_PIPE" -msgstr "pipe.png" - -#PrismDlg -msgid "ICON_DLG_PRISM" -msgstr "prism.png" - -#RevolutionDlg -msgid "ICON_DLG_REVOL" -msgstr "revol.png" - -#SectionDlg -msgid "ICON_DLG_SECTION" -msgstr "section.png" - -#SubShapeDlg -msgid "ICON_DLG_SUBSHAPE" -msgstr "subshape.png" - -#FilletDlg -msgid "ICON_DLG_FILLET" -msgstr "fillet.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER" -msgstr "chamfer.png" - -#FilletDlg -msgid "ICON_DLG_FILLET_ALL" -msgstr "filletall.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER_ALL" -msgstr "chamferall.png" - -#FilletDlg -msgid "ICON_DLG_FILLET_EDGE" -msgstr "filletedge.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER_EDGE" -msgstr "chamferedge.png" - -#FilletDlg -msgid "ICON_DLG_FILLET_FACE" -msgstr "filletface.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER_FACE" -msgstr "chamferface.png" - -#ChamferDlg -msgid "ICON_DLG_CHECKSHAPE" -msgstr "check.png" - -#SupressFaceDlg -msgid "ICON_DLG_SUPRESS_FACE" -msgstr "supressface.png" - -#SupressHoleDlg -msgid "ICON_DLG_SUPRESS_HOLE" -msgstr "supresshole.png" - -#SupressHoleDlg -msgid "ICON_DLG_SUPRESS_HOLE_FACE_SHELL" -msgstr "supressHolesOnFaceShell.png" - -#MultiTranslationDlg -msgid "ICON_DLG_MULTITRANSLATION_SIMPLE" -msgstr "multitranslationsimple.png" - -#MultiTranslationDlg -msgid "ICON_DLG_MULTITRANSLATION" -msgstr "multitranslation.png" - -#MultiTranslationDlg -msgid "ICON_DLG_MULTITRANSLATION_DOUBLE" -msgstr "multitranslationdouble.png" - -#MultiRotationDlg -msgid "ICON_DLG_MULTIROTATION_SIMPLE" -msgstr "multirotationsimple.png" - -#MultiRotationDlg -msgid "ICON_DLG_MULTIROTATION" -msgstr "multirotation.png" - -#MultiRotationDlg -msgid "ICON_DLG_MULTIROTATION_DOUBLE" -msgstr "multirotationdouble.png" - - - diff --git a/GEOMGUI/GeometryGUI_msg_en.po b/GEOMGUI/GeometryGUI_msg_en.po deleted file mode 100644 index a26356cfd..000000000 --- a/GEOMGUI/GeometryGUI_msg_en.po +++ /dev/null @@ -1,1186 +0,0 @@ -# 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_msg_en.po -# Module : GEOM - -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -# -#============================================================================== -# - -#Button Apply -msgid "GEOM_BUT_APPLY" -msgstr "&Apply" - -#Button Close -msgid "GEOM_BUT_CLOSE" -msgstr "&Close" - -#Button Cancel -msgid "GEOM_BUT_CANCEL" -msgstr "&Cancel" - -#Button Ok -msgid "GEOM_BUT_OK" -msgstr "&Ok" - -#Button Yes -msgid "GEOM_BUT_YES" -msgstr "&Yes" - -#Button No -msgid "GEOM_BUT_NO" -msgstr "&No" - -#Button Help -msgid "GEOM_BUT_HELP" -msgstr "&Help" - -#Button Explode -msgid "GEOM_BUT_EXPLODE" -msgstr "&Explode" - - -# -#============================================================================== -# - -#: GeometryGUI.cxx:563 -msgid "GEOM_INF_LOADED" -msgstr "File %1 loaded." - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3069 -msgid "GEOM_PRP_COMMAND" -msgstr "No command associated with this id = %1." - -#: GeometryGUI.cxx:4977 -msgid "GEOM_PRP_ABORT" -msgstr "Operation aborted" - -#: GeometryGUI.cxx:5058 -msgid "GEOM_PRP_DONE" -msgstr "Operation done" - -#: GeometryGUI.cxx:3717 -msgid "GEOM_PRP_LOADING" -msgstr "Loading %1 ..." - -#: GeometryGUI.cxx:1412 -msgid "GEOM_PRP_NULLSHAPE" -msgstr "Error, null or inappropriate shape !" - -#: GeometryGUI.cxx:5072 -msgid "GEOM_PRP_READY" -msgstr "Ready" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_SUBSHAPES" -msgstr "Select Sub Shapes" - -msgid "GEOM_CONFIRM" -msgstr "Confirm operation" - -msgid "GEOM_CONFIRM_INFO" -msgstr "Shape contains %1 sub shapes !" - - -msgid "GEOM_PRP_NOT_FOR_VTK_VIEWER" -msgstr "Not allowed in VTK viewer" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SHAPE_IN_STUDY" -msgstr "Main shape must be in the study before" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_EDGE" -msgstr "Select edges and click on Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FACE" -msgstr "Select faces to suppress and click on Ok/Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FIRST" -msgstr "Select main shape first" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_MIN_DIST" -msgstr "Min Distance not computed" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3698 -msgid "GEOM_MEN_ALL_FILES" -msgstr "All Files ( * )" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ANGLE" -msgstr "Angle :" - -#: GeometryGUI.cxx:3941 -msgid "GEOM_MEN_COMPONENT" -msgstr "Geometry" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ENTER_ANGLE" -msgstr "Enter An Angle In Degrees" - -#: GeometryGUI.cxx:3758 -msgid "GEOM_MEN_EXPORT" -msgstr "Export" - -#: GeometryGUI.cxx:3648 -msgid "GEOM_MEN_IMPORT" -msgstr "Import" - -#: GeometryGUI.cxx:3761 -msgid "GEOM_MEN_IMPORT_BREP" -msgstr "BREP Files ( *.brep )" - -#: GeometryGUI.cxx:3762 -msgid "GEOM_MEN_IMPORT_IGES" -msgstr "IGES Files ( *.iges *.igs )" - -#: GeometryGUI.cxx:3763 -msgid "GEOM_MEN_IMPORT_STEP" -msgstr "STEP Files ( *.step *.stp )" - -#: GeometryGUI.cxx:2931 -msgid "GEOM_MEN_ISOS" -msgstr "Select Number Of Isos" - -#: GeometryGUI.cxx:4278 -msgid "GEOM_MEN_POPUP_NAME" -msgstr "%1 Objects" - -#: GeometryGUI.cxx:4414 -msgid "GEOM_MEN_SKETCHER_X" -msgstr "Enter a length to set X" - -#: GeometryGUI.cxx:4438 -msgid "GEOM_MEN_SKETCHER_Y" -msgstr "Enter a length to set Y" - -#: GeometryGUI.cxx:2898 -msgid "GEOM_MEN_TRANSPARENCY" -msgstr "Transparency" - -#: GeometryGUI.cxx:4413 -msgid "GEOM_MEN_X" -msgstr "X :" - -#: GeometryGUI.cxx:4437 -msgid "GEOM_MEN_Y" -msgstr "Y :" - -#: GeometryGUI_NbIsosDlg.cxx:36 -msgid "GEOM_MEN_ISOU" -msgstr "Isos u :" - -#: GeometryGUI_NbIsosDlg.cxx:53 -msgid "GEOM_MEN_ISOV" -msgstr "Isos v :" - -#: GeometryGUI_TransparencyDlg.cxx:31 -msgid "GEOM_MEN_TRANSPARENCY_LABEL" -msgstr "Transparency :" - -msgid "GEOM_MEN_STEP_LABEL" -msgstr "Step :" - - -msgid "GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE" -msgstr "Identical names : select by mouse !" - -msgid "GEOM_NAME_INCORRECT" -msgstr "Object name not found" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:892 -msgid "GEOM_WRN_RADIUS_NULL" -msgstr "Radius is null" - -#: GeometryGUI.cxx:3854 -msgid "GEOM_WRN_WARNING" -msgstr "Warning" - -#: GeometryGUI.cxx:3854 -msgid "GEOM_REALLY_DELETE" -msgstr "Do you really want to delete object(s) ?" - -# -#============================================================================== -# - -#Object -msgid "GEOM_OBJECT" -msgstr "Object" - -#Main object -msgid "GEOM_MAIN_OBJECT" -msgstr "Main Object" - -#Tool object -msgid "GEOM_TOOL_OBJECT" -msgstr "Tool Object" - -#Base Object -msgid "GEOM_BASE_OBJECT" -msgstr "Base Object" - -#Path Object -msgid "GEOM_PATH_OBJECT" -msgstr "Path Object" - -#Objects -msgid "GEOM_OBJECTS" -msgstr "Objects" - -#Object i -msgid "GEOM_OBJECT_I" -msgstr "Object %1" - -#Object and result -msgid "GEOM_OBJECT_RESULT" -msgstr "Object And Result" - -#Point -msgid "GEOM_POINT" -msgstr "Point" - -#Base point -msgid "GEOM_BASE_POINT" -msgstr "Base Point" - -#Center Point -msgid "GEOM_CENTER_POINT" -msgstr "Center Point" - -#Diagonal Points -msgid "GEOM_DIAGONAL_POINTS" -msgstr "Diagonal Points" - -#Central Point -msgid "GEOM_CENTRAL_POINT" -msgstr "Central Point" - -#Points -msgid "GEOM_POINTS" -msgstr "Points" - -#Point i -msgid "GEOM_POINT_I" -msgstr "Point %1" - -#Arguments -msgid "GEOM_ARGUMENTS" -msgstr "Arguments" - -#Center -msgid "GEOM_CENTER" -msgstr "Center" - -#Radius -msgid "GEOM_RADIUS" -msgstr "Radius :" - -#Radius i -msgid "GEOM_RADIUS_I" -msgstr "Radius %1 :" - -#Height -msgid "GEOM_HEIGHT" -msgstr "Height :" - -#Length -msgid "GEOM_LENGTH" -msgstr "Length is :" - -#Weight -msgid "GEOM_WEIGHT" -msgstr "Weight :" - -#Coordinates -msgid "GEOM_COORDINATES" -msgstr "Coordinates" - -#Coor. -msgid "GEOM_COOR" -msgstr "Coord. :" - -#Reverse -msgid "GEOM_REVERSE" -msgstr "Reverse" - -#Reverse U -msgid "GEOM_REVERSE_U" -msgstr "Reverse U" - -#Reverse V -msgid "GEOM_REVERSE_V" -msgstr "Reverse V" - -#Angle -msgid "GEOM_ANGLE" -msgstr "Angle :" - -#Axis -msgid "GEOM_AXIS" -msgstr "Axis" - -#Matrix -msgid "GEOM_MATRIX" -msgstr "Matrix :" - -#Vector Length -msgid "GEOM_VECTOR_LENGTH" -msgstr "Vector Length :" - -#Reverse Vector -msgid "GEOM_REVERSE_VECTOR" -msgstr "Reverse Vector" - -#Plane Mirror -msgid "GEOM_PLANE_MIRROR" -msgstr "Plane Mirror" - -#Face Selection -msgid "GEOM_FACE_SELECTION" -msgstr "Face Selection" - -#Base -msgid "GEOM_BASE" -msgstr "Base" - -#Water Density -msgid "GEOM_WATER_DENSITY" -msgstr "Water Density :" - -#Meshing Deflection -msgid "GEOM_MESHING_DEFLECTION" -msgstr "Meshing Deflect. :" - -#Dimensions -msgid "GEOM_DIMENSIONS" -msgstr "Dimensions" - -#Precision -msgid "GEOM_PRECISION" -msgstr "Precision :" - -#Selection -msgid "GEOM_SELECTION" -msgstr "Selection" - -#Nb. Times -msgid "GEOM_NB_TIMES" -msgstr "Nb. Times :" - -#Nb. Times U -msgid "GEOM_NB_TIMES_U" -msgstr "Nb. Times U :" - -#Nb. Times V -msgid "GEOM_NB_TIMES_V" -msgstr "Nb. Times V :" - -#Step -msgid "GEOM_STEP" -msgstr "Step :" - -#Step V -msgid "GEOM_STEP_V" -msgstr "Step V :" - -#Step U -msgid "GEOM_STEP_U" -msgstr "Step U :" - -# -#============================================================================== -# - -#Partition -msgid "GEOM_PARTITION" -msgstr "Partition" - -#Tolerance -msgid "GEOM_TOLERANCE" -msgstr "Tolerance" - -#Orientation -msgid "GEOM_ORIENTATION" -msgstr "Orientation" - -#Pipe -msgid "GEOM_PIPE" -msgstr "Pipe" - -#Revolution -msgid "GEOM_REVOLUTION" -msgstr "Revolution" - -#Rotation -msgid "GEOM_ROTATION" -msgstr "Rotation" - -#Archimede -msgid "GEOM_ARCHIMEDE" -msgstr "Archimede" - -#Common -msgid "GEOM_COMMON" -msgstr "Common" - -#Cut -msgid "GEOM_CUT" -msgstr "Cut" - -#Distance -msgid "GEOM_DISTANCE" -msgstr "Distance" - -#Filling -msgid "GEOM_FILLING" -msgstr "Filling" - -#Fuse -msgid "GEOM_FUSE" -msgstr "Fuse" - -#Scale -msgid "GEOM_SCALE" -msgstr "Scale" - -#Section -msgid "GEOM_SECTION" -msgstr "Section" - -#Sewing -msgid "GEOM_SEWING" -msgstr "Sewing" - -#Translation -msgid "GEOM_TRANSLATION" -msgstr "Translation" - -#Working Plane -msgid "GEOM_WPLANE" -msgstr "Working Plane" - -#Mirror -msgid "GEOM_MIRROR" -msgstr "Mirror" - -#Prism -msgid "GEOM_PRISM" -msgstr "Prism" - -#Sub Shapes -msgid "GEOM_SUB_SHAPE" -msgstr "Sub Shapes" - -#Supress Face -msgid "GEOM_SUPRESSFACE" -msgstr "Supress Face" - -#Fillet -msgid "GEOM_FILLET" -msgstr "Fillet" - -#Chamfer -msgid "GEOM_CHAMFER" -msgstr "Chamfer" - -#Check Shape -msgid "GEOM_CHECK_SHAPE" -msgstr "Check Shape" - -#Whatis -msgid "GEOM_WHATIS" -msgstr "Whatis" - -#Bounding Box -msgid "GEOM_BNDBOX" -msgstr "Bounding Box" - -#Center Of Mass -msgid "GEOM_CMASS" -msgstr "Center Of Mass" - -#Basic Properties -msgid "GEOM_PROPERTIES" -msgstr "Basic Properties" - -#Multi-Translation -msgid "GEOM_MULTITRANSLATION" -msgstr "Multi-Translation" - -#Multi-Rotation -msgid "GEOM_MULTIROTATION" -msgstr "Multi-Rotation" - -# -#============================================================================== -# - -#Arc -msgid "GEOM_ARC" -msgstr "Arc" - -#Box -msgid "GEOM_BOX" -msgstr "Box" - -#Circle -msgid "GEOM_CIRCLE" -msgstr "Circle" - -#Compound -msgid "GEOM_COMPOUND" -msgstr "Compound" - -#CompSolid -msgid "GEOM_COMPOUNDSOLID" -msgstr "CompSolid" - -#Cone -msgid "GEOM_CONE" -msgstr "Cone" - -#Cylinder -msgid "GEOM_CYLINDER" -msgstr "Cylinder" - -#Edge -msgid "GEOM_EDGE" -msgstr "Edge" - -#Face -msgid "GEOM_FACE" -msgstr "Face" - -#Faces -msgid "GEOM_FACES" -msgstr "Faces" - -#Line -msgid "GEOM_LINE" -msgstr "Line" - -#Plane -msgid "GEOM_PLANE" -msgstr "Plane" - -#Shape -msgid "GEOM_SHAPE" -msgstr "Shape" - -#Shell -msgid "GEOM_SHELL" -msgstr "Shell" - -#Solid -msgid "GEOM_SOLID" -msgstr "Solid" - -#Sphere -msgid "GEOM_SPHERE" -msgstr "Sphere" - -#Conical Face -msgid "GEOM_SURFCONE" -msgstr "Conical Face" - -#Cylindrical Face -msgid "GEOM_SURFCYLINDER" -msgstr "Cylindrical Face" - -#Spherical Face -msgid "GEOM_SURFSPHERE" -msgstr "Spherical Face" - -#Toroidal Face -msgid "GEOM_SURFTORUS" -msgstr "Toroidal Face" - -#Torus -msgid "GEOM_TORUS" -msgstr "Torus" - -#Vector -msgid "GEOM_VECTOR" -msgstr "Vector" - -#Vector U -msgid "GEOM_VECTOR_U" -msgstr "Vector U" - -#Vector V -msgid "GEOM_VECTOR_V" -msgstr "Vector V" - -#Vertex -msgid "GEOM_VERTEX" -msgstr "Vertex" - -#Wire -msgid "GEOM_WIRE" -msgstr "Wire" - -#Parameter -msgid "GEOM_PARAMETER" -msgstr "Parameter :" - -# -#============================================================================== -# - -#Min -msgid "GEOM_MIN" -msgstr "Min :" - -#Max -msgid "GEOM_MAX" -msgstr "Max :" - -#X -msgid "GEOM_X" -msgstr "X :" - -#Y -msgid "GEOM_Y" -msgstr "Y :" - -#Z -msgid "GEOM_Z" -msgstr "Z :" - -#DX -msgid "GEOM_DX" -msgstr "Dx :" - -#DY -msgid "GEOM_DY" -msgstr "Dy :" - -#DZ -msgid "GEOM_DZ" -msgstr "Dz :" - -#D1 -msgid "GEOM_D1" -msgstr "D1 :" - -#D2 -msgid "GEOM_D2" -msgstr "D2 :" - -# -#============================================================================== -# - -#: GeometryGUI.cxx -msgid "GEOM_STEP_TITLE" -msgstr "Step value for GUI constructions" - -#: GeometryGUI_ArcDlg.cxx:45 -msgid "GEOM_ARC_TITLE" -msgstr "Arc Construction" - -#: GeometryGUI_ArchimedeDlg.cxx:55 -msgid "GEOM_ARCHIMEDE_TITLE" -msgstr "Archimede Construction" - -#: GeometryGUI_BndBoxDlg.cxx:59 -msgid "GEOM_BNDBOX_TITLE" -msgstr "Bounding Box Informations" - -#: GeometryGUI_BndBoxDlg.cxx:82 -msgid "GEOM_BNDBOX_OBJDIM" -msgstr "Object And Its Dimensions" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_TITLE" -msgstr "Box Construction" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_OBJ" -msgstr "Dimensions At Origin" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_TITLE" -msgstr "Chamfer Construction" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_ALL" -msgstr "Chamfer On Whole Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_EDGES" -msgstr "Chamfer On Edges From Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_FACES" -msgstr "Chamfer On Faces From Shape" - -#: GeometryGUI_CircleDlg.cxx:48 -msgid "GEOM_CIRCLE_TITLE" -msgstr "Circle Construction" - -#: GeometryGUI_CenterMassDlg.cxx:77 -msgid "GEOM_CMASS_TITLE" -msgstr "Center Of Mass Construction" - -msgid "GEOM_PLANE_SIZE" -msgstr "Size of plane :" - -#: GeometryGUI_CommonDlg.cxx:47 -msgid "GEOM_COMMON_TITLE" -msgstr "BOOLEAN : Common Of Two Objects" - -#: GeometryGUI_CompoundDlg.cxx:44 -msgid "GEOM_COMPOUND_TITLE" -msgstr "Create A Compound" - -#: GeometryGUI_ConeDlg.cxx:49 -msgid "GEOM_CONE_TITLE" -msgstr "Cone Construction" - -#: GeometryGUI_CutDlg.cxx:48 -msgid "GEOM_CUT_TITLE" -msgstr "BOOLEAN : Cut Of Two Objects" -# -#: GeometryGUI_CylinderDlg.cxx:47 -msgid "GEOM_CYLINDER_TITLE" -msgstr "Cylinder Construction" - -#: GeometryGUI_CheckShape.cxx:60 -msgid "GEOM_CHECK_TITLE" -msgstr "Check Shape Informations" - -#: GeometryGUI_CheckShape.cxx:83 -msgid "GEOM_CHECK_INFOS" -msgstr "Object And Its Topological Informations" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_TITLE" -msgstr "Minimun Distance Between Two Objects" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_OBJ" -msgstr "Objects And Results" - -#: GeometryGUI_EdgeDlg.cxx:47 -msgid "GEOM_EDGE_TITLE" -msgstr "Create An Edge" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_TITLE" -msgstr "Fillet Construction" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_ALL" -msgstr "Fillet On Whole Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_EDGES" -msgstr "Fillet On Edges From Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_FACES" -msgstr "Fillet On Faces From Shape" - -#: GeometryGUI_FaceDlg.cxx:49 -msgid "GEOM_FACE_TITLE" -msgstr "Create A Face" - -#: GeometryGUI_FaceDlg.cxx:78 -msgid "GEOM_FACE_FFW" -msgstr "Face from a wire" - -#: GeometryGUI_FaceDlg.cxx:103 -msgid "GEOM_FACE_OPT" -msgstr "Try to create a planar face" - -#: GeometryGUI_FillingDlg.cxx:53 -msgid "GEOM_FILLING_TITLE" -msgstr "Filling Surface With Curves" - -#: GeometryGUI_FillingDlg.cxx:112 -msgid "GEOM_FILLING_ARG" -msgstr "Arguments And Parameters" - -#: GeometryGUI_FillingDlg.cxx:128 -msgid "GEOM_FILLING_MIN_DEG" -msgstr "Min deg" - -#: GeometryGUI_FillingDlg.cxx:142 -msgid "GEOM_FILLING_MAX_DEG" -msgstr "Max deg" - -#: GeometryGUI_FillingDlg.cxx:150 -msgid "GEOM_FILLING_TOL_2D" -msgstr "Tol. 2D :" - -#: GeometryGUI_FillingDlg.cxx:170 -msgid "GEOM_FILLING_COMPOUND" -msgstr "Curves Comp." - -#: GeometryGUI_FillingDlg.cxx:184 -msgid "GEOM_FILLING_TOL_3D" -msgstr "Tol. 3D :" - -#: GeometryGUI_FillingDlg.cxx:192 -msgid "GEOM_FILLING_NB_ITER" -msgstr "Nb. Iter :" - -#: GeometryGUI_FuseDlg.cxx:48 -msgid "GEOM_FUSE_TITLE" -msgstr "BOOLEAN : Fuse Two Objects" - -#: GeometryGUI_InertiaDlg.cxx:42 -msgid "GEOM_INERTIA_TITLE" -msgstr "Calculs Of Inertia" - -#: GeometryGUI_InertiaDlg.cxx:50 -msgid "GEOM_INERTIA_CONSTR" -msgstr "Matrix And Moments Of Inertia" - -#: GeometryGUI_InertiaDlg.cxx:100 -msgid "GEOM_INERTIA_I" -msgstr "%1:1 :" - -#: GeometryGUI_InertiaDlg.cxx:182 -msgid "GEOM_INERTIA_IXYZ" -msgstr "IX & IY & IZ :" - -#: GeometryGUI_LineDlg.cxx:50 -msgid "GEOM_LINE_TITLE" -msgstr "Line Construction" - -#: GeometryGUI_MaxToleranceDlg.cxx:53 -msgid "GEOM_TOLERANCE_TITLE" -msgstr "Maximum Tolerance" - -#: GeometryGUI_MaxToleranceDlg.cxx:84 -msgid "GEOM_TOLERANCE_CONSTR" -msgstr "Object And Its Tolerances" - -#: GeometryGUI_MaxToleranceDlg.cxx:121 -msgid "GEOM_TOLERANCE_FACE" -msgstr "Face :" - -#: GeometryGUI_MaxToleranceDlg.cxx:138 -msgid "GEOM_TOLERANCE_EDGE" -msgstr "Edge :" - -#: GeometryGUI_MaxToleranceDlg.cxx:155 -msgid "GEOM_TOLERANCE_VERTEX" -msgstr "Vertex :" - -#: GeometryGUI_MirrorDlg.cxx:52 -msgid "GEOM_MIRROR_TITLE" -msgstr "Mirror An Object" - -#: GeometryGUI_OrientationDlg.cxx:46 -msgid "GEOM_ORIENTATION_TITLE" -msgstr "Change Orientation" - -#: GeometryGUI_OrientationDlg.cxx:134 -msgid "GEOM_ORIENTATION_OPT" -msgstr "Reverse orientation with normal vectors simulation" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_TITLE" -msgstr "Partition Of Object With Tool" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_KEEP_OBJECT" -msgstr "Keep Object" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_ORIENTATION" -msgstr "Change Orientation" - -#: GeometryGUI_PipeDlg.cxx:47 -msgid "GEOM_PIPE_TITLE" -msgstr "Pipe Construction" - -#: GeometryGUI_PointDlg.cxx:52 -msgid "GEOM_POINT_TITLE" -msgstr "Point Construction" - -#: GeometryGUI_PlaneDlg.cxx:60 -msgid "GEOM_PLANE_TITLE" -msgstr "Plane Construction" - -#: GeometryGUI_PlaneDlg.cxx:172 -msgid "GEOM_PLANE_PVC" -msgstr "Point + Coordinate Vector" - -#: GeometryGUI_PlaneDlg.cxx:133 -msgid "GEOM_PLANE_PV" -msgstr "Point + Vector" - -#: GeometryGUI_PrismDlg.cxx:54 -msgid "GEOM_PRISM_TITLE" -msgstr "Prism Construction" - -#: GeometryGUI_PrismDlg.cxx:83 -msgid "GEOM_PRISM_BSV" -msgstr "Base Shape + Vector" - -#: GeometryGUI_PropertiesDlg.cxx:56 -msgid "GEOM_PROPERTIES_TITLE" -msgstr "Basic Properties Informations" - -#: GeometryGUI_PropertiesDlg.cxx:78 -msgid "GEOM_PROPERTIES_CONSTR" -msgstr "Object And Its Properties" - -#: GeometryGUI_PropertiesDlg.cxx:114 -msgid "GEOM_PROPERTIES_SURFACE" -msgstr "Surface is :" - -#: GeometryGUI_PropertiesDlg.cxx:120 -msgid "GEOM_PROPERTIES_VOLUME" -msgstr "Volume is :" - -#: GeometryGUI_RevolDlg.cxx:49 -msgid "GEOM_REVOLUTION_TITLE" -msgstr "Construction By Revolution" - -#: GeometryGUI_RotationDlg.cxx:51 -msgid "GEOM_ROTATION_TITLE" -msgstr "Rotation Of An Object" - -#: GeometryGUI_ScaleDlg.cxx:52 -msgid "GEOM_SCALE_TITLE" -msgstr "Scale An Object" - -#: GeometryGUI_ScaleDlg.cxx:117 -msgid "GEOM_SCALE_FACTOR" -msgstr "Scale Factor :" - -#: GeometryGUI_SectionDlg.cxx:50 -msgid "GEOM_SECTION_TITLE" -msgstr "BOOLEAN : Section Of Two Objects" - -#: GeometryGUI_SewingDlg.cxx:48 -msgid "GEOM_SEWING_TITLE" -msgstr "Sewing Topologies" - -#: GeometryGUI_ShellDlg.cxx:53 -msgid "GEOM_SHELL_TITLE" -msgstr "Shell Construction" - -#: GeometryGUI_ShellDlg.cxx:74 -msgid "GEOM_SHELL_LIST" -msgstr "List Of Connected Faces" - -#: GeometryGUI_SphereDlg.cxx:50 -msgid "GEOM_SPHERE_TITLE" -msgstr "Sphere Construction" - -#: GeometryGUI_SphereDlg.cxx:113 -msgid "GEOM_SPHERE_CR" -msgstr "Center + Radius" - -#: GeometryGUI_SphereDlg.cxx:146 -msgid "GEOM_SPHERE_RO" -msgstr "Radius At Origin" - -#: GeometryGUI_SubShapeDlg.cxx:55 -msgid "GEOM_SUBSHAPE_TITLE" -msgstr "Sub Shapes Selection" - -#: GeometryGUI_SubShapeDlg.cxx:131 -msgid "GEOM_SUBSHAPE_TYPE" -msgstr "Sub Shapes Type :" - -#: GeometryGUI_SubShapeDlg.cxx:137 -msgid "GEOM_SUBSHAPE_SELECT" -msgstr "Select Sub Shapes" - -#: GeometryGUI_TorusDlg.cxx:51 -msgid "GEOM_TORUS_TITLE" -msgstr "Torus Construction" - -#: GeometryGUI_SuppressFacesDlg.cxx:103 -msgid "GEOM_SUPRESSFACE_TITLE" -msgstr "Suppress Faces In An Object" - -#: GeometryGUI_SuppressFacesDlg.cxx:164 -msgid "GEOM_SUPRESSFACE_SELECT" -msgstr "Select Faces To Suppress" - -#: GeometryGUI_TranslationDlg.cxx:78 -msgid "GEOM_TRANSLATION_COOR" -msgstr "Translation With Coordinates" - -msgid "GEOM_TRANSPARENCY_TITLE" -msgstr "Transparency" - -msgid "GEOM_TRANSPARENCY_OPAQUE" -msgstr "Opaque" - -msgid "GEOM_TRANSPARENCY_TRANSPARENT" -msgstr "Transparent" - -msgid "GEOM_SUPPRESSHOLE_TITLE" -msgstr "Suppress holes" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE" -msgstr "Select the face with hole" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE" -msgstr "Select wire on face" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE_END" -msgstr "Select end face (if hole traversing)" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE_END" -msgstr "Select end wire (if hole traversing)" - -msgid "GEOM_SUPPRESSHOLE_FACE_SHELL" -msgstr "Face or shell" - -msgid "GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE" -msgstr "Select hole(s) on the face" - -#: GeometryGUI_TranslationDlg.cxx:56 -msgid "GEOM_TRANSLATION_TITLE" -msgstr "Translation Of An Object" - -#: GeometryGUI_VectorDlg.cxx:54 -msgid "GEOM_VECTOR_TITLE" -msgstr "Vector Construction" - -#: GeometryGUI_WhatisDlg.cxx:63 -msgid "GEOM_WHATIS_TITLE" -msgstr "Whatis Informations" - -#: GeometryGUI_WhatisDlg.cxx:86 -msgid "GEOM_WHATIS_OBJECT" -msgstr "Object And Its Topological Informations" - -#: GeometryGUI_WireDlg.cxx:46 -msgid "GEOM_WIRE_TITLE" -msgstr "Create A Wire" - -#: GeometryGUI_WireDlg.cxx:103 -msgid "GEOM_WIRE_CONNECT" -msgstr "Wire creation from wires/edges connected" - -#: GeometryGUI_WorkingPlaneDlg.cxx:50 -msgid "GEOM_WPLANE_TITLE" -msgstr "Working Plane Selection" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_FACE" -msgstr "Plane Or Planar Face" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_TITLE" -msgstr "Multi-Translation" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_SIMPLE" -msgstr "Multi Translation Simple" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_DOUBLE" -msgstr "Multi Translation Double" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_TITLE" -msgstr "Multi-Rotation" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_SIMPLE" -msgstr "Multi Rotation Simple" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_DOUBLE" -msgstr "Multi Rotation Double" - -msgid "GEOM_PARAM_POINT" -msgstr "Parametric point" - - -# -#============================================================================== -# - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_WIREFRAME" -msgstr "Wireframe" - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_SHADING" -msgstr "\nShading" - -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT" -msgstr "Reconstruction Limit" - -msgid "GeometryGUI_PartitionDlg::SUPPRESS_RESULT" -msgstr "Suppress Result" - -msgid "GeometryGUI_PartitionDlg::SUPPRESS_RESULT_INSIDE" -msgstr "Inside" - -msgid "GeometryGUI_PartitionDlg::SUPPRESS_RESULT_OUTSIDE" -msgstr "Outside" - -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_SHAPE" -msgstr "Shape" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_SOLID" -msgstr "Solid" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_SHELL" -msgstr "Shell" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_FACE" -msgstr "Face" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_WIRE" -msgstr "Wire" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_EDGE" -msgstr "Edge" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_VERTEX" -msgstr "Vertex" diff --git a/GEOMGUI/GeometryGUI_msg_fr.po b/GEOMGUI/GeometryGUI_msg_fr.po deleted file mode 100644 index 00fcebbdd..000000000 --- a/GEOMGUI/GeometryGUI_msg_fr.po +++ /dev/null @@ -1,1152 +0,0 @@ -# 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_msg_fr.po -# Module : GEOM - -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -# -#============================================================================== -# - -#Button Apply -msgid "GEOM_BUT_APPLY" -msgstr "&Appliquer" - -#Button Close -msgid "GEOM_BUT_CLOSE" -msgstr "&Fermer" - -#Button Cancel -msgid "GEOM_BUT_CANCEL" -msgstr "&Annuler" - -#Button Ok -msgid "GEOM_BUT_OK" -msgstr "&Ok" - -#Button Yes -msgid "GEOM_BUT_YES" -msgstr "&Oui" - -#Button Help -msgid "GEOM_BUT_HELP" -msgstr "&Aide" - - -#Button Explode -msgid "GEOM_BUT_EXPLODE" -msgstr "&Exploser" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:563 -msgid "GEOM_INF_LOADED" -msgstr "Le fichier %1 est chargé." - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3069 -msgid "GEOM_PRP_COMMAND" -msgstr "Pas de commande associée à l'id = %1." - -#: GeometryGUI.cxx:4977 -msgid "GEOM_PRP_ABORT" -msgstr "L'opération a echoué" - -#: GeometryGUI.cxx:5058 -msgid "GEOM_PRP_DONE" -msgstr "Opération effectuée" - -#: GeometryGUI.cxx:3717 -msgid "GEOM_PRP_LOADING" -msgstr "Chargement de %1 ..." - -#: GeometryGUI.cxx:1412 -msgid "GEOM_PRP_NULLSHAPE" -msgstr "Erreur, objet inconsistant ou inapproprié !" - -#: GeometryGUI.cxx:5072 -msgid "GEOM_PRP_READY" -msgstr "Prêt..." - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_SUBSHAPES" -msgstr "Selection de sous objets" - -msgid "GEOM_CONFIRM" -msgstr "Confirmer cette operation" - -msgid "GEOM_CONFIRM_INFO" -msgstr "L'objet contient %1 sous objets" - - -msgid "GEOM_PRP_NOT_FOR_VTK_VIEWER" -msgstr "Non permis dans viewer VTK" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SHAPE_IN_STUDY" -msgstr "La shape principale doit etre avant dans l'etude" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_EDGE" -msgstr "Selectionner les edges et clicker sur Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FACE" -msgstr "Select les faces a supprimer et clicker sur Ok/Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FIRST" -msgstr "Selectionner la shape principale en premier" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_MIN_DIST" -msgstr "Min Distance non calculer" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3698 -msgid "GEOM_MEN_ALL_FILES" -msgstr "Tous fichiers ( * )" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ANGLE" -msgstr "Angle :" - -#: GeometryGUI.cxx:3941 -msgid "GEOM_MEN_COMPONENT" -msgstr "Géometrie" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ENTER_ANGLE" -msgstr "Saisir un angle en degrés" - -#: GeometryGUI.cxx:3758 -msgid "GEOM_MEN_EXPORT" -msgstr "Exporter" - -#: GeometryGUI.cxx:3648 -msgid "GEOM_MEN_IMPORT" -msgstr "Importer" - -#: GeometryGUI.cxx:3761 -msgid "GEOM_MEN_IMPORT_BREP" -msgstr "Fichiers BREP ( *.brep )" - -#: GeometryGUI.cxx:3762 -msgid "GEOM_MEN_IMPORT_IGES" -msgstr "Fichiers IGES ( *.iges *.igs )" - -#: GeometryGUI.cxx:3763 -msgid "GEOM_MEN_IMPORT_STEP" -msgstr "Fichiers STEP ( *.step *.stp )" - -#: GeometryGUI.cxx:2931 -msgid "GEOM_MEN_ISOS" -msgstr "Choisir un nombre d'isos" - -#: GeometryGUI.cxx:4278 -msgid "GEOM_MEN_POPUP_NAME" -msgstr "%1 Objets" - -#: GeometryGUI.cxx:4414 -msgid "GEOM_MEN_SKETCHER_X" -msgstr "Saisir une longueur pour fixer X" - -#: GeometryGUI.cxx:4438 -msgid "GEOM_MEN_SKETCHER_Y" -msgstr "Saisir une longueur pour fixer Y" - -#: GeometryGUI.cxx:2898 -msgid "GEOM_MEN_TRANSPARENCY" -msgstr "Transparence" - -#: GeometryGUI.cxx:4413 -msgid "GEOM_MEN_X" -msgstr "X :" - -#: GeometryGUI.cxx:4437 -msgid "GEOM_MEN_Y" -msgstr "Y :" - -#: GeometryGUI_NbIsosDlg.cxx:36 -msgid "GEOM_MEN_ISOU" -msgstr "Isos u :" - -#: GeometryGUI_NbIsosDlg.cxx:53 -msgid "GEOM_MEN_ISOV" -msgstr "Isos v :" - -#: GeometryGUI_TransparencyDlg.cxx:31 -msgid "GEOM_MEN_TRANSPARENCY_LABEL" -msgstr "Transparence :" - -msgid "GEOM_MEN_STEP_LABEL" -msgstr "Increment" - -msgid "GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE" -msgstr "Noms identiques : selectionner avec la souris !" - -msgid "GEOM_NAME_INCORRECT" -msgstr "Le nom saisi n'existe pas" - - - -# -#============================================================================== -# - -#: GeometryGUI.cxx:892 -msgid "GEOM_WRN_RADIUS_NULL" -msgstr "Le rayon est nul" - -#: GeometryGUI.cxx:3854 -msgid "GEOM_WRN_WARNING" -msgstr "Avertissement" - -# -#============================================================================== -# - -#Object -msgid "GEOM_OBJECT" -msgstr "Objet" - -#Main object -msgid "GEOM_MAIN_OBJECT" -msgstr "Objet Principal" - -#Tool object -msgid "GEOM_TOOL_OBJECT" -msgstr "Objet Outil" - -#Base Object -msgid "GEOM_BASE_OBJECT" -msgstr "Objet De Base" - -#Path Object -msgid "GEOM_PATH_OBJECT" -msgstr "Objet Chemin" - -#Objects -msgid "GEOM_OBJECTS" -msgstr "Objets" - -#Object i -msgid "GEOM_OBJECT_I" -msgstr "Objet %1" - -#Object and result -msgid "GEOM_OBJECT_RESULT" -msgstr "Objet Et Résultat" - -#Point -msgid "GEOM_POINT" -msgstr "Point" - -#Base point -msgid "GEOM_BASE_POINT" -msgstr "Point De Base" - -#Center Point -msgid "GEOM_CENTER_POINT" -msgstr "Point Centre" - -#Diagonal Points -msgid "GEOM__DIAGONAL_POINTS" -msgstr "Points Diagonaux" - -#Central Point -msgid "GEOM_CENTRAL_POINT" -msgstr "Point Central" - -#Points -msgid "GEOM_POINTS" -msgstr "Points" - -#Point i -msgid "GEOM_POINT_I" -msgstr "Point %1" - -#Arguments -msgid "GEOM_ARGUMENTS" -msgstr "Arguments" - -#Center -msgid "GEOM_CENTER" -msgstr "Centre" - -#Radius -msgid "GEOM_RADIUS" -msgstr "Rayon" - -#Radius i -msgid "GEOM_RADIUS_I" -msgstr "Rayon %1" - -#Height -msgid "GEOM_HEIGHT" -msgstr "Hauteur" - -#Length -msgid "GEOM_LENGTH" -msgstr "Longueur :" - -#Weight -msgid "GEOM_WEIGHT" -msgstr "poids" - -#Coordinates -msgid "GEOM_COORDINATES" -msgstr "Coordonnées" - -#Coor. -msgid "GEOM_COOR" -msgstr "Coord. :" - -#Reverse -msgid "GEOM_REVERSE" -msgstr "Renverser" - -#Reverse U -msgid "GEOM_REVERSE_U" -msgstr "Renverser U" - -#Reverse V -msgid "GEOM_REVERSE_V" -msgstr "Reverser V" - -#Angle -msgid "GEOM_ANGLE" -msgstr "Angle :" - -#Axis -msgid "GEOM_AXIS" -msgstr "Axe" - -#Matrix -msgid "GEOM_MATRIX" -msgstr "Matrice :" - -#Vector Length -msgid "GEOM_VECTOR_LENGTH" -msgstr "Longueur Du Vecteur :" - -#Reverse Vector -msgid "GEOM_REVERSE_VECTOR" -msgstr "Renverser Le Vecteur" - -#Plane Mirror -msgid "GEOM_PLANE_MIRROR" -msgstr "Plan Miroir" - -#Face Selection -msgid "GEOM_FACE_SELECTION" -msgstr "Selection de Face" - -#Base -msgid "GEOM_BASE" -msgstr "Base" - -#Water Density -msgid "GEOM_WATER_DENSITY" -msgstr "Densité de l'eau :" - -#Meshing Deflection -msgid "GEOM_MESHING_DEFLECTION" -msgstr "Déflection Du Maillage :" - -#Dimensions -msgid "GEOM_DIMENSIONS" -msgstr "Dimensions" - -#Precision -msgid "GEOM_PRECISION" -msgstr "Précision :" - -#Selection -msgid "GEOM_SELECTION" -msgstr "Sélection" - -#Nb. Times -msgid "GEOM_NB_TIMES" -msgstr "Nb. Fois :" - -#Nb. Times U -msgid "GEOM_NB_TIMES_U" -msgstr "Nb. Fois U :" - -#Nb. Times V -msgid "GEOM_NB_TIMES_V" -msgstr "Nb. Fois V :" - -#Step -msgid "GEOM_STEP" -msgstr "Pas :" - -#Step V -msgid "GEOM_STEP_V" -msgstr "Pas V :" - -#Step U -msgid "GEOM_STEP_U" -msgstr "Pas U :" - -# -#============================================================================== -# - -#Partition -msgid "GEOM_PARTITION" -msgstr "Partition" - -#Tolerance -msgid "GEOM_TOLERANCE" -msgstr "Tolérance" - -#Orientation -msgid "GEOM_ORIENTATION" -msgstr "Orientation" - -#Pipe -msgid "GEOM_PIPE" -msgstr "Pipe" - -#Revolution -msgid "GEOM_REVOLUTION" -msgstr "Révolution" - -#Rotation -msgid "GEOM_ROTATION" -msgstr "Rotation" - -#Archimede -msgid "GEOM_ARCHIMEDE" -msgstr "Archimède" - -#Common -msgid "GEOM_COMMON" -msgstr "Joindre" - -#Cut -msgid "GEOM_CUT" -msgstr "Couper" - -#Distance -msgid "GEOM_DISTANCE" -msgstr "Distance" - -#Filling -msgid "GEOM_FILLING" -msgstr "Surface Par Courbes" - -#Fuse -msgid "GEOM_FUSE" -msgstr "Fusionner" - -#Scale -msgid "GEOM_SCALE" -msgstr "Echelle" - -#Section -msgid "GEOM_SECTION" -msgstr "Section" - -#Sewing -msgid "GEOM_SEWING" -msgstr "Coudre" - -#Translation -msgid "GEOM_TRANSLATION" -msgstr "Translation" - -#Working Plane -msgid "GEOM_WPLANE" -msgstr "Plan de Travail" - -#Mirror -msgid "GEOM_MIRROR" -msgstr "Miroir" - -#Prism -msgid "GEOM_PRISM" -msgstr "Extrusion" - -#Sub Shapes -msgid "GEOM_SUB_SHAPE" -msgstr "Sous Shapes" - -#Supress Face -msgid "GEOM_SUPRESSFACE" -msgstr "Supression de Face" - -#Fillet -msgid "GEOM_FILLET" -msgstr "Conge" - -#Chamfer -msgid "GEOM_CHAMFER" -msgstr "Chanfrein" - -#Check Shape -msgid "GEOM_CHECK_SHAPE" -msgstr "Check Shape" - -#Whatis -msgid "GEOM_WHATIS" -msgstr "Whatis" - -#Bounding Box -msgid "GEOM_BNDBOX" -msgstr "Boite Anglobante" - -#Center Of Mass -msgid "GEOM_CMASS" -msgstr "Centre de Masse" - -#Basic Properties -msgid "GEOM_PROPERTIES" -msgstr "Basiques Proprietes" - -#Multi-Translation -msgid "GEOM_MULTITRANSLATION" -msgstr "Multi-Translation" - -#Multi-Rotation -msgid "GEOM_MULTIROTATION" -msgstr "Multi-Rotation" - -# -#============================================================================== -# - -#Arc -msgid "GEOM_ARC" -msgstr "Arc" - -#Box -msgid "GEOM_BOX" -msgstr "Boite" - -#Circle -msgid "GEOM_CIRCLE" -msgstr "Cercle" - -#Compound -msgid "GEOM_COMPOUND" -msgstr "Compound" - -#CompSolid -msgid "GEOM_COMPOUNDSOLID" -msgstr "CompSolid" - -#Cone -msgid "GEOM_CONE" -msgstr "Cone" - -#Cylinder -msgid "GEOM_CYLINDER" -msgstr "Cylindre" - -#Edge -msgid "GEOM_EDGE" -msgstr "Edge" - -#Face -msgid "GEOM_FACE" -msgstr "Face" - -#Faces -msgid "GEOM_FACES" -msgstr "Faces" - -#Line -msgid "GEOM_LINE" -msgstr "Ligne" - -#Plane -msgid "GEOM_PLANE" -msgstr "Plan" - -#Shape -msgid "GEOM_SHAPE" -msgstr "Shape" - -#Shell -msgid "GEOM_SHELL" -msgstr "Shell" - -#Solid -msgid "GEOM_SOLID" -msgstr "Solide" - -#Sphere -msgid "GEOM_SPHERE" -msgstr "Sphère" - -#Conical Face -msgid "GEOM_SURFCONE" -msgstr "Face Conique" - -#Cylindrical Face -msgid "GEOM_SURFCYLINDER" -msgstr "Face Cylindrique" - -#Spherical Face -msgid "GEOM_SURFSPHERE" -msgstr "Face Sphèrique" - -#Toroidal Face -msgid "GEOM_SURFTORUS" -msgstr "Face Toroique" - -#Torus -msgid "GEOM_TORUS" -msgstr "Tore" - -#Vector -msgid "GEOM_VECTOR" -msgstr "Vecteur" - -#Vector U -msgid "GEOM_VECTOR_U" -msgstr "Vecteur U" - -#Vector V -msgid "GEOM_VECTOR_V" -msgstr "Vecteur V" - -#Vertex -msgid "GEOM_VERTEX" -msgstr "Vertex" - -#Wire -msgid "GEOM_WIRE" -msgstr "Wire" - -#Parameter -msgid "GEOM_PARAMETER" -msgstr "Paramètre :" - - -# -#============================================================================== -# - -#Min -msgid "GEOM_MIN" -msgstr "Min :" - -#Max -msgid "GEOM_MAX" -msgstr "Max :" - -#X -msgid "GEOM_X" -msgstr "X :" - -#Y -msgid "GEOM_Y" -msgstr "Y :" - -#Z -msgid "GEOM_Z" -msgstr "Z :" - -#DX -msgid "GEOM_DX" -msgstr "Dx :" - -#DY -msgid "GEOM_DY" -msgstr "Dy :" - -#DZ -msgid "GEOM_DZ" -msgstr "Dz :" - -#D1 -msgid "GEOM_D1" -msgstr "D1 :" - -#D2 -msgid "GEOM_D2" -msgstr "D2 :" - -# -#============================================================================== -# - -#: GeometryGUI.cxx -msgid "GEOM_STEP_TITLE" -msgstr "Increment par défaut lors des constructions" - -#: GeometryGUI_ArcDlg.cxx:45 -msgid "GEOM_ARC_TITLE" -msgstr "Construction d'un Arc" - -#: GeometryGUI_ArchimedeDlg.cxx:55 -msgid "GEOM_ARCHIMEDE_TITLE" -msgstr "Construction d'Archimède" - -#: GeometryGUI_BndBoxDlg.cxx:59 -msgid "GEOM_BNDBOX_TITLE" -msgstr "Boite Englobante" - -#: GeometryGUI_BndBoxDlg.cxx:82 -msgid "GEOM_BNDBOX_OBJDIM" -msgstr "Objet and ses dimensions" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_TITLE" -msgstr "Construction d'une Boite" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_OBJ" -msgstr "Dimensions A l'Origine" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_TITLE" -msgstr "Construction d'un Chanfrein" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_ALL" -msgstr "Chanfrein sur toute la Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_EDGES" -msgstr "Chanfrein sur Edges de la Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_FACES" -msgstr "Chanfrein sur Faces de la Shape" - -#: GeometryGUI_CircleDlg.cxx:48 -msgid "GEOM_CIRCLE_TITLE" -msgstr "Construction d'un Cercle" - -#: GeometryGUI_CenterMassDlg.cxx:77 -msgid "GEOM_CMASS_TITLE" -msgstr "Centre De Gravité" - -msgid "GEOM_PLANE_SIZE" -msgstr "Taille du plan :" - -#: GeometryGUI_CommonDlg.cxx:47 -msgid "GEOM_COMMON_TITLE" -msgstr "BOOLEEN : Jonction De Deux Objets" - -#: GeometryGUI_CompoundDlg.cxx:44 -msgid "GEOM_COMPOUND_TITLE" -msgstr "Création d'un Compound" - -#: GeometryGUI_ConeDlg.cxx:49 -msgid "GEOM_CONE_TITLE" -msgstr "Construction d'un Cone" - -#: GeometryGUI_CutDlg.cxx:48 -msgid "GEOM_CUT_TITLE" -msgstr "BOOLEEN : Couper Deux Objets" -# -#: GeometryGUI_CylinderDlg.cxx:47 -msgid "GEOM_CYLINDER_TITLE" -msgstr "Construction d'un Cylindre" - -#: GeometryGUI_CheckShape.cxx:60 -msgid "GEOM_CHECK_TITLE" -msgstr "Check Shape" - -#: GeometryGUI_CheckShape.cxx:83 -msgid "GEOM_CHECK_INFOS" -msgstr "Objet et ses Informations Topologiques" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_TITLE" -msgstr "Distance Minimale entre Deux Objets" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_OBJ" -msgstr "Objets Et Resultats" - -#: GeometryGUI_EdgeDlg.cxx:47 -msgid "GEOM_EDGE_TITLE" -msgstr "Création d'un Edge" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_TITLE" -msgstr "Construction d'un Congé" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_ALL" -msgstr "Congé sur toute la Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_EDGES" -msgstr "Congé sur Edges de la Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_FACES" -msgstr "Congé sur Faces de la Shape" - -#: GeometryGUI_FaceDlg.cxx:49 -msgid "GEOM_FACE_TITLE" -msgstr "Création d'une Face" - -#: GeometryGUI_FaceDlg.cxx:78 -msgid "GEOM_FACE_FFW" -msgstr "Face a partir d'un wire" - -#: GeometryGUI_FaceDlg.cxx:103 -msgid "GEOM_FACE_OPT" -msgstr "Création d'une Face plane" - -#: GeometryGUI_FillingDlg.cxx:53 -msgid "GEOM_FILLING_TITLE" -msgstr "Surface Par Courbes" - -#: GeometryGUI_FillingDlg.cxx:112 -msgid "GEOM_FILLING_ARG" -msgstr "Argument Et Parametres" - -#: GeometryGUI_FillingDlg.cxx:128 -msgid "GEOM_FILLING_MIN_DEG" -msgstr "Min. Deg" - -#: GeometryGUI_FillingDlg.cxx:142 -msgid "GEOM_FILLING_MAX_DEG" -msgstr "Max. Deg" - -#: GeometryGUI_FillingDlg.cxx:150 -msgid "GEOM_FILLING_TOL_2D" -msgstr "Tol. 2D" - -#: GeometryGUI_FillingDlg.cxx:170 -msgid "GEOM_FILLING_COMPOUND" -msgstr "Compound de Courbes" - -#: GeometryGUI_FillingDlg.cxx:184 -msgid "GEOM_FILLING_TOL_3D" -msgstr "Tol. 3D" - -#: GeometryGUI_FillingDlg.cxx:192 -msgid "GEOM_FILLING_NB_ITER" -msgstr "Nb. Iter" - -#: GeometryGUI_FuseDlg.cxx:48 -msgid "GEOM_FUSE_TITLE" -msgstr "BOOLEEN : Fusionner deux Objets" - -#: GeometryGUI_InertiaDlg.cxx:42 -msgid "GEOM_INERTIA_TITLE" -msgstr "Calculs d'Inertie" - -#: GeometryGUI_InertiaDlg.cxx:50 -msgid "GEOM_INERTIA_CONSTR" -msgstr "Matrice Et Moments d'Inertie" - -#: GeometryGUI_InertiaDlg.cxx:100 -msgid "GEOM_INERTIA_I" -msgstr "%1:1" - -#: GeometryGUI_InertiaDlg.cxx:182 -msgid "GEOM_INERTIA_IXYZ" -msgstr "IX & IY & IZ" - -#: GeometryGUI_LineDlg.cxx:50 -msgid "GEOM_LINE_TITLE" -msgstr "Construction d'une Ligne" - -#: GeometryGUI_MaxToleranceDlg.cxx:53 -msgid "GEOM_TOLERANCE_TITLE" -msgstr "Tolerance Maximale" - -#: GeometryGUI_MaxToleranceDlg.cxx:84 -msgid "GEOM_TOLERANCE_CONSTR" -msgstr "Object et ses Tolerances" - -#: GeometryGUI_MaxToleranceDlg.cxx:121 -msgid "GEOM_TOLERANCE_FACE" -msgstr "Face :" - -#: GeometryGUI_MaxToleranceDlg.cxx:138 -msgid "GEOM_TOLERANCE_EDGE" -msgstr "Edge :" - -#: GeometryGUI_MaxToleranceDlg.cxx:155 -msgid "GEOM_TOLERANCE_VERTEX" -msgstr "Vertex :" - -#: GeometryGUI_MirrorDlg.cxx:52 -msgid "GEOM_MIRROR_TITLE" -msgstr "Methode Miroir" - -#: GeometryGUI_OrientationDlg.cxx:46 -msgid "GEOM_ORIENTATION_TITLE" -msgstr "Changer l'Orientation" - -#: GeometryGUI_OrientationDlg.cxx:134 -msgid "GEOM_ORIENTATION_OPT" -msgstr "Renverser l'orientation avec une simulation de vecteur normal" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_TITLE" -msgstr "Partition d'Objects Avec Outils" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_KEEP_OBJECT" -msgstr "Objet garde" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_ORIENTATION" -msgstr "Change l'orientation" - -#: GeometryGUI_PipeDlg.cxx:47 -msgid "GEOM_PIPE_TITLE" -msgstr "Construction d'une Pipe" - -#: GeometryGUI_PointDlg.cxx:52 -msgid "GEOM_POINT_TITLE" -msgstr "Construction d'un Point" - -#: GeometryGUI_PlaneDlg.cxx:60 -msgid "GEOM_PLANE_TITLE" -msgstr "Construction d'un Plan" - -#: GeometryGUI_PlaneDlg.cxx:172 -msgid "GEOM_PLANE_PVC" -msgstr "Point + Vecteur Coordonnes" - -#: GeometryGUI_PlaneDlg.cxx:133 -msgid "GEOM_PLANE_PV" -msgstr "Point + Vecteur" - -#: GeometryGUI_PrismDlg.cxx:54 -msgid "GEOM_PRISM_TITLE" -msgstr "Extruder une Shape de base" - -#: GeometryGUI_PrismDlg.cxx:83 -msgid "GEOM_PRISM_BSV" -msgstr "Shape de base + Vecteur" - -#: GeometryGUI_PropertiesDlg.cxx:56 -msgid "GEOM_PROPERTIES_TITLE" -msgstr "Proprietes Basiques" - -#: GeometryGUI_PropertiesDlg.cxx:78 -msgid "GEOM_PROPERTIES_CONSTR" -msgstr "Objet et ses Proprietes" - -#: GeometryGUI_PropertiesDlg.cxx:114 -msgid "GEOM_PROPERTIES_SURFACE" -msgstr "Surface :" - -#: GeometryGUI_PropertiesDlg.cxx:120 -msgid "GEOM_PROPERTIES_VOLUME" -msgstr "Volume :" - -#: GeometryGUI_RevolDlg.cxx:49 -msgid "GEOM_REVOLUTION_TITLE" -msgstr "Construction Par Revolution" - -#: GeometryGUI_RotationDlg.cxx:51 -msgid "GEOM_ROTATION_TITLE" -msgstr "Rotation d'un Objet" - -#: GeometryGUI_ScaleDlg.cxx:52 -msgid "GEOM_SCALE_TITLE" -msgstr "Echelle d'un Objet" - -#: GeometryGUI_ScaleDlg.cxx:117 -msgid "GEOM_SCALE_FACTOR" -msgstr "Facteur d'echelle" - -#: GeometryGUI_SectionDlg.cxx:50 -msgid "GEOM_SECTION_TITLE" -msgstr "BOOLEEN : Section De Deux Objets" - -#: GeometryGUI_SewingDlg.cxx:48 -msgid "GEOM_SEWING_TITLE" -msgstr "Coudre des Topologies" - -#: GeometryGUI_ShellDlg.cxx:53 -msgid "GEOM_SHELL_TITLE" -msgstr "Construction d'une Shell" - -#: GeometryGUI_ShellDlg.cxx:74 -msgid "GEOM_SHELL_LIST" -msgstr "List de Faces Connectees" - -#: GeometryGUI_SphereDlg.cxx:50 -msgid "GEOM_SPHERE_TITLE" -msgstr "Construction d'une Sphere" - -#: GeometryGUI_SphereDlg.cxx:113 -msgid "GEOM_SPHERE_CR" -msgstr "Centre + rayon" - -#: GeometryGUI_SphereDlg.cxx:146 -msgid "GEOM_SPHERE_RO" -msgstr "Rayon a l'origine" - -#: GeometryGUI_SubShapeDlg.cxx:55 -msgid "GEOM_SUBSHAPE_TITLE" -msgstr "Selection de Sous Shapes" - -#: GeometryGUI_SubShapeDlg.cxx:131 -msgid "GEOM_SUBSHAPE_TYPE" -msgstr "Type de Sous Shapes" - -#: GeometryGUI_SubShapeDlg.cxx:137 -msgid "GEOM_SUBSHAPE_SELECT" -msgstr "Selectionner de Sous Shapes" - -#: GeometryGUI_TorusDlg.cxx:51 -msgid "GEOM_TORUS_TITLE" -msgstr "Constructiond'un Tore" - -#: GeometryGUI_SuppressFacesDlg.cxx:103 -msgid "GEOM_SUPRESSFACE_TITLE" -msgstr "Supprimer des Faces dans un Objet" - -#: GeometryGUI_SuppressFacesDlg.cxx:164 -msgid "GEOM_SUPRESSFACE_SELECT" -msgstr "Selectionner les Faces a Supprimer" - -#: GeometryGUI_TranslationDlg.cxx:78 -msgid "GEOM_TRANSLATION_COOR" -msgstr "Translation Avec Coordonnees" - -msgid "GEOM_TRANSPARENCY_TITLE" -msgstr "Transparence" - -msgid "GEOM_TRANSPARENCY_OPAQUE" -msgstr "Opaque" - -msgid "GEOM_TRANSPARENCY_TRANSPARENT" -msgstr "Transparent" - -msgid "GEOM_SUPPRESSHOLE_TITLE" -msgstr "Suppression de trous" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE" -msgstr "Selection de la face initiale" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE" -msgstr "Selection du contour/trou sur la face" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE_END" -msgstr "Selection de la face terminale (si trou traversant)" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE_END" -msgstr "Selection de contour final (si trou traversant)" - -msgid "GEOM_SUPPRESSHOLE_FACE_SHELL" -msgstr "Face ou shell" - -msgid "GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE" -msgstr "Selection de trou(s) sur la face" - -#: GeometryGUI_TranslationDlg.cxx:56 -msgid "GEOM_TRANSLATION_TITLE" -msgstr "Translation d'un Objet" - -#: GeometryGUI_VectorDlg.cxx:54 -msgid "GEOM_VECTOR_TITLE" -msgstr "Construction d'un Vecteur" - -#: GeometryGUI_WhatisDlg.cxx:63 -msgid "GEOM_WHATIS_TITLE" -msgstr "Whatis" - -#: GeometryGUI_WhatisDlg.cxx:86 -msgid "GEOM_WHATIS_OBJECT" -msgstr "Objet et ses Informations Topologiques" - -#: GeometryGUI_WireDlg.cxx:46 -msgid "GEOM_WIRE_TITLE" -msgstr "Creer un Wire" - -#: GeometryGUI_WireDlg.cxx:103 -msgid "GEOM_WIRE_CONNECT" -msgstr "Creation d'un Wire a partir de wires/edges connectes" - -#: GeometryGUI_WorkingPlaneDlg.cxx:50 -msgid "GEOM_WPALNE_TITLE" -msgstr "plan de travail" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPALNE_FACE" -msgstr "Plan Ou Face plane" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_TITLE" -msgstr "Multi-Translation" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_SIMPLE" -msgstr "Multi Translation Simple" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_DOUBLE" -msgstr "Multi Translation Double" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_TITLE" -msgstr "Multi-Rotation" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_SIMPLE" -msgstr "Multi Rotation Simple" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_DOUBLE" -msgstr "Multi Rotation Double" - -msgid "GEOM_PARAM_POINT" -msgstr "Point paramétrique" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_WIREFRAME" -msgstr "Filaire" - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_SHADING" -msgstr "Ombré" diff --git a/GEOMGUI/Makefile.in b/GEOMGUI/Makefile.in deleted file mode 100644 index d6f0812bc..000000000 --- a/GEOMGUI/Makefile.in +++ /dev/null @@ -1,174 +0,0 @@ -# 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 : Makefile.in -# Author : Marc Tajchman (CEA) -# Module : GEOM -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@top_srcdir@/idl - - -@COMMENCE@ - -# header files -EXPORT_HEADERS= GeometryGUI_Swig.hxx \ - GeometryGUI_Swig.i - -# ressources files : -PO_FILES = \ - GeometryGUI_icons.po \ - GeometryGUI_msg_en.po \ - GeometryGUI_msg_fr.po - -# Libraries targets -LIB = libGeometryGUI.la -LIB_SRC = GeometryGUI.cxx \ - GeometryGUI_SpinBox.cxx \ - GeometryGUI_TransparencyDlg.cxx \ - GeometryGUI_NbIsosDlg.cxx \ - GeometryGUI_BoxDlg.cxx \ - GeometryGUI_ArchimedeDlg.cxx \ - GeometryGUI_PointDlg.cxx \ - GeometryGUI_VectorDlg.cxx \ - GeometryGUI_PlaneDlg.cxx \ - GeometryGUI_PrismDlg.cxx \ - GeometryGUI_FuseDlg.cxx \ - GeometryGUI_SectionDlg.cxx \ - GeometryGUI_CommonDlg.cxx \ - GeometryGUI_CutDlg.cxx \ - GeometryGUI_LineDlg.cxx \ - GeometryGUI_ScaleDlg.cxx \ - GeometryGUI_MirrorDlg.cxx \ - GeometryGUI_SphereDlg.cxx \ - GeometryGUI_CircleDlg.cxx \ - GeometryGUI_RevolDlg.cxx \ - GeometryGUI_RotationDlg.cxx \ - GeometryGUI_TranslationDlg.cxx \ - GeometryGUI_ArcDlg.cxx \ - GeometryGUI_PipeDlg.cxx \ - GeometryGUI_CylinderDlg.cxx \ - GeometryGUI_ConeDlg.cxx \ - GeometryGUI_TorusDlg.cxx \ - GeometryGUI_FillingDlg.cxx \ - GeometryGUI_SewingDlg.cxx \ - GeometryGUI_CompoundDlg.cxx \ - GeometryGUI_EdgeDlg.cxx \ - GeometryGUI_OrientationDlg.cxx \ - GeometryGUI_PartitionDlg.cxx \ - GeometryGUI_SubShapeDlg.cxx \ - GeometryGUI_aParameterDlg.cxx \ - GeometryGUI_WireDlg.cxx \ - GeometryGUI_WorkingPlaneDlg.cxx \ - GeometryGUI_PropertiesDlg.cxx \ - GeometryGUI_InertiaDlg.cxx \ - GeometryGUI_CenterMassDlg.cxx \ - GeometryGUI_FaceDlg.cxx \ - GeometryGUI_BndBoxDlg.cxx \ - GeometryGUI_MaxToleranceDlg.cxx \ - GeometryGUI_WhatisDlg.cxx \ - GeometryGUI_DistanceDlg.cxx \ - GeometryGUI_SuppressFacesDlg.cxx \ - GeometryGUI_CheckShape.cxx \ - GeometryGUI_FilletDlg.cxx \ - GeometryGUI_ChamferDlg.cxx \ - GeometryGUI_MultiTranslationDlg.cxx \ - GeometryGUI_MultiRotationDlg.cxx \ - GeometryGUI_Swig.cxx \ - GeometryGUI_SuppressHoleDlg.cxx \ - -LIB_MOC = \ - GeometryGUI.h \ - GeometryGUI_SpinBox.h \ - GeometryGUI_TransparencyDlg.h \ - GeometryGUI_NbIsosDlg.h \ - GeometryGUI_BoxDlg.h \ - GeometryGUI_ArchimedeDlg.h \ - GeometryGUI_PointDlg.h \ - GeometryGUI_VectorDlg.h \ - GeometryGUI_PlaneDlg.h \ - GeometryGUI_PrismDlg.h \ - GeometryGUI_FuseDlg.h \ - GeometryGUI_SectionDlg.h \ - GeometryGUI_CommonDlg.h \ - GeometryGUI_CutDlg.h \ - GeometryGUI_LineDlg.h \ - GeometryGUI_ScaleDlg.h \ - GeometryGUI_MirrorDlg.h \ - GeometryGUI_SphereDlg.h \ - GeometryGUI_CircleDlg.h \ - GeometryGUI_RevolDlg.h \ - GeometryGUI_RotationDlg.h \ - GeometryGUI_TranslationDlg.h \ - GeometryGUI_ArcDlg.h \ - GeometryGUI_PipeDlg.h \ - GeometryGUI_CylinderDlg.h \ - GeometryGUI_ConeDlg.h \ - GeometryGUI_TorusDlg.h \ - GeometryGUI_FillingDlg.h \ - GeometryGUI_SewingDlg.h \ - GeometryGUI_CompoundDlg.h \ - GeometryGUI_EdgeDlg.h \ - GeometryGUI_OrientationDlg.h \ - GeometryGUI_PartitionDlg.h \ - GeometryGUI_SubShapeDlg.h \ - GeometryGUI_aParameterDlg.h \ - GeometryGUI_WireDlg.h \ - GeometryGUI_WorkingPlaneDlg.h \ - GeometryGUI_PropertiesDlg.h \ - GeometryGUI_InertiaDlg.h \ - GeometryGUI_CenterMassDlg.h \ - GeometryGUI_FaceDlg.h \ - GeometryGUI_BndBoxDlg.h \ - GeometryGUI_MaxToleranceDlg.h \ - GeometryGUI_WhatisDlg.h \ - GeometryGUI_DistanceDlg.h \ - GeometryGUI_SuppressFacesDlg.h \ - GeometryGUI_CheckShape.h \ - GeometryGUI_FilletDlg.h \ - GeometryGUI_ChamferDlg.h \ - GeometryGUI_MultiTranslationDlg.h \ - GeometryGUI_MultiRotationDlg.h \ - GeometryGUI_SuppressHoleDlg.h - -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ - -LIB_SERVER_IDL = - -# additionnal information to compil and link file - -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -CXXFLAGS += $(OCC_CXXFLAGS) - -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGeometryClient -lGeometryObject -lGeometryFiltersSelection -lGeometrySketcher $(OCC_LIBS) - -@CONCLUDE@ diff --git a/GEOM_SWIG/GEOM_Partition1.py b/GEOM_SWIG/GEOM_Partition1.py deleted file mode 100755 index 4eea3ff99..000000000 --- a/GEOM_SWIG/GEOM_Partition1.py +++ /dev/null @@ -1,98 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# -# -# File : GEOM_Partition1.py -# Module : GEOM - -#%Make geometry (like CEA script (A1)) using Partition algorithm% -# appel: -# import alveole_3D_01_GEOM -# reload(alveole_3D_01_GEOM) - -# -- Rayon de la bariere - -barier_height = 7.0 -barier_radius = 5.6 / 2 # Rayon de la bariere -colis_radius = 1.0 / 2 # Rayon du colis -colis_step = 2.0 # Distance s‰parant deux colis -cc_width = 0.11 # Epaisseur du complement de colisage - -# -- - -cc_radius = colis_radius + cc_width -from math import sqrt -colis_center = sqrt(2.0)*colis_step/2 - -# -- - -import geompy -geom = geompy.geom - -boolean_common = 1 -boolean_cut = 2 -boolean_fuse = 3 -boolean_section = 4 - -# -- - -barier = geompy.MakeCylinder( - geom.MakePointStruct(0.,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)), - barier_radius, - barier_height) - -# -- - -colis = geompy.MakeCylinder( - geom.MakePointStruct(0.,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)), - colis_radius, - barier_height) - -cc = geompy.MakeCylinder( - geom.MakePointStruct(0.,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)), - cc_radius, - barier_height) - -colis_cc = geompy.MakeCompound( - [colis._get_Name(), cc._get_Name()]) - -colis_cc = geompy.MakeTranslation( - colis_cc, colis_center, 0.0, 0.0) - -colis_cc_multi = geompy.MakeMultiRotation1D( - colis_cc, - geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)), - geom.MakePointStruct(0.,0.,0.), - 4) - -# -- - -alveole = geompy.Partition( - [colis_cc_multi._get_Name(), barier._get_Name()]) - -subshapes = geompy.SubShapeAll( alveole, geompy.ShapeType["SHAPE"] ) - -## there are 9 subshapes - -comp1 = geompy.MakeCompound( [ subshapes[0]._get_Name(), subshapes[1]._get_Name() ] ); -comp2 = geompy.MakeCompound( [ subshapes[2]._get_Name(), subshapes[3]._get_Name() ] ); -comp3 = geompy.MakeCompound( [ subshapes[4]._get_Name(), subshapes[5]._get_Name() ] ); -comp4 = geompy.MakeCompound( [ subshapes[6]._get_Name(), subshapes[7]._get_Name() ] ); - -compIORs = [] -compIORs.append( comp1._get_Name() ); -compIORs.append( comp2._get_Name() ); -compIORs.append( comp3._get_Name() ); -compIORs.append( comp4._get_Name() ); -comp = geompy.MakeCompound( compIORs ); - -alveole = geompy.MakeCompound( [ comp._get_Name(), subshapes[8]._get_Name() ]); - -geompy.addToStudy(alveole, "alveole") - - diff --git a/GEOM_SWIG/GEOM_Partition2.py b/GEOM_SWIG/GEOM_Partition2.py deleted file mode 100755 index db8ce8ec6..000000000 --- a/GEOM_SWIG/GEOM_Partition2.py +++ /dev/null @@ -1,148 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# -# -# File : GEOM_Partition2.py -# Module : GEOM - -#%Make geometry (like CEA script (A2)) using Partition algorithm% -# import callovo_01_GEOM -# reload(callovo_01_GEOM) - - -# -------------------------------------------- -# Geometrie avec une galerie perpendiculaire -# -------------------------------------------- - -import geompy -geom = geompy.geom - -# -- colis - -colis_xmin = 05.76 -colis_xmax = 19.83 -colis_radius = 0.3 - -colis = geompy.MakeCylinder( - geom.MakePointStruct(colis_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - colis_radius, - colis_xmax-colis_xmin) - -# -- bo - -bo_xmin = 04.83 -bo_xmax = colis_xmax -bo_radius = 1.23 - -bo = geompy.MakeCylinder( - geom.MakePointStruct(bo_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - bo_radius, - bo_xmax-bo_xmin) - - -# -- rupture alveole - -alvRup_xmin = 04.46 -alvRup_xmax = colis_xmax -alvRup_radius = 1.6 - -alvRup = geompy.MakeCylinder( - geom.MakePointStruct(alvRup_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - alvRup_radius, - alvRup_xmax-alvRup_xmin) - - -# bouchon - -bouchon_xmin = colis_xmax -bouchon_xmax = 22.83 -bouchon_radius = alvRup_radius - -bouchon = geompy.MakeCylinder( - geom.MakePointStruct(bouchon_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - bouchon_radius, - bouchon_xmax-bouchon_xmin) - -# galerie - -galerie_xmax = 25.0 -galerie_radius = 3.0 -box_y = 30.0 - -galerie = geompy.MakeCylinder( - geom.MakePointStruct(galerie_xmax,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)), - galerie_radius, - box_y) -galerie = geompy.MakeTranslation(galerie, 0, -box_y/2, 0) - -# -- box - -box = geompy.MakeBox(0., 0., 0., galerie_xmax, box_y, box_y) -box = geompy.MakeTranslation(box, 0.0, -box_y/2, -box_y/2) - - -# -- rupture galerie - -galRup_xmax = galerie_xmax -galRup_radius = 3.9 - -galRup = geompy.MakeCylinder( - geom.MakePointStruct(galerie_xmax,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)), - galRup_radius, - box_y) -galRup = geompy.MakeTranslation(galRup, 0, -box_y/2, 0) - -# -- endommagement galerie - -galEnd_xmax = galerie_xmax -galEnd_radius = 4.6 - -galEnd = geompy.MakeCylinder( - geom.MakePointStruct(galerie_xmax,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)), - galEnd_radius, - box_y) -galEnd = geompy.MakeTranslation(galEnd, 0, -box_y/2, 0) - -# -- endommagement alveole - -alvEnd_xmin = 03.6 -alvEnd_xmax = galerie_xmax -alvEnd_radius = 2.46 - -alvEnd = geompy.MakeCylinder( - geom.MakePointStruct(alvEnd_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - alvEnd_radius, - alvEnd_xmax-alvEnd_xmin) - -# remove internal parts of galEnd intersecting alvEnd - -galEnd_alvEnd = geompy.Partition( - [ alvEnd._get_Name() ] , [], [], [ galEnd._get_Name() ] ) - -iorL = [ colis._get_Name() ] -iorL += [ bo._get_Name() ] -iorL += [ alvRup._get_Name() ] -#iorL += [ galerie._get_Name() ] -iorL += [ galRup._get_Name() ] -iorL += [ galEnd_alvEnd._get_Name() ] - -# -- - -# remove section parts outside bo and inside bouchon - -callovo = geompy.Partition( - iorL, [], [ box._get_Name() ], [galerie._get_Name(), bouchon._get_Name()] ) - - - -geompy.addToStudy(callovo, "callovo perp. 2") diff --git a/GEOM_SWIG/GEOM_Partition3.py b/GEOM_SWIG/GEOM_Partition3.py deleted file mode 100755 index d325f848e..000000000 --- a/GEOM_SWIG/GEOM_Partition3.py +++ /dev/null @@ -1,141 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# -# -# File : GEOM_Partition3.py -# Module : GEOM - -#%Make geometry (like CEA script (A2)) using Partition algorithm% -# import callovo_01_GEOM -# reload(callovo_01_GEOM) - - -import geompy -geom = geompy.geom - -# -- colis - -colis_xmin = 05.76 -colis_xmax = 19.83 -colis_radius = 0.3 - -colis = geompy.MakeCylinder( - geom.MakePointStruct(colis_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - colis_radius, - colis_xmax-colis_xmin) - -iorL = [colis._get_Name()] - -# -- bo - -bo_xmin = 04.83 -bo_xmax = colis_xmax -bo_radius = 1.23 - -bo = geompy.MakeCylinder( - geom.MakePointStruct(bo_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - bo_radius, - bo_xmax-bo_xmin) - -iorL.append(bo._get_Name()) - -# -- rupture alveole - -alvRup_xmin = 04.46 -alvRup_xmax = colis_xmax -alvRup_radius = 1.6 - -alvRup = geompy.MakeCylinder( - geom.MakePointStruct(alvRup_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - alvRup_radius, - alvRup_xmax-alvRup_xmin) - -iorL.append(alvRup._get_Name()) - -# bouchon - -bouchon_xmin = colis_xmax -bouchon_xmax = 22.83 -bouchon_radius = alvRup_radius - -bouchon = geompy.MakeCylinder( - geom.MakePointStruct(bouchon_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - bouchon_radius, - bouchon_xmax-bouchon_xmin) - -#iorL.append(bouchon._get_Name()) - -# -- endommagement alveole - -alvEnd_xmin = 03.6 -alvEnd_xmax = 20.66 -alvEnd_radius = 2.46 - -alvEnd = geompy.MakeCylinder( - geom.MakePointStruct(alvEnd_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - alvEnd_radius, - alvEnd_xmax-alvEnd_xmin) - -iorL.append(alvEnd._get_Name()) - -# galerie - -galerie_xmin = bouchon_xmax -galerie_xmax = 25.0 -galerie_radius = 2.17 - -galerie = geompy.MakeCylinder( - geom.MakePointStruct(galerie_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - galerie_radius, - galerie_xmax-galerie_xmin) - -iorL.append(galerie._get_Name()) - -# -- rupture galerie - -galRup_xmin = 22.18 -galRup_xmax = galerie_xmax -galRup_radius = 2.82 - -galRup = geompy.MakeCylinder( - geom.MakePointStruct(galRup_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - galRup_radius, - galRup_xmax-galRup_xmin) - -iorL.append(galRup._get_Name()) - -# -- endom. galerie - -galEnd_xmin = alvEnd_xmax -galEnd_xmax = galerie_xmax -galEnd_radius = 4.34 - -galEnd = geompy.MakeCylinder( - geom.MakePointStruct(galEnd_xmin,0.,0.), - geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)), - galEnd_radius, - galEnd_xmax-galEnd_xmin) - -iorL.append(galEnd._get_Name()) - -# -- - -box_y = 30.0 -box = geompy.MakeBox(0., 0., 0., galerie_xmax, box_y, box_y) -box = geompy.MakeTranslation(box, 0.0, -box_y/2, -box_y/2) - -iorL.append(box._get_Name()) - -# -- - -callovo = geompy.Partition(iorL,[],[], [bouchon._get_Name()]) -geompy.addToStudy(callovo, "callovo 2") diff --git a/GEOM_SWIG/GEOM_Partition4.py b/GEOM_SWIG/GEOM_Partition4.py deleted file mode 100755 index 17c7632c9..000000000 --- a/GEOM_SWIG/GEOM_Partition4.py +++ /dev/null @@ -1,87 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# -# -# File : GEOM_Partition4.py -# Module : GEOM - -#%Make geometry (like CEA script (A3)) using Partition algorithm% -# import couplex2_01_GEOM -# reload(couplex2_01_GEOM) - -# Dimensions de alveolus -# Parall‰pipˆde rectangle de taille alDx, alDy, alDz - -alDx = 2.5 -alDy = 20.0 -alDz = 2.5 -alSepx = 18.0 - -# Dimensions de backfill -# Parall‰pipˆde rectangle de taille baDx, baDy, baDz - -baDx = 27.0 -baDy = 4.8 -baDz = 4.8 - -# Dimensions de geological medium - -gmDx = baDx -gmDy = 49.6 -gmDz = 100.0 - -# -- - -import geompy -geom = geompy.geom - -# -- Construction de backfill - -backA = geompy.MakeBox(0.0,0.0,0.0,baDx,baDy,baDz) -back = geompy.MakeTranslation(backA,-baDx/2,-baDy/2,-baDz/2) - -# -- Construction de alveolus - -import math - -alveA = geompy.MakeBox(0.0,0.0,0.0,alDx,alDy,alDz) -alveB = geompy.MakeTranslation(alveA,-alDx/2,baDy/2,-alDz/2) -axis = geompy.geom.MakeAxisStruct(0.0,0.0,0.0,1.0,0.0,0.0) -alve1 = geompy.MakeRotation(alveB,axis,math.pi) -alve2 = geompy.MakeTranslation(alveB,+alSepx/2,0.0,0.0) -alve3 = geompy.MakeTranslation(alveB,-alSepx/2,0.0,0.0) -IORlist = [] -IORlist.append(alve1._get_Name()) -IORlist.append(alve2._get_Name()) -IORlist.append(alve3._get_Name()) -alve = geompy.MakeCompound(IORlist) - -# -- Construction de geological medium - -geolA = geompy.MakeBox(0.0,0.0,0.0,gmDx,gmDy,gmDz) -geol = geompy.MakeTranslation(geolA,-gmDx/2,-gmDy/2,-gmDz/2) - -geol = geompy.Partition( - [alve._get_Name(), geol._get_Name(), back._get_Name()]) - -subshapes = geompy.SubShapeAll( geol, geompy.ShapeType["SHAPE"] ) - -IORlist = [] -IORlist.append(subshapes[0]._get_Name()) -IORlist.append(subshapes[1]._get_Name()) -IORlist.append(subshapes[2]._get_Name()) -alve = geompy.MakeCompound(IORlist) - -geol = subshapes[3] -back = subshapes[4] - -# -- - -geol = geompy.MakeCompound( - [geol._get_Name(), back._get_Name(), alve._get_Name()]) - -geompy.addToStudy(geol,"couplex2 2") - - diff --git a/GEOM_SWIG/GEOM_Partition5.py b/GEOM_SWIG/GEOM_Partition5.py deleted file mode 100755 index cbc1c5c5f..000000000 --- a/GEOM_SWIG/GEOM_Partition5.py +++ /dev/null @@ -1,103 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# -# -# File : GEOM_Partition5.py -# Module : GEOM - -#%Make geometry (like CEA script (A4)) using Partition algorithm% -# import gallery_01_GEOM -# reload(gallery_01_GEOM) - -# -- Import geompy pour piloter GEOM par script - -import geompy -geom = geompy.geom - -# -- Dimensions de la boite entiˆre - -LX, LY, LZ = 300.0, 150.0, 150.0 - -# -- D‰finition du plan de sym‰trie (O,Ox,Oz) - -symPlane = geompy.MakePlane ( - geom.MakePointStruct(0.,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)), - 10.0 ) - -# -- bo - -bo = geompy.MakeBox(0.0,0.0,0.0,LX,LY,LZ) -bo = geompy.MakeTranslation(bo,0.0,-LY/2,-LZ/2) - -# -- Galerie principale - -gal_diam = 80.0 -gal_lony = LY -gal_x = LX-20.0-gal_diam/2 -gal = geompy.MakeCylinder( - geom.MakePointStruct(0.,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)), - gal_diam/2,gal_lony) -gal = geompy.MakeTranslation(gal,gal_x,-gal_lony/2,0.0) - -# -- Galerie perpendiculaire -# -- Dimensions de la galerie perpendiculaire -# -- La longueur est compt‰e € partir du centre -# -- de la galerie principale - -gpe_long, gpe_diam = 200.0, 60.0 -gpe_x = gal_x -gpe = geompy.MakeCylinder( - geom.MakePointStruct(0.,0.,0.), - geom.MakeDirection(geom.MakePointStruct(-1.,0.,0.)), - gpe_diam/2,gpe_long) -gpe = geompy.MakeTranslation(gpe,gpe_x,0,0) - -# -- Dimensions d'une alveole -# -- Construction d'une alv‰ole - -alv_long, alv_diam = 60.0, 18.0 -alv01 = geompy.MakeCylinder( - geom.MakePointStruct(0.,0.,0.), - geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)), - alv_diam/2,alv_long) -alv02 = geompy.MakeMirrorByPlane(alv01,symPlane) -alv0 = geompy.MakeCompound( [ alv01._get_Name(), alv02._get_Name() ] ) - -# -- Construction des alv‰oles - -alv_del, alv_sep = 40.0, 35.0 -alv1 = geompy.MakeTranslation ( - alv0,gal_x-gal_diam/2-alv_sep,0.0,0.0 ) -alv2 = geompy.MakeTranslation ( - alv1,-alv_del,0.0,0.0 ) -alv3 = geompy.MakeTranslation ( - alv2,-alv_del,0.0,0.0 ) -alv = geompy.MakeCompound( [ alv1._get_Name(), alv2._get_Name(), alv3._get_Name() ] ) - -# -- Remplissage de la BO - -gallery = geompy.Partition( - [ alv._get_Name(), bo._get_Name() ], [], [], [ gal._get_Name(), gpe._get_Name() ]) - -subshapes = geompy.SubShapeAll( gallery, geompy.ShapeType["SHAPE"] ) - -alvIORs = [] -alvIORs.append( subshapes[0]._get_Name() ) -alvIORs.append( subshapes[1]._get_Name() ) -alvIORs.append( subshapes[2]._get_Name() ) -alvIORs.append( subshapes[3]._get_Name() ) -alvIORs.append( subshapes[4]._get_Name() ) -alvIORs.append( subshapes[5]._get_Name() ) -alvcomp = geompy.MakeCompound( alvIORs ) - -boIOR = subshapes[6]._get_Name() -galIOR = subshapes[7]._get_Name() -gpeIOR = subshapes[8]._get_Name() - -gallery = geompy.MakeCompound( [ boIOR, alvcomp._get_Name(), gpeIOR, galIOR ] ) - -geompy.addToStudy(gallery,"Gallery 2") diff --git a/GEOM_SWIG/GEOM_example.py b/GEOM_SWIG/GEOM_example.py deleted file mode 100644 index e293a3e57..000000000 --- a/GEOM_SWIG/GEOM_example.py +++ /dev/null @@ -1,47 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : GEOM_example.py -# Author : Paul RASCLE, EDF -# Module : GEOM -# $Header$ - -import salome -import geompy - -ind = 0 -boxlist = [] -while ind < 5: - x1 = 10. * ind - y1 = 0. - z1 = 0. - x2 = 10. * (ind+1) - y2 = 20. * (ind+1) - z2 = 30. * (ind+1) - print x1, y1, z1, x2, y2, z2 - name = "box%d"%(ind) - box = geompy.MakeBox(x1, y1, z1, x2, y2, z2) - id_box = geompy.addToStudy(box, name) - boxlist.append(box) - ind = ind +1 - diff --git a/GEOM_SWIG/GEOM_example2.py b/GEOM_SWIG/GEOM_example2.py deleted file mode 100644 index 8d462a940..000000000 --- a/GEOM_SWIG/GEOM_example2.py +++ /dev/null @@ -1,64 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : GEOM_example2.py -# Author : Paul RASCLE, EDF -# Module : GEOM -# $Header$ - -import salome -import geompy -import math - -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") -myBuilder = salome.myStudy.NewBuilder() - -point0 = geom.MakePointStruct(0.,0.,0.) -pointz1 = geom.MakePointStruct(0.,0.,1.) -dirz = geom.MakeDirection(pointz1) - -torus1 = geompy.MakeTorus(point0,dirz,150.,25.) -id_torus1 = geompy.addToStudy(torus1,"torus1") - -torus2 = geom.MakeCopy(torus1) -torus2 = geom.MakeTranslation(torus2,0.,0.,100.) -id_torus2 = geompy.addToStudy(torus2,"torus2") - -cylz1 = geompy.MakeCylinder(point0,dirz,25.,100.) - -ind = 0 -cyllist = [] -while ind < 6: - acyl = geom.MakeCopy(cylz1) - x = 150. * math.cos(ind * math.pi/3.) - y = 150. * math.sin(ind * math.pi/3.) - z = 0. - name = "cyl%d"%(ind) - acyl = geompy.MakeTranslation(acyl,x,y,z) - id_acyl = geompy.addToStudy(acyl,name) - cyllist.append(acyl) - ind = ind +1 - - - - diff --git a/GEOM_SWIG/GEOM_example3.py b/GEOM_SWIG/GEOM_example3.py deleted file mode 100644 index 66a699971..000000000 --- a/GEOM_SWIG/GEOM_example3.py +++ /dev/null @@ -1,112 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : GEOM_example3.py -# Author : Paul RASCLE, EDF -# Module : GEOM -# $Header$ - -import salome -import geompy -import math -from time import sleep - -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") -myBuilder = salome.myStudy.NewBuilder() - -gg = salome.ImportComponentGUI("Geometry") - -point0 = geom.MakePointStruct(0.,0.,0.) -pointz1 = geom.MakePointStruct(0.,0.,1.) -dirz = geom.MakeDirection(pointz1) - -torus1 = geompy.MakeTorus(point0,dirz,150.,25.) -id_torus1 = geompy.addToStudy(torus1,"torus1") -gg.createAndDisplayGO(id_torus1) - -torus2 = geom.MakeCopy(torus1) -torus2 = geom.MakeTranslation(torus2,0.,0.,100.) -id_torus2 = geompy.addToStudy(torus2,"torus2") -gg.createAndDisplayGO(id_torus2) - -cylz1 = geompy.MakeCylinder(point0,dirz,25.,100.) - -ind = 0 -shapeList = [] -idList = [] -while ind < 6: - acyl = geom.MakeCopy(cylz1) - x = 150. * math.cos(ind * math.pi/3.) - y = 150. * math.sin(ind * math.pi/3.) - z = 0. - name = "cyl%d"%(ind) - acyl = geompy.MakeTranslation(acyl,x,y,z) - id_acyl = geompy.addToStudy(acyl,name) - gg.createAndDisplayGO(id_acyl) - shapeList.append(acyl) - idList.append(id_acyl) - ind = ind +1 - -shapeList.append(torus1) -shapeList.append(torus2) -idList.append(id_torus1) -idList.append(id_torus2) - -iorStringList = [] -for shape in shapeList: - iorStringList.append(shape._get_Name()) - -cage = geompy.MakeCompound(iorStringList) -id_cage = geompy.addToStudy(cage,"cage") -gg.createAndDisplayGO(id_cage) - -from salome import sg -sleep(1) -sg.EraseAll() -for id in idList: - sg.DisplayOnly(id) - sleep(1) -sg.EraseAll() -for id in idList: - sg.Display(id) - sleep(1) -for id in idList: - sg.Erase(id) - sleep(1) - -#sg.Display(id_cage) -sg.Display(id_torus1) -sg.Display(id_torus2) -sg.Display(id_acyl) - -gg.setTransparency(id_torus1,0.5) - -gg.setDisplayMode(id_torus1,1) -gg.setDisplayMode(id_torus2,1) -gg.setDisplayMode(id_acyl,1) -#gg.setDisplayMode(id_cage,1) - -gg.setColor(id_torus1,0,0,255) -gg.setColor(id_torus2,255,0,0) -gg.setColor(id_acyl,0,255,0) -#gg.setColor(id_cage,255,255,0) \ No newline at end of file diff --git a/GEOM_SWIG/GEOM_example4.py b/GEOM_SWIG/GEOM_example4.py deleted file mode 100755 index 1736af047..000000000 --- a/GEOM_SWIG/GEOM_example4.py +++ /dev/null @@ -1,116 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : GEOM_example4.py -# Module : GEOM - -import SMESH -import smeshpy -import salome -from salome import sg -import math -#import SMESH_BasicHypothesis_idl - -import geompy - -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") -myBuilder = salome.myStudy.NewBuilder() -from geompy import gg - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId); - -ShapeTypeCompSolid = 1 -ShapeTypeSolid = 2 -ShapeTypeShell = 3 -ShapeTypeFace = 4 -ShapeTypeWire = 5 -ShapeTypeEdge = 6 -ShapeTypeVertex = 7 - -pi=math.pi - -# --------------------------------------------- -xa=math.sin(pi/12) -ya=0 -za=math.cos(pi/12) - -xb=0 -yb=math.sin(pi/18) -zb=math.cos(pi/18) - -xc=math.cos(-pi/18) -yc=0 -zc=math.sin(-pi/18) - -rc1=150 -hc1=300 -rc2=150 -rc3=150 -rc4=300 -# --------------------------------------------- -point_0 = geom.MakePointStruct(0, 0, 0) -point_z = geom.MakePointStruct(0, 0, 1) - -point_a = geom.MakePointStruct(xa, ya, za) -point_b = geom.MakePointStruct(xb, yb, zb) -point_c = geom.MakePointStruct(xc, yc, zc) - -dir_z = geom.MakeDirection(point_z) -axe_z = geom.MakeAxisStruct(0, 0, 0, 0, 0, 1) - -dir_a = geom.MakeDirection(point_a) -axe_a = geom.MakeAxisStruct(0, 0, 0, xa, ya, za) - -dir_b = geom.MakeDirection(point_b) -axe_b = geom.MakeAxisStruct(0, 0, 0, xb, yb, zb) - -dir_c = geom.MakeDirection(point_c) -axe_c = geom.MakeAxisStruct(0, 0, 0, xc, yc, zc) - -cyl_1 = geompy.MakeCylinder(point_0, dir_z, rc1, hc1) - -hc2=2*hc1 -cyl_t = geompy.MakeCylinder(point_0, dir_a, rc2, hc2) -cyl_a = geompy.MakeTranslation(cyl_t, 1.2*rc1, 0.1*rc1, -0.5*hc1) - -hc3=2*hc1 -cyl_t = geompy.MakeCylinder(point_0, dir_b, rc3, hc3) -cyl_b = geompy.MakeTranslation(cyl_t, -1.2*rc1, -0.1*rc1, -0.5*hc1) - -hc4=2*hc1 -cyl_t = geompy.MakeCylinder(point_0, dir_c, rc4, hc4) -cyl_t = geompy.MakeRotation(cyl_t, axe_c, pi/2) -cyl_c = geompy.MakeTranslation(cyl_t, -hc1, 0, 0) -cyl_d = geompy.MakeTranslation(cyl_t, -hc1, 0, 1.3*rc4) - -inter_t = geompy.MakeBoolean(cyl_c,cyl_d, 1) # common - -blob_t = geompy.MakeBoolean(cyl_1, cyl_a, 2) # cut -blob_t = geompy.MakeBoolean(blob_t, cyl_b, 2) - -blob = geompy.MakeBoolean(blob_t, inter_t, 1) # common - -idblob = geompy.addToStudy(blob,"blob") -#idc = geompy.addToStudy(cyl_c,"cyl_c") -#idd = geompy.addToStudy(cyl_d,"cyl_d") diff --git a/GEOM_SWIG/GEOM_moteur.py b/GEOM_SWIG/GEOM_moteur.py deleted file mode 100644 index cf01b08c0..000000000 --- a/GEOM_SWIG/GEOM_moteur.py +++ /dev/null @@ -1,154 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : GEOM_moteur.py -# Author : Damien COQUERET, Open CASCADE -# Module : GEOM -# $Header$ - -import salome -import geompy -import math - -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") -myBuilder = salome.myStudy.NewBuilder() - -#Variables modifiables -PosX = 0 #Position du cylindre dans l'espace -PosY = 0 #Il est oriente suivant Z -PosZ = 0 -NbBranches = 7 #>2 -HauteurT = 70 #Hauteur total du stator - -#Varaibles -Angle1 = 2 * math.pi / NbBranches -Angle2 = Angle1 / 2 -HauteurR = HauteurT / 3 -Ep = HauteurT / 10 -DExtExt = HauteurT * 6 / 7 -DExtInt = DExtExt - Ep -DIntExt = DExtExt / 3 -DIntInt = DExtExt / 4 -EpRot = DIntExt * math.sin(Angle2) -Pos1C = PosX + DIntExt * math.cos(Angle2) -Pos1S = PosY + DIntExt * math.sin(Angle2) -PosCour = PosZ + HauteurT * 4 / 7 -PosRot = PosZ + 0.9 * HauteurT - -#Points -P0 = geom.MakePointStruct(0, 0, 1) -P1 = geom.MakePointStruct(PosX, PosY, PosZ) -P2 = geom.MakePointStruct(PosX, PosY, PosZ + Ep) -P3 = geom.MakePointStruct(PosX, PosY, PosCour) -P4 = geom.MakePointStruct(PosX, PosY, PosCour + Ep) -P5 = geom.MakePointStruct(PosX, PosY, PosRot) -P6 = geom.MakePointStruct(Pos1C, Pos1S, PosZ) -P7 = geom.MakePointStruct(PosX + DExtExt, Pos1S, PosZ) -P8 = geom.MakePointStruct(Pos1C, Pos1S, PosZ + HauteurT) - -#Vecteurs -V1 = geom.MakeDirection(P0) -V2 = geom.MakeAxisStruct(PosX, PosY, PosZ, 0, 0, 1) -V3 = geom.MakeAxisStruct(Pos1C, Pos1S, PosZ, 0, 0, 1) - -#Cylindre central -C0 = geompy.MakeCylinder(P1, V1, DIntInt, PosCour + Ep - PosZ) -C01 = geompy.MakeCylinder(P1, V1, DIntExt, PosCour + Ep - PosZ) -Cylindre = geompy.MakeBoolean(C01, C0, 2) -#Id_Cyl = geompy.addToStudy(Cylindre, "Cylindre") - -#Camemberts de coupe -B1 = geompy.MakeVector(P6, P7) -B2 = geompy.MakePrism(B1, P6, P8) -S0 = geompy.MakeRevolution(B2, V3, Angle1) -CoupeList = [] -CoupeList.append(S0) -Ind = 1 -while Ind < NbBranches : - S = geompy.MakeRotation(S0, V2, Ind * Angle1) - CoupeList.append(S) - Ind = Ind + 1 -IorCoupeList = [] -for CoupeShape in CoupeList : - IorCoupeList.append(CoupeShape._get_Name()) -Coupe1 = geompy.MakeCompound(IorCoupeList) -#Id_Coupe1 = geompy.addToStudy(Coupe1, "Coupe1") - -#Couronne1 -C1 = geompy.MakeCylinder(P1, V1, DExtExt, HauteurT) -C2 = geompy.MakeCylinder(P2, V1, DExtInt, HauteurT) -C3 = geompy.MakeBoolean(C1, C2, 2) -C31 = geompy.MakeBoolean(C3, C0, 2) -Couronne1 = geompy.MakeBoolean(C31, Coupe1, 2) -#Id_Couronne1 = geompy.addToStudy(Couronne1, "Couronne1") - -#Couronne2 -C4 = geompy.MakeCylinder(P3, V1, DExtExt, PosZ + HauteurT - PosCour) -C5 = geompy.MakeCylinder(P4, V1, DExtInt, HauteurT) -Coupe2 = geompy.MakeRotation(Coupe1, V2, Angle2) -C6 = geompy.MakeBoolean(C4, C5, 2) -C61 = geompy.MakeBoolean(C6, C0, 2) -Couronne2 = geompy.MakeBoolean(C61, Coupe2, 2) -#Id_Couronne2 = geompy.addToStudy(Couronne2, "Couronne2") - -#Rotor1 -C9 = geompy.MakeCylinder(P5, V1, DIntExt, HauteurR) -C10 = geompy.MakeCylinder(P5, V1, DIntExt / 4, 2 * HauteurR) -Rotor1List = [] -Rotor1List.append(C9) -Rotor1List.append(C10) -IorRotor1List = [] -for Rotor1Shape in Rotor1List : - IorRotor1List.append(Rotor1Shape._get_Name()) -Rotor1 = geompy.MakeCompound(IorRotor1List) -Id_Rotor1 = geompy.addToStudy(Rotor1, "Rotor1") - -#Rotor2 -D0 = geompy.MakeBox(2 * Pos1C - PosX, -Pos1S + 2 * PosY, PosRot, 2 * Pos1C + EpRot - PosX, Pos1S, PosRot + EpRot / 2) -Rotor2List = [] -Rotor2List.append(D0) -Ind = 1 -while Ind < NbBranches : - R = geompy.MakeRotation(D0, V2, Ind * Angle1) - Rotor2List.append(R) - Ind = Ind + 1 -IorRotor2List = [] -for Rotor2Shape in Rotor2List : - IorRotor2List.append(Rotor2Shape._get_Name()) -Rotor2 = geompy.MakeCompound(IorRotor2List) -Id_Rotor2 = geompy.addToStudy(Rotor2, "Rotor2") - -#Rotor3 -Rotor3 = geompy.MakeRotation(Rotor2, V2, Angle2) -Id_Rotor3 = geompy.addToStudy(Rotor3, "Rotor3") - -#Stator -StatorList = [] -StatorList.append(Cylindre) -StatorList.append(Couronne1) -StatorList.append(Couronne2) -IorStatorList = [] -for StatorShape in StatorList : - IorStatorList.append(StatorShape._get_Name()) -Stator = geompy.MakeCompound(IorStatorList) -Id_Stator = geompy.addToStudy(Stator, "Stator") diff --git a/GEOM_SWIG/GEOM_usinggeom.py b/GEOM_SWIG/GEOM_usinggeom.py deleted file mode 100644 index 8ac2790cd..000000000 --- a/GEOM_SWIG/GEOM_usinggeom.py +++ /dev/null @@ -1,252 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : GEOM_usinggeom.py -# Author : Damien COQUERET, Open CASCADE -# Module : GEOM -# $Header$ - -import salome -import geompy -import math - -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") -myBuilder = salome.myStudy.NewBuilder() - -from geompy import gg - -#Create base Variables -nbtimes1 = 5 #Short -nbtimes2 = 5 -mindeg = 2 -maxdeg = 5 -nbiter = 5 -ShapeTypeFace = 4 -ShapeTypeEdge = 6 -WantPlanarFace = 1 #True - -radius = 10. #Double -radius1 = 100. -radius2 = 200. -height = 200. -d1 = 10. -d2 = 10. -step1 = 250. -step2 = 250. -angle = 45. -angle1 = angle * math.pi / 180 -angle2 = 2 * angle1 -factor = 2. -tol3d = 0.0001 -tol2d = 0.0001 -weight = 1000000. -waterdensity = 1. -meshingdeflection = 0.01 -trimsize = 1000. -precision = 0.00001 - -#Create base points -p0 = geom.MakePointStruct(0., 0., 0.) #(Double, Double, Double)->PointStruct -px = geom.MakePointStruct(100., 0., 0.) -py = geom.MakePointStruct(0., 100., 0.) -pz = geom.MakePointStruct(0., 0., 100.) -pxyz = geom.MakePointStruct(100., 100., 100.) - -#Create base directions -vx = geom.MakeDirection(px) #(PointStruct)->DirStruct -vy = geom.MakeDirection(py) -vz = geom.MakeDirection(pz) -vxyz = geom.MakeDirection(pxyz) -ax = geom.MakeAxisStruct(0., 0., 0., 100., 0., 0.) #(Double, Double, Double, Double, Double, Double)->AxisStruct -axy = geom.MakeAxisStruct(100., 0., 0., -100., 100., 0.) -ay = geom.MakeAxisStruct(0., 0., 0., 0., 100., 0.) -az = geom.MakeAxisStruct(0., 0., 0., 0., 0., 100.) - -#Create base geometry 2D -Vertex = geom.MakeVertex(100., 50., 200.) #(Double, Double, Double)->GEOM_Shape_ptr -Vector = geom.MakeVector(px, py) #(PointStruct, PointStruct)->GEOM_Shape_ptr -Line = geom.MakeLine(p0, vxyz) #(PointStruct, DirStruct)->GEOM_Shape_ptr -Arc = geom.MakeArc(py, pz, px) #(PointStruct, PointStruct, PointStruct)->GEOM_Shape_ptr -Circle = geom.MakeCircle(p0, vz, radius1) #(PointStruct, DirStruct, Double)->GEOM_Shape_ptr -Plane = geom.MakePlane(pz, vxyz, trimsize) #(PointStruct, DirStruct, Double)->GEOM_Shape_ptr - -#Create base geometry 3D -Box = geompy.MakeBox(0., 0., 0., 200., 200., 200.) #(Double, Double, Double)->GEOM_Shape_ptr -Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(Double, Double, Double)->GEOM_Shape_ptr -Sphere = geompy.MakeSphere(0., 0., 0., radius1) #(Double, Double, Double)->GEOM_Shape_ptr -Cone = geompy.MakeCone(p0, vz, radius2, radius, height) #(PointStruct)->DirStruct -Torus = geompy.MakeTorus(p0, vz, radius2, radius) #(Double, Double, Double)->GEOM_Shape_ptr - -#Boolean (Common, Cut, Fuse, Section) -Common = geompy.MakeBoolean(Box, Sphere, 1) #(GEOM_Shape_ptr, GEOM_Shape_ptr, Short)->GEOM_Shape_ptr -Cut = geompy.MakeBoolean(Box, Sphere, 2) -Fuse = geompy.MakeBoolean(Box, Sphere, 3) -Section = geompy.MakeBoolean(Box, Sphere, 4) - -#IORList for Wire -ShapeListWire = [] -IORListWire = [] -ShapeListWire.append(Vector) -ShapeListWire.append(Arc) -for Shape in ShapeListWire : - IORListWire.append(Shape._get_Name()) - -#IORList for Compound -ShapeListCompound = [] -IORListCompound = [] -i = 0 -while i <= 3 : - S = geompy.MakeTranslation(Arc, i * 100., i * 100., i * 100.) - ShapeListCompound.append(S) - i = i + 1 -for Shape in ShapeListCompound : - IORListCompound.append(Shape._get_Name()) - -#Create base objects -Edge = geompy.MakeEdge(p0, pxyz) #(PointStruct, PointStruct)->GEOM_Shape_ptr -Wire = geompy.MakeWire(IORListWire) #(ListOfIOR)->GEOM_Shape_ptr -Face = geompy.MakeFace(Wire, WantPlanarFace) #(GEOM_Shape_ptr, Boolean)->GEOM_Shape_ptr -Compound = geompy.MakeCompound(IORListCompound) #(ListOfIOR)->GEOM_Shape_ptr - -#IORList for Sewing -ShapeListSewing = [] -IORListSewing = [] -ShapeListSewing.append(Face) -S = geompy.MakeRotation(Face, axy, angle1) -ShapeListSewing.append(S) -for Shape in ShapeListSewing : - IORListSewing.append(Shape._get_Name()) - -#Create advanced objects -Copy = geompy.MakeCopy(Box) #(GEOM_Shape_ptr)->GEOM_Shape_ptr -Prism = geompy.MakePrism(Face, p0, pz) #(GEOM_Shape_ptr, PointStruct, PointStruct)->GEOM_Shape_ptr -#Revolution = geompy.MakeRevolution(Face, az, angle2) #(GEOM_Shape_ptr, AxisStruct, Double)->GEOM_Shape_ptr -Filling = geompy.MakeFilling(Compound, mindeg, maxdeg, tol3d, tol2d, nbiter) #(GEOM_Shape_ptr, Short, Short, Double, Double, Short)->GEOM_Shape_ptr -Pipe = geompy.MakePipe(Edge, Wire) #(GEOM_Shape_ptr, GEOM_Shape_ptr)->GEOM_Shape_ptr -Sewing = geompy.MakeSewing(IORListSewing, precision) #(ListOfIOR, Double)->GEOM_Shape_ptr - -#IDList for Fillet/Chamfer -IDlist = [] -i = 1 -while i <= 3 : - IDlist.append(i) - i = i + 1 - -#Transform objects -Translation = geompy.MakeTranslation(Box, 300., 300., 300.) #(GEOM_Shape_ptr, Double, Double, Double)->GEOM_Shape_ptr -Rotation = geompy.MakeRotation(Box, az, angle1) #(GEOM_Shape_ptr, AxisStruct, Double)->GEOM_Shape_ptr -Scale = geompy.MakeScaleTransform(Box, p0, factor) #(GEOM_Shape_ptr, PointStruct, Double)->GEOM_Shape_ptr -Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(GEOM_Shape_ptr, GEOM_Shape_ptr)->GEOM_Shape_ptr -Orientation = geompy.OrientationChange(Box) #(GEOM_Shape_ptr)->GEOM_Shape_ptr -Fillet = geompy.MakeFillet (Prism, radius, ShapeTypeEdge, IDlist) #(GEOM_Shape_ptr, Double, Short, ListOfSubShapeID)->GEOM_Shape_ptr -Chamfer = geompy.MakeChamfer(Prism, d1, d2, ShapeTypeEdge, IDlist) #(GEOM_Shape_ptr, Double, Double, Short, ListOfSubShapeID)->GEOM_Shape_ptr - -#Create Patterns -MultiTrans1D = geompy.MakeMultiTranslation1D(Fillet, vz, step1, nbtimes1) #(GEOM_Shape_ptr, DirStruct, Double, Short)->GEOM_Shape_ptr -MultiTrans2D = geompy.MakeMultiTranslation2D(Fillet, vz, step1, nbtimes1, vy, step2, nbtimes2) #(GEOM_Shape_ptr, DirStruct, Double, Short, DirStruct, Double, Short)->GEOM_Shape_ptr -#!!!!Angle In Degree!!!! -MultiRot1D = geompy.MakeMultiRotation1D(Chamfer, vx, px, nbtimes1) #(GEOM_Shape_ptr, DirStruct, PointStruct, Short)->GEOM_Shape_ptr -MultiRot2D = geompy.MakeMultiRotation2D(Chamfer, vx, px, angle, nbtimes1, step1, nbtimes2) #(GEOM_Shape_ptr, DirStruct, PointStruct, Double, Short, Double, Short)->GEOM_Shape_ptr - -#IDList for Partition -ShapeListPartition1 = [] -ShapeListPartition1.append(Box) -IORListPartition1 = [] -for Shape in ShapeListPartition1 : - IORListPartition1.append(Shape._get_Name()) -ShapeListPartition2 = [] -ShapeListPartition2.append(Plane) -IORListPartition2 = [] -for Shape in ShapeListPartition2 : - IORListPartition2.append(Shape._get_Name()) - -#IDList for SubShape -IDlistSubShape = [] -IDlistSubShape.append(3) - -#Create Informations objects -CDG = geompy.MakeCDG(Prism) #(GEOM_Shape_ptr)->GEOM_Shape_ptr -Archimede = geompy.Archimede(Box, weight, waterdensity, meshingdeflection) #(GEOM_Shape_ptr, Double, Double, Double)->GEOM_Shape_ptr -CheckShape = geompy.CheckShape(Prism) #(GEOM_Shape_ptr)->Boolean - -#Partition objects -Partition = geompy.Partition(IORListPartition1, IORListPartition2) #(ListOfIOR, ListOfIOR)->GEOM_Shape_ptr - -#Add In Study -id_Vertex = geompy.addToStudy(Vertex, "Vertex") -id_Vector = geompy.addToStudy(Vector, "Vector") -id_Line = geompy.addToStudy(Line, "Line") -id_Arc = geompy.addToStudy(Arc, "Arc") -id_Circle = geompy.addToStudy(Circle, "Circle") -id_Plane = geompy.addToStudy(Plane, "Plane") - -id_Box = geompy.addToStudy(Box, "Box") -id_Cylinder = geompy.addToStudy(Cylinder, "Cylinder") -id_Sphere = geompy.addToStudy(Sphere, "Sphere") -id_Cone = geompy.addToStudy(Cone, "Cone") -id_Torus = geompy.addToStudy(Torus, "Torus") - -id_Edge = geompy.addToStudy(Edge, "Edge") -id_Wire = geompy.addToStudy(Wire, "Wire") -id_Face = geompy.addToStudy(Face, "Face") -id_Compound = geompy.addToStudy(Compound, "Compound") - -id_Common = geompy.addToStudy(Common, "Common") -id_Cut = geompy.addToStudy(Cut, "Cut") -id_Fuse = geompy.addToStudy(Fuse, "Fuse") -id_Section = geompy.addToStudy(Section, "Section") - -id_Copy = geompy.addToStudy(Copy, "Copy") -id_Prism = geompy.addToStudy(Prism, "Prism") -#id_Revolution = geompy.addToStudy(Revolution, "Revolution") -id_Filling = geompy.addToStudy(Filling, "Filling") -id_Pipe = geompy.addToStudy(Pipe, "Pipe") -id_Sewing = geompy.addToStudy(Sewing, "Sewing") - -Id_Translation = geompy.addToStudy(Translation, "Translation") -Id_Rotation = geompy.addToStudy(Rotation, "Rotation") -Id_Scale = geompy.addToStudy(Scale, "Scale") -Id_Mirror = geompy.addToStudy(Mirror, "Mirror") -Id_Orientation = geompy.addToStudy(Orientation, "Orientation") -Id_Fillet = geompy.addToStudy(Fillet, "Fillet") -Id_Chamfer = geompy.addToStudy(Chamfer, "Chamfer") - -Id_MultiTrans1D = geompy.addToStudy(MultiTrans1D, "MultiTrans1D") -Id_MultiTrans2D = geompy.addToStudy(MultiTrans2D, "MultiTrans2D") -Id_MultiRot1D = geompy.addToStudy(MultiRot1D, "MultiRot1D") -Id_MultiRot2D = geompy.addToStudy(MultiRot2D, "MultiRot2D") - -Id_Partition = geompy.addToStudy(Partition, "Partition") -Id_CDG = geompy.addToStudy(CDG, "CDG") -Id_Archimede = geompy.addToStudy(Archimede, "Archimede") - -#Decompose objects -SubShape = geompy.SubShape(Box, ShapeTypeFace, IDlistSubShape) #(GEOM_Shape_ptr, Short, ListOfSubShapeID)->GEOM_Shape_ptr -name = geompy.SubShapeName( SubShape._get_Name(), Box._get_Name() ) -Id_SubShape = geompy.addToStudyInFather(Box, SubShape, name) - -SubShapeAllList = [] -SubShapeAllList = geompy.SubShapeAll(SubShape, ShapeTypeEdge) #(GEOM_Shape_ptr, Short)->ListOfGeomShapes -for Shape in SubShapeAllList : - name = geompy.SubShapeName( Shape._get_Name(), Box._get_Name() ) - Id_SubShapeAll = geompy.addToStudyInFather(SubShape, Shape, name) diff --git a/GEOM_SWIG/Makefile.in b/GEOM_SWIG/Makefile.in deleted file mode 100644 index 98eefb035..000000000 --- a/GEOM_SWIG/Makefile.in +++ /dev/null @@ -1,67 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : Makefile.in -# Author : Nicolas REJNERI, Paul RASCLE -# Module : GEOM -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@top_srcdir@/idl - - -@COMMENCE@ - -# Libraries targets - -LIB = libGeometry_Swigcmodule.la -LIB_SRC = - -SWIG_DEF = libGeometry_Swig.i -EXPORT_PYSCRIPTS = libGeometry_Swig.py geompy.py batchmode_geompy.py \ - GEOM_example.py \ - GEOM_example2.py \ - GEOM_example3.py \ - GEOM_example4.py \ - GEOM_moteur.py \ - GEOM_usinggeom.py \ - GEOM_Partition1.py \ - GEOM_Partition2.py \ - GEOM_Partition3.py \ - GEOM_Partition4.py \ - GEOM_Partition5.py - -LIB_CLIENT_IDL = SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOME_Component.idl - -CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -DHAVE_CONFIG_H -LIBS+= $(PYTHON_LIBS) -LDFLAGS+= -lGeometryGUI - -@CONCLUDE@ diff --git a/GEOM_SWIG/batchmode_geompy.py b/GEOM_SWIG/batchmode_geompy.py deleted file mode 100644 index 5a4f1c623..000000000 --- a/GEOM_SWIG/batchmode_geompy.py +++ /dev/null @@ -1,444 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# -# -# File : geompy.py -# Author : Paul RASCLE, EDF -# Module : GEOM -# $Header$ - -from batchmode_salome import * - -#-------------------------------------------------------------------------- - -geom = lcc.FindOrLoadComponent("FactoryServer", "Geometry") -geom.GetCurrentStudy(myStudyId) -myBuilder = myStudy.NewBuilder() - -father = myStudy.FindComponent("GEOM") -if father is None: - father = myBuilder.NewComponent("GEOM") - A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName"); - FName = A1._narrow(SALOMEDS.AttributeName) - FName.SetValue("Geometry") - A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = A2._narrow(SALOMEDS.AttributePixMap); - aPixmap.SetPixMap( "ICON_OBJBROWSER_Geometry" ); - myBuilder.DefineComponentInstance(father,geom) - - -# ----------------------------------------------------------------------------- -# add To Study -# ----------------------------------------------------------------------------- - -def SubShapeName(aSubId, aMainId): -# index = gg.getIndexTopology(aSubId, aMainId) -# print index -# name = gg.getShapeTypeString(aSubId) + "_%d"%(index) - name = "Shape" - print name - return name - -def addArguments(aShape): - ListIOR = [] - ListIOR = geom.GetReferencedObjects(aShape) - - if aShape._get_StudyShapeId()!="": - father = IDToSObject(aShape._get_StudyShapeId()) - - myBuilder.NewCommand() - if len(ListIOR) > 0: - Arg = myBuilder.NewObject(father) - A1 = myBuilder.FindOrCreateAttribute(Arg, "AttributeName"); - ArgName = A1._narrow(SALOMEDS.AttributeName) - ArgName.SetValue("Arguments") - A2 = myBuilder.FindOrCreateAttribute(Arg, "AttributeSelectable"); - SelAttr = A2._narrow(SALOMEDS.AttributeSelectable); - SelAttr.SetSelectable(0); - - OneObject = 0 - for anIOR in ListIOR: - Shape = orb.string_to_object(anIOR) - if Shape is not None: - if Shape._get_StudyShapeId()!="": - Obj = IDToSObject(Shape._get_StudyShapeId()) - if Obj is not None: - Obj1 = myBuilder.NewObject(Arg) - myBuilder.Addreference(Obj1,Obj) - OneObject = 1 - - if OneObject == 0: - myBuilder.RemoveObject(Arg) - - myBuilder.CommitCommand() - return 1 - -def addToStudy(aShape, aName): - try: - myBuilder.NewCommand() - newObj = myBuilder.NewObject(father) - ior = orb.object_to_string(aShape) - A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR"); - ObjIOR = A1._narrow(SALOMEDS.AttributeIOR) - ObjIOR.SetValue(ior) - A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName"); - ObjName = A2._narrow(SALOMEDS.AttributeName) - ObjName.SetValue(aName) - id = newObj.GetID() - aShape._set_StudyShapeId(id) - myBuilder.CommitCommand() - - addArguments( aShape ) - - except: - return None - return id - -def addToStudyInFather(aFather, aShape, aName): - myBuilder.NewCommand() - newObj = myBuilder.NewObject( IDToSObject(aFather._get_StudyShapeId()) ) - ior = orb.object_to_string(aShape) - A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR"); - ObjIOR = A1._narrow(SALOMEDS.AttributeIOR) - ObjIOR.SetValue(ior) - A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName"); - ObjName = A2._narrow(SALOMEDS.AttributeName) - ObjName.SetValue(aName) - id = newObj.GetID() - aShape._set_StudyShapeId(id) - myBuilder.CommitCommand() - addArguments( aShape ) - return id - -# ----------------------------------------------------------------------------- -# Create Geometry 2D -# ----------------------------------------------------------------------------- - -def MakeVertex(x,y,z): - anObj = geom.MakeVertex(x,y,z) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeVector(p1,p2): - anObj = geom.MakeVector(p1,p2) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeLine(p1,d1): - anObj = geom.MakeLine(p1,d1) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeArc(p1,p2,p3): - anObj = geom.MakeArc(p1,p2,p3) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCircle(p1,d1,radius): - anObj = geom.MakeCircle(p1,d1,radius) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakePlane(p1,d1,trimsize): - anObj = geom.MakePlane(p1,d1,trimsize) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Create Geometry 3D -# ----------------------------------------------------------------------------- - -def MakeBox(x1,y1,z1,x2,y2,z2): - anObj = geom.MakeBox(x1,y1,z1,x2,y2,z2) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCylinder(p1,d1,radius,height): - anObj = geom.MakeCylinder(p1,d1,radius,height) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeSphere(x,y,z,radius): - anObj = geom.MakeSphere(x,y,z,radius) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCone(p1,d1,radius1,radius2,height): - anObj = geom.MakeCone(p1,d1,radius1,radius2,height) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeTorus(p1,d1,major_radius,minor_radius): - anObj = geom.MakeTorus(p1,d1,major_radius,minor_radius) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Create base objects -# ----------------------------------------------------------------------------- - -def MakeEdge(p1,p2): - anObj = geom.MakeEdge(p1,p2) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeWire(ListShape): - anObj = geom.MakeWire(ListShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeFace(aShapeWire,WantPlanarFace): - anObj = geom.MakeFace(aShapeWire,WantPlanarFace) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCompound(ListShape): - anObj = geom.MakeCompound(ListShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Create advanced objects -# ----------------------------------------------------------------------------- - -def MakeCopy(aShape): - anObj = geom.MakeCopy(aShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakePrism(baseShape,p1,p2): - anObj = geom.MakePrism(baseShape,p1,p2) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeRevolution(aShape,axis,angle): - anObj = geom.MakeRevolution(aShape,axis,angle) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeFilling(aShape,mindeg,maxdeg,tol3d,tol2d,nbiter): - anObj = geom.MakeFilling(aShape,mindeg,maxdeg,tol3d,tol2d,nbiter) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakePipe(pathShape,baseShape): - anObj = geom.MakePipe(pathShape,baseShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeSewing(ListShape,precision): - anObj = geom.MakeSewing(ListShape,precision) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Boolean (Common, Cut, Fuse, Section) -# ----------------------------------------------------------------------------- - -def MakeBoolean(shape1,shape2,operation): - anObj = geom.MakeBoolean(shape1,shape2,operation) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Transform objects -# ----------------------------------------------------------------------------- - -def MakeTranslation(aShape,x,y,z): - anObj = geom.MakeTranslation(aShape,x,y,z) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeRotation(aShape,axis,angle): - anObj = geom.MakeRotation(aShape,axis,angle) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeScaleTransform(aShape,theCenterofScale,factor): - anObj = geom.MakeScaleTransform(aShape,theCenterofScale,factor) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMirrorByPlane(aShape,aPlane): - anObj = geom.MakeMirrorByPlane(aShape,aPlane) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def OrientationChange(aShape): - anObj = geom.OrientationChange(aShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeFillet(aShape,radius,ShapeType,ListShape): - anObj = geom.MakeFillet(aShape,radius,ShapeType,ListShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeChamfer(aShape,d1,d2,ShapeType,ListShape): - anObj = geom.MakeChamfer(aShape,d1,d2,ShapeType,ListShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Decompose objects -# ----------------------------------------------------------------------------- - -def SubShape(aShape,type,ListOfId): - anObj = geom.SubShape(aShape,type, ListOfId) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SubShapeAll(aShape,type): - ListObj = geom.SubShapeAll(aShape,type) - for anObj in ListObj : - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return ListObj - -def SubShapeSorted(aShape,type,ListOfId): - anObj = geom.SubShapeSorted(aShape,type, ListOfId) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SubShapeAllSorted(aShape,type): - ListObj = geom.SubShapeAllSorted(aShape,type) - for anObj in ListObj : - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return ListObj - -# -- enumeration ShapeType as a dictionary -- -ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} - -def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], Limit=ShapeType["SHAPE"]): - anObj = geom.Partition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, Limit); - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SuppressFaces(aShape,ListOfId): - anObj = geom.SuppressFaces(aShape,ListOfId) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace): - anObj = geom.SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Patterns -# ----------------------------------------------------------------------------- - -def MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes): - anObj = geom.MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2): - anObj = geom.MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes): - anObj = geom.MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2): - anObj = geom.MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Import objects -# ----------------------------------------------------------------------------- - -def ImportBREP(filename): - anObj = geom.ImportBREP(filename) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def ImportIGES(filename): - anObj = geom.ImportIGES(filename) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def ImportSTEP(filename): - anObj = geom.ImportSTEP(filename) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Export objects -# ----------------------------------------------------------------------------- -def ExportBREP(filename,aShape): - geom.ExportBREP(filename,aShape) - -def ExportIGES(filename,aShape): - geom.ExportIGES(filename,aShape) - -def ExportSTEP(filename,aShape): - geom.ExportSTEP(filename,aShape) - -# ----------------------------------------------------------------------------- -# Information objects -# ----------------------------------------------------------------------------- - -def MakeCDG(aShape): - anObj = geom.MakeCDG(aShape) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def Archimede(aShape,weight,WaterDensity,MeshingDeflection): - anObj = geom.Archimede(aShape,weight,WaterDensity,MeshingDeflection) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def CheckShape(aShape): - Status = geom.CheckShape(aShape) - return Status diff --git a/GEOM_SWIG/geompy.py b/GEOM_SWIG/geompy.py deleted file mode 100644 index c04664557..000000000 --- a/GEOM_SWIG/geompy.py +++ /dev/null @@ -1,476 +0,0 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# -# 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 : geompy.py -# Author : Paul RASCLE, EDF -# Module : GEOM -# $Header$ - -import salome -import SALOMEDS -#import SALOMEDS_Attributes_idl - -#NRI : BugID 1682 : from libSALOME_Swig import * - -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") -geom.GetCurrentStudy(salome.myStudyId) -myBuilder = salome.myStudy.NewBuilder() - -gg = salome.ImportComponentGUI("Geometry") - -father = salome.myStudy.FindComponent("GEOM") -if father is None: - father = myBuilder.NewComponent("GEOM") - A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName"); - FName = A1._narrow(SALOMEDS.AttributeName) - FName.SetValue("Geometry") - A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = A2._narrow(SALOMEDS.AttributePixMap); - aPixmap.SetPixMap( "ICON_OBJBROWSER_Geometry" ); - myBuilder.DefineComponentInstance(father,geom) - - -# ----------------------------------------------------------------------------- -# add To Study -# ----------------------------------------------------------------------------- - -def SubShapeName(aSubId, aMainId): - index = gg.getIndexTopology(aSubId, aMainId) - name = gg.getShapeTypeString(aSubId) + "_%d"%(index) - return name - -def addArguments(aShape): - ListIOR = [] - ListIOR = geom.GetReferencedObjects(aShape) - - if aShape._get_StudyShapeId()!="": - father = salome.IDToSObject(aShape._get_StudyShapeId()) - - myBuilder.NewCommand() - if len(ListIOR) > 0: - Arg = myBuilder.NewObject(father) - A1 = myBuilder.FindOrCreateAttribute(Arg, "AttributeName"); - ArgName = A1._narrow(SALOMEDS.AttributeName) - ArgName.SetValue("Arguments") - A2 = myBuilder.FindOrCreateAttribute(Arg, "AttributeSelectable"); - SelAttr = A2._narrow(SALOMEDS.AttributeSelectable); - SelAttr.SetSelectable(0); - - OneObject = 0 - for anIOR in ListIOR: - Shape = salome.orb.string_to_object(anIOR) - if Shape is not None: - if Shape._get_StudyShapeId()!="": - Obj = salome.IDToSObject(Shape._get_StudyShapeId()) - if Obj is not None: - Obj1 = myBuilder.NewObject(Arg) - myBuilder.Addreference(Obj1,Obj) - OneObject = 1 - - if OneObject == 0: - myBuilder.RemoveObject(Arg) - - myBuilder.CommitCommand() - return 1 - -def addToStudy(aShape, aName): - myBuilder.NewCommand() - newObj = myBuilder.NewObject(father) - ior = salome.orb.object_to_string(aShape) - A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR"); - ObjIOR = A1._narrow(SALOMEDS.AttributeIOR) - ObjIOR.SetValue(ior) - A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName"); - ObjName = A2._narrow(SALOMEDS.AttributeName) - ObjName.SetValue(aName) - A3 = myBuilder.FindOrCreateAttribute(newObj, "AttributePixMap"); - ObjPixmap = A3._narrow(SALOMEDS.AttributePixMap) - anIcon = gg.getShapeTypeIcon(ior); - ObjPixmap.SetPixMap(anIcon) - id = newObj.GetID() - aShape._set_StudyShapeId(id) - myBuilder.CommitCommand() - - addArguments( aShape ) - -#NRI : BugID 1682 : sg = SALOMEGUI_Swig() -#NRI : BugID 1682 : sg.updateObjBrowser(0) - salome.sg.updateObjBrowser(0) - return id - -def addToStudyInFather(aFather, aShape, aName): - -#NRI : BugID 1682 : sg = SALOMEGUI_Swig() - myBuilder.NewCommand() - newObj = myBuilder.NewObject( salome.IDToSObject(aFather._get_StudyShapeId()) ) - ior = salome.orb.object_to_string(aShape) - A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR"); - ObjIOR = A1._narrow(SALOMEDS.AttributeIOR) - ObjIOR.SetValue(ior) - A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName"); - ObjName = A2._narrow(SALOMEDS.AttributeName) - ObjName.SetValue(aName) - A3 = myBuilder.FindOrCreateAttribute(newObj, "AttributePixMap"); - ObjPixmap = A3._narrow(SALOMEDS.AttributePixMap) - anIcon = gg.getShapeTypeIcon(ior); - ObjPixmap.SetPixMap(anIcon) - id = newObj.GetID() - aShape._set_StudyShapeId(id) - myBuilder.CommitCommand() - - addArguments( aShape ) - -#NRI : BugID 1682 : sg.updateObjBrowser(0) - salome.sg.updateObjBrowser(0) - return id - -# ----------------------------------------------------------------------------- -# Create Geometry 2D -# ----------------------------------------------------------------------------- - -def MakeVertex(x,y,z): - anObj = geom.MakeVertex(x,y,z) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeVector(p1,p2): - anObj = geom.MakeVector(p1,p2) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeLine(p1,d1): - anObj = geom.MakeLine(p1,d1) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeArc(p1,p2,p3): - anObj = geom.MakeArc(p1,p2,p3) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCircle(p1,d1,radius): - anObj = geom.MakeCircle(p1,d1,radius) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakePlane(p1,d1,trimsize): - anObj = geom.MakePlane(p1,d1,trimsize) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Create Geometry 3D -# ----------------------------------------------------------------------------- - -def MakeBox(x1,y1,z1,x2,y2,z2): - anObj = geom.MakeBox(x1,y1,z1,x2,y2,z2) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCylinder(p1,d1,radius,height): - anObj = geom.MakeCylinder(p1,d1,radius,height) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeSphere(x,y,z,radius): - anObj = geom.MakeSphere(x,y,z,radius) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCone(p1,d1,radius1,radius2,height): - anObj = geom.MakeCone(p1,d1,radius1,radius2,height) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeTorus(p1,d1,major_radius,minor_radius): - anObj = geom.MakeTorus(p1,d1,major_radius,minor_radius) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Create base objects -# ----------------------------------------------------------------------------- - -def MakeEdge(p1,p2): - anObj = geom.MakeEdge(p1,p2) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeWire(ListShape): - anObj = geom.MakeWire(ListShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeFace(aShapeWire,WantPlanarFace): - anObj = geom.MakeFace(aShapeWire,WantPlanarFace) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeCompound(ListShape): - anObj = geom.MakeCompound(ListShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Create advanced objects -# ----------------------------------------------------------------------------- - -def MakeCopy(aShape): - anObj = geom.MakeCopy(aShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakePrism(baseShape,p1,p2): - anObj = geom.MakePrism(baseShape,p1,p2) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeRevolution(aShape,axis,angle): - anObj = geom.MakeRevolution(aShape,axis,angle) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeFilling(aShape,mindeg,maxdeg,tol3d,tol2d,nbiter): - anObj = geom.MakeFilling(aShape,mindeg,maxdeg,tol3d,tol2d,nbiter) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakePipe(pathShape,baseShape): - anObj = geom.MakePipe(pathShape,baseShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeSewing(ListShape,precision): - anObj = geom.MakeSewing(ListShape,precision) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Boolean (Common, Cut, Fuse, Section) -# ----------------------------------------------------------------------------- - -def MakeBoolean(shape1,shape2,operation): - anObj = geom.MakeBoolean(shape1,shape2,operation) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Transform objects -# ----------------------------------------------------------------------------- - -def MakeTranslation(aShape,x,y,z): - anObj = geom.MakeTranslation(aShape,x,y,z) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeRotation(aShape,axis,angle): - anObj = geom.MakeRotation(aShape,axis,angle) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeScaleTransform(aShape,theCenterofScale,factor): - anObj = geom.MakeScaleTransform(aShape,theCenterofScale,factor) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMirrorByPlane(aShape,aPlane): - anObj = geom.MakeMirrorByPlane(aShape,aPlane) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def OrientationChange(aShape): - anObj = geom.OrientationChange(aShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeFillet(aShape,radius,ShapeType,ListShape): - anObj = geom.MakeFillet(aShape,radius,ShapeType,ListShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeChamfer(aShape,d1,d2,ShapeType,ListShape): - anObj = geom.MakeChamfer(aShape,d1,d2,ShapeType,ListShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Decompose objects -# ----------------------------------------------------------------------------- - -def SubShape(aShape,type,ListOfId): - anObj = geom.SubShape(aShape,type, ListOfId) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SubShapeAll(aShape,type): - ListObj = geom.SubShapeAll(aShape,type) - for anObj in ListObj : - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return ListObj - -def SubShapeSorted(aShape,type,ListOfId): - anObj = geom.SubShapeSorted(aShape,type, ListOfId) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SubShapeAllSorted(aShape,type): - ListObj = geom.SubShapeAllSorted(aShape,type) - for anObj in ListObj : - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return ListObj - -# -- enumeration ShapeType as a dictionary -- -ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} - -def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], Limit=ShapeType["SHAPE"]): - anObj = geom.Partition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, Limit); - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SuppressFaces(aShape,ListOfId): - anObj = geom.SuppressFaces(aShape,ListOfId) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace): - anObj = geom.SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Patterns -# ----------------------------------------------------------------------------- - -def MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes): - anObj = geom.MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2): - anObj = geom.MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes): - anObj = geom.MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2): - anObj = geom.MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Import objects -# ----------------------------------------------------------------------------- - -def ImportBREP(filename): - anObj = geom.ImportBREP(filename) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def ImportIGES(filename): - anObj = geom.ImportIGES(filename) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def ImportSTEP(filename): - anObj = geom.ImportSTEP(filename) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -# ----------------------------------------------------------------------------- -# Export objects -# ----------------------------------------------------------------------------- -def ExportBREP(filename,aShape): - geom.ExportBREP(filename,aShape) - -def ExportIGES(filename,aShape): - geom.ExportIGES(filename,aShape) - -def ExportSTEP(filename,aShape): - geom.ExportSTEP(filename,aShape) - -# ----------------------------------------------------------------------------- -# Information objects -# ----------------------------------------------------------------------------- - -def MakeCDG(aShape): - anObj = geom.MakeCDG(aShape) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def Archimede(aShape,weight,WaterDensity,MeshingDeflection): - anObj = geom.Archimede(aShape,weight,WaterDensity,MeshingDeflection) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj - -def CheckShape(aShape): - Status = geom.CheckShape(aShape) - return Status diff --git a/GEOM_SWIG/libGeometry_Swig.i b/GEOM_SWIG/libGeometry_Swig.i deleted file mode 100644 index e09d0a3cc..000000000 --- a/GEOM_SWIG/libGeometry_Swig.i +++ /dev/null @@ -1,32 +0,0 @@ -// GEOM GEOM_SWIG : binding of C++ omplementaion with Python -// -// 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 : libGeometry_Swig.i -// Author : Nicolas REJNERI, Paul RASCLE -// Module : GEOM -// $Header$ - -%module libGeometry_Swig - -%include "GeometryGUI_Swig.i" -