From a596550f89dfafcf288f8d62a2ca2a1be40ca512 Mon Sep 17 00:00:00 2001 From: dcq Date: Wed, 16 Jun 2004 15:24:55 +0000 Subject: [PATCH] DCQ : Merge with Ecole_Ete_a6. --- INSTALL | 4 +- Makefile.in | 15 +- adm_local/unix/make_commence.in | 10 +- bin/VERSION | 2 +- configure.in.base | 11 +- doc/Makefile.in | 11 +- doc/html/INPUT/doxyfile | 2 +- doc/html/INPUT/sources/static/tree.js | 2 +- doc/salome/GEOM_index.html | 95 ++ doc/salome/Makefile.in | 44 + doc/salome/gui/Makefile.in | 33 + idl/GEOM_Gen.idl | 7 +- idl/Makefile.in | 19 +- resources/GEOM.config | 1 + resources/GEOM_en.xml | 29 - resources/GEOM_fr.xml | 248 ++- src/ARCHIMEDE/Archimede_VolumeSection.cxx | 1 + src/BasicGUI/BasicGUI.cxx | 2 +- src/BasicGUI/BasicGUI_ArcDlg.cxx | 6 +- src/BasicGUI/BasicGUI_CircleDlg.cxx | 6 +- src/BasicGUI/BasicGUI_EllipseDlg.cxx | 6 +- src/BasicGUI/BasicGUI_LineDlg.cxx | 6 +- src/BasicGUI/BasicGUI_PlaneDlg.cxx | 6 +- src/BasicGUI/BasicGUI_PointDlg.cxx | 1 + src/BasicGUI/BasicGUI_VectorDlg.cxx | 1 + src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx | 1 + src/BooleanGUI/BooleanGUI_CutDlg.cxx | 4 +- src/BuildGUI/BuildGUI_EdgeDlg.cxx | 5 +- src/BuildGUI/BuildGUI_FaceDlg.cxx | 2 +- src/BuildGUI/BuildGUI_ShellDlg.cxx | 6 +- src/BuildGUI/BuildGUI_ShellDlg.h | 5 +- src/DisplayGUI/DisplayGUI.cxx | 10 +- src/DlgRef/DlgRef_4Sel1List_QTD.cxx | 109 +- src/DlgRef/DlgRef_4Sel1List_QTD.h | 3 + src/DlgRef/DlgRef_Skeleton_QTD.cxx | 39 +- src/DlgRef/DlgRef_Skeleton_QTD.h | 11 +- src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui | 72 +- src/EntityGUI/EntityGUI.cxx | 437 +----- src/EntityGUI/EntityGUI.h | 16 +- src/EntityGUI/EntityGUI_1Sel_QTD.cxx | 94 ++ src/EntityGUI/EntityGUI_1Sel_QTD.h | 46 + src/EntityGUI/EntityGUI_1Spin.cxx | 56 + src/EntityGUI/EntityGUI_1Spin.h | 47 + src/EntityGUI/EntityGUI_1Spin_QTD.cxx | 88 ++ src/EntityGUI/EntityGUI_1Spin_QTD.h | 45 + src/EntityGUI/EntityGUI_2Spin.cxx | 60 + src/EntityGUI/EntityGUI_2Spin.h | 48 + src/EntityGUI/EntityGUI_2Spin_QTD.cxx | 99 ++ src/EntityGUI/EntityGUI_2Spin_QTD.h | 47 + src/EntityGUI/EntityGUI_3Spin.cxx | 63 + src/EntityGUI/EntityGUI_3Spin.h | 49 + src/EntityGUI/EntityGUI_3Spin_QTD.cxx | 110 ++ src/EntityGUI/EntityGUI_3Spin_QTD.h | 49 + src/EntityGUI/EntityGUI_4Spin.cxx | 67 + src/EntityGUI/EntityGUI_4Spin.h | 50 + src/EntityGUI/EntityGUI_4Spin_QTD.cxx | 128 ++ src/EntityGUI/EntityGUI_4Spin_QTD.h | 51 + src/EntityGUI/EntityGUI_Dir1_QTD.cxx | 80 + src/EntityGUI/EntityGUI_Dir1_QTD.h | 41 + src/EntityGUI/EntityGUI_Dir2_QTD.cxx | 76 + src/EntityGUI/EntityGUI_Dir2_QTD.h | 40 + src/EntityGUI/EntityGUI_Point_QTD.cxx | 74 + src/EntityGUI/EntityGUI_Point_QTD.h | 40 + src/EntityGUI/EntityGUI_Skeleton_QTD.cxx | 176 +++ src/EntityGUI/EntityGUI_Skeleton_QTD.h | 61 + src/EntityGUI/EntityGUI_SketcherDlg.cxx | 1168 ++++++++++++++ src/EntityGUI/EntityGUI_SketcherDlg.h | 149 ++ src/EntityGUI/Makefile.in | 30 +- src/GEOM/GEOM_Gen_i.cc | 208 ++- src/GEOM/GEOM_Gen_i.hh | 9 + src/GEOM/GEOM_Shape_i.cc | 27 +- src/GEOM/Makefile.in | 2 +- src/GEOMBase/GEOMBase.cxx | 83 +- src/GEOMBase/GEOMBase.h | 3 + src/GEOMBase/GEOMBase_Skeleton.h | 1 + src/GEOMClient/GEOM_Client.cxx | 2 +- src/GEOMContext/GEOMContext.cxx | 7 + src/GEOMContext/GEOMContext.h | 6 +- src/GEOMContext/GEOM_msg_en.po | 21 +- src/GEOMContext/GEOM_msg_fr.po | 264 +++- src/GEOMContext/Makefile.in | 2 +- src/GEOMDS/GEOMDS_Commands.cxx | 5 +- src/GEOMDS/GEOMDS_Commands.jxx | 2 +- src/GEOMGUI/GeometryGUI.cxx | 394 ++--- src/GEOMGUI/GeometryGUI.h | 38 +- src/GEOMGUI/GeometryGUI_Swig.cxx | 43 +- src/GEOMToolsGUI/GEOMToolsGUI.cxx | 84 +- src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx | 14 +- src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h | 16 +- .../GEOMToolsGUI_TransparencyDlg.cxx | 34 +- .../GEOMToolsGUI_TransparencyDlg.h | 12 +- src/GEOM_SWIG/GEOM_Sketcher.py | 58 + src/GEOM_SWIG/Makefile.in | 3 +- src/GEOM_SWIG/batchmode_geompy.py | 27 +- src/GEOM_SWIG/geompy.py | 21 +- .../GenerationGUI_FillingDlg.cxx | 18 +- src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 7 +- src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 6 +- src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 40 +- src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx | 5 +- src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx | 5 +- src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx | 5 +- src/MeasureGUI/MeasureGUI_DistanceDlg.cxx | 9 +- src/MeasureGUI/MeasureGUI_InertiaDlg.cxx | 5 +- src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx | 5 +- src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx | 5 +- src/MeasureGUI/MeasureGUI_Skeleton.h | 1 + src/MeasureGUI/MeasureGUI_WhatisDlg.cxx | 16 +- src/OBJECT/GEOM_AISShape.jxx | 2 +- .../OperationGUI_ArchimedeDlg.cxx | 1 + src/OperationGUI/OperationGUI_ChamferDlg.cxx | 206 +-- src/OperationGUI/OperationGUI_ChamferDlg.h | 3 - src/OperationGUI/OperationGUI_FilletDlg.cxx | 188 +-- src/OperationGUI/OperationGUI_FilletDlg.h | 3 - .../OperationGUI_PartitionDlg.cxx | 1 + src/PrimitiveGUI/PrimitiveGUI.cxx | 7 +- src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx | 1 + src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx | 14 +- src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx | 6 +- src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx | 1 + src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx | 30 +- src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h | 2 - src/RepairGUI/RepairGUI.cxx | 9 +- src/RepairGUI/RepairGUI_OrientationDlg.cxx | 6 +- src/RepairGUI/RepairGUI_SewingDlg.cxx | 1 + src/SKETCHER/GEOM_Sketcher.cxx | 1389 ----------------- src/SKETCHER/GEOM_Sketcher.h | 201 --- src/SKETCHER/Makefile.in | 18 +- src/SKETCHER/Sketcher_Profile.cxx | 382 +++++ ..._SketcherStatus.h => Sketcher_Profile.hxx} | 57 +- .../TransformationGUI_MirrorDlg.cxx | 6 +- .../TransformationGUI_MultiRotationDlg.cxx | 10 +- .../TransformationGUI_MultiTranslationDlg.cxx | 12 +- .../TransformationGUI_RotationDlg.cxx | 6 +- .../TransformationGUI_ScaleDlg.cxx | 6 +- .../TransformationGUI_TranslationDlg.cxx | 6 +- 136 files changed, 5455 insertions(+), 3052 deletions(-) create mode 100644 doc/salome/GEOM_index.html create mode 100644 doc/salome/Makefile.in create mode 100644 doc/salome/gui/Makefile.in create mode 100644 resources/GEOM.config create mode 100644 src/EntityGUI/EntityGUI_1Sel_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_1Sel_QTD.h create mode 100644 src/EntityGUI/EntityGUI_1Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_1Spin.h create mode 100644 src/EntityGUI/EntityGUI_1Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_1Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_2Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_2Spin.h create mode 100644 src/EntityGUI/EntityGUI_2Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_2Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_3Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_3Spin.h create mode 100644 src/EntityGUI/EntityGUI_3Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_3Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_4Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_4Spin.h create mode 100644 src/EntityGUI/EntityGUI_4Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_4Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Dir1_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Dir1_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Dir2_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Dir2_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Point_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Point_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Skeleton_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Skeleton_QTD.h create mode 100644 src/EntityGUI/EntityGUI_SketcherDlg.cxx create mode 100644 src/EntityGUI/EntityGUI_SketcherDlg.h create mode 100644 src/GEOM_SWIG/GEOM_Sketcher.py delete mode 100644 src/SKETCHER/GEOM_Sketcher.cxx delete mode 100644 src/SKETCHER/GEOM_Sketcher.h create mode 100644 src/SKETCHER/Sketcher_Profile.cxx rename src/SKETCHER/{GEOM_SketcherStatus.h => Sketcher_Profile.hxx} (52%) diff --git a/INSTALL b/INSTALL index 6fe7d777b..cd622460b 100644 --- a/INSTALL +++ b/INSTALL @@ -1,3 +1,3 @@ -This is the version 1.4.0 of GEOM +This is the version 2.0.0 of GEOM Compatible with : - - KERNEL 1.4.0 + - KERNEL 2.0.0 diff --git a/Makefile.in b/Makefile.in index 3657e2248..d5c51e9cf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,11 +14,12 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl @COMMENCE@ -SUBDIRS = idl src +SUBDIRS = idl src doc RESOURCES_FILES = \ GEOM_en.xml \ GEOM_fr.xml \ +GEOM.config \ GEOMCatalog.xml \ GEOMDS_Resources \ arc.png \ @@ -144,10 +145,10 @@ include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.ref # test if SALOMEconfig.h has changed (contents) salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h @if ! [ -a $@ ]; then \ - cp -p $< $@; \ + cp -p -f $< $@; \ fi; \ if ! cmp $< $@; then \ - cp -p $< $@; \ + cp -p -f $< $@; \ fi; \ include/salome/sstream: salome_adm/unix/sstream @@ -169,10 +170,10 @@ install-end: install-include: $(include_list) $(INSTALL) -d $(includedir) - @for f in X $(include_list); do \ - if test $$f != X; then \ - ($(INSTALL_DATA) $$f $(includedir)/. || exit 1); \ - fi; \ + @for f in X $(include_list); do \ + if test $$f != X; then \ + ($(INSTALL_DATA) -p $$f $(includedir)/. || exit 1); \ + fi; \ done # install script in $(bindir) : diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 28f29a130..4d758b99f 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -31,7 +31,7 @@ C_DEPEND_FLAG = @C_DEPEND_FLAG@ # C++ CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ +CXXFLAGS = @CXXFLAGS@ -Wparentheses -Wreturn-type -Wmissing-declarations -Winline CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ # JAVA @@ -131,7 +131,7 @@ OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@ OMNIORB_IDL = @OMNIORB_IDL@ OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ -OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome +OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@ OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@ @@ -148,7 +148,7 @@ CORBA_INCLUDES = @CORBA_INCLUDES@ CORBA_LIBS = @CORBA_LIBS@ CORBA_CXXFLAGS = @CORBA_CXXFLAGS@ -IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome IDLPYFLAGS = @IDLPYFLAGS@ IDL = @IDL@ @@ -202,13 +202,13 @@ idldir=${prefix}/idl/salome sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules incmakedir=${prefix}/salome_adm/unix -docdir=$(datadir)/doc +docdir=${prefix}/doc/salome # # begin of package rules # -.PHONY: all lib bin inc resources data doc tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean +.PHONY: all lib bin inc resources data docs tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean .SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm diff --git a/bin/VERSION b/bin/VERSION index 1b77509ae..1b4eeb6eb 100755 --- a/bin/VERSION +++ b/bin/VERSION @@ -1 +1 @@ -THIS IS SALOME - GEOM VERSION: 1.4.0 +THIS IS SALOME - GEOM VERSION: 2.0.0 diff --git a/configure.in.base b/configure.in.base index 212a37556..2057690b2 100644 --- a/configure.in.base +++ b/configure.in.base @@ -15,6 +15,7 @@ # Created from configure.in.base # + AC_INIT(src) AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files) AC_CANONICAL_HOST @@ -294,7 +295,7 @@ else fi # make other build directories -for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources share/salome/doc idl +for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl do # if test ! -d $rep ; then # eval mkdir $rep @@ -327,14 +328,16 @@ dnl copy shells and utilities contained in the bin directory dnl excluding .in files (treated in AC-OUTPUT below) and CVS dnl directory -cd bin +mkdir -p bin/salome +cd bin/salome + for i in $ROOT_SRCDIR/bin/* do local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` case "$local_bin" in *.in | *~) ;; - ./bin/CVS) ;; - *) ln -fs $i; echo $local_bin ;; + ./bin/CVS | ./bin/salome) ;; + *) /usr/bin/install -C $i .; echo $local_bin ;; esac done cd $ROOT_BUILDDIR diff --git a/doc/Makefile.in b/doc/Makefile.in index 019015971..7295ede75 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -11,9 +11,11 @@ top_builddir=.. srcdir=@srcdir@ VPATH=.:@srcdir@ -SUBDIRS=html +SUBDIRS= salome -doc: +@COMMENCE@ + +docs: @@SETX@; for d in $(SUBDIRS); do \ (cd $$d && $(MAKE) $@) || exit 1; \ done @@ -31,3 +33,8 @@ install: @@SETX@; for d in $(SUBDIRS); do \ (cd $$d && $(MAKE) $@) || exit 1; \ done + +uninstall: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done diff --git a/doc/html/INPUT/doxyfile b/doc/html/INPUT/doxyfile index 2a891be10..ce82f87d7 100755 --- a/doc/html/INPUT/doxyfile +++ b/doc/html/INPUT/doxyfile @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "SALOME - GEOM - v.1.4.0" +PROJECT_NAME = "SALOME - GEOM - v.2.0.0" PROJECT_NUMBER = id#1.1 OUTPUT_DIRECTORY = ../ OUTPUT_LANGUAGE = English diff --git a/doc/html/INPUT/sources/static/tree.js b/doc/html/INPUT/sources/static/tree.js index 3fb69102c..fdfc5a03c 100755 --- a/doc/html/INPUT/sources/static/tree.js +++ b/doc/html/INPUT/sources/static/tree.js @@ -1,4 +1,4 @@ -foldersTree = gFld("SALOME v.1.4.0 ", "", "") +foldersTree = gFld("SALOME v.2.0.0 ", "", "") insDoc(foldersTree, gLnk("Main Page", "", "main.html")) aux1 = insFld(foldersTree, gFld("TUI Reference Guide", "")) diff --git a/doc/salome/GEOM_index.html b/doc/salome/GEOM_index.html new file mode 100644 index 000000000..7da877011 --- /dev/null +++ b/doc/salome/GEOM_index.html @@ -0,0 +1,95 @@ + + + + + + + + Geometry Module Documentation + + + +
  +
+
                   +   
+ + + + + + + + + +
+ + + +
+ +
+
+
+

Geometry MODULE Documentation

+
+
+ + + + + +
+
+ +
+

Application-About.png +     

+
+ +
+ + + + +
+
+
+
+
+ +
+ +
GUI Documentation
+ +
+ +
+ +

+
+ +
+ +
TUI Documentation
+ +
+ +
+ +

+
+
+
+
+
+
+ + diff --git a/doc/salome/Makefile.in b/doc/salome/Makefile.in new file mode 100644 index 000000000..69c40d626 --- /dev/null +++ b/doc/salome/Makefile.in @@ -0,0 +1,44 @@ + +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 30/11/2001 +# $Header$ +# +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +SUBDIRS= tui gui + +@COMMENCE@ + +docs: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; \ + cp -f $(srcdir)/GEOM_index.html GEOM_index.html + +clean: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +distclean: clean + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +install: + $(MAKE) docs + (cd tui && $(MAKE) install); + (cd gui && $(MAKE) install); + cp -f GEOM_index.html $(docdir) + +uninstall: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; \ + rm -fr $(docdir)/GEOM_index.html diff --git a/doc/salome/gui/Makefile.in b/doc/salome/gui/Makefile.in new file mode 100644 index 000000000..a44228d6c --- /dev/null +++ b/doc/salome/gui/Makefile.in @@ -0,0 +1,33 @@ +# Copyright (C) 2003 CEA/DEN, EDF R&D +# +# +# +# File : Makefile.in +# Author : Vasily Rusyaev (Open Cascade NN) +# Module : doc +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +@COMMENCE@ + +docs: + cp -fr $(srcdir)/GEOM ./ + -find $(PWD) -name CVS -exec rm -rf {} \; + +clean: + rm -fr `ls | grep -v "Makefile"` + +distclean: clean + rm -fr GEOM + +install: + mkdir -p $(docdir)/gui + cp -rf GEOM $(docdir)/gui + -find $(PWD) -name CVS -exec rm -rf {} \; + +uninstall: + rm -rf $(docdir)/gui/GEOM diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 9b085c403..61b8afc20 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -190,7 +190,12 @@ module GEOM in DirStruct dstruct, in double major_radius, in double minor_radius) raises (SALOME::SALOME_Exception) ; - + + //-----------------------------------------------------------// + // Sketcher // + //-----------------------------------------------------------// + GEOM_Shape MakeSketcher (in string Cmd) raises (SALOME::SALOME_Exception) ; + //-----------------------------------------------------------// // Primitives Construction // //-----------------------------------------------------------// diff --git a/idl/Makefile.in b/idl/Makefile.in index 1d0b5c6cc..d7d1cae79 100644 --- a/idl/Makefile.in +++ b/idl/Makefile.in @@ -6,7 +6,7 @@ top_srcdir=@top_srcdir@ top_builddir=.. srcdir=@srcdir@ -VPATH=.:$(srcdir):${KERNEL_ROOT_DIR}/idl/salome +VPATH=.:${KERNEL_ROOT_DIR}/idl/salome @COMMENCE@ @@ -17,11 +17,14 @@ IDL_FILES = \ PY_CLIENT_IDL = $(IDL_FILES) # we copy all idl file in $(top_builddir)/idl -inc: $(IDL_FILES:%=$(top_builddir)/idl/%) +inc: $(top_builddir)/idl/salome $(IDL_FILES:%=$(top_builddir)/idl/salome/%) -$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:% +$(top_builddir)/idl/salome: + mkdir $@ + +$(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%) # $(CP) $< $@ - cp -f $< $@ + cp -f $^ $(top_builddir)/idl/salome lib: pyidl @@ -33,7 +36,7 @@ pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py) $(PYTHON_BUILD_SITE): $(INSTALL) -d $@ -$(PYTHON_BUILD_SITE)/%_idl.py: %.idl +$(PYTHON_BUILD_SITE)/%_idl.py: $(top_builddir)/idl/salome/%.idl $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $< @@ -41,12 +44,12 @@ $(PYTHON_BUILD_SITE)/%_idl.py: %.idl install: install-pyidl install-idl # create directory $(idldir) and copy idl files into it -install-idl: $(IDL_FILES) +install-idl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%) $(INSTALL) -d $(idldir) $(INSTALL_DATA) $^ $(idldir) -install-pyidl: $(IDL_FILES) +install-pyidl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%) $(INSTALL) -d $(PYTHON_SITE_INSTALL) @for file in $^ dummy; do \ if [ $$file != "dummy" ]; then \ @@ -61,6 +64,6 @@ cleandep: distclean: -$(RM) *.py - -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%) + -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/salome/%) -$(RM) Makefile diff --git a/resources/GEOM.config b/resources/GEOM.config new file mode 100644 index 000000000..692539760 --- /dev/null +++ b/resources/GEOM.config @@ -0,0 +1 @@ +language=en \ No newline at end of file diff --git a/resources/GEOM_en.xml b/resources/GEOM_en.xml index 1b6fdcc20..aba68d130 100644 --- a/resources/GEOM_en.xml +++ b/resources/GEOM_en.xml @@ -71,21 +71,6 @@ - - - - - - - - - - - - - - - @@ -257,19 +242,5 @@ - - - - - - - - - - - - - - diff --git a/resources/GEOM_fr.xml b/resources/GEOM_fr.xml index 855153c6f..b5c4eb07e 100644 --- a/resources/GEOM_fr.xml +++ b/resources/GEOM_fr.xml @@ -39,110 +39,120 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - + + + + + + + + + + + + + - - - + - - - - + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + - - - - + + + + + - - - + + + + + - - - - - - - - - - + + + + + + + + + + - + - - + + - + + - - - - - - - + + + + + + + @@ -150,16 +160,15 @@ - - + + - - - - + + + + - @@ -167,80 +176,67 @@ - - - - - - - - + + + + + + + + - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - + + - - + + - - - + + + - + - - - - - - - - - - - - - - - + diff --git a/src/ARCHIMEDE/Archimede_VolumeSection.cxx b/src/ARCHIMEDE/Archimede_VolumeSection.cxx index 86d058af3..d354c1f55 100644 --- a/src/ARCHIMEDE/Archimede_VolumeSection.cxx +++ b/src/ARCHIMEDE/Archimede_VolumeSection.cxx @@ -406,3 +406,4 @@ void VolumeSection::getZ( double& min, double& max) min = Zmin; max = Zmax; } + diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx index 54e4116cb..aef6d70b0 100644 --- a/src/BasicGUI/BasicGUI.cxx +++ b/src/BasicGUI/BasicGUI.cxx @@ -201,7 +201,7 @@ gp_Pnt BasicGUI::ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3 gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir); Standard_Real X, Y, Z; - aView->Convert(x, y, X, Y, Z); + aView->Convert(int(x), int(y), X, Y, Z); gp_Pnt ConvertedPoint(X, Y, Z); gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint); diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 33f929e3d..4c3bfaa9c 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "BasicGUI_ArcDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : BasicGUI_ArcDlg() // purpose : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the @@ -137,6 +140,7 @@ void BasicGUI_ArcDlg::ClickOnOk() //================================================================================= void BasicGUI_ArcDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index b29e778fe..a10e4049f 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "BasicGUI_CircleDlg.h" #include @@ -35,6 +34,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : BasicGUI_CircleDlg() // purpose : Constructs a BasicGUI_CircleDlg which is a child of 'parent', with the @@ -147,6 +150,7 @@ void BasicGUI_CircleDlg::ClickOnOk() //================================================================================= void BasicGUI_CircleDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index 6093d492b..80321b426 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -25,7 +25,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "BasicGUI_EllipseDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : BasicGUI_EllipseDlg() // purpose : Constructs a BasicGUI_EllipseDlg which is a child of 'parent', with the @@ -153,6 +156,7 @@ void BasicGUI_EllipseDlg::ClickOnOk() //================================================================================= void BasicGUI_EllipseDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index b5b649821..a146f4d8e 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "BasicGUI_LineDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : BasicGUI_LineDlg() // purpose : Constructs a BasicGUI_LineDlg which is a child of 'parent', with the @@ -135,6 +138,7 @@ void BasicGUI_LineDlg::ClickOnOk() //================================================================================= void BasicGUI_LineDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index cd429b1bc..6b3a77f8f 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "BasicGUI_PlaneDlg.h" #include @@ -37,6 +36,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : BasicGUI_PlaneDlg() // purpose : Constructs a BasicGUI_PlaneDlg which is a child of 'parent', with the @@ -273,6 +276,7 @@ void BasicGUI_PlaneDlg::ClickOnOk() //================================================================================= void BasicGUI_PlaneDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 51b287dd2..52128eeac 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -259,6 +259,7 @@ void BasicGUI_PointDlg::ClickOnOk() //================================================================================= void BasicGUI_PointDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if(mySimulationTopoDs.IsNull()) return; diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 6d4eb0d24..03baf4300 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -237,6 +237,7 @@ void BasicGUI_VectorDlg::ClickOnOk() //================================================================================= void BasicGUI_VectorDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 1403f8f02..515269302 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -127,6 +127,7 @@ void BasicGUI_WorkingPlaneDlg::ClickOnOk() //================================================================================= void BasicGUI_WorkingPlaneDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if(myOkPlane) myBasicGUI->MakeWorkingPlane(myLoc, myDir); diff --git a/src/BooleanGUI/BooleanGUI_CutDlg.cxx b/src/BooleanGUI/BooleanGUI_CutDlg.cxx index 1cc08269d..4123fed72 100644 --- a/src/BooleanGUI/BooleanGUI_CutDlg.cxx +++ b/src/BooleanGUI/BooleanGUI_CutDlg.cxx @@ -52,8 +52,8 @@ BooleanGUI_CutDlg::BooleanGUI_CutDlg(QWidget* parent, const char* name, BooleanG GroupCut = new DlgRef_2Sel_QTD(this, "GroupCut"); GroupCut->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupCut->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); - GroupCut->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + GroupCut->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupCut->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); GroupCut->PushButton1->setPixmap(image1); GroupCut->PushButton2->setPixmap(image1); diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index f5b403f0d..770cc70b3 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -26,12 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "BuildGUI_EdgeDlg.h" #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : BuildGUI_EdgeDlg() // purpose : Constructs a BuildGUI_EdgeDlg which is a child of 'parent', with the diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index 2edaf57b9..197231414 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -52,7 +52,7 @@ BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, BuildGUI* GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_FACE_FFW")); - GroupPoints->TextLabel1->setText(tr("GEOM_WIRE")); + GroupPoints->TextLabel1->setText(tr("GEOM_WIRES")); GroupPoints->CheckButton1->setText(tr("GEOM_FACE_OPT")); GroupPoints->PushButton1->setPixmap(image1); diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx index 8a33f4cf6..1f4df38cf 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.cxx +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -87,7 +87,7 @@ void BuildGUI_ShellDlg::Init() myEditCurrentArgument = GroupShell->LineEdit1; myOkListShapes = false; - myFaceFilter = new GEOM_FaceFilter(StdSelect_Plane, myGeom); + myFaceFilter = new GEOM_ShapeTypeFilter(TopAbs_FACE, myGeom); /* Filter for the next selection */ mySelection->AddFilter(myFaceFilter) ; @@ -163,10 +163,8 @@ void BuildGUI_ShellDlg::SelectionIntoArgument() //================================================================================= void BuildGUI_ShellDlg::SetEditCurrentArgument() { - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; + mySelection->ClearFilters(); GroupShell->LineEdit1->setFocus(); - myEditCurrentArgument = GroupShell->LineEdit1; mySelection->AddFilter(myFaceFilter); this->SelectionIntoArgument(); return; diff --git a/src/BuildGUI/BuildGUI_ShellDlg.h b/src/BuildGUI/BuildGUI_ShellDlg.h index 87f3d428e..3bb860857 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.h +++ b/src/BuildGUI/BuildGUI_ShellDlg.h @@ -34,7 +34,7 @@ #include "BuildGUI.h" -#include "GEOM_FaceFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" //================================================================================= // class : BuildGUI_ShellDlg @@ -54,7 +54,7 @@ private: BuildGUI* myBuildGUI; - Handle(GEOM_FaceFilter) myFaceFilter; /* Filters selection */ + Handle(GEOM_ShapeTypeFilter) myFaceFilter; /* Filters selection */ GEOM::GEOM_Gen::ListOfIOR myListShapes; bool myOkListShapes; /* to check when arguments is defined */ @@ -64,7 +64,6 @@ private slots: void ClickOnOk(); void ClickOnApply(); void SetEditCurrentArgument(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void ActivateThisDialog(); diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 73235ed1b..0ef6fcdfe 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header: -using namespace std; #include "DisplayGUI.h" #include "QAD_RightFrame.h" @@ -39,6 +38,10 @@ using namespace std; #include +#include "utilities.h" + +using namespace std; + //======================================================================= // function : DisplayGUI() // purpose : Constructor @@ -232,6 +235,11 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO if(theIO.IsNull()) MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed") + Standard_Boolean testResult; + GEOM::GEOM_Shape_var myGeomShape = myDisplayGUI->myGeomBase->ConvertIOinGEOMShape(theIO, testResult); + if(!testResult) + return; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK diff --git a/src/DlgRef/DlgRef_4Sel1List_QTD.cxx b/src/DlgRef/DlgRef_4Sel1List_QTD.cxx index 62582e40b..04b28ef15 100644 --- a/src/DlgRef/DlgRef_4Sel1List_QTD.cxx +++ b/src/DlgRef/DlgRef_4Sel1List_QTD.cxx @@ -41,86 +41,105 @@ DlgRef_4Sel1List_QTD::DlgRef_4Sel1List_QTD( QWidget* parent, const char* name, Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); - LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); - - Layout1->addWidget( LineEdit2, 1, 2 ); - - PushButton4 = new QPushButton( GroupBox1, "PushButton4" ); - PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); - PushButton4->setText( trUtf8( "" ) ); + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); - Layout1->addWidget( PushButton4, 4, 1 ); + Layout1->addWidget( TextLabel1, 0, 0 ); PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); PushButton1->setText( trUtf8( "" ) ); Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); - LineEdit4 = new QLineEdit( GroupBox1, "LineEdit4" ); - - Layout1->addWidget( LineEdit4, 4, 2 ); + Layout1->addWidget( LineEdit1, 0, 2 ); + - PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); - PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); - PushButton3->setText( trUtf8( "" ) ); + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); - Layout1->addWidget( PushButton3, 3, 1 ); + Layout1->addWidget( TextLabel2, 1, 0 ); PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); PushButton2->setText( trUtf8( "" ) ); Layout1->addWidget( PushButton2, 1, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); - TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); - TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); - TextLabel1->setText( trUtf8( "TL1" ) ); + Layout1->addWidget( LineEdit2, 1, 2 ); - Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); - TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + Layout1->addWidget( ComboBox1, 2, 2 ); + + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_4Sel1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + + GroupBox2 = new QGroupBox( this, "GroupBox2" ); + GroupBox2->setTitle( trUtf8( "" ) ); + GroupBox2->setColumnLayout(0, Qt::Vertical ); + GroupBox2->layout()->setSpacing( 6 ); + GroupBox2->layout()->setMargin( 11 ); + GroupBox2Layout = new QGridLayout( GroupBox2->layout() ); + GroupBox2Layout->setAlignment( Qt::AlignTop ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel4 = new QLabel( GroupBox2, "TextLabel4" ); TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); TextLabel4->setText( trUtf8( "TL4" ) ); - - Layout1->addWidget( TextLabel4, 3, 0 ); + + Layout2->addWidget( TextLabel4, 0, 0 ); QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding ); Layout1->addItem( spacer, 5, 2 ); - LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); - - Layout1->addWidget( LineEdit1, 0, 2 ); + PushButton3 = new QPushButton( GroupBox2, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); - TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); - TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); - TextLabel5->setText( trUtf8( "TL5" ) ); + Layout2->addWidget( PushButton3, 0, 1 ); - Layout1->addWidget( TextLabel5, 4, 0 ); + LineEdit3 = new QLineEdit( GroupBox2, "LineEdit3" ); - LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + Layout2->addWidget( LineEdit3, 0, 2 ); - Layout1->addWidget( LineEdit3, 3, 2 ); - TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); - TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); - TextLabel2->setText( trUtf8( "TL2" ) ); - - Layout1->addWidget( TextLabel2, 1, 0 ); + TextLabel5 = new QLabel( GroupBox2, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); - ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); - ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + Layout2->addWidget( TextLabel5, 1, 0 ); - Layout1->addWidget( ComboBox1, 2, 2 ); + PushButton4 = new QPushButton( GroupBox2, "PushButton4" ); + PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); + PushButton4->setText( trUtf8( "" ) ); - TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); - TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); - TextLabel3->setText( trUtf8( "TL3" ) ); + Layout2->addWidget( PushButton4, 1, 1 ); - Layout1->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); + LineEdit4 = new QLineEdit( GroupBox2, "LineEdit4" ); - GroupBox1Layout->addLayout( Layout1, 0, 0 ); + Layout2->addWidget( LineEdit4, 1, 2 ); - DlgRef_4Sel1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); + GroupBox2Layout->addLayout( Layout2, 0, 0 ); + + DlgRef_4Sel1List_QTDLayout->addWidget( GroupBox2, 1, 0 ); } /* diff --git a/src/DlgRef/DlgRef_4Sel1List_QTD.h b/src/DlgRef/DlgRef_4Sel1List_QTD.h index f09d2729d..d8390e2a2 100644 --- a/src/DlgRef/DlgRef_4Sel1List_QTD.h +++ b/src/DlgRef/DlgRef_4Sel1List_QTD.h @@ -29,6 +29,7 @@ public: ~DlgRef_4Sel1List_QTD(); QGroupBox* GroupBox1; + QGroupBox* GroupBox2; QLineEdit* LineEdit2; QPushButton* PushButton4; QPushButton* PushButton1; @@ -48,7 +49,9 @@ public: protected: QGridLayout* DlgRef_4Sel1List_QTDLayout; QGridLayout* GroupBox1Layout; + QGridLayout* GroupBox2Layout; QGridLayout* Layout1; + QGridLayout* Layout2; }; #endif // DLGREF_4SEL1LIST_QTD_H diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.cxx b/src/DlgRef/DlgRef_Skeleton_QTD.cxx index cb1100af3..897e3f19c 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.cxx +++ b/src/DlgRef/DlgRef_Skeleton_QTD.cxx @@ -1,7 +1,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'DlgRef_Skeleton_QTD.ui' ** -** Created: mar sep 23 15:06:58 2003 +** Created: Fri Apr 16 12:57:26 2004 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include #include @@ -29,7 +31,7 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, bo { if ( !name ) setName( "DlgRef_Skeleton_QTD" ); - resize( 307, 147 ); + resize( 321, 295 ); setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); setCaption( trUtf8( "DlgRef_Skeleton_QTD" ) ); setSizeGripEnabled( TRUE ); @@ -37,6 +39,12 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, bo Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + GroupMedium = new QGroupBox( this, "GroupMedium" ); + GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); + GroupMedium->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupMedium, 2, 0 ); + GroupButtons = new QGroupBox( this, "GroupButtons" ); GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); GroupButtons->setTitle( trUtf8( "" ) ); @@ -63,7 +71,7 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, bo Layout3->addWidget( buttonCancel ); GroupButtonsLayout->addLayout( Layout3 ); - Layout1->addWidget( GroupButtons, 2, 0 ); + Layout1->addWidget( GroupButtons, 3, 0 ); GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); @@ -92,11 +100,28 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, bo Layout1->addWidget( GroupConstructors, 0, 0 ); - GroupMedium = new QGroupBox( this, "GroupMedium" ); - GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); - GroupMedium->setTitle( trUtf8( "" ) ); + GroupBoxName = new QGroupBox( this, "GroupBoxName" ); + GroupBoxName->setTitle( trUtf8( "Result name" ) ); + GroupBoxName->setColumnLayout(0, Qt::Vertical ); + GroupBoxName->layout()->setSpacing( 6 ); + GroupBoxName->layout()->setMargin( 11 ); + GroupBoxNameLayout = new QGridLayout( GroupBoxName->layout() ); + GroupBoxNameLayout->setAlignment( Qt::AlignTop ); + + Layout66 = new QGridLayout( 0, 1, 1, 0, 6, "Layout66"); + + ResultName = new QLineEdit( GroupBoxName, "ResultName" ); + + Layout66->addWidget( ResultName, 0, 1 ); + + NameLabel = new QLabel( GroupBoxName, "NameLabel" ); + NameLabel->setText( trUtf8( "Name" ) ); + + Layout66->addWidget( NameLabel, 0, 0 ); + + GroupBoxNameLayout->addLayout( Layout66, 0, 0 ); - Layout1->addWidget( GroupMedium, 1, 0 ); + Layout1->addWidget( GroupBoxName, 1, 0 ); DlgRef_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); } diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.h b/src/DlgRef/DlgRef_Skeleton_QTD.h index f16363d60..38d6d83d6 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.h +++ b/src/DlgRef/DlgRef_Skeleton_QTD.h @@ -1,7 +1,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'DlgRef_Skeleton_QTD.ui' ** -** Created: mar sep 23 15:06:57 2003 +** Created: Fri Apr 16 12:57:26 2004 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! @@ -16,6 +16,8 @@ class QHBoxLayout; class QGridLayout; class QButtonGroup; class QGroupBox; +class QLabel; +class QLineEdit; class QPushButton; class QRadioButton; @@ -27,6 +29,7 @@ public: DlgRef_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~DlgRef_Skeleton_QTD(); + QGroupBox* GroupMedium; QGroupBox* GroupButtons; QPushButton* buttonOk; QPushButton* buttonApply; @@ -35,7 +38,9 @@ public: QRadioButton* RadioButton1; QRadioButton* RadioButton2; QRadioButton* RadioButton3; - QGroupBox* GroupMedium; + QGroupBox* GroupBoxName; + QLineEdit* ResultName; + QLabel* NameLabel; protected: @@ -45,6 +50,8 @@ protected: QHBoxLayout* Layout3; QGridLayout* GroupConstructorsLayout; QHBoxLayout* Layout2; + QGridLayout* GroupBoxNameLayout; + QGridLayout* Layout66; }; #endif // DLGREF_SKELETON_QTD_H diff --git a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui index 0c6e57718..eed5c27f4 100644 --- a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui @@ -8,8 +8,8 @@ 0 0 - 307 - 147 + 321 + 295 @@ -51,6 +51,22 @@ 6 + + GroupMedium + + + + 7 + 7 + 0 + 0 + + + + + + + GroupButtons @@ -203,19 +219,51 @@ - GroupMedium - - - - 7 - 7 - 0 - 0 - + GroupBoxName - + Result name + + + unnamed + + + 11 + + + 6 + + + + Layout66 + + + + unnamed + + + 0 + + + 6 + + + + ResultName + + + + + NameLabel + + + Name + + + + + diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx index 4234a8477..049b4fe00 100644 --- a/src/EntityGUI/EntityGUI.cxx +++ b/src/EntityGUI/EntityGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header: -using namespace std; #include "EntityGUI.h" #include "QAD_RightFrame.h" @@ -36,18 +35,18 @@ using namespace std; #include "SALOMEGUI_ImportOperation.h" #include "SALOMEGUI_QtCatchCorbaException.hxx" -#include -#include #include -#include #include -#include #include -#include -#include #include "DisplayGUI.h" -#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE + +#include "EntityGUI_SketcherDlg.h" // Sketcher +#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE + +#include "utilities.h" + +using namespace std; //======================================================================= // function : EntityGUI() @@ -59,6 +58,9 @@ EntityGUI::EntityGUI() : myGeomBase = new GEOMBase(); myGeomGUI = GEOMContext::GetGeomGUI(); myGeom = myGeomGUI->myComponentGeom; + + mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); } @@ -81,126 +83,12 @@ bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) myEntityGUI->myGeomGUI->EmitSignalDeactivateDialog(); SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - switch (theCommandID) { case 404: // SKETCHER { ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002 - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - - myEntityGUI->myGeomGUI->GetSketcher() = Sketch(v3d->getViewer3d()); - myEntityGUI->myGeomGUI->myState = 2; - - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); - - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(LENGTH_PARAMETER, Mb->isItemChecked(4061)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(ANGLE_PARAMETER, Mb->isItemChecked(4062)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(RADIUS_PARAMETER, Mb->isItemChecked(4063)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(XVALUE_PARAMETER, Mb->isItemChecked(4064)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(YVALUE_PARAMETER, Mb->isItemChecked(4065)); - - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - break; - } - case 4041: // SKETCH Segment - { - myEntityGUI->myGeomGUI->GetSketcher().ChangeMode(SEGMENT); - break; - } - case 4042: // SKETCH Arc - { - myEntityGUI->myGeomGUI->GetSketcher().ChangeMode(ARC_CHORD); - break; - } - case 4043: // SKETCH Set Angle - { - myEntityGUI->OnSketchSetAngle(); - break; - } - case 4044: // SKETCH Set X - { - myEntityGUI->OnSketchSetx(); - break; - } - case 4045: // SKETCH Set Y - { - myEntityGUI->OnSketchSety(); - break; - } - case 4046: // SKETCH Delete - { - myEntityGUI->OnSketchDelete(); - break; - } - case 4047: // SKETCH End - { - myEntityGUI->OnSketchEnd(); - break; - } - case 4048: // SKETCH Close - { - myEntityGUI->OnSketchClose(); - break; - } - case 4051: // sketcher Set Plane - { - //TO DO - break; - } - case 4052: // sketcher TANGENT - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - if(Mb->isItemChecked(theCommandID) == true) - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(TANGENT); - else - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - - Mb->setItemChecked(4053, false); - break; - } - case 4053: // sketcher PERPENDICULAR - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - if(Mb->isItemChecked(theCommandID) == true) - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(PERPENDICULAR); - else - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - - Mb->setItemChecked(4052, false); - break; - } - case 4061: // SKETCH OptionsOnofflengthdimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(LENGTH_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4062: // SKETCH OptionsOnoffangledimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(ANGLE_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4063: // SKETCH OptionsOnoffradiusdimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(RADIUS_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4064: // SKETCH OptionsOnoffxdimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(XVALUE_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4065: // SKETCH OptionsOnoffydimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(YVALUE_PARAMETER, Mb->isItemChecked(theCommandID)); + EntityGUI_SketcherDlg* aDlg = new EntityGUI_SketcherDlg(parent, "", myEntityGUI, Sel); break; } case 407: // EXPLODE : use ic @@ -224,254 +112,97 @@ bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //======================================================================= -// function : OnSketchSetAngle() +// function : OnSketchEnd() // purpose : //======================================================================= -void EntityGUI::OnSketchSetAngle() +void EntityGUI::OnSketchEnd(const char *Cmd) { - Standard_Real anAngle = myGeomGUI->GetSketcher().GetSegmentAngle()/PI180; - Sketch::fitInResol(anAngle); - Standard_Boolean res = false; - QString Value = QString("%1").arg(anAngle); - anAngle = myGeomBase->Parameter(res, Value, tr("GEOM_MEN_ANGLE"), tr("GEOM_MEN_ENTER_ANGLE"), - -180.0, +180.0, 6) * PI180; - - if(res) { - myGeomGUI->GetSketcher().SetSegmentAngle(anAngle); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); + try { + GEOM::GEOM_Shape_var result = myGeom->MakeSketcher(Cmd); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } - return; -} - - -//======================================================================= -// function : OnSketchSetx() -// purpose : -//======================================================================= -void EntityGUI::OnSketchSetx() -{ - Standard_Boolean res = false; - double X = myGeomBase->Parameter(res, "0.", tr("GEOM_MEN_X"), tr("GEOM_MEN_SKETCHER_X"), - 2.0 * Precision::Confusion(), 1E6, 6); - if(res) - myGeomGUI->GetSketcher().SetXDimension(X); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); - return; -} - - -//======================================================================= -// function : OnSketchSety() -// purpose : -//======================================================================= -void EntityGUI::OnSketchSety() -{ - Standard_Boolean res = false; - double Y = myGeomBase->Parameter(res, "0.", tr("GEOM_MEN_Y"), tr("GEOM_MEN_SKETCHER_Y"), 2.0 * Precision::Confusion(), 1E6, 6); - if(res) - myGeomGUI->GetSketcher().SetYDimension(Y); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); - return; -} - - -//======================================================================= -// function : OnSketchDelete() -// purpose : -//======================================================================= -void EntityGUI::OnSketchDelete() -{ - if(myGeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS - myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); } - - if(myGeomGUI->GetSketcher().Delete()) - myGeomGUI->myState = -1; return; } -//======================================================================= -// function : OnSketchClose() -// purpose : -//======================================================================= -void EntityGUI::OnSketchClose() +//===================================================================================== +// function : DisplaySimulationShape() +// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape +//===================================================================================== +void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle(AIS_InteractiveContext) myContext = v3d->getAISContext(); - - TopoDS_Wire W = myGeomGUI->GetSketcher().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 + //NRI DEBUG : 14/02/2002 + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; - Curve->D0((First + Last) / 2., CenterPoint); - - GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); - GEOM::PointStruct pC = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z()); - GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); - - GEOM::GEOM_Shape_var arc; - - try { - arc = myGeom->MakeArc(pI, pC, pE); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + try { + if(!S1.IsNull()) { + /* erase any previous */ + ic->Erase(mySimulationShape1, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape1); + + mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape1->Set(S1); + mySimulationShape1->SetColor(Quantity_NOC_RED); + + ic->Deactivate(mySimulationShape1); + ic->Display(mySimulationShape1, Standard_False); + mySimulationShape1->UnsetColor(); + } + if(!S2.IsNull()) { + ic->Erase(mySimulationShape2, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape2); - listShapes->length(i+1); - listShapes[i] = strdup(arc->Name()); - i++; - } - else { - GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); - GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); - GEOM::GEOM_Shape_var segment; - - try { - segment = myGeom->MakeEdge(pI,pE); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } + mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape2->Set(S2); + mySimulationShape2->SetColor(Quantity_NOC_VIOLET); - listShapes->length(i+1); - listShapes[i] = strdup(segment->Name()); - i++; - } - Ex.Next(); + ic->Deactivate(mySimulationShape2); + ic->Display(mySimulationShape2, Standard_False); + mySimulationShape2->UnsetColor(); } - GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes); - TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire); - Standard_CString type; - myGeomBase->GetShapeTypeString(S,type); - Wire->NameType(type); - - if(myGeomBase->Display(Wire)) - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + ic->UpdateCurrentViewer(); } - myGeomGUI->myState = -1; - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS - myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + catch(Standard_Failure) { + MESSAGE("Exception catched in EntityGUI::DisplaySimulationShape "); + } return; } -//======================================================================= -// function : OnSketchEnd() -// purpose : -//======================================================================= -void EntityGUI::OnSketchEnd() +//================================================================================== +// function : EraseSimulationShape() +// purpose : Clears the display of 'mySimulationShape' a pure graphical shape +//================================================================================== +void EntityGUI::EraseSimulationShape(int Sh) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - - TopoDS_Wire W = myGeomGUI->GetSketcher().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 = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); - GEOM::PointStruct pC = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z()); - GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); - - GEOM::GEOM_Shape_var arc; - - try { - arc = myGeom->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 = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); - GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); - GEOM::GEOM_Shape_var segment; - - try { - segment = myGeom->MakeEdge(pI,pE); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - listShapes->length(i+1); - listShapes[i] = strdup(segment->Name()); - i++; + int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < count; i++) { + if(QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + if(Sh < 1) { + ic->Erase(mySimulationShape1, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape1); } - Ex.Next(); - } - - GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes); - TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire); - Standard_CString type; - myGeomBase->GetShapeTypeString(S,type); - Wire->NameType(type); - - if(myGeomBase->Display(Wire)) - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + if(Sh <= 1) { + ic->Erase(mySimulationShape2, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape2); + } + ic->UpdateCurrentViewer(); + } } - myGeomGUI->myState = -1; - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS - myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - return; } @@ -579,7 +310,7 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap } else { aResult->NameType(tr("GEOM_SHAPE")); - sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++); } SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); @@ -814,7 +545,7 @@ bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* } else { aResult->NameType(tr("GEOM_SHAPE")); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++); } result = new GEOM_AISShape(Exp.Current(), nameG); IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); @@ -823,10 +554,10 @@ bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* else { if ( myGeomBase->GetShapeTypeString(compound,Type)) { aResult->NameType(Type); - sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); + sprintf (nameG, "%s_%d", Type, myGeomGUI->myNbGeom++); } else { aResult->NameType(tr("GEOM_SHAPE")); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++); } result = new GEOM_AISShape(compound, nameG); IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); diff --git a/src/EntityGUI/EntityGUI.h b/src/EntityGUI/EntityGUI.h index 863e310ed..9ecb56744 100644 --- a/src/EntityGUI/EntityGUI.h +++ b/src/EntityGUI/EntityGUI.h @@ -45,14 +45,10 @@ public : static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - /* Sketcher management */ - void OnSketchSetAngle(); - void OnSketchSetx(); - void OnSketchSety(); - - void OnSketchDelete(); - void OnSketchClose(); - void OnSketchEnd(); + void OnSketchEnd(const char *Cmd); + + void DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + void EraseSimulationShape(int Sh = 0); /* Methods for sub shapes explode */ bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); @@ -60,6 +56,10 @@ public : bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext); + /* AIS shape used only during topo/geom simulations */ + Handle(AIS_Shape) mySimulationShape1; + Handle(AIS_Shape) mySimulationShape2; + GEOMBase* myGeomBase; GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.cxx b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx new file mode 100644 index 000000000..01584de8f --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx @@ -0,0 +1,94 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_1Sel_QTD.ui' +** +** Created: Fri Apr 30 11:23:36 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_1Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_1Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_1Sel_QTD::EntityGUI_1Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_1Sel_QTD" ); + resize( 245, 110 ); + setCaption( trUtf8( "EntityGUI_1Sel_QTD" ) ); + EntityGUI_1Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_1Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 180, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 1, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + LineEdit1->setFocusPolicy( QLineEdit::NoFocus ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_1Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Sel_QTD::~EntityGUI_1Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.h b/src/EntityGUI/EntityGUI_1Sel_QTD.h new file mode 100644 index 000000000..915cda9c4 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_1Sel_QTD.ui' +** +** Created: Fri Apr 30 11:23:32 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_1SEL_QTD_H +#define ENTITYGUI_1SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class EntityGUI_1Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_1Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_1Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* EntityGUI_1Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_1SEL_QTD_H diff --git a/src/EntityGUI/EntityGUI_1Spin.cxx b/src/EntityGUI/EntityGUI_1Spin.cxx new file mode 100644 index 000000000..131a45500 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin.cxx @@ -0,0 +1,56 @@ +// 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 : EntityGUI_1Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_1Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +EntityGUI_1Spin::EntityGUI_1Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_1Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Spin::~EntityGUI_1Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_1Spin.h b/src/EntityGUI/EntityGUI_1Spin.h new file mode 100644 index 000000000..fb5814ca2 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin.h @@ -0,0 +1,47 @@ +// 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 : EntityGUI_1Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_1SPIN_H +#define ENTITYGUI_1SPIN_H + +#include "EntityGUI_1Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_1Spin : public EntityGUI_1Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_1Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~EntityGUI_1Spin(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#endif // ENTITYGUI_1SPIN_H diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.cxx b/src/EntityGUI/EntityGUI_1Spin_QTD.cxx new file mode 100644 index 000000000..20f21d295 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.cxx @@ -0,0 +1,88 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_1Spin_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_1Spin_QTD::EntityGUI_1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_1Spin_QTD" ); + resize( 154, 96 ); + setCaption( trUtf8( "EntityGUI_1Spin_QTD" ) ); + EntityGUI_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 3, 1 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Spin_QTD::~EntityGUI_1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.h b/src/EntityGUI/EntityGUI_1Spin_QTD.h new file mode 100644 index 000000000..b44238263 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_1Spin_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_1SPIN_QTD_H +#define ENTITYGUI_1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_1Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + + +protected: + QGridLayout* EntityGUI_1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_1SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_2Spin.cxx b/src/EntityGUI/EntityGUI_2Spin.cxx new file mode 100644 index 000000000..b71d731ae --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin.cxx @@ -0,0 +1,60 @@ +// 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 : EntityGUI_2Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_2Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_2Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +EntityGUI_2Spin::EntityGUI_2Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_2Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_2Spin::~EntityGUI_2Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_2Spin.h b/src/EntityGUI/EntityGUI_2Spin.h new file mode 100644 index 000000000..4d0dd21a3 --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin.h @@ -0,0 +1,48 @@ +// 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 : EntityGUI_2Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_2SPIN_H +#define ENTITYGUI_2SPIN_H + +#include "EntityGUI_2Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_2Spin : public EntityGUI_2Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~EntityGUI_2Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + +}; + +#endif // ENTITYGUI_2SPIN_H diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.cxx b/src/EntityGUI/EntityGUI_2Spin_QTD.cxx new file mode 100644 index 000000000..a01f2a783 --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.cxx @@ -0,0 +1,99 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_2Spin_QTD.ui' +** +** Created: ven déc 12 11:17:11 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_2Spin_QTD::EntityGUI_2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_2Spin_QTD" ); + resize( 154, 96 ); + setCaption( trUtf8( "EntityGUI_2Spin_QTD" ) ); + EntityGUI_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_2Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 3, 1 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_2Spin_QTD::~EntityGUI_2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.h b/src/EntityGUI/EntityGUI_2Spin_QTD.h new file mode 100644 index 000000000..4827aa86c --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_2Spin_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_2SPIN_QTD_H +#define ENTITYGUI_2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_2Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel2; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + + +protected: + QGridLayout* EntityGUI_2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_2SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_3Spin.cxx b/src/EntityGUI/EntityGUI_3Spin.cxx new file mode 100644 index 000000000..fe73aeba5 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin.cxx @@ -0,0 +1,63 @@ +// 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 : EntityGUI_3Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_3Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_3Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +EntityGUI_3Spin::EntityGUI_3Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_3Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + Layout1->addWidget(SpinBox_DZ, 2, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_3Spin::~EntityGUI_3Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_3Spin.h b/src/EntityGUI/EntityGUI_3Spin.h new file mode 100644 index 000000000..58b732d31 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin.h @@ -0,0 +1,49 @@ +// 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 : EntityGUI_3Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_3SPIN_H +#define ENTITYGUI_3SPIN_H + +#include "EntityGUI_3Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_3Spin : public EntityGUI_3Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_3Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_3Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + +}; + +#endif // ENTITYGUI_3SPIN_H diff --git a/src/EntityGUI/EntityGUI_3Spin_QTD.cxx b/src/EntityGUI/EntityGUI_3Spin_QTD.cxx new file mode 100644 index 000000000..8fa505304 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.cxx @@ -0,0 +1,110 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_3Spin_QTD.ui' +** +** Created: ven déc 12 11:17:11 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_3Spin_QTD::EntityGUI_3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_3Spin_QTD" ); + resize( 154, 120 ); + setCaption( trUtf8( "EntityGUI_3Spin_QTD" ) ); + EntityGUI_3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_3Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 3, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_3Spin_QTD::~EntityGUI_3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_3Spin_QTD.h b/src/EntityGUI/EntityGUI_3Spin_QTD.h new file mode 100644 index 000000000..1efc3a5c1 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_3Spin_QTD.ui' +** +** Created: ven déc 12 11:17:11 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_3SPIN_QTD_H +#define ENTITYGUI_3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_3Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel2; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; + + +protected: + QGridLayout* EntityGUI_3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_3SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_4Spin.cxx b/src/EntityGUI/EntityGUI_4Spin.cxx new file mode 100644 index 000000000..29aa398a1 --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin.cxx @@ -0,0 +1,67 @@ +// 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 : EntityGUI_4Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_4Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_4Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +EntityGUI_4Spin::EntityGUI_4Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_4Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + SpinBox4->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + Layout1->addWidget(SpinBox_DZ, 2, 1); + + SpinBox_DS = new DlgRef_SpinBox(GroupBox1, "SpinBox_DS"); + Layout1->addWidget(SpinBox_DS, 3, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_4Spin::~EntityGUI_4Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_4Spin.h b/src/EntityGUI/EntityGUI_4Spin.h new file mode 100644 index 000000000..9a97fff1e --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin.h @@ -0,0 +1,50 @@ +// 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 : EntityGUI_4Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_4SPIN_H +#define ENTITYGUI_4SPIN_H + +#include "EntityGUI_4Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_4Spin : public EntityGUI_4Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_4Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_4Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + DlgRef_SpinBox* SpinBox_DS; + +}; + +#endif // ENTITYGUI_4SPIN_H diff --git a/src/EntityGUI/EntityGUI_4Spin_QTD.cxx b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx new file mode 100644 index 000000000..428da7dfb --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx @@ -0,0 +1,128 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_4Spin_QTD.ui' +** +** Created: Fri Apr 30 10:56:21 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_4Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_4Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_4Spin_QTD::EntityGUI_4Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_4Spin_QTD" ); + resize( 176, 154 ); + setCaption( trUtf8( "EntityGUI_4Spin_QTD" ) ); + EntityGUI_4Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_4Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 70, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 4, 1 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox4, 3, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout1->addWidget( TextLabel4, 3, 0 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( buttonUndo, buttonApply ); + setTabOrder( buttonApply, SpinBox1 ); + setTabOrder( SpinBox1, SpinBox2 ); + setTabOrder( SpinBox2, SpinBox3 ); + setTabOrder( SpinBox3, SpinBox4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_4Spin_QTD::~EntityGUI_4Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_4Spin_QTD.h b/src/EntityGUI/EntityGUI_4Spin_QTD.h new file mode 100644 index 000000000..4aa37176d --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_4Spin_QTD.ui' +** +** Created: Fri Apr 30 10:56:17 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_4SPIN_QTD_H +#define ENTITYGUI_4SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_4Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_4Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QSpinBox* SpinBox3; + QSpinBox* SpinBox2; + QLabel* TextLabel2; + QSpinBox* SpinBox4; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel4; + + +protected: + QGridLayout* EntityGUI_4Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_4SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_Dir1_QTD.cxx b/src/EntityGUI/EntityGUI_Dir1_QTD.cxx new file mode 100644 index 000000000..40b070b47 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir1_QTD.cxx @@ -0,0 +1,80 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Dir1_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Dir1_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Dir1_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Dir1_QTD::EntityGUI_Dir1_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Dir1_QTD" ); + resize( 131, 123 ); + setCaption( trUtf8( "EntityGUI_Dir1_QTD" ) ); + EntityGUI_Dir1_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Dir1_QTDLayout"); + + GroupDir1 = new QButtonGroup( this, "GroupDir1" ); + GroupDir1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDir1->sizePolicy().hasHeightForWidth() ) ); + GroupDir1->setTitle( trUtf8( "Direction" ) ); + GroupDir1->setColumnLayout(0, Qt::Vertical ); + GroupDir1->layout()->setSpacing( 6 ); + GroupDir1->layout()->setMargin( 11 ); + GroupDir1Layout = new QGridLayout( GroupDir1->layout() ); + GroupDir1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Dir12 = new QRadioButton( GroupDir1, "RB_Dir12" ); + RB_Dir12->setText( trUtf8( "Perpendicular" ) ); + + Layout1->addWidget( RB_Dir12, 1, 0 ); + + RB_Dir13 = new QRadioButton( GroupDir1, "RB_Dir13" ); + RB_Dir13->setText( trUtf8( "Tangent" ) ); + + Layout1->addWidget( RB_Dir13, 2, 0 ); + + RB_Dir11 = new QRadioButton( GroupDir1, "RB_Dir11" ); + RB_Dir11->setText( trUtf8( "Angle" ) ); + + Layout1->addWidget( RB_Dir11, 0, 0 ); + + RB_Dir14 = new QRadioButton( GroupDir1, "RB_Dir14" ); + RB_Dir14->setText( trUtf8( "VX-VY" ) ); + + Layout1->addWidget( RB_Dir14, 3, 0 ); + + GroupDir1Layout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Dir1_QTDLayout->addWidget( GroupDir1, 0, 0 ); + + // tab order + setTabOrder( RB_Dir11, RB_Dir12 ); + setTabOrder( RB_Dir12, RB_Dir13 ); + setTabOrder( RB_Dir13, RB_Dir14 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Dir1_QTD::~EntityGUI_Dir1_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Dir1_QTD.h b/src/EntityGUI/EntityGUI_Dir1_QTD.h new file mode 100644 index 000000000..31a85e8bb --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir1_QTD.h @@ -0,0 +1,41 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Dir1_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_DIR1_QTD_H +#define ENTITYGUI_DIR1_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Dir1_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Dir1_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Dir1_QTD(); + + QButtonGroup* GroupDir1; + QRadioButton* RB_Dir12; + QRadioButton* RB_Dir13; + QRadioButton* RB_Dir11; + QRadioButton* RB_Dir14; + + +protected: + QGridLayout* EntityGUI_Dir1_QTDLayout; + QGridLayout* GroupDir1Layout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_DIR1_QTD_H diff --git a/src/EntityGUI/EntityGUI_Dir2_QTD.cxx b/src/EntityGUI/EntityGUI_Dir2_QTD.cxx new file mode 100644 index 000000000..6fee0814c --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir2_QTD.cxx @@ -0,0 +1,76 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Dir2_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Dir2_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Dir2_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Dir2_QTD::EntityGUI_Dir2_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Dir2_QTD" ); + resize( 124, 106 ); + setCaption( trUtf8( "EntityGUI_Dir2_QTD" ) ); + EntityGUI_Dir2_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Dir2_QTDLayout"); + + GroupDir2 = new QButtonGroup( this, "GroupDir2" ); + GroupDir2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDir2->sizePolicy().hasHeightForWidth() ) ); + GroupDir2->setTitle( trUtf8( "Direction" ) ); + GroupDir2->setColumnLayout(0, Qt::Vertical ); + GroupDir2->layout()->setSpacing( 6 ); + GroupDir2->layout()->setMargin( 11 ); + GroupDir2Layout = new QGridLayout( GroupDir2->layout() ); + GroupDir2Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Dir22 = new QRadioButton( GroupDir2, "RB_Dir22" ); + RB_Dir22->setText( trUtf8( "X" ) ); + + Layout1->addWidget( RB_Dir22, 1, 0 ); + + RB_Dir23 = new QRadioButton( GroupDir2, "RB_Dir23" ); + RB_Dir23->setText( trUtf8( "Y" ) ); + + Layout1->addWidget( RB_Dir23, 2, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 0 ); + + RB_Dir21 = new QRadioButton( GroupDir2, "RB_Dir21" ); + RB_Dir21->setText( trUtf8( "Length" ) ); + + Layout1->addWidget( RB_Dir21, 0, 0 ); + + GroupDir2Layout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Dir2_QTDLayout->addWidget( GroupDir2, 0, 0 ); + + // tab order + setTabOrder( RB_Dir21, RB_Dir22 ); + setTabOrder( RB_Dir22, RB_Dir23 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Dir2_QTD::~EntityGUI_Dir2_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Dir2_QTD.h b/src/EntityGUI/EntityGUI_Dir2_QTD.h new file mode 100644 index 000000000..04ae7382f --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir2_QTD.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Dir2_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_DIR2_QTD_H +#define ENTITYGUI_DIR2_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Dir2_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Dir2_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Dir2_QTD(); + + QButtonGroup* GroupDir2; + QRadioButton* RB_Dir22; + QRadioButton* RB_Dir23; + QRadioButton* RB_Dir21; + + +protected: + QGridLayout* EntityGUI_Dir2_QTDLayout; + QGridLayout* GroupDir2Layout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_DIR2_QTD_H diff --git a/src/EntityGUI/EntityGUI_Point_QTD.cxx b/src/EntityGUI/EntityGUI_Point_QTD.cxx new file mode 100644 index 000000000..901a14fe2 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Point_QTD.cxx @@ -0,0 +1,74 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Point_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Point_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Point_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Point_QTD::EntityGUI_Point_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Point_QTD" ); + resize( 124, 106 ); + setCaption( trUtf8( "EntityGUI_Point_QTD" ) ); + EntityGUI_Point_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Point_QTDLayout"); + + GroupPoint = new QButtonGroup( this, "GroupPoint" ); + GroupPoint->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupPoint->sizePolicy().hasHeightForWidth() ) ); + GroupPoint->setTitle( trUtf8( "Point" ) ); + GroupPoint->setColumnLayout(0, Qt::Vertical ); + GroupPoint->layout()->setSpacing( 6 ); + GroupPoint->layout()->setMargin( 11 ); + GroupPointLayout = new QGridLayout( GroupPoint->layout() ); + GroupPointLayout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Point2 = new QRadioButton( GroupPoint, "RB_Point2" ); + RB_Point2->setText( trUtf8( "Relative" ) ); + + Layout1->addWidget( RB_Point2, 1, 0 ); + + RB_Point1 = new QRadioButton( GroupPoint, "RB_Point1" ); + RB_Point1->setText( trUtf8( "Absolute" ) ); + + Layout1->addWidget( RB_Point1, 0, 0 ); + + RB_Point3 = new QRadioButton( GroupPoint, "RB_Point3" ); + RB_Point3->setText( trUtf8( "Selection" ) ); + + Layout1->addWidget( RB_Point3, 2, 0 ); + + GroupPointLayout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Point_QTDLayout->addWidget( GroupPoint, 0, 0 ); + + // tab order + setTabOrder( RB_Point1, RB_Point2 ); + setTabOrder( RB_Point2, RB_Point3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Point_QTD::~EntityGUI_Point_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Point_QTD.h b/src/EntityGUI/EntityGUI_Point_QTD.h new file mode 100644 index 000000000..8b58ee2d0 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Point_QTD.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Point_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_POINT_QTD_H +#define ENTITYGUI_POINT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Point_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Point_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Point_QTD(); + + QButtonGroup* GroupPoint; + QRadioButton* RB_Point2; + QRadioButton* RB_Point1; + QRadioButton* RB_Point3; + + +protected: + QGridLayout* EntityGUI_Point_QTDLayout; + QGridLayout* GroupPointLayout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_POINT_QTD_H diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx new file mode 100644 index 000000000..8298731f4 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx @@ -0,0 +1,176 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Skeleton_QTD 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. + */ +EntityGUI_Skeleton_QTD::EntityGUI_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "EntityGUI_Skeleton_QTD" ); + resize( 317, 276 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "EntityGUI_Skeleton_QTD" ) ); + EntityGUI_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "EntityGUI_Skeleton_QTDLayout"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + GroupVal = new QGroupBox( this, "GroupVal" ); + GroupVal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupVal->sizePolicy().hasHeightForWidth() ) ); + GroupVal->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupVal, 2, 0 ); + + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); + GroupConstructors->setTitle( trUtf8( "Element Type" ) ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 6 ); + GroupConstructors->layout()->setMargin( 11 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + RadioButton1 = new QRadioButton( GroupConstructors, "RadioButton1" ); + RadioButton1->setText( trUtf8( "Segment" ) ); + Layout2->addWidget( RadioButton1 ); + + RadioButton2 = new QRadioButton( GroupConstructors, "RadioButton2" ); + RadioButton2->setText( trUtf8( "Arc" ) ); + Layout2->addWidget( RadioButton2 ); + + GroupConstructorsLayout->addLayout( Layout2, 0, 0 ); + + Layout1->addWidget( GroupConstructors, 0, 0 ); + + GroupDest = new QGroupBox( this, "GroupDest" ); + GroupDest->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDest->sizePolicy().hasHeightForWidth() ) ); + GroupDest->setTitle( trUtf8( "Destination" ) ); + GroupDest->setColumnLayout(0, Qt::Vertical ); + GroupDest->layout()->setSpacing( 6 ); + GroupDest->layout()->setMargin( 11 ); + GroupDestLayout = new QGridLayout( GroupDest->layout() ); + GroupDestLayout->setAlignment( Qt::AlignTop ); + + Layout5 = new QGridLayout( 0, 1, 1, 0, 6, "Layout5"); + + GroupDest1 = new QButtonGroup( GroupDest, "GroupDest1" ); + GroupDest1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDest1->sizePolicy().hasHeightForWidth() ) ); + GroupDest1->setTitle( trUtf8( "Type" ) ); + GroupDest1->setColumnLayout(0, Qt::Vertical ); + GroupDest1->layout()->setSpacing( 6 ); + GroupDest1->layout()->setMargin( 11 ); + GroupDest1Layout = new QGridLayout( GroupDest1->layout() ); + GroupDest1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + RB_Dest2 = new QRadioButton( GroupDest1, "RB_Dest2" ); + RB_Dest2->setText( trUtf8( "Direction" ) ); + + Layout4->addWidget( RB_Dest2, 0, 1 ); + + RB_Dest1 = new QRadioButton( GroupDest1, "RB_Dest1" ); + RB_Dest1->setText( trUtf8( "Point" ) ); + + Layout4->addWidget( RB_Dest1, 0, 0 ); + + GroupDest1Layout->addLayout( Layout4, 0, 0 ); + + Layout5->addMultiCellWidget( GroupDest1, 0, 0, 0, 1 ); + + GroupDest2 = new QButtonGroup( GroupDest, "GroupDest2" ); + GroupDest2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest2->sizePolicy().hasHeightForWidth() ) ); + GroupDest2->setTitle( trUtf8( "" ) ); + GroupDest2->setColumnLayout(0, Qt::Vertical ); + GroupDest2->layout()->setSpacing( 6 ); + GroupDest2->layout()->setMargin( 11 ); + GroupDest2Layout = new QGridLayout( GroupDest2->layout() ); + GroupDest2Layout->setAlignment( Qt::AlignTop ); + + Layout5->addWidget( GroupDest2, 1, 0 ); + + GroupDest3 = new QButtonGroup( GroupDest, "GroupDest3" ); + GroupDest3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest3->sizePolicy().hasHeightForWidth() ) ); + GroupDest3->setTitle( trUtf8( "" ) ); + GroupDest3->setColumnLayout(0, Qt::Vertical ); + GroupDest3->layout()->setSpacing( 6 ); + GroupDest3->layout()->setMargin( 11 ); + GroupDest3Layout = new QGridLayout( GroupDest3->layout() ); + GroupDest3Layout->setAlignment( Qt::AlignTop ); + + Layout5->addWidget( GroupDest3, 1, 1 ); + + GroupDestLayout->addLayout( Layout5, 0, 0 ); + + Layout1->addWidget( GroupDest, 1, 0 ); + + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); + GroupButtons->setTitle( trUtf8( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 6 ); + GroupButtons->layout()->setMargin( 11 ); + GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QHBoxLayout( 0, 0, 6, "Layout3"); + + buttonEnd = new QPushButton( GroupButtons, "buttonEnd" ); + buttonEnd->setText( trUtf8( "End Sketch" ) ); + Layout3->addWidget( buttonEnd ); + + buttonClose = new QPushButton( GroupButtons, "buttonClose" ); + buttonClose->setText( trUtf8( "Close Sketch" ) ); + Layout3->addWidget( buttonClose ); + QSpacerItem* spacer = new QSpacerItem( 91, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer ); + + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( trUtf8( "&Cancel" ) ); + Layout3->addWidget( buttonCancel ); + GroupButtonsLayout->addLayout( Layout3 ); + + Layout1->addWidget( GroupButtons, 3, 0 ); + + EntityGUI_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); + + // tab order + setTabOrder( RadioButton1, RadioButton2 ); + setTabOrder( RadioButton2, RB_Dest1 ); + setTabOrder( RB_Dest1, RB_Dest2 ); + setTabOrder( RB_Dest2, buttonEnd ); + setTabOrder( buttonEnd, buttonClose ); + setTabOrder( buttonClose, buttonCancel ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Skeleton_QTD::~EntityGUI_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.h b/src/EntityGUI/EntityGUI_Skeleton_QTD.h new file mode 100644 index 000000000..534f52ca3 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' +** +** Created: ven déc 12 11:17:07 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_SKELETON_QTD_H +#define ENTITYGUI_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QPushButton; +class QRadioButton; + +class EntityGUI_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + EntityGUI_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~EntityGUI_Skeleton_QTD(); + + QGroupBox* GroupVal; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QGroupBox* GroupDest; + QButtonGroup* GroupDest1; + QRadioButton* RB_Dest2; + QRadioButton* RB_Dest1; + QButtonGroup* GroupDest2; + QButtonGroup* GroupDest3; + QGroupBox* GroupButtons; + QPushButton* buttonEnd; + QPushButton* buttonClose; + QPushButton* buttonCancel; + + +protected: + QGridLayout* EntityGUI_Skeleton_QTDLayout; + QGridLayout* Layout1; + QGridLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; + QGridLayout* GroupDestLayout; + QGridLayout* Layout5; + QGridLayout* GroupDest1Layout; + QGridLayout* Layout4; + QGridLayout* GroupDest2Layout; + QGridLayout* GroupDest3Layout; + QHBoxLayout* GroupButtonsLayout; + QHBoxLayout* Layout3; +}; + +#endif // ENTITYGUI_SKELETON_QTD_H diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx new file mode 100644 index 000000000..d91c24544 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -0,0 +1,1168 @@ +// 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 : EntityGUI_SketcherDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "EntityGUI_SketcherDlg.h" +#include "Sketcher_Profile.hxx" +#include "utilities.h" + +#include +#include +#include + +#include + +//================================================================================= +// class : EntityGUI_SketcherDlg() +// purpose : Constructs a EntityGUI_SketcherDlg 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. +//================================================================================= +EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(QWidget* parent, const char* name, EntityGUI* theEntityGUI, SALOME_Selection* Sel, bool modal, WFlags fl) + :EntityGUI_Skeleton_QTD(parent, name, modal, fl) +{ + if (!name) + setName("EntityGUI_SketcherDlg"); + + buttonCancel->setText(tr("GEOM_BUT_CANCEL")); + buttonEnd->setText(tr("GEOM_BUT_END_SKETCH")); + buttonClose->setText(tr("GEOM_BUT_CLOSE_SKETCH")); + GroupVal->close(TRUE); + GroupDest2->close(TRUE); + GroupDest3->close(TRUE); + resize(0, 0); + + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SKETCHER_TITLE")); + + GroupConstructors->setTitle(tr("GEOM_SKETCHER_EL")); + RadioButton1->setText(tr("GEOM_SKETCHER_SEGMENT")); + RadioButton2->setText(tr("GEOM_SKETCHER_ARC")); + GroupDest->setTitle(tr("GEOM_SKETCHER_DEST")); + GroupDest1->setTitle(tr("GEOM_SKETCHER_TYPE")); + RB_Dest1->setText(tr("GEOM_SKETCHER_POINT")); + RB_Dest2->setText(tr("GEOM_SKETCHER_DIR")); + + /***************************************************************/ + GroupPt = new EntityGUI_Point_QTD(GroupDest, "GroupPt"); + GroupPt->GroupPoint->setTitle(tr("GEOM_SKETCHER_POINT")); + GroupPt->RB_Point1->setText(tr("GEOM_SKETCHER_ABS")); + GroupPt->RB_Point2->setText(tr("GEOM_SKETCHER_REL")); + GroupPt->RB_Point3->setText(tr("GEOM_SKETCHER_SEL")); + + GroupD1 = new EntityGUI_Dir1_QTD(GroupDest, "GroupD1"); + GroupD1->GroupDir1->setTitle(tr("GEOM_SKETCHER_DIR")); + GroupD1->RB_Dir11->setText(tr("GEOM_SKETCHER_ANGLE")); + GroupD1->RB_Dir12->setText(tr("GEOM_SKETCHER_PER")); + GroupD1->RB_Dir13->setText(tr("GEOM_SKETCHER_TAN")); + GroupD1->RB_Dir14->setText(tr("GEOM_SKETCHER_VXVY")); + + GroupD2 = new EntityGUI_Dir2_QTD(GroupDest, "GroupD2"); + GroupD2->GroupDir2->setTitle(tr("GEOM_SKETCHER_DIR")); + GroupD2->RB_Dir21->setText(tr("GEOM_SKETCHER_LENGTH")); + GroupD2->RB_Dir22->setText(tr("GEOM_SKETCHER_X")); + GroupD2->RB_Dir23->setText(tr("GEOM_SKETCHER_Y")); + + Group1Sel = new EntityGUI_1Sel_QTD(this, "Group1Sel"); + Group1Sel->TextLabel1->setText(tr("GEOM_SKETCHER_POINT2")); + Group1Sel->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group1Sel->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group1Sel->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + Group1Sel->PushButton1->setPixmap(image0); + + Group1Spin = new EntityGUI_1Spin(this, "Group1Spin"); + Group1Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group1Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group1Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Group2Spin = new EntityGUI_2Spin(this, "Group2Spin"); + Group2Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group2Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group2Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Group3Spin = new EntityGUI_3Spin(this, "Group3Spin"); + Group3Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group3Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group3Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Group4Spin = new EntityGUI_4Spin(this, "Group4Spin"); + Group4Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group4Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group4Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Layout5->addMultiCellWidget(GroupPt, 1, 1, 0, 1); + Layout5->addWidget(GroupD1, 1, 0); + Layout5->addWidget(GroupD2, 1, 1); + + Layout1->addWidget(Group1Sel, 2, 0); + Layout1->addWidget(Group1Spin, 2, 0); + Layout1->addWidget(Group2Spin, 2, 0); + Layout1->addWidget(Group3Spin, 2, 0); + Layout1->addWidget(Group4Spin, 2, 0); + /***************************************************************/ + + mySelection = Sel; + mySimulationTopoDs1.Nullify(); + mySimulationTopoDs2.Nullify(); + myEntityGUI = theEntityGUI; + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + myGeom = myGeomGUI->myComponentGeom; + + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* signals and slots connections */ + connect(buttonEnd, SIGNAL(clicked()), this, SLOT(ClickOnEnd())); + connect(buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnClose())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + + connect(Group1Sel->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group1Sel->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group1Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group1Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group2Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group2Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group3Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group3Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group4Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group4Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(TypeClicked(int))); + connect(GroupDest1, SIGNAL(clicked(int)), this, SLOT(DestClicked(int))); + connect(GroupPt->GroupPoint, SIGNAL(clicked(int)), this, SLOT(PointClicked(int))); + connect(GroupD1->GroupDir1, SIGNAL(clicked(int)), this, SLOT(Dir1Clicked(int))); + connect(GroupD2->GroupDir2, SIGNAL(clicked(int)), this, SLOT(Dir2Clicked(int))); + + connect(Group1Sel->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group1Sel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DS, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DS, SLOT(SetStep(double))); + + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + /* Move widget on the botton right corner of main widget */ +// int x, y; +// myGeomBase->DefineDlgPosition( this, x, y ); + + myEntityGUI = theEntityGUI; + this->Init(); + this->show(); +} + + +//================================================================================= +// function : ~EntityGUI_SketcherDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg() +{ + // no need to delete child widgets, Qt does it all for us + this->destroy(TRUE, TRUE); +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = Group1Sel->LineEdit1; + + /* min, max, step and decimals for spin boxes */ + Group1Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group4Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group4Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group4Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group4Spin->SpinBox_DS->RangeStepAndValidator(-999.999, 999.999, 5., 3); + + Group1Spin->SpinBox_DX->SetValue(0.0); + Group2Spin->SpinBox_DX->SetValue(0.0); + Group2Spin->SpinBox_DY->SetValue(0.0); + Group3Spin->SpinBox_DX->SetValue(0.0); + Group3Spin->SpinBox_DY->SetValue(0.0); + Group3Spin->SpinBox_DZ->SetValue(0.0); + Group4Spin->SpinBox_DX->SetValue(0.0); + Group4Spin->SpinBox_DY->SetValue(0.0); + Group4Spin->SpinBox_DZ->SetValue(0.0); + Group4Spin->SpinBox_DS->SetValue(0.0); + + /* displays Dialog */ + Group1Sel->buttonUndo->setEnabled(false); + Group1Spin->buttonUndo->setEnabled(false); + Group2Spin->buttonUndo->setEnabled(false); + Group3Spin->buttonUndo->setEnabled(false); + Group4Spin->buttonUndo->setEnabled(false); + + RadioButton1->setChecked(true); + + myLastOp = 0; + myLastX1 = 0.0; + myLastY1 = 0.0; + myLastX2 = 0.0; + myLastY2 = 0.0; + + mySketchState = FIRST_POINT; + this->TypeClicked(0); + + return; +} + + +//================================================================================= +// function : InitClick() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::InitClick() +{ + disconnect(mySelection, 0, this, 0); + + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + + Group1Sel->hide(); + Group1Spin->hide(); + Group2Spin->hide(); + Group3Spin->hide(); + Group4Spin->hide(); + + resize(0, 0); + + return; +} + + +//================================================================================= +// function : TypeClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::TypeClicked(int constructorId) +{ + myConstructorId = constructorId; + if(myConstructorId == 0) { // SEGMENT + GroupD2->setEnabled(true); + RB_Dest1->setEnabled(true); + RB_Dest1->setChecked(true); + this->DestClicked(1); + } + else if(myConstructorId == 1) { // ARC + GroupD2->setEnabled(false); + RB_Dest1->setEnabled(false); + RB_Dest2->setChecked(true); + this->DestClicked(0); + } + return; +} + + +//================================================================================= +// function : DestClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::DestClicked(int constructorId) +{ + GroupPt->hide(); + GroupD1->hide(); + GroupD2->hide(); + + if(constructorId == 1) { // Point + GroupPt->RB_Point1->setChecked(true); + GroupPt->show(); + this->PointClicked(1); // XY + } + else if(constructorId == 0) { // Direction + GroupD1->RB_Dir11->setChecked(true); + GroupD1->show(); + GroupD2->show(); + this->Dir1Clicked(2); // Angle + } + return; +} + + +//================================================================================= +// function : PointClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::PointClicked(int constructorId) +{ + this->InitClick(); + + if(myConstructorId == 0) { // SEGMENT + if(constructorId == 1) { // XY + mySketchType = PT_ABS; + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2")); + myX = 0.0; + Group2Spin->SpinBox_DX->SetValue(myX); + myY = 0.0; + Group2Spin->SpinBox_DY->SetValue(myY); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + this->MakeSimulationAndDisplay(); + } + else if(constructorId == 0) { // DXDY + mySketchType = PT_RELATIVE; + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2")); + myDX = 0.0; + Group2Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group2Spin->SpinBox_DY->SetValue(myDY); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + this->MakeSimulationAndDisplay(); + } + else if(constructorId == 2) { // Selection + mySketchType = PT_SEL; + myEditCurrentArgument = Group1Sel->LineEdit1; + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + Group1Sel->show(); + Group1Sel->buttonApply->setFocus(); + this->SelectionIntoArgument(); + } + } + + return; +} + + +//================================================================================= +// function : Dir1Clicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::Dir1Clicked(int constructorId) +{ + myConstructorDirId = constructorId; + GroupD2->RB_Dir21->setChecked(true); + this->Dir2Clicked(2); + return; +} + + +//================================================================================= +// function : Dir2Clicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) +{ + this->InitClick(); + myAngle = 0.0; + + if(myConstructorId == 0) { // SEGMENT + myX = 0.0; + myY = 0.0; + myLength = 100.0; + if(myConstructorDirId == 2) { // Angle + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group2Spin->SpinBox_DX->SetValue(myAngle); + Group2Spin->buttonApply->setFocus(); + Group2Spin->show(); + + if(constructorId == 2) { // Length + mySketchType = DIR_ANGLE_LENGTH; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group2Spin->SpinBox_DY->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_ANGLE_X; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_X3")); + Group2Spin->SpinBox_DY->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_ANGLE_Y; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y3")); + Group2Spin->SpinBox_DY->SetValue(myY); + } + } + else if(myConstructorDirId == 0) { // Perpendicular + Group1Spin->show(); + Group1Spin->buttonApply->setFocus(); + + if(constructorId == 2) { // Length + mySketchType = DIR_PER_LENGTH; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group1Spin->SpinBox_DX->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_PER_X; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X3")); + Group1Spin->SpinBox_DX->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_PER_Y; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_Y3")); + Group1Spin->SpinBox_DX->SetValue(myY); + } + } + else if(myConstructorDirId == 1) { // Tangent + Group1Spin->show(); + Group1Spin->buttonApply->setFocus(); + + if(constructorId == 2) { // Length + mySketchType = DIR_TAN_LENGTH; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group1Spin->SpinBox_DX->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_TAN_X; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X3")); + Group1Spin->SpinBox_DX->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_TAN_Y; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_Y3")); + Group1Spin->SpinBox_DX->SetValue(myY); + } + } + else if(myConstructorDirId == 3) { // DXDY + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); + myDX = 0.0; + Group3Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group3Spin->SpinBox_DY->SetValue(myDY); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + + if(constructorId == 2) { // Length + mySketchType = DIR_DXDY_LENGTH; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group3Spin->SpinBox_DZ->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_DXDY_X; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_X3")); + Group3Spin->SpinBox_DZ->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_DXDY_Y; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_Y3")); + Group3Spin->SpinBox_DZ->SetValue(myY); + } + } + } + else if(myConstructorId == 1) { // ARC + if(myConstructorDirId == 2) { // Angle + if(constructorId == 2) { // Length + mySketchType = DIR_ANGLE_LENGTH; + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->SpinBox_DX->SetValue(myAngle); + myRadius = 100.0; + Group3Spin->SpinBox_DY->SetValue(myRadius); + myLength = 30.0; + Group3Spin->SpinBox_DZ->SetValue(myLength); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + } + } + else if(myConstructorDirId == 0) { // Perpendicular + if(constructorId == 2) { // Length + mySketchType = DIR_PER_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + } + } + else if(myConstructorDirId == 1) { // Tangent + if(constructorId == 2) { // Length + mySketchType = DIR_TAN_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + } + } + else if(myConstructorDirId == 3) { // DXDY + if(constructorId == 2) { // Length + mySketchType = DIR_DXDY_LENGTH; + Group4Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); + Group4Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); + Group4Spin->TextLabel3->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group4Spin->TextLabel4->setText(tr("GEOM_SKETCHER_ANGLE2")); + myDX = 0.0; + Group4Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group4Spin->SpinBox_DY->SetValue(myDY); + myRadius = 100.0; + Group4Spin->SpinBox_DZ->SetValue(myRadius); + myLength = 30.0; + Group4Spin->SpinBox_DS->SetValue(myLength); + Group4Spin->show(); + Group4Spin->buttonApply->setFocus(); + } + } + } + + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + myEntityGUI->EraseSimulationShape(); + mySimulationTopoDs1.Nullify(); + mySimulationTopoDs2.Nullify(); + + mySelection->ClearFilters(); + disconnect(mySelection, 0, this, 0); + + reject(); + return; +} + + +//================================================================================= +// function : ClickOnEnd() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnEnd() +{ + if(mySketchState != FIRST_POINT && mySketchState != SECOND_POINT) + myEntityGUI->OnSketchEnd(myCommand.ascii()); + + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnClose() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnClose() +{ + if(mySketchState != FIRST_POINT && mySketchState != SECOND_POINT) { + myCommand = myCommand + ":WW"; + myEntityGUI->OnSketchEnd(myCommand.ascii()); + } + + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnApply() +{ + if(mySketchState == FIRST_POINT) { + mySketchState = SECOND_POINT; + myLastX2 = myLastX1; + myLastY2 = myLastY1; + } + else { + if(mySketchState != SECOND_POINT) { + Group1Sel->buttonUndo->setEnabled(true); + Group1Spin->buttonUndo->setEnabled(true); + Group2Spin->buttonUndo->setEnabled(true); + Group3Spin->buttonUndo->setEnabled(true); + Group4Spin->buttonUndo->setEnabled(true); + } + + QString myNewCommand = this->GetNewCommand(); + QString myCommandTemp = myCommand + myNewCommand; + + Sketcher_Profile aProfile (myCommandTemp.ascii()); + + if(aProfile.IsDone()) { + myLastCommand = myCommand; + myCommand = myCommandTemp; + myLastX2 = myLastX1; + myLastY2 = myLastY1; + mySketchState = NEXT_POINT; + } + } + + myLastOp = myConstructorId; + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : ClickOnUndo() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnUndo() +{ + Group1Sel->buttonUndo->setEnabled(false); + Group1Spin->buttonUndo->setEnabled(false); + Group2Spin->buttonUndo->setEnabled(false); + Group3Spin->buttonUndo->setEnabled(false); + Group4Spin->buttonUndo->setEnabled(false); + + myCommand = myLastCommand; + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed +//================================================================================= +void EntityGUI_SketcherDlg::SelectionIntoArgument() +{ + myEntityGUI->EraseSimulationShape(1); //Juste Shape2!! + + Group1Sel->buttonApply->setEnabled(false); + Group1Sel->buttonApply->setFocus(); + + myEditCurrentArgument->setText(""); + QString aString = ""; + + myX = 0.0; + myY = 0.0; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ + TopoDS_Shape S; + gp_Pnt myPoint1; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == Group1Sel->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myX = myPoint1.X(); + myY = myPoint1.Y(); + Group1Sel->LineEdit1->setText(aString); + + Group1Sel->buttonApply->setEnabled(true); + Group1Sel->buttonApply->setFocus(); + this->MakeSimulationAndDisplay(); + } + + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + mySelection->ClearFilters(); + if(send == Group1Sel->PushButton1) { + //Group1Sel->LineEdit1->setFocus(); + myEditCurrentArgument = Group1Sel->LineEdit1; + } + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::LineEditReturnPressed() +{ + /* 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(myGeomBase->SelectionByNameInDialogs(thisWidget, objectUserName, mySelection)) + myEditCurrentArgument->setText(objectUserName); + + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::DeactivateActiveDialog() +{ + this->setEnabled(false); + mySelection->ClearFilters(); + disconnect(mySelection, 0, this, 0); + myEntityGUI->EraseSimulationShape(); + myGeomGUI->SetActiveDialogBox(0); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + myGeomGUI->EmitSignalDeactivateDialog(); + this->setEnabled(true); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); + myEntityGUI->DisplaySimulationShape(mySimulationTopoDs1, mySimulationTopoDs2); + + return; +} + + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + Standard_Real vx, vy, vz, vs; + vx = vy = vz = vs = 0.0; + + if(send == Group1Spin->SpinBox_DX) { + vx = newValue; + Group1Spin->buttonApply->setFocus(); + } + else if(send == Group2Spin->SpinBox_DX) { + vx = newValue; + vy = Group2Spin->SpinBox_DY->GetValue(); + Group2Spin->buttonApply->setFocus(); + } + else if(send == Group2Spin->SpinBox_DY) { + vx = Group2Spin->SpinBox_DX->GetValue(); + vy = newValue; + Group2Spin->buttonApply->setFocus(); + } + else if(send == Group3Spin->SpinBox_DX) { + vx = newValue; + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = Group3Spin->SpinBox_DZ->GetValue(); + Group3Spin->buttonApply->setFocus(); + } + else if(send == Group3Spin->SpinBox_DY) { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group3Spin->SpinBox_DZ->GetValue(); + Group3Spin->buttonApply->setFocus(); + } + else if(send == Group3Spin->SpinBox_DZ) { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = newValue; + Group3Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DX) { + vx = newValue; + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + Group4Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DY) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + Group4Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DZ) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = newValue; + vs = Group4Spin->SpinBox_DS->GetValue(); + Group4Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DS) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = newValue; + Group4Spin->buttonApply->setFocus(); + } + + if(myConstructorId == 0) { // SEGMENT + if(mySketchType == PT_ABS) { + myX = vx; + myY = vy; + } + else if(mySketchType == PT_RELATIVE) { + myDX = vx; + myDY = vy; + } + else if(mySketchType == DIR_ANGLE_LENGTH) { + myAngle = vx; + myLength = vy; + } + else if(mySketchType == DIR_ANGLE_X) { + myAngle = vx; + myX = vy; + } + else if(mySketchType == DIR_ANGLE_Y) { + myAngle = vx; + myY = vy; + } + else if(mySketchType == DIR_PER_LENGTH) { + myLength = vx; + } + else if(mySketchType == DIR_PER_X) { + myX = vx; + } + else if(mySketchType == DIR_PER_Y) { + myY = vx; + } + else if(mySketchType == DIR_TAN_LENGTH) { + myLength = vx; + } + else if(mySketchType == DIR_TAN_X) { + myX = vx; + } + else if(mySketchType == DIR_TAN_Y) { + myY = vx; + } + else if(mySketchType == DIR_DXDY_LENGTH) { + myDX = vx; + myDY = vy; + myLength = vz; + } + else if(mySketchType == DIR_DXDY_X) { + myDX = vx; + myDY = vy; + myX = vz; + } + else if(mySketchType == DIR_DXDY_Y) { + myDX = vx; + myDY = vy; + myY = vz; + } + } + else if(myConstructorId == 1) { // ARC + if(mySketchType == DIR_ANGLE_LENGTH) { + myAngle = vx; + myRadius = vy; + myLength = vz; + } + else if(mySketchType == DIR_PER_LENGTH) { + myRadius = vx; + myLength = vy; + } + else if(mySketchType == DIR_TAN_LENGTH) { + myRadius = vx; + myLength = vy; + } + else if(mySketchType == DIR_DXDY_LENGTH) { + myDX = vx; + myDY = vy; + myRadius = vz; + myLength = vs; + } + } + + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : GetNewCommand() +// purpose : +//================================================================================= +QString EntityGUI_SketcherDlg::GetNewCommand() +{ + QString myNewCommand = ""; + if(mySketchState == FIRST_POINT) + return myNewCommand; + + myNewCommand = ":"; + if(myConstructorId == 0) { // SEGMENT + if(mySketchType == PT_ABS || mySketchType == PT_SEL) + myNewCommand = myNewCommand + "TT " + QString::number(myX) + " " + QString::number(myY); + if(mySketchType == PT_RELATIVE) + myNewCommand = myNewCommand + "T " + QString::number(myDX) + " " + QString::number(myDY); + if(mySketchType == DIR_ANGLE_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if(mySketchType == DIR_ANGLE_X) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if(mySketchType == DIR_ANGLE_Y) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + if(mySketchType == DIR_PER_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if(mySketchType == DIR_PER_X) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if(mySketchType == DIR_PER_Y) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + if(mySketchType == DIR_TAN_LENGTH) + myNewCommand = myNewCommand + "L " + QString::number(myLength); + if(mySketchType == DIR_TAN_X) + myNewCommand = myNewCommand + "IX " + QString::number(myX); + if(mySketchType == DIR_TAN_Y) + myNewCommand = myNewCommand + "IY " + QString::number(myY); + if(mySketchType == DIR_DXDY_LENGTH) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if(mySketchType == DIR_DXDY_X) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if(mySketchType == DIR_DXDY_Y) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + } + else if(myConstructorId == 1) { // ARC + if(mySketchType == DIR_ANGLE_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if(mySketchType == DIR_PER_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if(mySketchType == DIR_TAN_LENGTH) { + myNewCommand = myNewCommand + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if(mySketchType == DIR_DXDY_LENGTH) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + } + return myNewCommand; +} + + +//================================================================================= +// function : MakeSimulationAndDisplay() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::MakeSimulationAndDisplay() +{ + myEntityGUI->EraseSimulationShape(); + mySimulationTopoDs1.Nullify(); + mySimulationTopoDs2.Nullify(); + + try { + if(mySketchState == FIRST_POINT) { + myCommand = "Sketch "; + myCommand = myCommand + ":" + "F " + QString::number(myX) + " " + QString::number(myY); + + myLastX1 = myX; + myLastY1 = myY; + + } + + Sketcher_Profile aProfile1 (myCommand.ascii()); + + if(aProfile1.IsDone()) { + myShape = aProfile1.GetShape(); + mySimulationTopoDs1 = myShape; + } + + if(mySketchState != FIRST_POINT) { + if(mySketchState == SECOND_POINT) { + gp_Pnt pt = BRep_Tool::Pnt(TopoDS::Vertex(myShape)); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); + } + else { + TopoDS_Vertex V1, V2; + TopExp::Vertices(TopoDS::Wire(myShape), V1, V2); + gp_Pnt pt = BRep_Tool::Pnt(V2); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); + if(myLastOp == 1) { // ARC + myLastDir = aProfile1.GetLastDir(); + myLastX2 = myLastX1 - myLastDir.X(); + myLastY2 = myLastY1 - myLastDir.Y(); + } + } + QString myNewCommand = "Sketch "; + myNewCommand = myNewCommand + ":" + "F " + QString::number(myLastX1) + " " + QString::number(myLastY1); + if(mySketchState != SECOND_POINT && !((myLastX1 - myLastX2) == 0 && (myLastY1 - myLastY2) == 0)) + myNewCommand = myNewCommand + ":" + "D " + QString::number(myLastX1 - myLastX2) + " " + QString::number(myLastY1 - myLastY2); + myNewCommand = myNewCommand + this->GetNewCommand(); + Sketcher_Profile aProfile2 (myNewCommand.ascii()); + if(aProfile2.IsDone()) + mySimulationTopoDs2 = aProfile2.GetShape(); + + if ( mySimulationTopoDs2.IsNull() ) { + if ( Group1Sel->isVisible() ) { + Group1Sel->buttonApply->setEnabled(false); + Group1Sel->buttonApply->setFocus(); + } + if ( Group1Spin->isVisible() ) { + Group1Spin->buttonApply->setEnabled(false); + Group1Spin->buttonApply->setFocus(); + } + if ( Group2Spin->isVisible() ) { + Group2Spin->buttonApply->setEnabled(false); + Group2Spin->buttonApply->setFocus(); + } + if ( Group3Spin->isVisible() ) { + Group3Spin->buttonApply->setEnabled(false); + Group3Spin->buttonApply->setFocus(); + } + if ( Group4Spin->isVisible() ) { + Group4Spin->buttonApply->setEnabled(false); + Group4Spin->buttonApply->setFocus(); + } + } else { + if ( Group1Sel->isVisible() ) { + Group1Sel->buttonApply->setEnabled(true); + Group1Sel->buttonApply->setFocus(); + } + if ( Group1Spin->isVisible() ) { + Group1Spin->buttonApply->setEnabled(true); + Group1Spin->buttonApply->setFocus(); + } + if ( Group2Spin->isVisible() ) { + Group2Spin->buttonApply->setEnabled(true); + Group2Spin->buttonApply->setFocus(); + } + if ( Group3Spin->isVisible() ) { + Group3Spin->buttonApply->setEnabled(true); + Group3Spin->buttonApply->setFocus(); + } + if ( Group4Spin->isVisible() ) { + Group4Spin->buttonApply->setEnabled(true); + Group4Spin->buttonApply->setFocus(); + } + } + } + + myEntityGUI->DisplaySimulationShape(mySimulationTopoDs1, mySimulationTopoDs2); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h new file mode 100644 index 000000000..2da62fe81 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -0,0 +1,149 @@ +// 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 : EntityGUI_SketcherDlg.h +// Author : Damine COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_SKETCHERDLG_H +#define ENTITYGUI_SKETCHERDLG_H + +#include "EntityGUI_Skeleton_QTD.h" +#include "EntityGUI_Point_QTD.h" +#include "EntityGUI_Dir1_QTD.h" +#include "EntityGUI_Dir2_QTD.h" + +#include "EntityGUI_1Sel_QTD.h" +#include "EntityGUI_1Spin.h" +#include "EntityGUI_2Spin.h" +#include "EntityGUI_3Spin.h" +#include "EntityGUI_4Spin.h" + +#include "EntityGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +#include + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : EntityGUI_Dlg +// purpose : +//================================================================================= +class EntityGUI_SketcherDlg : public EntityGUI_Skeleton_QTD +{ + Q_OBJECT + +public: + EntityGUI_SketcherDlg(QWidget* parent = 0, const char* name = 0, EntityGUI* theEntityGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~EntityGUI_SketcherDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void InitClick(); + void MakeSimulationAndDisplay(); + QString GetNewCommand(); + + EntityGUI* myEntityGUI; + + double step; + int myConstructorId; + int myConstructorDirId; + int mySketchType; + int mySketchState; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + + TopoDS_Shape mySimulationTopoDs1; /* Shape used for simulation display */ + TopoDS_Shape mySimulationTopoDs2; /* Shape used for simulation display */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + SALOME_Selection* mySelection; /* User shape selection */ + GEOM::GEOM_Gen_var myGeom; /* Current GeomI object */ + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; /* Current GeomGUI object */ + + int myLastOp; + QString myCommand; + QString myLastCommand; + TopoDS_Shape myShape; + gp_Dir myLastDir; + + Standard_Real myX; + Standard_Real myY; + Standard_Real myDX; + Standard_Real myDY; + Standard_Real myLastX1; + Standard_Real myLastY1; + Standard_Real myLastX2; + Standard_Real myLastY2; + Standard_Real myLength; + Standard_Real myAngle; + Standard_Real myRadius; + + EntityGUI_Point_QTD* GroupPt; + EntityGUI_Dir1_QTD* GroupD1; + EntityGUI_Dir2_QTD* GroupD2; + + EntityGUI_1Sel_QTD* Group1Sel; + EntityGUI_1Spin* Group1Spin; + EntityGUI_2Spin* Group2Spin; + EntityGUI_3Spin* Group3Spin; + EntityGUI_4Spin* Group4Spin; + + enum SketchState {FIRST_POINT, SECOND_POINT, NEXT_POINT}; + + enum SketchType {PT_ABS, PT_RELATIVE, PT_SEL, + DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y, + DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y, + DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y, + DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y}; + +private slots: + void ClickOnEnd(); + void ClickOnClose(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnUndo(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void TypeClicked(int constructorId); + void DestClicked(int constructorId); + void PointClicked(int constructorId); + void Dir1Clicked(int constructorId); + void Dir2Clicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // ENTITYGUI_SKETCHERDLG_H diff --git a/src/EntityGUI/Makefile.in b/src/EntityGUI/Makefile.in index 3883eebab..2f22e88c2 100644 --- a/src/EntityGUI/Makefile.in +++ b/src/EntityGUI/Makefile.in @@ -41,10 +41,38 @@ LIB = libEntityGUI.la EXPORT_HEADERS= LIB_SRC = EntityGUI.cxx \ + EntityGUI_Skeleton_QTD.cxx \ + EntityGUI_Point_QTD.cxx \ + EntityGUI_Dir1_QTD.cxx \ + EntityGUI_Dir2_QTD.cxx \ + EntityGUI_1Sel_QTD.cxx \ + EntityGUI_1Spin_QTD.cxx \ + EntityGUI_2Spin_QTD.cxx \ + EntityGUI_3Spin_QTD.cxx \ + EntityGUI_4Spin_QTD.cxx \ + EntityGUI_1Spin.cxx \ + EntityGUI_2Spin.cxx \ + EntityGUI_3Spin.cxx \ + EntityGUI_4Spin.cxx \ + EntityGUI_SketcherDlg.cxx \ EntityGUI_SubShapeDlg.cxx LIB_MOC = \ EntityGUI.h \ + EntityGUI_Skeleton_QTD.h \ + EntityGUI_Point_QTD.h \ + EntityGUI_Dir1_QTD.h \ + EntityGUI_Dir2_QTD.h \ + EntityGUI_1Sel_QTD.h \ + EntityGUI_1Spin_QTD.h \ + EntityGUI_2Spin_QTD.h \ + EntityGUI_3Spin_QTD.h \ + EntityGUI_4Spin_QTD.h \ + EntityGUI_1Spin.h \ + EntityGUI_2Spin.h \ + EntityGUI_3Spin.h \ + EntityGUI_4Spin.h \ + EntityGUI_SketcherDlg.h \ EntityGUI_SubShapeDlg.h LIB_CLIENT_IDL = @@ -56,6 +84,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMFiltersSelection -lDisplayGUI +LDFLAGS += -lGEOMFiltersSelection -lDisplayGUI -lGEOMSketcher @CONCLUDE@ diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index 4bf747c5a..41506b1e7 100644 --- a/src/GEOM/GEOM_Gen_i.cc +++ b/src/GEOM/GEOM_Gen_i.cc @@ -31,6 +31,7 @@ using namespace std; #include "Partition_Spliter.hxx" #include "Archimede_VolumeSection.hxx" +#include "Sketcher_Profile.hxx" #include "Utils_CorbaException.hxx" #include "utilities.h" @@ -159,6 +160,8 @@ using namespace std; #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) +#include "Utils_ExceptHandlers.hxx" + Standard_EXPORT static Standard_Boolean IsValid(const TopoDS_Shape& S) { #if OCC_VERSION_MAJOR >= 5 return BRepAlgo::IsValid(S); @@ -209,7 +212,7 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, { GEOM::GEOM_Shape_var aShape = GEOM::GEOM_Shape::_narrow(_orb->string_to_object(IORString)); if (!CORBA::is_nil(aShape)) { - return strdup(aShape->ShapeId()); + return CORBA::string_dup(aShape->ShapeId()); } return 0; } @@ -235,6 +238,12 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, TCollection_ExtendedString MainIOR; TDF_Label Lab; TDF_Tool::Label(aDoc->GetData(), aPersRefString, Lab ); + + if (Lab.IsNull()) { + MESSAGE("Can not find label "<StudyId()); + THROW_SALOME_CORBA_EXCEPTION("Incorrect GEOM data loaded",SALOME::BAD_PARAM); + //return ""; empty IORs raise new problem: "display" in popup crashes + } Handle(TNaming_NamedShape) NS; Lab.FindAttribute( TNaming_NamedShape::GetID(), NS ); @@ -259,7 +268,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, TCollection_AsciiString entry; TDF_Tool::Entry(mainLabel,entry); - CORBA::String_var ent = strdup(entry.ToCString()); + CORBA::String_var ent = CORBA::string_dup(entry.ToCString()); /* Create the main object recursively */ MainIOR = LocalPersistentIDToIOR(theSObject, ent, isMultiFile, isASCII) ; @@ -363,6 +372,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, CORBA::Object_ptr theObject, const char* theName) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); SALOMEDS::SObject_var aResultSO; if(CORBA::is_nil(theObject)) return aResultSO; @@ -426,7 +436,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, aShapeName = "Vertex_"; } if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag()); - else aShapeName = TCollection_AsciiString(strdup(theName)); + else aShapeName = TCollection_AsciiString((char*)theName); //Set a name of the added shape anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName"); @@ -509,7 +519,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true); SALOMEDS::Study_var Study = theComponent->GetStudy(); - TCollection_AsciiString name( strdup(Study->Name()) ); + TCollection_AsciiString name( Study->Name() ); int StudyID = Study->StudyId(); myStudyIDToDoc.Bind( StudyID, myCurrentOCAFDoc ); @@ -537,7 +547,7 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, // void GEOM_Gen_i::Save(const char *IORSComponent, const char *aUrlOfFile) // { -// TCollection_ExtendedString path(strdup(aUrlOfFile)); +// TCollection_ExtendedString path((char*)aUrlOfFile); // TCollection_ExtendedString pathWithExt = path + TCollection_ExtendedString(".sgd"); // myOCAFApp->SaveAs(myCurrentOCAFDoc,pathWithExt); // } @@ -550,14 +560,14 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, // void GEOM_Gen_i::Load(const char *IORSComponent, const char *aUrlOfFile) // { -// TCollection_ExtendedString path(strdup(aUrlOfFile)); +// TCollection_ExtendedString path((char*)aUrlOfFile); // TCollection_ExtendedString pathWithExt = path + TCollection_ExtendedString(".sgd"); // myOCAFApp->Open(pathWithExt,myCurrentOCAFDoc); // SALOMEDS::SComponent_var SC = SALOMEDS::SComponent::_narrow(_orb->string_to_object(IORSComponent)); // SALOMEDS::Study_var Study = SC->GetStudy(); -// TCollection_AsciiString name( strdup(Study->Name()) ); +// TCollection_AsciiString name( Study->Name() ); // int StudyID = Study->StudyId(); // myStudyIDToDoc.Bind( StudyID, myCurrentOCAFDoc ); @@ -614,7 +624,7 @@ CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) { //============================================================================ SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) { // Declare a sequence of the byte to store the copied object - SALOMEDS::TMPFile_var aStreamFile; + SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile; // Try to get GEOM_Shape object by given SObject SALOMEDS::GenericAttribute_var anAttr; @@ -704,7 +714,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, //============================================================================ char* GEOM_Gen_i::ComponentDataType() { - return strdup("GEOM"); + return CORBA::string_dup("GEOM"); } //============================================================================ @@ -714,7 +724,7 @@ char* GEOM_Gen_i::ComponentDataType() void GEOM_Gen_i::register_name(char * name) { GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(POA_GEOM::GEOM_Gen::_this()); - name_service->Register(g, strdup(name)); + name_service->Register(g, name); } @@ -753,7 +763,7 @@ TopoDS_Shape GEOM_Gen_i::GetTopoShape(GEOM::GEOM_Shape_ptr shape_ptr) TDF_Label lab ; Handle(TDF_Data) D = myCurrentOCAFDoc->GetData() ; - TDF_Tool::Label( D, strdup(shape_ptr->ShapeId()), lab, true ) ; + TDF_Tool::Label( D, shape_ptr->ShapeId(), lab, true ) ; Handle(TNaming_NamedShape) NamedShape ; bool res = lab.FindAttribute(TNaming_NamedShape::GetID(), NamedShape) ; @@ -803,7 +813,7 @@ const char * GEOM_Gen_i::InsertInLabel(TopoDS_Shape S, const char *mystr, Handle { GEOMDS_Commands GC(OCAFDoc->Main()); /* add attributs S and mystr in a new label */ - TDF_Label Lab = GC.AddShape (S, strdup(mystr)); + TDF_Label Lab = GC.AddShape (S, (char*)mystr); TCollection_AsciiString entry; TDF_Tool::Entry(Lab,entry); @@ -831,7 +841,7 @@ const char * GEOM_Gen_i::InsertInLabelDependentShape( TopoDS_Shape S, TDF_Tool::Label(OCAFDoc->GetData(), mainshape_ptr->ShapeId(), mainRefLab); /* add attributs : S, nameIor and ref to main */ - TDF_Label Lab = GC.AddDependentShape(S, strdup(nameIor), mainRefLab); + TDF_Label Lab = GC.AddDependentShape(S, (char*)nameIor, mainRefLab); TCollection_AsciiString entry; TDF_Tool::Entry(Lab, entry); @@ -911,7 +921,15 @@ void GEOM_Gen_i::InsertInLabelMoreArguments(TopoDS_Shape main_topo, //================================================================================= CORBA::Short GEOM_Gen_i::NbLabels() { - return TDF_Tool::NbLabels( myCurrentOCAFDoc->Main() ); + TDF_ChildIterator ChildIterator(myCurrentOCAFDoc->Main()); + unsigned int i = 1; + + while (ChildIterator.More()) { + i++; + ChildIterator.Next(); + } + return i; + // return TDF_Tool::NbLabels( myCurrentOCAFDoc->Main() ); } @@ -1015,6 +1033,7 @@ int GEOM_Gen_i::SuppressFacesGlue( const TopoDS_Shape& S, TopoDS_Shape& aCompoundOfShells ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); BRepTools_Quilt Glue; aCompoundOfShells.Nullify() ; @@ -1103,6 +1122,7 @@ GEOM::GEOM_Shape::ListOfSubShapeID* GEOM_Gen_i::IndexOfFacesOfSubShell( const To throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; ListOfID->length(0) ; if( subShell.IsNull() || subShell.ShapeType() != TopAbs_SHELL ) { @@ -1219,6 +1239,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SuppressFaces( GEOM::GEOM_Shape_pt const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Gen::ListOfGeomShapes_var listOfGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; listOfGeomShapes->length(0) ; @@ -1367,6 +1388,7 @@ void GEOM_Gen_i::SuppressHoleSubRoutine( const TopoDS_Shape& mainShape, TopTools_MapOfShape& MSwireEndEdges ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); TopTools_MapOfShape MS ; TopTools_SequenceOfShape SU ; FreeEdgesFromMapOfFace(MSfaces, MS) ; /* MS = free edges of MSfaces */ @@ -1467,6 +1489,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHolesInFaceOrShell( GEOM::GEOM_Shape_pt const GEOM::GEOM_Shape::ListOfSubShapeID& ListIdWires ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; if( ListIdWires.length() < 1 ) @@ -1629,6 +1652,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHole( GEOM::GEOM_Shape_ptr shape, const GEOM::GEOM_Shape::ListOfSubShapeID& ListIdEndFace ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Face aFace ; TopoDS_Wire aWire ; @@ -1918,6 +1942,7 @@ bool GEOM_Gen_i::BuildShapeHoleNotTraversing( const TopoDS_Shape& aShape, TopoDS_Shape& resultTds ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); BRep_Builder B; TopExp_Explorer exp ; TopoDS_Face newFace ; @@ -1976,6 +2001,7 @@ bool GEOM_Gen_i::BuildShapeHoleTraversing( const TopoDS_Shape& aShape, TopoDS_Shape& resultTds ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); BRep_Builder B; TopExp_Explorer exp ; TopoDS_Face newFace ; @@ -2115,6 +2141,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SubShape(GEOM::GEOM_Shape_ptr shape, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); return SubShapesOne(shape, (TopAbs_ShapeEnum) ShapeType, ListOfID); } @@ -2128,6 +2155,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SubShapeSorted(GEOM::GEOM_Shape_ptr shape, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); return SubShapesOne(shape, (TopAbs_ShapeEnum) ShapeType, ListOfID, Standard_True); } @@ -2142,6 +2170,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SubShapesOne( GEOM::GEOM_Shape_ptr shape, const Standard_Boolean Sort) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape mainShape; TopoDS_Shape mainTopo = GetTopoShape(shape); @@ -2222,6 +2251,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapeAll(GEOM::GEOM_Shape_ptr s CORBA::Short ShapeType) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); return SubShapesAll(shape, (TopAbs_ShapeEnum) ShapeType); } @@ -2234,6 +2264,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapeAllSorted(GEOM::GEOM_Shape CORBA::Short ShapeType) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); return SubShapesAll(shape, (TopAbs_ShapeEnum) ShapeType, Standard_True); } @@ -2248,6 +2279,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapesAll(GEOM::GEOM_Shape_ptr throw (SALOME::SALOME_Exception) { /* List of sub shapes returned */ + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Gen::ListOfGeomShapes_var listOfGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; listOfGeomShapes->length(0) ; @@ -2334,21 +2366,21 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapesAll(GEOM::GEOM_Shape_ptr return listOfGeomShapes._retn() ; } - //================================================================================= // function : MakeBoolean() // purpose : Boolean operation according to the type 'operation' //================================================================================= GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBoolean(GEOM::GEOM_Shape_ptr shape1, - GEOM::GEOM_Shape_ptr shape2, - CORBA::Long operation) + GEOM::GEOM_Shape_ptr shape2, + CORBA::Long operation) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape shape ; TopoDS_Shape aShape1 ; TopoDS_Shape aShape2 ; - + try { aShape1 = GetTopoShape(shape1) ; aShape2 = GetTopoShape(shape2) ; @@ -2420,6 +2452,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFuse(GEOM::GEOM_Shape_ptr shape1, GEOM::GEOM_Shape_ptr shape2) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape aShape1 = GetTopoShape(shape1) ; TopoDS_Shape aShape2 = GetTopoShape(shape2) ; @@ -2506,9 +2539,9 @@ GEOM::PointStruct GEOM_Gen_i::MakePointStruct(CORBA::Double x, GEOM::DirStruct GEOM_Gen_i::MakeDirection(const GEOM::PointStruct& p) { GEOM::DirStruct d ; - d.PS.x = p.x ; d.PS.y = p.y ; d.PS.z = p.z ; - return d ; - } + d.PS.x = p.x ; d.PS.y = p.y ; d.PS.z = p.z ; + return d ; +} //================================================================================= // function : MakeBox() @@ -2522,6 +2555,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBox(CORBA::Double x1, CORBA::Double z2) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); gp_Pnt P1(x1,y1,z1); gp_Pnt P2(x2,y2,z2); GEOM::GEOM_Shape_var result ; @@ -2554,6 +2588,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCylinder(const GEOM::PointStruct& pstruct, CORBA::Double height) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape tds ; gp_Pnt p(pstruct.x, pstruct.y, pstruct.z) ; @@ -2586,6 +2621,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSphere(CORBA::Double x1, CORBA::Double radius) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; try { @@ -2614,6 +2650,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeTorus( const GEOM::PointStruct& pstruct, CORBA::Double minor_radius ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape tds ; gp_Pnt p(pstruct.x, pstruct.y, pstruct.z) ; @@ -2648,6 +2685,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCone(const GEOM::PointStruct& pstruct, CORBA::Double height) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape tds ; gp_Pnt p(pstruct.x, pstruct.y, pstruct.z) ; @@ -2686,6 +2724,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCone(const GEOM::PointStruct& pstruct, GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportIGES(const char* filename) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; //VRV: OCC 4.0 migration IGESControl_Reader aReader; @@ -2696,8 +2735,11 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportIGES(const char* filename) THROW_SALOME_CORBA_EXCEPTION("Error in reading import file", SALOME::BAD_PARAM); } MESSAGE("ImportIGES : all Geometry Transfer" << endl ) ; - aReader.Clear(); - aReader.TransferRoots(false); + //OCC 5.1.2 porting +// aReader.Clear(); +// aReader.TransferRoots(false); + aReader.ClearShapes(); + aReader.TransferRoots(); MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes() << endl ); TopoDS_Shape shape = aReader.OneShape(); @@ -2727,6 +2769,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportIGES(const char* filename) GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportSTEP(const char* filename) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; //VRV: OCC 4.0 migration STEPControl_Reader aReader; @@ -2802,6 +2845,7 @@ GEOM::GEOM_Shape_ptr const CORBA::Short Limit) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var aResult; TopoDS_Shape tds ; //MESSAGE ("In Partition"); @@ -2833,7 +2877,6 @@ throw (SALOME::SALOME_Exception) GEOM::GEOM_Shape_var aShape = GetIORFromString( ListTools[ind] ); TopoDS_Shape Shape = GetTopoShape(aShape); if(Shape.IsNull() ) { - //MESSAGE ( "In Partition a tool shape is null" ); THROW_SALOME_CORBA_EXCEPTION("In Partition a shape is null", SALOME::BAD_PARAM); } if ( !ShapesMap.Contains( Shape ) && ToolsMap.Add( Shape )) @@ -2868,7 +2911,9 @@ throw (SALOME::SALOME_Exception) PS.AddShape(Shape); } + //MESSAGE ( "Partition::Compute() " ); PS.Compute ((TopAbs_ShapeEnum) Limit); + //MESSAGE ( "Partition::Compute() - END" ); // suppress result outside of shapes in KInsideMap for (ind = 0; ind < ListKeepInside.length(); ind++) { @@ -2971,6 +3016,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape, CORBA::Short nbiter) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Face tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -2993,6 +3039,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape, THROW_SALOME_CORBA_EXCEPTION("Initial shape doesn't contain only edges !", SALOME::BAD_PARAM); } C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); + if (C.IsNull()) continue; C = new Geom_TrimmedCurve(C, First, Last); Section.AddCurve(C) ; i++ ; @@ -3167,6 +3214,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeGlueFaces(GEOM::GEOM_Shape_ptr myShape, // appliquer BRepTools_SameParameter au compshell // (rendre parametres 2D des edges identiques aux parametres 3D) + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -3305,6 +3353,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewing( const GEOM::GEOM_Gen::ListOfIOR& Li CORBA::Double precision ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; BRepOffsetAPI_Sewing aMethod ; @@ -3343,6 +3392,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewingShape( GEOM::GEOM_Shape_ptr aShape, CORBA::Double precision ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds, S ; BRepOffsetAPI_Sewing aMethod ; @@ -3386,6 +3436,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewingShape( GEOM::GEOM_Shape_ptr aShape, GEOM::GEOM_Shape_ptr GEOM_Gen_i::OrientationChange(GEOM::GEOM_Shape_ptr aShape) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; BRep_Builder aBuilder; @@ -3462,7 +3513,7 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetReferencedObjects(GEOM::GEOM_Shape_ptr Handle(TDataStd_Name) Att; L.FindAttribute(TDataStd_Name::GetID(),Att); TCollection_AsciiString nameIOR (Att->Get()) ; - aList[i] = strdup( nameIOR.ToCString() ); + aList[i] = CORBA::string_dup( nameIOR.ToCString() ); i++; } @@ -3512,7 +3563,7 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetObjects(GEOM::GEOM_Shape_ptr shape) if (!Att->Get().IsEqual(TCollection_ExtendedString("Arguments")) ) { TCollection_AsciiString nameIOR (Att->Get()); - aList[i] = strdup( nameIOR.ToCString() ); + aList[i] = CORBA::string_dup( nameIOR.ToCString() ); i++; } ChildIterator1.Next(); @@ -3528,12 +3579,15 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetObjects(GEOM::GEOM_Shape_ptr shape) GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportBREP(const char* filename) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); TopoDS_Shape tds ; GEOM::GEOM_Shape_var result ; try { - BRep_Builder aBuilder; - BRepTools::Read(tds, strdup(filename), aBuilder) ; + BRep_Builder aBuilder; + char* aCopyfilename = strdup(filename); + BRepTools::Read(tds, aCopyfilename, aBuilder) ; + free(aCopyfilename); if (tds.IsNull()) { THROW_SALOME_CORBA_EXCEPTION("Import BRep aborted", SALOME::BAD_PARAM); } @@ -3558,6 +3612,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePlane(const GEOM::PointStruct& pstruct, CORBA::Double trimsize) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; @@ -3591,13 +3646,14 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeVertex(CORBA::Double x, CORBA::Double z) throw (SALOME::SALOME_Exception) { - + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; gp_Pnt P(x,y,z); TopoDS_Shape tds = BRepBuilderAPI_MakeVertex(P).Shape(); if (tds.IsNull()) { THROW_SALOME_CORBA_EXCEPTION("Make Vertex/Point aborted", SALOME::BAD_PARAM); } + tds.Infinite(true); result = CreateObject(tds) ; const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ; result->ShapeId(entry); @@ -3613,6 +3669,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFace( GEOM::GEOM_Shape_ptr wire, CORBA::Boolean wantplanarface ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape aShape; TopoDS_Shape tds; @@ -3684,10 +3741,21 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFaces(const GEOM::GEOM_Gen::ListOfIOR& List FR.Perform(); if(FR.IsDone()) { - for(; FR.More(); FR.Next()) - aBuilder.Add(C, FR.Current().Oriented(OriF)); - result = CreateObject(C); - InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc); + int k = 0; + TopoDS_Shape aFace; + for(; FR.More(); FR.Next()) { + aFace = FR.Current().Oriented(OriF); + aBuilder.Add(C, aFace); + k++; + } + if(k == 1) { + result = CreateObject(aFace); + InsertInLabelMoreArguments(aFace, result, ListShapes, myCurrentOCAFDoc); + } + else { + result = CreateObject(C); + InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc); + } } } } @@ -3709,6 +3777,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFaces(const GEOM::GEOM_Gen::ListOfIOR& List GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeShell( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; BRepTools_Quilt Glue; TopoDS_Shape C; @@ -3750,6 +3819,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeShell( const GEOM::GEOM_Gen::ListOfIOR& Lis GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSolid( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; Standard_Integer ish = 0; TopoDS_Compound Res; @@ -3798,6 +3868,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeLine(const GEOM::PointStruct& pstruct, const GEOM::DirStruct& dstruct) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; gp_Pnt P1(pstruct.x, pstruct.y, pstruct.z); gp_Pnt P2(dstruct.PS.x, dstruct.PS.y, dstruct.PS.z) ; @@ -3814,6 +3885,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeLine(const GEOM::PointStruct& pstruct, THROW_SALOME_CORBA_EXCEPTION("Make Line aborted : null shape", SALOME::BAD_PARAM); } else { + tds.Infinite(true); result = CreateObject(tds) ; const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ; result->ShapeId(entry); @@ -3830,6 +3902,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeVector(const GEOM::PointStruct& pstruct1, const GEOM::PointStruct& pstruct2) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; @@ -3863,6 +3936,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCircle(const GEOM::PointStruct& pstruct, CORBA::Double radius) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape tds ; @@ -3896,6 +3970,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeEllipse( const GEOM::PointStruct& pstruct, CORBA::Double radius_minor ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape tds ; @@ -3930,6 +4005,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeArc(const GEOM::PointStruct& pInit, const GEOM::PointStruct& pEnd) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; try { gp_Pnt pI(pInit.x, pInit.y, pInit.z) ; @@ -3957,7 +4033,34 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeArc(const GEOM::PointStruct& pInit, return result ; } - +//================================================================================= + // function : MakeSketcher() + // purpose : Make a wire from a list containing many points + //================================================================================= + GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSketcher( const char *Cmd ) + throw (SALOME::SALOME_Exception) + { + GEOM::GEOM_Shape_var result ; + TopoDS_Shape tds ; + try { + Sketcher_Profile aProfile (Cmd); + if(aProfile.IsDone()) + tds = aProfile.GetShape(); + } + catch(Standard_Failure) { + THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeSketcher", SALOME::BAD_PARAM); + } + + if (tds.IsNull()) { + THROW_SALOME_CORBA_EXCEPTION("MakeSketcher aborted : null shape", SALOME::BAD_PARAM); + } + else { + result = CreateObject(tds); + const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ; + result->ShapeId(entry) ; + } + return result; + } //================================================================================= // function : MakeTranslation() @@ -3969,6 +4072,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeTranslation( GEOM::GEOM_Shape_ptr myShape, CORBA::Double z) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape aShape = GetTopoShape(myShape) ; if( aShape.IsNull() ) { @@ -3999,6 +4103,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiTranslation1D( GEOM::GEOM_Shape_ptr my CORBA::Short nbtimes ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; @@ -4054,6 +4159,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiTranslation2D( GEOM::GEOM_Shape_ptr my CORBA::Short nbtimes2 ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; @@ -4111,6 +4217,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiRotation1D( GEOM::GEOM_Shape_ptr mySha CORBA::Short nbtimes) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -4164,6 +4271,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiRotation2D( GEOM::GEOM_Shape_ptr mySha CORBA::Short nbtimes2 ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -4248,6 +4356,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiRotation2D( GEOM::GEOM_Shape_ptr mySha GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCopy( GEOM::GEOM_Shape_ptr Shape) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(Shape) ; @@ -4273,6 +4382,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMirrorByPlane(GEOM::GEOM_Shape_ptr myShape, GEOM::GEOM_Shape_ptr shapePlane) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -4325,6 +4435,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeRotation( GEOM::GEOM_Shape_ptr myShape, CORBA::Double angle) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -4363,6 +4474,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeScaleTransform(GEOM::GEOM_Shape_ptr myShape CORBA::Double factor) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -4396,6 +4508,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeScaleTransform(GEOM::GEOM_Shape_ptr myShape GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCompound( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Compound C; BRep_Builder aBuilder; @@ -4429,6 +4542,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeEdge(const GEOM::PointStruct& pstruct1, const GEOM::PointStruct& pstruct2) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; @@ -4459,6 +4573,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeEdge(const GEOM::PointStruct& pstruct1, GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeWire( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; BRepBuilderAPI_MakeWire MW ; TopoDS_Shape tds, Shape ; @@ -4502,6 +4617,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeRevolution(GEOM::GEOM_Shape_ptr myShape, double angle) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -4535,6 +4651,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePipe( GEOM::GEOM_Shape_ptr pathShape, GEOM::GEOM_Shape_ptr baseShape ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Wire aWire ; @@ -4591,6 +4708,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePrism( GEOM::GEOM_Shape_ptr myShape, const GEOM::PointStruct& P2 ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(myShape) ; @@ -4624,6 +4742,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePrism( GEOM::GEOM_Shape_ptr myShape, GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCDG(GEOM::GEOM_Shape_ptr aShape) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape shape = GetTopoShape(aShape) ; @@ -4678,6 +4797,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::Archimede(GEOM::GEOM_Shape_ptr aShape, CORBA::Double aMeshingDeflection) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; double cste = -1; @@ -4751,6 +4871,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFillet( GEOM::GEOM_Shape_ptr shape, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape tds ; @@ -4770,7 +4891,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFillet( GEOM::GEOM_Shape_ptr shape, fill.Add(E); } for (int i = 1;i<=fill.NbContours();i++) { - fill.SetRadius(radius,i); + fill.SetRadius(radius,i,i); } tds = fill.Shape(); @@ -4785,7 +4906,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFillet( GEOM::GEOM_Shape_ptr shape, } } for (int i = 1;i<=fill.NbContours();i++) { - fill.SetRadius(radius,i); + fill.SetRadius(radius,i,i); } tds = fill.Shape(); } @@ -4815,6 +4936,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeChamfer( GEOM::GEOM_Shape_ptr shape, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID ) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result; TopoDS_Shape tds ; @@ -4873,6 +4995,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeChamfer( GEOM::GEOM_Shape_ptr shape, CORBA::Boolean GEOM_Gen_i::CheckShape(GEOM::GEOM_Shape_ptr shape) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); TopoDS_Shape S = GetTopoShape(shape) ; if( S.IsNull() ) { THROW_SALOME_CORBA_EXCEPTION("Shape is null", SALOME::BAD_PARAM); @@ -4893,6 +5016,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePlacedBox(CORBA::Double x1, CORBA::Double CORBA::Double delta1, CORBA::Double delta2, CORBA::Double delta3) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; @@ -4932,6 +5056,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePanel(GEOM::GEOM_Shape_ptr shape, CORBA::Double delta) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Shape_var result ; TopoDS_Shape tds ; TopoDS_Shape aShape = GetTopoShape(shape) ; @@ -4979,10 +5104,10 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePanel(GEOM::GEOM_Shape_ptr shape, GEOM::GEOM_Gen::ListOfIOR_var aList = new GEOM::GEOM_Gen::ListOfIOR; aList->length(4); - aList[0]=strdup(Edge1->Name()); - aList[1]=strdup(Edge2->Name()); - aList[2]=strdup(Edge3->Name()); - aList[3]=strdup(Edge4->Name()); + aList[0]=CORBA::string_dup(Edge1->Name()); + aList[1]=CORBA::string_dup(Edge2->Name()); + aList[2]=CORBA::string_dup(Edge3->Name()); + aList[3]=CORBA::string_dup(Edge4->Name()); GEOM::GEOM_Shape_ptr aWire = MakeWire( aList ); GEOM::GEOM_Shape_ptr aFace = MakeFace( aWire, true ) ; @@ -5008,6 +5133,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePanel(GEOM::GEOM_Shape_ptr shape, void GEOM_Gen_i::ExportIGES(const char* filename,GEOM::GEOM_Shape_ptr theShape) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); if (theShape->_is_nil()) { THROW_SALOME_CORBA_EXCEPTION("Export IGES aborted", SALOME::BAD_PARAM); @@ -5040,6 +5166,7 @@ void GEOM_Gen_i::ExportIGES(const char* filename,GEOM::GEOM_Shape_ptr theShape) void GEOM_Gen_i::ExportBREP(const char* filename,GEOM::GEOM_Shape_ptr theShape) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); if (theShape->_is_nil()) { THROW_SALOME_CORBA_EXCEPTION("Export BRep aborted", SALOME::BAD_PARAM); @@ -5064,6 +5191,7 @@ void GEOM_Gen_i::ExportBREP(const char* filename,GEOM::GEOM_Shape_ptr theShape) void GEOM_Gen_i::ExportSTEP(const char* filename,GEOM::GEOM_Shape_ptr theShape) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); if (theShape->_is_nil()) { THROW_SALOME_CORBA_EXCEPTION("Export STEP aborted", SALOME::BAD_PARAM); diff --git a/src/GEOM/GEOM_Gen_i.hh b/src/GEOM/GEOM_Gen_i.hh index 6d74fa198..ff910b897 100644 --- a/src/GEOM/GEOM_Gen_i.hh +++ b/src/GEOM/GEOM_Gen_i.hh @@ -388,6 +388,7 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, GEOM::GEOM_Shape_ptr MakePlacedBox(CORBA::Double x1, CORBA::Double y1, CORBA::Double z1, CORBA::Double delta1, CORBA::Double delta2, CORBA::Double delta3) throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakePanel(GEOM::GEOM_Shape_ptr shape, CORBA::Short directiontype, CORBA::Double delta) @@ -576,6 +577,14 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, const GEOM::PointStruct& pEnd) throw (SALOME::SALOME_Exception) ; + //-------------------------------------------------------------------// + // Specific method Sketcher // + //-------------------------------------------------------------------// + GEOM::GEOM_Shape_ptr MakeSketcher (const char* Cmd) + throw (SALOME::SALOME_Exception) ; + + //-------------------------------------------------------------------// + GEOM::GEOM_Shape_ptr MakeCompound (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) throw (SALOME::SALOME_Exception) ; GEOM::GEOM_Shape_ptr MakeWire (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) diff --git a/src/GEOM/GEOM_Shape_i.cc b/src/GEOM/GEOM_Shape_i.cc index 60db998b4..bd2110d50 100644 --- a/src/GEOM/GEOM_Shape_i.cc +++ b/src/GEOM/GEOM_Shape_i.cc @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; +#include +#include + #include +#include + #include "GEOM_Shape_i.hh" #include "SALOME_NamingService.hxx" -#include -#include +using namespace std; //================================================================================= @@ -84,7 +87,7 @@ GEOM_Shape_i::~GEOM_Shape_i() { delete &_geom; } // : WARNING : Register to naming service actually removed ! //================================================================================= void GEOM_Shape_i::Name(const char* name) { - _name = strdup(name); + _name = CORBA::string_dup(name); GEOM::GEOM_Shape_ptr g = GEOM::GEOM_Shape::_narrow(_this()); // Removed declaration of shapes to naming service @@ -97,14 +100,14 @@ void GEOM_Shape_i::Name(const char* name) { // function : Name (get method) // purpose : to get the attribute 'name' of this shape //================================================================================= -char* GEOM_Shape_i::Name() { return strdup(_name); } +char* GEOM_Shape_i::Name() { return CORBA::string_dup(_name); } //================================================================================= // function : MainName (set method) // purpose : to set the attribute 'name' of this mainshape. //================================================================================= void GEOM_Shape_i::MainName(const char* name) { - _mainname = strdup(name); + _mainname = CORBA::string_dup(name); } @@ -112,7 +115,7 @@ void GEOM_Shape_i::MainName(const char* name) { // function : MainName (get method) // purpose : to get the attribute 'name' of this shape //================================================================================= -char* GEOM_Shape_i::MainName() { return strdup(_mainname); } +char* GEOM_Shape_i::MainName() { return CORBA::string_dup(_mainname); } //================================================================================= // function : IsMainShape (get method) @@ -132,14 +135,14 @@ void GEOM_Shape_i::IsMainShape(const bool abool) { _ismain = abool ; } // function : ShapeId // purpose : to get the id of this shape from GEOM (OCAF entry) //================================================================================= -char* GEOM_Shape_i::ShapeId() { return strdup(_shapeid) ; } +char* GEOM_Shape_i::ShapeId() { return CORBA::string_dup(_shapeid) ; } //================================================================================= // function : ShapeId (set method) // purpose : to set the id of this shape in GEOM/OCAF doc //================================================================================= -void GEOM_Shape_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid) ; } +void GEOM_Shape_i::ShapeId(const char * shapeid) { _shapeid = CORBA::string_dup(shapeid) ; } @@ -147,7 +150,7 @@ void GEOM_Shape_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid) ; // function : StudyShapeId (get method) // purpose : to get the id of this shape from the study document (OCAF entry) //================================================================================= -char* GEOM_Shape_i::StudyShapeId() { return strdup(_studyshapeid) ; } +char* GEOM_Shape_i::StudyShapeId() { return CORBA::string_dup(_studyshapeid) ; } //================================================================================= @@ -155,7 +158,7 @@ char* GEOM_Shape_i::StudyShapeId() { return strdup(_studyshapeid) ; } // purpose : to set the id of this shape in the Study document (OCAF entry) //================================================================================= void GEOM_Shape_i::StudyShapeId(const char * studyshapeid) -{ _studyshapeid = strdup(studyshapeid) ; } +{ _studyshapeid = CORBA::string_dup(studyshapeid) ; } @@ -209,7 +212,7 @@ void GEOM_Shape_i::NameType(const char* name) { // function : NameType (get method) // purpose : to get the attribute 'nametype' of this shape //================================================================================= -char* GEOM_Shape_i::NameType() { return strdup(_nametype); } +char* GEOM_Shape_i::NameType() { return CORBA::string_dup(_nametype); } //================================================================================= // function : GetShapeStream diff --git a/src/GEOM/Makefile.in b/src/GEOM/Makefile.in index 738e9ae64..a15b57b8b 100644 --- a/src/GEOM/Makefile.in +++ b/src/GEOM/Makefile.in @@ -51,7 +51,7 @@ EXPORT_HEADERS = # additionnal information to compil and link file CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMDS -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMPartition -lGEOMArchimede $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMDS -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMPartition -lGEOMArchimede $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome # additional file to be cleaned MOSTLYCLEAN = diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index fd8b537af..9e7925e68 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -227,6 +227,7 @@ bool GEOMBase::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString needDisplay = true; SALOMEDS::SObject_var obj = ActiveStudy->getStudyDocument()->FindObjectID(anIObject->getEntry()); if(!obj->_is_nil()) { + if (strcmp(obj->GetFatherComponent()->GetName(), "GEOM")) continue; GEOM::GEOM_Shape_var aShape; if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); @@ -370,6 +371,7 @@ bool GEOMBase::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString SALOMEDS::SObject_var obj = ActiveStudy->getStudyDocument()->FindObjectID(anIObject->getEntry()); if(!obj->_is_nil()) { + if (strcmp(obj->GetFatherComponent()->GetName(), "GEOM")) continue; GEOM::GEOM_Shape_var aShape; if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); @@ -506,11 +508,11 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) Standard_CString type; GetShapeTypeString(shape,type); aShape->NameType(type); - nameG += TCollection_AsciiString(type) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); + nameG += TCollection_AsciiString(type) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->myNbGeom++) + TCollection_AsciiString("\0"); } else - nameG += TCollection_AsciiString(aShape->NameType()) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); - } + nameG += TCollection_AsciiString(aShape->NameType()) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->myNbGeom++) + TCollection_AsciiString("\0"); + } else nameG = TCollection_AsciiString(name); @@ -673,11 +675,17 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); if(!Name.isEmpty()) { // VTK - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - GActor->setName(strdup(Name.latin1())); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + char* aCopy = CORBA::string_dup(Name.latin1()); + GActor->setName(aCopy); + delete(aCopy); + } // OCC - else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - GAISShape->setName(strdup(Name.latin1())); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + char* aCopy = CORBA::string_dup(Name.latin1()); + GAISShape->setName(aCopy); + delete(aCopy); + } } else return false; @@ -914,55 +922,55 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& { case TopAbs_COMPOUND: { - aTypeString = strdup(tr("GEOM_COMPOUND")); + aTypeString = CORBA::string_dup(tr("GEOM_COMPOUND")); return true; } case TopAbs_COMPSOLID: { - aTypeString = strdup(tr("GEOM_COMPOUNDSOLID")) ; + aTypeString = CORBA::string_dup(tr("GEOM_COMPOUNDSOLID")) ; return true ; } case TopAbs_SOLID: { - aTypeString = strdup(tr("GEOM_SOLID")) ; + aTypeString = CORBA::string_dup(tr("GEOM_SOLID")) ; return true ; } case TopAbs_SHELL: { - aTypeString = strdup(tr("GEOM_SHELL")) ; + aTypeString = CORBA::string_dup(tr("GEOM_SHELL")) ; return true ; } case TopAbs_FACE: { BRepAdaptor_Surface surf(TopoDS::Face(aShape)); if(surf.GetType() == GeomAbs_Plane) { - aTypeString = strdup(tr("GEOM_PLANE")); + aTypeString = CORBA::string_dup(tr("GEOM_PLANE")); return true; } else if(surf.GetType() == GeomAbs_Cylinder) { - aTypeString = strdup(tr("GEOM_SURFCYLINDER")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFCYLINDER")); return true; } else if(surf.GetType() == GeomAbs_Sphere) { - aTypeString = strdup(tr("GEOM_SURFSPHERE")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFSPHERE")); return true ; } else if(surf.GetType() == GeomAbs_Torus) { - aTypeString = strdup(tr("GEOM_SURFTORUS")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFTORUS")); return true ; } else if(surf.GetType() == GeomAbs_Cone) { - aTypeString = strdup(tr("GEOM_SURFCONE")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFCONE")); return true ; } else { - aTypeString = strdup(tr("GEOM_FACE")); + aTypeString = CORBA::string_dup(tr("GEOM_FACE")); return true; } } case TopAbs_WIRE: { - aTypeString = strdup(tr("GEOM_WIRE")); + aTypeString = CORBA::string_dup(tr("GEOM_WIRE")); return true; } case TopAbs_EDGE: @@ -970,31 +978,31 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& 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")); + aTypeString = CORBA::string_dup(tr("GEOM_LINE")); else - aTypeString = strdup(tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(tr("GEOM_EDGE")); return true; } else if(curv.GetType() == GeomAbs_Circle) { if(curv.IsClosed()) - aTypeString = strdup(tr("GEOM_CIRCLE")); + aTypeString = CORBA::string_dup(tr("GEOM_CIRCLE")); else - aTypeString = strdup(tr("GEOM_ARC")); + aTypeString = CORBA::string_dup(tr("GEOM_ARC")); return true; } else { - aTypeString = strdup(tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(tr("GEOM_EDGE")); return true; } } case TopAbs_VERTEX: { - aTypeString = strdup(tr("GEOM_VERTEX")); + aTypeString = CORBA::string_dup(tr("GEOM_VERTEX")); return true; } case TopAbs_SHAPE: { - aTypeString = strdup(tr("GEOM_SHAPE")); + aTypeString = CORBA::string_dup(tr("GEOM_SHAPE")); return true; } } @@ -1209,7 +1217,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM 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); + listIOR[j] = CORBA::string_dup(theValue); j++; } } @@ -1217,7 +1225,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM 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); + listIOR[j] = CORBA::string_dup(ior); j++; } } @@ -1453,7 +1461,9 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU 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)); + char* aCopyobjectUserName = CORBA::string_dup(objectUserName); + Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", aCopyobjectUserName); + delete(aCopyobjectUserName); /* Add as a selected object */ /* Clear any previous selection : */ @@ -1477,6 +1487,23 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) return true; } +QString GEOMBase::GetDefaultName(const QString& theOperation) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + int aNumber = 0; + QString aName; + SALOMEDS::SObject_var obj; + + do + { + aName = theOperation+"_"+QString::number(++aNumber); + obj = aStudy->FindObject(aName); + } + while (!obj->_is_nil()); + + return aName; +} + //===================================================================================== // EXPORTED METHODS diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index db3bb1daa..b6de381c5 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -110,6 +110,9 @@ public : bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel); bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); + /* This method generates default names for results of geometrical operations */ + static QString GetDefaultName(const QString& theOperation); + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index 0ec58c125..cfeb6ea45 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -39,6 +39,7 @@ #include #include #include +#include class GEOMBase_Skeleton : public DlgRef_Skeleton_QTD { diff --git a/src/GEOMClient/GEOM_Client.cxx b/src/GEOMClient/GEOM_Client.cxx index b5ee8f58e..8c1345ff4 100644 --- a/src/GEOMClient/GEOM_Client.cxx +++ b/src/GEOMClient/GEOM_Client.cxx @@ -175,7 +175,7 @@ unsigned int GEOM_Client::BufferLength() 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); diff --git a/src/GEOMContext/GEOMContext.cxx b/src/GEOMContext/GEOMContext.cxx index 210807916..fcd33c80f 100644 --- a/src/GEOMContext/GEOMContext.cxx +++ b/src/GEOMContext/GEOMContext.cxx @@ -81,9 +81,16 @@ GEOMContext* GEOMContext::GetOrCreateGeomGUI(QAD_Desktop* desktop) /* GetCurrentStudy */ int studyId = desktop->getActiveStudy()->getStudyId(); GeomGUI->myComponentGeom->GetCurrentStudy(studyId); + GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); } + /* GetCurrentStudy */ + int studyId = desktop->getActiveStudy()->getStudyId(); + GeomGUI->myComponentGeom->GetCurrentStudy(studyId); + + GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); + return GeomGUI; } diff --git a/src/GEOMContext/GEOMContext.h b/src/GEOMContext/GEOMContext.h index d31f1b6dc..e83a93288 100644 --- a/src/GEOMContext/GEOMContext.h +++ b/src/GEOMContext/GEOMContext.h @@ -31,7 +31,6 @@ #include "QAD_Desktop.h" #include "GEOM_Client.hxx" -#include "GEOM_Sketcher.h" #include #include @@ -49,12 +48,12 @@ public : private : QDialog* myActiveDialogBox; /* Unique active dialog box */ - int myNbGeom; /* Unique name for a geom entity */ GEOM_Client myShapeReader; Standard_CString myFatherior; - Sketch mySketcher; public : + int myNbGeom; /* Unique name for a geom entity */ + static GEOMContext* GetOrCreateGeomGUI(QAD_Desktop* desktop); static GEOMContext* GetGeomGUI(); @@ -67,7 +66,6 @@ public : int& GetNbGeom(){return myNbGeom;}; GEOM_Client& GetShapeReader(){return myShapeReader;}; Standard_CString& GetFatherior(){return myFatherior;}; - Sketch& GetSketcher(){return mySketcher;}; bool LoadLibrary(QString GUILibrary); diff --git a/src/GEOMContext/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po index 1b91d57f8..5d07378e1 100644 --- a/src/GEOMContext/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -662,6 +662,10 @@ msgstr "Vertex" msgid "GEOM_WIRE" msgstr "Wire" +#Wire(s) +msgid "GEOM_WIRES" +msgstr "Wire(s)" + #Parameter msgid "GEOM_PARAMETER" msgstr "Parameter :" @@ -937,6 +941,10 @@ msgstr "Keep Object" msgid "GEOM_PARTITION_ORIENTATION" msgstr "Change Orientation" +#: GeometryGUI_PartitionDlg.cxx:45 +msgid "SUPPRESS_RESULT" +msgstr "Suppress Result" + #: GeometryGUI_PipeDlg.cxx:47 msgid "GEOM_PIPE_TITLE" msgstr "Pipe Construction" @@ -1199,13 +1207,13 @@ msgid "GEOM_SKETCHER_EL" msgstr "Element Type" msgid "GEOM_BUT_CLOSE_SKETCH" -msgstr "Close Sketcher" +msgstr "Close Sketch" msgid "GEOM_BUT_END_SKETCH" -msgstr "End Sketcher" +msgstr "End Sketch" msgid "GEOM_SKETCHER_TITLE" -msgstr "Spline Construction" +msgstr "Sketch Construction" msgid "GEOM_SKETCHER_POINT" msgstr "Point" @@ -1299,3 +1307,10 @@ msgstr "Values" msgid "GEOM_SKETCHER_TYPE" msgstr "Type" + +msgid "GEOM_FILLET_ABORT" +msgstr "Fillet can't be computed with radius %1" + +msgid "GEOM_CHAMFER_ABORT" +msgstr "Chamfer can't be computed with %1 and %2" + diff --git a/src/GEOMContext/GEOM_msg_fr.po b/src/GEOMContext/GEOM_msg_fr.po index fdeb94661..f0ba8041c 100644 --- a/src/GEOMContext/GEOM_msg_fr.po +++ b/src/GEOMContext/GEOM_msg_fr.po @@ -34,6 +34,10 @@ msgstr "&Ok" msgid "GEOM_BUT_YES" msgstr "&Oui" +#Button No +msgid "GEOM_BUT_NO" +msgstr "&Non" + #Button Help msgid "GEOM_BUT_HELP" msgstr "&Aide" @@ -49,7 +53,7 @@ msgstr "&Exploser" #: GeometryGUI.cxx:563 msgid "GEOM_INF_LOADED" -msgstr "Le fichier %1 est chargé." +msgstr "Le fichier %1 est chargé." # #============================================================================== @@ -57,15 +61,15 @@ msgstr "Le fichier %1 est charg #: GeometryGUI.cxx:3069 msgid "GEOM_PRP_COMMAND" -msgstr "Pas de commande associée à l'id = %1." +msgstr "Pas de commande associée à l'id = %1." #: GeometryGUI.cxx:4977 msgid "GEOM_PRP_ABORT" -msgstr "L'opération a echoué" +msgstr "L'opération a echoué" #: GeometryGUI.cxx:5058 msgid "GEOM_PRP_DONE" -msgstr "Opération effectuée" +msgstr "Opération effectuée" #: GeometryGUI.cxx:3717 msgid "GEOM_PRP_LOADING" @@ -73,11 +77,11 @@ msgstr "Chargement de %1 ..." #: GeometryGUI.cxx:1412 msgid "GEOM_PRP_NULLSHAPE" -msgstr "Erreur, objet inconsistant ou inapproprié !" +msgstr "Erreur, objet inconsistant ou inapproprié !" #: GeometryGUI.cxx:5072 msgid "GEOM_PRP_READY" -msgstr "Prêt..." +msgstr "Prêt..." #: GeometryGUI.cxx:1690 msgid "GEOM_PRP_SELECT_SUBSHAPES" @@ -127,11 +131,11 @@ msgstr "Angle :" #: GeometryGUI.cxx:3941 msgid "GEOM_MEN_COMPONENT" -msgstr "Géometrie" +msgstr "Géometrie" #: GeometryGUI.cxx:4389 msgid "GEOM_MEN_ENTER_ANGLE" -msgstr "Saisir un angle en degrés" +msgstr "Saisir un angle en degrés" #: GeometryGUI.cxx:3758 msgid "GEOM_MEN_EXPORT" @@ -153,6 +157,10 @@ msgstr "Fichiers IGES ( *.iges *.igs )" msgid "GEOM_MEN_IMPORT_STEP" msgstr "Fichiers STEP ( *.step *.stp )" +#: GeometryGUI.cxx:3763 +msgid "GEOM_MEN_LOAD_SCRIPT" +msgstr "Fichiers PYTHON ( *.py )" + #: GeometryGUI.cxx:2931 msgid "GEOM_MEN_ISOS" msgstr "Choisir un nombre d'isos" @@ -216,6 +224,10 @@ msgstr "Le rayon est nul" msgid "GEOM_WRN_WARNING" msgstr "Avertissement" +#: GeometryGUI.cxx:3854 +msgid "GEOM_REALLY_DELETE" +msgstr "Voulez-vous supprimer l'object(s) ?" + # #============================================================================== # @@ -250,7 +262,7 @@ msgstr "Objet %1" #Object and result msgid "GEOM_OBJECT_RESULT" -msgstr "Objet Et Résultat" +msgstr "Objet Et Résultat" #Point msgid "GEOM_POINT" @@ -265,7 +277,7 @@ msgid "GEOM_CENTER_POINT" msgstr "Point Centre" #Diagonal Points -msgid "GEOM__DIAGONAL_POINTS" +msgid "GEOM_DIAGONAL_POINTS" msgstr "Points Diagonaux" #Central Point @@ -310,7 +322,7 @@ msgstr "poids" #Coordinates msgid "GEOM_COORDINATES" -msgstr "Coordonnées" +msgstr "Coordonnées" #Coor. msgid "GEOM_COOR" @@ -362,11 +374,11 @@ msgstr "Base" #Water Density msgid "GEOM_WATER_DENSITY" -msgstr "Densité de l'eau :" +msgstr "Densité de l'eau :" #Meshing Deflection msgid "GEOM_MESHING_DEFLECTION" -msgstr "Déflection Du Maillage :" +msgstr "Déflection Du Maillage :" #Dimensions msgid "GEOM_DIMENSIONS" @@ -374,11 +386,11 @@ msgstr "Dimensions" #Precision msgid "GEOM_PRECISION" -msgstr "Précision :" +msgstr "Précision :" #Selection msgid "GEOM_SELECTION" -msgstr "Sélection" +msgstr "Sélection" #Nb. Times msgid "GEOM_NB_TIMES" @@ -414,7 +426,7 @@ msgstr "Partition" #Tolerance msgid "GEOM_TOLERANCE" -msgstr "Tolérance" +msgstr "Tolérance" #Orientation msgid "GEOM_ORIENTATION" @@ -426,7 +438,7 @@ msgstr "Pipe" #Revolution msgid "GEOM_REVOLUTION" -msgstr "Révolution" +msgstr "Révolution" #Rotation msgid "GEOM_ROTATION" @@ -434,7 +446,7 @@ msgstr "Rotation" #Archimede msgid "GEOM_ARCHIMEDE" -msgstr "Archimède" +msgstr "Archimède" #Common msgid "GEOM_COMMON" @@ -544,6 +556,21 @@ msgstr "Boite" msgid "GEOM_CIRCLE" msgstr "Cercle" +#Ellipse +msgid "GEOM_ELLIPSE" +msgstr "Ellipse" + +msgid "GEOM_ELLIPSE_TITLE" +msgstr "Construction d'Ellipses" + +#Radius major +msgid "GEOM_RADIUS_MAJOR" +msgstr "Rayon max. :" + +#Radius minor +msgid "GEOM_RADIUS_MINOR" +msgstr "Rayon min. :" + #Compound msgid "GEOM_COMPOUND" msgstr "Compound" @@ -594,7 +621,7 @@ msgstr "Solide" #Sphere msgid "GEOM_SPHERE" -msgstr "Sphère" +msgstr "Sphère" #Conical Face msgid "GEOM_SURFCONE" @@ -606,7 +633,7 @@ msgstr "Face Cylindrique" #Spherical Face msgid "GEOM_SURFSPHERE" -msgstr "Face Sphèrique" +msgstr "Face Sphèrique" #Toroidal Face msgid "GEOM_SURFTORUS" @@ -635,10 +662,14 @@ msgstr "Vertex" #Wire msgid "GEOM_WIRE" msgstr "Wire" + +#Wire(s) +msgid "GEOM_WIRES" +msgstr "Wire(s)" #Parameter msgid "GEOM_PARAMETER" -msgstr "Paramètre :" +msgstr "Paramètre :" # @@ -691,7 +722,7 @@ msgstr "D2 :" #: GeometryGUI.cxx msgid "GEOM_STEP_TITLE" -msgstr "Increment par défaut lors des constructions" +msgstr "Increment par défaut lors des constructions" #: GeometryGUI_ArcDlg.cxx:45 msgid "GEOM_ARC_TITLE" @@ -699,7 +730,7 @@ msgstr "Construction d'un Arc" #: GeometryGUI_ArchimedeDlg.cxx:55 msgid "GEOM_ARCHIMEDE_TITLE" -msgstr "Construction d'Archimède" +msgstr "Construction d'Archimède" #: GeometryGUI_BndBoxDlg.cxx:59 msgid "GEOM_BNDBOX_TITLE" @@ -739,7 +770,7 @@ msgstr "Construction d'un Cercle" #: GeometryGUI_CenterMassDlg.cxx:77 msgid "GEOM_CMASS_TITLE" -msgstr "Centre De Gravité" +msgstr "Centre De Gravité" msgid "GEOM_PLANE_SIZE" msgstr "Taille du plan :" @@ -750,7 +781,7 @@ msgstr "BOOLEEN : Jonction De Deux Objets" #: GeometryGUI_CompoundDlg.cxx:44 msgid "GEOM_COMPOUND_TITLE" -msgstr "Création d'un Compound" +msgstr "Création d'un Compound" #: GeometryGUI_ConeDlg.cxx:49 msgid "GEOM_CONE_TITLE" @@ -782,27 +813,27 @@ msgstr "Objets Et Resultats" #: GeometryGUI_EdgeDlg.cxx:47 msgid "GEOM_EDGE_TITLE" -msgstr "Création d'un Edge" +msgstr "Création d'un Edge" #: GeometryGUI_FilletDlg.cxx:58 msgid "GEOM_FILLET_TITLE" -msgstr "Construction d'un Congé" +msgstr "Construction d'un Congé" #: GeometryGUI_FilletDlg.cxx:58 msgid "GEOM_FILLET_ALL" -msgstr "Congé sur toute la Shape" +msgstr "Congé sur toute la Shape" #: GeometryGUI_FilletDlg.cxx:58 msgid "GEOM_FILLET_EDGES" -msgstr "Congé sur Edges de la Shape" +msgstr "Congé sur Edges de la Shape" #: GeometryGUI_FilletDlg.cxx:58 msgid "GEOM_FILLET_FACES" -msgstr "Congé sur Faces de la Shape" +msgstr "Congé sur Faces de la Shape" #: GeometryGUI_FaceDlg.cxx:49 msgid "GEOM_FACE_TITLE" -msgstr "Création d'une Face" +msgstr "Création d'une Face" #: GeometryGUI_FaceDlg.cxx:78 msgid "GEOM_FACE_FFW" @@ -810,7 +841,7 @@ msgstr "Face a partir d'un wire" #: GeometryGUI_FaceDlg.cxx:103 msgid "GEOM_FACE_OPT" -msgstr "Création d'une Face plane" +msgstr "Création d'une Face plane" #: GeometryGUI_FillingDlg.cxx:53 msgid "GEOM_FILLING_TITLE" @@ -912,6 +943,10 @@ msgstr "Objet garde" msgid "GEOM_PARTITION_ORIENTATION" msgstr "Change l'orientation" +#: GeometryGUI_PartitionDlg.cxx:45 +msgid "SUPPRESS_RESULT" +msgstr "Suppress Result" + #: GeometryGUI_PipeDlg.cxx:47 msgid "GEOM_PIPE_TITLE" msgstr "Construction d'une Pipe" @@ -984,9 +1019,9 @@ msgstr "Coudre des Topologies" msgid "GEOM_SHELL_TITLE" msgstr "Construction d'une Shell" -#: GeometryGUI_ShellDlg.cxx:74 -msgid "GEOM_SHELL_LIST" -msgstr "List de Faces Connectees" +#: GeometryGUI_SolidDlg.cxx:74 +msgid "GEOM_SOLID_TITLE" +msgstr "Construction d'un Solid" #: GeometryGUI_SphereDlg.cxx:50 msgid "GEOM_SPHERE_TITLE" @@ -1083,11 +1118,11 @@ msgid "GEOM_WIRE_CONNECT" msgstr "Creation d'un Wire a partir de wires/edges connectes" #: GeometryGUI_WorkingPlaneDlg.cxx:50 -msgid "GEOM_WPALNE_TITLE" +msgid "GEOM_WPLANE_TITLE" msgstr "plan de travail" #: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPALNE_FACE" +msgid "GEOM_WPLANE_FACE" msgstr "Plan Ou Face plane" #: GeometryGUI_multiTranslationDlg.cxx:107 @@ -1115,7 +1150,7 @@ msgid "GEOM_MULTIROTATION_DOUBLE" msgstr "Multi Rotation Double" msgid "GEOM_PARAM_POINT" -msgstr "Point paramétrique" +msgstr "Point paramétrique" # #============================================================================== @@ -1127,4 +1162,155 @@ msgstr "Filaire" #: GeometryGUI.cxx:4613 msgid "GEOM_MEN_SHADING" -msgstr "Ombré" +msgstr "Ombré" + +msgid "GEOM_RECONSTRUCTION_LIMIT" +msgstr "Limite de Reconstruction" + +msgid "GEOM_SUPPRESS_RESULT" +msgstr "Supprimer le Resultat" + +msgid "GEOM_SUPPRESS_RESULT_INSIDE" +msgstr "Intérieur" + +msgid "GEOM_SUPPRESS_RESULT_OUTSIDE" +msgstr "Extérieur" + +msgid "GEOM_RECONSTRUCTION_LIMIT_SHAPE" +msgstr "Shape" +msgid "GEOM_RECONSTRUCTION_LIMIT_SOLID" +msgstr "Solid" +msgid "GEOM_RECONSTRUCTION_LIMIT_SHELL" +msgstr "Shell" +msgid "GEOM_RECONSTRUCTION_LIMIT_FACE" +msgstr "Face" +msgid "GEOM_RECONSTRUCTION_LIMIT_WIRE" +msgstr "Wire" +msgid "GEOM_RECONSTRUCTION_LIMIT_EDGE" +msgstr "Edge" +msgid "GEOM_RECONSTRUCTION_LIMIT_VERTEX" +msgstr "Vertex" + +msgid "GEOM_SPLINE_TITLE" +msgstr "Construction de Splines" +msgid "GEOM_SPLINE" +msgstr "Spline" +msgid "GEOM_BEZIER" +msgstr "Bezier" +msgid "GEOM_INTERPOL" +msgstr "Interpolation" + +# +#============================================================================== +# + +msgid "GEOM_SKETCHER_EL" +msgstr "Type d'Element" + +msgid "GEOM_BUT_CLOSE_SKETCH" +msgstr "Fermer Sketch" + +msgid "GEOM_BUT_END_SKETCH" +msgstr "Terminer Sketch" + +msgid "GEOM_SKETCHER_TITLE" +msgstr "Construction de Sketch" + +msgid "GEOM_SKETCHER_POINT" +msgstr "Point" + +msgid "GEOM_SKETCHER_SEGMENT" +msgstr "Sègment" + +msgid "GEOM_SKETCHER_ARC" +msgstr "Arc" + +msgid "GEOM_SKETCHER_DIR" +msgstr "Direction" + +msgid "GEOM_SKETCHER_POINT2" +msgstr "Point :" + +msgid "GEOM_SKETCHER_DEST" +msgstr "Destination" + +msgid "GEOM_SKETCHER_ABS" +msgstr "Absolu" + +msgid "GEOM_SKETCHER_REL" +msgstr "Relative" + +msgid "GEOM_SKETCHER_SEL" +msgstr "Sélection" + +msgid "GEOM_SKETCHER_ANGLE" +msgstr "Angle" + +msgid "GEOM_SKETCHER_PER" +msgstr "Perpendiculaire" + +msgid "GEOM_SKETCHER_TAN" +msgstr "Tangent" + +msgid "GEOM_SKETCHER_VXVY" +msgstr "VX-VY" + +msgid "GEOM_SKETCHER_LENGTH" +msgstr "Longueur" + +msgid "GEOM_SKETCHER_X" +msgstr "X" + +msgid "GEOM_SKETCHER_Y" +msgstr "Y" + +msgid "GEOM_SKETCHER_X2" +msgstr "X :" + +msgid "GEOM_SKETCHER_Y2" +msgstr "Y :" + +msgid "GEOM_SKETCHER_X3" +msgstr "Abs. X :" + +msgid "GEOM_SKETCHER_Y3" +msgstr "Abs. Y :" + +msgid "GEOM_SKETCHER_DX2" +msgstr "DX :" + +msgid "GEOM_SKETCHER_DY2" +msgstr "DY :" + +msgid "GEOM_SKETCHER_VX2" +msgstr "VX :" + +msgid "GEOM_SKETCHER_VY2" +msgstr "VY :" + +msgid "GEOM_SKETCHER_LENGTH2" +msgstr "Longueur :" + +msgid "GEOM_SKETCHER_ANGLE2" +msgstr "Angle :" + +msgid "GEOM_SKETCHER_RADIUS2" +msgstr "Radius :" + +msgid "GEOM_SKETCHER_UNDO" +msgstr "Undo" + +msgid "GEOM_SKETCHER_APPLY" +msgstr "Appliquer" + +msgid "GEOM_SKETCHER_VALUES" +msgstr "Valeurs" + +msgid "GEOM_SKETCHER_TYPE" +msgstr "Type" + +msgid "GEOM_FILLET_ABORT" +msgstr "Le congé ne peut-être realisé avec un rayon de %1 " + +msgid "GEOM_CHAMFER_ABORT" +msgstr "Le chanfrein ne peut-être realisé avec %1 et %2 " diff --git a/src/GEOMContext/Makefile.in b/src/GEOMContext/Makefile.in index ffb273015..991d7480e 100644 --- a/src/GEOMContext/Makefile.in +++ b/src/GEOMContext/Makefile.in @@ -60,6 +60,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/GEOMDS/GEOMDS_Commands.cxx b/src/GEOMDS/GEOMDS_Commands.cxx index 17f7e5764..d2fa1c38e 100644 --- a/src/GEOMDS/GEOMDS_Commands.cxx +++ b/src/GEOMDS/GEOMDS_Commands.cxx @@ -264,9 +264,10 @@ Standard_Boolean GEOMDS_Commands::ClearAllIOR(const TDF_Label& aLabel) 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" ) + ClearAllIOR(L); } - if(notTested) - MESSAGE("in GEOMDS_Commands::ClearAllIOR : IOR CLEARED" ) } return true ; } diff --git a/src/GEOMDS/GEOMDS_Commands.jxx b/src/GEOMDS/GEOMDS_Commands.jxx index 017dcd329..8d4cccf10 100644 --- a/src/GEOMDS/GEOMDS_Commands.jxx +++ b/src/GEOMDS/GEOMDS_Commands.jxx @@ -35,4 +35,4 @@ #endif #ifndef _GEOMDS_Commands_HeaderFile #include "GEOMDS_Commands.hxx" -#endif \ No newline at end of file +#endif diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 357507e17..fd961ec3d 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "GeometryGUI.h" // Open CASCADE Includes @@ -40,9 +39,12 @@ using namespace std; #include "OCCViewer_Viewer3d.h" #include "OCCViewer_ViewPort3d.h" #include "VTKViewer_ViewFrame.h" +#include "VTKViewer_InteractorStyleSALOME.h" #include "SALOME_Selection.h" +using namespace std; + /* The object itself created in the static method 'GetOrCreateGEOMBase()' */ static GEOMContext* GeomGUI = 0; @@ -56,10 +58,9 @@ typedef bool CP(QAD_Desktop*, QPopupMenu*, const QString&, // function : GeometryGUI() // purpose : Constructor //======================================================================= -GeometryGUI::GeometryGUI() : - QObject() -{ -} +GeometryGUI::GeometryGUI( const QString& theName, QObject* theParent ) : + SALOMEGUI( theName, theParent ) +{} //======================================================================= @@ -102,7 +103,6 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) return false; Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -110,149 +110,122 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings - if(theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT - theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC - theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE - theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X - theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y - theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE - theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END - theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE - theCommandID == 4051 || // SKETCHER - MENU - SET PLANE - theCommandID == 4052 || // SKETCHER - MENU - TANGENT - theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR - theCommandID == 4061 || // SKETCHER - MENU - LENGTH - theCommandID == 4062 || // SKETCHER - MENU - ANGLE - theCommandID == 4063 || // SKETCHER - MENU - RADIUS - theCommandID == 4064 || // SKETCHER - MENU - X - theCommandID == 4065) { // SKETCHER - MENU - Y + if(theCommandID == 111 || // MENU FILE - IMPORT BREP + theCommandID == 112 || // MENU FILE - IMPORT IGES + theCommandID == 113 || // MENU FILE - IMPORT STEP + theCommandID == 121 || // MENU FILE - EXPORT BREP + theCommandID == 122 || // MENU FILE - EXPORT IGES + theCommandID == 123 || // MENU FILE - EXPORT STEP + theCommandID == 31 || // MENU EDIT - COPY + theCommandID == 33 || // MENU EDIT - DELETE + theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY + theCommandID == 412 || // MENU SETTINGS - SHADING COLOR + theCommandID == 413 || // MENU SETTINGS - ISOS + theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES + theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY + theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT + theCommandID == 8032 || // POPUP VIEWER - COLOR + theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY + theCommandID == 8034 || // POPUP VIEWER - ISOS + theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY + theCommandID == 901 || // OBJECT BROWSER - RENAME + theCommandID == 9024) { // OBJECT BROWSER - OPEN + if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) + return false; + } + else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING + theCommandID == 212 || // MENU VIEW - DISPLAY ALL + theCommandID == 213 || // MENU VIEW - DISPLAY ONLY + theCommandID == 214 || // MENU VIEW - ERASE ALL + theCommandID == 215 || // MENU VIEW - ERASE ONLY + theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING + if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) + return false; + } + else if(theCommandID == 4011 || // MENU BASIC - POINT + theCommandID == 4012 || // MENU BASIC - LINE + theCommandID == 4013 || // MENU BASIC - CIRCLE + theCommandID == 4014 || // MENU BASIC - ELLIPSE + theCommandID == 4015 || // MENU BASIC - ARC + theCommandID == 4016 || // MENU BASIC - VECTOR + theCommandID == 4017 || // MENU BASIC - PLANE + theCommandID == 4018) { // MENU BASIC - WPLANE + if(!GeomGUI->LoadLibrary("libBasicGUI.so")) + return false; + } + else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX + theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER + theCommandID == 4023 || // MENU PRIMITIVE - SPHERE + theCommandID == 4024 || // MENU PRIMITIVE - TORUS + theCommandID == 4025) { // MENU PRIMITIVE - CONE + if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) + return false; + } + else if(theCommandID == 4031 || // MENU GENERATION - PRISM + theCommandID == 4032 || // MENU GENERATION - REVOLUTION + theCommandID == 4033 || // MENU GENERATION - FILLING + theCommandID == 4034) { // MENU GENERATION - PIPE + if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) + return false; + } + else if(theCommandID == 404 || // MENU ENTITY - SKETCHER + theCommandID == 407) { // MENU ENTITY - EXPLODE if(!GeomGUI->LoadLibrary("libEntityGUI.so")) return false; } - else { - if(GeomGUI->myState == 2) { - Mb->setItemEnabled(405, false);//SKETCHER - GeomGUI->GetSketcher().Clear(); - GeomGUI->myState = -1; - } - - if(theCommandID == 111 || // MENU FILE - IMPORT BREP - theCommandID == 112 || // MENU FILE - IMPORT IGES - theCommandID == 113 || // MENU FILE - IMPORT STEP - theCommandID == 121 || // MENU FILE - EXPORT BREP - theCommandID == 122 || // MENU FILE - EXPORT IGES - theCommandID == 123 || // MENU FILE - EXPORT STEP - theCommandID == 31 || // MENU EDIT - COPY - theCommandID == 33 || // MENU EDIT - DELETE - theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY - theCommandID == 412 || // MENU SETTINGS - SHADING COLOR - theCommandID == 413 || // MENU SETTINGS - ISOS - theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES - theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY - theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT - theCommandID == 8032 || // POPUP VIEWER - COLOR - theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY - theCommandID == 8034 || // POPUP VIEWER - ISOS - theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY - theCommandID == 901 || // OBJECT BROWSER - RENAME - theCommandID == 9024) { // OBJECT BROWSER - OPEN - if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) - return false; - } - else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING - theCommandID == 212 || // MENU VIEW - DISPLAY ALL - theCommandID == 213 || // MENU VIEW - DISPLAY ONLY - theCommandID == 214 || // MENU VIEW - ERASE ALL - theCommandID == 215 || // MENU VIEW - ERASE ONLY - theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING - if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) - return false; - } - else if(theCommandID == 4011 || // MENU BASIC - POINT - theCommandID == 4012 || // MENU BASIC - LINE - theCommandID == 4013 || // MENU BASIC - CIRCLE - theCommandID == 4014 || // MENU BASIC - ELLIPSE - theCommandID == 4015 || // MENU BASIC - ARC - theCommandID == 4016 || // MENU BASIC - VECTOR - theCommandID == 4017 || // MENU BASIC - PLANE - theCommandID == 4018) { // MENU BASIC - WPLANE - if(!GeomGUI->LoadLibrary("libBasicGUI.so")) - return false; - } - else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX - theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER - theCommandID == 4023 || // MENU PRIMITIVE - SPHERE - theCommandID == 4024 || // MENU PRIMITIVE - TORUS - theCommandID == 4025) { // MENU PRIMITIVE - CONE - if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) - return false; - } - else if(theCommandID == 4031 || // MENU GENERATION - PRISM - theCommandID == 4032 || // MENU GENERATION - REVOLUTION - theCommandID == 4033 || // MENU GENERATION - FILLING - theCommandID == 4034) { // MENU GENERATION - PIPE - if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) - return false; - } - else if(theCommandID == 404 || // SKETCHER - theCommandID == 407) { // MENU ENTITY - EXPLODE - if(!GeomGUI->LoadLibrary("libEntityGUI.so")) - return false; - } - else if(theCommandID == 4081 || // MENU BUILD - EDGE - theCommandID == 4082 || // MENU BUILD - WIRE - theCommandID == 4083 || // MENU BUILD - FACE - theCommandID == 4084 || // MENU BUILD - SHELL - theCommandID == 4085 || // MENU BUILD - SOLID - theCommandID == 4086) { // MENU BUILD - COMPUND - if(!GeomGUI->LoadLibrary("libBuildGUI.so")) - return false; - } - else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE - theCommandID == 5012 || // MENU BOOLEAN - COMMON - theCommandID == 5013 || // MENU BOOLEAN - CUT - theCommandID == 5014) { // MENU BOOLEAN - SECTION - if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) - return false; - } - else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION - theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION - theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR - theCommandID == 5024 || // MENU TRANSFORMATION - SCALE - theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION - theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION - if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) - return false; - } - else if(theCommandID == 503 || // MENU OPERATION - PARTITION - theCommandID == 504 || // MENU OPERATION - ARCHIMEDE - theCommandID == 505 || // MENU OPERATION - FILLET - theCommandID == 506) { // MENU OPERATION - CHAMFER - if(!GeomGUI->LoadLibrary("libOperationGUI.so")) - return false; - } - else if(theCommandID == 601 || // MENU REPAIR - SEWING - theCommandID == 602 || // MENU REPAIR - ORIENTATION - theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES - theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE - if(!GeomGUI->LoadLibrary("libRepairGUI.so")) - return false; - } - else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES - theCommandID == 702 || // MENU MEASURE - CDG - theCommandID == 703 || // MENU MEASURE - INERTIA - theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX - theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE - theCommandID == 705 || // MENU MEASURE - TOLERANCE - theCommandID == 706 || // MENU MEASURE - WHATIS - theCommandID == 707) { // MENU MEASURE - CHECK - if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) - return false; - } - else + else if(theCommandID == 4081 || // MENU BUILD - EDGE + theCommandID == 4082 || // MENU BUILD - WIRE + theCommandID == 4083 || // MENU BUILD - FACE + theCommandID == 4084 || // MENU BUILD - SHELL + theCommandID == 4085 || // MENU BUILD - SOLID + theCommandID == 4086) { // MENU BUILD - COMPUND + if(!GeomGUI->LoadLibrary("libBuildGUI.so")) return false; } - + else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE + theCommandID == 5012 || // MENU BOOLEAN - COMMON + theCommandID == 5013 || // MENU BOOLEAN - CUT + theCommandID == 5014) { // MENU BOOLEAN - SECTION + if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) + return false; + } + else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION + theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION + theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR + theCommandID == 5024 || // MENU TRANSFORMATION - SCALE + theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION + theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION + if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) + return false; + } + else if(theCommandID == 503 || // MENU OPERATION - PARTITION + theCommandID == 504 || // MENU OPERATION - ARCHIMEDE + theCommandID == 505 || // MENU OPERATION - FILLET + theCommandID == 506) { // MENU OPERATION - CHAMFER + if(!GeomGUI->LoadLibrary("libOperationGUI.so")) + return false; + } + else if(theCommandID == 601 || // MENU REPAIR - SEWING + theCommandID == 602 || // MENU REPAIR - ORIENTATION + theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES + theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE + if(!GeomGUI->LoadLibrary("libRepairGUI.so")) + return false; + } + else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES + theCommandID == 702 || // MENU MEASURE - CDG + theCommandID == 703 || // MENU MEASURE - INERTIA + theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX + theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE + theCommandID == 705 || // MENU MEASURE - TOLERANCE + theCommandID == 706 || // MENU MEASURE - WHATIS + theCommandID == 707) { // MENU MEASURE - CHECK + if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) + return false; + } + else + return false; + //Load Function OnGUIEvent OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnGUIEvent"); OGE (*f1) = NULL; @@ -292,12 +265,7 @@ bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFra if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - - if(GeomGUI->myState == 2) { - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); - GeomGUI->GetSketcher().MakeCurrentEdge(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); - } - + else return true; } @@ -313,14 +281,7 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - if(GeomGUI->myState == 2) { - GeomGUI->GetSketcher().ValidateEdge(); - if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, true); // SKETCH CONTRAINTS - } - } - else if(GeomGUI->myState == 0) { + if(GeomGUI->myState == 0) { if(!GeomGUI->LoadLibrary("libBasicGUI.so")) return false; @@ -336,6 +297,30 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr return false; } +static void UpdateVtkSelection(QAD_Desktop* parent) +{ + if (!parent->getActiveStudy()) return; + + QList aFrameList = parent->getActiveStudy()->getStudyFrames(); + + for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) { + if (aStudyFrame->getTypeView() == VIEW_VTK) { + QAD_ViewFrame* aViewFrame = aStudyFrame->getRightFrame()->getViewFrame(); + VTKViewer_ViewFrame* aVtkViewFrame = dynamic_cast(aViewFrame); + if (!aVtkViewFrame) continue; + VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor(); + if (anInteractor) { + anInteractor->SetSelectionProp(); + anInteractor->SetSelectionTolerance(); + VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME(); + if (aStyle) { + aStyle->setPreselectionProp(); + } + } + } + } +} + //================================================================================= // function : SetSettings() @@ -400,8 +385,6 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) } Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(405, false);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -409,6 +392,9 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings + // PAL5356: update VTK selection + ::UpdateVtkSelection(parent); + return true; } @@ -426,11 +412,8 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString theObject = ""; theContext = ""; - if((theParent.compare("Viewer") == 0)) { - if(GeomGUI->myState == 2) - theContext = "Sketch"; - else if(Sel->IObjectCount() == 0) + if(Sel->IObjectCount() == 0) theContext = "NothingSelected"; } @@ -461,24 +444,6 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr { GeometryGUI::GetOrCreateGeometryGUI(parent); - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - if(theParent.compare("Viewer") == 0) { - if(theContext.compare("Sketch") == 0) { - SketchStatus myCS = GeomGUI->GetSketcher().GetCurrentStatus(); - popup->setCheckable(TRUE); - if(myCS == SEGMENT) { - popup->setItemChecked(4041, true); //Sketch Segment Menu - popup->setItemChecked(4042, false); //Sketch Arc Menu - } - else if(myCS == ARC_CHORD) { - popup->setItemChecked(4041, false); //Sketch Segment Menu - popup->setItemChecked(4042, true); //Sketch Arc Menu - } - return true; - } - } - } - if(!GeomGUI->LoadLibrary("libGEOMBase.so")) return false; @@ -501,24 +466,17 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr // function : activeStudyChanged() // purpose : static //================================================================================= -void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) +bool GeometryGUI::ActiveStudyChanged(QAD_Desktop* parent) { GeometryGUI::GetOrCreateGeometryGUI(parent); if(GeomGUI != 0) { QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - if(GeomGUI->myState == 2) { - Mb->setItemEnabled(405, false);//SKETCHER - GeomGUI->GetSketcher().Clear(); - GeomGUI->myState = -1; - } - bool ViewOCC = false; if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) ViewOCC = true; Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -529,7 +487,11 @@ void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) GeomGUI->EmitSignalCloseAllDialogs(); GeomGUI = 0; } - return; + + // PAL5356: update VTK selection + ::UpdateVtkSelection(parent); + + return true; } @@ -555,43 +517,23 @@ void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theI } -//================================================================================= -// EXPORTED METHODS -//================================================================================= -extern "C" +void GeometryGUI::SupportedViewType(int* buffer, int bufferSize) { - 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 & parent, QString & theObject) - {GeometryGUI::DefinePopup(theContext, parent, theObject);} - - bool activeStudyChanged(QAD_Desktop* parent) - {GeometryGUI::activeStudyChanged(parent);} + if(!buffer || !bufferSize) return; + buffer[0] = (int)VIEW_OCC; + if (--bufferSize) buffer[1] = (int)VIEW_VTK; +} - void buildPresentation(const Handle(SALOME_InteractiveObject)& theIO) - {GeometryGUI::BuildPresentation(theIO);} +void GeometryGUI::Deactivate() +{ + if ( GeomGUI ) + GeomGUI->EmitSignalCloseAllDialogs(); +} - void supportedViewType(int* buffer, int bufferSize) - { - if(!buffer || !bufferSize) return; - buffer[0] = (int)VIEW_OCC; - if (--bufferSize) buffer[1] = (int)VIEW_VTK; +static GeometryGUI aGUI(""); +extern "C" +{ + Standard_EXPORT SALOMEGUI* GetComponentGUI() { + return &aGUI; } } diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index dd133add0..06649f622 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -29,34 +29,36 @@ #ifndef GEOMETRYGUI_H #define GEOMETRYGUI_H +#include "SALOMEGUI.h" #include "GEOMContext.h" //================================================================================= // class : GeometryGUI // purpose : //================================================================================= -class GeometryGUI : public QObject +class GeometryGUI : public SALOMEGUI { Q_OBJECT /* for QT compatibility */ public : - GeometryGUI(); - ~GeometryGUI(); - - static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop); - - /* 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 bool SetSettings(QAD_Desktop* parent); - Standard_EXPORT static void activeStudyChanged(QAD_Desktop* parent); - Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&); - 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); - + GeometryGUI( const QString& name = "", QObject* parent = 0 ); + ~GeometryGUI(); + + static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop); + + /* Managed by IAPP */ + virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + virtual bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + virtual bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + virtual bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + virtual bool SetSettings(QAD_Desktop* parent); + virtual bool ActiveStudyChanged(QAD_Desktop* parent); + virtual void BuildPresentation(const Handle(SALOME_InteractiveObject)&); + virtual void DefinePopup(QString & theContext, QString & theParent, QString & theObject); + virtual bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject); + virtual void SupportedViewType (int* buffer, int bufferSize); + virtual void Deactivate (); }; #endif diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx index 55727f909..bb7159bbb 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.cxx +++ b/src/GEOMGUI/GeometryGUI_Swig.cxx @@ -40,6 +40,8 @@ using namespace std; #include "OCCViewer_Viewer3d.h" #include #include +#include +#include #include #include #include @@ -47,6 +49,7 @@ using namespace std; #include #include #include +#include #include "VTKViewer_RenderWindowInteractor.h" #include "VTKViewer_ViewFrame.h" @@ -164,17 +167,36 @@ int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR) 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(); - } + 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; } @@ -242,6 +264,7 @@ const char* GEOM_Swig::getShapeTypeString(const char* IOR) case TopAbs_SHAPE: { return "Shape" ;} } + return 0; } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index a977323fc..e4aab6706 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -21,12 +21,11 @@ // // // -// File : GEOMBase_Tools.cxx +// File : GEOMToolsGUI.cxx // Author : Damien COQUERET // Module : GEOM // $Header: -using namespace std; #include "GEOMToolsGUI.h" #include "QAD_Config.h" @@ -34,6 +33,7 @@ using namespace std; #include "QAD_Tools.h" #include "QAD_MessageBox.h" #include "QAD_RightFrame.h" +#include "QAD_PyEditor.h" #include "OCCViewer_Viewer3d.h" #include "VTKViewer_ViewFrame.h" @@ -60,6 +60,10 @@ using namespace std; #include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement #include "GEOMToolsGUI_TransparencyDlg.h" // Method TRANSPARENCY adjustement +#include "utilities.h" + +using namespace std; + //======================================================================= // function : GEOMToolsGUI() // purpose : Constructor @@ -150,7 +154,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) break; - + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); @@ -163,7 +167,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } else { Quantity_Color Default = Quantity_Color(); - color = QColor ((int)Default.Red() * 255.0, (int)Default.Green()* 255.0, (int)Default.Blue() * 255.0); + 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()); @@ -213,7 +217,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) else IsoV = "1"; - GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + GEOMToolsGUI_NbIsosDlg* NbIsosDlg = new GEOMToolsGUI_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); int UIso = IsoU.toInt(); int VIso = IsoV.toInt(); @@ -372,7 +376,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) 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()); + QColor c = QColorDialog::getColor(QColor((int)(CSFColor.Red() * 255.0), (int)(CSFColor.Green() * 255.0), (int)(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); @@ -401,7 +405,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } - GEOMBase_TransparencyDlg *aDlg = new GEOMBase_TransparencyDlg(parent, "", Sel, ic); + GEOMToolsGUI_TransparencyDlg *aDlg = new GEOMToolsGUI_TransparencyDlg(parent, "", Sel, ic); break; } case 8034: // ISOS - POPUP VIEWER @@ -427,8 +431,8 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) else IsoV = "1"; - GEOMBase_NbIsosDlg * NbIsosDlg = - new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + GEOMToolsGUI_NbIsosDlg * NbIsosDlg = + new GEOMToolsGUI_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); NbIsosDlg->SpinBoxU->setValue(IsoU.toInt()); NbIsosDlg->SpinBoxV->setValue(IsoV.toInt()); @@ -478,13 +482,50 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) while(useSubItems?anIter->More():!anAttr->_is_nil()) { if(!obj->FindAttribute(anAttr, "AttributeIOR") && obj->FindAttribute(anAttr, "AttributePersistentRef")) { - // load - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer","GEOM"); - if (!CORBA::is_nil(comp)) { - SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - aStudyBuilder->LoadWith(aStudy->FindComponent("GEOM"),driver); - } + + SALOMEDS::SComponent_var FComp = obj->GetFatherComponent(); + if (!CORBA::is_nil(FComp)) { + if (FComp->FindAttribute(anAttr, "AttributeName")) { + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); + QString compName = parent->getComponentName(aName->Value()); + // parent->loadComponentData(parent->getComponentName(aName->Value())); + Engines::Component_var comp ; + if ( compName.compare("SUPERV") == 0 ) { + comp = parent->getEngine( "SuperVisionContainer", compName) ; + } + else { + comp = parent->getEngine( "FactoryServer", compName); + if ( comp->_is_nil() ) + comp = parent->getEngine( "FactoryServerPy", compName); + } + + if (!CORBA::is_nil(comp)) { + SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); + if (!CORBA::is_nil(driver)) { + SALOMEDS::StudyBuilder_var B = aStudy->NewBuilder(); + if (!CORBA::is_nil(B)) { + B->LoadWith(FComp,driver); + } else { + return false; + } + } else { + MESSAGE("loadComponentData(): Driver is null"); + return false; + } + } else { + MESSAGE("loadComponentData(): Engine is null"); + return false; + } + // // load + // Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer","GEOM"); + // if (!CORBA::is_nil(comp)) { + // SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); + // SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + // SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM"); + // if (!CORBA::is_nil(SC)) + // aStudyBuilder->LoadWith(SC,driver); + } + } else { MESSAGE("Component is null"); } @@ -752,9 +793,9 @@ bool GEOMToolsGUI::Import(int aState) // if (aLocked) return false; father->ComponentIOR(myGeomGUI->GetFatherior()); - QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++); + QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->myNbGeom++); - if(myGeomBase->Display(aShape, strdup(nameShape.latin1()))) { + if(myGeomBase->Display(aShape, (char*)nameShape.latin1())) { QAD_Application::getDesktop()->getActiveStudy()->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) ); QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_READY")); } @@ -802,7 +843,7 @@ bool GEOMToolsGUI::Export(int aState) QApplication::setOverrideCursor( Qt::waitCursor ); // Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) ); try { - myGeom->ExportBREP(strdup( file.latin1()), aShape); + myGeom->ExportBREP((char*)file.latin1(), aShape); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -829,7 +870,7 @@ bool GEOMToolsGUI::Export(int aState) if ( !file.isEmpty() && !aShape->_is_nil() ) { QApplication::setOverrideCursor( Qt::waitCursor ); try { - myGeom->ExportIGES(strdup( file.latin1()), aShape); + myGeom->ExportIGES((char*)file.latin1(), aShape); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -875,7 +916,7 @@ bool GEOMToolsGUI::Export(int aState) QApplication::setOverrideCursor( Qt::waitCursor ) ; try { - myGeom->ExportSTEP(strdup( file.latin1()), aShape); + myGeom->ExportSTEP((char*)file.latin1(), aShape); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -901,6 +942,7 @@ bool GEOMToolsGUI::Export(int aState) } QApplication::restoreOverrideCursor() ; + return true; } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx index 5ef80f650..842332015 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx @@ -21,7 +21,7 @@ // // // -// File : GEOMBase_NbIsosDlg.cxx +// File : GEOMToolsGUI_NbIsosDlg.cxx // Author : // Module : GEOM // $Header: @@ -37,17 +37,17 @@ using namespace std; #include //================================================================================= -// class : GEOMBase_NbIsosDlg() -// purpose : Constructs a GEOMBase_NbIsosDlg which is a child of 'parent', with the +// class : GEOMToolsGUI_NbIsosDlg() +// purpose : Constructs a GEOMToolsGUI_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. //================================================================================= -GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool modal, WFlags fl) +GEOMToolsGUI_NbIsosDlg::GEOMToolsGUI_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("GEOMBase_NbIsosDlg"); + setName("GEOMToolsGUI_NbIsosDlg"); setCaption(name); setSizeGripEnabled(TRUE); QGridLayout* MyDialogLayout = new QGridLayout(this); @@ -122,10 +122,10 @@ GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool m //================================================================================= -// function : ~GEOMBase_NbIsosDlg() +// function : ~GEOMToolsGUI_NbIsosDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= -GEOMBase_NbIsosDlg::~GEOMBase_NbIsosDlg() +GEOMToolsGUI_NbIsosDlg::~GEOMToolsGUI_NbIsosDlg() { // no need to delete child widgets, Qt does it all for us } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h index 48c70c563..07e471200 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h @@ -21,13 +21,13 @@ // // // -// File : GEOMBase_NbIsosDlg.h +// File : GEOMToolsGUI_NbIsosDlg.h // Author : // Module : GEOM // $Header: -#ifndef GEOMBASE_NBISOSDLG_H -#define GEOMBASE_NBISOSDLG_H +#ifndef GEOMTOOLSGUI_NBISOSDLG_H +#define GEOMTOOLSGUI_NBISOSDLG_H #include @@ -36,16 +36,16 @@ class QSpinBox; class QPushButton; //================================================================================= -// class : GEOMBase_NbIsosDlg +// class : GEOMToolsGUI_NbIsosDlg // purpose : //================================================================================= -class GEOMBase_NbIsosDlg : public QDialog +class GEOMToolsGUI_NbIsosDlg : public QDialog { Q_OBJECT public: - GEOMBase_NbIsosDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); - ~GEOMBase_NbIsosDlg(); + GEOMToolsGUI_NbIsosDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + ~GEOMToolsGUI_NbIsosDlg(); QPushButton* buttonOk; QPushButton* buttonCancel; @@ -56,4 +56,4 @@ public: }; -#endif // GEOMETRYGUI_NBISOSDLG_H +#endif // GEOMTOOLSGUI_NBISOSDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx index 122cc9848..12beaaaa5 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx @@ -21,7 +21,7 @@ // // // -// File : GEOMBase_TransparencyDlg.cxx +// File : GEOMToolsGUI_TransparencyDlg.cxx // Author : Lucien PIGNOLONI // Module : GEOM @@ -48,24 +48,24 @@ using namespace std; #include "VTKViewer_RenderWindowInteractor.h" //================================================================================= -// class : GEOMBase_TransparencyDlg() +// class : GEOMToolsGUI_TransparencyDlg() // purpose : Constructs a GEOMBase_SUBSHAPE which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // // : WARNING : this dialog is modal ! // //================================================================================= -GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic, bool modal, WFlags fl) +GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_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("GEOMBase_TransparencyDlg"); + setName("GEOMToolsGUI_TransparencyDlg"); resize(152, 107); setCaption(tr("GEOM_TRANSPARENCY_TITLE")); setSizeGripEnabled(TRUE); - GEOMBase_TransparencyDlgLayout = new QGridLayout(this); - GEOMBase_TransparencyDlgLayout->setSpacing(6); - GEOMBase_TransparencyDlgLayout->setMargin(11); + GEOMToolsGUI_TransparencyDlgLayout = new QGridLayout(this); + GEOMToolsGUI_TransparencyDlgLayout->setSpacing(6); + GEOMToolsGUI_TransparencyDlgLayout->setMargin(11); /*************************************************************************/ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); @@ -112,8 +112,8 @@ GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 ); /*************************************************************************/ - GEOMBase_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); - GEOMBase_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); + GEOMToolsGUI_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); + GEOMToolsGUI_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); /* Initialisations */ this->myGeomGUI = GEOMContext::GetGeomGUI(); @@ -133,18 +133,18 @@ GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(ValueHasChanged(int))); /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomBase->DefineDlgPosition(this, x, y); - this->move(x, y) ; +// int x, y ; +// myGeomBase->DefineDlgPosition(this, x, y); +// this->move(x, y) ; this->show() ; /* Displays this Dialog */ } //================================================================================= -// function : ~GEOMBase_TransparencyDlg() +// function : ~GEOMToolsGUI_TransparencyDlg() // purpose : //================================================================================= -GEOMBase_TransparencyDlg::~GEOMBase_TransparencyDlg() +GEOMToolsGUI_TransparencyDlg::~GEOMToolsGUI_TransparencyDlg() { // no need to delete child widgets, Qt does it all for us } @@ -154,7 +154,7 @@ GEOMBase_TransparencyDlg::~GEOMBase_TransparencyDlg() // function : ClickOnOk() // purpose : //======================================================================= -void GEOMBase_TransparencyDlg::ClickOnOk() +void GEOMToolsGUI_TransparencyDlg::ClickOnOk() { accept(); return; @@ -165,7 +165,7 @@ void GEOMBase_TransparencyDlg::ClickOnOk() // function : ClickOnClose() // purpose : //======================================================================= -void GEOMBase_TransparencyDlg::ClickOnClose() +void GEOMToolsGUI_TransparencyDlg::ClickOnClose() { accept(); return; @@ -177,7 +177,7 @@ void GEOMBase_TransparencyDlg::ClickOnClose() // purpose : Called when value of slider change // : or the first time as initilisation //================================================================================= -void GEOMBase_TransparencyDlg::ValueHasChanged(int newValue) +void GEOMToolsGUI_TransparencyDlg::ValueHasChanged(int newValue) { if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h index fbcc4efcd..8ae122d1b 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h @@ -21,7 +21,7 @@ // // // -// File : GEOMBase_TransparencyDlg.h +// File : GEOMToolsGUI_TransparencyDlg.h // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ @@ -51,23 +51,23 @@ class QSlider; //================================================================================= -// class : GEOMBase_TransparencyDlg +// class : GEOMToolsGUI_TransparencyDlg // purpose : // : WARNING : that is a MODAL dialog. //================================================================================= -class GEOMBase_TransparencyDlg : public QDialog +class GEOMToolsGUI_TransparencyDlg : public QDialog { Q_OBJECT public: - GEOMBase_TransparencyDlg( QWidget* parent = 0, + GEOMToolsGUI_TransparencyDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, const Handle(AIS_InteractiveContext)& ic = 0, bool modal = TRUE, WFlags fl = 0 ); - ~GEOMBase_TransparencyDlg(); + ~GEOMToolsGUI_TransparencyDlg(); private : @@ -89,7 +89,7 @@ public slots: void ValueHasChanged( int newValue ) ; protected: - QGridLayout* GEOMBase_TransparencyDlgLayout; + QGridLayout* GEOMToolsGUI_TransparencyDlgLayout; QHBoxLayout* Layout1; QHBoxLayout* Layout2; }; diff --git a/src/GEOM_SWIG/GEOM_Sketcher.py b/src/GEOM_SWIG/GEOM_Sketcher.py new file mode 100644 index 000000000..fbdb7fbf5 --- /dev/null +++ b/src/GEOM_SWIG/GEOM_Sketcher.py @@ -0,0 +1,58 @@ +# 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_Sketcher.py +# Author : Damien COQUERET, Open CASCADE +# Module : GEOM +# $Header$ + +import geompy + +#SKETCHER INFOS +#Init Sketcher +#Create a string beginning by :"Sketcher:" +#Each command must be separated by ":" +#"F x y" : Create first point at X & Y + +#To Make Segment +#"R angle" : Set the direction by angle +#"D dx dy" : Set the direction by DX & DY + +#"TT x y" : Create by point at X & Y +#"T dx dy" : Create by point with DX & DY +#"L length" : Create by direction & Length +#"IX x" : Create by direction & Intersect. X +#"IY y" : Create by direction & Intersect. Y + +#To Make Arc +#"C radius length" : Create by direction, radius and length(in degree) + +#To finish +#"WW" : Close Wire + +#Create Sketcher +Cmd = "Sketch:F 0 0:TT 0 100:C 100 180:WW" +Sketcher = geompy.MakeSketcher(Cmd) #(string)->GEOM_Shape_ptr + +#Add In Study +id_Sketcher = geompy.addToStudy(Sketcher, "Sketcher") diff --git a/src/GEOM_SWIG/Makefile.in b/src/GEOM_SWIG/Makefile.in index 6ea27169e..a053a12a1 100644 --- a/src/GEOM_SWIG/Makefile.in +++ b/src/GEOM_SWIG/Makefile.in @@ -51,7 +51,8 @@ EXPORT_PYSCRIPTS = libGEOM_Swig.py geompy.py batchmode_geompy.py \ GEOM_Partition2.py \ GEOM_Partition3.py \ GEOM_Partition4.py \ - GEOM_Partition5.py + GEOM_Partition5.py \ + GEOM_Sketcher.py LIB_CLIENT_IDL = SALOMEDS.idl \ SALOMEDS_Attributes.idl \ diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 4bb742a89..041330f6a 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -152,12 +152,24 @@ def MakeCircle(p1,d1,radius): anObj._set_Name(ior) return anObj +def MakeEllipse(p1,d1,radiusMaj,radiusMin): + anObj = geom.MakeEllipse(p1,d1,radiusMaj, radiusMin) + 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 +def MakeSketcher(Cmd): + anObj = geom.MakeSketcher(Cmd) + ior = orb.object_to_string(anObj) + anObj._set_Name(ior) + return anObj + # ----------------------------------------------------------------------------- # Create Geometry 3D # ----------------------------------------------------------------------------- @@ -214,6 +226,12 @@ def MakeFace(aShapeWire,WantPlanarFace): anObj._set_Name(ior) return anObj +def MakeFaces(ListShape,WantPlanarFace): + anObj = geom.MakeFaces(ListShape,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) @@ -356,10 +374,11 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], return anObj def SuppressFaces(aShape,ListOfId): - anObj = geom.SuppressFaces(aShape,ListOfId) - ior = orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj + ListObj = geom.SuppressFaces(aShape,ListOfId) + for anObj in ListObj : + ior = orb.object_to_string(anObj) + anObj._set_Name(ior) + return ListObj def SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace): anObj = geom.SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace) diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 4746e7d62..6d0fca32a 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -178,12 +178,24 @@ def MakeCircle(p1,d1,radius): anObj._set_Name(ior) return anObj +def MakeEllipse(p1,d1,radiusMaj,radiusMin): + anObj = geom.MakeEllipse(p1,d1,radiusMaj, radiusMin) + 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 +def MakeSketcher(Cmd): + anObj = geom.MakeSketcher(Cmd) + ior = salome.orb.object_to_string(anObj) + anObj._set_Name(ior) + return anObj + # ----------------------------------------------------------------------------- # Create Geometry 3D # ----------------------------------------------------------------------------- @@ -388,10 +400,11 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], return anObj def SuppressFaces(aShape,ListOfId): - anObj = geom.SuppressFaces(aShape,ListOfId) - ior = salome.orb.object_to_string(anObj) - anObj._set_Name(ior) - return anObj + ListObj = geom.SuppressFaces(aShape,ListOfId) + for anObj in ListObj : + ior = salome.orb.object_to_string(anObj) + anObj._set_Name(ior) + return ListObj def SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace): anObj = geom.SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace) diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index 968e4df57..85d0203b8 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -26,9 +26,9 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_FillingDlg.h" +#include "QAD_WaitCursor.h" #include "QAD_Config.h" #include @@ -38,8 +38,14 @@ using namespace std; #include #include #include +#include #include #include +#include + +#include "utilities.h" + +using namespace std; //================================================================================= // class : GenerationGUI_FillingDlg() @@ -172,6 +178,7 @@ void GenerationGUI_FillingDlg::ClickOnOk() //================================================================================= void GenerationGUI_FillingDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; @@ -209,10 +216,14 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() return; if(myEditCurrentArgument == GroupPoints->LineEdit1 && mySectionShape.ShapeType() == TopAbs_COMPOUND) { - myEditCurrentArgument->setText(aString); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; + // mySectionShape should be a compound of edges + for ( TopoDS_Iterator it( mySectionShape ); it.More(); it.Next() ) + if ( it.Value().ShapeType() != TopAbs_EDGE ) + return; + myEditCurrentArgument->setText(aString); myOkSectionShape = true; } @@ -318,6 +329,8 @@ void GenerationGUI_FillingDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void GenerationGUI_FillingDlg::MakeFillingSimulationAndDisplay() { + QAD_WaitCursor wc; + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); @@ -335,6 +348,7 @@ void GenerationGUI_FillingDlg::MakeFillingSimulationAndDisplay() if( Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return; C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); + if (C.IsNull()) continue; C = new Geom_TrimmedCurve(C, First, Last); Section.AddCurve(C) ; i++ ; diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index dae7c23f6..adb21593b 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_PipeDlg.h" #include @@ -38,6 +37,10 @@ using namespace std; #include #endif +#include "utilities.h" + +using namespace std; + //================================================================================= // class : GenerationGUI_PipeDlg() // purpose : Constructs a GenerationGUI_PipeDlg which is a child of 'parent', with the @@ -187,7 +190,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() } else if(myEditCurrentArgument == GroupPoints->LineEdit2) { myOkShape2 = false; - if(S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE && S.ShapeType() != TopAbs_VERTEX) { + if(S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) { myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index f2b9ea58f..90fc67b70 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -26,12 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_PrismDlg.h" #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : GenerationGUI_PrismDlg() // purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the @@ -146,6 +149,7 @@ void GenerationGUI_PrismDlg::ClickOnOk() //================================================================================= void GenerationGUI_PrismDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 79e7e1bac..0aa52712c 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -26,13 +26,18 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_RevolDlg.h" #include #include #include #include "QAD_Config.h" +#include +#include + +#include "utilities.h" + +using namespace std; //================================================================================= // class : GenerationGUI_RevolDlg() @@ -145,6 +150,7 @@ void GenerationGUI_RevolDlg::ClickOnOk() //================================================================================= void GenerationGUI_RevolDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; @@ -156,6 +162,32 @@ void GenerationGUI_RevolDlg::ClickOnApply() return; } +//======================================================================= +//function : isAcceptableBase +//purpose : return true if theBase can be used as algo argument +//======================================================================= + +static bool isAcceptableBase(const TopoDS_Shape& theBase) +{ + switch ( theBase.ShapeType() ) { + case TopAbs_VERTEX: + case TopAbs_EDGE: + case TopAbs_WIRE: + case TopAbs_FACE: + case TopAbs_SHELL: + return true; + case TopAbs_SOLID: + case TopAbs_COMPSOLID: + return false; + case TopAbs_COMPOUND: { + TopExp_Explorer exp( theBase, TopAbs_SOLID); + return !exp.More(); + } + default: + return false; + } + return false; +} //================================================================================= // function : SelectionIntoArgument() @@ -188,8 +220,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) 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) + if( !isAcceptableBase( S )) return; myEditCurrentArgument->setText(aString); myOkBase = true; @@ -317,8 +348,7 @@ void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay() myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); - TopAbs_ShapeEnum aType = myBase.ShapeType(); - if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType !=TopAbs_COMPOUND) + if (!isAcceptableBase( myBase )) return; try { diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index fc9feffb6..838f140e7 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -26,12 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_BndBoxDlg.h" #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_BndBoxDlg() // purpose : Constructs a MeasureGUI_BndBoxDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index 691fd8694..2ddbc82f0 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_CenterMassDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_CenterMassDlg() // purpose : Constructs a MeasureGUI_CenterMassDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx index fa6d776ca..407824be7 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_CheckShapeDlg.h" #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_CheckShapeDlg() // purpose : Constructs a MeasureGUI_CheckShapeDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index d527eee7f..f33a3415b 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_DistanceDlg.h" #include "QAD_RightFrame.h" @@ -42,6 +41,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_DistanceDlg() // purpose : Constructs a MeasureGUI_DistanceDlg which is a child of 'parent', with the @@ -322,7 +325,9 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape gp_Pln gp_P = gce_MP.Value(); Handle(Geom_Plane) P = new Geom_Plane(gp_P); - Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension(V1, V2, P, Dist, TCollection_ExtendedString(strdup(S))); + char* aCopyS = CORBA::string_dup(S); + Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension(V1, V2, P, Dist, TCollection_ExtendedString(aCopyS)); + delete(aCopyS); GroupC1->LineEdit3->setText(S); diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index e8c796ad8..8ceaea053 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -25,13 +25,16 @@ // Author : Lucien PIGNOLONI // Module : GEOM -using namespace std; #include "MeasureGUI_InertiaDlg.h" #include #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_InertiaDlg() // purpose : Constructs a MeasureGUI_InertiaDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index 93f2da25f..04b810b89 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_MaxToleranceDlg.h" #include @@ -35,6 +34,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_MaxToleranceDlg() // purpose : Constructs a MeasureGUI_MaxToleranceDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index 934551b84..ede6403fa 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_PropertiesDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_PropertiesDlg() // purpose : Constructs a MeasureGUI_PropertiesDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.h b/src/MeasureGUI/MeasureGUI_Skeleton.h index 015951864..299c51a85 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.h +++ b/src/MeasureGUI/MeasureGUI_Skeleton.h @@ -39,6 +39,7 @@ #include #include #include +#include class MeasureGUI_Skeleton : public MeasureGUI_Skeleton_QTD { diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 23c2895c3..3fddd8492 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_WhatisDlg.h" #include @@ -37,6 +36,12 @@ using namespace std; #include +#include + +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_WhatisDlg() // purpose : Constructs a MeasureGUI_WhatisDlg which is a child of 'parent', with the @@ -211,8 +216,15 @@ void MeasureGUI_WhatisDlg::CalculateWhatis(const TopoDS_Shape& S) return; TCollection_AsciiString Astr; - Astr = Astr + " Number of shapes in " + strdup(SelectedName.latin1()) + " : \n"; + if ( S.ShapeType() == TopAbs_EDGE ) { + if( BRep_Tool::Degenerated(TopoDS::Edge(S)) ) { + Astr = Astr + " " + CORBA::string_dup(SelectedName.latin1()) + " is a degenerated edge \n"; + } + } + + Astr = Astr + " Number of shapes in " + CORBA::string_dup(SelectedName.latin1()) + " : \n"; + try { int iType, nbTypes [TopAbs_SHAPE]; for(iType = 0; iType < TopAbs_SHAPE; ++iType) diff --git a/src/OBJECT/GEOM_AISShape.jxx b/src/OBJECT/GEOM_AISShape.jxx index 8f66299fd..c3d2a67e9 100644 --- a/src/OBJECT/GEOM_AISShape.jxx +++ b/src/OBJECT/GEOM_AISShape.jxx @@ -38,4 +38,4 @@ #endif #ifndef _Prs3d_Presentation_HeaderFile #include -#endif \ No newline at end of file +#endif diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index 77468ea95..7e272e91d 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -152,6 +152,7 @@ void OperationGUI_ArchimedeDlg::ClickOnOk() //================================================================================= void OperationGUI_ArchimedeDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if(myOkIO) myOperationGUI->Archimede(myIO, myWeight, myWaterDensity, myMeshingDeflection); diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 92085d229..b4a171f40 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -30,7 +30,10 @@ using namespace std; #include "OperationGUI_ChamferDlg.h" #include "DisplayGUI.h" +#include "QAD_MessageBox.h" +#include +#include #include #include #include @@ -38,6 +41,9 @@ using namespace std; #include #include +#include +#include + //================================================================================= // class : OperationGUI_ChamferDlg() // purpose : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the @@ -68,23 +74,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(QWidget* parent, const char* na Group1->TextLabel3->setText(tr("GEOM_D2")); Group1->PushButton1->setPixmap(image3); - Group2 = new DlgRef_1Sel2Spin(this, "Group2"); - Group2->GroupBox1->setTitle(tr("GEOM_CHAMFER_EDGES")); - Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - Group2->TextLabel2->setText(tr("GEOM_D1")); - Group2->TextLabel3->setText(tr("GEOM_D2")); - Group2->PushButton1->setPixmap(image3); - - Group3 = new DlgRef_1Sel2Spin(this, "Group3"); - Group3->GroupBox1->setTitle(tr("GEOM_CHAMFER_FACES")); - Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - Group3->TextLabel2->setText(tr("GEOM_D1")); - Group3->TextLabel3->setText(tr("GEOM_D2")); - Group3->PushButton1->setPixmap(image3); - Layout1->addWidget(Group1, 1, 0); - Layout1->addWidget(Group2, 1, 0); - Layout1->addWidget(Group3, 1, 0); /***************************************************************/ /* Initialisations */ @@ -123,18 +113,10 @@ void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic) double SpecificStep = 10.0; /* min, max, step and decimals for spin boxes */ Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); - Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); - Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); Group1->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); - Group2->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); - Group3->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); Group1->SpinBox_DX->SetValue(myD1); - Group2->SpinBox_DX->SetValue(myD1); - Group3->SpinBox_DX->SetValue(myD1); Group1->SpinBox_DY->SetValue(myD2); - Group2->SpinBox_DY->SetValue(myD2); - Group3->SpinBox_DY->SetValue(myD2); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); @@ -146,32 +128,16 @@ void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic) connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group2->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DY, SLOT(SetStep(double))); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* displays Dialog */ - Group2->hide(); - Group3->hide(); Group1->show(); this->show(); @@ -200,52 +166,33 @@ void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) myUseLocalContext = false; } + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) { + myConstructorId = constructorId = 0; //No subshape selection if viewer is not OCC + RadioButton1->setChecked(TRUE); + } + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + Group1->LineEdit1->setText(""); + Group1->SpinBox_DX->SetValue(myD1); + Group1->SpinBox_DY->SetValue(myD2); switch (constructorId) { case 0: /* Chamfer All */ { - Group2->hide(); - Group3->hide(); - resize(0, 0); - Group1->show(); - - myEditCurrentArgument = Group1->LineEdit1; - Group1->LineEdit1->setText(""); + Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_ALL")); myShapeType = -1; - - Group1->SpinBox_DX->SetValue(myD1); - Group1->SpinBox_DY->SetValue(myD2); break; } case 1: /* Chamfer edges */ { - Group1->hide(); - Group3->hide(); - resize(0, 0); - Group2->show(); - - myEditCurrentArgument = Group2->LineEdit1; - Group2->LineEdit1->setText(""); + Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_EDGES")); myShapeType = 6; - - Group2->SpinBox_DX->SetValue(myD1); - Group2->SpinBox_DY->SetValue(myD2); break; } case 2: /* Chamfer Faces */ { - Group1->hide(); - Group2->hide(); - resize(0, 0); - Group3->show(); - - myEditCurrentArgument = Group3->LineEdit1; - Group3->LineEdit1->setText(""); + Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_FACES")); myShapeType = 4; - - Group3->SpinBox_DX->SetValue(myD1); - Group3->SpinBox_DY->SetValue(myD2); break; } } @@ -271,6 +218,7 @@ void OperationGUI_ChamferDlg::ClickOnOk() //================================================================================= void OperationGUI_ChamferDlg::ClickOnApply() { + buttonApply->setFocus(); QApplication::setOverrideCursor(Qt::waitCursor); QAD_Application::getDesktop()->putInfo(tr("")); myGeomBase->EraseSimulationShape(); @@ -372,7 +320,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() } } } - if(myConstructorId == 0) + if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0) this->MakePreview(); } @@ -388,27 +336,6 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void OperationGUI_ChamferDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if(send == Group1->LineEdit1) - myEditCurrentArgument = Group1->LineEdit1; - else if (send == Group2->LineEdit1) - myEditCurrentArgument = Group2->LineEdit1; - else if (send == Group3->LineEdit1) - myEditCurrentArgument = Group3->LineEdit1; - else - return; - - GEOMBase_Skeleton::LineEditReturnPressed(); - return; -} - - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -417,18 +344,9 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == Group1->PushButton1) { + if(send == Group1->PushButton1) Group1->LineEdit1->setFocus(); - myEditCurrentArgument = Group1->LineEdit1; - } - else if(send == Group2->PushButton1) { - Group2->LineEdit1->setFocus(); - myEditCurrentArgument = Group2->LineEdit1; - } - else if(send == Group3->PushButton1) { - Group3->LineEdit1->setFocus(); - myEditCurrentArgument = Group3->LineEdit1; - } + this->SelectionIntoArgument(); return; } @@ -489,24 +407,20 @@ void OperationGUI_ChamferDlg::closeEvent(QCloseEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) +void OperationGUI_ChamferDlg::ValueChangedInSpinBox(double newValue) { myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); QObject* send = (QObject*)sender(); - if(send == Group1->SpinBox_DX || send == Group2->SpinBox_DX || send == Group3->SpinBox_DX) { /* D1 */ + if(send == Group1->SpinBox_DX) /* D1 */ myD1 = newValue; - if(myConstructorId == 0) - this->MakePreview(); - return ; - } - else if(send == Group1->SpinBox_DY || send == Group2->SpinBox_DY || send == Group3->SpinBox_DY) { /* D2 */ + else if(send == Group1->SpinBox_DY) /* D2 */ myD2 = newValue; - if(myConstructorId == 0) - this->MakePreview(); - return; - } + + if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0) + this->MakePreview(); + return; } @@ -539,48 +453,44 @@ void OperationGUI_ChamferDlg::ResetStateOfDialog() void OperationGUI_ChamferDlg::MakePreview() { QApplication::setOverrideCursor(Qt::waitCursor); - - if(!myOkShape) { - QApplication::restoreOverrideCursor(); - return; - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ListOfID->length(0); - - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(myShapeIOR); - if(theObj->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - QApplication::restoreOverrideCursor(); - return; - } + TopoDS_Shape tds; try { - if(myD1 <= Precision::Confusion() || myD2 <= Precision::Confusion()) { - QApplication::restoreOverrideCursor(); - return; - } + 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 */ + } - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(myShapeIOR); - GEOM::GEOM_Shape_var result = myGeom->MakeChamfer(aShape, myD1, myD2, myShapeType, ListOfID); - if(result->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); - QApplication::restoreOverrideCursor(); - return; + if(!tds.IsNull()) { + mySimulationTopoDs = tds; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } - - TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); - - mySimulationTopoDs = S; - myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { - MESSAGE("Exception catched in MakePreview"); QApplication::restoreOverrideCursor(); - return; + QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_CHAMFER_ABORT").arg(myD1).arg(myD2), tr("GEOM_BUT_OK")); + QApplication::setOverrideCursor(Qt::waitCursor); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + Group1->SpinBox_DX->SetValue(5.0); + Group1->SpinBox_DY->SetValue(5.0); } + QApplication::restoreOverrideCursor(); return; - } diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h index 46e114443..320bc37c9 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -72,8 +72,6 @@ private : double myD2; DlgRef_1Sel2Spin* Group1; - DlgRef_1Sel2Spin* Group2; - DlgRef_1Sel2Spin* Group3; private slots: void ClickOnOk(); @@ -81,7 +79,6 @@ private slots: void ClickOnCancel(); void ActivateThisDialog(); void DeactivateActiveDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(double newValue); diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 746c9eb08..6f81cae0f 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -30,12 +30,17 @@ using namespace std; #include "OperationGUI_FilletDlg.h" #include "DisplayGUI.h" +#include "QAD_MessageBox.h" +#include #include #include #include #include +#include +#include + //================================================================================= // class : OperationGUI_FilletDlg() // purpose : Constructs a OperationGUI_FilletDlg which is a child of 'parent', with the @@ -65,21 +70,7 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(QWidget* parent, const char* name Group1->TextLabel2->setText(tr("GEOM_RADIUS")); Group1->PushButton1->setPixmap(image3); - Group2 = new DlgRef_1Sel1Spin(this, "Group2"); - Group2->GroupBox1->setTitle(tr("GEOM_FILLET_EDGES")); - Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - Group2->TextLabel2->setText(tr("GEOM_RADIUS")); - Group2->PushButton1->setPixmap(image3); - - Group3 = new DlgRef_1Sel1Spin(this, "Group3"); - Group3->GroupBox1->setTitle(tr("GEOM_FILLET_FACES")); - Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - Group3->TextLabel2->setText(tr("GEOM_RADIUS")); - Group3->PushButton1->setPixmap(image3); - Layout1->addWidget(Group1, 1, 0); - Layout1->addWidget(Group2, 1, 0); - Layout1->addWidget(Group3, 1, 0); /***************************************************************/ /* Initialisations */ @@ -117,12 +108,7 @@ void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic) double SpecificStep = 10.0; /* min, max, step and decimals for spin boxes */ Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); - Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); - Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); - Group1->SpinBox_DX->SetValue(myRadius); - Group2->SpinBox_DX->SetValue(myRadius); - Group3->SpinBox_DX->SetValue(myRadius); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); @@ -134,26 +120,14 @@ void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic) connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double))); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* displays Dialog */ - Group2->hide(); - Group3->hide(); Group1->show(); this->show(); @@ -181,49 +155,32 @@ void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) myUseLocalContext = false; } + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) { + myConstructorId = constructorId = 0; //No subshape selection if viewer is not OCC + RadioButton1->setChecked(TRUE); + } + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + Group1->LineEdit1->setText(""); + Group1->SpinBox_DX->SetValue(myRadius); switch (constructorId) { case 0: /* Fillet All */ { - Group2->hide(); - Group3->hide(); - resize(0, 0); - Group1->show(); - - myEditCurrentArgument = Group1->LineEdit1; - Group1->LineEdit1->setText(""); + Group1->GroupBox1->setTitle(tr("GEOM_FILLET_ALL")); myShapeType = -1; - - Group1->SpinBox_DX->SetValue(myRadius); break; } case 1: /* Fillet edges */ { - Group1->hide(); - Group3->hide(); - resize(0, 0); - Group2->show(); - - myEditCurrentArgument = Group2->LineEdit1; - Group2->LineEdit1->setText(""); + Group1->GroupBox1->setTitle(tr("GEOM_FILLET_EDGES")); myShapeType = 6; - - Group2->SpinBox_DX->SetValue(myRadius); break; } case 2: /* Fillet Faces */ { - Group1->hide(); - Group2->hide(); - resize(0, 0); - Group3->show(); - - myEditCurrentArgument = Group3->LineEdit1; - Group3->LineEdit1->setText(""); + Group1->GroupBox1->setTitle(tr("GEOM_FILLET_FACES")); myShapeType = 4; - - Group3->SpinBox_DX->SetValue(myRadius); break; } } @@ -249,6 +206,7 @@ void OperationGUI_FilletDlg::ClickOnOk() //================================================================================= void OperationGUI_FilletDlg::ClickOnApply() { + buttonApply->setFocus(); QApplication::setOverrideCursor(Qt::waitCursor); QAD_Application::getDesktop()->putInfo(tr("")); myGeomBase->EraseSimulationShape(); @@ -348,7 +306,7 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() } } } - if(myConstructorId == 0) + if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0) this->MakePreview(); } else @@ -363,27 +321,6 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void OperationGUI_FilletDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if(send == Group1->LineEdit1) - myEditCurrentArgument = Group1->LineEdit1; - else if (send == Group2->LineEdit1) - myEditCurrentArgument = Group2->LineEdit1; - else if (send == Group3->LineEdit1) - myEditCurrentArgument = Group3->LineEdit1; - else - return; - - GEOMBase_Skeleton::LineEditReturnPressed(); - return; -} - - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -392,18 +329,9 @@ void OperationGUI_FilletDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == Group1->PushButton1) { + if(send == Group1->PushButton1) Group1->LineEdit1->setFocus(); - myEditCurrentArgument = Group1->LineEdit1; - } - else if(send == Group2->PushButton1) { - Group2->LineEdit1->setFocus(); - myEditCurrentArgument = Group2->LineEdit1; - } - else if(send == Group3->PushButton1) { - Group3->LineEdit1->setFocus(); - myEditCurrentArgument = Group3->LineEdit1; - } + this->SelectionIntoArgument(); return; } @@ -492,7 +420,7 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue) myRadius = newValue; - if(myConstructorId == 0) + if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0) this->MakePreview(); return; } @@ -505,46 +433,56 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue) void OperationGUI_FilletDlg::MakePreview() { QApplication::setOverrideCursor(Qt::waitCursor); + TopoDS_Shape tds; - if(!myOkShape) { - QApplication::restoreOverrideCursor(); - return; - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ListOfID->length(0); - - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(myShapeIOR); - if(theObj->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - QApplication::restoreOverrideCursor(); - return; - } - try { - if(myRadius <= Precision::Confusion()) { - QApplication::restoreOverrideCursor(); - return; - } + 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++) { + try { + fill.SetRadius(myRadius,i,i); + } + catch(Standard_Failure) { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_FILLET_ABORT").arg(myRadius), tr("GEOM_BUT_OK")); + QApplication::setOverrideCursor(Qt::waitCursor); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + Group1->SpinBox_DX->SetValue(5.0); + QApplication::restoreOverrideCursor(); + return; + } + } + tds = fill.Shape(); + break; + } + // case 1: /* Fillet edges */ + // case 2: /* Fillet Faces */ + } - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(myShapeIOR); - GEOM::GEOM_Shape_var result = myGeom->MakeFillet(aShape, myRadius, myShapeType, ListOfID); - if(result->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); - QApplication::restoreOverrideCursor(); - return; + if(!tds.IsNull()) { + mySimulationTopoDs = tds; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } - TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); - - mySimulationTopoDs = S; - myGeomBase->DisplaySimulationShape(mySimulationTopoDs); - } + } catch(Standard_Failure) { - MESSAGE("Exception catched in MakePreview"); QApplication::restoreOverrideCursor(); - return; + QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_FILLET_ABORT").arg(myRadius), tr("GEOM_BUT_OK")); + QApplication::setOverrideCursor(Qt::waitCursor); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + Group1->SpinBox_DX->SetValue(5.0); } + QApplication::restoreOverrideCursor(); return; } diff --git a/src/OperationGUI/OperationGUI_FilletDlg.h b/src/OperationGUI/OperationGUI_FilletDlg.h index 76fbab6f5..3756f82b2 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.h +++ b/src/OperationGUI/OperationGUI_FilletDlg.h @@ -71,8 +71,6 @@ private : double myRadius; DlgRef_1Sel1Spin* Group1; - DlgRef_1Sel1Spin* Group2; - DlgRef_1Sel1Spin* Group3; private slots: void ClickOnOk(); @@ -80,7 +78,6 @@ private slots: void ClickOnCancel(); void ActivateThisDialog(); void DeactivateActiveDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(double newValue); diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index fb93269dd..3fbcb8705 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -52,6 +52,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(QWidget* parent, const char GroupPoints = new DlgRef_4Sel1List_QTD(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION")); + GroupPoints->GroupBox2->setTitle(tr("SUPPRESS_RESULT")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT")); diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx index 343759a6a..e28c3f6f6 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -216,14 +216,17 @@ void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, const double Radius1, const double Radius2, const double aHeight) { try { - if((Radius1 <= Precision::Confusion() && Radius2 <= Precision::Confusion()) || aHeight <= Precision::Confusion()) + double myRadius2 = Radius2; + if(myRadius2 < Precision::Confusion()) + myRadius2 = Precision::Confusion(); + if(Radius1 <= Precision::Confusion() || aHeight <= Precision::Confusion()) return; GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z()); GEOM::PointStruct d = myGeom->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z()); GEOM::DirStruct dstruct = myGeom->MakeDirection(d); - GEOM::GEOM_Shape_var result = myGeom->MakeCone(pstruct, dstruct, Radius1, Radius2, aHeight); + GEOM::GEOM_Shape_var result = myGeom->MakeCone(pstruct, dstruct, Radius1, myRadius2, aHeight); if(result->_is_nil()) { QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 39e12f88c..24b638432 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -221,6 +221,7 @@ void PrimitiveGUI_BoxDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_BoxDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 480eca52d..f9af4748d 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "PrimitiveGUI_ConeDlg.h" #include @@ -36,6 +35,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : PrimitiveGUI_ConeDlg() // purpose : Constructs a PrimitiveGUI_ConeDlg which is a child of 'parent', with the @@ -120,11 +123,11 @@ void PrimitiveGUI_ConeDlg::Init() step = St.toDouble(); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, 999.999, step, 3); GroupPoints->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.000, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.000, 999.999, step, 3); GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); GroupPoints->SpinBox_DX->SetValue(myRadius1); @@ -247,6 +250,7 @@ void PrimitiveGUI_ConeDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_ConeDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 0826eef58..d12e8dc42 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "PrimitiveGUI_CylinderDlg.h" #include @@ -35,6 +34,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : PrimitiveGUI_CylinderDlg() // purpose : Constructs a PrimitiveGUI_CylinderDlg which is a child of 'parent', with the @@ -234,6 +237,7 @@ void PrimitiveGUI_CylinderDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_CylinderDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index a26177ca1..d13352dc2 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -205,6 +205,7 @@ void PrimitiveGUI_SphereDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_SphereDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if(mySimulationTopoDs.IsNull()) return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index e67d4ae54..90aa6db8b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "PrimitiveGUI_TorusDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : PrimitiveGUI_TorusDlg() // purpose : Constructs a PrimitiveGUI_TorusDlg which is a child of 'parent', with the @@ -102,7 +105,6 @@ void PrimitiveGUI_TorusDlg::Init() myRadius1 = 300.0; myRadius2 = 100.0; - myOkRadius1 = myOkRadius2 = true; myOkPoint1 = myOkDir = false; myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom); @@ -167,7 +169,6 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) mySelection->ClearFilters(); myGeomBase->EraseSimulationShape(); disconnect(mySelection, 0, this, 0); - myOkRadius1 = myOkRadius2 = true; myRadius1 = 300.0; myRadius2 = 100.0; @@ -230,13 +231,14 @@ void PrimitiveGUI_TorusDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_TorusDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) + if(myOkPoint1 && myOkDir) myPrimitiveGUI->MakeTorusAndDisplay(myPoint1, myDir, myRadius1, myRadius2); return ; } @@ -278,7 +280,7 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() myOkDir = true; } - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2) + if(myOkPoint1 && myOkDir) MakeTorusSimulationAndDisplay(); return; } @@ -374,15 +376,23 @@ void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue) QObject* send = (QObject*)sender(); if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) { - myRadius1 = newValue; - myOkRadius1 = true; + if(newValue > myRadius2) + myRadius1 = newValue; + else { + GroupPoints->SpinBox_DX->SetValue(myRadius1); + GroupDimensions->SpinBox_DX->SetValue(myRadius1); + } } else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) { - myRadius2 = newValue; - myOkRadius2 = true; + if(newValue < myRadius1) + myRadius2 = newValue; + else { + GroupPoints->SpinBox_DY->SetValue(myRadius2); + GroupDimensions->SpinBox_DY->SetValue(myRadius2); + } } - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2) + if(myOkPoint1 && myOkDir) MakeTorusSimulationAndDisplay(); return; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h index 2eb3b32b5..84068f432 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h @@ -72,8 +72,6 @@ private: Standard_Real myRadius1; Standard_Real myRadius2; - bool myOkRadius1; - bool myOkRadius2; DlgRef_2Sel2Spin* GroupPoints; DlgRef_2Spin* GroupDimensions; diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index 0c456bdd7..ab9be2e20 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header: -using namespace std; #include "RepairGUI.h" #include "QAD_RightFrame.h" @@ -38,6 +37,10 @@ using namespace std; #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES #include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE +#include "utilities.h" + +using namespace std; + //======================================================================= // function : RepairGUI() // purpose : Constructor @@ -311,11 +314,11 @@ bool RepairGUI::OnSuppressFaces(const TopoDS_Shape& ShapeTopo, const char* Shape Standard_CString Type; if(myGeomBase->GetShapeTypeString(S, Type)) { aShellOrFace->NameType(Type); - sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); + sprintf (nameG, "%s_%d", Type, myGeomGUI->myNbGeom++); } else { aShellOrFace->NameType(tr("GEOM_SHAPE")); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++); } /* Display with name */ diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.cxx b/src/RepairGUI/RepairGUI_OrientationDlg.cxx index 7b877f19e..fd88ba8ab 100644 --- a/src/RepairGUI/RepairGUI_OrientationDlg.cxx +++ b/src/RepairGUI/RepairGUI_OrientationDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "RepairGUI_OrientationDlg.h" #include @@ -36,6 +35,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : RepairGUI_OrientationDlg() // purpose : Constructs a RepairGUI_OrientationDlg which is a child of 'parent', with the @@ -140,6 +143,7 @@ void RepairGUI_OrientationDlg::ClickOnOk() //================================================================================= void RepairGUI_OrientationDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx index 2cc0e2066..d36dedea0 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -134,6 +134,7 @@ void RepairGUI_SewingDlg::ClickOnOk() //================================================================================= void RepairGUI_SewingDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if(myOkListShapes) myRepairGUI->MakeSewingAndDisplay(myListShapes, myPrecision); diff --git a/src/SKETCHER/GEOM_Sketcher.cxx b/src/SKETCHER/GEOM_Sketcher.cxx deleted file mode 100644 index 7734c2b8f..000000000 --- a/src/SKETCHER/GEOM_Sketcher.cxx +++ /dev/null @@ -1,1389 +0,0 @@ -// GEOM SKETCHER : basic sketcher -// -// 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_Sketcher.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_Sketcher.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 -#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 - -/*! - \class GEOM_Sketcher GEOM_Sketcher.h - \brief ... -*/ - -Standard_Real resol = 1.0; - -/*! - Constructor. -*/ -Sketch::Sketch() -{ - -} - -/*! - Destructor. -*/ -Sketch::~Sketch() -{ - -} - - -/*! - Constructor. - - \param V3d_Viewer -*/ -Sketch::Sketch(const Handle(V3d_Viewer)& aViewer) : -myInteractiveContext(new AIS_InteractiveContext(aViewer)), -myAxisColor(Quantity_Color(Quantity_NOC_YELLOW)), -myCurrentColor(Quantity_Color(Quantity_NOC_GREEN)), -myWireColor(Quantity_Color(Quantity_NOC_RED)) -{ - Init(); -} - -/*! - Constructor. - - \param V3d_Viewer - \param Quantity_Color - \param Quantity_Color - \param Quantity_Color -*/ -Sketch::Sketch(const Handle(V3d_Viewer)& aViewer, - const Quantity_Color& anAxisColor, - const Quantity_Color& aCurrentColor, - const Quantity_Color& aWireColor): -myInteractiveContext(new AIS_InteractiveContext(aViewer)), -myAxisColor(anAxisColor), -myCurrentColor(aCurrentColor), -myWireColor(aWireColor) -{ - Init(); -} - -/*! - Build the current edge in a graphic mode. - The first signature with view coordinates is used to connect to the move event from the user interface. - The second signature is used when the current point is known by 2d real coordinates. - - \param Xp - \param Yp - \param V3d_View -*/ -void Sketch::MakeCurrentEdge(const Standard_Integer Xp , - const Standard_Integer Yp , - const Handle(V3d_View)& aView ) -{ - /* 3d coordinates of the picked point */ - Standard_Real Xv,Yv,Zv; - aView->Convert(Xp,Yp,Xv,Yv,Zv); - /* computation of real 2d coordinates in plane of sketch */ - Standard_Real Vx,Vy,Vz; - aView->Proj(Vx,Vy,Vz); - gp_Dir D(Vx,Vy,Vz); - gp_Pnt P(Xv,Yv,Zv); - gp_Lin L(P,D); - Standard_Real X,Y; - gp_Pnt Sol; - IntAna_IntConicQuad Int(L,myPlane->Pln(),Precision::Angular()); - if (Int.IsDone()) { - if (!Int.IsParallel()) { - if (Int.NbPoints() > 0 ) { - Sol = Int.Point(1); - ElSLib::Parameters(myPlane->Pln(),Sol,X,Y); - } - } - } - MakeCurrentEdge(X,Y); -} - -/*! - Build the current edge in a graphic mode. - The first signature with view coordinates is used to connect to the move event from the user interface. - The second signature is used when the current point is known by 2d real coordinates. - - \param X - \param Y -*/ -void Sketch::MakeCurrentEdge(const Standard_Real X, const Standard_Real Y) -{ - /* Create the current edge depending on the active mode */ - switch (myCurrentStatus) { - case BEGIN_SKETCH: - myCurrentEdge = BRepBuilderAPI_MakeVertex(ElCLib::To3d(myPlane->Pln().Position().Ax2(),gp_Pnt2d(X,Y))); - break; - case SEGMENT: - MakeCurrentSegment(X,Y); - break; - case ARC_CHORD: - MakeCurrentSegment(X,Y); - break; - case ARC_CHORD_END: - MakeCurrentArc(X,Y); - break; - } - DisplayCurrentEdge(); -} - -/*! - Build the current edge in a graphic mode. - Function to connect to the input event from the user interface. -*/ -void Sketch::ValidateEdge() -{ - gp_Pnt pt; - gp_Pnt2d pt2d; - switch (myCurrentStatus) { - case BEGIN_SKETCH: - { - myFirstPointSketch = TopoDS::Vertex(myCurrentEdge); - myPresentableWire = new AIS_Shape(myFirstPointSketch); - myPresentableWire->SetColor(myWireColor.Name()); - myInteractiveContext->Display(myPresentableWire); - pt = BRep_Tool::Pnt(myFirstPointSketch); - pt2d = ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); - myCurrentStatus = SEGMENT; - break; - } - case SEGMENT: - { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,first,last); - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(Handle(Geom2d_Line)::DownCast(C)->Lin2d(),0.,myLengthDimension->Value()); - if (myTransitionStatus == ANGLE || - myTransitionStatus == LENGTH_FIXED || - myTransitionStatus == X_FIXED || - myTransitionStatus == Y_FIXED) - myTransitionStatus = NOCONSTRAINT; - AddEdgeToWire(); - break; - } - case ARC_CHORD: - { - myInteractiveContext->CloseLocalContext(); - myInteractiveContext->OpenLocalContext(); - gp_Pnt2d p1 (myLastX,myLastY); - pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myCurrentEdge))); - gp_Pnt2d p2 = ProjLib::Project(myPlane->Pln(),pt); - GccAna_Pnt2dBisec ComputeMediatrice(p1,p2); - if (ComputeMediatrice.HasSolution()) { - myMediatrice = new Geom2d_Line(ComputeMediatrice.ThisSolution()); - Handle(Geom_Curve) aMediatrice3d = GeomAPI::To3d(myMediatrice,myPlane->Pln()); - myPresentableMediatrice = new AIS_Axis(Handle(Geom_Line)::DownCast(aMediatrice3d)); - myInteractiveContext->Display(myPresentableMediatrice); - } - TopoDS_Edge e = BRepBuilderAPI_MakeEdge2d(gce_MakeCirc2d(gp_Pnt2d(0.,0),1.)); - BRepLib::BuildCurve3d(e); - myLengthDimension->SetText(TCollection_ExtendedString()); - myInteractiveContext->Redisplay(myLengthDimension,Standard_False); - if (myEdgesNumber == 0) - myPreviousEdge = TopoDS::Edge(myCurrentEdge); - pt2d = ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); - myTransitionStatus = NOCONSTRAINT; - myCurrentStatus = ARC_CHORD_END; - break; - } - case ARC_CHORD_END: - myCurrentStatus = ARC_CHORD; - AddEdgeToWire(); - break; - } -} - -/*! - Add edge to current wire on an edge validation . -*/ -void Sketch::AddEdgeToWire() -{ - myPreviousEdge = TopoDS::Edge(myCurrentEdge); - BRepLib::BuildCurve3d(myPreviousEdge); - myCurrentWire.Add(TopoDS::Edge(myPreviousEdge)); - myEdgesNumber++; - myPresentableWire->Set( myCurrentWire.Wire() ); - myInteractiveContext->Redisplay(myPresentableWire); - myConstructionMode.Append(myCurrentStatus); - myConstraintMode.Append(myTransitionStatus); - myInteractiveContext->CloseLocalContext(); - gp_Pnt pt; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD ) - pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myPreviousEdge))); - else - pt = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(myPreviousEdge))); - gp_Pnt2d pt2d= ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); -} - -/*! - Set the numeric dimension for the current edge and validate creation. - - \param aValue - \return Standard_Boolean -*/ -Standard_Boolean Sketch::SetDimension(Standard_Real& aValue) -{ - fitInResol(aValue); - if (myCurrentStatus == SEGMENT || - myCurrentStatus == ARC_CHORD){ - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = - BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,first,last); - myCurrentEdge = - BRepBuilderAPI_MakeEdge2d(Handle(Geom2d_Line)::DownCast(C)->Lin2d(),0.,aValue); - DisplayCurrentEdge(); - if (myTransitionStatus == NOCONSTRAINT) { - mySegmentLength = aValue; - myTransitionStatus = LENGTH_FIXED; - } - else - ValidateEdge(); - return Standard_True; - } - - else if( myCurrentStatus == ARC_CHORD_END){ - if (myTransitionStatus == TANGENT) return Standard_False; - gp_Pnt2d p; - if (myEdgesNumber > 0) { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge))); - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge))); - } - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(myFirstPointSketch)); - GccAna_Circ2d2TanRad aSol(p, gp_Pnt2d(myLastX,myLastY),aValue,Precision::Confusion()); - Standard_Real dist = RealLast(); - if (aSol.NbSolutions() > 0) { - gp_Circ2d CirSol; - gp_Pnt2d pc = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopoDS::Vertex(myCenterCircle->Shape()))); - for (Standard_Integer i =1; i<= aSol.NbSolutions(); i++) { - if (pc.Distance(aSol.ThisSolution(i).Location()) < dist) - CirSol = aSol.ThisSolution(i); - } - if (myCurrentEdge.Orientation() == TopAbs_FORWARD) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),p,gp_Pnt2d(myLastX,myLastY)); - else { - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),gp_Pnt2d(myLastX,myLastY),p); - myCurrentEdge.Reverse(); - } - DisplayCurrentEdge(); - ValidateEdge(); - return Standard_True; - } - } - - return Standard_False; -} - -/*! - Set the numeric dimension for the current edge and validate creation. - - \param deltaX - \param deltaY -*/ -void Sketch::SetDimension(Standard_Real& deltaX, Standard_Real& deltaY) -{ - fitInResol(deltaX); - fitInResol(deltaY); - Standard_Real X = myLastX + deltaX; - Standard_Real Y = myLastY + deltaY; - MakeCurrentEdge(X,Y); - ValidateEdge(); -} - -/*! - Set the numeric value of the X coordinate of current point giving a deltaX relative to previous point. - - \param deltaX -*/ -void Sketch::SetXDimension(Standard_Real& deltaX) -{ - fitInResol(deltaX); - Standard_Real X = myLastX + deltaX; - Standard_Real Y = myLastY; - if ( deltaX == 0. ) - Y = Y + 100.0 * Precision::Confusion(); - - if (myTransitionStatus == NOCONSTRAINT) { - MakeCurrentEdge(X,Y); - myTransitionStatus = X_FIXED; - mySegmentX = X; - } - else if (myTransitionStatus == Y_FIXED) { - myTransitionStatus = NOCONSTRAINT; - MakeCurrentEdge(X,mySegmentY); - ValidateEdge(); - } - else if (myTransitionStatus == ANGLE) { - myTransitionStatus = NOCONSTRAINT; - Standard_Real angle; - if (0 <= mySegmentAngle && mySegmentAngle<= PI ) - angle = PI - mySegmentAngle; - else - angle = mySegmentAngle - PI; - Y = X*Tan(angle); - MakeCurrentEdge(X,Y); - ValidateEdge(); - } - else - myTransitionStatus = NOCONSTRAINT; -} - -/*! - Set the numeric value of the Y coordinate of current point giving a deltaY relative to previous point. - - \param deltaY -*/ -void Sketch::SetYDimension(Standard_Real& deltaY) -{ - fitInResol(deltaY); - Standard_Real X = myLastX; - Standard_Real Y = myLastY + deltaY; - - if ( deltaY == 0. ) - X = X + 100.0 * Precision::Confusion(); - - if (myTransitionStatus == NOCONSTRAINT) { - MakeCurrentEdge(X,Y); - myTransitionStatus = Y_FIXED; - mySegmentY = Y; - } - else if (myTransitionStatus == X_FIXED) { - myTransitionStatus = NOCONSTRAINT; - MakeCurrentEdge(mySegmentX,Y); - ValidateEdge(); - } - else if (myTransitionStatus == ANGLE) { - myTransitionStatus = NOCONSTRAINT; - Standard_Real angle; - if (0 <= mySegmentAngle && mySegmentAngle<= PI ) - angle = PI - mySegmentAngle; - else - angle = mySegmentAngle - PI; - X = Y/Tan(angle); - MakeCurrentEdge(X,Y); - ValidateEdge(); - } - else - myTransitionStatus = NOCONSTRAINT; -} - -/*! - Set the numeric value of angle between 2 segments. - - \param aValue -*/ -void Sketch::SetSegmentAngle(Standard_Real& aValue) -{ - if (myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Standard_Real angle; - if (0 <= aValue && aValue<= PI ) - angle = PI - aValue; - else - angle = aValue - PI; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last); - - GccAna_Lin2dTanObl aSol(gp_Pnt2d(myLastX,myLastY),Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d(),angle); - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),0.,myLengthDimension->Value()); - } - if (myTransitionStatus == LENGTH_FIXED) { - ValidateEdge(); - } - else if (myTransitionStatus == X_FIXED) { - Standard_Real length = mySegmentX/Cos(angle); - SetDimension(length); - ValidateEdge(); - } - else if (myTransitionStatus == Y_FIXED) { - Standard_Real length = mySegmentY/Sin(angle); - SetDimension(length); - ValidateEdge(); - } - else { - mySegmentAngle = aValue; - myTransitionStatus = ANGLE; - } - } -} - -/*! - Get the angle value between 2 segments. - - \return Standard_Real -*/ -Standard_Real Sketch::GetSegmentAngle() -{ - return mySegmentAngle; -} - -/*! - Close automatically an open sketch. - - \return TopoDS_Wire. Return null shape if not possible. -*/ -TopoDS_Wire Sketch::Close() -{ - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - if (myEdgesNumber >= 2) { - BRepTools_WireExplorer Ex(myCurrentWire.Wire()); - TopoDS_Vertex V1; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - V1 = TopExp::LastVertex(myPreviousEdge); - else - V1 = TopExp::FirstVertex(myPreviousEdge); - myCurrentWire.Add(BRepBuilderAPI_MakeEdge(V1,myFirstPointSketch).Edge()); - myEdgesNumber++; - return myCurrentWire.Wire(); - } - else - return TopoDS_Wire(); -} - - - -/*! - Clear sketch presentation. -*/ -void Sketch::Clear() -{ - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); -} - -/*! - Terminate sketch without closing. - - \return TopoDS_Wire. Return null shape if not possible. -*/ -TopoDS_Wire Sketch::End() -{ - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - if (myCurrentWire.IsDone()) { - return myCurrentWire.Wire(); - } - else - return TopoDS_Wire(); -} - - -/*! - Delete current edge. -*/ -Standard_Boolean Sketch::Delete() -{ - myInteractiveContext->Erase(myAngleDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myLengthDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myRadiusDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myCenterCircle,Standard_True,Standard_False); - myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False); - - if (myCurrentStatus == BEGIN_SKETCH) { - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - return true; - } - else if(myCurrentStatus == SEGMENT || - myCurrentStatus == ARC_CHORD ) { - RemoveLastEdge(); - } - else if(myCurrentStatus == ARC_CHORD_END) { - myCurrentStatus = ARC_CHORD; - myInteractiveContext->CloseAllContexts(); - } - gp_Pnt pt; - if (myEdgesNumber == 0) { - //myInteractiveContext->EraseAll(Standard_False); - ChangeMode(BEGIN_SKETCH); // DCQ - pt = BRep_Tool::Pnt(myFirstPointSketch); - } - else { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD ) - pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myPreviousEdge))); - else - pt = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(myPreviousEdge))); - } - gp_Pnt2d pt2d= ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); - - return false; -} - -/*! - Set a specific plane for sketch. - - \param GeomyPlane -*/ -void Sketch::SetPlane(const Handle(Geom_Plane)& aPlane) -{ - myPlane = aPlane; -} - -/*! - Set display parameters. - - \param aColor -*/ -void Sketch::SetWireColor(const Quantity_Color& aColor) -{ - myWireColor = aColor; -} - -/*! - Set display parameters. - - \param aColor -*/ -void Sketch::SetCurrentColor(const Quantity_Color& aColor) -{ - myCurrentColor = aColor; -} - -/*! - Set display parameters. - - \param aColor -*/ -void Sketch::SetAxisColor(const Quantity_Color& aColor) -{ - myAxisColor = aColor; -} - - -/*! - Change mode of construction line. - - \param aMode : SEGMENT, ARC_CHORD. -*/ -void Sketch::ChangeMode(const SketchStatus aMode) -{ - gp_Pnt2d p; - if (myEdgesNumber > 0) { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge))); - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge))); - myLastX = p.X(); - myLastY = p.Y(); - myInteractiveContext->CloseLocalContext(myInteractiveContext->IndexOfCurrentLocal()); - } - if (!myCurrentStatus == BEGIN_SKETCH) - myCurrentStatus = aMode; /* change the mode only when the sketch is not in state BEGIN_SKETCH, i.d. fist point has been fixed */ - -} - -/*! - Set transition constraint between consecutive edges. - - \param aStatus : NOCONSTRAINT, TANGENT, PERPENDICULAR, ANGLE, LENGTH_FIXED, X_FIXED, Y_FIXED. -*/ -void Sketch::SetTransitionStatus(const TransitionStatus aStatus) -{ - myTransitionStatus = aStatus; -} - -/*! - Set or unset the display of dimensions. - - \param atype - \param OnOff -*/ -void Sketch::SetParameterVisibility(const TypeOfParameter atype, const Standard_Boolean OnOff) -{ - switch (atype) { - case ANGLE_PARAMETER: - myIsAngleDimensionVisible = OnOff; - if (!myIsAngleDimensionVisible && !myAngleDimension.IsNull()) - myInteractiveContext->Erase(myAngleDimension,Standard_True,Standard_False); - //else DCQ - // DisplayCurrentEdge(); - break; - case LENGTH_PARAMETER: - myIsLengthDimensionVisible = OnOff; - if (!myIsLengthDimensionVisible&& !myLengthDimension.IsNull()) - myInteractiveContext->Erase(myLengthDimension,Standard_True,Standard_False); - //else DCQ - // DisplayCurrentEdge(); - break; - case RADIUS_PARAMETER: - myIsRadiusDimensionVisible = OnOff; - if (!myIsRadiusDimensionVisible&& !myRadiusDimension.IsNull()){ - myInteractiveContext->Erase(myRadiusDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myCenterCircle,Standard_True,Standard_False); - } - //else DCQ - // DisplayCurrentEdge(); - break; - case XVALUE_PARAMETER: - myIsXDimensionVisible = OnOff; - if (!myIsXDimensionVisible&& !myXDimension.IsNull()) - myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False); - break; - case YVALUE_PARAMETER: - myIsYDimensionVisible = OnOff; - if (!myIsYDimensionVisible&& !myYDimension.IsNull()) - myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False); - break; - } -} - -/*! - Hilight parameters. - - \param atype - \param acolor -*/ -void Sketch::HiligthWithColor(const TypeOfParameter atype, const Quantity_NameOfColor acolor) -{ - switch (atype) { - case ANGLE_PARAMETER: - myInteractiveContext->HilightWithColor(myAngleDimension, acolor); - break; - case LENGTH_PARAMETER: - myInteractiveContext->HilightWithColor(myLengthDimension, acolor); - break; - case RADIUS_PARAMETER: - myInteractiveContext->HilightWithColor(myRadiusDimension, acolor); - break; - case XVALUE_PARAMETER: - myInteractiveContext->HilightWithColor(myXDimension, acolor); - break; - case YVALUE_PARAMETER: - myInteractiveContext->HilightWithColor(myYDimension, acolor); - break; - } -} - - -/*! - Unhilight parameters. - - \param atype -*/ -void Sketch::Unhiligth(const TypeOfParameter atype) -{ - switch (atype) { - case ANGLE_PARAMETER: - myInteractiveContext->Unhilight(myAngleDimension); - break; - case LENGTH_PARAMETER: - myInteractiveContext->Unhilight(myLengthDimension); - break; - case RADIUS_PARAMETER: - myInteractiveContext->Unhilight(myRadiusDimension); - break; - case XVALUE_PARAMETER: - myInteractiveContext->Unhilight(myXDimension); - break; - case YVALUE_PARAMETER: - myInteractiveContext->Unhilight(myYDimension); - break; - } -} - -/*! - Check if the edition of a type of parameter is relevant depending on sketch current status. - - \param atype - \return Standard_Boolean -*/ -Standard_Boolean Sketch::IsValidCurrentParameter(const TypeOfParameter atype) -{ - switch (atype) { - case ANGLE_PARAMETER: - if (myCurrentStatus != SEGMENT && myCurrentStatus != ARC_CHORD) - return Standard_False; - else if (myTransitionStatus == TANGENT || myTransitionStatus == PERPENDICULAR) - return Standard_False; - else if (myEdgesNumber < 1) - return Standard_False; - else { - TopLoc_Location L; - Standard_Real First,Last; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (!PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) - return Standard_False; - } - break; - case LENGTH_PARAMETER: - if (myCurrentStatus != SEGMENT && - myCurrentStatus != ARC_CHORD /*&& - myCurrentStatus != CURVE_POINTS*/ - ) - return Standard_False; - else if (myTransitionStatus == LENGTH_FIXED) - return Standard_False; - break; - case RADIUS_PARAMETER: - if (myCurrentStatus != ARC_CHORD_END) - return Standard_False; - break; - case XVALUE_PARAMETER: - if (myCurrentStatus != SEGMENT && - myCurrentStatus != ARC_CHORD /*&& - myCurrentStatus != CURVE_POINTS*/ - ) - return Standard_False; - else if (myTransitionStatus == X_FIXED) - return Standard_False; - break; - case YVALUE_PARAMETER: - if (myCurrentStatus != SEGMENT && - myCurrentStatus != ARC_CHORD /*&& - myCurrentStatus != CURVE_POINTS*/ - ) - return Standard_False; - else if (myTransitionStatus == Y_FIXED) - return Standard_False; - break; - } - return Standard_True; -} - -/*! - Set a parameter value. - - \param atype - \param aValue -*/ -void Sketch::SetParameterValue(const TypeOfParameter atype, Standard_Real aValue) -{ - switch (atype) { - case ANGLE_PARAMETER: - SetSegmentAngle(aValue); - break; - case LENGTH_PARAMETER: - SetDimension(aValue); - break; - case RADIUS_PARAMETER: - SetDimension(aValue); - break; - case XVALUE_PARAMETER: - SetXDimension(aValue); - break; - case YVALUE_PARAMETER: - SetYDimension(aValue); - break; - } -} - -/*! - Initialisation of sketch parameters or options. -*/ -void Sketch::Init() -{ - myPlane = new Geom_Plane (0.,0.,1.,0.); - CreateConstraints(); - BRepLib::Plane(myPlane); - myEdgesNumber = 0; - myCurrentStatus = BEGIN_SKETCH; - /* In order to update the visulisation of current objects by using Redisplay method from InteractiveContext */ - myCurrentEdge = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.)); - myPresentableEdge = new AIS_Shape(myCurrentEdge); - myPresentableEdge->SetColor(myCurrentColor.Name()); - myInteractiveContext->Display(myPresentableEdge); - myTransitionStatus = NOCONSTRAINT; - /* Init for display objects */ - TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.)); - TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(10.,0.,0.)); - myLengthDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString()); - myXDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString(),gp_Pnt(),DsgPrs_AS_NONE, - AIS_TOD_Horizontal); - myYDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString(),gp_Pnt(),DsgPrs_AS_NONE, - AIS_TOD_Vertical); - myRadiusDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString()); - myCenterCircle = new AIS_Shape(V1); - myIsLengthDimensionVisible = Standard_False; - myIsXDimensionVisible = Standard_False; - myIsYDimensionVisible = Standard_False; - myIsRadiusDimensionVisible = Standard_False; -} - -/*! - Build the current segment. - - \param X - \param Y -*/ -void Sketch::MakeCurrentSegment(Standard_Real X, Standard_Real Y) -{ - if (myTransitionStatus == NOCONSTRAINT) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y)); - else if (myTransitionStatus == X_FIXED) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),gp_Pnt2d(mySegmentX,Y)); - else if (myTransitionStatus == Y_FIXED) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),gp_Pnt2d(X,mySegmentY)); - else if (myTransitionStatus == TANGENT && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - gp_Pnt2d p1; - gp_Vec2d Vt; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - C->D1(last,p1,Vt); - else - C->D1(first,p1,Vt); - gp_Lin2d aline(p1,Vt); - Geom2dAPI_ProjectPointOnCurve proj(gp_Pnt2d(X,Y),new Geom2d_Line(aline)); - if (proj.NbPoints() > 0) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(p1,proj.Point(1)); - } - else if (myTransitionStatus == PERPENDICULAR && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - gp_Pnt2d p1; - gp_Lin2d perpen; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - C->D0(last,p1); - else - C->D0(first,p1); - if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Line)::DownCast(C)->Lin2d()); - perpen = aSol.ThisSolution(1); - } - else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Circle)::DownCast(C)->Circ2d()); - perpen = aSol.ThisSolution(1); - } - Geom2dAPI_ProjectPointOnCurve proj(gp_Pnt2d(X,Y),new Geom2d_Line(perpen)); - if (proj.NbPoints() > 0) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(p1,proj.Point(1)); - } - else if (myTransitionStatus == ANGLE && myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last); - Standard_Real angle; - if (0 <= mySegmentAngle && mySegmentAngle<= PI ) - angle = PI - mySegmentAngle; - else - angle = mySegmentAngle - PI; - GccAna_Lin2dTanObl aSol(gp_Pnt2d(myLastX,myLastY),Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d(),angle); - Standard_Real dist = RealLast(); - gp_Pnt2d pt(X,Y),ptproj; - for (Standard_Integer i =1; i<=aSol.NbSolutions(); i++) { - Geom2dAPI_ProjectPointOnCurve proj(pt,new Geom2d_Line(aSol.ThisSolution(i))); - if (pt.Distance(proj.Point(1)) < dist) { - dist = pt.Distance(proj.Point(1)); - ptproj = proj.Point(1); - } - } - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),ptproj); - } - } - else if (myTransitionStatus == LENGTH_FIXED && myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last); - gp_Lin2d aline = gce_MakeLin2d(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y)); - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aline,0.,mySegmentLength); - } - } -} - -/*! - Build the current arc. - - \param X - \param Y -*/ -void Sketch::MakeCurrentArc(Standard_Real X, Standard_Real Y) -{ - gp_Circ2d CircSol; - Standard_Boolean OK(Standard_False); - - if (myTransitionStatus == NOCONSTRAINT) { - GccAna_Circ2d2TanOn aSol(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - /* Tangency with previous edge */ - else if (myTransitionStatus == TANGENT && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - if (C->IsKind(STANDARD_TYPE(Geom2d_Line))){ - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(Handle(Geom2d_Line)::DownCast(C)->Lin2d()), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(Handle(Geom2d_Circle)::DownCast(C)->Circ2d()), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - else if(C->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve))) { - gp_Pnt2d pc; - gp_Vec2d Vt; - C->D1(last,pc,Vt); - gp_Lin2d alin2d(pc,gp_Dir2d(Vt)); - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(alin2d), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - } - /* Tangency with the perpendicular to the previous edge */ - else if (myTransitionStatus == PERPENDICULAR && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - gp_Pnt2d p1; - gp_Lin2d perpen; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - C->D0(last,p1); - else - C->D0(first,p1); - if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Line)::DownCast(C)->Lin2d()); - perpen = aSol.ThisSolution(1); - } - else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Circle)::DownCast(C)->Circ2d()); - perpen = aSol.ThisSolution(1); - } - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(perpen), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - - gp_Pnt2d p; - if (myEdgesNumber > 0) { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge))); - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge))); - } - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(myFirstPointSketch)); - if (OK){ - gp_Vec2d V1(p,gp_Pnt2d(X,Y)); - gp_Vec2d V2(p,gp_Pnt2d(myLastX,myLastY)); - if (V1.Angle(V2) > 0 ) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(CircSol,p,gp_Pnt2d(myLastX,myLastY)); - else { - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(CircSol,gp_Pnt2d(myLastX,myLastY),p); - myCurrentEdge.Reverse(); - } - } - else { - myCurrentStatus = ARC_CHORD; - myLastX = p.X(); - myLastY = p.Y(); - myInteractiveContext->CloseLocalContext(); - } - -} - -/*! - Display the current edge under construction with it's dimension. -*/ -void Sketch::DisplayCurrentEdge() -{ - myPresentableEdge->Set(myCurrentEdge); - myInteractiveContext->Redisplay(myPresentableEdge); - if (myCurrentStatus == SEGMENT || - myCurrentStatus == ARC_CHORD ) { - /* Length dimension */ - TopoDS_Vertex V1 = TopExp::FirstVertex(TopoDS::Edge(myCurrentEdge)); - TopoDS_Vertex V2 = TopExp::LastVertex(TopoDS::Edge(myCurrentEdge)); - DisplayLengthDimension(V1,V2); - /* Angular dimension */ - DisplayAngleDimension(); - DisplayXDimension(V1,V2); - DisplayYDimension(V1,V2); - } - else if (myCurrentStatus == ARC_CHORD_END ) - DisplayRadiusDimension(); - else { - TopoDS_Vertex V1 = TopoDS::Vertex(myCurrentEdge); - TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.)); - DisplayXDimension(V1,V2); - DisplayYDimension(V1,V2); - } - -} - -/*! - Display the current length dimension. - - \param V1 - \param V2 -*/ -void Sketch::DisplayLengthDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2) -{ - gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1)); - gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2)); - Standard_Real length = p1.Distance(p2); - if (length <= Precision::Confusion()) return; - myLengthDimension->SetFirstShape(V1); - myLengthDimension->SetSecondShape(V2); - fitInResol(length); - myLengthDimension->SetValue(length); - QString S; - S.sprintf("%.1f",length); - myLengthDimension->SetText(TCollection_ExtendedString(strdup(S))); - if (myIsLengthDimensionVisible) { - if (myInteractiveContext->IsDisplayed(myLengthDimension)) - myInteractiveContext->Redisplay(myLengthDimension); - else - myInteractiveContext->Display(myLengthDimension); - } -} - -/*! - Display the current X dimension. - - \param V1 - \param V2 -*/ -void Sketch::DisplayXDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2) -{ - if (myTransitionStatus != X_FIXED) { - gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1)); - gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2)); - - gp_Lin aline(p1,myPlane->Pln().XAxis().Direction()); - GeomAPI_ProjectPointOnCurve proj(p2,new Geom_Line(aline)); - - gp_Pnt pb = p1; - - if (proj.NbPoints() > 0) { - Standard_Real length = p1.Distance(proj.Point(1)); - if (length <= Precision::Confusion()) return; - myXDimension->SetFirstShape(V1); - myXDimension->SetSecondShape(V2); - fitInResol(length); - myXDimension->SetValue(length); - QString S; - S.sprintf("%.1f",length); - myXDimension->SetText(TCollection_ExtendedString(strdup(S))); - // myXDimension->SetPosition(proj.Point(1)); - pb.BaryCenter(5,proj.Point(1),5); - myXDimension->SetPosition(pb); - if (myIsXDimensionVisible) { - if (myInteractiveContext->IsDisplayed(myXDimension)) - myInteractiveContext->Redisplay(myXDimension); - else - myInteractiveContext->Display(myXDimension); - } - } - } else - myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False); -} - -/*! - Display the current Y dimension. - - \param V1 - \param V2 -*/ -void Sketch::DisplayYDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2) -{ - if (myTransitionStatus != Y_FIXED) { - - gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1)); - gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2)); - gp_Lin aline(p2 /*p1*/, myPlane->Pln().YAxis().Direction()); - gp_Pnt pb = p2 /*p1*/; - GeomAPI_ProjectPointOnCurve proj(p1 /*p2*/,new Geom_Line(aline)); - if (proj.NbPoints() > 0) { - Standard_Real length = /*p1*/ p2.Distance(proj.Point(1)); - if (length <= Precision::Confusion()) return; - myYDimension->SetFirstShape(V1); - myYDimension->SetSecondShape(V2); - fitInResol(length); - myYDimension->SetValue(length); - QString S; - S.sprintf("%.1f",length); - myYDimension->SetText(TCollection_ExtendedString(strdup(S))); - pb.BaryCenter(5,proj.Point(1),5); - myYDimension->SetPosition(pb); - // myYDimension->SetPosition(p2); - if (myIsYDimensionVisible) { - if (myInteractiveContext->IsDisplayed(myYDimension)) - myInteractiveContext->Redisplay(myYDimension); - else - myInteractiveContext->Display(myYDimension); - } - } - } else - myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False); -} - -/*! - Display the current angle dimension. -*/ -void Sketch::DisplayAngleDimension() -{ - if (!myIsAngleDimensionVisible) - return; - if (myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - Handle (Geom2d_Curve) CurrentCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line)) && CurrentCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Standard_Real angle = Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d().Angle(Handle(Geom2d_Line)::DownCast(CurrentCurve)->Lin2d()); - gp_Pnt2d apos; - if (0 <= angle && angle<= PI) - angle = PI - angle; - else - angle = PI + angle; - CurrentCurve->D0((First+Last)/5.,apos); - gp_Pnt apos3d = ElCLib::To3d(myPlane->Pln().Position().Ax2(),apos); - Standard_Real angtext = angle*180./PI; - mySegmentAngle = angle; - BRepLib::BuildCurve3d(TopoDS::Edge(myCurrentEdge)); - fitInResol(angtext); - - QString S; - S.sprintf("%.1f",angtext); - if (myInteractiveContext->IndexOfCurrentLocal() == 0) { - myInteractiveContext->OpenLocalContext(); - myAngleDimension = new AIS_AngleDimension(myPreviousEdge,TopoDS::Edge(myCurrentEdge),myPlane,angle, - TCollection_ExtendedString(strdup(S))); - myInteractiveContext->Display(myAngleDimension); - } - else { - myAngleDimension->SetSecondShape(myCurrentEdge); - myAngleDimension->SetValue(angle); - myAngleDimension->SetPosition(apos3d); - myAngleDimension->SetText(TCollection_ExtendedString(strdup(S))); - myInteractiveContext->Redisplay(myAngleDimension); - } - } - } -} - -/*! - Display the current radius dimension. -*/ -void Sketch::DisplayRadiusDimension() -{ - if (! myIsRadiusDimensionVisible) - return; - BRepLib::BuildCurve3d(TopoDS::Edge(myCurrentEdge)); - Standard_Real First,Last; - Handle (Geom_Circle) C = Handle (Geom_Circle)::DownCast(BRep_Tool::Curve(TopoDS::Edge(myCurrentEdge),First,Last)); - if (!C.IsNull()) { - Standard_Real R = C->Radius(); - TopoDS_Shape V1 = BRepBuilderAPI_MakeVertex(C->Location()); - gp_Pnt MidlePoint ; - C->D0((First+Last)/2.,MidlePoint); - TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(MidlePoint); - myRadiusDimension->SetFirstShape(V1); - myRadiusDimension->SetSecondShape(V2); - myRadiusDimension->SetValue(R); - fitInResol(R); - QString S; - S.sprintf("%.1f",R); - myRadiusDimension->SetText(TCollection_ExtendedString(strdup(S))); - if (myInteractiveContext->IsDisplayed(myRadiusDimension)) - myInteractiveContext->Redisplay(myRadiusDimension); - else - myInteractiveContext->Display(myRadiusDimension); - myCenterCircle->Set(V1); - if (myInteractiveContext->IsDisplayed(myCenterCircle)) - myInteractiveContext->Redisplay(myCenterCircle); - else - myInteractiveContext->Display(myCenterCircle); - } -} - -/*! - Remove last edge from the current wire. -*/ -void Sketch::RemoveLastEdge() -{ - if (myEdgesNumber == 0) { - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - return; - } - else { - BRepTools_WireExplorer Ex; - BRepBuilderAPI_MakeWire MW; - Standard_Integer index = 1; - myCurrentEdge = myPreviousEdge; - for (Ex.Init(myCurrentWire.Wire());Ex.More();Ex.Next()){ - if (index <= myEdgesNumber-1) { - MW.Add(Ex.Current()); - myPreviousEdge = Ex.Current(); - index++; - } - } - myCurrentWire = MW; - myCurrentStatus = (SketchStatus)myConstructionMode(myEdgesNumber); - myTransitionStatus = (TransitionStatus)myConstraintMode(myEdgesNumber); - myEdgesNumber--; - myConstructionMode.Remove(index); - myConstraintMode.Remove(index); - if (myEdgesNumber == 0) - myPresentableWire->Set(myFirstPointSketch); - else - myPresentableWire->Set(myCurrentWire.Wire()); - myInteractiveContext->Redisplay(myPresentableWire); - myInteractiveContext->CloseLocalContext(); - myPresentableEdge->Set(myCurrentEdge); - myInteractiveContext->Redisplay(myPresentableEdge); - } -} - -/*! - Create initial constraints. -*/ -void Sketch::CreateConstraints() -{ - Handle(Geom_Axis1Placement) xAxis = new Geom_Axis1Placement(myPlane->Pln().XAxis()); - Handle(Geom_Axis1Placement) yAxis = new Geom_Axis1Placement(myPlane->Pln().YAxis()); - myHAxis = new AIS_Axis(xAxis); - myVAxis = new AIS_Axis(yAxis); - myAngularAxis = myVAxis; - myHAxis->SetColor(myAxisColor.Name()); - myVAxis->SetColor(myAxisColor.Name()); - myAngularAxis->SetColor(myAxisColor.Name()); -} - -/*! - fitInResol. - - \param toFit - \param minIsResol -*/ -void Sketch::fitInResol(Standard_Real &toFit, Standard_Boolean minIsResol) -{ - Standard_Real sign = (toFit < 0) ? -1. : +1.; - Standard_Real value = toFit + sign * resol/2.0; /* why "+ resol/2.0" ? because if resol = 0.5, 3.3 is rounded to 3.5 */ - int nTimesResol = int(value/resol); - if ((nTimesResol == 0) && (minIsResol)) nTimesResol = 1; - toFit = nTimesResol*resol; -} - -SketchStatus Sketch::GetCurrentStatus() -{ - return myCurrentStatus; -} - -Standard_Integer Sketch::GetmyEdgesNumber() -{ - return myEdgesNumber; -} - - - diff --git a/src/SKETCHER/GEOM_Sketcher.h b/src/SKETCHER/GEOM_Sketcher.h deleted file mode 100644 index 89b12c086..000000000 --- a/src/SKETCHER/GEOM_Sketcher.h +++ /dev/null @@ -1,201 +0,0 @@ -// GEOM SKETCHER : basic sketcher -// -// 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_Sketcher.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#include "GEOM_SketcherStatus.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class Sketch -{ -public: - Sketch(); - ~Sketch(); - Sketch(const Handle(V3d_Viewer)& aViewer); - Sketch(const Handle(V3d_Viewer)& aViewer, - const Quantity_Color& anAxisColor, - const Quantity_Color& aCurrentColor, - const Quantity_Color& aWireColor); - - static void fitInResol(Standard_Real &toFit, - Standard_Boolean minIsResol = Standard_False); - - void MakeCurrentEdge(const Standard_Integer Xp , - const Standard_Integer Yp , - const Handle(V3d_View)& aView ); - - void MakeCurrentEdge(const Standard_Real X, const Standard_Real Y); - - Standard_Boolean SetDimension(Standard_Real& aValue); - void SetDimension(Standard_Real& deltaX,Standard_Real& deltaY); - - void SetXDimension(Standard_Real& deltaX); - void SetYDimension(Standard_Real& deltaY); - - void SetSegmentAngle(Standard_Real& aValue); - Standard_Real GetSegmentAngle(); - - void ValidateEdge(); - - TopoDS_Wire Close(); - TopoDS_Wire End(); - - void Clear(); - - Standard_Boolean Delete(); - - void SetPlane(const Handle(Geom_Plane)& aPlane); - - void SetWireColor(const Quantity_Color& aColor); - void SetCurrentColor(const Quantity_Color& aColor); - void SetAxisColor(const Quantity_Color& aColor); - - void SetParameterVisibility(const TypeOfParameter atype, - const Standard_Boolean OnOff); - - void HiligthWithColor(const TypeOfParameter atype, - const Quantity_NameOfColor acolor); - void Unhiligth(const TypeOfParameter atype); - - Standard_Boolean IsValidCurrentParameter(const TypeOfParameter atype); - - void SetParameterValue(const TypeOfParameter atype, Standard_Real aValue); - - void ChangeMode(const SketchStatus aMode); - - void SetTransitionStatus(const TransitionStatus aStatus); - - SketchStatus GetCurrentStatus(); - Standard_Integer GetmyEdgesNumber(); - -private : - - void Init(); - - void MakeCurrentSegment(Standard_Real X, Standard_Real Y); - - void MakeCurrentArc(Standard_Real X, Standard_Real Y); - - void DisplayCurrentEdge(); - - void DisplayLengthDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2); - void DisplayXDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2); - void DisplayYDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2); - void DisplayAngleDimension(); - void DisplayRadiusDimension(); - - void AddEdgeToWire(); - - void RemoveLastEdge(); - - void CreateConstraints(); - -private: - // Current status of construction - SketchStatus myCurrentStatus; - // Transition status between arcs and segments - TransitionStatus myTransitionStatus; - // Current wire - BRepBuilderAPI_MakeWire myCurrentWire; - // Current presentable wire - Handle_AIS_Shape myPresentableWire; - // Number of edges into the current wire - Standard_Integer myEdgesNumber; - // Store for each edge how it has been built i.d the value of myCurrentStatus - TColStd_SequenceOfInteger myConstructionMode; - // Store for each edge how it has been built i.d the value of myTransitionStatus - TColStd_SequenceOfInteger myConstraintMode; - // Current edge - TopoDS_Shape myCurrentEdge; - // Previous edge - TopoDS_Edge myPreviousEdge; - // List of points to interpolate when computing a curve by interpolation - TColgp_SequenceOfPnt2d myPointsToInterpolate; - // Tangent vector at beginning of curve - gp_Vec2d myTangentVector; - // Tangent flag at beginning og curve - Standard_Boolean myTangentFlag; - - // Origin of sketch - TopoDS_Vertex myFirstPointSketch; - // Last x coordinate of end point of previous edge or picked point - Standard_Real myLastX; - // Last y coordinate of end point of previous edge or picked point - Standard_Real myLastY; - // angle between 2 segments when an ANGLE TransitionStatus is set. - Standard_Real mySegmentAngle; - // Length of segment when the length of the segment is fixed before the angle - Standard_Real mySegmentLength; - // Value of X fixed coordinate - Standard_Real mySegmentX; - // Value of Y fixed Coordinate - Standard_Real mySegmentY; - Handle_AIS_Shape myPresentableEdge; // Current presentable edge - Handle_AIS_LengthDimension myLengthDimension;// For display of current length segment dimension - Handle_AIS_LengthDimension myXDimension; // For display of current X segment dimension - Handle_AIS_LengthDimension myYDimension; // For display of current Y segment dimension - Handle_AIS_LengthDimension myRadiusDimension;// For display of current radius dimension - Handle_AIS_AngleDimension myAngleDimension; // For display of current angle dimension - Standard_Boolean myIsLengthDimensionVisible; // Visibility flag for LengthDimension - Standard_Boolean myIsXDimensionVisible; // Visibility flag for X Dimension - Standard_Boolean myIsYDimensionVisible; // Visibility flag for Y Dimension - Standard_Boolean myIsRadiusDimensionVisible; // Visibility flag for RadiusDimension - Standard_Boolean myIsAngleDimensionVisible; // Visibility flag for AngleDimension - Handle_AIS_Axis myPresentableMediatrice; // Chord mediatrice of current circle as a presentable object - Handle_Geom2d_Line myMediatrice; // Chord mediatrice of current circle as a 2d line - Handle_AIS_Shape myCenterCircle; // to visualise center of current arc - - Handle_AIS_Axis myHAxis; // Horizontal axis - Handle_AIS_Axis myVAxis; // Vertical axis - Handle_AIS_Axis myAngularAxis; // Axis making a predefined angle with the previous edge - - Quantity_Color myWireColor; // Color of wire and of build edges - Quantity_Color myCurrentColor; // Color of edge under construction - Quantity_Color myAxisColor; // Color for axis - Handle_AIS_InteractiveContext myInteractiveContext; // Interactive context for display management - - Handle_Geom_Plane myPlane; // Plane of sketch - - BRepBuilderAPI_MakeWire myPasteWire; - Standard_Integer myPasteEdgesNumber; - TColStd_SequenceOfInteger myPasteConstructionMode; - TColStd_SequenceOfInteger myPasteConstraintMode; -}; diff --git a/src/SKETCHER/Makefile.in b/src/SKETCHER/Makefile.in index 3e988eb32..82c1e52e9 100644 --- a/src/SKETCHER/Makefile.in +++ b/src/SKETCHER/Makefile.in @@ -36,22 +36,16 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libGEOMSketcher.la -LIB_SRC = GEOM_Sketcher.cxx -LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl GEOM_Shape.idl GEOM_Gen.idl +LIB_SRC = Sketcher_Profile.cxx +LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl # header files -EXPORT_HEADERS= GEOM_Sketcher.h \ - GEOM_SketcherStatus.h +EXPORT_HEADERS= Sketcher_Profile.hxx # additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += $(QT_LIBS) $(CAS_LDPATH) -lTKTopAlgo -L${KERNEL_ROOT_DIR}/lib/salome - -# additional file to be cleaned -MOSTLYCLEAN = -CLEAN = -DISTCLEAN = +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/SKETCHER/Sketcher_Profile.cxx b/src/SKETCHER/Sketcher_Profile.cxx new file mode 100644 index 000000000..4df75a7bf --- /dev/null +++ b/src/SKETCHER/Sketcher_Profile.cxx @@ -0,0 +1,382 @@ +// GEOM SKETCHER : basic sketcher +// +// 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 : Sketcher_Profile.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "Sketcher_Profile.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +//======================================================================= +// profile +// command to build a profile +//======================================================================= +Sketcher_Profile::Sketcher_Profile() +{ +} + + +//======================================================================= +// profile +// command to build a profile +//======================================================================= +Sketcher_Profile::Sketcher_Profile(const char* aCmd) +{ + enum {line, circle, point, none} move; + + Standard_Integer i = 1; + Standard_Real x0, y0, x, y, dx, dy; + x0 = y0 = x = y = dy = 0; + dx = 1; + + Standard_Boolean first, stayfirst, face, close; + first = Standard_True; + stayfirst = face = close = Standard_False; + + TopoDS_Shape S; + TopoDS_Vertex MP; + BRepBuilderAPI_MakeWire MW; + gp_Ax3 DummyHP(gp::XOY()); + gp_Pln P(DummyHP); + TopLoc_Location TheLocation; + Handle(Geom_Surface) Surface; + + myOK = Standard_False; + + TCollection_AsciiString aCommand(CORBA::string_dup(aCmd)); + TCollection_AsciiString aToken = aCommand.Token(":", 1); + int n = 0; + TCollection_AsciiString aTab[aCommand.Length()]; + while(aToken.Length() != 0) { + if(aCommand.Token(":", n + 1).Length() > 0) + aTab[n] = aCommand.Token(":", n + 1); + aToken = aCommand.Token(":", ++n); + } + n = n - 1; + + while(i < n) { + Standard_Real length = 0, radius = 0, angle = 0; + move = point; + + int n1 = 0; + TCollection_AsciiString a[aTab[0].Length()]; + aToken = aTab[i].Token(" ", 1); + while(aToken.Length() != 0) { + if(aTab[i].Token(" ", n1 + 1).Length() > 0) + a[n1] = aTab[i].Token(" ", n1 + 1); + aToken = aTab[i].Token(" ", ++n1); + } + n1 = n1 - 1; + + switch(a[0].Value(1)) + { + case 'F': + { + if (n1 != 3) goto badargs; + if (!first) { + cout<<"profile : The F instruction must precede all moves"< Precision::Confusion()) + move = line; + else + move = none; + break; + } + case 'T': + { + if (n1 != 3) goto badargs; + Standard_Real vx = a[1].RealValue(); + Standard_Real vy = a[2].RealValue(); + if (a[0] == "TT") { + vx -= x; + vy -= y; + } + length = Sqrt(vx * vx + vy * vy); + if (length > Precision::Confusion()) { + move = line; + dx = vx / length; + dy = vy / length; + } + else + move = none; + break; + } + case 'R': + { + if (n1 != 2) goto badargs; + angle = a[1].RealValue() * PI180; + if (a[0] == "RR") { + dx = Cos(angle); + dy = Sin(angle); + } + else { + Standard_Real c = Cos(angle); + Standard_Real s = Sin(angle); + Standard_Real t = c * dx - s * dy; + dy = s * dx + c * dy; + dx = t; + } + break; + } + case 'D': + { + if (n1 != 3) goto badargs; + Standard_Real vx = a[1].RealValue(); + Standard_Real vy = a[2].RealValue(); + length = Sqrt(vx * vx + vy * vy); + if (length > Precision::Confusion()) { + dx = vx / length; + dy = vy / length; + } + else + move = none; + break; + } + case 'C': + { + if (n1 != 3) goto badargs; + radius = a[1].RealValue(); + if (Abs(radius) > Precision::Confusion()) { + angle = a[2].RealValue() * PI180; + move = circle; + } + else + move = none; + break; + } + case 'I': + { + if (n1 != 2) goto badargs; + length = a[1].RealValue(); + if (a[0] == "IX") { + if (Abs(dx) < Precision::Confusion()) { + cout<<"profile : cannot intersect, arg "< Precision::Confusion()) + move = line; + else + move = none; + break; + } + case 'W': + { + if (a[0] == "WW") + close = Standard_True; + else if(a[0] == "WF") { + close = Standard_True; + face = Standard_True; + } + i = n - 1; + break; + } + default: + { + cout<<"profile : unknown code "<D1(angle,p,v); + x = p.X(); + y = p.Y(); + dx = v.X() / radius; + dy = v.Y() / radius; + break; + } + case point: + { + MP = BRepBuilderAPI_MakeVertex(gp_Pnt(x, y, 0.0)); + break; + } + case none: + { + i = n - 1; + break; + } + } + + // update first + first = stayfirst; + stayfirst = Standard_False; + + if(!(dx == 0 && dy == 0)) + myLastDir.SetCoord(dx, dy, 0.0); + else + return; + myLastPoint.SetX(x); + myLastPoint.SetY(y); + + // next segment.... + i++; + if ((i == n) && close) { + // the closing segment + dx = x0 - x; + dy = y0 - y; + length = Sqrt(dx * dx + dy * dy); + move = line; + if (length > Precision::Confusion()) { + dx = dx / length; + dy = dy / length; + goto again; + } + } + } + + // get the result, face or wire + if (move == none) + return; + else if (move == point) + S = MP; + else if (face) + S = BRepBuilderAPI_MakeFace(P, MW.Wire()); + else + S = MW; + + if(!TheLocation.IsIdentity()) + S.Move(TheLocation); + + myShape = S; + myOK = true; + return; + + badargs : + cout<<"profile : bad number of arguments"< +#include +#include + +class Sketcher_Profile +{ + +public: + Sketcher_Profile(); + Sketcher_Profile(const char* aCmd); + +private: + gp_Pnt myLastPoint; + gp_Dir myLastDir; + + TopoDS_Shape myShape; + bool myOK; + +public: + gp_Pnt GetLastPoint(){return myLastPoint;}; + gp_Dir GetLastDir(){return myLastDir;}; + + const TopoDS_Shape& GetShape(){return myShape;}; + bool IsDone(){return myOK;}; + }; diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index 6a968659c..5b9d8126f 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_MirrorDlg.h" #include #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_MirrorDlg() // purpose : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the @@ -131,6 +134,7 @@ void TransformationGUI_MirrorDlg::ClickOnOk() //================================================================================= void TransformationGUI_MirrorDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index c347d7256..2d7b5aae1 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_MultiRotationDlg.h" #include @@ -42,6 +41,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_MultiRotationDlg() // purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the @@ -258,6 +261,7 @@ void TransformationGUI_MultiRotationDlg::ClickOnOk() //================================================================================= void TransformationGUI_MultiRotationDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; @@ -429,13 +433,13 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) QObject* send = (QObject*)sender(); if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1) - myNbTimes1 = newValue; + myNbTimes1 = (int)newValue; else if(send == GroupDimensions->SpinBox_DX1) myAng = newValue; else if(send == GroupDimensions->SpinBox_DX2) myStep = newValue; else if(send == GroupDimensions->SpinBox_DY2) - myNbTimes2 = newValue; + myNbTimes2 = (int)newValue; if(myOkBase && myOkDir) this->MakeMultiRotationSimulationAndDisplay(); diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 5e89231e2..9a78c2ecb 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_MultiTranslationDlg.h" #include @@ -39,6 +38,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_MultiTranslationDlg() // purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the @@ -269,6 +272,7 @@ void TransformationGUI_MultiTranslationDlg::ClickOnOk() //================================================================================= void TransformationGUI_MultiTranslationDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; @@ -488,7 +492,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu if(send == GroupPoints->SpinBox_DX) myStep1 = newValue; else if(send == GroupPoints->SpinBox_DY) - myNbTimes1 = newValue; + myNbTimes1 = (int)newValue; if(myOkBase && myOkDir1) this->MakeMultiTranslationSimulationAndDisplay(); break; @@ -498,11 +502,11 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu if(send == GroupDimensions->SpinBox_DX1) myStep1 = newValue; else if(send == GroupDimensions->SpinBox_DY1) - myNbTimes1 = newValue; + myNbTimes1 = (int)newValue; else if(send == GroupDimensions->SpinBox_DX2) myStep2 = newValue; else if(send == GroupDimensions->SpinBox_DY2) - myNbTimes2 = newValue; + myNbTimes2 = (int)newValue; if(myOkBase && myOkDir1 && myOkDir2) this->MakeMultiTranslationSimulationAndDisplay(); break; diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 4c410e4c4..6d61325c3 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_RotationDlg.h" #include #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_RotationDlg() // purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the @@ -142,6 +145,7 @@ void TransformationGUI_RotationDlg::ClickOnOk() //================================================================================= void TransformationGUI_RotationDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 6f408cff1..96b875d8b 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -26,11 +26,14 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_ScaleDlg.h" #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_ScaleDlg() // purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the @@ -140,6 +143,7 @@ void TransformationGUI_ScaleDlg::ClickOnOk() //================================================================================= void TransformationGUI_ScaleDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 46778b0c7..59f6e60d1 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -26,12 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_TranslationDlg.h" #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_TranslationDlg() // purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the @@ -148,6 +151,7 @@ void TransformationGUI_TranslationDlg::ClickOnOk() //================================================================================= void TransformationGUI_TranslationDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; -- 2.30.2