-This is the version 3.2.0a1 of SALOMEGUI
-Compatible with :
- - KERNEL 3.2.0a1
+SALOME2 : GUI module
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# -* Makefile *-
#
# Author : Patrick GOLDBRONN (CEA)
@COMMENCE@
-SUBDIRS = idl src doc
+SUBDIRS = src doc adm_local
RESOURCES_FILES = \
back.xpm \
# copy header files in common directory
OWN_CONFIG_H=@OWN_CONFIG_H@
+include_list = include/salome/SALOMEconfig.h \
+ include/salome/GUI_version.h
+
ifeq ($(OWN_CONFIG_H),yes)
- ifeq ($(HAVE_SSTREAM),yes)
- include_list=include/salome/SALOMEconfig.h include/salome/config.h
- else
- include_list=include/salome/SALOMEconfig.h include/salome/config.h include/salome/sstream
- endif
-else
- ifeq ($(HAVE_SSTREAM),yes)
- include_list=include/salome/SALOMEconfig.h
- else
- include_list=include/salome/SALOMEconfig.h include/salome/sstream
- endif
+ include_list += include/salome/config.h
+endif
+
+ifneq ($(HAVE_SSTREAM),yes)
+ include_list += include/salome/sstream
endif
inc: idl $(include_list)
+bin: bin/salome/VERSION
+
+bin/salome/VERSION : bin/VERSION
+ -$(RM) $@
+ $(LN_S) ../../$< $@
+
include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.ref
-$(RM) $@
$(LN_S) ../../$< $@
-$(RM) $@
$(LN_S) ../../$< $@
-depend: depend_idl
+include/salome/GUI_version.h: GUI_version.h
+ -$(RM) $@
+ $(LN_S) ../../$< $@
-depend_idl:
- (cd idl ; $(MAKE) $@) || exit 1
+depend:
+#depend: depend_idl
+#depend_idl:
+# (cd idl ; $(MAKE) $@) || exit 1
# doc is already build : if you want to had documents, go manually to doc and run 'make doc'
#doc:
$(INSTALL) -d $(bindir)
$(INSTALL_PROGRAM) $^ $(bindir)
-uninstall: uninstall-idl
-
-uninstall-idl:
- $(RM) $(idldir)/*.idl
+uninstall:
+#uninstall: uninstall-idl
+#uninstall-idl:
+# $(RM) $(idldir)/*.idl
distclean: distclean-other
# common directories to put headerfiles
inc_builddir=$(top_builddir)/include/salome
+GUI_DISABLE_CORBA=@GUI_DISABLE_CORBA@
+DISABLE_GLVIEWER=@DISABLE_GLVIEWER@
+DISABLE_PYCONSOLE=@DISABLE_PYCONSOLE@
+DISABLE_PLOT2DVIEWER=@DISABLE_PLOT2DVIEWER@
+DISABLE_SUPERVGRAPHVIEWER=@DISABLE_SUPERVGRAPHVIEWER@
+DISABLE_OCCVIEWER=@DISABLE_OCCVIEWER@
+DISABLE_VTKVIEWER=@DISABLE_VTKVIEWER@
+DISABLE_SALOMEOBJECT=@DISABLE_SALOMEOBJECT@
@SET_MAKE@
SHELL=/bin/sh
LIBS=@LIBS@
LIBSFORBIN=@LIBS@
-LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome
-LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome
+LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome
+LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome
# add libstdc++ to link c++ library with libtool !
LDFLAGS+= -lstdc++
LDFLAGSFORBIN+= -lstdc++
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@
PYTHON_VERSION = @PYTHON_VERSION@
-PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages
-PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome
+PYTHON_SITE = $(prefix)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages
+PYTHON_SITE_INSTALL = $(prefix)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome
# QT
QT_ROOT = @QT_ROOT@
OCC_INCLUDES=@CAS_CPPFLAGS@
OCC_CXXFLAGS=@CAS_CXXFLAGS@
-#OCC_KERNEL_LIBS=@CAS_KERNEL@
-#OCC_OCAF_LIBS=@CAS_OCAF@
-#OCC_VIEWER_LIBS=@CAS_VIEWER@
-#OCC_MODELER_LIBS=@CAS_MODELER@
-#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@
-#OCC_LIBS=@CAS_LDFLAGS@
CAS_KERNEL=@CAS_KERNEL@
CAS_MATH=@CAS_MATH@
CAS_OCAF=@CAS_OCAF@
CAS_MODELER=@CAS_MODELER@
CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@
CAS_LDPATH=@CAS_LDPATH@
+
# MPICH
MPICH_INCLUDES=@MPICH_INCLUDES@
CPPFLAGS+= $(CORBA_INCLUDES)
CXXFLAGS+= $(CORBA_CXXFLAGS)
-# add corba libs when link salome application !
-#LDFLAGS+= $(CORBA_LIBS)
-#LIBS+=$(CORBA_LIBS)
-
DOXYGEN = @DOXYGEN@
+DOXYGEN_WITH_PYTHON = @DOXYGEN_WITH_PYTHON@
+DOXYGEN_WITH_STL = @DOXYGEN_WITH_STL@
## Shared libraries
LT_STATIC_EXEC=@LT_STATIC_EXEC@
# create a symbolic link (or a copie ?)
LN_S=@LN_S@
+KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@
+KERNEL_SITE_DIR=@KERNEL_SITE_DIR@
+
+KERNEL_LDFLAGS=@KERNEL_LDFLAGS@
+KERNEL_CXXFLAGS=@KERNEL_CXXFLAGS@
+
## Installation points
prefix=@prefix@
exec_prefix=@exec_prefix@
-bindir=@bindir@/salome
-libdir=@libdir@/salome
+bindir=@exec_prefix@/bin/salome
+libdir=@exec_prefix@/lib@LIB_LOCATION_SUFFIX@/salome
# warning : if user give this path in configure we could have salome/salome :-(
includedir=@includedir@/salome
datadir=@datadir@/salome
idldir=${prefix}/idl/salome
-sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
+sharedpydir=@exec_prefix@/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
incmakedir=${prefix}/salome_adm/unix
docdir=${prefix}/doc/salome
Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in
cd $(top_builddir) ; ./config.status
-$(top_builddir)/config.status: $(top_srcdir)/configure
+LOCAL_MAKE = make_commence make_conclude make_omniorb
+
+KERNEL_MAKE = make_module depend SALOMEconfig.h F77config.h sstream envScript
+
+$(top_builddir)/config.status: $(top_srcdir)/configure \
+ $(LOCAL_MAKE:%=$(top_srcdir)/adm_local/unix/%.in) \
+ $(KERNEL_MAKE:%=$(KERNEL_ROOT_DIR)/salome_adm/unix/%.in)
cd $(top_builddir) ; ./config.status --recheck
# VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-)
ACLOCAL_SRC = \
-ac_cxx_bool.m4 check_corba.m4 check_vtk.m4 \
-ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \
-ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \
-ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \
-ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \
-ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
-ac_cc_warnings.m4 check_qt.m4 check_swig.m4 \
-check_boost.m4 check_msg2qm.m4
-
-$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
- cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
+check_qt.m4 check_vtk.m4 check_qwt.m4 \
+check_sip.m4 check_msg2qm.m4 check_pyqt.m4 \
+check_opengl.m4
+
+$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=$(top_srcdir)/adm_local/unix/config_files/%)
+ cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
+++ /dev/null
-THIS IS SALOME - SALOMEGUI VERSION: 3.2.0a1
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
#!/bin/bash -f
if [ -z "$SUITRoot" ] ; then
echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
-echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
+echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
-echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1
-echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
+echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
+echo " ./adm_local/unix/make_conclude:${ABS_CONF_DIR}/adm_local/unix/make_conclude.in \\" >> configure.in_tmp1
echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
\rm -f configure.in_tmp2 configure.in_tmp3
echo -n "Creating 'configure' script ... "
fi
-aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
+aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
if autoconf
then
echo "done"
PACKAGE=salome
AC_SUBST(PACKAGE)
-VERSION=0.0.1
+VERSION=3.2.0
+XVERSION=0x030200
AC_SUBST(VERSION)
+AC_SUBST(XVERSION)
+
+########################################################################
+# Check --disable-corba-gen and other --disable-* options
+
+GUI_DISABLE_CORBA="no"
+DISABLE_PYCONSOLE="no"
+DISABLE_GLVIEWER="no"
+DISABLE_PLOT2DVIEWER="no"
+DISABLE_SUPERVGRAPHVIEWER="no"
+DISABLE_OCCVIEWER="no"
+DISABLE_VTKVIEWER="no"
+DISABLE_SALOMEOBJECT="no"
+
+for option
+do
+ case $option in
+ -disable-corba-gen=yes | --disable-corba-gen=yes | -disable-corba-gen | --disable-corba-gen)
+ GUI_DISABLE_CORBA="yes";;
+ -disable-pyConsole=yes | --disable-pyConsole=yes | -disable-pyConsole | --disable-pyConsole)
+ DISABLE_PYCONSOLE="yes";;
+ -disable-glViewer=yes | --disable-glViewer=yes | -disable-glViewer | --disable-glViewer)
+ DISABLE_GLVIEWER="yes";;
+ -disable-plot2dViewer=yes | --disable-plot2dViewer=yes | -disable-plot2dViewer | --disable-plot2dViewer)
+ DISABLE_PLOT2DVIEWER="yes";;
+ -disable-supervGraphViewer=yes | --disable-supervGraphViewer=yes | \
+ -disable-supervGraphViewer | --disable-supervGraphViewer)
+ DISABLE_SUPERVGRAPHVIEWER="yes";;
+ -disable-occViewer=yes | --disable-occViewer=yes | -disable-occViewer | --disable-occViewer)
+ DISABLE_OCCVIEWER="yes";;
+ -disable-vtkViewer=yes | --disable-vtkViewer=yes | -disable-vtkViewer | --disable-vtkViewer)
+ DISABLE_VTKVIEWER="yes";;
+ -disable-salomeObject=yes | --disable-salomeObject=yes | -disable-salomeObject | --disable-salomeObject)
+ DISABLE_SALOMEOBJECT="yes";;
+ esac
+done
dnl
dnl Initialize source and build root directories
dnl CHECK_JAVA
+echo
+echo ---------------------------------------------
+echo Testing Disable Corba
+echo ---------------------------------------------
+echo
+
+CHECK_DISABLE_CORBA
+echo "GUI_DISABLE_CORBA = "$GUI_DISABLE_CORBA
+
+if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then
+
echo
echo ---------------------------------------------
echo testing swig
echo
CHECK_SWIG
+fi
echo
echo ---------------------------------------------
ENABLE_PTHREADS
+if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then
echo
echo ---------------------------------------------
echo testing omniORB
echo
DEFAULT_ORB=omniORB
+
+echo
+echo ---------------------------------------------
+echo testing Corba
+echo ---------------------------------------------
+echo
+
CHECK_CORBA
AC_SUBST_FILE(CORBA)
corba=make_$ORB
CORBA=adm_local/unix/$corba
+fi
echo
echo ---------------------------------------------
echo testing openGL
CHECK_QWT
+echo
+echo ---------------------------------------------
+echo Testing PyConsole
+echo ---------------------------------------------
+echo
+
+CHECK_PYCONSOLE
+echo "DISABLE_PYCONSOLE = "$DISABLE_PYCONSOLE
+
+echo
+echo ---------------------------------------------
+echo Testing GlViewer
+echo ---------------------------------------------
+echo
+
+CHECK_GLVIEWER
+echo "DISABLE_GLVIEWER = "$DISABLE_GLVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing Plot2dViewer
+echo ---------------------------------------------
+echo
+
+CHECK_PLOT2DVIEWER
+echo "DISABLE_PLOT2DVIEWER = "$DISABLE_PLOT2DVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing SupervGraphViewer
+echo ---------------------------------------------
+echo
+
+CHECK_SUPERVGRAPHVIEWER
+echo "DISABLE_SUPERVGRAPHVIEWER = "$DISABLE_SUPERVGRAPHVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing OCCViewer
+echo ---------------------------------------------
+echo
+
+CHECK_OCCVIEWER
+echo "DISABLE_OCCVIEWER = "$DISABLE_OCCVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing VTKViewer
+echo ---------------------------------------------
+echo
+
+CHECK_VTKVIEWER
+echo "DISABLE_VTKVIEWER = "$DISABLE_VTKVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing SalomeObject
+echo ---------------------------------------------
+echo
+
+CHECK_SALOMEOBJECT
+echo "DISABLE_SALOMEOBJECT = "$DISABLE_SALOMEOBJECT
+
+if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then
+ if test "x${DISABLE_PYCONSOLE}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable PyConsole !"
+ exit
+ fi
+ if test "x${DISABLE_GLVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable GlViewer !"
+ exit
+ fi
+ if test "x${DISABLE_PLOT2DVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable Plot2dViewer !"
+ exit
+ fi
+ if test "x${DISABLE_SUPERVGRAPHVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable SupervGraphViewer !"
+ exit
+ fi
+ if test "x${DISABLE_OCCVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable OCCViewer !"
+ exit
+ fi
+ if test "x${DISABLE_VTKVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable VTKViewer !"
+ exit
+ fi
+ if test "x${DISABLE_SALOMEOBJECT}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable SalomeObject !"
+ exit
+ fi
+fi
+
echo
echo ---------------------------------------------
echo Testing html generators
echo Testing Kernel
echo ---------------------------------------------
echo
-
CHECK_KERNEL
+echo
+echo ---------------------------------------------
+echo Testing CPPUNIT only required for unit testing
+echo ---------------------------------------------
+echo
+
+CHECK_CPPUNIT
+
echo
echo ---------------------------------------------
echo Summary
echo ---------------------------------------------
echo
-echo Configure
+if test "$GUI_DISABLE_CORBA" == "yes"; then
+ echo "Configure (without Corba)"
+else
+ echo Configure
+fi
+
+
+if test "$GUI_DISABLE_CORBA" != "yes"; then
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok msg2qm_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok"
+else
+variables="cc_ok lex_yacc_ok python_ok threads_ok OpenGL_ok qt_ok msg2qm_ok vtk_ok hdf5_ok boost_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok"
+fi
for var in $variables
do
eval echo \$$var
done
+echo "---Optional:"
+variables="cppunit_ok"
+
+for var in $variables
+do
+ eval toto=\$$var
+ if test x$toto != "x"; then
+ printf " %10s : " `echo \$var | sed -e "s,_ok,,"`
+ eval echo \$$var
+ fi
+done
+
+if test "$GUI_DISABLE_CORBA" != "yes"; then
echo
echo "Default ORB : $DEFAULT_ORB"
echo
-
+fi
dnl generals files which could be included in every makefile
AC_SUBST_FILE(COMMENCE) COMMENCE=adm_local/unix/make_commence
-AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
+AC_SUBST_FILE(CONCLUDE) CONCLUDE=adm_local/unix/make_conclude
AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
dnl les dependences
fi
# make other build directories
-for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl
+if test "$GUI_DISABLE_CORBA" == "yes"; then
+ dir_variables="salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources idl"
+else
+ dir_variables="salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources"
+fi
+
+for rep in $dir_variables
do
# if test ! -d $rep ; then
# eval mkdir $rep
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# -* Makefile *-
#
@@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \
done
+
+usr_docs:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+dev_docs:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
clean:
@@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \
+++ /dev/null
-<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
-
- <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
-
- <meta name="GENERATOR"
- content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
- <title>Gui Module Documentation</title>
-</head>
- <body bgcolor="#cccccc" text="#000000" link="#0000ee" alink="#0000ee"
- vlink="#551a8b">
-
-<div align="center">
-<center>
-<center>
- </center>
-
-<table width="96%" align="center">
- <tbody>
- <tr>
- <td><a href="http://www.opencascade.com"><img
- src="tui/SUIT/sources/logocorp.gif" border="0" height="46" width="122">
- </a></td>
- <td>
-
- <div align="right"><a href="http://www.opencascade.org/SALOME/"><img
- src="tui/SUIT/sources/application.gif" border="0" height="46" width="108">
- </a></div>
- </td>
- </tr>
-
- </tbody>
-</table>
-
-<div align="center">
-<center>
-<hr width="100%" size="2">
-<h1>GUI MODULE Documentation</h1>
- </center>
- </div>
-
-<table width="96%">
- <tbody>
-
- </tbody>
-</table>
- </center>
-
-<div align="center">
-<p> <img src="tui/SUIT/sources/Application-About.png"
- alt="Application-About.png" width="30%" height="20%">
- </p>
- </div>
-
-<center>
-<table width="96%">
- <tbody>
-
- </tbody>
-</table>
- <br>
- <br>
- <br>
- </center>
-
-<address> </address>
-
-<center><big><a href="gui/KERNEL/kernel.htm">GUI Documentation</a></big></center>
-
-<address> </address>
-
-<center></center>
-
-<center><br>
- </center>
-
-<address> </address>
-
-<center><big><a href="tui/SUIT/index.html">TUI Documentation</a></big></center>
-
-<address> </address>
-
-<center></center>
-
-<center><br>
- <br>
- </center>
- </div>
- <br>
- <br>
- <br>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
-
- <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
-
- <meta name="GENERATOR"
- content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
- <title>Gui Module Documentation</title>
-</head>
- <body bgcolor="#cccccc" text="#000000" link="#0000ee" alink="#0000ee"
- vlink="#551a8b">
-
-<div align="center">
-<center>
-<center>
- </center>
-
-<table width="96%" align="center">
- <tbody>
- <tr>
- <td><a href="http://www.opencascade.com"><img
- src="tui/SUIT/sources/logocorp.gif" border="0" height="46" width="122">
- </a></td>
- <td>
-
- <div align="right"><a href="http://www.opencascade.org/SALOME/"><img
- src="tui/SUIT/sources/application.gif" border="0" height="46" width="108">
- </a></div>
- </td>
- </tr>
-
- </tbody>
-</table>
-
-<div align="center">
-<center>
-<hr width="100%" size="2">
-<h1>GUI MODULE Documentation</h1>
- </center>
- </div>
-
-<table width="96%">
- <tbody>
-
- </tbody>
-</table>
- </center>
-
-<div align="center">
-<p> <img src="tui/SUIT/sources/Application-About.png"
- alt="Application-About.png" width="30%" height="20%">
- </p>
- </div>
-
-<center>
-<table width="96%">
- <tbody>
-
- </tbody>
-</table>
- <br>
- <br>
- <br>
- </center>
-
-<address> </address>
-
-<center><big><a href="gui/KERNEL/kernel.htm">GUI Documentation</a></big></center>
-
-<address> </address>
-
-<center></center>
-
-<center><br>
- </center>
-
-<address> </address>
-
-<center><big><a href="tui/SUIT/index.html">TUI Documentation</a></big></center>
-
-<address> </address>
-
-<center></center>
-
-<center><br>
- <br>
- </center>
- </div>
- <br>
- <br>
- <br>
-</body>
-</html>
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# -* Makefile *-
#
VPATH=.:@srcdir@
SUBDIRS= tui gui
+SUBDIRSTUI= tui
+SUBDIRSGUI= gui
@COMMENCE@
-docs:
- @@SETX@; for d in $(SUBDIRS); do \
+usr_docs:
+ @@SETX@; for d in $(SUBDIRSGUI); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done; \
+
+docs: usr_docs
+
+dev_docs:
+ @@SETX@; for d in $(SUBDIRSTUI); do \
(cd $$d && $(MAKE) $@) || exit 1; \
done; \
- cp -f $(srcdir)/GUI_index_v3.1.0.html GUI_index_v3.1.0.html
clean:
@@SETX@; for d in $(SUBDIRS); do \
- (cd $$d && $(MAKE) $@) || exit 1; \
+ if test -d $$d/GUI; then \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ fi; \
done
distclean: clean
@@SETX@; for d in $(SUBDIRS); do \
- (cd $$d && $(MAKE) $@) || exit 1; \
+ if test -d $$d/GUI; then \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ fi; \
done
install:
$(MAKE) docs
- (cd tui && $(MAKE) install);
- (cd gui && $(MAKE) install);
- cp -f GUI_index_v3.1.0.html $(docdir)
+ @@SETX@; for d in $(SUBDIRS); do \
+ if test -d $$d/GUI; then \
+ (cd $$d && $(MAKE) $@); \
+ fi; \
+ done
uninstall:
@@SETX@; for d in $(SUBDIRS); do \
- (cd $$d && $(MAKE) $@) || exit 1; \
+ if test -d $$d/GUI; then \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ fi; \
done; \
- rm -fr $(docdir)/GUI_index_v3.1.0.html
-# Copyright (C) 2003 CEA/DEN, EDF R&D
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.in
# Author : Vasily Rusyaev (Open Cascade NN)
# Module : doc
-# $Header:
top_srcdir=@top_srcdir@
top_builddir=../../..
@COMMENCE@
-docs:
- cp -fr $(srcdir)/SUIT ./INPUT; \
+dev_docs:
+ cp -fr $(srcdir)/GUI ./INPUT; \
+ cp -f ./GUI/doxyfile ./INPUT; \
cd INPUT; \
sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
+ sed 's|../../build/salome|$(top_builddir)|' ./doxyfile1 > ./doxyfile2; \
+ mv -f doxyfile2 doxyfile1; \
+ echo "DOXYGEN SUPPORT PYTHON - @DOXYGEN_WITH_PYTHON@"; \
+ if( test "x@DOXYGEN_WITH_PYTHON@" = "xyes"); then \
+ sed 's|python_extension_must_be_here|*.py|' ./doxyfile1 > ./doxyfile2; \
+ mv -f doxyfile2 doxyfile1; \
+ $(doxygen) -u ./doxyfile1; \
+ else \
+ sed 's|python_extension_must_be_here||' ./doxyfile1 > ./doxyfile2; \
+ mv -f doxyfile2 doxyfile1; \
+ fi; \
+ if( test "x@DOXYGEN_WITH_STL@" = "xyes"); then \
+ sed -e 's|BUILTIN_STL_SUPPORT = NO|BUILTIN_STL_SUPPORT = YES|' ./doxyfile1 > ./doxyfile2; \
+ mv -f doxyfile2 doxyfile1; \
+ fi; \
mv -f doxyfile1 doxyfile; \
+ echo "Running doxygen in directory:"`pwd`; \
$(doxygen) ./doxyfile; \
cd ../; \
- cp -fr $(srcdir)/SUIT/sources/ SUIT ; \
+ cp -fr $(srcdir)/GUI/sources/ GUI ; \
rm -fr INPUT
clean:
- rm -fr SUIT
+ rm -fr GUI
distclean: clean
rm -fr INPUT
install:
$(INSTALL) -d $(docdir); \
mkdir -p $(docdir)/tui
- cp -fr SUIT $(docdir)/tui
+ cp -fr GUI $(docdir)/tui
uninstall:
- rm -fr $(docdir)/tui/SUIT
+ rm -fr $(docdir)/tui/GUI
+++ /dev/null
-# Doxyfile 1.3.7
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME v.3.2.0a1"
-PROJECT_NUMBER = id#1.1
-OUTPUT_DIRECTORY = ../
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = NO
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 5
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = YES
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = YES
-HIDE_UNDOC_CLASSES = YES
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = YES
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 25
-SHOW_USED_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE = log.txt
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../../../share/salome/src \
- ../../../share/salome/idl
-FILE_PATTERNS = *.idl *.h *.hh *.hxx *.c *.cc *.cxx *.ixx *.jxx
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = YES
-IMAGE_PATH = sources/
-INPUT_FILTER =
-FILTER_SOURCE_FILES = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = NO
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = SUIT
-HTML_FILE_EXTENSION = .html
-HTML_HEADER = sources/myheader.html
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = YES
-TOC_EXPAND = YES
-DISABLE_INDEX = YES
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = YES
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = NO
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = NO
-HAVE_DOT = YES
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = NO
-UML_LOOK = NO
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = NO
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DOT_IMAGE_FORMAT = jpg
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1200
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = NO
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
+++ /dev/null
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
- <title>Main Page</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-</head>
-<body>
-
-<center><table WIDTH="96%" >
-<tr>
-<td><a href="http://www.opencascade.com"><img src="sources/logocorp.gif" BORDER=0 height=46 width=122></a></td>
-
-
-<td>
-<div align=right><a href="http://www.opencascade.org/SALOME/"><img src="sources/application.gif" BORDER=0 height=46 width=108></a></div>
-</td>
-</tr>
-</table></center>
-
-
-</body>
-</html>
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SalomeApp_Engine.idl
// Author : Alexander SLADKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAF_H
#define CAF_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAF_Application.h"
return new CAF_Application();
}
+/*!
+ Default constructor
+*/
CAF_Application::CAF_Application()
: STD_Application()
{
}
-CAF_Application::CAF_Application( const Handle(TDocStd_Application)& app )
+/*!
+ Constructor with OCAF application
+ \param app - OCAF application
+*/
+CAF_Application::CAF_Application( const Handle( TDocStd_Application )& app )
: STD_Application(),
myStdApp( app )
{
}
+/*!
+ Destructor
+*/
CAF_Application::~CAF_Application()
{
}
+/*!
+ \return application name
+*/
QString CAF_Application::applicationName() const
{
return QString( "CAFApplication" );
}
-Handle(TDocStd_Application) CAF_Application::stdApp() const
+/*!
+ \return OCAF application
+*/
+Handle( TDocStd_Application ) CAF_Application::stdApp() const
{
return myStdApp;
}
+/*!
+ \return file filters for open/save document
+*/
QString CAF_Application::getFileFilter() const
{
if ( stdApp().IsNull() )
return filters.join( ";;" );
}
+/*!
+ Creates actions of application
+*/
void CAF_Application::createActions()
{
STD_Application::createActions();
redo->setEnabled( cafStudy && cafStudy->canRedo() );
}
+/*!
+ SLOT: called by clicking on Help->About in main menu
+*/
void CAF_Application::onHelpAbout()
{
SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
}
+/*!
+ Creates new study
+*/
SUIT_Study* CAF_Application::createNewStudy()
{
return new CAF_Study( this );
}
+/*!
+ Sets OCAF application
+*/
void CAF_Application::setStdApp( const Handle(TDocStd_Application)& app )
{
myStdApp = app;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAF_APPLICATION_H
#define CAF_APPLICATION_H
#pragma warning ( disable: 4251 )
#endif
+/*!
+ \class CAF_Application
+ Defines application configuration and behaviour for application with
+ link to standard OCC OCAF data model. Allows to use OCC OCAF serives
+ (for example, undo/redo)
+*/
class CAF_EXPORT CAF_Application : public STD_Application
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAF_Operation.h"
#include <TDocStd_Document.hxx>
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
+/*!
+ Default constructor
+*/
CAF_Operation::CAF_Operation(SUIT_Application* theApp)
:SUIT_Operation(theApp)
{
}
+/*!
+ Destructor
+*/
CAF_Operation::~CAF_Operation()
{
}
+/*!
+ \return OCAF document
+*/
Handle(TDocStd_Document) CAF_Operation::stdDoc() const
{
Handle(TDocStd_Document) doc;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAF_OPERATION_H
#define CAF_OPERATION_H
#include <Standard.hxx>
class CAF_Study;
+//! OCC OCAF Std document
class Handle(TDocStd_Document);
+/*!
+ \class CAF_Operation
+ Base operation for all operations used in CAF package
+ Operation has link to OCC OCAF std document
+*/
class CAF_EXPORT CAF_Operation : public SUIT_Operation
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAF_Study.h"
#include <Standard_ErrorHandler.hxx>
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
+/*!
+ Constructor
+*/
CAF_Study::CAF_Study(SUIT_Application* theApp)
: SUIT_Study( theApp ),
myModifiedCnt( 0 )
{
}
+/*!
+ Constructor
+*/
CAF_Study::CAF_Study(SUIT_Application* theApp, Handle (TDocStd_Document)& aStdDoc)
: SUIT_Study( theApp ),
myStdDoc( aStdDoc ),
{
}
+/*!
+ Destructor
+*/
CAF_Study::~CAF_Study()
{
}
+/*!
+ \return OCAF document
+*/
Handle(TDocStd_Document) CAF_Study::stdDoc() const
{
return myStdDoc;
}
+/*!
+ Sets new OCAF document
+ \param aStdDoc - new OCAF document
+*/
void CAF_Study::setStdDoc( Handle(TDocStd_Document)& aStdDoc )
{
myStdDoc = aStdDoc;
}
+/*!
+ Custom document initialization
+*/
void CAF_Study::createDocument()
{
SUIT_Study::createDocument();
}
}
+/*!
+ Close document
+*/
void CAF_Study::closeDocument( bool permanent )
{
Handle(TDocStd_Application) app = stdApp();
SUIT_Study::closeDocument( permanent );
}
+/*!
+ Open document
+ \param fname - name of file
+*/
bool CAF_Study::openDocument( const QString& fname )
{
Handle(TDocStd_Application) app = stdApp();
return status && SUIT_Study::openDocument( fname );
}
+/*!
+ Save document with other name
+ \param fname - name of file
+*/
bool CAF_Study::saveDocumentAs( const QString& fname )
{
Handle(TDocStd_Application) app = stdApp();
return status;
}
+/*!
+ Open OCAF transaction
+*/
bool CAF_Study::openTransaction()
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
bool res = true;
return res;
}
+/*!
+ Abort OCAF transaction
+*/
bool CAF_Study::abortTransaction()
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
bool res = true;
- try {
+ try {
myStdDoc->AbortCommand();
update();
}
return res;
}
+/*!
+ Commit OCAF transaction
+*/
bool CAF_Study::commitTransaction( const QString& name )
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
bool res = true;
- try {
+ try {
myStdDoc->CommitCommand();
if ( canUndo() )
return res;
}
+/*!
+ \return true, if there is opened OCAF transaction
+*/
bool CAF_Study::hasTransaction() const
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
return myStdDoc->HasOpenCommand();
}
/*!
- Returns whether the document was saved in file. [ public ]
+ \return whether the document was saved in file. [ public ]
*/
bool CAF_Study::isSaved() const
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
return myStdDoc->IsSaved();
}
/*!
- Returns whether the document is modified. [ public ]
+ \return whether the document is modified. [ public ]
*/
bool CAF_Study::isModified() const
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
// return myStdDoc->IsModified();
}
/*!
- Check if possible to perform 'undo' command. [ public ]
+ \return true if possible to perform 'undo' command. [ public ]
*/
bool CAF_Study::canUndo() const
{
}
/*!
- Check if possible to perform 'redo' command. [ public ]
+ \return true if possible to perform 'redo' command. [ public ]
*/
bool CAF_Study::canRedo() const
{
}
/*!
- Returns the list of names of 'undo' actions available. [ public ]
+ \return the list of names of 'undo' actions available. [ public ]
*/
QStringList CAF_Study::undoNames() const
{
}
/*!
- Returns the list of names of 'redo' actions available. [ public ]
+ \return the list of names of 'redo' actions available. [ public ]
*/
QStringList CAF_Study::redoNames() const
{
}
/*!
- Returns the standard OCAF application from owner application. [ protected ]
+ \return the standard OCAF application from owner application. [ protected ]
*/
Handle(TDocStd_Application) CAF_Study::stdApp() const
{
}
/*!
- Returns the application casted to type CAF_Application. [ protected ]
+ \return the application casted to type CAF_Application. [ protected ]
*/
CAF_Application* CAF_Study::cafApplication() const
{
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAF_STUDY_H
#define CAF_STUDY_H
#pragma warning ( disable: 4251 )
#endif
+/*!
+ \class CAF_Study
+ Represents study for using in CAF, contains reference
+ to OCAF std document and allows to use OCAF services.
+ Provides necessary functionality for OCC transactions management.
+*/
class CAF_EXPORT CAF_Study : public SUIT_Study
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : CAF_Tools.cxx
// Author : UI team
return result;
}
+/*!
+ Converts Qt color to OCC color
+*/
Quantity_Color CAF_Tools::color( const QColor& c )
{
Quantity_Color aColor;
return aColor;
}
+/*!
+ Converts OCC color to Qt color
+*/
QColor CAF_Tools::color( const Quantity_Color& c )
{
return QColor ( int( c.Red() * 255 ),
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : CAF_Tools.h
// Author : UI team
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
+/*!
+ \class CAF_Tools
+ Prodives set of auxiliary static methods
+*/
class CAF_EXPORT CAF_Tools : public SUIT_Tools
{
public:
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : caf
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAM_H
#define CAM_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAM_Application.h"
CAM_Module* mod = loadModule( (*it).title );
if ( mod )
addModule( mod );
- else
- SUIT_MessageBox::error1( desktop(), tr( "Loading modules" ),
- tr( "Can not load module %1" ).arg( (*it).title ), tr( "Ok" ) );
+ else {
+ if ( desktop() && desktop()->isShown() )
+ SUIT_MessageBox::error1( desktop(), tr( "Loading modules" ),
+ tr( "Can not load module %1" ).arg( (*it).title ), tr( "Ok" ) );
+ else
+ qWarning( tr( "Can not load module %1" ).arg( (*it).title ).latin1() );
+ }
}
}
module->setName( moduleName( modName ) );
}
- if ( !err.isEmpty() )
- SUIT_MessageBox::warn1( desktop(), tr( "Error" ), err, tr( "Ok" ) );
+ if ( !err.isEmpty() ) {
+ if ( desktop() && desktop()->isShown() )
+ SUIT_MessageBox::warn1( desktop(), tr( "Error" ), err, tr( "Ok" ) );
+ else
+ qWarning( err.latin1() );
+ }
return module;
}
-/**@name Activate module group.*/
+/*! @name Activate module group. */
//@{
/*!Activate module with name \a modName.
*\param modName - module name.
{
myModule->setMenuShown( false );
myModule->setToolShown( false );
- SUIT_MessageBox::error1( desktop(), tr( "ERROR_TLT" ), tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() ), tr( "BUT_OK" ) );
+ if ( desktop() && desktop()->isShown() )
+ SUIT_MessageBox::error1( desktop(), tr( "ERROR_TLT" ), tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() ), tr( "BUT_OK" ) );
+ else
+ qWarning( tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() ).latin1() );
myModule = 0;
return false;
}
myInfoList.append( inf );
}
- if ( myInfoList.isEmpty() )
- SUIT_MessageBox::error1( 0, tr( "Error" ), tr( "Can not load modules configuration file " ), tr( "Ok" ) );
+ if ( myInfoList.isEmpty() ) {
+ if ( desktop() && desktop()->isShown() )
+ SUIT_MessageBox::warn1( desktop(), tr( "Warning" ), tr( "Modules list is empty" ), tr( "&OK" ) );
+ else
+ qWarning( tr( "Modules list is empty" ).latin1() );
+ }
}
/*!Add common items for popup menu ( if they are exist )
/*!Create empty study.*/
void CAM_Application::createEmptyStudy()
{
- SUIT_Study* study = activeStudy();
-
+ /*SUIT_Study* study = */activeStudy();
STD_Application::createEmptyStudy();
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAM_APPLICATION_H
#define CAM_APPLICATION_H
#pragma warning( disable:4251 )
#endif
+/*!
+ \class CAM_Application
+ Defines application configuration and behaviour for application with modules.
+ Every module has own data model, necessary windows and viewers, etc.
+ Application provides all necessary functionality for module management
+ (loading of modules/activation/deactivation, etc)
+*/
class CAM_EXPORT CAM_Application : public STD_Application
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAM_DataModel.h"
{
}
+/*!
+ Default implementation, does nothing.
+ Can be used for creation of root object.
+*/
void CAM_DataModel::initialize()
{
- //! Default implementation, does nothing.\n
- //! Can be used for creation of root object.
}
/*!Get root object.
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAM_DATAMODEL_H
#define CAM_DATAMODEL_H
class CAM_Study;
class SUIT_DataObject;
+/*!
+ \class CAM_DataModel
+ Base class for all data models used in CAM-based applications.
+ Represents data model of CAM module. Provides necessary interface (default implementation is empty)
+*/
class CAM_EXPORT CAM_DataModel : public QObject
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAM_DataObject.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAM_DATAOBJECT_H
#define CAM_DATAOBJECT_H
class CAM_Module;
class CAM_DataModel;
+/*!
+ \class CAM_DataObject
+ Provides only additional link to CAM_DataModel
+*/
class CAM_EXPORT CAM_DataObject : public SUIT_DataObject
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAM_Module.h"
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
+
/*!Icon.*/
static const char* ModuleIcon[] = {
"20 20 2 1",
void CAM_Module::initialize( CAM_Application* app )
{
myApp = app;
+ if (myApp) {
+ SUIT_Session* aSession = SUIT_Session::session();
+ connect(aSession, SIGNAL( applicationClosed( SUIT_Application* ) ),
+ this, SLOT( onApplicationClosed( SUIT_Application* ) ));
+ }
}
/*!\retval Module icon.*/
{
}
+/*!Public slot, nullify application pointer if the application was closed.*/
+void CAM_Module::onApplicationClosed( SUIT_Application* theApp )
+{
+ if (myApp == theApp)
+ myApp = NULL;
+}
+
/*!Create and return new instance of CAM_DataModel.*/
CAM_DataModel* CAM_Module::createDataModel()
{
/*! Create tool.
* Insert QAction with id \a id from action map(myActionMap) to tool manager.
- *\param a - QAction
- *\param tBar - integer
*\param id - integer
+ *\param tBar - integer
*\param idx - integer
*\retval integer id of new action in tool manager.
*\retval Return -1 if something wrong.
/*! Create tool.
* Insert QAction with id \a id from action map(myActionMap) to tool manager.
- *\param a - QAction
- *\param tBar - QString&
*\param id - integer
+ *\param tBar - QString&
*\param idx - integer
*\retval integer id of new action in tool manager.
*\retval Return -1 if something wrong.
*\retval Return -1 if something wrong.
*/
int CAM_Module::createMenu( const QString& subMenu, const int menu,
- const int id, const int group, const int index )
+ const int id, const int group, const int index,
+ const bool enableEmpty )
{
if ( !menuMgr() )
return -1;
- return menuMgr()->insert( subMenu, menu, group, index );
+ return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty );
}
/*! Create menu.
*\retval Return -1 if something wrong.
*/
int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
- const int id, const int group, const int index )
+ const int id, const int group, const int index,
+ const bool enableEmpty )
{
if ( !menuMgr() )
return -1;
- return menuMgr()->insert( subMenu, menu, group, index );
+ return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty );
}
return ident;
}
+/*! Unregister an action.
+ * \param id - id for action.
+ * \retval true if succeded, false if action is used
+ */
+bool CAM_Module::unregisterAction( const int id )
+{
+ return unregisterAction( action( id ) );
+}
+
+/*! Unregister an action.
+ * \param a - action
+ * \retval true if succeded, false if action is used
+ */
+bool CAM_Module::unregisterAction( QAction* a )
+{
+ if ( !a )
+ return false;
+ if ( menuMgr() ) {
+ int id = menuMgr()->actionId( a );
+ if ( id != -1 && menuMgr()->containsMenu( id, -1 ) )
+ return false;
+ }
+ if ( toolMgr() ) {
+ int id = toolMgr()->actionId( a );
+ if ( id != -1 && toolMgr()->containsAction( id ) )
+ return false;
+ }
+ if ( menuMgr() )
+ menuMgr()->unRegisterAction( menuMgr()->actionId( a ) );
+ if ( toolMgr() )
+ toolMgr()->unRegisterAction( toolMgr()->actionId( a ) );
+ return true;
+}
+
/*! Return qt action manager separator.*/
QAction* CAM_Module::separator()
{
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAM_MODULE_H
#define CAM_MODULE_H
class QAction;
class SUIT_Study;
+class SUIT_Application;
class CAM_Study;
class CAM_DataModel;
class CAM_Application;
/** @name Set Menu Shown*/
//@{
- void setMenuShown( const bool );
+ virtual void setMenuShown( const bool );
void setMenuShown( QAction*, const bool );
void setMenuShown( const int, const bool );
//@}
/** @name Set Tool Shown*/
//@{
- void setToolShown( const bool );
+ virtual void setToolShown( const bool );
void setToolShown( QAction*, const bool );
void setToolShown( const int, const bool );
//@}
virtual void studyClosed( SUIT_Study* );
virtual void studyChanged( SUIT_Study*, SUIT_Study* );
+ virtual void onApplicationClosed( SUIT_Application* );
+
protected:
virtual CAM_DataModel* createDataModel();
/** @name Create menu methods.*/
//@{
- int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
- int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
+ int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
int createMenu( const int, const int, const int = -1, const int = -1 );
int createMenu( const int, const QString&, const int = -1, const int = -1 );
int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
//@}
int registerAction( const int, QAction* );
+ bool unregisterAction( const int );
+ bool unregisterAction( QAction* );
QAction* createAction( const int, const QString&, const QIconSet&, const QString&,
const QString&, const int, QObject* = 0,
const bool = false, QObject* = 0, const char* = 0 );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAM_RootObject.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAM_ROOTOBJECT_H
#define CAM_ROOTOBJECT_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CAM_Study.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef CAM_STUDY_H
#define CAM_STUDY_H
#pragma warning( disable:4251 )
#endif
+/*!
+ \class CAM_Study
+ Represents study for using in CAM, contains list of
+ data model references from all modules. Provides
+ necessary functionality for data models management.
+*/
class CAM_EXPORT CAM_Study : public SUIT_Study
{
Q_OBJECT
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : CAM
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
msgid "ERROR_ACTIVATE_MODULE_MSG"
msgstr "Failed to activate module %1"
-
-msgid "BUT_OK"
-msgstr "Ok"
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef DDS_H
#define DDS_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "DDS_DicGroup.h"
#include "DDS_Dictionary.h"
LDOM_NodeList systemList = systems.getElementsByTagName( DDS_Dictionary::KeyWord( "UNIT_SYSTEM" ) );
for ( Standard_Integer i = 0; i < systemList.getLength(); i++ )
{
- LDOM_Element aSystem = (const LDOM_Element &)systemList.item( i );
+ //const LDOM_Element& aSystem = (const LDOM_Element &)systemList.item( i );
+ LDOM_Node aNode = systemList.item( i );
+ const LDOM_Element& anElem = (const LDOM_Element&) aNode;
+ LDOM_Element aSystem(anElem);
TCollection_AsciiString aName = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_NAME" ) );
TCollection_ExtendedString aLabel = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_LABEL" ) );
for ( Standard_Integer i = 0; i < aData.getLength(); i++ )
{
- LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i );
+ //LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i );
+ LDOM_Node aNode = aData.item( i );
+ const LDOM_Element& anElem = (const LDOM_Element&) aNode;
+ LDOM_Element aQuantity(anElem);
// 1. Attributes (id,label,units?,format?,required?)
TCollection_AsciiString anID = aQuantity.getAttribute( DDS_Dictionary::KeyWord( "DATUM_ID" ) );
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef DDS_DICGROUP_H
#define DDS_DICGROUP_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "DDS_DicItem.h"
#include "DDS_Dictionary.h"
if ( aListValueID.IsIntegerValue() )
{
// Read the text in the element "value"
- LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
+ //LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
+ LDOM_Node aNode = aListItemValue.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aListItemTxt(aText);
if ( !aListItemTxt.isNull() )
{
// adding ID and text value to sequence
if ( !aShDescr.isNull() )
{
// text is always a sub-node of element, containing it
- LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild();
+ //LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild();
+ LDOM_Node aNode = aShDescr.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aShDescrTxt(aText);
if ( !aShDescrTxt.isNull() )
aShortD = aShDescrTxt.getData();
}
if ( !aLDescr.isNull() )
{
// text is always a sub-node of element, containing it
- LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild();
+ //LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild();
+ LDOM_Node aNode = aLDescr.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aLDescrTxt(aText);
if ( !aLDescrTxt.isNull() )
aLongD = aLDescrTxt.getData();
}
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef DDS_DICITEM_H
#define DDS_DICITEM_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "DDS_Dictionary.h"
#include "DDS_KeyWords.h"
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef DDS_DICTIONARY_H
#define DDS_DICTIONARY_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "DDS_KeyWords.h"
IMPLEMENT_STANDARD_HANDLE(DDS_KeyWords, MMgt_TShared)
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef DDS_KEYWORDS_H
#define DDS_KEYWORDS_H
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Alexander SOLOVYOV (OCN)
# Module : DDS
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
// File: SalomeApp.h
// Created: November, 2004
// Author: OCC team
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
LIB = libEvent.la
LIB_SRC = SALOME_Event.cxx
-CPPFLAGS+=$(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS+=$(QT_INCLUDES) $(KERNEL_CXXFLAGS)
LDFLAGS+=$(QT_MT_LIBS)
@CONCLUDE@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
static pthread_t myThread;
#endif
+/*!
+ \return thread id
+*/
void SALOME_Event::GetSessionThread(){
#ifdef WIN32
myThread = ::GetCurrentThreadId();
#endif
}
+/*!
+ \return true if it is session thread
+*/
bool SALOME_Event::IsSessionThread(){
bool aResult = false;
#ifdef WIN32
}
-//===========================================================
/*!
- * SALOME_Event::SALOME_Event
- * Constructor
- */
-//===========================================================
+ Constructor
+*/
SALOME_Event::SALOME_Event(){
// if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this );
// Prepare the semaphore
*mySemaphore += 2;
}
-//===========================================================
/*!
- * SALOME_Event::~SALOME_Event
- * Destructor
- */
-//===========================================================
+ Destructor
+*/
SALOME_Event::~SALOME_Event(){
// if(MYDEBUG) MESSAGE( "SALOME_Event::~SALOME_Event(): this = "<<this );
if ( mySemaphore->available() < mySemaphore->total() )
delete mySemaphore;
}
-//===========================================================
/*!
- * SALOME_Event::process
- * Posts the event and optionally waits for its completion
- */
-//===========================================================
+ Posts the event and optionally waits for its completion
+*/
void SALOME_Event::process()
{
QThread::postEvent( qApp, new QCustomEvent( SALOME_EVENT, (void*)this ) );
// if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<" - COMPLETED" );
}
-//===========================================================
/*!
- * SALOME_Event::processed
- * Signals that this event has been processed
- */
-//===========================================================
+ Signals that this event has been processed
+*/
void SALOME_Event::processed()
{
// if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class QSemaphore;
-//===========================================================
/*!
- * Class: SALOME_Event
+ * \class SALOME_Event
* Description:
* This class encapsulates data and functionality required for
* posting component-specific events to perform arbitrary operations in main GUI thread.
* Caveats:
* There is no.
*/
-//===========================================================
#include <Event.h>
};
-// Template classes for member function
-//-------------------------------------
-template<class TObject, typename TRes>
-class TMemFunEvent: public SALOME_Event{
+/*!
+ \class TMemFunEvent
+ \brief Template class for member function
+*/
+template<class TObject, typename TRes> class /*EVENT_EXPORT */TMemFunEvent: public SALOME_Event{
public:
typedef TRes TResult;
TResult myResult;
};
-template<class TObject>
-class TVoidMemFunEvent: public SALOME_Event{
+/*!
+ \class TVoidMemFunEvent
+ \brief Template class for member function
+*/
+template<class TObject> class /*EVENT_EXPORT*/ TVoidMemFunEvent: public SALOME_Event{
public:
typedef void (TObject::* TAction)();
TVoidMemFunEvent(TObject* theObject, TAction theAction):
};
-// Template for member function with one argument
-//-----------------------------------------------
-template<class TObject, typename TRes,
- typename TArg, typename TStoreArg = TArg>
-class TMemFun1ArgEvent: public SALOME_Event{
+/*!
+ \class TMemFun1ArgEvent
+ \brief Template for member function with one argument
+*/
+template<class TObject, typename TRes, typename TArg, typename TStoreArg = TArg> class /*EVENT_EXPORT*/ TMemFun1ArgEvent:
+public SALOME_Event{
public:
typedef TRes TResult;
TResult myResult;
};
-template<class TObject, typename TArg, typename TStoreArg = TArg>
-class TVoidMemFun1ArgEvent: public SALOME_Event{
+/*!
+ \class TVoidMemFun1ArgEvent
+ \brief Template for member function with one argument
+*/
+template<class TObject, typename TArg, typename TStoreArg = TArg> class /*EVENT_EXPORT*/ TVoidMemFun1ArgEvent: public SALOME_Event{
public:
typedef void (TObject::* TAction)(TArg);
TVoidMemFun1ArgEvent(TObject* theObject, TAction theAction, TArg theArg):
};
-// Template for member function with one argument
-//-----------------------------------------------
-template<class TObject, typename TRes,
- typename TArg, typename TArg1,
- typename TStoreArg = TArg, typename TStoreArg1 = TArg1>
-class TMemFun2ArgEvent: public SALOME_Event{
+/*!
+ \class TMemFun2ArgEvent
+ \brief Template for member function with two arguments
+*/
+template<class TObject, typename TRes, typename TArg, typename TArg1, typename TStoreArg = TArg, typename TStoreArg1 = TArg1> class
+/*EVENT_EXPORT*/ TMemFun2ArgEvent: public SALOME_Event{
public:
typedef TRes TResult;
TResult myResult;
};
-template<class TObject, typename TArg, typename TArg1,
- typename TStoreArg = TArg, typename TStoreArg1 = TArg1>
-class TVoidMemFun2ArgEvent: public SALOME_Event{
+/*!
+ \class TVoidMemFun2ArgEvent
+ \brief Template for member function with two arguments
+*/
+template<class TObject, typename TArg, typename TArg1, typename TStoreArg = TArg, typename TStoreArg1 = TArg1> class
+/*EVENT_EXPORT*/ TVoidMemFun2ArgEvent: public SALOME_Event{
public:
typedef void (TObject::* TAction)(TArg,TArg1);
TVoidMemFun2ArgEvent(TObject* theObject, TAction theAction, TArg theArg, TArg1 theArg1):
};
-// Template function for processing events with result returing
+/*!
+ \fn ProcessEvent
+ \brief Template function for processing events with result returing
+*/
template<class TEvent> inline typename TEvent::TResult ProcessEvent(TEvent* theEvent){
typename TEvent::TResult aResult;
if(SALOME_Event::IsSessionThread()){
}
-// Template function for processing events without result
+/*!
+ \fn ProcessEvent
+ \brief Template function for processing events without result
+*/
inline void ProcessVoidEvent(SALOME_Event* theEvent){
if(SALOME_Event::IsSessionThread()){
theEvent->Execute();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_AspectLine.cxx
// Created: 26/05/2005 3:17:00 PM
-//================================================================
-// Class : GLViewer_AspectLine
-// Description : Substitution of Prs2d_AspectLine for OpenGL
-//================================================================
#include "GLViewer_AspectLine.h"
-//=======================================================================
-// Function: GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+ Default constructor
+*/
GLViewer_AspectLine::GLViewer_AspectLine()
{
myNColor = QColor( 255, 255, 255 );
myLineType = 0;
}
-//=======================================================================
-// Function: GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param type: 0 for normal line and 1 for strip line
+ \param width - width of line
+*/
GLViewer_AspectLine::GLViewer_AspectLine( int type, float width )
{
myNColor = QColor( 255, 255, 255 );
myLineType = 0;
}
-//=======================================================================
-// Function: ~GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_AspectLine::~GLViewer_AspectLine()
{
}
-//=======================================================================
-// Function: setLineColors
-// Purpose :
-//=======================================================================
+/*!
+ Sets line color
+ \param nc - normal color
+ \param hc - hilighting color
+ \param sc - selection color
+*/
void GLViewer_AspectLine::setLineColors( QColor nc, QColor hc, QColor sc )
{
myNColor = nc;
mySColor = sc;
}
-//=======================================================================
-// Function: setLineType
-// Purpose :
-//=======================================================================
+/*!
+ Sets type of line
+ \param type: 0 for normal line and 1 for strip line
+*/
int GLViewer_AspectLine::setLineType( const int type )
{
if( type == 1 || type == 0 )
return 1;
}
-//=======================================================================
-// Function: setLineWidth
-// Purpose :
-//=======================================================================
+/*!
+ Sets width of line
+ \param width - new width of line
+*/
int GLViewer_AspectLine::setLineWidth( const float width )
{
if( width > 0 )
return 1;
}
-//=======================================================================
-// Function: getLineColors
-// Purpose :
-//=======================================================================
+/*!
+ \return colors of line
+ \param nc - variable for normal color
+ \param hc - variable for hilighting color
+ \param sc - variable for selection color
+*/
void GLViewer_AspectLine::getLineColors( QColor& nc, QColor& hc, QColor& sc ) const
{
nc = myNColor;
sc = mySColor;
}
-//=======================================================================
-// Function: getByteCopy
-// Purpose :
-//=======================================================================
+/*!
+ \return binary representation of line aspect
+*/
QByteArray GLViewer_AspectLine::getByteCopy() const
{
int anISize = sizeof( int );
return aResult;
}
-//=======================================================================
-// Function: fromByteCopy
-// Purpose :
-//=======================================================================
+/*!
+ Sets line aspect from binary representation
+*/
GLViewer_AspectLine* GLViewer_AspectLine::fromByteCopy( QByteArray theBytes )
{
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#endif
/*!
- * Class GLViewer_AspectLine
- * Substitution of Prs2d_AspectLine for OpenGL
- */
+ \Class GLViewer_AspectLine
+ Substitution of Prs2d_AspectLine for OpenGL
+*/
class GLVIEWER_API GLViewer_AspectLine
{
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#include <GL/glx.h>
#endif
-/***************************************************************************
-** Class: GLViewer_MarkerDrawer
-** Descr: Drawer for GLViewer_MarkerSet
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
-
GLfloat sin_table[SEGMENTS];
GLfloat cos_table[SEGMENTS];
+/*!
+ Default constructor
+*/
GLViewer_MarkerDrawer::GLViewer_MarkerDrawer()
: GLViewer_Drawer()
{
myObjectType = "GLViewer_MarkerSet";
}
+/*!
+ Destructor
+*/
GLViewer_MarkerDrawer::~GLViewer_MarkerDrawer()
{
}
+/*! Draws object in GLViewer
+ \param xScale - current scale along X-direction
+ \param yScale - current scale along Y-direction
+ \param onlyUpdate - = true if only update highlight-select information
+*/
void GLViewer_MarkerDrawer::create( float xScale, float yScale, bool onlyUpdate )
{
QValueList<int>::Iterator it;
}
}
+/*! Draws marker
+ \param theXCoord - X position
+ \param theYCoord - Y position
+ \param theRadius - radius
+ \param theColor - color
+ \param theAspectLine - line aspect
+*/
void GLViewer_MarkerDrawer::drawMarker( float& theXCoord, float& theYCoord,
float& theRadius, QColor& theColor, GLViewer_AspectLine* theAspectLine )
{
glEnd();
}
-/***************************************************************************
-** Class: GLViewer_PolylineDrawer
-** Descr: Drawer for GLViewer_Polyline
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
+/*!
+ Default constructor
+*/
GLViewer_PolylineDrawer::GLViewer_PolylineDrawer()
:GLViewer_Drawer()
{
myObjectType = "GLViewer_Polyline";
}
+/*!
+ Destructor
+*/
GLViewer_PolylineDrawer::~GLViewer_PolylineDrawer()
{
}
+/*! Draws object in GLViewer
+ \param xScale - current scale along X-direction
+ \param yScale - current scale along Y-direction
+ \param onlyUpdate - = true if only update highlight-select information
+*/
void GLViewer_PolylineDrawer::create( float xScale, float yScale, bool onlyUpdate )
{
QValueList<GLViewer_Object*>::Iterator aObjectIt = myObjects.begin();
}
}
-/***************************************************************************
-** Class: GLViewer_TextDrawer
-** Descr:
-** Module: GLViewer
-** Created: UI team, 27.02.04
-****************************************************************************/
-
+/*!
+ Default constructor
+*/
GLViewer_TextDrawer::GLViewer_TextDrawer()
: GLViewer_Drawer()
{
myObjectType = "GLViewer_TextObject";
}
+/*!
+ Destructor
+*/
GLViewer_TextDrawer::~GLViewer_TextDrawer()
{
}
+/*! Draws object in GLViewer
+ \param xScale - current scale along X-direction
+ \param yScale - current scale along Y-direction
+ \param onlyUpdate - = true if only update highlight-select information
+*/
void GLViewer_TextDrawer::create( float xScale, float yScale, bool onlyUpdate )
{
QValueList<GLViewer_Object*>::Iterator aObjectIt = myObjects.begin();
}
}
+/*!
+ Updates objects after updating font
+*/
void GLViewer_TextDrawer::updateObjects()
{
QValueList<GLViewer_Object*>::Iterator aObjectIt = myObjects.begin();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#pragma warning( disable:4251 )
#endif
-/*! Class GLViewer_MarkerDrawer
-* Drawer for GLViewer_MarkerSet
- */
+/*!
+ \class GLViewer_MarkerDrawer
+ Drawer for GLViewer_MarkerSet
+*/
class GLVIEWER_API GLViewer_MarkerDrawer : public GLViewer_Drawer
{
void drawMarker( float& x, float& y, float& radius, QColor& color, GLViewer_AspectLine* aspect );
};
-/*! Class GLViewer_PolylineDrawer
-* Drawer for GLViewer_Polyline
+/*!
+ \class GLViewer_PolylineDrawer
+ Drawer for GLViewer_Polyline
*/
class GLVIEWER_API GLViewer_PolylineDrawer : public GLViewer_Drawer
virtual void create( float, float, bool );
};
-/* Class GLViewer_TextDrawer
-* Drawer for GLViewer_Text
+/*!
+ \class GLViewer_TextDrawer
+ Drawer for GLViewer_Text
*/
class GLVIEWER_API GLViewer_TextDrawer: public GLViewer_Drawer
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_BaseObjects
-** Descr: Internal OpenGL Objects
-** Module: GLViewer
-** Created: UI team, 02.09.02
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_BaseObjects.h"
#include "GLViewer_BaseDrawers.h"
//#include <cmath>
//using namespace std;
-/***************************************************************************
-** Class: GLViewer_MarkerSet
-** Descr: OpenGL MarkerSet
-** Module: GLViewer
-** Created: UI team, 03.09.02
-****************************************************************************/
-
+/*!
+ Constructor
+*/
GLViewer_MarkerSet::GLViewer_MarkerSet( int number, float size, const QString& toolTip ) :
GLViewer_Object(),
myNumber( 0 ),
setNumMarkers( number );
}
+/*!
+ Destructor
+*/
GLViewer_MarkerSet::~GLViewer_MarkerSet()
{
if ( myXCoord )
delete[] myYCoord;
}
+/*!
+ Adds coords to text buffer in HPGL format
+ \param buffer - text buffer
+ \param command - command to be added with coords
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+ \param x - x co-ordinate
+ \param y - y co-ordinate
+ \param NewLine - adds new line to buffer
+*/
void AddCoordsToHPGL( QString& buffer, QString command, GLViewer_CoordSystem* aViewerCS,
GLViewer_CoordSystem* aPaperCS, double x, double y, bool NewLine = true )
{
buffer += ";\n";
}
+/*!
+ Adds coords to text buffer in PostScript format
+ \param buffer - text buffer
+ \param command - command to be added with coords
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+ \param x - x co-ordinate
+ \param y - y co-ordinate
+ \param NewLine - adds new line to buffer
+*/
void AddCoordsToPS( QString& buffer, QString command, GLViewer_CoordSystem* aViewerCS,
GLViewer_CoordSystem* aPaperCS, double x, double y, bool NewLine = true )
{
buffer += "\n";
}
+/*!
+ Adds line aspect description to text buffer in PostScript format
+ \param buffer - text buffer
+ \param anAspect - line aspect
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+*/
void AddLineAspectToPS( QString& buffer, GLViewer_AspectLine* anAspect,
GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPaperCS )
{
}
#ifdef WIN32
+/*!
+ Adds line aspect description EMF image
+ \param hDC - descriptor of EMF
+ \param anAspect - line aspect
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+*/
HPEN AddLineAspectToEMF( HDC hDC, GLViewer_AspectLine* anAspect,
GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPaperCS )
{
}
#endif
+/*!
+ Saves to file PostScript set of markers
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aPSCS - paper co-ordinates system
+*/
bool GLViewer_MarkerSet::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
int noPoints = 20;
return true;
}
+/*!
+ Saves to file HPGL set of markers
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aHPGLCS - paper co-ordinates system
+*/
bool GLViewer_MarkerSet::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS,
GLViewer_CoordSystem* aHPGLCS )
{
}
#ifdef WIN32
+/*!
+ Saves to EMF image set of markers
+ \param dc - EMF image descriptor
+ \param aViewerCS - viewer co-ordinates system
+ \param aEMFCS - paper co-ordinates system
+*/
bool GLViewer_MarkerSet::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
int noPoints = 20;
}
#endif
-
+/*!
+ Computes all necessary information about object for presentation in drawer
+*/
void GLViewer_MarkerSet::compute()
{
// cout << "GLViewer_MarkerSet::compute" << endl;
myRect->setBottom( ya - myYGap );
}
+/*!
+ Creates corresponding drawer
+*/
GLViewer_Drawer* GLViewer_MarkerSet::createDrawer()
{
// cout << "GLViewer_MarkerSet::createDrawer" << endl;
return myDrawer = new GLViewer_MarkerDrawer();
}
-
+/*!
+ Computes highlight presentation
+ \param x - x coord
+ \param y - y coord
+ \param tol - tolerance of detecting
+ \param isCircle - true if sensitive area of detection is round
+ \return true if highlight status is changed
+*/
GLboolean GLViewer_MarkerSet::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle )
{
if( !myIsVisible )
return update;
}
+/*!
+ Unhilights object
+*/
GLboolean GLViewer_MarkerSet::unhighlight()
{
if( !myHNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ Selects marker set
+ /param x, y - co-ordinates of mouse
+ /param tol - tolerance
+ /param rect - rectangle (in case of rectangular selection)
+ /param isFull - if it is true, then object may selected only if it lays whole in selection zone
+ \param isCircle - true if sensitive area of detection is round
+ \param isShift - true if selection exec with append option
+*/
GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull,
GLboolean isCircle, GLboolean isShift )
{
return myIsSel;
}
+/*!
+ Unselects marker set
+*/
GLboolean GLViewer_MarkerSet::unselect()
{
if( !mySelNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ \return update object rectangle
+ Does not equal getRect() if object have a persistence to some viewer transformations
+*/
GLViewer_Rect* GLViewer_MarkerSet::getUpdateRect()
{
GLViewer_Rect* rect = new GLViewer_Rect();
return rect;
}
-
+/*!
+ Sets array of x coords of points
+ \param xCoord - array of co-ordinates
+ \param size - array size
+*/
void GLViewer_MarkerSet::setXCoord( GLfloat* xCoord, int size )
{
myXCoord = new GLfloat[ size ];
myXCoord[i] = xCoord[i];
}
+/*!
+ Sets array of y coords of points
+ \param yCoord - array of co-ordinates
+ \param size - array size
+*/
void GLViewer_MarkerSet::setYCoord( GLfloat* yCoord, int size )
{
myYCoord = new GLfloat[ size ];
myYCoord[i] = yCoord[i];
}
+/*!
+ Sets number of markers
+ \param number - new number of markers
+*/
void GLViewer_MarkerSet::setNumMarkers( GLint number )
{
if ( myNumber == number )
myXCoord = new GLfloat[ myNumber ];
myYCoord = new GLfloat[ myNumber ];
}
-/*
-void GLViewer_MarkerSet::onSelectionDone( bool append)
-{
- mySelectedIndexes.Clear();
- QValueList<int>::Iterator it;
- //for( it = myMarkers->mySelNumbers.begin(); it != myMarkers->mySelNumbers.end(); ++it )
- // mySelectedIndexes.Append( *it / 2 ); //!!!
- emit dvMarkersSelected( mySelectedIndexes );
-}
-void GLViewer_MarkerSet::onSelectionCancel()
-{
- mySelectedIndexes.Clear();
- emit dvMarkersSelected( mySelectedIndexes );
-}
+/*!
+ Export numbers of highlighted/selected lines
*/
void GLViewer_MarkerSet::exportNumbers( QValueList<int>& highlight,
QValueList<int>& unhighlight,
myUHNumbers = myHNumbers;
}
+/*!
+ Adds or remove selected number
+ \param index - selected index
+*/
bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
{
if( index < 0 || index > myNumber )
return TRUE;
}
+/*!
+ Adds some selected numbers
+ \param seq - sequence of indices
+*/
void GLViewer_MarkerSet::addSelected( const TColStd_SequenceOfInteger& seq )
{
for ( int i = 1; i <= seq.Length(); i++ )
mySelNumbers.append( seq.Value( i ) - 1 );
}
+/*!
+ Sets some numbers as selected
+ \param seq - sequence of indices
+*/
void GLViewer_MarkerSet::setSelected( const TColStd_SequenceOfInteger& seq )
{
// for( QValueList<int>::Iterator it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
mySelNumbers.append( seq.Value( i ) - 1 );
}
+/*! Moves object by recomputing
+ \param dx - moving along X coord
+ \param dy - moving along Y coord
+ \param fromGroup - is true if this method called from group
+*/
void GLViewer_MarkerSet::moveObject( float theX, float theY, bool fromGroup )
{
if( !fromGroup && myGroup)
compute();
}
+/*!
+ Codes marker set as byte copy
+ \return byte array
+*/
QByteArray GLViewer_MarkerSet::getByteCopy()
{
int i = 0;
return aResult;
}
+/*!
+ Initialize marker set by byte array
+ \param theArray - byte array
+*/
bool GLViewer_MarkerSet::initializeFromByteCopy( QByteArray theArray )
{
int i = 0;
return true;
}
-/***************************************************************************
-** Class: GLViewer_Polyline
-** Descr: OpenGL Polyline
-** Module: GLViewer
-** Created: UI team, 03.09.02
-****************************************************************************/
+/*!
+ \class GLViewer_Polyline
+ OpenGL Polyline
+*/
#define SECTIONS 100
#define DISTANTION 5
+/*!
+ Constructor
+ \param number - number of segments
+ \param size - size of polyline
+ \param toolTip - tool tip of polyline
+*/
GLViewer_Polyline::GLViewer_Polyline( int number, float size, const QString& toolTip ):
GLViewer_Object(),
myNumber( 0 ),
myToolTipText = toolTip;
}
+/*!
+ Destructor, destroys internal arrays of co-ordinates
+*/
GLViewer_Polyline::~GLViewer_Polyline()
{
if ( myXCoord )
delete[] myYCoord;
}
+/*!
+ Saves polyline to file PostScript
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aPSCS - paper co-ordinates system
+*/
bool GLViewer_Polyline::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
QString aBuffer = "newpath\n";
return true;
}
+/*!
+ Saves polyline to file HPGL
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aHPGLCS - paper co-ordinates system
+*/
bool GLViewer_Polyline::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS )
{
QString aBuffer = "";
}
#ifdef WIN32
+/*!
+ Saves polyline to EMF image
+ \param dc - EMF image descriptor
+ \param aViewerCS - viewer co-ordinates system
+ \param aEMFCS - paper co-ordinates system
+*/
bool GLViewer_Polyline::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
if( !aViewerCS || !aEMFCS )
}
#endif
+/*!
+ Computes all necessary information about object for presentation in drawer
+*/
void GLViewer_Polyline::compute()
{
// cout << "GLViewer_MarkerSet::compute" << endl;
myRect->setBottom( ya - yGap );
}
+/*!
+ \return update object rectangle
+ Does not equal getRect() if object have a persistence to some viewer transformations
+*/
GLViewer_Rect* GLViewer_Polyline::getUpdateRect()
{
GLViewer_Rect* rect = new GLViewer_Rect();
return rect;
}
+/*!
+ Creates corresponding drawer
+*/
GLViewer_Drawer* GLViewer_Polyline::createDrawer()
{
// cout << "GLViewer_MarkerSet::createDrawer" << endl;
return myDrawer = new GLViewer_PolylineDrawer();
}
+/*!
+ Computes highlight presentation
+ \param x - x coord
+ \param y - y coord
+ \param tol - tolerance of detecting
+ \param isCircle - true if sensitive area of detection is round
+ \return true if highlight status is changed
+*/
GLboolean GLViewer_Polyline::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle )
{
if( !myIsVisible )
return update;
}
+/*!
+ Unhilights object
+*/
GLboolean GLViewer_Polyline::unhighlight()
{
// if( !myHNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ Selects polyline
+ /param x, y - co-ordinates of mouse
+ /param tol - tolerance
+ /param rect - rectangle (in case of rectangular selection)
+ /param isFull - if it is true, then object may selected only if it lays whole in selection zone
+ \param isCircle - true if sensitive area of detection is round
+ \param isShift - true if selection exec with append option
+*/
GLboolean GLViewer_Polyline::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull,
GLboolean isCircle, GLboolean isShift )
{
return myIsSel;
}
+/*!
+ Unselects polyline
+*/
GLboolean GLViewer_Polyline::unselect()
{
// if( !mySelNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ Sets array of abscisses for points of polyline
+ \param xCoord - array of of abscisses
+ \param size - size of array
+*/
void GLViewer_Polyline::setXCoord( GLfloat* xCoord, int size )
{
myXCoord = new GLfloat[ size ];
myXCoord[i] = xCoord[i];
}
+/*!
+ Sets array of ordinates for points of polyline
+ \param xCoord - array of of ordinates
+ \param size - size of array
+*/
void GLViewer_Polyline::setYCoord( GLfloat* yCoord, int size )
{
myYCoord = new GLfloat[ size ];
myYCoord[i] = yCoord[i];
}
+/*!
+ Sets number of points
+ \param number - new number of points
+*/
void GLViewer_Polyline::setNumber( GLint number )
{
if ( myNumber == number )
myXCoord = new GLfloat[ myNumber ];
myYCoord = new GLfloat[ myNumber ];
}
-/*
-void GLViewer_Polyline::onSelectionDone( bool append)
-{
- mySelectedIndexes.Clear();
- QValueList<int>::Iterator it;
- //for( it = myMarkers->mySelNumbers.begin(); it != myMarkers->mySelNumbers.end(); ++it )
- // mySelectedIndexes.Append( *it / 2 ); //!!!
-}
-void GLViewer_Polyline::onSelectionCancel()
-{
- mySelectedIndexes.Clear();
-}
+/*!
+ Export numbers of highlighted/selected lines
*/
void GLViewer_Polyline::exportNumbers( QValueList<int>& highlight,
QValueList<int>& unhighlight,
unselect = myUSelNumbers;
}
+/*!
+ Moves object by recomputing
+ \param dx - moving along X coord
+ \param dy - moving along Y coord
+ \param fromGroup - is true if this method called from group
+*/
void GLViewer_Polyline::moveObject( float theX, float theY, bool fromGroup )
{
if( !fromGroup && myGroup)
compute();
}
+/*!
+ Codes polyline as byte copy
+ \return byte array
+*/
QByteArray GLViewer_Polyline::getByteCopy()
{
int i = 0;
}
+/*!
+ Initialize polyline by byte array
+ \param theArray - byte array
+*/
bool GLViewer_Polyline::initializeFromByteCopy( QByteArray theArray )
{
int i = 0;
return true;
}
-/***************************************************************************
-** Class: GLViewer_TextObject
-** Descr: Text as Object for OpenGL
-** Module: GLViewer
-** Created: UI team, 12.02.04
-****************************************************************************/
+
+/*!
+ Constructor
+ \param theStr - text string
+ \param xPos - x position
+ \param yPos - y position
+ \param color - color of text
+ \param toolTip - tooltip of text object
+*/
GLViewer_TextObject::GLViewer_TextObject( const QString& theStr, float xPos, float yPos,
const QColor& color, const QString& toolTip )
: GLViewer_Object()
myToolTipText = toolTip;
}
+
+/*!
+ Destructor
+*/
GLViewer_TextObject::~GLViewer_TextObject()
{
if ( myGLText )
delete myGLText;
}
+/*!
+ Saves text object to file PostScript
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aPSCS - paper co-ordinates system
+*/
bool GLViewer_TextObject::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
QString aText = myGLText->getText();
return true;
}
+/*!
+ Saves text object to file HPGL
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aHPGLCS - paper co-ordinates system
+*/
bool GLViewer_TextObject::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS )
{
QString aText = myGLText->getText();
}
#ifdef WIN32
+/*!
+ Saves text object to EMF image
+ \param dc - EMF image descriptor
+ \param aViewerCS - viewer co-ordinates system
+ \param aEMFCS - paper co-ordinates system
+*/
bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
QString aText = myGLText->getText();
}
#endif
+/*!
+ Creates corresponding drawer
+*/
GLViewer_Drawer* GLViewer_TextObject::createDrawer()
{
myDrawer = new GLViewer_TextDrawer();
return myDrawer;
}
+/*!
+ Computes all necessary information about object for presentation in drawer
+*/
void GLViewer_TextObject::compute()
{
float xPos, yPos;
myRect->setBottom( yPos );
}
+/*!
+ Installing already exist drawer with same type
+ \param theDrawer - new drawer
+*/
void GLViewer_TextObject::setDrawer( GLViewer_Drawer* theDrawer )
{
myDrawer = theDrawer;
//compute();
}
+/*!
+ \return update object rectangle
+ Does not equal getRect() if object have a persistence to some viewer transformations
+*/
GLViewer_Rect* GLViewer_TextObject::getUpdateRect()
{
GLViewer_Rect* rect = new GLViewer_Rect();
return rect;
}
+/*!
+ Computes highlight presentation
+ \param x - x coord
+ \param y - y coord
+ \param tol - tolerance of detecting
+ \param isCircle - true if sensitive area of detection is round
+ \return true if highlight status is changed
+*/
GLboolean GLViewer_TextObject::highlight( GLfloat theX, GLfloat theY, GLfloat theTol, GLboolean isCircle )
{
if( !myIsVisible )
return myIsHigh;
}
+/*!
+ Unhilights object
+*/
GLboolean GLViewer_TextObject::unhighlight()
{
if( myIsHigh )
return GL_FALSE;
}
+/*!
+ Selects text object
+ /param x, y - co-ordinates of mouse
+ /param tol - tolerance
+ /param rect - rectangle (in case of rectangular selection)
+ /param isFull - if it is true, then object may selected only if it lays whole in selection zone
+ \param isCircle - true if sensitive area of detection is round
+ \param isShift - true if selection exec with append option
+*/
GLboolean GLViewer_TextObject::select( GLfloat theX, GLfloat theY, GLfloat theTol, GLViewer_Rect rect,
GLboolean isFull, GLboolean isCircle, GLboolean isShift )
{
return myIsSel;
}
+/*!
+ Unselects text object
+*/
GLboolean GLViewer_TextObject::unselect()
{
if( myIsSel )
return GL_FALSE;
}
+/*!
+ Moves object by recomputing
+ \param dx - moving along X coord
+ \param dy - moving along Y coord
+ \param fromGroup - is true if this method called from group
+*/
void GLViewer_TextObject::moveObject( float theX, float theY, bool fromGroup )
{
if( !fromGroup && myGroup)
compute();
}
+/*!
+ Codes text object as byte copy
+ \return byte array
+*/
QByteArray GLViewer_TextObject::getByteCopy()
{
QByteArray aObject = GLViewer_Object::getByteCopy();
return aObject;
}
+/*!
+ Initialize text object by byte array
+ \param theArray - byte array
+*/
bool GLViewer_TextObject::initializeFromByteCopy( QByteArray theArray )
{
if( !GLViewer_Object::initializeFromByteCopy( theArray ) || myType != "GLViewer_TextObject" )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#endif
/*!
- * Class GLViewer_MarkerSet
- * OpenGL MarkerSet
- */
-
+ \class GLViewer_MarkerSet
+ OpenGL MarkerSet
+*/
class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object
{
public:
};
/*!
- * Class GLViewer_Polyline
- * OpenGL Polyline
- */
-
+ \class GLViewer_Polyline
+ OpenGL Polyline
+*/
class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
{
public:
//! Checks highlight as whole object status
GLboolean isHighSelAll() const { return myHighSelAll; }
- //! Export numbers of heghlighted/selected lines
+ //! Export numbers of highlighted/selected lines
void exportNumbers( QValueList<int>& high, QValueList<int>& unhigh,
QValueList<int>& sel, QValueList<int>& unsel );
GLboolean myHighFlag;
};
-// Class: GLViewer_TextObject
-// Descr: Text as Object for OpenGL
-
+/*!
+ \class GLViewer_TextObject
+ Text as Object for OpenGL
+*/
class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Compass.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_Compass
-// Description : Class implement representatiof of compass in one of corner in GLViewer
-//================================================================
-
#include "GLViewer_Compass.h"
#include "GLViewer_Drawer.h"
-//=======================================================================
-// Function: GLViewer_Compass
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param color - a color of compass
+ \param size - a diameter of compass
+ \param pos - a position
+ \param WidthTop - width of wide part of arrow
+ \param WidthBottom - width of base part of arrow
+ \param HeightTop - height of arrow header
+ \param HeightBottom - height of arrow cut on bottom
+*/
GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
const int WidthTop, const int WidthBottom, const int HeightTop,
const int HeightBottom )
//myFont->generateTexture();
}
-//=======================================================================
-// Function: ~GLViewer_Compass
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Compass::~GLViewer_Compass()
{
delete myFont;
}
-//=======================================================================
-// Function: setCompass
-// Purpose :
-//=======================================================================
+/*!
+ Sets parameters of compass
+ \param color - a color of compass
+ \param size - a diameter of compass
+ \param pos - a position
+*/
void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
{
myCol = color;
myPos = pos;
}
-//=======================================================================
-// Function: setVisible
-// Purpose :
-//=======================================================================
+/*!
+ Sets visibility of compass
+ \param vis - new visibility state
+*/
void GLViewer_Compass::setVisible( const bool vis )
{
myIsVisible = vis;
}
-//=======================================================================
-// Function: setSize
-// Purpose :
-//=======================================================================
+/*!
+ Sets size of compass
+ \param size - new size
+*/
void GLViewer_Compass::setSize( const int size )
{
if( size > 0 )
mySize=size;
}
-//=======================================================================
-// Function: setArrowWidthTop
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow width top
+ \param WidthTop - new arrow width top
+*/
void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
{
if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
myArrowWidthTop=WidthTop;
}
-//=======================================================================
-// Function: setArrowWidthBottom
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow width bottom
+ \param WidthBot - new arrow width bottom
+*/
void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
{
if( WidthBot > myArrowWidthTop || WidthBot < 1 )
myArrowWidthBottom=WidthBot;
}
-//=======================================================================
-// Function: setArrowHeightTop
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow height top
+ \param HeightTop - new arrow height top
+*/
void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
{
if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
myArrowHeightTop=HeightTop;
}
-//=======================================================================
-// Function: setArrowHeightBottom
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow height bottom
+ \param HeightBot - new arrow height bottom
+*/
void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
{
if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
myArrowHeightBottom=HeightBot;
}
-//=======================================================================
-// Function: getFont
-// Purpose :
-//=======================================================================
+/*!
+ \return font of compass
+*/
GLViewer_TexFont* GLViewer_Compass::getFont()
{
if(!isGenereted)
return myFont;
}
-//=======================================================================
-// Function: setFont
-// Purpose :
-//=======================================================================
+/*!
+ Sets font of compass
+ \param theFont - new font
+*/
void GLViewer_Compass::setFont( QFont theFont )
{
delete myFont;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#pragma warning( disable:4251 )
#endif
+class GLViewer_TexFont;
+
/*! Class GLViewer_Compass
* Class implement representatiof of compass in one of corner in GLViewer.
* Compass it's a some round visual pointer rotated with view window and
* located in fixed place (in one fixed corner)
*/
-
-class GLViewer_TexFont;
-
class GLVIEWER_API GLViewer_Compass
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Context.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_AspectLine
-// Description : Class for manage of presentations in GLViewer
-//================================================================
+/*!
+ \class GLViewer_AspectLine
+ \brief Class for manage of presentations in GLViewer
+*/
#include "GLViewer_Context.h"
#define TOLERANCE 12
-//=======================================================================
-// Function: GLViewer_Context
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+*/
GLViewer_Context::GLViewer_Context( GLViewer_Viewer2d* v ) :
myGLViewer2d( v ),
myHighlightColor( Quantity_NOC_CYAN1 ),
mySelCurIndex = 0;
}
-//=======================================================================
-// Function: ~GLViewer_Context
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Context::~GLViewer_Context()
{
myActiveObjects.clear();
mySelectedObjects.clear();
}
-//=======================================================================
-// Function: MoveTo
-// Purpose :
-//=======================================================================
+/*!
+ Hiilights objects under cursor
+ \param x - X coord of mouse cursor
+ \param y - Y coord of mouse cursor
+ \param byCircle - true if needs round sensitive area around mouse cursor, else rectangle
+ function search object rectangle which intersect with sensitive area and call object highlight method
+*/
int GLViewer_Context::MoveTo( int xi, int yi, bool byCircle )
{
GLfloat x = (GLfloat)xi;
return 0;
}
-//=======================================================================
-// Function: Select
-// Purpose :
-//=======================================================================
+/*! Selects already highlighting object by calling object method select
+ \param Append - true if new selection will be append to existing selection, false - another
+ \param byCircle - true if needs round selection area in complex object
+*/
int GLViewer_Context::Select( bool Append, bool byCircle )
{
ObjList::Iterator it, itEnd, oit, oitEnd;
return SS_NoChanged;
}
-//=======================================================================
-// Function: SelectByRect
-// Purpose :
-//=======================================================================
+/*! Selects objects on scene by rectangle
+ \param theRect - rectangle of selection
+ \param Append - true if new selection will be append to existing selection, false - another
+ function search object rectangle which intersect with theRect and call object select method
+*/
int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append )
{
GLfloat aXScale;
return status;
}
-//=======================================================================
-// Function: SetHighlightColor
-// Purpose :
-//=======================================================================
+/*!
+ Sets color of hilighting
+ \param aCol - new color of highlighting
+*/
void GLViewer_Context::SetHighlightColor( Quantity_NameOfColor aCol )
{
myHighlightColor = aCol;
myGLViewer2d->updateColors( colH, colS);
}
-//=======================================================================
-// Function: SetSelectionColor
-// Purpose :
-//=======================================================================
+/*!
+ Sets color of selection
+ \param aCol - new color of selection
+*/
void GLViewer_Context::SetSelectionColor( Quantity_NameOfColor aCol )
{
mySelectionColor = aCol;
myGLViewer2d->updateColors( colH, colS);
}
-//=======================================================================
-// Function: NbSelected
-// Purpose :
-//=======================================================================
+/*!
+ \return number of selected objects
+*/
int GLViewer_Context::NbSelected()
{
return mySelectedObjects.count();
}
-//=======================================================================
-// Function: InitSelected
-// Purpose :
-//=======================================================================
+/*!
+ Inits iteration through selected objects
+*/
void GLViewer_Context::InitSelected()
{
mySelCurIndex = 0;
}
-//=======================================================================
-// Function: MoreSelected
-// Purpose :
-//=======================================================================
+/*!
+ Checks if iteration through selected objects may be continued
+*/
bool GLViewer_Context::MoreSelected()
{
return ( mySelCurIndex < NbSelected() );
}
-//=======================================================================
-// Function: NextSelected
-// Purpose :
-//=======================================================================
+/*!
+ Iterates to next selected object
+*/
bool GLViewer_Context::NextSelected()
{
if ( mySelCurIndex >= 0 && mySelCurIndex < NbSelected() )
return FALSE;
}
-//=======================================================================
-// Function: SelectedObject
-// Purpose :
-//=======================================================================
+/*!
+ \return current selected object (must be used only in cycle as "for( InitSelected(); MoreSelected(); NextSelected() ) {...}" )
+*/
GLViewer_Object* GLViewer_Context::SelectedObject()
{
return mySelectedObjects[ mySelCurIndex ];
}
-//=======================================================================
-// Function: isSelected
-// Purpose :
-//=======================================================================
+/*!
+ \return true if object is selected
+ \param theObj - object to be checked
+*/
bool GLViewer_Context::isSelected( GLViewer_Object* theObj )
{
return mySelectedObjects.contains( theObj );
}
-//=======================================================================
-// Function: insertObject
-// Purpose :
-//=======================================================================
+/*! Inserts new object in context
+ \param theObject - object to be inserted
+ \param display - true if needs display object immediatly after inserting, else false
+ \param isActive - true if needs inserting object in active list
+*/
int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool isActive )
{
// cout << "GLViewer_Context::insertObject" << endl;
return myActiveObjects.count() + myInactiveObjects.count();
}
-//=======================================================================
-// Function: replaceObject
-// Purpose :
-//=======================================================================
+/*!
+ Replaces object in context
+ \param oldObject - object to be replaced
+ \param newObject - object for replacing
+*/
bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject )
{
if( !oldObject || !newObject )
return false;
}
-//=======================================================================
-// Function: updateScales
-// Purpose :
-//=======================================================================
+/*!
+ Updates scales of all objects in context
+*/
void GLViewer_Context::updateScales( GLfloat scX, GLfloat scY )
{
if( scX <= 0 || scY <= 0 )
(*it)->setScale( scX, scY );
}
-//=======================================================================
-// Function: clearHighlighted
-// Purpose :
-//=======================================================================
+/*!
+ Clears hilighting of objects
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::clearHighlighted( bool updateViewer )
{
if( myHFlag && myLastPicked )
}
}
-//=======================================================================
-// Function: clearSelected
-// Purpose :
-//=======================================================================
+/*!
+ Clears selection of objects
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::clearSelected( bool updateViewer )
{
if( !mySFlag )
mySelectedObjects.clear();
}
-//=======================================================================
-// Function: setSelected
-// Purpose :
-//=======================================================================
+/*!
+ Selects object, other selected objects are left as selected
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer )
{
if( !object )
myGLViewer2d->activateDrawer( object, TRUE, TRUE );
}
-//=======================================================================
-// Function: remSelected
-// Purpose :
-//=======================================================================
+/*!
+ Unselects object, other selected objects are left as selected
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer )
{
if( !object || !mySelectedObjects.contains( object ) )
myGLViewer2d->activateDrawer( object, TRUE, TRUE );
}
-//=======================================================================
-// Function: eraseObject
-// Purpose :
-//=======================================================================
+/*!
+ Erases object in viewer
+ \param theUpdateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::eraseObject( GLViewer_Object* theObject, bool theUpdateViewer )
{
if( !theObject || !myActiveObjects.contains( theObject ) )
myGLViewer2d->updateAll();
}
-//=======================================================================
-// Function: deleteObject
-// Purpose :
-//=======================================================================
+/*!
+ Deletes object in
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateViewer )
{
if( !theObject ||
myGLViewer2d->updateAll();
}
-//=======================================================================
-// Function: setActive
-// Purpose :
-//=======================================================================
+/*!
+ Installs active status to object
+ \param theObject
+*/
bool GLViewer_Context::setActive( GLViewer_Object* theObject )
{
if( !theObject || !myInactiveObjects.contains( theObject ) )
return true;
}
-//=======================================================================
-// Function: setInactive
-// Purpose :
-//=======================================================================
+/*!
+ Installs inactive status to object
+ \param theObject
+*/
bool GLViewer_Context::setInactive( GLViewer_Object* theObject )
{
if( !theObject || !myActiveObjects.contains( theObject ) )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// Created: November, 2004
-/*! Class GLViewer_Context
- * Class for manage of presentations in GLViewer
- */
-
#ifndef GLVIEWER_CONTEXT_H
#define GLVIEWER_CONTEXT_H
#pragma warning( disable:4251 )
#endif
+/*! \class GLViewer_Context
+ * Class for manage of presentations in GLViewer
+ */
class GLVIEWER_API GLViewer_Context
{
public:
*function search object rectangle which intersect with sensitive area and call object highlight method
*/
int MoveTo( int x, int y, bool byCircle = FALSE );
- //! A function selecting already highlighting object by calling object method select
- /*!
+ /*! A function selecting already highlighting object by calling object method select
*\param Append - true if new selection will be append to existing selection, false - another
*\param byCircle - true if needs round selection area in complex object
*/
int Select( bool Append = FALSE, bool byCircle = FALSE );
- //! A function selecting objects on scene by rectangle
- /*!
+ /*! A function selecting objects on scene by rectangle
*\param theRect - rectangle of selection
*\param Append - true if new selection will be append to existing selection, false - another
*function search object rectangle which intersect with theRect and call object select method
int insertObject( GLViewer_Object* theObject, bool display = false, bool isActive = true );
//! Replacing objects in context
/*!
- * Function search activ and incative objects
+ * Function search active and incative objects
*/
bool replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject );
//! A function updating scales of all objects in context
//! Returns list of context objects
/*!
- * Returns active objects if isActive = true, else inactive objects
+ * \return active objects if isActive = true, else inactive objects
*/
const ObjList& getObjects( bool isActive = true )
{ return isActive ? myActiveObjects : myInactiveObjects; }
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Context.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_CoordSystem
-// Description : Class implementing mathematical model of 2D coordinate system
-//================================================================
#include "GLViewer_CoordSystem.h"
#include <math.h>
-//=======================================================================
-// Function: GLViewer_CoordSystem
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param aType - type of CS
+ \param X0 - X of origin in reference CS
+ \param Y0 - Y of origin in reference CS
+ \param XUnit - X unit in reference CS
+ \param YUnit - Y unit in reference CS
+ \param Rotation - rotation relative reference CS
+*/
GLViewer_CoordSystem::GLViewer_CoordSystem( CSType aType, double X0, double Y0,
double XUnit, double YUnit, double Rotation )
{
setRotation( Rotation );
}
-//=======================================================================
-// Function: getOrigin
-// Purpose :
-//=======================================================================
+/*!
+ \return origin in reference CS
+*/
void GLViewer_CoordSystem::getOrigin( double& x, double& y ) const
{
x = myX0;
y = myY0;
}
-//=======================================================================
-// Function: setOrigin
-// Purpose :
-//=======================================================================
+/*!
+ Sets origin in reference CS
+*/
void GLViewer_CoordSystem::setOrigin( double x, double y )
{
myX0 = x;
myY0 = y;
}
-//=======================================================================
-// Function: getUnits
-// Purpose :
-//=======================================================================
+/*!
+ \return units
+*/
void GLViewer_CoordSystem::getUnits( double& x, double& y ) const
{
x = myXUnit;
y = myYUnit;
}
-//=======================================================================
-// Function: setUnits
-// Purpose :
-//=======================================================================
+/*!
+ Sets units
+*/
void GLViewer_CoordSystem::setUnits( double x, double y )
{
if( x>0 )
else
myYUnit = 1.0;
}
-//=======================================================================
-// Function: getRotation
-// Purpose :
-//=======================================================================
+
+/*!
+ \return rotation
+*/
double GLViewer_CoordSystem::getRotation() const
{
return myRotation;
}
-//=======================================================================
-// Function: setRotation
-// Purpose :
-//=======================================================================
+/*!
+ Sets rotation
+*/
void GLViewer_CoordSystem::setRotation( double rotation )
{
myRotation = rotation;
}
-//=======================================================================
-// Function: getType
-// Purpose :
-//=======================================================================
+/*!
+ \return type
+*/
GLViewer_CoordSystem::CSType GLViewer_CoordSystem::getType() const
{
return myType;
}
-//=======================================================================
-// Function: setType
-// Purpose :
-//=======================================================================
+/*!
+ Sets type
+*/
void GLViewer_CoordSystem::setType( CSType type )
{
myType = type;
}
-//=======================================================================
-// Function: toReference
-// Purpose :
-//=======================================================================
+/*!
+ Recalculate co-ordinates to reference co-ordinates
+ \param x, y - co-ordinates
+*/
void GLViewer_CoordSystem::toReference( double& x, double& y )
{
if( myType==Cartesian )
}
}
-//=======================================================================
-// Function: fromReference
-// Purpose :
-//=======================================================================
+/*!
+ Recalculate co-ordinates from reference co-ordinates
+ \param x, y - co-ordinates
+*/
void GLViewer_CoordSystem::fromReference( double& x, double& y )
{
x = (x - myX0) / myXUnit;
}
}
-//=======================================================================
-// Function: transform
-// Purpose :
-//=======================================================================
+/*!
+ Recalculate co-ordinates to co-ordinates of other CS
+ \param aSystem - other CS
+ \param x, y - co-ordinates
+*/
void GLViewer_CoordSystem::transform( GLViewer_CoordSystem& aSystem, double& x, double& y )
{
toReference( x, y );
aSystem.fromReference( x, y );
}
-//=======================================================================
-// Function: getStretching
-// Purpose :
-//=======================================================================
+/*!
+ \return stretching of CS along X and Y axis
+*/
void GLViewer_CoordSystem::getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY )
{
theX = myXUnit / aSystem.myXUnit;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#pragma warning( disable:4251 )
#endif
+/*!
+ \class GLViewer_CoordSystem
+ \brief Class implementing mathematical model of 2D coordinate system
+*/
class GLVIEWER_API GLViewer_CoordSystem
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
GLfloat modelMatrix[16];
-//================================================================
-// Class : GLViewer_TexFont
-// Description :
-//================================================================
+
//! code of first font symbol
static int FirstSymbolNumber = 32;
//! code of last font symbol
QMap<GLViewer_TexFindId,GLViewer_TexIdStored> GLViewer_TexFont::TexFontBase;
QMap<GLViewer_TexFindId,GLuint> GLViewer_TexFont::BitmapFontCache;
-//=======================================================================
-// Function: clearTextBases
-// Purpose :
-//=======================================================================
+/*!
+ Clears all generated fonts
+*/
void GLViewer_TexFont::clearTextBases()
{
//cout << "Clear font map" << endl;
BitmapFontCache.clear();
}
-//======================================================================
-// Function: GLViewer_TexFont
-// Purpose :
-//=======================================================================
+/*!
+ Default constructor
+*/
GLViewer_TexFont::GLViewer_TexFont()
: myMaxRowWidth( 0 ), myFontHeight( 0 )
{
init();
}
-//======================================================================
-// Function: GLViewer_TexFont
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param theFont - a base font
+ \param theSeparator - separator between letters
+ \param theIsResizeable - specifies whether text drawn by this object can be scaled along with the scene
+ \param theMinMagFilter - min/mag filter, affects text sharpness
+*/
GLViewer_TexFont::GLViewer_TexFont( QFont* theFont, int theSeparator, bool theIsResizeable, GLuint theMinMagFilter )
: myMaxRowWidth( 0 ), myFontHeight( 0 )
{
init();
}
-//======================================================================
-// Function: ~GLViewer_TexFont
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_TexFont::~GLViewer_TexFont()
{
delete[] myWidths;
delete[] myPositions;
}
-//======================================================================
-// Function: init
-// Purpose :
-//=======================================================================
+/*!
+ Initializes font parameters
+*/
void GLViewer_TexFont::init()
{
myNbSymbols = LastSymbolNumber - FirstSymbolNumber + 1;
myTexFontHeight = 0;
}
-//======================================================================
-// Function: generateTexture
-// Purpose :
-//=======================================================================
+/*!
+ Generating font texture
+*/
bool GLViewer_TexFont::generateTexture()
{
GLViewer_TexFindId aFindFont;
aFindFont.myIsItal = myQFont.italic();
aFindFont.myIsUndl = myQFont.underline();
aFindFont.myPointSize = myQFont.pointSize();
- aFindFont.myViewPortId = (int)QGLContext::currentContext();
+ aFindFont.myViewPortId = size_t(QGLContext::currentContext());
if( TexFontBase.contains( aFindFont ) )
{
return true;
}
-//======================================================================
-// Function: drawString
-// Purpose :
-//=======================================================================
+/*!
+ Drawing string in viewer
+ \param theStr - string to be drawn
+ \param theX - X position
+ \param theY - Y position
+ \param theScale - scale coefficient
+*/
void GLViewer_TexFont::drawString( QString theStr, GLdouble theX , GLdouble theY, GLfloat theScale )
{
// Adding some pixels to have a gap between rows
glPopAttrib();
}
-//======================================================================
-// Function: getStringWidth
-// Purpose :
-//=======================================================================
+/*!
+ \return width of string in pixels
+*/
int GLViewer_TexFont::getStringWidth( QString theStr )
{
int aWidth = 0;
return aWidth;
}
-//======================================================================
-// Function: getStringHeight
-// Purpose :
-//=======================================================================
+/*!
+ \return height of string in pixels
+*/
int GLViewer_TexFont::getStringHeight()
{
QFontMetrics aFM( myQFont );
return aFM.height();
}
-//! function for generation list base for bitmap fonts
+/*!
+ Generates list base for bitmap fonts
+*/
static GLuint displayListBase( QFont* theFont )
{
if ( !theFont )
return aList;
}
- aFindFont.myViewPortId = (int)aCont;
+ aFindFont.myViewPortId = size_t(aCont);
if ( GLViewer_TexFont::BitmapFontCache.contains( aFindFont ) )
aList = GLViewer_TexFont::BitmapFontCache[aFindFont];
QMap<GLViewer_TexFindId, GLuint>::iterator it = GLViewer_TexFont::BitmapFontCache.begin();
for ( ; it != GLViewer_TexFont::BitmapFontCache.end(); ++it )
{
- if ( it.key().myViewPortId == (int)aCont && it.data() > listBase )
+ if ( it.key().myViewPortId == size_t(aCont) && it.data() > listBase )
listBase = it.data();
}
listBase += 256;
return aList;
}
-/***************************************************************************
-** Class: GLViewer_Drawer
-** Descr: Drawer for GLViewer_Object
-** Module: GLViewer
-** Created: UI team, 01.10.01
-****************************************************************************/
-//======================================================================
-// Function: GLViewer_Drawer
-// Purpose :
-//=======================================================================
+/*!
+ Default constructor
+*/
GLViewer_Drawer::GLViewer_Drawer()
: myFont( "Helvetica", 10, QFont::Bold )
{
myTextScale = 0.125;
}
-//======================================================================
-// Function: ~GLViewer_Drawer
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Drawer::~GLViewer_Drawer()
{
myObjects.clear();
glDeleteLists( myTextList, 1 );
}
-//======================================================================
-// Function: destroyAllTextures
-// Purpose :
-//=======================================================================
+/*!
+ Clears all generated textures
+*/
void GLViewer_Drawer::destroyAllTextures()
{
QMap<GLViewer_TexFindId,GLViewer_TexIdStored>::Iterator anIt= GLViewer_TexFont::TexFontBase.begin();
glDeleteTextures( 1, &(anIt.data().myTexFontId) );
}
-//=======================================================================
-// Function: setAntialiasing
-// Purpose : The function enables and disables antialiasing in Open GL (for points, lines and polygons).
-//=======================================================================
+/*!
+ Enables and disables antialiasing in Open GL (for points, lines and polygons).
+ \param on - if it is true, antialiasing is enabled
+*/
void GLViewer_Drawer::setAntialiasing(const bool on)
{
if (on)
}
}
-//======================================================================
-// Function: loadTexture
-// Purpose :
-//=======================================================================
+/*! Loads texture from file
+ \param fileName - the name of texture file
+ \param x_size - the horizontal size of picture ( less or equal texture horizontal size )
+ \param y_size - the vertical size of picture ( less or equal texture vertical size )
+ \param t_size - the size of texture ( texture vertical size equals texture horizontal size )
+*/
GLuint GLViewer_Drawer::loadTexture( const QString& fileName,
GLint* x_size,
GLint* y_size,
return texture;
}
-//======================================================================
-// Function: drawTexture
-// Purpose :
-//=======================================================================
+/*! Draw square texture
+ \param texture - the texture ID
+ \param size - the size of square texture
+ \param x - x coord
+ \param y - y coord
+*/
void GLViewer_Drawer::drawTexture( GLuint texture, GLint size, GLfloat x, GLfloat y )
{
/*float xScale = myXScale;
drawTexture( texture, size, size, x, y );
}
-//======================================================================
-// Function: drawTexture
-// Purpose :
-//=======================================================================
+/*! Draw texture
+ \param texture - the texture ID
+ \param x_size - the horizontal size of texture
+ \param y_size - the vertical size of texture
+ \param x - x coord
+ \param y - y coord
+*/
void GLViewer_Drawer::drawTexture( GLuint texture, GLint x_size, GLint y_size, GLfloat x, GLfloat y )
{
/*float xScale = myXScale;
drawTexturePart( texture, 1.0, 1.0, x_size, y_size, x, y );
}
-//======================================================================
-// Function: drawTexture
-// Purpose :
-//=======================================================================
+/*! Draw texture part
+ \param texture - the texture ID
+ \param x_ratio - the horizontal ratio of texture part
+ \param y_ratio - the vertical ratio of texture part
+ \param x_size - the horizontal size of texture
+ \param y_size - the vertical size of texture
+ \param x - x coord
+ \param y - y coord
+ \param scale - common scale factor ( if = 0, use drawer scales )
+*/
void GLViewer_Drawer::drawTexturePart( GLuint texture,
GLfloat x_ratio,
GLfloat y_ratio,
glDisable( GL_TEXTURE_2D );
}
-//======================================================================
-// Function: drawText
-// Purpose :
-//=======================================================================
+/*!
+ Draw text
+ \param text - text to be drawn
+ \param xPos - x position
+ \param yPos - y position
+ \param color - color of text
+ \param theFont - font of text
+ \param theSeparator - letter separator
+ \param theFormat - text format (by default DTF_BITMAP)
+*/
void GLViewer_Drawer::drawText( const QString& text, GLfloat xPos, GLfloat yPos,
const QColor& color, QFont* theFont, int theSeparator, DisplayTextFormat theFormat )
{
}
}
-//======================================================================
-// Function: drawText
-// Purpose :
-//=======================================================================
+/*!
+ Draws object-text
+*/
void GLViewer_Drawer::drawText( GLViewer_Object* theObject )
{
if( !theObject )
drawText( aText->getText(), aPosX, aPosY, aText->getColor(), &aTmpVarFont, aText->getSeparator(), aText->getDisplayTextFormat() );
}
-//======================================================================
-// Function: drawGLText
-// Purpose :
-//=======================================================================
+/*! Draw text
+ \param text - the text string
+ \param x - x coord
+ \param y - y coord
+ \param hPosition - horizontal alignment
+ \param vPosition - vertical alignment
+ \param color - text color
+ \param smallFont - font format
+*/
void GLViewer_Drawer::drawGLText( QString text, float x, float y,
int hPosition, int vPosition, QColor color, bool smallFont )
{
QFont aFont( myFont );
if( smallFont )
- aFont.setPointSize( aFont.pointSize() * 0.8 );
+ aFont.setPointSize( int(aFont.pointSize() * 0.8) );
GLfloat scale = textScale() > 0. ? textScale() : 1.;
drawText( text, x, y, color, &aFont, 2, myTextFormat );
}
-//======================================================================
-// Function: textRect
-// Purpose :
-//=======================================================================
+/*!
+ \return a rectangle of text (without viewer scale)
+*/
GLViewer_Rect GLViewer_Drawer::textRect( const QString& text ) const
{
GLfloat scale = textScale() > 0. ? textScale() : 1.;
return GLViewer_Rect( 0, width, height, 0 );
}
-//======================================================================
-// Function: drawRectangle
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangle
+ \param rect - instance of primitive
+ \param color - color of primitive
+*/
void GLViewer_Drawer::drawRectangle( GLViewer_Rect* rect, QColor color )
{
if( !rect )
glEnd();
}
-//======================================================================
-// Function: translateToHPGL
-// Purpose :
-//=======================================================================
+/*!
+ Saves object to file with format of HPGL
+ \param hFile - file
+ \param aViewerCS - viewer co-ordinate system
+ \param aHPGLCS - paper co-ordinate system
+*/
bool GLViewer_Drawer::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS )
{
bool result = true;
return result;
}
-//======================================================================
-// Function: translateToPS
-// Purpose :
-//=======================================================================
+/*!
+ Saves object to file with format of PostScript
+ \param hFile - file
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+*/
bool GLViewer_Drawer::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
bool result = true;
}
#ifdef WIN32
-//======================================================================
-// Function: translateToEMF
-// Purpose :
-//=======================================================================
+/*!
+ Saves object to file with format of EMF
+ \param hFile - file
+ \param aViewerCS - viewer co-ordinate system
+ \param aEMFCS - paper co-ordinate system
+*/
bool GLViewer_Drawer::translateToEMF( HDC hDC, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
bool result = true;
}
#endif
-//======================================================================
-// Function: drawRectangle
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangle
+ \param rect - instance of primitive
+ \param lineWidth - width of line
+ \param gap - gap of rectangle
+ \param color - color of primitive
+ \param filled - if it is true, then rectangle will be drawn filled with color "fillingColor"
+ \param fillingColor - color of filling
+*/
void GLViewer_Drawer::drawRectangle( GLViewer_Rect* rect, GLfloat lineWidth, GLfloat gap,
QColor color, bool filled, QColor fillingColor )
{
glEnd();
}
-//======================================================================
-// Function: drawContour
-// Purpose :
-//=======================================================================
+/*!
+ Draws contour
+ \param pntList - list of points
+ \param color - color of contour
+ \param lineWidth - width of line
+*/
void GLViewer_Drawer::drawContour( const GLViewer_PntList& pntList, QColor color, GLfloat lineWidth )
{
glColor3f( ( GLfloat )color.red() / 255,
glEnd();
}
-//======================================================================
-// Function: drawContour
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangular contour
+ \param rect - instance of rectangle
+ \param color - color of primitive
+ \param lineWidth - width of line
+ \param pattern - pattern of line
+ \param isStripe - enables line stipple
+*/
void GLViewer_Drawer::drawContour( GLViewer_Rect* rect, QColor color, GLfloat lineWidth,
GLushort pattern, bool isStripe )
{
glDisable( GL_LINE_STIPPLE );
}
-//======================================================================
-// Function: drawPolygon
-// Purpose :
-//=======================================================================
+/*!
+ Draws polygon
+ \param pntList - list of points
+ \param color - color of polygon
+*/
void GLViewer_Drawer::drawPolygon( const GLViewer_PntList& pntList, QColor color )
{
glColor3f( ( GLfloat )color.red() / 255,
glEnd();
}
-//======================================================================
-// Function: drawPolygon
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangle
+ \param rect - instance of rectangle
+ \param color - color of polygon
+ \param pattern - pattern of line
+ \param isStripe - enables line stipple
+*/
void GLViewer_Drawer::drawPolygon( GLViewer_Rect* rect, QColor color,
GLushort pattern, bool isStripe )
{
glDisable( GL_LINE_STIPPLE );
}
-//======================================================================
-// Function: drawVertex
-// Purpose :
-//=======================================================================
GLubyte rasterVertex[5] = { 0x70, 0xf8, 0xf8, 0xf8, 0x70 };
+
+/*!
+ Draws vertex
+ \param x - x position
+ \param y - y position
+ \param color - color of vertex
+*/
void GLViewer_Drawer::drawVertex( GLfloat x, GLfloat y, QColor color )
{
glColor3f( ( GLfloat )color.red() / 255, ( GLfloat )color.green() / 255, ( GLfloat )color.blue() / 255 );
glBitmap( 5, 5, 2, 2, 0, 0, rasterVertex );
}
-//======================================================================
-// Function: drawCross
-// Purpose :
-//=======================================================================
GLubyte rasterCross[7] = { 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82 };
+
+/*!
+ Draws cross
+ \param x - x position
+ \param y - y position
+ \param color - color of cross
+*/
void GLViewer_Drawer::drawCross( GLfloat x, GLfloat y, QColor color )
{
glColor3f( ( GLfloat )color.red() / 255, ( GLfloat )color.green() / 255, ( GLfloat )color.blue() / 255 );
glBitmap( 7, 7, 3, 3, 0, 0, rasterCross );
}
-//======================================================================
-// Function: drawArrow
-// Purpose :
-//=======================================================================
+/*!
+ Draws arrow
+ \param red, green, blue - components of color
+ \param lineWidth - width of line
+ \param staff -
+ \param length - length of arrow
+ \param width - width of arrow
+ \param x - x position
+ \param y - y position
+ \param angle - angle of arrow
+ \param filled - drawn as filled
+*/
void GLViewer_Drawer::drawArrow( const GLfloat red, const GLfloat green, const GLfloat blue,
GLfloat lineWidth,
GLfloat staff, GLfloat length, GLfloat width,
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
}
};
-/***************************************************************************
-** Class: GLViewer_TexFont
-** Descr: Font for GLViewer_Drawer
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
+/*!
+ \class GLViewer_TexFont
+ Font for GLViewer_Drawer, Drawing bitmap and texture fonts in GLViewer
+*/
-/*!
- * Class GLViewer_TexFont
- * Drawing bitmap and texture fonts in GLViewer
- */
class GLVIEWER_API GLViewer_TexFont
{
public:
int myMaxRowWidth;
};
-/***************************************************************************
-** Class: GLViewer_Drawer
-** Descr: Drawer for GLObject
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
/*!
- * Class GLViewer_Drawer
- * Drawer for GLViewer_Objects.
- * Drawer creates only one times per one type of object
- */
+ \class GLViewer_Drawer
+ Drawer for GLViewer_Objects.
+ Drawer creates only one times per one type of object
+*/
class GLVIEWER_API GLViewer_Drawer
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_Geom
-** Descr:
-** Module: GLViewer
-** Created: UI team, 16.11.04
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include <GLViewer_Geom.h>
#define FAR_POINT 1e10 // Value used as a "very distant" co-ordinate
#define TOLERANCE 1e-3
-//================================================================
-// Function : GLViewer_Segment
-// Purpose : constructs a real segment bounded by two points
-//================================================================
+/*!
+ constructs a real segment bounded by two points
+*/
GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt1,
const GLViewer_Pnt& thePnt2 )
: myPnt1( thePnt1 ),
myC = myPnt1.x() * myPnt2.y() - myPnt2.x() * myPnt1.y();
}
-//================================================================
-// Function : GLViewer_Segment
-// Purpose : constructs a ray starting at <thePnt> and directed
-// along positive X axis direction (or Y axis if vertical )
-//================================================================
+/*!
+ constructs a ray starting at <thePnt> and directed along positive X axis direction (or Y axis if vertical )
+*/
GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt,
const GLfloat theA,
const GLfloat theB,
myPnt2 = GLViewer_Pnt( FAR_POINT, - myA / myB * FAR_POINT - myC / myB );
}
-//================================================================
-// Function : GLViewer_Segment
-// Purpose : destructor, does nothing
-//================================================================
+/*!
+ destructor, does nothing
+*/
GLViewer_Segment::~GLViewer_Segment()
{
}
-//================================================================
-// Function : HasIntersection
-// Purpose : detects intersection with segment <theOther>
-//================================================================
+/*!
+ detects intersection with segment <theOther>
+*/
bool GLViewer_Segment::HasIntersection( const GLViewer_Segment& theOther ) const
{
bool aRes = false;
return aRes;
}
-//================================================================
-// Function : GLViewer_Poly
-// Purpose : constructs a closed polygon from the given ordered list of points
-//================================================================
+/*!
+ constructs a closed polygon from the given ordered list of points
+*/
GLViewer_Poly::GLViewer_Poly( const GLViewer_PntList* thePoints )
: myPoints( (GLViewer_PntList*)thePoints )
{
}
-//================================================================
-// Function : ~GLViewer_Poly
-// Purpose : destructor, <myPoints> mustn't be deleted here!
-//================================================================
+/*!
+ destructor, <myPoints> mustn't be deleted here!
+*/
GLViewer_Poly::~GLViewer_Poly()
{
}
-//================================================================
-// Function : IsIn
-// Purpose : returns true if <thePnt> lies within this polygon
-//================================================================
+/*!
+ \return true if <thePnt> lies within this polygon
+*/
bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt ) const
{
if ( !myPoints )
return ( aNbInter % 2 == 1 );
}
+/*!
+ \return true if <thePnt> lies within this polygon
+*/
/*
-//================================================================
-// Function : IsIn
-// Purpose : returns true if <thePnt> lies within this polygon
-//================================================================
bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt, const float tolerance ) const
{
if ( !myPoints )
return res;
}
*/
-//================================================================
-// Function : IsCovers
-// Purpose : returns true if <thePoly> covers this polygon
-//================================================================
+/*!
+ \return true if <thePoly> covers this polygon
+*/
bool GLViewer_Poly::IsCovers( const GLViewer_Poly& thePoly ) const
{
if ( !myPoints || !thePoly.Count() )
return true;
}
-//================================================================
-// Function : IsCovers
-// Purpose : returns true if <theRect> covers this polygon
-//================================================================
+/*!
+ \return true if <theRect> covers this polygon
+*/
bool GLViewer_Poly::IsCovers( const GLViewer_Rect& theRect ) const
{
if ( !myPoints ) //needs check for <theRect>
return IsCovers( GLViewer_Poly( &aList ) );
}
-//================================================================
-// Function : HasIntersection
-// Purpose : looks for any
-//================================================================
+/*!
+ \return true if polygon has intersection with segment or ray
+ \param theSegment - segment to check intersection
+*/
bool GLViewer_Poly::HasIntersection( const GLViewer_Segment& theSegment ) const
{
if ( !myPoints )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#include <Precision.hxx>
#include <qglobal.h>
+/*!
+ Default constructor
+*/
GLViewer_Grid::GLViewer_Grid() :
myGridList( 0 ), myGridHeight( (GLfloat)0.0 ), myGridWidth( (GLfloat)0.0 ),
myWinW( (GLfloat)0.0 ), myWinH( (GLfloat)0.0 ), myXSize( (GLfloat)0.0 ), myYSize( (GLfloat)0.0 ),
myAxisColor[2] = 0.75;
}
+/*!
+ Constructor
+ \param width and \param height - width and height of grid
+ \param winW and \param winH - width and height of window
+ \param xSize and \param ySize - steps along x and y direction
+ \param xPan and \param yPan - offsets along x and y direction
+ \param xScale and \param yScal - scale factors along x and y direction
+*/
GLViewer_Grid::GLViewer_Grid( GLfloat width, GLfloat height,
GLfloat winW, GLfloat winH,
GLfloat xSize, GLfloat ySize,
myAxisColor[2] = 0.75;
}
+/*!
+ Destructor
+*/
GLViewer_Grid::~GLViewer_Grid()
{
}
+/*!
+ Performs OpenGL drawing
+*/
void GLViewer_Grid::draw()
{
if ( myGridList == 0 || myIsUpdate )
glCallList( myGridList );
}
+/*!
+ Changes color of grid
+ \param r, g, b - components of color
+*/
void GLViewer_Grid::setGridColor( GLfloat r, GLfloat g, GLfloat b )
{
if( myGridColor[0] == r && myGridColor[1] == g && myGridColor[2] == b )
myIsUpdate = GL_TRUE;
}
+/*!
+ Changes color of axis
+ \param r, g, b - components of color
+*/
void GLViewer_Grid::setAxisColor( GLfloat r, GLfloat g, GLfloat b )
{
if( myAxisColor[0] == r && myAxisColor[1] == g && myAxisColor[2] == b )
myIsUpdate = GL_TRUE;
}
+/*!
+ Changes grid width
+ \param w - new grid width
+*/
void GLViewer_Grid::setGridWidth( float w )
{
if( myGridWidth == w )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets Radius of center point( begin coords )
+ \param r - new radius
+*/
void GLViewer_Grid::setCenterRadius( int r )
{
if( myCenterRadius == r )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets grid size along X and Y axis
+ \param xSize - size along X axis
+ \param ySize - size along Y axis
+*/
void GLViewer_Grid::setSize( float xSize, float ySize )
{
if( myXSize == xSize && myYSize == ySize )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets panning of grid
+ \param xPan - panning along X axis
+ \param yPan - panning along Y axis
+*/
void GLViewer_Grid::setPan( float xPan, float yPan )
{
if( myXPan == xPan && myYPan == yPan )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets zoom
+ \param zoom - new coefficient of zooming
+*/
bool GLViewer_Grid::setZoom( float zoom )
{
if( zoom == 1.0 )
return true;
}
+/*!
+ Sets parameters of grid by zoom coefficient and window size
+ \param WinW - window width
+ \param WinH - window height
+ \param zoom - zoom coefficient
+*/
void GLViewer_Grid::setResize( float WinW, float WinH, float zoom )
{
if( myWinW == WinW && myWinH == WinH && zoom == 1.0 )
myIsUpdate = GL_TRUE;
}
+/*!
+ \return grid size along x and y axis
+ \param xSize - for size along x axis
+ \param ySize - for size along y axis
+*/
void GLViewer_Grid::getSize( float& xSize, float& ySize ) const
{
xSize = myXSize;
ySize = myYSize;
}
+/*!
+ \return panning along x and y axis
+ \param xPan - for panning along x axis
+ \param yPan - for panning along y axis
+*/
void GLViewer_Grid::getPan( float& xPan, float& yPan ) const
{
xPan = myXPan;
yPan = myYPan;
}
+/*!
+ \return scaling along x and y axis
+ \param xScale - for scaling along x axis
+ \param yScale - for scaling along y axis
+*/
void GLViewer_Grid::getScale( float& xScale, float& yScale ) const
{
xScale = myXScale;
yScale = myYScale;
}
+/*!
+ Initialize grid display list
+*/
bool GLViewer_Grid::initList()
{
myIsUpdate = GL_FALSE;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#include "GLViewer_Group.h"
#include "GLViewer_Object.h"
-/***************************************************************************
-** Class: GLViewer_Group
-** Descr: Group of GLViewer_Objects
-** Module: GLViewer
-** Created: UI team, 25.03.05
-****************************************************************************/
-
-//--------------------------------------------------------------------------
-//Function: GLViewer_Group()
-//Description: constructor
-//--------------------------------------------------------------------------
+/*!
+ constructor
+*/
GLViewer_Group::GLViewer_Group()
{
mySelObjNum = 0;
}
-//--------------------------------------------------------------------------
-//Function: GLViewer_Group()
-//Description: destructor
-//--------------------------------------------------------------------------
+/*!
+ destructor
+*/
GLViewer_Group::~GLViewer_Group()
{
}
-//--------------------------------------------------------------------------
-//Function: isEmpty
-//Description: detection of empty group
-//--------------------------------------------------------------------------
+/*!
+ detection of empty group
+*/
bool GLViewer_Group::isEmpty()
{
return myList.empty();
}
-//--------------------------------------------------------------------------
-//Function: count
-//Description: number of elements
-//--------------------------------------------------------------------------
+/*!
+ \return number of elements
+*/
int GLViewer_Group::count()
{
return myList.size();
}
-//--------------------------------------------------------------------------
-//Function: contains
-//Description: return the position of object, else -1
-//--------------------------------------------------------------------------
+/*!
+ \return the position of object if group contains it, else -1
+*/
int GLViewer_Group::contains( GLViewer_Object* theObject )
{
if( !theObject )
return -1;
}
-//--------------------------------------------------------------------------
-//Function: addObject
-//Description: adding object to group
-//--------------------------------------------------------------------------
+/*!
+ adding object to group
+*/
int GLViewer_Group::addObject( GLViewer_Object* theObject )
{
if( theObject && contains( theObject ) == -1 )
return count();
}
-//--------------------------------------------------------------------------
-//Function: removeObject
-//Description: removing object from group
-//--------------------------------------------------------------------------
+/*!
+ removing object from group
+*/
int GLViewer_Group::removeObject( GLViewer_Object* theObject )
{
if( theObject )
return count();
}
-//--------------------------------------------------------------------------
-//Function: dragingObjects
-//Description:
-//--------------------------------------------------------------------------
+/*!
+ Dragging operation
+ \param Once is true, if this operation calls only one time for all object
+ \param x, y - dragging position
+*/
void GLViewer_Group::dragingObjects( float x, float y, bool once )
{
if( !once )
(*it)->moveObject( x, y, true );
}
-//--------------------------------------------------------------------------
-//Function: updateZoom
-//Description:
-//--------------------------------------------------------------------------
+/*!
+ Updates zoom of object
+ \param sender - object to be updated
+ \param zoom - zoom coefficient
+*/
void GLViewer_Group::updateZoom( GLViewer_Object* sender, float zoom )
{
OGIterator it = myList.begin();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_MimeSource
-** Descr: Needs for a work with QClipboard
-** Module: GLViewer
-** Created: UI team, 22.03.04
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_MimeSource.h"
#include "GLViewer_BaseObjects.h"
//#include <cmath>
//using namespace std;
+/*!
+ Destructor
+*/
GLViewer_MimeSource::~GLViewer_MimeSource()
{
}
+/*!
+ Translate objects to byte array
+ \param theObjects - list of objects
+*/
bool GLViewer_MimeSource::setObjects( QValueList<GLViewer_Object*> theObjects )
{
if( !theObjects.empty() )
return false;
}
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-//If you want to use new class, following two method must be redefined
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+/*!
+ Creates object by it's representation (byte array)
+ \param theArray - byte array
+ \param theType - type of object
+*/
GLViewer_Object* GLViewer_MimeSource::getObject( QByteArray theArray, QString theType )
{
if( !theArray.isEmpty() )
return NULL;
}
+/*!
+ Creates list of objects by its representation (byte array)
+ \param theArray - byte array
+ \param theType - type of object
+*/
QValueList<GLViewer_Object*> GLViewer_MimeSource::getObjects( QByteArray theArray, QString theType )
{
if( !theArray.isEmpty() )
return QValueList<GLViewer_Object*>();
}
+/*!
+ \return format by index
+ \param theIndex - index
+*/
const char* GLViewer_MimeSource::format( int theIndex ) const
{
switch( theIndex )
}
+/*!
+ \return internal byte array
+*/
QByteArray GLViewer_MimeSource::encodedData( const char* theObjectType ) const
{
if( theObjectType == "GLViewer_Objects" )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
class GLViewer_Object;
-/*! Class GLViewer_MimeSource
-* Needs for a work with QClipboard
+/*!
+ \class GLViewer_MimeSource
+ Needs for a work with QClipboard
*/
-
class GLVIEWER_API GLViewer_MimeSource: public QMimeSource
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_Object
-** Descr: OpenGL Object
-** Module: GLViewer
-** Created: UI team, 03.09.02
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Object.h"
#include "GLViewer_Drawer.h"
//#include <cmath>
//using namespace std;
+/*!
+ Default constructor
+*/
GLViewer_Object::GLViewer_Object()
{
myXScale = 1.0;
myGroup = NULL;
}
+/*!
+ Destructor
+*/
GLViewer_Object::~GLViewer_Object()
{
if( myRect )
delete myAspectLine;
}
+/*!
+ \return priority of object
+*/
int GLViewer_Object::getPriority() const
{
return myDrawer ? myDrawer->getPriority() : 0;
}
+/*!
+ \return true if object is inside rectangle
+ \param theRect - rectangle
+*/
GLboolean GLViewer_Object::isInside( GLViewer_Rect theRect )
{
return theRect.toQRect().contains( myRect->toQRect() );
}
+/*!
+ Sets zoom factor
+ \param zoom - zoom factor
+*/
GLboolean GLViewer_Object::setZoom( GLfloat zoom, bool, bool )
{
if( myZoom == zoom )
return GL_TRUE;
}
+/*!
+ Performs zoom change by step
+ \param zoomIn - to increase to decrease zoom
+*/
GLboolean GLViewer_Object::updateZoom( bool zoomIn )
{
float newZoom;
return setZoom( newZoom, true );
}
+/*!
+ Codes object as byte copy
+ \return byte array
+*/
QByteArray GLViewer_Object::getByteCopy()
{
int i = 0;
return aResult;
}
+/*!
+ Initialize object by byte array
+ \param theArray - byte array
+*/
bool GLViewer_Object::initializeFromByteCopy( QByteArray theArray )
{
int i = 0;
return true;
}
+/*!
+ Sets object's group
+ \param theGroup - group
+*/
void GLViewer_Object::setGroup( GLViewer_Group* theGroup )
{
if ( myGroup == theGroup )
myGroup->addObject( this );
}
+/*!
+ \return object's group
+*/
GLViewer_Group* GLViewer_Object::getGroup() const
{
return myGroup;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#pragma warning( disable:4251 )
#endif
-/*!
- * Class GLViewer_Object
- * Base Object for GLViewer
- */
class GLViewer_Drawer;
class GLViewer_AspectLine;
class GLViewer_Group;
class GLViewer_Text;
class GLViewer_Owner;
+/*!
+ * Class GLViewer_Object
+ * Base Object for all GLViewer objects
+ */
class GLVIEWER_API GLViewer_Object
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Selector.cxx
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector
-** Descr: Base class for object selection in QAD-based application
-** Module: GLViewer
-** Created: UI team, 22.09.00
-*****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Selector.h"
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Selector.h
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector
-** Descr: Base class for object selection in QAD-based application
-** Module: GLViewer
-** Created: UI team, 22.09.00
-*****************************************************************************/
#ifndef GLVIEWER_SELECTOR_H
#define GLVIEWER_SELECTOR_H
class GLViewer_Viewer;
-/*! Class GLViewer_Selector
-* Based select manager for GLViewer
+/*!
+ \Class GLViewer_Selector
+ Base class for object selection in SUIT-based application
*/
-
class GLVIEWER_API GLViewer_Selector : public QObject
{
Q_OBJECT
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Selector2d.cxx
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector2d
-** Descr: OpenGL Selector 2D
-** Module: GLViewer
-** Created: UI team, 20.09.02
-*****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Selector2d.h"
#include "GLViewer_Viewer2d.h"
#include "GLViewer_Context.h"
#include "GLViewer_ViewPort2d.h"
+/*!
+ Constructor
+*/
GLViewer_Selector2d::GLViewer_Selector2d( GLViewer_Viewer2d* v2d, GLViewer_Context* glc ) :
GLViewer_Selector( v2d ),
myGLContext( glc )
// myGLContext->SetSelectionColor( Quantity_NOC_RED );
}
+/*!
+ Destructor
+*/
GLViewer_Selector2d::~GLViewer_Selector2d()
{
}
+/*!
+ Changes hilight color of context
+ \param color - new hilight color
+*/
void GLViewer_Selector2d::setHilightColor( Quantity_NameOfColor color )
{
myGLContext->SetHighlightColor( color );
}
+/*!
+ Changes selection color of context
+ \param color - new selection color
+*/
void GLViewer_Selector2d::setSelectColor( Quantity_NameOfColor color )
{
myGLContext->SetSelectionColor( color );
}
+/*!
+ Detects object at point
+ \param x, y - point co-ordinates
+*/
void GLViewer_Selector2d::detect( int x, int y )
{
//cout << "GLViewer_Selector2d : detect ( " << x << " , " << y << " )" << endl;
myGLContext->MoveTo( x, y );
}
+/*!
+ Undetects all objects
+*/
void GLViewer_Selector2d::undetectAll()
{
if ( myLocked || !myGLContext || !myViewer || !myViewer->getActiveView() ||
myGLContext->clearHighlighted( true );
}
+/*!
+ Selects previously hilighted objects
+ \param append - append objects to selection
+*/
void GLViewer_Selector2d::select( bool append )
{
//cout << "GLViewer_Selector2d : select ( " << (int)append << " )" << endl;
checkSelection( selBefore, append, status );
}
+/*!
+ Selects objects in rectangle
+ \param selRect - selection rectangle
+ \param append - append objects to selection
+*/
void GLViewer_Selector2d::select( const QRect& selRect, bool append )
{
GLViewer_Viewer::SelectionMode selMode = myViewer->getSelectionMode();
checkSelection( selBefore, append, aStatus );
}
+/*!
+ Unselects all objects
+*/
void GLViewer_Selector2d::unselectAll()
{
if ( myLocked || !myViewer )
if ( hadSelection ) emit selSelectionCancel();
}
-/* Checks selection state and emits 'selSelectionDone' or 'selSelectionCancel'
- Should be called by after non-interactive selection. */
+/*!
+ Checks selection state and emits 'selSelectionDone' or 'selSelectionCancel'
+ Should be called by after non-interactive selection.
+*/
void GLViewer_Selector2d::checkSelection( int selBefore, bool append, int aStatus )
{
int selAfter = numSelected();
}
}
+/*!
+ \return number of selected objects
+*/
int GLViewer_Selector2d::numSelected() const
{
return myGLContext->NbSelected();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Selector2d.h
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector2d
-** Descr: OpenGL Selector 2D
-** Module: GLViewer
-** Created: UI team, 20.09.02
-*****************************************************************************/
#ifndef GLVIEWER_SELECTOR2D_H
#define GLVIEWER_SELECTOR2D_H
class GLViewer_Viewer2d;
class GLViewer_Context;
-/*! Class GLViewer_Selector2d
-* 2D select manager for GLViewer
+/*!
+ \class GLViewer_Selector2d
+ 2D select manager for GLViewer
*/
class GLVIEWER_API GLViewer_Selector2d : public GLViewer_Selector
{
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_Text
-** Descr: Substitution of Prs3d_Text for OpenGL
-** Module: GLViewer
-** Created: UI team, 10.07.03
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Text.h"
+/*!
+ Constructor
+*/
GLViewer_Text::GLViewer_Text( const QString& text, float xPos, float yPos, const QColor& color )
{
myText = text;
myDTF = DTF_BITMAP;
}
+/*!
+ Constructor
+*/
GLViewer_Text::GLViewer_Text( const QString& text, float xPos, float yPos, const QColor& color, QFont theFont, int theSeparator )
{
myText = text;
myDTF = DTF_BITMAP;
}
+/*!
+ Destructor
+*/
GLViewer_Text::~GLViewer_Text()
{
}
+/*!
+ \return width of text
+*/
int GLViewer_Text::getWidth()
{
int aResult = 0;
return aResult;
}
+/*!
+ \return height of text
+*/
int GLViewer_Text::getHeight()
{
QFontMetrics aFM( myQFont );
return aFM.height();
}
+/*!
+ Codes object as byte copy
+ \return byte array
+*/
QByteArray GLViewer_Text::getByteCopy() const
{
int i;
return aResult;
}
+/*!
+ Initialize text from binary representation
+ \param theBuf - byte array
+*/
GLViewer_Text* GLViewer_Text::fromByteCopy( QByteArray theBuf )
{
int i = 0;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#pragma warning( disable:4251 )
#endif
-/* Class GLViewer_Text
-* Substitution of Prs3d_Text for OpenGL */
-
+/*!
+ \class GLViewer_Text
+ Substitution of Prs3d_Text for OpenGL
+*/
class GLVIEWER_API GLViewer_Text
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#include <qapplication.h>
#include <qtooltip.h>
-/***************************************************************************
-** Class: GLViewer_ToolTip
-** Descr: ToolTip of GLViewer_Objects
-** Module: GLViewer
-** Created: UI team, 25.03.05
-****************************************************************************/
-
-//--------------------------------------------------------------------------
-//Function: GLViewer_ToolTip()
-//Description: constructor
-//--------------------------------------------------------------------------
+/*!
+ constructor
+*/
GLViewer_ObjectTip::GLViewer_ObjectTip( GLViewer_ViewPort2d* theParent )
:QObject(),
myText(),
connect( mypTimer, SIGNAL( timeout() ), this, SLOT( showTip() ) );
}
-//--------------------------------------------------------------------------
-//Function: GLViewer_ToolTip()
-//Description: destructor
-//--------------------------------------------------------------------------
+/*!
+ destructor
+*/
GLViewer_ObjectTip::~GLViewer_ObjectTip()
{
// delete mypRect;
}
-//--------------------------------------------------------------------------
-//Function: GLViewer_ToolTip()
-//Description: destructor
-//--------------------------------------------------------------------------
+/*!
+ It is called when there is a possibility that a tool tip should be shown
+ \param p - position of tooltip
+*/
bool GLViewer_ObjectTip::maybeTip( const QPoint &p )
{
*/
}
+/*!
+ Custom event filter
+*/
bool GLViewer_ObjectTip::eventFilter( QObject* theObj, QEvent* e )
{
hideTipAndSleep();
return false;
}
-
+/*!
+ Hides tooltip and stops timer
+*/
void GLViewer_ObjectTip::hideTipAndSleep()
{
//if( mypPoint )
mypTimer->stop();
}
+/*!
+ Shows tooltip
+*/
void GLViewer_ObjectTip::showTip()
{
if( maybeTip( myPoint ) )
}
}
+/*!
+ Restarts timer
+*/
void GLViewer_ObjectTip::wakeup( int theTime )
{
if( mypTimer->isActive() )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
class GLViewer_ViewPort2d;
class QLabel;
-/***************************************************************************
-** Class: GLViewer_ObjectTip
-** Descr: ToolTip of GLViewer_Objects
-** Module: GLViewer
-** Created: UI team, 28.03.05
-****************************************************************************/
+/*!
+ \class GLViewer_ObjectTip
+ ToolTip of GLViewer_Objects
+*/
class GLVIEWER_API GLViewer_ObjectTip: public QObject//QToolTip//QtxToolTip
{
Q_OBJECT
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#include <iostream>
-/****************************************************************************
-** Class: GLViewer_LineList
-** Descr: Tools for distinct line
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+/*!
+ Constructor
+ \param size - size of internal array
+*/
GLViewer_LineList::GLViewer_LineList( int size )
{
myRealSize = 2*size;
memset( myArray, 0, myRealSize*sizeof(double) );
}
+/*!
+ Destructor
+*/
GLViewer_LineList::~GLViewer_LineList()
{
delete myArray;
}
+/*!
+ Adds new line segment to list
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::addSegment( double coord1, double coord2 )
{
if( coord1 > coord2 )
return true;
}
+/*!
+ Gets info about segment
+ \param theIndex - index of segment
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::readSegment( int theIndex, double& coord1, double& coord2 )
{
if( theIndex > mySegmentNumber || !myArray)
return true;
}
+/*!
+ \return true if line list covers point
+ \param thePoint - point co-ordinate
+*/
int GLViewer_LineList::contains( double thePoint ) const
{
if( !myArray || mySegmentNumber == 0 )
}
+/*!
+ Removes segment
+ \param theIndex - segment index
+*/
bool GLViewer_LineList::removeSegment( int theIndex )
{
if( theIndex > mySegmentNumber || !myArray)
return true;
}
+/*!
+ Removes segment from line list
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::removeSegment( double coord1, double coord2 )
{
if( coord1 > coord2 )
return true;
}
+/*!
+ Clears line list
+*/
void GLViewer_LineList::clear()
{
if( myArray )
memset( myArray, 0, myRealSize*sizeof(double) );
}
+/*!
+ Prints debug info about line list
+*/
void GLViewer_LineList::print()
{
std::cout << "MainCoord: " << myMainCoord <<" SIZE: " << myRealSize << " ENum: " << mySegmentNumber << " :::";
std::cout << std::endl;
}
+/*!
+ Draws line list with help of OpenGL
+ \param theDim - dimension
+*/
void GLViewer_LineList::show( FieldDim theDim )
{
if( !myArray )
}
}
-/****************************************************************************
-** Class: GLViewer_LineField
-** Descr: Tools for solving
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+
+/*!
+ Constructor
+*/
GLViewer_LineField::GLViewer_LineField()
{
myCurArrayIndex = 0;
myXLineArray = NULL;
myYLineArray = NULL;
}
+
+/*!
+ Constructor
+*/
GLViewer_LineField::GLViewer_LineField( const int theMAXSize, const int theXN, const int theYN )
{
myCurArrayIndex = 0;
}
}
+/*!
+ Destructor
+*/
GLViewer_LineField::~GLViewer_LineField()
{
if( myXLineArray )
delete myGraphArray2;
}
+/*!
+ Adds line
+*/
void GLViewer_LineField::addLine( FieldDim theDim, GLViewer_LineList* )
{
//not implemented
}
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theMC - main co-ordinate
+ \param theBegin - start co-ordinate
+ \param theEnd - end co-ordinate
+*/
void GLViewer_LineField:: addLine( FieldDim theDim, double theMC, double theBegin, double theEnd )
{
GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
addLine( theDim, aLL );
}
-
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theLL - main co-ordinate
+ \param thePosition - index in list
+*/
int GLViewer_LineField::insertLine( FieldDim theDim, GLViewer_LineList* theLL, int thePosition )
{
if( !myXLineArray || !myYLineArray )
return -1;
}
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theMainCoord - main co-ordinate
+ \param theBegin - start co-ordinate
+ \param theEnd - end co-ordinate
+ \param thePosition - index in list
+*/
int GLViewer_LineField::insertLine( FieldDim theDim, double theMainCoord, double theBegin, double theEnd, int thePosition )
{
GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
return insertLine( theDim, aLL, thePosition );
}
-
+/*!
+ \return other dimension
+*/
FieldDim GLViewer_LineField::invertDim( FieldDim theFD )
{
if( theFD == FD_X )
return FD_X;
}
+/*!
+ \return line list
+ \param theIndex - index in list
+ \param tehFD - dimension
+*/
GLViewer_LineList* GLViewer_LineField::getLine( int theIndex, FieldDim theFD )
{
if( !myXLineArray || !myYLineArray )
return NULL;
}
+/*!
+ Sets borders of field
+ \param X1, X2 - minimal and maximal abscisses
+ \param Y1, Y2 - minimal and maximal ordinates
+*/
void GLViewer_LineField::setBorders( double X1, double X2, double Y1, double Y2 )
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Adds rectangle
+ \param top, right - a corner of rectangle
+ \param bottom, left - other corner of rectangle
+*/
void GLViewer_LineField::addRectangle( double top, double right, double bottom, double left )
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Prints debug info about line field
+*/
void GLViewer_LineField::print()
{
std::cout << "My X matrix Number: " << myXSize << std::endl;
myYLineArray[j]->print();
}
+/*!
+ Draws field with help of OpenGL
+*/
void GLViewer_LineField::show()
{
for( int i = 0; i < myXSize; i++ )
std::cout << "Show function" << std::endl;
}
+/*!
+ \return size
+ \param theDim - dimension
+*/
int GLViewer_LineField::getDimSize( FieldDim theDim )
{
if( theDim == FD_X )
return -1;
}
+/*!
+ \return array of intersected indexes
+ \param theDim - dimension
+ \param theIndex - index
+ \param theLL - line with that intersection is checked
+ \param theSize - to return value of array size
+*/
int* GLViewer_LineField::intersectIndexes( FieldDim theDim, int theIndex, const GLViewer_LineList* theLL, int& theSize )
{
theSize = 0;
return anArray;
}
-
+/*!
+ Sets start/end search point
+ \param thePoint - type of point (start: FP_Start; end: FP_End )
+ \param theX, theY - point co-ordinates
+*/
bool GLViewer_LineField::setPoint( FieldPoint thePoint, double theX, double theY )
{
if( !myXLineArray || !myYLineArray )
return false;
}
+/*!
+ \return number of segments
+*/
int GLViewer_LineField::segmentNumber()
{
if( !(myXLineArray || myYLineArray) )
return aNumber;
}
+/*!
+ Removes all multiple segments
+*/
void GLViewer_LineField::optimize()
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Some prepare actions
+ Needs call setPoint before
+*/
void GLViewer_LineField::initialize()
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ One iteration of algorithm
+*/
void GLViewer_LineField::iteration()
{
int aParam = myCurCount;
delete[] aNodes;
}
+/*!
+ Checks for complete status
+*/
GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete()
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return IS_NOT_SOLVED;
}
+/*!
+ Finds LineList by counts and returns indexes
+*/
int* GLViewer_LineField::findByCount( int& theParam )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return anArray;
}
+/*!
+ Finds LineList by segment and dimension
+*/
int GLViewer_LineField::findBySegment( FieldDim theDim, int theLineIndex, int theSegment, bool inCurArray )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 || getDimSize( theDim ) <= theLineIndex )
return -1;
}
+/*!
+ Main method, performs algorithm execution
+*/
GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm()
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return ES_SOLVED;
}
+/*!
+ \return solution and size of solution
+*/
double* GLViewer_LineField::solution( int& theSize )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return anArray;
}
+/*!
+ \return current solution array
+*/
GraphNode* GLViewer_LineField::getCurArray()
{
if( !myGraphArray1 || !myGraphArray2 )
return myGraphArray2;
}
+/*!
+ \return other solution array
+*/
GraphNode* GLViewer_LineField::getSecArray()
{
if( !myGraphArray1 || !myGraphArray2 )
return myGraphArray1;
}
+/*!
+ \return maximum segment number
+*/
int GLViewer_LineField::maxSegmentNum()
{
if( !myXLineArray || !myYLineArray )
return max_num;
}
+/*!
+ \return list of LileList by dimension
+ \param theDim - dimension
+*/
GLViewer_LineList** GLViewer_LineField::getLLArray( FieldDim theDim )
{
if( theDim == FD_X )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
class GLViewer_LineField;
-/****************************************************************************
-** Class: GLViewer_Tools
-** Descr: Tools for Viewer
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+/*!
+ \class GLViewer_Tools
+ Tools for Viewer
+*/
class GLVIEWER_API GLViewer_Tools
{
public:
};
/*!
- Class GLViewer_LineList
+ \class GLViewer_LineList
Tools for distinct line
This class implmented interface for segment operations:
add, cut, remove and etc.
int mySolveIndex;
};
-/*! Class GLViewer_LineField
-* Tools for solving algorithm of finding shortest path on rare grid with minimum of
-* line turns number
+/*!
+ \class GLViewer_LineField
+ Tools for solving algorithm of finding shortest path on rare grid with minimum of
+ line turns number
*/
class GLViewer_LineField
{
//! Checks for complete status
IterationStatus checkComplete();
- //! Finds LileList by counts and returns indexes
+ //! Finds LineList by counts and returns indexes
int* findByCount( int& theParam );
- //! Finds LileList by segment and dimension
+ //! Finds LineList by segment and dimension
int findBySegment( FieldDim, int coord1, int coord2, bool inCurArray = true );
//! Returns current solution array
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_ViewFrame.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewFrame
-** Descr: Frame window for viewport in QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_ViewFrame.h"
#include "GLViewer_Viewer.h"
{
}
-//================================================================
-// Function : createActions
-// Purpose :
-//================================================================
+/*!
+ Creates actions of GL view frame
+*/
void GLViewer_ViewFrame::createActions()
{
if (!myActionsMap.isEmpty()) return;
myActionsMap[ ResetId ] = aAction;
}
-//================================================================
-// Function : createToolBar
-// Purpose :
-//================================================================
+/*!
+ Creates toolbar of GL view frame
+*/
void GLViewer_ViewFrame::createToolBar()
{
myActionsMap[DumpId]->addTo(myToolBar);
{
QWidget* p = parentWidget();
if ( p && p->inherits( "QWorkspaceChild" ) )
- p = p->parentWidget(); /* QWorkspaceChild: internal impl class in QWorkspace */
+ p = p->parentWidget();
if ( !p )
return QMainWindow::sizeHint();
return QSize( 9 * p->width() / 10 , 9 * p->height() / 10 );
//#include <windows.h>
+/*!
+ SLOT: called on dump view operation is activated, stores scene to raster file
+*/
void GLViewer_ViewFrame::onViewDump()
{
GLViewer_Widget* aWidget = ((GLViewer_ViewPort2d*)myVP)->getGLWidget();
}
}
+/*!
+ Start panning
+*/
void GLViewer_ViewFrame::onViewPan()
{
myViewer->activateTransform( GLViewer_Viewer::Pan );
}
+/*!
+ Start zooming
+*/
void GLViewer_ViewFrame::onViewZoom()
{
myViewer->activateTransform( GLViewer_Viewer::Zoom );
}
+/*!
+ Start fit all
+*/
void GLViewer_ViewFrame::onViewFitAll()
{
myViewer->activateTransform( GLViewer_Viewer::FitAll );
}
+/*!
+ Start fit area
+*/
void GLViewer_ViewFrame::onViewFitArea()
{
myViewer->activateTransform( GLViewer_Viewer::FitRect );
}
+/*!
+ Start fit selected
+*/
void GLViewer_ViewFrame::onViewFitSelect()
{
myViewer->activateTransform( GLViewer_Viewer::FitSelect );
}
+/*!
+ Start global panning
+*/
void GLViewer_ViewFrame::onViewGlobalPan()
{
myViewer->activateTransform( GLViewer_Viewer::PanGlobal );
}
+/*!
+ Start rotating
+*/
void GLViewer_ViewFrame::onViewRotate()
{
//myViewer->activateTransform( GLViewer_Viewer::Rotate );
}
+/*!
+ Start reset default view aspects
+*/
void GLViewer_ViewFrame::onViewReset()
{
myViewer->activateTransform( GLViewer_Viewer::Reset );
}
-
-//================================================================
-// Function : mouseEvent
-// Purpose : dispatches mouse events
-//================================================================
+
+/*!
+ Dispatches mouse events
+*/
void GLViewer_ViewFrame::mouseEvent( QMouseEvent* e )
{
switch ( e->type() )
}
}
-//================================================================
-// Function : keyEvent
-// Purpose : dispatches key events
-//================================================================
+/*!
+ Dispatches key events
+*/
void GLViewer_ViewFrame::keyEvent( QKeyEvent* e )
{
switch ( e->type() )
}
}
-//================================================================
-// Function : wheelEvent
-// Purpose : dispatches wheel events
-//================================================================
+/*!
+ Dispatches wheel events
+*/
void GLViewer_ViewFrame::wheelEvent( QWheelEvent* e )
{
switch ( e->type() )
break;
}
}
+
+/*!
+ \return the visual parameters of this view as a formated string
+*/
+QString GLViewer_ViewFrame::getVisualParameters()
+{
+ QString retStr;
+ if ( myVP && myVP->inherits( "GLViewer_ViewPort2d" ) ) {
+ GLViewer_ViewPort2d* vp2d = (GLViewer_ViewPort2d*)myVP;
+ GLfloat xSc, ySc, xPan, yPan;
+ vp2d->getScale( xSc, ySc );
+ vp2d->getPan( xPan, yPan );
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e", xSc, ySc, xPan, yPan );
+ }
+ return retStr;
+}
+
+/*!
+ The method restores visual parameters of this view from a formated string
+*/
+void GLViewer_ViewFrame::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( myVP && myVP->inherits( "GLViewer_ViewPort2d" ) && paramsLst.size() == 4) {
+ GLViewer_ViewPort2d* vp2d = (GLViewer_ViewPort2d*)myVP;
+
+ GLfloat xSc, ySc, xPan, yPan;
+ xSc = paramsLst[0].toDouble();
+ ySc = paramsLst[1].toDouble();
+ xPan = paramsLst[2].toDouble();
+ yPan = paramsLst[3].toDouble();
+
+ vp2d->getGLWidget()->setScale( xSc, ySc, 1. );
+ vp2d->getGLWidget()->setPan( xPan, yPan, 0. );
+ }
+}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_ViewFrame.h
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewFrame
-** Descr: Frame window for viewport in QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
#ifndef GLVIEWER_VIEWFRAME_H
#define GLVIEWER_VIEWFRAME_H
#pragma warning( disable:4251 )
#endif
-/*! Class GLViewer_ViewFrame
-* Frame window for viewport in GLViewer
+/*!
+ \class GLViewer_ViewFrame
+ Frame window for viewport in QAD-based application
*/
class GLVIEWER_API GLViewer_ViewFrame: public SUIT_ViewWindow
QSize sizeHint() const;
virtual void onUpdate( int );
+
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
signals:
void vfDrawExternal( QPainter* );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
int GLViewer_ViewManager::myMaxId = 0;
-//***************************************************************
+/*!Constructor.*/
GLViewer_ViewManager::GLViewer_ViewManager( SUIT_Study* theStudy, SUIT_Desktop* theDesktop )
: SUIT_ViewManager( theStudy, theDesktop )
{
setViewModel( new GLViewer_Viewer2d( "GLViewer" ) );
}
-//***************************************************************
+/*!Destructor.*/
GLViewer_ViewManager::~GLViewer_ViewManager()
{
}
-//***************************************************************
+/*!Sets view name for view window \a theView.*/
void GLViewer_ViewManager::setViewName(SUIT_ViewWindow* theView)
{
int aPos = myViews.find(theView);
theView->setCaption( QString( "GL scene:%1 - viewer:%2" ).arg(myId).arg(aPos+1));
}
-//***************************************************************
+/*!Context menu popup for \a popup.*/
void GLViewer_ViewManager::contextMenuPopup( QPopupMenu* popup )
{
SUIT_ViewManager::contextMenuPopup( popup );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_ViewPort.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewPort
-** Descr: Visualisation canvas of QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#if !(defined WNT) && !(defined QT_CLEAN_NAMESPACE)
#include <Xw_Window.hxx>
#include <Graphic3d_GraphicDevice.hxx>
+/*!
+ \struct CMapEntry
+ Map of indexed colors
+ For internal purposes
+*/
struct CMapEntry
{
CMapEntry();
XStandardColormap scmap;
};
+/*!
+ Constructor
+*/
CMapEntry::CMapEntry()
{
cmap = 0;
scmap.colormap = 0;
}
+/*!
+ Destructor
+*/
CMapEntry::~CMapEntry()
{
if ( alloc )
setBackgroundColor( selColor );
}
+/*!
+ Custom context menu event handler
+*/
void GLViewer_ViewPort::contextMenuEvent( QContextMenuEvent* e )
{
//if ( e->reason() != QContextMenuEvent::Mouse )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_ViewPort.h
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewPort
-** Descr: Visualisation canvas of GLViewer
-** Created: UI team, 05.09.04
-****************************************************************************/
#ifndef GLVIEWER_VIEWPORT_H
#define GLVIEWER_VIEWPORT_H
BS_Dragging = 0x0004
};
-/*!
- * Class GLViewer_ViewPort
- * Visualisation canvas of GLViewer
- */
+/*!
+ \class GLViewer_ViewPort
+ Visualisation canvas of GLViewer
+*/
class GLVIEWER_API GLViewer_ViewPort: public QWidget
{
Q_OBJECT
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
theY = aTempY;
}
+/*!
+ Constructor
+*/
GLViewer_ViewPort2d::GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* theViewFrame ) :
GLViewer_ViewPort( parent ),
myMargin( MARGIN ), myWidth( WIDTH ), myHeight( HEIGHT ),
// myGLWidget->installEventFilter( myObjectTip );
}
+/*!
+ Destructor
+*/
GLViewer_ViewPort2d::~GLViewer_ViewPort2d()
{
if( myCompass )
delete myGLWidget;
}
+/*!
+ SLOT: initializes drag process
+*/
void GLViewer_ViewPort2d::onStartDragObject( )
{
if( myIsDragProcess == noDrag )
}
}
+/*!
+ SLOT: cuts object to clipboard
+*/
void GLViewer_ViewPort2d::onCutObject()
{
/*GLViewer_Object* aMovingObject = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->getCurrentObject();
}
}
+/*!
+ SLOT: copies object to clipboard
+*/
void GLViewer_ViewPort2d::onCopyObject()
{
/*GLViewer_Object* aMovingObject = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->getCurrentObject();
}
}
+/*!
+ SLOT: pastes object from clipboard
+*/
void GLViewer_ViewPort2d::onPasteObject()
{
/*QClipboard *aClipboard = QApplication::clipboard();
*/
}
+/*!
+ SLOT: called when object is being dragged
+*/
void GLViewer_ViewPort2d::onDragObject( QMouseEvent* e )
{
//cout << "---GLViewer_ViewPort2d::onDragObject()---" << endl;
}
}
+/*!
+ Custom mouse double click event handler
+*/
void GLViewer_ViewPort2d::mouseDoubleClickEvent( QMouseEvent * e )
{
//redefined to block mouse release after mouse double click
GLViewer_ViewPort::mouseDoubleClickEvent( e );
}
+/*!
+ Creates or deletes compass
+ \param on - if it is true, then to create
+*/
void GLViewer_ViewPort2d::turnCompass( GLboolean on )
{
if( on )
delete myCompass;
}
+/*!
+ Creates or deletes grid
+ \param on - if it is true, then to create
+*/
void GLViewer_ViewPort2d::turnGrid( GLboolean on )
{
if( on )
delete myGrid;
}
+/*!
+ Changes grid color
+ \param gridColor - new grid color
+ \param axisColor - new axis color
+*/
void GLViewer_ViewPort2d::setGridColor( const QColor gridColor, const QColor axisColor )
{
if( myGrid )
}
}
+/*!
+ Changes background color
+ \param color - new background color
+*/
void GLViewer_ViewPort2d::setBackgroundColor( const QColor& color )
{
GLViewer_ViewPort::setBackgroundColor( color );
myGLWidget->repaint();
}
+/*!
+ \return background color
+*/
QColor GLViewer_ViewPort2d::backgroundColor() const
{
return GLViewer_ViewPort::backgroundColor();
}
+/*!
+ Resize view
+*/
void GLViewer_ViewPort2d::initResize( int x, int y )
{
float xa, xb, ya, yb;
myGLWidget->setScale( myXScale, myYScale, 1.0 );
}
+/*!
+ Custom paint event handler
+*/
void GLViewer_ViewPort2d::paintEvent( QPaintEvent* e )
{
//cout << "GLViewer_ViewPort2d::paintEvent" << endl;
GLViewer_ViewPort::paintEvent( e );
}
+/*!
+ Custom resize event handler
+*/
void GLViewer_ViewPort2d::resizeEvent( QResizeEvent* e )
{
//cout << "GLViewer_ViewPort2d::resizeEvent" << endl;
GLViewer_ViewPort::resizeEvent( e );
}
+/*!
+ Resets view to start state
+*/
void GLViewer_ViewPort2d::reset()
{
//cout << "GLViewer_ViewPort2d::reset" << endl;
myGLWidget->updateGL();
}
+/*!
+ Sets offset to view
+ \param dx - X offset
+ \param dy - Y offset
+*/
void GLViewer_ViewPort2d::pan( int dx, int dy )
{
//cout << "GLViewer_ViewPort2d::pan " << dx << " " << dy << endl;
myGLWidget->updateGL();
}
+/*!
+ Sets view center in global coords
+ \param x, y - global co-ordinates of center
+*/
void GLViewer_ViewPort2d::setCenter( int x, int y )
{
//cout << "GLViewer_ViewPort2d::setCenter" << endl;
myGLWidget->updateGL();
}
+/*!
+ Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 )
+*/
void GLViewer_ViewPort2d::zoom( int x0, int y0, int x, int y )
{
//cout << "GLViewer_ViewPort2d::zoom" << endl;
}
}
+/*!
+ Transforms view by rectangle
+ \param rect - rectangle
+*/
void GLViewer_ViewPort2d::fitRect( const QRect& rect )
{
float x0, x1, y0, y1;
myGLWidget->updateGL();
}
+/*!
+ Transforms view by selection
+*/
void GLViewer_ViewPort2d::fitSelect()
{
GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer();
}
}
+/*!
+ Transform view by view borders
+ \param keepScale - if it is true, zoom does not change
+*/
void GLViewer_ViewPort2d::fitAll( bool keepScale, bool withZ )
{
//cout << "GLViewer_ViewPort2d::fitAll" << endl;
emit vpUpdateValues();
}
+/*!
+ Begins rotation
+ \param x, y - start point
+*/
void GLViewer_ViewPort2d::startRotation( int x, int y )
{
myGLWidget->setRotationStart( x, y, 1.0 );
}
+/*!
+ Performs rotation
+ \param intX, intY - current point
+*/
void GLViewer_ViewPort2d::rotate( int intX, int intY )
{
GLint val[4];
myGLWidget->updateGL();
}
+/*!
+ Finishes rotation
+*/
void GLViewer_ViewPort2d::endRotation()
{
float ra, rx, ry, rz;
myGLWidget->setRotationAngle( ra );
}
+/*!
+ Draws compass
+*/
void GLViewer_ViewPort2d::drawCompass()
{
if( !myCompass->getVisible() )
glCallList( aTextList );
}
+/*!
+ \return blocking status for current started operations
+*/
BlockStatus GLViewer_ViewPort2d::currentBlock()
{
if( myIsDragProcess == inDrag && myCurDragPosX != NULL && myCurDragPosY != NULL)
return BS_NoBlock;
}
+/*!
+ Initializes rectangle selection
+ \param x, y - start point
+*/
void GLViewer_ViewPort2d::startSelectByRect( int x, int y )
{
if( !mypFirstPoint && !mypLastPoint )
mypLastPoint = new QPoint( x, y );
}
}
+
+/*!
+ Draws rectangle selection
+ \param x, y - current point
+*/
void GLViewer_ViewPort2d::drawSelectByRect( int x, int y )
{
if( mypFirstPoint && mypLastPoint )
}
}
+
+/*!
+ Finishes rectangle selection
+*/
void GLViewer_ViewPort2d::finishSelectByRect()
{
if( mypFirstPoint && mypLastPoint )
}
}
+/*!
+ \return rectangle selection
+*/
QRect GLViewer_ViewPort2d::selectionRect()
{
QRect aRect;
return aRect;
}
+/*!
+*/
bool GLViewer_ViewPort2d::startPulling( GLViewer_Pnt point )
{
GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer();
return false;
}
+/*!
+*/
void GLViewer_ViewPort2d::drawPulling( GLViewer_Pnt point )
{
GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer();
myPullingObject->pull( point, aLockedObject );
}
+/*!
+*/
void GLViewer_ViewPort2d::finishPulling()
{
myIsPulling = false;
setCursor( *getDefaultCursor() );
}
+/*!
+ Convert rectangle in window co-ordinates to GL co-ordinates
+ \return converted rectangle
+*/
GLViewer_Rect GLViewer_ViewPort2d::win2GLV( const QRect& theRect ) const
{
GLViewer_Rect aRect;
return aRect;
}
+/*!
+ Convert rectangle in GL co-ordinates to window co-ordinates
+ \return converted rectangle
+*/
QRect GLViewer_ViewPort2d::GLV2win( const GLViewer_Rect& theRect ) const
{
QRect aRect;
return aRect;
}
+/*!
+ SLOT: called when tooltip should be shown
+*/
void GLViewer_ViewPort2d::onMaybeTip( QPoint thePoint, QString& theText, QFont& theFont, QRect& theTextReg, QRect& theRegion )
{
GLViewer_Context* aContext = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
virtual void setCenter( int x, int y );
//! Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 )
virtual void zoom( int x0, int y0, int x1, int y1 );
- //! Transforms view by certangle
+ //! Transforms view by rectangle
virtual void fitRect( const QRect& );
//! Transforms view by selection
virtual void fitSelect();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Viewer.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_Viewer
-** Descr: Viewer for QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Viewer.h"
#include "GLViewer_Selector.h"
delete mySelector;
}
-//================================================================
-// Function : setViewManager
-// Purpose :
-//================================================================
+/*!
+ Sets new view manager
+ \param theViewManager - new view manager
+*/
void GLViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
SUIT_ViewModel::setViewManager(theViewManager);
}
}
-//================================================================
-// Function : contextMenuPopup
-// Purpose :
-//================================================================
+/*!
+ Builds popup for GL viewer
+*/
void GLViewer_Viewer::contextMenuPopup( QPopupMenu* thePopup )
{
if( thePopup->count() > 0 )
startOperations( e );
}
-/****************************************************************
-** Class: GLViewer_ViewTransformer
-** Level: Public
-*****************************************************************/
int GLViewer_ViewTransformer::panBtn = Qt::MidButton;
int GLViewer_ViewTransformer::zoomBtn = Qt::LeftButton;
int GLViewer_ViewTransformer::fitRectBtn = Qt::LeftButton;
}
-/****************************************************************
-** Class: GLViewer_ViewSketcher
-** Level: Public
-*****************************************************************/
int GLViewer_ViewSketcher::sketchBtn = LeftButton;
/*!
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
#endif
/*!
- * Class GLViewer_Object
- * Base Viewer for GLViewer
- */
+ \class GLViewer_Object
+ Base Viewer for GLViewer
+*/
class GLVIEWER_API GLViewer_Viewer: public SUIT_ViewModel
{
Q_OBJECT
GLViewer_ViewTransformer* myTransformer; /* transform manipulator */
};
-/****************************************************************
-** Class: GLViewer_ViewTransformer
-**
-*****************************************************************/
class GLVIEWER_API GLViewer_ViewTransformer : public QObject
{
public:
int myMajorBtn;
};
-/****************************************************************
-** Class: GLViewer_ViewSketcher
-**
-*****************************************************************/
class GLVIEWER_API GLViewer_ViewSketcher : public QObject
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Viewer2d.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_Viewer2d
-** Descr: OpenGL Viewer 2D
-** Module: GLViewer
-** Created: UI team, 04.09.02
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Viewer2d.h"
#include "GLViewer_Object.h"
#include <qpointarray.h>
#include <qcolordialog.h>
+/*!
+ Constructor
+ \param title - viewer title
+*/
GLViewer_Viewer2d::GLViewer_Viewer2d( const QString& title) :
GLViewer_Viewer( title )
{
myDrawers.clear();
}
+/*!
+ Destructor
+*/
GLViewer_Viewer2d::~GLViewer_Viewer2d()
{
//myGLSketcher = 0;
GLViewer_TexFont::clearTextBases();
}
+/*!Create new instance of view window on desktop \a theDesktop.
+ *\retval SUIT_ViewWindow* - created view window pointer.
+ */
SUIT_ViewWindow* GLViewer_Viewer2d::createView( SUIT_Desktop* theDesktop )
{
return new GLViewer_ViewFrame( theDesktop, this );
}
+/*!
+ Adds item for change background color
+ \param thePopup - menu
+*/
void GLViewer_Viewer2d::addPopupItems( QPopupMenu* thePopup )
{
// CTH8434. "Change background color" menu item is available if there are no selected objects
}
}
+/*!
+ Changes background color
+*/
void GLViewer_Viewer2d::onChangeBgColor()
{
if( !getActiveView() )
}
}
+/*!
+ Updates colors for all drawers (does not work)
+*/
void GLViewer_Viewer2d::updateColors( QColor colorH, QColor colorS )
{
// cout << "GLViewer_Viewer2d::updateColors" << endl;
activateAllDrawers( TRUE );
}
+/*!
+ Updates rect of global scene by adding new rectangle
+ \param theRect - rectangle
+*/
void GLViewer_Viewer2d::updateBorders( GLViewer_Rect* theRect )
{
QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
}
}
+/*!
+ Recomputes global scene rect
+*/
void GLViewer_Viewer2d::updateBorders()
{
QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
}
}
+/*!
+ Redraws all active objects by updating all drawers in all views
+*/
void GLViewer_Viewer2d::updateAll()
{
if ( !getActiveView() )
( ( GLViewer_ViewPort2d* )( ( GLViewer_ViewFrame* )views[i] )->getViewPort() )->getGLWidget()->updateGL();
}
+/*!
+ \param onlyUpdate is passed to method activateAllDrawers drawers
+*/
void GLViewer_Viewer2d::updateDrawers( GLboolean update, GLfloat scX, GLfloat scY )
{
// cout << "GLViewer_Viewer2d::updateDrawers" << endl;
activateAllDrawers( update );
}
+/*!
+ Activates drawers for objects from list \param theObjects only
+*/
void GLViewer_Viewer2d::activateDrawers( QValueList<GLViewer_Object*>& theObjects, bool onlyUpdate, GLboolean swap )
{
//cout << "GLViewer_Viewer2d::activateDrawers " << (int)onlyUpdate << " " << (int)swap << endl;
( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent();
}
+/*!
+ Activates drawer for \param theObject
+*/
void GLViewer_Viewer2d::activateDrawer( GLViewer_Object* theObject, bool onlyUpdate, GLboolean swap )
{
ObjList aList;
activateDrawers( aList, onlyUpdate, swap );
}
+/*!
+ \param onlyUpdate is passed to drawers
+*/
void GLViewer_Viewer2d::activateAllDrawers( bool onlyUpdate, GLboolean swap )
{
if ( !getActiveView() )
activateDrawers( anActiveObjs, onlyUpdate, swap );
}
+/*!
+ Creates set of marker
+ \param theMarkersNum - number of markers
+ \param theMarkersRad - radius of markers
+*/
void GLViewer_Viewer2d::onCreateGLMarkers( int theMarkersNum, int theMarkersRad )
{
if ( !getActiveView() )
delete[] anYCoord;
}
+/*!
+ Creates GL polyline
+ \param theAnglesNum - number of angles
+ \param theRadius - radius
+ \param thePolylineNumber - number
+*/
void GLViewer_Viewer2d::onCreateGLPolyline( int theAnglesNum, int theRadius, int thePolylineNumber )
{
if ( !getActiveView() )
delete[] anYCoord;
}
+/*!
+ Creates text
+ \param theStr - text string
+ \param theTextNumber - number
+*/
void GLViewer_Viewer2d::onCreateGLText( QString theStr, int theTextNumber )
{
if ( !getActiveView() )
activateAllDrawers( false );
}
+/*!
+ Translates point from global CS to curreent viewer CS
+ \param x, y - co-ordinates to be translated
+*/
void GLViewer_Viewer2d::transPoint( GLfloat& x, GLfloat& y )
{
if ( !getActiveView() )
y -= yPan;
}
+/*!
+ \return object rect in window CS
+ \param theObject - object
+*/
QRect* GLViewer_Viewer2d::getWinObjectRect( GLViewer_Object* theObject )
{
if ( !getActiveView() )
return newRect;
}
+/*!
+ Translates rect in window CS to rect in global CS
+ \param theRect - rectangle to be translated
+ \return transformed rect
+*/
GLViewer_Rect GLViewer_Viewer2d::getGLVRect( const QRect& theRect ) const
{
if ( !getActiveView() )
return vp->win2GLV( theRect );
}
+/*!
+ Translates rect in global CS to rect in window CS
+ \param theRect - rectangle to be translated
+ \return transformed rect
+*/
QRect GLViewer_Viewer2d::getQRect( const GLViewer_Rect& theRect ) const
{
if ( !getActiveView() )
return vp->GLV2win( theRect );
}
+/*!
+ \return new selector
+*/
GLViewer_Selector* GLViewer_Viewer2d::createSelector()
{
return new GLViewer_Selector2d( this, getGLContext() );
}
+/*!
+ \return new Transformer
+ \param type - type of new transformer
+*/
GLViewer_ViewTransformer* GLViewer_Viewer2d::createTransformer( int type )
{
return new GLViewer_View2dTransformer( this, type );
}
-/*
-GLViewer_Sketcher* GLViewer_Viewer2d::createGLSketcher( int type )
-{
- return new GLViewer_Sketcher( this, type );
-}
-void GLViewer_Viewer2d::activateGLSketching( int type )
-{
- GLViewer_ViewPort2d* vp = 0;
- if ( !getActiveView() || !( vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() ) )
- return;
-
- // Finish current sketching
- if ( type == None )
- {
- if ( myGLSketcher->getType() != None )
- {
- myGLSketcher->setType( None );
- finishSketching();
- }
- }
- // Activate new sketching
- else
- {
- activateGLSketching( None ); // concurrency not supported
- myGLSketcher->setType( type );
- startSketching();
- }
-}
-
-void GLViewer_Viewer2d::startSketching()
-{
- GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
- avp->setCursor( *avp->getSketchCursor() );
- //avp->enablePopup( false );
- myGLSketcher->startSketching();
-}
-
-void GLViewer_Viewer2d::finishSketching()
-{
- GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
- avp->setCursor( *avp->getDefaultCursor() );
- //avp->enablePopup( true );
- myGLSketcher->finishSketching();
-}
-
-bool GLViewer_Viewer2d::isSketchingActive()
-{
- return myGLSketcher->getType() != None;
-}
-
-int GLViewer_Viewer2d::getSketchingType()
-{
- return myGLSketcher->getType();
-}
-
-void GLViewer_Viewer2d::onSketchDelObject()
-{
- GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
- avp->setCursor( *avp->getDefaultCursor() );
- myGLSketcher->finishSketching( true );
-}
-
-void GLViewer_Viewer2d::onSketchUndoLast()
-{
-
-}
-
-void GLViewer_Viewer2d::onSketchFinish()
-{
- finishSketching();
-}
+/*!
+ Custom mouse event handler
*/
void GLViewer_Viewer2d::onMouseEvent( SUIT_ViewWindow*, QMouseEvent* e )
{
GLViewer_Viewer::onMouseEvent( 0, e );
}
+/*!
+ Rotation transformation
+*/
bool GLViewer_Viewer2d::testRotation( QMouseEvent* e )
{
if ( ( e->button() == GLViewer_View2dTransformer::rotateButton() ) &&
return false;
}
-
+/*!
+ Inserts text lines as header for file
+ \param aType - file type
+ \param hFile - file instance
+*/
void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile )
{
if( aType == POST_SCRIPT )
}
}
+/*!
+ Inserts text lines as ending for file
+ \param aType - file type
+ \param hFile - file instance
+*/
void GLViewer_Viewer2d::insertEnding( VectorFileType aType, QFile& hFile )
{
if( aType == POST_SCRIPT )
#endif
}
+/*!
+ Translates current view content to vector file
+ \param aType - type of file
+ \param FileName - name of file,
+ \param aPType - paper size type
+ \param mmLeft, mmRight, mmTop, mmBottom - margins
+*/
bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, PaperType aPType,
double mmLeft, double mmRight, double mmTop, double mmBottom )
{
return true;
}
-
+/*!
+ Repaints view
+ \param theView - view to be repainted. If it is NULL then all views will be repainted
+*/
void GLViewer_Viewer2d::repaintView( GLViewer_ViewFrame* theView, bool makeCurrent )
{
GLViewer_ViewFrame* aCurView;
// ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent();
}
+/*!
+ Starts some operation on mouse event
+*/
void GLViewer_Viewer2d::startOperations( QMouseEvent* e )
{
GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
vp->startSelectByRect( e->x(), e->y() );
}
+/*!
+ Updates started operation on mouse event
+*/
bool GLViewer_Viewer2d::updateOperations( QMouseEvent* e )
{
GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
return false;
}
+/*!
+ Completes started operation on mouse event
+*/
void GLViewer_Viewer2d::finishOperations( QMouseEvent* e )
{
GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
}
}
+/*!
+ Starts some operation on mouse wheel event
+*/
void GLViewer_Viewer2d::startOperations( QWheelEvent* e )
{
bool zoomIn = e->delta() > 0;
}
-/****************************************************************
-** Class: GLViewer_View2dTransformer
-**
-*****************************************************************/
-
int GLViewer_View2dTransformer::rotateBtn = RightButton;
+/*!
+ Constructor
+*/
GLViewer_View2dTransformer::GLViewer_View2dTransformer( GLViewer_Viewer* viewer, int typ )
: GLViewer_ViewTransformer( viewer, typ )
{
initTransform( true );
}
+/*!
+ Destructor
+*/
GLViewer_View2dTransformer::~GLViewer_View2dTransformer()
{
if ( type() == GLViewer_Viewer::Rotate )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Viewer2d.h
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_Viewer2d
-** Descr: OpenGL Viewer 2D
-** Module: GLViewer
-** Created: UI team, 04.09.04
-****************************************************************************/
#ifndef GLVIEWER_VIEWER2D_H
#define GLVIEWER_VIEWER2D_H
#pragma warning( disable:4251 )
#endif
-/*!
- * Class GLViewer_Object
- * 2D viewer for GLViewer
- */
+/*!
+ \class GLViewer_Viewer2d
+ OpenGL Viewer 2D
+*/
+
class GLVIEWER_API GLViewer_Viewer2d : public GLViewer_Viewer
{
Q_OBJECT
//GLViewer_Sketcher* myGLSketcher;
};
-/****************************************************************
-** Class: GLViewer_View2dTransformer
-**
-*****************************************************************/
class GLVIEWER_API GLViewer_View2dTransformer : public GLViewer_ViewTransformer
{
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Widget.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_Widget
-// Description : OpenGL QWidget for GLViewer
-//================================================================
-
#include "GLViewer_Widget.h"
#include "GLViewer_ViewPort2d.h"
#include "GLViewer_Viewer2d.h"
#include <qsize.h>
#include <qtooltip.h>
-//=======================================================================
-// Function: GLViewer_Widget
-// Purpose :
-//=======================================================================
+/*!
+ A constructor
+ Parameters using for QOGLWidget as is
+*/
GLViewer_Widget::GLViewer_Widget( QWidget* parent, const char* name ):
QGLWidget( parent, 0/*, WRepaintNoErase | WResizeNoErase*/ )
{
setMouseTracking( true );
}
-//=======================================================================
-// Function: GLViewer_Widget
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Widget::~GLViewer_Widget()
{
}
-//=======================================================================
-// Function: ~GLViewer_Widget
-// Purpose :
-//=======================================================================
+/*!
+ \return offset parameters of Window in OpenGL global scene
+*/
void GLViewer_Widget::getPan( GLfloat& xPan, GLfloat& yPan, GLfloat& zPan )
{
xPan = myXPan;
zPan = myZPan;
}
-//=======================================================================
-// Function: setPan
-// Purpose :
-//=======================================================================
+/*!
+ A function for installing the offset parameters of Window in OpenGL global scene
+*/
void GLViewer_Widget::setPan( GLfloat xPan, GLfloat yPan, GLfloat zPan )
{
myXPan = xPan;
myZPan = zPan;
}
-//=======================================================================
-// Function: getScale
-// Purpose :
-//=======================================================================
+/*!
+ \return scales on OpenGL scene along 3 directions in 2d scene zScale = 1.0
+*/
void GLViewer_Widget::getScale( GLfloat& xScale, GLfloat& yScale, GLfloat& zScale )
{
xScale = myXScale;
zScale = myZScale;
}
-//=======================================================================
-// Function: setScale
-// Purpose :
-//=======================================================================
+/*!
+ A function for installing the scales of OpenGL scene
+*/
void GLViewer_Widget::setScale( GLfloat xScale, GLfloat yScale, GLfloat zScale )
{
if ( xScale > 0 && yScale > 0 && zScale > 0 )
}
}
-//=======================================================================
-// Function: getRotationStart
-// Purpose :
-//=======================================================================
+/*!
+ \return start point of curren rotation of Window in OpenGL global scene
+*/
void GLViewer_Widget::getRotationStart( GLfloat& rotationStartX,
GLfloat& rotationStartY,
GLfloat& rotationStartZ )
rotationStartZ = myRotationStartZ;
}
-//=======================================================================
-// Function: setRotationStart
-// Purpose :
-//=======================================================================
+/*!
+ A function for installing the rotation angle of Window in OpenGL global scene in degree (Only in 2D)
+*/
void GLViewer_Widget::setRotationStart( GLfloat rotationStartX,
GLfloat rotationStartY,
GLfloat rotationStartZ )
myRotationStartZ = rotationStartZ;
}
-//=======================================================================
-// Function: getRotation
-// Purpose :
-//=======================================================================
+/*!
+ \return parameters of rotation
+ \param rotationAngle - angle
+ \param rotationCenterX - center x
+ \param rotationCenterY - center y
+ \param rotationCenterZ - center z
+*/
void GLViewer_Widget::getRotation( GLfloat& rotationAngle,
GLfloat& rotationCenterX,
GLfloat& rotationCenterY,
rotationCenterZ = myRotationCenterZ;
}
-//=======================================================================
-// Function: setRotation
-// Purpose :
-//=======================================================================
+/*!
+ Sets parameters of rotation
+ \param rotationAngle - angle
+ \param rotationCenterX - center x
+ \param rotationCenterY - center y
+ \param rotationCenterZ - center z
+*/
void GLViewer_Widget::setRotation( GLfloat rotationAngle,
GLfloat rotationCenterX,
GLfloat rotationCenterY,
myRotationCenterZ = rotationCenterZ;
}
-//=======================================================================
-// Function: setBackground
-// Purpose :
-//=======================================================================
+
+/*!
+ Sets image as background
+ \param filename - name of file
+*/
void GLViewer_Widget::setBackground( QString filename )
{
}
}
-//=======================================================================
-// Function: addToolTip
-// Purpose :
-//=======================================================================
+/*!
+ Adds tooltip
+ \param theString - tooltip text
+ \param theRect - tooltip rectangle
+*/
void GLViewer_Widget::addToolTip( QString theString, QRect theRect )
{
myToolTipRect = theRect;
QToolTip::add( this, myToolTipRect, theString );
}
-//=======================================================================
-// Function: removeToolTip
-// Purpose :
-//=======================================================================
+/*!
+ Removes tooltip
+*/
void GLViewer_Widget::removeToolTip()
{
QToolTip::remove( this, myToolTipRect );
}
-//=======================================================================
-// Function: initializeGL
-// Purpose :
-//=======================================================================
+/*!
+ Initialization (redefined virtual from QGLWidget)
+*/
void GLViewer_Widget::initializeGL()
{
setAutoBufferSwap( true );
isLoadBackground = false;
}
-//=======================================================================
-// Function: paintGL
-// Purpose :
-//=======================================================================
+/*!
+ Paints content
+*/
void GLViewer_Widget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
v->repaintView( getViewPort()->getViewFrame() );
}
-//=======================================================================
-// Function: resizeGL
-// Purpose :
-//=======================================================================
+/*!
+ Resets OpenGl parameters after resize
+ \param w - new width
+ \param h - new height
+*/
void GLViewer_Widget::resizeGL( int w, int h )
{
glLoadIdentity();
}
-//=======================================================================
-// Function: exportRepaint
-// Purpose :
-//=======================================================================
+/*!
+ Provides repaint in export mode
+*/
void GLViewer_Widget::exportRepaint()
{
isExportMode = true;
isExportMode = false;
}
-//=======================================================================
-// Function: paintEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom paint event handler
+*/
void GLViewer_Widget::paintEvent( QPaintEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: mouseMoveEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom mouse move event handler
+*/
void GLViewer_Widget::mouseMoveEvent( QMouseEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: mousePressEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom mouse press event handler
+*/
void GLViewer_Widget::mousePressEvent( QMouseEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: mouseReleaseEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom mouse release event handler
+*/
void GLViewer_Widget::mouseReleaseEvent( QMouseEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: enterEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom enter event handler
+*/
void GLViewer_Widget::enterEvent( QEvent* e )
{
updateGL();
}
-//=======================================================================
-// Function: leaveEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom leave event handler
+*/
void GLViewer_Widget::leaveEvent( QEvent* e )
{
updateGL();
}
-//=======================================================================
-//! Function: hex
-//! Purpose : Returns the hex code of digit < 16
-//=======================================================================
+/*!
+ \return the hex code of digit < 16
+ \param c - digit
+*/
inline char hex( uchar c )
{
if( c<=9 )
return ' ';
}
-//=======================================================================
-//! Function: AddImagePart
-//! Purpose : Translates path of image to PS format
-/*! Image inside rectangle from w1 to w2 and from h2 to h1*/
-//=======================================================================
+/*!
+ Translates part of image inside rectangle from w1 to w2 and from h2 to h1 to PS format
+ \param hFile - PostScript file
+ \param image - image to be tarnslated
+ \param w1 - x start position
+ \param w2 - x end position
+ \param h1 - y start position
+ \param h2 - y end position
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+ \param a
+ \param b
+ \param c
+ \param d
+ \param dw
+ \param dh
+*/
void AddImagePart( QFile& hFile, QImage& image, int w1, int w2, int h1, int h2,
GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS,
double a, double b, double c, double d, double dw, double dh )
}
}
-//=======================================================================
-// Function: getBackgroundRectInViewerCS
-// Purpose :
-//=======================================================================
+/*!
+ \return background rectangle in viewer CS
+*/
void GLViewer_Widget::getBackgroundRectInViewerCS( double& left, double& top, double& right, double& bottom )
{
left = -myIW/2; right = myIW/2;
top = myIH/2; bottom = -myIH/2;
}
-//=======================================================================
-// Function: translateBackgroundToPS
-// Purpose :
-//=======================================================================
+/*!
+ Translates background to PostScript
+ \param hFile - PostScript file
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+*/
void GLViewer_Widget::translateBackgroundToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
QImage buf;
}
}
-//=======================================================================
-//! Function: DecodeScanLine
-//! Purpose : Translate image line with one color depth to line wiht other depth
-//=======================================================================
+/*!
+ Translates image line with one color depth to line with other depth
+*/
void DecodeScanLine( int width, uchar* dest, int dest_depth, uchar* source, int source_depth )
{
#ifndef WIN32
}
}
-//=======================================================================
-// Function: translateBackgroundToEMF
-// Purpose :
-//=======================================================================
#ifdef WIN32
+/*!
+ Translates background to EMF
+ \param dc - descriptor of EMF
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+*/
void GLViewer_Widget::translateBackgroundToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
QImage buf;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : OPEN CASCADE
//
// File: GLViewer_Widget.h
// Created: November, 2004
-/*! Class GLViewer_Widget
- * Class for visualization OpenGL scene (widget) for GLViewer
- */
#ifndef GLVIEWER_WIDGET_H
#define GLVIEWER_WIDGET_H
class GLViewer_ViewPort2d;
class GLViewer_CoordSystem;
+/*!
+ \class GLViewer_Widget
+ Widget for visualization of OpenGL scene
+*/
class GLVIEWER_API GLViewer_Widget : public QGLWidget
{
Q_OBJECT
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : caf
LDFLAGS+=$(QT_MT_LIBS) $(CAS_KERNEL)
-LIBS+= -L${GUI_ROOT_DIR}/lib/salome -lsuit -L/usr/X11R6/lib -lGLU
+LIBS+= -lsuit -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lGLU
@CONCLUDE@
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: GLViewer_images.po
// Created: 10/25/2004 12:46:36 PM
// Author: Sergey Anikin
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: GLViewer_msg_en.po
// Created: 10/25/2004 12:46:36 PM
// Author: Sergey Anikin
msgid "ERROR"
msgstr "Error"
-msgid "BUT_OK"
-msgstr "Ok"
-
msgid "CHANGE_BGCOLOR"
msgstr "Change background..."
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp.h
// Created: June, 2005
// Author: OCC team
-// Copyright (C) CEA 2005
// The following ifdef block is the standard way of creating macros which make exporting
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_AboutDlg.cxx
// Created: 03.06.2005 13:52:45
// Author: Sergey TELKOV
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_AboutDlg.h
// Created: 03.06.2005 13:49:25
// Author: Sergey TELKOV
#include <QtxDialog.h>
-/*!
- Descr: LightApp help about dialog
-*/
-
class QLabel;
+/*!
+ \class LightApp_AboutDlg
+ LightApp help about dialog
+*/
class LIGHTAPP_EXPORT LightApp_AboutDlg : public QtxDialog
{
Q_OBJECT
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_Application.cxx
// Created: 6/20/2005 18:39:45 PM
// Author: Natalia Donis
// Copyright (C) CEA 2005
-#include "PythonConsole_PyInterp.h" // WARNING! This include must be the first!
+#ifndef DISABLE_PYCONSOLE
+ #include "PythonConsole_PyInterp.h" // WARNING! This include must be the first!
+ #include <PythonConsole_PyConsole.h>
+#endif
#include "LightApp_Application.h"
#include "LightApp_WidgetContainer.h"
#include "LightApp_OBFilter.h"
-#include "LightApp_GLSelector.h"
#include "LightApp_OBSelector.h"
-#include "LightApp_OCCSelector.h"
-#include "LightApp_VTKSelector.h"
#include "LightApp_SelectionMgr.h"
#include <CAM_Module.h>
#include <LogWindow.h>
#include <OB_Browser.h>
#include <OB_ListView.h>
-#include <PythonConsole_PyConsole.h>
-#include <GLViewer_Viewer.h>
-#include <GLViewer_ViewManager.h>
+#ifndef DISABLE_GLVIEWER
+ #include <GLViewer_Viewer.h>
+ #include <GLViewer_ViewManager.h>
+ #include "LightApp_GLSelector.h"
+#endif
-#include <Plot2d_ViewManager.h>
-#include <Plot2d_ViewModel.h>
-#include <SPlot2d_ViewModel.h>
+#ifndef DISABLE_PLOT2DVIEWER
+ #include <Plot2d_ViewManager.h>
+ #include <Plot2d_ViewModel.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SPlot2d_ViewModel.h>
+#else
+ #include <Plot2d_ViewModel.h>
+#endif
+#endif
-#include <OCCViewer_ViewManager.h>
-#include <SOCC_ViewModel.h>
+#ifndef DISABLE_OCCVIEWER
+ #include <OCCViewer_ViewManager.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SOCC_ViewModel.h>
+#else
+ #include <OCCViewer_ViewModel.h>
+#endif
+ #include "LightApp_OCCSelector.h"
+#endif
-#include <SVTK_ViewModel.h>
-#include <SVTK_ViewManager.h>
-#include <VTKViewer_ViewModel.h>
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SVTK_ViewModel.h>
+ #include <SVTK_ViewManager.h>
+ #include "LightApp_VTKSelector.h"
+#else
+ #include <VTKViewer_ViewModel.h>
+ #include <VTKViewer_ViewManager.h>
+#endif
+ #include <VTKViewer_ViewModel.h>
+#endif
-#include <SUPERVGraph_ViewModel.h>
-#include <SUPERVGraph_ViewFrame.h>
-#include <SUPERVGraph_ViewManager.h>
+//#ifndef DISABLE_SUPERVGRAPHVIEWER
+// #include <SUPERVGraph_ViewModel.h>
+// #include <SUPERVGraph_ViewFrame.h>
+// #include <SUPERVGraph_ViewManager.h>
+//#endif
#include <QtxWorkstack.h>
#include <qcombobox.h>
#include <qinputdialog.h>
#include <qmessagebox.h>
+#include <qfontdatabase.h>
#define FIRST_HELP_ID 1000000
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIO.hxx"
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+ #include "SALOME_ListIO.hxx"
+#endif
static const char* imageEmptyIcon[] = {
"20 20 1 1",
"....................",
"...................."};
+int LightApp_Application::lastStudyId = 0;
+
+/*!
+ \return last global id of study
+*/
+int LightApp_Application::studyId()
+{
+ return LightApp_Application::lastStudyId;
+}
+
/*!Create new instance of LightApp_Application.*/
extern "C" LIGHTAPP_EXPORT SUIT_Application* createApplication()
{
return new LightApp_Application();
}
+/*! \var global preferences of LightApp */
LightApp_Preferences* LightApp_Application::_prefs_ = 0;
-/*
- Class : LightApp_Application
- Description : Application containing LightApp module
+/*!
+ \class LightApp_Application
+ Application containing LightApp module
*/
/*!Constructor.*/
mySelMgr = new LightApp_SelectionMgr( this );
- myAccel = new SUIT_Accel( desktop() );
+ myAccel = SUIT_Accel::getAccel();
+
+#ifndef DISABLE_OCCVIEWER
myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, OCCViewer_Viewer::Type() );
+#endif
+#ifndef DISABLE_VTKVIEWER
myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, VTKViewer_Viewer::Type() );
+#endif
connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
+
+ // Set existing font for the python console in resources
+ if( !aResMgr->hasValue( "PyConsole", "font" ) )
+ return;
+
+ QFont f = aResMgr->fontValue( "PyConsole", "font" );
+ QFontDatabase fdb;
+ QStringList famdb = fdb.families();
+
+ if ( famdb.contains(f.family()) || !aResMgr->hasValue( "PyConsole", "additional_families" ) )
+ return;
+
+ QStringList anAddFamilies = QStringList::split( ";", aResMgr->stringValue( "PyConsole", "additional_families" ) );
+ QString aFamily;
+ for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it )
+ {
+ aFamily = *it;
+ if ( famdb.contains(aFamily) )
+ {
+ f.setFamily( aFamily );
+ aResMgr->setValue( "PyConsole", "font", f );
+ break;
+ }
+ }
}
/*!Destructor.
*/
LightApp_Application::~LightApp_Application()
{
- saveWindowsGeometry();
-
- if ( resourceMgr() )
- {
- if ( desktop() )
- desktop()->saveGeometry( resourceMgr(), "desktop" );
- resourceMgr()->save();
- }
delete mySelMgr;
}
return true;
}
+/*!
+ Opens other study into active Study. If Study is empty - creates it.
+ \param theName - name of study
+*/
bool LightApp_Application::useStudy(const QString& theName)
{
createEmptyStudy();
return mySelMgr;
}
+/*!Creat action "New window" for certain type of viewer:*/
+void LightApp_Application::createActionForViewer( const int id,
+ const int parentId,
+ const QString& suffix,
+ const int accel )
+{
+ QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), QIconSet(),
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ),
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ),
+ accel, desktop(), false, this, SLOT( onNewWindow() ) );
+ createMenu( a, parentId, -1 );
+}
+
/*!Create actions:*/
void LightApp_Application::createActions()
{
int id = LightApp_Application::UserID + FIRST_HELP_ID;
// help for KERNEL and GUI
QCString dir;
- QString aFileName;
+ QString aFileName = "index.htm";
QString root;
QAction* a;
if (dir = getenv("GUI_ROOT_DIR")) {
- aFileName = "GUI_index_v3.1.0.html";
- root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") );
+ root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") +
+ Qtx::addSlash("gui") + Qtx::addSlash("GUI") );
if ( QFileInfo( root + aFileName ).exists() ) {
- a = createAction( id, tr( QString("Kernel & GUI Help") ), QIconSet(),
- tr( QString("Kernel && GUI Help") ),
- tr( QString("Kernel & GUI Help") ),
+ a = createAction( id, tr( QString("GUI Help") ), QIconSet(),
+ tr( QString("GUI Help") ),
+ tr( QString("GUI Help") ),
0, desk, false, this, SLOT( onHelpContentsModule() ) );
a->setName( QString("GUI") );
createMenu( a, helpModuleMenu, -1 );
id++;
}
}
+ if (dir = getenv("KERNEL_ROOT_DIR")) {
+ QString aFN = "index.html";
+ root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") +
+ Qtx::addSlash("salome") );
+ if ( QFileInfo( root + aFN ).exists() ) {
+ a = createAction( id, tr( QString("KERNEL Help") ), QIconSet(),
+ tr( QString("KERNEL Help") ),
+ tr( QString("KERNEL Help") ),
+ 0, desk, false, this, SLOT( onHelpContentsModule() ) );
+ a->setName( QString("KERNEL") );
+ createMenu( a, helpModuleMenu, -1 );
+ id++;
+ }
+ }
// help for other existing modules
QStringList::Iterator it;
for ( it = aModuleList.begin(); it != aModuleList.end(); ++it )
continue;
QString modName = moduleName( *it );
- aFileName = modName + "_index_v3.1.0.html";
if (dir = getenv( modName + "_ROOT_DIR")) {
- root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") );
+ root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") +
+ Qtx::addSlash("gui") + Qtx::addSlash(modName) );
if ( QFileInfo( root + aFileName ).exists() ) {
QAction* a = createAction( id, tr( moduleTitle(modName) + QString(" Help") ), QIconSet(),
for ( it = modList.begin(); it != modList.end(); ++it )
{
- if ( (*it).isEmpty() )
+ if ( !isLibExists( *it ) )
+ {
+ qDebug( QString( "Library '%1' cannot be found" ).arg( *it ) );
continue;
+ }
QString iconName;
if ( iconMap.contains( *it ) )
SUIT_Tools::simplifySeparators( modTBar );
// New window
- int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 );
int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
createMenu( separator(), windowMenu, -1, 1 );
- QMap<int, int> accelMap;
- accelMap[NewGLViewId] = ALT+Key_G;
- accelMap[NewPlot2dId] = ALT+Key_P;
- accelMap[NewOCCViewId] = ALT+Key_O;
- accelMap[NewVTKViewId] = ALT+Key_K;
- for ( id = NewGLViewId; id <= NewVTKViewId; id++ )
- {
- QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ), QIconSet(),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- accelMap.contains( id ) ? accelMap[id] : 0, desk, false, this, SLOT( onNewWindow() ) );
- createMenu( a, newWinMenu, -1 );
- }
+#ifndef DISABLE_GLVIEWER
+ createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ), ALT+Key_G );
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ createActionForViewer( NewPlot2dId, newWinMenu, QString::number( 1 ), ALT+Key_P );
+#endif
+#ifndef DISABLE_OCCVIEWER
+ createActionForViewer( NewOCCViewId, newWinMenu, QString::number( 2 ), ALT+Key_O );
+#endif
+#ifndef DISABLE_VTKVIEWER
+ createActionForViewer( NewVTKViewId, newWinMenu, QString::number( 3 ), ALT+Key_K );
+#endif
+
createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
SHIFT+Key_R, desk, false, this, SLOT( onRenameWindow() ) );
int id = actionId( (QAction*)obj );
switch ( id )
{
+#ifndef DISABLE_GLVIEWER
case NewGLViewId:
type = GLViewer_Viewer::Type();
break;
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
case NewPlot2dId:
type = Plot2d_Viewer::Type();
break;
+#endif
+#ifndef DISABLE_OCCVIEWER
case NewOCCViewId:
type = OCCViewer_Viewer::Type();
break;
+#endif
+#ifndef DISABLE_VTKVIEWER
case NewVTKViewId:
type = VTKViewer_Viewer::Type();
break;
+#endif
}
if ( !type.isEmpty() )
createViewManager( type );
}
-//=======================================================================
-// name : onNewDoc
-/*! Purpose : SLOT. Create new document*/
-//=======================================================================
+/*!
+ SLOT: Creates new document
+*/
void LightApp_Application::onNewDoc()
{
SUIT_Study* study = activeStudy();
}
}
-//=======================================================================
-// name : onOpenDoc
-/*! Purpose : SLOT. Open new document*/
-//=======================================================================
+/*!
+ SLOT: Opens new document
+*/
void LightApp_Application::onOpenDoc()
{
SUIT_Study* study = activeStudy();
}
#include "SUIT_MessageBox.h"
-/*! Purpose : SLOT. Open new document with \a aName.*/
+
+/*!
+ SLOT: Opens new document.
+ \param aName - name of file
+*/
bool LightApp_Application::onOpenDoc( const QString& aName )
{
bool isAlreadyOpen = false;
return res;
}
-//=======================================================================
-// name : onHelpAbout
-/*! Purpose : SLOT. Display "About" message box*/
-//=======================================================================
+/*!
+ SLOT: Displays "About" message box
+*/
void LightApp_Application::onHelpAbout()
{
LightApp_AboutDlg* dlg = new LightApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
delete dlg;
}
-/*!SLOT. Load document with \a aName.*/
+/*!
+ SLOT: Loads document
+ \param aName - name of document
+*/
bool LightApp_Application::onLoadDoc( const QString& aName )
{
bool res = CAM_Application::onLoadDoc( aName );
return res;
}
-/*!Private SLOT. Selection.*/
+/*!
+ Private SLOT: Called on selection is changed
+ Dispatchs active module that selection is changed
+*/
void LightApp_Application::onSelection()
{
onSelectionChanged();
((LightApp_Module*)activeModule())->selectionChanged();
}
-/*!Set active study.
- *\param study - SUIT_Study.
- */
+/*!
+ Sets active study.
+ \param study - SUIT_Study.
+*/
void LightApp_Application::setActiveStudy( SUIT_Study* study )
{
CAM_Application::setActiveStudy( study );
activateWindows();
}
-//=======================================================================
-// name : updateCommandsStatus
-/*! Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu*/
-//=======================================================================
+/*!
+ Enables/Disables menu items and toolbar buttons. Rebuild menu
+*/
void LightApp_Application::updateCommandsStatus()
{
CAM_Application::updateCommandsStatus();
+ QAction* a = 0;
- for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
- {
- QAction* a = action( id );
- if ( a )
- a->setEnabled( activeStudy() );
- }
+#ifndef DISABLE_GLVIEWER
+ a = action( NewGLViewId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
+
+#ifndef DISABLE_PLOT2DVIEWER
+ a = action( NewPlot2dId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
+
+#ifndef DISABLE_OCCVIEWER
+ a = action( NewOCCViewId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
+
+#ifndef DISABLE_VTKVIEWER
+ a = action( NewVTKViewId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
}
-// Helps to execute command
+/*!
+ \class RunBrowser
+ Runs system command in separate thread
+*/
class RunBrowser: public QThread {
public:
- RunBrowser(QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL):
+ RunBrowser( LightApp_Application* app, QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL):
myApp(theApp), myParams(theParams),
#ifdef WIN32
myHelpFile("file://" + theHelpFile + theContext),
#else
myHelpFile("file:" + theHelpFile + theContext),
#endif
- myStatus(0) {};
+ myStatus(0),
+ myLApp( app )
+{
+};
virtual void run()
{
myStatus = system(aCommand);
if(myStatus != 0)
{
- QCustomEvent* ce2000 = new QCustomEvent (2000);
- postEvent (qApp, ce2000);
+ QCustomEvent* ce2000 = new QCustomEvent( 2000 );
+ QString* msg = new QString( QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile) );
+ ce2000->setData( msg );
+ postEvent( myLApp, ce2000 );
}
}
- if( myStatus != 0)
- {
- qApp->lock();
- SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
- QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile),
- QObject::tr("BUT_OK"));
- qApp->unlock();
- }
}
private:
QString myParams;
QString myHelpFile;
int myStatus;
-
+ LightApp_Application* myLApp;
};
-//=======================================================================
-// name : onHelpContentsModule
-/*! Purpose : SLOT. Display help contents for choosen module*/
-//=======================================================================
+/*!
+ SLOT: Displays help contents for choosen module
+*/
void LightApp_Application::onHelpContentsModule()
{
const QAction* obj = (QAction*) sender();
QString aComponentName = obj->name();
- QString aFileName = aComponentName + "_index_v3.1.0.html";
+ QString aFileName = "index.htm";
+ QString aFileNameKernel = "index.html";
QCString dir = getenv( aComponentName + "_ROOT_DIR");
- QString homeDir = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") );
+ QString homeDir = !aComponentName.compare(QString("KERNEL")) ?
+ Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") ) :
+ Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") + Qtx::addSlash("gui") + Qtx::addSlash(aComponentName) );
+
+ QString helpFile = QFileInfo( homeDir + (!aComponentName.compare(QString("KERNEL")) ? aFileNameKernel : aFileName) ).absFilePath();
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+ QString anApp = resMgr->stringValue("ExternalBrowser", "application");
+ QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
+
+ if (!anApp.isEmpty()) {
+ RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile );
+ rs->start();
+ }
+ else {
+ if( SUIT_MessageBox::warn2(desktop(), tr("WRN_WARNING"),
+ tr("DEFINE_EXTERNAL_BROWSER"),
+ tr("BUT_OK"),tr("BUT_CANCEL"),0,1,0 )==0 )
+ onPreferences();
+ }
+}
- QString helpFile = QFileInfo( homeDir + aFileName ).absFilePath();
+/*!
+ SLOT: Displays help contents for choosen dialog
+*/
+void LightApp_Application::onHelpContextModule(const QString& theComponentName, const QString& theFileName)
+{
+ QCString dir = getenv( theComponentName + "_ROOT_DIR");
+ QString homeDir = Qtx::addSlash(Qtx::addSlash(dir)+Qtx::addSlash("doc")+Qtx::addSlash("salome")+Qtx::addSlash("gui")+Qtx::addSlash(theComponentName));
+
+ QString helpFile = QFileInfo( homeDir + theFileName ).absFilePath();
SUIT_ResourceMgr* resMgr = resourceMgr();
QString anApp = resMgr->stringValue("ExternalBrowser", "application");
QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
if (!anApp.isEmpty()) {
- RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
+ RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile );
rs->start();
}
else {
- SUIT_MessageBox::warn1(desktop(), tr("WRN_WARNING"),
+ if( SUIT_MessageBox::warn2(desktop(), tr("WRN_WARNING"),
tr("DEFINE_EXTERNAL_BROWSER"),
- tr("BUT_OK"));
+ tr("BUT_OK"), tr("BUT_CANCEL"),0,1,0)==0 )
+ onPreferences();
}
}
-/*!Sets enable or disable some actions on selection changed.*/
+/*!
+ Sets enable or disable some actions on selection changed.
+*/
void LightApp_Application::onSelectionChanged()
{
}
-/*!Return window.
- *\param flag - key for window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ \return window by key
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
QWidget* LightApp_Application::window( const int flag, const int studyId ) const
{
QWidget* wid = 0;
return wid;
}
-/*!Adds window to application.
- *\param wid - QWidget
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ Adds window to application.
+ \param wid - QWidget
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
void LightApp_Application::addWindow( QWidget* wid, const int flag, const int studyId )
{
if ( !wid )
LightApp_WidgetContainer* newWC = new LightApp_WidgetContainer( flag, desktop() );
connect( newWC, SIGNAL( destroyed ( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) );
+ // asv: connecting a slot for storing visibility flag of a window
+ connect( newWC, SIGNAL( visibilityChanged ( bool ) ), SLOT( onVisibilityChanged( bool ) ) );
myWindows.insert( flag, newWC );
if ( winMap.contains( flag ) )
desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] );
}
QFont f;
+#ifndef DISABLE_PYCONSOLE
if( wid->inherits( "PythonConsole" ) )
{
if( resourceMgr()->hasValue( "PyConsole", "font" ) )
f = resourceMgr()->fontValue( "PyConsole", "font" );
else
- {
- f = ( ( PythonConsole* )wid )->font();
- resourceMgr()->setValue( "PyConsole", "font", f );
- }
+ {
+ f = ( ( PythonConsole* )wid )->font();
+ resourceMgr()->setValue( "PyConsole", "font", f );
+ }
}
else
+#endif
f = wid->font();
myWindows[flag]->insert( sId, wid );
setWindowShown( flag, !myWindows[flag]->isEmpty() );
}
-/*!Remove window from application.
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ Removes window from application.
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
void LightApp_Application::removeWindow( const int flag, const int studyId )
{
if ( !myWindows.contains( flag ) )
setWindowShown( flag, !myWindows[flag]->isEmpty() );
}
-/*!Gets window.
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ Gets window.
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
QWidget* LightApp_Application::getWindow( const int flag, const int studyId )
{
QWidget* wid = window( flag, studyId );
return wid;
}
-/*!Check is window visible?(with identificator \a type)*/
+/*!
+ \return is window visible
+ \param type - flag of window
+*/
bool LightApp_Application::isWindowVisible( const int type ) const
{
bool res = false;
return res;
}
-/*!Sets window show or hide.
- *\param type - window identificator.
- *\param on - true/false (window show/hide)
- */
+/*!
+ Sets window show or hide.
+ \param type - window identificator.
+ \param on - true/false (window show/hide)
+*/
void LightApp_Application::setWindowShown( const int type, const bool on )
{
if ( !desktop() || !myWindows.contains( type ) )
QDockWindow* dw = myWindows[type];
desktop()->setAppropriate( dw, on );
- on ? dw->show() : dw->hide();
+ if( on )
+ dw->show();
+ else if( dw->isShown() )
+ {
+ dw->hide();
+ myWindowsVisible[ type ] = true;
+ }
}
-/*!Gets "ObjectBrowser".*/
+/*!
+ \return Object Browser
+*/
OB_Browser* LightApp_Application::objectBrowser()
{
OB_Browser* ob = 0;
return ob;
}
-/*!Gets "LogWindow".*/
+/*!
+ \return Log Window
+*/
LogWindow* LightApp_Application::logWindow()
{
LogWindow* lw = 0;
return lw;
}
-/*!Get "PythonConsole"*/
+#ifndef DISABLE_PYCONSOLE
+/*!
+ \return Python Console
+*/
PythonConsole* LightApp_Application::pythonConsole()
{
PythonConsole* console = 0;
console = (PythonConsole*)wid;
return console;
}
+#endif
-/*!Update obect browser*/
+/*!
+ Updates object browser and maybe data models
+ \param updateModels - if it is true, then data models are updated
+*/
void LightApp_Application::updateObjectBrowser( const bool updateModels )
{
// update existing data models
if ( updateModels )
{
+ const bool isAutoUpdate = objectBrowser() ? objectBrowser()->isAutoUpdate() : true;
+ if( objectBrowser() )
+ objectBrowser()->setAutoUpdate( false );
+
LightApp_Study* study = dynamic_cast<LightApp_Study*>(activeStudy());
if ( study ) {
CAM_Study::ModelList dm_list;
((LightApp_DataModel*)camDM)->update();
}
}
+
+ if( objectBrowser() )
+ objectBrowser()->setAutoUpdate( isAutoUpdate );
}
if ( objectBrowser() )
{
}
}
-/*!Gets preferences.*/
+/*!
+ \return preferences
+*/
LightApp_Preferences* LightApp_Application::preferences() const
{
return preferences( false );
}
-/*!Gets view manager*/
+/*!
+ \return first view manager of some type
+ \param vmType - type of view manager
+ \param create - is it necessary to create view manager in case, when there is no manager of such type
+*/
SUIT_ViewManager* LightApp_Application::getViewManager( const QString& vmType, const bool create )
{
SUIT_ViewManager* aVM = viewManager( vmType );
return aVM;
}
-/*!Create view manager.*/
+/*!
+ Creates view manager of some type
+ \param vmType - type of view manager
+*/
SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType )
{
SUIT_ResourceMgr* resMgr = resourceMgr();
SUIT_ViewManager* viewMgr = 0;
+#ifndef DISABLE_GLVIEWER
if( vmType == GLViewer_Viewer::Type() )
{
viewMgr = new GLViewer_ViewManager( activeStudy(), desktop() );
new LightApp_GLSelector( (GLViewer_Viewer2d*)viewMgr->getViewModel(), mySelMgr );
}
- else if( vmType == Plot2d_Viewer::Type() )
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ if( vmType == Plot2d_Viewer::Type() )
{
viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() );
- SPlot2d_Viewer* vm = new SPlot2d_Viewer();
+ Plot2d_Viewer* vm;
+#ifndef DISABLE_SALOMEOBJECT
+ vm = new SPlot2d_Viewer();
+#else
+ vm = new Plot2d_Viewer();
+#endif
viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( viewMgr->getActiveView() );
if( wnd )
frame->setBackgroundColor( resMgr->colorValue( "Plot2d", "Background", frame->backgroundColor() ) );
}
}
- else if( vmType == SUPERVGraph_Viewer::Type() )
- {
- viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop() );
- SUPERVGraph_Viewer* vm = new SUPERVGraph_Viewer();
- SUPERVGraph_ViewFrame* view = dynamic_cast<SUPERVGraph_ViewFrame*>( vm->getViewManager()->getActiveView() );
- if( view )
- view->setBackgroundColor( resMgr->colorValue( "SUPERVGraph", "Background", view->backgroundColor() ) );
- }
- else if( vmType == OCCViewer_Viewer::Type() )
+#endif
+ //#ifndef DISABLE_SUPERVGRAPHVIEWER
+ // if( vmType == SUPERVGraph_Viewer::Type() )
+ // {
+ // viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop(), new SUPERVGraph_Viewer() );
+ // }
+ //#endif
+#ifndef DISABLE_OCCVIEWER
+ if( vmType == OCCViewer_Viewer::Type() )
{
viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() );
- SOCC_Viewer* vm = new SOCC_Viewer();
+ OCCViewer_Viewer* vm;
+#ifndef DISABLE_SALOMEOBJECT
+ vm = new SOCC_Viewer();
+#else
+ vm = new OCCViewer_Viewer();
+#endif
vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
vm->setTrihedronSize( resMgr->integerValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) );
int u( 1 ), v( 1 );
viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
new LightApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
}
- else if ( vmType == SVTK_Viewer::Type() )
+#endif
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ if ( vmType == SVTK_Viewer::Type() )
+#else
+ if ( vmType == VTKViewer_Viewer::Type() )
+#endif
{
+#ifndef DISABLE_SALOMEOBJECT
viewMgr = new SVTK_ViewManager( activeStudy(), desktop() );
SVTK_Viewer* vm = dynamic_cast<SVTK_Viewer*>( viewMgr->getViewModel() );
if( vm )
{
vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
- vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ) );
+ vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ),
+ resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) );
new LightApp_VTKSelector( vm, mySelMgr );
}
+#else
+ viewMgr = new VTKViewer_ViewManager( activeStudy(), desktop() );
+ VTKViewer_Viewer* vm = dynamic_cast<VTKViewer_Viewer*>( viewMgr->getViewModel() );
+ if ( vm )
+ vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
+#endif
}
+#endif
if ( !viewMgr )
return 0;
if ( viewWin && desktop() )
viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
- connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
- this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
-
return viewMgr;
}
-//=======================================================================
-// name : onCloseView
-/*! Purpose : SLOT. Remove view manager from application*/
-//=======================================================================
+/*!
+ SLOT: Removes view manager from application
+*/
void LightApp_Application::onCloseView( SUIT_ViewManager* theVM )
{
removeViewManager( theVM );
}
-/*!Protected SLOT. On study created.*/
+/*!
+ Protected SLOT: On study created.
+ \param theStudy - just created study
+*/
void LightApp_Application::onStudyCreated( SUIT_Study* theStudy )
{
SUIT_DataObject* aRoot = 0;
activateWindows();
}
-/*!Protected SLOT. On study opened.*/
+/*!
+ Protected SLOT: On study opened.
+ \param theStudy - just opened study
+*/
void LightApp_Application::onStudyOpened( SUIT_Study* theStudy )
{
SUIT_DataObject* aRoot = 0;
*/
QString LightApp_Application::getFileFilter() const
{
- return "(*.bin)";
- // HDF persistence not yet completed - to be uncommented later
- //return "(*.hdf)";
+ //return "(*.bin)";
+ // HDF persistence
+ return "(*.hdf)";
}
-/*! Gets file name*/
+/*!
+ Shows file dialog and return user selected file name
+*/
QString LightApp_Application::getFileName( bool open, const QString& initial, const QString& filters,
const QString& caption, QWidget* parent )
{
updateCommandsStatus();
}
-//=======================================================================
-// name : createNewStudy
-/*! Purpose : Create new study*/
-//=======================================================================
+/*!
+ Creates new study
+*/
SUIT_Study* LightApp_Application::createNewStudy()
{
+ LightApp_Application::lastStudyId++;
+
LightApp_Study* aStudy = new LightApp_Study( this );
// Set up processing of major study-related events
return aStudy;
}
-/*!Create window.*/
+/*!
+ Creates window by flag.
+ \param flag - identificator of window type
+*/
QWidget* LightApp_Application::createWindow( const int flag )
{
QWidget* wid = 0;
{
OB_Browser* ob = new OB_Browser( desktop() );
ob->setAutoUpdate( true );
- ob->setAutoOpenLevel( 1 );
+ //ob->setAutoOpenLevel( 1 ); // commented by ASV as a fix to bug IPAL10107
ob->setCaption( tr( "OBJECT_BROWSER" ) );
OB_ListView* ob_list = dynamic_cast<OB_ListView*>( const_cast<QListView*>( ob->listView() ) );
ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
+#ifndef DISABLE_PYCONSOLE
else if ( flag == WT_PyConsole )
{
PythonConsole* pyCons = new PythonConsole( desktop() );
wid = pyCons;
// pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
+#endif
else if ( flag == WT_LogWindow )
{
LogWindow* logWin = new LogWindow( desktop() );
return wid;
}
-/*!Default windows(Object Browser, Python Console).
- * Adds to map \a aMap.
+/*!
+ \return default windows( Object Browser, Python Console )
+ Adds to map \a aMap.
*/
void LightApp_Application::defaultWindows( QMap<int, int>& aMap ) const
{
aMap.insert( WT_ObjectBrowser, Qt::DockLeft );
+#ifndef DISABLE_PYCONSOLE
aMap.insert( WT_PyConsole, Qt::DockBottom );
+#endif
// aMap.insert( WT_LogWindow, Qt::DockBottom );
}
-/*!Default view manager.*/
+/*!Default view managers*/
void LightApp_Application::defaultViewManagers( QStringList& ) const
{
/*!Do nothing.*/
}
-/*!Gets preferences.
- * Create preferences, if \a crt = true.
- */
+/*!
+ \return preferences.
+ Create preferences, if \a crt = true.
+*/
LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
{
if ( myPrefs )
return myPrefs;
}
-/*!Add new module to application.*/
+/*!
+ Adds new module to application
+*/
void LightApp_Application::moduleAdded( CAM_Module* mod )
{
CAM_Application::moduleAdded( mod );
}
}
-/*!Create preferences.*/
+/*!
+ Create preferences
+*/
void LightApp_Application::createPreferences( LightApp_Preferences* pref )
{
if ( !pref )
pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "multi_file" );
pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" );
- int undoPref = pref->addPreference( tr( "PREF_UNDO_LEVEL" ), studyGroup, LightApp_Preferences::IntSpin, "Study", "undo_level" );
- pref->setItemProperty( undoPref, "min", 1 );
- pref->setItemProperty( undoPref, "max", 100 );
pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
LightApp_Preferences::Color, "OCCViewer", "background" );
pref->setItemProperty( occTS, "min", 1 );
- pref->setItemProperty( occTS, "max", 150 );
+ pref->setItemProperty( occTS, "max", 1000 );
int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
"ObjectBrowser", "auto_size" );
}
-/*!Changed preferences */
+/*!
+ Changes appearance of application according to changed preferences
+ \param sec - section
+ \param param - name of changed parameter
+*/
void LightApp_Application::preferencesChanged( const QString& sec, const QString& param )
{
SUIT_ResourceMgr* resMgr = resourceMgr();
if ( !resMgr )
return;
+#ifndef DISABLE_OCCVIEWER
if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) )
{
int sz = resMgr->integerValue( sec, param, -1 );
occVM->getAISContext()->UpdateCurrentViewer();
}
}
+#endif
+#ifndef DISABLE_VTKVIEWER
if ( sec == QString( "VTKViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )) )
{
int sz = resMgr->integerValue( "VTKViewer", "trihedron_size", -1 );
+ bool isRelative = resMgr->booleanValue( "VTKViewer", "relative_size", true );
QPtrList<SUIT_ViewManager> lst;
+#ifndef DISABLE_SALOMEOBJECT
viewManagers( SVTK_Viewer::Type(), lst );
for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
{
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM )
{
- vtkVM->setTrihedronSize( sz );
+ vtkVM->setTrihedronSize( sz, isRelative );
vtkVM->Repaint();
}
}
+#endif
}
+#endif
+#ifndef DISABLE_OCCVIEWER
if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) )
{
QPtrList<SUIT_ViewManager> lst;
mgr->getOCCViewer()->setIsos( u, v );
}
}
+#endif
if( sec=="ObjectBrowser" )
{
autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual );
+ if( autoSize )
+ for( int i=1; i<ob->listView()->columns(); i++ )
+ if( ob->listView()->columnWidth( i )>0 )
+ ob->listView()->adjustColumn( i );
updateObjectBrowser( false );
}
}
updateWindows();
}
+#ifndef DISABLE_PYCONSOLE
if( sec=="PyConsole" )
{
if( param=="font" )
if( pythonConsole() )
pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
}
+#endif
}
-/*!Update desktop title.*/
+/*!
+ Saves preferences
+*/
+void LightApp_Application::savePreferences()
+{
+ saveWindowsGeometry();
+
+ if ( resourceMgr() )
+ {
+ if ( desktop() )
+ desktop()->saveGeometry( resourceMgr(), "desktop" );
+ resourceMgr()->save();
+ }
+}
+
+/*!
+ Updates desktop title
+*/
void LightApp_Application::updateDesktopTitle() {
QString aTitle = applicationName();
QString aVer = applicationVersion();
if ( !aVer.isEmpty() )
aTitle += QString( " " ) + aVer;
+ if ( activeStudy() ) {
+ QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
+ aTitle += QString( " - [%1]" ).arg( sName );
+ }
+
desktop()->setCaption( aTitle );
}
-/*!Update windows after close document.*/
+/*!
+ Updates windows after close document
+*/
void LightApp_Application::afterCloseDoc()
{
updateWindows();
CAM_Application::afterCloseDoc();
}
-/*!Update module action.*/
+/*!
+ Updates actions of active module
+*/
void LightApp_Application::updateModuleActions()
{
QString modName;
myActions[modName]->setOn( true );
}
-/*!Gets current windows.
- *\param winMap - output current windows map.
- */
+/*!
+ Gets current windows.
+ \param winMap - output current windows map.
+*/
void LightApp_Application::currentWindows( QMap<int, int>& winMap ) const
{
winMap.clear();
defaultWindows( winMap );
}
-/*!Gets current view managers.
- *\param lst - output current view managers list.
- */
+/*!
+ Gets current view managers.
+ \param lst - output current view managers list.
+*/
void LightApp_Application::currentViewManagers( QStringList& lst ) const
{
lst.clear();
defaultViewManagers( lst );
}
-/*!Update windows.*/
+/*!
+ Updates windows
+*/
void LightApp_Application::updateWindows()
{
QMap<int, int> winMap;
currentWindows( winMap );
- for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
- getWindow( it.key() );
+ if ( activeStudy() ) {
+ for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
+ getWindow( it.key() );
- loadWindowsGeometry();
+ loadWindowsGeometry();
+ }
+
+ // setWindowShown should be done even if no study is active (open). in this case all open windows
+ // will be hidden, which is neccessary in this case.
+ for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) {
+
+ if ( myWindowsVisible.contains( itr.key() ) &&
+ !myWindowsVisible[ itr.key() ] )
+ continue;
- for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) );
+ }
}
-/*!Update view managers.*/
+/*!
+ Updates view managers
+*/
void LightApp_Application::updateViewManagers()
{
QStringList lst;
getViewManager( *it, true );
}
-/*!Load windows geometry.*/
+/*!
+ Loads windows geometry
+*/
void LightApp_Application::loadWindowsGeometry()
{
bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
dockMgr->restoreGeometry();
}
-/*!Save windows geometry.*/
+/*!
+ Saves windows geometry
+*/
void LightApp_Application::saveWindowsGeometry()
{
bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
dockMgr->saveGeometry( resourceMgr(), section, false );
}
-/*!Activate windows.*/
+/*!
+ Activates windows
+*/
void LightApp_Application::activateWindows()
{
if ( activeStudy() )
}
}
-/*!Adds icon names for modules.*/
+/*!
+ Adds icon names for modules
+*/
void LightApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) const
{
iconMap.clear();
}
}
-/*!Insert items in popup, which necessary for current application*/
+/*!
+ Inserts items in popup, which necessary for current application
+*/
void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title )
{
CAM_Application::contextMenuPopup( type, thePopup, title );
thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
}
-/*!Create empty study.*/
+/*!
+ Create empty study
+*/
void LightApp_Application::createEmptyStudy()
{
CAM_Application::createEmptyStudy();
objectBrowser()->updateTree();
}
-/*!Activate module \a mod.*/
+/*!
+ Activates module
+ \param mod - module to be activated
+*/
bool LightApp_Application::activateModule( CAM_Module* mod )
{
bool res = CAM_Application::activateModule( mod );
return res;
}
-/*!return keyborad accelerators manager object */
+/*!
+ \return keyborad accelerators manager object
+*/
SUIT_Accel* LightApp_Application::accel() const
{
return myAccel;
}
-/*! remove dead widget container from map */
+/*!
+ Removes dead widget container from map
+*/
void LightApp_Application::onWCDestroyed( QObject* ob )
{
// remove destroyed widget container from windows map
}
}
-/*! redefined to remove view manager from memory */
+/*!
+ Connects just added view manager
+*/
+void LightApp_Application::addViewManager( SUIT_ViewManager* vm )
+{
+ connect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
+ this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
+ STD_Application::addViewManager( vm );
+}
+
+/*!
+ Remove view manager from memory
+*/
void LightApp_Application::removeViewManager( SUIT_ViewManager* vm )
{
disconnect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
delete vm;
}
-/*! rename active window of desktop */
+/*!
+ Renames active window of desktop
+*/
void LightApp_Application::onRenameWindow()
{
if( !desktop() )
if( ok && !name.isEmpty() )
w->setCaption( name );
}
+
+/*!
+ \return if the library of module exists
+ \param moduleTitle - title of module
+*/
+bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
+{
+ if( moduleTitle.isEmpty() )
+ return false;
+
+ QString lib = moduleLibrary( moduleTitle );
+ QStringList paths;
+#ifdef WIN32
+ paths = QStringList::split( ";", ::getenv( "PATH" ) );
+#else
+ paths = QStringList::split( ":", ::getenv( "LD_LIBRARY_PATH" ) );
+#endif
+
+ QStringList::const_iterator anIt = paths.begin(), aLast = paths.end();
+ for( ; anIt!=aLast; anIt++ )
+ {
+ QFileInfo inf( Qtx::addSlash( *anIt ) + lib );
+ if( inf.exists() )
+ return true;
+ }
+ return false;
+}
+
+/*!
+ \return default name for an active study
+*/
+void LightApp_Application::setDefaultStudyName( const QString& theName )
+{
+ QStringList anInfoList;
+ modules( anInfoList, false );
+
+ LightApp_Study* aStudy = (LightApp_Study*)activeStudy();
+ if( anInfoList.count() == 1 && // to avoid a conflict between different modules
+ !aStudy->isSaved() )
+ {
+ aStudy->setStudyName( theName );
+ updateDesktopTitle();
+ }
+}
+
+/*! slot, called on show/hide of a dock window */
+void LightApp_Application::onVisibilityChanged( bool visible )
+{
+ const QObject* win = sender();
+
+ for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
+ if ( itr.data() == win )
+ {
+ myWindowsVisible[ itr.key() ] = visible;
+ return;
+ }
+}
+
+/*!
+ Custom event handler
+*/
+bool LightApp_Application::event( QEvent* e )
+{
+ if( e && e->type()==2000 )
+ {
+ QCustomEvent* ce = ( QCustomEvent* )e;
+ QString* d = ( QString* )ce->data();
+ if( SUIT_MessageBox::warn2(0, tr("WRN_WARNING"),
+ d ? *d : "",
+ tr("BUT_OK"), tr("BUT_CANCEL"), 0, 1, 0 )==0 )
+ onPreferences();
+ if( d )
+ delete d;
+ return true;
+ }
+ return CAM_Application::event( e );
+}
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_Application.h
// Created: 6/20/2005 18:39:25 PM
// Author: OCC team
class LogWindow;
class OB_Browser;
-class PythonConsole;
+#ifndef DISABLE_PYCONSOLE
+ class PythonConsole;
+#endif
class STD_Application;
class LightApp_WidgetContainer;
class LightApp_Preferences;
Q_OBJECT
public:
- typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
+ typedef enum { WT_ObjectBrowser,
+#ifndef DISABLE_PYCONSOLE
+ WT_PyConsole,
+#endif
+ WT_LogWindow,
+ WT_User }
+ WindowTypes;
+
+ enum { MenuWindowId = 6 };
- enum { NewGLViewId = CAM_Application::UserID, NewPlot2dId, NewOCCViewId, NewVTKViewId,
- PreferencesId, MRUId, RenameId, UserID };
+ enum { RenameId = CAM_Application::UserID,
+
+#ifndef DISABLE_GLVIEWER
+ NewGLViewId ,
+#endif
+
+#ifndef DISABLE_PLOT2DVIEWER
+ NewPlot2dId,
+#endif
+
+#ifndef DISABLE_OCCVIEWER
+ NewOCCViewId,
+#endif
+
+#ifndef DISABLE_VTKVIEWER
+ NewVTKViewId,
+#endif
+
+ PreferencesId, MRUId, UserID };
public:
LightApp_Application();
virtual ~LightApp_Application();
LogWindow* logWindow();
OB_Browser* objectBrowser();
+#ifndef DISABLE_PYCONSOLE
PythonConsole* pythonConsole();
+#endif
virtual void updateObjectBrowser( const bool = true );
void updateActions();
SUIT_ViewManager* getViewManager( const QString&, const bool );
+ virtual void addViewManager( SUIT_ViewManager* );
virtual void removeViewManager( SUIT_ViewManager* );
QWidget* getWindow( const int, const int = -1 );
QWidget* window( const int, const int = -1 ) const;
SUIT_Accel* accel() const;
+ void setDefaultStudyName( const QString& theName );
+
+ static int studyId();
+
+ virtual bool event( QEvent* );
+
signals:
void studyOpened();
void studySaved();
public slots:
virtual void onHelpContentsModule();
+ virtual void onHelpContextModule( const QString&, const QString& );
virtual void onNewDoc();
virtual void onOpenDoc();
virtual void onHelpAbout();
protected:
virtual void createActions();
+ virtual void createActionForViewer( const int id,
+ const int parentId,
+ const QString& suffix,
+ const int accel );
virtual SUIT_Study* createNewStudy();
virtual QWidget* createWindow( const int );
virtual void defaultWindows( QMap<int, int>& ) const;
LightApp_Preferences* preferences( const bool ) const;
virtual void createPreferences( LightApp_Preferences* );
virtual void preferencesChanged( const QString&, const QString& );
+ virtual void savePreferences();
virtual void updateDesktopTitle();
protected slots:
void onMRUActivated( QString );
void onPreferenceChanged( QString&, QString&, QString& );
void onRenameWindow();
+ void onVisibilityChanged( bool );
protected:
void updateWindows();
void moduleIconNames( QMap<QString, QString>& ) const;
void activateWindows();
+ bool isLibExists( const QString& ) const;
protected:
typedef QMap<QString, QAction*> ActionMap;
typedef QMap<int, LightApp_WidgetContainer*> WindowMap;
+ typedef QMap<int, bool> WindowVisibilityMap;
protected:
LightApp_Preferences* myPrefs;
LightApp_SelectionMgr* mySelMgr;
ActionMap myActions;
WindowMap myWindows;
+ WindowVisibilityMap myWindowsVisible;
SUIT_Accel* myAccel;
static LightApp_Preferences* _prefs_;
+
+ static int lastStudyId;
};
#ifdef WIN32
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_DataModel.cxx
// Created: 10/25/2004 10:36:06 AM
// Author: Sergey LITONIN
#include "LightApp_DataModel.h"
#include "LightApp_Study.h"
#include "LightApp_RootObject.h"
+#include "LightApp_DataObject.h"
#include "LightApp_Module.h"
#include "LightApp_Application.h"
-#include <CAM_DataObject.h>
+#include <OB_Browser.h>
#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_DataObject.h>
-//=======================================================================
-// name : LightApp_DataModel::LightApp_DataModel
-/*!Purpose : Constructor*/
-//=======================================================================
+/*!
+ Constructor
+*/
LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule )
: CAM_DataModel( theModule )
{
}
-//=======================================================================
-// name : LightApp_DataModel::~LightApp_DataModel
-/*! Purpose : Destructor*/
-//=======================================================================
+/*!
+ Destructor
+*/
LightApp_DataModel::~LightApp_DataModel()
{
}
-//================================================================
-// Function : open
-/*! Purpose : Emit opened()*/
-//================================================================
+/*!
+ Emit opened()
+*/
bool LightApp_DataModel::open( const QString&, CAM_Study* study, QStringList )
{
emit opened(); //TODO: is it really needed? to be removed maybe...
return true;
}
-//================================================================
-// Function : save
-/*! Purpose : Emit saved()*/
-//================================================================
+/*!
+ Emit saved()
+*/
bool LightApp_DataModel::save( QStringList& )
{
emit saved();
return true;
}
-//================================================================
-// Function : saveAs
-/*! Purpose : Emit saved()*/
-//================================================================
+/*!
+ Emit saved()
+*/
bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList& )
{
emit saved();
return true;
}
-//================================================================
-// Function : close
-/*! Purpose : Emit closed()*/
-//================================================================
+/*!
+ Emit closed()
+*/
bool LightApp_DataModel::close()
{
emit closed();
return true;
}
-//================================================================
-// Function : update
-/*! Purpose : Update application (empty virtual function).*/
-//================================================================
-void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study )
+/*!
+ Build whole data model tree
+*/
+void LightApp_DataModel::build()
{
}
-//================================================================
-// Function : getModule
-/*! Purpose : gets module*/
-//================================================================
+/*!
+ Updates data model presentation in some widgets (for example, in object browser
+*/
+void LightApp_DataModel::updateWidgets()
+{
+ LightApp_Application* app = dynamic_cast<LightApp_Application*>( module()->application() );
+ if( app )
+ app->objectBrowser()->updateTree( 0, false );
+}
+
+/*!
+ Default behaviour of data model update for light modules
+*/
+void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* )
+{
+ LightApp_ModuleObject* modelRoot = dynamic_cast<LightApp_ModuleObject*>( root() );
+ DataObjectList ch;
+ if( modelRoot )
+ {
+ ch = modelRoot->children();
+ for ( DataObjectListIterator it( ch ); it.current(); ++it )
+ it.current()->setParent( 0 );
+ }
+ build();
+ updateWidgets();
+ for( DataObjectListIterator it( ch ); it.current(); ++it )
+ delete it.current();
+}
+/*!
+ \return corresponding module
+*/
LightApp_Module* LightApp_DataModel::getModule() const
{
return dynamic_cast<LightApp_Module*>( module() );
}
-//================================================================
-// Function : getStudy
-/*! Purpose : gets study */
-//================================================================
+/*!
+ \return corresponding study
+*/
LightApp_Study* LightApp_DataModel::getStudy() const
{
LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root()->root() );
return aRoot->study();
}
-//================================================================
-// Function : isModified
-/*! Purpose : default implementation, always returns false so as not to mask study's isModified()*/
-//================================================================
+/*!
+ default implementation, always returns false so as not to mask study's isModified()
+*/
bool LightApp_DataModel::isModified() const
{
return false;
}
-//================================================================
-// Function : isSaved
-/*! Purpose : default implementation, always returns true so as not to mask study's isSaved()*/
-//================================================================
+/*!
+ default implementation, always returns true so as not to mask study's isSaved()
+*/
bool LightApp_DataModel::isSaved() const
{
return true;
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_DataModel.h
// Created: 10/25/2004 10:32:33 AM
// Author: Sergey LITONIN
protected:
LightApp_Study* getStudy() const;
-
+ virtual void build();
+ virtual void updateWidgets();
};
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_DataObject.h"
return myEntry == that->myEntry;
}
-/*
- Class: LightApp_DataObject
- Level: Public
-*/
/*!Constructor. Initialize by \a parent*/
LightApp_DataObject::LightApp_DataObject( SUIT_DataObject* parent )
: CAM_DataObject( parent ), myCompObject( 0 ), myCompDataType( "" )
return myCompDataType;
}
-/*
- Class: LightApp_ModuleObject
- Level: Public
-*/
+
/*!Constructor.Initialize by \a parent.*/
LightApp_ModuleObject::LightApp_ModuleObject( SUIT_DataObject* parent )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_DATAOBJECT_H
#define LIGHTAPP_DATAOBJECT_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_DataOwner.h"
{
}
+#ifndef DISABLE_SALOMEOBJECT
/*!Constructor. Initialize by \a SALOME_InteractiveObject.*/
LightApp_DataOwner
::LightApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO ):
myIO(theIO)
{
}
+#endif
/*!Destructor. Do nothing.*/
LightApp_DataOwner
return other && entry() == other->entry();
}
+bool LightApp_DataOwner::operator<( const SUIT_DataOwner& obj ) const
+{
+ const LightApp_DataOwner* other = dynamic_cast<const LightApp_DataOwner*>( &obj );
+ return entry() < other->entry();
+}
+
/*!Gets entry.*/
QString
LightApp_DataOwner
return myEntry;
}
+#ifndef DISABLE_SALOMEOBJECT
/*!Gets SALOME_InteractiveObject.*/
const Handle(SALOME_InteractiveObject)&
LightApp_DataOwner
{
return myIO;
}
+#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_DATAOWNER_H
#include "LightApp.h"
#include "SUIT_DataOwner.h"
-#include "SALOME_InteractiveObject.hxx"
+
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+#endif
/*!
This class provide data owner objects.
class LIGHTAPP_EXPORT LightApp_DataOwner : public SUIT_DataOwner
{
public:
+#ifndef DISABLE_SALOMEOBJECT
LightApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO );
+#endif
LightApp_DataOwner( const QString& );
virtual ~LightApp_DataOwner();
virtual bool isEqual( const SUIT_DataOwner& ) const;
+ virtual bool operator<( const SUIT_DataOwner& ) const;
+
+#ifndef DISABLE_SALOMEOBJECT
const Handle(SALOME_InteractiveObject)& IO() const;
+#endif
QString entry() const;
private:
QString myEntry;
+#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject) myIO;
+#endif
};
typedef SMART(LightApp_DataOwner) LightApp_DataOwnerPtr;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_DataSubOwner.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_DATASUBOWNER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: LightApp_Dialog.cxx
// Author: Alexander SOLOVYOV
#include <qlineedit.h>
#include <qlabel.h>
-/*
- Class : LightApp_Dialog
- Description : Base class for all dialogs
+/*!
+ Constructor
*/
-
-//=======================================================================
-// name : LightApp_Dialog
-// Purpose : Constructor
-//=======================================================================
LightApp_Dialog::LightApp_Dialog( QWidget* parent, const char* name, bool modal,
bool allowResize, const int f, WFlags wf )
: QtxDialog( parent, name, modal, allowResize, f, wf ),
setObjectPixmap( "LightApp", tr( "ICON_SELECT" ) );
}
-//=======================================================================
-// name : ~LightApp_Dialog
-// Purpose : Destructor
-//=======================================================================
+/*!
+ Destructor
+*/
LightApp_Dialog::~LightApp_Dialog()
{
}
-//=======================================================================
-// name : show
-// Purpose :
-//=======================================================================
+/*!
+ Show dialog
+*/
void LightApp_Dialog::show()
{
QtxDialog::show();
}
-//=======================================================================
-// name : isExclusive
-// Purpose :
-//=======================================================================
+/*!
+ \return isExclusive status of selection buttons
+*/
bool LightApp_Dialog::isExclusive() const
{
return myIsExclusive;
}
-//=======================================================================
-// name : updateButtons
-// Purpose :
-//=======================================================================
+/*!
+ Updates "on" state of buttons according to special button
+ \param _id - id of special button (if it is -1, then first selected button will be treated as special)
+*/
void LightApp_Dialog::updateButtons( const int _id )
{
if( !myIsExclusive )
}
}
-//=======================================================================
-// name : setExclusive
-// Purpose :
-//=======================================================================
+/*!
+ Sets isExclusive status of selection buttons
+ \param ex - new value of isExclusive status
+*/
void LightApp_Dialog::setExclusive( const bool ex )
{
myIsExclusive = ex;
updateButtons();
}
-//=======================================================================
-// name : showObject
-// Purpose :
-//=======================================================================
+/*!
+ Shows object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::showObject( const int id )
{
setObjectShown( id, true );
}
-//=======================================================================
-// name : hideObject
-// Purpose :
-//=======================================================================
+/*!
+ Hides object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::hideObject( const int id )
{
setObjectShown( id, false );
}
-//=======================================================================
-// name : setObjectShown
-// Purpose :
-//=======================================================================
+/*!
+ Shows/hides object selection widget
+ \param id - identificator of object selection widget
+ \param shown - if it is true, widget will be shown
+*/
void LightApp_Dialog::setObjectShown( const int id, const bool shown )
{
if( myObjects.contains( id ) && isObjectShown( id )!=shown )
}
}
-//=======================================================================
-// name : isObjectShown
-// Purpose :
-//=======================================================================
+/*!
+ \return isShown state of object selection widget
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::isObjectShown( const int id ) const
{
return myObjects.contains( id ) && myObjects[ id ].myEdit->isShown();
}
-//=======================================================================
-// name : setObjectEnabled
-// Purpose :
-//=======================================================================
+/*!
+ Change enable state of object selection widget
+ \param id - identificator of object selection widget
+ \param en - new value of enable state
+*/
void LightApp_Dialog::setObjectEnabled( const int id, const bool en )
{
if( myObjects.contains( id ) && isObjectEnabled( id )!=en )
}
}
-//=======================================================================
-// name : isObjectEnabled
-// Purpose :
-//=======================================================================
+/*!
+ \return enable state of object selection widget
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::isObjectEnabled( const int id ) const
{
return myObjects.contains( id ) && myObjects[ id ].myEdit->isEnabled();
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to all active widgets name, type and id of selected object
+ \param name - name of selected object
+ \param type - type of selected object
+ \param id - id of selected object
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const QString& name, const int type, const QString& id, const bool update )
{
QStringList names; names.append( name );
selectObject( names, types, ids, update );
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to all active widgets names, types and ids of selected objects
+ \param _names - names of selected objects
+ \param _types - types of selected objects
+ \param _ids - ids of selected objects
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const QStringList& _names,
const TypesList& _types,
const QStringList& _ids,
selectObject( anIt.key(), _names, _types, _ids, update );
}
-//=======================================================================
-// name : hasSelection
-// Purpose :
-//=======================================================================
+/*!
+ \return true if widget has selection
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::hasSelection( const int id ) const
{
return myObjects.contains( id ) && !myObjects[ id ].myIds.isEmpty();
}
-//=======================================================================
-// name : clearSelection
-// Purpose :
-//=======================================================================
+/*!
+ Clears selection of widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::clearSelection( const int id )
{
if( id==-1 )
}
}
-//=======================================================================
-// name : objectWg
-// Purpose :
-//=======================================================================
+/*!
+ \return object selection widget
+ \param theId - identificator of object selection widget
+ \param theWgId may be "Label", "Btn" or "Control"
+*/
QWidget* LightApp_Dialog::objectWg( const int theId, const int theWgId ) const
{
QWidget* aResWg = 0;
return aResWg;
}
-//=======================================================================
-// name : objectText
-// Purpose :
-//=======================================================================
+/*!
+ \return object selection widget text
+ \param theId - identificator of object selection widget
+*/
QString LightApp_Dialog::objectText( const int theId ) const
{
return myObjects.contains( theId ) ? myObjects[ theId ].myEdit->text() : "";
}
-//=======================================================================
-// name : setObjectText
-// Purpose :
-//=======================================================================
+/*!
+ Sets object selection widget text
+ \param theId - identificator of object selection widget
+ \param theText - new text
+*/
void LightApp_Dialog::setObjectText( const int theId, const QString& theText )
{
if ( myObjects.contains( theId ) )
myObjects[ theId ].myEdit->setText( theText );
}
-//=======================================================================
-// name : selectedObject
-// Purpose :
-//=======================================================================
+/*!
+ \return objects selected by widget
+ \param id - identificator of object selection widget
+ \param list - list to be filled by selected objects
+*/
void LightApp_Dialog::selectedObject( const int id, QStringList& list ) const
{
if( myObjects.contains( id ) )
list = myObjects[ id ].myIds;
}
-//=======================================================================
-// name : selectedObject
-// Purpose :
-//=======================================================================
+/*!
+ \return selected object id
+ \param id - identificator of object selection widget
+*/
QString LightApp_Dialog::selectedObject( const int id ) const
{
if ( myObjects.contains( id ) && myObjects[ id ].myIds.count() > 0 )
return "";
}
-//=======================================================================
-// name : objectSelection
-// Purpose :
-//=======================================================================
+/*!
+ \return all selected objects
+ \param objs - map: widget id -> string id to be filled with selected objects
+*/
void LightApp_Dialog::objectSelection( SelectedObjects& objs ) const
{
//objs.clear();
}
}
-//=======================================================================
-// name : createObject
-// Purpose :
-//=======================================================================
+/*!
+ Creates object selection widget
+ \return id
+ \label - label text
+ \parent - parent object
+ \id - proposed id for widget (if it is less than 0, the free id will be used)
+*/
int LightApp_Dialog::createObject( const QString& label, QWidget* parent, const int id )
{
int nid = id;
return nid;
}
-//=======================================================================
-// name : renameObject
-// Purpose :
-//=======================================================================
+/*!
+ Changes label of object selection widget
+ \param id - identificator of object selection widget
+ \param label - new text of label
+*/
void LightApp_Dialog::renameObject( const int id, const QString& label )
{
if( myObjects.contains( id ) )
myObjects[ id ].myLabel->setText( label );
}
-//=======================================================================
-// name : setObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Sets possible types for widget
+ \param id - identificator of object selection widget
+ \param type1,... - type
+*/
void LightApp_Dialog::setObjectType( const int id, const int type1, ... )
{
TypesList types;
setObjectType( id, types );
}
-//=======================================================================
-// name : setObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Sets possible types for widget
+ \param id - identificator of object selection widget
+ \param list - list of possible types
+*/
void LightApp_Dialog::setObjectType( const int id, const TypesList& list )
{
if( !myObjects.contains( id ) )
updateObject( id );
}
-//=======================================================================
-// name : addObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Adds new possible types to object selection widget
+ \param id - identificator of object selection widget
+ \param type1, ... - new types
+*/
void LightApp_Dialog::addObjectType( const int id, const int type1, const int, ... )
{
TypesList types; objectTypes( id, types );
setObjectType( id, types );
}
-//=======================================================================
-// name : addObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Adds new possible types to object selection widget
+ \param id - identificator of object selection widget
+ \param list - new types
+*/
void LightApp_Dialog::addObjectType( const int id, const TypesList& list )
{
TypesList types = list; objectTypes( id, types );
setObjectType( id, types );
}
-//=======================================================================
-// name : addObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Adds new possible type to object selection widget
+ \param id - identificator of object selection widget
+ \param type - new type
+*/
void LightApp_Dialog::addObjectType( const int id, const int type )
{
TypesList types; objectTypes( id, types );
setObjectType( id, types );
}
-//=======================================================================
-// name : removeObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Clears list of possibles types for object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::removeObjectType( const int id )
{
TypesList types;
setObjectType( id, types );
}
-//=======================================================================
-// name : removeObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Removes types from list of possibles for object selection widget
+ \param id - identificator of object selection widget
+ \param list - list of types to be removed
+*/
void LightApp_Dialog::removeObjectType( const int id, const TypesList& list )
{
if( !myObjects.contains( id ) )
updateObject( id );
}
-//=======================================================================
-// name : removeObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Removes type from list of possibles for object selection widget
+ \param id - identificator of object selection widget
+ \param type - type to be removed
+*/
void LightApp_Dialog::removeObjectType( const int id, const int type )
{
TypesList list; list.append( type );
removeObjectType( id, list );
}
-//=======================================================================
-// name : hasObjectType
-// Purpose :
-//=======================================================================
+/*!
+ \return true if widget has such type
+ \param id - identificator of object selection widget
+ \param type - type to be checked
+*/
bool LightApp_Dialog::hasObjectType( const int id, const int type ) const
{
if( myObjects.contains( id ) )
return false;
}
-//=======================================================================
-// name : objectTypes
-// Purpose :
-//=======================================================================
+/*!
+ Returns list of possible types for widget
+ \param id - identificator of object selection widget
+ \param list - list to be filled with possible types
+*/
void LightApp_Dialog::objectTypes( const int id, TypesList& list ) const
{
if( myObjects.contains( id ) )
}
}
-//=======================================================================
-// name : onToggled
-// Purpose :
-//=======================================================================
+/*!
+ SLOT: called if selection button is clicked
+*/
void LightApp_Dialog::onToggled( bool on )
{
QButton* but = ( QButton* )sender();
emit objectDeactivated( id );
}
-//=======================================================================
-// name : updateObject
-// Purpose :
-//=======================================================================
+/*!
+ Updates selection description of widget
+ \param id - identificator of object selection widget
+ \param emit_signal - if it is true, the signal "selection changed" is emitted
+*/
void LightApp_Dialog::updateObject( const int id, bool emit_signal )
{
if( hasSelection( id ) )
}
}
-//=======================================================================
-// name : filterTypes
-// Purpose :
-//=======================================================================
+/*!
+ Finds in list possible types
+ \param id - identificator of object selection widget
+ \param names - list of selected objects names
+ \param types - list of selected objects types
+ \param ids - list of selected objects ids
+*/
void LightApp_Dialog::filterTypes( const int id, QStringList& names, TypesList& types, QStringList& ids ) const
{
if( !myObjects.contains( id ) )
ids = new_ids;
}
-//=======================================================================
-// name : resMgr
-// Purpose :
-//=======================================================================
+/*!
+ \return global resource manager
+*/
SUIT_ResourceMgr* LightApp_Dialog::resMgr() const
{
return SUIT_Session::session()->resourceMgr();
}
-//=======================================================================
-// name : setObjectPixmap
-// Purpose :
-//=======================================================================
+/*!
+ Sets pixmap for all object selection button
+ \param p - image
+*/
void LightApp_Dialog::setObjectPixmap( const QPixmap& p )
{
myPixmap = p;
( ( QToolButton* )anIt.data().myBtn )->setIconSet( p );
}
-//=======================================================================
-// name : setObjectPixmap
-// Purpose :
-//=======================================================================
+/*!
+ Sets pixmap all for object selection button
+ \param section - name of section of resource manager
+ \param file - name of file
+*/
void LightApp_Dialog::setObjectPixmap( const QString& section, const QString& file )
{
SUIT_ResourceMgr* mgr = resMgr();
setObjectPixmap( mgr->loadPixmap( section, file ) );
}
-//=======================================================================
-// name : multipleSelection
-// Purpose :
-//=======================================================================
+/*!
+ \return true, if it is enable multiple selection
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::multipleSelection( const int id ) const
{
return nameIndication( id )!=OneName;
}
-//=======================================================================
-// name : nameIndication
-// Purpose :
-//=======================================================================
+/*!
+ \return type of name indication
+ \param id - identificator of object selection widget
+*/
LightApp_Dialog::NameIndication LightApp_Dialog::nameIndication( const int id ) const
{
if( myObjects.contains( id ) )
return OneNameOrCount;
}
-//=======================================================================
-// name : setNameIndication
-// Purpose :
-//=======================================================================
+/*!
+ Sets type of name indication
+ \param id - identificator of object selection widget
+ \param ni - new type of name indication
+*/
void LightApp_Dialog::setNameIndication( const int id, const NameIndication ni )
{
if( id==-1 )
}
}
-//=======================================================================
-// name : selectionDescription
-// Purpose :
-//=======================================================================
+/*!
+ \return string representation of selection by selection data
+ \param names - list of selected objects names
+ \param types - list of selected objects types
+ \param ni - type of name indication
+*/
QString LightApp_Dialog::selectionDescription( const QStringList& names, const TypesList& types, const NameIndication ni ) const
{
if( names.count()!=types.count() )
return QString::null;
}
-//=======================================================================
-// name : countOfTypes
-// Purpose :
-//=======================================================================
+/*!
+ \return string representation of count of types
+ \param types - list of types
+*/
QString LightApp_Dialog::countOfTypes( const TypesList& types ) const
{
QMap<int, int> typesCount;
return typeCount.join( ", " );
}
-//=======================================================================
-// name : typeName
-// Purpose :
-//=======================================================================
+/*!
+ \return reference to type name
+ \param type - integer id of type
+*/
QString& LightApp_Dialog::typeName( const int type )
{
return myTypeNames[ type ];
}
-//=======================================================================
-// name : typeName
-// Purpose :
-//=======================================================================
+/*!
+ \return const reference to type name
+ \param type - integer id of type
+*/
const QString& LightApp_Dialog::typeName( const int type ) const
{
return myTypeNames[ type ];
}
-//=======================================================================
-// name : activateObject
-// Purpose :
-//=======================================================================
+/*!
+ Activates object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::activateObject( const int theId )
{
if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isOn() )
myObjects[ theId ].myBtn->toggle();
}
-//=======================================================================
-// name : deactivateAll
-// Purpose :
-//=======================================================================
+/*!
+ Deactivates all object selection widgets
+*/
void LightApp_Dialog::deactivateAll()
{
ObjectMap::iterator anIt = myObjects.begin(),
}
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to widget name, type and id of selected object
+ \param id - identificator of object selection widget
+ \param name - name of selected object
+ \param type - type of selected object
+ \param selid - id of selected object
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const int id, const QString& name, const int type, const QString& selid, const bool update )
{
QStringList names; names.append( name );
selectObject( id, names, types, ids, update );
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to widget names, types and ids of selected objects
+ \param id - identificator of object selection widget
+ \param _names - names of selected object
+ \param _types - types of selected object
+ \param _ids - ids of selected object
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const int id, const QStringList& _names, const TypesList& _types,
const QStringList& _ids, const bool update )
{
emit selectionChanged( id );
}
-//=======================================================================
-// name : setReadOnly
-// Purpose :
-//=======================================================================
+/*!
+ Sets read only state of object selection line edit
+ \param id - identificator of object selection widget
+ \param ro - new read only state
+*/
void LightApp_Dialog::setReadOnly( const int id, const bool ro )
{
if( myObjects.contains( id ) )
myObjects[ id ].myEdit->setReadOnly( nameIndication( id )==ListOfNames || nameIndication( id )==OneName ? ro : true );
}
-//=======================================================================
-// name : isReadOnly
-// Purpose :
-//=======================================================================
+/*!
+ \return read only state of object selection line edit
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::isReadOnly( const int id ) const
{
if( myObjects.contains( id ) )
else
return true;
}
-
-//=======================================================================
-// name : onTextChanged
-// Purpose :
-//=======================================================================
+
+/*!
+ SLOT: called if text of object selection line edit is changed
+*/
void LightApp_Dialog::onTextChanged( const QString& text )
{
if( myIsBusy )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: LightApp_Dialog.h
// Author: Alexander SOLOVYOV
class SUIT_ResourceMgr;
-/*
- Class : LightApp_Dialog
- Description : Base class for all LightApp dialogs
+/*!
+ \class LightApp_Dialog
+ Base class for all LightApp dialogs.
+ Provides standard widget for object selection: line edit, button;
+ it is necessary to call corresponding methods on selection change.
+ Standard dialog provides filtering, selection string representation,
+ possibility to indicate necessary selection by text with list of ids.
*/
class LIGHTAPP_EXPORT LightApp_Dialog : public QtxDialog
{
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_Displayer.h"
#include <CAM_Study.h>
-#include <SALOME_InteractiveObject.hxx>
-
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_ViewManager.h>
#include <SUIT_ViewWindow.h>
#include <qstring.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+#endif
+/*!
+ Default constructor
+*/
LightApp_Displayer::LightApp_Displayer()
{
}
+/*!
+ Destructor
+*/
LightApp_Displayer::~LightApp_Displayer()
{
}
+/*!
+ Displays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void LightApp_Displayer::Display( const QString& entry, const bool updateViewer, SALOME_View* theViewFrame )
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ Redisplays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+*/
void LightApp_Displayer::Redisplay( const QString& entry, const bool updateViewer )
{
// Remove the object permanently (<forced> == true)
}
}
+/*!
+ Erases object in view
+ \param entry - object entry
+ \param forced - deletes object from viewer (otherwise it will be erased, but cached)
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void LightApp_Displayer::Erase( const QString& entry, const bool forced,
const bool updateViewer, SALOME_View* theViewFrame )
{
}
}
+/*!
+ Erases all objects in view
+ \param forced - deletes objects from viewer
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void LightApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ \return true if object is displayed in viewer
+ \param entry - object entry
+ \param theViewFrame - view
+*/
bool LightApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
+ bool res = false;
if( vf )
{
+#ifndef DISABLE_SALOMEOBJECT
Handle( SALOME_InteractiveObject ) temp = new SALOME_InteractiveObject();
temp->setEntry( entry.latin1() );
- return vf->isVisible( temp );
+ res = vf->isVisible( temp );
+#endif
}
- else
- return false;
+ return res;
}
+/*!
+ Updates active view
+*/
void LightApp_Displayer::UpdateViewer() const
{
SALOME_View* vf = GetActiveView();
vf->Repaint();
}
+/*!
+ \return presentation of object, built with help of CreatePrs method
+ \param entry - object entry
+ \param theViewFrame - view
+ \sa CreatePrs()
+*/
SALOME_Prs* LightApp_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
{
SALOME_Prs* prs = 0;
return prs;
}
+/*!
+ \return active view
+*/
SALOME_View* LightApp_Displayer::GetActiveView()
{
SUIT_Session* session = SUIT_Session::session();
return 0;
}
-bool LightApp_Displayer::canBeDisplayed( const QString&, const QString& ) const
+/*!
+ \return true, if object can be displayed in this type of viewer
+ \param entry - object entry
+ \param viewer_type - type of viewer
+*/
+bool LightApp_Displayer::canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const
{
return true;
}
+/*!
+ \return true, if object can be displayed in any type of viewer
+ \param entry - object entry
+*/
bool LightApp_Displayer::canBeDisplayed( const QString& entry ) const
{
QString viewerType;
return !viewerType.isNull() && canBeDisplayed( entry, viewerType );
}
+/*!
+ \return displayer, corresponding to module
+ \param mod_name - name of module
+ \param load - is module has to be forced loaded
+*/
LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load )
{
SUIT_Session* session = SUIT_Session::session();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_DISPLAYER_HEADER
class QString;
+/*!
+ \class LightApp_Displayer
+ Uniform mechanism of display/erase of objects in different views.
+ Objects are specified by string entry
+*/
class LIGHTAPP_EXPORT LightApp_Displayer : public SALOME_Displayer
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_Driver.h"
using namespace std;
-//================================================================
-// Function : SaveDatasInFile
-/*! Purpose : save in file 'theFileName' datas from this driver*/
-//================================================================
+/*!
+ Save in file 'theFileName' datas from this driver
+*/
bool LightApp_Driver::SaveDatasInFile( const char* theFileName, bool isMultiFile )
{
int aNbModules = 0;
return true;
}
-//=======================================================================
-// name : ReaDatasFromFile
-/*! Purpose : filling current driver from file 'theFileName'*/
-//=======================================================================
+/*!
+ Filling current driver from file 'theFileName'
+*/
bool LightApp_Driver::ReadDatasFromFile( const char* theFileName, bool isMultiFile )
{
#ifdef WNT
return true;
}
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : returns temp directory for path 'theURL'*/
-//================================================================
+/*!
+ \return temp directory for path 'theURL'
+*/
std::string LightApp_Driver::GetTmpDir (const char* theURL, const bool isMultiFile)
{
std::string anURLDir = GetDirFromPath(theURL);
return aTmpDir;
}
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : returns list of files for module with name 'theModuleName'*/
-//================================================================
+/*!
+ \return list of files for module with name 'theModuleName'
+*/
LightApp_Driver::ListOfFiles LightApp_Driver::GetListOfFiles( const char* theModuleName )
{
ListOfFiles aListOfFiles;
return aListOfFiles;
}
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : sets list of files for module with name 'theModuleName'*/
-//================================================================
+/*!
+ Sets list of files for module with name 'theModuleName'
+*/
void LightApp_Driver::SetListOfFiles( const char* theModuleName, const ListOfFiles theListOfFiles )
{
std::string aName (theModuleName);
myMap[aName] = theListOfFiles;
}
-//============================================================================
-// function : PutFilesToStream
-/*! Purpose : converts files which was created from module <theModuleName> into a byte sequence unsigned char*/
-//============================================================================
+/*!
+ Converts files which was created from module <theModuleName> into a byte sequence unsigned char
+*/
void LightApp_Driver::PutFilesToStream( const std::string& theModuleName, unsigned char*& theBuffer,
long& theBufferSize, bool theNamesOnly )
{
theBufferSize = aBufferSize;
}
-//============================================================================
-// function : PutStreamToFile
-/*! Purpose : converts a byte sequence <theBuffer> to files and return list of them*/
-//============================================================================
+/*!
+ Converts a byte sequence <theBuffer> to files and return list of them
+*/
LightApp_Driver::ListOfFiles LightApp_Driver::PutStreamToFiles( const unsigned char* theBuffer,
const long theBufferSize, bool theNamesOnly )
{
return aFiles;
}
-//============================================================================
-// function : RemoveFiles
-/*! Purpose : Remove files. First item in <theFiles> is a directory with slash at the end.
- Other items are names of files. If <IsDirDeleted> is true,
- then the directory is also deleted.
+/*!
+ Remove files. First item in <theFiles> is a directory with slash at the end.
+ Other items are names of files. If <IsDirDeleted> is true,
+ then the directory is also deleted.
*/
-//============================================================================
void LightApp_Driver::RemoveFiles( const ListOfFiles& theFiles, const bool IsDirDeleted)
{
int i, aLength = theFiles.size() - 1;
}
}
-//============================================================================
-// function : RemoveTemporaryFiles
-/*! Purpose : removes files which was created from module theModuleName if
- <IsDirDeleted> is true tmp directory is also deleted if it is empty*/
-//============================================================================
+/*!
+ Removes files which was created from module theModuleName if
+ <IsDirDeleted> is true tmp directory is also deleted if it is empty
+*/
void LightApp_Driver::RemoveTemporaryFiles( const char* theModuleName, const bool IsDirDeleted )
{
std::string aModuleName(theModuleName);
}
-//============================================================================
-// function : ClearDriverContents
-/*! Purpose : clear map of list files*/
-//============================================================================
+/*!
+ Clears map of list files
+*/
void LightApp_Driver::ClearDriverContents()
{
std::map<std::string, ListOfFiles>::iterator it;
SetIsTemporary( false );
}
-//============================================================================
-// function : GetTempDir
-/*! Purpose : return a temp directory to store created files like "/tmp/sub_dir/" */
-//============================================================================
+/*!
+ \return a temp directory to store created files like "/tmp/sub_dir/"
+*/
std::string LightApp_Driver::GetTmpDir()
{
if ( myTmpDir.length() != 0 )
return aTmpDir.ToCString();
}
-//============================================================================
-// function : GetDirFromPath
-/*! Purpose : returns the dir by the path*/
-//============================================================================
+/*!
+ \return the dir by the path
+*/
std::string LightApp_Driver::GetDirFromPath( const std::string& thePath ) {
if(thePath == "")
return "";
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_DRIVER_H
#define LIGHTAPP_DRIVER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_GLSelector.h"
#include "LightApp_DataOwner.h"
-#include <SALOME_GLOwner.h>
-
#include <GLViewer_Context.h>
/*!Constructor. Initialize by GLViewer_Viewer2d and SUIT_SelectionMgr.*/
GLViewer_Object* obj = cont->SelectedObject();
if ( obj )
{
- SALOME_GLOwner* owner = dynamic_cast< SALOME_GLOwner* >( obj->owner() );
+ LightApp_GLOwner* owner = dynamic_cast< LightApp_GLOwner* >( obj->owner() );
if( owner )
aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( owner->entry() ) ) );
}
GLViewer_Object* obj = *it;
if ( obj && obj->getVisible() )
{
- SALOME_GLOwner* owner = dynamic_cast< SALOME_GLOwner* >( obj->owner() );
+ LightApp_GLOwner* owner = dynamic_cast< LightApp_GLOwner* >( obj->owner() );
if ( owner )
aDisplayed.insert( owner->entry(), obj );
}
if ( Nb > 0 )
myViewer->updateAll();
}
+
+
+/*!
+ Constructor
+ \param entry - entry of object
+*/
+LightApp_GLOwner::LightApp_GLOwner( const char* entry )
+: GLViewer_Owner()
+{
+ setEntry( entry );
+}
+
+/*!
+ Destructor
+*/
+LightApp_GLOwner::~LightApp_GLOwner()
+{
+}
+
+/*!
+ \return entry
+*/
+const char* LightApp_GLOwner::entry() const
+{
+ return myEntry.c_str();
+}
+
+/*!
+ Sets new entry
+ \param entry - entry of object
+*/
+void LightApp_GLOwner::setEntry( const char* entry )
+{
+ myEntry = entry;
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_GLSELECTOR_H
#define LIGHTAPP_GLSELECTOR_H
#include <GLViewer_Viewer2d.h>
+#include <string>
+#include <GLViewer_Object.h>
+
+/*!
+ \class LightApp_GLSelector
+ Custom selector to get/set selection from GL viewer
+*/
class LIGHTAPP_EXPORT LightApp_GLSelector : public SUIT_Selector
{
Q_OBJECT
GLViewer_Viewer2d* myViewer;
};
+
+/*!
+ This class provide data owner objects for GLViewer.
+*/
+class LIGHTAPP_EXPORT LightApp_GLOwner : public GLViewer_Owner
+{
+public:
+ LightApp_GLOwner( const char* );
+ ~LightApp_GLOwner();
+
+ const char* entry() const;
+ void setEntry( const char* );
+
+private:
+ std::string myEntry;
+};
+
#endif
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_Module.cxx
// Created: 6/20/2005 16:30:56 AM
// Author: OCC team
#include <SUIT_DataObject.h>
#include <SUIT_ResourceMgr.h>
-#include <SVTK_ViewWindow.h>
-#include <SVTK_ViewModel.h>
-#include <OCCViewer_ViewWindow.h>
-#include <OCCViewer_ViewPort3d.h>
-#include <SOCC_ViewModel.h>
-#include <GLViewer_ViewFrame.h>
-#include <GLViewer_ViewPort.h>
-#include <Plot2d_ViewWindow.h>
-#include <Plot2d_ViewFrame.h>
-#include <SPlot2d_ViewModel.h>
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SVTK_ViewWindow.h>
+ #include <SVTK_ViewModel.h>
+#else
+ #include <VTKViewer_ViewWindow.h>
+#endif
+ #include <VTKViewer_ViewModel.h>
+#endif
+#ifndef DISABLE_OCCVIEWER
+ #include <OCCViewer_ViewWindow.h>
+ #include <OCCViewer_ViewPort3d.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SOCC_ViewModel.h>
+#else
+ #include <OCCViewer_ViewModel.h>
+#endif
+#endif
+#ifndef DISABLE_GLVIEWER
+ #include <GLViewer_ViewFrame.h>
+ #include <GLViewer_ViewPort.h>
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ #include <Plot2d_ViewWindow.h>
+ #include <Plot2d_ViewFrame.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SPlot2d_ViewModel.h>
+#else
+ #include <Plot2d_ViewModel.h>
+#endif
+#endif
#include <OB_Browser.h>
void LightApp_Module::updateObjBrowser( bool theIsUpdateDataModel,
SUIT_DataObject* theDataObject )
{
+ bool upd = getApp()->objectBrowser()->isAutoUpdate();
+ getApp()->objectBrowser()->setAutoUpdate( false );
+
SUIT_DataObject* aDataObject = theDataObject;
if( theIsUpdateDataModel ){
if( CAM_DataModel* aDataModel = dataModel() ){
}
}
}
- getApp()->objectBrowser()->updateTree( aDataObject );
+ getApp()->objectBrowser()->setAutoUpdate( upd );
+ getApp()->objectBrowser()->updateTree( 0, false /*aDataObject*/ );
}
/*!NOT IMPLEMENTED*/
if ( res && application() && application()->resourceMgr() )
application()->resourceMgr()->raiseTranslators( name() );
+ connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
+ connect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
+
if ( mySwitchOp == 0 )
mySwitchOp = new LightApp_SwitchOp( this );
delete mySwitchOp;
mySwitchOp = 0;
+ disconnect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
+ disconnect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
+
// abort all operations
MapOfOperation::const_iterator anIt;
for( anIt = myOperations.begin(); anIt != myOperations.end(); anIt++ ) {
if ( SUIT_ViewManager* viewMgr = getApp()->activeViewManager() )
if ( SUIT_ViewWindow* viewWnd = viewMgr->getActiveView() )
{
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
if ( viewWnd->inherits( "SVTK_ViewWindow" ) )
( (SVTK_ViewWindow*)viewWnd )->Repaint();
- else if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
+#else
+ if ( viewWnd->inherits( "VTKViewer_ViewWindow" ) )
+ ( (VTKViewer_ViewWindow*)viewWnd )->Repaint();
+#endif
+#endif
+#ifndef DISABLE_OCCVIEWER
+ if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
- else if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
( (Plot2d_ViewWindow*)viewWnd )->getViewFrame()->Repaint();
- else if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
+#endif
+#ifndef DISABLE_GLVIEWER
+ if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate();
+#endif
}
}
}
myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, true );
myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, true );
myPopupMgr->setRule( dispOnly, uniform, true );
- QString viewers = "{ '%1' '%2' '%3' }";
- viewers = viewers.arg( SOCC_Viewer::Type() ).arg( SVTK_Viewer::Type() ).arg( SPlot2d_Viewer::Type() );
- myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( viewers ), true );
+
+ QStringList viewers;
+
+#ifndef DISABLE_OCCVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ viewers.append( SOCC_Viewer::Type() );
+#else
+ viewers.append( OCCViewer_Viewer::Type() );
+#endif
+#endif
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ viewers.append( SVTK_Viewer::Type() );
+#else
+ viewers.append( VTKViewer_Viewer::Type() );
+#endif
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ viewers.append( SPlot2d_Viewer::Type() );
+#else
+ viewers.append( Plot2d_Viewer::Type() );
+#endif
+#endif
+
+ if( !viewers.isEmpty() )
+ {
+ QString strViewers = "{ ", temp = "'%1' ";
+ QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
+ for( ; anIt!=aLast; anIt++ )
+ strViewers+=temp.arg( *anIt );
+ strViewers+="}";
+ myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( strViewers ), true );
+ }
}
return myPopupMgr;
}
}
}
+/*!
+ Must be redefined in order to use standard displayer mechanism
+ \return displayer of module
+*/
LightApp_Displayer* LightApp_Module::displayer()
{
return 0;
}
+/*!
+ SLOT: called on activating of standard operations show/hide
+*/
void LightApp_Module::onShowHide()
{
if( !sender()->inherits( "QAction" ) || !popupMgr() )
if( id!=-1 )
startOperation( id );
}
+
+/*!
+ virtual SLOT: called on view manager adding
+*/
+void LightApp_Module::onViewManagerAdded( SUIT_ViewManager* )
+{
+}
+
+/*!
+ virtual SLOT: called on view manager removing
+*/
+void LightApp_Module::onViewManagerRemoved( SUIT_ViewManager* )
+{
+}
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_Module.h
// Created: 6/20/2005 16:25:06 AM
// Author: OCC team
class SUIT_Study;
class SUIT_DataObject;
class SUIT_Operation;
+class SUIT_ViewManager;
class CAM_Application;
class QtxPopupMgr;
class QString;
class QVariant;
-/*
- Class : LightApp_Module
- Description : Base class for all light modules
+/*!
+ \class LightApp_Module
+ Base class for all light modules
*/
class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
virtual void onOperationStopped( SUIT_Operation* );
virtual void onOperationDestroyed();
virtual void onShowHide();
+ virtual void onViewManagerAdded( SUIT_ViewManager* );
+ virtual void onViewManagerRemoved( SUIT_ViewManager* );
protected:
virtual QtxPopupMgr* popupMgr();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : LightApp_ModuleDlg.cxx
// Author : Michael Zorin (mzn)
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : LightApp_ModuleDlg.h
// Author : Michael ZORIN (mzn)
class QLabel;
class QPushButton;
+/*!
+ \class LightApp_ModuleDlg
+ Dialog allows to choose action on module activation when there is no document.
+ It is possible to create new document, to open existing or to cancel module activation
+*/
class LIGHTAPP_EXPORT LightApp_ModuleDlg : public QDialog
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : LightApp_NameDlg.cxx
// Author : Vadim SANDLER
return myLineEdit->text();
}
+/*!
+ Accepts if name isn't empty
+*/
void LightApp_NameDlg::accept()
{
if ( name().stripWhiteSpace().isEmpty() )
-// SALOME SalomeApp : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SalomeApp : implementation of desktop and GUI kernel
//
// File : LightApp_NameDlg.h
// Author : Vadim SANDLER
class QLineEdit;
class QPushButton;
-//=================================================================================
-// class : LightApp_NameDlg
-/*! purpose : Common <Rename> dialog box class*/
-//=================================================================================
+/*!
+ \class LightApp_NameDlg
+ Common <Rename> dialog box class
+*/
class LIGHTAPP_EXPORT LightApp_NameDlg : public QDialog
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_OBFilter.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_OBFILTER_H
#define LIGHTAPP_OBFILTER_H
class LightApp_SelectionMgr;
+/*!
+ \class LightApp_OBFilter
+ Custom Object Browser filter, that checks correctness of object by all filters set in selection manager
+*/
class LIGHTAPP_EXPORT LightApp_OBFilter: public OB_Filter
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_OBSelector.h"
LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( it.current() );
if ( obj )
{
+#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject
( obj->entry(), obj->componentDataType(), obj->name() );
LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj );
+#else
+ LightApp_DataOwner* owner = new LightApp_DataOwner( obj->entry() );
+#endif
that->mySelectedList.append( SUIT_DataOwnerPtr( owner ) );
}
}
}
myBrowser->setSelected( objList );
+ mySelectedList.clear();
}
/*!On selection changed.*/
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_OBSELECTOR_H
#define LIGHTAPP_OBSELECTOR_H
class OB_Browser;
class LightApp_DataObject;
+/*!
+ \class LightApp_OBSelector
+ Custom selector to get/set selection from object browser
+*/
class LIGHTAPP_EXPORT LightApp_OBSelector : public SUIT_Selector
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_DataOwner.h"
#include "LightApp_OCCSelector.h"
-#include <SALOME_InteractiveObject.hxx>
-
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_InteractiveObject.hxx>
+#endif
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() )
if ( !anIt.Value().IsNull() )
{
+#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anIt.Value()->GetOwner());
if( !anObj.IsNull() )
aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( anObj ) ) );
+#else
+ aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) );
+#endif
}
}
if ( anAIS.IsNull() || !anAIS->HasOwner() )
return QString::null;
- Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner());
-
QString res;
+
+#ifndef DISABLE_SALOMEOBJECT
+ Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner());
if ( !anObj.IsNull() )
res = QString( anObj->getEntry() );
+#endif
+
return res;
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_OCCSELECTOR_H
#define LIGHTAPP_OCCSELECTOR_H
class Handle_AIS_InteractiveObject;
+/*!
+ \class LightApp_OCCSelector
+ Custom selector to get/set selection from OCC viewer
+*/
class LIGHTAPP_EXPORT LightApp_OCCSelector : public SUIT_Selector
{
Q_OBJECT
-// LIGHT LightApp
-//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : LightApp_Operation.h
// Author : Sergey LITONIN
-// Module : LIGHT
+// Module : LightApp
#include <LightApp_Operation.h>
#include <LightApp_Module.h>
setDialogActive( false );
}
-//=======================================================================
-// name : abortOperation
-// Purpose : Hide dialog box (if it is exists)
-//=======================================================================
/*!
* \brief Performs actions needed for aborting operation
*
-// LIGHT LightApp
-//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : LightApp_Operation.h
// Author : Sergey LITONIN
class LightApp_Dialog;
class SUIT_Desktop;
-/*
- Class : LightApp_Operation
- Description : Base class for all operations
-*/
-
/*!
- * \brief Base class for all operations
- *
- * Base class for all operations (see SUIT_Operation for more description)
+ \class LightApp_Operation
+ \brief Base class for all operations
+ Base class for all operations (see SUIT_Operation for more description)
*/
class LIGHTAPP_EXPORT LightApp_Operation : public SUIT_Operation
{
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: LightApp_Preferences.cxx
// Author: Sergey TELKOV
return id;
}
-/*
+/*!
Checks: is preferences has module with name \a mod.
*/
bool LightApp_Preferences::hasModule( const QString& mod ) const
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: LightApp_Preferences.h
// Author: Sergey TELKOV
class QtxResourceMgr;
+/*!
+ \class LightApp_Preferences
+ Custom preference container. Assign each preference category with module.
+ Emits signal on preference changing
+*/
class LIGHTAPP_EXPORT LightApp_Preferences : public QtxListResourceEdit
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: LightApp_PreferencesDlg.cxx
// Author: Sergey TELKOV
#include "LightApp_PreferencesDlg.h"
-
#include "LightApp_Preferences.h"
#include "QtxResourceMgr.h"
#include <qlayout.h>
#include <qmessagebox.h>
#include <qvbox.h>
+#include <qfiledialog.h>
/*!
Constructor.
*/
LightApp_PreferencesDlg::LightApp_PreferencesDlg( LightApp_Preferences* prefs, QWidget* parent )
-: QtxDialog( parent, 0, true, false, OK | Close | Apply ),
+: QtxDialog( parent, 0, true, true, OK | Close | Apply ),
myPrefs( prefs ), mySaved ( false )
{
setCaption( tr( "CAPTION" ) );
QButton* defBtn = userButton( insertButton( tr( "DEFAULT_BTN_TEXT" ) ) );
if ( defBtn )
connect( defBtn, SIGNAL( clicked() ), this, SLOT( onDefault() ) );
+ QButton* impBtn = userButton( insertButton( tr( "IMPORT_BTN_TEXT" ) ) );
+ if( impBtn )
+ connect( impBtn, SIGNAL( clicked() ), this, SLOT( onImportPref() ) );
}
/*!
}
}
}
+
+/*! Import preferences from some file */
+void LightApp_PreferencesDlg::onImportPref()
+{
+ QtxResourceMgr* mgr = myPrefs->resourceMgr();
+ if( !mgr )
+ return;
+
+ QFileDialog dlg( ".", "*", this, "", tr( "IMPORT_PREFERENCES" ) );
+ dlg.setShowHiddenFiles( true );
+ dlg.exec();
+ QString fname = dlg.selectedFile();
+ if( fname.isEmpty() )
+ return;
+
+ if( mgr->import( fname ) )
+ {
+ myPrefs->retrieve();
+ myPrefs->toBackup();
+ }
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: LightApp_PreferencesDlg.h
// Author: Sergey TELKOV
class LightApp_Preferences;
+/*!
+ \class LightApp_PreferencesDlg
+ Dialog for preferences edition
+*/
class LIGHTAPP_EXPORT LightApp_PreferencesDlg : public QtxDialog
{
Q_OBJECT
void onHelp();
void onApply();
void onDefault();
+ void onImportPref();
private:
LightApp_Preferences* myPrefs;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_ROOTOBJECT_H
#define LIGHTAPP_ROOTOBJECT_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_Selection.h"
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>( (*anIt ).get() );
if( sowner )
{
- if( entries.contains( sowner->entry() ) )
+ entry = myStudy->referencedToEntry( sowner->entry() );
+ if( entries.contains( entry ) )
continue;
- entry = myStudy->referencedToEntry( sowner->entry() );
entries.insert( entry, 0 );
myEntries.insert( num, entry );
- myIsReferences.insert( num, sowner->entry() == entry );
+ myIsReferences.insert( num, sowner->entry() != entry );
processOwner( sowner );
num++;
}
LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false );
// false in last parameter means that now we doesn't load module, if it isn't loaded
- return QtxValue( d ? d->canBeDisplayed( myEntries[ ind ] ) : true, 0 );
+ if ( d )
+ return d->canBeDisplayed( myEntries[ ind ] );
+ else if ( myEntries[ ind ].startsWith( QObject::tr( "SAVE_POINT_DEF_NAME" ) ) ) // object is a Save Point object
+ return false;
+
+ return true;
//now if displayer is null, it means, that according module isn't loaded, so that we allow to all display/erase
//operations under object
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class LightApp_Study;
class SUIT_ViewWindow;
-
+/*!
+ \class LightApp_Selection
+ Custom selection class, allowing to build popup with rules on the base
+ of owners selected in all selectors (popup client has more priority).
+ It is able to return values of standard object properties
+ (isVisible,isComponent,canBeDisplayed,isReference, etc)
+*/
class LIGHTAPP_EXPORT LightApp_Selection : public QtxPopupMgr::Selection
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_SelectionMgr.h"
#include <SUIT_Session.h>
-#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_ListIO.hxx>
+ #include <SALOME_ListIteratorOfListIO.hxx>
-// Open CASCADE Include
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
+ // Open CASCADE Include
+ #include <TColStd_MapOfInteger.hxx>
+ #include <TColStd_MapIteratorOfMapOfInteger.hxx>
+ #include <TColStd_IndexedMapOfInteger.hxx>
+#endif
/*!
Constructor.
return myApp;
}
+#ifndef DISABLE_SALOMEOBJECT
/*!
Get all selected objects from selection manager
*/
QString component = study->componentDataType( refEntry );
theList.Append( new SALOME_InteractiveObject( refEntry, component, ""/*refobj->Name().c_str()*/ ) );
}
- else
+ else if( !owner->IO().IsNull() )
theList.Append( owner->IO() );
}
}
else {
- if( !entryMap.contains( entry ) )
+ if( !entryMap.contains( entry ) && !owner->IO().IsNull() )
theList.Append( owner->IO() );
}
setSelected( owners, append );
}
+#else
+/*!
+ Get all selected objects from selection manager
+*/
+void LightApp_SelectionMgr::selectedObjects( QStringList& theList, const QString& theType,
+ const bool convertReferences ) const
+{
+ theList.clear();
+
+ SUIT_DataOwnerPtrList aList;
+ selected( aList, theType );
+
+ QString entry;
+ for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
+ {
+ const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
+ if( !owner )
+ continue;
+
+ LightApp_Study* study = dynamic_cast<LightApp_Study*>( application()->activeStudy() );
+ if ( !study )
+ return;
+
+ entry = owner->entry();
+ if( !theList.contains( entry ) )
+ theList.append( entry );
+ }
+}
+
+#endif
+
/*!
Emit current selection changed.
*/
emit currentSelectionChanged();
}
+#ifndef DISABLE_SALOMEOBJECT
+
/*!
get map of indexes for the given SALOME_InteractiveObject
*/
}
}
}
+
+#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_SELECTIONMGR_H
#define LIGHTAPP_SELECTIONMGR_H
#include "LightApp.h"
#include <SUIT_SelectionMgr.h>
-#include <SALOME_InteractiveObject.hxx>
-#include <qmap.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_InteractiveObject.hxx>
+ #include <qmap.h>
+
+ class SALOME_ListIO;
+ class TColStd_IndexedMapOfInteger;
+ class TColStd_MapOfInteger;
+#else
+#include <qstringlist.h>
+#endif
-class SALOME_ListIO;
class LightApp_Application;
-class TColStd_IndexedMapOfInteger;
-class TColStd_MapOfInteger;
+/*!
+ Custom selection manager, allowing to work with object selection
+ (additionally to data owners) and to access to sub-selection of objects
+*/
class LIGHTAPP_EXPORT LightApp_SelectionMgr : public SUIT_SelectionMgr
{
Q_OBJECT
LightApp_SelectionMgr( LightApp_Application*, const bool = true );
virtual ~LightApp_SelectionMgr();
+ LightApp_Application* application() const;
+
+#ifndef DISABLE_SALOMEOBJECT
typedef QMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger;
typedef QMap< QString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger;
- LightApp_Application* application() const;
-
void selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const;
void setSelectedObjects( const SALOME_ListIO&, const bool = false );
void selectObjects( MapIOOfMapOfInteger theMapIO, bool append );
void selectedSubOwners( MapEntryOfMapOfInteger& theMap );
+#else
+ void selectedObjects( QStringList&, const QString& = QString::null, const bool = true ) const;
+#endif
signals:
void currentSelectionChanged();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_ShowHideOp.h"
#include "LightApp_SelectionMgr.h"
#include "LightApp_Selection.h"
-#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_ListIO.hxx>
+ #include <SALOME_ListIteratorOfListIO.hxx>
+#endif
+/*!
+ Constructor
+*/
LightApp_ShowHideOp::LightApp_ShowHideOp( ActionType type )
: LightApp_Operation(),
myActionType( type )
{
}
+/*!
+ Destructor
+*/
LightApp_ShowHideOp::~LightApp_ShowHideOp()
{
}
+/*!
+ Makes show/hide operation
+*/
void LightApp_ShowHideOp::startOperation()
{
LightApp_Application* app = dynamic_cast<LightApp_Application*>( application() );
}
}
+ QStringList entries;
+
+#ifndef DISABLE_SALOMEOBJECT
SALOME_ListIO selObjs;
mgr->selectedObjects( selObjs );
-
- QStringList entries;
SALOME_ListIteratorOfListIO anIt( selObjs );
for( ; anIt.More(); anIt.Next() )
- {
- if( anIt.Value().IsNull() )
- continue;
+ if( !anIt.Value().IsNull() )
+#else
+ QStringList selObjs;
+ mgr->selectedObjects( selObjs );
+ QStringList::const_iterator anIt = selObjs.begin(), aLast = selObjs.end();
+ for( ; ; anIt!=aLast )
+#endif
+ {
+ QString entry =
+#ifndef DISABLE_SALOMEOBJECT
+ anIt.Value()->getEntry();
+#else
+ *anIt;
+#endif
- if( study->isComponent( anIt.Value()->getEntry() ) )
- study->children( anIt.Value()->getEntry(), entries );
- else
- entries.append( anIt.Value()->getEntry() );
- }
+ if( study->isComponent( entry ) )
+ study->children( entry, entries );
+ else
+ entries.append( entry );
+ }
for( QStringList::const_iterator it = entries.begin(), last = entries.end(); it!=last; it++ )
{
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_SHOW_HIDE_OPERATION_HEADER
#include "LightApp_Operation.h"
class LightApp_Displayer;
+
+/*!
+ \class LightApp_ShowHideOp
+ Standard operation allowing to show/hide selected objects
+ corresponding to any module with help of module displayer
+*/
class LIGHTAPP_EXPORT LightApp_ShowHideOp : public LightApp_Operation
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_Study.h"
#include "LightApp_DataModel.h"
#include "LightApp_DataObject.h"
#include "LightApp_RootObject.h"
-// HDF persistence not yet completed
-//#include "LightApp_HDFDriver.h"
+#include "LightApp_HDFDriver.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_DataObjectIterator.h"
LightApp_Study::LightApp_Study( SUIT_Application* app )
: CAM_Study( app )
{
- // HDF persistence not yet completed
- //myDriver = new LightApp_HDFDriver();
- myDriver = new LightApp_Driver();
+ // HDF persistence
+ myDriver = new LightApp_HDFDriver();
+ //myDriver = new LightApp_Driver();
}
-
+
/*!
Destructor.
*/
*/
void LightApp_Study::createDocument()
{
+ setStudyName( QString( "Study%1" ).arg( LightApp_Application::studyId() ) );
+
// create myRoot
setRoot( new LightApp_RootObject( this ) );
emit created( this );
}
-//=======================================================================
-// name : openDocument
-/*! Purpose : Open document*/
-//=======================================================================
+/*!
+ Opens document
+*/
bool LightApp_Study::openDocument( const QString& theFileName )
{
myDriver->ClearDriverContents();
return res;
}
-//=======================================================================
-// name : loadDocument
-/*! Purpose : Load document */
-//=======================================================================
+/*!
+ Loads document
+*/
bool LightApp_Study::loadDocument( const QString& theStudyName )
{
myDriver->ClearDriverContents();
return res;
}
-//=======================================================================
-// name : saveDocumentAs
-/*! Purpose : Save document */
-//=======================================================================
+/*!
+ Saves document
+*/
bool LightApp_Study::saveDocumentAs( const QString& theFileName )
{
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
return res;
}
-//=======================================================================
-// name : saveDocument
-/*! Purpose : Save document */
-//=======================================================================
+/*!
+ Saves document
+*/
bool LightApp_Study::saveDocument()
{
ModelList list; dataModels( list );
return res;
}
-//================================================================
-// Function : closeDocument
-/*! Purpose : Close document */
-//================================================================
+/*!
+ Closes document
+*/
void LightApp_Study::closeDocument(bool permanently)
{
// Inform everybody that this study is going to close when it's most safe to,
myDriver->ClearDriverContents();
}
-//================================================================
-// Function : referencedToEntry
-/*! Purpose : Return current entry*/
-//================================================================
+/*!
+ \return real entry by entry of reference
+ \param entry - entry of reference object
+*/
QString LightApp_Study::referencedToEntry( const QString& entry ) const
{
return entry;
}
-//================================================================
-// Function : children
-/*! Purpose : Return entries of children of object*/
-//================================================================
+/*!
+ \return entries of object children
+*/
void LightApp_Study::children( const QString&, QStringList& ) const
{
}
-//================================================================
-// Function : isComponent
-/*! Purpose : Return true if entry corresponds to component*/
-//================================================================
+/*!
+ \return true if entry corresponds to component
+*/
bool LightApp_Study::isComponent( const QString& entry ) const
{
if( !root() )
return false;
}
-//================================================================
-// Function : componentDataType
-/*! Purpose : Return component data type from entry*/
-//================================================================
+/*!
+ \return component data type for entry
+*/
QString LightApp_Study::componentDataType( const QString& entry ) const
{
LightApp_DataObject* aCurObj;
return "";
}
-//================================================================
-// Function : isModified
-// Purpose :
-//================================================================
+/*!
+ \return true if study is modified
+*/
bool LightApp_Study::isModified() const
{
bool isAnyChanged = CAM_Study::isModified();
return isAnyChanged;
}
-//================================================================
-// Function : isSaved
-/*! Purpose : Check: data model is saved?*/
-//================================================================
+/*!
+ \return true if data model is saved
+*/
bool LightApp_Study::isSaved() const
{
return CAM_Study::isSaved();
}
-//=======================================================================
-// name : addComponent
-/*! Purpose : Create SComponent for module, necessary for SalomeApp study */
-//=======================================================================
+/*!
+ Creates SComponent for module, necessary for SalomeApp study
+*/
void LightApp_Study::addComponent(const CAM_DataModel* dm)
{
}
-//=======================================================================
-// name : saveModuleData
-/*! Purpose : save list file for module 'theModuleName' */
-//=======================================================================
+/*!
+ Saves list file for module 'theModuleName'
+*/
void LightApp_Study::saveModuleData(QString theModuleName, QStringList theListOfFiles)
{
int aNb = theListOfFiles.count();
myDriver->SetListOfFiles(theModuleName, aListOfFiles);
}
-//=======================================================================
-// name : openModuleData
-/*! Purpose : gets list of file for module 'theModuleNam' */
-//=======================================================================
+/*!
+ Gets list of file for module 'theModuleNam'
+*/
void LightApp_Study::openModuleData(QString theModuleName, QStringList& theListOfFiles)
{
std::vector<std::string> aListOfFiles = myDriver->GetListOfFiles(theModuleName);
theListOfFiles.append(aListOfFiles[i+1].c_str());
}
-//=======================================================================
-// name : saveStudyData
-/*! Purpose : save data from study */
-//=======================================================================
+/*!
+ Saves data from study
+*/
bool LightApp_Study::saveStudyData( const QString& theFileName )
{
ModelList list; dataModels( list );
return aRes;
}
-//=======================================================================
-// name : openStudyData
-/*! Purpose : open data for study */
-//=======================================================================
+/*!
+ Opens data for study
+*/
bool LightApp_Study::openStudyData( const QString& theFileName )
{
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
return aRes;
}
-//================================================================
-// Function : openDataModel
-/*! Purpose : Open data model */
-//================================================================
+/*!
+ Opens data model
+*/
bool LightApp_Study::openDataModel( const QString& studyName, CAM_DataModel* dm )
{
if (!dm)
return false;
}
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ \return temporary directory for saving files of modules
+*/
std::string LightApp_Study::GetTmpDir (const char* theURL,
const bool isMultiFile)
{
return myDriver->GetTmpDir(theURL, isMultiFile);
}
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ \return list of files necessary for module
+ \param theModuleName - name of module
+*/
std::vector<std::string> LightApp_Study::GetListOfFiles(const char* theModuleName) const
{
std::vector<std::string> aListOfFiles;
return aListOfFiles;
}
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ Sets list of files necessary for module
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files
+*/
void LightApp_Study::SetListOfFiles (const char* theModuleName, const std::vector<std::string> theListOfFiles)
{
myDriver->SetListOfFiles(theModuleName, theListOfFiles);
}
-//================================================================
-// Function : RemoveTemporaryFiles
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ Removes temporary files
+*/
void LightApp_Study::RemoveTemporaryFiles (const char* theModuleName, const bool isMultiFile) const
{
if (isMultiFile)
myDriver->RemoveTemporaryFiles(theModuleName, isDirDeleted);
}
-//================================================================
-// Function : components
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ Fills list with components names
+ \param comp - list to be filled
+*/
void LightApp_Study::components( QStringList& comp ) const
{
DataObjectList children = root()->children();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_STUDY_H
#define LIGHTAPP_STUDY_H
class SUIT_Application;
class CAM_DataModel;
+/*!
+ Custom study, using for open/close of documents HDF format.
+ Data of each module can be saved to different files, those
+ after that are combined into one HDF file
+*/
class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study
{
Q_OBJECT
private:
LightApp_Driver* myDriver;
+
+ friend class LightApp_Application;
};
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/**
-* LIGHT LightApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : LightApp_SwitchOp.h
-* Author : Sergey LITONIN
-* Module : LIGHT
-*/
#include "LightApp_SwitchOp.h"
#include "LightApp_Module.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/**
-* LIGHT LightApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : LightApp_SwitchOp.h
-* Author : Sergey LITONIN
-* Module : LIGHT
-*/
-
-
#ifndef LightApp_SwitchOp_H
#define LightApp_SwitchOp_H
-// LIGHT LightApp
-//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : LightApp_UpdateFlags.h
// Author : Sergey LITONIN
#ifndef LightApp_UpdateFlags_H
#define LightApp_UpdateFlags_H
-/*
- Enum : UpdateFlags
- Description : Enumeration for update flags. First byte is reserved for LightApp_Module.
- Modules derived from this model must use other 3 bytes to define their
- own update flags
+/*!
+ \enum UpdateFlags
+ Enumeration for update flags. First byte is reserved for LightApp_Module.
+ Modules derived from this model must use other 3 bytes to define their
+ own update flags
*/
typedef enum
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_VTKSelector.h"
#include "LightApp_DataOwner.h"
-#include "SVTK_ViewModelBase.h"
-#include "SVTK_Selector.h"
-#include "SVTK_ViewWindow.h"
-#include "SVTK_Functor.h"
+#ifndef DISABLE_VTKVIEWER
+ #include "SVTK_ViewModelBase.h"
+ #include "SVTK_ViewManager.h"
+ #include "SVTK_Selector.h"
+ #include "SVTK_ViewWindow.h"
+ #include "SVTK_Functor.h"
+ #include "VTKViewer_Algorithm.h"
+ #include <vtkRenderer.h>
+#endif
-#include "SALOME_Actor.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_Actor.h"
+ #include "SALOME_ListIteratorOfListIO.hxx"
+#endif
-#include "VTKViewer_Algorithm.h"
-#include <vtkRenderer.h>
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
/*!
Constructor.
*/
LightApp_SVTKDataOwner
::LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_IndexedMapOfInteger& theIds,
- Selection_Mode theMode,
- SALOME_Actor* theActor):
+ SUIT_Desktop* theDesktop ):
LightApp_DataOwner( theIO ),
- mySelectionMode(theMode),
- myActor(theActor)
-{
- myIds = theIds; // workaround - there is no constructor copy for the container
-}
+ myDesktop( theDesktop )
+{}
+#endif
/*!
Destuctor.
{
}
+/*!
+ \return active SVTK view window
+*/
+SVTK_ViewWindow*
+LightApp_SVTKDataOwner
+::GetActiveViewWindow() const
+{
+ if(SUIT_ViewWindow* aViewWindow = myDesktop->activeWindow())
+ return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+
+ return NULL;
+}
+
+/*!
+ Gets dataowners ids list.
+*/
+const TColStd_IndexedMapOfInteger&
+LightApp_SVTKDataOwner
+::GetIds() const
+{
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){
+ if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){
+ aSelector->GetIndex(IO(),myIds);
+ }
+ }
+
+ return myIds;
+}
+
+/*!
+ Gets selection mode.
+*/
+Selection_Mode
+LightApp_SVTKDataOwner
+::GetMode() const
+{
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){
+ if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){
+ return aSelector->SelectionMode();
+ }
+ }
+
+ return -1;
+}
+
/*!
Gets actor pointer.
*/
LightApp_SVTKDataOwner
::GetActor() const
{
- return myActor.GetPointer();
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){
+ using namespace SVTK;
+ return Find<SALOME_Actor>(aViewWindow->getRenderer()->GetActors(),TIsSameIObject<SALOME_Actor>(IO()));
+ }
+
+ return NULL;
}
+#endif
+
+
+#ifndef DISABLE_VTKVIEWER
/*!
Constructor.
*/
return myViewer->getType();
}
+#endif
/*!
On selection changed.
*/
selectionChanged();
}
+#ifndef DISABLE_VTKVIEWER
+
/*!
Gets list of selected data owners.(output \a aList).
*/
::getSelection( SUIT_DataOwnerPtrList& aList ) const
{
if(myViewer){
- if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
- if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
- if(SVTK_Selector* aSelector = aView->GetSelector()){
- Selection_Mode aMode = aSelector->SelectionMode();
- const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
- SALOME_ListIteratorOfListIO anIter(aListIO);
- for(; anIter.More(); anIter.Next()){
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if(anIO->hasEntry()){
- TColStd_IndexedMapOfInteger anIds;
- aSelector->GetIndex(anIO,anIds);
- SALOME_Actor* anActor = aSelector->GetActor(anIO);
- if( !anActor ){
- using namespace SVTK;
- anActor = Find<SALOME_Actor>(aView->getRenderer()->GetActors(),TIsSameIObject<SALOME_Actor>(anIO));
- }
- aList.append(new LightApp_SVTKDataOwner(anIO,anIds,aMode,anActor));
+ if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){
+ if(SVTK_ViewManager* aViewMgr = dynamic_cast<SVTK_ViewManager*>(aViewManager)){
+ if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
+ if(SVTK_Selector* aSelector = aView->GetSelector()){
+ const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ for(; anIter.More(); anIter.Next()){
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if(anIO->hasEntry())
+ aList.append(new LightApp_SVTKDataOwner(anIO,aViewMgr->getDesktop()));
}
}
}
aSelector->SetSelectionMode(anOwner->GetMode());
Handle(SALOME_InteractiveObject) anIO = anOwner->IO();
- if( anOwner->GetActor() )
- aSelector->AddIObject( anOwner->GetActor() );
- else
- aSelector->AddIObject(anIO);
+ aSelector->AddIObject(anIO);
anAppendList.Append(anIO);
aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
}
}
}
+
+#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_VTKSELECTOR_H
#define LIGHTAPP_VTKSELECTOR_H
-#include <vtkSmartPointer.h>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
#include "SUIT_Selector.h"
-
#include "LightApp.h"
#include "LightApp_DataOwner.h"
-#include "SVTK_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
+class SUIT_Desktop;
-class SALOME_Actor;
-class SVTK_ViewModelBase;
+#ifndef DISABLE_VTKVIEWER
+ #include <vtkSmartPointer.h>
+ #include <TColStd_IndexedMapOfInteger.hxx>
+ #include "SVTK_Selection.h"
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+#endif
+ class SALOME_Actor;
+ class SVTK_ViewWindow;
+ class SVTK_ViewModelBase;
+#endif
/*!
Provide salome vtk data owner list.
class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner
{
public:
+#ifndef DISABLE_VTKVIEWER
+ #ifndef DISABLE_SALOMEOBJECT
LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_IndexedMapOfInteger& theIds,
- Selection_Mode theMode = ActorSelection,
- SALOME_Actor* theActor = NULL);
+ SUIT_Desktop* theDesktop );
+ #endif
virtual ~LightApp_SVTKDataOwner();
/*!Gets dataowners ids list.*/
- const TColStd_IndexedMapOfInteger& GetIds() const
- {
- return myIds;
- }
+ const TColStd_IndexedMapOfInteger& GetIds() const;
/*!Gets selection mode.*/
- Selection_Mode GetMode() const
- {
- return mySelectionMode;
- }
+ Selection_Mode GetMode() const;
+ /*!Finds corresponding actor in the active viewer.*/
SALOME_Actor* GetActor() const;
protected:
- TColStd_IndexedMapOfInteger myIds;
- Selection_Mode mySelectionMode;
- vtkSmartPointer<SALOME_Actor> myActor;
+ mutable TColStd_IndexedMapOfInteger myIds;
+
+ SVTK_ViewWindow* GetActiveViewWindow() const;
+ SUIT_Desktop* myDesktop;
+
+#else
+ LightApp_SVTKDataOwner( const QString& );
+#endif
};
/*!
- Provide vtk selection of data owners.
+ \class LightApp_VTKSelector
+ Custom selector to get/set selection from object browser
*/
class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector
{
Q_OBJECT;
public:
+#ifndef DISABLE_VTKVIEWER
LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
virtual ~LightApp_VTKSelector();
SVTK_ViewModelBase* viewer() const;
virtual QString type() const;
+#else
+ LightApp_VTKSelector( SUIT_SelectionMgr* );
+#endif
private slots:
void onSelectionChanged();
+#ifndef DISABLE_VTKVIEWER
protected:
virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
virtual void setSelection( const SUIT_DataOwnerPtrList& );
private:
SVTK_ViewModelBase* myViewer;
+
+#endif
};
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "LightApp_WidgetContainer.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef LIGHTAPP_WIDGETCONTAINER_H
#define LIGHTAPP_WIDGETCONTAINER_H
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : OCC team (OCN)
# Module : LightApp
LightApp_Dialog.h \
LightApp_Displayer.h \
LightApp_Driver.h \
- LightApp_GLSelector.h \
+ LightApp_HDFDriver.h \
LightApp_Module.h \
LightApp_ModuleDlg.h \
LightApp_NameDlg.h \
LightApp_OBFilter.h \
LightApp_OBSelector.h \
- LightApp_OCCSelector.h \
LightApp_Operation.h \
LightApp_Selection.h \
LightApp_SelectionMgr.h \
LightApp_PreferencesDlg.h \
LightApp_RootObject.h \
LightApp_UpdateFlags.h \
- LightApp_VTKSelector.h \
LightApp_WidgetContainer.h
-# LightApp_HDFDriver.h \
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ EXPORT_HEADERS+= LightApp_VTKSelector.h
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ EXPORT_HEADERS+= LightApp_OCCSelector.h
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ EXPORT_HEADERS+= LightApp_GLSelector.h
+endif
# .po files to transform in .qm
PO_FILES = LightApp_images.po \
LightApp_Dialog.cxx \
LightApp_Displayer.cxx \
LightApp_Driver.cxx \
- LightApp_GLSelector.cxx \
+ LightApp_HDFDriver.cxx \
LightApp_Module.cxx \
LightApp_ModuleDlg.cxx \
LightApp_NameDlg.cxx \
LightApp_OBFilter.cxx \
LightApp_OBSelector.cxx \
- LightApp_OCCSelector.cxx \
LightApp_Operation.cxx \
LightApp_Selection.cxx \
LightApp_SelectionMgr.cxx \
LightApp_SwitchOp.cxx \
LightApp_Preferences.cxx \
LightApp_PreferencesDlg.cxx \
- LightApp_VTKSelector.cxx \
LightApp_WidgetContainer.cxx
-# LightApp_HDFDriver.cxx \
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIB_SRC+= LightApp_VTKSelector.cxx
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ LIB_SRC+= LightApp_OCCSelector.cxx
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ LIB_SRC+= LightApp_GLSelector.cxx
+endif
LIB_MOC = LightApp_AboutDlg.h \
LightApp_Application.h \
LightApp_DataModel.h \
LightApp_Dialog.h \
- LightApp_GLSelector.h \
LightApp_OBSelector.h \
- LightApp_OCCSelector.h \
LightApp_Operation.h \
LightApp_Module.h \
LightApp_ModuleDlg.h \
LightApp_SwitchOp.h \
LightApp_Preferences.h \
LightApp_PreferencesDlg.h \
- LightApp_VTKSelector.h \
LightApp_WidgetContainer.h
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIB_MOC+= LightApp_VTKSelector.h
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ LIB_MOC+= LightApp_OCCSelector.h
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ LIB_MOC+= LightApp_GLSelector.h
+endif
+
RESOURCES_FILES = icon_about.png \
icon_applogo.png \
icon_default.png \
LightApp.ini \
LightApp.xml
-CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES)
- #$(HDF5_INCLUDES)
+CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(OCC_INCLUDES) \
+ $(HDF5_INCLUDES) $(KERNEL_CXXFLAGS)
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ CPPFLAGS+= $(VTK_INCLUDES)
+else
+ CPPFLAGS+= -DDISABLE_VTKVIEWER
+endif
+ifneq ($(DISABLE_PLOT2DVIEWER),yes)
+ CPPFLAGS+= $(QWT_INCLUDES)
+else
+ CPPFLAGS+= -DDISABLE_PLOT2DVIEWER
+endif
+ifeq ($(DISABLE_OCCVIEWER),yes)
+ CPPFLAGS+= -DDISABLE_OCCVIEWER
+endif
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ CPPFLAGS+= $(PYTHON_INCLUDES)
+else
+ CPPFLAGS+= -DDISABLE_PYCONSOLE
+endif
+ifeq ($(DISABLE_GLVIEWER),yes)
+ CPPFLAGS+= -DDISABLE_GLVIEWER
+endif
+ifeq ($(DISABLE_SUPERVGRAPHVIEWER),yes)
+ CPPFLAGS+= -DDISABLE_SUPERVGRAPHVIEWER
+endif
+ifeq ($(DISABLE_SALOMEOBJECT),yes)
+ CPPFLAGS+= -DDISABLE_SALOMEOBJECT
+endif
+
+LDFLAGS+=$(QT_MT_LIBS)
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ LDFLAGS+= $(PYTHON_LIBS)
+endif
+
+LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lLogWindow $(CAS_KERNEL) -lSalomePrs \
+ $(HDF5_LIBS) $(KERNEL_LDFLAGS) -lSalomeHDFPersist
-LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS)
-LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lLogWindow $(CAS_KERNEL) -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSOCC -lSVTK -lSPlot2d -lSUPERVGraph -lPyInterp -lPythonConsole
- #$(HDF5_LIBS) -lSalomeHDFPersistCopy
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSalomeObject
+endif
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ LIBS+= -lVTKViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSVTK
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ LIBS+= -lOCCViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSOCC
+endif
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ LIBS+= -lGLViewer
+endif
+ifneq ($(DISABLE_PLOT2DVIEWER),yes)
+ LIBS+= -lPlot2d
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSPlot2d
+endif
+endif
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ LIBS+= -lPyInterp -lPythonConsole
+endif
+ifneq ($(DISABLE_SUPERVGRAPHVIEWER),yes)
+ LIBS+= -lSUPERVGraph
+endif
@CONCLUDE@
<document>
- <section name="desktop" >
- <parameter name="state" value="max"/>
- <parameter name="pos_x" value="100"/>
- <parameter name="pos_y" value="050"/>
- <parameter name="width" value="640"/>
- <parameter name="height" value="480"/>
- </section>
<section name="launch">
+ <!-- SALOME launching parameters -->
<parameter name="gui" value="yes"/>
<parameter name="splash" value="yes"/>
<parameter name="file" value="no"/>
<parameter name="modules" value="LIGHT"/>
</section>
<section name="language">
+ <!-- Language settings (resource manager)-->
<parameter name="language" value="en"/>
<parameter name="translators" value="%P_msg_%L.qm|%P_icons.qm|%P_images.qm"/>
</section>
+ <section name="splash" >
+ <!-- Splash screen settings -->
+ <parameter name="image" value="${SUITRoot}/resources/icon_about.png" />
+ <parameter name="info" value="%A : %V" />
+ <parameter name="text_colors" value="#543AA9|#FFFFFF" />
+ </section>
<section name="resources">
+ <!-- Resource directories (resource manager)-->
<parameter name="SUIT" value="${SUITRoot}/resources"/>
<parameter name="STD" value="${SUITRoot}/resources"/>
<parameter name="Plot2d" value="${SUITRoot}/resources"/>
<parameter name="CAM" value="${SUITRoot}/resources"/>
<parameter name="LightApp" value="${SUITRoot}/resources"/>
<parameter name="SVTK" value="${SUITRoot}/resources"/>
- <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
<parameter name="ToolsGUI" value="${SUITRoot}/resources"/>
+ <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
+ </section>
+ <section name="desktop" >
+ <!-- Default GUI desktop state, position, size -->
+ <parameter name="state" value="normal"/>
+ <parameter name="pos_x" value="center"/>
+ <parameter name="pos_y" value="center"/>
+ <parameter name="width" value="800"/>
+ <parameter name="height" value="600"/>
</section>
<section name="LIGHT">
+ <!-- LIGHT module settings -->
<parameter name="name" value="Light"/>
<parameter name="icon" value="LIGHT.png"/>
</section>
-
-<!-- values below this line are just an example, they are not used -->
- <section name="application">
+ <section name="PyConsole">
+ <!-- Python console preferences -->
+ <parameter name="font" value="Helvetic,12" />
+ <parameter name="additional_families" value="Helvetic;Helvetica;Helvetica[Adobe];Times;Times[Adobe];Sans Serif;Serif;Monospace;Lucida"/>
+ </section>
+ <section name="FileDlg">
+ <!-- "Open/Save File" dialog box preferences-->
<parameter name="QuickDirList" value=""/>
- <!-- Here go other common user preferences -->
</section>
<section name="Study">
- <parameter value="true" name="store_positions" />
+ <!-- General study settings -->
+ <parameter name="store_positions" value="true" />
</section>
<section name="OCCViewer" >
- <parameter value="35, 136, 145" name="background" />
- <parameter value="1" name="iso_number_u" />
- <parameter value="1" name="iso_number_v" />
- <parameter value="100" name="trihedron_size" />
+ <!-- OCC viewer preferences -->
+ <parameter name="background" value="35, 136, 145" />
+ <parameter name="iso_number_u" value="1" />
+ <parameter name="iso_number_v" value="1" />
+ <parameter name="trihedron_size" value="100" />
</section>
<section name="VTKViewer" >
- <parameter value="0, 0, 0" name="background" />
- <parameter value="100" name="trihedron_size" />
+ <!-- OCC viewer preferences -->
+ <parameter name="background" value="0, 0, 0"/>
+ <parameter name="trihedron_size" value="100" />
</section>
<section name="Plot2d" >
- <parameter value="255, 255, 255" name="Background" />
- <parameter value="1" name="CurveType" />
- <parameter value="0" name="HorScaleMode" />
- <parameter value="1" name="LegendPos" />
- <parameter value="9" name="MarkerSize" />
- <parameter value="true" name="ShowLegend" />
- <parameter value="0" name="VerScaleMode" />
+ <!-- Plot2d viewer preferences -->
+ <parameter name="Background" value="255, 255, 255" />
+ <parameter name="CurveType" value="1" />
+ <parameter name="HorScaleMode" value="0" />
+ <parameter name="LegendPos" value="1" />
+ <parameter name="MarkerSize" value="9" />
+ <parameter name="ShowLegend" value="true" />
+ <parameter name="VerScaleMode" value="0" />
</section>
<section name="SUPERVGraph" >
- <parameter value="144, 208, 211" name="Background" />
- <parameter value="63, 213, 255" name="Title" />
- </section>
- <!-- Here go optional sections for other modules -->
- <section name="resources">
- <parameter name="salome" value="${KERNEL_ROOT_DIR}/share/salome/res"/>
- <!-- Here go resource directories for other modules -->
+ <!-- Supervision viewer preferences -->
+ <parameter name="Background" value="144, 208, 211" />
+ <parameter name="Title" value="63, 213, 255" />
</section>
</document>
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: LightApp_images.po
// Created: May, 2005
// Author: OCC team
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
msgstr "Version %1"
msgid "ABOUT_COPYRIGHT"
-msgstr "Copyright (C) 2003-2005 OPEN CASCADE, EADS/CCR, LIP6,\nCEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS"
+msgstr "Copyright (C) 2003-2006 OPEN CASCADE, EADS/CCR, LIP6,\nCEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS"
msgid "ABOUT_LICENSE"
msgstr "GNU LGPL"
msgstr "Module activation cancelled"
msgid "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"
-msgstr "External browser \"%1\" can not show help page \"%2\""
+msgstr "External browser \"%1\" can not show help page \"%2\". Do you want to change it in preferences?"
msgid "LightApp_Application::DEFINE_EXTERNAL_BROWSER"
-msgstr "Define external browser in preferences"
+msgstr "External browser is not found. Do you want to define it in preferences?"
msgid "LightApp_Application::DATA_MODELS"
msgstr "Data models"
msgid "LightApp_Application::PREF_ASCII_FILE"
msgstr "ASCII save"
-msgid "LightApp_Application::PREF_UNDO_LEVEL"
-msgstr "Undo level"
-
msgid "LightApp_Application::PREF_STORE_POS"
msgstr "Store positions of windows"
msgstr "Warning"
msgid "LightApp_PreferencesDlg::DEFAULT_QUESTION"
-msgstr "Do you want to retrieve default preferences?"
+msgstr "Do you want to retrieve default preferences?"
+
+msgid "LightApp_PreferencesDlg::IMPORT_PREFERENCES"
+msgstr "Import preferences"
+
+msgid "LightApp_PreferencesDlg::IMPORT_BTN_TEXT"
+msgstr "Import"
//=======================================================================================
msgid "LightApp_ModuleDlg::ActivateComponent_DESCRIPTION"
msgstr "Create, open or load study."
+
+msgid "LightApp_NameDlg::TLT_RENAME"
+msgstr "Rename"
+
+msgid "LightApp_NameDlg::NAME_LBL"
+msgstr "Name: "
+
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include "LogWindow.h"
#define DEFAULT_SEPARATOR "***"
-//****************************************************************
+/*!
+ Converts rich text to plain text
+*/
static QString plainText( const QString& richText )
{
QString aText = richText;
return aText;
}
-//****************************************************************
-
+/*!
+ Default constructor
+*/
LogWindow::LogWindow( QWidget* parent )
: QFrame( parent ),
SUIT_PopupClient()
createActions();
}
+/*!
+ Destructor
+*/
LogWindow::~LogWindow()
{
}
+/*!
+ Custom event handler
+*/
bool LogWindow::eventFilter( QObject* o, QEvent* e )
{
if ( o == myView->viewport() && e->type() == QEvent::ContextMenu )
return QFrame::eventFilter( o, e );
}
+/*!
+ Sets banner (title of message log)
+ \param banner - new title
+*/
void LogWindow::setBanner( const QString& banner )
{
myBanner = banner;
clear( false );
}
+/*!
+ Set separator (line printing between messages)
+ \param separator - new separator
+*/
void LogWindow::setSeparator( const QString& separator )
{
mySeparator = separator;
clear( false );
}
+/*!
+ Puts message to log window
+ \param message - text of message
+ \addSeparator - if it is true, then separator is added to tail of message log
+*/
void LogWindow::putMessage( const QString& message, bool addSeparator )
{
myView->append( message );
myView->scrollToBottom();
}
+/*!
+ Clears message log
+ \param clearHistory - if it is true, then also history is cleared
+*/
void LogWindow::clear( bool clearHistory )
{
myView->clear();
myBannerSize = 0;
}
+/*!
+ Saves log to file
+ \param fileName - name of file
+*/
bool LogWindow::saveLog( const QString& fileName )
{
QFile file( fileName );
return true;
}
+/*!
+ Creates actions
+*/
void LogWindow::createActions()
{
QAction* a = new QAction( "", tr( "&Copy" ), 0, this );
myActions.insert( SaveToFileId, a );
}
+/*!
+ Redefined virtual method for popup filling
+*/
void LogWindow::contextMenuPopup( QPopupMenu* popup )
{
myActions[ CopyId ]->addTo( popup );
updateActions();
}
+/*!
+ Updates enable status of actions
+*/
void LogWindow::updateActions()
{
int paraFrom, paraTo, indexFrom, indexTo;
myActions[ SaveToFileId ]->setEnabled( myHistory.count() > 0 );
}
+/*!
+ SLOT: called if user click "Save" in popup
+*/
void LogWindow::onSaveToFile()
{
SUIT_Application* app = SUIT_Session::session()->activeApplication();
SUIT_MessageBox::error1( this, tr( "Error" ), tr( "Can't save file" ), tr( "OK" ) );
}
+/*!
+ SLOT: called if user click "Select all" in popup
+*/
void LogWindow::onSelectAll()
{
if ( myView )
myView->selectAll();
}
+/*!
+ SLOT: called if user click "Clear" in popup
+*/
void LogWindow::onClear()
{
clear( false );
}
+/*!
+ SLOT: called if user click "Copy" in popup
+*/
void LogWindow::onCopy()
{
if ( myView )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : LogWindow.h
// Author :
class QAction;
class QTextBrowser;
+/*!
+ \class LogWindow
+ Widget, showing logs message. Allows to show, to clear, to copy messages and to save then to file
+*/
class LOGWINDOW_EXPORT LogWindow : public QFrame, public SUIT_PopupClient
{
Q_OBJECT
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : LogWindow
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
@COMMENCE@
-SUBDIRS = Qtx DDS QDS SUIT STD CAF CAM SUITApp VTKViewer OCCViewer GLViewer \
- LogWindow Event OBJECT Prs PyInterp PythonConsole ObjBrowser \
- RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d SUPERVGraph \
- LightApp Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT Style ResExporter
+SUBDIRS = Qtx DDS QDS SUIT STD CAF CAM SUITApp LogWindow ObjBrowser Prs
+
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += OBJECT
+endif
+
+ifneq ($(DISABLE_GLVIEWER),yes)
+ SUBDIRS += GLViewer
+endif
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ SUBDIRS += VTKViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += SVTK
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ SUBDIRS += OCCViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += SOCC
+endif
+endif
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ SUBDIRS += PyInterp PythonConsole
+endif
+ifneq ($(DISABLE_PLOT2DVIEWER),yes)
+ SUBDIRS += Plot2d
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += SPlot2d
+endif
+endif
+ifneq ($(DISABLE_SUPERVGRAPHVIEWER),yes)
+ SUBDIRS += SUPERVGraph
+endif
+SUBDIRS += LightApp Style ResExporter
+
+ifneq ($(GUI_DISABLE_CORBA),yes)
+ SUBDIRS += RegistryDisplay TOOLSGUI \
+ Event Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT
+endif
+
+ifeq (@cppunit_ok@,yes)
+ifneq ($(GUI_DISABLE_CORBA),yes)
+ SUBDIRS+= \
+ SalomeApp/Test
+endif
+endif
@MODULE@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class Standard_Transient;
class Handle_Standard_Type;
+/*!
+ \class Handle(AIS_InteractiveObject)
+ Smart pointer (handle) to AIS_InteractiveObject
+*/
class Handle(AIS_InteractiveObject);
class SALOME_AISObject;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISObject);
+/*!
+ \class Handle(SALOME_AISObject)
+ Smart pointer (handle) to SALOME_AISObject
+*/
class Handle(SALOME_AISObject) : public Handle(AIS_InteractiveObject) {
public:
inline void* operator new(size_t,void* anAddress)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class Standard_Transient;
class Handle_Standard_Type;
+/*!
+ \class Handle(AIS_Shape)
+ Smart pointer (handle) to AIS_Shape
+*/
class Handle(AIS_Shape);
class SALOME_AISShape;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISShape);
+/*!
+ \class Handle(SALOME_AISShape)
+ Smart pointer (handle) to SALOME_AISShape
+*/
class Handle(SALOME_AISShape) : public Handle(AIS_Shape) {
public:
inline void* operator new(size_t,void* anAddress)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class Standard_Transient;
class Handle_Standard_Type;
+/*!
+ \class Handle(MMgt_TShared)
+ Smart pointer (handle) to MMgt_TShared
+*/
class Handle(MMgt_TShared);
class SALOME_Filter;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_Filter);
+/*!
+ \class Handle(SALOME_Filter)
+ Smart pointer (handle) to SALOME_Filter
+*/
class Handle(SALOME_Filter) : public Handle(MMgt_TShared) {
public:
inline void* operator new(size_t,void* anAddress)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class Standard_Transient;
class Handle_Standard_Type;
+/*!
+ \class Handle(MMgt_TShared)
+ Smart pointer (handle) to MMgt_TShared
+*/
class Handle(MMgt_TShared);
class SALOME_InteractiveObject;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_InteractiveObject);
+/*!
+ \class Handle(SALOME_InteractiveObject)
+ Smart pointer (handle) to SALOME_InteractiveObject
+*/
class Handle(SALOME_InteractiveObject) : public Handle(MMgt_TShared) {
public:
void* operator new(size_t,void* anAddress)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class Standard_Transient;
class Handle_Standard_Type;
+/*!
+ \class Handle(TCollection_MapNode)
+ Smart pointer (handle) to TCollection_MapNode
+*/
class Handle(TCollection_MapNode);
class SALOME_ListNodeOfListIO;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_ListNodeOfListIO);
+/*!
+ \class Handle(SALOME_ListNodeOfListIO)
+ Smart pointer (handle) to SALOME_ListNodeOfListIO
+*/
class Handle(SALOME_ListNodeOfListIO) : public Handle(TCollection_MapNode) {
public:
void* operator new(size_t,void* anAddress)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class Standard_Transient;
class Handle_Standard_Type;
+/*!
+ \class Handle(SALOME_Filter)
+ Smart pointer (handle) to SALOME_Filter
+*/
class Handle(SALOME_Filter);
class SALOME_TypeFilter;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_TypeFilter);
+/*!
+ \class Handle(SALOME_TypeFilter)
+ Smart pointer (handle) to SALOME_TypeFilter
+*/
class Handle(SALOME_TypeFilter) : public Handle(SALOME_Filter) {
public:
inline void* operator new(size_t,void* anAddress)
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# source path
top_srcdir=@top_srcdir@
top_builddir=../..
EXPORT_HEADERS = SALOME_InteractiveObject.hxx \
Handle_SALOME_InteractiveObject.hxx \
- SALOME_GLOwner.h \
SALOME_AISShape.hxx \
Handle_SALOME_AISShape.hxx \
SALOME_AISObject.hxx \
LIB = libSalomeObject.la
LIB_SRC = SALOME_InteractiveObject.cxx \
- SALOME_GLOwner.cxx \
SALOME_AISShape.cxx\
SALOME_AISObject.cxx\
SALOME_ListIO_0.cxx \
BIN =
BIN_SRC =
-CPPFLAGS+=$(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(QT_INCLUDES) $(OGL_INCLUDES)
-LDFLAGS+= $(PYTHON_LIBS) $(VTK_LIBS) $(QT_LIBS) $(OGL_LIBS) $(CAS_LDPATH) -lTKV3d -lVTKViewer -lsuit
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES)
+LDFLAGS+= $(QT_LIBS) $(CAS_LDPATH) -lTKV3d
@CONCLUDE@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
//using namespace std;
#include "SALOME_AISShape.ixx"
-SALOME_AISShape::SALOME_AISShape(const TopoDS_Shape& shape): AIS_Shape(shape) {
+/*!
+ Constructor
+ \param shape - TopoDS shape
+*/
+SALOME_AISShape::SALOME_AISShape(const TopoDS_Shape& shape)
+: AIS_Shape(shape)
+{
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
#endif
using namespace std;
+
+/*!
+ Destructor
+*/
SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
+/*!
+ \return OCC Handle Type
+*/
Standard_EXPORT Handle_Standard_Type& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
{
}
-// DownCast method
-// allow safe downcasting
-//
+/*!
+ DownCast method: allows safe downcasting
+*/
const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) _anOtherObject;
return _anOtherObject ;
}
+
+/*!
+ \return OCC Handle dynamic Type
+*/
const Handle(Standard_Type)& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::DynamicType() const
{
return STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) ;
}
+
+/*!
+ \return true if other type is the same
+ \param AType - type to be checked
+*/
Standard_Boolean SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) == AType || TCollection_MapNode::IsKind(AType));
}
+/*!
+ Destructor
+*/
Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
#define TheKey Handle_SALOME_InteractiveObject
#define TheKey_hxx "SALOME_InteractiveObject.hxx"
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
-// 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.salome-platform.org/
-//
-
-#include <SALOME_GLOwner.h>
-
-SALOME_GLOwner::SALOME_GLOwner( const char* entry )
-: GLViewer_Owner()
-{
- setEntry( entry );
-}
-
-SALOME_GLOwner::~SALOME_GLOwner()
-{
-}
-
-const char* SALOME_GLOwner::entry() const
-{
- return myEntry.c_str();
-}
-
-void SALOME_GLOwner::setEntry( const char* entry )
-{
- myEntry = entry;
-}
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
-// 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.salome-platform.org/
-//
-#ifndef SALOME_GLOWNER_H
-#define SALOME_GLOWNER_H
-
-#include <string>
-//#include <GLViewer.h>
-#include <GLViewer_Object.h>
-
-#ifdef WNT
-#define SALOME_OBJECT_EXPORT __declspec (dllexport)
-#else
-#define SALOME_OBJECT_EXPORT
-#endif
-
-class SALOME_OBJECT_EXPORT SALOME_GLOwner : public GLViewer_Owner
-{
-public:
- SALOME_GLOwner( const char* );
- ~SALOME_GLOwner();
-
- const char* entry() const;
- void setEntry( const char* );
-
-private:
- std::string myEntry;
-};
-
-#endif
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SALOME_InteractiveObject.ixx"
+/*!
+ Default constructor
+*/
SALOME_InteractiveObject::SALOME_InteractiveObject()
{
myEntry = "";
myReference = "";
}
+/*!
+ Constructor
+ \param anEntry - entry of object
+ \param aComponentDataType - component data type name
+ \param aName - name of object
+*/
SALOME_InteractiveObject::SALOME_InteractiveObject(const char* anEntry,
const char* aComponentDataType,
const char* aName):
myReference("")
{}
+/*!
+ Sets entry
+ \param anEntry - new entry of object
+*/
void SALOME_InteractiveObject::setEntry(const char* anEntry){
myEntry = anEntry;
}
+/*!
+ \return entry
+*/
const char* SALOME_InteractiveObject::getEntry(){
return myEntry.c_str();
}
+/*!
+ Sets component data type
+ \param aComponentDataType - component data type name
+*/
void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType){
myComponentDataType = aComponentDataType;
}
+/*!
+ \return component data type
+*/
const char* SALOME_InteractiveObject::getComponentDataType(){
return myComponentDataType.c_str();
}
+/*!
+ Sets name
+ \param aName - new name of object
+*/
void SALOME_InteractiveObject::setName(const char* aName){
myName = aName;
}
+/*!
+ \return name
+*/
const char* SALOME_InteractiveObject::getName(){
return myName.c_str();
}
+/*!
+ \return true if entry isn't empty
+*/
Standard_Boolean SALOME_InteractiveObject::hasEntry(){
return myEntry != "";
}
+/*!
+ \return true if objects have same entries
+ \param anIO - other object
+*/
Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
if ( anIO->hasEntry() && this->hasEntry() ) {
if ( myEntry == anIO->getEntry() )
return Standard_False;
}
+/*!
+ \return true if component data types are same
+ \param ComponentDataType - component data type to be checked
+*/
Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType){
if ( myComponentDataType == ComponentDataType )
return Standard_True;
return Standard_False;
}
+/*!
+ \return true if object has reference
+*/
Standard_Boolean SALOME_InteractiveObject::hasReference()
{
return myReference != "";
}
+/*!
+ \return reference
+*/
const char* SALOME_InteractiveObject::getReference()
{
return myReference.c_str();
}
+/*!
+ Sets reference
+ \param aReference - new reference
+*/
void SALOME_InteractiveObject::setReference(const char* aReference)
{
myReference = aReference;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <Standard_Macro.hxx>
#endif
+/*!
+ \class SALOME_ListIO
+ List of SALOME interactive objects
+*/
class SALOME_ListIO {
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class SALOME_ListIO;
class SALOME_ListIteratorOfListIO;
-
+/*!
+ \class SALOME_ListNodeOfListIO
+ Auxiliary class, represents list node for SALOME_ListIO
+*/
class SALOME_ListNodeOfListIO : public TCollection_MapNode {
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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SALOME_ListIteratorOfListIO.hxx"
#endif
using namespace std;
+
+/*!
+ Destructor
+*/
SALOME_ListNodeOfListIO::~SALOME_ListNodeOfListIO() {}
-
+/*!
+ \return OCC Handle Type
+*/
Standard_EXPORT Handle_Standard_Type& SALOME_ListNodeOfListIO_Type_()
{
}
-// DownCast method
-// allow safe downcasting
-//
+/*!
+ DownCast method, allows safe downcasting
+*/
const Handle(SALOME_ListNodeOfListIO) Handle(SALOME_ListNodeOfListIO)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(SALOME_ListNodeOfListIO) _anOtherObject;
return _anOtherObject ;
}
+
+/*!
+ \return OCC Handle dynamic Type
+*/
const Handle(Standard_Type)& SALOME_ListNodeOfListIO::DynamicType() const
{
return STANDARD_TYPE(SALOME_ListNodeOfListIO) ;
}
+
+/*!
+ \return true if other type is the same
+ \param AType - type to be checked
+*/
Standard_Boolean SALOME_ListNodeOfListIO::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(SALOME_ListNodeOfListIO) == AType || TCollection_MapNode::IsKind(AType));
}
+/*!
+ Destructor
+*/
Handle_SALOME_ListNodeOfListIO::~Handle_SALOME_ListNodeOfListIO() {}
#define Item Handle_SALOME_InteractiveObject
#define Item_hxx "SALOME_InteractiveObject.hxx"
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SALOME_InteractiveObject.hxx"
using namespace std;
+/*!
+ Constructor
+ \param TheKind - type of filter
+*/
SALOME_TypeFilter::SALOME_TypeFilter(const Standard_CString TheKind):
myKind(TheKind){}
+/*!
+ \return true if object passes filter
+ \param anObj - object to be checked
+*/
Standard_Boolean SALOME_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
{
return anObj->isComponentType( myKind );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : OCCViewer
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifdef WNT
#ifdef OCCVIEWER_EXPORTS
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OCCViewer_AISSelector.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#if !defined( OCCVIEWER_AISSELECTOR_H )
#define OCCVIEWER_AISSELECTOR_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "OCCViewer_ClippingDlg.h"
#include <QtxDblSpinBox.h>
+#include <QtxAction.h>
#include "SUIT_Session.h"
#include "SUIT_ViewWindow.h"
#include "OCCViewer_ViewWindow.h"
#include "OCCViewer_ViewPort3d.h"
-//#include "utilities.h"
-
#include <V3d_View.hxx>
-#include <V3d.hxx>
-#include <V3d_Plane.hxx>
+//#include <V3d.hxx>
#include <Geom_Plane.hxx>
#include <Prs3d_Presentation.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <qcombobox.h>
#include <qcheckbox.h>
-//=================================================================================
-// class : OCCViewer_ClippingDlg()
-// purpose :
-//=================================================================================
+/*!
+ Constructor
+ \param view - view window
+ \param parent - parent widget
+ \param name - dialog name
+ \param modal - is this dialog modal
+ \param fl - flags
+*/
OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, "OCCViewer_ClippingDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), myView( view )
+: QDialog( parent, "OCCViewer_ClippingDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ myView( view )
{
setCaption( tr( "Clipping" ) );
myBusy = false;
}
-//=================================================================================
-// function : ~ OCCViewer_ClippingDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
+/*!
+ Destructor
+ Destroys the object and frees any allocated resources
+*/
OCCViewer_ClippingDlg::~ OCCViewer_ClippingDlg()
{
// no need to delete child widgets, Qt does it all for us
}
-//=================================================================================
-// function : closeEvent
-// purpose :
-//=================================================================================
+/*!
+ Custom handling of close event: erases preview
+*/
void OCCViewer_ClippingDlg::closeEvent( QCloseEvent* e )
{
erasePreview();
+
+ // Set the clipping plane back
+ Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+ if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
+ aView3d->SetPlaneOn( myClippingPlane );
+
+ if (!myView->isCuttingPlane())
+ myAction->setOn( false );
+
QDialog::closeEvent( e );
}
-//=================================================================================
-// function : showEvent
-// purpose :
-//=================================================================================
+/*!
+ Custom handling of show event: displays preview
+*/
void OCCViewer_ClippingDlg::showEvent( QShowEvent* e )
{
+ ReserveClippingPlane();
+
QDialog::showEvent( e );
onPreview( PreviewChB->isChecked() );
}
-//=================================================================================
-// function : hideEvent
-// purpose :
-//=================================================================================
+/*!
+ Custom handling of hide event: erases preview
+*/
void OCCViewer_ClippingDlg::hideEvent( QHideEvent* e )
{
erasePreview();
}
-//=================================================================================
-// function : ClickOnClose()
-// purpose :
-//=================================================================================
+/*!
+ SLOT on close button click: erases preview and rejects dialog
+*/
void OCCViewer_ClippingDlg::ClickOnClose()
{
erasePreview();
+
+ // Set the clipping plane back
+ Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+ if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
+ aView3d->SetPlaneOn( myClippingPlane );
+
+ if (!myView->isCuttingPlane())
+ myAction->setOn( false );
+
reject();
}
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
+/*!
+ SLOT on apply button click: sets cutting plane
+*/
void OCCViewer_ClippingDlg::ClickOnApply()
{
qApp->processEvents();
SpinBox_Dx->value(), SpinBox_Dy->value(), SpinBox_Dz->value() );
QApplication::restoreOverrideCursor();
-
+
erasePreview();
+
+ ReserveClippingPlane();
}
-
-//=================================================================================
-// function : onReset()
-// purpose :
-//=================================================================================
+/*!
+ SLOT on reset button click: sets default values
+*/
void OCCViewer_ClippingDlg::onReset()
{
myBusy = true;
}
}
-
-//=================================================================================
-// function : onInvert()
-// purpose :
-//=================================================================================
+/*!
+ SLOT on invert button click: inverts normal of cutting plane
+*/
void OCCViewer_ClippingDlg::onInvert()
{
double Dx = SpinBox_Dx->value();
}
}
-
-//=================================================================================
-// function : onModeChanged()
-// purpose :
-//=================================================================================
+/*!
+ SLOT: called on mode changed
+*/
void OCCViewer_ClippingDlg::onModeChanged( int mode )
{
bool isUserMode = (mode==0);
}
-//================================================================
-// Function : displayPreview
-// Purpose :
-//================================================================
+/*!
+ Displays preview of clipping plane
+*/
void OCCViewer_ClippingDlg::displayPreview()
{
if ( myBusy || !isValid() )
myPreviewPlane = new AIS_Plane( new Geom_Plane( aBasePnt, aNormal ) );
myPreviewPlane->SetSize( aSize, aSize );
+ // Deactivate clipping planes
+ myView->getViewPort()->getView()->SetPlaneOff();
+
ic->Display( myPreviewPlane, 1, -1, false );
ic->SetWidth( myPreviewPlane, 10, false );
ic->SetMaterial( myPreviewPlane, Graphic3d_NOM_PLASTIC, false );
}
-//================================================================
-// Function : erasePreview
-// Purpose :
-//================================================================
+/*!
+ Erases preview of clipping plane
+*/
void OCCViewer_ClippingDlg::erasePreview ()
{
OCCViewer_Viewer* anOCCViewer = (OCCViewer_Viewer*)myView->getViewManager()->getViewModel();
}
-//================================================================
-// Function : onValueChanged
-// Purpose :
-//================================================================
+/*!
+ SLOT: called on value changes (co-ordinates of point or normal)
+*/
void OCCViewer_ClippingDlg::onValueChanged()
{
if ( PreviewChB->isChecked() )
}
-//================================================================
-// Function : onPreview
-// Purpose :
-//================================================================
+/*!
+ SLOT: called on preview check box toggled
+*/
void OCCViewer_ClippingDlg::onPreview( bool on )
{
erasePreview();
displayPreview();
}
-//================================================================
-// Function : onPreview
-// Purpose :
-//================================================================
+/*!
+ \return true if plane parameters are valid
+*/
bool OCCViewer_ClippingDlg::isValid()
{
return ( SpinBox_Dx->value()!=0 || SpinBox_Dy->value()!=0 || SpinBox_Dz->value()!=0 );
}
+
+/*!
+ Remember the current clipping plane
+*/
+void OCCViewer_ClippingDlg::ReserveClippingPlane()
+{
+ Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+ if ( !aView3d.IsNull() )
+ {
+ aView3d->InitActivePlanes();
+ if ( aView3d->MoreActivePlanes() )
+ myClippingPlane = aView3d->ActivePlane();
+ }
+}
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef OCCVIEWER_CLIPPINGDLG_H
#define OCCVIEWER_CLIPPINGDLG_H
#include <qdialog.h>
#include <AIS_Plane.hxx>
+#include <V3d_Plane.hxx>
class QGroupBox;
class QLabel;
class QComboBox;
class QCheckBox;
class QtxDblSpinBox;
+class QtxAction;
class OCCViewer_ViewWindow;
-//=================================================================================
-// class : OCCViewer_ClippingDlg
-// purpose :
-//=================================================================================
+/*!
+ \class OCCViewer_ClippingDlg
+ \brief Dialog allowing to assign parameters of clipping plane
+*/
class OCCViewer_ClippingDlg : public QDialog
{
Q_OBJECT
public:
OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~OCCViewer_ClippingDlg();
+
+ void SetAction( QtxAction* theAction ) { myAction = theAction; }
private :
virtual void hideEvent ( QHideEvent * );
void displayPreview();
void erasePreview();
+ void ReserveClippingPlane();
bool isValid();
OCCViewer_ViewWindow* myView;
Handle(AIS_Plane) myPreviewPlane;
+ Handle(V3d_Plane) myClippingPlane;
bool myBusy;
+
+ QtxAction* myAction;
private slots:
void ClickOnApply();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OCCViewer_CreateRestoreViewDlg.h"
#include "OCCViewer_ViewModel.h"
#include <qpainter.h>
#include <qimage.h>
+/*!
+ Constructor
+*/
OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, OCCViewer_Viewer* curModel )
: QDialog( aWin )
{
connect( theClearAll, SIGNAL( clicked() ), this, SLOT( clearList() ) );
}
+/*!
+ Destructor
+*/
OCCViewer_CreateRestoreViewDlg::~OCCViewer_CreateRestoreViewDlg()
{
}
+/*!
+ Changes image in accordance with item
+ \param curItem - item contains info about view parameters
+*/
void OCCViewer_CreateRestoreViewDlg::changeImage( QListBoxItem* curItem )
{
if( curItem && myListBox->isEditEnabled() )
}
}
+/*!
+ \return current view parameters (corresponding to current item)
+*/
viewAspect OCCViewer_CreateRestoreViewDlg::currentItem() const
{
return myCurrentItem;
}
+/*!
+ Deletes selected items from list view
+*/
void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems()
{
if( myListBox->count() && myListBox->isEditEnabled() )
}
}
+/*!
+ Clears list of view aspects
+*/
void OCCViewer_CreateRestoreViewDlg::clearList()
{
myListBox->clear();
myParametersMap.clear();
}
+/*!
+ \return const reference to all view aspects
+*/
const viewAspectList& OCCViewer_CreateRestoreViewDlg::parameters() const
{
return myParametersMap;
}
+/*!
+ Renames key of view aspect map in accordance with item name
+ \param anItem - item
+*/
void OCCViewer_CreateRestoreViewDlg::editItemText( QListBoxItem* anItem )
{
int index = anItem->listBox()->index( anItem );
myParametersMap[ index ].name = anItem->text().latin1();
}
+/*!
+ Custom event filter
+*/
bool OCCViewer_CreateRestoreViewDlg::eventFilter( QObject* anObj, QEvent* anEv )
{
if( anEv->type() == QEvent::KeyPress )
return QWidget::eventFilter( anObj, anEv );
}
+/*!
+ SLOT: called on OK click, emits dlgOk() and closes dialog
+*/
void OCCViewer_CreateRestoreViewDlg::OKpressed()
{
emit dlgOk();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OCCVIEWER_CREATERESTOREVIEWDLG_H
#define OCCVIEWER_CREATERESTOREVIEWDLG_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/***********************************************************************
-
- FONCTION :
- ----------
- Classe OCCViewer_VService :
-
- HISTORIQUE DES MODIFICATIONS :
- --------------------------------
- 00-09-92 : GG ; Creation.
- 25-02-98 : FMN ; PERF.27: Optimisation de la création d'une vue à partir d'une vue existante
-
- REMARQUES :
- -----------
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
- * Includes
- */
-//just to load the OpenGl shared library
-//#include <OpenGl_GraphicDriver.hxx>
#include "OCCViewer_VService.h"
#include <V3d_Viewer.hxx>
#include <Xw_Window.hxx>
#include <Graphic3d_GraphicDevice.hxx>
#include <Xw_Driver.hxx>
-#include <Xdps_Driver.hxx>
+//#include <Xdps_Driver.hxx>
#include <Xw_TypeOfMapping.hxx>
#endif
Creates Xdps window driver [ static ]
On Win32 the same as OCCViewer_VService::WindowDriver()
*/
+/*
Handle(Aspect_WindowDriver) OCCViewer_VService::XdpsDriver( const Standard_CString aDisplay,
const Standard_Integer ahiwin,
const Standard_Integer alowin,
return new Xdps_Driver( W );
#endif
}
-
+*/
/*!
Creates Xw window driver [ static ]
On Win32 the same as OCCViewer_VService::WindowDriver()
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OCCVIEWER_VSERVICE_H
#define OCCVIEWER_VSERVICE_H
const Standard_Integer hiwin,
const Standard_Integer lowin,
const Quantity_NameOfColor color = Quantity_NOC_GRAY69 );
- static Handle_Aspect_WindowDriver
+ /*static Handle_Aspect_WindowDriver
XdpsDriver( const Standard_CString display,
const Standard_Integer hiwin,
const Standard_Integer lowin,
const Quantity_NameOfColor color = Quantity_NOC_GRAY69 );
+ */
static Handle_Aspect_WindowDriver
ImageDriver( const Standard_CString display,
const Standard_Integer hiwin,
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OCCViewer_ViewManager.h"
#include "OCCViewer_ViewWindow.h"
int OCCViewer_ViewManager::myMaxId = 0;
-//***************************************************************/
+/*!
+ Constructor
+*/
OCCViewer_ViewManager::OCCViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop, bool DisplayTrihedron )
: SUIT_ViewManager( study, theDesktop )
{
setViewModel( new OCCViewer_Viewer( DisplayTrihedron ) );
}
-//***************************************************************/
+/*!
+ Destructor
+*/
OCCViewer_ViewManager::~OCCViewer_ViewManager()
{
}
-//***************************************************************/
+/*!
+ Sets view name
+ \param theView - view to assign name
+*/
void OCCViewer_ViewManager::setViewName(SUIT_ViewWindow* theView)
{
int aPos = myViews.find(theView);
theView->setCaption( tr( "OCC_VIEW_TITLE" ).arg( myId ).arg( aPos + 1 ) );
}
-//***************************************************************/
+/*!
+ Fills popup menu with custom actions
+ \param popup - popup menu to be filled with
+*/
void OCCViewer_ViewManager::contextMenuPopup( QPopupMenu* popup )
{
SUIT_ViewManager::contextMenuPopup( popup );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OCCVIEWER_VIEWMANAGER_H
#define OCCVIEWER_VIEWMANAGER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OCCViewer_ViewModel.h"
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_LineAspect.hxx>
+/*!
+ Constructor
+ \param DisplayTrihedron - is trihedron displayed
+*/
OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron )
: SUIT_ViewModel(),
myBgColor( Qt::black )
myMultiSelectionEnabled = true;
}
-
+/*!
+ Destructor
+*/
OCCViewer_Viewer::~OCCViewer_Viewer()
{
}
+/*!
+ \return background color of viewer
+*/
QColor OCCViewer_Viewer::backgroundColor() const
{
return myBgColor;
}
+/*!
+ Sets background color
+ \param c - new background color
+*/
void OCCViewer_Viewer::setBackgroundColor( const QColor& c )
{
if ( c.isValid() )
myBgColor = c;
}
+/*!
+ Start initialization of view window
+ \param view - view window to be initialized
+*/
void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
{
if ( view ) {
}
}
-
+/*!
+ Creates new view window
+ \param theDesktop - main window of application
+*/
SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
{
OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this);
return view;
}
-//*********************************************************************
+/*!
+ Sets new view manager
+ \param theViewManager - new view manager
+*/
void OCCViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
SUIT_ViewModel::setViewManager(theViewManager);
}
}
-
-//*********************************************************************
+/*!
+ SLOT: called on mouse button press, stores current mouse position as start point for transformations
+*/
void OCCViewer_Viewer::onMousePress(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
{
myStartPnt.setX(theEvent->x()); myStartPnt.setY(theEvent->y());
}
-
-//*********************************************************************
+/*!
+ SLOT: called on mouse move, processes transformation or hilighting
+*/
void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
{
if (!mySelectionEnabled) return;
}
-//*********************************************************************
+/*!
+ SLOT: called on mouse button release, finishes transformation or selection
+*/
void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
{
if (!mySelectionEnabled) return;
}
-//*********************************************************************
+/*!
+ Sets selection enabled status
+ \param isEnabled - new status
+*/
void OCCViewer_Viewer::enableSelection(bool isEnabled)
{
mySelectionEnabled = isEnabled;
}
}
-//*********************************************************************
+/*!
+ Sets multiselection enabled status
+ \param isEnabled - new status
+*/
void OCCViewer_Viewer::enableMultiselection(bool isEnable)
{
myMultiSelectionEnabled = isEnable;
}
}
-//*********************************************************************
+/*!
+ Builds popup for occ viewer
+*/
void OCCViewer_Viewer::contextMenuPopup(QPopupMenu* thePopup)
{
thePopup->insertItem( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
}
+/*!
+ SLOT: called on dump view operation is activated, stores scene to raster file
+*/
void OCCViewer_Viewer::onDumpView()
{
OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
aView->onDumpView();
}
-//*********************************************************************
+/*!
+ SLOT: called if background color is to be changed changed, passes new color to view port
+*/
void OCCViewer_Viewer::onChangeBgColor()
{
OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
aViewPort3d->setBackgroundColor(selColor);
}
-//*********************************************************************
+/*!
+ SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window
+*/
void OCCViewer_Viewer::onShowToolbar() {
OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
if ( aView )
aView->getToolBar()->show();
}
-//*********************************************************************
+/*!
+ Updates OCC 3D viewer
+*/
void OCCViewer_Viewer::update()
{
if (!myV3dViewer.IsNull())
myV3dViewer->Update();
}
-//*********************************************************************
+/*!
+ \return objects selected in 3D viewer
+ \param theList - list to be filled with selected objects
+*/
void OCCViewer_Viewer::getSelectedObjects(AIS_ListOfInteractive& theList)
{
theList.Clear();
theList.Append(myAISContext->SelectedInteractive());
}
-//*********************************************************************
+/*!
+ Selects objects in 3D viewer. Other selected objects are left as selected
+ \param theList - list objects to be selected
+*/
void OCCViewer_Viewer::setObjectsSelected(const AIS_ListOfInteractive& theList)
{
AIS_ListIteratorOfListOfInteractive aIt;
myAISContext->UpdateCurrentViewer();
}
-//*********************************************************************
+/*!
+ Auxiliary method to emit signal selectionChanged()
+*/
void OCCViewer_Viewer::performSelectionChanged()
{
emit selectionChanged();
}
-//****************************************************************
-
+/*!
+ SLOT, clears view aspects
+*/
void OCCViewer_Viewer::onClearViewAspects()
{
clearViewAspects();
}
-//****************************************************************
-
+/*!
+ Clears view aspects
+*/
void OCCViewer_Viewer::clearViewAspects()
{
myViewAspects.clear();
}
-//****************************************************************
-
+/*!
+ \return const reference to list of view aspects
+*/
const viewAspectList& OCCViewer_Viewer::getViewAspects()
{
return myViewAspects;
}
-//****************************************************************
-
+/*!
+ Appends new view aspect
+ \param aParams - new view aspects
+*/
void OCCViewer_Viewer::appendViewAspect( const viewAspect& aParams )
{
myViewAspects.append( aParams );
}
-//****************************************************************
-
+/*!
+ Replaces old view aspects by new ones
+ \param aViewList - list of new view aspects
+*/
void OCCViewer_Viewer::updateViewAspects( const viewAspectList& aViewList )
{
myViewAspects = aViewList;
}
+/*!
+ Hilights/unhilights object in viewer
+ \param obj - object to be updated
+ \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param update - update current viewer
+*/
bool OCCViewer_Viewer::highlight( const Handle(AIS_InteractiveObject)& obj,
bool hilight, bool update )
{
return false;
}
+/*!
+ Unhilights all objects in viewer
+ \param updateviewer - update current viewer
+*/
bool OCCViewer_Viewer::unHighlightAll( bool updateviewer )
{
if ( myAISContext->HasOpenedContext() )
return false;
}
+/*!
+ \return true if object is in viewer or in collector
+ \param obj - object to be checked
+ \param onlyInViewer - search object only in viewer (so object must be displayed)
+*/
bool OCCViewer_Viewer::isInViewer( const Handle(AIS_InteractiveObject)& obj,
bool onlyInViewer )
{
return false;
}
+/*!
+ \return true if object is displayed in viewer
+ \param obj - object to be checked
+*/
bool OCCViewer_Viewer::isVisible( const Handle(AIS_InteractiveObject)& obj )
{
return myAISContext->IsDisplayed( obj );
}
+/*!
+ Sets color of object
+ \param obj - object to be updated
+ \param color - new color
+ \param update - update current viewer
+*/
void OCCViewer_Viewer::setColor( const Handle(AIS_InteractiveObject)& obj,
const QColor& color,
bool update )
myV3dViewer->Update();
}
+/*!
+ Changes display mode of object
+ \param obj - object to be processed
+ \param mode - new display mode
+ \param update - update current viewer
+*/
void OCCViewer_Viewer::switchRepresentation( const Handle(AIS_InteractiveObject)& obj,
int mode, bool update )
{
myV3dViewer->Update();
}
+/*!
+ Changes transparency of object
+ \param obj - object to be processed
+ \param trans - new transparency
+ \param update - update current viewer
+*/
void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj,
float trans, bool update )
{
myV3dViewer->Update();
}
-//****************************************************************
+/*!
+ Changes visibility of trihedron to opposite
+*/
void OCCViewer_Viewer::toggleTrihedron()
{
setTrihedronShown( !isTrihedronVisible() );
}
+/*!
+ \return true if trihedron is visible
+*/
bool OCCViewer_Viewer::isTrihedronVisible() const
{
return !myTrihedron.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed( myTrihedron );
}
+/*!
+ Sets visibility state of trihedron
+ \param on - new state
+*/
+
void OCCViewer_Viewer::setTrihedronShown( const bool on )
{
if ( myTrihedron.IsNull() )
myAISContext->Erase( myTrihedron );
}
+/*!
+ \return trihedron size
+*/
int OCCViewer_Viewer::trihedronSize() const
{
int sz = 0;
return sz;
}
+/*!
+ Changes trihedron size
+ \param sz - new size
+*/
void OCCViewer_Viewer::setTrihedronSize( const int sz )
{
if ( !myTrihedron.IsNull() )
myTrihedron->SetSize( sz );
}
+/*!
+ Set number of isolines
+ \param u - u-isolines (first parametric co-ordinate)
+ \param v - v-isolines (second parametric co-ordinate)
+*/
void OCCViewer_Viewer::setIsos( const int u, const int v )
{
Handle(AIS_InteractiveContext) ic = getAISContext();
ic->SetIsoNumber( v, AIS_TOI_IsoV );
}
+/*!
+ \return number of isolines
+ \param u - to return u-isolines (first parametric co-ordinate)
+ \param v - to return v-isolines (second parametric co-ordinate)
+*/
void OCCViewer_Viewer::isos( int& u, int& v ) const
{
Handle(AIS_InteractiveContext) ic = getAISContext();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OCCVIEWER_VIEWMODEL_H
#define OCCVIEWER_VIEWMODEL_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/***************************************************************************
-** Class: OCCViewer_ViewPort
-** Descr: Visualisation canvas of SUIT-based application
-** Module: SUIT
-** Created: UI team, 05.09.00
-****************************************************************************/
+
#if !defined WNT
#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */
#endif
XStandardColormap scmap;
};
+/*!
+ Constructor
+*/
CMapEntry::CMapEntry()
{
cmap = 0;
scmap.colormap = 0;
}
+/*!
+ Destructor
+*/
CMapEntry::~CMapEntry()
{
if ( alloc )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OCCVIEWER_VIEWPORT_H
#define OCCVIEWER_VIEWPORT_H
class OCCViewer_ViewSketcher;
class OCCViewer_ViewTransformer;
+/*!
+ \class OCCViewer_ViewPort
+ Visualisation canvas of SUIT-based application
+*/
class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/***************************************************************************
-** Class: OCCViewer_ViewPort3D
-** Descr: Visualisation canvas with CasCade 3D view
-** Module: OCCViewer
-** Created: UI team, 05.09.00
-****************************************************************************/
#include "OCCViewer_ViewPort3d.h"
}
}
+/*!
+ Set animation mode
+ \param theDegenerated - degenerated mode
+*/
void OCCViewer_ViewPort3d::setAnimationMode(bool theDegenerated)
{
if ( !activeView().IsNull() )
if ( !myDegenerated )
activeView()->SetDegenerateModeOff();
activeView()->ZFitAll(1.);
+ activeView()->SetZSize(0.);
+ activeView()->Update();
}
}
Standard_Real margin = 0.01;
activeView()->FitAll( margin, withZ, upd );
+ activeView()->SetZSize(0.);
}
/*!
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OCCVIEWER_VIEWPORT3D_H
#define OCCVIEWER_VIEWPORT3D_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// OCCViewer_ViewWindow.cxx: implementation of the OCCViewer_ViewWindow class.
-//
-//////////////////////////////////////////////////////////////////////
+
#include "OCCViewer_ViewWindow.h"
#include "OCCViewer_ViewModel.h"
"................................"};
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
+/*!
+ Constructor
+ \param theDesktop - main window of application
+ \param theModel - OCC 3D viewer
+*/
OCCViewer_ViewWindow::OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel)
: SUIT_ViewWindow(theDesktop)
{
myClippingDlg = 0;
}
-//****************************************************************
+/*!
+ Initialization of view window
+*/
void OCCViewer_ViewWindow::initLayout()
{
myViewPort = new OCCViewer_ViewPort3d( this, myModel->getViewer3d(), V3d_ORTHOGRAPHIC );
createToolBar();
}
-//****************************************************************
+/*!
+ \return type of operation by states of mouse and keyboard buttons
+ \param theEvent - mouse event
+*/
OCCViewer_ViewWindow::OperationType OCCViewer_ViewWindow::getButtonState(QMouseEvent* theEvent)
{
OperationType aOp = NOTHING;
return aOp;
}
-//****************************************************************
+/*!
+ Custom event handler
+*/
bool OCCViewer_ViewWindow::eventFilter(QObject* watched, QEvent* e)
{
if ( watched == myViewPort ) {
return SUIT_ViewWindow::eventFilter(watched, e);
}
+/*!
+ Updates state of enable draw mode state
+*/
void OCCViewer_ViewWindow::updateEnabledDrawMode()
{
if ( myModel )
myEnableDrawMode = myModel->isSelectionEnabled() && myModel->isMultiSelectionEnabled();
}
-//****************************************************************
+/*!
+ Handler of mouse press event
+*/
void OCCViewer_ViewWindow::vpMousePressEvent(QMouseEvent* theEvent)
{
myStartX = theEvent->x();
}
-//****************************************************************
+/*!
+ Starts zoom operation, sets corresponding cursor
+*/
void OCCViewer_ViewWindow::activateZoom()
{
if ( !transformRequested() && !myCursorIsHand )
}
-//****************************************************************
/*!
- Activates 'panning' transformation
+ Starts panning operation, sets corresponding cursor
*/
void OCCViewer_ViewWindow::activatePanning()
{
}
}
-//****************************************************************
/*!
- Activates 'rotation' transformation
+ Starts rotation operation, sets corresponding cursor
*/
void OCCViewer_ViewWindow::activateRotation()
{
}
}
-//****************************************************************
+/*!
+ Starts global panning operation, sets corresponding cursor
+*/
void OCCViewer_ViewWindow::activateGlobalPanning()
{
Handle(V3d_View) aView3d = myViewPort->getView();
}
}
-//****************************************************************
/*!
- Activates 'fit' transformation
+ Starts fit operation, sets corresponding cursor
*/
void OCCViewer_ViewWindow::activateWindowFit()
{
}
}
-//****************************************************************
/*!
- Sets the active operation 'op'
+ Stores which viewer operation is requesting
*/
void OCCViewer_ViewWindow::setTransformRequested ( OperationType op )
{
}
-//****************************************************************/
+/*!
+ Handler of mouse move event
+*/
void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent)
{
myCurrX = theEvent->x();
}
}
-//****************************************************************/
+/*!
+ Handler of mouse release event
+*/
void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
{
switch ( myOperation ) {
}
}
-//****************************************************************
/*!
- Sets the viewport to its initial state
- ( no transformations in process etc. )
+ Sets the viewport to its initial state
+ ( no transformations in process etc. )
*/
void OCCViewer_ViewWindow::resetState()
{
}
-//****************************************************************/
+/*!
+ Draws rectangle by starting and current points
+*/
void OCCViewer_ViewWindow::drawRect()
{
QPainter aPainter(myViewPort);
myRect = aRect;
}
-//****************************************************************/
+/*!
+ Creates actions of OCC view window
+*/
void OCCViewer_ViewWindow::createActions()
{
if (!myActionsMap.isEmpty()) return;
connect(aAction, SIGNAL(activated()), this, SLOT(onCloneView()));
myActionsMap[ CloneId ] = aAction;
- aAction = new QtxAction(tr("MNU_CLIPPING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ) ),
+ myClippingAction = new QtxAction(tr("MNU_CLIPPING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ) ),
tr( "MNU_CLIPPING" ), 0, this);
- aAction->setStatusTip(tr("DSC_CLIPPING"));
- aAction->setToggleAction( true );
- connect(aAction, SIGNAL(toggled( bool )), this, SLOT(onClipping( bool )));
- myActionsMap[ ClippingId ] = aAction;
+ myClippingAction->setStatusTip(tr("DSC_CLIPPING"));
+ myClippingAction->setToggleAction( true );
+ connect(myClippingAction, SIGNAL(toggled( bool )), this, SLOT(onClipping( bool )));
+ myActionsMap[ ClippingId ] = myClippingAction;
aAction = new QtxAction(tr("MNU_SHOOT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SHOOT_VIEW" ) ),
tr( "MNU_SHOOT_VIEW" ), 0, this);
}
}
-//****************************************************************
+/*!
+ Creates toolbar of OCC view window
+*/
void OCCViewer_ViewWindow::createToolBar()
{
myActionsMap[DumpId]->addTo(myToolBar);
myActionsMap[ClippingId]->addTo(myToolBar);
}
-//****************************************************************
+/*!
+ Processes operation fit all
+*/
void OCCViewer_ViewWindow::onViewFitAll()
{
myViewPort->fitAll();
}
-//****************************************************************
+/*!
+ Processes transformation "front view"
+*/
void OCCViewer_ViewWindow::onFrontView()
{
emit vpTransformationStarted ( FRONTVIEW );
onViewFitAll();
}
-//****************************************************************
+/*!
+ Processes transformation "back view"
+*/
void OCCViewer_ViewWindow::onBackView()
{
emit vpTransformationStarted ( BACKVIEW );
onViewFitAll();
}
-//****************************************************************
+/*!
+ Processes transformation "top view"
+*/
void OCCViewer_ViewWindow::onTopView()
{
emit vpTransformationStarted ( TOPVIEW );
onViewFitAll();
}
-//****************************************************************
+/*!
+ Processes transformation "bottom view"
+*/
void OCCViewer_ViewWindow::onBottomView()
{
emit vpTransformationStarted ( BOTTOMVIEW );
onViewFitAll();
}
-//****************************************************************
+/*!
+ Processes transformation "left view"
+*/
void OCCViewer_ViewWindow::onLeftView()
{
emit vpTransformationStarted ( LEFTVIEW );
onViewFitAll();
}
-//****************************************************************
+/*!
+ Processes transformation "right view"
+*/
void OCCViewer_ViewWindow::onRightView()
{
emit vpTransformationStarted ( RIGHTVIEW );
onViewFitAll();
}
-//****************************************************************
+/*!
+ Processes transformation "reset view": sets default orientation of viewport camera
+*/
void OCCViewer_ViewWindow::onResetView()
{
emit vpTransformationStarted( RESETVIEW );
myViewPort->getView()->Update();
}
-//****************************************************************
+/*!
+ Processes transformation "fit all"
+*/
void OCCViewer_ViewWindow::onFitAll()
{
emit vpTransformationStarted( FITALLVIEW );
myViewPort->fitAll();
}
-//****************************************************************
+/*!
+ Creates one more window with same content
+*/
void OCCViewer_ViewWindow::onCloneView()
{
SUIT_ViewWindow* vw = myManager->createViewWindow();
vw->show();
}
-//****************************************************************
+/*!
+ SLOT: called if clipping operation is activated, enables/disables of clipping plane
+*/
void OCCViewer_ViewWindow::onClipping( bool on )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
if ( on )
{
if ( !myClippingDlg )
- myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop );
+ {
+ myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop );
+ myClippingDlg->SetAction( myClippingAction );
+ }
if ( !myClippingDlg->isShown() )
myClippingDlg->show();
}
}
-//****************************************************************
+/*!
+ Stores view parameters
+*/
void OCCViewer_ViewWindow::onMemorizeView()
{
- double centerX, centerY, projX, projY, projZ, twist;
- double atX, atY, atZ, eyeX, eyeY, eyeZ;
-
- Handle(V3d_View) aView3d = myViewPort->getView();
-
- aView3d->Center( centerX, centerY );
- aView3d->Proj( projX, projY, projZ );
- aView3d->At( atX, atY, atZ );
- aView3d->Eye( eyeX, eyeY, eyeZ );
- twist = aView3d->Twist();
-
- viewAspect params;
- QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
-
- params.scale = aView3d->Scale();
- params.centerX = centerX;
- params.centerY = centerY;
- params.projX = projX;
- params.projY = projY;
- params.projZ = projZ;
- params.twist = twist;
- params.atX = atX;
- params.atY = atY;
- params.atZ = atZ;
- params.eyeX = eyeX;
- params.eyeY = eyeY;
- params.eyeZ = eyeZ;
- params.name = aName;
-
- myModel->appendViewAspect( params );
-
+ myModel->appendViewAspect( getViewParams() );
}
-//****************************************************************
+/*!
+ Restores view parameters
+*/
void OCCViewer_ViewWindow::onRestoreView()
{
OCCViewer_CreateRestoreViewDlg* aDlg = new OCCViewer_CreateRestoreViewDlg( centralWidget(), myModel );
performRestoring( aDlg->currentItem() );
}
-//****************************************************************
-
+/*!
+ Restores view parameters from structure viewAspect
+*/
void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem )
{
Handle(V3d_View) aView3d = myViewPort->getView();
Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False );
aView3d->SetScale( anItem.scale );
aView3d->SetCenter( anItem.centerX, anItem.centerY );
- aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
aView3d->SetTwist( anItem.twist );
aView3d->SetAt( anItem.atX, anItem.atY, anItem.atZ );
aView3d->SetImmediateUpdate( prev );
aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ );
+ aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
myRestoreFlag = 0;
}
+/*!
+ Sets restore flag
+*/
void OCCViewer_ViewWindow::setRestoreFlag()
{
myRestoreFlag = 1;
}
-//****************************************************************
+/*!
+ SLOT: called when action "show/hide" trihedron is activated
+*/
void OCCViewer_ViewWindow::onTrihedronShow()
{
myModel->toggleTrihedron();
}
-//****************************************************************
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage OCCViewer_ViewWindow::dumpView()
{
QPixmap px = QPixmap::grabWindow( myViewPort->winId() );
return px.convertToImage();
}
-
+
+/*!
+ Sets parameters of cutting plane
+ \param on - is cutting plane enabled
+ \param x - x-position of plane point
+ \param y - y-position of plane point
+ \param z - z-position of plane point
+ \param dx - x-coordinate of plane normal
+ \param dy - y-coordinate of plane normal
+ \param dz - z-coordinate of plane normal
+*/
void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const double y, const double z,
const double dx, const double dy, const double dz )
{
+ Handle(V3d_View) view = myViewPort->getView();
+ if ( view.IsNull() )
+ return;
+
if ( on ) {
Handle(V3d_Viewer) viewer = myViewPort->getViewer();
- Handle(V3d_View) view = myViewPort->getView();
// try to use already existing plane or create a new one
Handle(V3d_Plane) clipPlane;
pln.Coefficients( a, b, c, d );
clipPlane->SetPlane( a, b, c, d );
- Handle(V3d_View) v = myViewPort->getView();
- v->SetPlaneOn( clipPlane );
- v->Update();
- v->Redraw();
+ view->SetPlaneOn( clipPlane );
}
- else {
- Handle(V3d_View) view = myViewPort->getView();
+ else
+ view->SetPlaneOff();
+
+ view->Update();
+ view->Redraw();
+}
- // try to use already existing plane
- Handle(V3d_Plane) clipPlane;
- view->InitActivePlanes();
- if ( view->MoreActivePlanes() )
- clipPlane = view->ActivePlane();
-
- Handle(V3d_View) v = myViewPort->getView();
- if ( !clipPlane.IsNull() )
- v->SetPlaneOff( clipPlane );
- else
- v->SetPlaneOff();
-
- v->Update();
- v->Redraw();
+/*!
+ \return true if there is at least one cutting plane
+*/
+bool OCCViewer_ViewWindow::isCuttingPlane()
+{
+ Handle(V3d_View) view = myViewPort->getView();
+ view->InitActivePlanes();
+ return (view->MoreActivePlanes());
+}
+
+/*!
+ The method returns the visual parameters of this view as a viewAspect object
+*/
+viewAspect OCCViewer_ViewWindow::getViewParams() const
+{
+ double centerX, centerY, projX, projY, projZ, twist;
+ double atX, atY, atZ, eyeX, eyeY, eyeZ;
+
+ Handle(V3d_View) aView3d = myViewPort->getView();
+
+ aView3d->Center( centerX, centerY );
+ aView3d->Proj( projX, projY, projZ );
+ aView3d->At( atX, atY, atZ );
+ aView3d->Eye( eyeX, eyeY, eyeZ );
+ twist = aView3d->Twist();
+
+ QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
+
+ viewAspect params;
+ params.scale = aView3d->Scale();
+ params.centerX = centerX;
+ params.centerY = centerY;
+ params.projX = projX;
+ params.projY = projY;
+ params.projZ = projZ;
+ params.twist = twist;
+ params.atX = atX;
+ params.atY = atY;
+ params.atZ = atZ;
+ params.eyeX = eyeX;
+ params.eyeY = eyeY;
+ params.eyeZ = eyeZ;
+ params.name = aName;
+
+ return params;
+}
+
+
+/*!
+ The method returns the visual parameters of this view as a formated string
+*/
+QString OCCViewer_ViewWindow::getVisualParameters()
+{
+ viewAspect params = getViewParams();
+ QString retStr;
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale,
+ params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist,
+ params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ );
+ return retStr;
+}
+
+/*!
+ The method restors visual parameters of this view from a formated string
+*/
+void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 13 ) {
+ viewAspect params;
+ params.scale = paramsLst[0].toDouble();
+ params.centerX = paramsLst[1].toDouble();
+ params.centerY = paramsLst[2].toDouble();
+ params.projX = paramsLst[3].toDouble();
+ params.projY = paramsLst[4].toDouble();
+ params.projZ = paramsLst[5].toDouble();
+ params.twist = paramsLst[6].toDouble();
+ params.atX = paramsLst[7].toDouble();
+ params.atY = paramsLst[8].toDouble();
+ params.atZ = paramsLst[9].toDouble();
+ params.eyeX = paramsLst[10].toDouble();
+ params.eyeY = paramsLst[11].toDouble();
+ params.eyeZ = paramsLst[12].toDouble();
+
+ performRestoring( params );
}
-
- Handle(V3d_View) v = myViewPort->getView();
- v->Update();
- v->Redraw();
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OCCVIEWER_VIEWWINDOW_H
#define OCCVIEWER_VIEWWINDOW_H
void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
const double dx = 0, const double dy = 0, const double dz = 1);
+
+ bool isCuttingPlane();
+
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
public slots:
void onFrontView();
virtual OperationType getButtonState(QMouseEvent* theEvent);
+ viewAspect getViewParams() const;
+
OperationType myOperation;
OCCViewer_Viewer* myModel;
OCCViewer_ViewPort3d* myViewPort;
private:
OCCViewer_ClippingDlg* myClippingDlg;
+ QtxAction* myClippingAction;
};
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
msgstr "Dump view"
msgid "DSC_CLIPPING"
-msgstr "Define clipping plane"
+msgstr "Set clipping plane"
msgid "MNU_CLIPPING"
msgstr "Clipping"
msgid "ERROR"
msgstr "Error"
-msgid "BUT_OK"
-msgstr "Ok"
-
-
msgid "OCCViewer_Viewer::MEN_DUMP_VIEW"
msgstr "Dump view..."
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : ObjectBrowser
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OB_H
#define OB_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OB_Browser.h"
#include <time.h>
/*!
- Class: OB_Browser::ToolTip
- Descr: Tool tip for OB_Browser.
+ \class OB_Browser::ToolTip
+ Tool tip for OB_Browser.
*/
class OB_Browser::ToolTip : public QToolTip
OB_Browser* myBrowser;
};
+/*!
+ Constructor
+*/
OB_Browser::ToolTip::ToolTip( OB_Browser* b, QWidget* p )
: QToolTip( p ),
myBrowser( b )
{
}
+/*!
+ Destructor
+*/
OB_Browser::ToolTip::~ToolTip()
{
}
+/*!
+ It is called when there is a possibility that a tool tip
+ should be shown and must decide whether there is a tool tip for the point
+ in the widget that this QToolTip object relates to.
+ \param pos - point co-ordinates
+*/
void OB_Browser::ToolTip::maybeTip( const QPoint& pos )
{
if ( !parentWidget() || !myBrowser || !myBrowser->isShowToolTips() )
typedef SUIT_DataObject* ObjPtr;
typedef OB_ListItem* ItemPtr;
+
/*!
- Class: OB_BrowserSync
- Descr: Auxiliary class for synchronizing tree of SUIT_DataObjects and list view items
+ \class OB_BrowserSync
+ Auxiliary class for synchronizing tree of SUIT_DataObjects and list view items
*/
-
class OB_BrowserSync
{
public:
};
+/*!
+ Constructor
+*/
OB_BrowserSync::OB_BrowserSync( OB_Browser* ob )
: myBrowser( ob )
{
}
+/*!
+ \return true if item must be updated
+ \param item - item to be checked
+*/
bool OB_BrowserSync::needUpdate( const ItemPtr& item ) const
{
bool update = false;
SUIT_DataObject* obj = item->dataObject();
if ( obj ) {
// 1. check text
- update = ( item->text( 0 ) != obj->name() );
+ update = ( item->text( 0 ) != obj->name() ) || myBrowser->needToUpdateTexts( item );
+
if ( !update ) {
// 2. check pixmap (compare serialNumber()-s)
QPixmap objPix = obj->icon();
return update;
}
+/*!
+ Updates item
+ \param p - item
+*/
void OB_BrowserSync::updateItem( const ItemPtr& p ) const
{
if ( p && needUpdate( p ) ) {
// printf( "--- needUpdate for %s = true ---\n", p->text( 0 ).latin1() );
+ myBrowser->updateText( p );
p->update();
}
}
+/*!
+ Creates item by SUIT object
+ \param src - corresponding SUIT object
+ \param parent - parent for item
+ \param after - previous sibling for item
+ \param prepend - item must be added to start of children list
+*/
ItemPtr OB_BrowserSync::createItem( const ObjPtr& src,
const ItemPtr& parent, const ItemPtr& after,
- const bool asFirst ) const
+ const bool prepend ) const
{
- ItemPtr i = myBrowser ? dynamic_cast<ItemPtr>( myBrowser->createItem( src, parent, after, asFirst ) ) : 0;
+ ItemPtr i = myBrowser ? dynamic_cast<ItemPtr>( myBrowser->createItem( src, parent, after, prepend ) ) : 0;
if( i )
i->setOpen( src->isOpen() );
return i;
}
+/*!
+ Deletes object with all children
+ \param i - item
+*/
void OB_BrowserSync::deleteItemWithChildren( const ItemPtr& i ) const
{
if( myBrowser && myBrowser->myItems.contains( i->dataObject() ) )
}
}
+/*!
+ \return true if objects correspond each other at all
+ \param p - suit object
+ \param q - object browser item
+*/
bool OB_BrowserSync::isEqual( const ObjPtr& p, const ItemPtr& q ) const
{
- return ( !p && !q ) || ( p && q && q->dataObject()==p );
+ bool isRoot = p==myBrowser->getRootObject() && !q,
+ isEq = p && q && q->dataObject()==p;
+ return isRoot || ( !p && !q ) || isEq;
}
+/*!
+ \return null suit object
+*/
ObjPtr OB_BrowserSync::nullSrc() const
{
return 0;
}
+/*!
+ \return null item
+*/
ItemPtr OB_BrowserSync::nullTrg() const
{
return 0;
}
+/*!
+ Fills list with children of SUIT object
+ \param p - SUIT object
+ \param ch - list to be filled
+*/
void OB_BrowserSync::children( const ObjPtr& p, QValueList<ObjPtr>& ch ) const
{
DataObjectList l;
}
}
+/*!
+ Fills list with children of item
+ \param p - item
+ \param ch - list to be filled
+*/
void OB_BrowserSync::children( const ItemPtr& p, QValueList<ItemPtr>& ch ) const
{
- for( QListViewItem* item = p->firstChild(); item; item = item->nextSibling() )
+ for( QListViewItem* item = p ? p->firstChild() : myBrowser->listView()->firstChild(); item; item = item->nextSibling() )
{
ItemPtr p = dynamic_cast<ItemPtr>( item );
if( p )
}
}
+/*!
+ \return parent of item
+ \param p - item
+*/
ItemPtr OB_BrowserSync::parent( const ItemPtr& p ) const
{
return p ? dynamic_cast<ItemPtr>( p->parent() ) : 0;
/*!
- Class: OB_Browser
- Descr: Hierarchical tree object browser.
+ Constructor
*/
-
OB_Browser::OB_Browser( QWidget* parent, SUIT_DataObject* root )
: QFrame( parent ),
setModified();
}
+/*!
+ Destructor
+*/
OB_Browser::~OB_Browser()
{
myItems.clear();
delete myTooltip;
}
+/*!
+ \return true if root is decorated by +
+*/
bool OB_Browser::rootIsDecorated() const
{
return myRootDecorated;
}
+/*!
+ Sets state "root is recorated"
+ \param decor - new value of state
+*/
void OB_Browser::setRootIsDecorated( const bool decor )
{
if ( decor == rootIsDecorated() )
updateTree( 0, false );
}
+/*!
+ \return number of levels to be auto opened on update tree
+*/
int OB_Browser::autoOpenLevel() const
{
return myAutoOpenLevel;
}
+/*!
+ Changes number of levels to be auto opened on update tree
+ \param level - new number of levels
+*/
void OB_Browser::setAutoOpenLevel( const int level )
{
if ( myAutoOpenLevel == level )
autoOpenBranches();
}
+/*!
+ \return state "are tooltips shown"
+*/
bool OB_Browser::isShowToolTips()
{
return myShowToolTips;
}
+/*!
+ Sets new value of state "are tooltips shown"
+ \param theDisplay - new value
+*/
void OB_Browser::setShowToolTips( const bool theDisplay )
{
myShowToolTips = theDisplay;
}
+/*!
+ \return true if object browser automatically updates tree after SUIT object removing
+*/
bool OB_Browser::isAutoUpdate() const
{
return myAutoUpdate;
}
+/*!
+ Sets new value of "auto update": whether object browser automatically updates tree after SUIT object removing
+*/
void OB_Browser::setAutoUpdate( const bool on )
{
myAutoUpdate = on;
}
+/*!
+ \return true if object browser must delete old tree on setRootObject(), replaceTree()
+ \sa setRootObject(), replaceTree()
+*/
bool OB_Browser::isAutoDeleteObjects() const
{
return myAutoDelObjs;
}
+/*!
+ Sets whether object browser must delete old tree on setRootObject(), replaceTree()
+ \sa setRootObject(), replaceTree()
+*/
void OB_Browser::setAutoDeleteObjects( const bool on )
{
myAutoDelObjs = on;
}
+/*!
+ \return root SUIT object of browser
+*/
SUIT_DataObject* OB_Browser::getRootObject() const
{
return myRoot;
}
+/*!
+ Sets new root SUIT object of browser
+ \param theRoot - new root object
+*/
void OB_Browser::setRootObject( SUIT_DataObject* theRoot )
{
DataObjectKey curKey;
emit selectionChanged();
}
+/*!
+ \return number of selected items
+*/
int OB_Browser::numberOfSelected() const
{
int count = 0;
return count;
}
+/*!
+ \return list of selected objects
+*/
DataObjectList OB_Browser::getSelected() const
{
DataObjectList lst;
return lst;
}
+/*!
+ Fills list with selected objects
+*/
void OB_Browser::getSelected( DataObjectList& theObjList ) const
{
theObjList.clear();
}
}
+/*!
+ Sets selected object
+ \param theObject - new selected object
+ \param append - if it is true, then other selected objects are left as selected,
+ otherwise only 'theObject' will be selected
+*/
void OB_Browser::setSelected( const SUIT_DataObject* theObject, const bool append )
{
DataObjectList lst;
setSelected( lst, append );
}
+/*!
+ Sets selected objects
+ \param theObjLst - new selected objects
+ \param append - if it is true, then other selected objects are left as selected,
+ otherwise only 'theObjLst' will be selected
+*/
void OB_Browser::setSelected( const DataObjectList& theObjLst, const bool append )
{
QListView* lv = listView();
}
}
+/*!
+ \return true if item corresponding to object is opened
+ \param theObject - object to be checked
+*/
bool OB_Browser::isOpen( SUIT_DataObject* theObject ) const
{
bool res = false;
return res;
}
+/*!
+ Sets opened state of item
+ \param theObject - object corresponding to item
+ \param theOpen - new opened state
+*/
void OB_Browser::setOpen( SUIT_DataObject* theObject, const bool theOpen )
{
if ( listView() )
listView()->setOpen( listViewItem( theObject ), theOpen );
}
+/*!
+ \return SUIT object correspondint to item at position 'pos'
+ \param pos - position
+*/
SUIT_DataObject* OB_Browser::dataObjectAt( const QPoint& pos ) const
{
SUIT_DataObject* obj = 0;
return obj;
}
+/*!
+ \return filter of list view
+*/
OB_Filter* OB_Browser::filter() const
{
return myView->filter();
}
+/*!
+ Changes filter of list view
+ \param f - new filter
+*/
void OB_Browser::setFilter( OB_Filter* f )
{
myView->setFilter( f );
}
+/*!
+ Adds new column to list view
+ \param label - title of column
+ \param id - id of column
+ \param width - width of column
+*/
int OB_Browser::addColumn( const QString& label, const int id, const int width )
{
return addColumn( QIconSet(), label, id, width );
}
+/*!
+ Adds new column to list view
+ \param icon - icon of column
+ \param label - title of column
+ \param id - id of column
+ \param width - width of column
+*/
int OB_Browser::addColumn( const QIconSet& icon, const QString& label, const int id, const int width )
{
QListView* lv = listView();
return theId;
}
+/*!
+ Removes column
+ \param id - id of column
+*/
void OB_Browser::removeColumn( const int id )
{
QListView* lv = listView();
updateText();
}
+/*!
+ Sets title of first column (name column)
+ \param label - new title
+*/
void OB_Browser::setNameTitle( const QString& label )
{
setNameTitle( QIconSet(), label );
}
+/*!
+ Sets title and icon of first column (name column)
+ \param icon - new icon
+ \param label - new title
+*/
void OB_Browser::setNameTitle( const QIconSet& icon, const QString& label )
{
QListView* lv = listView();
lv->setColumnText( 0, icon, label );
}
+/*!
+ Sets title of column
+ \param id - column id
+ \param label - new column title
+*/
void OB_Browser::setColumnTitle( const int id, const QString& label )
{
setColumnTitle( id, QIconSet(), label );
}
+/*!
+ Sets title and icon of column
+ \param id - column id
+ \param icon - new column icon
+ \param label - new column title
+*/
void OB_Browser::setColumnTitle( const int id, const QIconSet& icon, const QString& label )
{
QListView* lv = listView();
lv->setColumnText( myColumnIds[id], icon, label );
}
+/*!
+ \return title of first column (name column)
+*/
QString OB_Browser::nameTitle() const
{
return myView->columnText( 0 );
}
+/*!
+ \return title of first column (name column)
+ \param id - column id
+*/
QString OB_Browser::columnTitle( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ \return true if column is visible
+ \param id - column id
+*/
bool OB_Browser::isColumnVisible( const int id ) const
{
return myColumnIds.contains( id ) && myView->isShown( myColumnIds[id] );
}
+/*!
+ Sets visibility of column
+ \param id - column id
+ \param on - new visibility state
+*/
void OB_Browser::setColumnShown( const int id, const bool on )
{
if ( !myColumnIds.contains( id ) )
return;
myView->setShown( myColumnIds[id], on );
+ if( !on )
+ myView->setColumnWidthMode( myColumnIds[id], QListView::Manual );
}
+/*!
+ Sets global width mode
+ \param mode - new width mode
+*/
void OB_Browser::setWidthMode( QListView::WidthMode mode )
{
for ( int i = 0, n = myView->columns(); i < n; i++ )
- myView->setColumnWidthMode( i, mode );
+ if( mode!=QListView::Maximum || myView->columnWidth( i )>0 )
+ myView->setColumnWidthMode( i, mode );
}
+/*!
+ \return list of columns ids
+*/
QValueList<int> OB_Browser::columns() const
{
QValueList<int> lst;
return lst;
}
+/*!
+ \return true if it is possible to show/hide column by popup
+ \param id - column id
+*/
bool OB_Browser::appropriateColumn( const int id ) const
{
bool res = false;
return res;
}
+/*!
+ Sets "appropriate state": is it possible to show/hide column by popup
+ \param id - column id
+ \param on - new state
+*/
void OB_Browser::setAppropriateColumn( const int id, const bool on )
{
if ( !myColumnIds.contains( id ) )
myView->setAppropriate( myColumnIds[id], on );
}
+/*!
+ Updates tree
+ \param obj - start object
+ \param autoOpen - to open automatically branches of autoOpenLevel()
+ \sa autoOpenLevel()
+*/
void OB_Browser::updateTree( SUIT_DataObject* obj, const bool autoOpen )
{
// QTime t1 = QTime::currentTime();
// qDebug( QString( "update tree time = %1 msecs" ).arg( t1.msecsTo( t2 ) ) );
}
+/*!
+ Replaces part of tree starting at object 'src' by tree starting at object 'trg'
+*/
void OB_Browser::replaceTree( SUIT_DataObject* src, SUIT_DataObject* trg )
{
if ( !src || !trg || src == trg || src->root() != getRootObject() )
emit selectionChanged();
}
+/*!
+ Updates view
+ \param startObj - start object
+*/
void OB_Browser::updateView( SUIT_DataObject* startObj )
{
QListView* lv = listView();
if ( !startObj || startObj->root() != getRootObject() )
return;
- if( startObj==myRoot )
- {
- DataObjectList ch;
- myRoot->children( ch );
+ //qDebug( "updateView:" );
+ //startObj->dump();
- ItemMap exist;
- QListViewItem* st = lv->firstChild();
- for( ; st; st = st->nextSibling() )
- {
- OB_ListItem* ob_item = dynamic_cast<OB_ListItem*>( st );
- exist.insert( ob_item->dataObject(), ob_item );
- }
-
- SUIT_DataObject* local_root = ch.first();
- for( ; local_root; local_root = ch.next() )
- {
- OB_BrowserSync sync( this );
- OB_ListItem* local_item = dynamic_cast<OB_ListItem*>( listViewItem( local_root ) );
-
- // QString srcName = ( local_root && !local_root->name().isNull() ) ? local_root->name() : "";
- // QString trgName = ( local_item && !local_item->text(0).isNull() ) ? local_item->text(0) : "";
- // printf( "--- OB_Browser::updateView() calls synchronize()_1: src = %s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
- synchronize<ObjPtr,ItemPtr,OB_BrowserSync>( local_root, local_item, sync );
- exist[local_root] = 0;
- }
-
- ItemMap::const_iterator anIt = exist.begin(), aLast = exist.end();
- for( ; anIt!=aLast; anIt++ )
- if( anIt.data() )
- {
- removeReferences( anIt.data() );
- OB_ListItem* item = dynamic_cast<OB_ListItem*>( anIt.data() );
- if( item && myItems.contains( item->dataObject() ) )
- delete anIt.data();
- }
+ if ( startObj == myRoot )
+ {
+ OB_BrowserSync sync( this );
+ synchronize<ObjPtr,ItemPtr,OB_BrowserSync>( myRoot, 0, sync );
}
else
{
OB_BrowserSync sync( this );
OB_ListItem* startItem = dynamic_cast<OB_ListItem*>( listViewItem( startObj ) );
-
- // QString srcName = ( startObj && !startObj->name().isNull() ) ? startObj->name() : "";
- // QString trgName = ( startItem && !startItem->text(0).isNull() ) ? startItem->text(0) : "";
- // printf( "--- OB_Browser::updateView() calls synchronize()_2: src = %s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
synchronize<ObjPtr,ItemPtr,OB_BrowserSync>( startObj, startItem, sync );
}
}
+/*!
+ Creates new list item
+ \return new item
+ \param o - corresponding SUIT object
+ \param parent - parent item
+ \param after - item after that new item must be added
+ \param prepend - new item must be added as first
+*/
QListViewItem* OB_Browser::createItem( const SUIT_DataObject* o, QListViewItem* parent,
- QListViewItem* after, const bool asFirstChild )
+ QListViewItem* after, const bool prepend )
{
QListView* lv = listView();
if ( parent )
{
- if ( parent->childCount() && !after )
+ if ( after )
{
- after = parent->firstChild();
- while ( after->nextSibling() )
- after = after->nextSibling();
+ if ( type == -1 )
+ item = new OB_ListItem( obj, parent, after );
+ else
+ item = new OB_CheckListItem( obj, parent, after, (QCheckListItem::Type)type );
}
-
- if ( after && !asFirstChild )
+ else if ( prepend )
{
if ( type == -1 )
- item = new OB_ListItem( obj, parent, after );
+ item = new OB_ListItem( obj, parent );
else
- item = new OB_CheckListItem( obj, parent, after, (QCheckListItem::Type)type );
+ item = new OB_CheckListItem( obj, parent, (QCheckListItem::Type)type );
}
- else
+ else // append
{
+ after = parent->firstChild();
+ while ( after && after->nextSibling() )
+ after = after->nextSibling();
if ( type == -1 )
- item = new OB_ListItem( obj, parent );
+ item = new OB_ListItem( obj, parent, after );
else
- item = new OB_CheckListItem( obj, parent, (QCheckListItem::Type)type );
+ item = new OB_CheckListItem( obj, parent, after, (QCheckListItem::Type)type );
}
}
- else // ROOT item
+ else
{
- if ( type == -1 )
- item = new OB_ListItem( obj, lv );
- else
- item = new OB_CheckListItem( obj, lv, (QCheckListItem::Type)type );
+ if ( after )
+ {
+ if ( type == -1 )
+ item = new OB_ListItem( obj, lv, after );
+ else
+ item = new OB_CheckListItem( obj, lv, after, (QCheckListItem::Type)type );
+ }
+ else if ( prepend )
+ {
+ if ( type == -1 )
+ item = new OB_ListItem( obj, lv );
+ else
+ item = new OB_CheckListItem( obj, lv, (QCheckListItem::Type)type );
+ }
+ else // append
+ {
+ after = lv->firstChild();
+ while ( after && after->nextSibling() )
+ after = after->nextSibling();
+ if ( type == -1 )
+ item = new OB_ListItem( obj, lv, after );
+ else
+ item = new OB_CheckListItem( obj, lv, after, (QCheckListItem::Type)type );
+ }
}
myItems.insert( obj, item );
return item;
}
+/*!
+ Adjusts width by root item
+*/
void OB_Browser::adjustWidth()
{
if ( !listView() )
adjustWidth( listView()->firstChild() );
}
+/*!
+ Adjusts width by item
+ \param item
+*/
void OB_Browser::adjustWidth( QListViewItem* item )
{
while ( item )
}
}
+/*!
+ \return SUIT object corresponding to item
+ \param item
+*/
SUIT_DataObject* OB_Browser::dataObject( const QListViewItem* item ) const
{
SUIT_DataObject* obj = 0;
return obj;
}
+/*!
+ \return item corresponding to SUIT object
+ \param obj - SUIT object
+*/
QListViewItem* OB_Browser::listViewItem( const SUIT_DataObject* obj ) const
{
QListViewItem* item = 0;
return item;
}
+/*!
+ \return list view of object browser
+*/
QListView* OB_Browser::listView() const
{
return myView;
}
+/*!
+ \remove all items referencing current (through data objects)
+*/
void OB_Browser::removeReferences( QListViewItem* item )
{
if ( !item )
}
}
+/*!
+ Connects all children to SLOT onDestroyed
+*/
void OB_Browser::createConnections( SUIT_DataObject* obj )
{
if ( !obj )
it.current()->connect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
}
+/*!
+ Disconnects all children from SLOT onDestroyed
+*/
void OB_Browser::removeConnections( SUIT_DataObject* obj )
{
if ( !obj )
it.current()->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
}
+/*!
+ Stores states (opened, selected) of current tree items
+ \return current item
+ \param selObjs, selKeys - maps of selected objects
+ \param openObjs, openKeys - maps of opened objects
+ \param curKey - map of current objects
+*/
SUIT_DataObject* OB_Browser::storeState( DataObjectMap& selObjs, DataObjectMap& openObjs,
DataObjectKeyMap& selKeys, DataObjectKeyMap& openKeys,
DataObjectKey& curKey ) const
return curObj;
}
+/*!
+ Restores states (opened, selected) of current tree items
+ \param selObjs, selKeys - maps of selected objects
+ \param openObjs, openKeys - maps of opened objects
+ \param curKey - map of current objects
+*/
void OB_Browser::restoreState( const DataObjectMap& selObjs, const DataObjectMap& openObjs,
const SUIT_DataObject* curObj, const DataObjectKeyMap& selKeys,
const DataObjectKeyMap& openKeys, const DataObjectKey& curKey )
lv->blockSignals( block );
}
+/*!
+ Creates object key by tree item
+*/
OB_Browser::DataObjectKey OB_Browser::objectKey( QListViewItem* i ) const
{
return objectKey( dataObject( i ) );
}
+/*!
+ Creates object key by SUIT object
+*/
OB_Browser::DataObjectKey OB_Browser::objectKey( SUIT_DataObject* obj ) const
{
if ( !obj )
return DataObjectKey( obj->key() );
}
+/*!
+ Custom key press event handler, updates tree by F5
+*/
void OB_Browser::keyPressEvent( QKeyEvent* e )
{
if ( e->key() == Qt::Key_F5 )
QFrame::keyPressEvent( e );
}
+/*!
+ SLOT: called if action "Expand all" is activated
+*/
void OB_Browser::onExpand()
{
DataObjectList selected;
expand( listViewItem( itr.current() ) );
}
+/*!
+ SLOT: called if action "Show/hide column" is activated by popup
+*/
void OB_Browser::onColumnVisible( int id )
{
setColumnShown( id, !isColumnVisible( id ) );
}
+/*!
+ SLOT: called if SUIT object is destroyed
+*/
void OB_Browser::onDestroyed( SUIT_DataObject* obj )
{
removeObject( obj );
}
+/*!
+ SLOT: called on finish of drag-n-drop operation
+ \param items - dragged items
+ \param item - destination (item on that they were dropped)
+ \param action - QDropEvent::Action
+*/
void OB_Browser::onDropped( QPtrList<QListViewItem> items, QListViewItem* item, int action )
{
SUIT_DataObject* obj = dataObject( item );
emit dropped( lst, obj, action );
}
+/*!
+ Updates texts of items
+*/
void OB_Browser::updateText()
{
if ( myColumnIds.isEmpty() )
}
}
+/*!
+ \return true if item must be updated
+ \param item - item to be checked
+*/
+bool OB_Browser::needToUpdateTexts( QListViewItem* item ) const
+{
+ SUIT_DataObject* obj = dataObject( item );
+ if ( !obj )
+ return false;
+
+ for( QMap<int, int>::const_iterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it )
+ if( item->text( it.data() ) != obj->text( it.key() ) )
+ return true;
+ return false;
+}
+
+/*!
+ Updates texts of item
+ \param item - item to be updated
+*/
void OB_Browser::updateText( QListViewItem* item )
{
SUIT_DataObject* obj = dataObject( item );
item->setText( it.data(), obj->text( it.key() ) );
}
+/*!
+ Custom event filter
+*/
bool OB_Browser::eventFilter( QObject* o, QEvent* e )
{
if ( o == myView && e->type() == QEvent::ContextMenu )
return QFrame::eventFilter( o, e );
}
+/*!
+ Adds custom actions to popup
+ \param menu - popup menu
+*/
void OB_Browser::contextMenuPopup( QPopupMenu* menu )
{
/* QValueList<int> cols;
}
}
+/*!
+ Expands item with all it's children
+*/
void OB_Browser::expand( QListViewItem* item )
{
if ( !item )
expand( child );
}
+/*!
+ \return true if item or one of it's children isn't opened
+*/
bool OB_Browser::hasClosed( QListViewItem* item ) const
{
if ( !item )
return has;
}
+/*!
+ Removes SUIT object
+ \param obj - SUIT object to be removed
+ \param autoUpd - auto tree updating
+*/
void OB_Browser::removeObject( SUIT_DataObject* obj, const bool autoUpd )
{
if ( !obj )
delete item;
}
+/*!
+ Opens branches from 1 to autoOpenLevel()
+ \sa autoOpenLevel()
+*/
void OB_Browser::autoOpenBranches()
{
int level = autoOpenLevel();
}
}
+/*!
+ Opens branch
+ \param item
+ \param level
+*/
void OB_Browser::openBranch( QListViewItem* item, const int level )
{
if ( level < 1 )
}
}
+/*!
+ SLOT: called on double click on item, emits signal
+*/
void OB_Browser::onDoubleClicked( QListViewItem* item )
{
if ( item )
emit doubleClicked( dataObject( item ) );
}
+/*!
+ Stores time of last modification
+*/
void OB_Browser::setModified()
{
myModifiedTime = clock();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OB_BROWSER_H
#define OB_BROWSER_H
class OB_ListView;
class OB_ListItem;
+/*!
+ \class OB_Browser
+ Represents object browser. Allows to get/set selection,
+ to drag-n-drop of objects, to determine item by SUIT object and
+ vice versa
+*/
class OB_EXPORT OB_Browser : public QFrame, public SUIT_PopupClient
{
Q_OBJECT
void removeObject( SUIT_DataObject*, const bool = true );
void updateText( QListViewItem* );
+ bool needToUpdateTexts( QListViewItem* ) const;
DataObjectKey objectKey( QListViewItem* ) const;
DataObjectKey objectKey( SUIT_DataObject* ) const;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OB_Filter.h"
+/*!
+ Default constructor
+*/
OB_Filter::OB_Filter()
{
}
+/*!
+ Destructor
+*/
OB_Filter::~OB_Filter()
{
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OB_FILTER_H
#define OB_FILTER_H
class SUIT_DataObject;
+/*!
+ \class OB_Filter
+ Base class for ObjectBrowser filter.
+ Filters selected objects by some condition.
+*/
class OB_EXPORT OB_Filter
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OB_ListItem.h"
using namespace std;
/*!
- Class: ListItem
- Descr: base template class
+ Constructor
*/
-
template<class T>
ListItemF<T>::ListItemF( T* theT, SUIT_DataObject* obj ) :
myT( theT ),
{
}
+/*!
+ Paints item
+*/
template<class T>
void ListItemF<T>::paintC( QPainter* p, QColorGroup& cg, int c, int w, int align )
{
//myT.paintCell( p, colorGrp, c, itemW, align );
}
+/*!
+ Paints focused item
+*/
template<class T>
void ListItemF<T>::paintFoc( QPainter* p, QColorGroup& cg, const QRect& r )
{
//myT.paintFocus( p, cg, rect );
}
+/*!
+ Set selection of item
+ \param s - selected state
+*/
template<class T>
void ListItemF<T>::setSel( bool s )
{
//myT.setSelected( s );
}
+/*!
+ Updates name and pixmap of item
+*/
template<class T>
void ListItemF<T>::update()
{
}
/*!
- Class: OB_ListItem
- Descr: List view item for OB_Browser.
+ Constructor
*/
-
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListView* parent )
: ListItemF<QListViewItem>( this, obj ),
QListViewItem(parent)
update();
}
+/*!
+ Constructor
+*/
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListViewItem* parent )
: ListItemF<QListViewItem>( this, obj ),
QListViewItem(parent)
update();
}
+/*!
+ Constructor
+*/
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListView* parent, QListViewItem* after )
: ListItemF<QListViewItem>( this, obj),
QListViewItem(parent, after )
update();
}
+/*!
+ Constructor
+*/
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListViewItem* parent, QListViewItem* after )
: ListItemF<QListViewItem>( this,obj),
QListViewItem(parent, after )
update();
}
+/*!
+ Destructor
+*/
OB_ListItem::~OB_ListItem()
{
}
+/*!
+ Sets selection state of item
+ \param s - new state
+*/
void OB_ListItem::setSelected( bool s )
{
setSel( s );
QListViewItem::setSelected( s );
}
+/*!
+ Paints focus
+ \param p - painter
+ \param cg - color group
+ \param r - focus rectangle
+*/
void OB_ListItem::paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r )
{
QColorGroup col_group( cg );
QListViewItem::paintFocus( p, col_group, R );
}
+/*!
+ Paints item
+ \param p - painter
+ \param cg - color group
+ \param c - not used
+ \param w - width of item
+ \param align - alignment
+*/
void OB_ListItem::paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align )
{
QColorGroup col_group( cg );
if ( listView() && !listView()->allColumnsShowFocus() )
W = width( p->fontMetrics(), listView(), c );
- QListViewItem::paintCell( p, col_group, c, W, align );
+ QListViewItem::paintCell( p, col_group, c, min( W, w ), align );
}
+/*!
+ \return custom RTTI info
+*/
int OB_ListItem::RTTI()
{
return 1000;
}
+/*!
+ \return custom RTTI info
+*/
int OB_ListItem::rtti() const
{
return RTTI();
}
+/*!
+ Sets item text
+ \param column - column index
+ \param text - new text
+*/
void OB_ListItem::setText( int column, const QString& text )
{
QListViewItem::setText( column, text );
}
/*!
- Class: OB_CheckListItem
- Descr: Check list view item for OB_Browser.
+ Constructor
*/
-
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListView* parent, Type type )
: ListItemF<QCheckListItem>( this, obj),
QCheckListItem( parent, "", type )
update();
}
+/*!
+ Constructor
+*/
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListViewItem* parent, Type type )
: ListItemF<QCheckListItem>( this, obj),
QCheckListItem( parent, "", type )
update();
}
+/*!
+ Constructor
+*/
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListView* parent, QListViewItem* after, Type type )
: ListItemF<QCheckListItem>( this, obj),
#if defined(QT_VERSION) && QT_VERSION >= 0x030101
update();
}
+/*!
+ Constructor
+*/
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListViewItem* parent, QListViewItem* after, Type type )
: ListItemF<QCheckListItem>( this, obj),
#if defined(QT_VERSION) && QT_VERSION >= 0x030101
update();
}
+/*!
+ Destructor
+*/
OB_CheckListItem::~OB_CheckListItem()
{
}
+/*!
+ Sets selection state of item
+ \param s - new state
+*/
void OB_CheckListItem::setSelected( bool s )
{
setSel( s );
QCheckListItem::setSelected( s );
}
+/*!
+ Paints focus
+ \param p - painter
+ \param cg - color group
+ \param r - focus rectangle
+*/
void OB_CheckListItem::paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r )
{
QColorGroup col_group( cg );
QCheckListItem::paintFocus( p, col_group, R );
}
+/*!
+ Paints item
+ \param p - painter
+ \param cg - color group
+ \param c - not used
+ \param w - width of item
+ \param align - alignment
+*/
void OB_CheckListItem::paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align )
{
QColorGroup col_group( cg );
if ( listView() && !listView()->allColumnsShowFocus() )
W = width( p->fontMetrics(), listView(), c );
- QCheckListItem::paintCell( p, col_group, c, W, align );
+ QCheckListItem::paintCell( p, col_group, c, min( W, w ), align );
}
+/*!
+ \return custom RTTI info
+*/
int OB_CheckListItem::RTTI()
{
return OB_ListItem::RTTI() + 1;
}
+/*!
+ \return custom RTTI info
+*/
int OB_CheckListItem::rtti() const
{
return RTTI();
}
+/*!
+ SLOT: called if checked state is changed, changes corresponding state of SUIT object
+*/
void OB_CheckListItem::stateChange( bool on )
{
QCheckListItem::stateChange( on );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OB_LISTITEM_H
class SUIT_DataObject;
-/*
- base template class for ListViewItems and CheckListItems
+/*!
+ \class ListItemF
+ Base template class for ListViewItems and CheckListItems
*/
-
template<class T> class ListItemF
{
public:
T* myT;
};
-/*
- ListViewItem class
+/*!
+ \class OB_ListItem
+ Provides custom list item for Object Browser tree
*/
-
class OB_EXPORT OB_ListItem : public ListItemF<QListViewItem>, public QListViewItem
{
public:
static int RTTI();
};
-/*
- CheckListItem class
+/*!
+ \class OB_CheckListItem
+ Provides custom list item with check box
*/
-
class OB_EXPORT OB_CheckListItem : public ListItemF<QCheckListItem>, public QCheckListItem
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "OB_ListView.h"
#include <qdragobject.h>
+/*!
+ Constructor
+*/
OB_ListView::OB_ListView( QWidget* parent, const char* name, WFlags f )
: QtxListView( parent, name, f ),
myFilter( 0 )
{
}
+/*!
+ Constructor
+*/
OB_ListView::OB_ListView( const int state, QWidget* parent, const char* name, WFlags f )
: QtxListView( state, parent, name, f ),
myFilter( 0 )
{
}
+/*!
+ Destructor
+*/
OB_ListView::~OB_ListView()
{
delete myFilter;
}
+/*!
+ \return filter
+*/
OB_Filter* OB_ListView::filter() const
{
return myFilter;
}
+/*!
+ Changes filter
+ \param f - new filter
+*/
void OB_ListView::setFilter( OB_Filter* f )
{
if ( myFilter == f )
myFilter = f;
}
+/*!
+ \return true if item passes filter
+*/
bool OB_ListView::isOk( QListViewItem* item ) const
{
bool ok = true;
return ok;
}
+/*!
+ Creates new drag object
+*/
QDragObject* OB_ListView::dragObject()
{
myItems.clear();
return new QTextDrag( "", this );
}
+/*!
+ Custom drag enter event filter
+*/
void OB_ListView::dragEnterEvent( QDragEnterEvent* e )
{
e->accept();
}
+/*!
+ Custom drag move event filter
+*/
void OB_ListView::dragMoveEvent( QDragMoveEvent* e )
{
QListViewItem* item = dropItem( e );
e->accept( false );
}
+/*!
+ Custom drop event filter
+*/
void OB_ListView::dropEvent( QDropEvent* e )
{
QListViewItem* item = dropItem( e );
myItems.clear();
}
+/*!
+ Custom key press event filter
+*/
void OB_ListView::keyPressEvent( QKeyEvent* ke )
{
if ( ( ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Minus ) && ke->state() & ControlButton )
QtxListView::keyPressEvent( ke );
}
+/*!
+ Finds item, in that dragged objects are dropped by QDropEvent
+ \return tree item
+*/
QListViewItem* OB_ListView::dropItem( QDropEvent* e ) const
{
QListViewItem* item = 0;
return item;
}
+/*!
+ \return SUIT object by tree item
+ \param item - tree item
+*/
SUIT_DataObject* OB_ListView::dataObject( QListViewItem* item ) const
{
if ( !item )
return obj;
}
+/*!
+ \return true if it is possible to drop into item
+ \param item - tree item to be checked
+*/
bool OB_ListView::isDropAccepted( QListViewItem* item ) const
{
bool res = true;
return res;
}
+/*!
+ \return true if it is possible to drop one item into other
+ \param drag - dragged item
+ \param drop - destination item
+*/
bool OB_ListView::isDropAccepted( QListViewItem* drag, QListViewItem* drop ) const
{
SUIT_DataObject* dragObj = dataObject( drag );
return dropObj->isDropAccepted( dragObj );
}
+/*!
+ Sets column width
+ \param col - column index
+ \param width - column width
+*/
void OB_ListView::setColumnWidth( int col, int width )
{
int max = columnMaxWidth( col );
QListView::setColumnWidth( col, width );
}
+/*!
+ \return column max width
+ \param col - column index
+*/
int OB_ListView::columnMaxWidth( const int col ) const
{
int res = -1;
return res;
}
+/*!
+ Changes column max width
+ \param col - column index
+ \param w - column max width
+*/
void OB_ListView::setColumnMaxWidth( const int col, const int w )
{
myMaxColWidth.insert( col, w );
}
+/*!
+ \return column max ratio
+ \param col - column index
+*/
double OB_ListView::columnMaxRatio( const int col ) const
{
double res = 0.0;
return res;
}
+/*!
+ Changes column max ratio
+ \param col - column index
+ \param w - column max ratio
+*/
void OB_ListView::setColumnMaxRatio( const int col, const double r )
{
myMaxColRatio.insert( col, r );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef OB_LISTVIEW_H
#define OB_LISTVIEW_H
class QListViewItem;
class SUIT_DataObject;
+/*!
+ \class OB_ListView
+ Special list view for ObjectBrowser.
+ Allows drag-n-drop, filtering of selected objects, column management.
+*/
class OB_EXPORT OB_ListView : public QtxListView
{
Q_OBJECT
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : Plot2d
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifdef WNT
#ifdef PLOT2D_EXPORTS
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Plot2d_Curve.h"
#include <qcolor.h>
return *this;
}
+/*!
+ \return title of table
+*/
QString Plot2d_Curve::getTableTitle() const
{
return QString();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PLOT2D_CURVE_H
#define PLOT2D_CURVE_H
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : Plot2d_FitDataDlg.cxx
// Author : Vadim SANDLER
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PLOT2D_FITDATADLG_H
#define PLOT2D_FITDATADLG_H
// 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.salome-platform.org or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <qwt_plot.h>
#include "Plot2d_Prs.h"
-//==========================================================
/*!
- * Plot2d_Prs::Plot2d_Prs
- * Default constructor
- */
-//==========================================================
+ Default constructor
+*/
Plot2d_Prs::Plot2d_Prs( bool theDelete )
: mySecondY( false)
{
setAutoDel(theDelete);
}
-//==========================================================
/*!
- * Plot2d_Prs::Plot2d_Prs
- * Standard constructor
- */
-//==========================================================
+ Standard constructor
+*/
Plot2d_Prs::Plot2d_Prs( const Plot2d_Curve* obj, bool theDelete )
: mySecondY( false)
{
AddObject( obj );
}
-//==========================================================
/*!
- * Plot2d_Prs::~Plot2d_Prs
- * Destructor
- */
-//==========================================================
+ Destructor
+*/
Plot2d_Prs::~Plot2d_Prs()
{
}
-//==========================================================
/*!
- * Plot2d_Prs::GetObjects
- * Get curves list
- */
-//==========================================================
+ Get curves list
+*/
curveList Plot2d_Prs::getCurves() const
{
return myCurves;
}
-//==========================================================
/*!
- * Plot2d_Prs::AddObject
- * Add curbe
- */
-//==========================================================
+ Add curve
+*/
void Plot2d_Prs::AddObject( const Plot2d_Curve* obj )
{
myCurves.append((Plot2d_Curve*)obj);
mySecondY = true;
}
-//==========================================================
/*!
- * Plot2d_Prs::IsNull
- * Return 0 if list of the curves is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
+ \return 0 if list of the curves is empty [ Reimplemented from SALOME_Prs ]
+*/
bool Plot2d_Prs::IsNull() const
{
return myCurves.isEmpty();
}
-//==========================================================
/*!
- * Plot2d_Prs::IsSecondY
- * Return 1 if in the list of curves exist at least one curve
- * with axis Qwt::yRight
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
+ \return 1 if in the list of curves exist at least one curve with axis Qwt::yRight [ Reimplemented from SALOME_Prs ]
+*/
bool Plot2d_Prs::isSecondY() const
{
return mySecondY;
}
-//==========================================================
/*!
- * Plot2d_Prs::IsNull
- * Return 0 if list of the curves is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
+ \return 0 if list of the curves is empty [ Reimplemented from SALOME_Prs ]
+*/
void Plot2d_Prs::setAutoDel(bool theDel)
{
myCurves.setAutoDelete(theDel);
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PLOT2D_PRS_H
#define PLOT2D_PRS_H
-// SALOME Plot2d : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME Plot2d : implementation of desktop and GUI kernel
//
// File : Plot2d_SetupCurveDlg.cxx
// Author : Vadim SANDLER
-// SALOME Plot2d : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME Plot2d : implementation of desktop and GUI kernel
//
// File : Plot2d_SetupCurveDlg.h
// Author : Vadim SANDLER
// Module : SALOME
-// $Header$
#ifndef Plot2d_SetupCurveDlg_H
#define Plot2d_SetupCurveDlg_H
#include <qdialog.h>
-//=================================================================================
-// class : Plot2d_SetupCurveDlg
-// purpose : Dialog box for setup Plot2d curve
-//=================================================================================
+/*!
+ \class Plot2d_SetupCurveDlg
+ Dialog box for setup Plot2d curve
+*/
class QPushButton;
class QComboBox;
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : Plot2d_SetupViewDlg.cxx
// Author : Vadim SANDLER
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PLOT2D_SETUPVIEWDLG_H
#define PLOT2D_SETUPVIEWDLG_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Plot2d_ViewFrame.h"
"................................"};
-//=================================================================================
-// Plot2d_ViewFrame implementation
-//=================================================================================
-
/*!
Constructor
*/
emit vpCurveChanged();
}
+/*!
+ Sets curve title
+ \param curveKey - curve id
+ \param title - new title
+*/
void Plot2d_ViewFrame::setCurveTitle( int curveKey, const QString& title )
{
if(myPlot) myPlot->setCurveTitle(curveKey, title);
return allPositive;
}
-//=================================================================================
-// Plot2d_Plot2d implementation
-//=================================================================================
/*!
Constructor
*/
*/
}
+/*!
+ \return the default layout behavior of the widget
+*/
QSizePolicy Plot2d_Plot2d::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize Plot2d_Plot2d::sizeHint() const
{
return QwtPlot::minimumSizeHint();
return false;
}
-// TEMPORARY SOLUTION!!! TO BE IMPLEMENTED!!!
+/*!
+ Creates presentation of object
+ Default implementation is empty
+*/
Plot2d_Prs* Plot2d_ViewFrame::CreatePrs( const char* /*entry*/ )
{
return 0;
}
+/*!
+ Copies preferences from other viewframe
+ \param vf - other view frame
+*/
void Plot2d_ViewFrame::copyPreferences( Plot2d_ViewFrame* vf )
{
if( !vf )
setTitle( true, aTables.join("; "), MainTitle, true );
}
+/*!
+ Outputs content of viewframe to file
+ \param file - file name
+ \param format - file format
+*/
bool Plot2d_ViewFrame::print( const QString& file, const QString& format ) const
{
#ifdef WIN32
return res;
#endif
}
+
+/*!
+ \return string with all visual parameters
+*/
+QString Plot2d_ViewFrame::getVisualParameters()
+{
+ double xmin, xmax, ymin, ymax, y2min, y2max;
+ getFitRanges( xmin, xmax, ymin, ymax, y2min, y2max );
+ QString retStr;
+ retStr.sprintf( "%d*%d*%d*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", myXMode,
+ myYMode, mySecondY, xmin, xmax, ymin, ymax, y2min, y2max );
+ return retStr;
+}
+
+/*!
+ Restores all visual parameters from string
+*/
+void Plot2d_ViewFrame::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 9 ) {
+ double xmin, xmax, ymin, ymax, y2min, y2max;
+ myXMode = paramsLst[0].toInt();
+ myYMode = paramsLst[1].toInt();
+ mySecondY = (bool)paramsLst[2].toInt();
+ xmin = paramsLst[3].toDouble();
+ xmax = paramsLst[4].toDouble();
+ ymin = paramsLst[5].toDouble();
+ ymax = paramsLst[6].toDouble();
+ y2min = paramsLst[7].toDouble();
+ y2max = paramsLst[8].toDouble();
+
+ if (mySecondY)
+ setTitle( myY2TitleEnabled, myY2Title, Y2Title, false );
+ setHorScaleMode( myXMode, /*update=*/false );
+ setVerScaleMode( myYMode, /*update=*/false );
+
+ if (mySecondY) {
+ QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.d2() - yMap2.d1();
+ }
+
+ fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
+ fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
+ }
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PLOT2D_VIEWFRAME_H
#define PLOT2D_VIEWFRAME_H
virtual bool print( const QString& file, const QString& format ) const;
+ QString getVisualParameters();
+ void setVisualParameters( const QString& parameters );
+
protected:
int testOperation( const QMouseEvent& );
void readPreferences();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Plot2d_ViewManager.h"
#include "Plot2d_ViewModel.h"
int Plot2d_ViewManager::myMaxId = 0;
+/*!
+ Constructor
+*/
Plot2d_ViewManager::Plot2d_ViewManager( SUIT_Study* study, SUIT_Desktop* desk )
: SUIT_ViewManager( study, desk )
{
setViewModel( v );
}
+/*!
+ Destructor
+*/
Plot2d_ViewManager::~Plot2d_ViewManager()
{
}
+/*!
+ \return corresponding viewer
+*/
Plot2d_Viewer* Plot2d_ViewManager::getPlot2dModel() const
{
return (Plot2d_Viewer*)myViewModel;
}
+/*!
+ Sets default name of view
+ \param the View - view to be renamed
+*/
void Plot2d_ViewManager::setViewName( SUIT_ViewWindow* theView )
{
int aPos = myViews.find(theView);
theView->setCaption( QString( "Plot2d scene:%1 - viewer:%2" ).arg(myId).arg(aPos+1));
}
+/*!
+ Adds new view
+ \param theView - view to be added
+*/
bool Plot2d_ViewManager::insertView( SUIT_ViewWindow* theView )
{
bool res = SUIT_ViewManager::insertView( theView );
return res;
}
+/*!
+ Creates new view
+*/
void Plot2d_ViewManager::createView()
{
createViewWindow();
}
+/*!
+ SLOT: called if action "Clone view" is activated, emits signal cloneView()
+*/
void Plot2d_ViewManager::onCloneView()
{
SUIT_ViewWindow* vw = createViewWindow();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PLOT2D_VIEWMANAGER_H
#define PLOT2D_VIEWMANAGER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Plot2d_ViewModel.cxx: implementation of the Plot2d_ViewModel class.
-//
-//////////////////////////////////////////////////////////////////////
#include "Plot2d_ViewModel.h"
#include "Plot2d_ViewWindow.h"
#include <qpopupmenu.h>
+/*!
+ Constructor
+*/
Plot2d_Viewer::Plot2d_Viewer(bool theAutoDel)
:SUIT_ViewModel()
{
myAutoDel = theAutoDel;
}
+/*!
+ Destructor
+*/
Plot2d_Viewer::~Plot2d_Viewer()
{
if (myPrs)
clearPrs();
}
-//*********************************************************************
+/*!
+ Create new instance of view window on desktop \a theDesktop.
+ \retval SUIT_ViewWindow* - created view window pointer.
+*/
SUIT_ViewWindow* Plot2d_Viewer::createView(SUIT_Desktop* theDesktop)
{
Plot2d_ViewWindow* aPlot2dView = new Plot2d_ViewWindow(theDesktop, this);
return aPlot2dView;
}
-//*********************************************************************
+/*!
+ Adds custom items to popup menu
+ \param thePopup - popup menu
+*/
void Plot2d_Viewer::contextMenuPopup(QPopupMenu* thePopup)
{
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
}
}
-
-//*********************************************************************
+/*!
+ Sets presentation of viewer
+ \param thePrs - new presentation
+*/
void Plot2d_Viewer::setPrs(Plot2d_Prs* thePrs)
{
if (myPrs)
myPrs->setAutoDel(myAutoDel);
}
-//*********************************************************************
+/*!
+ Updates current viewer
+*/
void Plot2d_Viewer::update()
{
SUIT_ViewManager* aMgr = getViewManager();
}
}
-//*********************************************************************
+/*!
+ Clear viewer presentation
+*/
void Plot2d_Viewer::clearPrs()
{
SUIT_ViewManager* aMgr = getViewManager();
myPrs = 0;
}
-//*********************************************************************
+/*!
+ Sets "auto delete" state of of presentation
+ \param theDel - new state
+*/
void Plot2d_Viewer::setAutoDel(bool theDel)
{
myAutoDel = theDel;
myPrs->setAutoDel(theDel);
}
-//*********************************************************************
+/*!
+ SLOT: called when action "Change background" is activated
+*/
void Plot2d_Viewer::onChangeBgColor()
{
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
aViewFrame->onChangeBackground();
}
-//*********************************************************************
+/*!
+ SLOT: called when action "Show toolbar" is activated
+*/
void Plot2d_Viewer::onShowToolbar() {
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
if ( aView )
aView->getToolBar()->show();
}
-//*********************************************************************
+/*!
+ SLOT: called when action "Dump view" is activated
+*/
void Plot2d_Viewer::onDumpView()
{
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
aView->onDumpView();
}
-//*********************************************************************
+/*!
+ SLOT: called when action "Clone view" is activated
+*/
void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* )
{
}
-//*********************************************************************
+
+/*!
+ Sets view manager
+ \param mgr - new view manager
+*/
void Plot2d_Viewer::setViewManager( SUIT_ViewManager* mgr )
{
SUIT_ViewModel::setViewManager( mgr );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#if !defined(_PLOT2D_VIEWMODEL_H)
#define _PLOT2D_VIEWMODEL_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Plot2d_ViewWindow.cxx: implementation of the Plot2d_ViewWindow class.
-//
-//////////////////////////////////////////////////////////////////////
+
#include "Plot2d_ViewWindow.h"
#include "Plot2d_ViewFrame.h"
#include <qpopupmenu.h>
#include <qimage.h>
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
+/*!
+ Constructor
+*/
Plot2d_ViewWindow::Plot2d_ViewWindow(SUIT_Desktop* theDesktop, Plot2d_Viewer* theModel)
: SUIT_ViewWindow(theDesktop)
{
}
+/*!
+ Destructor
+*/
Plot2d_ViewWindow::~Plot2d_ViewWindow()
{
}
-//****************************************************************
+/*!
+ Puts message to status bar
+ \param theMsg - message text
+*/
void Plot2d_ViewWindow::putInfo(QString theMsg)
{
QStatusBar* aStatusBar = myDesktop->statusBar();
aStatusBar->message(theMsg/*, 3000*/);
}
-//****************************************************************
+/*!
+ Fills popup menu with custom actions
+ \param popup - popup menu to be filled with
+*/
void Plot2d_ViewWindow::contextMenuPopup( QPopupMenu* thePopup )
{
// scaling
myActionsMap[ CurvSettingsId ]->addTo(thePopup);
}
-//****************************************************************
+/*!
+ Custom event filter
+*/
bool Plot2d_ViewWindow::eventFilter(QObject* watched, QEvent* e)
{
if (watched == myViewFrame) {
return SUIT_ViewWindow::eventFilter(watched, e);
}
-//****************************************************************
+/*!
+ Create actions for Plot2d view window
+*/
void Plot2d_ViewWindow::createActions()
{
if ( !myActionsMap.isEmpty() )
}
-//****************************************************************
+/*!
+ Create toolbar for Plot2d view window
+*/
void Plot2d_ViewWindow::createToolBar()
{
myActionsMap[DumpId]->addTo(myToolBar);
onChangeLegendMode();
}
-//****************************************************************
+/*!
+ SLOT: called if scale mode for horizontal axis is changed
+*/
void Plot2d_ViewWindow::onChangeHorMode()
{
bool aLinear = myViewFrame->isModeHorLinear();
myActionsMap[GlobalPanId]->setEnabled( myViewFrame->isModeVerLinear() && myViewFrame->isModeHorLinear() );
}
-//****************************************************************
+/*!
+ SLOT: called if scale mode for vertical axis is changed
+*/
void Plot2d_ViewWindow::onChangeVerMode()
{
bool aLinear = myViewFrame->isModeVerLinear();
myActionsMap[GlobalPanId]->setEnabled( myViewFrame->isModeVerLinear() && myViewFrame->isModeHorLinear() );
}
-//****************************************************************
+/*!
+ SLOT: called if curve type is changed
+*/
void Plot2d_ViewWindow::onChangeCurveMode()
{
int aCurveType = myViewFrame->getCurveType();
myActionsMap[CurvSplinesId]->setOn(aCurveType == 2);
}
-//****************************************************************
+/*!
+ SLOT: called if legend mode is changed
+*/
void Plot2d_ViewWindow::onChangeLegendMode()
{
myActionsMap[ LegendId ]->setOn(myViewFrame->isLegendShow());
}
-//****************************************************************
+/*!
+ SLOT: called if action "Fit all" is activated
+*/
void Plot2d_ViewWindow::onFitAll()
{
myViewFrame->onViewFitAll();
}
-//****************************************************************
+/*!
+ SLOT: called if action "Fit rect" is activated
+*/
void Plot2d_ViewWindow::onFitRect()
{
myViewFrame->onViewFitArea();
}
-//****************************************************************
+/*!
+ SLOT: called if action "Zoom" is activated
+*/
void Plot2d_ViewWindow::onZoom()
{
myViewFrame->onViewZoom();
}
-//****************************************************************
+/*!
+ SLOT: called if action "Panning" is activated
+*/
void Plot2d_ViewWindow::onPanning()
{
myViewFrame->onViewPan();
}
-//****************************************************************
+/*!
+ SLOT: called if action "Global panning" is activated
+*/
void Plot2d_ViewWindow::onGlobalPanning()
{
myViewFrame->onViewGlobalPan();
}
-//****************************************************************
+/*!
+ SLOT: called if action of scale mode for horizontal axis changing is activated
+*/
void Plot2d_ViewWindow::onViewHorMode()
{
if (myViewFrame->isModeHorLinear())
myViewFrame->setHorScaleMode(0);
}
-//****************************************************************
+/*!
+ SLOT: called if action of scale mode for vertical axis changing is activated
+*/
void Plot2d_ViewWindow::onViewVerMode()
{
if (myViewFrame->isModeVerLinear())
myViewFrame->setVerScaleMode(0);
}
-//****************************************************************
+/*!
+ SLOT: called if action "Show legend" is activated
+*/
void Plot2d_ViewWindow::onLegend()
{
myViewFrame->showLegend(!myViewFrame->isLegendShow());
onChangeLegendMode();
}
-//****************************************************************
+/*!
+ SLOT: called if action "Change curve type" is activated
+*/
void Plot2d_ViewWindow::onCurves()
{
QtxAction* aSender = (QtxAction*) sender();
myViewFrame->setCurveType(2);
}
-//****************************************************************
+/*!
+ SLOT: called if action "Dump view" is activated
+*/
void Plot2d_ViewWindow::onDumpView()
{
qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ), TRUE ) );
SUIT_ViewWindow::onDumpView();
}
-//****************************************************************
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage Plot2d_ViewWindow::dumpView()
{
QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
return px.convertToImage();
}
-bool Plot2d_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& format )
+/*!
+ Saves scene rendering in window to file
+ \param fileName - name of file
+ \param format - string contains name of format (for example, "BMP"(default) or "JPEG", "JPG")
+*/
+bool Plot2d_ViewWindow::dumpViewToFormat( const QImage& img, const QString& fileName, const QString& format )
{
bool res = myViewFrame ? myViewFrame->print( fileName, format ) : false;
if( !res )
- res = SUIT_ViewWindow::dumpViewToFormat( fileName, format );
+ res = SUIT_ViewWindow::dumpViewToFormat( img, fileName, format );
return res;
}
+/*!
+ \return filter of image files
+*/
QString Plot2d_ViewWindow::filter() const
{
return SUIT_ViewWindow::filter() + ";;" + tr( "POSTSCRIPT_FILES" );
}
+
+/*!
+ \return the visual parameters of this view as a formated string
+ */
+QString Plot2d_ViewWindow::getVisualParameters()
+{
+ return myViewFrame->getVisualParameters();
+}
+
+/*!
+ The method restors visual parameters of this view from a formated string
+*/
+void Plot2d_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ myViewFrame->setVisualParameters( parameters );
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PLOT2D_VIEWWINDOW_H
#define PLOT2D_VIEWWINDOW_H
QToolBar* getToolBar() { return myToolBar; };
void contextMenuPopup( QPopupMenu* thePopup );
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
+
protected:
virtual QImage dumpView();
virtual QString filter() const;
- virtual bool dumpViewToFormat( const QString& fileName, const QString& format );
+ virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
private:
bool eventFilter(QObject* watched, QEvent* e);
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
msgid "ERROR"
msgstr "Error"
-msgid "BUT_OK"
-msgstr "Ok"
-
#-------------------------------------
# Plot2d_SetupViewDlg
# ------------------------------------
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# source path
top_srcdir=@top_srcdir@
top_builddir=../..
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: SALOME_Prs.cxx
// Created: Wed Apr 28 15:03:43 2004
//using namespace std;
-//===========================================================
/*!
- * Function: SALOME_OCCPrs::DisplayIn \n
- * Purpose: Dispatches display operation to proper Display() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches display operation to proper Display() method of SALOME_View
+*/
void SALOME_OCCPrs::DisplayIn( SALOME_View* v ) const
{
if ( v ) v->Display( this );
}
-//===========================================================
/*!
- * Function: SALOME_OCCPrs::EraseIn \n
- * Purpose: Dispatches display operation to proper Erase() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches display operation to proper Erase() method of SALOME_View
+*/
void SALOME_OCCPrs::EraseIn( SALOME_View* v, const bool forced ) const
{
if ( v ) v->Erase( this, forced );
}
-//===========================================================
/*!
- * Function: SALOME_OCCPrs::LocalSelectionIn \n
- * Purpose: Dispatches operation to proper LocalSelectionIn() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
{
if ( v ) v->LocalSelection( this, mode );
}
-//===========================================================
/*!
- * Function: SALOME_OCCPrs::Update \n
- * Purpose: Dispatches update operation to proper Update() \n
- * method of SALOME_Displayer
- */
-//===========================================================
+ Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
void SALOME_OCCPrs::Update( SALOME_Displayer* d )
{
if ( d ) d->Update( this );
}
-//===========================================================
/*!
- * Function: SALOME_VTKPrs::DisplayIn \n
- * Purpose: Dispatches display operation to proper Display() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches display operation to proper Display() method of SALOME_View
+*/
void SALOME_VTKPrs::DisplayIn( SALOME_View* v ) const
{
if ( v ) v->Display( this );
}
-//===========================================================
/*!
- * Function: SALOME_VTKPrs::EraseIn \n
- * Purpose: Dispatches display operation to proper Erase() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches display operation to proper Erase() method of SALOME_View
+*/
void SALOME_VTKPrs::EraseIn( SALOME_View* v, const bool forced ) const
{
if ( v ) v->Erase( this, forced );
}
-//===========================================================
/*!
- * Function: SALOME_VTKPrs::LocalSelectionIn \n
- * Purpose: Dispatches operation to proper LocalSelectionIn() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
void SALOME_VTKPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
{
if ( v ) v->LocalSelection( this, mode );
}
-//===========================================================
/*!
- * Function: SALOME_VTKPrs::Update \n
- * Purpose: Dispatches update operation to proper Update() \n
- * method of SALOME_Displayer
- */
-//===========================================================
+ Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
void SALOME_VTKPrs::Update( SALOME_Displayer* d )
{
if ( d ) d->Update( this );
}
-//===========================================================
/*!
- * Function: SALOME_Prs2d::DisplayIn \n
- * Purpose: Dispatches display operation to proper Display() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches display operation to proper Display() method of SALOME_View
+*/
void SALOME_Prs2d::DisplayIn( SALOME_View* v ) const
{
if ( v ) v->Display( this );
}
-//===========================================================
/*!
- * Function: SALOME_Prs2d::EraseIn \n
- * Purpose: Dispatches display operation to proper Erase() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches display operation to proper Erase() method of SALOME_View
+*/
void SALOME_Prs2d::EraseIn( SALOME_View* v, const bool forced ) const
{
if ( v ) v->Erase( this, forced );
}
-//===========================================================
/*!
- * Function: SALOME_Prs2d::LocalSelectionIn \n
- * Purpose: Dispatches operation to proper LocalSelectionIn() \n
- * method of SALOME_View
- */
-//===========================================================
+ Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
void SALOME_Prs2d::LocalSelectionIn( SALOME_View* v, const int mode ) const
{
if ( v ) v->LocalSelection( this, mode );
}
-//===========================================================
/*!
- * Function: SALOME_Prs2d::Update \n
- * Purpose: Dispatches update operation to proper Update() \n
- * method of SALOME_Displayer
- */
-//===========================================================
+ Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
void SALOME_Prs2d::Update( SALOME_Displayer* d )
{
if ( d ) d->Update( this );
}
-//===========================================================
/*!
- * Function: SALOME_View::Display \n
- * Purpose: Gives control to SALOME_Prs object, so that \n
- * it could perform double dispatch
- */
-//===========================================================
+ Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
void SALOME_View::Display( const SALOME_Prs* prs )
{
prs->DisplayIn( this );
}
-//===========================================================
/*!
- * Function: SALOME_View::Erase \n
- * Purpose: Gives control to SALOME_Prs object, so that \n
- * it could perform double dispatch
- */
-//===========================================================
+ Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
void SALOME_View::Erase( const SALOME_Prs* prs, const bool forced )
{
prs->EraseIn( this, forced );
}
-//===========================================================
/*!
- * Function: SALOME_View::LocalSelection \n
- * Purpose: Gives control to SALOME_Prs object, so that \n
- * it could perform double dispatch
- */
-//===========================================================
+ Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
{
prs->LocalSelectionIn( this, mode );
}
-//===========================================================
/*!
- * Function: SALOME_View::Display \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::Display( const SALOME_OCCPrs* )
{
// MESSAGE( "SALOME_View::Display( const SALOME_OCCPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::Display \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::Display( const SALOME_VTKPrs* )
{
// MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::Display \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::Display( const SALOME_Prs2d* )
{
// MESSAGE( "SALOME_View::Display( const SALOME_Prs2d& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::Erase \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::Erase( const SALOME_OCCPrs*, const bool )
{
// MESSAGE( "SALOME_View::Erase( const SALOME_OCCPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::Erase \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
{
// MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::Erase \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
{
// MESSAGE( "SALOME_View::Erase( const SALOME_Prs2d& ) called! Probably, presentation is being erased in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::EraseAll \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::EraseAll( const bool )
{
// MESSAGE( "SALOME_View::EraseAll() called!" );
}
-//===========================================================
/*!
- * Function: SALOME_View::LocalSelection \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
{
// MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called! \
// Probably, selection is being activated in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::LocalSelection \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
{
// MESSAGE( "SALOME_View::LocalSelection( const SALOME_VTKPrs* ) called! \
// Probably, selection is being activated in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::LocalSelection \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::LocalSelection( const SALOME_Prs2d*, const int )
{
// MESSAGE( "SALOME_View::LocalSelection( const SALOME_Prs2d* ) called! \
// Probably, selection is being activated in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_View::GlobalSelection \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_View::GlobalSelection( const bool ) const
{
// MESSAGE( "SALOME_View::GlobalSelection() called! \
// Probably, selection is being activated in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_Displayer::UpdatePrs \n
- * Purpose: Gives control to SALOME_Prs object, so that \n
- * it could perform double dispatch
- */
-//===========================================================
+ Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
void SALOME_Displayer::UpdatePrs( SALOME_Prs* prs )
{
prs->Update( this );
}
-//===========================================================
/*!
- * Function: SALOME_Displayer::Update \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_Displayer::Update( SALOME_OCCPrs* )
{
// MESSAGE( "SALOME_Displayer::Update( SALOME_OCCPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_Displayer::Update \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_Displayer::Update( SALOME_VTKPrs* )
{
// MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
}
-//===========================================================
/*!
- * Function: SALOME_Displayer::Update \n
- * Purpose: Virtual method, should be reimplemented in successors, \n
- * by default issues a warning and does nothing.
- */
-//===========================================================
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
void SALOME_Displayer::Update( SALOME_Prs2d* )
{
// MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOME_PRS_H
#define SALOME_PRS_H
class SALOME_Displayer;
class Handle_SALOME_InteractiveObject;
-//===========================================================
/*!
- * Class: SALOME_Prs \n
- * Description: Base class for SALOME graphic object wrappers - presentations.\n
- * Presentations are temporary objects, so they can be created on the stack.
- */
-//===========================================================
+ \class SALOME_Prs
+ Base class for SALOME graphic object wrappers - presentations.
+ Presentations are temporary objects, so they can be created on the stack.
+*/
class PRS_EXPORT SALOME_Prs
{
virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
};
-//===========================================================
/*!
- * Class: SALOME_OCCPrs \n
- * Description: Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.\n
- * This intermediate class is necessary to avoid dependencies from OCC libs.
- */
-//===========================================================
+ \class SALOME_OCCPrs
+ Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.
+ This intermediate class is necessary to avoid dependencies from OCC libs.
+*/
class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
{
virtual void LocalSelectionIn( SALOME_View*, const int ) const;
};
-//===========================================================
/*!
- * Class: SALOME_VTKPrs \n
- * Description: Base class for VTK graphic object (vtkActor) wrappers \n
- * This intermediate class is necessary to avoid dependencies from VTK libs.
- */
-//===========================================================
+ \class SALOME_VTKPrs
+ Base class for VTK graphic object (vtkActor) wrappers.
+ This intermediate class is necessary to avoid dependencies from VTK libs.
+*/
class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
{
public:
virtual void LocalSelectionIn( SALOME_View*, const int ) const;
};
-//===========================================================
/*!
- * Class: SALOME_Prs2d \n
- * Description: Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
- */
-//===========================================================
-
+ \class SALOME_Prs2d
+ Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
+*/
class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
{
public:
virtual void LocalSelectionIn( SALOME_View*, const int ) const;
};
-/////////////////////////////////////////////////////////////////////////
-// Base classes for object wrappers for any other visualization libraries
-// should be added here!
-/////////////////////////////////////////////////////////////////////////
-
-//===========================================================
/*!
- * Class: SALOME_View \n
- * Description: Base class for SALOME views (or view frames)
- */
-//===========================================================
-
+ Base classes for object wrappers for any other visualization libraries should be added here!
+*/
+/*!
+ \class SALOME_View
+ Base class for SALOME views (or view frames)
+*/
class PRS_EXPORT SALOME_View
{
public:
virtual void Repaint() {} //!< Null body here.
};
-//===========================================================
-/*
- * Classes: SALOME_Displayer
- * Description: These classes are used to specify type of view
- * VTK, OCC or Plot2d
- */
-//===========================================================
+/*!
+ \class SALOME_Displayer
+ These classes are used to specify type of view VTK, OCC or Plot2d
+*/
class PRS_EXPORT SALOME_OCCViewType {};
class PRS_EXPORT SALOME_VTKViewType {};
class PRS_EXPORT SALOME_Plot2dViewType {};
-//===========================================================
/*!
- * Class: SALOME_Displayer \n
- * Description: Base class for SALOME displayers
- */
-//===========================================================
-
+ \class SALOME_Displayer
+ Base class for SALOME displayers
+*/
class PRS_EXPORT SALOME_Displayer
{
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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#if !defined ( _PYINTERP_H )
#define _PYINTERP_H
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : PyInterp_Dispatcher.cxx
// Author : Sergey ANIKIN, OCC
PyInterp_Dispatcher* PyInterp_Dispatcher::myInstance = 0;
-//////////////////////////////////////////////////////////
-// class : PyInterp_Request
-//////////////////////////////////////////////////////////
-
void PyInterp_Request::process()
{
safeExecute();
}
}
-//////////////////////////////////////////////////////////
-// class : PyInterp_Event
-//////////////////////////////////////////////////////////
-
PyInterp_Event::~PyInterp_Event()
{
PyInterp_Request::Destroy( myRequest );
myRequest = 0;
}
-//////////////////////////////////////////////////////////
-// class : PyInterp_Dispatcher
-//////////////////////////////////////////////////////////
-
PyInterp_Dispatcher* PyInterp_Dispatcher::Get()
{
if ( !myInstance )
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : PyInterp_Dispatcher.h
// Author : Sergey Anikin, OCC
// Module : SALOME
-// $Header$
#ifndef _PYINTERP_DISPATCHER_H_
#define _PYINTERP_DISPATCHER_H_
class PyInterp_Watcher;
class PyInterp_Dispatcher;
-//////////////////////////////////////////////////////////
-// class : PyInterp_Request
-//////////////////////////////////////////////////////////
class PYINTERP_EXPORT PyInterp_Request
{
friend class PyInterp_Dispatcher;
PyInterp_base* myInterp;
};
-//////////////////////////////////////////////////////////
-// class : PyInterp_Event
-//////////////////////////////////////////////////////////
class PYINTERP_EXPORT PyInterp_Event : public QCustomEvent
{
PyInterp_Event();
PyInterp_Request* myRequest;
};
-//////////////////////////////////////////////////////////
-// class : PyInterp_Dispatcher
-//////////////////////////////////////////////////////////
class PYINTERP_EXPORT PyInterp_Dispatcher : protected QThread
{
PyInterp_Dispatcher(); // private constructor
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _PYINTERP_WATCHER_H_
#define _PYINTERP_WATCHER_H_
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : PyInterp_base.cxx
// Author : Christian CAREMOLI, Paul RASCLE, EDF
// Create cStringIO to capture stdout and stderr
PycString_IMPORT;
- _vout = PycStringIO->NewOutput(128);
- _verr = PycStringIO->NewOutput(128);
+ if (PycStringIO) { // CTH11627 : additional check
+ _vout = PycStringIO->NewOutput(128);
+ _verr = PycStringIO->NewOutput(128);
+ }
// All the initRun outputs are redirected to the standard output (console)
initRun();
_atFirst = false;
return ret;
}
- ret = simpleRun("salome.salome_init()");
+ ret = simpleRun("salome.salome_init(0,1)");
if (ret) {
_atFirst = false;
return ret;
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : PyInterp_base.h
// Author : Christian CAREMOLI, Paul RASCLE, EDF
// Module : SALOME
-// $Header$
#ifndef _PYINTERP_BASE_H_
#define _PYINTERP_BASE_H_
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : PythonConsole
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#if !defined ( _PYTHONCONSOLE_H )
#define _PYTHONCONSOLE_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "PythonConsole_PyConsole.h"
#include "PythonConsole_PyEditor.h"
using namespace std;
-//****************************************************************
+/*!
+ Constructor
+*/
PythonConsole::PythonConsole(QWidget* parent, PyInterp_base* interp)
: QWidget(parent), myEditor( 0 )
{
lay->addWidget( myEditor );
}
-//****************************************************************
+/*!
+ Destructor
+*/
PythonConsole::~PythonConsole()
{
}
-//****************************************************************
+/*!
+ Executes command
+ \param command - string with command and arguments
+*/
void PythonConsole::exec( const QString& command )
{
if ( myEditor )
myEditor->exec( command );
}
-//****************************************************************
+/*!
+ Changes font of python console
+ \param f - new font
+*/
void PythonConsole::setFont( const QFont& f )
{
if( myEditor )
myEditor->setFont( f );
}
-//****************************************************************
+/*!
+ \return font of python console
+*/
QFont PythonConsole::font() const
{
QFont res;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef PythonConsole_PyConsole_H
#define PythonConsole_PyConsole_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
PyInterp_Dispatcher::Get()->Exec( new ExecCommand( myInterp, _buf.latin1(), this ) );
}
-/*
+/*!
Processes drop event: paste dragged text
*/
void PythonConsole_PyEditor::contentsDropEvent( QDropEvent* event )
}
}
-/*
+/*!
Processes middle button release event - paste clipboard's contents
*/
void PythonConsole_PyEditor::contentsMouseReleaseEvent( QMouseEvent* event )
}
}
+/*!
+ Creates popup menu
+*/
QPopupMenu* PythonConsole_PyEditor::createPopupMenu( const QPoint& pos )
{
QPopupMenu* popup = QTextEdit::createPopupMenu( pos );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
{
}
+/*!
+ Destructor
+*/
PythonConsole_PyInterp::~PythonConsole_PyInterp()
{
}
return true;
}
-
+/*!
+ The GIL is assumed to be held
+ It is the caller responsability caller to acquire the GIL
+ It will still be held on initContext output
+*/
bool PythonConsole_PyInterp::initContext()
{
- /*
- * The GIL is assumed to be held
- * It is the caller responsability caller to acquire the GIL
- * It will still be held on initContext output
- */
PyObject *m = PyImport_AddModule("__main__"); // interpreter main module (module context)
if(!m){
// if(MYDEBUG) MESSAGE("problem...");
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Alexander SOLOVYOV (OCN)
# Module : QDS
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS.h"
#include "QDS_Datum.h"
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_H
#define QDS_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_CheckBox.h"
#include <qcheckbox.h>
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_CHECKBOX_H
#define QDS_CHECKBOX_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_ComboBox.h"
#include <DDS_Dictionary.h>
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_COMBOBOX_H
#define QDS_COMBOBOX_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_Datum.h"
#include "QDS_Validator.h"
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_DATUM_H
#define QDS_DATUM_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_LineEdit.h"
#include <qlineedit.h>
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_LINEEDIT_H
#define QDS_LINEEDIT_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_RadioBox.h"
#include <DDS_Dictionary.h>
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_RADIOBOX_H
#define QDS_RADIOBOX_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_SpinBox.h"
#include <QtxIntSpinBox.h>
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_SPINBOX_H
#define QDS_SPINBOX_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_SpinBoxDbl.h"
#include <DDS_Dictionary.h>
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_PINBOXDBL_H
#define QDS_PINBOXDBL_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_TextEdit.h"
#include <qtextedit.h>
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_TEXTEEDIT_H
#define QDS_TEXTEEDIT_H
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "QDS_Validator.h"
/*!
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef QDS_VALIDATOR_H
#define QDS_VALIDATOR_H
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
-# File : Makefile.in\r# Author : Vladimir Klyachin (OCN)
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# File : Makefile.in
+# Author : Vladimir Klyachin (OCN)
# Module : suit
# $Header$
QtxResourceEdit.h \
QtxListView.h \
QtxDirListEditor.h \
- QtxDblValidator.h
+ QtxDblValidator.h \
+ QtxSplash.h
# .po files to transform in .qm
QtxWorkstack.cxx \
QtxListView.cxx \
QtxDirListEditor.cxx \
- QtxDblValidator.cxx
+ QtxDblValidator.cxx \
+ QtxSplash.cxx
LIB_MOC = \
QtxAction.h \
QtxListView.h \
QtxListResourceEdit.h \
QtxDirListEditor.h \
- QtxDblValidator.h
+ QtxDblValidator.h \
+ QtxSplash.h
RESOURCES_FILES = \
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: Qtx.cxx
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: Qtx.h
// Author: Sergey TELKOV
typedef QValueList<short> QShortList;
typedef QValueList<double> QDoubleList;
+/*!
+ \class Qtx
+ \brief Set of auxiliary static methods
+*/
class QTX_EXPORT Qtx : public Qt
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxAction.cxx
// Author: Sergey TELKOV
#include "QtxAction.h"
#include <qpopupmenu.h>
+#include <qmenubar.h>
/*!
Name: QtxAction [public]
*/
QtxAction::QtxAction( QObject* parent, const char* name, bool toggle )
-: QAction( parent, name, toggle )
+ : QAction( parent, name, toggle )
{
}
QtxAction::QtxAction( const QString& text, const QIconSet& icon,
const QString& menuText, int accel,
QObject* parent, const char* name, bool toggle )
-: QAction( text, icon, menuText, accel, parent, name, toggle )
+ : QAction( text, icon, menuText, accel, parent, name, toggle )
{
}
QtxAction::QtxAction( const QString& text, const QString& menuText, int accel,
QObject* parent, const char* name, bool toggle )
-: QAction( text, menuText, accel, parent, name, toggle )
+ : QAction( text, menuText, accel, parent, name, toggle )
{
}
bool QtxAction::addTo( QWidget* w )
{
+ if ( w->inherits( "QMenuBar" ) ) {
+ // --- Add action to the QMenuBar ---
+ // n.b. currently for the actions inserted to the menu bar
+ // the following properties are not supported:
+ // * tooltips
+ // * what's this info
+ // * toggle mode
+ QMenuBar* mb = (QMenuBar*)w;
+ if ( myMenuIds.find( w ) != myMenuIds.end() )
+ return false; // already added
+ if ( name() == "qt_separator_action" ) // separator
+ myMenuIds[ w ] = mb->insertSeparator();
+ else if ( iconSet().isNull() ) // has no icon
+ myMenuIds[ w ] = mb->insertItem( menuText(), this, SIGNAL( activated() ), accel() );
+ else // has icon
+ myMenuIds[ w ] = mb->insertItem( iconSet(), menuText(), this, SIGNAL( activated() ), accel() );
+ mb->setItemEnabled( myMenuIds[ w ], isEnabled() );
+ mb->setItemVisible( myMenuIds[ w ], isVisible() );
+ return true;
+ }
return QAction::addTo( w );
}
if ( !addTo( w ) )
return false;
- if ( w->inherits( "QPopupMenu" ) )
- {
+ if ( w->inherits( "QPopupMenu" ) ) {
+ // --- Add action to the QPopupMenu ---
QPopupMenu* popup = (QPopupMenu*)w;
- if ( index < (int)popup->count() - 1 )
- {
+ if ( index >= 0 && index < (int)popup->count() - 1 ) {
int id = popup->idAt( popup->count() - 1 );
- if ( id != -1 )
- {
- QMenuItem* item = popup->findItem( id );
- if ( item && item->isSeparator() )
- {
- popup->removeItem( id );
- popup->insertSeparator( index );
- }
- else
- {
- QPopupMenu* p = item ? item->popup() : 0;
- int accel = popup->accel( id );
- bool isOn = popup->isItemEnabled( id );
- QString text = popup->text( id );
- QIconSet icon;
- if ( popup->iconSet( id ) )
- icon = *popup->iconSet( id );
- popup->removeItem( id );
- int pos;
- if ( icon.isNull() )
- if ( p )
- pos = popup->indexOf( popup->insertItem( text, p, id, index ) );
- else
- pos = popup->indexOf( popup->insertItem( text, id, index ) );
- else
- if ( p )
- pos = popup->indexOf( popup->insertItem( icon, text, p, id, index ) );
- else
- pos = popup->indexOf( popup->insertItem( icon, text, p, id, index ) );
- popup->setId( pos, id );
- popup->setAccel( accel, id );
- popup->setItemEnabled( id, isOn );
- if ( !p )
- popup->connectItem( id, this, SLOT( internalActivation() ) );
- }
+ if ( id != -1 ) {
+ QMenuItem* item = popup->findItem( id );
+ if ( item && item->isSeparator() ) {
+ popup->removeItem( id );
+ popup->insertSeparator( index );
+ }
+ else {
+ QPopupMenu* p = item ? item->popup() : 0;
+ int accel = popup->accel( id );
+ bool isOn = popup->isItemEnabled( id );
+ bool isVisible = popup->isItemVisible( id );
+ bool isChecked = popup->isItemChecked( id );
+ QString text = popup->text( id );
+ QIconSet icon;
+ if ( popup->iconSet( id ) )
+ icon = *popup->iconSet( id );
+ popup->removeItem( id );
+ int pos;
+ if ( icon.isNull() )
+ if ( p )
+ pos = popup->indexOf( popup->insertItem( text, p, id, index ) );
+ else
+ pos = popup->indexOf( popup->insertItem( text, id, index ) );
+ else
+ if ( p )
+ pos = popup->indexOf( popup->insertItem( icon, text, p, id, index ) );
+ else
+ pos = popup->indexOf( popup->insertItem( icon, text, p, id, index ) );
+ popup->setId( pos, id );
+ popup->setAccel( accel, id );
+ popup->setItemEnabled( id, isOn );
+ popup->setItemVisible( id, isVisible );
+ popup->setItemChecked( id, isChecked );
+ if ( !whatsThis().isEmpty() )
+ popup->setWhatsThis( id, whatsThis() );
+ if ( !p )
+ popup->connectItem( id, this, SLOT( internalActivation() ) );
+ }
+ }
+ }
+ }
+ else if ( w->inherits( "QMenuBar" ) ) {
+ // --- Add action to the QMenuBar ---
+ QMenuBar* mb = (QMenuBar*)w;
+ if ( index >= 0 && index < (int)mb->count() - 1 ) {
+ int id = mb->idAt( mb->count() - 1 );
+ if ( id != -1 ) {
+ QMenuItem* item = mb->findItem( id );
+ if ( item && item->isSeparator() ) {
+ mb->removeItem( id );
+ mb->insertSeparator( index );
+ }
+ else {
+ QPopupMenu* p = item ? item->popup() : 0;
+ int accel = mb->accel( id );
+ bool isOn = mb->isItemEnabled( id );
+ bool isVisible = mb->isItemVisible( id );
+ QString text = mb->text( id );
+ QIconSet icon;
+ if ( mb->iconSet( id ) )
+ icon = *mb->iconSet( id );
+ mb->removeItem( id );
+ int pos;
+ if ( icon.isNull() )
+ if ( p )
+ pos = mb->indexOf( mb->insertItem( text, p, id, index ) );
+ else
+ pos = mb->indexOf( mb->insertItem( text, id, index ) );
+ else
+ if ( p )
+ pos = mb->indexOf( mb->insertItem( icon, text, p, id, index ) );
+ else
+ pos = mb->indexOf( mb->insertItem( icon, text, p, id, index ) );
+ mb->setId( pos, id );
+ mb->setAccel( accel, id );
+ mb->setItemEnabled( id, isOn );
+ mb->setItemVisible( id, isVisible );
+ if ( !p )
+ mb->connectItem( id, this, SIGNAL( activated() ) );
+ }
}
}
}
-
return true;
}
+/*!
+ Name: removeFrom [virtual public]
+ Desc: Removes this action from widget. Returns true if the action was removed
+ successfully and false otherwise.
+*/
+
+bool QtxAction::removeFrom( QWidget* w )
+{
+ // check if widget is QMenuBar
+ if ( w->inherits( "QMenuBar" ) ) {
+ QMenuBar* mb = (QMenuBar*)w;
+ if ( myMenuIds.find( w ) == myMenuIds.end() )
+ return false; // not yet added
+ mb->removeItem( myMenuIds[ w ] );
+ myMenuIds.remove( w );
+ return true;
+ }
+ return QAction::removeFrom( w );
+}
+
/*!
Name: setPopup [virtual public]
Desc: Set or unset the sub popup menu for item with specified id in the given popup.
*/
-void QtxAction::setPopup( QPopupMenu* popup, const int id, QPopupMenu* subPopup ) const
+void QtxAction::setPopup( QWidget* w, const int id, QPopupMenu* subPopup ) const
{
- if ( !popup )
+ if ( !w )
return;
+ if ( !w->inherits( "QPopupMenu" ) && !w->inherits( "QMenuBar" ) )
+ return; // unsupported widget type
+
QMenuData* md = 0;
- const QMenuData* pmd = popup;
- QMenuItem* item = popup->findItem( id, &md );
+ QMenuData* pmd = dynamic_cast<QMenuData*>( w );
+ if ( !pmd )
+ return; // bad widget
+
+ QMenuItem* item = pmd->findItem( id, &md );
if ( !item || md != pmd )
- return;
+ return; // item is not found
QPopupMenu* oldPopup = item->popup();
if ( oldPopup == subPopup )
- return;
+ return; // popup is not changed
- int accel = popup->accel( id );
- bool isOn = popup->isItemEnabled( id );
- QString text = popup->text( id );
+ // get properties
+ int accel = pmd->accel( id );
+ bool isOn = pmd->isItemEnabled( id );
+ bool isVisible = pmd->isItemVisible( id );
+ int pos = pmd->indexOf( id );
+ QString text = pmd->text( id );
QIconSet icon;
- if ( popup->iconSet( id ) )
- icon = *popup->iconSet( id );
- popup->removeItem( id );
+ if ( pmd->iconSet( id ) )
+ icon = *pmd->iconSet( id );
- int pos;
- if ( icon.isNull() )
- pos = popup->indexOf( subPopup ? popup->insertItem( text, subPopup ) : popup->insertItem( text ) );
- else
- pos = popup->indexOf( subPopup ? popup->insertItem( icon, text, subPopup ) : popup->insertItem( icon, text ) );
+ // remove previous item
+ pmd->removeItem( id );
- popup->setId( pos, id );
- popup->setAccel( accel, id );
- popup->setItemEnabled( id, isOn );
+ // add new item
+ if ( w->inherits( "QPopupMenu" ) ) {
+ // --- QPopupMenu ---
+ QPopupMenu* popup = (QPopupMenu*)w;
+ if ( icon.isNull() )
+ pos = popup->indexOf( subPopup ? popup->insertItem( text, subPopup, id, pos ) :
+ popup->insertItem( text, id, pos ) );
+ else
+ pos = popup->indexOf( subPopup ? popup->insertItem( icon, text, subPopup, id, pos ) :
+ popup->insertItem( icon, text, id, pos ) );
+ }
+ else {
+ // --- QMenuBar ---
+ QMenuBar* mb = (QMenuBar*)w;
+ if ( icon.isNull() )
+ pos = mb->indexOf( subPopup ? mb->insertItem( text, subPopup, id, pos ) :
+ mb->insertItem( text, id, pos ) );
+ else
+ pos = mb->indexOf( subPopup ? mb->insertItem( icon, text, subPopup, id, pos ) :
+ mb->insertItem( icon, text, id, pos ) );
+ }
+ // restore properties
+ pmd->setId( pos, id ); // for sure (if id < 0)
+ pmd->setAccel( accel, id );
+ pmd->setItemEnabled( id, isOn );
+ pmd->setItemVisible( id, isVisible );
+
+ // delete old popup
delete oldPopup;
}
+
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxAction.hxx
// Author: Sergey TELKOV
#include "Qtx.h"
#include <qaction.h>
+#include <qmap.h>
class QTX_EXPORT QtxAction : public QAction
{
virtual bool addTo( QWidget* );
virtual bool addTo( QWidget*, const int );
+ virtual bool removeFrom( QWidget* );
protected:
- void setPopup( QPopupMenu*, const int, QPopupMenu* ) const;
+ void setPopup( QWidget*, const int, QPopupMenu* ) const;
+
+private:
+ QMap<QWidget*,int> myMenuIds;
};
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxActionMenuMgr.cxx
// Author: Alexander SOLOVYEV, Sergey TELKOV
#include <qmainwindow.h>
#include <qfile.h>
#include <qdom.h>
+#include <qvaluelist.h>
+
+// VSR: Uncomment this #define in order to allow dynamic menus support
+// (emit signals when popup menu is pre-activated)
+// Currently this support is disabled.
+//#define ENABLE_DYNAMIC_MENU
+
+/*!
+ Service functions
+ Level: Internal
+*/
+namespace {
+ QValueList<int> prepareIds( const QWidget* w )
+ {
+ QValueList<int> l;
+ const QMenuData* md = 0;
+ if ( w->inherits( "QMenuBar" ) )
+ md = dynamic_cast<const QMenuData*>( w );
+ else if ( w->inherits( "QPopupMenu" ) )
+ md = dynamic_cast<const QMenuData*>( w );
+ if ( md ) {
+ for ( int i=0; i < md->count(); i++ )
+ l.append( md->idAt( i ) );
+ }
+ return l;
+ }
+
+ int getNewId( const QWidget* w, const QValueList<int>& l, bool retId = true )
+ {
+ const QMenuData* md = 0;
+ if ( w->inherits( "QMenuBar" ) )
+ md = dynamic_cast<const QMenuData*>( w );
+ else if ( w->inherits( "QPopupMenu" ) )
+ md = dynamic_cast<const QMenuData*>( w );
+ if ( md ) {
+ for ( int i=0, j=0; i < md->count() && j < l.count(); i++, j++ )
+ if ( md->idAt( i ) != l[ j ] ) return retId ? md->idAt( i ) : i;
+ if ( md->count() > l.count() ) return retId ? md->idAt( md->count()-1 ) : md->count()-1;
+ }
+ return -1;
+ }
+
+ void dumpMenu( QWidget* w, bool before )
+ {
+ QMenuData* md = dynamic_cast<QMenuData*>( w );
+ if ( !w ) return;
+ printf(">>> start dump menu (%s) >>>\n", before ? "before" : "after" );
+ for( int i = 0; i < md->count(); i++ )
+ printf("%d: %d: %s\n",i,md->idAt(i),md->text(md->idAt(i)).latin1() );
+ printf("<<< end dump menu (%s) <<<\n", before ? "before" : "after" );
+ }
+};
/*!
Class: QtxActionMenuMgr::MenuAction
class QtxActionMenuMgr::MenuAction : public QtxAction
{
public:
- MenuAction( const QString&, const QString&, QObject* );
+ MenuAction( const QString&, const QString&, QObject*, const int = -1, const bool = false );
virtual ~MenuAction();
virtual bool addTo( QWidget* );
QPopupMenu* popup() const;
private:
- int myId;
- QPopupMenu* myPopup;
+ int myId;
+ QPopupMenu* myPopup;
+ bool myEmptyEnabled;
+ QMap<QWidget*,int> myIds;
};
-QtxActionMenuMgr::MenuAction::MenuAction( const QString& text, const QString& menuText, QObject* parent )
+
+/*!
+ Constructor for menu action
+ \param text - description text
+ \param menutext - menu text
+ \param parent - parent object
+ \param id - integer identificator of action
+ \param allowEmpty - if it is true, it makes possible to add this action with empty popup to menu
+*/
+
+QtxActionMenuMgr::MenuAction::MenuAction( const QString& text,
+ const QString& menuText,
+ QObject* parent,
+ const int id,
+ const bool allowEmpty )
: QtxAction( text, menuText, 0, parent ),
-myId( -1 ),
-myPopup( 0 )
+ myId( id ),
+ myPopup( 0 ),
+ myEmptyEnabled( allowEmpty )
{
myPopup = new QPopupMenu();
}
+/*!
+ Destructor: deletes internal popup
+*/
QtxActionMenuMgr::MenuAction::~MenuAction()
{
delete myPopup;
}
+/*!
+ Adds action to widget, for example, to popup menu or menu bar
+*/
bool QtxActionMenuMgr::MenuAction::addTo( QWidget* w )
{
- if ( myId != -1 || !w )
- return false;
+ if ( !w )
+ return false; // bad widget
if ( !w->inherits( "QPopupMenu" ) && !w->inherits( "QMenuBar" ) )
- return false;
-
- if ( w->inherits( "QPopupMenu" ) && QAction::addTo( w ) )
- {
- QPopupMenu* pm = (QPopupMenu*)w;
- myId = pm->idAt( pm->count() - 1 );
- setPopup( pm, myId, myPopup );
+ return false; // not allowed widget type
+
+ if ( myIds.find( w ) != myIds.end() )
+ return false; // already added
+
+ if ( !myPopup )
+ return false; // bad own popup menu
+
+ if ( !myEmptyEnabled && !myPopup->count() )
+ return false; // not allowed empty menu
+
+ if ( w->inherits( "QPopupMenu" ) ) {
+ QValueList<int> l = prepareIds( w );
+ int idx;
+ if ( QtxAction::addTo( w ) && ( idx = getNewId( w, l, false ) ) != -1 ) {
+ QPopupMenu* pm = (QPopupMenu*)w;
+ myIds[ w ] = pm->idAt( idx );
+ if ( myId != -1 )
+ pm->setId( idx, myId );
+ setPopup( pm, myId != -1 ? myId : myIds[ w ], myPopup );
+ }
}
- else if ( w->inherits( "QMenuBar" ) )
- {
- QMenuBar* mb = (QMenuBar*)w;
- myId = iconSet().isNull() ? mb->insertItem( menuText(), myPopup ) :
- mb->insertItem( iconSet(), menuText(), myPopup );
- mb->setItemEnabled( myId, isEnabled() );
+ else if ( w->inherits( "QMenuBar" ) ) {
+ QValueList<int> l = prepareIds( w );
+ int idx;
+ if ( QtxAction::addTo( w ) && ( idx = getNewId( w, l, false ) ) != -1 ) {
+ QMenuBar* mb = (QMenuBar*)w;
+ myIds[ w ] = mb->idAt( idx );
+ if ( myId != -1 )
+ mb->setId( idx, myId );
+ setPopup( mb, myId != -1 ? myId : myIds[ w ], myPopup );
+ }
}
else
return false;
return true;
}
+/*!
+ Removes action from widget, for example, from popup menu or menu bar
+*/
bool QtxActionMenuMgr::MenuAction::removeFrom( QWidget* w )
{
- if ( w->inherits( "QPopupMenu" ) && QAction::removeFrom( w ) )
- myId = -1;
+ if ( !w )
+ return false; // bad widget
+
+ if ( !w->inherits( "QPopupMenu" ) && !w->inherits( "QMenuBar" ) )
+ return false; // not allowed widget type
+
+ if ( myIds.find( w ) == myIds.end() )
+ return false; // not yet added
+
+ if ( w->inherits( "QPopupMenu" ) ) {
+ if ( myId != -1 ) {
+ QPopupMenu* pm = (QPopupMenu*)w;
+ int idx = pm->indexOf( myId );
+ if ( idx != -1 ) pm->setId( idx, myIds[ w ] );
+ }
+ myIds.remove( w );
+ return QtxAction::removeFrom( w );;
+ }
else if ( w->inherits( "QMenuBar" ) )
{
- QMenuBar* mb = (QMenuBar*)w;
- mb->removeItem( myId );
- myId = -1;
+ if ( myId != -1 ) {
+ QMenuBar* mb = (QMenuBar*)w;
+ int idx = mb->indexOf( myId );
+ if ( idx != -1 ) mb->setId( idx, myIds[ w ] );
+ }
+ myIds.remove( w );
+ return QtxAction::removeFrom( w );
}
-
- return myId == -1;
+ return false;
}
+/*!
+ \return internal popup of action
+*/
QPopupMenu* QtxActionMenuMgr::MenuAction::popup() const
{
return myPopup;
Class: QtxActionMenuMgr
Level: Public
*/
-
-
QtxActionMenuMgr::QtxActionMenuMgr( QMainWindow* p )
: QtxActionMgr( p ),
-myMenu( p ? p->menuBar() : 0 )
+ myMenu( p ? p->menuBar() : 0 )
{
myRoot.id = -1;
myRoot.group = -1;
- if ( myMenu )
+ if ( myMenu ) {
connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
+#ifdef ENABLE_DYNAMIC_MENU
+ if ( myMenu->inherits( "QMenuBar" ) )
+ connect( myMenu, SIGNAL( highlighted( int ) ), this, SLOT( onHighlighted( int ) ) );
+#endif
+ }
}
+/*!
+ Constructor
+*/
QtxActionMenuMgr::QtxActionMenuMgr( QWidget* mw, QObject* p )
: QtxActionMgr( p ),
-myMenu( mw )
+ myMenu( mw )
{
myRoot.id = -1;
myRoot.group = -1;
connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
+/*!
+ Destructor
+*/
QtxActionMenuMgr::~QtxActionMenuMgr()
{
for ( NodeListIterator it( myRoot.children ); it.current() && myMenu; ++it )
delete itr.data();
}
+/*!
+ \return whether menu item corresponding to action is visible
+ \param actId - identificator of action
+ \param place - identificator of some parent action
+*/
bool QtxActionMenuMgr::isVisible( const int actId, const int place ) const
{
MenuNode* node = find( actId, place );
return node && node->visible;
}
+/*!
+ Sets visible state of action
+ \param actId - identificator of action
+ \param place - identificator of some parent action
+ \param v - visibility state
+*/
void QtxActionMenuMgr::setVisible( const int actId, const int place, const bool v )
{
MenuNode* node = find( actId, place );
node->visible = v;
}
+/*!
+ Insert action as children menu item
+ \param id - identificator of action
+ \param menus - few names of parent menu items, separated by '|'. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( const int id, const QString& menus, const int group, const int idx )
{
return insert( id, QStringList::split( "|", menus ), group, idx );
}
+/*!
+ Insert action as children menu item
+ \param a - action
+ \param menus - few names of parent menu items, separated by '|'. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( QAction* a, const QString& menus, const int group, const int idx )
{
return insert( a, QStringList::split( "|", menus ), group, idx );
}
+/*!
+ Insert action as children menu item
+ \param id - identificator of action
+ \param menus - list of names of parent menu items, separated by |. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( const int id, const QStringList& menus, const int group, const int idx )
{
int pId = createMenu( menus, -1 );
return insert( id, pId, group, idx );
}
+/*!
+ Insert action as children menu item
+ \param a - action
+ \param menus - list of names of parent menu items. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( QAction* a, const QStringList& menus, const int group, const int idx )
{
int pId = createMenu( menus, -1 );
return insert( a, pId, group, idx );
}
+/*!
+ Insert action as children menu item
+ \param id - identificator of action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( const int id, const int pId, const int group, const int idx )
{
if ( id == -1 )
MenuNode* node = new MenuNode( pNode );
node->id = id;
+ node->idx = idx;
node->group = group;
- if ( idx < 0 || idx >= (int)pNode->children.count() )
- pNode->children.append( node );
- else
- pNode->children.insert( idx, node );
+ pNode->children.append( node );
updateMenu( pNode, false );
return node->id;
}
+/*!
+ Insert action as children menu item
+ \param a - action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( QAction* a, const int pId, const int group, const int idx )
{
return insert( registerAction( a ), pId, group, idx );
}
-int QtxActionMenuMgr::insert( const QString& title, const int pId, const int group, const int idx )
+/*!
+ Create and insert action as children menu item
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+ \param id - identificator of new action
+ \param idx - index inside Qt menu
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
+int QtxActionMenuMgr::insert( const QString& title, const int pId, const int group, const int id, const int idx, const bool allowEmpty )
{
MenuNode* pNode = pId == -1 ? &myRoot : find( pId );
if ( !pNode )
return -1;
- int id = -1;
- for ( NodeListIterator it( pNode->children ); it.current() && id == -1; ++it )
+ MenuNode* eNode = id == -1 ? 0 : find( id );
+
+ int fid = -1;
+ for ( NodeListIterator it( pNode->children ); it.current() && fid == -1; ++it )
{
if ( myMenus.contains( it.current()->id ) &&
clearTitle( myMenus[it.current()->id]->menuText() ) == clearTitle( title ) )
- id = it.current()->id;
+ fid = it.current()->id;
}
- if ( id != -1 )
- return id;
+ if ( fid != -1 )
+ return fid;
+
+ int gid = (id == -1 || eNode ) ? generateId() : id;
- MenuAction* ma = new MenuAction( clearTitle( title ), title, this );
+ MenuAction* ma = new MenuAction( clearTitle( title ), title, this, gid, allowEmpty );
+#ifdef ENABLE_DYNAMIC_MENU
+ connect( ma->popup(), SIGNAL( highlighted( int ) ), this, SLOT( onHighlighted( int ) ) );
+#endif
MenuNode* node = new MenuNode( pNode );
node->group = group;
- node->id = myMenus.insert( generateId(), ma ).key();
+ node->idx = idx;
+ node->id = myMenus.insert( gid, ma ).key();
- if ( idx < 0 || idx >= (int)pNode->children.count() )
- pNode->children.append( node );
- else
- pNode->children.insert( idx, node );
+ pNode->children.append( node );
updateMenu( pNode, false );
return node->id;
}
-int QtxActionMenuMgr::insert( const QString& title, const QString& menus, const int group, const int idx )
+/*!
+ Create and insert action as children menu item
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param menus - string list of parents' menu texts, separated by |
+ \param group - group identificator
+ \param id - identificator of new action
+ \param idx - index inside Qt menu
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
+int QtxActionMenuMgr::insert( const QString& title, const QString& menus, const int group, const int id, const int idx, const bool allowEmpty )
{
- return insert( title, QStringList::split( "|", menus ), group, idx );
+ return insert( title, QStringList::split( "|", menus ), group, id, idx, allowEmpty );
}
-int QtxActionMenuMgr::insert( const QString& title, const QStringList& menus, const int group, const int idx )
+/*!
+ Create and insert action as children menu item
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param menus - list of parents menu items
+ \param group - group identificator
+ \param id - identificator of new action
+ \param idx - index inside Qt menu
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
+int QtxActionMenuMgr::insert( const QString& title, const QStringList& menus, const int group, const int id, const int idx, const bool allowEmpty )
{
int pId = createMenu( menus, -1 );
- return insert( title, pId, group, idx );
+ return insert( title, pId, group, id, idx, allowEmpty );
}
-int QtxActionMenuMgr::append( const QString& title, const int pId, const int group )
+/*!
+ Create and append action as last children
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+ \param id - identificator of new action
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
+int QtxActionMenuMgr::append( const QString& title, const int pId, const int group, const int id, const bool allowEmpty )
{
- return insert( title, pId, group );
+ return insert( title, pId, group, id, allowEmpty );
}
+/*!
+ Create and append action as last children
+ \return identificator of inserted action
+ \param id - identificator of existing action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::append( const int id, const int pId, const int group )
{
return insert( id, pId, group );
}
+/*!
+ Create and append action as last children
+ \return identificator of inserted action
+ \param a - action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::append( QAction* a, const int pId, const int group )
{
return insert( a, pId, group );
}
-int QtxActionMenuMgr::prepend( const QString& title, const int pId, const int group )
+/*!
+ Create and insert action as first children
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+ \param id - identificator of new action
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
+int QtxActionMenuMgr::prepend( const QString& title, const int pId, const int group, const int id, const bool allowEmpty )
{
- return insert( title, pId, group, 0 );
+ return insert( title, pId, group, id, 0, allowEmpty );
}
+/*!
+ Create and insert action as last children
+ \return identificator of inserted action
+ \param id - identificator of existing action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::prepend( const int id, const int pId, const int group )
{
return insert( id, pId, group, 0 );
}
+/*!
+ Create and insert action as last children
+ \return identificator of inserted action
+ \param a - action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::prepend( QAction* a, const int pId, const int group )
{
return insert( a, pId, group, 0 );
}
+/*!
+ Removes menu item corresponding to action
+ \param id - identificator of action
+*/
void QtxActionMenuMgr::remove( const int id )
{
removeMenu( id, 0 );
update();
}
+/*!
+ Removes menu item
+ \param id - identificator of action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+*/
void QtxActionMenuMgr::remove( const int id, const int pId, const int group )
{
- MenuNode* pNode = find( pId );
+ MenuNode* pNode = pId == -1 ? &myRoot : find( pId );
if ( !pNode )
return;
updateMenu( pNode, false );
}
+/*!
+ Shows menu item corresponding to action
+ \param id - identificator of action
+*/
void QtxActionMenuMgr::show( const int id )
{
setShown( id, true );
}
+/*!
+ Hides menu item corresponding to action
+ \param id - identificator of action
+*/
void QtxActionMenuMgr::hide( const int id )
{
setShown( id, false );
}
+/*!
+ \return shown status of menu item corresponding to action
+ \param id - identificator of action
+*/
bool QtxActionMenuMgr::isShown( const int id ) const
{
bool res = false;
return res;
}
+/*!
+ Sets shown status of menu item corresponding to action
+ \param id - identificator of action
+ \param on - new shown status
+*/
void QtxActionMenuMgr::setShown( const int id, const bool on )
{
NodeList aNodes;
updateMenu( itr.key(), false );
}
+/*!
+ SLOT: called when corresponding menu is destroyed, clears internal pointer to menu
+*/
void QtxActionMenuMgr::onDestroyed( QObject* obj )
{
if ( myMenu == obj )
myMenu = 0;
}
+/*!
+ SLOT: called when menu item is highlighted
+*/
+void QtxActionMenuMgr::onHighlighted( int id )
+{
+ const QObject* snd = sender();
+ int pid = 0, realId;
+ if ( myMenu && snd == myMenu )
+ pid = -1;
+ else {
+ for ( MenuMap::Iterator itr = myMenus.begin(); itr != myMenus.end(); ++itr ) {
+ if ( itr.data()->popup() && itr.data()->popup() == snd )
+ pid = itr.key();
+ }
+ }
+ if ( pid ) {
+ realId = findId( id, pid );
+ if ( realId != -1 ) {
+ bool updatesEnabled = isUpdatesEnabled();
+ setUpdatesEnabled( false );
+ emit menuHighlighted( pid, realId );
+ setUpdatesEnabled( updatesEnabled );
+ updateMenu( find( realId ) );
+ }
+ }
+}
+
+/*!
+ Assignes new menu with manager
+ \param mw - new menu
+*/
void QtxActionMenuMgr::setWidget( QWidget* mw )
{
if ( myMenu == mw )
connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
-QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int actId, const int pId ) const
+/*!
+ \return menu node by it's place description
+ \param actId - identificator of action
+ \param pId - identificator of action corresponding to start menu item
+ \param rec - recursive search
+*/
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int actId, const int pId, const bool rec ) const
{
- return find( actId, find( pId ) );
+ return find( actId, find( pId ), rec );
}
-QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, MenuNode* startNode ) const
+/*!
+ \return menu node by it's place description
+ \param actId - identificator of action
+ \param startNode - start menu item
+ \param rec - recursive search
+*/
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, MenuNode* startNode, const bool rec ) const
{
MenuNode* node = 0;
MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
{
if ( it.current()->id == id )
node = it.current();
- else
- node = find( id, it.current() );
+ else if ( rec )
+ node = find( id, it.current(), rec );
}
return node;
}
+/*!
+ Finds menu node
+ \return true if at least one node is found
+ \param id - identificator of action
+ \param lst - list to be filled with found nodes
+ \param startNode - start menu item
+*/
bool QtxActionMenuMgr::find( const int id, NodeList& lst, MenuNode* startNode ) const
{
MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
return !lst.isEmpty();
}
+/*!
+ Finds menu node
+ \return menu node
+ \param title - menu text of searched node
+ \param pId - id of action corresponding to start menu item
+ \param rec - recursive searching
+*/
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, const int pId, const bool rec ) const
+{
+ return find( title, find( pId ), rec );
+}
+
+/*!
+ Finds menu node
+ \return true if at least one node is found
+ \param title - menu text of node
+ \param lst - list to be filled with found nodes
+ \param startNode - start menu item
+*/
+bool QtxActionMenuMgr::find( const QString& title, NodeList& lst, MenuNode* startNode ) const
+{
+ MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
+ for ( NodeListIterator it( start->children ); it.current(); ++it )
+ {
+ QAction* a = itemAction( it.current()->id );
+ if ( !a )
+ a = menuAction( it.current()->id );
+ if ( a && clearTitle( a->menuText() ) == clearTitle( title ) )
+ lst.prepend( it.current() );
+
+ find( title, lst, it.current() );
+ }
+ return !lst.isEmpty();
+}
+
+/*!
+ Finds menu node
+ \return menu node
+ \param title - menu text of searched node
+ \param startNode - start menu item
+ \param rec - recursive searching
+*/
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, MenuNode* startNode, const bool rec ) const
+{
+ MenuNode* node = 0;
+ MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
+ for ( NodeListIterator it( start->children ); it.current() && !node; ++it )
+ {
+ QAction* a = itemAction( it.current()->id );
+ if ( !a )
+ a = menuAction( it.current()->id );
+ if ( a && clearTitle( a->menuText() ) == clearTitle( title ) )
+ node = it.current();
+ if ( !node && rec )
+ node = find( title, it.current(), rec );
+ }
+ return node;
+}
+
+/*!
+ Find id among children
+ \return id (>0) if on success or -1 on fail
+ \param id - id to be searched
+ \param pid - id of parent, among children of that 'id' must be searched
+*/
+int QtxActionMenuMgr::findId( const int id, const int pid ) const
+{
+ MenuNode* start = pid != -1 ? find( pid ) : (MenuNode*)&myRoot;
+ if ( start ) {
+ for ( NodeListIterator it( start->children ); it.current(); ++it ) {
+ if ( it.current()->id == id ) return id;
+ }
+ }
+ return -1;
+}
+
+/*!
+ Removes child
+ \param id - id of child to be removed
+ \param startNode - parent menu item
+*/
void QtxActionMenuMgr::removeMenu( const int id, MenuNode* startNode )
{
MenuNode* start = startNode ? startNode : &myRoot;
}
}
+/*!
+ \return menu item action by id
+ \param id - id of action
+*/
QAction* QtxActionMenuMgr::itemAction( const int id ) const
{
return action( id );
}
+/*!
+ \return menu action by id
+ \param id - id of action
+*/
QtxActionMenuMgr::MenuAction* QtxActionMenuMgr::menuAction( const int id ) const
{
MenuAction* a = 0;
return a;
}
+/*!
+ Updates menu ( isUpdatesEnabled() must return true )
+ \param startNode - first menu item to be updated
+ \param rec - recursive update
+ \param updParent - update also parent item (without recursion)
+ \sa isUpdatesEnabled()
+*/
void QtxActionMenuMgr::updateMenu( MenuNode* startNode, const bool rec, const bool updParent )
{
if ( !isUpdatesEnabled() )
if ( a )
a->removeFrom( mw );
}
-
- if ( node != &myRoot )
- {
- if ( mw->inherits( "QMenuBar" ) )
- ((QMenuBar*)mw)->clear();
- else if ( mw->inherits( "QPopupMenu" ) )
- ((QPopupMenu*)mw)->clear();
- }
-
+ /* VSR: commented to allow direct creating of menus by calling insertItem() methods
+ if ( mw->inherits( "QMenuBar" ) )
+ ((QMenuBar*)mw)->clear();
+ else if ( mw->inherits( "QPopupMenu" ) )
+ ((QPopupMenu*)mw)->clear();
+ */
QMap<int, NodeList> idMap;
for ( NodeListIterator it2( node->children ); it2.current(); ++it2 )
{
- MenuNode* par = it2.current()->parent;
- if ( isVisible( it2.current()->id, par ? par->id : -1 ) )
- {
- NodeList& lst = idMap[it2.current()->group];
+ NodeList& lst = idMap[it2.current()->group];
+ int idx = it2.current()->idx;
+ if ( idx < 0 || idx >= lst.count() )
lst.append( it2.current() );
- }
+ else
+ lst.insert( idx, it2.current() );
}
QIntList groups = idMap.keys();
const NodeList& lst = idMap[*gIt];
for ( NodeListIterator iter( lst ); iter.current(); ++iter )
{
+ MenuNode* par = iter.current()->parent;
+ if ( !isVisible( iter.current()->id, par ? par->id : -1 ) )
+ continue;
+
if ( rec )
updateMenu( iter.current(), rec, false );
QAction* a = itemAction( iter.current()->id );
+ if ( !a )
+ a = menuAction( iter.current()->id );
if ( a )
- a->addTo( mw );
- else
- {
- MenuAction* ma = menuAction( iter.current()->id );
- if ( ma && ma->popup() && ma->popup()->count() )
- ma->addTo( mw );
- }
+ a->addTo( mw );
}
}
updateMenu( node->parent, false );
}
+/*!
+ Updates menu (virtual variant). To be redefined for custom activity on menu updating
+*/
void QtxActionMenuMgr::internalUpdate()
{
if ( isUpdatesEnabled() )
updateMenu();
}
+/*!
+ \return true if widget is non-empty menu
+ \param wid - widget to be checked
+*/
bool QtxActionMenuMgr::checkWidget( QWidget* wid ) const
{
if ( !wid )
else if ( wid->inherits( "QMenuBar" ) )
md = (QMenuBar*)wid;
- return md->count();
+ return md ? md->count() : false;
}
+/*!
+ \return popup of menu item
+ \param node - menu item
+*/
QWidget* QtxActionMenuMgr::menuWidget( MenuNode* node) const
{
if ( !node || node == &myRoot )
return myMenus[node->id]->popup();
}
+/*!
+ Removes excess separators of menu
+ \param wid - menu to be processed
+*/
void QtxActionMenuMgr::simplifySeparators( QWidget* wid )
{
if ( wid && wid->inherits( "QPopupMenu" ) )
Qtx::simplifySeparators( (QPopupMenu*)wid, false );
}
+/*!
+ Removes special symbols (&) from string
+ \param txt - string to be processed
+ \return clear variant of string
+*/
QString QtxActionMenuMgr::clearTitle( const QString& txt ) const
{
QString res = txt;
return res;
}
+/*!
+ Creates and inserts many menu items
+ \param lst - list of menu texts
+ \param pId - id of action corresponding to parent menu item
+*/
int QtxActionMenuMgr::createMenu( const QStringList& lst, const int pId )
{
if ( lst.isEmpty() )
return insert( title, parentId, -1 );
}
+/*!
+ Loads actions description from file
+ \param fname - name of file
+ \param r - reader of file
+ \return true on success
+*/
bool QtxActionMenuMgr::load( const QString& fname, QtxActionMgr::Reader& r )
{
MenuCreator cr( &r, this );
return r.read( fname, cr );
}
+/*!
+ \return true if item has such child
+ \param title - menu text of child
+ \param pid - id of action corresponding to item
+*/
+bool QtxActionMenuMgr::containsMenu( const QString& title, const int pid ) const
+{
+ return (bool)find( title, pid, false );
+}
/*!
- Class: QtxActionMenuMgr::MenuCreator
- Level: Public
+ \return true if item has such child
+ \param id - id of action corresponding to child
+ \param pid - id of action corresponding to item
*/
+bool QtxActionMenuMgr::containsMenu( const int id, const int pid ) const
+{
+ return (bool)find( id, pid, false );
+}
+
+/*!
+ Constructor
+ \param r - menu reader
+ \param mgr - menu manager
+*/
QtxActionMenuMgr::MenuCreator::MenuCreator( QtxActionMgr::Reader* r,
QtxActionMenuMgr* mgr )
: QtxActionMgr::Creator( r ),
{
}
+/*!
+ Destructor
+*/
QtxActionMenuMgr::MenuCreator::~MenuCreator()
{
}
+/*!
+ Appends new menu items
+ \param tag - tag of item
+ \param subMenu - it has submenu
+ \param attr - list of attributes
+ \param pId - id of action corresponding to parent item
+*/
int QtxActionMenuMgr::MenuCreator::append( const QString& tag, const bool subMenu,
const ItemAttributes& attr, const int pId )
{
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxActionMenuMgr.h
// Author: Alexander SOLOVYEV, Sergey TELKOV
#pragma warning( disable:4251 )
#endif
+/*!
+ \class QtxActionMenuMgr
+ Allows to use set of action to automatically build main menu.
+ With help of methods insert/append/remove it is possible to
+ describe whole structure of menu. Method hide allows
+ to temporary remove some items from menu, method show allows to
+ recreate them.
+ Actions can be grouped with help of group identifictor.
+ Inside popup or menu bar items have order by increasing group id.
+ This manager is able to attune menu: to remove excess separators,
+ to remove empty popup menu etc.
+*/
class QTX_EXPORT QtxActionMenuMgr : public QtxActionMgr
{
Q_OBJECT
typedef QPtrList<MenuNode> NodeList;
typedef QPtrListIterator<MenuNode> NodeListIterator;
+ /*!
+ \class MenuNode
+ Represents a menu item inside main menu structure.
+ For internal purposes only
+ */
class MenuNode
{
public:
MenuNode( MenuNode* p ) : parent( p ), visible( true ) { children.setAutoDelete( true ); };
int id;
+ int idx;
int group;
MenuNode* parent;
bool visible;
virtual int insert( const int, const int, const int, const int = -1 );
int insert( QAction*, const int, const int, const int = -1 );
- int insert( const QString&, const QString&, const int, const int = -1 );
- int insert( const QString&, const QStringList&, const int, const int = -1 );
- virtual int insert( const QString&, const int, const int, const int = -1 );
+ int insert( const QString&, const QString&, const int, const int = -1, const int = -1, const bool = false );
+ int insert( const QString&, const QStringList&, const int, const int = -1, const int = -1, const bool = false );
+ virtual int insert( const QString&, const int, const int, const int = -1, const int = -1, const bool = false );
int append( const int, const int, const int );
int append( QAction*, const int, const int );
- int append( const QString&, const int, const int );
+ int append( const QString&, const int, const int, const int = -1, const bool = false );
int prepend( const int, const int, const int );
int prepend( QAction*, const int, const int );
- int prepend( const QString&, const int, const int );
+ int prepend( const QString&, const int, const int, const int = -1, const bool = false );
void remove( const int );
void remove( const int, const int, const int = -1 );
virtual bool load( const QString&, QtxActionMgr::Reader& );
+ bool containsMenu( const QString&, const int ) const;
+ bool containsMenu( const int, const int ) const;
+
+
private slots:
void onDestroyed( QObject* );
+ void onHighlighted( int );
+
+signals:
+ void menuHighlighted( int, int );
protected:
void setWidget( QWidget* );
- MenuNode* find( const int, const int ) const;
- MenuNode* find( const int, MenuNode* = 0 ) const;
+ MenuNode* find( const int, const int, const bool = true ) const;
+ MenuNode* find( const int, MenuNode* = 0, const bool = true ) const;
bool find( const int, NodeList&, MenuNode* = 0 ) const;
+ MenuNode* find( const QString&, const int, const bool = true ) const;
+ MenuNode* find( const QString&, MenuNode* = 0, const bool = true ) const;
+ bool find( const QString&, NodeList&, MenuNode* = 0 ) const;
+ int findId( const int, const int = -1 ) const;
void removeMenu( const int, MenuNode* );
MenuMap myMenus;
};
+/*!
+ \class QtxActionMenuMgr::MenuCreator
+ Allows to create automatically main menu by data read from file
+*/
class QtxActionMenuMgr::MenuCreator : public QtxActionMgr::Creator
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxActionMgr.cxx
// Author: Alexander SOLOVYEV, Sergey TELKOV
QMap<QToolBar*, QWidgetList> myTools;
};
+/*!
+ Constructor
+*/
QtxActionMgr::SeparatorAction::SeparatorAction( QObject* parent )
: QtxAction( parent )
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::SeparatorAction::~SeparatorAction()
{
}
+/*!
+ Adds action to widget
+ \param wid - widget
+*/
bool QtxActionMgr::SeparatorAction::addTo( QWidget* wid )
{
if ( !wid )
return res;
}
+/*!
+ Removes action from widget
+ \param wid - widget
+*/
bool QtxActionMgr::SeparatorAction::removeFrom( QWidget* wid )
{
if ( !wid )
Level: Public
*/
+/*!
+ Constructor
+*/
QtxActionMgr::QtxActionMgr( QObject* parent )
: QObject( parent ),
myUpdate( true )
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::~QtxActionMgr()
{
}
+/*!
+ Stores action in internal map
+ If action with such id is registered already, then it will be unregistered
+ \param a - action to be registered
+ \param userId - proposed id (if it is less than 0, then id will be generated automatically)
+*/
int QtxActionMgr::registerAction( QAction* a, const int userId )
{
if ( !a )
return theId;
}
+/*!
+ Removes action from internal map
+ \param id - action id
+*/
void QtxActionMgr::unRegisterAction( const int id )
{
if( contains( id ) )
myActions.remove( id );
}
+/*!
+ \return action by id
+ \param id - action id
+*/
QAction* QtxActionMgr::action( const int id ) const
{
if ( contains( id ) )
return 0;
}
+/*!
+ \return id by action
+ \param a - action
+*/
int QtxActionMgr::actionId( const QAction* a ) const
{
if ( !a )
return theId;
}
+/*!
+ \return true if internal map contains such id
+ \param id - action id
+*/
bool QtxActionMgr::contains( const int id ) const
{
return myActions.contains( id );
}
+/*!
+ \return count of actions in internal map
+*/
int QtxActionMgr::count() const
{
return myActions.count();
}
+/*!
+ \return true if internal map is empty
+*/
bool QtxActionMgr::isEmpty() const
{
return myActions.isEmpty();
}
+/*!
+ Fills list with ids of registered actions
+*/
void QtxActionMgr::idList( QIntList& lst ) const
{
lst = myActions.keys();
}
+/*!
+ \return true if updates are enabled
+*/
bool QtxActionMgr::isUpdatesEnabled() const
{
return myUpdate;
}
+/*!
+ Enables/disables updates
+ \param upd - new state
+*/
void QtxActionMgr::setUpdatesEnabled( const bool upd )
{
myUpdate = upd;
}
+/*!
+ \return true if action is visible (by default \return always true)
+*/
bool QtxActionMgr::isVisible( const int, const int ) const
{
return true;
}
+/*!
+ Sets visibility of action (by default, empty implementation)
+*/
void QtxActionMgr::setVisible( const int, const int, const bool )
{
}
+/*!
+ Updates actions, check isUpdatesEnabled() and call internalUpdate()
+ \sa isUpdatesEnabled(), internalUpdate()
+*/
void QtxActionMgr::update()
{
if ( isUpdatesEnabled() )
internalUpdate();
}
+/*!
+ Real update (to be redefined in successors)
+*/
void QtxActionMgr::internalUpdate()
{
}
+/*!
+ \return global free id
+*/
int QtxActionMgr::generateId() const
{
static int id = -1;
return --id;
}
+/*!
+ \return true if action is enabled
+ \param id - action id
+*/
bool QtxActionMgr::isEnabled( const int id ) const
{
QAction* a = action( id );
return false;
}
+/*!
+ Enables/disables action
+ \param id - action id
+ \param en - new state
+*/
void QtxActionMgr::setEnabled( const int id, const bool en )
{
QAction* a = action( id );
a->setEnabled( en );
}
+/*!
+ \return action for separator
+ If this action doesn't exist, then it will be created
+ \param individual - if it is false, then action will be shared, otherwise it will be created on every call
+*/
QAction* QtxActionMgr::separator( const bool individual )
{
if ( individual )
Level: Public
*/
+/*!
+ Constructor
+*/
QtxActionMgr::Reader::Reader()
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::Reader::~Reader()
{
}
+/*!
+ \return list of options
+*/
QStringList QtxActionMgr::Reader::options() const
{
return myOptions.keys();
}
+/*!
+ \return value of option
+ \param name - option name
+ \param def - default option value (is returned, if there is no such option)
+*/
QString QtxActionMgr::Reader::option( const QString& name, const QString& def ) const
{
if( myOptions.contains( name ) )
return def;
}
+/*!
+ Sets value of option
+ \param name - option name
+ \param value - option value
+*/
void QtxActionMgr::Reader::setOption( const QString& name, const QString& value )
{
myOptions[ name ] = value;
/*!
- Class: QtxActionMgr::XMLReader
- Level: Public
+ Constructor
*/
QtxActionMgr::XMLReader::XMLReader( const QString& root,
const QString& item,
setOption( QString( "toggle" ), QString( "toggle-id" ) );
}
+/*!
+ Destructor
+*/
QtxActionMgr::XMLReader::~XMLReader()
{
}
+/*!
+ Reads file and fills action manager with help of creator
+ \param fname - file name
+ \param cr - creator
+*/
bool QtxActionMgr::XMLReader::read( const QString& fname, Creator& cr ) const
{
bool res = false;
return res;
}
+/*!
+ Create item by xml node
+ \param parent_node - parent node
+ \param parent_id - parent id
+ \param cr - creator
+*/
void QtxActionMgr::XMLReader::read( const QDomNode& parent_node,
const int parent_id,
Creator& cr ) const
}
}
+/*!
+ \return true if node satisfies pattern
+*/
bool QtxActionMgr::XMLReader::isNodeSimilar( const QDomNode& node,
const QString& pattern ) const
{
/*!
- Class: QtxActionMgr::Creator
- Level: Public
+ \return integer value by attributes
+ \param attrs - attributes
+ \param name - name of attribute
+ \param def - default value (is returned on fail)
*/
int QtxActionMgr::Creator::intValue( const ItemAttributes& attrs,
const QString& name, int def )
return def;
}
+/*!
+ \return string value by attributes
+ \param attrs - attributes
+ \param name - name of attribute
+ \param def - default value (is returned on fail)
+*/
QString QtxActionMgr::Creator::strValue( const ItemAttributes& attrs,
const QString& name,
const QString& def )
return def;
}
+/*!
+ Constructor
+*/
QtxActionMgr::Creator::Creator( QtxActionMgr::Reader* r )
: myReader( r )
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::Creator::~Creator()
{
}
+/*!
+ \return corresponding reader
+*/
QtxActionMgr::Reader* QtxActionMgr::Creator::reader() const
{
return myReader;
}
+/*!
+ Connects action to some slots (default implementation is empty)
+*/
void QtxActionMgr::Creator::connect( QAction* ) const
{
}
+/*!
+ Loads pixmap
+ \param fname - file name
+ \param pix - to return loaded pixmap
+*/
bool QtxActionMgr::Creator::loadPixmap( const QString& fname, QPixmap& pix ) const
{
if( !reader() )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxActionMgr.h
// Author: Alexander SOLOVYEV, Sergey TELKOV
#pragma warning( disable:4251 )
#endif
+
+/*!
+ \class QtxActionMgr
+ Contains set of actions accessible by id.
+ Base class for menu, popup creators and other action containers.
+*/
class QTX_EXPORT QtxActionMgr : public QObject
{
Q_OBJECT
QTX_EXPORT typedef QMap<QString, QString> ItemAttributes;
+/*!
+ \class QtxActionMgr::Creator
+ Allows to fill automatically action manager with actions created by data from file
+*/
class QtxActionMgr::Creator
{
public:
QtxActionMgr::Reader* myReader;
};
+/*!
+ \class QtxActionMgr::Reader
+ This class is used to read files of some format
+ to create actions and to fill action manager automatically
+*/
class QtxActionMgr::Reader
{
public:
QMap< QString, QString > myOptions;
};
+/*!
+ \class QtxActionMgr::Reader
+ This class is used to read files of XML format
+ to create actions and to fill action manager automatically
+*/
class QtxActionMgr::XMLReader : public Reader
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxActionToolMgr.cxx
// Author: Alexander SOLOVYEV, Sergey TELKOV
#include <qmainwindow.h>
#include <qobjectlist.h>
+/*!
+ Constructor
+*/
QtxActionToolMgr::QtxActionToolMgr( QMainWindow* p )
: QtxActionMgr( p ),
myMainWindow( p )
{
}
+/*!
+ Destructor
+*/
QtxActionToolMgr::~QtxActionToolMgr()
{
}
+/*!
+ \return desktop
+*/
QMainWindow* QtxActionToolMgr::mainWindow() const
{
return myMainWindow;
}
+/*!
+ Creates toolbar
+ \return id of just created toolbar
+ \param name - name of toolbar
+ \param tid - proposed id (if such id is used already, then it will be returned without creation)
+*/
int QtxActionToolMgr::createToolBar( const QString& name, const int tid )
{
static int _toolBarId = -1;
return tbId;
}
+/*!
+ \return toolbar by title
+ \param label - toolbar title
+ \param mw - desktop
+*/
QToolBar* QtxActionToolMgr::find( const QString& label, QMainWindow* mw ) const
{
if ( !mw )
return res;
}
+/*!
+ Removes toolbar
+ \param tid - toolbar id
+*/
void QtxActionToolMgr::removeToolBar( const int tid )
{
if ( !myToolBars.contains( tid ) )
myToolBars.remove( tid );
}
+/*!
+ Removes toolbar
+ \param tname - toolbar name
+*/
void QtxActionToolMgr::removeToolBar( const QString& tname )
{
removeToolBar( find( tname ) );
}
+/*!
+ Insert action into toolbar
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+ \param idx - position inside toolbar
+*/
int QtxActionToolMgr::insert( const int id, const int tid, const int idx )
{
if ( !contains( id ) || !hasToolBar( tid ) )
return -1;
+ if ( containsAction( id, tid ) )
+ remove( id, tid );
+
ToolNode node;
node.id = id;
return id;
}
+/*!
+ Insert action into toolbar
+ \param act - action
+ \param tId - identificator of toolbar
+ \param pos - position inside toolbar
+*/
int QtxActionToolMgr::insert( QAction* act, const int tid, const int pos )
{
return insert( registerAction( act ), tid, pos );
}
+/*!
+ Insert action into toolbar
+ \param id - identificator of action
+ \param tname - name of toolbar
+ \param pos - position inside toolbar
+*/
int QtxActionToolMgr::insert( const int id, const QString& tname, const int pos )
{
return insert( id, createToolBar( tname ), pos );
}
+/*!
+ Insert action into toolbar
+ \param act - action
+ \param tname - name of toolbar
+ \param pos - position inside toolbar
+*/
int QtxActionToolMgr::insert( QAction* act, const QString& tname, const int pos )
{
return insert( registerAction( act ), createToolBar( tname ), pos );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::append( const int id, const int tid )
{
return insert( id, tid );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param act - action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::append( QAction* act, const int tid )
{
return insert( act, tid );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param id - identificator of action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::append( const int id, const QString& tname )
{
return insert( id, tname );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param act - action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::append( QAction* act, const QString& tname )
{
return insert( act, tname );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::prepend( const int id, const int tid )
{
return insert( id, tid, 0 );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param act - action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::prepend( QAction* act, const int tid )
{
return insert( act, tid, 0 );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param id - identificator of action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::prepend( const int id, const QString& tname )
{
return insert( id, tname, 0 );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param act - action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::prepend( QAction* act, const QString& tname )
{
return insert( act, tname, 0 );
}
+/*!
+ Remove action from toolbar
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
void QtxActionToolMgr::remove( const int id, const int tid )
{
if ( !myToolBars.contains( tid ) )
updateToolBar( tid );
}
+/*!
+ Remove action from toolbar
+ \param id - identificator of action
+ \param tname - name of toolbar
+*/
void QtxActionToolMgr::remove( const int id, const QString& tname )
{
remove( id, find( tname ) );
}
+/*!
+ \return toolbar by it's id
+ \param tId - identificator of toolbar
+*/
QToolBar* QtxActionToolMgr::toolBar( const int tid ) const
{
QToolBar* tb = 0;
return tb;
}
+/*!
+ \return toolbar by it's name
+ \param tname - name of toolbar
+*/
QToolBar* QtxActionToolMgr::toolBar( const QString& tname ) const
{
return toolBar( find( tname ) );
}
+/*!
+ \return true if manager contains toolbar with such id
+ \param tId - identificator of toolbar
+*/
bool QtxActionToolMgr::hasToolBar( const int tid ) const
{
return myToolBars.contains( tid );
}
+/*!
+ \return true if manager contains toolbar with such name
+ \param tname - name of toolbar
+*/
bool QtxActionToolMgr::hasToolBar( const QString& tname ) const
{
return find( tname ) != -1;
}
+/*!
+ \return true if toolbar contains action
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
+bool QtxActionToolMgr::containsAction( const int id, const int tid ) const
+{
+ for ( ToolBarMap::ConstIterator it = myToolBars.begin(); it != myToolBars.end(); ++it )
+ {
+ if ( tid == -1 || it.key() == tid ) {
+ const NodeList& list = it.data().nodes;
+ for ( NodeList::const_iterator nit = list.begin(); nit != list.end(); ++nit )
+ if ( (*nit).id == id )
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ SLOT: called when toolbar is destroyed, removes just destroyed toolbar from map
+*/
void QtxActionToolMgr::onToolBarDestroyed()
{
myToolBars.remove( find( (QToolBar*)sender() ) );
}
+/*!
+ \return id of toolbar by it's name
+ \param tname - name of toolbar
+*/
int QtxActionToolMgr::find( const QString& tname ) const
{
int id = -1;
return id;
}
+/*!
+ \return id of toolbar
+ \param t - toolbar
+*/
int QtxActionToolMgr::find( QToolBar* t ) const
{
int id = -1;
return id;
}
+/*!
+ Updates toolbar
+ \param tId - toolbar id
+*/
void QtxActionToolMgr::updateToolBar( const int tId )
{
if ( !isUpdatesEnabled() )
simplifySeparators( tb );
}
+/*!
+ Updates all toolbars
+*/
void QtxActionToolMgr::internalUpdate()
{
for ( ToolBarMap::ConstIterator it1 = myToolBars.begin(); it1 != myToolBars.end(); ++it1 )
updateToolBar( it1.key() );
}
+/*!
+ Removes excess separators from toolbar
+*/
void QtxActionToolMgr::simplifySeparators( QToolBar* t )
{
if ( t )
Qtx::simplifySeparators( t );
}
+/*!
+ Shows action in all toolbars
+ \param actId - action id
+*/
void QtxActionToolMgr::show( const int actId )
{
setShown( actId, true );
}
+/*!
+ Hides action in all toolbars
+ \param actId - action id
+*/
void QtxActionToolMgr::hide( const int actId )
{
setShown( actId, false );
}
+/*!
+ Changes shown status of action in all toolbars
+ \param id - action id
+ \param on - new shown status
+*/
void QtxActionToolMgr::setShown( const int id, const bool on )
{
for ( ToolBarMap::Iterator it = myToolBars.begin(); it != myToolBars.end(); ++it )
setVisible( id, it.key(), on );
}
+/*!
+ \return true if action is shown in all toolbars
+ \param id - action id
+*/
bool QtxActionToolMgr::isShown( const int id ) const
{
QPtrList<ToolNode> nodes;
return vis;
}
+/*!
+ \return shown status of action in toolbar
+ \param id - action id
+ \param tId - toolbar id
+*/
bool QtxActionToolMgr::isVisible( const int id, const int tId ) const
{
if ( !myToolBars.contains( tId ) )
return vis;
}
+/*!
+ Changes action shown status in certain toolbar
+ \param id - action id
+ \param tId - toolbar id
+ \param on - new shown status
+*/
void QtxActionToolMgr::setVisible( const int id, const int tId, const bool on )
{
if ( !myToolBars.contains( tId ) )
updateToolBar( tId );
}
+/*!
+ Loads toolbar content from file
+ \param fname - file name
+ \param r - reader
+*/
bool QtxActionToolMgr::load( const QString& fname, QtxActionMgr::Reader& r )
{
ToolCreator cr( &r, this );
/*!
- Class: QtxActionToolMgr::ToolCreator
- Level: Public
+ Constructor
*/
QtxActionToolMgr::ToolCreator::ToolCreator( QtxActionMgr::Reader* r,
QtxActionToolMgr* mgr )
{
}
+/*!
+ Destructor
+*/
QtxActionToolMgr::ToolCreator::~ToolCreator()
{
}
+/*!
+ Appends new tool buttons
+ \param tag - tag of toolmenu
+ \param subMenu - it has submenu (not used here)
+ \param attr - list of attributes
+ \param pId - id of action corresponding to parent item
+*/
int QtxActionToolMgr::ToolCreator::append( const QString& tag, const bool subMenu,
const ItemAttributes& attr, const int tId )
{
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxActionToolMgr.h
// Author: Alexander SOLOVYEV, Sergey TELKOV
#pragma warning( disable:4251 )
#endif
+/*!
+ \class QtxActionToolMgr
+ Allows to use set of action to automatically build set of toolbars.
+ With help of methods insert/append/remove it is possible to
+ describe toolbars and its internal structure.
+ This manager is able to attune toolbar by removing excess separators
+*/
class QTX_EXPORT QtxActionToolMgr : public QtxActionMgr
{
Q_OBJECT
+ /*!
+ \class ToolNode
+ Represents a toolbutton inside toolbar
+ For internal purposes only
+ */
class ToolNode
{
public:
bool hasToolBar( const int ) const;
bool hasToolBar( const QString& ) const;
+ bool containsAction( const int, const int = -1 ) const;
+
virtual bool load( const QString&, QtxActionMgr::Reader& );
protected slots:
QMainWindow* myMainWindow;
};
+/*!
+ \class QtxActionToolMgr::ToolCreator
+ Allows to create automatically toolbar by data read from file
+*/
class QtxActionToolMgr::ToolCreator : public QtxActionMgr::Creator
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxColorScale.cxx
// Author: Sergey TELKOV
#include <math.h>
-/*********************************************************************
-** Class: QtxColorScale
-** Descr: Color Scale widget.
-** Level: Public
-*********************************************************************/
-
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( QWidget* parent, const char* name, WFlags f )
: QFrame( parent, name, f | WResizeNoErase | WRepaintNoErase ),
myDock( 0 ),
setCaption( tr ( "Color scale" ) );
}
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( const int num, QWidget* parent, const char* name, WFlags f )
: QFrame( parent, name, f | WResizeNoErase | WRepaintNoErase ),
myDock( 0 ),
#if QT_VER == 3
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( Dock* dock, const char* name, WFlags f )
: QFrame( dock, name, f | WResizeNoErase | WRepaintNoErase ),
myMin( 0.0 ),
#endif
+/*!
+ Destructor
+*/
QtxColorScale::~QtxColorScale()
{
}
-//================================================================
-// Function : minimum
-// Purpose : Returns minimal limit of scale.
-//================================================================
-
+/*!
+ \returns minimal limit of scale.
+*/
double QtxColorScale::minimum() const
{
return myMin;
}
-//================================================================
-// Function : maximum
-// Purpose : Returns maximal limit of scale.
-//================================================================
-
+/*!
+ \return maximal limit of scale.
+*/
double QtxColorScale::maximum() const
{
return myMax;
}
-//================================================================
-// Function : range
-// Purpose : Returns range (minimal and maximal limits) of scale.
-//================================================================
-
+/*!
+ \return range (minimal and maximal limits) of scale.
+*/
void QtxColorScale::range( double& min, double& max ) const
{
min = myMin;
max = myMax;
}
-//================================================================
-// Function : title
-// Purpose : Returns the current title string.
-//================================================================
-
+/*!
+ \return the current title string.
+*/
QString QtxColorScale::title() const
{
return myTitle;
}
-//================================================================
-// Function : format
-// Purpose : Returns the current format of number presentation in
-// labels for Auto label mode (sprintf specification).
-//================================================================
-
+/*!
+ \returns the current format of number presentation in labels for Auto label mode (sprintf specification).
+*/
QString QtxColorScale::format() const
{
return myFormat;
}
-//================================================================
-// Function : dumpMode
-// Purpose : Returns dump mode.
-//================================================================
-
+/*!
+ \return dump mode.
+*/
int QtxColorScale::dumpMode() const
{
return myDumpMode;
}
-//================================================================
-// Function : labelMode
-// Purpose : Returns label mode.
-//================================================================
-
+/*!
+ \return label mode.
+*/
int QtxColorScale::labelMode() const
{
return myLabelMode;
}
-//================================================================
-// Function : colorMode
-// Purpose : Returns color mode.
-//================================================================
-
+/*!
+ \return color mode.
+*/
int QtxColorScale::colorMode() const
{
return myColorMode;
}
-//================================================================
-// Function : intervalsNumber
-// Purpose : Returns intervals number of color scale.
-//================================================================
-
+/*!
+ \return intervals number of color scale.
+*/
int QtxColorScale::intervalsNumber() const
{
return myInterval;
}
-//================================================================
-// Function : label
-// Purpose : Returns the user label of specified interval.
-//================================================================
-
+/*!
+ \return the user label of specified interval.
+*/
QString QtxColorScale::label( const int idx ) const
{
QString res;
return res;
}
-//================================================================
-// Function : color
-// Purpose : Returns the user color of specified interval.
-//================================================================
-
+/*!
+ \return the user color of specified interval.
+*/
QColor QtxColorScale::color( const int idx ) const
{
QColor res;
return res;
}
-//================================================================
-// Function : labels
-// Purpose : Returns the user labels.
-//================================================================
-
+/*!
+ \return the user labels.
+*/
void QtxColorScale::labels( QStringList& list ) const
{
list = myLabels;
}
-//================================================================
-// Function : colors
-// Purpose : Returns the user color.
-//================================================================
-
+/*!
+ \return the user color.
+*/
void QtxColorScale::colors( QValueList<QColor>& list ) const
{
list = myColors;
}
-//================================================================
-// Function : labelPosition
-// Purpose : Returns the label position.
-//================================================================
-
+/*!
+ \return the label position.
+*/
int QtxColorScale::labelPosition() const
{
return myLabelPos;
}
-//================================================================
-// Function : titlePosition
-// Purpose : Returns the title position.
-//================================================================
-
+/*!
+ \return the title position.
+*/
int QtxColorScale::titlePosition() const
{
return myTitlePos;
}
-//================================================================
-// Function : setMinimum
-// Purpose : Sets the minimum limit.
-//================================================================
-
+/*!
+ Sets the minimum limit.
+*/
void QtxColorScale::setMinimum( const double val )
{
setRange( val, maximum() );
}
-//================================================================
-// Function : setMaximum
-// Purpose : Sets the maximum limit.
-//================================================================
-
+/*!
+ Sets the maximum limit.
+*/
void QtxColorScale::setMaximum( const double val )
{
setRange( minimum(), val );
}
-//================================================================
-// Function : setRange
-// Purpose : Sets the minimum and maximum limits.
-//================================================================
-
+/*!
+ Sets the minimum and maximum limits.
+*/
void QtxColorScale::setRange( const double min, const double max )
{
if ( myMin == min && myMax == max )
updateScale();
}
-//================================================================
-// Function : setTitle
-// Purpose : Sets the title string.
-//================================================================
-
+/*!
+ Sets the title string.
+*/
void QtxColorScale::setTitle( const QString& str )
{
if ( myTitle == str )
updateScale();
}
-//================================================================
-// Function : setFormat
-// Purpose : Sets the format of number presentation in labels for
-// Auto label mode (sprintf specification).
-//================================================================
-
+/*!
+ Sets the format of number presentation in labels for
+ Auto label mode (sprintf specification).
+*/
void QtxColorScale::setFormat( const QString& format )
{
if ( myFormat == format )
updateScale();
}
-//================================================================
-// Function : setIntervalsNumber
-// Purpose : Sets the number of intervals.
-//================================================================
-
+/*!
+ Sets the number of intervals.
+*/
void QtxColorScale::setIntervalsNumber( const int num )
{
if ( myInterval == num || num < 1 )
updateScale();
}
-//================================================================
-// Function : setLabel
-// Purpose : Sets the user label for specified interval. If number
-// of interval is negative then user label will be added
-// as new at the end of list.
-//================================================================
-
+/*!
+ Sets the user label for specified interval. If number
+ of interval is negative then user label will be added
+ as new at the end of list.
+*/
void QtxColorScale::setLabel( const QString& txt, const int idx )
{
bool changed = false;
updateScale();
}
-//================================================================
-// Function : setColor
-// Purpose : Sets the user color for specified interval. If number
-// of interval is negative then user color will be added
-// as new at the end of list.
-//================================================================
-
+/*!
+ Sets the user color for specified interval. If number
+ of interval is negative then user color will be added
+ as new at the end of list.
+*/
void QtxColorScale::setColor( const QColor& clr, const int idx )
{
bool changed = false;
updateScale();
}
-//================================================================
-// Function : setLabels
-// Purpose : Replace the all user label with specified list.
-//================================================================
-
+/*!
+ Replace the all user label with specified list.
+*/
void QtxColorScale::setLabels( const QStringList& list )
{
if ( list.isEmpty() )
updateScale();
}
-//================================================================
-// Function : setColors
-// Purpose : Replace the all user colors with specified list.
-//================================================================
-
+/*!
+ Replace the all user colors with specified list.
+*/
void QtxColorScale::setColors( const QValueList<QColor>& list )
{
if ( list.isEmpty() )
updateScale();
}
-//================================================================
-// Function : setColorMode
-// Purpose : Sets the color mode (Auto or User).
-//================================================================
-
+/*!
+ Sets the color mode (Auto or User).
+*/
void QtxColorScale::setColorMode( const int mode )
{
if ( myColorMode == mode )
updateScale();
}
-//================================================================
-// Function : setDumpMode
-// Purpose : Sets the dump mode.
-//================================================================
-
+/*!
+ Sets the dump mode.
+*/
void QtxColorScale::setDumpMode( const int mode )
{
myDumpMode = mode;
}
-//================================================================
-// Function : setLabelMode
-// Purpose : Sets the label mode (Auto or User).
-//================================================================
-
+/*!
+ Sets the label mode (Auto or User).
+*/
void QtxColorScale::setLabelMode( const int mode )
{
if ( myLabelMode != mode )
}
}
-//================================================================
-// Function : setLabelPosition
-// Purpose : Sets the label position.
-//================================================================
-
+/*!
+ Sets the label position.
+*/
void QtxColorScale::setLabelPosition( const int pos )
{
if ( myLabelPos != pos && pos >= None && pos <= Center )
}
}
-//================================================================
-// Function : setTitlePosition
-// Purpose : Sets the title position.
-//================================================================
-
+/*!
+ Sets the title position.
+*/
void QtxColorScale::setTitlePosition( const int pos )
{
if ( myTitlePos != pos && pos >= None && pos <= Center )
}
}
-//================================================================
-// Function : setFlags
-// Purpose : Set the specified flags.
-//================================================================
-
+/*!
+ Set the specified flags.
+*/
void QtxColorScale::setFlags( const int flags )
{
int prev = myFlags;
updateScale();
}
-//================================================================
-// Function : testFlags
-// Purpose : Returns true if specified flags are setted.
-//================================================================
-
+/*!
+ \return true if specified flags are setted.
+*/
bool QtxColorScale::testFlags( const int flags ) const
{
return ( myFlags & flags ) == flags;
}
-//================================================================
-// Function : clearFlags
-// Purpose : Clear (reset) the specified flags.
-//================================================================
-
+/*!
+ Clear (reset) the specified flags.
+*/
void QtxColorScale::clearFlags( const int flags )
{
int prev = myFlags;
updateScale();
}
-//================================================================
-// Function : minimumSizeHint
-// Purpose :
-//================================================================
-
+/*!
+ \return minimum size hint
+*/
QSize QtxColorScale::minimumSizeHint() const
{
QSize sz = calculateSize( true, myFlags, titlePosition() != None, labelPosition() != None, true );
return sz + QSize( frameWidth(), frameWidth() );
}
-//================================================================
-// Function : sizeHint
-// Purpose :
-//================================================================
-
+/*!
+ \return size hint
+*/
QSize QtxColorScale::sizeHint() const
{
QSize sz = calculateSize( false, myFlags, titlePosition() != None, labelPosition() != None, true );
return sz + QSize( frameWidth(), frameWidth() );
}
-//================================================================
-// Function : calculateSize
-// Purpose : Dump color scale into pixmap with current size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with current size.
+*/
QSize QtxColorScale::calculateSize( const bool min, const int flags, const bool title,
const bool labels, const bool colors ) const
{
return QSize( W, H );
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with current size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with current size.
+*/
QPixmap QtxColorScale::dump() const
{
QPixmap aPix;
return aPix;
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with specified size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with specified size.
+*/
QPixmap QtxColorScale::dump( const int w, const int h ) const
{
#if QT_VER < 3
#endif
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with specified size
-// and background color.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with specified size and background color.
+*/
QPixmap QtxColorScale::dump( const QColor& bg, const int w, const int h ) const
{
QPixmap aPix;
return aPix;
}
-//================================================================
-// Function : show
-// Purpose : Show the color scale. [Reimplemented]
-//================================================================
-
+/*!
+ Show the color scale. [Reimplemented]
+*/
void QtxColorScale::show()
{
#if QT_VER == 3
QFrame::show();
}
-//================================================================
-// Function : hide
-// Purpose : Hides the color scale. [Reimplemented]
-//================================================================
-
+/*!
+ Hides the color scale. [Reimplemented]
+*/
void QtxColorScale::hide()
{
#if QT_VER == 3
QFrame::hide();
}
-//================================================================
-// Function : drawContents
-// Purpose : Draw color scale contents. [Reimplemented]
-//================================================================
-
+/*!
+ Draw color scale contents. [Reimplemented]
+*/
void QtxColorScale::drawContents( QPainter* p )
{
if ( !isUpdatesEnabled() )
titlePosition() != None, labelPosition() != None, true );
}
-//================================================================
-// Function : drawScale
-// Purpose : Draw color scale contents.
-//================================================================
-
+/*!
+ Draw color scale contents.
+*/
void QtxColorScale::drawScale( QPainter* p, const bool transp, const int X, const int Y,
const int W, const int H, const bool title,
const bool label, const bool scale ) const
p->drawPixmap( X, Y, cache );
}
-//================================================================
-// Function : drawScale
-// Purpose : Draw color scale contents.
-//================================================================
-
+/*!
+ Draw color scale contents.
+*/
void QtxColorScale::drawScale( QPainter* p, const QColor& bg, const bool transp,
const int X, const int Y, const int W, const int H,
const bool drawTitle, const bool drawLabel, const bool drawColors ) const
}
}
-//================================================================
-// Function : getFormat
-// Purpose : Returns the format for number labels.
-//================================================================
-
+/*!
+ \return the format for number labels.
+*/
QString QtxColorScale::getFormat() const
{
QString aFormat = format();
return aFormat;
}
-//================================================================
-// Function : getNumber
-// Purpose : Returns the number for specified interval.
-//================================================================
-
+/*!
+ \return the number for specified interval.
+*/
double QtxColorScale::getNumber( const int idx ) const
{
double val = 0;
return val;
}
-//================================================================
-// Function : getLabel
-// Purpose : Returns the label for specified interval according
-// to the current label mode.
-//================================================================
-
+/*!
+ \return the label for specified interval according to the current label mode.
+*/
QString QtxColorScale::getLabel( const int idx ) const
{
QString res;
return res;
}
-//================================================================
-// Function : getColor
-// Purpose : Returns the color for specified interval according
-// to the current color mode.
-//================================================================
-
+/*!
+ \return the color for specified interval according to the current color mode.
+*/
QColor QtxColorScale::getColor( const int idx ) const
{
QColor res;
return res;
}
-//================================================================
-// Function : updateScale
-// Purpose : Update color scale if it required.
-//================================================================
-
+/*!
+ Update color scale if it required.
+*/
void QtxColorScale::updateScale()
{
update();
updateGeometry();
}
-//================================================================
-// Function : simpleRichText
-// Purpose : Return QSimpleRichText object for title. If title
-// not defined (empty string) then return null pointer.
-// Object should be deleted by caller function.
-//================================================================
-
+/*!
+ \return QSimpleRichText object for title. If title
+ not defined (empty string) then return null pointer.
+ Object should be deleted by caller function.
+*/
QSimpleRichText* QtxColorScale::simpleRichText( const int flags ) const
{
QSimpleRichText* srt = 0;
#if QT_VER == 3
-/*********************************************************************
-** Class: QtxColorScale::Dock
-** Descr: Dockable window contains the color scale.
-** Level: Public
-*********************************************************************/
-
-//================================================================
-// Function : Dock
-// Purpose : Constructor.
-//================================================================
+/*!
+ \class QtxColorScale::Dock
+ Dockable window contains the color scale.
+*/
+/*!
+ Constructor
+*/
QtxColorScale::Dock::Dock( Place p, QWidget* parent, const char* name, WFlags f )
: QDockWindow( p, parent, name, f ),
myBlockShow( false ),
setCaption( tr ( "Color scale" ) );
}
-//================================================================
-// Function : ~Dock
-// Purpose : Destructor.
-//================================================================
-
+/*!
+ Destructor.
+*/
QtxColorScale::Dock::~Dock()
{
}
-//================================================================
-// Function : colorScale
-// Purpose : Returns color scale widget.
-//================================================================
-
+/*!
+ \return color scale widget.
+*/
QtxColorScale* QtxColorScale::Dock::colorScale() const
{
return myScale;
}
-//================================================================
-// Function : activate
-// Purpose : Set the dockable window is visible for main window.
-//================================================================
-
+/*!
+ Set the dockable window is visible for main window.
+*/
void QtxColorScale::Dock::activate()
{
if ( myBlockShow )
mw->setAppropriate( this, true );
}
-//================================================================
-// Function : deactivate
-// Purpose : Set the dockable window is hidden for main window.
-//================================================================
-
+/*!
+ Set the dockable window is hidden for main window.
+*/
void QtxColorScale::Dock::deactivate()
{
if ( myBlockShow )
mw->setAppropriate( this, false );
}
-//================================================================
-// Function : isActive
-// Purpose : Returns true if the dockable window is visible.
-//================================================================
-
+/*!
+ \return true if the dockable window is visible.
+*/
bool QtxColorScale::Dock::isActive() const
{
QMainWindow* mw = 0;
return false;
}
-//================================================================
-// Function : show
-// Purpose : Reimplemented for internal reasons.
-//================================================================
-
+/*!
+ Redefined show
+*/
void QtxColorScale::Dock::show()
{
bool f = myBlockShow;
myBlockShow = f;
}
-//================================================================
-// Function : hide
-// Purpose : Reimplemented for internal reasons.
-//================================================================
-
+/*!
+ Redefined hide
+*/
void QtxColorScale::Dock::hide()
{
bool f = myBlockShow;
myBlockShow = f;
}
-//================================================================
-// Function : resize
-// Purpose : Make extent width as maximum value of widget width.
-//================================================================
-
+/*!
+ Make extent width as maximum value of widget width.
+*/
void QtxColorScale::Dock::resize( int w, int h )
{
QDockWindow::resize( w, h );
setFixedExtentHeight( QMAX( fixedExtent().height(), h ) );
}
-//================================================================
-// Function : setOrientation
-// Purpose :
-//================================================================
-
+/*!
+ Set orientation
+ \param o - new orientation
+*/
void QtxColorScale::Dock::setOrientation( Orientation o )
{
bool b = myBlockResize;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxColorScale.h
// Author: Sergey TELKOV
#pragma warning( disable:4251 )
#endif
+/*!
+ \class QtxColorScale
+ Color Scale widget.
+*/
class QTX_EXPORT QtxColorScale : public QFrame
{
Q_OBJECT
QSize calculateSize( const bool, const int,
const bool, const bool, const bool ) const;
- friend class Dock;
+#if QT_VER == 3
+ friend class QtxColorScale::Dock;
+#endif
private:
double myMin;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxComboBox.cxx
// Author: Sergey TELKOV
#include <qlineedit.h>
#include <qvaluelist.h>
+/*!
+ Constructor
+*/
QtxComboBox::QtxComboBox( QWidget* parent, const char* name )
: QComboBox( parent, name ),
myCleared( false )
connect( this, SIGNAL( activated( const QString& ) ), this, SLOT( onActivated( const QString& ) ) );
}
+/*!
+ Constructor
+*/
QtxComboBox::QtxComboBox( bool rw, QWidget* parent, const char* name )
: QComboBox( rw, parent, name ),
myCleared( false )
connect( this, SIGNAL( activated( const QString& ) ), this, SLOT( onActivated( const QString& ) ) );
}
+/*!
+ Destructor
+*/
QtxComboBox::~QtxComboBox()
{
}
+/*!
+ \return true if combobox is cleared
+*/
bool QtxComboBox::isCleared() const
{
return myCleared;
}
+/*!
+ Sets cleared status
+ \param isClear - new status
+*/
void QtxComboBox::setCleared( const bool isClear )
{
if ( myCleared == isClear )
update();
}
+/*!
+ Sets currently selected item
+ \param idx - index of item
+*/
void QtxComboBox::setCurrentItem( int idx )
{
if ( idx < 0 || idx >= count() )
QComboBox::setCurrentItem( idx );
}
+/*!
+ Sets current text
+ \param txt - new current text
+*/
void QtxComboBox::setCurrentText( const QString& txt )
{
myCleared = false;
#endif
}
+/*!
+ \return current selected id
+*/
int QtxComboBox::currentId() const
{
return id( currentItem() );
}
+/*!
+ Sets current selected id
+*/
void QtxComboBox::setCurrentId( int num )
{
setCurrentItem( index( num ) );
}
+/*!
+ Custom paint event handler
+*/
void QtxComboBox::paintEvent( QPaintEvent* e )
{
if ( !count() || !myCleared || editable() )
paintClear( e );
}
+/*!
+ SLOT: called if some item is activated
+ \param idx - index of activated item
+*/
void QtxComboBox::onActivated( int idx )
{
resetClear();
emit activatedId( myIndexId[idx] );
}
-void QtxComboBox::onActivated( const QString& )
+/*!
+ SLOT: called if some item is activated
+*/void QtxComboBox::onActivated( const QString& )
{
resetClear();
}
+/*!
+ Strips "cleared" state and updates
+*/
void QtxComboBox::resetClear()
{
if ( !myCleared )
update();
}
+/*!
+ Draws combobox when it is cleared or isn't editable
+*/
void QtxComboBox::paintClear( QPaintEvent* e )
{
int curIndex = currentItem();
setUpdatesEnabled( upd );
}
+/*!
+ \return id by index
+*/
int QtxComboBox::id( const int idx ) const
{
int id = -1;
return id;
}
+/*!
+ \return index by id
+*/
int QtxComboBox::index( const int id ) const
{
int idx = -1;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxComboBox.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDblSpinBox.cxx
// Author: Sergey TELKOV
#include <float.h>
-/*
- Class: QtxDblSpinBox::Validator [internal]
- Descr: Validator for QtxDblSpinBox (getted from Trolltech Qt - SpinBoxValidator)
+/*!
+ \class QtxDblSpinBox::Validator [internal]
+ Validator for QtxDblSpinBox (getted from Trolltech Qt - SpinBoxValidator)
*/
-
class QtxDblSpinBox::Validator : public QDoubleValidator
{
public:
QtxDblSpinBox* spinBox;
};
+
+/*!
+ Checks string and \return QValidator::State
+*/
QValidator::State QtxDblSpinBox::Validator::validate( QString& str, int& pos ) const
{
QString pref = spinBox->prefix();
return state;
}
-/*
- Class: QtxDblSpinBox
- Descr: Spin box for real numbers.
+/*!
+ Constructor
*/
-
QtxDblSpinBox::QtxDblSpinBox( QWidget* parent, const char* name )
: QSpinBox( parent, name ),
myCleared( false ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Constructor
+*/
QtxDblSpinBox::QtxDblSpinBox( double min, double max, double step, QWidget* parent, const char* name )
: QSpinBox( parent, name ),
myMin( min ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Destructor
+*/
QtxDblSpinBox::~QtxDblSpinBox()
{
}
+/*!
+ \return min value of spin box
+*/
double QtxDblSpinBox::minValue() const
{
return myMin;
}
+/*!
+ \return max value of spin box
+*/
double QtxDblSpinBox::maxValue() const
{
return myMax;
}
+/*!
+ Changes min value of spin box
+ \param min - new min value
+*/
void QtxDblSpinBox::setMinValue( int min )
{
setMinValue( (double)min );
}
+/*!
+ Changes min value of spin box
+ \param min - new min value
+*/
void QtxDblSpinBox::setMinValue( double min )
{
if ( myMin != min )
}
}
+/*!
+ Changes max value of spin box
+ \param max - new max value
+*/
void QtxDblSpinBox::setMaxValue( int max )
{
setMaxValue( (double)max );
}
+/*!
+ Changes max value of spin box
+ \param max - new max value
+*/
void QtxDblSpinBox::setMaxValue( double max )
{
if ( myMax != max )
}
}
+/*!
+ Changes min and max value of spin box
+ \param min - new min value
+ \param max - new max value
+*/
void QtxDblSpinBox::setRange( int min, int max )
{
setRange( (double)min, (double)max );
}
+/*!
+ Changes min and max value of spin box
+ \param min - new min value
+ \param max - new max value
+*/
void QtxDblSpinBox::setRange( double min, double max )
{
if ( myMin != min || myMax != max )
}
}
+/*!
+ \return step of spin box
+*/
double QtxDblSpinBox::lineStep() const
{
return myStep;
}
+/*!
+ Changes step of spin box
+ \param step - new step
+*/
void QtxDblSpinBox::setLineStep( int step )
{
setLineStep( (double)step );
}
+/*!
+ Changes step of spin box
+ \param step - new step
+*/
void QtxDblSpinBox::setLineStep( double step )
{
myStep = step;
}
+/*!
+ \return value of spin box
+*/
double QtxDblSpinBox::value() const
{
QSpinBox::value();
return myValue;
}
+/*!
+ Changes value of spin box
+ \param val - new value of spin box
+*/
void QtxDblSpinBox::setValue( int val )
{
setValue( (double)val );
}
+/*!
+ Changes value of spin box
+ \param val - new value of spin box
+*/
void QtxDblSpinBox::setValue( double val )
{
myCleared = false;
valueChange();
}
+/*!
+ Adds step to value
+*/
void QtxDblSpinBox::stepUp()
{
interpretText();
setValue( myValue + myStep );
}
+/*!
+ Subtracks step from value
+*/
void QtxDblSpinBox::stepDown()
{
interpretText();
setValue( myValue - myStep );
}
+/*!
+ \return number of digit after comma
+*/
int QtxDblSpinBox::precision() const
{
return myPrecision;
}
+/*!
+ Changes number of digit after comma
+ \param prec - new digit number
+*/
void QtxDblSpinBox::setPrecision( const int prec )
{
int newPrec = QMAX( prec, 0 );
updateDisplay();
}
+/*!
+ \return true if spin box is cleared
+*/
bool QtxDblSpinBox::isCleared() const
{
return myCleared;
}
+/*!
+ Changes cleared status of spin box
+ \param on - new status
+*/
void QtxDblSpinBox::setCleared( const bool on )
{
if ( myCleared == on )
updateDisplay();
}
+/*!
+ Selects all content of spin box editor
+*/
void QtxDblSpinBox::selectAll()
{
#if QT_VER >= 3
#endif
}
+/*!
+ Custom event filter, updates text of spin box editor
+*/
bool QtxDblSpinBox::eventFilter( QObject* o, QEvent* e )
{
if ( !myCleared || o != editor() || !editor()->text().stripWhiteSpace().isEmpty() )
return QSpinBox::eventFilter( o, e );
}
+/*!
+ Updates text of editor
+*/
void QtxDblSpinBox::updateDisplay()
{
if ( myBlocked )
myBlocked = isBlock;
}
+/*!
+ Sets double value by text in editor
+*/
void QtxDblSpinBox::interpretText()
{
myCleared = false;
updateDisplay();
}
+/*!
+ Emits signal "valueChanged"
+*/
void QtxDblSpinBox::valueChange()
{
updateDisplay();
emit valueChanged( currentValueText() );
}
+/*!
+ Attune parameters on range changing
+*/
void QtxDblSpinBox::rangeChange()
{
double min = QMIN( myMin, myMax );
updateDisplay();
}
+/*!
+ \return text of editor
+*/
QString QtxDblSpinBox::currentValueText()
{
QString s;
return s;
}
+/*!
+ Converts number to string
+ \param v - number to be converted
+*/
QString QtxDblSpinBox::mapValueToText( double v )
{
QString s;
return removeTrailingZeroes( s );
}
+/*!
+ Converts value to string
+*/
QString QtxDblSpinBox::mapValueToText( int )
{
QString s;
return removeTrailingZeroes( s );
}
+/*!
+ Converts current text of editor to double
+*/
double QtxDblSpinBox::mapTextToDoubleValue( bool* ok )
{
QString s = text();
return newVal;
}
+/*!
+ \return value corrected in accordance with borders
+ \param val - value to be corrected
+*/
double QtxDblSpinBox::bound( double val )
{
double newVal = val;
return newVal;
}
+/*!
+ Custom handler for leave event
+*/
void QtxDblSpinBox::leaveEvent( QEvent* e )
{
if ( !myCleared )
QSpinBox::leaveEvent( e );
}
+/*!
+ Custom handler for wheel event
+*/
void QtxDblSpinBox::wheelEvent( QWheelEvent* e )
{
if ( !isEnabled() )
updateDisplay();
}
+/*!
+ SLOT: called if text is changed
+*/
void QtxDblSpinBox::onTextChanged( const QString& str )
{
if ( !myBlocked )
myCleared = false;
}
+/*!
+ \return string without excess zeros in start and in end
+*/
QString QtxDblSpinBox::removeTrailingZeroes( const QString& src ) const
{
QString delim( "." );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDblSpinBox.h
// Author: Sergey TELKOV
#include <qspinbox.h>
+/*!
+ \class QtxDblSpinBox
+ Spin box for real numbers.
+*/
class QTX_EXPORT QtxDblSpinBox : public QSpinBox
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDblValidator.cxx
// Author: Alexandre SOLOVYOV
#include "QtxDblValidator.h"
+/*!
+ Constructor
+ \param bot - minimal possible value
+ \param top - maximal possible value
+ \param dec - number of digits
+ \param o - parent object
+ \param name - name of validator
+*/
QtxDblValidator::QtxDblValidator( const double bot, const double top, const int dec,
QObject* o, const char* name )
: QDoubleValidator( bot, top, dec, o, name )
{
}
+/*!
+ Destructor
+*/
QtxDblValidator::~QtxDblValidator()
{
}
+/*!
+ Corrects string: if it represent double value less then bottom, it becomes equal to bottom,
+ if it is more then top, it becomes equal to top, if it isn't number is becomes '0'
+*/
void QtxDblValidator::fixup( QString& str ) const
{
bool ok = false;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDblValidator.h
// Author: Alexandre SOLOVYOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDialog.cxx
// Author: Sergey TELKOV
Class: QtxDialog::Area
Level: Internal
*/
-
class QtxDialog::Area : public QFrame
{
public:
Orientation myOrientation;
};
+/*!
+ Contructor
+*/
QtxDialog::Area::Area( Orientation o, QtxDialog* dlg, QWidget* parent )
: QFrame( parent ),
myDlg( dlg ),
hide();
}
+/*!
+ Destructor
+*/
QtxDialog::Area::~Area()
{
}
+/*!
+ Inserts button to area
+ \param b - button
+*/
void QtxDialog::Area::insertButton( QButton* b )
{
if ( !b || myButtons.findRef( b ) != -1 )
updateBorder();
}
+/*!
+ Removes button from area
+ \param b - button
+*/
void QtxDialog::Area::removeButton( QButton* b )
{
if ( !b )
layoutButtons();
}
+/*!
+ \return true if area contains button
+ \param b - button
+*/
bool QtxDialog::Area::contains( QButton* b ) const
{
return myButtons.containsRef( b );
}
+/*!
+ \return policy of button layouting.
+*/
int QtxDialog::Area::policy() const
{
return myPolicy;
}
+/*!
+ Changes policy of button layouting.
+ \param p - new policy
+*/
void QtxDialog::Area::setPolicy( const int p )
{
if ( myPolicy == p )
layoutButtons();
}
+/*!
+ \return true if border enabled
+*/
bool QtxDialog::Area::isBorderEnabled() const
{
return myLine && myBorder;
}
+/*!
+ Enables/disable separator between main frame and button frame
+ \param on - new state
+*/
void QtxDialog::Area::setBorderEnabled( const bool on )
{
if ( !myLine || myBorder == on )
updateBorder();
}
+/*!
+ Sets label as separator between main frame and button frame
+ \param line - new separator
+*/
void QtxDialog::Area::setBorderWidget( QLabel* line )
{
if ( myLine == line )
updateBorder();
}
+/*!
+ \return const reference to list of buttons
+*/
const QPtrList<QButton>& QtxDialog::Area::buttons() const
{
return myButtons;
}
+/*!
+ Updates visibility of border
+*/
void QtxDialog::Area::updateBorder()
{
if ( !myLine )
myLine->setLineWidth( myBorder ? 1 : 0 );
}
+/*!
+ Installs buttons into layout
+*/
void QtxDialog::Area::layoutButtons()
{
int aPolicy = policy();
Qtx::setTabOrder( wids );
}
+
/*!
- Class: QtxDialog::Border
- Level: Internal
-*/
+ \class QtxDialog::Border
+ Special label used as separator between main frame and button frame
+*/
class QtxDialog::Border : public QLabel
{
public:
virtual QSize minimumSizeHint() const;
};
+/*!
+ Constructor
+*/
QtxDialog::Border::Border( QWidget* parent )
: QLabel( parent )
{
setAlignment( Qt::AlignCenter );
}
+/*!
+ Destructor
+*/
QtxDialog::Border::~Border()
{
}
+/*!
+ Set line width of separator
+ \param lw - new line width
+*/
void QtxDialog::Border::setLineWidth( int lw )
{
bool isOn = lineWidth() > 0;
updateGeometry();
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxDialog::Border::sizeHint() const
{
QSize sz( 5, 5 );
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxDialog::Border::minimumSizeHint() const
{
return sizeHint();
}
/*!
- Class: QtxDialog
- Level: Public
+ Constructor
+ Construct a dialog with specified parent and name.
+ \param modal define modal status of dialog (default non modal dialog created).
+ \param allowResize - if it is true then dialog can be resize by user (default non resizable dialog created).
+ \param Button flags specified control buttons for dialog (default buttons is OK, Cancel and Help).
+ \param Widget flags used as in any widget.
*/
-
-/*!
- Name: QtxDialog [public]
- Desc: Construct a dialog with specified parent and name.
- Parameter 'modal' define modal status of dialog (default non modal
- dialog created). If parameter 'allowResize' is true then dialog
- can be resize by user (default non resizable dialog created).
- Button flags specified control buttons for dialog (default buttons
- is OK, Cancel and Help). Widget flags used as in any widget.
-*/
-
QtxDialog::QtxDialog( QWidget* parent, const char* name,
bool modal, bool allowResize, const int f, WFlags wf )
: QDialog( parent, name, modal,
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDialog.hxx
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxDirListEditor.h"
*/
void QtxDirListEditor::getPathList(QStringList& list)
{
+ // Finish the path editing
+ if (myEdit) {
+ validate(true);
+
+ myEdit->deleteLater();
+ myBtn->deleteLater();
+ myEdit = 0;
+ myBtn = 0;
+ myEdited = false;
+ myDirList->setFocus();
+ }
+
list.clear();
for (unsigned i = 0; i < myDirList->count()-1; i++)
list.append(myDirList->text(i));
/*!
Validates entered path, returns true if OK
*/
-bool QtxDirListEditor::validate()
+bool QtxDirListEditor::validate( const bool quietMode )
{
if ( myEdited )
{
- QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).absFilePath();
+ QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).filePath();
/*
#ifndef WNT
if ( dirPath.startsWith( "~") ) {
if (found) {
if (found != myLastSelected) {
// it is forbidden to add directory more then once
- QMessageBox::critical(this,
- tr("Error"),
- tr("Directory already specified."),
- tr("Ok"));
+ if ( !quietMode )
+ QMessageBox::critical(this,
+ tr("Error"),
+ tr("Directory already specified."),
+ tr("Ok"));
myEdit->setFocus();
return false;
}
}
else {
if (!dir.exists()) {
- if ( QMessageBox::information(this,
- tr("Warning"),
- tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
- tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
+ if ( !quietMode && QMessageBox::information(this,
+ tr("Warning"),
+ tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
+ tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
myEdit->setFocus();
return false;
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef QTX_DIRLISTEDITOR_H
#define QTX_DIRLISTEDITOR_H
* \brief Validates entered path
* \retval bool - returns status (true if OK)
*/
- bool validate();
+ bool validate( const bool quietMode = false );
/*!
* \brief Appends/changes path
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDockAction.cxx
// Author: Sergey TELKOV
#include <qdockarea.h>
#include <qdockwindow.h>
#include <qmainwindow.h>
+#include <qobjectlist.h>
#include <qapplication.h>
/*!
return QtxAction::removeFrom( wid );
}
+/*!
+ Sets menu text of action
+ \param txt - new menu text
+*/
void QtxDockAction::setMenuText( const QString& txt )
{
if ( menuText() == txt )
if ( !mw )
return;
- lst = mw->dockWindows();
+ QObjectList* objs = mw->queryList( "QDockWindow" );
+ if ( objs )
+ {
+ for ( QObjectListIt it( *objs ); it.current(); ++it )
+ {
+ QDockWindow* dockWin = ::qt_cast<QDockWindow*>( it.current() );
+ if ( dockWin && dockMainWindow( mw, dockWin ) )
+ lst.append( dockWin );
+ }
+ }
+ delete objs;
+}
+
+/*!
+ \return true if main window is parent of object
+ \param mw - main window
+ \param win - object
+*/
+bool QtxDockAction::dockMainWindow( QMainWindow* mw, QObject* win ) const
+{
+ if ( !mw || !win )
+ return false;
+
+ while ( win )
+ {
+ if ( win->parent() && win->parent() == mw )
+ return true;
+
+ if ( ::qt_cast<QMainWindow*>( win->parent() ) )
+ return false;
+
+ win = win->parent();
+ }
+
+ return false;
}
/*!
if ( !myInfo.contains( dw ) )
return;
+ QMainWindow* mw = mainWindow();
+ if ( !mw )
+ return;
+
+ QObject* p = dw->parent();
+ if ( !( !p || p == mw || ( p->parent() && p->parent() == mw ) ) )
+ return;
+
QString winName = myInfo[dw].name;
if ( winName.isEmpty() || !myGeom.contains( winName ) )
return;
QMap<QString, QDockWindow*> nameMap;
for ( QPtrListIterator<QDockWindow> itr( lst ); itr.current(); ++itr )
{
+ QObject* p = itr.current()->parent();
+ if ( !( !p || p == mw || ( p->parent() && p->parent() == mw ) ) )
+ continue;
+
QString name;
if ( myInfo.contains( itr.current() ) )
name = myInfo[itr.current()].name;
}
}
+/*!
+ Updates menu of action
+*/
void QtxDockAction::updateMenus()
{
for ( MenuMap::Iterator it = myMenu.begin(); it != myMenu.end(); ++it )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDockAction.h
// Author: Sergey TELKOV
void updateMenus();
+ bool dockMainWindow( QMainWindow*, QObject* ) const;
+
private:
enum { AutoAdd = QEvent::User, LoadArea };
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDockWindow.cxx
// Author: Sergey TELKOV
#include <qapplication.h>
/*!
- Class: QtxDockWindow::Watcher [Internal]
- Descr: Internal object with event filter.
+ \class QtxDockWindow::Watcher [Internal]
+ Internal object with event filter.
*/
-
class QtxDockWindow::Watcher : public QObject
{
public:
bool myVisible;
};
+/*!
+ Constructor
+*/
QtxDockWindow::Watcher::Watcher( QtxDockWindow* cont )
: QObject( cont ), myCont( cont ),
myState( true ),
installFilters();
}
+/*!
+ Custom event filter
+*/
bool QtxDockWindow::Watcher::eventFilter( QObject* o, QEvent* e )
{
if ( o == myCont &&
return false;
}
+/*!
+ Sets internal status to shown
+*/
void QtxDockWindow::Watcher::shown( QtxDockWindow* dw )
{
if ( dw != myCont )
myVisible = true;
}
+/*!
+ Sets internal status to hidden
+*/
void QtxDockWindow::Watcher::hided( QtxDockWindow* dw )
{
if ( dw != myCont )
myVisible = false;
}
+/*!
+ Shows corresponding dock window
+*/
void QtxDockWindow::Watcher::showContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Hides corresponding dock window
+*/
void QtxDockWindow::Watcher::hideContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Event filter of custom events
+*/
void QtxDockWindow::Watcher::customEvent( QCustomEvent* e )
{
installFilters();
updateVisibility();
}
+/*!
+ Installs this object as event filter to all widgets inside corresponding main window
+*/
void QtxDockWindow::Watcher::installFilters()
{
if ( !myCont )
}
}
+/*!
+ Updates visibility of all widgets inside corresponding main window
+*/
void QtxDockWindow::Watcher::updateVisibility()
{
if ( !myCont )
vis ? showContainer() : hideContainer();
}
+/*!
+ Updates icon of corresponding main window
+*/
void QtxDockWindow::Watcher::updateIcon()
{
if ( !myCont || !myCont->widget() )
myCont->setIcon( ico ? *ico : QPixmap() );
}
+/*!
+ Updates caption of corresponding main window
+*/
void QtxDockWindow::Watcher::updateCaption()
{
if ( myCont && myCont->widget() && !myCont->widget()->caption().isNull() )
}
/*!
- Class: QtxDockWindow [Public]
- Descr:
+ Constructor
*/
-
QtxDockWindow::QtxDockWindow( Place p, QWidget* parent, const char* name, WFlags f )
: QDockWindow( p, parent, name, f ),
myWatcher( 0 ),
{
}
+/*!
+ Constructor
+*/
QtxDockWindow::QtxDockWindow( const bool watch, QWidget* parent, const char* name, WFlags f )
: QDockWindow( InDock, parent, name, f ),
myWatcher( 0 ),
myWatcher = new Watcher( this );
}
+/*!
+ Constructor
+*/
QtxDockWindow::QtxDockWindow( QWidget* parent, const char* name, WFlags f )
: QDockWindow( InDock, parent, name, f ),
myWatcher( 0 ),
{
}
+/*!
+ Destructor
+*/
QtxDockWindow::~QtxDockWindow()
{
}
+/*!
+ Sets the dock window's main widget
+ \param wid - new main widget
+*/
void QtxDockWindow::setWidget( QWidget* wid )
{
if ( wid )
QDockWindow::setWidget( wid );
}
+/*!
+ \return true if the dock window is stretchable
+*/
bool QtxDockWindow::isStretchable() const
{
return myStretch;
}
+/*!
+ Sets the dock window "stretchable" state
+ \param on - new state
+*/
void QtxDockWindow::setStretchable( const bool on )
{
if ( myStretch == on )
}
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxDockWindow::sizeHint() const
{
QSize sz = QDockWindow::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxDockWindow::minimumSizeHint() const
{
QSize sz = QDockWindow::minimumSizeHint();
return sz;
}
+/*!
+ \return corresponding main window
+*/
QMainWindow* QtxDockWindow::mainWindow() const
{
QMainWindow* mw = 0;
return mw;
}
+/*!
+ Shows window
+*/
void QtxDockWindow::show()
{
if ( myWatcher )
QDockWindow::show();
}
+/*!
+ Hides window
+*/
void QtxDockWindow::hide()
{
if ( myWatcher )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxDockWindow.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxGroupBox.cxx
// Author: Sergey TELKOV
#include <qapplication.h>
#include <qobjectlist.h>
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( QWidget* parent, const char* name )
: QGroupBox( parent, name ),
myContainer( 0 )
{
}
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( const QString& title, QWidget* parent, const char* name )
: QGroupBox( title, parent, name ),
myContainer( 0 )
initialize();
}
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( int strips, Orientation o, QWidget* parent, const char* name )
: QGroupBox( strips, o, parent, name ),
myContainer( 0 )
initialize();
}
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( int strips, Orientation o, const QString& title,
QWidget* parent, const char* name )
: QGroupBox( strips, o, title, parent, name ),
initialize();
}
+/*!
+ Destructor
+*/
QtxGroupBox::~QtxGroupBox()
{
delete myContainer;
}
+/*!
+ Creates horizontal box as container
+*/
void QtxGroupBox::initialize()
{
myContainer = new QHBox( this, 0, WStyle_Customize | WStyle_NoBorderEx | WStyle_Tool );
#if QT_VER < 3
+/*!
+ \return the width of the empty space between the items in the group and the frame of the group
+*/
int QtxGroupBox::insideMargin() const
{
int m = 0;
return m;
}
+/*!
+ \return the width of the empty space between each of the items in the group
+*/
int QtxGroupBox::insideSpacing() const
{
int s = 0;
return s;
}
+/*!
+ Sets the width of the empty space between the items in the group and the frame of the group
+*/
void QtxGroupBox::setInsideMargin( int m )
{
if ( layout() )
layout()->setMargin( m );
}
+/*!
+ Sets the width of the empty space between each of the items in the group
+*/
void QtxGroupBox::setInsideSpacing( int s )
{
if ( layout() )
#endif
+/*!
+ Inserts title widget
+ \param wid - new title widget
+*/
void QtxGroupBox::insertTitleWidget( QWidget* wid )
{
if ( !myContainer )
updateTitle();
}
+/*!
+ Removes title widget
+ \param wid - title widget
+*/
void QtxGroupBox::removeTitleWidget( QWidget* wid )
{
if ( !myContainer || wid->parentWidget() != myContainer )
updateTitle();
}
+/*!
+ Calculates margin
+*/
void QtxGroupBox::adjustInsideMargin()
{
QApplication::sendPostedEvents( myContainer, QEvent::ChildInserted );
setInsideMargin( myContainer->height() );
}
+/*!
+ Sets the alignment of the group box title
+*/
void QtxGroupBox::setAlignment( int align )
{
QGroupBox::setAlignment( align );
updateTitle();
}
+/*!
+ Sets title of groop box
+*/
void QtxGroupBox::setTitle( const QString& title )
{
QGroupBox::setTitle( title );
updateTitle();
}
+/*!
+ Changes the layout of the group box
+ \param strips - number of column/rows
+ \param o - orientation
+*/
void QtxGroupBox::setColumnLayout( int strips, Orientation o )
{
if ( myContainer )
updateTitle();
}
+/*!
+ Shows group box
+*/
void QtxGroupBox::show()
{
QGroupBox::show();
updateTitle();
}
+/*!
+ Updates group box
+*/
void QtxGroupBox::update()
{
QGroupBox::update();
updateTitle();
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxGroupBox::sizeHint() const
{
QSize sz = QGroupBox::sizeHint();
return QSize( QMAX( sz.width(), sw ), sz.height() );
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxGroupBox::minimumSizeHint() const
{
QSize sz = QGroupBox::minimumSizeHint();
return QSize( QMAX( sz.width(), sw ), sz.height() );
}
+/*!
+ Custom event filter
+*/
bool QtxGroupBox::eventFilter( QObject* obj, QEvent* e )
{
QEvent::Type type = e->type();
return QGroupBox::eventFilter( obj, e );
}
+/*!
+ Custom resize event filter
+*/
void QtxGroupBox::resizeEvent( QResizeEvent* e )
{
QGroupBox::resizeEvent( e );
updateTitle();
}
+/*!
+ Custom child event filter
+*/
void QtxGroupBox::childEvent( QChildEvent* e )
{
if ( e->type() == QEvent::ChildInserted && e->child() == myContainer )
QGroupBox::childEvent( e );
}
+/*!
+ Event filter of custom items
+*/
void QtxGroupBox::customEvent( QCustomEvent* )
{
updateTitle();
}
+/*!
+ On frame changed
+*/
void QtxGroupBox::frameChanged()
{
updateTitle();
}
+/*!
+ \return size of title
+*/
QSize QtxGroupBox::titleSize() const
{
QSize sz( 0, 0 );
return QSize( w, h );
}
+/*!
+ Updates title
+*/
void QtxGroupBox::updateTitle()
{
if ( !myContainer )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxGroupBox.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxIntSpinBox.cxx
// Author: Sergey TELKOV
#include <qlineedit.h>
#include <qapplication.h>
+/*!
+ Constructor
+*/
QtxIntSpinBox::QtxIntSpinBox( QWidget* parent, const char* name )
: QSpinBox( parent, name ),
myCleared( false ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Constructor
+*/
QtxIntSpinBox::QtxIntSpinBox( int min, int max, int step, QWidget* parent, const char* name )
: QSpinBox( min, max, step, parent, name ),
myCleared( false ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Destructor
+*/
QtxIntSpinBox::~QtxIntSpinBox()
{
}
+/*!
+ \return true if spin box is cleared
+*/
bool QtxIntSpinBox::isCleared() const
{
return myCleared;
}
+/*!
+ Changes cleared status of spin box
+ \param on - new status
+*/
void QtxIntSpinBox::setCleared( const bool on )
{
if ( myCleared == on )
updateDisplay();
}
+/*!
+ Changes value of spin box
+ \param val - new value of spin box
+*/
void QtxIntSpinBox::setValue( int value )
{
myCleared = false;
QSpinBox::setValue( value );
}
+/*!
+ Custom event filter
+*/
bool QtxIntSpinBox::eventFilter( QObject* o, QEvent* e )
{
if ( !myCleared || o != editor() || !editor()->text().stripWhiteSpace().isEmpty() )
return QSpinBox::eventFilter( o, e );
}
+/*!
+ Sets integer value by text in editor
+*/
void QtxIntSpinBox::interpretText()
{
myCleared = false;
QSpinBox::interpretText();
}
+/*!
+ Updates text of editor
+*/
void QtxIntSpinBox::updateDisplay()
{
if ( myBlocked )
myBlocked = block;
}
+/*!
+ Custom handler for leave event
+*/
void QtxIntSpinBox::leaveEvent( QEvent* e )
{
if ( !myCleared )
QSpinBox::leaveEvent( e );
}
+/*!
+ Custom handler for wheel event
+*/
void QtxIntSpinBox::wheelEvent( QWheelEvent* e )
{
if ( !isEnabled() )
updateDisplay();
}
+/*!
+ SLOT: called if text is changed
+*/
void QtxIntSpinBox::onTextChanged( const QString& )
{
if ( !myBlocked )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxIntSpinBox.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxListAction.cxx
// Author: Sergey TELKOV (Based on code by Eugene AKSENOV)
};
/*!
- Class: QtxListAction::ToolButton
- Level: Internal
+ \class QtxListAction::ToolButton
+ Custom tool button
*/
-
class QtxListAction::ToolButton : public QToolButton
{
public:
QtxListAction* myAction;
};
+/*!
+ Constructor
+*/
QtxListAction::ToolButton::ToolButton( QtxListAction* a, QWidget* parent, const char* name )
: QToolButton( parent, name ),
myAction( a )
setIconSet( QPixmap( list_arrow_icon ) );
}
+/*!
+ Destructor
+*/
QtxListAction::ToolButton::~ToolButton()
{
if ( myAction )
myAction->controlDeleted( this );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxListAction::ToolButton::sizeHint() const
{
QSize sz = iconSet().pixmap().size();
}
/*!
- Class: QtxListAction
- Level: Public
+ Constructs an list action with given parent and name. If toggle is true the
+ action will be a toggle action, otherwise it will be a command action.
*/
-
-/*!
- Name: QtxListAction [public]
- Desc: Constructs an list action with given parent and name. If toggle is true the
- action will be a toggle action, otherwise it will be a command action.
-*/
-
QtxListAction::QtxListAction( QObject* parent, const char* name, bool toggle )
: QtxAction( parent, name, toggle ),
myFrame( 0 ),
}
/*!
- Name: QtxListAction [public]
- Desc: This constructor creates an action with the following properties: the
- description text, the icon or iconset icon, the menu text and keyboard
- accelerator. It is a child of given parent and named specified name.
- If toggle is true the action will be a toggle action, otherwise it will
- be a command action.
+ This constructor creates an action with the following properties: the
+ description text, the icon or iconset icon, the menu text and keyboard
+ accelerator. It is a child of given parent and named specified name.
+ If toggle is true the action will be a toggle action, otherwise it will
+ be a command action.
*/
QtxListAction::QtxListAction( const QString& text, const QIconSet& icon,
}
/*!
- Name: QtxListAction [public]
- Desc: This constructor creates an action with the following properties: the
- description text, the menu text and keyboard accelerator. It is a child
- of given parent and named specified name. If toggle is true the action
- will be a toggle action, otherwise it will be a command action.
+ This constructor creates an action with the following properties: the
+ description text, the menu text and keyboard accelerator. It is a child
+ of given parent and named specified name. If toggle is true the action
+ will be a toggle action, otherwise it will be a command action.
*/
QtxListAction::QtxListAction( const QString& text, const QString& menuText,
}
/*!
- Name: ~QtxListAction [virtual public]
- Desc: Destructor.
+ Destructor.
*/
QtxListAction::~QtxListAction()
myMode = mode;
}
+/*!
+ \return list of names
+*/
QStringList QtxListAction::names() const
{
QStringList lst;
myFrame->hide();
}
+/*!
+ SLOT: called when frame is hidden
+*/
void QtxListAction::onHided()
{
for ( ButtonsMap::Iterator bit = myButtons.begin(); bit != myButtons.end(); ++bit )
}
}
-/**********************************************************************
-** Class: QtxListFrame
-** Descr: Frame for the list of actions
-** Level: Internal
-***********************************************************************/
-
+/*!
+ \class QtxListFrame
+ Frame for the list of actions
+*/
class QtxListFrame::ScrollEvent : public QCustomEvent
{
public:
setFrameStyle( Panel | Raised );
}
+/*!
+ Destructor
+*/
QtxListFrame::~QtxListFrame()
{
if ( myAction )
setNames( myNames );
}
+/*!
+ Adds a names to the list. Truncates the name to fit to the frame width.
+ Use QtxListAction::setMaxLineChar( int ) to set the width in characters. [ public ]
+*/
+
void QtxListFrame::addNames( const QStringList& names )
{
for ( QStringList::ConstIterator it = names.begin(); it != names.end(); ++it )
}
}
+/*!
+ \return list of names
+*/
const QStringList QtxListFrame::names() const
{
return myNames;
myComment->setText( com );
}
+/*!
+ Sets owner
+ \param wo - new owner
+*/
void QtxListFrame::setOwner( QWidget* wo )
{
myOwner = wo;
return true;
}
+/*!
+ Custom event filter
+*/
bool QtxListFrame::event( QEvent* e )
{
if ( e->type() != (int)ScrollEvent::Scroll )
updateComment();
}
+/*!
+ return number of selected items
+*/
int QtxListFrame::selected() const
{
uint sel = 0;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxListAction.hxx
// Author: Sergey TELKOV (Based on code by Eugene AKSENOV)
friend class QtxListFrame;
};
-/*************************************
-** Class: QtxListFrame
-** Level: Internal
-*************************************/
-
+/*!
+ \class QtxListFrame
+*/
class QtxListFrame : public QFrame
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxListBox.cxx
// Author: Sergey TELKOV
#include <qpixmap.h>
#include <qlineedit.h>
+/*!
+ Constructor
+*/
QtxListBox::QtxListBox( QWidget* parent, const char* name, WFlags f )
: QListBox( parent, name, f ),
myEditor( 0 ),
this, SLOT( onContentsMoving( int, int ) ) );
}
+/*!
+ Destructor
+*/
QtxListBox::~QtxListBox()
{
}
+/*!
+ \return true if editing is enabled
+*/
bool QtxListBox::isEditEnabled() const
{
return myEditState;
}
+/*!
+ Enables/disables editing
+ \param on - new state
+*/
void QtxListBox::setEditEnabled( bool on )
{
if ( isEditEnabled() == on )
endEdition( defaultEditAction() );
}
+/*!
+ \return default edit action
+ \sa setDefaultEditAction()
+*/
bool QtxListBox::defaultEditAction() const
{
return myEditDefault;
}
+/*!
+ Changes default edit action.
+ Pressing of ENTER button always accepts new value of edited item.
+ But other ways, such as focus out or edition of other item accepts
+ new value of edited item only if "default edit action" is true
+ \param def - new value
+*/
void QtxListBox::setDefaultEditAction( bool def )
{
myEditDefault = def;
}
+/*!
+ \return modification enabled state
+ \sa setModificationEnabled()
+*/
bool QtxListBox::isModificationEnabled() const
{
return myModifEnabled;
}
+/*!
+ Changes "modification enabled" state
+ If it is true, then pressing of CTRL + { Up, Down, Home, End } allows move items in list
+ \param on - new state
+*/
void QtxListBox::setModificationEnabled( bool on )
{
myModifEnabled = on;
}
+/*!
+ \return current edited item
+*/
QListBoxItem* QtxListBox::editedItem() const
{
return item( editedIndex() );
}
+/*!
+ \return current edited index
+*/
int QtxListBox::editedIndex() const
{
return myEditIndex;
}
+/*!
+ Starts edition of item
+ \param idx - index of item
+*/
void QtxListBox::startEdition( const int idx )
{
if ( idx < 0 || editedIndex() == idx || !isEditEnabled() )
ed->setFocus();
}
+/*!
+ Starts edition of item
+ \param item - item to be edited
+*/
void QtxListBox::startEdition( const QListBoxItem* item )
{
startEdition( index( item ) );
}
+/*!
+ Finishes edition of item
+ \param action - if it is true, then new values must be accepted
+*/
void QtxListBox::endEdition( const bool action )
{
int idx = editedIndex();
}
}
+/*!
+ Ensures that the item is visible.
+ \param idx - index of item
+*/
void QtxListBox::ensureItemVisible( const int idx )
{
if ( idx < 0 )
setTopItem( idx );
}
+/*!
+ Ensures that the item is visible.
+ \param item - item to be made visible
+*/
void QtxListBox::ensureItemVisible( const QListBoxItem* item )
{
ensureItemVisible( index( item ) );
}
+/*!
+ \return validator of item editor
+*/
const QValidator* QtxListBox::validator() const
{
const QValidator* v = 0;
return v;
}
+/*!
+ Removes validator of item editor
+*/
void QtxListBox::clearValidator()
{
if ( editor() )
editor()->clearValidator();
}
+/*!
+ Changes validator of item editor
+ \param v - new validator
+*/
void QtxListBox::setValidator( const QValidator* v )
{
if ( editor() )
editor()->setValidator( v );
}
+/*!
+ Moves item to top
+ \param idx - index of item
+*/
void QtxListBox::moveItemToTop( const int idx )
{
moveItem( idx, -idx );
}
+/*!
+ Moves item to bottom
+ \param idx - index of item
+*/
void QtxListBox::moveItemToBottom( const int idx )
{
moveItem( idx, count() - idx );
}
+/*!
+ Moves item
+ \param idx - index of item
+ \param step - changing of position
+*/
void QtxListBox::moveItem( const int idx, const int step )
{
QListBoxItem* i = item( idx );
emit itemMoved( idx, pos );
}
+/*!
+ Inserts empty item
+ \param i - position of item (if it is less than 0, then current position is used)
+*/
void QtxListBox::createItem( const int i )
{
if ( !isEditEnabled() )
startEdition( idx );
}
+/*!
+ Removes item
+ \param i - position of item (if it is less than 0, then current position is used)
+*/
void QtxListBox::deleteItem( const int i )
{
if ( !isEditEnabled() )
updateEditor();
}
+/*!
+ Scrolls the content so that the point is in the top-left corner.
+ \param x, y - point co-ordinates
+*/
void QtxListBox::setContentsPos( int x, int y )
{
QListBox::setContentsPos( x, y );
updateEditor();
}
+/*!
+ Custom event filter, performs finish of edition on focus out, escape/return/enter pressing
+*/
bool QtxListBox::eventFilter( QObject* o, QEvent* e )
{
if ( editor() == o )
return QListBox::eventFilter( o, e );
}
+/*!
+ Custom key press event handler
+ Allows to move items by CTRL + { Up, Down, Home, End }
+*/
void QtxListBox::keyPressEvent( QKeyEvent* e )
{
if ( e->key() == Key_Up && e->state() & ControlButton && isModificationEnabled() )
QListBox::keyPressEvent( e );
}
+/*!
+ Custom resize event handler
+*/
void QtxListBox::viewportResizeEvent( QResizeEvent* e )
{
QListBox::viewportResizeEvent( e );
updateEditor();
}
+/*!
+ Custom mouse double click event handler
+*/
void QtxListBox::mouseDoubleClickEvent( QMouseEvent* e )
{
if ( isEditEnabled() )
QListBox::mouseDoubleClickEvent( e );
}
+/*!
+ Updates editor on contents moving
+*/
void QtxListBox::onContentsMoving( int, int )
{
updateEditor();
}
+/*!
+ \return item editor
+*/
QLineEdit* QtxListBox::editor() const
{
if ( !myEditor )
return myEditor;
}
+/*!
+ Creates item editor
+*/
void QtxListBox::createEditor()
{
if ( myEditor )
addChild( myEditor );
}
+/*!
+ Updates item editor
+*/
void QtxListBox::updateEditor()
{
if ( !editedItem() || !editor() )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxListBox.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxListOfOperations.h"
#include <stdarg.h>
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+*/
QtxListOfOperations::QtxListOfOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxListOfOperations::~QtxListOfOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return fills list with brackets symbols
+ \param list - list to be filled
+ \param open - if it is true, it is necessary to fill with open brackets otherwise with close
+*/
void QtxListOfOperations::bracketsList( QStringList& list, bool open ) const
{
OperationSetsIterator anIt = mySets.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list with operation names
+*/
void QtxListOfOperations::opersList( QStringList& list ) const
{
OperationSetsIterator anIt = mySets.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Create some value by it's string representation
+*/
bool QtxListOfOperations::createValue( const QString& str, QtxValue& val ) const
{
bool ok;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of operation
+*/
int QtxListOfOperations::prior( const QString& op, bool isBin ) const
{
OperationSetsIterator anIt = mySets.begin(),
return prior>0 ? prior : 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return whether values with passed types are valid for arguments of operation
+ \param op - name of operation
+ \param t1 - type of first argument
+ \param t2 - type of second argument
+*/
QtxParser::Error QtxListOfOperations::isValid( const QString& op,
const QVariant::Type t1,
const QVariant::Type t2 ) const
return err;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxListOfOperations::calculate( const QString& op,
QtxValue& v1,
QtxValue& v2 ) const
return QtxParser::InvalidOperation;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Clears list of operations
+*/
void QtxListOfOperations::clear()
{
mySets.clear();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if list contains operations
+ \param name - name of operation
+*/
bool QtxListOfOperations::has( const QString& name ) const
{
OperationSetsIterator anIt = mySets.begin(),
return false;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Appends operations to list
+ \param name - name of operations
+ \param oper - operations
+ \param prior - additional prior
+*/
void QtxListOfOperations::append( const QString& name, QtxOperations* oper,
int prior )
{
insert( name, oper, prior );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Prepends operations to list
+ \param name - name of operations
+ \param oper - operations
+ \param prior - additional prior
+*/
void QtxListOfOperations::prepend( const QString& name, QtxOperations* oper,
int prior )
{
insert( name, oper, prior, 0 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Inserts operations to list
+ \param name - name of operations
+ \param oper - operations
+ \param prior - additional prior
+ \param pos - insert position
+*/
void QtxListOfOperations::insert( const QString& name, QtxOperations* oper,
int prior, int pos )
{
mySets.insert( mySets.at( pos ), op );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes operations from list
+ \param name - name of operations
+*/
void QtxListOfOperations::remove( const QString& name )
{
OperationSets::iterator anIt = mySets.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return count of operations in list
+*/
int QtxListOfOperations::count() const
{
return mySets.count();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return operations by name
+ \name - name of operations
+*/
QtxOperations* QtxListOfOperations::operations( const QString& name ) const
{
OperationSetsIterator anIt = mySets.begin(),
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxListOfOperations.h
// Author: Alexander SOLOVYOV
#endif
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ Class: QtxListOfOperations
+
+ This class provides special variant of QtxOperations. It contains list of QtxOperations* with
+ fixed order. When it is necessary to calculate operation or get it's priority, this operation is
+ being found starting from first item. It makes possible to create unions of operations. Every QtxOperations*
+ has priority, which is added to priority of operation, so that it makes possible to increase priority of
+ whole group of operations
+*/
class QTX_EXPORT QtxListOfOperations : public QtxOperations
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxListResourceEdit.cxx
// Author: Sergey TELKOV
#include <qfontdatabase.h>
#include <qfileinfo.h>
#include <qfiledialog.h>
+#include <qapplication.h>
#include "QtxIntSpinBox.h"
#include "QtxDblSpinBox.h"
#include "QtxComboBox.h"
#include "QtxDirListEditor.h"
-/*
- Class: QtxListResourceEdit
- Descr: GUI implementation of QtxResourceEdit - manager of resources
+/*!
+ Constructor
*/
-
QtxListResourceEdit::QtxListResourceEdit( QtxResourceMgr* mgr, QWidget* parent )
: QFrame( parent ),
QtxResourceEdit( mgr )
updateState();
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::~QtxListResourceEdit()
{
}
+/*!
+ Sets value to widget
+ \param id - id of widget
+ \param prop - name of resource
+ \param val - value of resource
+*/
void QtxListResourceEdit::setItemProperty( const int id, const QString& prop, const QVariant& val )
{
Item* i = item( id );
updateVisible();
}
+/*!
+ SLOT: called if main list selection changed, raises resource group widgets
+*/
void QtxListResourceEdit::onSelectionChanged()
{
QString title = myList->text( myList->index( myList->selectedItem() ) );
myStack->raiseWidget( i->id() );
}
+/*!
+ Custom activity after item addition
+ \param i - added item
+*/
void QtxListResourceEdit::itemAdded( QtxResourceEdit::Item* i )
{
if ( !i )
updateVisible();
}
+/*!
+ Creates and \return category
+ \param title - category title
+*/
QtxResourceEdit::Item* QtxListResourceEdit::createItem( const QString& title, const int )
{
Item* i = item( title, -1 );
return category;
}
+/*!
+ Emits signal about resource changing
+ \param map - map of changed resources
+*/
void QtxListResourceEdit::changedResources( const QMap<Item*, QString>& map )
{
QMap<int, QString> idMap;
emit resourcesChanged( idMap );
}
+/*!
+ Updates widgets with accordance with main list selection
+*/
void QtxListResourceEdit::updateState()
{
if ( myList->selectedItem() && myStack->visibleWidget() )
myList->setShown( myList->count() > 1 );
}
+/*!
+ Updates visibility state
+*/
void QtxListResourceEdit::updateVisible()
{
QPtrList<Item> items;
updateState();
}
-/*
- Class: QtxListResourceEdit::Category
- Descr: GUI implementation of preferences category.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::Category::Category( QtxListResourceEdit* edit, QWidget* parent )
: QFrame( parent ),
Item( edit )
updateState();
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Category::~Category()
{
}
+/*!
+ \return true if it is empty
+*/
bool QtxListResourceEdit::Category::isEmpty() const
{
return Item::isEmpty() && myInfo->text().isEmpty();
}
+/*!
+ \return category type
+*/
int QtxListResourceEdit::Category::type() const
{
return -1;
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Category::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Category::retrieve()
{
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::Category::property( const QString& prop ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::Category::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
updateState();
}
+/*!
+ Creates new tab
+ \param title - name of tab
+*/
QtxResourceEdit::Item* QtxListResourceEdit::Category::createItem( const QString& title, const int )
{
Item* i = item( title, id() );
return tab;
}
+/*!
+ Updates category
+*/
void QtxListResourceEdit::Category::updateState()
{
if ( myTabs->count() )
myInfo->hide();
}
-/*
- Class: QtxListResourceEdit::Tab
- Descr: GUI implementation of resources tab.
-*/
+/*!
+ Constructor
+*/
QtxListResourceEdit::Tab::Tab( QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: QFrame( parent ),
Item( edit, pItem )
main->addStretch( 1 );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Tab::~Tab()
{
}
+/*!
+ \return tab type
+*/
int QtxListResourceEdit::Tab::type() const
{
return -1;
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Tab::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Tab::retrieve()
{
}
+/*!
+ Delayed initialization of a widget
+*/
void QtxListResourceEdit::Tab::polish()
{
QFrame::polish();
adjustLabels();
}
+/*!
+ Creates new group
+ \param title - name of group
+*/
QtxResourceEdit::Item* QtxListResourceEdit::Tab::createItem( const QString& title, const int )
{
Item* i = item( title, id() );
return group;
}
+/*!
+ Adjusts sizes of labels
+*/
void QtxListResourceEdit::Tab::adjustLabels()
{
QObjectList* labels = queryList( "QLabel" );
}
}
-/*
- Class: QtxListResourceEdit::Group
- Descr: GUI implementation of resources group.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::Group::Group( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: QGroupBox( 2, Qt::Horizontal, title, parent ),
Item( edit, pItem )
{
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Group::~Group()
{
}
+/*!
+ \return group type
+*/
int QtxListResourceEdit::Group::type() const
{
return -1;
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Group::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Group::retrieve()
{
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::Group::property( const QString& prop ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::Group::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
}
}
+/*!
+ Sets title of group
+ \param title - new title of group
+*/
void QtxListResourceEdit::Group::setTitle( const QString& title )
{
Item::setTitle( title );
QGroupBox::setTitle( title );
}
+/*!
+ Creates new item
+ \param title - title of new item
+ \type - type of new item
+*/
QtxResourceEdit::Item* QtxListResourceEdit::Group::createItem( const QString& title, const int type )
{
Item* item = 0;
return item;
}
-/*
- Class: QtxListResourceEdit::PrefItem
- Descr: Base class for preferences items.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::PrefItem::PrefItem( const int type, QtxResourceEdit* edit, Item* pi, QWidget* parent )
: QHBox( parent ),
Item( edit, pi ),
setSpacing( 5 );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::PrefItem::~PrefItem()
{
}
+/*!
+ \return preference item type
+*/
int QtxListResourceEdit::PrefItem::type() const
{
return myType;
}
+/*!
+ Doesn't create item, \return 0 by default
+*/
QtxResourceEdit::Item* QtxListResourceEdit::PrefItem::createItem( const QString&, const int )
{
return 0;
}
-/*
- Class: QtxListResourceEdit::Spacer
- Descr: GUI implementation of resources spacer.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::Spacer::Spacer( QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( Space, edit, pItem, parent )
{
setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Spacer::~Spacer()
{
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Spacer::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Spacer::retrieve()
{
}
-/*
- Class: QtxListResourceEdit::SelectItem
- Descr: GUI implementation of resources list item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::SelectItem::SelectItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Selector, edit, pItem, parent )
myList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::SelectItem::~SelectItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::SelectItem::store()
{
int idx = myList->currentItem();
setInteger( myIndex[idx] );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::SelectItem::retrieve()
{
int id = getInteger( -1 );
myList->setCurrentItem( idx );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::SelectItem::property( const QString& name ) const
{
QVariant val;
return val;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::SelectItem::setProperty( const QString& name, const QVariant& val )
{
if ( name == QString( "strings" ) )
setIndexes( val );
}
+/*!
+ Sets property "strings" - items for selection in combo box
+ \param var - must be string list: list of items
+*/
void QtxListResourceEdit::SelectItem::setStrings( const QVariant& var )
{
if ( var.type() != QVariant::StringList )
setStrings( var.toStringList() );
}
+/*!
+ Sets property "indexes" - corresponding indices of items in combo box
+ \param var - must be list of integer variants: list of indices
+*/
void QtxListResourceEdit::SelectItem::setIndexes( const QVariant& var )
{
if ( var.type() != QVariant::List )
setIndexes( lst );
}
+/*!
+ Sets property "strings" - items for selection in combo box
+ \param lst - list of items
+*/
void QtxListResourceEdit::SelectItem::setStrings( const QStringList& lst )
{
myList->clear();
myList->insertStringList( lst );
}
+/*!
+ Sets property "indexes" - corresponding indices of items in combo box
+ \param var - list of indices
+*/
void QtxListResourceEdit::SelectItem::setIndexes( const QValueList<int>& lst )
{
myIndex.clear();
myIndex.insert( idx, *it );
}
-/*
- Class: QtxListResourceEdit::StateItem
- Descr: GUI implementation of resources bool item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::StateItem::StateItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Bool, edit, pItem, parent )
myState->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::StateItem::~StateItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::StateItem::store()
{
setBoolean( myState->isChecked() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::StateItem::retrieve()
{
myState->setChecked( getBoolean() );
}
-/*
- Class: QtxListResourceEdit::StringItem
- Descr: GUI implementation of resources string item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::StringItem::StringItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( String, edit, pItem, parent )
myString->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::StringItem::~StringItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::StringItem::store()
{
setString( myString->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::StringItem::retrieve()
{
myString->setText( getString() );
}
-/*
- Class: QtxListResourceEdit::IntegerEditItem
- Descr: GUI implementation of resources integer item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::IntegerEditItem::IntegerEditItem( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( Integer, edit, pItem, parent )
{
myInteger->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::IntegerEditItem::~IntegerEditItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::IntegerEditItem::store()
{
setString( myInteger->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::IntegerEditItem::retrieve()
{
myInteger->setText( getString() );
}
-/*
- Class: QtxListResourceEdit::IntegerSpinItem
- Descr: GUI implementation of resources integer item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::IntegerSpinItem::IntegerSpinItem( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( IntSpin, edit, pItem, parent )
{
myInteger->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::IntegerSpinItem::~IntegerSpinItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::IntegerSpinItem::store()
{
setInteger( myInteger->value() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::IntegerSpinItem::retrieve()
{
myInteger->setValue( getInteger() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::IntegerSpinItem::property( const QString& name ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::IntegerSpinItem::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
myInteger->setSuffix( prop.toString() );
}
-/*
- Class: QtxListResourceEdit::DoubleEditItem
- Descr: GUI implementation of resources string item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::DoubleEditItem::DoubleEditItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Double, edit, pItem, parent )
myDouble->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::DoubleEditItem::~DoubleEditItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::DoubleEditItem::store()
{
setString( myDouble->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::DoubleEditItem::retrieve()
{
myDouble->setText( getString() );
}
-/*
- Class: QtxListResourceEdit::DoubleSpinItem
- Descr: GUI implementation of resources double item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::DoubleSpinItem::DoubleSpinItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( DblSpin, edit, pItem, parent )
myDouble->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::DoubleSpinItem::~DoubleSpinItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::DoubleSpinItem::store()
{
setDouble( myDouble->value() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::DoubleSpinItem::retrieve()
{
myDouble->setValue( getDouble() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::DoubleSpinItem::property( const QString& name ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::DoubleSpinItem::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
myDouble->setSuffix( prop.toString() );
}
-/*
- Class: QtxListResourceEdit::ColorItem
- Descr: GUI implementation of resources color item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::ColorItem::ColorItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Color, edit, pItem, parent )
{
+ /*!
+ \class QtxListResourceEdit::ColorItem::ColorSelector
+ \brief Label, showing color and allowing to pick color with help of standard color dialog
+ */
class ColorSelector : public QLabel
{
public:
myColor->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::ColorItem::~ColorItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::ColorItem::store()
{
setColor( myColor->paletteBackgroundColor() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::ColorItem::retrieve()
{
myColor->setPaletteBackgroundColor( getColor() );
}
-/*
- Class: QtxListResourceEdit::FontItem
- Descr: GUI implementation of resources font item.
+/*!
+ Constructor
*/
QtxListResourceEdit::FontItem::FontItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
setProperty( "widget_flags", ( int )All );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::FontItem::~FontItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::FontItem::store()
{
QFont f( family(), size() );
Item::setFont( f );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::FontItem::retrieve()
{
QFont f = getFont();
setParams( f.bold(), f.italic(), f.underline() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::FontItem::property( const QString& name ) const
{
if( name=="system" )
return QVariant();
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::FontItem::setProperty( const QString& name, const QVariant& value )
{
if( name=="system" )
myProperties[ name ] = value;
}
+/*!
+ Sets family of font
+ \param f - new family
+*/
void QtxListResourceEdit::FontItem::setFamily( const QString& f )
{
QString curtext;
if( deffam.canCast( QVariant::String ) )
curtext = deffam.toString();
}
+
+ if ( curtext.isEmpty() )
+ curtext = (QApplication::font()).family();
int idx = -1;
for ( int i = 0; i < (int)myFamilies->count() && idx < 0; i++ )
onActivateFamily( idx );
}
+/*!
+ \return family of font
+*/
QString QtxListResourceEdit::FontItem::family() const
{
return myFamilies->currentText();
}
+/*!
+ Sets size of font
+ \param s - new size of font
+*/
void QtxListResourceEdit::FontItem::setSize( const int s )
{
int cursize = -1;
mySizes->setCurrentText( cursize>0 ? QString( "%1" ).arg( cursize ) : "" );
}
+/*!
+ \return size of font
+*/
int QtxListResourceEdit::FontItem::size() const
{
QString s = mySizes->currentText();
return ( ok ? pSize : 0 );
}
+/*!
+ Sets font parameters
+ \param bold - is font bold
+ \param italic - is font italic
+ \param underline - is font underlined
+*/
void QtxListResourceEdit::FontItem::setParams( const bool bold, const bool italic, const bool underline )
{
bool curbold = false, curitalic = false, curunderline = false;
myUnderline->setChecked( curunderline );
}
+/*!
+ \return font parameters
+ \param bold - is font bold
+ \param italic - is font italic
+ \param underline - is font underlined
+*/
void QtxListResourceEdit::FontItem::params( bool& bold, bool& italic, bool& underline )
{
bold = myBold->isChecked();
underline = myUnderline->isChecked();
}
+/*!
+ Updates internal selection of font properties
+*/
void QtxListResourceEdit::FontItem::internalUpdate()
{
- //update internal selection of font properties
setFamily( family() );
setSize( size() );
bool b1, b2, b3;
setParams( b1, b2, b3 );
}
+/*!
+ SLOT: called if family is activated, updates list of possible sizes
+*/
void QtxListResourceEdit::FontItem::onActivateFamily( int )
{
QVariant sizes = property( QString( "%1:sizes" ).arg( family() ) );
setSize( s );
}
+/*!
+ SLOT: called if it is necessary to show font preview
+*/
void QtxListResourceEdit::FontItem::onPreview()
{
QFont f( family(), size() );
-
-
-/*
- Class: QtxListResourceEdit::DirListItem
- Descr:
+/*!
+ Constructor
*/
QtxListResourceEdit::DirListItem::DirListItem( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( Font, edit, pItem, parent )
myDirListEditor = new QtxDirListEditor( this );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::DirListItem::~DirListItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::DirListItem::store()
{
QStringList list;
setString( QString(list.join(";")) );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::DirListItem::retrieve()
{
myDirListEditor->setPathList(QStringList::split(";", getString()));
-/*
- Class: QtxListResourceEdit::FileItem
- Descr: GUI implementation of resources file item.
+/*!
+ Constructor
*/
QtxListResourceEdit::FileItem::FileItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
connect( myOpenFile, SIGNAL( clicked() ), this, SLOT( onOpenFile() ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::FileItem::~FileItem()
{
if( myFileDlg )
delete myFileDlg;
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::FileItem::store()
{
setString( myFile->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::FileItem::retrieve()
{
myFile->setText( getString() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::FileItem::property( const QString& name ) const
{
if( name=="filter" )
return QVariant();
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::FileItem::setProperty( const QString& name, const QVariant& value )
{
if( name=="filter" )
}
}
+/*!
+ SLOT: called if user click "Open File" button, shows dialog
+*/
void QtxListResourceEdit::FileItem::onOpenFile()
{
if( !myFileDlg )
}
}
+/*!
+ \return true if file satisfies permissions
+ \param f - file name
+*/
bool QtxListResourceEdit::FileItem::isFileCorrect( const QString& f ) const
{
bool res = false;
return res;
}
+/*!
+ SLOT: called if user has selected file in file dialog, checks file permissions and passes it's name to widget
+ \param f - file name
+*/
void QtxListResourceEdit::FileItem::onFileSelected( const QString& f )
{
if( myFileDlg && !isFileCorrect( f ) )
}
-
+/*!
+ Constructor
+*/
QtxListResourceEdit::FileItem::FileValidator::FileValidator( FileItem* item, QObject* parent )
: QValidator( parent ),
myItem( item )
{
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::FileItem::FileValidator::~FileValidator()
{
}
+/*!
+ Check file permissions
+ \param f - file name
+*/
QValidator::State QtxListResourceEdit::FileItem::FileValidator::validate( QString& f, int& ) const
{
if( myItem && myItem->isFileCorrect( f ) )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxListResourceEdit.h
// Author: Sergey TELKOV
class QtxDirListEditor;
-/*
- Class: QtxListResourceEdit
- Descr: GUI implementation of QtxResourceEdit - manager of resources
+/*!
+ \class QtxListResourceEdit
+ GUI implementation of QtxResourceEdit - manager of resources
*/
class QTX_EXPORT QtxListResourceEdit : public QFrame, public QtxResourceEdit
QWidgetStack* myStack;
};
-/*
- Class: QtxListResourceEdit::Category
- Descr: GUI implementation of 'Category' frame
+/*!
+ \class QtxListResourceEdit::Category
+ GUI implementation of 'Category' frame
*/
class QtxListResourceEdit::Category : public QFrame, public Item
QTabWidget* myTabs;
};
-/*
- Class: QtxListResourceEdit::Tab
- Descr: GUI implementation of resources tab.
+/*!
+ \class QtxListResourceEdit::Tab
+ GUI implementation of resources tab.
*/
class QtxListResourceEdit::Tab : public QFrame, public Item
QWidget* myMainFrame;
};
-/*
- Class: QtxListResourceEdit::Group
- Descr: GUI implementation of resources group.
+/*!
+ \class QtxListResourceEdit::Group
+ GUI implementation of resources group.
*/
class QtxListResourceEdit::Group : public QGroupBox, public Item
virtual Item* createItem( const QString&, const int );
};
-/*
- Class: QtxListResourceEdit::PrefItem
- Descr: Base class for preferences items.
+/*!
+ \class QtxListResourceEdit::PrefItem
+ Base class for preferences items.
*/
class QtxListResourceEdit::PrefItem : public QHBox, public Item
int myType;
};
-/*
- Class: QtxListResourceEdit::Spacer
- Descr: GUI implementation of resources spacer.
+/*!
+ \class QtxListResourceEdit::Spacer
+ GUI implementation of resources spacer.
*/
class QtxListResourceEdit::Spacer : public PrefItem
virtual void retrieve();
};
-/*
- Class: QtxListResourceEdit::SelectItem
- Descr: GUI implementation of resources selector item.
+/*!
+ \class QtxListResourceEdit::SelectItem
+ GUI implementation of resources selector item.
*/
class QtxListResourceEdit::SelectItem : public PrefItem
QMap<int, int> myIndex;
};
-/*
- Class: QtxListResourceEdit::StateItem
- Descr: GUI implementation of resources bool item.
+/*!
+ \class QtxListResourceEdit::StateItem
+ GUI implementation of resources bool item.
*/
-
class QtxListResourceEdit::StateItem : public PrefItem
{
public:
QCheckBox* myState;
};
-/*
- Class: QtxListResourceEdit::StringItem
- Descr: GUI implementation of resources string item.
+/*!
+ \class QtxListResourceEdit::StringItem
+ GUI implementation of resources string item.
*/
class QtxListResourceEdit::StringItem : public PrefItem
QLineEdit* myString;
};
-/*
- Class: QtxListResourceEdit::IntegerEditItem
- Descr: GUI implementation of resources integer item.
+/*!
+ \class QtxListResourceEdit::IntegerEditItem
+ GUI implementation of resources integer item.
*/
class QtxListResourceEdit::IntegerEditItem : public PrefItem
QLineEdit* myInteger;
};
-/*
- Class: QtxListResourceEdit::IntegerSpinItem
- Descr: GUI implementation of resources integer item.
+/*!
+ \class QtxListResourceEdit::IntegerSpinItem
+ GUI implementation of resources integer item.
*/
class QtxListResourceEdit::IntegerSpinItem : public PrefItem
QtxIntSpinBox* myInteger;
};
-/*
- Class: QtxListResourceEdit::DoubleEditItem
- Descr: GUI implementation of resources double item.
+/*!
+ \class QtxListResourceEdit::DoubleEditItem
+ GUI implementation of resources double item.
*/
class QtxListResourceEdit::DoubleEditItem : public PrefItem
QLineEdit* myDouble;
};
-/*
- Class: QtxListResourceEdit::DoubleSpinItem
- Descr: GUI implementation of resources double item.
+/*!
+ \class QtxListResourceEdit::DoubleSpinItem
+ GUI implementation of resources double item.
*/
class QtxListResourceEdit::DoubleSpinItem : public PrefItem
QtxDblSpinBox* myDouble;
};
-/*
- Class: QtxListResourceEdit::ColorItem
- Descr: GUI implementation of resources color item.
+/*!
+ \class QtxListResourceEdit::ColorItem
+ GUI implementation of resources color item.
*/
class QtxListResourceEdit::ColorItem : public PrefItem
QWidget* myColor;
};
-/*
- Class: QtxListResourceEdit::FontItem
- Descr: GUI implementation of resources font item.
-*/
-
class QtxComboBox;
class QToolButton;
+/*!
+ \class QtxListResourceEdit::FontItem
+ GUI implementation of resources font item.
+*/
class QtxListResourceEdit::FontItem : public PrefItem
{
Q_OBJECT
/*!
- * \brief GUI implementation of resources directory list item.
- *
- *
- */
+ \class QtxListResourceEdit
+ \brief GUI implementation of resources directory list item.
+*/
class QtxListResourceEdit::DirListItem : public PrefItem
{
Q_OBJECT
QtxDirListEditor* myDirListEditor; //!< The widget wich implements in GUI the list of directories
};
-/*
- Class: QtxListResourceEdit::FontItem
- Descr: GUI implementation of resources font item.
-*/
-
class QtxComboBox;
class QToolButton;
class QFileDialog;
+/*!
+ \class QtxListResourceEdit::FontItem
+ GUI implementation of resources font item.
+*/
+
class QtxListResourceEdit::FileItem : public PrefItem
{
Q_OBJECT
private:
+ /*!
+ \class QtxListResourceEdit::FileItem::FileValidator
+ custom file validator: checks files on some rights
+ */
+
class FileValidator : public QValidator
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxListView.h"
"................",
"................" };
+/*!
+ Constructor
+*/
QtxListView::QtxListView( const int state, QWidget* parent, const char* name, WFlags f )
: QListView( parent, name, f ),
myButton( 0 ),
initialize();
}
+/*!
+ Constructor
+*/
QtxListView::QtxListView( QWidget* parent, const char* name, WFlags f )
: QListView( parent, name, f ),
myButton( 0 ),
initialize();
}
+/*!
+ Initialization
+*/
void QtxListView::initialize()
{
if ( myHeaderState == HeaderButton )
connect( header(), SIGNAL( sizeChange( int, int, int ) ), this, SLOT( onHeaderResized() ) );
}
+/*!
+ Destructor
+*/
QtxListView::~QtxListView()
{
}
+/*!
+ Add new column
+ \param label - column title
+ \param width - column width
+*/
int QtxListView::addColumn( const QString& label, int width )
{
int res = QListView::addColumn( label, width );
return res;
}
+/*!
+ Add new column
+ \param iconset - column icon
+ \param label - column title
+ \param width - column width
+*/
int QtxListView::addColumn( const QIconSet& iconset, const QString& label, int width )
{
int res = QListView::addColumn( iconset, label, width );
return res;
}
+/*!
+ Removes column
+ \param index - column index
+*/
void QtxListView::removeColumn( int index )
{
QListView::removeColumn( index );
onHeaderResized();
}
+/*!
+ \return true if column is situated in popup for show/hide columns
+*/
bool QtxListView::appropriate( const int index ) const
{
return index >= 0 && index < (int)myAppropriate.count() && myAppropriate[index];
}
+/*!
+ Sets appropriate state: whether column is situated in popup for show/hide columns
+ \param index - column index
+ \param on - new state
+*/
void QtxListView::setAppropriate( const int index, const bool on )
{
if ( index < 0 || index >= (int)myAppropriate.count() )
myAppropriate[index] = on ? 1 : 0;
}
+/*!
+ Resizes list view and header
+*/
void QtxListView::resize( int w, int h )
{
QListView::resize( w, h );
onHeaderResized();
}
+/*!
+ Shows list view
+*/
void QtxListView::show()
{
QListView::show();
onHeaderResized();
}
+/*!
+ Update on resize contents
+*/
void QtxListView::resizeContents( int w, int h )
{
/*
onHeaderResized();
}
+/*!
+ Shows column
+ \param ind - column index
+*/
void QtxListView::show( int ind )
{
setShown( ind, true );
}
+/*!
+ Hides column
+ \param ind - column index
+*/
void QtxListView::hide( int ind )
{
setShown( ind, false );
}
+/*!
+ \return true if column is shown
+ \param ind - column index
+*/
bool QtxListView::isShown( int ind ) const
{
if ( ind>=0 && ind<header()->count() )
return false;
}
+/*!
+ Shows/hides column
+ \param ind - column index
+ \param sh - new is shown state
+*/
void QtxListView::setShown( int ind, bool sh )
{
if( ind<0 || ind>=header()->count() || isShown( ind )==sh )
updateContents();
}
+/*!
+ Changes column width
+ \param c - column index
+ \param w - new width
+*/
void QtxListView::setColumnWidth( int c, int w )
{
if ( myColumns.contains( c ) )
QListView::setColumnWidth( c, !myColumns.contains( c ) ? w : 0 );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxListView::sizeHint() const
{
QSize sz = QListView::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxListView::minimumSizeHint() const
{
QSize sz = QListView::minimumSizeHint();
return sz;
}
+/*!
+ SLOT: called if header is resized
+*/
void QtxListView::onHeaderResized()
{
if ( myHeaderState == HeaderAuto )
}
}
+/*!
+ Shows popup filled with column names to show/hide column
+ \param x, y - position of popup
+*/
void QtxListView::showPopup( const int x, const int y )
{
myPopup->clear();
myPopup->exec( mapToGlobal( QPoint( x, y ) ) );
}
+/*!
+ SLOT: shows popup on button ".." click
+*/
void QtxListView::onButtonClicked()
{
if ( myHeaderState != HeaderButton )
showPopup( x, y );
}
+/*!
+ SLOT: called on popup action is activated, toggles shown state of column
+ \param id - column index
+*/
void QtxListView::onShowHide( int id )
{
//if ( myHeaderState != HeaderButton )
setShown( id, !isShown( id ) );
}
+/*!
+ Receives all resize events sent to the viewport
+*/
void QtxListView::viewportResizeEvent( QResizeEvent* e )
{
QListView::viewportResizeEvent( e );
onHeaderResized();
}
+/*!
+ Custom event filter, shows popup on right button click
+*/
bool QtxListView::eventFilter( QObject* o, QEvent* e )
{
if( o==header() && e->type()==QEvent::MouseButtonPress )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef QTXLISTVIEW_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxLogoMgr.h"
#include <qmenubar.h>
#include <qapplication.h>
+/*!
+ Constructor
+*/
QtxLogoMgr::QtxLogoMgr( QMenuBar* mb )
: QObject( mb ),
myMenus( mb ),
{
}
+/*!
+ Destructor
+*/
QtxLogoMgr::~QtxLogoMgr()
{
}
generate();
}
+/*!
+ Inserts logo to menu bar
+*/
void QtxLogoMgr::generate()
{
if ( !menuBar() )
QApplication::postEvent( menuBar()->parentWidget(), new QEvent( QEvent::LayoutHint ) );
}
+/*!
+ \return index of found logo
+ \param id - logo id
+*/
int QtxLogoMgr::find( const QString& id ) const
{
int idx = -1;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef QTX_LOGOMGR_H
#define QTX_LOGOMGR_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxMRUAction.cxx
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxMRUAction.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxMainWindow.cxx
// Author: Sergey TELKOV
QWidget* myWidget;
};
+/*!
+ Constructor
+*/
QtxMainWindow::Filter::Filter( QWidget* wid, QtxMainWindow* mw, QObject* parent )
: QObject( parent ),
myMain( mw ),
myMain->installEventFilter( this );
};
+/*!
+ Destructor
+*/
QtxMainWindow::Filter::~Filter()
{
}
+/*!
+ Custom event filter
+*/
bool QtxMainWindow::Filter::eventFilter( QObject* o, QEvent* e )
{
if ( myMain == o && e->type() == QEvent::ChildRemoved &&
Descr: Main window with support of dockable menubar/status bar
and geometry store/retrieve.
*/
-
QtxMainWindow::QtxMainWindow( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f ),
myMode( -1 ),
{
}
+/*!
+ Destructor
+*/
QtxMainWindow::~QtxMainWindow()
{
setDockableMenuBar( false );
setDockableStatusBar( false );
}
+/*!
+ \return true if menu bar exists
+*/
bool QtxMainWindow::isDockableMenuBar() const
{
return myMenuBar;
}
+/*!
+ Creates or deletes menu bar
+ \param on - if it is true, then to create, otherwise - to delete
+*/
void QtxMainWindow::setDockableMenuBar( const bool on )
{
if ( isDockableMenuBar() == on )
setUpLayout();
}
+/*!
+ \return true if status bar exists
+*/
bool QtxMainWindow::isDockableStatusBar() const
{
return myStatusBar;
}
+/*!
+ Creates or deletes status bar
+ \param on - if it is true, then to create, otherwise - to delete
+*/
void QtxMainWindow::setDockableStatusBar( const bool on )
{
if ( isDockableStatusBar() == on )
setUpLayout();
}
+/*!
+ Retrieve the geometry information from the specified resource manager section.
+ \param resMgr - instance of ersource manager
+ \param section - section name
+*/
void QtxMainWindow::loadGeometry( QtxResourceMgr* resMgr, const QString& section )
{
QString sec = section.stripWhiteSpace();
myMode = winState;
}
+/*!
+ Shows main window
+*/
void QtxMainWindow::show()
{
if ( myMode != -1 )
QMainWindow::show();
}
+/*!
+ Handler of custom events
+*/
void QtxMainWindow::customEvent( QCustomEvent* e )
{
QMainWindow::customEvent( e );
- int mode = (int)e->data();
+ size_t mode = size_t(e->data());
switch ( mode )
{
case WS_Normal:
}
}
+/*!
+ \return relative co-ordinate by two points
+ \param type - type of result: WP_Center (center), WP_Left (left), WP_Right (right)
+ \param wh - left point
+ \param WH - right point
+*/
int QtxMainWindow::relativeCoordinate( const int type, const int WH, const int wh ) const
{
int res = 0;
return res;
}
+/*!
+ Store the geometry information into the specified resource manager section.
+ \param resMgr - instance of ersource manager
+ \param section - section name
+*/
void QtxMainWindow::saveGeometry( QtxResourceMgr* resMgr, const QString& section ) const
{
QString sec = section.stripWhiteSpace();
resMgr->setValue( sec, "state", winState );
}
+/*!
+ Custom event filter
+*/
bool QtxMainWindow::eventFilter( QObject* o, QEvent* e )
{
return QMainWindow::eventFilter( o, e );
}
+/*!
+ Controls whether or not the dw dock window's caption should appear
+ as a menu item on the dock window menu that lists the dock windows.
+ \param dw - window
+ \param a - if it is true, then it appears in menu
+*/
void QtxMainWindow::setAppropriate( QDockWindow* dw, bool a )
{
QMainWindow::setAppropriate( dw, myStatusBar != dw && myMenuBar != dw && a );
}
+/*!
+ Sets up layout
+*/
void QtxMainWindow::setUpLayout()
{
QMainWindow::setUpLayout();
layout()->setMenuBar( 0 );
}
+/*!
+ SLOT: called on object destroyed, clears internal fields in case of deletion of menu bar or status bar
+*/
void QtxMainWindow::onDestroyed( QObject* obj )
{
QObject* o = 0;
}
}
+/*!
+ \return flag of window state by it's name
+ \param str - name of flag
+*/
int QtxMainWindow::windowState( const QString& str ) const
{
static QMap<QString, int> winStateMap;
return res;
}
+/*!
+ \return flag of position by it's name
+ \param str - name of position
+*/
int QtxMainWindow::windowPosition( const QString& str ) const
{
static QMap<QString, int> winPosMap;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxMainWindow.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxMenuButton.cxx
// Author: Sergey TELKOV
QtxMenuButton* myMenuButton;
};
+/*!
+ Sets the widget's minimum size
+ \param w - width
+ \param h - height
+*/
void QtxMenuButton::PopupMenu::setMinimumSize( int w, int h )
{
if ( myMenuButton->isAlignWidth() &&
}
+/*!
+ Constructor
+ \param pos - position
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( int pos, QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( pos )
initialize();
}
+/*!
+ Constructor
+ \param text - button text
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( const QString& text, QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( Bottom )
initialize();
}
+/*!
+ Constructor
+ \param pos - position
+ \param text - button text
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( int pos, const QString& text, QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( pos )
initialize();
}
+/*!
+ Constructor
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( Bottom )
initialize();
}
+/*!
+ Destructor
+*/
QtxMenuButton::~QtxMenuButton()
{
}
+/*!
+ Initialization
+*/
void QtxMenuButton::initialize()
{
myArrow = true;
connect( this, SIGNAL( clicked() ), this, SLOT( onShowPopup() ) );
}
+/*!
+ \return position
+*/
int QtxMenuButton::position() const
{
return myPos;
}
+/*!
+ \return true if align is enabled
+*/
bool QtxMenuButton::isAlignWidth() const
{
return myAlign;
}
+/*!
+ \return true if arrow is shown
+*/
bool QtxMenuButton::isArrowEnabled() const
{
return myArrow;
}
+/*!
+ Changes position
+ \param pos - new position
+*/
void QtxMenuButton::setPosition( const int pos )
{
if ( myPos == pos )
onShowPopup();
}
+/*!
+ Changes align state
+ \param on - new align state
+*/
void QtxMenuButton::setAlignWidth( const bool on )
{
if ( myAlign == on )
updateGeometry();
}
+/*!
+ Enables/disable arrow
+ \param on - new enabled state
+*/
void QtxMenuButton::setArrowEnabled( const bool on )
{
if ( myArrow == on )
repaint();
}
+/*!
+ Clears popup
+*/
void QtxMenuButton::clear()
{
if ( myPopup )
updateGeometry();
}
+/*!
+ Removes item from popup
+ \param id - item id
+*/
void QtxMenuButton::removeItem( int id )
{
if ( myPopup )
- removeItem( id );
+ myPopup->removeItem( id );
updateGeometry();
}
+/*!
+ Inserts separator into popup
+ \param id - position
+*/
int QtxMenuButton::insertSeparator( int id )
{
int res = -1;
return res;
}
+/*!
+ Inserts item into popup
+ \param t - menu text
+ \param id - item id
+ \param index - position
+*/
int QtxMenuButton::insertItem( const QString& t, int id, int index )
{
int resId = -1;
return resId;
}
+/*!
+ Inserts item into popup
+ \param is - icons
+ \param t - menu text
+ \param id - item id
+ \param index - position
+*/
int QtxMenuButton::insertItem( const QIconSet& is, const QString& t, int id, int index )
{
int resId = -1;
return resId;
}
+/*!
+ SLOT: calls when button is clicked, shows popup
+*/
void QtxMenuButton::onShowPopup()
{
if ( !myPopup || !myPopup->count() )
myPopup->exec( QPoint( x, y ) );
}
+/*!
+ Custom event handler
+*/
bool QtxMenuButton::event( QEvent* e )
{
if ( e->type() == QEvent::MouseButtonPress ||
return QPushButton::event( e );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxMenuButton::sizeHint() const
{
QSize sz = QPushButton::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxMenuButton::minimumSizeHint() const
{
QSize sz = QPushButton::minimumSizeHint();
return sz;
}
+/*!
+ Custom resize event handler
+*/
void QtxMenuButton::resizeEvent( QResizeEvent* re )
{
if ( re )
myPopup->setMinimumWidth( re ? re->size().width() : width() );
}
+/*!
+ \return corresponding popup
+*/
QPopupMenu* QtxMenuButton::popup() const
{
return myPopup;
}
+/*!
+ Draws label
+*/
void QtxMenuButton::drawButtonLabel( QPainter* p )
{
QPushButton::drawButtonLabel( p );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxMenuButton.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxOperations.h"
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxOperations::QtxOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxOperations::~QtxOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates QtxValue by it's string representation
+*/
bool QtxOperations::createValue( const QString& str, QtxValue& v ) const
{
v = str;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxOperations.h
// Author: Alexander SOLOVYOV
#include "Qtx.h"
#include "QtxParser.h"
-//================================================================
-// Class :
-// Purpose :
-//================================================================
class QTX_EXPORT QtxOperations
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxParser.h"
#include "QtxOperations.h"
-//================================================================
-// Function :
-// Purpose :
-//================================================================
-QtxParser::QtxParser( QtxOperations* operations,
- const QString& expr )
+/*!
+ Constructor
+*/
+QtxParser::QtxParser( QtxOperations* operations, const QString& expr )
: myOperations( operations )
{
if( myOperations )
setLastError( OperationsNull );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxParser::~QtxParser()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Search elements of list as substrings starting on 'offset'
+ \returns the least position of substrings inside string
+ \param list - list of substrings
+ \param str - string where search
+ \param offset - starting index for search
+ \param matchLen - the length of appropriate substring
+ \param listind - list index of appropriate substring
+*/
int QtxParser::search( const QStringList& list, const QString& str, int offset,
int& matchLen, int& listind )
{
return min;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return substring
+ \param str - string
+ \param pos - start position of substring
+ \param len - length of substring
+*/
QString QtxParser::note( const QString& str, int pos, int len )
{
return str.mid( pos, len ).stripWhiteSpace();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ First step of parsing: finding tokens, determining its types and creating of unsorted pseudo-postfix (with brackets)
+ \param expr - string expression
+ \param post - postfix to be created
+*/
bool QtxParser::prepare( const QString& expr, Postfix& post )
{
int pos = 0, len = expr.length();
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Second step of parsing: determining types of operations
+ \param post - unsorted postfix
+*/
bool QtxParser::setOperationTypes( Postfix& post )
{
Postfix::iterator aStart = post.begin(),
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return how many global brackets there is (for example '((2+3))' has 2 global brackets)
+ \param post - postfix to be checked
+ \param f - start index to search
+ \param l - last index to search
+*/
int QtxParser::globalBrackets( const QtxParser::Postfix& post, int f, int l )
{
int i,
return br+min_br_num;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Third step of parsing: sorting of postfix in order to convert it to real postfix
+ \param post - source postfix
+ \param res - destination postfix
+ \param anOpen - list of open brackets
+ \param aClose - list of close brackets
+ \param f - start index of postfix to sorting
+ \param l - last index of postfix to sorting
+*/
bool QtxParser::sort( const Postfix& post, Postfix& res,
const QStringList& anOpen,
const QStringList& aClose,
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Build posfix by expression
+ \param expr - string expression
+*/
bool QtxParser::parse( const QString& expr )
{
myPost.clear();
sort( p, myPost, opens, closes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculate operation
+ \param op - operation name
+ \param v1 - first argument (it is not valid for unary prefix operations and it is used to store result)
+ \param v2 - second argument (it is not valid for unary postfix operations)
+*/
bool QtxParser::calculate( const QString& op, QtxValue& v1, QtxValue& v2 )
{
Error err = myOperations->isValid( op, v1.type(), v2.type() );
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates expression without postfix rebuilding
+ \return QtxValue as result (it is invalid if there were errors during calculation)
+*/
QtxValue QtxParser::calculate()
{
setLastError( OK );
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Change expression, rebuild postfix and calculate it
+ \return QtxValue as result (it is invalid if there were errors during calculation)
+*/
QtxValue QtxParser::calculate( const QString& expr )
{
setExpr( expr );
return calculate();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Change expression and rebuild postfix
+*/
bool QtxParser::setExpr( const QString& expr )
{
return parse( expr );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true, if parser contain parameter
+ \param name - name of parameter
+*/
bool QtxParser::has( const QString& name ) const
{
return myParameters.contains( name.stripWhiteSpace() );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets parameter value
+ \param name - name of parameter
+ \param value - value of parameter
+*/
void QtxParser::set( const QString& name, const QtxValue& value )
{
myParameters[ name.stripWhiteSpace() ] = value;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes parameter
+ \param name - name of parameter
+*/
bool QtxParser::remove( const QString& name )
{
QString sname = name.stripWhiteSpace();
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return value of parameter (result is invalid if there is no such parameter)
+ \param name - name of parameter
+*/
QtxValue QtxParser::value( const QString& name ) const
{
QString sname = name.stripWhiteSpace();
return QtxValue();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Searches first parameter with assigned invalid QtxValue
+ \return true if it is found
+ \param name - variable to return name of parameter
+*/
bool QtxParser::firstInvalid( QString& name ) const
{
QMap< QString, QtxValue >::const_iterator anIt = myParameters.begin(),
return false;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes all parameters with assigned invalid QtxValues
+*/
void QtxParser::removeInvalids()
{
QStringList toDelete;
myParameters.remove( *aLIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return last error occured during parsing
+*/
QtxParser::Error QtxParser::lastError() const
{
return myLastError;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets last error occured during parsing (for internal using only)
+*/
void QtxParser::setLastError( QtxParser::Error err )
{
myLastError = err;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return string dump of internal parser postfix
+*/
QString QtxParser::dump() const
{
return dump( myPost );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return string dump of postfix
+ \param post - postfix to be dumped
+*/
QString QtxParser::dump( const Postfix& post ) const
{
QString res;
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list with names of parameters
+ \param list - list to be filled
+*/
void QtxParser::paramsList( QStringList& list )
{
PostfixIterator anIt = myPost.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes all parameters
+*/
void QtxParser::clear()
{
myParameters.clear();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return string representation for list of QtxValues
+ \param list - list to be converted
+*/
QString QtxParser::toString( const QValueList< QtxValue >& list )
{
QValueList< QtxValue >::const_iterator anIt = list.begin(),
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxParser.h
// Author: Alexander SOLOVYOV
class QtxOperations;
+/*! \var QtxValue
+ \brief Alias for QVariant
+*/
typedef QVariant QtxValue;
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxParser
+
+ This class allows to calculate values of expressions using different set of operations.
+ It is provided some of standard set of operations (arithmetics, logic, strings, etc - in QtxStdOperations.h).
+ This parser allows to use parameters with help of methods has(), set(), remove(), value(). It uses
+ postfix representation of expressions and uses class QtxOperations in order to make certain operation
+ Every instance of parser contains only one postfix, so that if expression has been changed, then postfix
+ must be rebuilt. In order to increase performance of frequent calculation for many of expressions it is
+ recommended to use different instances of parser for expressions
+
+*/
class QTX_EXPORT QtxParser
{
public:
+ /*!
+ \enum Error
+ \brief Errors during parsing
+ */
typedef enum
{
- OK, OperandsNotMatch, InvalidResult, InvalidOperation,
- OperationsNull, InvalidToken, CloseExpected, ExcessClose,
- BracketsNotMatch, StackUnderflow, ExcessData
+ OK, /*! \var All right */
+ OperandsNotMatch, /*! \var Types of arguments are invalid for this operation */
+ InvalidResult, /*! \var Operation cannot find result (for example, division by zero) */
+ InvalidOperation, /*! \var Name of operation is unknown */
+ OperationsNull, /*! \var Internal operations pointer of parser is null */
+ InvalidToken, /*! \var It isn't operation, parameter of value */
+ CloseExpected, /*! \var Close bracket is expected */
+ ExcessClose, /*! \var The one of close bracket is excess */
+ BracketsNotMatch, /*! \var Last open and this close bracket are different, for example [) */
+ StackUnderflow, /*! \var There is no arguments in stack for operation */
+ ExcessData /*! \var The parsing is finished, but there is more then one value in stack */
} Error;
static QString toString( const QValueList< QtxValue >& );
protected:
- typedef enum { Value, Param, Open, Close, Pre, Post, Binary } PostfixItemType;
+ /*!
+ \enum PostfixItemType
+ \brief Types of postfix representation elements
+ */
+ typedef enum
+ {
+ Value, /*! \var Value (number, string, etc.)*/
+ Param, /*! \var Parameter */
+ Open, /*! \var Open bracket */
+ Close, /*! \var Close bracket */
+ Pre, /*! \var Unary prefix operation */
+ Post, /*! \var Unary postfix operation */
+ Binary /*! \var Binary operation */
+
+ } PostfixItemType;
+ /*! \var postfix representation element */
typedef struct
{
QtxValue myValue;
} PostfixItem;
+ /*! \var postfix representation */
typedef QValueList< PostfixItem > Postfix;
+
+ /*! \var postfix representation iterator */
typedef Postfix::const_iterator PostfixIterator;
protected:
static int globalBrackets( const Postfix&, int, int );
private:
+ /*! \var stack of QtxValues */
typedef QValueStack < QtxValue > QtxValueStack;
private:
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxPathDialog.cxx
// Author: Sergey TELKOV
" "
};
-//================================================================
-// Function : QtxPathDialog
-// Purpose : Constructor.
-//================================================================
-
+/*!
+ Constructor.
+*/
QtxPathDialog::QtxPathDialog( const bool import, QWidget* parent, const bool modal, const bool resize, const int buttons, WFlags f )
: QtxDialog( parent, 0, modal, resize, buttons, f ),
myDefault( -1 ),
setFocusProxy( le );
}
-//================================================================
-// Function : QtxPathDialog
-// Purpose : Constructor.
-//================================================================
-
+/*!
+ Constructor.
+*/
QtxPathDialog::QtxPathDialog( QWidget* parent, const bool modal, const bool resize, const int buttons, WFlags f )
: QtxDialog( parent, 0, modal, resize, buttons, f ),
myDefault( -1 ),
initialize();
}
-//================================================================
-// Function : ~QtxPathDialog
-// Purpose : Destructor.
-//================================================================
-
+/*!
+ Destructor.
+*/
QtxPathDialog::~QtxPathDialog()
{
}
-//================================================================
-// Function : fileName
-// Purpose :
-//================================================================
-
+/*!
+ \return file name
+*/
QString QtxPathDialog::fileName() const
{
return fileName( defaultEntry() );
}
-//================================================================
-// Function : setFileName
-// Purpose :
-//================================================================
-
+/*!
+ Sets file name
+ \param txt - new file name
+ \param autoExtension - auto extension determination by file
+*/
void QtxPathDialog::setFileName( const QString& txt, const bool autoExtension )
{
setFileName( defaultEntry(), txt, autoExtension );
}
-//================================================================
-// Function : filter
-// Purpose :
-//================================================================
-
+/*!
+ \return filter
+*/
QString QtxPathDialog::filter() const
{
return myFilter;
}
-//================================================================
-// Function : setFilter
-// Purpose :
-//================================================================
-
+/*!
+ Changes filter (filter is a list of masks, separated by ';;')
+ \param fltr - new filter
+*/
void QtxPathDialog::setFilter( const QString& fltr )
{
myFilter = fltr;
}
-//================================================================
-// Function : show
-// Purpose :
-//================================================================
-
+/*!
+ Shows path dialog
+*/
void QtxPathDialog::show()
{
if ( hasVisibleChildren( myEntriesFrame ) )
QtxDialog::show();
}
-//================================================================
-// Function : onBrowse
-// Purpose :
-//================================================================
-
+/*!
+ SLOT: called if user click button to show standard file dialog
+*/
void QtxPathDialog::onBrowse()
{
const QObject* obj = sender();
emit fileNameChanged( fName );
}
-//================================================================
-// Function : onReturnPressed
-// Purpose :
-//================================================================
-
+/*!
+ SLOT: called if user presses RETURN in line edit
+*/
void QtxPathDialog::onReturnPressed()
{
const QObject* obj = sender();
emit fileNameChanged( fileName() );
}
-//================================================================
-// Function : onTextChanged
-// Purpose :
-//================================================================
-
+/*!
+ SLOT: called if text in line edit is changed
+*/
void QtxPathDialog::onTextChanged( const QString& )
{
validate();
}
-//================================================================
-// Function : validate
-// Purpose :
-//================================================================
-
+/*!
+ Checks validity of text and according to it enables/disables OK, Yes buttons
+*/
void QtxPathDialog::validate()
{
setButtonEnabled( isValid(), OK | Yes );
}
-//================================================================
-// Function : isValid
-// Purpose :
-//================================================================
-
+/*!
+ \return true if selected file is valid
+*/
bool QtxPathDialog::isValid()
{
bool ok = true;
return ok;
}
-//================================================================
-// Function : acceptData
-// Purpose :
-//================================================================
-
+/*!
+ \return true entered data is accepted
+*/
bool QtxPathDialog::acceptData() const
{
bool ok = true;
return ok;
}
-//================================================================
-// Function : fileNameChanged
-// Purpose :
-//================================================================
-
+/*!
+ Some custom activity on file name changing (must be redefined, default implementation is empty
+*/
void QtxPathDialog::fileNameChanged( int, QString )
{
}
-//================================================================
-// Function : optionsFrame
-// Purpose :
-//================================================================
-
+/*!
+ \return frame with options
+*/
QFrame* QtxPathDialog::optionsFrame()
{
return myOptionsFrame;
}
-//================================================================
-// Function : getFileName
-// Purpose :
-//================================================================
-
+/*!
+ \return file name
+ \param id - id of file entry
+*/
QString QtxPathDialog::fileName( const int id ) const
{
QString res;
return res;
}
-//================================================================
-// Function : setFileName
-// Purpose :
-//================================================================
-
+/*!
+ Change file name of file entry
+ \param id - id of file entry
+ \param txt - new file name
+ \param autoExt - assign extension automatically
+*/
void QtxPathDialog::setFileName( const int id, const QString& txt, const bool autoExt )
{
int mode;
}
}
-//================================================================
-// Function : fileEntry
-// Purpose :
-//================================================================
-
+/*!
+ \return line edit of file entry
+ \param id - id of file entry
+*/
QLineEdit* QtxPathDialog::fileEntry( const int id ) const
{
QLineEdit* le = 0;
return le;
}
-//================================================================
-// Function : fileEntry
-// Purpose :
-//================================================================
-
+/*!
+ \return line edit and mode of file entry
+ \param id - id of file entry
+ \param theMode - for return mode of file entry
+*/
QLineEdit* QtxPathDialog::fileEntry( const int theId, int& theMode ) const
{
QLineEdit* le = 0;
return le;
}
-//================================================================
-// Function : createFileEntry
-// Purpose :
-//================================================================
-
+/*!
+ Creates file entry
+ \return id of just created file entry
+ \param lab - title of entry
+ \param mode - mode of entry
+ \param id - proposed id (if it is -1, then id will be chosen automatically)
+*/
int QtxPathDialog::createFileEntry( const QString& lab, const int mode, const int id )
{
int num = id;
return num;
}
-//================================================================
-// Function : defaultEntry
-// Purpose :
-//================================================================
-
+/*!
+ \return id of default entry
+*/
int QtxPathDialog::defaultEntry() const
{
return myDefault;
}
-//================================================================
-// Function : setDefaultEntry
-// Purpose :
-//================================================================
-
+/*!
+ Change default entry id
+ \param id - new default entry id
+*/
void QtxPathDialog::setDefaultEntry( const int id )
{
myDefault = id;
}
-//================================================================
-// Function : initialize
-// Purpose :
-//================================================================
-
+/*!
+ Initialize dialog layout
+*/
void QtxPathDialog::initialize()
{
setCaption( tr( "File dialog" ) );
myOptionsFrame = new QFrame( mainGroup );
}
-//================================================================
-// Function : prepareFilters
-// Purpose :
-//================================================================
-
+/*!
+ \return list of filters
+*/
QStringList QtxPathDialog::prepareFilters() const
{
QStringList res;
return res;
}
-//================================================================
-// Function : filterWildCards
-// Purpose :
-//================================================================
-
+/*!
+ \return list of filters with filtered wild cards
+*/
QStringList QtxPathDialog::filterWildCards( const QString& theFilter ) const
{
QStringList res;
return res;
}
-//================================================================
-// Function : autoExtension
-// Purpose :
-//================================================================
-
+/*!
+ \return file name with assigned extension
+ \param theFileName - source file name
+ \param theFilter - list of filters
+*/
QString QtxPathDialog::autoExtension( const QString& theFileName, const QString& theFilter ) const
{
QString fName = theFileName;
return fName;
}
-//================================================================
-// Function : hasVisibleChildren
-// Purpose :
-//================================================================
-
+/*!
+ \return true if widget has visible children
+ \param wid - widget
+*/
bool QtxPathDialog::hasVisibleChildren( QWidget* wid ) const
{
bool res = false;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxPathDialog.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxPopupMenu.h"
int myAlign;
};
+/*!
+ Constructor
+*/
QtxPopupMenu::TitleMenuItem::TitleMenuItem( const QString& txt, const QIconSet& ico, const int align )
: QCustomMenuItem(),
myText( txt ),
{
}
+/*!
+ Destructor
+*/
QtxPopupMenu::TitleMenuItem::~TitleMenuItem()
{
}
+/*!
+ \return TRUE if this item wants to span the entire popup menu width
+*/
bool QtxPopupMenu::TitleMenuItem::fullSpan() const
{
return true;
}
+/*!
+ \return TRUE if this item is just a separator
+*/
bool QtxPopupMenu::TitleMenuItem::isSeparator() const
{
return false;
}
+/*!
+ Changes font of item
+ \param font - new font
+*/
void QtxPopupMenu::TitleMenuItem::setFont( const QFont& font )
{
myFont = font;
myFont.setBold( true );
}
+/*!
+ Draws item
+*/
void QtxPopupMenu::TitleMenuItem::paint( QPainter* p, const QColorGroup& cg,
bool act, bool enabled, int x, int y, int w, int h )
{
p->setFont( f );
}
+/*!
+ \return the recommended size for item
+*/
QSize QtxPopupMenu::TitleMenuItem::sizeHint()
{
QFontMetrics fM( myFont );
}
/*!
- Class: QtxPopupMenu [Public]
- Descr: Popup menu item with title.
+ Constructor
*/
-
QtxPopupMenu::QtxPopupMenu( QWidget* parent, const char* name )
: QPopupMenu( parent, name ),
myId( -1 ),
{
}
+/*!
+ Destructor
+*/
QtxPopupMenu::~QtxPopupMenu()
{
}
+/*!
+ \return popup menu title
+*/
QString QtxPopupMenu::titleText() const
{
return myText;
}
+/*!
+ \return popup menu icon
+*/
QIconSet QtxPopupMenu::titleIcon() const
{
return myIcon;
}
+/*!
+ \return popup menu title policy
+*/
int QtxPopupMenu::titlePolicy() const
{
return myPolicy;
}
+/*!
+ \return popup menu title alignment
+*/
int QtxPopupMenu::titleAlignment() const
{
return myAlign;
}
+/*!
+ Changes title text
+ \param txt - new text
+*/
void QtxPopupMenu::setTitleText( const QString& txt )
{
if ( myText == txt )
updateTitle();
}
+/*!
+ Changes title icon
+ \param icon - new icon
+*/
void QtxPopupMenu::setTitleIcon( const QIconSet& ico )
{
myIcon = ico;
updateTitle();
}
+/*!
+ Changes title policy
+ \param p - new policy
+*/
void QtxPopupMenu::setTitlePolicy( const int p )
{
if ( myPolicy == p )
updateTitle();
}
+/*!
+ Changes title alignment
+ \param a - new alignment
+*/
void QtxPopupMenu::setTitleAlignment( const int a )
{
if ( myAlign == a )
updateTitle();
}
+/*!
+ Shows menu
+*/
void QtxPopupMenu::show()
{
insertTitle();
QPopupMenu::show();
}
+/*!
+ Hides menu
+*/
void QtxPopupMenu::hide()
{
QPopupMenu::hide();
removeTitle();
}
+/*!
+ Creates title item
+ \param txt - item text
+ \param icon - item icon
+ \param align - item alignment
+*/
QtxPopupMenu::TitleMenuItem* QtxPopupMenu::createTitleItem( const QString& txt, const QIconSet& ico,
const int align ) const
{
return new TitleMenuItem( txt, ico, align );
}
+/*!
+ Inserts title item to popup menu
+*/
void QtxPopupMenu::insertTitle()
{
if ( myId != -1 || titlePolicy() == TitleOff ||
setItemEnabled( myId, false );
}
+/*!
+ Removes title item from popup menu
+*/
void QtxPopupMenu::removeTitle()
{
if ( myId == -1 )
myId = -1;
}
+/*!
+ Updates title item
+*/
void QtxPopupMenu::updateTitle()
{
if ( myId != -1 )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef QTXPOPUPMENU_H
#define QTXPOPUPMENU_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxPopupMgr.h"
#include <qpopupmenu.h>
#include <qdatetime.h>
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+
+/*!
+ \return value of global parameter (depending on whole selection, but not dependending on one object of selection)
+ \param str - name of parameter
+
+ By default, it returns count of selected objects ("selcount") and list of parameters ("$<name>")
+*/
QtxValue QtxPopupMgr::Selection::globalParam( const QString& str ) const
{
if( str==selCountParam() )
return QtxValue();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return symbole to detect name of parameter list
+*/
QChar QtxPopupMgr::Selection::equality() const
{
return defEquality();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return name of parameter for count of selected objects
+*/
QString QtxPopupMgr::Selection::selCountParam() const
{
return defSelCountParam();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return default symbole to detect name of parameter list
+*/
QChar QtxPopupMgr::Selection::defEquality()
{
return '$';
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return default name of parameter for count of selected objects
+*/
QString QtxPopupMgr::Selection::defSelCountParam()
{
return "selcount";
+/*!
+ \class QtxCacheSelection
+ Special selection class, that caches parameter values.
+ Every parameter during popup building is calculated only one time,
+ although it may be included to many rules. After calculation
+ it is stored in internal map
+*/
-//================================================================
-// Class :
-// Purpose :
-//================================================================
class QtxCacheSelection : public QtxPopupMgr::Selection
{
public:
CacheMap myParamCache;
};
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+ \param sel - base selection used for parameter calculation
+*/
QtxCacheSelection::QtxCacheSelection( QtxPopupMgr::Selection* sel )
: mySel( sel )
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxCacheSelection::~QtxCacheSelection()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return count of selected objects
+*/
int QtxCacheSelection::count() const
{
return mySel ? mySel->count() : 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates and caches parameters.
+ Already calculated parameters are returned without calculation
+ \return parameter value
+ \param i - index of selected object
+ \param name - name of parameter
+*/
QtxValue QtxCacheSelection::param( const int i, const QString& name ) const
{
QString param_name = name + "#####" + QString::number( i );
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates and caches global parameters.
+ Already calculated parameters are returned without calculation
+ \return parameter value
+ \param name - name of parameter
+*/
QtxValue QtxCacheSelection::globalParam( const QString& name ) const
{
if( myParamCache.contains( name ) )
-
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+ \param mgr - popup manager
+*/
QtxPopupMgr::Operations::Operations( QtxPopupMgr* mgr )
: QtxStrings(),
myPopupMgr( mgr )
myParser = new QtxParser( mgr->myOperations );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+ Deletes internal parser
+*/
QtxPopupMgr::Operations::~Operations()
{
delete myParser;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of popup operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxPopupMgr::Operations::prior( const QString& op, bool isBin ) const
{
if( !isBin && ( op=="every" || op=="any" || op=="onlyone" ) )
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxPopupMgr::Operations::calculate
( const QString& op, QtxValue& v1, QtxValue& v2 ) const
{
return QtxStrings::calculate( op, v1, v2 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Clears internal map of values
+*/
void QtxPopupMgr::Operations::clear()
{
myValues.clear();
-
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+*/
QtxPopupMgr::QtxPopupMgr( QPopupMenu* popup, QObject* parent )
: QtxActionMenuMgr( popup, parent ),
myCurrentSelection( 0 )
createOperations();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxPopupMgr::~QtxPopupMgr()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates popup operations instance
+*/
void QtxPopupMgr::createOperations()
{
myOperations = new QtxListOfOperations;
myOperations->append( "custom", new Operations( this ), 200 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Additional version of registerAction
+ \param act - action to be registered
+ \param visible - rule for visibility state
+ \param toggle - rule for toggle on state
+ \param id - proposed id (if it is less than 0, then id will be generated automatically)
+*/
int QtxPopupMgr::registerAction( QAction* act,
const QString& visible,
const QString& toggle,
return _id;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes action from internal map
+ \param id - action id
+*/
void QtxPopupMgr::unRegisterAction( const int id )
{
QAction* act = action( id );
//QtxActionMenuMgr::unRegisterAction( id );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if manager has rule for action
+ \param act - action
+ \param visibility - if it is true, then rule for "visibility" is checked, otherwise - for "toggle"
+*/
bool QtxPopupMgr::hasRule( QAction* act, bool visibility ) const
{
return map( visibility ).contains( act );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if manager has rule for action
+ \param id - action id
+ \param visibility - if it is true, then rule for "visibility" is checked, otherwise - for "toggle"
+*/
bool QtxPopupMgr::hasRule( const int id, bool visibility ) const
{
return hasRule( action( id ), visibility );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets new rule for action
+ \param act - action
+ \param rule - string expression of rule
+ \param visibility - if it is true, then rule for "visibility" will be set, otherwise - for "toggle"
+*/
void QtxPopupMgr::setRule( QAction* act, const QString& rule, bool visibility )
{
if( !act || rule.isEmpty() )
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets new rule for action
+ \param id - action id
+ \param rule - string expression of rule
+ \param visibility - if it is true, then rule for "visibility" will be set, otherwise - for "toggle"
+*/
void QtxPopupMgr::setRule( const int id, const QString& rule, bool visibility )
{
setRule( action( id ), rule, visibility );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if parser has finished work without errors
+ \param p - parser
+*/
bool result( QtxParser* p )
{
bool res = false;
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills parser parameters with help of Selection::globalParam() method
+ \param p - parser
+ \param specific - list will be filled with names of parameters depending on selection objects (not global)
+*/
void QtxPopupMgr::setParams( QtxParser* p, QStringList& specific ) const
{
if( !p || !myCurrentSelection )
}
}
+/*!
+ \return true if 'v1'<'v2'
+ This function can work with many types of values
+*/
bool operator<( const QtxValue& v1, const QtxValue& v2 )
{
QVariant::Type t1 = v1.type(), t2 = v2.type();
return t1<t2;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if rule of action is satisfied on current selection
+ \param act - action
+ \param visibility - what rule is checked: for visibility(true) or for toggle(false)
+*/
bool QtxPopupMgr::isSatisfied( QAction* act, bool visibility ) const
{
QString menu = act->menuText();
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if item corresponding to action is visible
+ \param actId - action id
+ \param place - index of place
+*/
bool QtxPopupMgr::isVisible( const int actId, const int place ) const
{
bool res = QtxActionMenuMgr::isVisible( actId, place );
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Updates popup according to selection
+ \param p - popup menu
+ \param sel - selection
+*/
void QtxPopupMgr::updatePopup( QPopupMenu* p, Selection* sel )
{
QTime t1 = QTime::currentTime();
delete myCurrentSelection;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return reference to map of rules
+ \param visibility - type of map: visibility of toggle
+*/
QtxPopupMgr::RulesMap& QtxPopupMgr::map( bool visibility ) const
{
return ( RulesMap& )( visibility ? myVisibility : myToggle );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Loads actions description from file
+ \param fname - name of file
+ \param r - reader of file
+ \return true on success
+*/
bool QtxPopupMgr::load( const QString& fname, QtxActionMgr::Reader& r )
{
PopupCreator cr( &r, this );
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+ \param r - menu reader
+ \param mgr - menu manager
+*/
QtxPopupMgr::PopupCreator::PopupCreator( QtxActionMgr::Reader* r,
QtxPopupMgr* mgr )
: QtxActionMgr::Creator( r ),
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
-QtxPopupMgr::PopupCreator::~PopupCreator()
+/*!
+ Destructor
+*/QtxPopupMgr::PopupCreator::~PopupCreator()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+
+/*!
+ Appends new menu items
+ \param tag - tag of item
+ \param subMenu - it has submenu
+ \param attr - list of attributes
+ \param pId - id of action corresponding to parent item
+*/
int QtxPopupMgr::PopupCreator::append( const QString& tag, const bool subMenu,
const ItemAttributes& attr, const int pId )
{
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return visibility rule by attributes
+ Default implementation is empty
+*/
QString QtxPopupMgr::PopupCreator::visibleRule( const ItemAttributes& ) const
{
return QString::null;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return toggle rule by attributes
+ Default implementation is empty
+*/
QString QtxPopupMgr::PopupCreator::toggleRule( const ItemAttributes& ) const
{
return QString::null;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __QTX_POPUP_MGR_HEADER__
class QtxListOfOperations;
-//================================================================
-// Class :
-// Purpose :
-//================================================================
class QTX_EXPORT QtxPopupMgr : public QtxActionMenuMgr
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxResourceEdit.cxx
// Author: Sergey TELKOV
#include "QtxResourceMgr.h"
-/*
- Class: QtxResourceEdit
- Descr: Class for managing preferences items
-*/
+/*!
+ Constructor
+*/
QtxResourceEdit::QtxResourceEdit( QtxResourceMgr* mgr )
: myResMgr( mgr )
{
}
+/*!
+ Destructor
+*/
QtxResourceEdit::~QtxResourceEdit()
{
ItemMap items;
delete itr.data();
}
+/*!
+ \return assigned resource manager
+*/
QtxResourceMgr* QtxResourceEdit::resourceMgr() const
{
return myResMgr;
}
+/*!
+ Adds new item
+ \param label - label of widget to edit preference
+ \param pId - parent item id
+ \param type - type of item
+ \param section - section of resource assigned with item
+ \param param - name of resource assigned with item
+*/
int QtxResourceEdit::addItem( const QString& label, const int pId, const int type,
const QString& section, const QString& param )
{
return i->id();
}
+/*!
+ \return value of item property
+ \param id - item id
+ \propName - propertyName
+*/
QVariant QtxResourceEdit::itemProperty( const int id, const QString& propName ) const
{
QVariant propValue;
return propValue;
}
+/*!
+ Sets value of item property
+ \param id - item id
+ \propName - propertyName
+ \propValue - new value of property
+*/
void QtxResourceEdit::setItemProperty( const int id, const QString& propName, const QVariant& propValue )
{
Item* i = item( id );
i->setProperty( propName, propValue );
}
+/*!
+ \return resource assigned with item
+ \param id - item id
+ \param section - to return section of resource
+ \param param - to return name of resource
+*/
void QtxResourceEdit::resource( const int id, QString& sec, QString& param ) const
{
Item* i = item( id );
i->resource( sec, param );
}
+/*!
+ Stores all values to resource manager
+*/
void QtxResourceEdit::store()
{
QMap<Item*, QString> before;
changedResources( changed );
}
+/*!
+ Retrieve all values from resource manager
+*/
void QtxResourceEdit::retrieve()
{
for ( ItemMap::ConstIterator it = myItems.begin(); it != myItems.end(); ++it )
it.data()->retrieve();
}
+/*!
+ Stores all values to backup container
+*/
void QtxResourceEdit::toBackup()
{
myBackup.clear();
resourceValues( myBackup );
}
+/*!
+ Retrieve all values from backup container
+*/
void QtxResourceEdit::fromBackup()
{
QMap<Item*, QString> before;
changedResources( changed );
}
+/*!
+ Updates resource edit (default implementation is empty)
+*/
void QtxResourceEdit::update()
{
}
+/*!
+ \return item by it's id
+ \param id - item id
+*/
QtxResourceEdit::Item* QtxResourceEdit::item( const int id ) const
{
Item* i = 0;
return i;
}
+/*!
+ \return item by it's title (finds first item)
+ \param title - item title
+*/
QtxResourceEdit::Item* QtxResourceEdit::item( const QString& title ) const
{
Item* i = 0;
return i;
}
+/*!
+ \return item by it's title and parent id
+ \param title - item title
+ \param pId - parent id
+*/
QtxResourceEdit::Item* QtxResourceEdit::item( const QString& title, const int pId ) const
{
Item* i = 0;
return i;
}
+/*!
+ Creates item
+ \return new item
+ \param label - text of label for new item
+ \param type - type of new item
+ \param pId - parent id
+*/
QtxResourceEdit::Item* QtxResourceEdit::createItem( const QString& label, const int type, const int pId )
{
Item* i = 0;
return i;
}
+/*!
+ Removes item
+ \param item - item to be removed
+*/
void QtxResourceEdit::removeItem( Item* item )
{
if ( !item )
itemRemoved( item );
}
+/*!
+ \return children items of resource edit
+ \param lst - list of items to be filled with children
+*/
void QtxResourceEdit::childItems( QPtrList<Item>& lst ) const
{
lst.clear();
lst.append( it.current() );
}
+/*!
+ \return all resources values from widgets
+ \param map - map to be filled by resources values
+*/
void QtxResourceEdit::resourceValues( QMap<int, QString>& map ) const
{
QString sect, name;
}
}
+/*!
+ \return all resources values from widgets
+ \param map - map to be filled by resources values
+*/
void QtxResourceEdit::resourceValues( QMap<Item*, QString>& map ) const
{
QString sect, name;
}
}
+/*!
+ Sets to widgets all resources values from map
+ \param map - map with resources values
+*/
void QtxResourceEdit::setResourceValues( QMap<int, QString>& map ) const
{
for ( QMap<int, QString>::ConstIterator it = map.begin(); it != map.end(); ++it )
}
}
+/*!
+ Sets to widgets all resources values from map
+ \param map - map with resources values
+*/
void QtxResourceEdit::setResourceValues( QMap<Item*, QString>& map ) const
{
for ( QMap<Item*, QString>::ConstIterator it = map.begin(); it != map.end(); ++it )
it.key()->setResourceValue( it.data() );
}
-
+/*!
+ Compares two map of resources values and finds different ones
+ \param map1 - first map
+ \param map2 - second map
+ \param resMap - map to be filled with different values
+ \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second
+*/
void QtxResourceEdit::differentValues( const QMap<int, QString>& map1, const QMap<int, QString>& map2,
QMap<int, QString>& resMap, const bool fromFirst ) const
{
}
}
+/*!
+ Compares two map of resources values and finds different ones
+ \param map1 - first map
+ \param map2 - second map
+ \param resMap - map to be filled with different values
+ \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second
+*/
void QtxResourceEdit::differentValues( const QMap<Item*, QString>& map1, const QMap<Item*, QString>& map2,
QMap<Item*, QString>& resMap, const bool fromFirst ) const
{
}
}
+/*!
+ Makes some activity on resource changing (called from store() method)
+ \sa store()
+*/
void QtxResourceEdit::changedResources( const QMap<Item*, QString>& )
{
}
+/*!
+ Some activity on item addition (default implementation is empty)
+*/
void QtxResourceEdit::itemAdded( Item* )
{
}
+/*!
+ Some activity on item removing (default implementation is empty)
+*/
void QtxResourceEdit::itemRemoved( Item* )
{
}
-/*
- Class: QtxResourceEdit::Item
- Descr: Class for incapsulation of one preference item
+/*!
+ Constructor
*/
-
QtxResourceEdit::Item::Item( QtxResourceEdit* edit, Item* parent )
: myEdit( edit ),
myParent( 0 )
parent->insertChild( this );
}
+/*!
+ Destructor
+*/
QtxResourceEdit::Item::~Item()
{
if ( resourceEdit() )
resourceEdit()->removeItem( this );
}
+/*!
+ \return id of item
+*/
int QtxResourceEdit::Item::id() const
{
return myId;
}
+/*!
+ \return parent item
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::parentItem() const
{
return myParent;
}
+/*!
+ Appends child and (if necessary) removes item from old parent
+ \param item - item to be added
+*/
void QtxResourceEdit::Item::insertChild( Item* item )
{
if ( !item || myChildren.contains( item ) )
myChildren.append( item );
}
+/*!
+ Removes child
+ \param item - item to be removed
+*/
void QtxResourceEdit::Item::removeChild( Item* item )
{
if ( !item || !myChildren.contains( item ) )
item->myParent = 0;
}
+/*!
+ Fills list with children items
+ \param lst - list to be filled with
+*/
void QtxResourceEdit::Item::childItems( QPtrList<Item>& lst ) const
{
for ( ItemListIterator it( myChildren ); it.current(); ++it )
lst.append( it.current() );
}
+/*!
+ \return true if there is no children of this item
+*/
bool QtxResourceEdit::Item::isEmpty() const
{
return myChildren.isEmpty();
}
+/*!
+ \return title of item
+*/
QString QtxResourceEdit::Item::title() const
{
return myTitle;
}
+/*!
+ \return assigned resource placement
+ \param sec - to return section
+ \param param - to return param name
+*/
void QtxResourceEdit::Item::resource( QString& sec, QString& param ) const
{
sec = myResSection;
param = myResParameter;
}
+/*!
+ Sets item title
+ \param title - new item title
+*/
void QtxResourceEdit::Item::setTitle( const QString& title )
{
myTitle = title;
}
+/*!
+ Assigns new resource to item
+ \param sec - section
+ \param sec - param name
+*/
void QtxResourceEdit::Item::setResource( const QString& sec, const QString& param )
{
myResSection = sec;
myResParameter = param;
}
+/*!
+ Updates item (default implementation is empty)
+*/
void QtxResourceEdit::Item::update()
{
}
+/*!
+ \return property value
+*/
QVariant QtxResourceEdit::Item::property( const QString& ) const
{
return QVariant();
}
+/*!
+ Sets property value
+*/
void QtxResourceEdit::Item::setProperty( const QString&, const QVariant& )
{
}
+/*!
+ \return value of assigned resource
+*/
QString QtxResourceEdit::Item::resourceValue() const
{
return getString();
}
+/*!
+ Sets value of assigned resource
+ \param val - new value
+*/
void QtxResourceEdit::Item::setResourceValue( const QString& val )
{
setString( val );
}
+/*!
+ \return corresponding resource manager
+*/
QtxResourceMgr* QtxResourceEdit::Item::resourceMgr() const
{
QtxResourceMgr* resMgr = 0;
return resMgr;
}
+/*!
+ \return corresponding resource edit
+*/
QtxResourceEdit* QtxResourceEdit::Item::resourceEdit() const
{
return myEdit;
}
+/*!
+ \return integer value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
int QtxResourceEdit::Item::getInteger( const int val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->integerValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return double value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
double QtxResourceEdit::Item::getDouble( const double val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->doubleValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return boolean value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
bool QtxResourceEdit::Item::getBoolean( const bool val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->booleanValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return string value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
QString QtxResourceEdit::Item::getString( const QString& val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->stringValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return color value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
QColor QtxResourceEdit::Item::getColor( const QColor& val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->colorValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return font value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
QFont QtxResourceEdit::Item::getFont( const QFont& val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->fontValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setInteger( const int val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setDouble( const double val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setBoolean( const bool val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setString( const QString& val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setColor( const QColor& val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setFont( const QFont& val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ \return other item
+ \param id - other item id
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::item( const int id ) const
{
return resourceEdit() ? resourceEdit()->item( id ) : 0;
}
+/*!
+ \return other item
+ \param title - other item title
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::item( const QString& title ) const
{
return resourceEdit() ? resourceEdit()->item( title ) : 0;
}
+/*!
+ \return other item
+ \param title - other item title
+ \param id - parent item id
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::item( const QString& title, const int id ) const
{
return resourceEdit() ? resourceEdit()->item( title, id ) : 0;
}
+/*!
+ \return free item id
+*/
int QtxResourceEdit::Item::generateId()
{
static int _id = 0;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxResourceEdit.h
// Author: Sergey TELKOV
#include <qvariant.h>
#include <qfont.h>
+/*!
+ \class QtxResourceEdit
+ Class for managing preferences items
+*/
class QTX_EXPORT QtxResourceEdit
{
public:
friend class QtxResourceEdit::Item;
};
-/*
- Class: QtxResourceEditor::Item
- Descr: Class for incapsulation of one preference item
+/*!
+ \class QtxResourceEditor::Item
+ Class for incapsulation of one preference item
*/
class QTX_EXPORT QtxResourceEdit::Item
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxResourceMgr.h"
{
}
+/*!
+ Destructor
+*/
QtxResourceMgr::Resources::~Resources()
{
}
+/*!
+ Returns name of resource file
+ This file is used to load/save operations
+*/
QString QtxResourceMgr::Resources::file() const
{
return myFileName;
}
+/*!
+ Sets name of resource file
+ \param fn - name of file
+*/
void QtxResourceMgr::Resources::setFile( const QString& fn )
{
myFileName = fn;
}
+/*!
+ Returns string representation of parameter value
+ Returns QString::null if there is no such parameter
+
+ \param sect - name of section
+ \param name - name of parameter
+ \param subst - if it is true, then the substitution of variables
+ will be done with help of makeSubstitution method
+ \sa makeSubstitution()
+*/
QString QtxResourceMgr::Resources::value( const QString& sect, const QString& name, const bool subst ) const
{
QString val;
return val;
}
+/*!
+ Sets value by it's string representation
+
+ \param sect - name of section
+ \param name - name of parameter
+ \param val - string value
+*/
void QtxResourceMgr::Resources::setValue( const QString& sect, const QString& name, const QString& val )
{
Section& s = section( sect );
s.insert( name, val );
}
+/*!
+ \return true if section exists
+ \param sect - name of section
+*/
bool QtxResourceMgr::Resources::hasSection( const QString& sect ) const
{
return mySections.contains( sect );
}
+/*!
+ \return true if parameter exists in section
+ \param sect - name of section
+ \param name - name of parameter
+*/
bool QtxResourceMgr::Resources::hasValue( const QString& sect, const QString& name ) const
{
return hasSection( sect ) && section( sect ).contains( name );
}
+/*!
+ Removes section from resources
+ \param sect - name of section
+*/
void QtxResourceMgr::Resources::removeSection( const QString& sect )
{
mySections.remove( sect );
}
+/*!
+ Removes parameter from section
+ \param sect - name of section
+ \param name - name of parameter
+*/
void QtxResourceMgr::Resources::removeValue( const QString& sect, const QString& name )
{
if ( !hasSection( sect ) )
mySections.remove( sect );
}
+/*!
+ Removes all sections
+*/
void QtxResourceMgr::Resources::clear()
{
mySections.clear();
}
+/*!
+ \return list of section names
+*/
QStringList QtxResourceMgr::Resources::sections() const
{
return mySections.keys();
}
+/*!
+ \return list of parameter names from section
+ \param sec - name of section
+*/
QStringList QtxResourceMgr::Resources::parameters( const QString& sec ) const
{
if ( !hasSection( sec ) )
return section( sec ).keys();
}
+/*!
+ \return path of file from directory built by parameter
+ \return QString::null if built path doesn't exist
+ \param sec - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QString QtxResourceMgr::Resources::path( const QString& sec, const QString& prefix, const QString& name ) const
{
QString filePath = fileName( sec, prefix, name );
return filePath;
}
+/*!
+ \return corresponding resource manager
+*/
QtxResourceMgr* QtxResourceMgr::Resources::resMgr() const
{
return myMgr;
}
+/*!
+ \return instance of section by it's name. Section will be created if it doesn't exist
+*/
QtxResourceMgr::Section& QtxResourceMgr::Resources::section( const QString& sn )
{
if ( !mySections.contains( sn ) )
return mySections[sn];
}
+/*!
+ \return instance of section by it's name. Section will be created if it doesn't exist
+*/
const QtxResourceMgr::Section& QtxResourceMgr::Resources::section( const QString& sn ) const
{
return mySections[sn];
}
+/*!
+ \return full path of file
+ \param sect - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QString QtxResourceMgr::Resources::fileName( const QString& sect, const QString& prefix, const QString& name ) const
{
QString path;
return QString();
}
+/*!
+ \return QPixmap loaded from file
+ \param sect - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of picture file
+*/
QPixmap QtxResourceMgr::Resources::loadPixmap( const QString& sect, const QString& prefix, const QString& name ) const
{
QString fname = fileName( sect, prefix, name );
return p;
}
+/*!
+ \return just created and loaded translator
+ \param sect - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QTranslator* QtxResourceMgr::Resources::loadTranslator( const QString& sect, const QString& prefix, const QString& name ) const
{
QTranslator* trans = new QTranslator( 0 );
return trans;
}
+/*!
+ Finds in string variables by patterns: ${name} or $(name) or %name%
+ \return first found name or QString::null if there is no ones
+ \param str - string where the search is processed
+ \param start - integer value for returning start position of variable
+ \param len - integer value for returning length of variable
+*/
QString QtxResourceMgr::Resources::environmentVariable( const QString& str, int& start, int& len ) const
{
QString varName = QString::null;
return varName;
}
+/*!
+ Substitutes variables by its' values. If variable is from enviroment,
+ it will be replaced by environment value. If it isn't, method tries to
+ find it's value among resources
+ \return new variant of string 'str'
+ \param str - string to process substitution
+ \param sect - section, in which the variables will be finding
+ \param name - name of variable which must be ignored during substitution
+*/
QString QtxResourceMgr::Resources::makeSubstitution( const QString& str, const QString& sect, const QString& name ) const
{
QString res = str;
Class: QtxResourceMgr::IniFormat
Level: Internal
*/
-
class QtxResourceMgr::IniFormat : public Format
{
public:
virtual bool save( const QString&, const QMap<QString, Section>& );
};
+/*!
+ Default constructor
+*/
QtxResourceMgr::IniFormat::IniFormat()
: Format( "ini" )
{
}
+/*!
+ Destructor
+*/
QtxResourceMgr::IniFormat::~IniFormat()
{
}
+/*!
+ Loads resources from ini-file to map of sections
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::IniFormat::load( const QString& fname, QMap<QString, Section>& secMap )
{
QFile file( fname );
return res;
}
+/*!
+ Saves map of sections to resource ini-file
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::IniFormat::save( const QString& fname, const QMap<QString, Section>& secMap )
{
QFile file( fname );
QString valueAttribute() const;
};
+/*!
+ Default constructor
+*/
QtxResourceMgr::XmlFormat::XmlFormat()
: Format( "xml" )
{
}
+/*!
+ Destructor
+*/
QtxResourceMgr::XmlFormat::~XmlFormat()
{
}
+/*!
+ Loads resources from xml-file to map of sections
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::XmlFormat::load( const QString& fname, QMap<QString, Section>& secMap )
{
bool res = false;
QFile file( fname );
if ( !file.open( IO_ReadOnly ) )
+ {
+ qDebug( "File cannot be opened" );
return false;
+ }
QDomDocument doc;
file.close();
if ( !res )
+ {
+ qDebug( "File is empty" );
return false;
+ }
QDomElement root = doc.documentElement();
if ( root.isNull() || root.tagName() != docTag() )
+ {
+ qDebug( "Invalid root" );
return false;
+ }
QDomNode sectNode = root.firstChild();
while ( res && !sectNode.isNull() )
secMap[section].insert( paramName, paramValue );
}
else
+ {
+ qDebug( "Invalid parameter element" );
res = false;
+ }
}
else
+ {
res = paramNode.isComment();
+ if( !res )
+ qDebug( "Node isn't element nor comment" );
+ }
paramNode = paramNode.nextSibling();
}
}
else
+ {
+ qDebug( "Invalid section" );
res = false;
+ }
}
else
+ {
res = sectNode.isComment(); // if it's a comment -- let it be, pass it..
+ if( !res )
+ qDebug( "Node isn't element nor comment" );
+ }
sectNode = sectNode.nextSibling();
}
#endif
+ if( res )
+ qDebug( QString( "File '%1' is loaded successfully" ).arg( fname ) );
return res;
}
+/*!
+ Saves map of sections to resource xml-file
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::XmlFormat::save( const QString& fname, const QMap<QString, Section>& secMap )
{
bool res = false;
return res;
}
+/*!
+ \return XML tag of document
+*/
QString QtxResourceMgr::XmlFormat::docTag() const
{
QString tag = option( "doc_tag" );
return tag;
}
+/*!
+ \return XML tag of section
+*/
QString QtxResourceMgr::XmlFormat::sectionTag() const
{
QString tag = option( "section_tag" );
return tag;
}
+/*!
+ \return XML tag of parameter
+*/
QString QtxResourceMgr::XmlFormat::parameterTag() const
{
QString tag = option( "parameter_tag" );
return tag;
}
+/*!
+ \return XML attribute of parameter name
+*/
QString QtxResourceMgr::XmlFormat::nameAttribute() const
{
QString str = option( "name_attribute" );
return str;
}
+/*!
+ \return XML attribute of parameter value
+*/
QString QtxResourceMgr::XmlFormat::valueAttribute() const
{
QString str = option( "value_attribute" );
Qtx::mkDir( Qtx::dir( res->myFileName ) );
- return save( res->myFileName, res->mySections );
+ QtxResourceMgr* mgr = res->resMgr();
+ QString name = mgr ? mgr->userFileName( mgr->appName(), false ) : res->myFileName;
+ return save( name, res->mySections );
}
/*!
it.current()->clear();
}
+/*!
+ Set state 'ignore user values'.
+ If it is true, then all resources loaded from user home directory is ignored
+*/
void QtxResourceMgr::setIgnoreUserValues( const bool val )
{
myIsIgnoreUserValues = val;
}
+/*!
+ \return state 'ignore user values'
+*/
bool QtxResourceMgr::ignoreUserValues() const
{
return myIsIgnoreUserValues;
return res;
}
+/*!
+ \brief Import some file with resources
+*/
+bool QtxResourceMgr::import( const QString& fname )
+{
+ Format* fmt = format( currentFormat() );
+ if ( !fmt )
+ return false;
+
+ Resources* r = myResources.getFirst();
+ if( !r )
+ return false;
+
+ QString old = r->file();
+ r->setFile( fname );
+ bool res = fmt->load( r );
+ r->setFile( old );
+ return res;
+}
+
/*!
\brief Save the changed resources in to the user resource file.
*/
return res;
}
+/*!
+ \return path of file from directory built by parameter
+ \return QString::null if built path doesn't exist
+ \param sec - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QString QtxResourceMgr::path( const QString& sect, const QString& prefix, const QString& name ) const
{
QString res;
return res;
}
+/*!
+ \return section corresponding to resources paths
+*/
QString QtxResourceMgr::resSection() const
{
QString res = option( "res_section_name" );
return res;
}
+/*!
+ \return section corresponding to language settings
+*/
QString QtxResourceMgr::langSection() const
{
QString res = option( "lang_section_name" );
return res;
}
+/*!
+ \return default image used when during loading the image file doesn't exist
+*/
QPixmap QtxResourceMgr::defaultPixmap() const
{
return myDefaultPix;
}
+/*!
+ Set image as default image used when during loading the image file doesn't exist
+ \param pix - image
+*/
void QtxResourceMgr::setDefaultPixmap( const QPixmap& pix )
{
myDefaultPix = pix;
}
+/*!
+ \return image loaded from file
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name ) const
{
return loadPixmap( prefix, name, true );
}
+/*!
+ \return image loaded from file
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+ \param useDef - indicates if it is possible to use default image returning by defaultPixmap() method.
+ If it is false, the empty pixmap will be used as default
+ \sa defaultPixmap()
+*/
QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, const bool useDef ) const
{
return loadPixmap( prefix, name, useDef ? defaultPixmap() : QPixmap() );
}
+/*!
+ Finds in all sections an existing path corresponding to 'prefix' parameter
+ and load image with name 'name' from this folder
+
+ \return image loaded from file
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+ \param defPix - default image used when file doesn't exist
+*/
QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, const QPixmap& defPix ) const
{
initialize();
return pix;
}
+/*!
+ Loads translator for language
+ Name of translator file is constructed by list returning by option "translators" or,
+ if it is empty, by predefined pattern "%P_msg_%L.qm". It is recommended to used in translators
+ name the strings %A, %P, %L whose will be replaced by application name, prefix and language name correspondingly
+
+ \param pref - name of parameter containing path to translator's file.
+ If it is empty, the list of parameters from resource section ( resSection() )
+ is used.
+
+ \param l - name of language. If it is empty, then value of parameter "language"
+ from language section ( langSection() ) is used. If it is also empty, then
+ predefined name "en" is used
+
+ \sa resSection(), langSection()
+*/
void QtxResourceMgr::loadLanguage( const QString& pref, const QString& l )
{
initialize();
}
}
+/*!
+ Loads translators by path and list of files
+
+ \param prefix - value of this parameter must contain path
+ \param translators - list of translators' files
+*/
void QtxResourceMgr::loadTranslators( const QString& prefix, const QStringList& translators )
{
initialize();
}
}
+/*!
+ Loads translator by path and file name
+
+ \param prefix - value of this parameter must contain path
+ \param name - name of translator file
+*/
void QtxResourceMgr::loadTranslator( const QString& prefix, const QString& name )
{
initialize();
}
}
+/*!
+ Remove all translators corresponding to prefix
+
+ \param prefix - parameter containing path
+*/
void QtxResourceMgr::removeTranslators( const QString& prefix )
{
if ( !myTranslator.contains( prefix ) )
myTranslator.remove( prefix );
}
+/*!
+ Moves translators corresponding to prefix to the top of translator stack
+
+ \param prefix - parameter containing path
+*/
void QtxResourceMgr::raiseTranslators( const QString& prefix )
{
if ( !myTranslator.contains( prefix ) )
}
}
+/*!
+ Copies all resources to user resources, so that they will be saved in user home folder
+*/
void QtxResourceMgr::refresh()
{
QStringList sl = sections();
}
}
+/*!
+ \brief Sets the resource directories list except user home directory and clear resources
+*/
void QtxResourceMgr::setDirList( const QStringList& dl )
{
myDirList = dl;
myResources.clear();
}
+/*!
+ Sets resource value
+ \param sect - name of section
+ \param name - name of parameter
+ \param val - string representation of value
+*/
void QtxResourceMgr::setResource( const QString& sect, const QString& name, const QString& val )
{
initialize();
myResources.first()->setValue( sect, name, val );
}
-QString QtxResourceMgr::userFileName( const QString& appName ) const
+/*!
+ \return name of resource file, which is being found in user home directory
+ \param appName - name of application
+ \param for_load - flag indicating that file will be used for loading (true) or for saving(false)
+ It makes possible to use different resource files for loading and saving
+*/
+QString QtxResourceMgr::userFileName( const QString& appName, const bool /*for_load*/ ) const
{
QString fileName;
QString pathName = QDir::homeDirPath();
return pathName;
}
+/*!
+ \return name of resource file, which is being found in all resource directories, except user home
+*/
QString QtxResourceMgr::globalFileName( const QString& appName ) const
{
return QString( "%1.%2" ).arg( appName ).arg( currentFormat() );
}
+/*!
+ Replaced substrings by pattern %A, %B, etc by values from map
+
+ \param src - string to be processed
+ \param substMap - map of values for replacing
+*/
QString QtxResourceMgr::substMacro( const QString& src, const QMap<QChar, QString>& substMap ) const
{
QString trg = src;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef QTX_RESOURCEMGR_H
#define QTX_RESOURCEMGR_H
QString path( const QString&, const QString&, const QString& ) const;
bool load();
+ bool import( const QString& );
bool save();
QStringList sections() const;
virtual void setDirList( const QStringList& );
virtual void setResource( const QString&, const QString&, const QString& );
- virtual QString userFileName( const QString& ) const;
+ virtual QString userFileName( const QString&, const bool = true ) const;
virtual QString globalFileName( const QString& ) const;
private:
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QtxStdOperations.h"
#include <math.h>
#include <stdlib.h>
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxStdOperations::QtxStdOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxStdOperations::~QtxStdOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list of brackets treated as open (when 'open' is 'true') or close ('open' is 'false')
+*/
void QtxStdOperations::bracketsList( QStringList& list, bool open ) const
{
if( open )
list.append( ")" );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list with operation names by copying of internal list of operations
+*/
void QtxStdOperations::opersList( QStringList& list ) const
{
- list += myOpers;
+ list += myOpers;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Add operation names from list to internal list of operations
+*/
void QtxStdOperations::addOperations( const QStringList& list )
{
QStringList::const_iterator anIt = list.begin(),
myOpers.append( *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Append operation names from 'list' to internal list of operations
+*/
void QtxStdOperations::addTypes( const ListOfTypes& list )
{
ListOfTypes::const_iterator anIt = list.begin(),
myTypes.append( *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return whether values with passed types are valid for arguments of operation
+ \param op - name of operation
+ \param t1 - type of first argument
+ \param t2 - type of second argument
+*/
QtxParser::Error QtxStdOperations::isValid( const QString& op,
const QVariant::Type t1,
const QVariant::Type t2 ) const
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxArithmetics::QtxArithmetics()
: QtxStdOperations()
{
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxArithmetics::~QtxArithmetics()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates numbers by it's string representation [redefined virtual]
+*/
bool QtxArithmetics::createValue( const QString& str, QtxValue& v ) const
{
bool ok = false;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxArithmetics::prior( const QString& op, bool isBin ) const
{
if( isBin )
v1 = QVariant( v2, 0 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxArithmetics::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxLogic::QtxLogic()
: QtxStdOperations()
{
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxLogic::~QtxLogic()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates value 'true' or 'false' it's string representation [redefined virtual]
+*/
bool QtxLogic::createValue( const QString& str, QtxValue& v ) const
{
bool ok = true;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxLogic::prior( const QString& op, bool isBin ) const
{
if( isBin )
return false;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxLogic::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxFunctions::QtxFunctions()
: QtxStdOperations()
{
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxFunctions::~QtxFunctions()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates numbers by it's string representation [redefined virtual]
+*/
bool QtxFunctions::createValue( const QString& str, QtxValue& v ) const
{
bool ok = false;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxFunctions::prior( const QString& op, bool isBin ) const
{
if( isBin )
return 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxFunctions::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxStrings::QtxStrings()
: QtxStdOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxStrings::~QtxStrings()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates string QtxValue by it's Qt string representation [redefined virtual]
+*/
bool QtxStrings::createValue( const QString& str, QtxValue& v ) const
{
QChar st = str[0],
return QtxStdOperations::createValue( str, v );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxStrings::prior( const QString& op, bool isBin ) const
{
if( isBin )
return 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxStrings::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxSets::QtxSets()
{
QStringList aList;
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxSets::~QtxSets()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list of brackets treated as open (when 'open' is 'true') or close ('open' is 'false')
+*/
void QtxSets::bracketsList( QStringList& list, bool open ) const
{
if( open )
QtxStdOperations::bracketsList( list, open );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates set of QtxValues by their string representation [redefined virtual]
+*/
bool QtxSets::createValue( const QString& str, QtxValue& val ) const
{
return QtxStdOperations::createValue( str, val );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxSets::prior( const QString& op, bool isBin ) const
{
if( isBin )
return 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return whether values with passed types are valid for arguments of operation
+ \param op - name of operation
+ \param t1 - type of first argument
+ \param t2 - type of second argument
+*/
QtxParser::Error QtxSets::isValid( const QString& op,
const QVariant::Type t1,
const QVariant::Type t2 ) const
return QtxStdOperations::isValid( op, t1, t2 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Adds new value 'v' to set 'set' [static]
+*/
void QtxSets::add( ValueSet& set, const QtxValue& v )
{
if( v.isValid() && set.contains( v )==0 )
set.append( v );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Adds values from set 's2' to set 's1'
+*/
void QtxSets::add( ValueSet& s1, const ValueSet& s2 )
{
ValueSet::const_iterator anIt = s2.begin(),
add( s1, *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes value 'v' from set 'set'
+*/
void QtxSets::remove( ValueSet& set, const QtxValue& v )
{
set.remove( v );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes values of set 's2' from set 's1'
+*/
void QtxSets::remove( ValueSet& s1, const ValueSet& s2 )
{
ValueSet::const_iterator anIt = s2.begin(),
s1.remove( *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxSets::calculate( const QString& op, QtxValue& v1, QtxValue& v2 ) const
{
QtxParser::Error err = QtxParser::OK;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxStdOperations.h
// Author: Alexander SOLOVYOV
#include "Qtx.h"
#include "QtxOperations.h"
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxStdOperations
+ Provides simplified interface for standard operations.
+ Conatins list of operation names, priority and possible types
+*/
class QTX_EXPORT QtxStdOperations : public QtxOperations
{
public:
ListOfTypes myTypes;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxArithmetics
+ Provides set of arithmetic operations for parser
+*/
class QTX_EXPORT QtxArithmetics : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxLogic
+ Provides set of logic operations for parser
+*/
class QTX_EXPORT QtxLogic : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxFunctions
+ Provides set of more complex operations for parser (sqrt, sin, cos, etc)
+*/
class QTX_EXPORT QtxFunctions : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxStrings
+ Provides set of string operations for parser
+*/
class QTX_EXPORT QtxStrings : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxSets
+ Provides set of operations with sets for parser
+*/
class QTX_EXPORT QtxSets : public QtxStdOperations
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxTable.cxx
// Author: Sergey TELKOV
#include <qlineedit.h>
+/*!
+ Constructor
+*/
QtxTable::QtxTable( QWidget* parent, const char* name )
: QTable( parent, name ),
myHeaderEditor( 0 ),
connect( horizontalScrollBar(), SIGNAL( valueChanged( int ) ), this, SLOT( onScrollBarMoved( int ) ) );
}
+/*!
+ Constructor
+*/
QtxTable::QtxTable( int numRows, int numCols, QWidget* parent, const char* name )
: QTable( numRows, numCols, parent, name ),
myHeaderEditor( 0 ),
connect( horizontalScrollBar(), SIGNAL( valueChanged( int ) ), this, SLOT( onScrollBarMoved( int ) ) );
}
+/*!
+ Destructor
+*/
QtxTable::~QtxTable()
{
}
+/*!
+ \return true if header is editable
+ \param o - header orientation
+*/
bool QtxTable::headerEditable( Orientation o ) const
{
return myHeaderEditable.contains( o ) ? myHeaderEditable[o] : false;
}
+/*!
+ Changes editable state of header
+ \param o - header orientation
+ \param on - new state
+*/
void QtxTable::setHeaderEditable( Orientation o, const bool on )
{
if ( headerEditable( o ) == on )
hdr->removeEventFilter( this );
}
+/*!
+ Starts edition of header
+ \param o - header orientation
+ \param sec - column/row
+*/
bool QtxTable::editHeader( Orientation o, const int sec )
{
return beginHeaderEdit( o, sec );
}
+/*!
+ Finishes edition of header
+ \param accept - whether new value must be accepted
+*/
void QtxTable::endEditHeader( const bool accept )
{
endHeaderEdit( accept );
}
+/*!
+ Finishes edition and hides table
+*/
void QtxTable::hide()
{
endHeaderEdit();
QTable::hide();
}
+/*!
+ Custom event filter
+ Starts edition of header by double click
+ Finishes edition by escape/return/enter pressing
+*/
bool QtxTable::eventFilter( QObject* o, QEvent* e )
{
if ( e->type() == QEvent::MouseButtonDblClick )
return QTable::eventFilter( o, e );
}
+/*!
+ SLOT: called on scroll
+*/
void QtxTable::onScrollBarMoved( int )
{
updateHeaderEditor();
}
+/*!
+ SLOT: called on header size changing
+*/
void QtxTable::onHeaderSizeChange( int, int, int )
{
if ( sender() == myEditedHeader )
updateHeaderEditor();
}
+/*!
+ Custom resize event handler
+*/
void QtxTable::resizeEvent( QResizeEvent* e )
{
QTable::resizeEvent( e );
updateHeaderEditor();
}
+/*!
+ Starts edition of header
+ \param o - header orientation
+ \param sec - column/row
+*/
bool QtxTable::beginHeaderEdit( Orientation o, const int section )
{
if ( !headerEditable( o ) || !header( o ) || !header( o )->isVisibleTo( this ) )
return true;
}
+/*!
+ Finishes edition of header
+ \param accept - whether new value must be accepted
+*/
void QtxTable::endHeaderEdit( const bool accept )
{
if ( !isHeaderEditing() )
}
}
+/*!
+ \return true if header is being edited
+*/
bool QtxTable::isHeaderEditing() const
{
return myHeaderEditor && myEditedHeader && myEditedSection != -1;
}
+/*!
+ Creates and \return header editor
+ \param hdr - header
+ \param sec - column/row
+ \param init - init editor with value
+*/
QWidget* QtxTable::createHeaderEditor( QHeader* hdr, const int sec, const bool init )
{
QLineEdit* ed = new QLineEdit( 0 );
return ed;
}
+/*!
+ Initialize editor with value
+ \param hdr - header
+ \param sec - column/row
+ \param editor - editor
+*/
void QtxTable::setHeaderContentFromEditor( QHeader* hdr, const int sec, QWidget* editor )
{
if ( !hdr || !editor )
hdr->setLabel( sec, ((QLineEdit*)editor)->text() );
}
+/*!
+ \return header
+ \param o - orientation
+*/
QHeader* QtxTable::header( Orientation o ) const
{
return o == Horizontal ? horizontalHeader() : verticalHeader();
}
+/*!
+ Starts edition of header
+ \param o - header orientation
+ \param p - point
+*/
void QtxTable::beginHeaderEdit( Orientation o, const QPoint& p )
{
QHeader* hdr = header( o );
beginHeaderEdit( o, sec );
}
+/*!
+ \return rectangle of header section
+ \param hdr - header
+ \param sec - column/row
+*/
QRect QtxTable::headerSectionRect( QHeader* hdr, const int sec ) const
{
QRect r( -1, -1, -1, -1 );
return r;
}
+/*!
+ Updates header editor
+*/
void QtxTable::updateHeaderEditor()
{
if ( !myHeaderEditor || !myEditedHeader || myEditedSection < 0 )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxTable.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxToolBar.cxx
// Author: Sergey TELKOV
bool myVisible;
};
+/*!
+ Constructor
+*/
QtxToolBar::Watcher::Watcher( QtxToolBar* cont )
: QObject( cont ),
myCont( cont ),
installFilters();
}
+/*!
+ Custom event filter
+*/
bool QtxToolBar::Watcher::eventFilter( QObject* o, QEvent* e )
{
if ( o == myCont && e->type() == QEvent::ChildInserted )
return false;
}
+/*!
+ Sets internal visibility state to true
+*/
void QtxToolBar::Watcher::shown( QtxToolBar* tb )
{
if ( tb != myCont )
myVisible = true;
}
+/*!
+ Sets internal visibility state to false
+*/
void QtxToolBar::Watcher::hided( QtxToolBar* tb )
{
if ( tb != myCont )
myVisible = false;
}
+/*!
+ Shows corresponding QtxToolBar
+*/
void QtxToolBar::Watcher::showContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Hides corresponding QtxToolBar
+*/
void QtxToolBar::Watcher::hideContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Event handler of custom events
+*/
void QtxToolBar::Watcher::customEvent( QCustomEvent* e )
{
switch ( e->type() )
}
}
+/*!
+ Installs event filters
+*/
void QtxToolBar::Watcher::installFilters()
{
if ( !myCont )
}
}
+/*!
+ Update visibility state
+*/
void QtxToolBar::Watcher::updateVisibility()
{
if ( !myCont )
vis ? showContainer() : hideContainer();
}
+/*!
+ Updates icon
+*/
void QtxToolBar::Watcher::updateIcon()
{
if ( !myCont || !myCont->widget() )
myCont->setIcon( ico ? *ico : QPixmap() );
}
+/*!
+ Updates caption
+*/
void QtxToolBar::Watcher::updateCaption()
{
if ( myCont && myCont->widget() && !myCont->widget()->caption().isNull() )
}
/*!
- Class: QtxToolBar [Public]
- Descr:
+ Constructor
*/
-
QtxToolBar::QtxToolBar( const bool watch, const QString& label, QMainWindow* main,
QWidget* parent, bool newLine, const char* name, WFlags f )
: QToolBar( label, main, parent, newLine, name, f ),
myWatcher = new Watcher( this );
}
+/*!
+ Constructor
+*/
QtxToolBar::QtxToolBar( const QString& label, QMainWindow* main,
QWidget* parent, bool newLine, const char* name, WFlags f )
: QToolBar( label, main, parent, newLine, name, f ),
{
}
+/*!
+ Constructor
+*/
QtxToolBar::QtxToolBar( const bool watch, QMainWindow* main, const char* name )
: QToolBar( main, name ),
myWatcher( 0 ),
myWatcher = new Watcher( this );
}
+/*!
+ Constructor
+*/
QtxToolBar::QtxToolBar( QMainWindow* main, const char* name )
: QToolBar( main, name ),
myWatcher( 0 ),
{
}
+/*!
+ Destructor
+*/
QtxToolBar::~QtxToolBar()
{
}
+/*!
+ Change the toolbar's main widget
+ \param wid - new main widget
+*/
void QtxToolBar::setWidget( QWidget* wid )
{
if ( wid )
}
}
+/*!
+ \return true if toolbar is stretchable
+*/
bool QtxToolBar::isStretchable() const
{
return myStretch;
}
+/*!
+ Sets stretchable state of toolbar
+ \param on - new state
+*/
void QtxToolBar::setStretchable( const bool on )
{
if ( myStretch == on )
}
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxToolBar::sizeHint() const
{
QSize sz = QToolBar::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxToolBar::minimumSizeHint() const
{
QSize sz = QToolBar::minimumSizeHint();
return sz;
}
+/*!
+ Shows toolbar
+*/
void QtxToolBar::show()
{
if ( myWatcher )
QToolBar::show();
}
+/*!
+ Hides toolbar
+*/
void QtxToolBar::hide()
{
if ( myWatcher )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxToolBar.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxToolTip.cxx
// Author: Sergey TELKOV
#define TOOLTIP_SHOW_DELAY 0500
#define TOOLTIP_HIDE_DELAY 7000
+/*!
+ Constructor
+*/
QtxToolTip::QtxToolTip( QWidget* parent )
: QLabel( parent, "", WStyle_Customize | WStyle_NoBorder | WX11BypassWM | WStyle_Tool | WStyle_StaysOnTop | WType_TopLevel )
{
myShowDelayTime = 5000;
}
+/*!
+ Destructor
+*/
QtxToolTip::~QtxToolTip()
{
}
+/*!
+ Custom event filter
+*/
bool QtxToolTip::eventFilter( QObject* o, QEvent* e )
{
if ( ( e->type() == QEvent::Destroy ) || ( e->type() == QEvent::Close ) || ( e->type() == QEvent::Hide ) )
return false;
}
+/*!
+ Shows tool tip
+ \param aPos - position
+ \param text - tooltip text
+ \param aWidgetRegion - rectangle
+*/
void QtxToolTip::showTip( const QPoint& aPos, const QString& text, const QRect& aWidgetRegion )
{
QFontMetrics theFM = fontMetrics();
showTip( QRect( QPoint( aPos.x(), aPos.y() + 10 ), QSize( theWidth, theHeight ) ), text, aWidgetRegion );
}
+/*!
+ Shows tool tip
+ \param aRegion - tooltip region
+ \param text - tooltip text
+ \param aWidgetRegion - widget rectangle
+*/
void QtxToolTip::showTip( const QRect& aRegion, const QString& text, const QRect& aWidgetRegion )
{
setText( text );
show();
}
+/*!
+ Hides tooltip
+*/
void QtxToolTip::hideTip()
{
hide();
mySleepTimer->stop();
}
+/*!
+ It is called when there is a possibility that a tool tip should be shown and
+ must decide whether there is a tool tip for the point p in the widget that this QToolTip object relates to
+ \param pos - position
+*/
void QtxToolTip::maybeTip( const QPoint& pos )
{
QString text;
}
}
+/*!
+ SLOT: called when sleep time is out
+*/
void QtxToolTip::onSleepTimeOut()
{
mySleepTimer->stop();
hideTip();
}
+/*!
+ SLOT: called when wake time is out
+*/
void QtxToolTip::onWakeUpTimeOut()
{
myWakeUpTimer->stop();
maybeTip( pos );
}
+/*!
+ Custom mouse press event handler
+*/
void QtxToolTip::mousePressEvent( QMouseEvent* e )
{
hideTip();
QApplication::sendEvent( reciever, me );
}
+/*!
+ Custom mouse double click event handler
+*/
void QtxToolTip::mouseDoubleClickEvent( QMouseEvent* e )
{
hideTip();
QApplication::sendEvent( reciever, me );
}
+/*!
+ Sets wake delay time
+ \param theTime
+*/
void QtxToolTip::setWakeUpDelayTime( int theTime )
{
if( !(theTime < 0) )
myWakeUpDelayTime = theTime;
}
+/*!
+ Sets show delay time
+ \param theTime
+*/
void QtxToolTip::setShowDelayTime( int theTime )
{
if( !(theTime < 0) )
myShowDelayTime = theTime;
}
+/*!
+ \return timer measuring time of sleeping
+*/
QTimer* QtxToolTip::sleepTimer() const
{
return mySleepTimer;
}
+/*!
+ \return timer measuring time of waking up
+*/
QTimer* QtxToolTip::wakeUpTimer() const
{
return myWakeUpTimer;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxToolTip.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxWorkspaceAction.cxx
// Author: Sergey TELKOV
#include <qworkspace.h>
#include <qwidgetlist.h>
+/*!
+ Constructor
+*/
QtxWorkspaceAction::QtxWorkspaceAction( QWorkspace* ws, QObject* parent, const char* name )
: QtxAction( tr( "Controls windows into workspace" ), tr( "Workspace management" ), 0, parent, name ),
myFlags( Standard ),
connect( myItem[VTile], SIGNAL( activated() ), this, SLOT( tileHorizontal() ) );
}
+/*!
+ Destructor
+*/
QtxWorkspaceAction::~QtxWorkspaceAction()
{
}
+/*!
+ \return corresponding workspace
+*/
QWorkspace* QtxWorkspaceAction::workspace() const
{
return myWorkspace;
}
+/*!
+ \return set of action flags
+*/
int QtxWorkspaceAction::items() const
{
return myFlags;
}
+/*!
+ Sets action flags
+ \param flags - new set of flags
+*/
void QtxWorkspaceAction::setItems( const int flags )
{
if ( !flags || flags == myFlags || !( flags & Operations ) )
myFlags = flags;
}
+/*!
+ \return true if action contains all flags
+ \param flags - new set of flags
+*/
bool QtxWorkspaceAction::hasItems( const int flags ) const
{
return ( myFlags & flags ) == flags;
}
+/*!
+ \return accelerator of item
+ \param id - item id
+*/
int QtxWorkspaceAction::accel( const int id ) const
{
int a = 0;
return a;
}
+/*!
+ \return icons of item
+ \param id - item id
+*/
QIconSet QtxWorkspaceAction::iconSet( const int id ) const
{
QIconSet ico;
return ico;
}
+/*!
+ \return menu text of item
+ \param id - item id
+*/
QString QtxWorkspaceAction::menuText( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ \return status tip of item
+ \param id - item id
+*/
QString QtxWorkspaceAction::statusTip( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ Changes accelerator of item
+ \param id - item id
+ \param a - new accelerator
+*/
void QtxWorkspaceAction::setAccel( const int id, const int a )
{
if ( myItem.contains( id ) )
myItem[id]->setAccel( a );
}
+/*!
+ Changes icons of item
+ \param id - item id
+ \param ico - new icons
+*/
void QtxWorkspaceAction::setIconSet( const int id, const QIconSet& ico )
{
if ( myItem.contains( id ) )
myItem[id]->setIconSet( ico );
}
+/*!
+ Changes menu text of item
+ \param id - item id
+ \param txt - new menu text
+*/
void QtxWorkspaceAction::setMenuText( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setMenuText( txt );
}
+/*!
+ Changes status tip of item
+ \param id - item id
+ \param txt - new status tip
+*/
void QtxWorkspaceAction::setStatusTip( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setStatusTip( txt );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+*/
bool QtxWorkspaceAction::addTo( QWidget* wid )
{
return addTo( wid, -1 );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+ \param idx - position
+*/
bool QtxWorkspaceAction::addTo( QWidget* wid, const int idx )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Removes action from widget
+ \param wid - widget
+*/
bool QtxWorkspaceAction::removeFrom( QWidget* wid )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Performs action
+ \param type - action type
+*/
void QtxWorkspaceAction::perform( const int type )
{
switch ( type )
}
}
+/*!
+ Performs tile action
+*/
void QtxWorkspaceAction::tile()
{
QWorkspace* ws = workspace();
ws->tile();
}
+/*!
+ Performs cascade action
+*/
void QtxWorkspaceAction::cascade()
{
QWorkspace* ws = workspace();
it.current()->resize( int( w * 0.8 ), int( h * 0.8 ) );
}
+/*!
+ Performs tile vertical action
+*/
void QtxWorkspaceAction::tileVertical()
{
QWorkspace* wrkSpace = workspace();
}
}
+/*!
+ Performs tile horizontal action
+*/
void QtxWorkspaceAction::tileHorizontal()
{
QWorkspace* wrkSpace = workspace();
}
}
+/*!
+ SLOT: called just before the popup menu is displayed, updates popup
+*/
void QtxWorkspaceAction::onAboutToShow()
{
const QObject* obj = sender();
updatePopup( (QPopupMenu*)obj );
}
+/*!
+ SLOT: called when popup menu is destroyed, removes it from menu
+*/
void QtxWorkspaceAction::onPopupDestroyed( QObject* obj )
{
myMenu.remove( (QPopupMenu*)obj );
}
+/*!
+ Updates popup
+ \param pm - popup menu
+*/
void QtxWorkspaceAction::checkPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
}
}
+/*!
+ Clears and refills popup and updates state of actions
+ \param pm - popup menu
+*/
void QtxWorkspaceAction::updatePopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
myItem[VTile]->setEnabled( count );
}
+/*!
+ Clears popup
+ \param pm - popup menu
+*/
int QtxWorkspaceAction::clearPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
return idx;
}
+/*!
+ Fills popup with items
+ \param pm - popup menu
+ \param idx - position
+*/
void QtxWorkspaceAction::fillPopup( QPopupMenu* pm, const int idx )
{
if ( !pm )
}
}
+/*!
+ SLOT: called when popup item corresponding to window is activated, activates window
+*/
void QtxWorkspaceAction::onItemActivated( int idx )
{
QWorkspace* ws = workspace();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxWorkspaceAction.h
// Author: Sergey TELKOV
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxWorkstack.cxx
// Author: Sergey TELKOV
#include <qapplication.h>
#include <qinputdialog.h>
#include <qevent.h>
+#include <qregexp.h>
#define DARK_COLOR_LIGHT 250
+
/*!
- Class: QtxWorkstack [Public]
- Descr:
+ Constructor
*/
-
QtxWorkstack::QtxWorkstack( QWidget* parent )
: QWidget( parent ),
myWin( 0 ),
base->addWidget( mySplit );
}
+/*!
+ Destructor
+*/
QtxWorkstack::~QtxWorkstack()
{
}
+/*!
+ \return list of all widgets in all areas
+*/
QWidgetList QtxWorkstack::windowList() const
{
QPtrList<QtxWorkstackArea> lst;
return widList;
}
+/*!
+ \return list of all widgets in active area
+*/
QWidgetList QtxWorkstack::splitWindowList() const
{
return myArea ? myArea->widgetList() : QWidgetList();
}
+/*!
+ \return active widget
+*/
QWidget* QtxWorkstack::activeWindow() const
{
return myWin;
}
+/*!
+ Splits widgets
+ \param o - orientation (Qt::Orientation)
+*/
void QtxWorkstack::split( const int o )
{
QtxWorkstackArea* area = myWorkArea;
}
/*!
-* \brief Split workarea of the given widget on two parts.
-* \param wid - widget, belonging to this workstack
-* \param o - orientation of splitting (Qt::Horizontal or Qt::Vertical)
-* \param type - type of splitting, see <VAR>SplitType</VAR> enumeration
+ \brief Split workarea of the given widget on two parts.
+ \param wid - widget, belonging to this workstack
+ \param o - orientation of splitting (Qt::Horizontal or Qt::Vertical)
+ \param type - type of splitting, see <VAR>SplitType</VAR> enumeration
*/
void QtxWorkstack::Split (QWidget* wid, const Qt::Orientation o, const SplitType type)
{
}
/*!
-* \brief Put given widget on top of its workarea
-* \param wid - widget, belonging to this workstack
+ \brief Put given widget on top of its workarea
+ \param wid - widget, belonging to this workstack
*/
/*
void QtxWorkstack::OnTop (QWidget* wid)
*/
/*!
-* \brief Move widget(s) from source workarea into target workarea
-* or just reorder widgets inside one workarea.
-* \param wid1 - widget from target workarea
-* \param wid2 - widget from source workarea
-* \param all - if this parameter is TRUE, all widgets from source workarea will
-* be moved into the target one, else only the \a wid2 will be moved
-*
-* Move \a wid2 in target workarea. Put it right after \a wid1.
-* If value of boolean argument is TRUE, all widgets from source workarea
-* will be moved together with \a wid2, source workarea will be deleted.
-* If \a wid1 and \a wid2 belongs to one workarea, simple reordering will take place.
+ \brief Move widget(s) from source workarea into target workarea
+ or just reorder widgets inside one workarea.
+ \param wid1 - widget from target workarea
+ \param wid2 - widget from source workarea
+ \param all - if this parameter is TRUE, all widgets from source workarea will
+ be moved into the target one, else only the \a wid2 will be moved
+
+ Move \a wid2 in target workarea. Put it right after \a wid1.
+ If value of boolean argument is TRUE, all widgets from source workarea
+ will be moved together with \a wid2, source workarea will be deleted.
+ If \a wid1 and \a wid2 belongs to one workarea, simple reordering will take place.
*/
void QtxWorkstack::Attract ( QWidget* wid1, QWidget* wid2, const bool all )
{
return 0;
}
+/*!
+ Redistributes space among widgets equally
+*/
void QtxWorkstack::distributeSpace( QSplitter* split ) const
{
if ( !split )
split->setSizes( szList );
}
+/*!
+ Splits widgets vertically
+*/
void QtxWorkstack::splitVertical()
{
split( Qt::Horizontal );
}
+/*!
+ Splits widgets horizontally
+*/
void QtxWorkstack::splitHorizontal()
{
split( Qt::Vertical );
}
+/*!
+ SLOT: called if action "Rename" is activated, changes caption of widget
+*/
void QtxWorkstack::onRename()
{
if ( !myWorkWin )
myWorkWin->setCaption( newName );
}
+/*!
+ Wraps area into new splitter
+ \return new splitter
+*/
QSplitter* QtxWorkstack::wrapSplitter( QtxWorkstackArea* area )
{
if ( !area )
return wrap;
}
+/*!
+ Reparenst and adds widget
+ \param wid - widget
+ \param pWid - parent widget
+ \param after - after widget
+*/
void QtxWorkstack::insertWidget( QWidget* wid, QWidget* pWid, QWidget* after )
{
if ( !wid || !pWid )
activeWindow()->close();
}
+/*!
+ SLOT: called on area is destroyed
+ Sets focus to neighbour area
+*/
void QtxWorkstack::onDestroyed( QObject* obj )
{
QtxWorkstackArea* area = (QtxWorkstackArea*)obj;
QApplication::postEvent( this, new QCustomEvent( QEvent::User ) );
}
+/*!
+ SLOT: called on window activating
+*/
void QtxWorkstack::onWindowActivated( QWidget* wid )
{
const QObject* obj = sender();
setActiveArea( (QtxWorkstackArea*)obj );
}
+/*!
+ SLOT: called on window deactivating
+*/
void QtxWorkstack::onDeactivated( QtxWorkstackArea* area )
{
if ( myArea != area )
QApplication::postEvent( this, new QCustomEvent( QEvent::User ) );
}
+/*!
+ Creates and shows popup menu for area
+ \param w - area
+ \param p - popup position
+*/
void QtxWorkstack::onContextMenuRequested( QWidget* w, QPoint p )
{
QtxWorkstackArea* anArea = dynamic_cast<QtxWorkstackArea*>( (QObject*)sender() );
myWorkArea = 0;
}
+/*!
+ Custom child event handler, inserts widget to active or current area
+*/
void QtxWorkstack::childEvent( QChildEvent* e )
{
if ( e->inserted() && e->child()->isWidgetType() )
QWidget::childEvent( e );
}
+/*!
+ Handler of custom events
+*/
void QtxWorkstack::customEvent( QCustomEvent* e )
{
updateState();
}
+/*!
+ \return splitter corresponding to area
+ \param area
+*/
QSplitter* QtxWorkstack::splitter( QtxWorkstackArea* area ) const
{
if ( !area )
return split;
}
+/*!
+ Fills list with children splitters
+ \param split - parent splitter
+ \param splitList - list to be filled with
+ \param rec - recursive search of children
+*/
void QtxWorkstack::splitters( QSplitter* split, QPtrList<QSplitter>& splitList, const bool rec ) const
{
if ( !split )
}
}
+/*!
+ Fills list with children areas
+ \param split - parent splitter
+ \param areaList - list to be filled with
+ \param rec - recursive search of children
+*/
void QtxWorkstack::areas( QSplitter* split, QPtrList<QtxWorkstackArea>& areaList, const bool rec ) const
{
if ( !split )
}
}
+/*!
+ \return active area
+*/
QtxWorkstackArea* QtxWorkstack::activeArea() const
{
return myArea;
}
+/*!
+ \return active area or current area or create new area of there is no one
+*/
QtxWorkstackArea* QtxWorkstack::targetArea()
{
QtxWorkstackArea* area = activeArea();
return area;
}
+/*!
+ \return current area (that has focus)
+*/
QtxWorkstackArea* QtxWorkstack::currentArea() const
{
QtxWorkstackArea* area = 0;
return area;
}
+/*!
+ Creates new area
+*/
QtxWorkstackArea* QtxWorkstack::createArea( QWidget* parent ) const
{
QtxWorkstackArea* area = new QtxWorkstackArea( parent );
return area;
}
+/*!
+ Sets area as active
+ \param area
+*/
void QtxWorkstack::setActiveArea( QtxWorkstackArea* area )
{
QWidget* oldCur = myWin;
emit windowActivated( myWin );
}
+/*!
+ \return neighbour area
+ \param area - area to search neighbour
+*/
QtxWorkstackArea* QtxWorkstack::neighbourArea( QtxWorkstackArea* area ) const
{
QPtrList<QtxWorkstackArea> lst;
return na;
}
+/*!
+ \return area covering point
+ \param p - point
+*/
QtxWorkstackArea* QtxWorkstack::areaAt( const QPoint& p ) const
{
QtxWorkstackArea* area = 0;
return area;
}
+/*!
+ Update
+*/
void QtxWorkstack::updateState()
{
updateState( mySplit );
}
+/*!
+ Update splitters
+*/
void QtxWorkstack::updateState( QSplitter* split )
{
QPtrList<QSplitter> recList;
}
/*!
- Class: QtxWorkstackArea [Internal]
- Descr:
+ Gets splitter info for debug
+ \param split - splitter
+ \param info - string to be filled with info
+*/
+void QtxWorkstack::splitterInfo( QSplitter* split, QString& info ) const
+{
+ if ( !split )
+ return;
+
+ const QObjectList* objs = split->children();
+ if ( objs )
+ {
+ // make up a sizes string: integer values are separated by ':' char
+ QValueList<int> sizes = split->sizes();
+ QString sizesStr;
+ for ( QValueList<int>::Iterator sIt = sizes.begin(); sIt != sizes.end(); ++sIt ) {
+ if ( *sIt > 1 ) // size 1 pixel usually means empty Workstack area, which will NOT be re-created,
+ sizesStr += QString( ":%1" ).arg( *sIt ); // so we don't need to store its size
+ }
+ if ( !sizesStr.isEmpty() ) // cut the first ':'
+ sizesStr = sizesStr.right( sizesStr.length()-1 );
+
+ // count all QSplitter-s and QtxWorkstackArea-s
+ // int nChilds( 0 );
+ // QObjectListIt it( *objs );
+ // for ( ; it.current(); ++it )
+ // {
+ // if ( it.current()->inherits( "QSplitter" ) ||
+ // it.current()->inherits( "QtxWorkstackArea" ) )
+ // nChilds++;
+ // }
+
+ info += QString( "(splitter orientation=%1 sizes=%3 " ).arg( split->orientation() ).arg( sizesStr );
+
+ for ( QObjectListIt it( *objs ); it.current(); ++it )
+ {
+ if ( it.current()->inherits( "QSplitter" ) )
+ splitterInfo( (QSplitter*)it.current(), info );
+ else if ( it.current()->inherits( "QtxWorkstackArea" ) ) {
+ QtxWorkstackArea* area = (QtxWorkstackArea*)it.current();
+ if ( area->isEmpty() )
+ continue;
+ info += QString( "(views active='%1'" ).arg( area->activeWidget()->name() );
+ QWidgetList views = area->widgetList();
+ for ( QWidgetListIt wIt( views ); wIt.current(); ++wIt )
+ info += QString( " '%1'" ).arg( wIt.current()->name() );
+ info += ')';
+ }
+ }
+ }
+ info += ')';
+}
+
+
+//Cuts starting '(' symbol and ending '(' symbol
+void cutBrackets( QString& parameters )
+{
+ QChar c1 = parameters[0];
+ QChar c2 = parameters.length()-1;
+ if ( !parameters.isEmpty() && c1 == '(' && c2 == ')' )
+ parameters = parameters.mid( 1, parameters.length()-2 );
+}
+
+/*
+ for strings like "(splitter orientation=0 children=2 sizes=332:478" returns values of
+ parameters. For example, getValue( example, "children" ) returns "2"
+ getValue( example, "sizes" ) returns "332:478"
+*/
+QString getValue( const QString& str, const QString& valName )
+{
+ int i = str.find( valName );
+ if ( i != -1 ) {
+ int equal_i = str.find( '=', i );
+ if ( equal_i != -1 ) {
+ int space_i = str.find( ' ', ++equal_i );
+ if ( space_i != -1 )
+ return str.mid( equal_i, space_i-equal_i );
+ }
+ }
+ return QString( "" );
+}
+
+/*
+ checks format of splitter parameters string
+*/
+bool checkFormat( const QString& parameters )
+{
+ QString params( parameters );
+ // 1. begins and ends with brackets
+ QChar c1 = params[0];
+ QChar c2 = params.length()-1;
+ bool ok = ( c1 == '(' && c2 == ')' );
+ if ( !ok ) return ok;
+ ::cutBrackets( params );
+ // 2. has splitter word
+ ok = ( params.left( 8 ) == "splitter" );
+ if ( !ok ) return ok;
+ // 3. has children? = '(' is found
+ int i = params.find( '(' );
+ ok = i != -1;
+ if ( !ok ) return ok;
+ params = params.left( i ); // cut all children, they will be checked later
+ // 4. has orientation word and correct value
+ ::getValue( params, "orientation" ).toInt( &ok );
+ if ( !ok ) return ok;
+ // 5. has sizes word and values
+ ok = ! ::getValue( params, "sizes" ).isEmpty();
+ if ( !ok ) return ok;
+ // 6. check children -> number of '(' == number of ')' in original string
+ ok = ( parameters.contains( '(' ) == parameters.contains( ')' ) );
+ return ok;
+}
+
+/*
+ Returns children of splitter in a list. Children are separated by '(' and ')' symbols
+*/
+QStringList getChildren( const QString& str )
+{
+ QStringList lst;
+ if ( !str.startsWith( "(" ) )
+ return lst;
+
+ int i = 1,
+ nOpen = 1, // count brackets: '(' increments nOpen, ')' decrements
+ start = 0;
+ while ( i < str.length() ) {
+ if ( str[i] == '(' ) {
+ nOpen++;
+ if ( nOpen == 1 )
+ start = i;
+ }
+ else if ( str[i] == ')' ) {
+ nOpen--;
+ if ( nOpen == 0 )
+ lst.append( str.mid( start, i-start+1 ) );
+ }
+ i++;
+ }
+
+ return lst;
+}
+
+// for a string like "views active='AnotherView' 'GLView' 'AnotherView'"
+// getViewName( example, 0 ) returns "GLView",
+// getViewName( example, 1 ) -> "AnotherView", etc.
+QString getViewName( const QString& str, int i )
+{
+ QRegExp exp( "\\s'\\w+'" );
+ int start = 0; // start index of view name in the string
+ int num = 0 ; // index of found match
+ while ( ( start = exp.search( str, start ) ) != -1 && num < i ) {
+ start += exp.matchedLength();
+ num ++;
+ }
+ if ( start != -1 ) // +2 and -3 avoid starting space and starting and ending ' symbols
+ return str.mid( start+2, exp.matchedLength()-3 );
+
+ return QString( "" );
+}
+
+// returns widget with given name
+QWidget* getView( const QWidget* parent, const QString& aName )
+{
+ QWidget* view = 0;
+ QObjectList *l = parent->topLevelWidget()->queryList( "QWidget", aName, false, true );
+ if ( !l->isEmpty() )
+ view = dynamic_cast<QWidget*>( l->first() );
+ delete l;
+ return view;
+}
+
+/*!
+ Installs a splitter described by given parameters string
+*/
+void QtxWorkstack::setSplitter( QSplitter* splitter, const QString& parameters, QMap< QSplitter*, QValueList<int> >& sMap )
+{
+ if ( !::checkFormat( parameters ) ) {
+ printf( "\nInvalid format of workstack parameters. Positions of viewers can not be restored.\n" );
+ return;
+ }
+
+ QString params( parameters );
+ ::cutBrackets( params );
+
+ // get splitter sizes and store it in the map for future setting
+ QValueList<int> sizes;
+ QStringList sizesLst = QStringList::split( ':', ::getValue( params, "sizes" ) );
+ for ( QStringList::Iterator it = sizesLst.begin(); it != sizesLst.end(); ++it )
+ sizes.append( (*it).toInt() );
+ sMap[ splitter ] = sizes;
+
+ // set orientation of splitter
+ int orient = ::getValue( params, "orientation" ).toInt();
+ splitter->setOrientation( (Qt::Orientation)orient );
+
+ // get children
+ QString options = params.left( params.find( '(' ) );
+ QString childrenStr = params.right( params.length()-options.length() );
+ QStringList children = ::getChildren( childrenStr );
+
+ // debug output..
+ // printf (" splitter orient=%d, sizes_count=%d, children=%d\n", orient, sizes.count(), children.count() );
+ // for ( QStringList::Iterator tit = children.begin(); tit != children.end(); ++tit )
+ // printf (" |-> child = [%s]\n", (*tit).latin1() );
+
+ for ( QStringList::Iterator it = children.begin(); it != children.end(); ++it ) {
+ if ( (*it).startsWith( "(splitter" ) ) {
+ QSplitter* newSplitter = new QSplitter( splitter );
+ setSplitter( newSplitter, *it, sMap );
+ }
+ else if ( (*it).startsWith( "(views" ) ) {
+ QtxWorkstackArea* newArea = createArea( splitter );
+ QString activeViewName = ::getValue( *it, "active" );
+ QWidget* activeView( 0 );
+ activeViewName = activeViewName.mid( 1, activeViewName.length()-2 ); // chop off ' symbols
+ int i = 0;
+ QString viewName = ::getViewName( *it, i );
+ while ( !viewName.isEmpty() ) {
+ if ( QWidget* view = ::getView( splitter, viewName ) ) {
+ newArea->insertWidget( view );
+ if ( activeViewName == view->name() )
+ activeView = view;
+ }
+ viewName = ::getViewName( *it, ++i );
+ }
+ if ( activeView )
+ newArea->setActiveWidget( activeView );
+ }
+ }
+}
+
+/*!
+ Restore workstack's configuration stored in 'parameters' string
+*/
+QtxWorkstack& QtxWorkstack::operator<<( const QString& parameters )
+{
+ // clear the main splitter - remove all child splitters and empty areas from it
+ QPtrList<QSplitter> splitList;
+ QPtrList<QtxWorkstackArea> areaList;
+ splitters( mySplit, splitList, false );
+ areas( mySplit, areaList, false );
+ for ( QPtrListIterator<QSplitter> iter( splitList ); iter.current(); ++iter )
+ delete iter.current();
+ for ( QPtrListIterator<QtxWorkstackArea> it( areaList ); it.current(); ++it )
+ if ( it.current()->isEmpty() )
+ delete it.current();
+
+ // restore splitter recursively
+ QMap< QSplitter*, QValueList<int> > sMap;
+ setSplitter( mySplit, parameters, sMap );
+
+ // now mySplit may contains empty area (where all views were located before restoring)
+ // in order setSize to work correctly we have to exclude this area
+ areaList.clear();
+ areas( mySplit, areaList, false );
+ for ( QPtrListIterator<QtxWorkstackArea> delIt( areaList ); delIt.current(); ++delIt )
+ if ( delIt.current()->isEmpty() )
+ delete delIt.current();
+
+ qApp->processEvents();
+
+ // restore splitters' sizes (map of sizes is filled in setSplitters)
+ for ( QMap< QSplitter*, QValueList<int> >::Iterator it = sMap.begin(); it != sMap.end(); ++it )
+ it.key()->setSizes( it.data() );
+
+ return (*this);
+}
+
+/*!
+ Example of string produced by operator>> :
+ "(splitter orientation=0 sizes=186:624 (views active='OCCViewer_0_0' 'OCCViewer_0_0')
+/ (views active='VTKViewer_0_0' 'VTKViewer_0_0'))"
*/
+QtxWorkstack& QtxWorkstack::operator>>( QString& outParameters )
+{
+ splitterInfo( mySplit, outParameters );
+ return (*this);
+}
+
+/*!
+ Constructor
+*/
QtxWorkstackArea::QtxWorkstackArea( QWidget* parent )
: QWidget( parent )
{
qApp->installEventFilter( this );
}
+/*!
+ Destructor
+*/
QtxWorkstackArea::~QtxWorkstackArea()
{
qApp->removeEventFilter( this );
}
+/*!
+ \return true if area is empty
+*/
bool QtxWorkstackArea::isEmpty() const
{
bool res = false;
return !res;
}
+/*!
+ Adds widget to area
+ \param wid - widget
+ \param idx - index
+*/
void QtxWorkstackArea::insertWidget( QWidget* wid, const int idx )
{
if ( !wid )
wid->setFocus();
}
+/*!
+ Creates and shows popup menu for area
+ \param p - popup position
+*/
void QtxWorkstackArea::onContextMenuRequested( QPoint p )
{
const QtxWorkstackTabBar* bar = ::qt_cast<const QtxWorkstackTabBar*>( sender() );
emit contextMenuRequested( wid, p );
}
+/*!
+ SLOT: called when widget added to area is destroyed, removes widget from area
+*/
void QtxWorkstackArea::onWidgetDestroyed()
{
if ( sender() )
removeWidget( (QWidget*)sender(), false );
}
+/*!
+ Removes widget from area
+ \param wid - widget
+ \param del - auto deleting
+*/
void QtxWorkstackArea::removeWidget( QWidget* wid, const bool del )
{
if ( !myList.contains( wid ) )
updateState();
}
+/*!
+ \return list of visible widgets
+*/
QWidgetList QtxWorkstackArea::widgetList() const
{
QWidgetList lst;
return lst;
}
+/*!
+ \return active widget
+*/
QWidget* QtxWorkstackArea::activeWidget() const
{
return widget( myBar->currentTab() );
}
+/*!
+ Sets widget as active
+ \param wid - widget
+*/
void QtxWorkstackArea::setActiveWidget( QWidget* wid )
{
myBar->setCurrentTab( widgetId( wid ) );
}
+/*!
+ \return true if area contains widget
+ \param wid - widget
+*/
bool QtxWorkstackArea::contains( QWidget* wid ) const
{
return myList.contains( wid );
}
+/*!
+ Shows area
+*/
void QtxWorkstackArea::show()
{
QMap<QWidget*, bool> map;
setBlocked( itr.current(), map.contains( itr.current() ) ? map[itr.current()] : false );
}
+/*!
+ Hides area
+*/
void QtxWorkstackArea::hide()
{
QMap<QWidget*, bool> map;
setBlocked( itr.current(), map.contains( itr.current() ) ? map[itr.current()] : false );
}
+/*!
+ \return true if area is active
+*/
bool QtxWorkstackArea::isActive() const
{
QtxWorkstack* ws = workstack();
return ws->activeArea() == this;
}
+/*!
+ Update active state of tab bar
+*/
void QtxWorkstackArea::updateActiveState()
{
myBar->setActive( isActive() );
}
+/*!
+ \return corresponding workstack
+*/
QtxWorkstack* QtxWorkstackArea::workstack() const
{
QtxWorkstack* ws = 0;
return ws;
}
+/*!
+ Custom event filter
+*/
bool QtxWorkstackArea::eventFilter( QObject* o, QEvent* e )
{
if ( o->isWidgetType() )
return false;
}
+/*!
+ \return rectangle of area in order to draw drop rectangle on area
+*/
QRect QtxWorkstackArea::floatRect() const
{
QRect r = myStack->geometry();
return QRect( mapToGlobal( r.topLeft() ), mapToGlobal( r.bottomRight() ) );
}
+/*!
+ \return rectangle of tab in order to draw drop rectangle on tab
+ \param idx - tab index
+*/
QRect QtxWorkstackArea::floatTab( const int idx ) const
{
return myBar->tabRect( idx );
}
+/*!
+ \return tab covering point
+ \param p - point
+*/
int QtxWorkstackArea::tabAt( const QPoint& p ) const
{
int idx = -1;
return idx;
}
+/*!
+ Event handler for custom events
+*/
void QtxWorkstackArea::customEvent( QCustomEvent* e )
{
switch ( e->type() )
}
}
+/*!
+ Custom focus in event handler
+*/
void QtxWorkstackArea::focusInEvent( QFocusEvent* e )
{
QWidget::focusInEvent( e );
emit activated( activeWidget() );
}
+/*!
+ Custom mouse press event handler
+*/
void QtxWorkstackArea::mousePressEvent( QMouseEvent* e )
{
QWidget::mousePressEvent( e );
emit activated( activeWidget() );
}
+/*!
+ SLOT: called if button close is pressed
+*/
void QtxWorkstackArea::onClose()
{
QWidget* wid = activeWidget();
wid->close();
}
+/*!
+ SLOT: called if tab page is selected
+*/
void QtxWorkstackArea::onSelected( int id )
{
updateCurrent();
emit activated( activeWidget() );
}
+/*!
+ SLOT: called if active tab page is dragged
+*/
void QtxWorkstackArea::onDragActiveTab()
{
QtxWorkstackChild* c = child( activeWidget() );
new QtxWorkstackDrag( workstack(), c );
}
+/*!
+ SLOT: called on child is destroyed, removes from area
+*/
void QtxWorkstackArea::onChildDestroyed( QObject* obj )
{
QtxWorkstackChild* child = (QtxWorkstackChild*)obj;
QApplication::postEvent( this, new QCustomEvent( (QEvent::Type)RemoveWidget, wid ) );
}
+/*!
+ SLOT: called on child is shown
+*/
void QtxWorkstackArea::onChildShown( QtxWorkstackChild* c )
{
setWidgetShown( c->widget(), true );
}
+/*!
+ SLOT: called on child is hidden
+*/
void QtxWorkstackArea::onChildHided( QtxWorkstackChild* c )
{
setWidgetShown( c->widget(), false );
}
+/*!
+ SLOT: called on child is activated
+*/
void QtxWorkstackArea::onChildActivated( QtxWorkstackChild* c )
{
setWidgetActive( c->widget() );
}
+/*!
+ SLOT: called on child caption is changed
+*/
void QtxWorkstackArea::onChildCaptionChanged( QtxWorkstackChild* c )
{
updateTab( c->widget() );
}
+/*!
+ Raises widget when active tab is changed
+*/
void QtxWorkstackArea::updateCurrent()
{
QMap<QWidget*, bool> map;
setBlocked( itr.current(), map.contains( itr.current() ) ? map[itr.current()] : false );
}
+/*!
+ Updates tab
+ \param wid - tab widget
+*/
void QtxWorkstackArea::updateTab( QWidget* wid )
{
QTab* tab = myBar->tab( widgetId( wid ) );
tab->setText( wid->caption() );
}
+/*!
+ \return widget
+ \param id - widget id
+*/
QWidget* QtxWorkstackArea::widget( const int id ) const
{
QWidget* wid = 0;
return wid;
}
+/*!
+ \return widget id
+ \param wid - widget
+*/
int QtxWorkstackArea::widgetId( QWidget* wid ) const
{
int id = -1;
return id;
}
+/*!
+ \return true if widget is visible
+ \param wid - widget
+*/
bool QtxWorkstackArea::widgetVisibility( QWidget* wid ) const
{
bool res = false;
return res;
}
+/*!
+ Sets widget as active
+ \param wid - widget
+*/
void QtxWorkstackArea::setWidgetActive( QWidget* wid )
{
int id = widgetId( wid );
myBar->setCurrentTab( id );
}
+/*!
+ Shows/hides widget
+ \param wid - widget
+ \param on - new shown state
+*/
void QtxWorkstackArea::setWidgetShown( QWidget* wid, const bool on )
{
if ( isBlocked( wid ) || !myInfo.contains( wid ) || myInfo[wid].vis == on )
updateState();
}
+/*!
+ Update
+*/
void QtxWorkstackArea::updateState()
{
bool updBar = myBar->isUpdatesEnabled();
}
}
+/*!
+ \return first unshared widget id
+*/
int QtxWorkstackArea::generateId() const
{
QMap<int, int> map;
return id;
}
+/*!
+ \return true if widget is blocked
+ \param wid - widget
+*/
bool QtxWorkstackArea::isBlocked( QWidget* wid ) const
{
return myBlock.contains( wid );
}
+/*!
+ Blocks widget
+ \param wid - widget
+ \param on - new blocked state
+*/
void QtxWorkstackArea::setBlocked( QWidget* wid, const bool on )
{
if ( on )
myBlock.remove( wid );
}
+/*!
+ \return child corresponding to widget
+ \param wid - widget
+*/
QtxWorkstackChild* QtxWorkstackArea::child( QWidget* wid ) const
{
QtxWorkstackChild* res = 0;
}
/*!
- Class: QtxWorkstackChild [Internal]
- Descr:
+ Constructor
*/
-
QtxWorkstackChild::QtxWorkstackChild( QWidget* wid, QWidget* parent )
: QHBox( parent ),
myWidget( wid )
connect( myWidget, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
+/*!
+ Destructor
+*/
QtxWorkstackChild::~QtxWorkstackChild()
{
qApp->removeEventFilter( this );
disconnect( widget(), SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
+/*!
+ \return corresponding widget
+*/
QWidget* QtxWorkstackChild::widget() const
{
return myWidget;
}
+/*!
+ Custom event filter
+*/
bool QtxWorkstackChild::eventFilter( QObject* o, QEvent* e )
{
if ( o->isWidgetType() )
return QHBox::eventFilter( o, e );
}
+/*!
+ SLOT: called on object is destroyed
+*/
void QtxWorkstackChild::onDestroyed( QObject* obj )
{
if ( obj != widget() )
deleteLater();
}
+/*!
+ Custom child event handler
+*/
void QtxWorkstackChild::childEvent( QChildEvent* e )
{
if ( e->type() == QEvent::ChildRemoved && e->child() == widget() )
}
/*!
- Class: QtxWorkstackTabBar [Internal]
- Descr:
+ Constructor
*/
-
QtxWorkstackTabBar::QtxWorkstackTabBar( QWidget* parent )
: QTabBar( parent ),
myId( -1 )
{
}
+/*!
+ Destructor
+*/
QtxWorkstackTabBar::~QtxWorkstackTabBar()
{
}
+/*!
+ Sets tab bar as active or inactive
+ \param on - new active state
+*/
void QtxWorkstackTabBar::setActive( const bool on )
{
QFont aFont = font();
update();
}
+/*!
+ \return tab rectangle
+ \param idx - tab index
+*/
QRect QtxWorkstackTabBar::tabRect( const int idx ) const
{
QRect r;
return r;
}
+/*!
+ Custom mouse move event handler
+*/
void QtxWorkstackTabBar::mouseMoveEvent( QMouseEvent* e )
{
if ( myId != -1 && !tab( myId )->rect().contains( e->pos() ) )
QTabBar::mouseMoveEvent( e );
}
+/*!
+ Custom mouse press event handler
+*/
void QtxWorkstackTabBar::mousePressEvent( QMouseEvent* e )
{
QTabBar::mousePressEvent( e );
myId = currentTab();
}
+/*!
+ Custom mouse release event handler
+*/
void QtxWorkstackTabBar::mouseReleaseEvent( QMouseEvent* e )
{
QTabBar::mouseReleaseEvent( e );
emit contextMenuRequested( e->globalPos() );
}
+/*!
+ Custom context menu event handler
+*/
void QtxWorkstackTabBar::contextMenuEvent( QContextMenuEvent* e )
{
if ( e->reason() != QContextMenuEvent::Mouse )
emit contextMenuRequested( e->globalPos() );
}
+/*!
+ Draws label of tab bar
+*/
void QtxWorkstackTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
{
if ( currentTab() != t->identifier() )
}
/*!
- Class: QtxWorkstackDrag [Internal]
- Descr:
+ Constructor
*/
-
QtxWorkstackDrag::QtxWorkstackDrag( QtxWorkstack* ws, QtxWorkstackChild* child )
: QObject( 0 ),
myWS( ws ),
qApp->installEventFilter( this );
}
+/*!
+ Destructor
+*/
QtxWorkstackDrag::~QtxWorkstackDrag()
{
qApp->removeEventFilter( this );
endDrawRect();
}
+/*!
+ Custom event filter
+*/
bool QtxWorkstackDrag::eventFilter( QObject*, QEvent* e )
{
switch ( e->type() )
return true;
}
+/*!
+ Updates internal field with widget-target for dropping
+ \param p - current point of dragging
+*/
void QtxWorkstackDrag::updateTarget( const QPoint& p )
{
int tab = -1;
setTarget( area, tab );
}
+/*!
+ \return target area for dropping by point
+ \param p - current point of dragging
+ \param tab - index of tab to dropping
+*/
QtxWorkstackArea* QtxWorkstackDrag::detectTarget( const QPoint& p, int& tab ) const
{
if ( p.isNull() )
return area;
}
+/*!
+ Changes target area for dropping
+ \param area - new target area
+ \param tab - tab index
+*/
void QtxWorkstackDrag::setTarget( QtxWorkstackArea* area, const int tab )
{
if ( !area || ( myArea == area && tab == myTab ) )
drawRect();
}
+/*!
+ Called on widget drop, inserts dropped widget to area
+*/
void QtxWorkstackDrag::dropWidget()
{
if ( myArea )
myArea->insertWidget( myChild->widget(), myTab );
}
+/*!
+ Draws float rect
+*/
void QtxWorkstackDrag::drawRect()
{
if ( !myPainter || !myArea )
myPainter->drawRect( tr );
}
+/*!
+ Deletes internal painter
+*/
void QtxWorkstackDrag::endDrawRect()
{
delete myPainter;
myPainter = 0;
}
+/*!
+ Initialize internal painter
+*/
void QtxWorkstackDrag::startDrawRect()
{
if ( myPainter )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxWorkstack.h
// Author: Sergey TELKOV
void SetRelativePosition( QWidget* wid, const Qt::Orientation o, const double pos );
void SetRelativePositionInSplitter( QWidget* wid, const double pos );
+ // asv: Store/Restore visual parameters - geometry of inner windows
+ QtxWorkstack& operator<<( const QString& );
+ QtxWorkstack& operator>>( QString& );
+
signals:
void windowActivated( QWidget* );
void distributeSpace( QSplitter* ) const;
int setPosition( QWidget* wid, QSplitter* split, const Qt::Orientation o,
const int need_pos, const int splitter_pos );
-
+
+ void splitterInfo( QSplitter*, QString& ) const;
+ void setSplitter( QSplitter*, const QString&, QMap< QSplitter*,QValueList<int> >& );
+
private:
QWidget* myWin;
QtxWorkstackArea* myArea;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxWorkstackAction.cxx
// Author: Sergey TELKOV
#include <qpopupmenu.h>
#include <qwidgetlist.h>
+/*!
+ Constructor
+*/
QtxWorkstackAction::QtxWorkstackAction( QtxWorkstack* ws, QObject* parent, const char* name )
: QtxAction( tr( "Controls windows into workstack" ), tr( "Workstack management" ), 0, parent, name ),
myFlags( Standard ),
connect( myItem[HSplit], SIGNAL( activated() ), ws, SLOT( splitHorizontal() ) );
}
+/*!
+ Destructor
+*/
QtxWorkstackAction::~QtxWorkstackAction()
{
}
+/*!
+ \return corresponding workstack
+*/
QtxWorkstack* QtxWorkstackAction::workstack() const
{
return myWorkstack;
}
+/*!
+ \return set of action flags
+*/
int QtxWorkstackAction::items() const
{
return myFlags;
}
+/*!
+ Sets action flags
+ \param flags - new set of flags
+*/
void QtxWorkstackAction::setItems( const int flags )
{
if ( !flags || flags == myFlags || !( flags & Split ) )
myFlags = flags;
}
+/*!
+ \return true if action contains all flags
+ \param flags - new set of flags
+*/
bool QtxWorkstackAction::hasItems( const int flags ) const
{
return ( myFlags & flags ) == flags;
}
+/*!
+ \return accelerator of item
+ \param id - item id
+*/
int QtxWorkstackAction::accel( const int id ) const
{
int a = 0;
return a;
}
+/*!
+ \return icons of item
+ \param id - item id
+*/
QIconSet QtxWorkstackAction::iconSet( const int id ) const
{
QIconSet ico;
return ico;
}
+/*!
+ \return menu text of item
+ \param id - item id
+*/
QString QtxWorkstackAction::menuText( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ \return status tip of item
+ \param id - item id
+*/
QString QtxWorkstackAction::statusTip( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ Changes accelerator of item
+ \param id - item id
+ \param a - new accelerator
+*/
void QtxWorkstackAction::setAccel( const int id, const int a )
{
if ( myItem.contains( id ) )
myItem[id]->setAccel( a );
}
+/*!
+ Changes icons of item
+ \param id - item id
+ \param ico - new icons
+*/
void QtxWorkstackAction::setIconSet( const int id, const QIconSet& ico )
{
if ( myItem.contains( id ) )
myItem[id]->setIconSet( ico );
}
+/*!
+ Changes menu text of item
+ \param id - item id
+ \param txt - new menu text
+*/
void QtxWorkstackAction::setMenuText( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setMenuText( txt );
}
+/*!
+ Changes status tip of item
+ \param id - item id
+ \param txt - new status tip
+*/
void QtxWorkstackAction::setStatusTip( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setStatusTip( txt );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+*/
bool QtxWorkstackAction::addTo( QWidget* wid )
{
return addTo( wid, -1 );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+ \param idx - position
+*/
bool QtxWorkstackAction::addTo( QWidget* wid, const int idx )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Removes action from widget
+ \param wid - widget
+*/
bool QtxWorkstackAction::removeFrom( QWidget* wid )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Performs action
+ \param type - action type
+*/
void QtxWorkstackAction::perform( const int type )
{
switch ( type )
}
}
+/*!
+ SLOT: called just before the popup menu is displayed, updates popup
+*/
void QtxWorkstackAction::onAboutToShow()
{
const QObject* obj = sender();
updatePopup( (QPopupMenu*)obj );
}
+/*!
+ SLOT: called when popup menu is destroyed, removes it from menu
+*/
void QtxWorkstackAction::onPopupDestroyed( QObject* obj )
{
myMenu.remove( (QPopupMenu*)obj );
}
+/*!
+ Updates popup
+ \param pm - popup menu
+*/
void QtxWorkstackAction::checkPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
}
}
+/*!
+ Clears and refills popup and updates state of actions
+ \param pm - popup menu
+*/
void QtxWorkstackAction::updatePopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
myItem[HSplit]->setEnabled( count > 1 );
}
+/*!
+ Clears popup
+ \param pm - popup menu
+*/
int QtxWorkstackAction::clearPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
return idx;
}
+/*!
+ Fills popup with items
+ \param pm - popup menu
+ \param idx - position
+*/
void QtxWorkstackAction::fillPopup( QPopupMenu* pm, const int idx )
{
if ( !pm )
}
}
+/*!
+ SLOT: called when popup item corresponding to window is activated, activates window
+*/
void QtxWorkstackAction::onItemActivated( int idx )
{
QtxWorkstack* ws = workstack();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: QtxWorkstackAction.h
// Author: Sergey TELKOV
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
+/*!
+ Constructor
+*/
HelpWindow::HelpWindow(QWidget* parent, const char* name )
: QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
{
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
-// SALOME RegistryDisplay : GUI for Registry server implementation
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME RegistryDisplay : GUI for Registry server implementation
//
// File : IntervalWindow.cxx
// Author : Oksana TCHEBANOVA
#define SPACING_SIZE 6
#define MIN_SPIN_WIDTH 100
+/*!
+ Constructor
+*/
IntervalWindow::IntervalWindow ( QWidget* parent )
: QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{
END_OF("IntervalWindow constructor")
}
+
+/*!
+ Destructor
+*/
IntervalWindow::~IntervalWindow() {}
-/*
+
+/*!
Sets start interval size
*/
void IntervalWindow::setValue(const int size)
mySpinBox->setValue(size);
}
-/*
+/*!
Gets interval size
*/
int IntervalWindow::getValue()
return mySpinBox->value();
}
-/*
+/*!
gets a pointer to myButtonOk
*/
QPushButton* IntervalWindow::Ok()
return myButtonOk;
}
-/*
+/*!
gets a pointer to myButtonCancel
*/
QPushButton* IntervalWindow::Cancel()
-// SALOME RegistryDisplay : GUI for Registry server implementation
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME RegistryDisplay : GUI for Registry server implementation
//
// File : IntervalWindow.hxx
// Author : Oksana TCHEBANOVA
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
LIB_CLIENT_IDL = SALOME_Registry.idl SALOME_Exception.idl
-CPPFLAGS+=$(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+=$(QT_MT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeNS -lOpUtil
+CPPFLAGS+=$(QT_INCLUDES) $(KERNEL_CXXFLAGS)
+LDFLAGS+=$(QT_MT_LIBS) $(KERNEL_LDFLAGS) -lSalomeNS -lOpUtil
@CONCLUDE@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
a.append( QString( " )<br> " ) + tr( "in directory" ) + QString( " " ));
a.append( BOLD( c_info.cdir ) );
+ time_t aTime;
a.append( QString( "<br>" ) + tr( "begins" ) + QString( " " ) );
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+ aTime = time_t(c_info.tc_start);
+ char * t1 = (char * )duplicate(ctime(&aTime));
t1 [strlen(t1) -1 ] = ' ';
a.append( BOLD( t1 ) );
delete [] t1;
if (c_info.tc_hello != 0 )
{
- char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
+ aTime = time_t(c_info.tc_hello);
+ char * t2 = (char * )duplicate(ctime(&aTime));
t2 [strlen(t2) -1 ] = ' ';
a.append( tr( "last signal" ) + QString(" : ") );
a.append( BOLD( t2 ) );
}
if ((c_info.tc_end - c_info.difftime) != 0)
{
- char * t3 = (char * )duplicate(ctime(&c_info.tc_end));
+ aTime = time_t(c_info.tc_end);
+ char * t3 = (char * )duplicate(ctime(&aTime));
t3 [strlen(t3) -1 ] = ' ';
a.append( tr( "ends" ) + QString( " " ) );
a.append( BOLD( t3 ) );
_history->clear();
try
{
+ time_t aTime;
_serverhistory = _VarComponents->history();
for (CORBA::ULong i=0; i<_serverhistory->length(); i++)
{
ASSERT( c_info.name!=NULL);
QString a;
a.setNum(int(c_info.pid));
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+ aTime = time_t(c_info.tc_start);
+ char * t1 = (char * )duplicate(ctime(&aTime));
t1 [strlen(t1) -1 ] = ' ';
- char * t2 = (char * )duplicate(ctime(&c_info.tc_end));
+ aTime = time_t(c_info.tc_end);
+ char * t2 = (char * )duplicate(ctime(&aTime));
t2 [strlen(t2) -1 ] = ' ';
QListViewItem * item = new QListViewItem(_history, QString(c_info.name),\
a, QString(c_info.pwname), QString(c_info.machine), \
_clients->clear();
try
{
+ time_t aTime;
_serverclients = _VarComponents->getall();
for (CORBA::ULong i=0; i<_serverclients->length(); i++)
{
ASSERT( c_info.name!=NULL);
QString a;
a.setNum(int(c_info.pid));
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+ aTime = time_t(c_info.tc_start);
+ char * t1 = (char * )duplicate(ctime(&aTime));
t1 [strlen(t1) -1 ] = ' ';
- char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
+ aTime = time_t(c_info.tc_hello);
+ char * t2 = (char * )duplicate(ctime(&aTime));
t2 [strlen(t2) -1 ] = ' ';
QListViewItem * item = new QListViewItem(_clients, QString(c_info.name),\
a, QString(c_info.pwname), QString(c_info.machine), \
END_OF("slotSelectRefresh");
}
+/*!
+ SLOT: called when button OK is clicked in interval window
+*/
void RegWidget::slotIntervalOk()
{
BEGIN_OF("slotIntervalOk");
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vadim SANDLER (OCN)
# Module : SalomeApp
-//======================================================================================================
-// File: ResourceExporter.cxx
-// Created: 27/06/05
-// Author: Vadim SANDLER
-// Copyright (C) CEA 2005
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
//
-// This tool provides command-line interface allowing to modify user preferences.
-// The tool can be used by the compilation procedures in order to set default preferences for the module.
+// 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.
//
-// Usage:
-// ResourceExporter <parameters-list>
-// Parameters have the following format:
-// '<section>:<name>=<new_value>' - to set <new_value> for the user
-// preference <name> from the <section> section;
-// '<section>:<name>+=<value>[|<separator>]' - the <value> is appended to the current value
-// of the preference <name> from the <section> section;
-// separator is used to concatenate old and new values,
-// by default comma (',') symbol is used
-// '-<section>:<name>' - to remove user preference <name> from the <section>
-// section. Note that only use preference file is
-// influenced, you may need to use '<section>:<name>=""'
-// option
-// The number of parameters is limeted only by maximum possible length of the command line.
-//======================================================================================================
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*!
+ File: ResourceExporter.cxx
+ Created: 27/06/05
+ Author: Vadim SANDLER
+ Copyright (C) CEA 2005
+
+ This tool provides command-line interface allowing to modify user preferences.
+ The tool can be used by the compilation procedures in order to set default preferences for the module.
+
+ Usage:
+ ResourceExporter <parameters-list>
+ Parameters have the following format:
+ '<section>:<name>=<new_value>' - to set <new_value> for the user
+ preference <name> from the <section> section;
+ '<section>:<name>+=<value>[|<separator>]' - the <value> is appended to the current value
+ of the preference <name> from the <section> section;
+ separator is used to concatenate old and new values,
+ by default comma (',') symbol is used
+ '-<section>:<name>' - to remove user preference <name> from the <section>
+ section. Note that only use preference file is
+ influenced, you may need to use '<section>:<name>=""'
+ option
+ The number of parameters is limeted only by maximum possible length of the command line.
+*/
#include "SUIT_ResourceMgr.h"
#include <qfile.h>
#include <qapplication.h>
#include <iostream>
-//============================================================
-// salomeVersion(): get the SALOME version number
-//============================================================
+/*!
+ \return the SALOME version number
+*/
static QString salomeVersion()
{
QString path( ::getenv( "GUI_ROOT_DIR" ) );
return ver;
}
-//============================================================
-// help(): print the help information
-//============================================================
+/*!
+ print the help information
+*/
static void help()
{
std::cout << "" << std::endl;
std::cout << "" << std::endl;
}
-//============================================================
-// main(): application main() function
-//============================================================
+/*!
+ application main() function
+*/
int main( int argc, char** argv )
{
QApplication app( argc, argv );
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
SALOME_Exception.idl \
SALOME_GenericObj.idl
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -DHAVE_CONFIG_H
+CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS) $(KERNEL_CXXFLAGS) -DHAVE_CONFIG_H
LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeApp -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython
# -lVTKViewer
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
-//////////////////////////////////////////////////////////////////////////////
-// VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
-// All methods are implemented using Event mechanism:
-// - getRenderer()
-// - getRenderWindow()
-// - getRenderWindowInteractor()
-// These methods open new VTK viewer if there is no one opened.
-// In case of error methods return None object in Python.
-//////////////////////////////////////////////////////////////////////////////
+/*!
+ VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
+ All methods are implemented using Event mechanism:
+ - getRenderer()
+ - getRenderWindow()
+ - getRenderWindowInteractor()
+ These methods open new VTK viewer if there is no one opened.
+ In case of error methods return None object in Python.
+*/
static PyObject* GetPyClass(const char* theClassName){
static PyObject *aVTKModule = NULL;
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
-# Copyright (C) 2003 CEA/DEN, EDF R&D
+# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.in
# Author : Nicolas REJNERI
# Module : SALOME
-# $Header$
top_srcdir=@top_srcdir@
top_builddir=../../..
SALOME_ContainerManager.idl \
SALOME_Component.idl
-CPPFLAGS += $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H -I${KERNEL_ROOT_DIR}/include/salome -D__CALL_OLD_METHODS__
+CPPFLAGS += $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H $(KERNEL_CXXFLAGS) -D__CALL_OLD_METHODS__
LIBS += $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS)
LDFLAGS += -lPyInterp -lSalomeApp
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#if !defined ( SALOME_PYQT_GUI_H )
#define SALOME_PYQT_GUI_H
// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
+//
// 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
+// 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
+//
+// 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
+// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//=============================================================================
-// File : SALOME_PYQT_Module.cxx
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#include "PyInterp_Dispatcher.h"
#include "SALOME_PYQT_Module.h"
#include "SalomeApp_Study.h"
#include "QtxWorkstack.h"
+#include "QtxActionMenuMgr.h"
+#include "QtxActionToolMgr.h"
#include <SALOME_LifeCycleCORBA.hxx>
#include <Container_init_python.hxx>
#include <qfile.h>
#include <qdom.h>
#include <qworkspace.h>
+#include <qmenubar.h>
#include <qpopupmenu.h>
#ifndef WIN32
using namespace std;
-///////////////////////////////////////////////////////////////////////////////
-// Default name of the module, replaced at the moment of module creation
-#define __DEFAULT_NAME__ "SALOME_PYQT_Module"
+/*!
+ \var __DEFAULT_NAME__ - Default name of the module, replaced at the moment of module creation
+*/
+const char* __DEFAULT_NAME__ = "SALOME_PYQT_Module";
-///////////////////////////////////////////////////////////////////////////////
-// If __CALL_OLD_METHODS__ macro is not defined the invoking of obsolete Python
+/*!
+ \var __DEFAULT_GROUP__ - Default menu group number
+*/
+const int __DEFAULT_GROUP__ = 40;
+
+// If __CALL_OLD_METHODS__ macro is not defined the invoking of obsolete Python
// module's methods like setSetting(), definePopup(), etc. is blocked.
// This macro is defined by default (in Makefile)
#ifdef __CALL_OLD_METHODS__
const bool IsCallOldMethods = true;
-#else
+#else
const bool IsCallOldMethods = false;
#endif
-///////////////////////////////////////////////////////////////////////////////
// NB: Python requests.
// General rule for Python requests created by SALOME_PYQT_Module:
// all requests should be executed SYNCHRONOUSLY within the main GUI thread.
// However, it is obligatory that ANY Python call is wrapped with a request object,
// so that ALL Python API calls are serialized with PyInterp_Dispatcher.
-///////////////////////////////////////////////////////////////////////////////
-//=============================================================================
-// The class for parsing of the XML resource files.
-// Used for backward compatibility with existing Python modules.
-//=============================================================================
+/*!
+ \class SALOME_PYQT_XmlHandler
+ The class for parsing of the XML resource files.
+ Used for backward compatibility with existing Python modules.
+*/
class SALOME_PYQT_XmlHandler
{
public:
SALOME_PYQT_XmlHandler( SALOME_PYQT_Module* module, const QString& fileName );
void createActions();
- void createPopup ( QPopupMenu* menu,
- const QString& context,
- const QString& parent,
+ void clearActions();
+ void createPopup ( QPopupMenu* menu,
+ const QString& context,
+ const QString& parent,
const QString& object );
protected:
- void createToolBar ( QDomNode& parentNode );
- void createMenu ( QDomNode& parentNode,
- const int parentMenuId = -1 );
+ void createToolBar ( QDomNode& parentNode );
+ void createMenu ( QDomNode& parentNode,
+ const int parentMenuId = -1,
+ QPopupMenu* parentPopup = 0 );
- void insertPopupItems( QDomNode& parentNode,
+ void insertPopupItems( QDomNode& parentNode,
QPopupMenu* menu );
private:
SALOME_PYQT_Module* myModule;
QDomDocument myDoc;
+ QStringList myMenuItems;
+ QStringList myCurrentMenu;
+ bool myMenuCreated;
};
-//=============================================================================
// SALOME_PYQT_Module class implementation (implements CAM_Module API for
// all Python-based SALOME module
-//=============================================================================
// While the SalomePyQtGUI library is not imported in Python it's initialization function
// should be called manually (and only once) in order to initialize global sip data
// and to get C API from sip : sipBuildResult for example
+#if defined(SIP_VERS_v4_old) || defined(SIP_VERS_v4_new)
+#define INIT_FUNCTION initSalomePyQtGUI
#if defined(SIP_STATIC_MODULE)
-extern "C" void initSalomePyQtGUI();
+extern "C" void INIT_FUNCTION();
+#else
+PyMODINIT_FUNC INIT_FUNCTION();
+#endif
#else
-PyMODINIT_FUNC initSalomePyQtGUI();
+#define INIT_FUNCTION initlibSalomePyQtGUIc
+extern "C" void INIT_FUNCTION();
#endif
/*!
if ( !alreadyInitialized ) {
// call only once (see above) !
PyEval_RestoreThread( KERNEL_PYTHON::_gtstate );
- initSalomePyQtGUI();
+ INIT_FUNCTION();
PyEval_ReleaseThread( KERNEL_PYTHON::_gtstate );
alreadyInitialized = !alreadyInitialized;
}
}
}
-/*!
+/*!
* Static variables definition
*/
SALOME_PYQT_Module::InterpMap SALOME_PYQT_Module::myInterpMap;
* Little trick : provide an access to being activated Python module from outside;
* needed by the SalomePyQt library :(
*/
-SALOME_PYQT_Module* SALOME_PYQT_Module::getInitModule()
-{
- return myInitModule;
+SALOME_PYQT_Module* SALOME_PYQT_Module::getInitModule()
+{
+ return myInitModule;
}
/*!
* Constructor
*/
-SALOME_PYQT_Module::SALOME_PYQT_Module() :
- SalomeApp_Module( __DEFAULT_NAME__ ), myModule( 0 ), myXmlHandler ( 0 )
+SALOME_PYQT_Module::SALOME_PYQT_Module()
+ : SalomeApp_Module( __DEFAULT_NAME__ ),
+ myModule( 0 ),
+ myXmlHandler ( 0 )
{
- myMenuActionList.setAutoDelete( false );
- myPopupActionList.setAutoDelete( false );
- myToolbarActionList.setAutoDelete( false );
}
/*!
*/
SALOME_PYQT_Module::~SALOME_PYQT_Module()
{
- myMenuActionList.clear();
- myPopupActionList.clear();
- myToolbarActionList.clear();
if ( myXmlHandler )
delete myXmlHandler;
}
*
* This method is used for creation of the menus, toolbars and other staff.
* There are two ways:
- * - for obsolete modules this method first tries to read <module>_<language>.xml
+ * - for obsolete modules this method first tries to read <module>_<language>.xml
* resource file which contains a menu, toolbars and popup menus description.
* - new modules can create menus by by calling the corresponding methods of SalomePyQt
* Python API in the Python module's initialize() method which is called from here.
*/
void SALOME_PYQT_Module::initialize( CAM_Application* app )
{
+ MESSAGE( "SALOME_PYQT_Module::initialize" );
+
SalomeApp_Module::initialize( app );
// Try to get XML resource file name
QString aName = name( "" );
QString aFileName = aName + "_" + aLang + ".xml";
aFileName = aResMgr->path( "resources", aName, aFileName );
-
- // parse XML file if it is found and create actions
- if ( !myXmlHandler && !aFileName.isEmpty() ) {
+
+ // create XML handler instance
+ if ( !myXmlHandler && !aFileName.isEmpty() && QFile::exists( aFileName ) )
myXmlHandler = new SALOME_PYQT_XmlHandler( this, aFileName );
- myXmlHandler->createActions();
- }
// perform internal initialization and call module's initialize() method
// InitializeReq: request class for internal init() operation
{
public:
InitializeReq( CAM_Application* _app,
- SALOME_PYQT_Module* _obj )
+ SALOME_PYQT_Module* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myApp( _app ),
myObj( _obj ) {}
-
+
protected:
virtual void execute()
{
MESSAGE( "SALOME_PYQT_Module::activateModule" );
bool res = SalomeApp_Module::activateModule( theStudy );
-
+
if ( !res )
return res;
class ActivateReq : public PyInterp_Request
{
public:
- ActivateReq( SUIT_Study* _study,
- SALOME_PYQT_Module* _obj )
+ ActivateReq( SUIT_Study* _study,
+ SALOME_PYQT_Module* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
setMenuShown( true );
setToolShown( true );
+ if ( menuMgr() )
+ connect( menuMgr(), SIGNAL( menuHighlighted( int, int ) ),
+ this, SLOT( onMenuHighlighted( int, int ) ) );
+
+ // create menus & toolbars from XML file if required
+ if ( myXmlHandler )
+ myXmlHandler->createActions();
+
+ // CustomizeReq: request class for internal customize() operation
+ class CustomizeReq : public PyInterp_Request
+ {
+ public:
+ CustomizeReq( SUIT_Study* _study,
+ SALOME_PYQT_Module* _obj )
+ : PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
+ myStudy ( _study ),
+ myObj ( _obj ) {}
+
+ protected:
+ virtual void execute()
+ {
+ myObj->customize( myStudy );
+ }
+
+ private:
+ SUIT_Study* myStudy;
+ SALOME_PYQT_Module* myObj;
+ };
+
+ // Posting the request
+ PyInterp_Dispatcher::Get()->Exec( new CustomizeReq( theStudy, this ) );
+
return true;
}
{
MESSAGE( "SALOME_PYQT_Module::deactivateModule" );
- bool res = SalomeApp_Module::deactivateModule( theStudy );
+ if ( menuMgr() )
+ disconnect( menuMgr(), SIGNAL( menuHighlighted( int, int ) ),
+ this, SLOT( onMenuHighlighted( int, int ) ) );
+
+ // remove menus & toolbars created from XML file if required
+ if ( myXmlHandler )
+ myXmlHandler->clearActions();
// deactivate menus, toolbars, etc
setMenuShown( false );
class DeactivateReq : public PyInterp_LockRequest
{
public:
- DeactivateReq( PyInterp_base* _py_interp,
- SUIT_Study* _study,
- SALOME_PYQT_Module* _obj )
+ DeactivateReq( PyInterp_base* _py_interp,
+ SUIT_Study* _study,
+ SALOME_PYQT_Module* _obj )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
// Posting the request
PyInterp_Dispatcher::Get()->Exec( new DeactivateReq( myInterp, theStudy, this ) );
- return res;
+ return SalomeApp_Module::deactivateModule( theStudy );
+}
+
+/*!
+ * Called when study desktop is activated.
+ * Used for notifying about changing of the active study.
+ */
+void SALOME_PYQT_Module::studyActivated()
+{
+ // StudyChangedReq: request class for internal studyChanged() operation
+ class StudyChangedReq : public PyInterp_Request
+ {
+ public:
+ StudyChangedReq( SUIT_Study* _study,
+ SALOME_PYQT_Module* _obj )
+ : PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
+ myStudy ( _study ),
+ myObj ( _obj ) {}
+
+ protected:
+ virtual void execute()
+ {
+ myObj->studyChanged( myStudy );
+ }
+
+ private:
+ SUIT_Study* myStudy;
+ SALOME_PYQT_Module* myObj;
+ };
+
+ // Posting the request
+ PyInterp_Dispatcher::Get()->Exec( new StudyChangedReq( application()->activeStudy(), this ) );
}
/*!
class GUIEvent : public PyInterp_LockRequest
{
public:
- GUIEvent( PyInterp_base* _py_interp,
+ GUIEvent( PyInterp_base* _py_interp,
SALOME_PYQT_Module* _obj,
- int _id )
+ int _id )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myId ( _id ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
/*!
* Processes GUI action (from context popup menu, only for XML-based actions!)
*/
-void SALOME_PYQT_Module::onGUIEvent( int id )
+void SALOME_PYQT_Module::onGUIEvent( int id )
{
// perform synchronous request to Python event dispatcher
class GUIEvent : public PyInterp_LockRequest
{
public:
- GUIEvent( PyInterp_base* _py_interp,
+ GUIEvent( PyInterp_base* _py_interp,
SALOME_PYQT_Module* _obj,
- int _id )
+ int _id )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myId ( _id ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
PyInterp_Dispatcher::Get()->Exec( new GUIEvent( myInterp, this, id ) );
}
-/*!
+/*!
+ * Menu highlight processing
+ */
+void SALOME_PYQT_Module::onMenuHighlighted( int menu, int submenu )
+{
+ if ( !action( menu ) && registered( menu, submenu ) ) {
+ // perform synchronous request to Python event dispatcher
+ class MenuHighlightEvent : public PyInterp_LockRequest
+ {
+ public:
+ MenuHighlightEvent( PyInterp_base* _py_interp,
+ SALOME_PYQT_Module* _obj,
+ int _menu,
+ int _submenu )
+ : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
+ myMenu ( _menu ),
+ mySubMenu( _submenu ),
+ myObj ( _obj ) {}
+
+ protected:
+ virtual void execute()
+ {
+ myObj->menuHighlight( myMenu, mySubMenu );
+ }
+
+ private:
+ int myMenu;
+ int mySubMenu;
+ SALOME_PYQT_Module* myObj;
+ };
+
+ // Posting the request
+ PyInterp_Dispatcher::Get()->Exec( new MenuHighlightEvent( myInterp, this, menu, submenu ) );
+ }
+}
+
+/*!
Context popup menu request.
Called when user activates popup menu in some window (view, object browser, etc).
*/
class PopupMenuEvent : public PyInterp_LockRequest
{
public:
- PopupMenuEvent( PyInterp_base* _py_interp,
+ PopupMenuEvent( PyInterp_base* _py_interp,
SALOME_PYQT_Module* _obj,
- const QString& _context,
- QPopupMenu* _popup )
+ const QString& _context,
+ QPopupMenu* _popup )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
- myContext( _context ),
+ myContext( _context ),
myPopup ( _popup ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
/*!
* Defines the dockable window associated with the module.
- * To fill the list of windows the correspondind Python module's windows()
+ * To fill the list of windows the correspondind Python module's windows()
* method is called from SALOME_PYQT_Module::init() method.
* By default, ObjectBrowser, PythonConsole and LogWindow are provided.
*/
void SALOME_PYQT_Module::windows( QMap<int, int>& mappa ) const
{
- // First clear the output parameters
+ // First clear the output parameters
QMap<int, int>::ConstIterator it;
for ( it = myWindowsMap.begin(); it != myWindowsMap.end(); ++it ) {
mappa[ it.key() ] = it.data();
/*!
* Defines the compatible views which should be opened on module activation.
- * To fill the list of views the correspondind Python module's views()
+ * To fill the list of views the correspondind Python module's views()
* method is called from SALOME_PYQT_Module::init() method.
* By default, the list is empty.
*/
// initialize Python subinterpreter (on per study) and put it in <myInterp> variable
initInterp( aStudyId );
- if ( !myInterp )
- return; // Error
+ if ( !myInterp )
+ return; // Error
// import Python GUI module
importModule();
if ( !myModule )
- return; // Error
-
- myInitModule = this;
+ return; // Error
- if ( IsCallOldMethods ) { // __CALL_OLD_METHODS__
- // call Python module's setWorkspace() method
- setWorkSpace();
- } //__CALL_OLD_METHODS__
+ myInitModule = this;
// then call Python module's initialize() method
// ... first get python lock
PyErr_Print();
}
}
-
+
// get the windows list from the Python module by calling windows() method
// ... first put default values
myWindowsMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
}
/*!
- * Performs internal activation:
+ * Performs internal activation:
* - initializes/gets the Python interpreter (one per study)
* - imports the Python GUI module
- * - calls Python module's setSettings() method (obsolete function, used for compatibility with old code)
- * or activate() method (for new modules)
+ * - calls Python module's activate() method (for new modules)
*/
void SALOME_PYQT_Module::activate( SUIT_Study* theStudy )
{
// initialize Python subinterpreter (on per study) and put it in <myInterp> variable
initInterp( aStudyId );
- if ( !myInterp )
- return; // Error
+ if ( !myInterp )
+ return; // Error
// import Python GUI module
importModule();
if ( !myModule )
- return; // Error
-
+ return; // Error
+
+ // get python lock
+ PyLockWrapper aLock = myInterp->GetLockWrapper();
+
+ // call Python module's activate() method (for the new modules)
+ if(PyObject_HasAttrString(myModule , "activate")){
+ PyObjWrapper res1( PyObject_CallMethod( myModule, "activate", "" ) );
+ if( !res1 ) {
+ PyErr_Print();
+ }
+ }
+}
+
+/*!
+ * Performs additional customization after module is activated:
+ * - gets the Python interpreter (one per study)
+ * - imports the Python GUI module
+ * - calls Python module's setSettings() method (obsolete function, used for compatibility with old code)
+ */
+void SALOME_PYQT_Module::customize ( SUIT_Study* theStudy )
+{
+ // get study Id
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( theStudy );
+ int aStudyId = aStudy ? aStudy->studyDS()->StudyId() : 0;
+
+ // initialize Python subinterpreter (on per study) and put it in <myInterp> variable
+ initInterp( aStudyId );
+ if ( !myInterp )
+ return; // Error
+
+ // import Python GUI module
+ importModule();
+ if ( !myModule )
+ return; // Error
+
+ if ( IsCallOldMethods ) { // __CALL_OLD_METHODS__
+ // call Python module's setWorkspace() method
+ setWorkSpace();
+ } //__CALL_OLD_METHODS__
+
// get python lock
PyLockWrapper aLock = myInterp->GetLockWrapper();
}
}
} //__CALL_OLD_METHODS__
-
- // call Python module's activate() method (for the new modules)
- if(PyObject_HasAttrString(myModule , "activate")){
- PyObjWrapper res1( PyObject_CallMethod( myModule, "activate", "" ) );
- if( !res1 ) {
- PyErr_Print();
- }
- }
}
/*!
- * Performs internal deactivation:
+ * Performs internal deactivation:
* - calls Python module's deactivate() method
*/
void SALOME_PYQT_Module::deactivate( SUIT_Study* theStudy )
// initialize Python subinterpreter (on per study) and put it in <myInterp> variable
initInterp( aStudyId );
- if ( !myInterp )
- return; // Error
+ if ( !myInterp )
+ return; // Error
// import Python GUI module
importModule();
if ( !myModule )
- return; // Error
-
+ return; // Error
+
+ if ( IsCallOldMethods ) { // __CALL_OLD_METHODS__
+ // call Python module's setWorkspace() method
+ setWorkSpace();
+ } //__CALL_OLD_METHODS__
+
// get python lock
PyLockWrapper aLock = myInterp->GetLockWrapper();
return QString( "" );
}
-/*!
- * Called when study desktop is activated.
- * Used for notifying about changing of the active study.
- */
-void SALOME_PYQT_Module::studyActivated()
-{
- // StudyChangedReq: request class for internal studyChanged() operation
- class StudyChangedReq : public PyInterp_Request
- {
- public:
- StudyChangedReq( SUIT_Study* _study,
- SALOME_PYQT_Module* _obj )
- : PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
- myStudy ( _study ),
- myObj ( _obj ) {}
-
- protected:
- virtual void execute()
- {
- myObj->studyChanged( myStudy );
- }
-
- private:
- SUIT_Study* myStudy;
- SALOME_PYQT_Module* myObj;
- };
-
- // Posting the request
- PyInterp_Dispatcher::Get()->Exec( new StudyChangedReq( application()->activeStudy(), this ) );
-}
-
/*!
* Processes context popup menu request
* - calls Python module's definePopup(...) method (obsolete function, used for compatibility with old code)
// import first
if ( !myInterp || !myModule )
return;
-
- QString aContext( theContext ), aObject( "" ), aParent( "" );
-
+
+ QString aContext( "" ), aObject( "" ), aParent( theContext );
+
if ( IsCallOldMethods && PyObject_HasAttrString(myModule , "definePopup") ) { //__CALL_OLD_METHODS__
// call definePopup() Python module's function
// this is obsolete function, used only for compatibility reasons
- PyObjWrapper res(PyObject_CallMethod( myModule,
- "definePopup",
+ PyObjWrapper res(PyObject_CallMethod( myModule,
+ "definePopup",
"sss",
- aContext.latin1(),
- aObject.latin1(),
+ aContext.latin1(),
+ aObject.latin1(),
aParent.latin1() ) );
if( !res ) {
PyErr_Print();
PyObjWrapper sipPopup( sipBuildResult( 0, "M", thePopupMenu, sipClass_QPopupMenu ) );
// then call Python module's createPopupMenu() method (for new modules)
- if ( PyObject_HasAttrString(myModule , "createPopupMenu") ) {
+ if ( PyObject_HasAttrString(myModule , "createPopupMenu") ) {
PyObjWrapper res1( PyObject_CallMethod( myModule,
"createPopupMenu",
"Os",
"customPopup",
"Osss",
sipPopup.get(),
- aContext.latin1(),
- aObject.latin1(),
+ aContext.latin1(),
+ aObject.latin1(),
aParent.latin1() ) );
if( !res2 ) {
PyErr_Print();
/*!
* Processes GUI event
* - calls Python module's OnGUIEvent() method
- */
+ */
void SALOME_PYQT_Module::guiEvent( const int theId )
{
// Python interpreter should be initialized and Python module should be
// import first
if ( !myInterp || !myModule )
return;
-
- if ( PyObject_HasAttrString(myModule , "OnGUIEvent") ) {
+
+ if ( PyObject_HasAttrString(myModule , "OnGUIEvent") ) {
PyObjWrapper res( PyObject_CallMethod( myModule, "OnGUIEvent", "i", theId ) );
if( !res ) {
PyErr_Print();
}
}
+/*!
+ * Menu highlight processing
+ * - calls Python module's menuActivated(int,int) method
+ */
+void SALOME_PYQT_Module::menuHighlight( const int menu, const int submenu )
+{
+ // Python interpreter should be initialized and Python module should be
+ // import first
+ if ( !myInterp || !myModule )
+ return;
+
+ if ( PyObject_HasAttrString(myModule , "menuHighlight") ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, "menuHighlight", "ii", menu, submenu ) );
+ if( !res ) {
+ PyErr_Print();
+ }
+ }
+}
+
/*!
* Initialises python subinterpreter (one per study)
*/
}
// not found - create a new one!
///////////////////////////////////////////////////////////////////
- // Attention: the creation of Python interpretor must be protected
+ // Attention: the creation of Python interpretor must be protected
// by a C++ Lock because of C threads
///////////////////////////////////////////////////////////////////
myInterp = new SALOME_PYQT_PyInterp();
myInterp->initialize();
myInterpMap[ theStudyId ] = myInterp;
-
+
// import 'salome' module and call 'salome_init' method;
// do it only once on interpreter creation
// ... first get python lock
return;
}
// ... then call a method
- PyObjWrapper aRes( PyObject_CallMethod( aMod, "salome_init", "" ) );
+ int embedded = 1;
+ PyObjWrapper aRes( PyObject_CallMethod( aMod, "salome_init", "ii", theStudyId, embedded ) );
if( !aRes ) {
// Error!
PyErr_Print();
// Error!
PyErr_Print();
return;
- }
+ }
if ( IsCallOldMethods ) { //__CALL_OLD_METHODS__
// ... then get workspace object
}
PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget ) );
// ... and finally call Python module's setWorkspace() method (obsolete)
- if ( PyObject_HasAttrString(myModule , "setWorkSpace") ) {
+ if ( PyObject_HasAttrString(myModule , "setWorkSpace") ) {
PyObjWrapper res( PyObject_CallMethod( myModule, "setWorkSpace", "O", pyws.get() ) );
if( !res ) {
PyErr_Print();
}
/*!
- * Adds an action into private action list [internal usage]
+ * Returns default menu group
*/
-void SALOME_PYQT_Module::addAction( const PyQtGUIAction type, QAction* action )
+int SALOME_PYQT_Module::defaultMenuGroup()
{
- switch ( type ) {
- case PYQT_ACTION_MENU:
- myMenuActionList.append( action );
- break;
- case PYQT_ACTION_TOOLBAL:
- myToolbarActionList.append( action );
- break;
- case PYQT_ACTION_POPUP:
- myPopupActionList.append( action );
- break;
- }
+ return __DEFAULT_GROUP__;
}
-
/*!
- * The next methods just call the parent implementation.
+ * The next methods call the parent implementation.
* This is done to open protected methods from CAM_Module class.
-*/
+ * Also these methods are used to register created from outside menus
+ * in order to enable dynamic menus handling.
+ */
+
+
+/*! Create tool bar with name \a name, if it was't created before.
+ * \retval -1 - if tool manager was't be created.
+ */
int SALOME_PYQT_Module::createTool( const QString& name )
{
return SalomeApp_Module::createTool( name );
}
+/*! Create tool.
+ * Insert QAction with id \a id from action map(myActionMap) to tool manager.
+ *\param id - integer
+ *\param tBar - integer
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( const int id, const int tBar, const int idx )
{
return SalomeApp_Module::createTool( id, tBar, idx );
}
+/*! Create tool.
+ * Insert QAction with id \a id from action map(myActionMap) to tool manager.
+ *\param id - integer
+ *\param tBar - QString&
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( const int id, const QString& tBar, const int idx )
{
return SalomeApp_Module::createTool( id, tBar, idx );
}
+/*! Create tool. Register action \a a with id \a id.
+ * Insert QAction to tool manager.
+ *\param a - QAction
+ *\param tBar - integer
+ *\param id - integer
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( QAction* a, const int tBar, const int id, const int idx )
{
return SalomeApp_Module::createTool( a, tBar, id, idx );
}
+/*! Create tool. Register action \a a with id \a id.
+ * Insert QAction to tool manager.
+ *\param a - QAction
+ *\param tBar - QString&
+ *\param id - integer
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx )
{
return SalomeApp_Module::createTool( a, tBar, id, idx );
}
-int SALOME_PYQT_Module::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx )
+
+int SALOME_PYQT_Module::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( subMenu, menu, id, group, idx );
+ bool exists = hasMenu( subMenu, menu );
+ int regId = SalomeApp_Module::createMenu( subMenu, menu, id, group, idx, true );
+ if ( !exists )
+ registerMenu( regId, menu, constantMenu );
+ return regId;
}
-int SALOME_PYQT_Module::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx )
+
+int SALOME_PYQT_Module::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( subMenu, menu, id, group, idx );
+ QStringList menus = QStringList::split( "|", menu, false );
+ int pid = -1;
+ for (int i = 0; i < menus.count(); i++ ) {
+ pid = createMenu( menus[i], pid, -1, -1, -1, constantMenu );
+ if ( pid == -1 ) break;
+ }
+ if ( pid != -1 )
+ pid = createMenu( subMenu, pid, id, group, idx, constantMenu );
+ return pid;
}
-int SALOME_PYQT_Module::createMenu( const int id, const int menu, const int group, const int idx )
+
+int SALOME_PYQT_Module::createMenu( const int id, const int menu, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( id, menu, group, idx );
+ int regId = SalomeApp_Module::createMenu( id, menu, group, idx );
+ if ( regId != -1 )
+ registerMenu( regId, menu, constantMenu );
+ return regId;
}
-int SALOME_PYQT_Module::createMenu( const int id, const QString& menu, const int group, const int idx )
+
+int SALOME_PYQT_Module::createMenu( const int id, const QString& menu, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( id, menu, group, idx );
+ QStringList menus = QStringList::split( "|", menu, false );
+ int pid = -1;
+ for (int i = 0; i < menus.count(); i++ ) {
+ pid = createMenu( menus[i], pid, -1, -1, -1, constantMenu );
+ if ( pid == -1 ) break;
+ }
+ if ( pid != -1 )
+ pid = createMenu( id, pid, group, idx, constantMenu );
+ return pid;
}
-int SALOME_PYQT_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx )
+
+int SALOME_PYQT_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( a, menu, id, group, idx );
+ int regId = SalomeApp_Module::createMenu( a, menu, id, group, idx );
+ if ( regId != -1 )
+ registerMenu( regId, menu, constantMenu );
+ return regId;
}
-int SALOME_PYQT_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx )
+
+int SALOME_PYQT_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( a, menu, id, group, idx );
+ QStringList menus = QStringList::split( "|", menu, false );
+ int pid = -1;
+ for (int i = 0; i < menus.count(); i++ ) {
+ pid = createMenu( menus[i], pid, -1, -1, -1, constantMenu );
+ if ( pid == -1 ) break;
+ }
+ if ( pid != -1 )
+ pid = createMenu( a, pid, id, group, idx, constantMenu );
+ return pid;
}
+
QAction* SALOME_PYQT_Module::createSeparator()
{
return SalomeApp_Module::separator();
}
+
QAction* SALOME_PYQT_Module::action( const int id ) const
{
- QAction* a = SalomeApp_Module::action( id );
- if ( !a ) // try own action map for menu items
- a = SalomeApp_Module::action( id + PYQT_ACTION_MENU );
- if ( !a ) // try own action map for toolbar items
- a = SalomeApp_Module::action( id + PYQT_ACTION_TOOLBAL );
- if ( !a ) // try own action map for popup items
- a = SalomeApp_Module::action( id + PYQT_ACTION_POPUP );
- return a;
+ return SalomeApp_Module::action( id );
}
+
int SALOME_PYQT_Module::actionId( const QAction* a ) const
{
- int id = SalomeApp_Module::actionId( a );
- if ( myMenuActionList.contains( a ) ) // check own action map for menu items
- id -= PYQT_ACTION_MENU;
- if ( myToolbarActionList.contains( a ) ) // check own action map for toolbar items
- id -= PYQT_ACTION_TOOLBAL;
- if ( myPopupActionList.contains( a ) ) // check own action map for popup items
- id -= PYQT_ACTION_POPUP;
- return id;
+ return SalomeApp_Module::actionId( a );
}
-QAction* SALOME_PYQT_Module::createAction( const int id, const QString& text, const QString& icon,
+
+QAction* SALOME_PYQT_Module::createAction( const int id, const QString& text, const QString& icon,
const QString& menu, const QString& tip, const int key,
const bool toggle )
+{
+ QIconSet anIcon = loadIcon( icon );
+ QAction* a = action( id );
+ if ( a ) {
+ if ( a->text().isEmpty() && !text.isEmpty() ) a->setText( text );
+ if ( a->menuText().isEmpty() && !menu.isEmpty() ) a->setMenuText( menu );
+ if ( a->iconSet().isNull() && !anIcon.isNull() ) a->setIconSet( anIcon );
+ if ( a->statusTip().isEmpty() && !tip.isNull() ) a->setStatusTip( tip );
+ if ( a->accel().isEmpty() && key ) a->setAccel( key );
+ if ( a->isToggleAction() != toggle ) a->setToggleAction( toggle );
+ disconnect( a, SIGNAL( activated() ), this, SLOT( onGUIEvent() ) );
+ connect( a, SIGNAL( activated() ), this, SLOT( onGUIEvent() ) );
+ }
+ else {
+ a = SalomeApp_Module::createAction( id, text, anIcon, menu, tip, key, getApp()->desktop(), toggle, this, SLOT( onGUIEvent() ) );
+ }
+ return a;
+}
+/*!
+ * Load icon from resource file
+ */
+QIconSet SALOME_PYQT_Module::loadIcon( const QString& fileName )
{
QIconSet anIcon;
- if ( !icon.isEmpty() ) {
- QPixmap pixmap = getApp()->resourceMgr()->loadPixmap( name(""), tr( icon ) );
+ if ( !fileName.isEmpty() ) {
+ QPixmap pixmap = getApp()->resourceMgr()->loadPixmap( name(""), tr( fileName ) );
if ( !pixmap.isNull() )
anIcon = QIconSet( pixmap );
}
- return SalomeApp_Module::createAction( id, text, anIcon, menu, tip, key, getApp()->desktop(), toggle, this, SLOT( onGUIEvent() ) );
+ return anIcon;
}
+/*!
+ * Returns TRUE if menu already exists
+ */
+bool SALOME_PYQT_Module::hasMenu( const QString& subMenu, const int menu )
+{
+ return menuMgr() && menuMgr()->containsMenu( subMenu, menu );
+}
+
+/*!
+ * Register the menu
+ */
+void SALOME_PYQT_Module::registerMenu( const int id, const int menu, const bool constantMenu )
+{
+ QAction* a = action( id );
+ QAction* s = separator();
+ if ( a && a == s )
+ return;
+ if ( !registered( id, menu ) )
+ myMenus[menu].append( MenuId( id, constantMenu ) );
+}
+
+/*!
+ * Unregister the menu
+ */
+void SALOME_PYQT_Module::unregisterMenu( const int id, const int menu )
+{
+ if ( myMenus.find( menu ) != myMenus.end() ) {
+ MenuIdList::iterator lit;
+ for ( lit = myMenus[menu].begin(); lit != myMenus[menu].end(); ++lit ) {
+ if ( (*lit).id == id ) {
+ myMenus[menu].remove( lit );
+ return;
+ }
+ }
+ }
+}
+
+/*!
+ * Returns TRUE if the menu is registered
+ */
+bool SALOME_PYQT_Module::registered( const int id, const int menu )
+{
+ MenuMap::iterator mit;
+ for ( mit = myMenus.begin(); mit != myMenus.end(); ++mit ) {
+ MenuIdList::iterator lit;
+ for ( lit = mit.data().begin(); lit != mit.data().end(); ++lit ) {
+ if ( (*lit).id == id && ( menu == 0 || mit.key() == menu ) )
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ * Returns TRUE if the menu is constant (not removed by clearMenu()).
+ * This concerns the menus which are created from XML files.
+ */
+bool SALOME_PYQT_Module::isConstantMenu( const int id, const int menu )
+{
+ if ( myMenus.find( menu ) != myMenus.end() ) {
+ MenuIdList& l = myMenus[ menu ];
+ MenuIdList::iterator lit;
+ for ( lit = l.begin(); lit != l.end(); ++lit ) {
+ if ( (*lit).id == id && (*lit).constantMenu )
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ * Displays/hides the module's menus.
+ */
+void SALOME_PYQT_Module::setMenuShown( const bool show )
+{
+ QtxActionMenuMgr* mMgr = menuMgr();
+ if ( !mMgr )
+ return;
+
+ bool upd = mMgr->isUpdatesEnabled();
+ mMgr->setUpdatesEnabled( false );
+
+ SalomeApp_Module::setMenuShown( show );
+
+ for ( MenuMap::iterator mit = myMenus.begin(); mit != myMenus.end(); ++mit ) {
+ MenuIdList::iterator lit;
+ for ( lit = mit.data().begin(); lit != mit.data().end(); ++lit )
+ if ( !action( (*lit).id ) )
+ mMgr->setShown( (*lit).id, show );
+ }
+
+ mMgr->setUpdatesEnabled( upd );
+ if ( upd )
+ mMgr->update();
+}
+
+/*!
+ * Displays/hides the module's toolbars.
+ */
+void SALOME_PYQT_Module::setToolShown( const bool show )
+{
+ SalomeApp_Module::setToolShown( show );
+}
+
+/*!
+ * Clears the given menu.
+ * If <id> = 0 : clear all items in the <menu> menu
+ * If <menu> = 0 : clear all menus recursively starting from top-level.
+ * If <removeActions> = 0 : also unregister all removed actions (not delete!).
+ */
+bool SALOME_PYQT_Module::clearMenu( const int id, const int menu, const bool removeActions )
+{
+ QAction* a = action( id );
+ QAction* s = separator();
+ typedef QValueList<int> IntList;
+ if ( a && a != s ) {
+ // action
+ IntList menus;
+ if ( menu != 0 ) {
+ if ( registered( id, menu ) ) menus.append( menu );
+ }
+ else {
+ MenuMap::iterator mit;
+ for ( mit = myMenus.begin(); mit != myMenus.end(); ++mit )
+ if ( registered( id, mit.key() ) ) menus.append( mit.key() );
+ }
+ for ( int i = 0; i < menus.count(); i++ ) {
+ if ( !isConstantMenu( id, menus[i] ) ) {
+ menuMgr()->remove( menuMgr()->actionId( a ), menus[ i ] );
+ unregisterMenu( id, menus[i] );
+ }
+ }
+ if ( !registered( id ) && removeActions )
+ unregisterAction( id );
+ }
+ else {
+ // menu
+ if ( id == 0 ) {
+ if ( menu == 0 ) {
+ // clear all menus recursively starting from top-level (main menu)
+ IntList l = myMenus.keys();
+ IntList::iterator lit;
+ for ( lit = l.begin(); lit != l.end(); ++lit )
+ clearMenu( 0, *lit, removeActions );
+ }
+ else {
+ if ( myMenus.find( menu ) != myMenus.end() ) {
+ // remove all items in the parent menu
+ IntList l;
+ MenuIdList::iterator lit;
+ for ( lit = myMenus[menu].begin(); lit != myMenus[menu].end(); ++lit )
+ l.append( (*lit).id );
+ for ( int i = 0; i < l.count(); i++ )
+ clearMenu( l[i], menu, removeActions );
+ if ( myMenus[menu].empty() )
+ myMenus.remove( menu );
+ }
+ }
+ }
+ else {
+ MenuMap::iterator mit;
+ for ( mit = myMenus.begin(); mit != myMenus.end(); ++mit ) {
+ MenuIdList::iterator lit;
+ for ( lit = mit.data().begin(); lit != mit.data().end(); ++lit ) {
+ if ( (*lit).id == id && ( menu == 0 || mit.key() == menu ) ) {
+ clearMenu( 0, id, removeActions ); // first remove all sub-menus
+ if ( !isConstantMenu( id, mit.key() ) ) {
+ menuMgr()->remove( id, mit.key() );
+ mit.data().remove( lit );
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
-//=============================================================================
// SALOME_PYQT_XmlHandler class implementation
-//=============================================================================
// gets an tag name for the dom element [ static ]
// returns an empty string if the element does not have tag name
static QString tagName( const QDomElement& element ) {
- return element.tagName().stripWhiteSpace();
+ return element.tagName().stripWhiteSpace();
}
// gets an attribute by it's name for the dom element [ static ]
}
// checks the given value for the boolean value [ static ]
-// returns TRUE if string is "true", "yes" or "1"
-static bool checkBool( const QString& value ) {
- return ( value == "true" || value == "yes" || value == "1" );
+// returns TRUE if string represents boolean value:
+// - "true", "yes" or "1" for true
+// - "false", "no" or "0" for false
+// second parameter allows to check certain boolean value
+// - 1: true
+// - 0: false
+// - other value is not taken into account
+static bool checkBool( const QString& value, const int check = -1 ) {
+ QString v = value.lower();
+ if ( ( v == "true" || v == "yes" || v == "1" ) && ( check != 0 ) )
+ return true;
+ if ( ( v == "false" || v == "no" || v == "0" ) && ( check != 1 ) )
+ return true;
+ return false;
}
// checks the given value for the integer value [ static ]
// returns -1 if item is empty or presents and invalid number
-static int checkInt( const QString& value )
+static int checkInt( const QString& value, const int def = -1, const int shift = -1 )
{
- return value.isEmpty() ? -1 : value.toInt();
+ bool bOk;
+ int val = value.toInt( &bOk );
+ if ( !bOk ) val = def;
+ if ( shift > 0 && bOk && val < 0 )
+ val += shift;
+ return val;
}
/*!
* Constructor
*/
-SALOME_PYQT_XmlHandler::SALOME_PYQT_XmlHandler( SALOME_PYQT_Module* module, const QString& fileName )
- : myModule( module )
+SALOME_PYQT_XmlHandler::SALOME_PYQT_XmlHandler( SALOME_PYQT_Module* module,
+ const QString& fileName )
+ : myModule( module ),
+ myMenuCreated( false )
{
+ if (fileName.isEmpty() )
+ return;
QFile aFile( fileName );
if ( !aFile.open( IO_ReadOnly ) )
return;
if ( !myDoc.setContent( &aFile ) ) {
- aFile.close();
- return;
+ aFile.close();
+ return;
}
aFile.close();
}
/*!
- Called by SALOME_PYQT_Module::initialize() in order to create actions
- (menus, toolbars, popup menus)
+ * Called by SALOME_PYQT_Module::activate() in order to create actions
+ * (menus, toolbars, popup menus)
*/
void SALOME_PYQT_XmlHandler::createActions()
{
+ // check flag : are menus already created?
+ if ( myMenuCreated && !IsCallOldMethods )
+ return;
+
// get document element
QDomElement aDocElem = myDoc.documentElement();
- // get main menu actions
+ // create main menu actions
QDomNodeList aMenuList = aDocElem.elementsByTagName( "menu-item" );
for ( int i = 0; i < aMenuList.count(); i++ ) {
QDomNode n = aMenuList.item( i );
QDomNode n = aToolsList.item( i );
createToolBar( n );
}
+ // set flag : menus are already created
+ myMenuCreated = true;
+}
+
+/*!
+ * Called by SALOME_PYQT_Module::deactivate() in order to remove actions
+ * (menus, toolbars, popup menus)
+ */
+void SALOME_PYQT_XmlHandler::clearActions()
+{
+ for ( uint i = 0; i < myMenuItems.count(); i++ ) {
+ QMenuData* md = dynamic_cast<QMenuData*>( myModule->getApp()->desktop()->menuBar() );
+ QStringList menus = QStringList::split( ":", myMenuItems[ i ] );
+ for ( uint j = 0; j < menus.count(); j++) {
+ int id = menus[ j ].toInt();
+ QMenuData* smd;
+ QMenuItem* mi = md->findItem( id, &smd );
+ if ( mi && md == smd ) {
+ if ( j == menus.count()-1 || !mi->popup() ) { // last item or not popup
+ md->removeItem( id );
+ break;
+ }
+ else if ( mi->popup() )
+ md = dynamic_cast<QMenuData*>( mi->popup() );
+ }
+ else
+ break;
+ }
+ }
+ myMenuItems.clear();
}
/*!
* Creates popup menu
*/
-void SALOME_PYQT_XmlHandler::createPopup( QPopupMenu* menu,
- const QString& context,
- const QString& parent,
+void SALOME_PYQT_XmlHandler::createPopup( QPopupMenu* menu,
+ const QString& context,
+ const QString& parent,
const QString& object )
{
// get document element
/*!
Create main menu with child actions
*/
-void SALOME_PYQT_XmlHandler::createMenu( QDomNode& parentNode, const int parentMenuId )
+void SALOME_PYQT_XmlHandler::createMenu( QDomNode& parentNode,
+ const int parentMenuId,
+ QPopupMenu* parentPopup )
{
if ( !myModule )
return;
-
+
if ( parentNode.isNull() )
return;
- QDomElement parentElement = parentNode.toElement();
+ QDomElement parentElement = parentNode.toElement();
if ( !parentElement.isNull() ) {
QString plabel = attribute( parentElement, "label-id" );
int pid = checkInt( attribute( parentElement, "item-id" ) );
int ppos = checkInt( attribute( parentElement, "pos-id" ) );
+ int group = checkInt( attribute( parentElement, "group-id" ),
+ myModule->defaultMenuGroup() );
if ( !plabel.isEmpty() ) {
+ QPopupMenu* popup = 0;
+ int menuId = -1;
// create menu
- int menuId = myModule->createMenu( plabel, // label
- parentMenuId, // parent menu ID, should be -1 for main menu
- pid, // ID
- 80, // group ID
- ppos ); // position
+ if ( IsCallOldMethods ) { // __CALL_OLD_METHODS__
+ SUIT_Desktop* desktop = myModule->getApp()->desktop();
+ if ( parentMenuId == -1 ) { // top-level menu
+ QMenuBar* mb = desktop->menuBar();
+ QMenuItem* mi = mb->findItem( pid );
+ if ( mi ) popup = mi->popup();
+ if ( !popup ) {
+ popup = new QPopupMenu( desktop );
+ ppos = checkInt( attribute( parentElement, "pos-id" ), -1, mb->count() );
+ menuId = mb->insertItem( plabel, popup, pid, ppos );
+ myCurrentMenu.push_back( QString::number( menuId ) );
+ myMenuItems.append( myCurrentMenu.join( ":" ) );
+ }
+ else {
+ menuId = pid;
+ myCurrentMenu.push_back( QString::number( menuId ) );
+ }
+ }
+ else {
+ // parentPopup should not be 0 here!
+ QMenuItem* mi = parentPopup->findItem( pid );
+ if ( mi ) popup = mi->popup();
+ if ( !popup ) {
+ popup = new QPopupMenu( desktop );
+ ppos = checkInt( attribute( parentElement, "pos-id" ), -1, popup->count() );
+ menuId = parentPopup->insertItem( plabel, popup, pid, ppos );
+ myCurrentMenu.push_back( QString::number( menuId ) );
+ myMenuItems.append( myCurrentMenu.join( ":" ) );
+ }
+ else {
+ menuId = pid;
+ myCurrentMenu.push_back( QString::number( menuId ) );
+ }
+ }
+ }
+ else { //!__CALL_OLD_METHODS__
+ menuId = myModule->createMenu( plabel, // label
+ parentMenuId, // parent menu ID, should be -1 for main menu
+ pid, // ID
+ group, // group ID
+ ppos, // position
+ true ); // create constant menu (not removed by clearMenu())
+ } // __CALL_OLD_METHODS__
QDomNode node = parentNode.firstChild();
while ( !node.isNull() ) {
if ( node.isElement() ) {
if ( aTagName == "popup-item" ) {
int id = checkInt( attribute( elem, "item-id" ) );
int pos = checkInt( attribute( elem, "pos-id" ) );
+ int group = checkInt( attribute( elem, "group-id" ),
+ myModule->defaultMenuGroup() );
QString label = attribute( elem, "label-id" );
QString icon = attribute( elem, "icon-id" );
QString tooltip = attribute( elem, "tooltip-id" );
// -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
// also check if the action with given ID is already created
- if ( id != -1 && !myModule->action( SALOME_PYQT_Module::PYQT_ACTION_MENU + id ) ) {
- // little trick to have several actions with same ID for menus and toolbars
- id = SALOME_PYQT_Module::PYQT_ACTION_MENU + id;
- // create menu action
- QAction* action = myModule->createAction( id, // ID
- tooltip, // tooltip
- icon, // icon
- label, // menu text
- tooltip, // status-bar text
- QKeySequence( accel ), // keyboard accelerator
- toggle ); // toogled action
- myModule->addAction( SALOME_PYQT_Module::PYQT_ACTION_MENU, action );
- myModule->createMenu( action, menuId, -1, 80, pos );
+ if ( id != -1 ) {
+ if ( IsCallOldMethods ) { // __CALL_OLD_METHODS__
+ QIconSet iconSet = myModule->loadIcon( icon );
+ pos = checkInt( attribute( elem, "pos-id" ), -1, popup->count() );
+ int aid = iconSet.isNull() ? popup->insertItem( label,
+ myModule,
+ SLOT( onGUIEvent(int) ),
+ QKeySequence( accel ),
+ id,
+ pos ) :
+ popup->insertItem( iconSet,
+ label,
+ myModule,
+ SLOT( onGUIEvent(int) ),
+ QKeySequence( accel ),
+ id,
+ pos );
+ myCurrentMenu.push_back( QString::number( aid ) );
+ myMenuItems.append( myCurrentMenu.join( ":" ) );
+ myCurrentMenu.pop_back();
+ if ( toggle )
+ popup->setItemChecked( aid, checkBool( attribute( elem, "toggle-id" ), 1 ) );
+ }
+ else { //!__CALL_OLD_METHODS__
+ // create menu action
+ QAction* action = myModule->createAction( id, // ID
+ tooltip, // tooltip
+ icon, // icon
+ label, // menu text
+ tooltip, // status-bar text
+ QKeySequence( accel ), // keyboard accelerator
+ toggle ); // toogled action
+ myModule->createMenu( action, // action
+ menuId, // parent menu ID
+ id, // ID (same as for createAction())
+ group, // group ID
+ pos, // position
+ true ); // create constant menu (not removed by clearMenu())
+ } // __CALL_OLD_METHODS__
}
}
else if ( aTagName == "submenu" ) {
// create sub-menu
- createMenu( node, menuId );
+ createMenu( node, menuId, popup );
}
else if ( aTagName == "separator" ) {
// create menu separator
- int pos = checkInt( attribute( elem, "pos-id" ) );
- QAction* action = myModule->createSeparator();
- myModule->createMenu( action, menuId, -1, 80, pos );
+ int id = checkInt( attribute( elem, "item-id" ) ); // separator can have ID
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ int group = checkInt( attribute( elem, "group-id" ),
+ myModule->defaultMenuGroup() );
+ if ( IsCallOldMethods ) { // __CALL_OLD_METHODS__
+ pos = checkInt( attribute( elem, "pos-id" ), -1, popup->count() );
+ int sid = popup->insertSeparator( pos );
+ myCurrentMenu.push_back( QString::number( sid ) );
+ myMenuItems.append( myCurrentMenu.join( ":" ) );
+ myCurrentMenu.pop_back();
+ }
+ else { //!__CALL_OLD_METHODS__
+ QAction* action = myModule->createSeparator();
+ myModule->createMenu( action, // separator action
+ menuId, // parent menu ID
+ id, // ID
+ group, // group ID
+ pos, // position
+ true ); // create constant menu (not removed by clearMenu())
+ } // __CALL_OLD_METHODS__
}
}
node = node.nextSibling();
}
+ myCurrentMenu.pop_back();
}
}
}
{
if ( !myModule )
return;
-
+
if ( parentNode.isNull() )
return;
- QDomElement parentElement = parentNode.toElement();
+ QDomElement parentElement = parentNode.toElement();
if ( !parentElement.isNull() ) {
QString aLabel = attribute( parentElement, "label-id" );
if ( !aLabel.isEmpty() ) {
// -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
// also check if the action with given ID is already created
- if ( id != -1 && !myModule->action( SALOME_PYQT_Module::PYQT_ACTION_TOOLBAL + id ) ) {
- // little trick to have several actions with same ID for menus and toolbars
- id = SALOME_PYQT_Module::PYQT_ACTION_TOOLBAL + id;
+ if ( id != -1 ) {
// create toolbar action
QAction* action = myModule->createAction( id, // ID
tooltip, // tooltip
tooltip, // status-bar text
QKeySequence( accel ), // keyboard accelerator
toggle ); // toogled action
- myModule->addAction( SALOME_PYQT_Module::PYQT_ACTION_TOOLBAL, action );
myModule->createTool( action, tbId, -1, pos );
}
}
- else if ( aTagName == "separatorTB" ) {
+ else if ( aTagName == "separatorTB" || aTagName == "separator" ) {
// create toolbar separator
int pos = checkInt( attribute( elem, "pos-id" ) );
QAction* action = myModule->createSeparator();
node = node.nextSibling();
}
}
- }
+ }
}
+/*!
+ * Fill popup menu with items
+ */
void SALOME_PYQT_XmlHandler::insertPopupItems( QDomNode& parentNode, QPopupMenu* menu )
{
if ( !myModule )
return;
-
+
if ( parentNode.isNull() )
return;
if ( !pixmap.isNull() )
anIcon = QIconSet( pixmap );
}
-
+
// -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
// also check if the action with given ID is already created
if ( id != -1 ) {
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//=============================================================================
-// File : SALOME_PYQT_Module.h
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#ifndef SALOME_PYQT_MODULE_H
#define SALOME_PYQT_MODULE_H
SALOME_PYQT_PyInterp* myInterp;
/* Python GUI module loaded */
PyObjWrapper myModule;
- /* Pytho GUI being initialized (not zero only during the initialization)*/
- static SALOME_PYQT_Module* myInitModule;
-
- typedef QPtrList<QAction> ActionList;
-
- /* own actions list */
- ActionList myMenuActionList;
- ActionList myPopupActionList;
- ActionList myToolbarActionList;
+ /* Python GUI being initialized (not zero only during the initialization)*/
+ static SALOME_PYQT_Module* myInitModule;
+
+ /* own menus list */
+ struct MenuId
+ {
+ int id;
+ bool constantMenu;
+ MenuId() : id( -1 ), constantMenu( false ) {}
+ MenuId( const int _id, const bool _constantMenu )
+ : id( _id ), constantMenu( _constantMenu ) {}
+ };
+ typedef QValueList<MenuId> MenuIdList;
+ typedef QMap<int,MenuIdList> MenuMap;
+ MenuMap myMenus;
- enum PyQtGUIAction { PYQT_ACTION_MENU = 10000000,
- PYQT_ACTION_TOOLBAL = 20000000,
- PYQT_ACTION_POPUP = 30000000 };
-
/* XML resource file parser */
SALOME_PYQT_XmlHandler* myXmlHandler;
/* windows map*/
/* called when study desktop is activated */
virtual void studyActivated();
+ /* returns default menu group */
+ static int defaultMenuGroup();
+
/* working with toolbars : open protected methods */
int createTool( const QString& );
int createTool( const int, const int, const int = -1 );
int createTool( QAction*, const QString&, const int = -1, const int = -1 );
/* working with menus : open protected methods */
- int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
- int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
- int createMenu( const int, const int, const int = -1, const int = -1 );
- int createMenu( const int, const QString&, const int = -1, const int = -1 );
- int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
- int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );
+ int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( const int, const int, const int = -1, const int = -1, const bool = false );
+ int createMenu( const int, const QString&, const int = -1, const int = -1, const bool = false );
+ int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
+
+ /* clear given menu */
+ bool clearMenu( const int = 0, const int = 0, const bool = true );
/* create separator : open protected method */
QAction* createSeparator();
int actionId( const QAction* ) const;
QAction* createAction( const int, const QString&, const QString&, const QString&,
const QString&, const int, const bool = false );
+ /* load icon from resource file */
+ QIconSet loadIcon( const QString& fileName );
+
+ /* Show/hide menus/toolbars */
+ void setMenuShown( const bool );
+ void setToolShown( const bool );
public slots:
/* activation */
void onGUIEvent();
void onGUIEvent( int );
+protected:
+ /* Menu processing */
+ bool hasMenu( const QString&, const int );
+ void registerMenu( const int, const int, const bool = false );
+ void unregisterMenu( const int, const int );
+ bool registered( const int, const int = 0 );
+ bool isConstantMenu( const int, const int );
+
+protected slots:
+ void onMenuHighlighted( int, int );
+
private:
/* internal initizalition */
void init ( CAM_Application* );
void activate ( SUIT_Study* );
/* internal deactivation */
void deactivate ( SUIT_Study* );
+ /* customization */
+ void customize ( SUIT_Study* );
/* study activation */
void studyChanged( SUIT_Study* );
/* context popup menu processing */
void contextMenu( const QString&, QPopupMenu* );
/* GUI event processing */
void guiEvent( const int );
-
- /* add action to the private action map */
- void addAction ( const PyQtGUIAction, QAction* );
+ /* Menu highlight processing */
+ void menuHighlight( const int, const int );
/* initialize a Python subinterpreter */
void initInterp ( int );
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : SALOME_PYQT_PyInterp.cxx
// Author : Christian CAREMOLI, Paul RASCLE, EDF
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//=============================================================================
-// File : SALOME_PYQT_PyInterp.h
-// Created : 25/04/05
-// Author : Christian CAREMOLI, Paul RASCLE, EDF
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#ifndef SALOME_PYQT_PYINTERP_H
#define SALOME_PYQT_PYINTERP_H
-# Copyright (C) 2003 CEA/DEN, EDF R&D
+# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.in
# Author : Nicolas REJNERI
# Module : SALOME
-# $Header$
top_srcdir=@top_srcdir@
top_builddir=../../..
LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl
# Compilation/linkage flags
-CPPFLAGS += $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS += $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H $(KERNEL_CXXFLAGS)
LIBS += $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS)
-LDFLAGS += -lsuit -lCAM -lstd -lqtx -lSalomeApp -lSalomeSession -lEvent -lLogWindow -lVTKViewer -lToolsGUI -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeDS -lSalomePyQtGUI
+LDFLAGS += -lsuit -lCAM -lstd -lqtx -lSalomeApp -lSalomeSession -lEvent -lLogWindow -lVTKViewer -lToolsGUI -lSalomePyQtGUI
# Custom build step: generate C++ wrapping according to $(SIP_FILES)
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//=============================================================================
-// File : SalomePyQt.cxx
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#include "SALOME_PYQT_Module.h" // this include must be first!!!
#include "SalomePyQt.h"
using namespace std;
-//====================================================================================
-// static functions
-//====================================================================================
/*!
- getApplication()
- Returns active application object [ static ]
+ \return active application object [ static ]
*/
static SalomeApp_Application* getApplication() {
if ( SUIT_Session::session() )
}
/*!
- getActiveStudy()
- Gets active study or 0 if there is no study opened [ static ]
+ \return active study or 0 if there is no study opened [ static ]
*/
static SalomeApp_Study* getActiveStudy()
{
return 0;
}
-//====================================================================================
-// SALOME_Selection class.
-//====================================================================================
static QMap<SalomeApp_Application*, SALOME_Selection*> SelMap;
/*!
- SALOME_Selection::GetSelection
Creates or finds the selection object (one per study).
*/
SALOME_Selection* SALOME_Selection::GetSelection( SalomeApp_Application* app )
}
/*!
- SALOME_Selection::SALOME_Selection
Selection constructor.
*/
SALOME_Selection::SALOME_Selection( QObject* p ) : QObject( p ), mySelMgr( 0 )
}
}
/*!
- SALOME_Selection::~SALOME_Selection
Selection destructor. Removes selection object from the map.
*/
SALOME_Selection::~SALOME_Selection()
}
/*!
- SALOME_Selection::onSelMgrDestroyed
Watches for the selection manager destroying when study is closed.
*/
void SALOME_Selection::onSelMgrDestroyed()
}
/*!
- SALOME_Selection::Clear
Clears the selection.
*/
void SALOME_Selection::Clear()
}
/*!
- SALOME_Selection::ClearIObjects
Clears the selection.
*/
void SALOME_Selection::ClearIObjects()
}
/*!
- SALOME_Selection::ClearFilters
Removes all selection filters.
*/
void SALOME_Selection::ClearFilters()
ProcessVoidEvent( new TEvent( mySelMgr ) );
}
-//====================================================================================
-// SalomePyQt class
-//====================================================================================
-
/*!
- SalomePyQt::getDesktop
- Gets desktop. Returns 0 in error.
+ \return desktop (0 if error)
*/
class TGetDesktopEvent: public SALOME_Event {
public:
myResult = (QWidget*)( getApplication()->desktop() );
}
};
+
+/*!
+ \return desktop
+*/
QWidget* SalomePyQt::getDesktop()
{
return ProcessEvent( new TGetDesktopEvent() );
}
/*!
- SalomePyQt::getMainFrame
- Gets workspace widget. Returns 0 in error.
+ \return workspace widget (0 if error)
*/
class TGetMainFrameEvent: public SALOME_Event {
public:
}
}
};
+
+/*!
+ \return workspace widget (0 if error)
+*/
QWidget* SalomePyQt::getMainFrame()
{
return ProcessEvent( new TGetMainFrameEvent() );
}
}
};
+
+/*!
+ \return main menu
+ \retval 0 in error.
+*/
QMenuBar* SalomePyQt::getMainMenuBar()
{
return ProcessEvent( new TGetMainMenuBarEvent() );
}
}
};
+
+/*!
+ \return popup menu
+ \param menu - menu name
+*/
QPopupMenu* SalomePyQt::getPopupMenu( const MenuName menu )
{
return ProcessEvent( new TGetPopupMenuEvent( menu ) );
}
}
};
+
+/*!
+ SalomePyQt::getStudyId
+ Returns active study's ID or 0 if there is no active study.
+*/
int SalomePyQt::getStudyId()
{
return ProcessEvent( new TGetStudyIdEvent() );
myResult = SALOME_Selection::GetSelection( getApplication() );
}
};
+
+/*!
+ Creates a Selection object (to provide a compatibility with previous SALOME GUI).
+ \return just created selection object
+*/
SALOME_Selection* SalomePyQt::getSelection()
{
return ProcessEvent( new TGetSelectionEvent() );
}
}
};
+
+/*!
+ Puts an information message to the desktop's status bar
+ (with optional delay parameter given in seconds)
+ \param msg - message text
+ \param sec - delay in seconds
+*/
void SalomePyQt::putInfo( const QString& msg, const int sec )
{
ProcessVoidEvent( new TPutInfoEvent( msg, sec ) );
}
}
};
+
+/*!
+ \return an active component name or empty string if there is no active component
+*/
const QString SalomePyQt::getActiveComponent()
{
return ProcessEvent( new TGetActiveComponentEvent() );
}
}
};
+
+/*!
+ \return a setting value (as string)
+ This function is obsolete. Use stringSetting(), integerSetting(),
+ boolSetting(), stringSetting() or colorSetting() instead.
+*/
QString SalomePyQt::getSetting( const QString& name )
{
return ProcessEvent( new TGetSettingEvent( name ) );
}
}
};
+
+/*!
+ \return an integer setting from the application preferences
+*/
int SalomePyQt::integerSetting( const QString& section, const QString& name, const int def )
{
return ProcessEvent( new TGetIntSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return an double setting from the application preferences
+*/
double SalomePyQt::doubleSetting( const QString& section, const QString& name, const int def )
{
return ProcessEvent( new TGetDblSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return an boolean setting from the application preferences
+*/
bool SalomePyQt::boolSetting( const QString& section, const QString& name, const bool def )
{
return ProcessEvent( new TGetBoolSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return an string setting from the application preferences
+*/
QString SalomePyQt::stringSetting( const QString& section, const QString& name, const QString& def )
{
return ProcessEvent( new TGetStrSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return a color setting from the application preferences
+*/
QColor SalomePyQt::colorSetting ( const QString& section, const QString& name, const QColor& def )
{
return ProcessEvent( new TGetColorSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ Displays 'Open/Save file' dialog box and returns a user's choice (file name)
+*/
QString SalomePyQt::getFileName( QWidget* parent,
const QString& initial,
const QStringList& filters,
}
}
};
+
+/*!
+ Displays 'Open files' dialog box and returns a user's choice (a list of file names)
+*/
QStringList SalomePyQt::getOpenFileNames( QWidget* parent,
const QString& initial,
const QStringList& filters,
}
}
};
+
+/*!
+ Displays 'Get Directory' dialog box and returns a user's choice (a directory name)
+*/
QString SalomePyQt::getExistingDirectory( QWidget* parent,
const QString& initial,
const QString& caption )
}
}
};
+
+/*!
+ Dumps the contents of the currently active view to the image file
+ in the given format (JPEG, PNG, BMP are supported)
+*/
bool SalomePyQt::dumpView( const QString& filename )
{
return ProcessEvent( new TDumpViewEvent( filename ) );
}
+/*!
+ SalomePyQt::defaultMenuGroup
+ Returns default menu group
+*/
+class TDefMenuGroupEvent: public SALOME_Event {
+public:
+ typedef int TResult;
+ TResult myResult;
+ TDefMenuGroupEvent() : myResult( -1 ) {}
+ virtual void Execute() {
+ myResult = SALOME_PYQT_Module::defaultMenuGroup();
+ }
+};
+
+/*!
+ \return default menu group
+*/
+int SalomePyQt::defaultMenuGroup()
+{
+ return ProcessEvent( new TDefMenuGroupEvent() );
+}
+
/*!
SalomePyQt::createTool
These methods allow operating with the toolbars:
}
}
};
-// create new toolbar or get existing by name
+
+/*!
+ create new toolbar or get existing by name
+*/
int SalomePyQt::createTool( const QString& tBar )
{
return ProcessEvent( new TCreateToolEvent( CrTool( tBar ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( const int id, const int tBar, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( id, tBar, idx ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( const int id, const QString& tBar, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( id, tBar, idx ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( QtxAction* a, const int tBar, const int id, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( QtxAction* a, const QString& tBar, const int id, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) );
class CrMenu
{
public:
- CrMenu( const QString& subMenu, const int menu, const int group, const int idx )
- : myCase( 0 ), mySubMenuName( subMenu ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {}
- CrMenu( const QString& subMenu, const QString& menu, const int group, const int idx )
- : myCase( 1 ), mySubMenuName( subMenu ), myMenuName( menu ), myGroup( group ), myIndex( idx ) {}
+ CrMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx )
+ : myCase( 0 ), mySubMenuName( subMenu ), myMenuId( menu ), myId( id ), myGroup( group ), myIndex( idx ) {}
+ CrMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx )
+ : myCase( 1 ), mySubMenuName( subMenu ), myMenuName( menu ), myId( id ), myGroup( group ), myIndex( idx ) {}
CrMenu( const int id, const int menu, const int group, const int idx )
: myCase( 2 ), myId( id ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {}
CrMenu( const int id, const QString& menu, const int group, const int idx )
if ( module ) {
switch ( myCase ) {
case 0:
- return module->createMenu( mySubMenuName, myMenuId, -1, myGroup, myIndex );
+ return module->createMenu( mySubMenuName, myMenuId, myId, myGroup, myIndex );
case 1:
- return module->createMenu( mySubMenuName, myMenuName, -1, myGroup, myIndex );
+ return module->createMenu( mySubMenuName, myMenuName, myId, myGroup, myIndex );
case 2:
return module->createMenu( myId, myMenuId, myGroup, myIndex );
case 3:
}
}
};
-int SalomePyQt::createMenu( const QString& subMenu, const int menu, const int group, const int idx )
+int SalomePyQt::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx )
{
- return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, group, idx ) ) );
+ return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) );
}
-int SalomePyQt::createMenu( const QString& subMenu, const QString& menu, const int group, const int idx )
+int SalomePyQt::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx )
{
- return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, group, idx ) ) );
+ return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) );
}
int SalomePyQt::createMenu( const int id, const int menu, const int group, const int idx )
{
return ProcessEvent( new TActionIdEvent( a ) );
}
+
+/*!
+ SalomePyQt::clearMenu
+ Clears given menu (recursively if necessary)
+*/
+class TClearMenuEvent: public SALOME_Event {
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myId;
+ int myMenu;
+ bool myRemoveActions;
+ TClearMenuEvent( const int id, const int menu, const bool removeActions )
+ : myResult( false ), myId( id ), myMenu( menu ), myRemoveActions( removeActions ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SALOME_PYQT_Module* module = SALOME_PYQT_Module::getInitModule();
+ if ( !module )
+ module = dynamic_cast<SALOME_PYQT_Module*>( anApp->activeModule() );
+ if ( module )
+ myResult = module->clearMenu( myId, myMenu, myRemoveActions );
+ }
+ }
+};
+bool SalomePyQt::clearMenu( const int id, const int menu, const bool removeActions )
+{
+ return ProcessEvent( new TClearMenuEvent( id, menu, removeActions ) );
+}
+
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//=============================================================================
-// File : SalomePyQt.h
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#ifndef SALOME_PYQT_H
#define SALOME_PYQT_H
static bool dumpView( const QString& );
+ static int defaultMenuGroup();
+
static int createTool( const QString& );
static int createTool( const int, const int, const int = -1 );
static int createTool( const int, const QString&, const int = -1 );
static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 );
static int createMenu( const QString&, const int = -1,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const QString&, const QString& = QString::null,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const int, const int = -1,
const int = -1, const int = -1 );
static int createMenu( const int, const QString& = QString::null,
static QtxAction* action( const int );
static int actionId( const QtxAction* );
+ static bool clearMenu( const int = 0, const int = 0,
+ const bool = true );
+
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int );
static void addSetting ( const QString&, const QString&, const QString& );
Help = 7
};
-enum {
+enum WindowType {
WT_ObjectBrowser,
WT_PyConsole,
WT_LogWindow,
static bool dumpView( const QString& );
+ static int defaultMenuGroup();
+
static int createTool( const QString& );
static int createTool( const int, const int, int = -1 );
static int createTool( const int, const QString&, int = -1 );
static int createTool( QtxAction*, const QString&, int = -1, int = -1 );
static int createMenu( const QString&, const int,
- int = -1, int = -1 );
+ int = -1, int = -1, int = -1 );
static int createMenu( const QString&, const QString&,
- int = -1, int = -1 );
+ int = -1, int = -1, int = -1 );
static int createMenu( const int, const int,
int = -1, int = -1 );
static int createMenu( const int, const QString&,
static QtxAction* action( const int );
static int actionId( const QtxAction* );
+ static bool clearMenu( int = 0, int = 0,
+ bool = true );
+
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int /Constrained/ );
static void addSetting ( const QString&, const QString&, const QString& );
static void addSetting ( const QString&, const QString&, const QColor& );
static int integerSetting( const QString&, const QString&, int = 0 );
static double doubleSetting ( const QString&, const QString&, int = 0 );
- static bool boolSetting ( const QString&, const QString&, bool = 0 );
+ static bool boolSetting ( const QString&, const QString&, bool = false );
static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
static void removeSetting ( const QString&, const QString& );
Help = 7
};
-enum {
+enum WindowType {
WT_ObjectBrowser,
WT_PyConsole,
WT_LogWindow,
static void updateObjBrowser( const int = 0, bool = true );
static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
- static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& );
- static QString getExistingDirectory( QWidget*, const QString&, const QString& );
+ static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
+ static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
static void helpContext( const QString&, const QString& );
static bool dumpView( const QString& );
+ static int defaultMenuGroup();
+
static int createTool( const QString& );
static int createTool( const int, const int, const int = -1 );
static int createTool( const int, const QString&, const int = -1 );
static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 );
static int createMenu( const QString&, const int,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const QString&, const QString&,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const int, const int,
const int = -1, const int = -1 );
static int createMenu( const int, const QString&,
const int = -1, const int = -1 );
static int createMenu( QtxAction*, const QString&, const int = -1,
const int = -1, const int = -1 );
-
static QtxAction* createSeparator();
static QtxAction* createAction( const int, const QString&,
static QtxAction* action( const int );
static int actionId( const QtxAction* );
+ static bool clearMenu( const int = 0, const int = 0,
+ const bool = true );
+
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int /Constrained/ );
static void addSetting ( const QString&, const QString&, const QString& );
static void addSetting ( const QString&, const QString&, const QColor& );
static int integerSetting( const QString&, const QString&, const int = 0 );
static double doubleSetting ( const QString&, const QString&, const int = 0 );
- static bool boolSetting ( const QString&, const QString&, const bool = 0 );
+ static bool boolSetting ( const QString&, const QString&, const bool = false );
static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
static void removeSetting ( const QString&, const QString& );
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
SALOME_GenericObj.idl
SWIG_DEF = libSALOME_Swig.i
-EXPORT_PYSCRIPTS = libSALOME_Swig.py Help.py PyInterp.py examplevtk1.py supervisionexample.py supervisiongeomexample.py test_table.py test_big_table.py test_many_objects.py salome_test.py test_remove_ref.py
+EXPORT_PYSCRIPTS = libSALOME_Swig.py examplevtk1.py supervisionexample.py supervisiongeomexample.py test_table.py test_big_table.py test_many_objects.py test_remove_ref.py
EXPORT_SHAREDPYSCRIPTS=SALOMEGUI_shared_modules.py
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H $(KERNEL_CXXFLAGS)
LIBS+= $(PYTHON_LIBS)
LDFLAGS+= -lSalomeApp
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
-//////////////////////////////////////////////////////////////////////////////
-// asv : 3.12.04 : added checking for NULL GUI objects in almost all methods.
-// In the scope of fixing bug PAL6869.
-//////////////////////////////////////////////////////////////////////////////
-// (PR : modify comments)
-// Instance of this class is created every time "import salome" line is typed
-// - in IAPP embedded Python interpretor (SALOME_Session_Server executable),
-// - in inline Python nodes in Supervisor (in SALOME_Container executable),
-// - in stand-alone Python console outside any executable.
-// SALOME GUI(desktop and other objects) is only available in SALOME_Session_Server
-//////////////////////////////////////////////////////////////////////////////
-// VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
-// All methods are implemeted using Event mechanism.
-// Display/Erase methods use SALOME_Prs/SALOME_View mechanism. It is currently
-// implemented only for OCC and VTK viewers.
-//////////////////////////////////////////////////////////////////////////////
+/*!
+ asv : 3.12.04 : added checking for NULL GUI objects in almost all methods.
+ In the scope of fixing bug PAL6869.
+
+ (PR : modify comments)
+ Instance of this class is created every time "import salome" line is typed
+ - in IAPP embedded Python interpretor (SALOME_Session_Server executable),
+ - in inline Python nodes in Supervisor (in SALOME_Container executable),
+ - in stand-alone Python console outside any executable.
+ SALOME GUI(desktop and other objects) is only available in SALOME_Session_Server
+
+ VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
+ All methods are implemeted using Event mechanism.
+ Display/Erase methods use SALOME_Prs/SALOME_View mechanism. It is currently
+ implemented only for OCC and VTK viewers.
+*/
/*!
getApplication()
myResult = (bool)( getApplication() && getApplication()->desktop() );
}
};
+
+/*!
+ \return true if GUI is available.
+*/
bool SALOMEGUI_Swig::hasDesktop()
{
return ProcessEvent( new THasDesktopEvent() );
}
}
};
+
+/*!
+ \return active study's ID or 0 if there is no active study.
+*/
int SALOMEGUI_Swig::getActiveStudyId()
{
return ProcessEvent( new TGetActiveStudyIdEvent() );
}
}
};
+
+/*!
+ \return active study's name or NULL if there is no active study.
+*/
const char* SALOMEGUI_Swig::getActiveStudyName()
{
string result = ProcessEvent( new TGetActiveStudyNameEvent() );
SALOMEGUI_Swig::getComponentName
Returns the name of the component by its user name.
*/
+class TGetModulCatalogEvent: public SALOME_Event {
+public:
+ typedef CORBA::Object_var TResult;
+ TResult myResult;
+ TGetModulCatalogEvent() : myResult(CORBA::Object::_nil()) {}
+ virtual void Execute() {
+ if (SalomeApp_Application* anApp = getApplication())
+ myResult = anApp->namingService()->Resolve("/Kernel/ModulCatalog");
+ }
+};
+
+/*!
+ \return the name of the component by its user name.
+*/
const char* SALOMEGUI_Swig::getComponentName( const char* componentUserName )
{
- if ( SalomeApp_Application* anApp = getApplication() ) {
- CORBA::Object_var anObject = anApp->namingService()->Resolve("/Kernel/ModulCatalog");
- if ( !CORBA::is_nil( anObject ) ) {
- SALOME_ModuleCatalog::ModuleCatalog_var aCatalogue =
- SALOME_ModuleCatalog::ModuleCatalog::_narrow( anObject );
- SALOME_ModuleCatalog::ListOfIAPP_Affich_var aModules = aCatalogue->GetComponentIconeList();
- for ( unsigned int ind = 0; ind < aModules->length(); ind++ ) {
- CORBA::String_var aModuleName = aModules[ ind ].modulename;
- CORBA::String_var aModuleUserName = aModules[ ind ].moduleusername;
- if ( strcmp(componentUserName, aModuleUserName.in()) == 0 )
- return aModuleName._retn();
- }
+ CORBA::Object_var anObject = ProcessEvent(new TGetModulCatalogEvent());
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_ModuleCatalog::ModuleCatalog_var aCatalogue =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow( anObject );
+ SALOME_ModuleCatalog::ListOfIAPP_Affich_var aModules = aCatalogue->GetComponentIconeList();
+ for ( unsigned int ind = 0; ind < aModules->length(); ind++ ) {
+ CORBA::String_var aModuleName = aModules[ ind ].modulename;
+ CORBA::String_var aModuleUserName = aModules[ ind ].moduleusername;
+ if ( strcmp(componentUserName, aModuleUserName.in()) == 0 )
+ return aModuleName._retn();
}
}
return 0;
*/
const char* SALOMEGUI_Swig::getComponentUserName( const char* componentName )
{
- if ( SalomeApp_Application* anApp = getApplication() ) {
- CORBA::Object_var anObject = anApp->namingService()->Resolve("/Kernel/ModulCatalog");
- if ( !CORBA::is_nil( anObject ) ) {
- SALOME_ModuleCatalog::ModuleCatalog_var aCatalogue =
- SALOME_ModuleCatalog::ModuleCatalog::_narrow( anObject );
- SALOME_ModuleCatalog::ListOfIAPP_Affich_var aModules = aCatalogue->GetComponentIconeList();
- for ( unsigned int ind = 0; ind < aModules->length(); ind++ ) {
- CORBA::String_var aModuleName = aModules[ ind ].modulename;
- CORBA::String_var aModuleUserName = aModules[ ind ].moduleusername;
- if ( strcmp(componentName, aModuleName.in()) == 0 )
- return aModuleUserName._retn();
- }
+ CORBA::Object_var anObject = ProcessEvent(new TGetModulCatalogEvent());
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_ModuleCatalog::ModuleCatalog_var aCatalogue =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow( anObject );
+ SALOME_ModuleCatalog::ListOfIAPP_Affich_var aModules = aCatalogue->GetComponentIconeList();
+ for ( unsigned int ind = 0; ind < aModules->length(); ind++ ) {
+ CORBA::String_var aModuleName = aModules[ ind ].modulename;
+ CORBA::String_var aModuleUserName = aModules[ ind ].moduleusername;
+ if ( strcmp(componentName, aModuleName.in()) == 0 )
+ return aModuleUserName._retn();
}
}
return 0;
}
}
};
+
+/*!
+ \return the number of selected objects.
+*/
int SALOMEGUI_Swig::SelectedCount()
{
return ProcessEvent( new TSelectedCountEvent() );
}
}
};
+
+/*!
+ \return the selected object entry by the given index.
+*/
const char* SALOMEGUI_Swig::getSelected( int index )
{
QString result = ProcessEvent( new TGetSelectedEvent( index ) );
}
}
};
+
+/*!
+ \return TRUE if the object with given entry is in the current viewer.
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
bool SALOMEGUI_Swig::IsInCurrentView( const char* theEntry )
{
return ProcessEvent( new TIsInViewerEvent( theEntry ) );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
"""
"""
import SALOME_Session_idl
+from import_hook import register_name
+register_name("SalomePyQt")
+
# this function is required
def init_shared_modules():
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
+++ /dev/null
-# SALOME SALOME_SWIG : binding of C++ implementation and Python
-#
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : salome_test.py
-# Module : SALOME
-
-print "Test the application loading GEOM, SMESH, VISU, MED, components and doing some"
-print "operation within the components."
-
-import salome
-from salome import sg
-import SALOMEDS
-import os
-
-import SALOME_ModuleCatalog
-
-print "======================================================================"
-print " Get Catalog "
-print "======================================================================"
-obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
-catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
-
-print "======================================================================"
-print " Create Study "
-print "======================================================================"
-
-comp = catalog.GetComponent("GEOM")
-if comp is None:
- raise RuntimeError,"Component GEOM not found in Module Catalog."
-
-import geompy
-
-print "================================="
-print " create AttributeReal "
-print "================================="
-A = geompy.myBuilder.FindOrCreateAttribute(geompy.father, "AttributeReal")
-if A == None :
- raise RuntimeError, "Can't create AttributeReal attribute"
-A = A._narrow(SALOMEDS.AttributeReal)
-A.SetValue(0.0001)
-if A.Value() != 0.0001:
- raise RuntimeError, "Error : wrong value of AttributeReal"
-
-print
-print " =========== Test Geometry =========================="
-print
-
-print "==================================="
-print " define a box"
-print "==================================="
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
-
-print
-print "============= Test SMESH ============================="
-print
-
-import StdMeshers
-
-comp = catalog.GetComponent("SMESH")
-if comp is None:
- raise RuntimeError,"Component SMESH not found in Module Catalog."
-
-comp = catalog.GetComponent("MED")
-if comp is None:
- raise RuntimeError,"Component MED not found in Module Catalog."
-
-import SMESH
-
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-myBuilder = salome.myStudy.NewBuilder()
-
-smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId);
-
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
-
-# ---- add first face of box in study
-
-subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
-face=subShapeList[0]
-name = geompy.SubShapeName(face, box)
-print name
-idface=geompy.addToStudyInFather(box,face,name)
-
-# ---- add shell from box in study
-
-subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
-shell = subShellList[0]
-name = geompy.SubShapeName(shell, box)
-print name
-idshell=geompy.addToStudyInFather(box,shell,name)
-
-# ---- add first edge of face in study
-
-edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
-edge=edgeList[0];
-name = geompy.SubShapeName(edge, face)
-print name
-idedge=geompy.addToStudyInFather(face,edge,name)
-
-
-# ---- SMESH
-
-# ---- create Hypothesis
-
-print "-------------------------- create Hypothesis"
-print "-------------------------- LocalLength"
-hypLen1 = smesh.CreateHypothesis( "LocalLength", "libStdMeshersEngine.so" )
-hypLen1.SetLength(100)
-print hypLen1.GetName()
-print hypLen1.GetId()
-print hypLen1.GetLength()
-
-smeshgui.SetName(salome.ObjectToID(hypLen1), "Local_Length_100")
-
-print "-------------------------- NumberOfSegments"
-hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" )
-hypNbSeg1.SetNumberOfSegments(7)
-print hypNbSeg1.GetName()
-print hypNbSeg1.GetId()
-print hypNbSeg1.GetNumberOfSegments()
-
-smeshgui.SetName(salome.ObjectToID(hypNbSeg1), "NumberOfSegments_7")
-
-print "-------------------------- MaxElementArea"
-hypArea1 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
-hypArea1.SetMaxElementArea(2500)
-print hypArea1.GetName()
-print hypArea1.GetId()
-print hypArea1.GetMaxElementArea()
-
-smeshgui.SetName(salome.ObjectToID(hypArea1), "MaxElementArea_2500")
-
-print "-------------------------- MaxElementArea"
-hypArea2 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
-hypArea2.SetMaxElementArea(500)
-print hypArea2.GetName()
-print hypArea2.GetId()
-print hypArea2.GetMaxElementArea()
-
-smeshgui.SetName(salome.ObjectToID(hypArea2), "MaxElementArea_500")
-
-print "-------------------------- Regular_1D"
-algoReg = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" )
-listHyp=algoReg.GetCompatibleHypothesis()
-for hyp in listHyp:
- print hyp
-print algoReg.GetName()
-print algoReg.GetId()
-
-smeshgui.SetName(salome.ObjectToID(algoReg), "Regular_1D" )
-
-print "-------------------------- MEFISTO_2D"
-algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" )
-listHyp=algoMef.GetCompatibleHypothesis()
-for hyp in listHyp:
- print hyp
-print algoMef.GetName()
-print algoMef.GetId()
-
-smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D" )
-
-# ---- add hypothesis to box
-
-print "-------------------------- add hypothesis to box"
-box=salome.IDToObject(idbox)
-mesh = smesh.CreateMesh(box)
-
-smeshgui.SetName( salome.ObjectToID(mesh), "MeshBox" );
-
-ret=mesh.AddHypothesis(box,algoReg)
-print ret
-ret=mesh.AddHypothesis(box,algoMef)
-print ret
-
-
-ret=mesh.AddHypothesis(box,hypNbSeg1)
-print ret
-ret=mesh.AddHypothesis(box,hypArea1)
-print ret
-
-
-# ---- add hypothesis to edge
-
-print "-------------------------- add hypothesis to edge"
-edge=salome.IDToObject(idedge)
-submesh=mesh.GetSubMesh(edge, "SubMeshEdge")
-
-ret=mesh.AddHypothesis(edge,algoReg)
-print ret
-ret=mesh.AddHypothesis(edge,hypLen1)
-print ret
-
-print "-------------------------- add hypothesis to face"
-face=salome.IDToObject(idface)
-submesh = mesh.GetSubMesh(face, "SubMeshFace")
-
-ret=mesh.AddHypothesis(face,hypArea2)
-print ret
-
-smesh.Compute(mesh, box)
-sg.updateObjBrowser(1);
-
-print
-print "============= Test Supervisor ============================="
-print
-
-comp = catalog.GetComponent("SUPERV")
-if comp is None:
- raise RuntimeError,"Component SUPERV not found in Module Catalog."
-
-from SuperV import *
-import SALOMEDS
-myStudy = salome.myStudy
-myBuilder = myStudy.NewBuilder()
-
-SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV")
-father = myStudy.FindComponent("SUPERV")
-if father is None:
- father = myBuilder.NewComponent("SUPERV")
- A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
- FName = A1._narrow(SALOMEDS.AttributeName)
- FName.SetValue( salome.sg.getComponentUserName("SUPERV") )
- A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap");
- aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
- aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" );
- myBuilder.DefineComponentInstance(father,SuperVision)
-
-def addStudy(ior):
- dataflow = SuperVision.getStreamGraph(ior)
- name=dataflow.Name()
- itr = myStudy.NewChildIterator(father)
- while itr.More():
- item=itr.Value()
- res,A=item.FindAttribute("AttributeName")
- if res:
- aName = A._narrow(SALOMEDS.AttributeName)
- if aName.Value() == name :
- print myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
- A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
- print "A = ", A
- if A is not None :
- #res,A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
- anIOR = A._narrow(SALOMEDS.AttributeIOR);
- print "anIOR.SetValue(dataflow.getIOR())"
- anIOR.SetValue(dataflow.getIOR())
- return
- itr.Next()
- obj = myBuilder.NewObject(father)
- A=myBuilder.FindOrCreateAttribute(obj, "AttributeName")
- aName=A._narrow(SALOMEDS.AttributeName)
- aName.SetValue(name)
- A=myBuilder.FindOrCreateAttribute(obj, "AttributeIOR")
- anIOR = A._narrow(SALOMEDS.AttributeIOR)
- anIOR.SetValue(dataflow.getIOR())
-
-import os
-dir= os.getenv("DATA_DIR")
-if dir == None:
- raise RuntimeError, "DATA_DIR is not defined"
-xmlfile = dir +"/Superv/Graphs/GraphGeomEssai.xml"
-print "Load dataflow from the file : "
-print xmlfile
-print
-
-myGraph = StreamGraph ( xmlfile )
-
-# This DataFlow is "valid" : no loop, correct links between Nodes etc...
-print "myGraph.IsValid() = ", myGraph.IsValid()
-
-# Get Nodes
-myGraph.PrintNodes()
-
-# This DataFlow is "executable" : all pending Ports are defined with Datas
-print myGraph.IsExecutable()
-
-# Starts only execution of that DataFlow and gets control immediatly
-print myGraph.Run()
-
-# That DataFlow is running ==> 0 (false)
-print myGraph.IsDone()
-
-# Events of execution :
-aStatus,aNode,anEvent,aState = myGraph.Event()
-while aStatus :
- print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
- aStatus,aNode,anEvent,aState = myGraph.Event()
-print "myGraph.IsDone() = ",myGraph.IsDone()
-
-# Wait for Completion (but it is already done after event loop ...)
-print "Done : ",myGraph.DoneW()
-
-print " "
-#print "Type : print myGraph.IsDone()"
-#print " If execution is finished ==> 1 (true)"
-res=myGraph.IsDone()
-if res != 1:
- raise RuntimeError, "myGraph.Run() is not done"
-
-print " "
-print "Type : myGraph.PrintPorts()"
-print " to see input and output values of the graph"
-myGraph.PrintPorts()
-
-# Export will create newsupervisionexample.xml and the corresponding .py file
-tmpdir=os.getenv("TmpDir")
-if tmpdir is None:
- tmpdir="/tmp"
-file = tmpdir + "/newsupervisionexample"
-print "--------------\n"+file+"\n--------------\n"
-myGraph.Export(file)
-
-ior = salome.orb.object_to_string(myGraph.G)
-addStudy(ior)
-
-GraphName = myGraph.Name()
-print "Befor save ",
-#nodes = myGraph.Nodes()
-nodes = myGraph.G.Nodes().FNodes
-length_bs = len(nodes)
-print "ListOfNodes length = ", length_bs
-names=[]
-for node in nodes:
- names.append(node.Name())
-print names
-
-# Graph creation
-GraphInLines = StreamGraph( 'GraphInLines' )
-GraphInLines.SetName( 'GraphInLines' )
-GraphInLines.SetAuthor( '' )
-GraphInLines.SetComment( '' )
-GraphInLines.Coords( 0 , 0 )
-
-# Creation of InLine Nodes
-PyAdd = []
-PyAdd.append( 'def Add(a,b) : ' )
-PyAdd.append( ' return a+b ' )
-PyAdd.append( '' )
-Add = GraphInLines.INode( 'Add' , PyAdd )
-Add.InPort( 'a' , 'long' )
-Add.InPort( 'b' , 'long' )
-Add.OutPort( 'f' , 'long' )
-Add.SetName( 'Add' )
-Add.SetAuthor( '' )
-Add.SetComment( 'Python function' )
-Add.Coords( 351 , 77 )
-PySub = []
-PySub.append( 'def Sub(a,b) : ' )
-PySub.append( ' return a-b ' )
-PySub.append( '' )
-Sub = GraphInLines.INode( 'Sub' , PySub )
-Sub.InPort( 'a' , 'long' )
-Sub.InPort( 'b' , 'long' )
-Sub.OutPort( 'f' , 'long' )
-Sub.SetName( 'Sub' )
-Sub.SetAuthor( '' )
-Sub.SetComment( 'Python function' )
-Sub.Coords( 86 , 333 )
-PyMul = []
-PyMul.append( 'def Mul(a,b) : ' )
-PyMul.append( ' return a*b ' )
-Mul = GraphInLines.INode( 'Mul' , PyMul )
-Mul.InPort( 'a' , 'long' )
-Mul.InPort( 'b' , 'long' )
-Mul.OutPort( 'Result' , 'long' )
-Mul.SetName( 'Mul' )
-Mul.SetAuthor( '' )
-Mul.SetComment( 'Python function' )
-Mul.Coords( 616 , 247 )
-
-# Creation of intermediate Output variables and of Control Links
-Addf = Add.Port( 'f' )
-Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) )
-Mula.AddCoord( 1 , 570 , 356 )
-Mula.AddCoord( 2 , 570 , 186 )
-Subf = Sub.Port( 'f' )
-Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) )
-Mulb.AddCoord( 1 , 282 , 376 )
-Mulb.AddCoord( 2 , 282 , 442 )
-Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) )
-Addb.AddCoord( 1 , 283 , 209 )
-Addb.AddCoord( 2 , 283 , 374 )
-Addb.AddCoord( 3 , 283 , 442 )
-
-# Creation of Input datas
-Adda = Add.Input( 'a' , 1)
-Suba = Sub.Input( 'a' , 3)
-Subb = Sub.Input( 'b' , 4)
-
-# Creation of Output variables
-MulResult = Mul.Port( 'Result' )
-
-GraphInLines.Run()
-
-GraphInLines.DoneW()
-
-GraphInLines.PrintPorts()
-
-sg.updateObjBrowser(1);
-
-print
-print "============= Test VISU and MED ============================="
-print
-
-comp = catalog.GetComponent("VISU")
-if comp is None:
- raise RuntimeError,"Component VISU not found in Module Catalog."
-
-import sys
-import SALOMEDS
-import SALOME
-import SALOME_MED
-import VISU
-
-import visu_gui
-
-medFileName = "pointe.med"
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
-print "Load ", medFile
-
-studyCurrent = salome.myStudyName
-
-med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
-
-try:
- if os.access(medFile, os.R_OK) :
- if not os.access(medFile, os.W_OK) :
- import random
- medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medFileName
- print " -- Copy " + medFile + " to " + medFileNew
- os.system("cp "+ medFile + " " + medFileNew)
- medFile = medFileNew
- os.system("chmod 755 " + medFile)
-
- if os.access(medFile, os.W_OK) :
- med_comp.readStructFileWithFieldType(medFile,studyCurrent)
- med_obj = visu_gui.visu.getMedObjectFromStudy()
- print "med_obj - ", med_obj
-
- myField1 = visu_gui.visu.getFieldObjectFromStudy(2,1)
- aMeshName = "maa1"
- anEntity = VISU.NODE
- aTimeStampId = -1
-
- myResult1 = myVisu.ImportMedField(myField1)
- aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity);
-
- aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField1.getName(), aTimeStampId)
-
- myResult2 = myVisu.ImportFile(medFile);
- aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity);
-
- aTimeStampId = 3
- aScalarMap2= myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField1.getName(), aTimeStampId)
-
- sg.updateObjBrowser(0)
- else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file";
- else : print "We have no permission to read medFile, it will not be opened";
-
-except:
- if sys.exc_type == SALOME.SALOME_Exception :
- print "There is no permission to read " + medFile
- else :
- print sys.exc_type
- print sys.exc_value
- print sys.exc_traceback
-
-sg.updateObjBrowser(1);
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
#==============================================================================
# File : supervisionexample.py
# Created : 23 nov 2001
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# Generated python file of Graph GraphGeom2Essai
-# Copyright (C) 2003 CEA/DEN, EDF R&D
+# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : test_big_table.py
# Author : Vadim SANDLER
-# Copyright (C) 2003 CEA/DEN, EDF R&D
+# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : visu_many_objects.py
# Author : Vadim SANDLER
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
-# Copyright (C) 2003 CEA/DEN, EDF R&D
+# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : test_table.py
# Author : Vadim SANDLER
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Alexander Solovyov(OCN)
# Module : SOCC
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifdef WNT
#ifdef SOCC_EXPORTS
// 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.salome-platform.org or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SOCC_Prs.h"
using namespace std;
-//==========================================================
/*!
- * SOCC_Prs::SOCC_Prs
- * Default constructor
- */
-//==========================================================
+ Default constructor
+*/
SOCC_Prs::SOCC_Prs()
{
myToActivate = true;
}
-//==========================================================
/*!
- * SOCC_Prs::SOCC_Prs
- * Standard constructor
- */
-//==========================================================
+ Standard constructor
+*/
SOCC_Prs::SOCC_Prs( const Handle(AIS_InteractiveObject)& obj )
{
AddObject( obj );
}
-//==========================================================
/*!
- * SOCC_Prs::~SOCC_Prs
- * Destructor
- */
-//==========================================================
+ Destructor
+*/
SOCC_Prs::~SOCC_Prs()
{
myObjects.Clear();
}
-//==========================================================
/*!
- * SOCC_Prs::GetObjects
- * Get interactive objects list
- */
-//==========================================================
+ Get interactive objects list
+*/
void SOCC_Prs::GetObjects( AIS_ListOfInteractive& list ) const
{
list = myObjects;
}
-//==========================================================
/*!
- * SOCC_Prs::AddObject
- * Add interactive object
- */
-//==========================================================
+ Add interactive object
+*/
void SOCC_Prs::AddObject( const Handle(AIS_InteractiveObject)& obj )
{
myObjects.Append( obj );
}
-//==========================================================
/*!
- * SOCC_Prs::IsNull
- * Return 0 if list of the interactive objects is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
+ \return 0 if list of the interactive objects is empty [ Reimplemented from SALOME_Prs ]
+*/
bool SOCC_Prs::IsNull() const
{
return myObjects.IsEmpty() == Standard_True;
}
-//=================================================================
/*!
- * GEOM_Displayer::SetToActivate
- * This method is used for activisation/deactivisation of
- * objects in the moment of displaying
+ This method is used for activisation/deactivisation of
+ objects in the moment of displaying
*/
-//=================================================================
void SOCC_Prs::SetToActivate( const bool toActivate )
{
myToActivate = toActivate;
}
+
bool SOCC_Prs::ToActivate() const
{
return myToActivate;
// 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.salome-platform.org or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SOCC_ViewModel.h"
// get id of SUIT_Study, if it's a SalomeApp_Study, it will return
// id of its underlying SALOMEDS::Study
// SUIT_Application* app = SUIT_Session::session()->activeApplication();
-// if ( !app ) return _PTR(Study)(aStudy);
+// if ( !app ) return _PTR(Study)(aStudy);
// SUIT_Study* stud = app->activeStudy();
// if ( !stud ) return _PTR(Study)(aStudy);
// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
// return aMgr->GetStudyByID( id );
//}
+/*!
+ Constructor
+ \param DisplayTrihedron - is trihedron displayed
+*/
SOCC_Viewer::SOCC_Viewer( bool DisplayTrihedron )
: OCCViewer_Viewer( DisplayTrihedron )
{
}
+/*!
+ Destructor
+*/
SOCC_Viewer::~SOCC_Viewer()
{
}
+/*!
+ Hilights/unhilights object in viewer
+ \param obj - object to be updated
+ \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param update - update current viewer
+*/
bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj,
bool hilight, bool upd )
{
return false;
}
+/*!
+ \return true if object is in viewer or in collector
+ \param obj - object to be checked
+ \param onlyInViewer - search object only in viewer (so object must be displayed)
+*/
bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj,
bool onlyInViewer )
{
return false;
}
+/*!
+ \return true if object is displayed in viewer
+ \param obj - object to be checked
+*/
bool SOCC_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& obj )
{
AIS_ListOfInteractive List;
return false;
}
+/*!
+ Sets color of object
+ \param obj - object to be updated
+ \param color - new color
+ \param update - update current viewer
+*/
void SOCC_Viewer::setColor( const Handle(SALOME_InteractiveObject)& obj,
const QColor& color, bool update )
{
}
}
+/*!
+ Changes display mode of object
+ \param obj - object to be processed
+ \param mode - new display mode
+ \param update - update current viewer
+*/
void SOCC_Viewer::switchRepresentation( const Handle(SALOME_InteractiveObject)& obj,
int mode, bool update )
{
}
}
+/*!
+ Changes transparency of object
+ \param obj - object to be processed
+ \param trans - new transparency
+ \param update - update current viewer
+*/
void SOCC_Viewer::setTransparency( const Handle(SALOME_InteractiveObject)& obj,
float trans, bool update )
{
}
}
+/*!
+ Changes name of object
+ \param obj - object to be renamed
+ \param name - new name
+*/
void SOCC_Viewer::rename( const Handle(SALOME_InteractiveObject)& obj,
const QString& name )
{
}
}
-//=======================================================================
-// name : Display
-// Purpose : Display presentation
-//=======================================================================
+
+/*!
+ Display presentation
+ \param prs - presentation
+*/
void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
{
// try do downcast object
}
}
-//=======================================================================
-// name : Erase
-// Purpose : Erase presentation
-//=======================================================================
+
+/*!
+ Erase presentation
+ \param prs - presentation
+ \param forced - removes object from context
+*/
void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
{
// try do downcast object
}
}
-//=======================================================================
-// name : EraseAll
-// Purpose : Erase all presentations
-//=======================================================================
+
+/*!
+ Erase all presentations
+ \param forced - removes all objects from context
+*/
void SOCC_Viewer::EraseAll( const bool forced )
{
// get SALOMEDS Study
Repaint();
}
-//=======================================================================
-// name : CreatePrs
-// Purpose : Create presentation corresponding to the entry
-//=======================================================================
+/*!
+ Create presentation corresponding to the entry
+ \param entry - entry
+*/
SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
{
SOCC_Prs* prs = new SOCC_Prs();
return prs;
}
-//=======================================================================
-// name : LocalSelection
-// Purpose : Activates selection of sub shapes
-//=======================================================================
+/*!
+ Activates selection of sub shapes
+*/
void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
{
Handle(AIS_InteractiveContext) ic = getAISContext();
}
}
-//=======================================================================
-// name : GlobalSelection
-// Purpose : Deactivates selection of sub shapes
-//=======================================================================
+/*!
+ Deactivates selection of sub shapes
+*/
void SOCC_Viewer::GlobalSelection( const bool update ) const
{
Handle(AIS_InteractiveContext) ic = getAISContext();
}
}
-//=======================================================================
-// name : BeforeDisplay
-// Purpose : Axiluary method called before displaying of objects
-//=======================================================================
+/*!
+ Auxiliary method called before displaying of objects
+*/
void SOCC_Viewer::BeforeDisplay( SALOME_Displayer* d )
{
d->BeforeDisplay( this, SALOME_OCCViewType() );
}
-//=======================================================================
-// name : AfterDisplay
-// Purpose : Axiluary method called after displaying of objects
-//=======================================================================
+/*!
+ Auxiliary method called after displaying of objects
+*/
void SOCC_Viewer::AfterDisplay( SALOME_Displayer* d )
{
d->AfterDisplay( this, SALOME_OCCViewType() );
}
-//=======================================================================
-// name : getTrihedronSize
-// Purpose : Get new and current trihedron size corresponding to the
-// current model size
-//=======================================================================
+/*!
+ Get new and current trihedron size corresponding to the current model size
+*/
bool SOCC_Viewer::getTrihedronSize( double& theNewSize, double& theSize )
{
theNewSize = 100;
float aSizeInPercents = SUIT_Session::session()->resourceMgr()->doubleValue("Viewer","TrihedronSize", 105.);
- static double EPS = 5.0E-3;
+ static float EPS = 5.0E-3;
theSize = getTrihedron()->Size();
theNewSize = aMaxSide*aSizeInPercents / 100.0;
fabs( theNewSize - theSize) > theNewSize * EPS;
}
-//=======================================================================
-// name : Repaint
-// Purpose :
-//=======================================================================
+
+/*!
+ Updates current viewer
+*/
void SOCC_Viewer::Repaint()
{
// onAdjustTrihedron();
getViewer3d()->Update();
}
-//=======================================================================
-// name : createView
-// Purpose : create SOCC_ViewWindow
-//=======================================================================
+
+/*!
+ create SOCC_ViewWindow
+*/
SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
{
SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SOCC_VIEWMODEL_H
#define SOCC_VIEWMODEL_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SOCC_ViewWindow.h"
#include "SUIT_Accel.h"
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SOCC_ViewWindow
::SOCC_ViewWindow( SUIT_Desktop* theDesktop,
OCCViewer_Viewer* theModel)
{
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SOCC_ViewWindow
::~SOCC_ViewWindow()
{
}
-//----------------------------------------------------------------------------
-void
+/*!
+ Performs action
+ \param theAction - type of action
+*/
+bool
SOCC_ViewWindow
::action( const int theAction )
{
myViewPort->rotate( cx, cy + inc );
myViewPort->endRotation();
break;
- }
+ }
+ return true;
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SOCC_VIEWWINDOW_H
#define SOCC_VIEWWINDOW_H
virtual ~SOCC_ViewWindow();
protected:
- virtual void action( const int );
+ virtual bool action( const int );
};
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# source path
top_srcdir=@top_srcdir@
top_builddir=../..
LIB_MOC = \
SPlot2d_ViewModel.h
-#LIB_CLIENT_IDL = SALOMEDS.idl \
-# SALOME_Exception.idl \
-# SALOME_GenericObj.idl
-
-#LIB_CLIENT_IDL = SALOMEDS.idl \
-# SALOME_ModuleCatalog.idl \
-# SALOME_Component.idl \
-# SALOME_ContainerManager.idl \
-# SALOME_Exception.idl \
-# SALOME_GenericObj.idl
-
-#CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome
-LDFLAGS+=$(QT_MT_LIBS) $(QWT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lsuit -lPlot2d -lSalomePrs
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)
+LDFLAGS+=$(QT_MT_LIBS) $(QWT_LIBS) -lsuit -lPlot2d -lSalomePrs
@CONCLUDE@
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifdef WNT
#ifdef SPLOT2D_EXPORTS
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SPlot2d_Curve.cxx
// Author : Sergey RUIN
return *this;
}
+/*!
+ \return corresponding SALOME_InteractiveObject
+*/
Handle(SALOME_InteractiveObject) SPlot2d_Curve::getIO() const
{
return myIO;
}
+/*!
+ Sets corresponding SALOME_InteractiveObject
+ \param io - SALOME_InteractiveObject
+*/
void SPlot2d_Curve::setIO( const Handle(SALOME_InteractiveObject)& io )
{
myIO = io;
}
+/*!
+ \return true if curve has table interactive object
+*/
bool SPlot2d_Curve::hasTableIO() const
{
return !myTableIO.IsNull();
}
+/*!
+ \return table interactive object of curve
+*/
Handle(SALOME_InteractiveObject) SPlot2d_Curve::getTableIO() const
{
return myTableIO;
}
+/*!
+ Sets table interactive object of curve
+ \param io - SALOME_InteractiveObject
+*/
void SPlot2d_Curve::setTableIO( const Handle(SALOME_InteractiveObject)& io )
{
myTableIO = io;
}
+/*!
+ \return SALOME_InteractiveObject
+*/
bool SPlot2d_Curve::hasIO() const
{
return !myIO.IsNull();
}
+/*!
+ \return table title
+*/
QString SPlot2d_Curve::getTableTitle() const
{
QString title;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SPlot2d_Curve.h
// Author : Sergey RUIN
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SPlot2d_Prs.cxx
// Author : Sergey RUIN
using namespace std;
#endif
-//==========================================================
/*!
- * SPlot2d_Prs::SPlot2d_Prs
- * Default constructor
- */
-//==========================================================
+ Default constructor
+*/
SPlot2d_Prs::SPlot2d_Prs()
:Plot2d_Prs()
{
}
-//==========================================================
/*!
- * SPlot2d_Prs::SPlot2d_Prs
- * Standard constructor
- */
-//==========================================================
+ Standard constructor
+*/
SPlot2d_Prs::SPlot2d_Prs( const Plot2d_Curve* obj )
:Plot2d_Prs(obj)
{
}
+/*!
+ Standard constructor
+*/
SPlot2d_Prs::SPlot2d_Prs( const Plot2d_Prs* prs )
{
mySecondY = prs->isSecondY();
myCurves = prs->getCurves();
}
-//==========================================================
/*!
- * SPlot2d_Prs::~SPlot2d_Prs
- * Destructor
- */
-//==========================================================
+ Destructor
+*/
SPlot2d_Prs::~SPlot2d_Prs()
{
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SPlot2d_Prs.h
// Author : Sergey RUIN
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SPlot2d_Viewer.cxx
// Author : Sergey RUIN
return aMgr->GetStudyByID( id );
} */
-//=================================================================================
-// SPlot2d_Viewer implementation
-//=================================================================================
-
/*!
Constructor
*/
aViewFrame->updateTitles();
}
+/*!
+ Renames all copies of object in all view windows
+ \param IObj - object to be renamed
+ \param name - new name
+*/
void SPlot2d_Viewer::renameAll( const Handle(SALOME_InteractiveObject)& IObj, const QString& name )
{
SUIT_ViewManager* vm = getViewManager();
if(aViewFrame) aViewFrame->Repaint();
}
-//==========================================================
/*!
- * SPlot2d_Viewer::Display
- * Display presentation
- */
-//==========================================================
+ Display presentation
+*/
void SPlot2d_Viewer::Display( const SALOME_Prs2d* prs )
{
Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
if(aViewFrame && aPrs) aViewFrame->Display(aPrs);
}
-//==========================================================
/*!
- * SPlot2d_Viewer::Erase
- * Erase presentation
- */
-//==========================================================
+ Erase presentation
+*/
void SPlot2d_Viewer::Erase( const SALOME_Prs2d* prs, const bool )
{
Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
if(aViewFrame && aPrs) aViewFrame->Erase(aPrs);
}
-//==========================================================
/*!
- * SPlot2d_Viewer::CreatePrs
- * Create presentation by entry
- */
-//==========================================================
+ Create presentation by entry
+*/
SALOME_Prs* SPlot2d_Viewer::CreatePrs( const char* entry )
{
Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
return NULL;
}
-//==========================================================
/*!
- * SPlot2d_Viewer::BeforeDisplay
- * Axiluary method called before displaying of objects
- */
-//==========================================================
+ Axiluary method called before displaying of objects
+*/
void SPlot2d_Viewer::BeforeDisplay( SALOME_Displayer* d )
{
d->BeforeDisplay( this, SALOME_Plot2dViewType() );
}
-//==========================================================
/*!
- * SPlot2d_Viewer::AfterDisplay
- * Axiluary method called after displaying of objects
- */
-//==========================================================
+ Axiluary method called after displaying of objects
+*/
void SPlot2d_Viewer::AfterDisplay( SALOME_Displayer* d )
{
d->AfterDisplay( this, SALOME_Plot2dViewType() );
return anIO;
}
-//==========================================================
/*!
- * SPlot2d_Viewer::getActiveViewFrame
- * Returns an active Plot2d ViewFrame or NULL
- */
-//==========================================================
+ Returns an active Plot2d ViewFrame or NULL
+*/
Plot2d_ViewFrame* SPlot2d_Viewer::getActiveViewFrame()
{
SUIT_ViewManager* aViewMgr = getViewManager();
return NULL;
}
+/*!
+ \return curve by object and viewframe
+ \param theIObject - object
+ \param fr - viewframe
+*/
SPlot2d_Curve* SPlot2d_Viewer::getCurveByIO( const Handle(SALOME_InteractiveObject)& theIObject,
Plot2d_ViewFrame* fr )
{
return NULL;
}
+/*!
+ SLOT: called when action "Clone view" is activated
+*/
void SPlot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF )
{
if( !clonedVF || !newVF )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SPlot2d_ViewModel.h
// Author : Sergey RUIN
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : STD
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef STD_H
#define STD_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "STD_Application.h"
// Create menus
- int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1, 0 );
- int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1, 10 );
- int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1, 10 );
- int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
+ int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, MenuFileId, 0 );
+ int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, MenuEditId, 10 );
+ int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, MenuViewId, 10 );
+ int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, MenuHelpId, 1000 );
// Create menu items
- createMenu( FileNewId, fileMenu, 0 );
- createMenu( FileOpenId, fileMenu, 0 );
- createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load"
- createMenu( FileCloseId, fileMenu, 0 );
- createMenu( separator(), fileMenu, -1, 0 );
- createMenu( FileSaveId, fileMenu, 0 );
+ createMenu( FileNewId, fileMenu, 0 );
+ createMenu( FileOpenId, fileMenu, 0 );
+ createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load"
+ createMenu( FileCloseId, fileMenu, 0 );
+ createMenu( separator(), fileMenu, -1, 0 );
+ createMenu( FileSaveId, fileMenu, 0 );
createMenu( FileSaveAsId, fileMenu, 0 );
- createMenu( separator(), fileMenu, -1, 0 );
+ createMenu( separator(), fileMenu, -1, 0 );
- createMenu( separator(), fileMenu );
- createMenu( FileExitId, fileMenu );
+ createMenu( separator(), fileMenu );
+ createMenu( FileExitId, fileMenu );
- createMenu( EditCopyId, editMenu );
+ createMenu( EditCopyId, editMenu );
createMenu( EditPasteId, editMenu );
createMenu( separator(), editMenu );
- createMenu( ViewWindowsId, viewMenu );
+ createMenu( ViewWindowsId, viewMenu );
createMenu( ViewStatusBarId, viewMenu );
- createMenu( separator(), viewMenu );
+ createMenu( separator(), viewMenu );
createMenu( HelpAboutId, helpMenu );
createMenu( separator(), helpMenu );
if ( !isOk )
{
putInfo( "" );
- SUIT_MessageBox::error1( desktop(), tr( "TIT_FILE_SAVEAS" ),
- tr( "MSG_CANT_SAVE" ).arg( activeStudy()->studyName() ), tr( "BUT_OK" ) );
+ // displaying a message box as SUIT_Validator in case file can't be written (the most frequent case)
+ SUIT_MessageBox::error1( desktop(),
+ tr( "ERR_ERROR" ),
+ tr( "ERR_PERMISSION_DENIED" ).arg( activeStudy()->studyName() ),
+ tr( "BUT_OK" ) );
}
else
putInfo( tr( "INF_DOC_SAVED" ).arg( "" ) );
if ( !isOk )
SUIT_MessageBox::error1( desktop(), tr( "ERROR" ),
- tr( "INF_DOC_SAVING_FAILS" ).arg( aName ), tr( "BUT_OK" ) );
+ tr( "INF_DOC_SAVING_FAILS" ).arg( aName ),
+ tr( "BUT_OK" ) );
}
studySaved( activeStudy() );
for ( int i = EditCopyId; i <= EditPasteId; i++ )
{
- mMgr->setShown( i, myEditEnabled );
- tMgr->setShown( i, myEditEnabled );
+ mMgr->setShown( mMgr->actionId(action(i)), myEditEnabled );
+ tMgr->setShown( tMgr->actionId(action(i)), myEditEnabled );
}
}
return QFileDialog::getExistingDirectory( initial, parent, 0, caption, true );
}
+/*!
+ Changes desktop
+ \param desk - new desktop
+*/
void STD_Application::setDesktop( SUIT_Desktop* desk )
{
SUIT_Desktop* prev = desktop();
{
}
+/*!
+ Custom activity after study is created
+ Updates desktop and actions
+*/
void STD_Application::studyCreated( SUIT_Study* )
{
updateDesktopTitle();
updateCommandsStatus();
}
+/*!
+ Custom activity after study is opened
+ Updates desktop and actions
+*/
void STD_Application::studyOpened( SUIT_Study* )
{
updateDesktopTitle();
updateCommandsStatus();
}
+/*!
+ Custom activity after study is opened
+ Updates desktop and actions
+*/
void STD_Application::studySaved( SUIT_Study* )
{
updateDesktopTitle();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef STD_APPLICATION_H
#define STD_APPLICATION_H
virtual void onViewManagerActivated( SUIT_ViewManager* );
protected:
- enum { FileNewId, FileOpenId, FileCloseId, FileSaveId, FileSaveAsId,
- FileExitId, EditCutId, EditCopyId, EditPasteId, ViewStatusBarId,
- NewWindowId, HelpAboutId, ViewWindowsId, FileLoadId, UserID };
+ enum { MenuFileId = 1,
+ MenuViewId = 2,
+ MenuEditId = 3,
+ MenuHelpId = 7
+ };
+
+ enum { FileNewId, FileOpenId, FileLoadId, FileCloseId,
+ FileSaveId, FileSaveAsId, FileExitId,
+ ViewStatusBarId, ViewWindowsId, NewWindowId,
+ EditCutId, EditCopyId, EditPasteId,
+ HelpAboutId,
+ UserID
+ };
protected:
virtual void createActions();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "STD_CloseDlg.h"
connect( m_pb4, SIGNAL( clicked() ), this, SLOT( reject() ) );
}
-//================================================================================
/*!
* \brief reaction on clicked(pressed) button
*/
-//================================================================================
-
void STD_CloseDlg::onButtonClicked()
{
QPushButton* btn = ( QPushButton* )sender();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef STD_CloseDlg_H
#define STD_CloseDlg_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "STD_LoadStudiesDlg.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef STD_LOADSTUDIESDLG_H
#define STD_LOADSTUDIESDLG_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "STD_MDIDesktop.h"
if ( !mMgr )
return;
- int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkspaceAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef STD_MDIDESKTOP_H
#define STD_MDIDESKTOP_H
Q_OBJECT
public:
+ enum { MenuWindowId = 6 };
enum { Cascade, Tile, HTile, VTile };
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "STD_SDIDesktop.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef STD_SDIDESKTOP_H
#define STD_SDIDESKTOP_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "STD_TabDesktop.h"
if ( !mMgr )
return;
- int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkstackAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef STD_TABDESKTOP_H
#define STD_TABDESKTOP_H
Q_OBJECT
public:
+ enum { MenuWindowId = 6 };
enum { VSplit, HSplit };
public:
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
msgstr "Ready"
msgid "BUT_OK"
-msgstr "OK"
+msgstr "&Ok"
msgid "BUT_CANCEL"
-msgstr "Cancel"
+msgstr "&Cancel"
msgid "BUT_CLOSE"
-msgstr "Close"
+msgstr "&Close"
msgid "BUT_HELP"
-msgstr "Help"
+msgstr "&Help"
msgid "BUT_YES"
-msgstr "Yes"
+msgstr "&Yes"
msgid "BUT_NO"
-msgstr "No"
+msgstr "&No"
msgid "BUT_APPLY"
-msgstr "Apply"
+msgstr "&Apply"
msgid "ERR_ERROR"
msgstr "Error"
msgstr "&Save&&Close"
msgid "CLOSE_DLG_CLOSE"
-msgstr "&Close w/o saving"
+msgstr "C&lose w/o saving"
msgid "CLOSE_DLG_UNLOAD"
msgstr "&Unload"
msgstr "Load a document"
msgid "MEN_DESK_FILE_LOAD"
-msgstr "Conn&ect"
+msgstr "Conn&ect..."
msgid "CLOSE_DLG_CAPTION"
msgstr "Close active study"
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : suit
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_H
#define SUIT_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SUIT_Accel.cxx: implementation of the SUIT_Accel class.
-//
-//////////////////////////////////////////////////////////////////////
#include "SUIT_Accel.h"
-#include "SUIT_Desktop.h"
-#include "SUIT_ViewManager.h"
#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
#include "SUIT_ViewModel.h"
-#include <qaccel.h>
+#include <qobjectlist.h>
+#include <qapplication.h>
+#include <qnamespace.h>
-/*!\class SUIT_Accel
- * Class handles keyboard accelerator bindings.
- */
-/*! Constructor.*/
-SUIT_Accel::SUIT_Accel(SUIT_Desktop* theDesktop)
- : QObject( theDesktop, "SUIT_Accel" ),
- myDesktop( theDesktop )
+SUIT_Accel* SUIT_Accel::myself = 0;
+
+/*! Constructor [private].*/
+SUIT_Accel::SUIT_Accel()
+ : QObject( qApp, "SUIT_Accel" )
{
- myAccel = new QAccel( theDesktop, "SUIT_Accel_interal_qaccel" );
- connect( myAccel, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
+ qApp->installEventFilter( this );
}
-/*! Destructor.*/
-SUIT_Accel::~SUIT_Accel()
+/*! getAccel() : public interface for SUIT_Accel object. Only one instance is created and returned. */
+SUIT_Accel* SUIT_Accel::getAccel()
{
+ if ( !myself )
+ myself = new SUIT_Accel();
+ return myself;
}
-/*! setActionKey assign a ceratain action for a key accelerator */
+/*! setActionKey() : assign a ceratain action for a key accelerator */
void SUIT_Accel::setActionKey( const int action, const int key, const QString& type )
-{
- // 1. get or generate interal "id" of action
- int id = myAccel->findKey( key );
- if ( id == -1 )
- id = myAccel->insertItem( key );
-
+{
IdActionMap idActionMap;
if ( myMap.contains( type ) )
idActionMap = myMap[type];
- idActionMap[id] = action;
+ idActionMap[key] = action;
myMap[type] = idActionMap;
+
+ myOptMap[key] = true;
+}
+
+/*! unsetActionKey() : unregister a certain key accelerator */
+void SUIT_Accel::unsetActionKey( const int key, const QString& type )
+{
+ if ( myMap.contains( type ) ) {
+ IdActionMap idActionMap = myMap[type];
+ if ( idActionMap.contains( key ) ) {
+ idActionMap.erase( key );
+ myMap[type] = idActionMap;
+ }
+ }
}
-/*! onActivated slot called when a registered key accelerator was activated */
-void SUIT_Accel::onActivated( int id )
+/*! getParentViewWindow() : returns given object or any of its parents-grandparents-.. if it is a SUIT_ViewWindow */
+SUIT_ViewWindow* getParentViewWindow( const QObject* obj )
{
- if ( myDesktop ) {
- if ( SUIT_ViewWindow* vw = myDesktop->activeWindow() ) {
+ if ( obj ) {
+ if ( obj->inherits( "SUIT_ViewWindow" ) )
+ return (SUIT_ViewWindow*)obj;
+ else
+ return getParentViewWindow( obj->parent() );
+ }
+ return 0;
+}
+
+/*! getKey() : returns integer key code (with modifiers) made of key pressed 'inside' given event */
+int getKey( QKeyEvent *keyEvent )
+{
+ int key = keyEvent->key(),
+ state = keyEvent->state();
+ if ( state & Qt::ShiftButton )
+ key += Qt::SHIFT;
+ if ( state & Qt::ControlButton )
+ key += Qt::CTRL;
+ if ( state & Qt::AltButton )
+ key += Qt::ALT;
+ if ( state & Qt::MetaButton )
+ key += Qt::META;
+ return key;
+}
+
+/*! getAccelKey() : returns key pressed if 1) event was KeyPress 2) pressed key is a registered accelerator */
+int SUIT_Accel::getAccelKey( QEvent *event )
+{
+ if ( event && event->type() == QEvent::KeyPress ) {
+ int key = ::getKey( (QKeyEvent*)event );
+ if ( myOptMap.contains( key ) )
+ return key;
+ }
+ return 0;
+}
+
+/*! eventFilter() : filtering ALL events of QApplication. */
+bool SUIT_Accel::eventFilter( QObject *obj, QEvent *event )
+{
+ const int key = getAccelKey( event );
+ if ( key ) {
+ SUIT_ViewWindow* vw = ::getParentViewWindow( obj );
+ if ( vw ) {
QString type = vw->getViewManager()->getViewModel()->getType();
- if ( myMap.contains( type ) ) {
+ if ( myMap.contains( type ) ) {
IdActionMap idActionMap = myMap[type];
- if ( idActionMap.contains( id ) ) {
- vw->onAccelAction( idActionMap[id] );
+ if ( idActionMap.contains( key ) ) {
+ return vw->onAccelAction( idActionMap[key] );
}
}
}
}
+ return false;
}
-
+
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SUIT_Accel.h: interface for the SUIT_Accel class.
-//
-//////////////////////////////////////////////////////////////////////
#ifndef SUIT_Accel_h
#define SUIT_Accel_h
#include <qstring.h>
#include <qmap.h>
-class QAccel;
-class SUIT_Desktop;
-
+/*!
+ \class SUIT_Accel
+ Manager of keyboard accelerator bindings
+*/
class SUIT_EXPORT SUIT_Accel: public QObject
{
Q_OBJECT
};
public:
- SUIT_Accel( SUIT_Desktop* theDesktop );
- virtual ~SUIT_Accel();
+ static SUIT_Accel* getAccel();
void setActionKey( const int action, const int key, const QString& type );
+ void unsetActionKey( const int key, const QString& type );
-protected slots:
- void onActivated( int );
+protected:
+ bool eventFilter( QObject *, QEvent * );
private:
- QAccel* myAccel;
- SUIT_Desktop* myDesktop;
+ SUIT_Accel();
+
+ int getAccelKey( QEvent* ); // returns key pressed if 1) event was KeyPress
+ // 2) pressed key is a registered accelerator
- typedef QMap<int, int> IdActionMap; // internal_id - to - action map
+ typedef QMap<int, int> IdActionMap; // key - to - action_id map
typedef QMap<QString, IdActionMap> ViewerTypeIdActionMap; // viewer_type - to - IdActionMap
ViewerTypeIdActionMap myMap;
+
+ QMap<int, bool> myOptMap; // key - to - <not_used> map, used for optimazation. all registered keys (accelerators)
+ // are stored in this map.
+
+ static SUIT_Accel* myself;
};
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_ActionOperation.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_ACTIONOPERATION_H
#define SUIT_ACTIONOPERATION_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_Application.h"
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
+/*!
+ Default constructor
+*/
SUIT_Application::SUIT_Application()
: QObject( 0 ),
myStudy( 0 ),
{
}
+/*!
+ Destructor
+*/
SUIT_Application::~SUIT_Application()
{
delete myStudy;
setDesktop( 0 );
}
+/*!
+ \return main window of application (desktop)
+*/
SUIT_Desktop* SUIT_Application::desktop()
{
return myDesktop;
}
+/*!
+ \return FALSE if application can not be closed (because of non saved data for example).
+ This method called by SUIT_Session whin closing of application was requested.
+*/
bool SUIT_Application::isPossibleToClose()
{
return true;
}
+/*!
+ Performs some finalization of life cycle of this application.
+ For instance, the application can force its documents(s) to close.
+*/
void SUIT_Application::closeApplication()
{
emit applicationClosed( this );
}
+/*!
+ \return active Study. If Application supports wirking with several studies this method should be redefined
+*/
SUIT_Study* SUIT_Application::activeStudy() const
{
return myStudy;
}
+/*!
+ \return version of application
+*/
QString SUIT_Application::applicationVersion() const
{
return QString::null;
}
+/*!
+ Shows the application's main widget. For non GUI application must be redefined.
+*/
void SUIT_Application::start()
{
if ( desktop() )
desktop()->show();
}
+/*!
+ Opens document into active Study. If Study is empty - creates it.
+ \param theFileName - name of document file
+*/
bool SUIT_Application::useFile( const QString& theFileName )
{
createEmptyStudy();
return status;
}
+/*!
+ Opens other study into active Study. If Study is empty - creates it.
+ \param theName - name of study
+*/
bool SUIT_Application::useStudy( const QString& theName )
{
return false;
}
+/*!
+ Creates new empty Study if active Study = 0
+*/
void SUIT_Application::createEmptyStudy()
{
if ( !activeStudy() )
setActiveStudy( createNewStudy() );
}
+/*!
+ \return number of Studies.
+ Must be redefined in Applications which support several studies for one Application instance.
+*/
int SUIT_Application::getNbStudies() const
{
return activeStudy() ? 1 : 0;
}
+/*!
+ \return global resource manager
+*/
SUIT_ResourceMgr* SUIT_Application::resourceMgr() const
{
if ( !SUIT_Session::session() )
}
#define DEFAULT_MESSAGE_DELAY 3000
+
+/*!
+ Puts the message to the status bar
+ \param msg - text of message
+ \param msec - time in milliseconds, after that the status label will be cleared
+*/
void SUIT_Application::putInfo ( const QString& msg, const int msec )
{
if ( !desktop() )
QTimer::singleShot( msec <= 0 ? DEFAULT_MESSAGE_DELAY : msec, myStatusLabel, SLOT( clear() ) );
}
+/*!
+ Initialize with application arguments
+ \param argc - number of application arguments
+ \param argv - array of application arguments
+*/
SUIT_Application* SUIT_Application::startApplication( int argc, char** argv ) const
{
return startApplication( name(), argc, argv );
}
+/*!
+ Initialize with application name and arguments
+ \param name - name of application
+ \param argc - number of application arguments
+ \param argv - array of application arguments
+*/
SUIT_Application* SUIT_Application::startApplication( const QString& name, int argc, char** argv ) const
{
SUIT_Session* session = SUIT_Session::session();
return session->startApplication( name, argc, argv );
}
+/*!
+ Sets the main window of application
+ \param desk - new main window (desktop)
+*/
void SUIT_Application::setDesktop( SUIT_Desktop* desk )
{
if ( myDesktop == desk )
connect( myDesktop, SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) );
}
+/*!
+ Creates new instance of study.
+ By default, it is called from createEmptyStudy()
+ \sa createEmptyStudy()
+*/
SUIT_Study* SUIT_Application::createNewStudy()
{
return new SUIT_Study( this );
}
+/*!
+ Sets study as active
+ \param study - instance of study to be set as active
+*/
void SUIT_Application::setActiveStudy( SUIT_Study* study )
{
if ( myStudy == study )
myStudy = study;
}
+/*!
+ Creates new toolbar
+ \return identificator of new toolbar in tool manager
+ \param name - name of new toolbar
+*/
int SUIT_Application::createTool( const QString& name )
{
if ( !desktop() || !desktop()->toolMgr() )
return desktop()->toolMgr()->createToolBar( name );
}
+/*!
+ Creates new toolbutton
+ \return SUIT identificator of new action
+ \param a - action
+ \param tBar - identificator of toolbar
+ \param id - proposed SUIT identificator of action (if it is -1, then must be use any free)
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( QAction* a, const int tBar, const int id, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- int regId = desktop()->toolMgr()->registerAction( a, id );
- return desktop()->toolMgr()->insert( regId, tBar, idx );
+ int regId = registerAction( id, a );
+ int intId = desktop()->toolMgr()->insert( a, tBar, idx );
+ return intId != -1 ? regId : -1;
}
+/*!
+ Creates new toolbutton
+ \return SUIT identificator of new action
+ \param a - action
+ \param tBar - name of toolbar
+ \param id - proposed SUIT identificator of action (if it is -1, then must be use any free)
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( QAction* a, const QString& tBar, const int id, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- return desktop()->toolMgr()->insert( a, tBar, idx );
+ int regId = registerAction( id, a );
+ int intId = desktop()->toolMgr()->insert( a, tBar, idx );
+ return intId != -1 ? regId : -1;
}
+/*!
+ Creates new toolbutton
+ \return "id" if all right or -1 otherwise
+ \param id - SUIT identificator of action
+ \param tBar - identificator of toolbar
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( const int id, const int tBar, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- return desktop()->toolMgr()->insert( id, tBar, idx );
+ int intId = desktop()->toolMgr()->insert( action( id ), tBar, idx );
+ return intId != -1 ? id : -1;
}
+/*!
+ Creates new toolbutton
+ \return "id" if all right or -1 otherwise
+ \param id - SUIT identificator of action
+ \param tBar - name of toolbar
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( const int id, const QString& tBar, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- return desktop()->toolMgr()->insert( id, tBar, idx );
+ int intId = desktop()->toolMgr()->insert( action( id ), tBar, idx );
+ return intId != -1 ? id : -1;
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param subMenu - menu text of new item
+ \param menu - identificator of parent menu item
+ \param id - proposed identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const QString& subMenu, const int menu,
const int id, const int group, const int index )
{
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( subMenu, menu, group, index );
+ return desktop()->menuMgr()->insert( subMenu, menu, group, id, index );
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param subMenu - menu text of new item
+ \param menu - menu text of parent menu item
+ \param id - proposed identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const QString& subMenu, const QString& menu,
const int id, const int group, const int index )
{
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( subMenu, menu, group, index );
+ return desktop()->menuMgr()->insert( subMenu, menu, group, id, index );
}
+/*!
+ Creates new menu item
+ \return SUIT identificator of new action
+ \param a - action
+ \param menu - identificator of parent menu item
+ \param id - proposed SUIT identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( QAction* a, const int menu, const int id, const int group, const int index )
{
if ( !a || !desktop() || !desktop()->menuMgr() )
return -1;
- int regId = desktop()->menuMgr()->registerAction( a, id );
- return desktop()->menuMgr()->insert( regId, menu, group, index );
+ int regId = registerAction( id, a );
+ int intId = desktop()->menuMgr()->insert( a, menu, group, index );
+ return intId != -1 ? regId : -1;
}
+/*!
+ Creates new menu item
+ \return SUIT identificator of new action
+ \param a - action
+ \param menu - menu text of parent menu item
+ \param id - proposed SUIT identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( QAction* a, const QString& menu, const int id, const int group, const int index )
{
if ( !a || !desktop() || !desktop()->menuMgr() )
return -1;
- int regId = desktop()->menuMgr()->registerAction( a, id );
- return desktop()->menuMgr()->insert( regId, menu, group, index );
+ int regId = registerAction( id, a );
+ int intId = desktop()->menuMgr()->insert( a, menu, group, index );
+ return intId != -1 ? regId : -1;
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param id - SUIT identificator of action
+ \param menu - menu text of parent menu item
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const int id, const int menu, const int group, const int index )
{
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( id, menu, group, index );
+ int intId = desktop()->menuMgr()->insert( action( id ), menu, group, index );
+ return intId != -1 ? id : -1;
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param id - SUIT identificator of action
+ \param menu - menu text of parent menu item
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const int id, const QString& menu, const int group, const int index )
{
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( id, menu, group, index );
+ int intId = desktop()->menuMgr()->insert( action( id ), menu, group, index );
+ return intId != -1 ? id : -1;
}
+/*!
+ Show/hide menu item corresponding to action
+ \param a - action
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setMenuShown( QAction* a, const bool on )
{
setMenuShown( actionId( a ), on );
}
+/*!
+ Show/hide menu item corresponding to action
+ \param id - identificator of action in menu manager
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setMenuShown( const int id, const bool on )
{
if ( desktop() && desktop()->menuMgr() )
desktop()->menuMgr()->setShown( id, on );
}
+/*!
+ Show/hide tool button corresponding to action
+ \param a - action
+ \param on - if it is true, the button will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setToolShown( QAction* a, const bool on )
{
setToolShown( actionId( a ), on );
}
+/*!
+ Show/hide menu item corresponding to action
+ \param id - identificator of action in tool manager
+ \param on - if it is true, the button will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setToolShown( const int id, const bool on )
{
if ( desktop() && desktop()->toolMgr() )
desktop()->toolMgr()->setShown( id, on );
}
+/*!
+ Show/hide both menu item and tool button corresponding to action
+ \param a - action
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setActionShown( QAction* a, const bool on )
{
setMenuShown( a, on );
setToolShown( a, on );
}
+/*!
+ Show/hide both menu item and tool button corresponding to action
+ \param id - identificator in both menu manager and tool manager
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setActionShown( const int id, const bool on )
{
setMenuShown( id, on );
setToolShown( id, on );
}
+/*!
+ \return action by it's SUIT identificator
+ \param id - SUIT identificator
+*/
QAction* SUIT_Application::action( const int id ) const
{
- SUIT_Application* that = (SUIT_Application*)this;
- SUIT_Desktop* desk = that->desktop();
- if ( !desk )
- return 0;
-
QAction* a = 0;
- if ( desk->menuMgr() )
- a = desk->menuMgr()->action( id );
- if ( !a && desk->toolMgr() )
- a = desk->toolMgr()->action( id );
+ if ( myActionMap.contains( id ) )
+ a = myActionMap[id];
return a;
}
+/*!
+ \return SUIT identificator of action
+ \param a - action
+*/
int SUIT_Application::actionId( const QAction* a ) const
{
- SUIT_Application* that = (SUIT_Application*)this;
- SUIT_Desktop* desk = that->desktop();
- if ( !desk )
- return 0;
-
int id = -1;
- if ( desk->menuMgr() )
- id = desk->menuMgr()->actionId( a );
- if ( id == -1 && desk->toolMgr() )
- id = desk->toolMgr()->actionId( a );
+ for ( QMap<int, QAction*>::ConstIterator it = myActionMap.begin();
+ it != myActionMap.end() && id == -1;
+ ++it ) {
+ if ( it.data() == a )
+ id = it.key();
+ }
return id;
}
+/*!
+ Creates action and registers it both in menu manager and tool manager
+ \return new instance of action
+ \param id - proposed SUIT identificator
+ \param text - description
+ \param icon - icon for toolbar
+ \param menu - menu text
+ \param tip - tool tip
+ \param key - shortcut
+ \param parent - parent object
+ \param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action
+ \param reciever - object that contains slot
+ \param member - slot to be called when action is activated
+*/
QAction* SUIT_Application::createAction( const int id, const QString& text, const QIconSet& icon,
const QString& menu, const QString& tip, const int key,
QObject* parent, const bool toggle, QObject* reciever, const char* member )
return a;
}
-void SUIT_Application::registerAction( const int id, QAction* a )
+/*!
+ Registers action both in menu manager and tool manager
+ \param id - proposed SUIT identificator (if it is -1, auto generated one is used)
+ \param a - action
+*/
+int SUIT_Application::registerAction( const int id, QAction* a )
{
+ int ident = actionId( a );
+ if ( ident != -1 )
+ return ident;
+
+ static int generatedId = -1;
+ ident = id == -1 ? --generatedId : id;
+
+ if ( action( ident ) )
+ qWarning( "Action registration id is already in use: %d", ident );
+
+ myActionMap.insert( ident, a );
+
if ( desktop() && desktop()->menuMgr() )
- desktop()->menuMgr()->registerAction( a, id );
+ desktop()->menuMgr()->registerAction( a );
if ( desktop() && desktop()->toolMgr() )
- desktop()->toolMgr()->registerAction( a, id );
+ desktop()->toolMgr()->registerAction( a );
+
+ return ident;
}
+/*!
+ \return global action used as separator
+*/
QAction* SUIT_Application::separator()
{
return QtxActionMgr::separator();
}
+/*!
+ SLOT: it is called when desktop is activated
+*/
+
void SUIT_Application::onDesktopActivated()
{
emit activated( this );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_APPLICATION_H
#define SUIT_APPLICATION_H
static QAction* separator();
QAction* action( const int ) const;
int actionId( const QAction* ) const;
- void registerAction( const int, QAction* );
+ int registerAction( const int, QAction* );
QAction* createAction( const int, const QString&, const QIconSet&, const QString&,
const QString&, const int, QObject* = 0,
const bool = false, QObject* = 0, const char* = 0 );
private:
SUIT_Study* myStudy;
SUIT_Desktop* myDesktop;
+ QMap<int, QAction*> myActionMap;
QLabel* myStatusLabel;
};
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SUIT_Convertor.h: interface for the SUIT_Convertor class.
//
-//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SUIT_CONVERTOR_H__4C27F4C7_DC7C_4BEF_9DC1_EFB97B387EBF__INCLUDED_)
#define AFX_SUIT_CONVERTOR_H__4C27F4C7_DC7C_4BEF_9DC1_EFB97B387EBF__INCLUDED_
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_DataObject.h"
#include "SUIT_DataObjectKey.h"
-#include <iostream> // for cout in dump()
-
/*!
Constructor
*/
myCheck = on;
}
+/*!
+ \return the opened state of the object (used in Object Browser).
+*/
bool SUIT_DataObject::isOpen() const
{
return myOpen;
}
+/*!
+ Sets the opened state of the object (used in Object Browser).
+*/
void SUIT_DataObject::setOpen( const bool on )
{
myOpen = on;
void SUIT_DataObject::dump( const int indent ) const
{
QString strIndent = QString().fill( ' ', indent ); // indentation string
- std::cout << strIndent << name() << std::endl; // dump to cout
+ printf( "%s%s\n", strIndent.latin1(), name().latin1() );
for ( DataObjectListIterator it( myChildren ); it.current(); ++it ) // iterate all children
it.current()->dump( indent + 2 ); // dump every child with indent + 2 spaces
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_DATAOBJECT_H
#define SUIT_DATAOBJECT_H
#endif
/*!
- Class provide support data object.
+ \class SUIT_DataObject
+ Data Object represents uniform data tree structure recommended to use in SUIT-based applications
+ Many of standard classes (DataModel,ObjectBrowser) deal with SUIT_DataObjects
*/
class SUIT_EXPORT SUIT_DataObject
{
friend class SUIT_DataObjectIterator;
};
+/*!
+ \class SUIT_DataObject::Signal
+ Auxiliary class providing functionality to use signals of data object state change
+ SUIT_DataObject cannot have signals, because it isn't QObject, but
+ methods connect/disconnect of SUIT_DataObject with help of this it is possible
+ to emulate Qt signal processing
+*/
class SUIT_DataObject::Signal : public QObject
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_DataObjectIterator.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_DATAOBJECT_ITERATOR_H
#define SUIT_DATAOBJECT_ITERATOR_H
#include "SUIT_DataObject.h"
/*!
- Class provide data object iterator.
+ \class SUIT_DataObjectIterator
+ Provides functionality of SUIT tree detour
+ It is possible to use "to-depth" or "to-breadth" detour and
+ to control level detour (from left or from right)
*/
class SUIT_EXPORT SUIT_DataObjectIterator
{
int myDetourType, myCurrentLevel;
};
+/*!
+ \class SUIT_DataObjectIterator
+ Provides functionality of SUIT tree detour between certain levels
+ Only "to-breadth" detour is used
+*/
class SUIT_DataObjectLevelIterator : public SUIT_DataObjectIterator
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_DataObjectKey.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_DATAOBJECTKEY_H
#define SUIT_DATAOBJECTKEY_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_DataOwner.h"
#define _typeinfo type_info
#endif
-//********************************************************************
-// SUIT_DataOwner class
-//********************************************************************
-
-
/*! Constructor*/
SUIT_DataOwner::SUIT_DataOwner()
{
return p1.isNull() && p2.isNull();
}
-//********************************************************************
-/*! \class SUIT_DataOwnerPtrList
- * implements value list with unique items (uniqueness is
- * provided by operator==())
- */
-//********************************************************************
+/*!
+ \class SUIT_DataOwnerPtrList
+ implements value list with unique items (uniqueness is
+ provided by operator==())
+*/
-//====================================================================
-//! Constructor (default)
-//====================================================================
+/*!
+ Constructor (default)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList()
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( true )
{
}
-//====================================================================
-//! Constructor (default)
-//====================================================================
+/*!
+ Constructor (default)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual )
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( skipAllEqual )
{
}
-//====================================================================
-//! Constructor (copy)
-//====================================================================
+/*!
+ Constructor (copy)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l )
: QValueList<SUIT_DataOwnerPtr>( l ),
mySkipEqual( true )
{
}
-//====================================================================
-//! Constructor (copy)
-//====================================================================
+/*!
+ Constructor (copy)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual )
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( skipAllEqual )
}
#ifndef QT_NO_STL
-//====================================================================
-//! Constructor (from stl)
-//====================================================================
+/*!
+ Constructor (from stl)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l )
: QValueList<SUIT_DataOwnerPtr>( l ),
mySkipEqual( true )
#endif
#ifndef QT_NO_STL
-//====================================================================
-//! Constructor (from stl)
-//====================================================================
+/*!
+ Constructor (from stl)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l, const bool skipAllEqual )
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( skipAllEqual )
}
#endif
-//====================================================================
-//! Appends an item to the list
-//====================================================================
+/*!
+ Appends an item to the list
+*/
SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x )
{
if( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator==
return it;
}
-//====================================================================
-//! Clear list
-//====================================================================
+/*!
+ Clear list
+*/
void SUIT_DataOwnerPtrList::clear()
{
if( mySkipEqual )
QValueList<SUIT_DataOwnerPtr>::clear();
}
-//====================================================================
-//! Remove an item from the list
-//====================================================================
+/*!
+ Remove an item from the list
+*/
uint SUIT_DataOwnerPtrList::remove(const SUIT_DataOwnerPtr& x )
{
if( mySkipEqual && myMap.contains(x) )
return QValueList<SUIT_DataOwnerPtr>::remove( x );
}
-//====================================================================
-//!
-//====================================================================
+/*!
+ Operator < allows to order suit data owners for map
+*/
bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 )
{
return p1.get()<p2.get();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_DATAOWNER_H
#define SUIT_DATAOWNER_H
#pragma warning( disable:4275 )
#endif
+/*!
+ \class SUIT_DataOwner
+ Represents abstract selected objects.
+ Used for selection synchronizing between windows(e.g. ObjectBrowser) and viewers
+*/
+
class SUIT_EXPORT SUIT_DataOwner : public RefCount
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_Desktop.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_DESKTOP_H
#define SUIT_DESKTOP_H
class QtxActionMenuMgr;
class QtxActionToolMgr;
+/*!
+ \class SUIT_Desktop
+ Provides standard desktop: main window with
+ main menu manager, toolbars manager and logo.
+*/
class SUIT_EXPORT SUIT_Desktop : public QtxMainWindow
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_ExceptionHandler.h"
{
if ( !qApp )
return;
-
+
+ while ( QApplication::overrideCursor() )
+ QApplication::restoreOverrideCursor();
+
SUIT_MessageBox::error1( qApp->mainWidget(), title, msg, "OK" );
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_EXCEPTIONHANDLER_H
#define SUIT_EXCEPTIONHANDLER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//*********************************************************************************
-// SUIT_FileDlg class is the extension of the Qt's Open/Save file dialog box.
-// To get the file/directory name(s) call static methods:
-//
-// to invoke "Open file" or "Save file" dialog box
-// static QString getFileName(QWidget* parent, const QString& initial, const QStringList& filters,
-// const QString& caption, const bool open, const bool showQuickDir = true,
-// SUIT_FileValidator* validator = 0);
-//
-// to invoke "Open files" dialog box (to get the multiple file selection)
-// static QStringList getOpenFileNames(QWidget* parent, const QString& initial, const QStringList& filters,
-// const QString& caption, bool showQuickDir = true,
-// SUIT_FileValidator* validator = 0);
-//
-// to invoke "Select directory" dialog box
-// static QString getExistingDirectory(QWidget* parent, const QString& initial,
-// const QString& caption, const bool showQuickDir = true);
-//
-// The parameters:
-// - parent parent widget (if 0, the current desktop is used)
-// - initial starting directory or file name (if null, last visited directory is used)
-// - filters file filters list; patterns inside the filter can be separated by ';','|' or ' '
-// symbols
-// - caption dialog box's caption: if null, the default one is used
-// - open open flag - true for "Open File" and false for "Save File" dialog box
-// - showQuickDir this flag enables/disables "Quick directory list" controls
-// - validator you can provide custom file validator with this parameter
-//
-// Examples:
-// ...
-// QStringList flist;
-// flist.append( "Image files (*.bmp *.gif *.jpg )" );
-// flist.append( "All files (*.*)" );
-// QMyFileValidator* v = new QMyFileValidator( 0 );
-// QString fileName = SUIT_FileDlg::getFileName( 0, QString::null, flist, "Dump view", false, true, v );
-// if ( !fileName.isEmpty() ) {
-// ... writing image to the file
-// }
-// ...
-// QStringList flist;
-// flist.append( "*.cpp | *.cxx | *.c++" );
-// flist.append( "*.h | *.hpp | *.hxx" );
-// QString fileName = SUIT_FileDlg::getFileName( desktop(), QString::null, flist, QString::null, true, true );
-//
-//*********************************************************************************
+
+/*!
+ SUIT_FileDlg class is the extension of the Qt's Open/Save file dialog box.
+ To get the file/directory name(s) call static methods:
+
+ to invoke "Open file" or "Save file" dialog box
+ static QString getFileName(QWidget* parent, const QString& initial, const QStringList& filters,
+ const QString& caption, const bool open, const bool showQuickDir = true,
+ SUIT_FileValidator* validator = 0);
+
+ to invoke "Open files" dialog box (to get the multiple file selection)
+ static QStringList getOpenFileNames(QWidget* parent, const QString& initial, const QStringList& filters,
+ const QString& caption, bool showQuickDir = true,
+ SUIT_FileValidator* validator = 0);
+
+ to invoke "Select directory" dialog box
+ static QString getExistingDirectory(QWidget* parent, const QString& initial,
+ const QString& caption, const bool showQuickDir = true);
+
+ The parameters:
+ - parent parent widget (if 0, the current desktop is used)
+ - initial starting directory or file name (if null, last visited directory is used)
+ - filters file filters list; patterns inside the filter can be separated by ';','|' or ' '
+ symbols
+ - caption dialog box's caption: if null, the default one is used
+ - open open flag - true for "Open File" and false for "Save File" dialog box
+ - showQuickDir this flag enables/disables "Quick directory list" controls
+ - validator you can provide custom file validator with this parameter
+
+ Examples:
+ ...
+ QStringList flist;
+ flist.append( "Image files (*.bmp *.gif *.jpg )" );
+ flist.append( "All files (*.*)" );
+ QMyFileValidator* v = new QMyFileValidator( 0 );
+ QString fileName = SUIT_FileDlg::getFileName( 0, QString::null, flist, "Dump view", false, true, v );
+ if ( !fileName.isEmpty() ) {
+ ... writing image to the file
+ }
+ ...
+ QStringList flist;
+ flist.append( "*.cpp | *.cxx | *.c++" );
+ flist.append( "*.h | *.hpp | *.hxx" );
+ QString fileName = SUIT_FileDlg::getFileName( desktop(), QString::null, flist, QString::null, true, true );
+*/
#include "SUIT_FileDlg.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_FILEDIALOG_H
#define SUIT_FILEDIALOG_H
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : SUIT_FileValidator.cxx
-// Author :
// Module : SALOME
// $Header$
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
//
// File : SUIT_FileValidator.h
-// Author :
// Module : SALOME
-// $Header$
#ifndef SUIT_FILEVALIDATOR_H
#define SUIT_FILEVALIDATOR_H
#include <qwidget.h>
#include "SUIT.h"
+/*!
+ \class SUIT_FileValidator
+ Provides functionality to check file
+*/
class SUIT_EXPORT SUIT_FileValidator
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/********************************************************************
-** Class: SUIT_MessageBox
-** Descr: Message dialog box for SUIT-based application
-** Module: SUIT
-** Created: UI team, 02.10.00
-*********************************************************************/
+
+/*!
+ \class: SUIT_MessageBox
+ Message dialog box for SUIT-based application
+ Module: SUIT
+ Created: UI team, 02.10.00
+*/
#include "SUIT_MessageBox.h"
#include "SUIT_OverrideCursor.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/********************************************************************
-** Class: SUIT_MessageBox
-** Descr: Message dialog box for SUIT-based application
-** Module: SUIT
-** Created: UI team, 02.10.00
-*********************************************************************/
+
#ifndef SUIT_MESSAGEBOX_H
#define SUIT_MESSAGEBOX_H
#define SUIT_NO 4
#define SUIT_HELP 5
+/*!
+ \class SUIT_MessageBox
+ \brief Message dialog box for SUIT-based application
+*/
class SUIT_EXPORT SUIT_MessageBox
{
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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/**
-* SALOME SalomeApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : SUIT_Operation.h
-* Author : Unknown
-* Module : SALOME
+
+/*!
+ SALOME SalomeApp
+
+ Copyright (C) 2005 CEA/DEN, EDF R&D
+
+ File : SUIT_Operation.h
+ Author : Unknown
+ Module : SALOME
*/
#include "SUIT_Operation.h"
#include "SUIT_Application.h"
/*!
- * \brief Constructor
- * \param SUIT_Application - application for this operation
-*
-* Constructs an empty operation. Constructor should work very fast because many
-* operators may be created after starting application but only several from them
-* may be used. As result this constructor stores given application in myApp field
-* and set Waiting status.
+ \brief Constructor
+ \param SUIT_Application - application for this operation
+
+ Constructs an empty operation. Constructor should work very fast because many
+ operators may be created after starting application but only several from them
+ may be used. As result this constructor stores given application in myApp field
+ and set Waiting status.
*/
SUIT_Operation::SUIT_Operation( SUIT_Application* app )
: QObject(),
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-/**
-* SALOME SalomeApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : SUIT_Operation.h
-* Author : Unknown
-* Module : SALOME
-*/
#ifndef SUIT_OPERATION_H
#define SUIT_OPERATION_H
class SUIT_Application;
/*!
+ \class SUIT_Operation
* \brief Base class for all operations
*
* Base class for all operations. If you perform an action it is reasonable to create
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_OverrideCursor.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_OVERRIDECURSOR_H
#define SUIT_OVERRIDECURSOR_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_PopupClient.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_POPUPCLIENT_H
#define SUIT_POPUPCLIENT_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_ResourceMgr.h"
+#include <qfileinfo.h>
+#include <qdir.h>
+
/*!
Constructor
*/
return path( docSection, prefix, id );
}
+#ifndef WIN32
+#include <unistd.h>
+#endif
/*!
Returns the user file name for specified application
*/
-QString SUIT_ResourceMgr::userFileName( const QString& appName ) const
+QString SUIT_ResourceMgr::userFileName( const QString& appName, const bool for_load ) const
{
QString pathName = QtxResourceMgr::userFileName( appName );
if ( !version().isEmpty() )
pathName += QString( "." ) + version();
+ if( !QFileInfo( pathName ).exists() && for_load )
+ {
+ QString newName = findAppropriateUserFile( pathName );
+ if( !newName.isEmpty() )
+ pathName = newName;
+ }
+
return pathName;
}
+
+/*!
+ Finds other the most appropriate user file instead missing one
+*/
+QString SUIT_ResourceMgr::findAppropriateUserFile( const QString& fname ) const
+{
+ QDir d( QFileInfo( fname ).dir( true ) );
+ d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
+ QStringList l = d.entryList();
+ QString appr_file;
+ int id0 = userFileId( fname ), id, appr=-1;
+ if( id0<0 )
+ return appr_file;
+
+ for( QStringList::const_iterator anIt = l.begin(), aLast = l.end(); anIt!=aLast; anIt++ )
+ {
+ id = userFileId( *anIt );
+ if( id<0 )
+ continue;
+
+ if( abs( id-id0 ) < abs( appr-id0 ) )
+ {
+ appr = id;
+ appr_file = d.absFilePath( *anIt );
+ }
+ }
+ return appr_file;
+}
+
+/*!
+ Calculates integer extended version number by user file name for comparing
+*/
+int SUIT_ResourceMgr::userFileId( const QString& ) const
+{
+ return -1;
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_RESOURCEMGR_H
#define SUIT_RESOURCEMGR_H
QString loadDoc( const QString&, const QString& ) const;
protected:
- virtual QString userFileName( const QString& ) const;
+ virtual QString userFileName( const QString&, const bool = true ) const;
+ virtual QString findAppropriateUserFile( const QString& ) const;
+ virtual int userFileId( const QString& ) const;
private:
QString myVersion;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_SelectionFilter.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_SELECTIONFILTER_H
#define SUIT_SELECTIONFILTER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_SelectionMgr.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_SELECTIONMGR_H
#define SUIT_SELECTIONMGR_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_Selector.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_SELECTOR_H
#define SUIT_SELECTOR_H
class SUIT_SelectionMgr;
class SUIT_DataOwnerPtrList;
+/*!
+ \class SUIT_Selector
+ Base class for all selectors used in SUIT-based applications.
+ Provides functionality to get/set selection from/into some widget
+ (ObjectBrowser, viewers, etc)
+ Used by selection manager for selection synhronizing
+*/
class SUIT_EXPORT SUIT_Selector : public QObject
{
Q_OBJECT
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_Session.h"
#ifdef WIN32
lib = ::LoadLibrary( (char*)libFile.latin1() );
#else
- lib = dlopen( (char*)libFile.latin1(), RTLD_LAZY );
+ lib = dlopen( (char*)libFile.latin1(), RTLD_LAZY | RTLD_GLOBAL );
#endif
return lib;
}
*/
SUIT_ResourceMgr* SUIT_Session::createResourceMgr( const QString& appName ) const
{
- return new SUIT_ResourceMgr( appName );
+ return new SUIT_ResourceMgr( applicationName( appName ) );
}
/*!
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_SESSION_H
#define SUIT_SESSION_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#if !defined(__SUIT_SMARTPTR_H)
#define __SUIT_SMARTPTR_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_Study.h"
{
}
+/*!
+ Custom document initialization to be performed \n
+ within onNewDoc() handler can be put here
+*/
void SUIT_Study::createDocument()
{
- /*! Custom document initialization to be performed \n
- * within onNewDoc() handler can be put here
- */
}
/*!
{
return false;
}
+
+/*!
+ * \brief Stores the study state
+*/
+int SUIT_Study::storeState()
+{
+ return -1;
+}
+
+/*!
+ * \brief Restores the study state
+*/
+void SUIT_Study::restoreState(int savePoint)
+{
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_STUDY_H
#define SUIT_STUDY_H
bool suspend( SUIT_Operation* );
bool resume( SUIT_Operation* );
+ virtual int storeState();
+ virtual void restoreState(int savePoint);
+
signals:
void studyModified( SUIT_Study* );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_ToolButton.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_TOOLBUTTON_H
#define SUIT_TOOLBUTTON_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_Tools.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_TOOLS_H
#define SUIT_TOOLS_H
#include <qfont.h>
#include <qstring.h>
+/*!
+ \class SUIT_Tools
+ Prodives set of auxiliary static methods
+*/
class SUIT_EXPORT SUIT_Tools : public Qtx
{
public:
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef SUIT_TREE_SYNC_HEADER
#define SUIT_TREE_SYNC_HEADER
#include <qptrlist.h>
#include <qvaluelist.h>
+/*!
+ \struct DiffItem
+ \brief Struct representing difference between items
+*/
template <class SrcItem, class TrgItem>
struct DiffItem
{
- SrcItem mySrc; //if it is null, then this item is to deleted
- TrgItem myTrg; //if it is null, then this item is to added
- //if both fields aren't null, then this item is to update
+ SrcItem mySrc;
+ /*!
+ \var mySrc
+ if it is null, then this item is to deleted
+ */
+ TrgItem myTrg;
+ /*!
+ \var myTrg
+ if it is null, then this item is to added
+ if both fields aren't null, then this item is to update
+ */
};
+/*!
+ \brief synchronizes two trees
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem synchronize( const SrcItem&, const TrgItem&, const TreeData& );
+/*!
+ \brief compares children
+*/
template <class SrcItem, class TrgItem, class TreeData>
void diffSiblings( const SrcItem&, const TrgItem&,
QValueList < DiffItem < SrcItem,TrgItem > >&,
const TreeData& );
+/*!
+ \brief create item with children (subtree)
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem createSubTree( const SrcItem&, const TrgItem&, const TrgItem&, const bool, const TreeData& );
+/*!
+ \brief find equal element in list
+*/
template <class SrcItem, class TrgItem, class TreeData>
const typename QValueList<TrgItem>::const_iterator findEqual( const QValueList<TrgItem>& l,
const typename QValueList<TrgItem>::const_iterator& first,
-
-//int gSync = 0;
+/*!
+ Synchronizes two trees by comparing corresponding items
+ \param r1 - start item from first tree
+ \param r2 - start item from second tree
+ \param td - auxiliary class providing following methods:
+ <ul>
+ <li> bool isEqual( const SrcItem&, const TrgItem& ) const - returns true if items are equal
+ <li> SrcItem nullSrc() const - returns null SrcItem
+ <li> TrgItem nullTrg() const - returns null TrgItem
+ <li> TrgItem createItem(
+ <ol>
+ <li> const SrcItem& src, - corresponding SrcItem
+ <li> const TrgItem& parent, - parent TrgItem
+ <li> const TrgItem& after, - TrgItem after that new item must be added
+ <li> const bool prepend - whether new item must be added as first
+ </ol>
+ ) const - creates new TrgItem
+ <li> void updateItem( const TrgItem& ) const - updates TrgItem without recreation
+ <li> void deleteItemWithChildren( const TrgItem& ) const - deletes TrgItem with all children
+ <li> void children( const SrcItem&, QValueList<SrcItem>& ) const - fills list with children
+ <li> void children( const TrgItem&, QValueList<TrgItem>& ) const - fills list with children
+ <li> SrcItem parent( const SrcItem& ) const - return parent SrcItem
+ <li> TrgItem parent( const TrgItem& ) const - return parent SrcItem
+ </ul>
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem synchronize( const SrcItem& r1, const TrgItem& r2, const TreeData& td )
{
- // printf( "--- synchronize : %d ---\n", ++gSync );
-
if( td.isEqual( r1, r2 ) )
{
+ // update items themselves
+ td.updateItem( r2 );
+
+ // iterate 'siblings' (direct children)
QValueList< DiffItem< SrcItem, TrgItem > > d;
diffSiblings( r1, r2, d, td );
typename QValueList< DiffItem< SrcItem, TrgItem > >::const_iterator anIt = d.begin(), aLast = d.end();
- bool isFirst = true;
TrgItem lastItem = td.nullTrg();
// TrgItem tail = td.nullTrg();
for( ; anIt!=aLast; anIt++ )
if( item.myTrg==td.nullTrg() )
{
//to add
- lastItem = createSubTree( item.mySrc, r2, lastItem, isFirst, td );
+ TrgItem nitem = createSubTree( item.mySrc, r2, lastItem, lastItem==td.nullTrg(), td );
+ if( nitem!=td.nullTrg() )
+ lastItem = nitem;
}
else
{
synchronize( item.mySrc, item.myTrg, td );
lastItem = item.myTrg;
}
- isFirst = false;
}
}
-
+
return r2;
}
else
}
}
+/*!
+ Finds equal element in list
+ \return iterator
+ \param l - list to search
+ \param first - start iterator
+ \param it - item to be found
+ \param td - tree data object (provides auxiliary methods)
+*/
template <class SrcItem, class TrgItem, class TreeData>
const typename QValueList<TrgItem>::const_iterator findEqual( const QValueList<TrgItem>& l,
const typename QValueList<TrgItem>::const_iterator& first,
return last;
}
+/*!
+ Compares children of objects src and trg
+ \param src - SrcItem to be checked
+ \param trg - TrgItem to be checked
+ \param d - map of difference to be filled
+ \param td - tree data object (provides auxiliary methods)
+*/
template <class SrcItem, class TrgItem, class TreeData>
void diffSiblings( const SrcItem& src, const TrgItem& trg,
QValueList < DiffItem < SrcItem,TrgItem > >& d,
const TreeData& td )
{
- if( src==td.nullSrc() || trg==td.nullTrg() )
- return;
+ //if( src==td.nullSrc() || trg==td.nullTrg() )
+ // return;
QValueList<SrcItem> src_ch;
QValueList<TrgItem> trg_ch;
}
}
+/*!
+ Creates sub-tree
+ \return root of just created sub-tree
+ \param src - corresponding SrcItem
+ \param parent - parent of new TrgItem
+ \param after - TrgItem, after that new item must be added
+ \param asFirst - true if TrgItem must be added as first
+ \param td - tree data object (provides auxiliary methods)
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem createSubTree( const SrcItem& src, const TrgItem& parent,
const TrgItem& after, const bool asFirst,
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUIT_ViewManager.h"
myStudy = NULL;
}
+/*! invoke method of SUIT_PopupClient, which notifies about popup*/
void SUIT_ViewManager::onContextMenuRequested( QContextMenuEvent* e )
{
- /*! invoke method of SUIT_PopupClient, which notifies about popup*/
contextMenuRequest( e );
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_VIEWMANAGER_H
#define SUIT_VIEWMANAGER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SUIT_ViewModel.cxx: implementation of the SUIT_ViewModel class.
//
-//////////////////////////////////////////////////////////////////////
#include "SUIT_ViewModel.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUIT_VIEWMODEL_H
#define SUIT_VIEWMODEL_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SUIT_ViewWindow.cxx: implementation of the SUIT_ViewWindow class.
//
-//////////////////////////////////////////////////////////////////////
#include "SUIT_ViewWindow.h"
#include "SUIT_Desktop.h"
{
}
+/*!
+ Sets new view manager for window
+ \param theManager - new view manager
+*/
void SUIT_ViewWindow::setViewManager( SUIT_ViewManager* theManager )
{
myManager = theManager;
}
+/*!
+ \return view manager of window
+*/
SUIT_ViewManager* SUIT_ViewWindow::getViewManager() const
{
return myManager;
}
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage SUIT_ViewWindow::dumpView()
{
return QImage();
}
-bool SUIT_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& format )
+/*!
+ Saves image to file according to the format
+ \param image - image
+ \param fileName - name of file
+ \param format - string contains name of format (for example, "BMP"(default) or "JPEG", "JPG")
+*/
+bool SUIT_ViewWindow::dumpViewToFormat( const QImage& img, const QString& fileName, const QString& format )
{
- QImage img = dumpView();
if( img.isNull() )
return false;
return res;
}
+/*!
+ Saves scene rendering in window to file
+ \param fileName - name of file
+ \param format - string contains name of format (for example, "BMP"(default) or "JPEG", "JPG")
+*/
+bool SUIT_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& format )
+{
+ return dumpViewToFormat( dumpView(), fileName, format );
+}
+
/*! Close event \a theEvent.
*/
void SUIT_ViewWindow::closeEvent(QCloseEvent* theEvent)
qApp->postEvent( this, new QCustomEvent( DUMP_EVENT ) );
}
+/*!
+ \return filters for image files
+*/
QString SUIT_ViewWindow::filter() const
{
return tr( "TLT_IMAGE_FILES" );
bool bOk = false;
if ( myManager && myManager->study() && myManager->study()->application() )
{
+ QImage im = dumpView();
+
// get file name
SUIT_Application* app = myManager->study()->application();
QString fileName = app->getFileName( false, QString::null, filter(), tr( "TLT_DUMP_VIEW" ), 0 );
if( !fileName.isEmpty() )
{
QString fmt = SUIT_Tools::extension( fileName ).upper();
- bOk = dumpViewToFormat( fileName, fmt );
+ bOk = dumpViewToFormat( im, fileName, fmt );
}
else
{
/*! Called by SUIT_Accel::onActivated() when a key accelerator was activated and this window was active
*/
-void SUIT_ViewWindow::onAccelAction( int _action )
+bool SUIT_ViewWindow::onAccelAction( int _action )
{
- action( _action );
+ return action( _action );
}
/*! action handle standard action (zoom, pan) or custom action. to be redefined in successors.
*/
-void SUIT_ViewWindow::action( const int )
+bool SUIT_ViewWindow::action( const int )
+{
+ return true;
+}
+
+/*!
+ \return string containing visual parameters of window
+*/
+QString SUIT_ViewWindow::getVisualParameters()
+{
+ return "empty";
+}
+
+/*!
+ Sets visual parameters of window by its string representation
+ \param parameters - string with visual parameters
+*/
+void SUIT_ViewWindow::setVisualParameters( const QString& parameters )
{
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SUIT_ViewWindow.h: interface for the SUIT_ViewWindow class.
//
-//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SUIT_VIEWWINDOW_H__82C3D51A_6F10_45B0_BCFE_3CB3EF596A4D__INCLUDED_)
#define AFX_SUIT_VIEWWINDOW_H__82C3D51A_6F10_45B0_BCFE_3CB3EF596A4D__INCLUDED_
bool event(QEvent*);
virtual QImage dumpView();
- virtual bool dumpViewToFormat( const QString& fileName, const QString& format );
+ bool dumpViewToFormat( const QString& fileName, const QString& format );
- void onAccelAction( int );
+ bool onAccelAction( int );
+
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
public slots:
virtual void onDumpView();
void closeEvent( QCloseEvent* );
virtual void contextMenuEvent( QContextMenuEvent* );
virtual QString filter() const;
- virtual void action( const int );
+ virtual bool action( const int );
+ virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
SUIT_Desktop* myDesktop;
SUIT_ViewManager* myManager;
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
msgid "ERR_PERMISSION_DENIED"
msgstr "Can't save file \"%1\".\nPermission denied."
-msgid "BUT_OK"
-msgstr "&OK"
-
-msgid "BUT_YES"
-msgstr "&Yes"
-
-msgid "BUT_NO"
-msgstr "&No"
-
msgid "INF_DIRECTORIES_FILTER"
msgstr "Directories"
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// Module : SALOME
// $Header$
-/* --- Definition macros file to print informations if _DEBUG_ is defined --- */
+/*! --- Definition macros file to print informations if _DEBUG_ is defined --- */
#ifndef UTILITIES_H
#define UTILITIES_H
#include "LocalTraceBufferPool.hxx"
-/** \file utilities.h
+/*! \file utilities.h
* For each message to put in the trace, a specific ostingstream object is \n
* created and destroyed automatically at the end of the message macro. \n
* The insert function of LocalTraceBufferPool class gets a buffer in a \n
std::cerr << "ABORT return code= "<< code << std::endl; \
std::exit(code);}
-/* --- To print date and time of compilation of current source --- */
+/*! --- To print date and time of compilation of current source --- */
#if defined ( __GNUC__ )
#define COMPILER "g++"
<< " at " << __TIME__ << MESS_END }
#ifdef _DEBUG_
-/** @name the following MACROS are useful at debug time*/
+/*! @name the following MACROS are useful at debug time*/
//@{
#define MESSAGE(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
#define SCRUTE(var) {MESS_BEGIN("- Trace ") << #var << "=" << var <<MESS_END}
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : suitApp
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#if defined WNT
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
+#include <QtxSplash.h>
#ifdef SUIT_ENABLE_PYTHON
#include <Python.h>
#include <qfile.h>
#include <qstring.h>
#include <qstringlist.h>
+#include <qregexp.h>
#include <stdlib.h>
SUITApp_Session( bool theIniFormat ) : SUIT_Session(), myIniFormat ( theIniFormat ) {}
virtual ~SUITApp_Session() {}
-protected:
virtual SUIT_ResourceMgr* createResourceMgr( const QString& appName ) const
{
SUIT_ResourceMgr* resMgr = 0;
QStringList argList;
bool noExceptHandling = false;
- bool iniFormat = false;
+ bool iniFormat = false;
+ bool noSplash = false;
for ( int i = 1; i < args /*&& !noExceptHandling*/; i++ )
{
- if ( !strcmp( argv[i], "/noexcepthandling" ) )
+ if ( !strcmp( argv[i], "--noexcepthandling" ) )
noExceptHandling = true;
else if ( !strcmp( argv[i], "--format=ini") )
iniFormat = true;
+ else if ( !strcmp( argv[i], "--nosplash") )
+ noSplash = true;
else
argList.append( QString( argv[i] ) );
}
if ( !argList.isEmpty() )
{
SUITApp_Session* aSession = new SUITApp_Session( iniFormat );
+ QtxSplash* splash = 0;
+ if ( !noSplash ) {
+ SUIT_ResourceMgr* resMgr = aSession->createResourceMgr( argList.first() );
+ if ( resMgr ) {
+ resMgr->loadLanguage();
+ QString splashIcon, splashInfo, splashTextColors;
+ resMgr->value( "splash", "image", splashIcon );
+ resMgr->value( "splash", "info", splashInfo, false );
+ resMgr->value( "splash", "text_colors", splashTextColors );
+ QString appName = QObject::tr( "APP_NAME" ).stripWhiteSpace();
+ QString appVersion = QObject::tr( "APP_VERSION" ).stripWhiteSpace();
+ if ( appVersion == "APP_VERSION" ) {
+ if ( appName == "APP_NAME" || appName.lower() == "salome" )
+ appVersion = salomeVersion();
+ else
+ appVersion = "";
+ }
+ QPixmap px( splashIcon );
+ if ( !px.isNull() ) {
+ splash = QtxSplash::splash( px );
+ if ( !splashTextColors.isEmpty() ) {
+ QStringList colors = QStringList::split( "|", splashTextColors );
+ QColor c1, c2;
+ if ( colors.count() > 0 ) c1 = QColor( colors[0] );
+ if ( colors.count() > 1 ) c2 = QColor( colors[1] );
+ splash->setTextColors( c1, c2 );
+ }
+ else {
+ splash->setTextColors( Qt::white, Qt::black );
+ }
+#ifdef _DEBUG_
+ splash->setHideOnClick( true );
+#endif
+ QFont f = splash->font();
+ f.setBold( true );
+ splash->setFont( f );
+ if ( !splashInfo.isEmpty() ) {
+ splashInfo.replace( QRegExp( "%A" ), appName );
+ splashInfo.replace( QRegExp( "%V" ), QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) );
+ splashInfo.replace( QRegExp( "%L" ), QObject::tr( "ABOUT_LICENSE" ) );
+ splashInfo.replace( QRegExp( "%C" ), QObject::tr( "ABOUT_COPYRIGHT" ) );
+ splashInfo.replace( QRegExp( "\\\\n" ), "\n" );
+ splash->message( splashInfo );
+ }
+ splash->show();
+ qApp->processEvents();
+ }
+ }
+ }
SUIT_Application* theApp = aSession->startApplication( argList.first() );
if ( theApp )
{
// if ( !app.mainWidget() )
// app.setMainWidget( theApp->desktop() );
+ if ( splash )
+ splash->finish( theApp->desktop() );
result = app.exec();
+ if ( splash )
+ delete splash;
}
delete aSession;
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUITApp_Application.h"
#include <unistd.h>
#endif
+/*!
+ Constructor
+*/
SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand )
: QApplication( argc, argv ),
myExceptHandler( hand )
delete strTbl;
}
+/*!
+ Constructor
+*/
SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand )
: QApplication( argc, argv, type ),
myExceptHandler( hand )
installTranslator( strTbl );
}
+/*!
+ Sends event to receiver
+ \return the value that is returned from the receiver's event handler
+ \param e - event
+ \param receiver - receiver
+*/
bool SUITApp_Application::notify( QObject* receiver, QEvent* e )
{
return myExceptHandler ? myExceptHandler->handle( receiver, e ) :
QApplication::notify( receiver, e );
}
+/*!
+ Changes exception handler
+ \param hand - new handler
+*/
void SUITApp_Application::setHandler( SUIT_ExceptionHandler* hand )
{
myExceptHandler = hand;
}
+/*!
+ \return exception handler
+*/
SUIT_ExceptionHandler* SUITApp_Application::handler() const
{
return myExceptHandler;
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUITAPP_APPLICATION_H
#define SUITAPP_APPLICATION_H
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
msgid "APP_ERROR"
msgstr "Error"
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# source path
top_srcdir=@top_srcdir@
top_builddir=../..
LIB_CLIENT_IDL =
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+=$(QT_MT_LIBS) -L$(top_builddir)/lib
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS)
+LDFLAGS+=$(QT_MT_LIBS) -lsuit
@CONCLUDE@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
+/*!
+ Creates view
+*/
SUIT_ViewWindow* SUPERVGraph::createView(SUIT_Desktop* parent)
{
return new SUPERVGraph_ViewFrame( parent/*, "vtkView"*/ );
extern "C"
{
+ /*!
+ Creates view
+ */
SUIT_ViewWindow* createView(SUIT_Desktop* parent)
{
return SUPERVGraph::createView(parent);
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
+/*!
+ Constructor
+*/
SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent )
{
init(theParent);
}
+/*!
+ Constructor
+*/
SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent )
{
init(theParent);
}
+/*!
+ Builds popup for SUPERVGraph viewer
+*/
void SUPERVGraph_View::contextMenuPopup( QPopupMenu* )
{
// to be implemented
}
+/*!
+ Initialization
+*/
void SUPERVGraph_View::init( QWidget* theParent )
{
if ( theParent->inherits( "QMainWindow" ) ) {
createToolBar();
}
+/*!
+ Creates actions of SUPERVGraph view window
+*/
void SUPERVGraph_ViewFrame::createActions()
{
if (!myActionsMap.isEmpty()) return;
myActionsMap[ ResetId ] = aAction;
}
-//================================================================
-// Function : createToolBar
-// Purpose :
-//================================================================
+/*!
+ Creates toolbar of SUPERVGraph view window
+*/
void SUPERVGraph_ViewFrame::createToolBar()
{
myActionsMap[PanId]->addTo(myToolBar);
myActionsMap[ResetId]->addTo(myToolBar);
}
+/*!
+ Destructor
+*/
SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
/*!
}
+/*!
+ Sets new view widget
+ \param theView - new view widget
+*/
void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView )
{
myView = theView;
- setFocusProxy( myView ); // mkr : IPAL11388
}
return QMainWindow::backgroundColor();
}
+/*!
+*/
void SUPERVGraph_ViewFrame::onAdjustTrihedron()
{
// MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )
}
+/*!
+ Changes name of object
+ \param obj - object to be renamed
+ \param name - new name
+*/
void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
QString newName )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
}
+/*!
+ Unhilights all object in viewer
+ \param updateviewer - update current viewer
+*/
void SUPERVGraph_ViewFrame::unHighlightAll()
{
// MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
}
+/*!
+ Hilights/unhilights object in viewer
+ \param obj - object to be updated
+ \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param update - update current viewer
+*/
void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
bool highlight, bool immediatly )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
}
+/*!
+ \return true if object is in viewer or in collector
+ \param obj - object to be checked
+ \param onlyInViewer - search object only in viewer (so object must be displayed)
+*/
bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
return false;
}
+/*!
+ \return true if object is displayed in viewer
+ \param obj - object to be checked
+*/
bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
return false;
}
+/*!
+ Custom resize event handler
+*/
void SUPERVGraph_ViewFrame::resizeEvent( QResizeEvent* theEvent )
{
QMainWindow::resizeEvent( theEvent );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUPERVGraph_ViewManager.h"
int SUPERVGraph_ViewManager::myMaxId = 0;
+/*!
+ Constructor
+*/
SUPERVGraph_ViewManager::SUPERVGraph_ViewManager( SUIT_Study* theStudy,
SUIT_Desktop* theDesktop,
SUIT_ViewModel* theViewModel )
myId = ++myMaxId;
}
+/*!
+ Destructor
+*/
SUPERVGraph_ViewManager::~SUPERVGraph_ViewManager()
{
}
+/*!
+ Sets view name
+ \param theView - view to assign name
+*/
void SUPERVGraph_ViewManager::setViewName(SUIT_ViewWindow* theView)
{
int aPos = myViews.find(theView);
theView->setCaption( QString( "SUPERVISION scene:%1 - viewer:%2" ).arg( myId ).arg(aPos+1));
}
+/*!
+ Fills popup menu with custom actions
+ \param popup - popup menu to be filled with
+*/
void SUPERVGraph_ViewManager::contextMenuPopup( QPopupMenu* thePopup)
{
SUIT_ViewManager::contextMenuPopup( thePopup );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUPERVGRAPH_VIEWMANAGER_H
#define SUPERVGRAPH_VIEWMANAGER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SUPERVGraph_ViewModel.h"
#include "SUPERVGraph_ViewFrame.h"
#include "SUIT_Desktop.h"
#include "SUIT_ViewWindow.h"
+/*!
+ Constructor
+*/
SUPERVGraph_Viewer::SUPERVGraph_Viewer()
:SUIT_ViewModel()
{
}
+/*!
+ Destructor
+*/
SUPERVGraph_Viewer::~SUPERVGraph_Viewer()
{
}
+/*!
+ Creates new view window
+ \param theDesktop - main window of application
+*/
SUIT_ViewWindow* SUPERVGraph_Viewer::createView(SUIT_Desktop* theDesktop)
{
SUPERVGraph_ViewFrame* aRes = new SUPERVGraph_ViewFrame( theDesktop );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SUPERVGRAPH_VIEWMODEL_H
#define SUPERVGRAPH_VIEWMODEL_H
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SUPERVGraph_images.po
// Created: 11/22/2005 10:52:37 PM
// Author: Margarita Karpunina
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SUPERVGraph_msg_en.po
// Created: 11/22/2005 10:55:36 PM
// Author: Margarita Karpunina
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Alexander Solovyov(OCN)
# Module : SVTK
SALOME_Actor.h \
SVTK_RectPicker.h \
SVTK_DeviceActor.h \
+ SVTK_DialogBase.h \
SVTK_FontWidget.h \
SVTK_CubeAxesActor2D.h \
SVTK_Functor.h \
SVTK_Event.h \
SVTK_ViewModelBase.h
-PO_FILES = SVTK_msg_en.po
+PO_FILES = \
+ SVTK_msg_en.po \
+ SVTK_images.po
# Libraries targets
LIB = libSVTK.la
SVTK_DeviceActor.cxx \
SVTK_CubeAxesActor2D.cxx \
SVTK_NonIsometricDlg.cxx \
+ SVTK_UpdateRateDlg.cxx \
SVTK_CubeAxesDlg.cxx \
+ SVTK_DialogBase.cxx \
SVTK_FontWidget.cxx \
SVTK_Trihedron.cxx \
SVTK_MainWindow.cxx \
SVTK_GenericRenderWindowInteractor.h \
SVTK_RenderWindowInteractor.h \
SVTK_NonIsometricDlg.h \
+ SVTK_UpdateRateDlg.h \
SVTK_CubeAxesDlg.h \
SVTK_FontWidget.h \
+ SVTK_DialogBase.h \
SVTK_ViewModelBase.h \
SVTK_ViewManager.h \
SVTK_ViewWindow.h \
$(QT_INCLUDES) \
$(OCC_INCLUDES) \
$(VTK_INCLUDES) \
+ $(QWT_INCLUDES) \
$(BOOST_CPPFLAGS)
LDFLAGS+= \
$(QT_MT_LIBS) \
$(OCC_LIBS) \
+ $(QWT_LIBS) \
$(VTK_LIBS)
LIBS+= -lqtx -lsuit -lstd -lCAM -lSalomeObject -lSalomePrs -lVTKViewer
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
int SALOME_POINT_SIZE = 5;
int SALOME_LINE_WIDTH = 3;
-//----------------------------------------------------------------------------
namespace
{
int
{
int anEdgeId = 0;
if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
- float aPickPosition[3];
+ vtkFloatingPointType aPickPosition[3];
thePicker->GetPickPosition(aPickPosition);
- float aMinDist = 1000000.0, aDist = 0;
+ vtkFloatingPointType aMinDist = 1000000.0, aDist = 0;
for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
- int subId; float pcoords[3], closestPoint[3], weights[3];
+ int subId;
+ vtkFloatingPointType pcoords[3], closestPoint[3], weights[3];
aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
if (aDist < aMinDist) {
aMinDist = aDist;
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SALOME_Actor);
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SALOME_Actor
::SALOME_Actor():
myRenderer(NULL),
myOutlineActor->SetVisibility( false );
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SALOME_Actor
::~SALOME_Actor()
{}
-//----------------------------------------------------------------------------
+/*!
+ \return true if the SALOME_Actor has a reference to SALOME_InteractiveObject
+*/
Standard_Boolean
SALOME_Actor
::hasIO()
return !myIO.IsNull();
}
+/*!
+ \return correspoinding reference to SALOME_InteractiveObject
+*/
const Handle(SALOME_InteractiveObject)&
SALOME_Actor
::getIO()
return myIO;
}
+/*!
+ Sets reference to SALOME_InteractiveObject
+ \param theIO - new SALOME_InteractiveObject
+*/
void
SALOME_Actor
::setIO(const Handle(SALOME_InteractiveObject)& theIO)
myIO = theIO;
}
+/*!
+ Sets name the SALOME_Actor
+ \param theName - new name
+*/
void
SALOME_Actor
::setName(const char* theName)
}
-//----------------------------------------------------------------------------
+/*!
+ Publishes the actor in all its internal devices
+*/
void
SALOME_Actor
::AddToRender(vtkRenderer* theRenderer)
theRenderer->AddActor( myOutlineActor.GetPointer() );
}
+/*!
+ Removes the actor from all its internal devices
+*/
void
SALOME_Actor
::RemoveFromRender(vtkRenderer* theRenderer)
theRenderer->RemoveActor( myOutlineActor.GetPointer() );
}
+/*!
+ \return reference on renderer where it is published
+*/
vtkRenderer*
SALOME_Actor
::GetRenderer()
return myRenderer;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Sets interactor in order to use vtkInteractorObserver devices
+ \param theInteractor - new interactor
+*/
void
SALOME_Actor
::SetInteractor(vtkRenderWindowInteractor* theInteractor)
myInteractor = theInteractor;
}
+/*!
+ Put a request to redraw the view
+*/
void
SALOME_Actor
::Update()
myInteractor->CreateTimer(VTKI_TIMER_UPDATE);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Apply view transformation
+ \param theTransform - transformation
+*/
void
SALOME_Actor
::SetTransform(VTKViewer_Transform* theTransform)
myOutlineActor->SetTransform(theTransform);
}
-
+/*!
+ Apply additional position
+*/
void
SALOME_Actor
-::SetPosition(float _arg1, float _arg2, float _arg3)
+::SetPosition(vtkFloatingPointType _arg1,
+ vtkFloatingPointType _arg2,
+ vtkFloatingPointType _arg3)
{
Superclass::SetPosition(_arg1,_arg2,_arg3);
myOutlineActor->SetPosition(_arg1,_arg2,_arg3);
}
-
+/*!
+ Apply additional position
+*/
void
SALOME_Actor
-::SetPosition(float _arg[3])
+::SetPosition(vtkFloatingPointType _arg[3])
{
SetPosition(_arg[0],_arg[1],_arg[2]);
}
-
-//----------------------------------------------------------------
+/*!
+ Shows/hides actor
+ \param theVisibility - new visibility state
+*/
void
SALOME_Actor
::SetVisibility( int theVisibility )
}
}
-
-//----------------------------------------------------------------
+/*!
+ Set selector in order to the actor at any time can restore current selection
+ \param theSelector - new selector
+*/
void
SALOME_Actor
::SetSelector(SVTK_Selector* theSelector)
mySelector = theSelector;
}
+/*!
+ To map current selection to VTK representation
+*/
void
SALOME_Actor
::Highlight(bool theIsHighlight)
highlight(theIsHighlight);
}
+/*!
+ Updates visibility of the highlight devices
+*/
void
SALOME_Actor
::highlight(bool theIsHighlight)
{
- float aBounds[6];
+ vtkFloatingPointType aBounds[6];
GetInput()->GetBounds(aBounds);
myOutline->SetBounds(aBounds);
myOutlineActor->SetVisibility( GetVisibility() && theIsHighlight );
}
-//----------------------------------------------------------------
+/*!
+ To process prehighlight (called from SVTK_InteractorStyle)
+*/
bool
SALOME_Actor
::PreHighlight(vtkInteractorStyle *theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ if ( !GetPickable() )
+ return false;
+
vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
//
myPreHighlightActor->SetVisibility( false );
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
bool anIsChanged = (mySelectionMode != aSelectionMode);
- float x = theSelectionEvent->myX;
- float y = theSelectionEvent->myY;
- float z = 0.0;
+ vtkFloatingPointType x = theSelectionEvent->myX;
+ vtkFloatingPointType y = theSelectionEvent->myY;
+ vtkFloatingPointType z = 0.0;
if( !theIsHighlight ) {
SetPreSelected( false );
return anIsChanged;
}
-
-//----------------------------------------------------------------
+/*!
+ To process highlight (called from SVTK_InteractorStyle)
+*/
bool
SALOME_Actor
::Highlight(vtkInteractorStyle *theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ if ( !GetPickable() )
+ return false;
+
myOutlineActor->SetVisibility( false );
myHighlightActor->SetVisibility( false );
//
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
bool anIsShift = theSelectionEvent->myIsShift;
- if( !anIsShift ) {
+ if( !anIsShift || !theIsHighlight ) {
mySelector->RemoveIObject( this );
}
- float x = theSelectionEvent->myX;
- float y = theSelectionEvent->myY;
- float z = 0.0;
+ if ( !theIsHighlight )
+ return true;
+
+ vtkFloatingPointType x = theSelectionEvent->myX;
+ vtkFloatingPointType y = theSelectionEvent->myY;
+ vtkFloatingPointType z = 0.0;
if( !theSelectionEvent->myIsRectangle ) {
switch(aSelectionMode){
break;
}
}else{
- float xLast = theSelectionEvent->myLastX;
- float yLast = theSelectionEvent->myLastY;
- float zLast = 0.0;
+ vtkFloatingPointType xLast = theSelectionEvent->myLastX;
+ vtkFloatingPointType yLast = theSelectionEvent->myLastY;
+ vtkFloatingPointType zLast = 0.0;
- float x1 = x < xLast ? x : xLast;
- float y1 = y < yLast ? y : yLast;
- float z1 = z < zLast ? z : zLast;
- float x2 = x > xLast ? x : xLast;
- float y2 = y > yLast ? y : yLast;
- float z2 = z > zLast ? z : zLast;
+ vtkFloatingPointType x1 = x < xLast ? x : xLast;
+ vtkFloatingPointType y1 = y < yLast ? y : yLast;
+ vtkFloatingPointType z1 = z < zLast ? z : zLast;
+ vtkFloatingPointType x2 = x > xLast ? x : xLast;
+ vtkFloatingPointType y2 = y > yLast ? y : yLast;
+ vtkFloatingPointType z2 = z > zLast ? z : zLast;
switch(aSelectionMode){
case NodeSelection: {
if(aMapIter != aVectorIdsMap.end()){
const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
vtkIdType anEnd = aVectorIds.size();
- SVTK_RectPicker::TVectorIds::const_iterator anIdIter = aVectorIds.begin();
for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
int aPointId = aVectorIds[anId];
if( aPointId >= 0 && mySelector->IsValid( this, aPointId, true ) ) {
}
case ActorSelection :
{
- float aPnt[3];
- float* aBounds = GetBounds();
+ vtkFloatingPointType aPnt[3];
+ vtkFloatingPointType* aBounds = GetBounds();
bool anIsPicked = true;
for( int i = 0; i <= 1; i++ ) {
if(aMapIter != aVectorIdsMap.end()){
const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
vtkIdType anEnd = aVectorIds.size();
- SVTK_RectPicker::TVectorIds::const_iterator anIdIter = aVectorIds.begin();
for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
int aCellId = aVectorIds[anId];
if ( !mySelector->IsValid( this, aCellId ) )
return true;
}
-//----------------------------------------------------------------------------
+/*!
+ To set up a picker for nodal selection (initialized by SVTK_Renderer::AddActor)
+ \param thePointPicker - new picker
+*/
void
SALOME_Actor
::SetPointPicker(vtkPointPicker* thePointPicker)
myPointPicker = thePointPicker;
}
+/*!
+ To set up a picker for cell selection (initialized by SVTK_Renderer::AddActor)
+ \param theCellPicker - new picker
+*/
void
SALOME_Actor
::SetCellPicker(vtkCellPicker* theCellPicker)
myCellPicker = theCellPicker;
}
+/*!
+ To set up a picker for point rectangle selection (initialized by SVTK_Renderer::AddActor)
+ \param theRectPicker - new picker
+*/
void
SALOME_Actor
::SetPointRectPicker(SVTK_RectPicker* theRectPicker)
myPointRectPicker = theRectPicker;
}
+/*!
+ To set up a picker for cell rectangle selection (initialized by SVTK_Renderer::AddActor)
+ \param theRectPicker - new picker
+*/
void
SALOME_Actor
::SetCellRectPicker(SVTK_RectPicker* theRectPicker)
myCellRectPicker = theRectPicker;
}
-//----------------------------------------------------------------------------
+/*!
+ To set up a prehighlight property (initialized by SVTK_Renderer::AddActor)
+*/
void
SALOME_Actor
::SetPreHighlightProperty(vtkProperty* theProperty)
myPreHighlightActor->SetProperty(theProperty);
}
+/*!
+ To set up a highlight property (initialized by SVTK_Renderer::AddActor)
+*/
void
SALOME_Actor
::SetHighlightProperty(vtkProperty* theProperty)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
//! Apply additional position
virtual
void
- SetPosition(float _arg1, float _arg2, float _arg3);
+ SetPosition(vtkFloatingPointType _arg1,
+ vtkFloatingPointType _arg2,
+ vtkFloatingPointType _arg3);
//! Apply additional position
virtual
void
- SetPosition(float _arg[3]);
+ SetPosition(vtkFloatingPointType _arg[3]);
//----------------------------------------------------------------------------
//! Visibility management
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#ifndef SVTK_H
+#define SVTK_H
+
+#include "VTKViewer.h"
+
#ifdef WNT
-#ifdef SVTK_EXPORTS
-#define SVTK_EXPORT __declspec(dllexport)
-#else
-#define SVTK_EXPORT __declspec(dllimport)
-#endif
+# ifdef SVTK_EXPORTS
+# define SVTK_EXPORT __declspec(dllexport)
+# else
+# define SVTK_EXPORT __declspec(dllimport)
+# endif
#else
-#define SVTK_EXPORT
+# define SVTK_EXPORT
#endif
#if defined WNT
#pragma warning ( disable: 4251 )
#pragma warning ( disable: 4786 )
#endif
+
+#endif
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include "SVTK_Actor.h"
#include "SALOME_Actor.h"
aPoints->Delete();
}
-//=======================================================================
-
vtkStandardNewMacro(SVTK_Actor);
+/*!
+ Constructor
+*/
SVTK_Actor
::SVTK_Actor():
myUnstructuredGrid(vtkUnstructuredGrid::New())
myUnstructuredGrid->Allocate();
}
-//----------------------------------------------------------------------------
void
SVTK_Actor
::Initialize()
SetInput(GetSource());
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::SetSource(vtkUnstructuredGrid* theUnstructuredGrid)
return myUnstructuredGrid.GetPointer();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_Actor
::~SVTK_Actor()
{
}
-
-//----------------------------------------------------------------------------
const TColStd_IndexedMapOfInteger&
SVTK_Actor
::GetMapIndex() const
return myMapIndex;
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::MapCells(SALOME_Actor* theMapActor,
myMapIndex = theMapIndex;
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::MapPoints(SALOME_Actor* theMapActor,
aPoints->SetNumberOfPoints(aNbOfParts);
for(int i = 0; i < aNbOfParts; i++){
int aPartId = theMapIndex( i+1 );
- if(float* aCoord = theMapActor->GetNodeCoord(aPartId)){
+ if(vtkFloatingPointType* aCoord = theMapActor->GetNodeCoord(aPartId)){
aPoints->SetPoint(i,aCoord);
myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,&i);
}
myMapIndex = theMapIndex;
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::MapEdge(SALOME_Actor* theMapActor,
myMapIndex = theMapIndex;
}
-
-//----------------------------------------------------------------------------
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef SVTK_ACTOR_H
#define SVTK_ACTOR_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
vtkCxxRevisionMacro(SVTK_CubeAxesActor2D, "$Revision$");
vtkStandardNewMacro(SVTK_CubeAxesActor2D);
-//----------------------------------------------------------------------------
// Instantiate this object.
SVTK_CubeAxesActor2D::SVTK_CubeAxesActor2D()
{
}
-//----------------------------------------------------------------------------
SVTK_CubeAxesActor2D::~SVTK_CubeAxesActor2D()
{
this->wireActorXY->Delete();
this->rgridMapperXZ->Delete();
}
-//----------------------------------------------------------------------------
// Static variable describes connections in cube.
static int Conn[8][3] = {{1,2,4}, {0,3,5}, {3,0,6}, {2,1,7},
{5,6,0}, {4,7,1}, {7,4,2}, {6,5,3}};
-//----------------------------------------------------------------------------
// Project the bounding box and compute edges on the border of the bounding
// cube. Determine which parts of the edges are visible via intersection
// with the boundary of the viewport (minus borders).
return renderedSomething;
}
-static void ChangeValues(float* aArray1,float* aArray2,float *aRange1,float* aRange2,bool theY){
- float tmp=-1000;
+static void ChangeValues(vtkFloatingPointType* aArray1,
+ vtkFloatingPointType* aArray2,
+ vtkFloatingPointType *aRange1,
+ vtkFloatingPointType* aRange2,
+ bool theY)
+{
+ vtkFloatingPointType tmp=-1000;
if (!theY){
for (int i=0; i<4; i++){
tmp = aArray1[i]; aArray1[i] = aArray2[i]; aArray2[i] = tmp;
}
}
-static void ChangeArrays(float* xCoords,float* yCoords,float* zCoords,
- float* xRange,float* yRange,float* zRange,
- const int xAxes,const int yAxes, const int zAxes)
+static void ChangeArrays(vtkFloatingPointType* xCoords,
+ vtkFloatingPointType* yCoords,
+ vtkFloatingPointType* zCoords,
+ vtkFloatingPointType* xRange,
+ vtkFloatingPointType* yRange,
+ vtkFloatingPointType* zRange,
+ const int xAxes,
+ const int yAxes,
+ const int zAxes)
{
if ( xAxes == 0 && yAxes == 2 && zAxes == 1)
ChangeValues(yCoords,zCoords,yRange,zRange,true);
ChangeValues(zCoords,xCoords,zRange,xRange,false);
}
-//----------------------------------------------------------------------------
// Project the bounding box and compute edges on the border of the bounding
// cube. Determine which parts of the edges are visible via intersection
// with the boundary of the viewport (minus borders).
int SVTK_CubeAxesActor2D::RenderOpaqueGeometry(vtkViewport *viewport)
{
- float bounds[6], slope = 0.0, minSlope, num, den;
- float pts[8][3], d2, d2Min, min;
+ vtkFloatingPointType bounds[6], slope = 0.0, minSlope, num, den;
+ vtkFloatingPointType pts[8][3], d2, d2Min, min;
int i, idx = 0;
int xIdx, yIdx = 0, zIdx = 0, zIdx2, renderedSomething=0;
int xAxes = 0, yAxes, zAxes;
}
else
{
- float e1[2], e2[2], e3[2];
+ vtkFloatingPointType e1[2], e2[2], e3[2];
// Find distance to origin
d2Min = VTK_LARGE_FLOAT;
}
// Setup the axes for plotting
- float xCoords[4], yCoords[4], zCoords[4], xRange[2], yRange[2], zRange[2];
+ vtkFloatingPointType xCoords[4], yCoords[4], zCoords[4], xRange[2], yRange[2], zRange[2];
this->AdjustAxes(pts, bounds, idx, xIdx, yIdx, zIdx, zIdx2,
xAxes, yAxes, zAxes,
xCoords, yCoords, zCoords, xRange, yRange, zRange);
#else
for(i=0;i<numOfLabelsX;i++){
#endif
- float val = bounds[0]+i*(bounds[1]-bounds[0])/(numOfLabelsX-1);
+ vtkFloatingPointType val = bounds[0]+i*(bounds[1]-bounds[0])/(numOfLabelsX-1);
XCoords->InsertNextValue(val);
}
// YCoords coordinates for Y grid
#else
for(i=0;i<numOfLabelsX;i++){
#endif
- float val = bounds[2]+i*(bounds[3]-bounds[2])/(numOfLabelsY-1);
+ vtkFloatingPointType val = bounds[2]+i*(bounds[3]-bounds[2])/(numOfLabelsY-1);
YCoords->InsertNextValue(val);
}
// ZCoords coordinates for Z grid
#else
for(i=0;i<numOfLabelsZ;i++){
#endif
- float val = bounds[4]+i*(bounds[5]-bounds[4])/(numOfLabelsZ-1);
+ vtkFloatingPointType val = bounds[4]+i*(bounds[5]-bounds[4])/(numOfLabelsZ-1);
ZCoords->InsertNextValue(val);
}
rgrid->Delete();
- float aCPosition[3];
- float aCDirection[3];
+ vtkFloatingPointType aCPosition[3];
+ vtkFloatingPointType aCDirection[3];
this->Camera->GetPosition(aCPosition);
this->Camera->GetDirectionOfProjection(aCDirection);
bool replaceXY=false;
bool replaceYZ=false;
bool replaceXZ=false;
- float p[6][3]; // centers of planes
- float vecs[6][3]; // 6 vectors from camera position to centers
+ vtkFloatingPointType p[6][3]; // centers of planes
+ vtkFloatingPointType vecs[6][3]; // 6 vectors from camera position to centers
- float aMiddleX = (XCoords->GetValue(0) + XCoords->GetValue(numOfLabelsX-1))/2;
- float aMiddleY = (YCoords->GetValue(0) + YCoords->GetValue(numOfLabelsY-1))/2;
- float aMiddleZ = (ZCoords->GetValue(0) + ZCoords->GetValue(numOfLabelsZ-1))/2;
+ vtkFloatingPointType aMiddleX = (XCoords->GetValue(0) + XCoords->GetValue(numOfLabelsX-1))/2;
+ vtkFloatingPointType aMiddleY = (YCoords->GetValue(0) + YCoords->GetValue(numOfLabelsY-1))/2;
+ vtkFloatingPointType aMiddleZ = (ZCoords->GetValue(0) + ZCoords->GetValue(numOfLabelsZ-1))/2;
// plane XY
p[0][0] = aMiddleX; // plane X=0.5 Y=0.5 Z=0
YCoords->Delete();
ZCoords->Delete();
- float color[3];
+ vtkFloatingPointType color[3];
this->GetProperty()->GetColor(color);
this->wireActorXY->GetProperty()->SetColor(color);
return renderedSomething;
}
-//----------------------------------------------------------------------------
// Release any graphics resources that are being consumed by this actor.
// The parameter window could be used to determine which graphic
// resources to release.
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class vtkRectilinearGridGeometryFilter;
class VTKViewer_Transform;
-#include <SVTK.h>
+#include "SVTK.h"
+#include "VTKViewer.h"
#ifndef WNT
class VTK_HYBRID_EXPORT SVTK_CubeAxesActor2D : public vtkCubeAxesActor2D
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SVTK_CubeAxesActor2D.h"
#include "QtxAction.h"
+#include "QtxIntSpinBox.h"
#include <qlayout.h>
#include <qframe.h>
* Description : Tab of dialog
*/
-//=======================================================================
-// name : SVTK_AxisWidget::AxisWg
-// Purpose : Constructor
-//=======================================================================
+/*!
+ Constructor
+*/
SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent)
: QFrame(theParent)
{
aHBox = new QHBox(myLabelsGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("NUMBER"), aHBox);
- myLabelNumber = new QLineEdit(aHBox);
- myLabelNumber->setValidator(new QIntValidator(0, 25, this));
- myLabelNumber->installEventFilter(this);
+ myLabelNumber = new QtxIntSpinBox(0,25,1,aHBox,"SpinBoxLabelNumber");
aLabels.append(aLabel);
aHBox = new QHBox(myLabelsGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("OFFSET"), aHBox);
- myLabelOffset = new QLineEdit(aHBox);
+ myLabelOffset = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxLabellOffset");
aLabels.append(aLabel);
aHBox = new QHBox(myLabelsGrp);
aHBox = new QHBox(myTicksGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("LENGTH"), aHBox);
- myTickLength = new QLineEdit(aHBox);
+ myTickLength = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxTickLength");
+
aLabels.append(aLabel);
// Layout
connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked()));
}
+/*!
+ Destructor
+*/
SVTK_AxisWidget::~SVTK_AxisWidget()
{
}
onTicksChecked();
}
-bool SVTK_AxisWidget::eventFilter(QObject* o, QEvent* e)
-{
- if (e->type() == QEvent::FocusOut) {
- bool isOK = false;
- int k = myLabelNumber->text().toInt(&isOK);
- if (isOK && k > 25) myLabelNumber->setText("25");
- }
- return false;
-}
-
-//=======================================================================
-// name : SVTK_AxisWidget::onNameChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::setEnabled(QGroupBox* theGrp, const bool theState)
{
QObjectList aChildren(*theGrp->children());
((QHBox*)anObj)->setEnabled(theState);
}
-//=======================================================================
-// Labels : SVTK_AxisWidget::onLabelsChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::onLabelsChecked()
{
setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked());
}
-//=======================================================================
-// Labels : SVTK_AxisWidget::onTicksChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::onTicksChecked()
{
setEnabled(myTicksGrp, myIsTicksVisible->isChecked());
}
-//=======================================================================
-// name : SVTK_AxisWidget::onNameChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::onNameChecked()
{
setEnabled(myNameGrp, myIsNameVisible->isChecked());
}
-//=======================================================================
-// name : SVTK_AxisWidget::UseName
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::UseName(const bool toUse)
{
myIsNameVisible->setChecked(toUse);
}
-//=======================================================================
-// name : SVTK_AxisWidget::SetName
-// Purpose :
-//================================================== =====================
void SVTK_AxisWidget::SetName(const QString& theName)
{
myAxisName->setText(theName);
}
-//=======================================================================
-// name : SVTK_AxisWidget::SetNameFont
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::SetNameFont(const QColor& theColor,
const int theFont,
const bool theIsBold,
myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
}
-//=======================================================================
-// name : SVTK_AxisWidget::SetNameFont
-// Purpose :
-//=======================================================================
bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor)
{
if (theActor == 0)
vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();
if (aTitleProp !=0)
{
- float c[ 3 ];
+ vtkFloatingPointType c[ 3 ];
aTitleProp->GetColor(c);
aTitleColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
aTitleFontFamily = aTitleProp->GetFontFamily();
vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();
if (aLabelsProp !=0)
{
- float c[ 3 ];
+ vtkFloatingPointType c[ 3 ];
aLabelsProp->GetColor(c);
aLabelsColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
aLabelsFontFamily = aLabelsProp->GetFontFamily();
}
myIsLabelsVisible->setChecked(useLabels);
- myLabelNumber->setText(QString("%1").arg(nbLabels));
- myLabelOffset->setText(QString("%1").arg(anOffset));
+ myLabelNumber->setValue(nbLabels);
+ myLabelOffset->setValue(anOffset);
myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
// Tick marks
int aTickLength = theActor->GetTickLength();
myIsTicksVisible->setChecked(useTickMarks);
- myTickLength->setText(QString("%1").arg(aTickLength));
+ myTickLength->setValue(aTickLength);
return true;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::Apply
-// Purpose :
-//=======================================================================
bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor)
{
if (theActor == 0)
theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
- bool isOk = false;
- int nbLabels = myLabelNumber->text().toInt(&isOk);
- if (isOk)
- theActor->SetNumberOfLabels(nbLabels);
+ int nbLabels = myLabelNumber->value();
+ theActor->SetNumberOfLabels(nbLabels);
- int anOffset = myLabelOffset->text().toInt(&isOk);
- if (isOk)
- theActor->SetTickOffset(anOffset);
+ int anOffset = myLabelOffset->value();
+ theActor->SetTickOffset(anOffset);
QColor aLabelsColor(255, 255, 255);
int aLabelsFontFamily = VTK_ARIAL;
// Tick marks
theActor->SetTickVisibility(myIsTicksVisible->isChecked());
- int aTickLength = myTickLength->text().toInt(&isOk);
- if (isOk)
- theActor->SetTickLength(aTickLength);
+ int aTickLength = myTickLength->value();
+ theActor->SetTickLength(aTickLength);
return true;
}
Description : Dialog for specifynig cube axes properties
*/
-//=======================================================================
-// name : SVTK_CubeAxesDlg::SVTK_CubeAxesDlg
-// Purpose : Constructor
-//=======================================================================
-SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction):
- QDialog(theParent,
- theName,
- false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myMainWindow(theParent),
- myAction(theAction)
+/*!
+ Constructor
+*/
+SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName):
+ SVTK_DialogBase(theAction,
+ theParent,
+ theName),
+ myMainWindow(theParent)
{
setCaption(tr("CAPTION"));
QVBoxLayout* aLay = new QVBoxLayout(this, 5, 5);
aLay->addWidget(createMainFrame(this));
aLay->addWidget(createButtonFrame(this));
+
+ connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
+ connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::createMainFrame
-// Purpose : Create frame containing dialog's input fields
-//=======================================================================
+/*!
+ Create frame containing dialog's input fields
+*/
QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent)
{
QFrame* aFrame = new QFrame(theParent);
return aFrame;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::createButtonFrame
-// Purpose : Create frame containing buttons
-//=======================================================================
+/*!
+ Create frame containing buttons
+*/
QWidget* SVTK_CubeAxesDlg::createButtonFrame(QWidget* theParent)
{
QFrame* aFrame = new QFrame(theParent);
return aFrame;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg
-// Purpose : Destructor
-//=======================================================================
+/*!
+ Destructor
+*/
SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg()
{
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::Update
-// Purpose : Update dialog fields, connect signals and slots, show dialog
-//=======================================================================
+/*!
+ Update dialog fields, connect signals and slots, show dialog
+*/
void SVTK_CubeAxesDlg::Update()
{
myActor = myMainWindow->GetCubeAxes();
myIsVisible->setChecked(myActor->GetVisibility() ? true : false);
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::isValid
-// Purpose : Verify validity of entry data
-//=======================================================================
+/*!
+ Verify validity of entry data
+*/
bool SVTK_CubeAxesDlg::isValid() const
{
return true;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::onApply
-// Purpose : Verify validity of entry data
-//=======================================================================
+/*!
+ Verify validity of entry data
+*/
bool SVTK_CubeAxesDlg::onApply()
{
bool isOk = true;
try
{
+ QWidget *aCurrWid = this->focusWidget();
+ aCurrWid->clearFocus();
+ aCurrWid->setFocus();
+
isOk = isOk && myAxes[ 0 ]->Apply(myActor->GetXAxisActor2D());
isOk = isOk && myAxes[ 1 ]->Apply(myActor->GetYAxisActor2D());
isOk = isOk && myAxes[ 2 ]->Apply(myActor->GetZAxisActor2D());
return isOk;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed.
-//=======================================================================
+/*!
+ SLOT called when "Ok" button pressed.
+*/
void SVTK_CubeAxesDlg::onOk()
{
if (onApply())
onClose();
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
+/*!
+ SLOT: called when "Close" button pressed. Close dialog
+*/
void SVTK_CubeAxesDlg::onClose()
{
reject();
-
- myAction->setOn( false );
-}
-
-void SVTK_CubeAxesDlg::done( int r )
-{
- myAction->setOn( false );
- QDialog::done( r );
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#ifndef SVTK_CubeAxesDlg_H
#define SVTK_CubeAxesDlg_H
-#include <qdialog.h>
+#include "SVTK_DialogBase.h"
+
#include <qframe.h>
class QWidget;
class QGroupBox;
class QtxAction;
+class QtxIntSpinBox;
class vtkAxisActor2D;
class SVTK_CubeAxesActor2D;
* Class : SVTK_CubeAxesDlg
* Description : Dialog for specifynig cube axes properties
*/
-class SVTK_CubeAxesDlg : public QDialog
+class SVTK_CubeAxesDlg : public SVTK_DialogBase
{
Q_OBJECT
public:
- SVTK_CubeAxesDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction);
+ SVTK_CubeAxesDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName);
virtual ~SVTK_CubeAxesDlg();
void Update();
bool onApply();
void onClose();
- virtual void done( int );
-
private:
QWidget* createButtonFrame( QWidget* );
QWidget* createMainFrame ( QWidget* );
private:
SVTK_MainWindow *myMainWindow;
SVTK_CubeAxesActor2D* myActor;
- QtxAction* myAction;
QTabWidget* myTabWg;
QCheckBox* myIsVisible;
bool ReadData( vtkAxisActor2D* );
bool Apply( vtkAxisActor2D* );
-protected:
- bool eventFilter(QObject*, QEvent*);
-
private slots:
void onNameChecked();
void onLabelsChecked();
// labels
QGroupBox* myLabelsGrp;
QCheckBox* myIsLabelsVisible;
- QLineEdit* myLabelNumber;
- QLineEdit* myLabelOffset;
+ QtxIntSpinBox* myLabelNumber;
+ QtxIntSpinBox* myLabelOffset;
SVTK_FontWidget* myLabelsFont;
// tick marks
QGroupBox* myTicksGrp;
QCheckBox* myIsTicksVisible;
- QLineEdit* myTickLength;
+ QtxIntSpinBox* myTickLength;
friend class SVTK_CubeAxesDlg;
};
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_DeviceActor);
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_DeviceActor
::SVTK_DeviceActor()
{
myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_DeviceActor
::~SVTK_DeviceActor()
{
myPassFilter[i]->Delete();
}
-
-//----------------------------------------------------------------------------
+/*!
+ To insert some additional filters and then sets the given vtkMapper
+*/
void
SVTK_DeviceActor
::SetMapper(vtkMapper* theMapper)
InitPipeLine(theMapper);
}
+/*!
+ To initialize internal pipeline
+*/
void
SVTK_DeviceActor
::InitPipeLine(vtkMapper* theMapper)
Superclass::SetMapper(theMapper);
}
-//----------------------------------------------------------------------------
+/*!
+ Allows to get initial vtkDataSet
+*/
vtkDataSet*
SVTK_DeviceActor
::GetInput()
return myPassFilter.front()->GetOutput();
}
+/*!
+ Allows to set initial vtkDataSet
+*/
void
SVTK_DeviceActor
::SetInput(vtkDataSet* theDataSet)
InitPipeLine(myMapper);
}
-//----------------------------------------------------------------------------
+/*!
+ To provide VTK to Object and backward mapping
+*/
void
SVTK_DeviceActor::
SetStoreMapping(bool theStoreMapping)
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return time of modification
+*/
unsigned long int
SVTK_DeviceActor
::GetMTime()
return mTime;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Apply a view transformation
+ \param theTransform - transformation
+*/
void
SVTK_DeviceActor
::SetTransform(VTKViewer_Transform* theTransform)
myTransformFilter->SetTransform(theTransform);
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return true if actor is shrinkable
+*/
bool
SVTK_DeviceActor
::IsShrunkable()
{
return myIsShrinkable;
}
-
+
+/*!
+ Changes shrinkable state of actor
+ theIsShrinkable - new shrinkable state
+*/
void
SVTK_DeviceActor
::SetShrinkable(bool theIsShrinkable)
myIsShrinkable = theIsShrinkable;
}
+/*!
+ \return true if actor is shrunkable
+*/
bool
SVTK_DeviceActor
::IsShrunk()
return myIsShrunk;
}
+/*!
+ Insert shrink filter into pipeline
+*/
void
SVTK_DeviceActor
::SetShrink()
}
}
+/*!
+ Remove shrink filter from pipeline
+*/
void
SVTK_DeviceActor
::UnShrink()
}
}
-float
+/*!
+ \return shrink factor
+*/
+vtkFloatingPointType
SVTK_DeviceActor
::GetShrinkFactor()
{
return myShrinkFilter->GetShrinkFactor();
}
+/*!
+ Changes shrink factor
+ \param theValue - new shrink factor
+*/
void
SVTK_DeviceActor
-::SetShrinkFactor(float theValue)
+::SetShrinkFactor(vtkFloatingPointType theValue)
{
myShrinkFilter->SetShrinkFactor(theValue);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
+ param theMode - new mode
+*/
void
SVTK_DeviceActor
::SetRepresentation(SVTK::Representation::Type theMode)
myRepresentation = theMode;
}
+/*!
+ \return current representation mode
+*/
SVTK::Representation::Type
SVTK_DeviceActor
::GetRepresentation()
return myRepresentation;
}
-float
+/*!
+ \return default point size
+*/
+vtkFloatingPointType
SVTK_DeviceActor
::GetDefaultPointSize()
{
return 5;
}
-float
+/*!
+ \return default line width
+*/
+vtkFloatingPointType
SVTK_DeviceActor
::GetDefaultLineWidth()
{
return 3;
}
-
+/*!
+ \return true if actor is shaded
+*/
bool
SVTK_DeviceActor
::IsShaded()
return myIsShaded;
}
+/*!
+ Sets shaded state of actor
+ \param theShaded - new shaded state
+*/
void
SVTK_DeviceActor
::SetShaded(bool theShaded)
myIsShaded = theShaded;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Maps VTK index of a node to corresponding object index
+*/
int
SVTK_DeviceActor
::GetNodeObjId(int theVtkID)
return theVtkID;
}
-float*
+/*!
+ Get coordinates of a node for given object index
+*/
+vtkFloatingPointType*
SVTK_DeviceActor
::GetNodeCoord(int theObjID)
{
}
+/*!
+ Get corresponding #vtkCell for given object index
+*/
vtkCell*
SVTK_DeviceActor
::GetElemCell(int theObjID)
return GetInput()->GetCell(theObjID);
}
+/*!
+ Maps VTK index of a cell to corresponding object index
+*/
int
SVTK_DeviceActor
::GetElemObjId(int theVtkID)
return theVtkID;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Renders actor
+*/
void
SVTK_DeviceActor
::Render(vtkRenderer *ren, vtkMapper* m)
{
if(myIsResolveCoincidentTopology){
int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
- float aFactor, aUnit;
+ vtkFloatingPointType aFactor, aUnit;
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
}
}
-
+/*!
+ Set polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
SVTK_DeviceActor
-::SetPolygonOffsetParameters(float factor, float units)
+::SetPolygonOffsetParameters(vtkFloatingPointType factor,
+ vtkFloatingPointType units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
}
+/*!
+ Get polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
SVTK_DeviceActor
-::GetPolygonOffsetParameters(float& factor, float& units)
+::GetPolygonOffsetParameters(vtkFloatingPointType& factor,
+ vtkFloatingPointType& units)
{
factor = myPolygonOffsetFactor;
units = myPolygonOffsetUnits;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#ifndef SVTK_DEVICE_ACTOR_H
#define SVTK_DEVICE_ACTOR_H
+#include "SVTK.h"
+#include "VTKViewer.h"
+
#include <vector>
#include <vtkLODActor.h>
class vtkShrinkFilter;
class vtkDataSetMapper;
-#include "SVTK.h"
-
-//----------------------------------------------------------------------------
namespace SVTK
{
namespace Representation
}
-//----------------------------------------------------------------------------
class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor
{
public:
GetNodeObjId(int theVtkID);
virtual
- float*
+ vtkFloatingPointType*
GetNodeCoord(int theObjID);
virtual
/** @name For shrink mamnagement purpose */
//@{
- float
+ vtkFloatingPointType
GetShrinkFactor();
virtual
void
- SetShrinkFactor(float value);
+ SetShrinkFactor(vtkFloatingPointType value);
virtual
void
GetRepresentation();
virtual
- float
+ vtkFloatingPointType
GetDefaultPointSize();
virtual
- float
+ vtkFloatingPointType
GetDefaultLineWidth();
bool
bool myIsShrunk;
bool myIsResolveCoincidentTopology;
- float myPolygonOffsetFactor;
- float myPolygonOffsetUnits;
+ vtkFloatingPointType myPolygonOffsetFactor;
+ vtkFloatingPointType myPolygonOffsetUnits;
- void SetPolygonOffsetParameters(float factor, float units);
- void GetPolygonOffsetParameters(float& factor, float& units);
+ void SetPolygonOffsetParameters(vtkFloatingPointType factor,
+ vtkFloatingPointType units);
+ void GetPolygonOffsetParameters(vtkFloatingPointType& factor,
+ vtkFloatingPointType& units);
SVTK_DeviceActor();
~SVTK_DeviceActor();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
* Description : Dialog for specifynig font
*/
-//=======================================================================
-// name : SVTK_FontWidget
-// Purpose : Constructor
-//=======================================================================
+/*!
+ Constructor
+*/
SVTK_FontWidget::SVTK_FontWidget( QWidget* theParent )
: QHBox( theParent )
{
connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
}
-//=======================================================================
-// name : ~SVTK_FontWidget
-// Purpose : Destructor
-//=======================================================================
+/*!
+ Destructor
+*/
SVTK_FontWidget::~SVTK_FontWidget()
{
}
-//=======================================================================
-// name : SetColor
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::SetColor( const QColor& theColor )
{
myColorBtn->setPaletteBackgroundColor( theColor );
}
-//=======================================================================
-// name : GetColor
-// Purpose :
-//=======================================================================
QColor SVTK_FontWidget::GetColor() const
{
return myColorBtn->paletteBackgroundColor();
}
-//=======================================================================
-// name : onColor
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::onColor()
{
QColor aColor = QColorDialog::getColor( GetColor(), this );
SetColor( aColor );
}
-//=======================================================================
-// name : SetData
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::SetData( const QColor& theColor,
const int theFamily,
const bool theBold,
myShadow->setChecked( theShadow );
}
-//=======================================================================
-// name : GetData
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::GetData( QColor& theColor,
int& theFamily,
bool& theBold,
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SVTK_Functor_H
#define SVTK_Functor_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
-//----------------------------------------------------------------------------
vtkStandardNewMacro(QVTK_GenericRenderWindowInteractor);
+/*!
+ Constructor
+*/
QVTK_GenericRenderWindowInteractor
::QVTK_GenericRenderWindowInteractor()
{
connect(myTimer, SIGNAL(timeout()), this, SLOT(OnTimeOut())) ;
}
+/*!
+ Destructor
+*/
QVTK_GenericRenderWindowInteractor
::~QVTK_GenericRenderWindowInteractor()
{
delete myTimer;
}
-
-//----------------------------------------------------------------------------
+/*!
+ The slot connects to QTimer::timeout signal to invoke vtkCommand::TimerEvent
+*/
void
QVTK_GenericRenderWindowInteractor
::OnTimeOut()
}
}
+/*!
+ Starts the QTimer instance on defined microseconds
+*/
int
QVTK_GenericRenderWindowInteractor
::CreateTimer(int vtkNotUsed(timertype))
return 1;
}
+/*!
+ Stops the QTimer instance
+*/
int
QVTK_GenericRenderWindowInteractor
::DestroyTimer(void)
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_GenericRenderWindowInteractor);
+/*!
+ Constructor
+*/
SVTK_GenericRenderWindowInteractor
::SVTK_GenericRenderWindowInteractor():
myRenderWidget(NULL)
{
}
+/*!
+ Destructor
+*/
SVTK_GenericRenderWindowInteractor
::~SVTK_GenericRenderWindowInteractor()
{
}
+/*!
+ To get access to SVTK_Selector
+*/
SVTK_Selector*
SVTK_GenericRenderWindowInteractor
::GetSelector()
return mySelector.GetPointer();
}
+/*!
+ To initialize mySelector field
+ \param theSelector - new selector
+*/
void
SVTK_GenericRenderWindowInteractor
::SetSelector(SVTK_Selector* theSelector)
mySelector = theSelector;
}
+/*!
+ To get access to QWidget, where vtkRenderWindow maps to.
+*/
QWidget*
SVTK_GenericRenderWindowInteractor
::GetRenderWidget()
return myRenderWidget;
}
+/*!
+ To initialize myRenderWidget field.
+*/
void
SVTK_GenericRenderWindowInteractor
::SetRenderWidget(QWidget* theRenderWidget)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class SVTK_Renderer;
-//============================================================================
-//! Introduction of the class is intended to implement Qt based #CreateTimer and #DestroyTimer functionality.
/*!
+ \class QVTK_GenericRenderWindowInteractor
+ Introduction of the class is intended to implement Qt based #CreateTimer and #DestroyTimer functionality.
The class intendes to implement platform indepenedant subclass of vtkRenderWindowInteractor.
This is done by usage of Qt library.
\note
};
-//============================================================================
-//! This class introduce SALOME specific to the base one
/*!
+ \class SVTK_GenericRenderWindowInteractor
+ This class introduce SALOME specific to the base one
In this class new members is added (#mySelector and #myRenderWidget).
They are used for initialization of #SVTK_InteractorStyle by redefinition of
#SVTK_InteractorStyle::SetInteractor method
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_InteractorStyle);
-//----------------------------------------------------------------------------
+
+/*!
+ Constructor
+*/
SVTK_InteractorStyle
::SVTK_InteractorStyle():
mySelectionEvent(new SVTK_SelectionEvent()),
myControllerOnKeyDown->Delete();
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_InteractorStyle
::~SVTK_InteractorStyle()
{
}
-//----------------------------------------------------------------------------
+/*!
+ \return widget for rendering
+*/
QWidget*
SVTK_InteractorStyle
::GetRenderWidget()
return myInteractor->GetRenderWidget();
}
+/*!
+ \return selector
+*/
SVTK_Selector*
SVTK_InteractorStyle
::GetSelector()
return myInteractor->GetSelector();
}
-//----------------------------------------------------------------------------
+/*!
+ Generate special SVTK_SelectionEvent
+*/
SVTK_SelectionEvent*
SVTK_InteractorStyle
::GetSelectionEvent()
return mySelectionEvent.get();
}
-//----------------------------------------------------------------------------
+/*!
+ Generate special SVTK_SelectionEvent with flipped Y coordinate
+*/
SVTK_SelectionEvent*
SVTK_InteractorStyle
::GetSelectionEventFlipY()
return mySelectionEvent.get();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::RotateXY(int dx, int dy)
this->Render();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::PanXY(int x, int y, int oldX, int oldY)
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::DollyXY(int dx, int dy)
this->Render();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::SpinXY(int x, int y, int oldX, int oldY)
}
-//----------------------------------------------------------------------------
+/*!
+ To reset reset view
+*/
void
SVTK_InteractorStyle
::OnConfigure()
this->GetCurrentRenderer()->InvokeEvent(vtkCommand::ConfigureEvent,NULL);
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle mouse move event
+*/
void
SVTK_InteractorStyle
::OnMouseMove()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonDown()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonUp()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonDown()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonUp()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonDown()
x, y );
}
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonUp()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle mouse move event
+*/
void
SVTK_InteractorStyle
::OnMouseMove(int vtkNotUsed(ctrl),
onCursorMove(QPoint(x, y));
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonDown(int ctrl, int shift,
return;
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonUp(int vtkNotUsed(ctrl),
}
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonDown(int ctrl,
}
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonUp(int vtkNotUsed(ctrl),
}
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonDown(int ctrl,
}
}
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonUp(int vtkNotUsed(ctrl),
}
}
-//----------------------------------------------------------------------------
/* XPM */
const char* imageZoomCursor[] = {
"32 32 3 1",
"................................"};
-//----------------------------------------------------------------------------
-// loads cursors for viewer operations - zoom, pan, etc...
+/*!
+ loads cursors for viewer operations - zoom, pan, etc...
+*/
void
SVTK_InteractorStyle
::loadCursors()
}
-//----------------------------------------------------------------------------
-// starts Zoom operation (e.g. through menu command)
+/*!
+ Starts Zoom operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startZoom()
}
-//----------------------------------------------------------------------------
-// starts Pan operation (e.g. through menu command)
+/*!
+ Starts Pan operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startPan()
ForcedState = VTK_INTERACTOR_STYLE_CAMERA_PAN;
}
-//----------------------------------------------------------------------------
-// starts Rotate operation (e.g. through menu command)
+/*!
+ Starts Rotate operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startRotate()
}
-//----------------------------------------------------------------------------
-// starts Spin operation (e.g. through menu command)
+/*!
+ Starts Spin operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startSpin()
-//----------------------------------------------------------------------------
-// starts Fit Area operation (e.g. through menu command)
+/*!
+ Starts Fit Area operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startFitArea()
}
-//----------------------------------------------------------------------------
-// starts Global Panning operation (e.g. through menu command)
+/*!
+ Starts Global Panning operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startGlobalPan()
}
-//----------------------------------------------------------------------------
-// fits viewer contents to rect
+/*!
+ Fits viewer contents to rect
+*/
void
SVTK_InteractorStyle
::fitRect(const int left,
}
-//----------------------------------------------------------------------------
-// starts viewer operation (!internal usage!)
+/*!
+ Starts viewer operation (!internal usage!)
+*/
void
SVTK_InteractorStyle
::startOperation(int operation)
}
-//----------------------------------------------------------------------------
-// sets proper cursor for window when viewer operation is activated
+/*!
+ Sets proper cursor for window when viewer operation is activated
+*/
void
SVTK_InteractorStyle
::setCursor(const int operation)
}
-//----------------------------------------------------------------------------
-// called when viewer operation started (!put necessary initialization here!)
+/*!
+ Called when viewer operation started (!put necessary initialization here!)
+*/
void
SVTK_InteractorStyle
::onStartOperation()
{
- if (!GetRenderWidget()) return;
- // VSV: LOD actor activisation
- // this->Interactor->GetRenderWindow()->SetDesiredUpdateRate(this->Interactor->GetDesiredUpdateRate());
+ if (!GetRenderWidget())
+ return;
+
+ vtkRenderWindowInteractor *aRWI = this->Interactor;
+ vtkRenderWindow *aRenWin = aRWI->GetRenderWindow();
+ aRenWin->SetDesiredUpdateRate(aRWI->GetDesiredUpdateRate());
+
switch (State) {
case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
}
-//----------------------------------------------------------------------------
-// called when viewer operation finished (!put necessary post-processing here!)
+/*!
+ Called when viewer operation finished (!put necessary post-processing here!)
+*/
void
SVTK_InteractorStyle
::onFinishOperation()
if (!GetRenderWidget())
return;
- // VSV: LOD actor activisation
- // rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
+ vtkRenderWindowInteractor *aRWI = this->Interactor;
+ vtkRenderWindow *aRenWin = aRWI->GetRenderWindow();
+ aRenWin->SetDesiredUpdateRate(aRWI->GetStillUpdateRate());
SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
//
SALOME_Actor* anActor = GetFirstSALOMEActor(myPicker.GetPointer());
aSelectionEvent->myIsRectangle = false;
+
+ if(!myShiftState)
+ GetSelector()->ClearIObjects();
+
if(anActor){
anActor->Highlight( this, aSelectionEvent, true );
}else{
if(myLastHighlitedActor.GetPointer() && myLastHighlitedActor.GetPointer() != anActor)
myLastHighlitedActor->Highlight( this, aSelectionEvent, false );
- if(!myShiftState)
- GetSelector()->ClearIObjects();
}
myLastHighlitedActor = anActor;
}
}
-// called during viewer operation when user moves mouse (!put necessary processing here!)
-//----------------------------------------------------------------------------
+/*!
+ Called during viewer operation when user moves mouse (!put necessary processing here!)
+*/
void
SVTK_InteractorStyle
::onOperation(QPoint mousePos)
}
}
-// called when user moves mouse inside viewer window and there is no active viewer operation
-// (!put necessary processing here!)
-//----------------------------------------------------------------------------
+/*!
+ Called when user moves mouse inside viewer window and there is no active viewer operation
+ (!put necessary processing here!)
+*/
void
SVTK_InteractorStyle
::onCursorMove(QPoint mousePos)
this->Render();
}
-// called on finsh GlobalPan operation
-//----------------------------------------------------------------------------
+/*!
+ Called on finsh GlobalPan operation
+*/
void
SVTK_InteractorStyle
::Place(const int theX, const int theY)
-// Translates view from Point to Point
-//----------------------------------------------------------------------------
+/*!
+ Translates view from Point to Point
+*/
void
SVTK_InteractorStyle
::TranslateView(int toX, int toY, int fromX, int fromY)
{
vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera();
double viewFocus[4], focalDepth, viewPoint[3];
- float newPickPoint[4], oldPickPoint[4], motionVector[3];
+ vtkFloatingPointType newPickPoint[4], oldPickPoint[4], motionVector[3];
cam->GetFocalPoint(viewFocus);
this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
motionVector[2] + viewPoint[2]);
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::IncrementalPan( const int incrX, const int incrY )
this->PanXY( incrX, incrY, 0, 0 );
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::IncrementalZoom( const int incr )
this->DollyXY( incr, incr );
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::IncrementalRotate( const int incrX, const int incrY )
this->RotateXY( incrX, -incrY );
}
-//----------------------------------------------------------------------------
+/*!
+ Redefined in order to add an observer (callback) for custorm event (space mouse event)
+*/
void
SVTK_InteractorStyle
::SetInteractor( vtkRenderWindowInteractor* theInteractor )
}
}
-
-//----------------------------------------------------------------------------
+/*!
+ To implement cached rendering
+*/
void
SVTK_InteractorStyle
::OnTimer()
this->Interactor->Render();
}
-//----------------------------------------------------------------------------
+/*!
+ To invoke #vtkRenderWindowInteractor::CreateTimer
+*/
void
SVTK_InteractorStyle
::Render()
this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::onSpaceMouseMove( double* data )
IncrementalRotate( (int)data[3], 0 ); // 5. tilt the control forward/backward = rotate around X axis (Z axis of local coordinate system of space mouse)
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::onSpaceMouseButton( int button )
DominantCombinedSwitch();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::DominantCombinedSwitch()
printf( "\n--DominantCombinedSwitch() NOT IMPLEMENTED--\n" );
}
-//----------------------------------------------------------------------------
+/*!
+ Main process event method (reimplemented from #vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::ProcessEvents( vtkObject* object,
Superclass::ProcessEvents( object, event, clientData, callData );
}
-//----------------------------------------------------------------------------
+
+/*!
+ To handle keyboard event (reimplemented from #vtkInteractorStyle)
+*/
void SVTK_InteractorStyle::OnChar()
{
}
-//----------------------------------------------------------------------------
+
+/*!
+ Redefined vtkInteractorStyle::OnKeyDown
+*/
void SVTK_InteractorStyle::OnKeyDown()
{
bool bInvokeSuperclass=myControllerOnKeyDown->OnKeyDown(this);
Superclass::OnKeyDown();
}
}
-//----------------------------------------------------------------------------
+
+/*!
+ Provide instructions for Picking
+*/
void SVTK_InteractorStyle::ActionPicking()
{
int x, y;
onFinishOperation();
startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
}
-//----------------------------------------------------------------------------
+
+/*!
+ To set current increment controller
+*/
void SVTK_InteractorStyle::SetControllerOnKeyDown(SVTK_ControllerOnKeyDown* theController)
{
myControllerOnKeyDown=theController;
}
-//----------------------------------------------------------------------------
+
+/*!
+ To get current OnKeyDown controller
+*/
SVTK_ControllerOnKeyDown* SVTK_InteractorStyle::ControllerOnKeyDown()
{
return myControllerOnKeyDown.GetPointer();
}
-//----------------------------------------------------------------------------
+
+/*!
+ To get current increment controller
+*/
void SVTK_InteractorStyle::SetControllerIncrement(SVTK_ControllerIncrement* theController)
{
myControllerIncrement=theController;
}
-//----------------------------------------------------------------------------
+
+/*!
+ To get current increment controller
+*/
SVTK_ControllerIncrement* SVTK_InteractorStyle::ControllerIncrement()
{
return myControllerIncrement.GetPointer();
}
vtkStandardNewMacro(SVTK_ControllerIncrement);
-//----------------------------------------------------------------------------
SVTK_ControllerIncrement::SVTK_ControllerIncrement()
{
myIncrement=10;
}
-//----------------------------------------------------------------------------
SVTK_ControllerIncrement::~SVTK_ControllerIncrement()
{
}
-//----------------------------------------------------------------------------
void SVTK_ControllerIncrement::SetStartValue(const int theValue)
{
myIncrement=theValue;
}
-//----------------------------------------------------------------------------
int SVTK_ControllerIncrement::Current()const
{
return myIncrement;
}
-//----------------------------------------------------------------------------
int SVTK_ControllerIncrement::Increase()
{
++myIncrement;
return myIncrement;
}
-//----------------------------------------------------------------------------
int SVTK_ControllerIncrement::Decrease()
{
if (myIncrement>1){
}
vtkStandardNewMacro(SVTK_ControllerOnKeyDown);
-//----------------------------------------------------------------------------
+
+/*!
+ Constructor
+*/
SVTK_ControllerOnKeyDown::SVTK_ControllerOnKeyDown()
{
}
-//----------------------------------------------------------------------------
+
+/*!
+ Destructor
+*/
SVTK_ControllerOnKeyDown::~SVTK_ControllerOnKeyDown()
{
}
-//----------------------------------------------------------------------------
+
bool SVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS)
{
return true;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <vtkObject.h>
//
-//-------------------------------------------
//! Control the value of increment in SALOME way.
/*!
This class controls of value of increment,
void operator=(const SVTK_ControllerIncrement&); //Not implemented
};
//
-//-------------------------------------------
//! Control the behaviour of KeyDown event in SALOME way.
/*!
This class controls the behaviour of KeyDown event
SVTK_ControllerOnKeyDown(const SVTK_ControllerOnKeyDown&);//Not implemented
void operator=(const SVTK_ControllerOnKeyDown&); //Not implemented
};
-//-------------------------------------------
class vtkCell;
class vtkPicker;
SVTK_SelectionEvent*
GetSelectionEventFlipY();
- //! Redefined in order to add an observer (callback) for custorm event (space mouse event)
+ //! Redefined in order to add an observer (callback) for custom event (space mouse event)
virtual
void
SetInteractor( vtkRenderWindowInteractor* );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SUIT_Tools.h"
#include "SUIT_ResourceMgr.h"
#include "SVTK_NonIsometricDlg.h"
+#include "SVTK_UpdateRateDlg.h"
#include "SVTK_CubeAxesDlg.h"
#include "SVTK_MainWindow.h"
#include <qimage.h>
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_MainWindow
::SVTK_MainWindow(QWidget* theParent,
const char* theName,
createToolBar();
}
+/*!
+ To initialize the class
+*/
void
SVTK_MainWindow
::Initialize(SVTK_RenderWindowInteractor* theInteractor)
myInteractor->setFocusPolicy(StrongFocus);
myInteractor->setFocus();
setFocusProxy(myInteractor);
-}
+ myUpdateRateDlg = new SVTK_UpdateRateDlg(myActionsMap[UpdateRate],this,"SVTK_UpdateRateDlg");
+ myNonIsometricDlg = new SVTK_NonIsometricDlg(myActionsMap[NonIsometric],this,"SVTK_NonIsometricDlg");
+ myCubeAxesDlg = new SVTK_CubeAxesDlg(myActionsMap[GraduatedAxes],this,"SVTK_CubeAxesDlg");
+}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_MainWindow
::~SVTK_MainWindow()
{
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return used SVTK_RenderWindowInteractor
+*/
SVTK_RenderWindowInteractor*
SVTK_MainWindow
::GetInteractor()
return myInteractor;
}
+/*!
+ \return used #vtkRenderWindowInteractor (obsolete)
+*/
vtkRenderWindowInteractor*
SVTK_MainWindow
::getInteractor()
return GetInteractor()->GetDevice();
}
+/*!
+ \return used vtkRenderWindow (obsolete)
+*/
vtkRenderWindow*
SVTK_MainWindow
::getRenderWindow()
return GetInteractor()->getRenderWindow();
}
-//----------------------------------------------------------------------------
+/*!
+ To repaint the view
+ \param theUpdateTrihedron - adjust trihedron
+*/
void
SVTK_MainWindow
::Repaint(bool theUpdateTrihedron)
GetInteractor()->update();
}
-//----------------------------------------------------------------------------
+/*!
+ To invoke a VTK event on SVTK_RenderWindowInteractor instance
+*/
void
SVTK_MainWindow
::InvokeEvent(unsigned long theEvent, void* theCallData)
GetInteractor()->InvokeEvent(theEvent,theCallData);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::GetInteractorStyle
+*/
vtkInteractorStyle*
SVTK_MainWindow
::GetInteractorStyle()
return GetInteractor()->GetInteractorStyle();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::PushInteractorStyle
+*/
void
SVTK_MainWindow
::PushInteractorStyle(vtkInteractorStyle* theStyle)
GetInteractor()->PushInteractorStyle(theStyle);
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::PopInteractorStyle
+*/
void
SVTK_MainWindow
::PopInteractorStyle()
GetInteractor()->PopInteractorStyle();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::GetSelector
+*/
SVTK_Selector*
SVTK_MainWindow
::GetSelector()
return GetInteractor()->GetSelector();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::SelectionMode
+*/
Selection_Mode
SVTK_MainWindow
::SelectionMode()
return GetSelector()->SelectionMode();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::SetSelectionMode
+*/
void
SVTK_MainWindow
::SetSelectionMode(Selection_Mode theMode)
GetSelector()->SetSelectionMode(theMode);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::GetRenderer
+*/
SVTK_Renderer*
SVTK_MainWindow
::GetRenderer()
return GetInteractor()->GetRenderer();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::getRenderer
+*/
vtkRenderer*
SVTK_MainWindow
::getRenderer()
return GetInteractor()->getRenderer();
}
-//----------------------------------------------------------------------------
+/*!
+ Sets background color of the view
+ \param theColor - new background color
+*/
void
SVTK_MainWindow
::SetBackgroundColor(const QColor& theColor)
theColor.blue()/255.0);
}
+/*!
+ \return background color of the view
+*/
QColor
SVTK_MainWindow
::BackgroundColor()
{
- float aBackgroundColor[3];
+ vtkFloatingPointType aBackgroundColor[3];
getRenderer()->GetBackground(aBackgroundColor);
return QColor(int(aBackgroundColor[0]*255),
int(aBackgroundColor[1]*255),
int(aBackgroundColor[2]*255));
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetScale
+*/
void
SVTK_MainWindow
::GetScale( double theScale[3] )
GetRenderer()->GetScale( theScale );
}
+/*!
+ Redirect the request to SVTK_Renderer::SetScale
+*/
void
SVTK_MainWindow
::SetScale( double theScale[3] )
Repaint();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::AddActor
+*/
void
SVTK_MainWindow
::AddActor(VTKViewer_Actor* theActor,
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::RemoveActor
+*/
void
SVTK_MainWindow
::RemoveActor(VTKViewer_Actor* theActor,
Repaint();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetTrihedronSize
+*/
int
SVTK_MainWindow
::GetTrihedronSize()
return GetRenderer()->GetTrihedronSize();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::SetTrihedronSize
+*/
void
SVTK_MainWindow
-::SetTrihedronSize( const int theSize )
+::SetTrihedronSize( const int theSize, const bool theRelative )
{
- GetRenderer()->SetTrihedronSize(theSize);
+ GetRenderer()->SetTrihedronSize(theSize, theRelative);
Repaint();
}
-//----------------------------------------------------------------------------
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
* trihedron and cube axes, even if trihedron and cube axes is invisible.
*/
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::IsTrihedronDisplayed
+*/
bool
SVTK_MainWindow
::IsTrihedronDisplayed()
return GetRenderer()->IsTrihedronDisplayed();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::IsCubeAxesDisplayed
+*/
bool
SVTK_MainWindow
::IsCubeAxesDisplayed()
return GetRenderer()->IsCubeAxesDisplayed();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetTrihedron
+*/
VTKViewer_Trihedron*
SVTK_MainWindow
::GetTrihedron()
return GetRenderer()->GetTrihedron();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetCubeAxes
+*/
SVTK_CubeAxesActor2D*
SVTK_MainWindow
::GetCubeAxes()
return GetRenderer()->GetCubeAxes();
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return toolbar of svtk main window
+*/
QToolBar*
SVTK_MainWindow
::getToolBar()
return myToolBar;
}
-//----------------------------------------------------------------------------
void
SVTK_MainWindow
::SetEventDispatcher(vtkObject* theDispatcher)
myEventDispatcher = theDispatcher;
}
-//----------------------------------------------------------------------------
#if defined(WIN32) && !defined(_DEBUG)
#pragma optimize( "", off )
#endif
+/*!
+ Creates all actions of svtk main window
+*/
void
SVTK_MainWindow
::createActions(SUIT_ResourceMgr* theResourceMgr)
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onNonIsometric(bool)));
myActionsMap[ NonIsometric ] = anAction;
- myNonIsometricDlg = new SVTK_NonIsometricDlg(this,"SVTK_NonIsometricDlg",anAction);
-
// onGraduatedAxes: Manage graduated axes params
anAction = new QtxAction(tr("MNU_SVTK_GRADUATED_AXES"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_GRADUATED_AXES" ) ),
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onGraduatedAxes(bool)));
myActionsMap[ GraduatedAxes ] = anAction;
- myCubeAxesDlg = new SVTK_CubeAxesDlg(this,"SVTK_CubeAxesDlg",anAction);
+ // onGraduatedAxes: Manage graduated axes params
+ anAction = new QtxAction(tr("MNU_SVTK_UPDATE_RATE"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_UPDATE_RATE" ) ),
+ tr( "MNU_SVTK_UPDATE_RATE" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_UPDATE_RATE"));
+ anAction->setToggleAction(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool)));
+ myActionsMap[ UpdateRate ] = anAction;
}
#if defined(WIN32) && !defined(_DEBUG)
#pragma optimize( "", on )
#endif
-//----------------------------------------------------------------------------
+/*!
+ Creates toolbar of svtk main window
+*/
void
SVTK_MainWindow
::createToolBar()
myActionsMap[ResetId]->addTo(myToolBar);
+ myActionsMap[UpdateRate]->addTo(myToolBar);
myActionsMap[NonIsometric]->addTo(myToolBar);
myActionsMap[GraduatedAxes]->addTo(myToolBar);
}
-//----------------------------------------------------------------------------
+/*!
+ Custom show event handler
+*/
+void
+SVTK_MainWindow
+::showEvent( QShowEvent * theEvent )
+{
+ emit Show( theEvent );
+}
+
+/*!
+ Custom hide event handler
+*/
+void
+SVTK_MainWindow
+::hideEvent( QHideEvent * theEvent )
+{
+ emit Hide( theEvent );
+}
+
+/*!
+ Starts zoom transformation
+*/
void
SVTK_MainWindow
::activateZoom()
myEventDispatcher->InvokeEvent(SVTK::StartZoom,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts panning transformation
+*/
void
SVTK_MainWindow
::activatePanning()
myEventDispatcher->InvokeEvent(SVTK::StartPan,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts rotation transformation
+*/
void
SVTK_MainWindow
::activateRotation()
myEventDispatcher->InvokeEvent(SVTK::StartRotate,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts global panning transformation
+*/
void
SVTK_MainWindow
::activateGlobalPanning()
myEventDispatcher->InvokeEvent(SVTK::StartGlobalPan,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts window fit transformation
+*/
void
SVTK_MainWindow
::activateWindowFit()
myEventDispatcher->InvokeEvent(SVTK::StartFitArea,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "front view"
+*/
void
SVTK_MainWindow
::onFrontView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "back view"
+*/
void
SVTK_MainWindow
::onBackView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "top view"
+*/
void
SVTK_MainWindow
::onTopView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "bottom view"
+*/
void
SVTK_MainWindow
::onBottomView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "left view"
+*/
void
SVTK_MainWindow
::onLeftView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "right view"
+*/
void
SVTK_MainWindow
::onRightView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "reset view": sets default orientation of viewport camera
+*/
void
SVTK_MainWindow
::onResetView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "fit all"
+*/
void
SVTK_MainWindow
::onFitAll()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Shows trihedron
+*/
void
SVTK_MainWindow
::onViewTrihedron()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Shows cube axes
+*/
void
SVTK_MainWindow
::onViewCubeAxes()
Repaint();
}
-//----------------------------------------------------------------------------
+void
+SVTK_MainWindow
+::onUpdateRate(bool theIsActivate)
+{
+ if(theIsActivate){
+ myUpdateRateDlg->Update();
+ myUpdateRateDlg->show();
+ }else
+ myUpdateRateDlg->hide();
+}
+
void
SVTK_MainWindow
::onNonIsometric(bool theIsActivate)
myCubeAxesDlg->hide();
}
-//----------------------------------------------------------------------------
void
SVTK_MainWindow
::onAdjustTrihedron()
GetRenderer()->OnAdjustTrihedron();
}
-//----------------------------------------------------------------------------
void
SVTK_MainWindow
::onAdjustCubeAxes()
GetRenderer()->OnAdjustCubeAxes();
}
-//----------------------------------------------------------------------------
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage
SVTK_MainWindow
::dumpView()
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef SVTK_MAINWINDOW_H
#define SVTK_MAINWINDOW_H
class SVTK_RenderWindowInteractor;
class SVTK_NonIsometricDlg;
+class SVTK_UpdateRateDlg;
class SVTK_CubeAxesActor2D;
class SVTK_CubeAxesDlg;
class SVTK_Selector;
-//----------------------------------------------------------------------------
//! The class is a container for #SVTK_RenderWindowInteractor.
/*!
The class contains #SVTK_RenderWindowInteractor instance and
//! Redirect the request to #SVTK_Renderer::SetTrihedronSize
void
- SetTrihedronSize(const int theSize);
+ SetTrihedronSize(const int theSize, const bool theRelative = true);
//! Redirect the request to #SVTK_Renderer::AdjustActors
void
//----------------------------------------------------------------------------
QToolBar* getToolBar();
+ signals:
+ void Show( QShowEvent * );
+ void Hide( QHideEvent * );
+
public slots:
+ virtual void showEvent( QShowEvent * );
+ virtual void hideEvent( QHideEvent * );
+
void activateZoom();
void activateWindowFit();
void activateRotation();
void onViewTrihedron();
void onViewCubeAxes();
+ void onUpdateRate(bool theIsActivate);
void onNonIsometric(bool theIsActivate);
void onGraduatedAxes(bool theIsActivate);
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId,
- ViewTrihedronId, NonIsometric, GraduatedAxes};
+ ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate};
typedef QMap<int, QtxAction*> TActionsMap;
SUIT_ViewWindow* myViewWindow;
SVTK_NonIsometricDlg* myNonIsometricDlg;
+ SVTK_UpdateRateDlg* myUpdateRateDlg;
SVTK_CubeAxesDlg* myCubeAxesDlg;
vtkSmartPointer<vtkObject> myEventDispatcher;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
Constructor
*/
SVTK_NonIsometricDlg
-::SVTK_NonIsometricDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction):
- QDialog(theParent,
- theName,
- false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
- m_MainWindow(theParent),
- m_Action(theAction)
+::SVTK_NonIsometricDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName):
+ SVTK_DialogBase(theAction,
+ theParent,
+ theName),
+ m_MainWindow(theParent)
{
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
layoutDlg->setMargin(11);
// Create croup box with grid layout
- QGroupBox* GroupBox = new QGroupBox(this, "GroupBox");
- QGridLayout* glGroupBox = new QGridLayout(GroupBox);
- glGroupBox->setMargin(11);
- glGroupBox->setSpacing(6);
+ QGroupBox* aGroupBox = new QGroupBox(this, "GroupBox");
+ QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox);
+ aHBoxLayout->setMargin(11);
+ aHBoxLayout->setSpacing(6);
// "X" scaling
- QLabel* TextLabelX = new QLabel (tr("LBL_X"), GroupBox, "TextLabelX");
- m_sbXcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, GroupBox);
+ QLabel* TextLabelX = new QLabel (tr("LBL_X"), aGroupBox, "TextLabelX");
+ TextLabelX->setFixedWidth(15);
+ m_sbXcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
m_sbXcoeff->setMinimumWidth(80);
m_sbXcoeff->setValue(1.0);
// "Y" scaling
- QLabel* TextLabelY = new QLabel (tr("LBL_Y"), GroupBox, "TextLabelY");
- m_sbYcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, GroupBox);
+ QLabel* TextLabelY = new QLabel (tr("LBL_Y"), aGroupBox, "TextLabelY");
+ TextLabelY->setFixedWidth(15);
+ m_sbYcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
m_sbYcoeff->setMinimumWidth(80);
m_sbYcoeff->setValue(1.0);
// "Z" scaling
- QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), GroupBox, "TextLabelZ");
- m_sbZcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, GroupBox);
+ QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), aGroupBox, "TextLabelZ");
+ TextLabelZ->setFixedWidth(15);
+ m_sbZcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
m_sbZcoeff->setMinimumWidth(80);
m_sbZcoeff->setValue(1.0);
// Create <Reset> button
- m_bReset = new QPushButton(tr("&Reset"), GroupBox, "m_bReset");
+ m_bReset = new QPushButton(tr("&Reset"), aGroupBox, "m_bReset");
// Layout widgets in the group box
- glGroupBox->addWidget(TextLabelX, 0, 0);
- glGroupBox->addWidget(m_sbXcoeff, 0, 1);
- glGroupBox->addWidget(TextLabelY, 0, 2);
- glGroupBox->addWidget(m_sbYcoeff, 0, 3);
- glGroupBox->addWidget(TextLabelZ, 0, 4);
- glGroupBox->addWidget(m_sbZcoeff, 0, 5);
- glGroupBox->addWidget(m_bReset, 0, 6);
+ aHBoxLayout->addWidget(TextLabelX);
+ aHBoxLayout->addWidget(m_sbXcoeff);
+ aHBoxLayout->addWidget(TextLabelY);
+ aHBoxLayout->addWidget(m_sbYcoeff);
+ aHBoxLayout->addWidget(TextLabelZ);
+ aHBoxLayout->addWidget(m_sbZcoeff);
+ //aHBoxLayout->addStretch();
+ aHBoxLayout->addWidget(m_bReset);
// OK, CANCEL, Apply button
- QGroupBox* aWgt = new QGroupBox(this);
- QHBoxLayout* aHBoxLayout = new QHBoxLayout(aWgt);
- aHBoxLayout->setMargin(11);
- aHBoxLayout->setSpacing(6);
+ QGroupBox* aGroupBox2 = new QGroupBox(this);
+ QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox2);
+ aHBoxLayout2->setMargin(11);
+ aHBoxLayout2->setSpacing(6);
// Create <OK> button
- QPushButton* m_bOk = new QPushButton(tr("O&K"), aWgt, "m_bOk");
+ QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2, "m_bOk");
m_bOk->setDefault(TRUE);
m_bOk->setAutoDefault(TRUE);
// Create <Apply> button
- QPushButton* m_bApply = new QPushButton(tr("&Apply"), aWgt, "m_bApply");
+ QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2, "m_bApply");
m_bApply->setAutoDefault(TRUE);
// Create <Cancel> button
- QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aWgt, "m_bCancel");
+ QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2, "m_bCancel");
m_bCancel->setAutoDefault(TRUE);
// Layout buttons
- aHBoxLayout->addWidget(m_bOk);
- aHBoxLayout->addWidget(m_bApply);
- aHBoxLayout->addStretch();
- aHBoxLayout->addWidget(m_bCancel);
+ aHBoxLayout2->addWidget(m_bOk);
+ aHBoxLayout2->addWidget(m_bApply);
+ aHBoxLayout2->addStretch();
+ aHBoxLayout2->addWidget(m_bCancel);
// Layout top level widgets
- layoutDlg->addWidget(GroupBox,0,0);
- layoutDlg->addWidget(aWgt,1,0);
+ layoutDlg->addWidget(aGroupBox,0,0);
+ layoutDlg->addWidget(aGroupBox2,1,0);
// signals and slots connections
connect(m_bCancel, SIGNAL(clicked()), this, SLOT(onClickClose()));
::onClickClose()
{
reject();
-
- m_Action->setOn( false );
-}
-
-void
-SVTK_NonIsometricDlg
-::done( int r )
-{
- m_Action->setOn( false );
- QDialog::done( r );
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#ifndef SVTK_NONISOMETRICDLG_H
#define SVTK_NONISOMETRICDLG_H
-#include <qdialog.h>
+#include "SVTK_DialogBase.h"
class SVTK_MainWindow;
class QPushButton;
-class SVTK_NonIsometricDlg : public QDialog
+class SVTK_NonIsometricDlg : public SVTK_DialogBase
{
Q_OBJECT;
public:
- SVTK_NonIsometricDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction);
+ SVTK_NonIsometricDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName);
~SVTK_NonIsometricDlg();
protected:
SVTK_MainWindow *m_MainWindow;
- QtxAction* m_Action;
QtxDblSpinBox* m_sbXcoeff;
QtxDblSpinBox* m_sbYcoeff;
void onClickReset();
void onClickOk();
void onClickClose();
-
- virtual void done( int );
};
#endif // SVTK_NONISOMETRICDLG_H
// 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.salome-platform.org or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SVTK_Prs.h"
using namespace std;
-//==========================================================
/*!
- * SVTK_Prs::SVTK_Prs
- * Default constructor
- */
-//==========================================================
+ Default constructor
+*/
SVTK_Prs::SVTK_Prs() : myObjects( 0 )
{
}
-//==========================================================
/*!
- * SVTK_Prs::SVTK_Prs
- * tandard constructora
- */
-//==========================================================
+ Standard constructor
+*/
SVTK_Prs::SVTK_Prs( const vtkActor* obj )
{
AddObject( obj );
}
-//==========================================================
/*!
- * SVTK_Prs::~SVTK_Prs
- * Destructor
- */
-//==========================================================
+ Destructor
+*/
SVTK_Prs:: ~SVTK_Prs()
{
if ( myObjects ) myObjects->Delete();
}
-//==========================================================
/*!
- * SVTK_Prs::GetObjects
- * Get actors list
- */
-//==========================================================
+ \return actors list
+*/
vtkActorCollection* SVTK_Prs::GetObjects() const
{
return myObjects;
}
-//==========================================================
/*!
- * SVTK_Prs::AddObject
- * Add actor
- */
-//==========================================================
+ Add actor
+*/
void SVTK_Prs::AddObject( const vtkActor* obj )
{
if ( !myObjects)
myObjects->AddItem( (vtkActor*)obj );
}
-//==========================================================
/*!
- * SVTK_Prs::IsNull
- * Return 0 if list of the actors is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
+ \return 0 if list of the actors is empty [ Reimplemented from SALOME_Prs ]
+*/
bool SVTK_Prs::IsNull() const
{
return !myObjects || myObjects->GetNumberOfItems() <= 0;
// 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.salome-platform.org or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <vtkCamera.h>
#include <vtkCell.h>
-//----------------------------------------------------------------------------
namespace
{
//----------------------------------------------------------------------------
inline
- float
+ vtkFloatingPointType
GetZ(float* theZPtr,
int theSelection[4],
int theDX,
int
Check(float* theZPtr,
int theSelection[4],
- float theTolerance,
- float theDZ,
+ vtkFloatingPointType theTolerance,
+ vtkFloatingPointType theDZ,
int theDX,
int theDY)
{
int aRet = 0;
- float aZ = -1.0;
+ vtkFloatingPointType aZ = -1.0;
if(theDX >= theSelection[0] && theDX <= theSelection[2] &&
theDY >= theSelection[1] && theDY <= theSelection[3])
{
vtkDataSet *theInput,
SVTK_RectPicker::TVectorIds& theVisibleIds,
SVTK_RectPicker::TVectorIds& theInVisibleIds,
- float theTolerance)
+ vtkFloatingPointType theTolerance)
{
theVisibleIds.clear();
theInVisibleIds.clear();
*/
for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++){
// perform conversion
- float aX[4] = {1.0, 1.0, 1.0, 1.0};
+ vtkFloatingPointType aX[4] = {1.0, 1.0, 1.0, 1.0};
theInput->GetPoint(aPntId,aX);
- float aView[4];
+ vtkFloatingPointType aView[4];
aMatrix->MultiplyPoint(aX,aView);
if(aView[3] == 0.0)
continue;
aView[2]/aView[3]);
theRenderer->ViewToDisplay();
- float aDX[3];
+ vtkFloatingPointType aDX[3];
theRenderer->GetDisplayPoint(aDX);
// check whether visible and in selection window
//----------------------------------------------------------------------------
inline
void
- GetCenter(const float theBounds[6],
- float theCenter[3])
+ GetCenter(const vtkFloatingPointType theBounds[6],
+ vtkFloatingPointType theCenter[3])
{
theCenter[0] = (theBounds[1] + theBounds[0]) / 2.0;
theCenter[1] = (theBounds[3] + theBounds[2]) / 2.0;
vtkRenderer *theRenderer,
vtkDataSet *theInput,
SVTK_RectPicker::TVectorIds& theVectorIds,
- float theTolerance)
+ vtkFloatingPointType theTolerance)
{
theVectorIds.clear();
for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){
vtkCell* aCell = theInput->GetCell(aCellId);
- float aBounds[6];
+ vtkFloatingPointType aBounds[6];
aCell->GetBounds(aBounds);
- float aCenter[3];
+ vtkFloatingPointType aCenter[3];
GetCenter(aBounds,aCenter);
- float aView[4];
- float aX[4] = {aCenter[0], aCenter[1], aCenter[2], 1.0};
+ vtkFloatingPointType aView[4];
+ vtkFloatingPointType aX[4] = {aCenter[0], aCenter[1], aCenter[2], 1.0};
aMatrix->MultiplyPoint(aX,aView);
if(aView[3] == 0.0)
aView[2]/aView[3]);
theRenderer->ViewToDisplay();
- float aDX[3];
+ vtkFloatingPointType aDX[3];
theRenderer->GetDisplayPoint(aDX);
// check whether visible and in selection window
//----------------------------------------------------------------------------
void
CalculatePickPosition(vtkRenderer *theRenderer,
- float theSelectionX,
- float theSelectionY,
- float theSelectionZ,
- float thePickPosition[3])
+ vtkFloatingPointType theSelectionX,
+ vtkFloatingPointType theSelectionY,
+ vtkFloatingPointType theSelectionZ,
+ vtkFloatingPointType thePickPosition[3])
{
// Convert the selection point into world coordinates.
//
theRenderer->SetDisplayPoint(theSelectionX, theSelectionY, theSelectionZ);
theRenderer->DisplayToWorld();
- float* aWorldCoords = theRenderer->GetWorldPoint();
+ vtkFloatingPointType* aWorldCoords = theRenderer->GetWorldPoint();
if ( aWorldCoords[3] != 0.0 ) {
for (int i=0; i < 3; i++) {
thePickPosition[i] = aWorldCoords[i] / aWorldCoords[3];
}
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_RectPicker);
-//----------------------------------------------------------------------------
SVTK_RectPicker
::SVTK_RectPicker()
{
int
SVTK_RectPicker
-::Pick(float, float, float, vtkRenderer*)
+::Pick(vtkFloatingPointType,
+ vtkFloatingPointType,
+ vtkFloatingPointType,
+ vtkRenderer*)
{
return 0;
}
-//----------------------------------------------------------------------------
int
SVTK_RectPicker
-::Pick(float theSelection[3], float theSelection2[3], vtkRenderer *theRenderer)
+::Pick(vtkFloatingPointType theSelection[3],
+ vtkFloatingPointType theSelection2[3],
+ vtkRenderer *theRenderer)
{
return Pick(theSelection[0], theSelection[1], theSelection[2],
theSelection2[0], theSelection2[1], theSelection2[2],
theRenderer);
}
-//----------------------------------------------------------------------------
int
SVTK_RectPicker
-::Pick(float theSelectionX, float theSelectionY, float theSelectionZ,
- float theSelectionX2, float theSelectionY2, float theSelectionZ2,
+::Pick(vtkFloatingPointType theSelectionX,
+ vtkFloatingPointType theSelectionY,
+ vtkFloatingPointType theSelectionZ,
+ vtkFloatingPointType theSelectionX2,
+ vtkFloatingPointType theSelectionY2,
+ vtkFloatingPointType theSelectionZ2,
vtkRenderer *theRenderer)
{
// Initialize picking process
//
vtkCamera* aCamera = theRenderer->GetActiveCamera();
- float aCameraFP[4];
+ vtkFloatingPointType aCameraFP[4];
aCamera->GetFocalPoint(aCameraFP);
aCameraFP[3] = 1.0;
theRenderer->SetWorldPoint(aCameraFP);
theRenderer->WorldToDisplay();
- float* aDisplayCoords = theRenderer->GetDisplayPoint();
- float aSelectionZ = aDisplayCoords[2];
+ vtkFloatingPointType* aDisplayCoords = theRenderer->GetDisplayPoint();
+ vtkFloatingPointType aSelectionZ = aDisplayCoords[2];
this->SelectionPoint[0] = theSelectionX;
this->SelectionPoint[1] = theSelectionY;
}
-//----------------------------------------------------------------------------
const SVTK_RectPicker::TVectorIdsMap&
SVTK_RectPicker
::GetPointIdsMap() const
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#define __SVTK_RectPicker_h
#include "SVTK.h"
+#include "VTKViewer.h"
#include <map>
#include <vector>
/*! \class vtkAbstractPropPicker
* \brief For more information see <a href="http://www.vtk.org/">VTK documentation
*/
-/*! \class VTKViewer_RectPicker
+/*! \class SVTK_RectPicker
* \brief Rectangular picker class.
*/
class SVTK_EXPORT SVTK_RectPicker : public vtkAbstractPropPicker
as fraction of rendering window size. (Rendering window size is measured
across diagonal.)
*/
- vtkSetMacro(Tolerance,float);
- vtkGetMacro(Tolerance,float);
+ vtkSetMacro(Tolerance,vtkFloatingPointType);
+ vtkGetMacro(Tolerance,vtkFloatingPointType);
//! Use these methods to pick points or points and cells
vtkSetMacro(PickPoints,int);
virtual
int
- Pick(float theSelectionX, float theSelectionY, float theSelectionZ,
- float theSelectionX2, float theSelectionY2, float theSelectionZ2,
+ Pick(vtkFloatingPointType theSelectionX,
+ vtkFloatingPointType theSelectionY,
+ vtkFloatingPointType theSelectionZ,
+ vtkFloatingPointType theSelectionX2,
+ vtkFloatingPointType theSelectionY2,
+ vtkFloatingPointType theSelectionZ2,
vtkRenderer *theRenderer);
int
- Pick(float theSelection[3], float theSelection2[3], vtkRenderer *theRenderer);
+ Pick(vtkFloatingPointType theSelection[3],
+ vtkFloatingPointType theSelection2[3],
+ vtkRenderer *theRenderer);
typedef std::vector<vtkIdType> TVectorIds;
typedef std::map<vtkActor*,TVectorIds> TVectorIdsMap;
~SVTK_RectPicker();
//! tolerance for computation (% of window)
- float Tolerance;
+ vtkFloatingPointType Tolerance;
//! use the following to control picking mode
int PickPoints;
//! second rectangle selection point in window (pixel) coordinates
- float SelectionPoint2[3];
+ vtkFloatingPointType SelectionPoint2[3];
//! second rectangle selection point in world coordinates
- float PickPosition2[3];
+ vtkFloatingPointType PickPosition2[3];
TVectorIdsMap myPointIdsMap;
TVectorIdsMap myCellIdsMap;
private:
virtual
int
- Pick(float, float, float, vtkRenderer*);
+ Pick(vtkFloatingPointType,
+ vtkFloatingPointType,
+ vtkFloatingPointType,
+ vtkRenderer*);
};
#endif
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
static bool FOCUS_UNDER_MOUSE = false;
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
QVTK_RenderWindowInteractor
::QVTK_RenderWindowInteractor(QWidget* theParent,
const char* theName):
myRenderWindow->SetWindowId((void*)winId());
}
-
-void QVTK_RenderWindowInteractor::Initialize( vtkGenericRenderWindowInteractor* theDevice )
+/*!
+ To initialize by vtkGenericRenderWindowInteractor instance
+*/
+void
+QVTK_RenderWindowInteractor
+::Initialize(vtkGenericRenderWindowInteractor* theDevice)
{
if ( GetDevice() )
myDevice->SetRenderWindow( NULL );
theDevice->SetRenderWindow( getRenderWindow() );
}
-//----------------------------------------------------------------------------
-QVTK_RenderWindowInteractor::~QVTK_RenderWindowInteractor()
+/*!
+ Destructor
+*/
+QVTK_RenderWindowInteractor
+::~QVTK_RenderWindowInteractor()
{
#ifndef WIN32
SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance();
#endif
}
-//----------------------------------------------------------------------------
-vtkGenericRenderWindowInteractor* QVTK_RenderWindowInteractor::GetDevice()
+
+/*!
+ \return corresponding render window interactor
+*/
+vtkGenericRenderWindowInteractor*
+QVTK_RenderWindowInteractor
+::GetDevice()
{
return myDevice.GetPointer();
}
-//----------------------------------------------------------------------------
+/*!
+ \return corresponding render window
+*/
vtkRenderWindow*
QVTK_RenderWindowInteractor
::getRenderWindow()
return myRenderWindow.GetPointer();
}
-//----------------------------------------------------------------------------
+/*!
+ Just to simplify usage of its device (vtkGenericRenderWindowInteractor)
+*/
void
QVTK_RenderWindowInteractor
::InvokeEvent(unsigned long theEvent, void* theCallData)
GetDevice()->InvokeEvent(theEvent,theCallData);
}
-//----------------------------------------------------------------------------
+/*!
+ Need for initial contents display on Win32
+*/
void
QVTK_RenderWindowInteractor
::show()
update(); // needed for initial contents display on Win32
}
-//----------------------------------------------------------------------------
+/*!
+ To implement final initialization, just before the widget is displayed
+*/
void
QVTK_RenderWindowInteractor
::polish()
}
}
-//----------------------------------------------------------------------------
+/*!
+ To adjust widget and vtkRenderWindow size
+*/
void
QVTK_RenderWindowInteractor
::resize(int w, int h)
GetDevice()->UpdateSize(w,h);
}
-//----------------------------------------------------------------------------
+/*!
+ Custom paint event handler
+*/
void
QVTK_RenderWindowInteractor
::paintEvent( QPaintEvent* theEvent )
{
- GetDevice()->Render();
+ GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
}
-//----------------------------------------------------------------------------
+/*!
+ Custom resize event handler
+*/
void
QVTK_RenderWindowInteractor
::resizeEvent( QResizeEvent* theEvent )
}
-//----------------------------------------------------------------------------
+
+/*!
+ Custom context menu event handler
+*/
void
QVTK_RenderWindowInteractor
::contextMenuEvent( QContextMenuEvent* event )
{}
-
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse move event handler
+*/
void
QVTK_RenderWindowInteractor
::mouseMoveEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse press event handler
+*/
void
QVTK_RenderWindowInteractor
::mousePressEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse release event handler
+*/
void
QVTK_RenderWindowInteractor
::mouseReleaseEvent( QMouseEvent *event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse double click event handler
+*/
void
QVTK_RenderWindowInteractor
::mouseDoubleClickEvent( QMouseEvent* event )
{}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse wheel event handler
+*/
void
QVTK_RenderWindowInteractor
::wheelEvent( QWheelEvent* event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom key press event handler
+*/
void
QVTK_RenderWindowInteractor
::keyPressEvent( QKeyEvent* event )
GetDevice()->CharEvent();
}
-//----------------------------------------------------------------------------
+/*!
+ Custom key release event handler
+*/
void
QVTK_RenderWindowInteractor
::keyReleaseEvent( QKeyEvent * event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom enter event handler
+*/
void
QVTK_RenderWindowInteractor
::enterEvent( QEvent* event )
GetDevice()->EnterEvent();
}
-//----------------------------------------------------------------------------
+/*!
+ Custom leave event handler
+*/
void
QVTK_RenderWindowInteractor
::leaveEvent( QEvent * )
GetDevice()->LeaveEvent();
}
-
-//----------------------------------------------------------------------------
-void QVTK_RenderWindowInteractor::focusInEvent( QFocusEvent* event )
+/*!
+ Reimplemented from QWidget in order to set window - receiver
+ of space mouse events.
+*/
+void
+QVTK_RenderWindowInteractor
+::focusInEvent( QFocusEvent* event )
{
QWidget::focusInEvent( event );
#endif
}
-//----------------------------------------------------------------------------
-void QVTK_RenderWindowInteractor::focusOutEvent( QFocusEvent* event )
+/*!
+ Reimplemented from QWidget in order to set window - receiver
+ of space mouse events.
+*/
+void
+QVTK_RenderWindowInteractor
+::focusOutEvent ( QFocusEvent* event )
{
QWidget::focusOutEvent( event );
}
-//----------------------------------------------------------------------------
#ifdef WIN32
+/*!
+ To handle native Win32 events (from such devices as SpaceMouse)
+*/
bool QVTK_RenderWindowInteractor::winEvent( MSG* msg )
{
// TODO: Implement event handling for SpaceMouse
#else
-bool QVTK_RenderWindowInteractor::x11Event( XEvent *xEvent )
+/*!
+ To handle native X11 events (from such devices as SpaceMouse)
+*/
+bool
+QVTK_RenderWindowInteractor
+::x11Event( XEvent *xEvent )
{
// handle 3d space mouse events
if ( SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance() )
#endif
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_RenderWindowInteractor
::SVTK_RenderWindowInteractor(QWidget* theParent,
const char* theName):
myEventCallbackCommand->SetCallback(SVTK_RenderWindowInteractor::ProcessEvents);
}
+/*!
+ To initialize properly the class
+*/
void
SVTK_RenderWindowInteractor
::Initialize(vtkGenericRenderWindowInteractor* theDevice,
SetSelector(theSelector);
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_RenderWindowInteractor
::~SVTK_RenderWindowInteractor()
{
GetDevice()->SetRenderWindow(NULL);
}
-//----------------------------------------------------------------------------
+/*!
+ To get corresponding SVTK_Renderer instance
+*/
SVTK_Renderer*
SVTK_RenderWindowInteractor
::GetRenderer()
return myRenderer.GetPointer();
}
+/*!
+ To get corresponding SVTK_Renderer device (just to simplify collobaration with SVTK_Renderer)
+*/
vtkRenderer*
SVTK_RenderWindowInteractor
::getRenderer()
return GetRenderer()->GetDevice();
}
+/*!
+ Changes renderer
+ \param theRenderer - new renderer
+*/
void
SVTK_RenderWindowInteractor
::SetRenderer(SVTK_Renderer* theRenderer)
}
-//----------------------------------------------------------------------------
+/*!
+ Changes interactor style
+ \param theStyle - new interactor style
+*/
void
SVTK_RenderWindowInteractor
::InitInteractorStyle(vtkInteractorStyle* theStyle)
GetDevice()->SetInteractorStyle(theStyle);
}
-
-//----------------------------------------------------------------------------
+/*!
+ To change current interactor style by pushing the new one into the container
+*/
void
SVTK_RenderWindowInteractor
::PushInteractorStyle(vtkInteractorStyle* theStyle)
InitInteractorStyle(theStyle);
}
-
-//----------------------------------------------------------------------------
+/*!
+ To restore previous interactor style
+*/
void
SVTK_RenderWindowInteractor
::PopInteractorStyle()
InitInteractorStyle(GetInteractorStyle());
}
-
-//----------------------------------------------------------------------------
+/*!
+ To get current interactor style
+*/
vtkInteractorStyle*
SVTK_RenderWindowInteractor
::GetInteractorStyle()
}
-//----------------------------------------------------------------------------
+/*!
+ To get current selector
+*/
SVTK_Selector*
SVTK_RenderWindowInteractor
::GetSelector()
}
+/*!
+ Changes selector
+ \param theSelector - new selector
+*/
void
SVTK_RenderWindowInteractor
::SetSelector(SVTK_Selector* theSelector)
myPriority);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Main process VTK event method
+*/
void
SVTK_RenderWindowInteractor
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
}
}
-
-//----------------------------------------------------------------
+/*!
+ To change selection mode (just to simplify collobaration with SVTK_Selector)
+*/
void
SVTK_RenderWindowInteractor
::SetSelectionMode(Selection_Mode theMode)
mySelector->SetSelectionMode(theMode);
}
-
-//----------------------------------------------------------------
+/*!
+ To get current selection mode (just to simplify collobaration with SVTK_Selector)
+*/
Selection_Mode
SVTK_RenderWindowInteractor
::SelectionMode() const
}
-//----------------------------------------------------------------
+/*!
+ Emits signal selectionChanged()
+*/
void
SVTK_RenderWindowInteractor
::onEmitSelectionChanged()
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse move event handler
+*/
void
SVTK_RenderWindowInteractor
::mouseMoveEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse press event handler
+*/
void
SVTK_RenderWindowInteractor
::mousePressEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse release event handler
+*/
void
SVTK_RenderWindowInteractor
::mouseReleaseEvent( QMouseEvent *event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse double click event handler
+*/
void
SVTK_RenderWindowInteractor
::mouseDoubleClickEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
+/*!
+ Custom mouse wheel event handler
+*/
void
SVTK_RenderWindowInteractor
::wheelEvent( QWheelEvent* event )
emit WheelMoved( event );
}
-
-//----------------------------------------------------------------------------
+/*!
+ Custom key press event handler
+*/
void
SVTK_RenderWindowInteractor
::keyPressEvent( QKeyEvent* event )
emit KeyPressed( event );
}
-//----------------------------------------------------------------------------
+/*!
+ Custom key release event handler
+*/
void
SVTK_RenderWindowInteractor
::keyReleaseEvent( QKeyEvent * event )
emit KeyReleased( event );
}
-//----------------------------------------------------------------------------
+/*!
+ Custom context menu event handler
+*/
void
SVTK_RenderWindowInteractor
::contextMenuEvent( QContextMenuEvent* event )
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class SVTK_Selector;
class SVTK_Renderer;
-//============================================================================
-//! Implemements Qt based vtkRenderWindowInteractor.
/*!
+ \class QVTK_RenderWindowInteractor
+ Implements Qt based vtkRenderWindowInteractor.
The class inherits #QWidget class in order to be possible process Qt events.
It invokes corresponding VTK events through usage of its device - a #vtkGenericRenderWindowInteractor.
Also, it creates, initialize and holds vtkRenderWindow instance.
};
-//============================================================================
//! Extends QVTK_RenderWindowInteractor functionality.
/*!
+ \class SVTK_RenderWindowInteractor
Implements such features as
support of selection,
run-time interactor style management,
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#undef max
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_Renderer);
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_Renderer
::SVTK_Renderer():
myDevice(vtkRenderer::New()),
myTransform(VTKViewer_Transform::New()),
myCubeAxes(SVTK_CubeAxesActor2D::New()),
myTrihedron(SVTK_Trihedron::New()),
- myTrihedronSize(105)
+ myTrihedronSize(105),
+ myIsTrihedronRelative(true)
{
myDevice->Delete();
myTransform->Delete();
myPriority);
}
+/*!
+ Destructor
+*/
SVTK_Renderer
::~SVTK_Renderer()
{
}
+/*!
+ Main process event method
+*/
void
SVTK_Renderer
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
}
}
-//----------------------------------------------------------------------------
+/*!
+ \return renderer's device
+*/
vtkRenderer*
SVTK_Renderer
::GetDevice()
return myDevice.GetPointer();
}
+/*!
+ Initialize renderer
+*/
void
SVTK_Renderer
::Initialize(vtkRenderWindowInteractor* theInteractor,
mySelector = theSelector;
}
-//----------------------------------------------------------------------------
+/*!
+ Publishes pointed actor into the renderer
+*/
void
SVTK_Renderer
::AddActor(VTKViewer_Actor* theActor)
}
}
+/*!
+ Removes pointed actor from the renderer
+*/
void
SVTK_Renderer
::RemoveActor(VTKViewer_Actor* theActor)
}
}
+/*!
+ Get special container that keeps scaling of the scene
+*/
VTKViewer_Transform*
SVTK_Renderer
::GetTransform()
return myTransform.GetPointer();
}
+/*!
+ Allows to get a scale that is applied on the whole scene
+*/
void
SVTK_Renderer
::GetScale( double theScale[3] )
myTransform->GetMatrixScale( theScale );
}
+/*!
+ Allows to apply a scale on the whole scene
+*/
void
SVTK_Renderer
::SetScale( double theScale[3] )
AdjustActors();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Applies color and size (PointSize and LineWidth) of primitives in selection mode
+*/
void
SVTK_Renderer
::SetSelectionProp(const double& theRed,
myHighlightProperty->SetPointSize( theWidth );
}
-//----------------------------------------------------------------------------
+/*!
+ Applies color and size (PointSize and LineWidth) of primitives in preselection mode
+*/
void
SVTK_Renderer
::SetPreselectionProp(const double& theRed,
myPreHighlightProperty->SetPointSize( theWidth );
}
-//----------------------------------------------------------------------------
+/*!
+ Setup requested tolerance for the picking
+*/
void
SVTK_Renderer
::SetSelectionTolerance(const double& theTolNodes,
}
-//----------------------------------------------------------------------------
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
* trihedron and cube axes, even if trihedron and cube axes is invisible.
*/
inline
bool
-CheckBndBox(const float theBounds[6])
+CheckBndBox(const vtkFloatingPointType theBounds[6])
{
if(theBounds[0] > -VTK_LARGE_FLOAT && theBounds[1] < VTK_LARGE_FLOAT &&
theBounds[2] > -VTK_LARGE_FLOAT && theBounds[3] < VTK_LARGE_FLOAT &&
return false;
}
+/*!
+ Adjusts size of actors
+*/
bool
SVTK_Renderer
::OnAdjustActors()
bool aTDisplayed = IsTrihedronDisplayed();
bool aCDisplayed = IsCubeAxesDisplayed();
- float aNewBndBox[6];
+ vtkFloatingPointType aNewBndBox[6];
aNewBndBox[ 0 ] = aNewBndBox[ 2 ] = aNewBndBox[ 4 ] = VTK_LARGE_FLOAT;
aNewBndBox[ 1 ] = aNewBndBox[ 3 ] = aNewBndBox[ 5 ] = -VTK_LARGE_FLOAT;
myCubeAxes->VisibilityOff();
// if the new trihedron size have sufficient difference, then apply the value
- double aSize = myTrihedron->GetSize();
- ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
- myTrihedron->SetSize(aSize);
+ vtkFloatingPointType aSize = myTrihedron->GetSize();
+ if ( IsTrihedronRelative() )
+ {
+ ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
+ myTrihedron->SetSize(aSize);
+ }
+ else
+ myTrihedron->SetSize( myTrihedronSize );
// iterate through displayed objects and set size if necessary
vtkActorCollection* anActors = GetDevice()->GetActors();
if(anActor->IsResizable())
anActor->SetSize(0.5*aSize);
if(anActor->GetVisibility() && !anActor->IsInfinitive()){
- float *aBounds = anActor->GetBounds();
+ vtkFloatingPointType *aBounds = anActor->GetBounds();
if(CheckBndBox(aBounds))
for(int i = 0; i < 5; i = i + 2){
if(aBounds[i] < aNewBndBox[i])
return false;
}
+/*!
+ Adjusts size of actors
+*/
void
SVTK_Renderer
::AdjustActors()
::ResetCameraClippingRange(GetDevice());
}
+/*!
+ Set size of the trihedron
+ \param theSize - new size
+ \param theRelative - if it is true, then size is mesured in percents from bounding box of the scene,
+ otherwise - in viewer units
+*/
void
SVTK_Renderer
-::SetTrihedronSize(int theSize)
+::SetTrihedronSize(int theSize, const bool theRelative)
{
- if(myTrihedronSize != theSize){
+ if(myTrihedronSize != theSize || myIsTrihedronRelative != theRelative){
myTrihedronSize = theSize;
+ myIsTrihedronRelative = theRelative;
AdjustActors();
}
}
+/*!
+ \return size of the trihedron in percents from bounding box of the scene
+*/
int
SVTK_Renderer
::GetTrihedronSize() const
return myTrihedronSize;
}
+/*!
+ \return true if the size of the trihedron is relative
+*/
+bool
+SVTK_Renderer
+::IsTrihedronRelative() const
+{
+ return myIsTrihedronRelative;
+}
-//----------------------------------------------------------------------------
+/*!
+ \return trihedron control
+*/
VTKViewer_Trihedron*
SVTK_Renderer
::GetTrihedron()
return myTrihedron.GetPointer();
}
+/*!
+ \return true if trihedron is displayed
+*/
bool
SVTK_Renderer
::IsTrihedronDisplayed()
return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
}
+/*!
+ Toggle trihedron visibility
+*/
void
SVTK_Renderer
::OnViewTrihedron()
myTrihedron->VisibilityOn();
}
+/*!
+ Adjust size of the trihedron to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnAdjustTrihedron()
AdjustActors();
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return graduated rules control
+*/
SVTK_CubeAxesActor2D*
SVTK_Renderer
::GetCubeAxes()
return myCubeAxes.GetPointer();
}
+/*!
+ \return true if graduated rules displayed
+*/
bool
SVTK_Renderer
::IsCubeAxesDisplayed()
return myCubeAxes->GetVisibility() == 1;
}
+/*!
+ Toggle graduated rules visibility
+*/
void
SVTK_Renderer
::OnViewCubeAxes()
myCubeAxes->VisibilityOn();
}
+/*!
+ Adjust size of the graduated rules to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnAdjustCubeAxes()
AdjustActors();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Sets camera into predefined state
+*/
void
SVTK_Renderer
::OnResetView()
else
myCubeAxes->VisibilityOff();
- static float aCoeff = 3.0;
+ static vtkFloatingPointType aCoeff = 3.0;
aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Fit all presentation in the scene into the window
+*/
void
SVTK_Renderer
::OnFitAll()
::ResetCameraClippingRange(GetDevice());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Reset camera clipping range to adjust the range to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnResetClippingRange()
::ResetCameraClippingRange(GetDevice());
}
-
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to front view
+*/
void
SVTK_Renderer
::OnFrontView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to back view
+*/
void
SVTK_Renderer
::OnBackView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to top view
+*/
void
SVTK_Renderer
::OnTopView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to bottom view
+*/
void
SVTK_Renderer
::OnBottomView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to left view
+*/
void
SVTK_Renderer
::OnLeftView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to right view
+*/
void
SVTK_Renderer
::OnRightView()
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#define SVTK_Renderer_h
#include "SVTK.h"
+#include "VTKViewer.h"
#include <vtkObject.h>
#include <vtkSmartPointer.h>
class SVTK_Selector;
-//! The class is a container for #vtkRenderer instance.
-/*!
+/*!
+ \class SVTK_Renderer
+ The class is a container for #vtkRenderer instance.
Main goal of the class is to apply common behaviour to all #SALOME_Actor, like
selection and preselection colors.
Also, the class is responsible for management of internal actors like trihedron an so on.
*/
-//============================================================================
class SVTK_EXPORT SVTK_Renderer : public vtkObject
{
public:
SVTK_Selector* theSelector);
//----------------------------------------------------------------------------
- //! This method publishes pointed actor into the renderer
+ //! Publishes pointed actor into the renderer
virtual
void
AddActor(VTKViewer_Actor* theActor);
- //! This method removes pointed actor from the renderer
+ //! Removes pointed actor from the renderer
virtual
void
RemoveActor(VTKViewer_Actor* theActor);
VTKViewer_Transform*
GetTransform();
- //! This method allow to apply a scale on the whole scene
+ //! Allows to apply a scale on the whole scene
virtual
void
SetScale( double theScale[3] );
- //! This method allow to get a scale that is applied on the whole scene
+ //! Allows to get a scale that is applied on the whole scene
void
GetScale( double theScale[3] );
const double& theBlue = 1,
const int& theWidth = 5);
- //! Setup requested tollerance for the picking
+ //! Setup requested tolerance for the picking
void
SetSelectionTolerance(const double& theTolNodes = 0.025,
const double& theTolCell = 0.001);
//! Set size of the trihedron in percents from bounding box of the scene
void
- SetTrihedronSize(int theSize);
+ SetTrihedronSize(int theSize, const bool theRelative = true);
//! Get size of the trihedron in percents from bounding box of the scene
int
GetTrihedronSize() const;
+ //! Shows if the size of the trihedron is relative
+ bool
+ IsTrihedronRelative() const;
+
//----------------------------------------------------------------------------
//! Get trihedron control
VTKViewer_Trihedron*
//----------------------------------------------------------------------------
// Priority at which events are processed
- float myPriority;
+ vtkFloatingPointType myPriority;
// Used to process events
vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
//----------------------------------------------------------------------------
vtkSmartPointer<SVTK_CubeAxesActor2D> myCubeAxes;
vtkSmartPointer<VTKViewer_Trihedron> myTrihedron;
- int myTrihedronSize;
- float myBndBox[6];
+ int myTrihedronSize;
+ bool myIsTrihedronRelative;
+ vtkFloatingPointType myBndBox[6];
};
#endif
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <vtkCallbackCommand.h>
+/*!
+ \return new SVTK_Selector
+*/
SVTK_Selector*
SVTK_Selector
::New()
return new SVTK_SelectorDef();
}
-//----------------------------------------------------------------------------
+/*!
+ Default constructor
+*/
SVTK_SelectorDef
::SVTK_SelectorDef()
{
mySelectionMode = ActorSelection;
}
+/*!
+ Destructor
+*/
SVTK_SelectorDef
::~SVTK_SelectorDef()
{
}
-//----------------------------------------------------------------------------
+/*!
+ To invoke selectionChanged signals
+*/
void
SVTK_SelectorDef
::StartPickCallback()
this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
}
-//----------------------------------------------------------------------------
+/*!
+ To invoke selectionChanged signals
+*/
void
SVTK_SelectorDef
::EndPickCallback()
this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
}
-//----------------------------------------------------------------------------
+/*!
+ To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
+*/
void
SVTK_SelectorDef
::SetSelectionMode(Selection_Mode theMode)
}
}
+/*!
+ Clear selection
+*/
void
SVTK_SelectorDef
::ClearIObjects()
myMapIOSubIndex.clear();
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if the SALOME_InteractiveObject presents into selection
+*/
bool
SVTK_SelectorDef
::IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const
return !theIO.IsNull() && (myIObjects.find(theIO) != myIObjects.end());
}
+/*!
+ \return true if the SALOME_Actor presents into selection
+*/
bool
SVTK_SelectorDef
::IsSelected(SALOME_Actor* theActor) const
return IsSelected(anIO) && myIO2Actors.find(anIO) != myIO2Actors.end();
}
+/*!
+ \return corresponding SALOME_Actor for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+*/
SALOME_Actor*
SVTK_SelectorDef
::GetActor(const Handle(SALOME_InteractiveObject)& theIO) const
return NULL;
}
-//----------------------------------------------------------------------------
+/*!
+ Adds SALOME_InteractiveObject into selection
+ \param theIO - SALOME_InteractiveObject
+*/
bool
SVTK_SelectorDef
::AddIObject(const Handle(SALOME_InteractiveObject)& theIO)
return false;
}
+/*!
+ Adds SALOME_Actor into selection
+ \param theActor - SALOME_Actor
+*/
bool
SVTK_SelectorDef
::AddIObject(SALOME_Actor* theActor)
return !anIsIOBound || !anIsActorBound;
}
-//----------------------------------------------------------------------------
+/*!
+ Removes SALOME_InteractiveObject from selection
+ \param theIO - SALOME_InteractiveObject
+*/
bool
SVTK_SelectorDef
::RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO)
return anIsIOBound;
}
+/*!
+ Removes SALOME_Actor from selection
+ \param theActor - SALOME_Actor
+*/
bool
SVTK_SelectorDef
::RemoveIObject(SALOME_Actor* theActor)
return RemoveIObject(anIO) || anIsActorBound;
}
-//----------------------------------------------------------------------------
+/*!
+ \return list of all SALOME_InteractiveObject presenting in selection
+*/
const SALOME_ListIO&
SVTK_SelectorDef
::StoredIObjects() const
return myIObjectList;
}
+/*!
+ \return number of selected objects
+*/
int
SVTK_SelectorDef
::IObjectCount() const
return myIObjects.size();
}
+/*!
+ \return true if the SALOME_InteractiveObject has a subselection
+ \param theIO - SALOME_InteractiveObject
+*/
bool
SVTK_SelectorDef
::HasIndex( const Handle(SALOME_InteractiveObject)& theIO) const
return myMapIOSubIndex.find(theIO) != myMapIOSubIndex.end();
}
+/*!
+ Gets indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+*/
void
SVTK_SelectorDef
::GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
theIndex.Clear();
}
-bool SVTK_SelectorDef::IsIndexSelected( const Handle(SALOME_InteractiveObject)& theIO,
- int theIndex) const
+/*!
+ \return true if the index presents in subselection
+ \param theIO - SALOME_InteractiveObject
+ \param theIndex - index
+*/
+bool
+SVTK_SelectorDef
+::IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
+ int theIndex) const
{
TMapIOSubIndex::const_iterator anIter = myMapIOSubIndex.find(theIO);
if(anIter != myMapIOSubIndex.end()){
return anId != 0;
}
+/*!
+ Changes indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndices - indices
+ \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
bool
SVTK_SelectorDef
::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
}
+/*!
+ Changes indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndices - indices
+ \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
bool
SVTK_SelectorDef
::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
}
+/*!
+ Changes indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndex - index
+ \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
bool
SVTK_SelectorDef
::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
return false;
}
+
+/*!
+ Removes index of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndex - index
+*/
void
SVTK_SelectorDef
::RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
}
}
+/*!
+ Clears all indices of subselection
+*/
void
SVTK_SelectorDef
::ClearIndex()
myMapIOSubIndex.clear();
}
-//----------------------------------------------------------------------------
+/*!
+ To apply a filter on the selection
+ \param theFilter - new filter
+*/
void
SVTK_SelectorDef
::SetFilter(const Handle(VTKViewer_Filter)& theFilter)
myFilters.insert(TFilters::value_type(theFilter->GetId(),theFilter));
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if filter with given number is applyed
+ \param theId - filter id
+*/
bool
SVTK_SelectorDef
::IsFilterPresent(const TFilterID theId) const
return myFilters.find(theId) != myFilters.end();
}
-//----------------------------------------------------------------------------
+/*!
+ To remove a filter from the selection
+ \param theId - filter id
+*/
void
SVTK_SelectorDef
::RemoveFilter(const TFilterID theId)
myFilters.erase(theId);
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if the index satisfy installed filters
+ \param theActor - actor
+ \param theId - filter id
+ \param theIsNode - whether it is node
+*/
bool
SVTK_SelectorDef
::IsValid(SALOME_Actor* theActor,
return true;
}
-//----------------------------------------------------------------------------
+/*!
+ \return filter by it's id
+ \param theId - filter id
+*/
Handle(VTKViewer_Filter)
SVTK_SelectorDef
::GetFilter(const TFilterID theId) const
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
TColStd_IndexedMapOfInteger& theIndex ) = 0;
- //! Change indexes of subslection for given #SALOME_InteractiveObject
+ //! Change indices of subselection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
int theIndex) = 0;
- //! Check, if the given index is present in subslection
+ //! Check, if the given index is present in subselection
virtual
bool
IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SVTK_SpaceMouse.h"
-//---------------------------------------------
SVTK_SpaceMouse* SVTK_SpaceMouse::myInstance = 0;
-//---------------------------------------------
+/*!
+ \return shared instance of object (creates if there is no one)
+*/
SVTK_SpaceMouse* SVTK_SpaceMouse::getInstance()
{
if ( !myInstance )
return myInstance;
}
-//---------------------------------------------
+/*!
+ Constructor
+*/
SVTK_SpaceMouse::SVTK_SpaceMouse()
{
#ifndef WIN32
spaceMouseOn = 0;
}
-//---------------------------------------------
#ifndef WIN32
+/*!
+ Initialization
+*/
int SVTK_SpaceMouse::initialize( Display *display, Window window )
{
XMotionEvent = XInternAtom( display, "MotionEvent", 1 );
return spaceMouseOn;
}
-//---------------------------------------------
static int errorCallback( Display *display, XErrorEvent *Error )
{
char msg[ 128 ];
return 0;
}
-//---------------------------------------------
+/*!
+ Initialize by window
+*/
int SVTK_SpaceMouse::setWindow( Display *display, Window window )
{
XTextProperty winName;
return result;
}
-//---------------------------------------------
+/*!
+ Close
+*/
int SVTK_SpaceMouse::close(Display *display)
{
initialize( display, (Window)InputFocus );
return 1;
}
-//---------------------------------------------
+/*!
+ Custom event handler
+*/
int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent,
double scale, double rScale )
{
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SVTK_Trihedron.h"
#include "SALOME_Actor.h"
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
-//****************************************************************
vtkStandardNewMacro(SVTK_Trihedron);
-//****************************************************************
+/*!
+ Constructor
+*/
SVTK_Trihedron
::SVTK_Trihedron()
{
}
-//****************************************************************
+/*!
+ \return count of visible actors
+ \param theRenderer - renderer to be checked
+*/
int
SVTK_Trihedron
::GetVisibleActorCount(vtkRenderer* theRenderer)
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SVTK_TRIHEDRON_H
#define SVTK_TRIHEDRON_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_SignalHandler
::SVTK_SignalHandler(SVTK_MainWindow* theMainWindow):
QObject(theMainWindow),
this,SIGNAL(selectionChanged()));
}
+/*!
+ Destructor
+*/
SVTK_SignalHandler
::~SVTK_SignalHandler()
{
}
+/*!
+ \return corresponding svtk main window
+*/
SVTK_MainWindow*
SVTK_SignalHandler
::GetMainWindow()
}
-//----------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_MainWindow::Repaint (just for flexibility)
+*/
void
SVTK_SignalHandler
::Repaint(bool theUpdateTrihedron)
myMainWindow->Repaint(theUpdateTrihedron);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_MainWindow::GetRenderer (just for flexibility)
+*/
SVTK_Renderer*
SVTK_SignalHandler
::GetRenderer()
return myMainWindow->GetRenderer();
}
+/*!
+ Redirect the request to #SVTK_MainWindow::getRenderer (just for flexibility)
+*/
vtkRenderer*
SVTK_SignalHandler
::getRenderer()
return myMainWindow->getRenderer();
}
-//----------------------------------------------------------------
namespace SVTK
{
struct THighlightAction
};
}
+/*!
+ SLOT: called on selection change
+*/
void
SVTK_SignalHandler
::onSelectionChanged()
myMainWindow->Repaint(false);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_View
::SVTK_View(SVTK_MainWindow* theMainWindow) :
SVTK_SignalHandler(theMainWindow)
{
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_View
::~SVTK_View()
{
}
-//----------------------------------------------------------------
+/*!
+ Unhilights all objects in viewer
+*/
void
SVTK_View
::unHighlightAll()
Repaint();
}
-//----------------------------------------------------------------
+/*!
+ Hilights/unhilights object in viewer
+ \param theIO - object to be updated
+ \param theIsHighlight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param theIsUpdate - update current viewer
+*/
void
SVTK_View
::highlight( const Handle(SALOME_InteractiveObject)& theIO,
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Display object
+ \param theEntry - entry that corresponds to intractive objects
+*/
+Handle(SALOME_InteractiveObject)
+SVTK_View
+::FindIObject(const char* theEntry)
+{
+ using namespace SVTK;
+ SALOME_Actor* anActor =
+ Find<SALOME_Actor>(getRenderer()->GetActors(),
+ TIsSameEntry<SALOME_Actor>(theEntry));
+ if(anActor != NULL)
+ return anActor->getIO();
+
+ return NULL;
+}
+
+/*!
+ Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
void
SVTK_View
::SetSelectionProp(const double& theRed,
GetRenderer()->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
void
SVTK_View
::SetPreselectionProp(const double& theRed,
GetRenderer()->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
void
SVTK_View
::SetSelectionTolerance(const double& theTolNodes,
GetRenderer()->SetSelectionTolerance(theTolNodes,theTolCell);
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if object is in viewer or in collector
+ \param theIO - object to be checked
+*/
bool
SVTK_View
::isInViewer(const Handle(SALOME_InteractiveObject)& theIObject)
return anActor != NULL;
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if object is displayed in viewer
+ \param theIO - object to be checked
+*/
bool
SVTK_View
::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
return anActor != NULL && anActor->GetVisibility();
}
-//----------------------------------------------------------------------------
+/*!
+ Changes name of object
+ \param theIObject - object to be renamed
+ \param theName - new name
+*/
void
SVTK_View
::rename(const Handle(SALOME_InteractiveObject)& theIObject,
(&SALOME_Actor::setName,theName.latin1()));
}
-//----------------------------------------------------------------------------
+/*!
+ \return current display mode (obsolete)
+*/
int
SVTK_View
::GetDisplayMode()
return myDisplayMode;
}
+/*!
+ Set current display mode
+ \param theMode - new display mode
+*/
void
SVTK_View
::SetDisplayMode(int theMode)
myDisplayMode = theMode;
}
+/*!
+ Set current display mode
+ \param theIObject - object
+ \param theMode - new display mode
+*/
void
SVTK_View
::SetDisplayMode(const Handle(SALOME_InteractiveObject)& theIObject,
(&SALOME_Actor::setDisplayMode,theMode));
}
-//----------------------------------------------------------------------------
+/*!
+ Change all actors to wireframe
+*/
void
SVTK_View
::ChangeRepresentationToWireframe()
ChangeRepresentationToWireframe(getRenderer()->GetActors());
}
+/*!
+ Change all actors to shading
+*/
void
SVTK_View
::ChangeRepresentationToSurface()
ChangeRepresentationToSurface(getRenderer()->GetActors());
}
-
+/*!
+ Change to wireframe a list of vtkactor
+ theCollection - list of vtkactor
+*/
void
SVTK_View
::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
Repaint();
}
+/*!
+ Change to shading a list of vtkactor
+ theCollection - list of vtkactor
+*/
void
SVTK_View
::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
Repaint();
}
-//----------------------------------------------------------------------------
namespace SVTK
{
struct TErase
};
}
+/*!
+ To erase all existing VTK presentations
+*/
void
SVTK_View
::EraseAll()
Repaint();
}
+/*!
+ To display all existing VTK presentations
+*/
void
SVTK_View
::DisplayAll()
Repaint();
}
-
+/*!
+ To erase VTK presentation
+ \param theActor - actor
+ \param theIsUpdate - updates current viewer
+*/
void
SVTK_View
::Erase(SALOME_Actor* theActor,
}
+/*!
+ To erase VTK presentation
+ \param theIObject - object
+ \param theIsUpdate - updates current viewer
+*/
void
SVTK_View
::Erase(const Handle(SALOME_InteractiveObject)& theIObject,
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ To display the VTK presentation
+*/
void
SVTK_View
::Display(SALOME_Actor* theActor,
Repaint();
}
+/*!
+ To display the VTK presentation
+*/
void
SVTK_View
::Display(const Handle(SALOME_InteractiveObject)& theIObject,
Repaint();
}
+/*!
+ To display VTK presentation with defined #SALOME_InteractiveObject and erase all others
+*/
void
SVTK_View
::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject)
}
-//----------------------------------------------------------------------------
namespace SVTK
{
struct TRemoveAction
};
}
+/*!
+ To remove the VTK presentation
+*/
void
SVTK_View
::Remove(const Handle(SALOME_InteractiveObject)& theIObject,
Repaint();
}
+/*!
+ To remove the VTK presentation
+*/
void
SVTK_View
::Remove(SALOME_Actor* theActor,
Repaint();
}
+/*!
+ To remove all VTK presentations
+*/
void
SVTK_View
::RemoveAll(bool theIsUpdate)
}
}
-//----------------------------------------------------------------------------
+/*!
+ \return current transparency
+ \param theIObject - object
+*/
float
SVTK_View
::GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject)
}
+/*!
+ Sets current transparency
+ \param theIObject - object
+ \param theTrans - new transparency
+*/
void
SVTK_View
::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
float theTrans)
{
- float anOpacity = 1.0 - theTrans;
+ vtkFloatingPointType anOpacity = 1.0 - theTrans;
using namespace SVTK;
ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
TIsSameIObject<SALOME_Actor>(theIObject),
- TSetFunction<SALOME_Actor,float>
+ TSetFunction<SALOME_Actor,vtkFloatingPointType>
(&SALOME_Actor::SetOpacity,anOpacity));
}
-//----------------------------------------------------------------------------
+/*!
+ Change color
+ \param theIObject - object
+ \param theColor - new color
+*/
void
SVTK_View
::SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
const QColor& theColor)
{
- float aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.};
+ vtkFloatingPointType aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.};
using namespace SVTK;
ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
TIsSameIObject<SALOME_Actor>(theIObject),
- TSetFunction<SALOME_Actor,const float*>
+ TSetFunction<SALOME_Actor,const vtkFloatingPointType*>
(&SALOME_Actor::SetColor,aColor));
}
+/*!
+ \return object color
+ \param theIObject - object
+*/
QColor
SVTK_View
::GetColor(const Handle(SALOME_InteractiveObject)& theIObject)
Find<SALOME_Actor>(getRenderer()->GetActors(),
TIsSameIObject<SALOME_Actor>(theIObject));
if(anActor){
- float r,g,b;
+ vtkFloatingPointType r,g,b;
anActor->GetColor(r,g,b);
return QColor(int(r*255),int(g*255),int(b*255));
}
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef SVTK_VIEW_H
#define SVTK_VIEW_H
class SALOME_Actor;
-//----------------------------------------------------------------------------
//! Main purpose of the class is to provide a way to customize #SVTK_MainWindow.
/*!
This class is initialized by #SVTK_MainWindow and just pass Qt signals from
};
-//----------------------------------------------------------------------------
//! This class is introduced just for compatibility with old code.
/*!
This class contains frequantly used functionality in old code.
void
unHighlightAll();
- /* Selection Management */
+ //! Try to find a SALOME_InteractiveObject in the view that corresponds to the entry
Handle(SALOME_InteractiveObject)
FindIObject(const char* Entry);
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SVTK_ViewManager.h"
#include "SVTK_ViewModel.h"
int SVTK_ViewManager::_SVTKViewMgr_Id = 0;
-//***************************************************************
+/*!
+ Constructor
+*/
SVTK_ViewManager::SVTK_ViewManager( SUIT_Study* study,
SUIT_Desktop* theDesktop )
: SUIT_ViewManager( study, theDesktop )
setViewModel( new SVTK_Viewer() );
}
-//***************************************************************
+/*!
+ Destructor
+*/
SVTK_ViewManager::~SVTK_ViewManager()
{
}
-//***************************************************************
+/*!
+ \return corresponding main window
+*/
+SUIT_Desktop* SVTK_ViewManager::getDesktop()
+{
+ return myDesktop;
+}
+
+/*!
+ Sets default name of view
+*/
void SVTK_ViewManager::setViewName(SUIT_ViewWindow* theView)
{
int aPos = myViews.find(theView);
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SVTK_VIEWMANAGER_H
#define SVTK_VIEWMANAGER_H
//! Destroy the view manager
virtual ~SVTK_ViewManager();
+ SUIT_Desktop* getDesktop();
+
protected:
void setViewName( SUIT_ViewWindow* theView );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <qpopupmenu.h>
#include <qcolordialog.h>
// return aMgr->GetStudyByID( id );
//}
-//==========================================================
+/*!
+ Constructor
+*/
SVTK_Viewer::SVTK_Viewer()
{
myTrihedronSize = 105;
+ myTrihedronRelative = true;
}
-//==========================================================
+/*!
+ Destructor
+*/
SVTK_Viewer::~SVTK_Viewer()
{
}
+/*!
+ \return background color
+*/
QColor
SVTK_Viewer
::backgroundColor() const
return myBgColor;
}
+/*!
+ Changes background color
+ \param theColor - new background color
+*/
void
SVTK_Viewer
::setBackgroundColor( const QColor& theColor )
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
- aView->getMainWindow()->SetBackgroundColor(theColor);
+ aView->setBackgroundColor(theColor);
}
}
}
myBgColor = theColor;
}
-//==========================================================
-SUIT_ViewWindow*
+/*!Create new instance of view window on desktop \a theDesktop.
+ *\retval SUIT_ViewWindow* - created view window pointer.
+ */
+SUIT_ViewWindow*
SVTK_Viewer::
createView( SUIT_Desktop* theDesktop )
{
- SVTK_ViewWindow* aViewWindow = new SVTK_ViewWindow(theDesktop);
+ TViewWindow* aViewWindow = new TViewWindow(theDesktop);
aViewWindow->Initialize(this);
-
+
aViewWindow->setBackgroundColor( backgroundColor() );
- aViewWindow->SetTrihedronSize( trihedronSize() );
+ aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() );
return aViewWindow;
}
+/*!
+ \return trihedron size
+*/
int SVTK_Viewer::trihedronSize() const
{
return myTrihedronSize;
}
-void SVTK_Viewer::setTrihedronSize( const int sz )
+/*!
+ \return true if thihedron changes size in accordance with bounding box
+*/
+bool SVTK_Viewer::trihedronRelative() const
{
- myTrihedronSize = sz;
-
- SUIT_ViewManager* vm = getViewManager();
- if ( !vm )
- return;
-
- QPtrVector<SUIT_ViewWindow> vec = vm->getViews();
- for ( int i = 0; i < vec.count(); i++ )
- {
- SUIT_ViewWindow* win = vec.at( i );
- if ( !win || !win->inherits( "SVTK_ViewWindow" ) )
- continue;
+ return myTrihedronRelative;
+}
- SVTK_ViewWindow* vw = (SVTK_ViewWindow*)win;
- vw->SetTrihedronSize( sz );
+/*!
+ Sets trihedron size and relativeness( whether thihedron changes size in accordance with bounding box)
+ \param theSize - new size
+ \param theRelative - new relativeness
+*/
+void SVTK_Viewer::setTrihedronSize( const int theSize, const bool theRelative )
+{
+ myTrihedronSize = theSize;
+ myTrihedronRelative = theRelative;
+
+ if (SUIT_ViewManager* aViewManager = getViewManager()) {
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for (int i = 0; i < aViews.count(); i++) {
+ if (TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))) {
+ aView->SetTrihedronSize(theSize, theRelative);
+ }
+ }
}
}
-//==========================================================
+/*!
+ Sets new view manager
+ \param theViewManager - new view manager
+*/
void SVTK_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
SUIT_ViewModel::setViewManager(theViewManager);
this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
}
-//==========================================================
+/*!
+ Builds popup for vtk viewer
+*/
void
SVTK_Viewer
::contextMenuPopup( QPopupMenu* thePopup )
thePopup->insertSeparator();
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
- if ( !aView->getView()->GetMainWindow()->getToolBar()->isVisible() ){
+ if ( !aView->getMainWindow()->getToolBar()->isVisible() ){
thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
}
}
}
-//==========================================================
+/*!
+ SLOT: called on mouse button press, empty implementation
+*/
void
SVTK_Viewer
::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
{}
-//==========================================================
+/*!
+ SLOT: called on mouse move, empty implementation
+*/
void
SVTK_Viewer
::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
{}
-//==========================================================
+/*!
+ SLOT: called on mouse button release, empty implementation
+*/
void
SVTK_Viewer
::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
{}
-//==========================================================
+/*!
+ Enables/disables selection
+ \param isEnabled - new state
+*/
void
SVTK_Viewer
::enableSelection(bool isEnabled)
//!! To be done for view windows
}
-//==========================================================
+/*!
+ Enables/disables selection of many object
+ \param isEnabled - new state
+*/
void
SVTK_Viewer
::enableMultiselection(bool isEnable)
//!! To be done for view windows
}
+/*!
+ SLOT: called on dump view operation is activated, stores scene to raster file
+*/
void
SVTK_Viewer
::onDumpView()
aView->onDumpView();
}
-//==========================================================
+/*!
+ SLOT: called if background color is to be changed changed, passes new color to view port
+*/
void
SVTK_Viewer
::onChangeBgColor()
}
}
-//==========================================================
+/*!
+ SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window
+*/
void
SVTK_Viewer
::onShowToolbar()
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
- aView->getView()->GetMainWindow()->getToolBar()->show();
+ aView->getMainWindow()->getToolBar()->show();
}
}
}
-//==========================================================
+/*!
+ Display presentation
+ \param prs - presentation
+*/
void
SVTK_Viewer
::Display( const SALOME_VTKPrs* prs )
}
}
-//==========================================================
+/*!
+ Erase presentation
+ \param prs - presentation
+ \param forced - removes object from view
+*/
void
SVTK_Viewer
::Erase( const SALOME_VTKPrs* prs, const bool forced )
}
}
}
-
-//==========================================================
+
+/*!
+ Erase all presentations
+ \param forced - removes all objects from view
+*/
void
SVTK_Viewer
::EraseAll( const bool forced )
Repaint();
}
-//==========================================================
+/*!
+ Create presentation corresponding to the entry
+ \param entry - entry
+*/
SALOME_Prs*
SVTK_Viewer
::CreatePrs( const char* entry )
return prs;
}
-//==========================================================
+/*!
+ Auxiliary method called before displaying of objects
+*/
void
SVTK_Viewer
::BeforeDisplay( SALOME_Displayer* d )
d->BeforeDisplay( this, SALOME_VTKViewType() );
}
-//==========================================================
+/*!
+ Auxiliary method called after displaying of objects
+*/
void
SVTK_Viewer::AfterDisplay( SALOME_Displayer* d )
{
d->AfterDisplay( this, SALOME_VTKViewType() );
}
-//==========================================================
+/*!
+ \return true if object is displayed in viewer
+ \param obj - object to be checked
+*/
bool
SVTK_Viewer
::isVisible( const Handle(SALOME_InteractiveObject)& io )
{
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
- if(SVTK_View* aView = aViewWindow->getView())
- if(!aView->isVisible( io ))
- return false;
+ if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+ if(TViewWindow* aViewWnd = dynamic_cast<TViewWindow*>(aViewWindow))
+ if(SVTK_View* aView = aViewWnd->getView())
+ if(!aView->isVisible( io ))
+ return false;
return true;
}
-//==========================================================
+/*!
+ Updates current viewer
+*/
void
SVTK_Viewer
::Repaint()
// if (theUpdateTrihedron) onAdjustTrihedron();
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
+ if(TViewWindow* aViewWindow = dynamic_cast<TViewWindow*>(aViews.at(i)))
if(SVTK_View* aView = aViewWindow->getView())
aView->Repaint();
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SVTK_VIEWMODEL_H
#define SVTK_VIEWMODEL_H
//! Get size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
int trihedronSize() const;
+ //! Shows if the size of trihedron relative (see #SVTK_Renderer::SetTrihedronSize)
+ bool trihedronRelative() const;
+
//! Set size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
- void setTrihedronSize( const int );
+ void setTrihedronSize( const int, const bool = true );
public:
void enableSelection(bool isEnabled);
private:
QColor myBgColor;
int myTrihedronSize;
+ bool myTrihedronRelative;
bool mySelectionEnabled;
bool myMultiSelectionEnabled;
};
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef SVTK_SELECTIONCHANGED_H
#define SVTK_SELECTIONCHANGED_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOME_Actor.h"
#include <vtkCamera.h>
#include <vtkPointPicker.h>
#include <vtkCellPicker.h>
+#include <vtkAxisActor2D.h>
#include "QtxAction.h"
#include "SVTK_InteractorStyle.h"
#include "SVTK_RenderWindowInteractor.h"
#include "SVTK_GenericRenderWindowInteractor.h"
+#include "SVTK_CubeAxesActor2D.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "VTKViewer_Algorithm.h"
#include "SVTK_Functor.h"
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_ViewWindow
::SVTK_ViewWindow(SUIT_Desktop* theDesktop):
SUIT_ViewWindow(theDesktop),
myView(NULL)
{}
+/*!
+ To initialize #SVTK_ViewWindow instance
+*/
void
SVTK_ViewWindow
::Initialize(SVTK_ViewModelBase* theModel)
}
}
+/*!
+ To initialize #SVTK_ViewWindow instance
+*/
void
SVTK_ViewWindow
::Initialize(SVTK_View* theView,
theModel,SLOT(onSelectionChanged()));
}
+/*!
+ Destructor
+*/
SVTK_ViewWindow
::~SVTK_ViewWindow()
{}
-//----------------------------------------------------------------------------
+/*!
+ \return corresponding view
+*/
SVTK_View*
SVTK_ViewWindow
::getView()
return myView;
}
+/*!
+ \return corresponding vtk main window
+*/
SVTK_MainWindow*
SVTK_ViewWindow
::getMainWindow()
return myMainWindow;
}
+/*!
+ \return corresponding vtk render window
+*/
vtkRenderWindow*
SVTK_ViewWindow
::getRenderWindow()
return getMainWindow()->getRenderWindow();
}
+/*!
+ \return corresponding vtk render window interactor
+*/
vtkRenderWindowInteractor*
SVTK_ViewWindow
::getInteractor()
return getMainWindow()->getInteractor();
}
+/*!
+ \return corresponding vtk renderer
+*/
vtkRenderer*
SVTK_ViewWindow
::getRenderer()
return myMainWindow->getRenderer();
}
+/*!
+ \return corresponding vtk selector
+*/
SVTK_Selector*
SVTK_ViewWindow
::GetSelector()
return myMainWindow->GetSelector();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "front view"
+*/
void
SVTK_ViewWindow
::onFrontView()
myMainWindow->onFrontView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "back view"
+*/
void
SVTK_ViewWindow
::onBackView()
myMainWindow->onBackView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "top view"
+*/
void
SVTK_ViewWindow
::onTopView()
myMainWindow->onTopView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "bottom view"
+*/
void
SVTK_ViewWindow
::onBottomView()
myMainWindow->onBottomView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "left view"
+*/
void
SVTK_ViewWindow
::onLeftView()
myMainWindow->onLeftView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "right view"
+*/
void
SVTK_ViewWindow
::onRightView()
myMainWindow->onRightView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "reset view": sets default orientation of viewport camera
+*/
void
SVTK_ViewWindow
::onResetView()
myMainWindow->onResetView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "fit all"
+*/
void
SVTK_ViewWindow
::onFitAll()
myMainWindow->onFitAll();
}
-//----------------------------------------------------------------
+/*!
+ SLOT: called if selection is changed
+*/
void
SVTK_ViewWindow
::onSelectionChanged()
myView->onSelectionChanged();
}
-//----------------------------------------------------------------
+/*!
+ Change selection mode
+ \param theMode - new selection mode
+*/
void
SVTK_ViewWindow
::SetSelectionMode(Selection_Mode theMode)
myMainWindow->SetSelectionMode( theMode );
}
-//----------------------------------------------------------------
+/*!
+ \return selection mode
+*/
Selection_Mode
SVTK_ViewWindow
::SelectionMode() const
return myMainWindow->SelectionMode();
}
-//----------------------------------------------------------------
+/*!
+ Unhilights all objects in viewer
+*/
void
SVTK_ViewWindow
::unHighlightAll()
myView->unHighlightAll();
}
-//----------------------------------------------------------------
+/*!
+ Hilights/unhilights object in viewer
+ \param theIO - object to be updated
+ \param theIsHighlight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param theIsUpdate - update current viewer
+*/
void
SVTK_ViewWindow
::highlight(const Handle(SALOME_InteractiveObject)& theIO,
myView->highlight( theIO, theIsHighlight, theIsUpdate );
}
-//----------------------------------------------------------------
+/*!
+ \return true if object is in viewer or in collector
+ \param theIO - object to be checked
+*/
bool
SVTK_ViewWindow
::isInViewer( const Handle(SALOME_InteractiveObject)& theIO )
return myView->isInViewer( theIO );
}
-//----------------------------------------------------------------
+/*!
+ \return true if object is displayed in viewer
+ \param theIO - object to be checked
+*/
bool
SVTK_ViewWindow
::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
return myView->isVisible( theIO );
}
-//----------------------------------------------------------------
+/*!
+ Display object
+ \param theEntry - entry that corresponds to intractive objects
+*/
+Handle(SALOME_InteractiveObject)
+SVTK_ViewWindow
+::FindIObject(const char* theEntry)
+{
+ return myView->FindIObject(theEntry);
+}
+
+/*!
+ Display object
+ \param theIO - object
+ \param theImmediatly - update viewer
+*/
void
SVTK_ViewWindow
::Display(const Handle(SALOME_InteractiveObject)& theIO,
myView->Display(theIO,theImmediatly);
}
+/*!
+ Erase object
+ \param theIO - object
+ \param theImmediatly - update viewer
+*/
void
SVTK_ViewWindow
::Erase(const Handle(SALOME_InteractiveObject)& theIO,
myView->Erase(theIO,theImmediatly);
}
+/*!
+ Display only passed object
+ \param theIO - object
+*/
void
SVTK_ViewWindow
::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO)
myView->DisplayOnly(theIO);
}
+/*!
+ Display all objects in view
+*/
void
SVTK_ViewWindow
::DisplayAll()
myView->DisplayAll();
}
+/*!
+ Erase all objects in view
+*/
void
SVTK_ViewWindow
::EraseAll()
myView->EraseAll();
}
-//----------------------------------------------------------------------------
+/*!
+ Sets background color
+ \param color - new background color
+*/
void
SVTK_ViewWindow
::setBackgroundColor( const QColor& color )
myMainWindow->SetBackgroundColor( color );
}
-//----------------------------------------------------------------------------
+/*!
+ \return background color of viewer
+*/
QColor
SVTK_ViewWindow
::backgroundColor() const
return myMainWindow->BackgroundColor();
}
-//----------------------------------------------------------------------------
+/*!
+ Updates current viewer
+*/
void
SVTK_ViewWindow
::Repaint(bool theUpdateTrihedron)
myMainWindow->Repaint( theUpdateTrihedron );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::GetScale
+*/
void
SVTK_ViewWindow
::GetScale( double theScale[3] )
myMainWindow->GetScale( theScale );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetScale
+*/
void
SVTK_ViewWindow
::SetScale( double theScale[3] )
myMainWindow->SetScale( theScale );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
+*/
bool
SVTK_ViewWindow
::isTrihedronDisplayed()
return myMainWindow->IsTrihedronDisplayed();
}
+/*!
+ Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
+*/
bool
SVTK_ViewWindow
::isCubeAxesDisplayed()
return myMainWindow->IsCubeAxesDisplayed();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::OnViewTrihedron
+*/
void
SVTK_ViewWindow
::onViewTrihedron()
myMainWindow->onViewTrihedron();
}
+/*!
+ Redirect the request to #SVTK_Renderer::OnViewCubeAxes
+*/
void
SVTK_ViewWindow
::onViewCubeAxes()
myMainWindow->onViewCubeAxes();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::GetTrihedron
+*/
VTKViewer_Trihedron*
SVTK_ViewWindow::
GetTrihedron()
return myMainWindow->GetTrihedron();
}
+/*!
+ Redirect the request to #SVTK_Renderer::GetCubeAxes
+*/
SVTK_CubeAxesActor2D*
SVTK_ViewWindow
::GetCubeAxes()
return myMainWindow->GetCubeAxes();
}
+/*!
+ \return trihedron size
+*/
int
SVTK_ViewWindow
::GetTrihedronSize() const
return myMainWindow->GetTrihedronSize();
}
+/*!
+ Sets trihedron size
+ \param theSize - new trihedron size
+ \param theRelative - trihedron relativeness
+*/
void
SVTK_ViewWindow
-::SetTrihedronSize(const int theSize)
+::SetTrihedronSize(const int theSize, const bool theRelative)
{
- myMainWindow->SetTrihedronSize(theSize);
+ myMainWindow->SetTrihedronSize(theSize, theRelative);
}
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
myMainWindow->AdjustActors();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::OnAdjustTrihedron
+*/
void
SVTK_ViewWindow
::onAdjustTrihedron()
myMainWindow->onAdjustTrihedron();
}
+/*!
+ Redirect the request to #SVTK_Renderer::OnAdjustCubeAxes
+*/
void
SVTK_ViewWindow
::onAdjustCubeAxes()
myMainWindow->onAdjustCubeAxes();
}
-//=======================================================================
+/*!
+ Emits key pressed
+*/
void
SVTK_ViewWindow
::onKeyPressed(QKeyEvent* event)
emit keyPressed( this, event );
}
-//=======================================================================
+/*!
+ Emits key released
+*/
void
SVTK_ViewWindow
::onKeyReleased(QKeyEvent* event)
emit keyReleased( this, event );
}
-//=======================================================================
+/*!
+ Emits mouse pressed
+*/
void
SVTK_ViewWindow
::onMousePressed(QMouseEvent* event)
emit mousePressed(this, event);
}
-//=======================================================================
+/*!
+ Emits mouse released
+*/
void
SVTK_ViewWindow
::onMouseReleased(QMouseEvent* event)
emit mouseReleased( this, event );
}
-//=======================================================================
+/*!
+ Emits mouse moving
+*/
void
SVTK_ViewWindow
::onMouseMoving(QMouseEvent* event)
emit mouseMoving( this, event );
}
-//=======================================================================
+/*!
+ Emits mouse double clicked
+*/
void
SVTK_ViewWindow
::onMouseDoubleClicked( QMouseEvent* event )
emit mouseDoubleClicked( this, event );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::AddActor
+*/
void
SVTK_ViewWindow
::AddActor( VTKViewer_Actor* theActor,
myMainWindow->AddActor( theActor, theUpdate );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::RemoveActor
+*/
void
SVTK_ViewWindow
::RemoveActor( VTKViewer_Actor* theActor,
myMainWindow->RemoveActor( theActor, theUpdate );
}
-//----------------------------------------------------------------------------
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage
SVTK_ViewWindow
::dumpView()
return myMainWindow->dumpView();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
void
SVTK_ViewWindow
::SetSelectionProp(const double& theRed,
myView->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
void
SVTK_ViewWindow
::SetPreselectionProp(const double& theRed,
myView->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetSelectionTolerance
+*/
void
SVTK_ViewWindow
::SetSelectionTolerance(const double& theTolNodes,
myView->SetSelectionTolerance(theTolNodes,theTolItems);
}
-//----------------------------------------------------------------------------
int convertAction( const int accelAction )
{
switch ( accelAction ) {
return accelAction;
}
-//----------------------------------------------------------------------------
-void
+/*!
+ Performs action
+ \param accelAction - action
+*/
+bool
SVTK_ViewWindow
::action( const int accelAction )
{
+ if ( !myMainWindow->hasFocus() )
+ return false;
if ( accelAction == SUIT_Accel::ZoomFit )
onFitAll();
else {
int anEvent = convertAction( accelAction );
myMainWindow->InvokeEvent( anEvent, 0 );
}
+ return true;
+}
+
+// old visual parameters had 13 values. New format added additional
+// 76 values for graduated axes, so both numbers are processed.
+const int nNormalParams = 13; // number of view windows parameters excluding graduated axes params
+const int nGradAxisParams = 25; // number of parameters of ONE graduated axis (X, Y, or Z)
+const int nAllParams = nNormalParams + 3*nGradAxisParams + 1; // number of all visual parameters
+
+/*! The method returns visual parameters of a graduated axis actor (x,y,z axis of graduated axes)
+ */
+QString getGradAxisVisualParams( vtkAxisActor2D* actor )
+{
+ QString params;
+ if ( !actor )
+ return params;
+
+ // Name
+ bool isVisible = actor->GetTitleVisibility();
+ QString title ( actor->GetTitle() );
+ vtkFloatingPointType color[ 3 ];
+ int font = VTK_ARIAL;
+ int bold = 0;
+ int italic = 0;
+ int shadow = 0;
+
+ vtkTextProperty* txtProp = actor->GetTitleTextProperty();
+ if ( txtProp )
+ {
+ txtProp->GetColor( color );
+ font = txtProp->GetFontFamily();
+ bold = txtProp->GetBold();
+ italic = txtProp->GetItalic();
+ shadow = txtProp->GetShadow();
+ }
+ params.sprintf( "* Graduated Axis: * Name *%u*%s*%.2f*%.2f*%.2f*%u*%u*%u*%u", isVisible,
+ title.latin1(), color[0], color[1], color[2], font, bold, italic, shadow );
+
+ // Labels
+ isVisible = actor->GetLabelVisibility();
+ int labels = actor->GetNumberOfLabels();
+ int offset = actor->GetTickOffset();
+ font = VTK_ARIAL;
+ bold = false;
+ italic = false;
+ shadow = false;
+
+ txtProp = actor->GetLabelTextProperty();
+ if ( txtProp )
+ {
+ txtProp->GetColor( color );
+ font = txtProp->GetFontFamily();
+ bold = txtProp->GetBold();
+ italic = txtProp->GetItalic();
+ shadow = txtProp->GetShadow();
+ }
+ params += QString().sprintf( "* Labels *%u*%u*%u*%.2f*%.2f*%.2f*%u*%u*%u*%u", isVisible, labels, offset,
+ color[0], color[1], color[2], font, bold, italic, shadow );
+
+ // Tick marks
+ isVisible = actor->GetTickVisibility();
+ int length = actor->GetTickLength();
+
+ params += QString().sprintf( "* Tick marks *%u*%u", isVisible, length );
+
+ return params;
+}
+
+/*! The method restores visual parameters of a graduated axis actor (x,y,z axis)
+ */
+void setGradAxisVisualParams( vtkAxisActor2D* actor, const QString& params )
+{
+ if ( !actor )
+ return;
+
+ QStringList paramsLst = QStringList::split( '*', params, true );
+
+ if ( paramsLst.size() == nGradAxisParams ) { // altogether name, lable, ticks parameters make up 25 values
+
+ // retrieve and set name parameters
+ bool isVisible = paramsLst[2].toUShort();
+ QString title = paramsLst[3];
+ vtkFloatingPointType color[3];
+ color[0] = paramsLst[4].toDouble();
+ color[1] = paramsLst[5].toDouble();
+ color[2] = paramsLst[6].toDouble();
+ int font = paramsLst[7].toInt();
+ int bold = paramsLst[8].toInt();
+ int italic = paramsLst[9].toInt();
+ int shadow = paramsLst[10].toInt();
+
+ actor->SetTitleVisibility( isVisible );
+ actor->SetTitle( title.latin1() );
+ vtkTextProperty* txtProp = actor->GetTitleTextProperty();
+ if ( txtProp ) {
+ txtProp->SetColor( color );
+ txtProp->SetFontFamily( font );
+ txtProp->SetBold( bold );
+ txtProp->SetItalic( italic );
+ txtProp->SetShadow( shadow );
+ }
+
+ // retrieve and set lable parameters
+ isVisible = paramsLst[12].toUShort();
+ int labels = paramsLst[13].toInt();
+ int offset = paramsLst[14].toInt();
+ color[0] = paramsLst[15].toDouble();
+ color[1] = paramsLst[16].toDouble();
+ color[2] = paramsLst[17].toDouble();
+ font = paramsLst[18].toInt();
+ bold = paramsLst[19].toInt();
+ italic = paramsLst[20].toInt();
+ shadow = paramsLst[21].toInt();
+
+ actor->SetLabelVisibility( isVisible );
+ actor->SetNumberOfLabels( labels );
+ actor->SetTickOffset( offset );
+ txtProp = actor->GetLabelTextProperty();
+ if ( txtProp ) {
+ txtProp->SetColor( color );
+ txtProp->SetFontFamily( font );
+ txtProp->SetBold( bold );
+ txtProp->SetItalic( italic );
+ txtProp->SetShadow( shadow );
+ }
+
+ // retrieve and set tick marks properties
+ isVisible = paramsLst[23].toUShort();
+ int length = paramsLst[24].toInt();
+
+ actor->SetTickVisibility( isVisible );
+ actor->SetTickLength( length );
+ }
+}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString
+SVTK_ViewWindow
+::getVisualParameters()
+{
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+
+ // save position, focal point, viewUp, scale
+ vtkCamera* camera = getRenderer()->GetActiveCamera();
+ camera->GetPosition( pos );
+ camera->GetFocalPoint( focalPnt );
+ camera->GetViewUp( viewUp );
+ parScale = camera->GetParallelScale();
+ GetScale( scale );
+
+ // Parameters are given in the following format:view position (3 digits), focal point position (3 digits)
+ // view up values (3 digits), parallel scale (1 digit), scale (3 digits,
+ // Graduated axes parameters (X, Y, Z axes parameters)
+ QString retStr;
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e",
+ pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2],
+ viewUp[0], viewUp[1], viewUp[2], parScale, scale[0], scale[1], scale[2] );
+
+ // save graduated axes parameters
+ if ( SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes() ) {
+ retStr += QString( "*%1" ).arg( getMainWindow()->IsCubeAxesDisplayed() );
+ retStr += ::getGradAxisVisualParams( gradAxesActor->GetXAxisActor2D() );
+ retStr += ::getGradAxisVisualParams( gradAxesActor->GetYAxisActor2D() );
+ retStr += ::getGradAxisVisualParams( gradAxesActor->GetZAxisActor2D() );
+ }
+
+ return retStr;
+}
+
+/*!
+ The method restores visual parameters of this view or postpones it untill the view is shown
+*/
+void
+SVTK_ViewWindow
+::setVisualParameters( const QString& parameters )
+{
+ SVTK_RenderWindowInteractor* anInteractor = getMainWindow()->GetInteractor();
+ if ( anInteractor->isVisible() ) {
+ doSetVisualParameters( parameters );
+ }
+ else {
+ myVisualParams = parameters;
+ anInteractor->installEventFilter(this);
+ }
+}
+
+/*!
+ The method restores visual parameters of this view from a formated string
+*/
+void
+SVTK_ViewWindow
+::doSetVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() >= nNormalParams ) {
+ // 'reading' list of parameters
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+ pos[0] = paramsLst[0].toDouble();
+ pos[1] = paramsLst[1].toDouble();
+ pos[2] = paramsLst[2].toDouble();
+ focalPnt[0] = paramsLst[3].toDouble();
+ focalPnt[1] = paramsLst[4].toDouble();
+ focalPnt[2] = paramsLst[5].toDouble();
+ viewUp[0] = paramsLst[6].toDouble();
+ viewUp[1] = paramsLst[7].toDouble();
+ viewUp[2] = paramsLst[8].toDouble();
+ parScale = paramsLst[9].toDouble();
+ scale[0] = paramsLst[10].toDouble();
+ scale[1] = paramsLst[11].toDouble();
+ scale[2] = paramsLst[12].toDouble();
+
+ // applying parameters
+ vtkCamera* camera = getRenderer()->GetActiveCamera();
+ camera->SetPosition( pos );
+ camera->SetFocalPoint( focalPnt );
+ camera->SetViewUp( viewUp );
+ camera->SetParallelScale( parScale );
+ SetScale( scale );
+
+ // apply graduated axes parameters
+ SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes();
+ if ( gradAxesActor && paramsLst.size() == nAllParams ) {
+
+ int i = nNormalParams+1, j = i + nGradAxisParams - 1;
+ ::setGradAxisVisualParams( gradAxesActor->GetXAxisActor2D(), parameters.section( '*', i, j ) );
+ i = j + 1; j += nGradAxisParams;
+ ::setGradAxisVisualParams( gradAxesActor->GetYAxisActor2D(), parameters.section( '*', i, j ) );
+ i = j + 1; j += nGradAxisParams;
+ ::setGradAxisVisualParams( gradAxesActor->GetZAxisActor2D(), parameters.section( '*', i, j ) );
+
+ if ( paramsLst[13].toUShort() )
+ gradAxesActor->VisibilityOn();
+ else
+ gradAxesActor->VisibilityOff();
+ }
+ }
+}
+
+
+/*!
+ Delayed setVisualParameters
+*/
+bool SVTK_ViewWindow::eventFilter( QObject* theWatched, QEvent* theEvent )
+{
+ if ( theEvent->type() == QEvent::Show && theWatched->inherits( "SVTK_RenderWindowInteractor" ) ) {
+ SVTK_RenderWindowInteractor* anInteractor = (SVTK_RenderWindowInteractor*)theWatched;
+ if ( anInteractor->isVisible() ) {
+ doSetVisualParameters( myVisualParams );
+ anInteractor->removeEventFilter( this ); // theWatched = RenderWindowInteractor
+ }
+ }
+ return SUIT_ViewWindow::eventFilter( theWatched, theEvent );
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SVTK_VIEWWINDOW_H
#define SVTK_VIEWWINDOW_H
bool
isVisible(const Handle(SALOME_InteractiveObject)& theIObject);
- /* selection */
+ //! Redirect the request to #SVTK_View::FindIObject (to support old code)
//----------------------------------------------------------------------------
Handle(SALOME_InteractiveObject)
FindIObject(const char* theEntry);
//! Redirect the request to #SVTK_Renderer::SetTrihedronSize
virtual
void
- SetTrihedronSize( const int );
+ SetTrihedronSize( const int, const bool = true );
//! Redirect the request to #SVTK_Renderer::SetSelectionProp
virtual
void
SetSelectionTolerance(const double& theTolNodes = 0.025,
const double& theTolCell = 0.001);
+
+ //! Methods to save/restore visual parameters of a view (pan, zoom, etc.)
+ virtual
+ QString
+ getVisualParameters();
+
+ virtual
+ void
+ setVisualParameters( const QString& parameters );
+
+ virtual
+ bool
+ eventFilter( QObject*, QEvent* );
public slots:
virtual
Initialize(SVTK_View* theView,
SVTK_ViewModelBase* theModel);
+ void
+ doSetVisualParameters( const QString& );
+
QImage dumpView();
- virtual void action( const int );
+ virtual bool action( const int );
SVTK_View* myView;
SVTK_MainWindow* myMainWindow;
SVTK_ViewModelBase* myModel;
+
+ QString myVisualParams; // used for delayed setting of view parameters
};
extern "C"
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
msgid "ERROR"
msgstr "Error"
-msgid "BUT_OK"
-msgstr "Ok"
-
msgid "SVTK_Viewer::MEN_DUMP_VIEW"
msgstr "Dump view..."
msgid "DSC_SHOW_TRIHEDRON"
msgstr "Show/Hide trihedron in the current view"
+
+msgid "SVTK_NonIsometricDlg::MEN_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_NonIsometricDlg::O&K"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Apply"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Cancel"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Reset"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::DLG_TITLE"
+msgstr "Scaling"
+
+msgid "SVTK_NonIsometricDlg::LBL_X"
+msgstr "X :"
+
+msgid "SVTK_NonIsometricDlg::LBL_Y"
+msgstr "Y :"
+
+msgid "SVTK_NonIsometricDlg::LBL_Z"
+msgstr "Z :"
+
+msgid "SVTK_MainWindow::MNU_SVTK_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_MainWindow::DSC_SVTK_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_FontWidget::ARIAL"
+msgstr "Arial"
+
+msgid "SVTK_FontWidget::COURIER"
+msgstr "Courier"
+
+msgid "SVTK_FontWidget::TIMES"
+msgstr "Times"
+
+msgid "SVTK_FontWidget::BOLD"
+msgstr "Bold"
+
+msgid "SVTK_FontWidget::ITALIC"
+msgstr "Italic"
+
+msgid "SVTK_FontWidget::SHADOW"
+msgstr "Shadow"
+
+msgid "SVTK_CubeAxesDlg::CAPTION"
+msgstr "Graduated axes"
+
+msgid "SVTK_CubeAxesDlg::X_AXIS"
+msgstr "X axis"
+
+msgid "SVTK_CubeAxesDlg::Y_AXIS"
+msgstr "Y axis"
+
+msgid "SVTK_CubeAxesDlg::Z_AXIS"
+msgstr "Z axis"
+
+msgid "SVTK_CubeAxesDlg::IS_VISIBLE"
+msgstr "Is visible"
+
+msgid "SVTK_AxisWidget::AXIS_NAME"
+msgstr "Axis name"
+
+msgid "SVTK_AxisWidget::IS_VISIBLE"
+msgstr "Is visible"
+
+msgid "SVTK_AxisWidget::NAME"
+msgstr "Name"
+
+msgid "SVTK_AxisWidget::FONT"
+msgstr "Font"
+
+msgid "SVTK_AxisWidget::LABELS"
+msgstr "Labels"
+
+msgid "SVTK_AxisWidget::NUMBER"
+msgstr "Number"
+
+msgid "SVTK_AxisWidget::OFFSET"
+msgstr "Offset"
+
+msgid "SVTK_AxisWidget::TICK_MARKS"
+msgstr "Tick marks"
+
+msgid "SVTK_AxisWidget::LENGTH"
+msgstr "Length"
+
+msgid "SVTK_MainWindow::MNU_SVTK_GRADUATED_AXES"
+msgstr "Graduated axes"
+
+msgid "SVTK_MainWindow::DSC_SVTK_GRADUATED_AXES"
+msgstr "Graduated axes"
+
+msgid "SVTK_MainWindow::MNU_SVTK_UPDATE_RATE"
+msgstr "Update rate"
+
+msgid "SVTK_MainWindow::DSC_SVTK_UPDATE_RATE"
+msgstr "Update rate"
+
+msgid "SVTK_UpdateRateDlg::DLG_TITLE"
+msgstr "Update Rate"
+
+msgid "SVTK_UpdateRateDlg::INPUT_FRAME_TITLE"
+msgstr "Enable"
+
+msgid "SVTK_UpdateRateDlg::DESIRED"
+msgstr "Desired Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::STILL"
+msgstr "Still Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::INFORMATION_FRAME_TITLE"
+msgstr "Rendering Metrics"
+
+msgid "SVTK_UpdateRateDlg::CURRENT_FPS"
+msgstr "Current Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::NUMBER_CELLS"
+msgstr "Number of Cells, -"
+
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : SalomeApp
SalomeApp_Filter.h \
SalomeApp_TypeFilter.h \
SalomeApp_StudyPropertiesDlg.h \
- SalomeApp_CheckFileDlg.h
+ SalomeApp_CheckFileDlg.h \
+ SalomeApp_VisualState.h
# .po files to transform in .qm
PO_FILES = SalomeApp_images.po \
SalomeApp_TypeFilter.cxx \
SalomeApp_StudyPropertiesDlg.cxx \
SalomeApp_ListView.cxx \
- SalomeApp_CheckFileDlg.cxx
+ SalomeApp_CheckFileDlg.cxx \
+ SalomeApp_VisualState.cxx
LIB_MOC = SalomeApp_Application.h \
SalomeApp_DataModel.h \
RESOURCES_FILES = SalomeApp.ini \
SalomeApp.xml
-CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) $(KERNEL_CXXFLAGS)
LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS)
-LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lSalomePrs -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lLightApp -lSalomeContainer -lToolsGUI
+LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lSalomePrs $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSalomeDSClient $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lLightApp -lSalomeContainer -lToolsGUI
@CONCLUDE@
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp.h
// Created: November, 2004
// Author: OCC team
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp_Application.cxx
// Created: 10/22/2004 3:23:45 PM
// Author: Sergey LITONIN
#include "SalomeApp_DataModel.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_EventFilter.h"
+#include "SalomeApp_VisualState.h"
#include "SalomeApp_StudyPropertiesDlg.h"
-#include "SalomeApp_CheckFileDlg.h"
-
#include "LightApp_Application.h"
#include "LightApp_Preferences.h"
#include "LightApp_WidgetContainer.h"
#include "LightApp_SelectionMgr.h"
+#include "LightApp_NameDlg.h"
#include "STD_LoadStudiesDlg.h"
#include <qcombobox.h>
#include <qlistbox.h>
#include <qregexp.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
-#include "SALOMEDS_StudyManager.hxx"
-#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDSClient_ClientFactory.hxx"
+#include "SALOMEDSClient_IParameters.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
#include "ToolsGUI_CatalogGeneratorDlg.h"
#include "ToolsGUI_RegWidget.h"
+#include <SALOMEDSClient_ClientFactory.hxx>
+
/*!Create new instance of SalomeApp_Application.*/
extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
{
return new SalomeApp_Application();
}
-/*
- Class : SalomeApp_Application
- Description : Application containing SalomeApp module or LightApp module
-*/
-
/*!Constructor.*/
SalomeApp_Application::SalomeApp_Application()
: LightApp_Application()
SUIT_Desktop* desk = desktop();
+ //! Save GUI state
+ // "Save GUI State" command is moved to VISU module
+ // createAction( SaveGUIStateId, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIconSet(),
+ // tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
+ // 0, desk, false, this, SLOT( onSaveGUIState() ) );
+
//! Dump study
createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIconSet(),
tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
+ // "Save GUI State" command is renamed to "Save VISU State" and
+ // creation of menu item is moved to VISU
+ // createMenu( SaveGUIStateId, fileMenu, 10, -1 );
+
createMenu( DumpStudyId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
createMenu( LoadScriptId, fileMenu, 10, -1 );
createMenu( PropertiesId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
- int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 50 );
+ int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, MenuToolsId, 50 );
createMenu( CatalogGenId, toolsMenu, 10, -1 );
createMenu( RegDisplayId, toolsMenu, 10, -1 );
createMenu( separator(), toolsMenu, -1, 15, -1 );
_PTR(Study) stdDS = study->studyDS();
if(!stdDS) return;
+ if ( stdDS->GetProperties()->IsLocked() ) {
+ SUIT_MessageBox::warn1 ( desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ return;
+ }
+
SALOME_ListIteratorOfListIO it( list );
if(it.More())
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
if ( so ) {
- SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
-
- if ( aSO ) {
canCopy = studyMgr()->CanCopy(so);
canPaste = studyMgr()->CanPaste(so);
- }
}
}
}
QApplication::restoreOverrideCursor();
}
-//=======================================================================
-// name : createNewStudy
-/*! Purpose : Create new study*/
-//=======================================================================
+/*!
+ Creates new study
+*/
SUIT_Study* SalomeApp_Application::createNewStudy()
{
SalomeApp_Study* aStudy = new SalomeApp_Study( this );
return aStudy;
}
-//=======================================================================
-// name : updateCommandsStatus
-/*! Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu*/
-//=======================================================================
+/*!
+ Enable/Disable menu items and toolbar buttons. Rebuild menu
+*/
void SalomeApp_Application::updateCommandsStatus()
{
LightApp_Application::updateCommandsStatus();
if ( a )
a->setEnabled( activeStudy() );
+ // Properties menu
a = action( PropertiesId );
if( a )
a->setEnabled( activeStudy() );
+ // Save GUI state menu
+ a = action( SaveGUIStateId );
+ if( a )
+ a->setEnabled( activeStudy() );
+
// update state of Copy/Paste menu items
onSelectionChanged();
}
+/*!
+ \class DumpStudyFileDlg
+ Private class used in Dump Study operation. Consists 2 check boxes:
+ "Publish in study" and "Save GUI parameters"
+*/
+class DumpStudyFileDlg : public SUIT_FileDlg
+{
+public:
+ DumpStudyFileDlg( QWidget* parent ) : SUIT_FileDlg( parent, false, true, true )
+ {
+ QHBox* hB = new QHBox( this );
+ myPublishChk = new QCheckBox( tr("PUBLISH_IN_STUDY"), hB );
+ mySaveGUIChk = new QCheckBox( tr("SAVE_GUI_STATE"), hB );
+ QPushButton* pb = new QPushButton(this);
+ addWidgets( new QLabel("", this), hB, pb );
+ pb->hide();
+ }
+ QCheckBox* myPublishChk;
+ QCheckBox* mySaveGUIChk;
+};
+
/*!Private SLOT. On dump study.*/
void SalomeApp_Application::onDumpStudy( )
{
QStringList aFilters;
aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
- SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( desktop(), false, tr("PUBLISH_IN_STUDY"), true, true);
+ DumpStudyFileDlg* fd = new DumpStudyFileDlg( desktop() );
fd->setCaption( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
fd->setFilters( aFilters );
- fd->SetChecked(true);
+ fd->myPublishChk->setChecked( true );
+ fd->mySaveGUIChk->setChecked( true );
fd->exec();
QString aFileName = fd->selectedFile();
- bool toPublish = fd->IsChecked();
+ bool toPublish = fd->myPublishChk->isChecked();
+ bool toSaveGUI = fd->mySaveGUIChk->isChecked();
delete fd;
- if(!aFileName.isEmpty()) {
+ if ( !aFileName.isEmpty() ) {
QFileInfo aFileInfo(aFileName);
- bool res = aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish );
+ int savePoint;
+ _PTR(AttributeParameter) ap;
+ _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
+ if(ip->isDumpPython(appStudy->studyDS())) ip->setDumpPython(appStudy->studyDS()); //Unset DumpPython flag.
+ if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method
+ ip->setDumpPython(appStudy->studyDS());
+ savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
+ }
+ bool res = aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish);
+ if ( toSaveGUI )
+ appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
if ( !res )
- SUIT_MessageBox::warn1 ( desktop(),
- QObject::tr("WRN_WARNING"),
- tr("WRN_DUMP_STUDY_FAILED"),
- QObject::tr("BUT_OK") );
+ SUIT_MessageBox::warn1 ( desktop(),
+ QObject::tr("WRN_WARNING"),
+ tr("WRN_DUMP_STUDY_FAILED"),
+ QObject::tr("BUT_OK") );
}
}
}
}
+/*!Private SLOT. On save GUI state.*/
+void SalomeApp_Application::onSaveGUIState()
+{
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( study ) {
+ SalomeApp_VisualState( this ).storeState();
+ updateSavePointDataObjects( study );
+ objectBrowser()->updateTree( study->root() );
+ }
+ updateActions();
+}
+
/*!Gets file filter.
*\retval QString "(*.hdf)"
*/
LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
}
pref->setItemProperty( defCols, "columns", 1 );
+
+ // adding preference to LightApp_Application handled preferences.. a bit of hacking with resources..
+ int genTab = pref->addPreference( LightApp_Application::tr( "PREF_TAB_GENERAL" ), salomeCat );
+ int studyGroup = pref->addPreference( LightApp_Application::tr( "PREF_GROUP_STUDY" ), genTab );
+ pref->addPreference( tr( "PREF_STORE_VISUAL_STATE" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_visual_state" );
}
/*!Update desktop title.*/
/*!Create and return SALOMEDS_StudyManager.*/
SALOMEDSClient_StudyManager* SalomeApp_Application::studyMgr()
{
- static SALOMEDSClient_StudyManager* _sm = new SALOMEDS_StudyManager();
- return _sm;
+ static _PTR(StudyManager) _sm;
+ if(!_sm) _sm = ClientFactory::StudyManager();
+ return _sm.get();
}
/*!Create and return SALOME_NamingService.*/
LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects( aList, QString::null, false );
+ // add GUI state commands: restore, rename
+ if ( aList.Extent() == 1 && aList.First()->hasEntry() &&
+ QString( aList.First()->getEntry() ).startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) ) {
+ thePopup->insertSeparator();
+ thePopup->insertItem( tr( "MEN_RESTORE_VS" ), this, SLOT( onRestoreGUIState() ) );
+ thePopup->insertItem( tr( "MEN_RENAME_VS" ), this, SLOT( onRenameGUIState() ) );
+ thePopup->insertItem( tr( "MEN_DELETE_VS" ), this, SLOT( onDeleteGUIState() ) );
+ }
+
// "Delete reference" item should appear only for invalid references
// isInvalidRefs will be true, if at least one of selected objects is invalid reference
if (aList.Extent() != 1)
return;
Handle(SALOME_InteractiveObject) aIObj = aList.First();
+ // check if item is a "GUI state" item (also a first level object)
+ QString entry( aIObj->getEntry() );
+ if ( entry.startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) )
+ return;
QString aModuleName(aIObj->getComponentDataType());
QString aModuleTitle = moduleTitle(aModuleName);
CAM_Module* currentModule = activeModule();
/*!Update obect browser:
1.if 'updateModels' true, update existing data models;
2. update "non-existing" (not loaded yet) data models;
- 3. update object browser if it existing */
+ 3. update object browser if it exists */
void SalomeApp_Application::updateObjectBrowser( const bool updateModels )
{
// update "non-existing" (not loaded yet) data models
}
}
+ // create data objects that correspond to GUI state save points
+ if ( study ) updateSavePointDataObjects( study );
+
// update existing data models (already loaded SComponents)
LightApp_Application::updateObjectBrowser( updateModels );
-
-/* if ( objectBrowser() )
- {
- objectBrowser()->updateGeometry();
- objectBrowser()->updateTree();
- }*/
}
/*!Display Catalog Genenerator dialog */
}
}
}
+
+/*!
+ Creates new view manager
+ \param type - type of view manager
+*/
+SUIT_ViewManager* SalomeApp_Application::newViewManager(const QString& type)
+{
+ return createViewManager(type);
+}
+
+
+/*!Global utility funciton, returns selected GUI Save point object's ID */
+int getSelectedSavePoint( const LightApp_SelectionMgr* selMgr )
+{
+ SALOME_ListIO aList;
+ selMgr->selectedObjects( aList );
+ Handle(SALOME_InteractiveObject) aIObj = aList.First();
+ QString entry( aIObj->getEntry() );
+ QString startStr = QObject::tr( "SAVE_POINT_DEF_NAME" );
+ if ( !entry.startsWith( startStr ) ) // it's a "GUI state" object
+ return -1;
+ bool ok; // conversion to integer is ok?
+ int savePoint = entry.right( entry.length() - startStr.length() ).toInt( &ok );
+ return ok ? savePoint : -1;
+}
+
+/*!Called on Restore GUI State popup command*/
+void SalomeApp_Application::onRestoreGUIState()
+{
+ int savePoint = ::getSelectedSavePoint( selectionMgr() );
+ if ( savePoint == -1 )
+ return;
+ SalomeApp_VisualState( this ).restoreState( savePoint );
+}
+
+/*!Called on Rename GUI State popup command*/
+void SalomeApp_Application::onRenameGUIState()
+{
+ int savePoint = ::getSelectedSavePoint( selectionMgr() );
+ if ( savePoint == -1 )
+ return;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !study )
+ return;
+
+ QString newName = LightApp_NameDlg::getName( desktop(), study->getNameOfSavePoint( savePoint ) );
+ if ( !newName.isNull() && !newName.isEmpty() ) {
+ study->setNameOfSavePoint( savePoint, newName );
+ updateSavePointDataObjects( study );
+ objectBrowser()->updateTree( study->root() );
+ }
+}
+
+
+/*!Called on Delete GUI State popup command*/
+void SalomeApp_Application::onDeleteGUIState()
+{
+ int savePoint = ::getSelectedSavePoint( selectionMgr() );
+ if ( savePoint == -1 )
+ return;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !study )
+ return;
+
+ study->removeSavePoint( savePoint );
+ updateSavePointDataObjects( study );
+}
+
+/*!Called on Save study operation*/
+void SalomeApp_Application::onStudySaved( SUIT_Study* study )
+{
+ LightApp_Application::onStudySaved( study );
+
+ if ( objectBrowser() ) {
+ updateSavePointDataObjects( dynamic_cast<SalomeApp_Study*>( study ) );
+ objectBrowser()->updateTree( study->root() );
+ }
+}
+
+/*!Called on Open study operation*/
+void SalomeApp_Application::onStudyOpened( SUIT_Study* study )
+{
+ LightApp_Application::onStudyOpened( study );
+
+ if ( objectBrowser() ) {
+ updateSavePointDataObjects( dynamic_cast<SalomeApp_Study*>( study ) );
+ objectBrowser()->updateTree( study->root() );
+ }
+}
+
+/*! utility function. returns true if list view item that correspond to given SUIT_DataObject is open.
+ only first level items are traversed */
+bool isListViewItemOpen( QListView* lv, const SUIT_DataObject* dobj )
+{
+ if ( !lv || !dobj )
+ return false;
+
+ QListViewItem* item = lv->firstChild();
+ while ( item ) {
+ OB_ListItem* ob_item = dynamic_cast<OB_ListItem*>( item );
+ if ( ob_item && ob_item->dataObject() == dobj )
+ return ob_item->isOpen();
+ item = item->nextSibling();
+ }
+ return false;
+}
+
+/*! updateSavePointDataObjects: syncronize data objects that correspond to save points (gui states)*/
+void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study )
+{
+ OB_Browser* ob = objectBrowser();
+
+ if ( !study || !ob )
+ return;
+
+ // find GUI states root object
+ SUIT_DataObject* guiRootObj = 0;
+ DataObjectList ch;
+ study->root()->children( ch );
+ DataObjectList::const_iterator it = ch.begin(), last = ch.end();
+ for ( ; it != last ; ++it ) {
+ if ( dynamic_cast<SalomeApp_SavePointRootObject*>( *it ) ) {
+ guiRootObj = *it;
+ break;
+ }
+ }
+ std::vector<int> savePoints = study->getSavePoints();
+ // case 1: no more save points but they existed in study's tree
+ if ( savePoints.empty() && guiRootObj ) {
+ delete guiRootObj;
+ return;
+ }
+ // case 2: no more save points but root does not exist either
+ if ( savePoints.empty() && !guiRootObj )
+ return;
+ // case 3: save points but no root for them - create it
+ if ( !savePoints.empty() && !guiRootObj )
+ guiRootObj = new SalomeApp_SavePointRootObject( study->root() );
+ // case 4: everything already exists.. here may be a problem: we want "GUI states" root object
+ // to be always the last one in the tree. Here we check - if it is not the last one - remove and
+ // re-create it.
+ if ( guiRootObj->nextBrother() ) {
+ study->root()->removeChild(guiRootObj);
+ study->root()->appendChild(guiRootObj);
+ //study->root()->dump();
+ }
+
+ // store data objects in a map id-to-DataObject
+ QMap<int,SalomeApp_SavePointObject*> mapDO;
+ ch.clear();
+ guiRootObj->children( ch );
+ for( it = ch.begin(), last = ch.end(); it != last ; ++it ) {
+ SalomeApp_SavePointObject* dobj = dynamic_cast<SalomeApp_SavePointObject*>( *it );
+ if ( dobj )
+ mapDO[dobj->getId()] = dobj;
+ }
+
+ // iterate new save points. if DataObject with such ID not found in map - create DataObject
+ // if in the map - remove it from map.
+ for ( int i = 0; i < savePoints.size(); i++ )
+ if ( !mapDO.contains( savePoints[i] ) )
+ new SalomeApp_SavePointObject( guiRootObj, savePoints[i], study );
+ else
+ mapDO.remove( savePoints[i] );
+
+ // delete DataObjects that are still in the map -- their IDs were not found in data model
+ for ( QMap<int,SalomeApp_SavePointObject*>::Iterator it = mapDO.begin(); it != mapDO.end(); ++it )
+ delete it.data();
+}
+
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp_Application.h
// Created: 10/22/2004 3:37:25 PM
// Author: Sergey LITONIN
class LightApp_Preferences;
class SalomeApp_Module;
+class SalomeApp_Study;
class SALOME_LifeCycleCORBA;
#endif
/*!
- Description : Application containing SalomeApp module or LightApp module
+ \class SalomeApp_Application
+ \brief Application containing SalomeApp module or LightApp module
*/
class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
Q_OBJECT
public:
+ enum { MenuToolsId = 5 };
enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
- CatalogGenId, RegDisplayId, UserID };
+ CatalogGenId, RegDisplayId, SaveGUIStateId, UserID };
public:
SalomeApp_Application();
static SALOME_LifeCycleCORBA* lcc();
static QString defaultEngineIOR();
+ SUIT_ViewManager* newViewManager(const QString&);
+ void updateSavePointDataObjects( SalomeApp_Study* );
+
public slots:
virtual bool onOpenDoc( const QString& );
virtual void onLoadDoc();
virtual bool onLoadDoc( const QString& );
virtual void onCopy();
virtual void onPaste();
+ void onSaveGUIState();// called from VISU
+
+protected slots:
+ void onStudySaved( SUIT_Study* );
+ void onStudyOpened( SUIT_Study* );
protected:
virtual void createActions();
void onDumpStudy();
void onLoadScript();
+ void onDeleteGUIState();
+ void onRestoreGUIState();
+ void onRenameGUIState();
+
void onCatalogGen();
void onRegDisplay();
void onOpenWith();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_CheckFileDlg.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_CHECKFILEDIALOG_H
#define SALOMEAPP_CHECKFILEDIALOG_H
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp_DataModel.cxx
// Created: 10/25/2004 10:36:06 AM
// Author: Sergey LITONIN
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
-#include "SALOMEDS_Tool.hxx"
-
-//=======================================================================
-// name : SalomeApp_DataModelSync
-/*!Purpose : Auxiliary class for synchronizing tree of kernel objects and SUIT_DataObjects */
-//=======================================================================
-
typedef _PTR(SObject) kerPtr;
typedef SUIT_DataObject* suitPtr;
+/*!
+ \class SalomeApp_DataModelSync
+ Auxiliary class for synchronizing tree of kernel objects and SUIT_DataObjects
+*/
class SalomeApp_DataModelSync
{
public:
SUIT_DataObject* myRoot;
};
-
+/*!
+ Constructor
+*/
SalomeApp_DataModelSync::SalomeApp_DataModelSync( _PTR( Study ) aStudy, SUIT_DataObject* aRoot )
: myStudy( aStudy ),
myRoot( aRoot )
{
}
+/*!
+ \return true if kernel object is correct (has non empty name or is reference)
+*/
bool SalomeApp_DataModelSync::isCorrect( const kerPtr& so ) const
{
kerPtr refObj;
- QString name( so->GetName().c_str() );
+ QString name = so->GetName().c_str();
bool res = so && ( so->GetName().size() || so->ReferencedObject( refObj ) );
return res;
}
+/*!
+ Creates SUIT object by KERNEL object
+ \param so - corresponding KERNEL object
+ \param parent - parent for SUIT object
+ \param after - previous sibling for SUIT object
+ \param prepend - SUIT object must be added to start of children list
+*/
suitPtr SalomeApp_DataModelSync::createItem( const kerPtr& so,
const suitPtr& parent,
const suitPtr& after,
- const bool asFirst ) const
+ const bool prepend ) const
{
if( !isCorrect( so ) )
return 0;
else
parent->appendChild( nitem );
}
- else if( asFirst )
+ else if( prepend )
parent->insertChild( nitem, 0 );
- else
+ else // append
parent->appendChild( nitem );
else if( myRoot )
myRoot->appendChild( nitem );
return nitem;
}
+/*!
+ Deletes object with all children
+ \param p - SUIT object
+*/
void SalomeApp_DataModelSync::deleteItemWithChildren( const suitPtr& p ) const
{
if( !p )
delete p;
}
+/*!
+ \return true if objects correspond each other at all
+ \param p - kernel object
+ \param q - suit object
+*/
bool SalomeApp_DataModelSync::isEqual( const kerPtr& p, const suitPtr& q ) const
{
- LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( q );
- return ( !p && !q ) || ( obj && isCorrect( p ) && QString( p->GetID().c_str() ) == obj->entry() );
+ LightApp_ModuleObject* lobj = dynamic_cast<LightApp_ModuleObject*>( q );
+ SalomeApp_DataObject* sobj = dynamic_cast<SalomeApp_DataObject*>( q );
+ _PTR( SComponent ) aComp( p );
+ bool res = ( !p && !q ) ||
+ ( lobj && !sobj && aComp ) ||
+ ( sobj && isCorrect( p ) && p->GetID().c_str()==sobj->entry() );
+ return res;
}
+/*!
+ \return null kernel object
+*/
kerPtr SalomeApp_DataModelSync::nullSrc() const
{
return kerPtr();
}
+/*!
+ \return null suit object
+*/
suitPtr SalomeApp_DataModelSync::nullTrg() const
{
return suitPtr( 0 );
}
+/*!
+ Fills list with children of kernel object
+ \param obj - kernel object
+ \param ch - list to be filled
+*/
void SalomeApp_DataModelSync::children( const kerPtr& obj, QValueList<kerPtr>& ch ) const
{
ch.clear();
ch.append( it->Value() );
}
+/*!
+ Fills list with children of SUIT object
+ \param p - SUIT object
+ \param ch - list to be filled
+*/
void SalomeApp_DataModelSync::children( const suitPtr& p, QValueList<suitPtr>& ch ) const
{
DataObjectList l;
}
}
+/*!
+ \return parent of SUIT object
+ \param p - SUIT object
+*/
suitPtr SalomeApp_DataModelSync::parent( const suitPtr& p ) const
{
return p ? p->parent(): 0;
}
+/*!
+ Updates SUIT object
+ \param p - SUIT object
+*/
void SalomeApp_DataModelSync::updateItem( const suitPtr& ) const
{
}
+/*!
+ Auxiliary function, shows SUIT tree
+*/
void showTree( SUIT_DataObject* root )
{
qDebug( root ? "<tree>" : "<empty tree>" );
}
}
-//=======================================================================
-// name : SalomeApp_DataModel::SalomeApp_DataModel
-/*!Purpose : Constructor*/
-//=======================================================================
+/*!
+ Constructor
+*/
SalomeApp_DataModel::SalomeApp_DataModel( CAM_Module* theModule )
: LightApp_DataModel( theModule )
{
}
-//=======================================================================
-// name : SalomeApp_DataModel::~SalomeApp_DataModel
-/*! Purpose : Destructor*/
-//=======================================================================
+/*!
+ Destructor
+*/
SalomeApp_DataModel::~SalomeApp_DataModel()
{
}
-//================================================================
-// Function : open
-/*! Purpose : Open data model*/
-//================================================================
+/*!
+ Opens data model
+*/
bool SalomeApp_DataModel::open( const QString& name, CAM_Study* study, QStringList )
{
SalomeApp_Study* aDoc = dynamic_cast<SalomeApp_Study*>( study );
return true;
}
-//================================================================
-// Function : create
-/*! Purpose : Create data model*/
-//================================================================
+/*!
+ Creates data model
+*/
bool SalomeApp_DataModel::create( CAM_Study* theStudy )
{
update(NULL, (LightApp_Study*)theStudy);
return true;
}
-//================================================================
-// Function : update
-/*! Purpose : Update application.*/
-//================================================================
+/*!
+ Updates application.
+*/
void SalomeApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study )
{
SalomeApp_Study* aSStudy = dynamic_cast<SalomeApp_Study*>(study);
updateTree( sobj, aSStudy );
}
-//================================================================
-// Function : synchronize
-/*! Purpose : synchronizes kernel tree and suit data tree starting from component 'sobj' */
-//================================================================
+/*!
+ Synchronizes kernel tree and suit data tree starting from component 'sobj'
+*/
SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SComponent )& sobj, SalomeApp_Study* study )
{
if( !study || !study->root() || !sobj )
DataObjectList ch; study->root()->children( ch );
DataObjectList::const_iterator anIt = ch.begin(), aLast = ch.end();
- SalomeApp_DataObject* suitObj = 0;
+ SUIT_DataObject* suitObj = 0;
for( ; anIt!=aLast; anIt++ )
{
- SalomeApp_DataObject* dobj = dynamic_cast<SalomeApp_DataObject*>( *anIt );
- if( dobj && dobj->name()==sobj->GetName().c_str() )
+ LightApp_DataObject* dobj = dynamic_cast<LightApp_DataObject*>( *anIt );
+ if( dobj && dobj->name() == sobj->GetName().c_str() )
{
suitObj = dobj;
break;
SalomeApp_DataModelSync sync( study->studyDS(), study->root() );
- // QString srcName = sobj ? sobj->GetName().c_str() : "";
- // QString trgName = ( suitObj && !suitObj->name().isNull() ) ? suitObj->name() : "";
- // printf( "--- SalomeApp_DataModel::syncronize() calls synchronize()_1: src = %s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
- SUIT_DataObject* o = ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, suitObj, sync );
-// showTree( o );
- return o;
-}
-
-//================================================================
-// Function : synchronize
-/*! Purpose : synchronizes kernel tree and suit data tree starting from 'sobj' and 'obj' correspondly */
-//================================================================
-SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SObject )& sobj, SUIT_DataObject* obj,
- SalomeApp_Study* study )
-{
- if( !study )
+ if( !suitObj || dynamic_cast<SalomeApp_DataObject*>( suitObj ) )
+ return ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, suitObj, sync );
+ else
return 0;
- SalomeApp_DataModelSync sync( study->studyDS(), study->root() );
-
- // QString srcName = sobj ? sobj->GetName().c_str() : "";
- // QString trgName = ( obj && !obj->name().isNull() ) ? obj->name() : "";
- // printf( "--- SalomeApp_DataModel::syncronize() calls synchronize()_2: src = s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
- return ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, obj, sync );
}
-//================================================================
-// Function : updateTree
-/*! Purpose : updates tree.*/
-//================================================================
+/*!
+ Updates tree.
+*/
void SalomeApp_DataModel::updateTree( const _PTR( SComponent )& comp, SalomeApp_Study* study )
{
SalomeApp_ModuleObject* aNewRoot = dynamic_cast<SalomeApp_ModuleObject*>( synchronize( comp, study ) );
}
}
-//================================================================
-// Function : getModule
-/*! Purpose : gets module*/
-//================================================================
-
+/*!
+ \return module
+*/
SalomeApp_Module* SalomeApp_DataModel::getModule() const
{
return dynamic_cast<SalomeApp_Module*>( module() );
}
-//================================================================
-// Function : getStudy
-/*! Purpose : gets study */
-//================================================================
+/*!
+ \return study
+*/
SalomeApp_Study* SalomeApp_DataModel::getStudy() const
{
if(!root()) return 0;
return aStudy;
}
-//================================================================
-// Function : getRootEntry
-/*! Purpose : returns study entry corresponding to this data model*/
-//================================================================
+/*!
+ \return study entry corresponding to this data model
+*/
QString SalomeApp_DataModel::getRootEntry( SalomeApp_Study* study ) const
{
QString anEntry;
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp_DataModel.h
// Created: 10/25/2004 10:32:33 AM
// Author: Sergey LITONIN
public:
static SUIT_DataObject* synchronize( const _PTR( SComponent )&, SalomeApp_Study* );
- static SUIT_DataObject* synchronize( const _PTR( SObject )&, SUIT_DataObject*, SalomeApp_Study* );
- SalomeApp_DataModel ( CAM_Module* theModule );
- virtual ~SalomeApp_DataModel();
+ SalomeApp_DataModel ( CAM_Module* theModule );
+ virtual ~SalomeApp_DataModel();
virtual bool open( const QString&, CAM_Study*, QStringList );
virtual bool create( CAM_Study* );
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Study.h"
#include "LightApp_RootObject.h"
+#include <CAM_DataObject.h>
+
#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_DataObjectKey.h>
#include <SALOMEDSClient_AttributeTableOfReal.hxx>
#include <SALOMEDSClient_AttributeTableOfInteger.hxx>
-/*
- Class: SalomeApp_DataObject
- Level: Public
-*/
/*!Constructor. Initialize by \a parent*/
SalomeApp_DataObject::SalomeApp_DataObject( SUIT_DataObject* parent )
: LightApp_DataObject( parent ),
return val;
}
-/*
- Class: SalomeApp_ModuleObject
- Level: Public
-*/
+
+
+
/*!Constructor.Initialize by \a parent.*/
SalomeApp_ModuleObject::SalomeApp_ModuleObject( SUIT_DataObject* parent )
return SalomeApp_DataObject::name();
}
+
+
+
+/*!Constructor.Initialize by \a parent.*/
+SalomeApp_SavePointObject::SalomeApp_SavePointObject( SUIT_DataObject* _parent, const int id, SalomeApp_Study* study )
+ : LightApp_DataObject( _parent ), CAM_DataObject( _parent ), // IMPORTANT TO CALL ALL VIRTUAL CONSTRUCTORS!
+ myId( id ),
+ myStudy( study )
+{
+}
+
+/*!Destructor. Do nothing.*/
+SalomeApp_SavePointObject::~SalomeApp_SavePointObject()
+{
+}
+
+/*!Returns save points ID */
+int SalomeApp_SavePointObject::getId() const
+{
+ return myId;
+}
+
+/*!Returns "invalid" entry, which does not correspond to any object in data structure
+ but indicates that it is a save point object */
+QString SalomeApp_SavePointObject::entry() const
+{
+ return QObject::tr( "SAVE_POINT_DEF_NAME" ) + QString::number( myId );
+}
+
+/*!Returns displayed name of object */
+QString SalomeApp_SavePointObject::name() const
+{
+ return myStudy->getNameOfSavePoint( myId );
+}
+
+/*!Gets icon picture of object.*/
+QPixmap SalomeApp_SavePointObject::icon() const
+{
+ return QPixmap();
+}
+
+/*!Gets tooltip.*/
+QString SalomeApp_SavePointObject::toolTip() const
+{
+ return QObject::tr( "SAVE_POINT_OBJECT_TOOLTIP" ).arg( name() );
+}
+
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_DATAOBJECT_H
#define SALOMEAPP_DATAOBJECT_H
SalomeApp_ModuleObject( CAM_DataModel*, const _PTR(SObject)&, SUIT_DataObject* = 0 );
virtual ~SalomeApp_ModuleObject();
- virtual QString name() const;
+ virtual QString name() const;
+};
+
+/*!
+ * SalomeApp_SavePointObject - class that represents persistent visual_state object
+ * these objects are stored in data model, but NOT in SObjects structure, so we
+ * must handle them separately using this special class for them
+ */
+
+class SALOMEAPP_EXPORT SalomeApp_SavePointObject : public virtual LightApp_DataObject
+{
+public:
+ SalomeApp_SavePointObject( SUIT_DataObject* parent, const int, SalomeApp_Study* study );
+ virtual ~SalomeApp_SavePointObject();
+
+ virtual QString entry() const;
+
+ virtual QString name() const;
+ virtual QPixmap icon() const;
+ virtual QString toolTip() const;
+
+ int getId() const;
+
+private:
+ int myId;
+ SalomeApp_Study* myStudy;
+};
+
+/*!
+ * SalomeApp_SavePointRootObject - class that represents parent object for visual_state objects
+ */
+
+class SALOMEAPP_EXPORT SalomeApp_SavePointRootObject : public SUIT_DataObject
+{
+public:
+ SalomeApp_SavePointRootObject( SUIT_DataObject* parent ) : SUIT_DataObject( parent ) {}
+
+ virtual QString name() const { return QObject::tr( "SAVE_POINT_ROOT_NAME" ); }
+ virtual QString toolTip() const{ return QObject::tr( "SAVE_POINT_ROOT_TOOLTIP" ); }
};
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_Displayer.h"
#include <qstring.h>
+/*!
+ Default constructor
+*/
SalomeApp_Displayer::SalomeApp_Displayer()
{
}
+/*!
+ Destructor
+*/
SalomeApp_Displayer::~SalomeApp_Displayer()
{
}
+/*!
+ Displays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void SalomeApp_Displayer::Display( const QString& entry, const bool updateViewer, SALOME_View* theViewFrame )
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ Redisplays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+*/
void SalomeApp_Displayer::Redisplay( const QString& entry, const bool updateViewer )
{
// Remove the object permanently (<forced> == true)
}
}
+/*!
+ Erases object in view
+ \param entry - object entry
+ \param forced - deletes object from viewer (otherwise it will be erased, but cached)
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void SalomeApp_Displayer::Erase( const QString& entry, const bool forced,
const bool updateViewer, SALOME_View* theViewFrame )
{
}
}
+/*!
+ Erases all objects in view
+ \param forced - deletes objects from viewer
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void SalomeApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ \return true if object is displayed in viewer
+ \param entry - object entry
+ \param theViewFrame - view
+*/
bool SalomeApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
return false;
}
+/*!
+ Updates active view
+*/
void SalomeApp_Displayer::UpdateViewer() const
{
SALOME_View* vf = GetActiveView();
vf->Repaint();
}
+/*!
+ \return presentation of object, built with help of CreatePrs method
+ \param entry - object entry
+ \param theViewFrame - view
+ \sa CreatePrs()
+*/
SALOME_Prs* SalomeApp_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
{
SALOME_Prs* prs = 0;
return prs;
}
+/*!
+ \return active view
+*/
SALOME_View* SalomeApp_Displayer::GetActiveView()
{
SUIT_Session* session = SUIT_Session::session();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_DISPLAYER_HEADER
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_EventFilter.h"
qApp->removeEventFilter( this );
}
+/*!
+ Custom event filter
+*/
bool SalomeApp_EventFilter::eventFilter( QObject* o, QEvent* e )
{
if ( e->type() == SALOME_EVENT )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_EVENTFILTER_H
#define SALOMEAPP_EVENTFILTER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_ExceptionHandler.h"
+#include "CASCatch.hxx"
#include <OSD.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
-
#include <stdexcept>
#include <exception>
#include <qstring.h>
-#include <CASCatch_CatchSignals.hxx>
-#include <CASCatch_ErrorHandler.hxx>
-#include <CASCatch_Failure.hxx>
-
-
/*!Constructor. Initialize by \a floatSignal.*/
SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal )
: SUIT_ExceptionHandler()
/*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/
bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e )
{
-
- CASCatch_CatchSignals aCatchSignals;
- aCatchSignals.Activate();
-
-
CASCatch_TRY {
SUIT_ExceptionHandler::internalHandle( o, e );
}
- CASCatch_CATCH(CASCatch_Failure) {
- aCatchSignals.Deactivate();
- Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
- throw std::runtime_error( aFail->GetError() );
+ CASCatch_CATCH(Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ throw Standard_Failure( aFail->GetMessageString() );
}
- aCatchSignals.Deactivate();
return true;
}
-#ifdef try
-#undef try
-#endif
-
-#ifdef catch
-#undef catch
-#endif
-
/*!Try to call handleSignals( o, e ), catch and show error message.*/
bool SalomeApp_ExceptionHandler::handle( QObject* o, QEvent* e )
{
/*!Create new SUIT_ExceptionHandler*/
extern "C" SALOMEAPP_EXPORT SUIT_ExceptionHandler* getExceptionHandler()
{
- return new SalomeApp_ExceptionHandler( true );
+ // MSV 2006-04-26: work around PAL12004 "VTK window => SIGFPE Arithmetic Exception Detected"
+ // We disable FPE signal as it was in earlier versions of SALOME. It is enabled
+ // only in debug mode if the environment variable DISABLE_FPE is not set to 1.
+ bool raiseFPE;
+#ifdef _DEBUG_
+ raiseFPE = true;
+ char* envDisableFPE = getenv("DISABLE_FPE");
+ if (envDisableFPE && atoi(envDisableFPE))
+ raiseFPE = false;
+#else
+ raiseFPE = false;
+#endif
+ return new SalomeApp_ExceptionHandler( raiseFPE );
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_EXCEPTIONHANDLER_H
#define SALOMEAPP_EXCEPTIONHANDLER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_Filter.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_FILTER_H
#define SALOMEAPP_FILTER_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
-// SALOME SalomeApp
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SalomeApp
//
// File : SalomeApp_ListView.cxx
// Author : Vadim SANDLER
using namespace std;
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ListView class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : computeEditGeometry
-/*! Purpose : static function - used for resizing editing widget*/
-//================================================================
+/*!
+ Used for resizing editing widget
+*/
void computeEditGeometry(SalomeApp_ListViewItem* theItem,
SalomeApp_EntityEdit* theWidget)
{
theWidget->setGeometry(aX, aY, aW, aH);
}
-//================================================================
-// Function : SalomeApp_ListView::SalomeApp_ListView
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListView::SalomeApp_ListView( QWidget* parent )
: QtxListView( parent )
{
this, SLOT(onHeaderSizeChange(int, int, int)));
}
-//================================================================
-// Function : SalomeApp_ListView::~SalomeApp_ListView
-/*! Purpose : destructor*/
-//================================================================
+/*!
+ Destructor
+*/
SalomeApp_ListView::~SalomeApp_ListView()
{
if (myEdit) {
myEditedItem = 0;
}
-//================================================================
-// Function : SalomeApp_ListView::updateViewer
-/*! Purpose : updates all data viewer*/
-//================================================================
+/*!
+ Updates all data viewer
+*/
void SalomeApp_ListView::updateViewer()
{
// temporary disconnecting selection changed SIGNAL
emit selectionChanged();
}
-//================================================================
-// Function : SalomeApp_ListView::updateSelected
-/*! Purpose : updates currently selected item(s)*/
-//================================================================
+/*!
+ Updates currently selected item(s)
+*/
void SalomeApp_ListView::updateSelected()
{
// temporary disconnecting selection changed SIGNAL
emit selectionChanged();
}
-//================================================================
-// Function : SalomeApp_ListView::popupClientType
-/*! Purpose : returns popup client type*/
-//================================================================
+/*!
+ Returns popup client type
+*/
QString SalomeApp_ListView::popupClientType() const
{
return "SalomeApp_ListView";
}
-//================================================================
-// Function : SalomeApp_ListView::contextMenuPopup
-/*! Purpose : fills popup menu with items*/
-//================================================================
+/*!
+ Fills popup menu with items
+*/
void SalomeApp_ListView::contextMenuPopup( QPopupMenu* aPopup )
{
if (aPopup) {
}
}
-//================================================================
-// Function : SalomeApp_ListView::clear
-/*! Purpose : clears view*/
-//================================================================
+/*!
+ Clears view
+*/
void SalomeApp_ListView::clear()
{
if (myEdit) {
QListView::clear();
}
-//================================================================
-// Function : SalomeApp_ListView::isMouseEnabled
-/*! Purpose : returms true if mouse events are enabled*/
-//================================================================
+/*!
+ \return true if mouse events are enabled
+*/
bool SalomeApp_ListView::isMouseEnabled()
{
return myMouseEnabled;
}
-//================================================================
-// Function : SalomeApp_ListView::enableMouse
-// Purpose : enabled/disables mouse events (excluding MouseMove)
-//================================================================
+/*!
+ Enables/disables mouse events (excluding MouseMove)
+*/
void SalomeApp_ListView::enableMouse(bool enable)
{
myMouseEnabled = enable;
}
-//================================================================
-// Function : SalomeApp_ListView::eventFilter
-/*! Purpose : event filter*/
-//================================================================
+/*!
+ Event filter
+*/
bool SalomeApp_ListView::eventFilter(QObject* object, QEvent* event)
{
if (object == viewport() &&
return QListView::eventFilter(object, event);
}
-//================================================================
-// Function : SalomeApp_ListView::enableEditing
-/*! Purpose : setting editing of items availbale/not available*/
-//================================================================
+/*!
+ Setting editing of items availbale/not available
+*/
void SalomeApp_ListView::enableEditing(bool theFlag)
{
myEditingEnabled = theFlag;
}
}
-//================================================================
-// Function : SalomeApp_ListView::isEnableEditing
-/*! Purpose : says if editing is enabled*/
-//================================================================
+/*!
+ Says if editing is enabled
+*/
bool SalomeApp_ListView::isEnableEditing()
{
return myEditingEnabled;
}
-//================================================================
-// Function : SalomeApp_ListView::accept
-/*! Purpose : calls finishEditing(true)...*/
-//================================================================
+/*!
+ Calls finishEditing(true)...
+*/
void SalomeApp_ListView::accept()
{
finishEditing(true);
}
-//================================================================
-// Function : QAD_ListView::onSelectionChanged
-/*! Purpose : slot, called when selection changed in List Viewer*/
-//================================================================
+/*!
+ Slot, called when selection changed in List Viewer
+*/
void SalomeApp_ListView::onSelectionChanged()
{
if (myEdit) {
}
}
-//================================================================
-// Function : SalomeApp_ListView::resizeEvent
-/*! Purpose : called when Data Viewer is resized*/
-//================================================================
+/*!
+ Called when Data Viewer is resized
+*/
void SalomeApp_ListView::resizeEvent( QResizeEvent * e)
{
QListView::resizeEvent(e);
updateContents();
}
-//================================================================
-// Function : SalomeApp_ListView::onHeaderSizeChange
-/*! Purpose : slot, called when columns sizes are changed*/
-//================================================================
+/*!
+ Slot, called when columns sizes are changed
+*/
void SalomeApp_ListView::onHeaderSizeChange(int, int, int)
{
int aW = columnWidth(columns()-1);
setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
}
-//================================================================
-// Function : SalomeApp_ListView::viewportPaintEvent
-/*! Purpose : handler for paint event*/
-//================================================================
+/*!
+ Handler for paint event
+*/
void SalomeApp_ListView::viewportPaintEvent(QPaintEvent* e)
{
QListView::viewportPaintEvent(e);
}
}
-//================================================================
-// Function : SalomeApp_ListView::onEditOk
-/*! Purpose : called when user finishes in editing of item*/
-//================================================================
+/*!
+ Called when user finishes in editing of item
+*/
void SalomeApp_ListView::onEditOk()
{
finishEditing(true);
}
-//================================================================
-// Function : SalomeApp_ListView::onEditCancel
-/*! Purpose : called when user cancels item editing*/
-//================================================================
+/*!
+ Called when user cancels item editing
+*/
void SalomeApp_ListView::onEditCancel()
{
finishEditing(false);
}
-//================================================================
-// Function : SalomeApp_ListView::finishEditing
-/*! Purpose : finishes editing of entity*/
-//================================================================
+/*!
+ Finishes editing of entity
+*/
UpdateType SalomeApp_ListView::finishEditing(bool ok)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListView::tip
-/*! Purpose : gets current tooltip for list view
- * \retval valid rect in success
- */
-//================================================================
+/*!
+ \return current tooltip for list view
+ \retval valid rect in success
+*/
QRect SalomeApp_ListView::tip(QPoint aPos,
QString& aText,
QRect& dspRect,
return result;
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ListViewItem Class Implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent) :
QListViewItem( parent )
{
init();
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
SalomeApp_ListViewItem* after) :
QListViewItem( parent, after )
init();
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
const QString& theName,
const bool theEditable) :
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
const QString& theName,
const QString& theValue,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
const QString& theName,
const bool theEditable) :
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
const QString& theName,
const QString& theValue,
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::~SalomeApp_ListViewItem
-/*! Purpose : destructor*/
-//================================================================
+/*!
+ Destructor
+*/
SalomeApp_ListViewItem::~SalomeApp_ListViewItem()
{
}
-//================================================================
-// Function : SalomeApp_ListViewItem::init
-/*! Purpose : initialization*/
-//================================================================
+/*!
+ Initialization
+*/
void SalomeApp_ListViewItem::init()
{
myEditable = false;
myUserType = -1;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getName
-/*! Purpose : as default returns text in the first column*/
-//================================================================
+/*!
+ \return text in the first column
+*/
QString SalomeApp_ListViewItem::getName() const
{
return ( listView()->columns() > 0 ) ? text(0) : QString("");
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setName
-/*! Purpose : as default sets text in the first column*/
-//================================================================
+/*!
+ Sets text in the first column
+*/
UpdateType SalomeApp_ListViewItem::setName(const QString& theName)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getValue
-/*! Purpose : as default returns text in the second column*/
-//================================================================
+/*!
+ \return text in the second column
+*/
QString SalomeApp_ListViewItem::getValue() const
{
return ( listView()->columns() > 1 ) ? text(1) : QString("");
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setValue
-/*! Purpose : as default sets text in the second column*/
-//================================================================
+/*!
+ Sets text in the second column
+*/
UpdateType SalomeApp_ListViewItem::setValue(const QString& theValue)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::fullName
-/*! Purpose : returns full path to the entity from the root*/
-//================================================================
+/*!
+ \return full path to the entity from the root
+*/
QString SalomeApp_ListViewItem::fullName()
{
QString aFullName = getName();
return aFullName;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::openAllLevels
-/*! Purpose : expands all entities beginning from this level*/
-//================================================================
+/*!
+ expands all entities beginning from this level
+*/
void SalomeApp_ListViewItem::openAllLevels()
{
setOpen(true);
}
}
-//================================================================
-// Function : SalomeApp_ListViewItem::updateAllLevels
-/*! Purpose : update all entites beginning from this level*/
-//================================================================
+/*!
+ update all entites beginning from this level
+*/
void SalomeApp_ListViewItem::updateAllLevels()
{
SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
}
}
-//================================================================
-// Function : SalomeApp_EditBox::isEditable
-/*! Purpose : return true if entity is editable*/
-//================================================================
+/*!
+ \return true if entity is editable
+*/
bool SalomeApp_ListViewItem::isEditable() const
{
return myEditable;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setEditable
-/*! Purpose : sets editable flag fo the entity*/
-//================================================================
+/*!
+ Sets editable flag fo the entity
+*/
void SalomeApp_ListViewItem::setEditable(bool theEditable)
{
myEditable = theEditable;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::isAccepted
-/*! Purpose : returns true if entitiy is accepted after editing*/
-//================================================================
+/*!
+ \return true if entitiy is accepted after editing
+*/
bool SalomeApp_ListViewItem::isAccepted() const
{
return myAccepted;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setAccepted
-/*! Purpose : set entitiy accepted or not after editing*/
-//================================================================
+/*!
+ Sets entitiy accepted or not after editing
+*/
void SalomeApp_ListViewItem::setAccepted(bool theAccepted)
{
myAccepted = theAccepted;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getEditingType
-/*! Purpose :
- * \retval type of edit control (default is edit box)
- * \li 0 - edit box
- * \li 1 - combo box
- * \li 2 - editable combo box
- */
-//================================================================
+/*!
+ \retval type of edit control (default is edit box)
+ \li 0 - edit box
+ \li 1 - combo box
+ \li 2 - editable combo box
+*/
int SalomeApp_ListViewItem::getEditingType()
{
return myEditingType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setEditingType
-/*! Purpose :
- * \retval type of edit control (negative value means none)
- * \li 0 - edit box
- * \li 1 - combo box
- * \li 2 - editable combo box
- */
-//================================================================
+/*!
+ \retval type of edit control (negative value means none)
+ \li 0 - edit box
+ \li 1 - combo box
+ \li 2 - editable combo box
+*/
void SalomeApp_ListViewItem::setEditingType(const int type)
{
myEditingType = type;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getEditedColumn
-// Purpose :
/*! \retval edited column, default is last column
- * negative value means there are no editable columns
- */
-//================================================================
+ negative value means there are no editable columns
+*/
int SalomeApp_ListViewItem::getEditedColumn()
{
return listView()->columns()-1;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getValueType
-// Purpose :
-/*!\retval type of edited value (string, int, double)
- * default is string
- */
-//================================================================
+/*!
+ \retval type of edited value (string, int, double)
+ default is string
+*/
int SalomeApp_ListViewItem::getValueType()
{
return myValueType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setValueType
-/*! Purpose : sets type of edited value*/
-//================================================================
+/*!
+ Sets type of edited value
+*/
void SalomeApp_ListViewItem::setValueType(const int valueType)
{
myValueType = valueType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getUserType
-/*! Purpose : sets type of edited value*/
-//================================================================
+/*!
+ Sets type of edited value
+*/
int SalomeApp_ListViewItem::getUserType()
{
return myUserType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setUserType
-/*! Purpose : sets type of edited value*/
-//================================================================
+/*!
+ Sets type of edited value
+*/
void SalomeApp_ListViewItem::setUserType(const int userType)
{
myUserType = userType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getButtons
-/*! Purpose : returns buttons for editing widget (Apply (V), Cancel (X))
- * default is both buttons
- */
-//================================================================
+/*!
+ \return buttons for editing widget (Apply (V), Cancel (X))
+ default is both buttons
+*/
int SalomeApp_ListViewItem::getButtons()
{
return myButtons;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getButtons
-/*! Purpose : sets buttons for editing widget (Apply (V), Cancel (X))*/
-//================================================================
+/*!
+ Sets buttons for editing widget (Apply (V), Cancel (X))
+*/
void SalomeApp_ListViewItem::setButtons(const int buttons)
{
myButtons = buttons;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::startEditing
-/*! Purpose : creates control for editing and fills it with values*/
-//================================================================
+/*!
+ Creates control for editing and fills it with values
+*/
SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing()
{
SalomeApp_EntityEdit* aWidget = 0;
return aWidget;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::fillWidgetWithValues
-/*! Purpose : fills widget with initial values (list or single value)*/
-//================================================================
+/*!
+ Fills widget with initial values (list or single value)
+*/
void SalomeApp_ListViewItem::fillWidgetWithValues(SalomeApp_EntityEdit* theWidget)
{
int anEditColumn = getEditedColumn();
theWidget->insertItem(text(anEditColumn), true);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::finishEditing
-/*! Purpose : finishes editing of entity*/
-//================================================================
+/*!
+ Finishes editing of entity
+*/
UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::tipRect
-/*! Purpose : calculates rectangle which should contain item's tip*/
-//================================================================
+/*!
+ Calculates rectangle which should contain item's tip
+*/
QRect SalomeApp_ListViewItem::tipRect()
{
QRect aRect = QRect(-1, -1, -1, -1);
return aRect;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::tipText
-/*! Purpose : returns text for tooltip*/
-//================================================================
+/*!
+ \return text for tooltip
+*/
QString SalomeApp_ListViewItem::tipText()
{
QString aText = getName();
return aText;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::textRect
-/*! Purpose : calculates rect of item text in viewport coordinates*/
-//================================================================
+/*!
+ Calculates rect of item text in viewport coordinates
+*/
QRect SalomeApp_ListViewItem::textRect(const int column) const
{
QRect aItemRect = listView()->itemRect( this );
return theResult;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::itemRect
-/*! Purpose : calculates rect of item data in viewport coordinates*/
-//================================================================
+/*!
+ Calculates rect of item data in viewport coordinates
+*/
QRect SalomeApp_ListViewItem::itemRect(const int column) const
{
QRect aItemRect = listView()->itemRect( this );
return theResult;
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_EditBox class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : SalomeApp_EditBox::SalomeApp_EditBox
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_EditBox::SalomeApp_EditBox(QWidget* parent) :
QLineEdit(parent)
{
}
-//================================================================
-// Function : SalomeApp_EditBox::keyPressEvent
-/*! Purpose : event filter for key pressing*/
-//================================================================
+/*!
+ Event filter for key pressing
+*/
void SalomeApp_EditBox::keyPressEvent( QKeyEvent *e )
{
if ( e->key() == Key_Escape )
e->accept();
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ComboBox class implementation
-//////////////////////////////////////////////////////////////////////
-//================================================================
-// Function : SalomeApp_ComboBox::SalomeApp_ComboBox
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ComboBox::SalomeApp_ComboBox(bool rw, QWidget* parent, const char* name) :
QComboBox(rw, parent, name)
{
}
-//================================================================
-// Function : SalomeApp_ComboBox::findItem
-/*! Purpose : searches item in list and returns its index*/
-//================================================================
+/*!
+ Searches item in list and returns its index
+*/
int SalomeApp_ComboBox::findItem(const QString& theText)
{
for (int i = 0; i < count(); i++)
return -1;
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-/*! Purpose : adds item in combo box*/
-//================================================================
+/*!
+ Adds item in combo box
+*/
void SalomeApp_ComboBox::insertItem(const QString& theValue,
int theIndex)
{
QComboBox::insertItem(theValue, theIndex);
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-/*! Purpose : adds list of items in combo box*/
-//================================================================
+/*!
+ Adds list of items in combo box
+*/
void SalomeApp_ComboBox::insertList(const QStringList& theList)
{
for (unsigned i = 0; i < theList.count(); i++)
insertItem(theList[i]);
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-/*! Purpose : adds item in combo box*/
-//================================================================
+/*!
+ Adds item in combo box
+*/
void SalomeApp_ComboBox::insertItem(const int theValue)
{
int aNum;
insertItem(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-/*! Purpose : adds list of items in combo box*/
-//================================================================
+/*!
+ Adds list of items in combo box
+*/
void SalomeApp_ComboBox::insertList(const TColStd_ListOfInteger& theList)
{
for (TColStd_ListIteratorOfListOfInteger aIter(theList); aIter.More(); aIter.Next())
insertItem(aIter.Value());
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-/*! Purpose : adds item in combo box*/
-//================================================================
+/*!
+ Adds item in combo box
+*/
void SalomeApp_ComboBox::insertItem(const double theValue)
{
double aNum;
insertItem(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-/*! Purpose : adds list of items in combo box*/
-//================================================================
+/*!
+ Adds list of items in combo box
+*/
void SalomeApp_ComboBox::insertList(const TColStd_ListOfReal& theList)
{
for (TColStd_ListIteratorOfListOfReal aIter(theList); aIter.More(); aIter.Next())
insertItem(aIter.Value());
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_EntityEdit class implementation
-//////////////////////////////////////////////////////////////////////
-
#include <qlayout.h>
#define MIN_COMBO_WIDTH 1
#define MIN_EDIT_WIDTH 1
-//================================================================
-// Function : SalomeApp_EntityEdit::SalomeApp_EntityEdit
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent,
int controlType,
int valueType,
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::~SalomeApp_EntityEdit
-/*! Purpose : destructor*/
-//================================================================
+/*!
+ Destructor
+*/
SalomeApp_EntityEdit::~SalomeApp_EntityEdit()
{
}
-//================================================================
-// Function : SalomeApp_EntityEdit::clear
-/*! Purpose : clears edit/combo box*/
-//================================================================
+/*!
+ Clears edit/combo box
+*/
void SalomeApp_EntityEdit::clear()
{
if (myEdit)
myCombo->clear();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::getText
-/*! Purpose : returns current text in edit box or combo box*/
-//================================================================
+/*!
+ \return current text in edit box or combo box
+*/
QString SalomeApp_EntityEdit::getText()
{
if (myEdit)
return "";
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setText
-/*! Purpose : sets text*/
-//================================================================
+/*!
+ Sets text
+*/
void SalomeApp_EntityEdit::setText(const QString& theText)
{
myString = theText;
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-/*! Purpose : adds item in combo box,
- * sets it current if theSetCurrent is true
- */
-//================================================================
+/*!
+ Adds item in combo box, sets it current if theSetCurrent is true
+*/
void SalomeApp_EntityEdit::insertItem(const QString& theValue,
bool theSetCurrent,
int theOrder)
setText(theValue);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-/*! Purpose : adds items in combo box,
- * sets item theCurrent as current
- */
-//================================================================
+/*!
+ Adds items in combo box, sets item theCurrent as current
+*/
void SalomeApp_EntityEdit::insertList(const QStringList& theList,
const int theCurrent)
{
setText(theList[theCurrent]);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-/*! Purpose : adds item in combo box,
- * sets it current if theSetCurrent is true
- */
-//================================================================
+/*!
+ Adds item in combo box, sets it current if theSetCurrent is true
+*/
void SalomeApp_EntityEdit::insertItem(const int theValue,
bool theSetCurrent)
{
setText(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-/*! Purpose : adds items in combo box,
- * sets item theCurrent as current
- */
-//================================================================
+/*!
+ Adds items in combo box, sets item theCurrent as current
+*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList,
const int theCurrent)
{
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-// Purpose : adds item in combo box,
-// sets it current if theSetCurrent is true
-//================================================================
+/*!
+ Adds item in combo box, sets it current if theSetCurrent is true
+*/
void SalomeApp_EntityEdit::insertItem(const double theValue,
bool theSetCurrent)
{
setText(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-/*! Purpose : adds items in combo box,
- * sets item theCurrent as current
- */
-//================================================================
+/*!
+ Adds items in combo box, sets item theCurrent as current
+*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList,
const int theCurrent)
{
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::getControl
-/*! Purpose : gets actual widget*/
-//================================================================
+/*!
+ \return actual widget
+*/
QWidget* SalomeApp_EntityEdit::getControl()
{
if (myEdit)
return 0;
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setFocus
-/*! Purpose : redirect focus to corresponding widget*/
-//================================================================
+/*!
+ redirect focus to corresponding widget
+*/
void SalomeApp_EntityEdit::setFocus()
{
if (myEdit) {
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setValidator
-/*! Purpose : sets validator for the control*/
-//================================================================
+/*!
+ Sets validator for the control
+*/
void SalomeApp_EntityEdit::setValidator(const QValidator* theValidator)
{
if (myEdit)
myCombo->setValidator(theValidator);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::keyPressEvent
-/*! Purpose : event filter for KeyPress event*/
-//================================================================
+/*!
+ Event filter for KeyPress event
+*/
void SalomeApp_EntityEdit::keyPressEvent( QKeyEvent * e)
{
if ( (e->key() == Key_Enter ||
onCancel();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onComboActivated
-/*! Purpose : called when item activated in combo box*/
-//================================================================
+/*!
+ Called when item activated in combo box
+*/
void SalomeApp_EntityEdit::onComboActivated(const QString& theText)
{
onTextChanged(theText);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onTextChanged
-/*! Purpose : slot, called when text changed in line edit*/
-//================================================================
+/*!
+ Slot, called when text changed in line edit
+*/
void SalomeApp_EntityEdit::onTextChanged(const QString& theText)
{
if (myApplyBtn)
myCancelBtn->setEnabled(!(theText == myString));
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onCancel
-/*! Purpose : slot, called when user presses Cancel button*/
-//================================================================
+/*!
+ Slot, called when user presses Cancel button
+*/
void SalomeApp_EntityEdit::onCancel()
{
setText(myString);
emit escapePressed();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onApply
-/*! Purpose : slot, called when user presses Apply button*/
-//================================================================
+/*!
+ Slot, called when user presses Apply button
+*/
void SalomeApp_EntityEdit::onApply()
{
myString = getText();
emit returnPressed();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::showButtons
-/*! Purpose : shows/hides buttons*/
-//================================================================
+/*!
+ Shows/hides buttons
+*/
void SalomeApp_EntityEdit::showButtons(bool show)
{
if (myApplyBtn)
show ? myCancelBtn->show() : myCancelBtn->hide();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setDuplicatesEnabled
-/*! Purpose : enables/disables data duplication (for combo box)*/
-//================================================================
+/*!
+ Enables/disables data duplication (for combo box)
+*/
void SalomeApp_EntityEdit::setDuplicatesEnabled(bool enabled)
{
if (myCombo)
-// SALOME SalomeApp
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SalomeApp
//
// File : SalomeApp_ListView.h
// Author : Vadim SANDLER
// Module : SALOME
-// $Header$
#ifndef SALOMEAPP_LISTVIEW_H
#define SALOMEAPP_LISTVIEW_H
class SalomeApp_ListViewItem;
class SalomeApp_EntityEdit;
-//================================================================
-// Class : SalomeApp_ListView
-// Description : parent class for Data Viewer and Properties Viewer
-//================================================================
+/*!
+ \class SalomeApp_ListView
+ parent class for Data Viewer and Properties Viewer
+*/
class SalomeApp_ListView : public QtxListView , public SUIT_PopupClient {
Q_OBJECT
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp_Module.cxx
// Created: 10/25/2004 11:39:56 AM
// Author: Sergey LITONIN
#include "LightApp_Selection.h"
#include "LightApp_Operation.h"
#include "LightApp_Preferences.h"
+//#include "LightApp_Displayer.h"
#include "CAM_DataModel.h"
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_InteractiveObject.hxx>
+//#include <SALOME_Actor.h>
#include <SUIT_Session.h>
+#include <SUIT_ViewModel.h>
+
+#include <SVTK_ViewWindow.h>
+//#include <SVTK_ViewModel.h>
+//#include <SVTK_MainWindow.h>
+//#include <SVTK_RenderWindowInteractor.h>
#include <qstring.h>
#include <qmap.h>
+//#include <vtkActorCollection.h>
+//#include <vtkRenderer.h>
+
/*!Constructor.*/
SalomeApp_Module::SalomeApp_Module( const QString& name )
: LightApp_Module( name )
return LightApp_Module::createSelection();
}
+/*!
+ Converts objects-containers to list of objects, those are contained
+ Other objects must be added without conversion
+ \param source - source list of objects
+ \param dest - list of converted objects
+*/
void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_ListIO& dest ) const
{
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
dest.Append( obj );
}
}
+
+/*!
+ * \brief Virtual public
+ *
+ * This method is called just before the study document is saved, so the module has a possibility
+ * to store visual parameters in AttributeParameter attribue(s)
+ */
+void SalomeApp_Module::storeVisualParameters(int savePoint)
+{
+}
+
+/*!
+ * \brief Virtual public
+ *
+ * This method is called after the study document is opened, so the module has a possibility to restore
+ * visual parameters
+ */
+void SalomeApp_Module::restoreVisualParameters(int savePoint)
+{
+}
+
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp_Module.h
// Created: 10/25/2004 11:33:06 AM
// Author: Sergey LITONIN
#include <LightApp_Module.h>
-#include <string>
-
class CAM_DataModel;
class SalomeApp_Application;
class LightApp_Operation;
SalomeApp_Application* getApp() const;
+ virtual void storeVisualParameters(int savePoint);
+ virtual void restoreVisualParameters(int savePoint);
+
protected:
virtual CAM_DataModel* createDataModel();
virtual LightApp_Selection* createSelection() const;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
return true;
}
+/*!
+ Do nothing
+ The initialization has been done in main
+ */
void SalomeApp_PyInterp::init_python()
{
- /*
- * Do nothing
- * The initialization has been done in main
- */
MESSAGE("PyInterp_base::init_python");
ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main
SCRUTE(KERNEL_PYTHON::_gtstate);
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_Study.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Engine_i.hxx"
+#include "SalomeApp_VisualState.h"
#include "LightApp_RootObject.h"
#include <SUIT_ResourceMgr.h>
#include <qptrlist.h>
+#include <qapplication.h>
+#include <qdict.h>
#include "utilities.h"
+#include <iostream>
#include <string>
#include <vector>
+#include <SUIT_Session.h>
+
+#include <string>
+#include <vector>
+
+#include "SALOMEDS_Tool.hxx"
+
+#include "SALOMEDSClient_ClientFactory.hxx"
+#include "SALOMEDSClient_IParameters.hxx"
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
-#include "SALOMEDS_Tool.hxx"
+using namespace std;
/*!
Constructor.
emit created( this );
}
-//=======================================================================
-// name : openDocument
-/*! Purpose : Open document*/
-//=======================================================================
+/*!
+ Opens document
+ \param theFileName - name of file
+*/
bool SalomeApp_Study::openDocument( const QString& theFileName )
{
MESSAGE( "openDocument" );
emit opened( this );
study->IsSaved(true);
+
+ bool restore = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( restore ) {
+ std::vector<int> savePoints = getSavePoints();
+ if ( savePoints.size() > 0 )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).restoreState( savePoints[savePoints.size()-1] );
+ }
+
return res;
}
-//=======================================================================
-// name : loadDocument
-/*! Purpose : Connects GUI study to SALOMEDS one already loaded into StudyManager*/
-//=======================================================================
+/*!
+ Connects GUI study to SALOMEDS one already loaded into StudyManager
+ \param theStudyName - name of study
+*/
bool SalomeApp_Study::loadDocument( const QString& theStudyName )
{
MESSAGE( "loadDocument" );
bool res = CAM_Study::openDocument( theStudyName );
emit opened( this );
+ bool restore = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( restore ) {
+ std::vector<int> savePoints = getSavePoints();
+ if ( savePoints.size() > 0 )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).restoreState( savePoints[savePoints.size()-1] );
+ }
+
//SRN: BugID IPAL9021: End
return res;
}
-//=======================================================================
-// name : saveDocumentAs
-/*! Purpose : Save document*/
-//=======================================================================
+/*!
+ Saves document
+ \param theFileName - name of file
+*/
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
{
+ bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( store )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
+
ModelList list; dataModels( list );
SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
if( !resMgr )
return false;
- bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ),
- isAscii = resMgr->booleanValue( "Study", "ascii_file", false ),
- res = isAscii ?
- SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
- SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile ) &&
- CAM_Study::saveDocumentAs( theFileName ) && //SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
- saveStudyData(theFileName);
+ bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
+ bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false );
+ bool res = (isAscii ?
+ SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
+ SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile ))
+ && CAM_Study::saveDocumentAs( theFileName );
+
+ res = res && saveStudyData(theFileName);
if ( res )
emit saved( this );
return res;
}
-//=======================================================================
-// name : saveDocument
-/*! Purpose : Save document*/
-//=======================================================================
+/*!
+ Saves previously opened document
+*/
bool SalomeApp_Study::saveDocument()
{
+ bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( store )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
+
ModelList list; dataModels( list );
SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() ) {
listOfFiles.clear();
aModel->save(listOfFiles);
- if ( !listOfFiles.isEmpty() )
+ if ( !listOfFiles.isEmpty() )
saveModuleData(aModel->module()->name(), listOfFiles);
}
if( !resMgr )
return false;
- bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ),
- isAscii = resMgr->booleanValue( "Study", "ascii_file", false ),
- res = isAscii ?
- SalomeApp_Application::studyMgr()->SaveASCII( studyDS(), isMultiFile ) :
- SalomeApp_Application::studyMgr()->Save ( studyDS(), isMultiFile ) && CAM_Study::saveDocument();
+ bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
+ bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false );
+ bool res = (isAscii ?
+ SalomeApp_Application::studyMgr()->SaveASCII( studyDS(), isMultiFile ) :
+ SalomeApp_Application::studyMgr()->Save ( studyDS(), isMultiFile )) && CAM_Study::saveDocument();
res = res && saveStudyData(studyName());
if ( res )
return res;
}
-//================================================================
-// Function : closeDocument
-/*! Purpose : Close document*/
-//================================================================
+/*!
+ Closes document
+*/
void SalomeApp_Study::closeDocument(bool permanently)
{
LightApp_Study::closeDocument(permanently);
}
}
-//================================================================
-// Function : isModified
-// Purpose :
-//================================================================
+/*!
+ \return true, if study is modified in comparison with last open/save
+*/
bool SalomeApp_Study::isModified() const
{
bool isAnyChanged = studyDS() && studyDS()->IsModified();
return isAnyChanged;
}
-//================================================================
-// Function : isSaved
-/*! Purpose : Check: data model is saved?*/
-//================================================================
+/*!
+ \return if data model is saved
+*/
bool SalomeApp_Study::isSaved() const
{
bool isAllSaved = studyDS() && studyDS()->GetPersistentReference().size();
if (!isAllSaved)
- isAllSaved = LightApp_Study::isModified();
+ isAllSaved = LightApp_Study::isSaved();
return isAllSaved;
}
-//=======================================================================
-// name : saveModuleData
-/*! Purpose : save list file for module 'theModuleName' */
-//=======================================================================
+/*!
+ Saves data of module
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files to be saved
+*/
void SalomeApp_Study::saveModuleData( QString theModuleName, QStringList theListOfFiles )
{
int aNb = theListOfFiles.count();
SetListOfFiles(theModuleName, aListOfFiles);
}
-//=======================================================================
-// name : openModuleData
-/*! Purpose : gets list of file for module 'theModuleNam' */
-//=======================================================================
+/*!
+ Loads data of module
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files to be loaded
+*/
void SalomeApp_Study::openModuleData( QString theModuleName, QStringList& theListOfFiles )
{
std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName );
theListOfFiles.append(aListOfFiles[i+1].c_str());
}
-//=======================================================================
-// name : saveStudyData
-/*! Purpose : save data from study */
-//=======================================================================
+/*!
+ Saves data from study
+*/
bool SalomeApp_Study::saveStudyData( const QString& theFileName )
{
ModelList list; dataModels( list );
return true;
}
-//=======================================================================
-// name : openStudyData
-/*! Purpose : open data for study */
-//=======================================================================
+/*!
+ Loads data for study
+*/
bool SalomeApp_Study::openStudyData( const QString& theFileName )
{
return true;
}
/*!
- Create SComponent for module, using default engine (CORBAless)
+ Create SComponent for module, using default engine (CORBAless)
*/
void SalomeApp_Study::addComponent(const CAM_DataModel* dm)
{
return newName;
}
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ \return list of files used by module: to be used by CORBAless modules
+ \param theModuleName - name of module
+*/
std::vector<std::string> SalomeApp_Study::GetListOfFiles( const char* theModuleName ) const
{
SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
return aListOfFiles;
}
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ Sets list of files used by module: to be used by CORBAless modules
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files
+*/
void SalomeApp_Study::SetListOfFiles ( const char* theModuleName,
const std::vector<std::string> theListOfFiles )
{
aDefaultEngine->SetListOfFiles(theListOfFiles, id(), theModuleName);
}
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ \return temporary directory for saving files of modules
+*/
std::string SalomeApp_Study::GetTmpDir ( const char* theURL, const bool isMultiFile )
{
std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
return aTmpDir;
}
-//================================================================
-// Function : RemoveTemporaryFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ Removes temporary files
+*/
void SalomeApp_Study::RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const
{
if (isMultiFile)
}
}
-// END: methods to be used by CORBAless modules
-
+/*!
+ Deletes all references to object
+ \param obj - object
+*/
void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj )
{
_PTR(StudyBuilder) sb = studyDS()->NewBuilder();
}
}
-//================================================================
-// Function : referencedToEntry
-/*! Purpose : Return referenced entry from entry*/
-//================================================================
+/*!
+ \return real entry by entry of reference
+ \param entry - entry of reference object
+*/
QString SalomeApp_Study::referencedToEntry( const QString& entry ) const
{
_PTR(SObject) obj = studyDS()->FindObjectID( entry.latin1() );
return LightApp_Study::referencedToEntry( entry );
}
-//================================================================
-// Function : componentDataType
-/*! Purpose : Return component data type from entry*/
-//================================================================
+/*!
+ \return component data type for entry
+*/
QString SalomeApp_Study::componentDataType( const QString& entry ) const
{
_PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) );
return obj->GetFatherComponent()->ComponentDataType().c_str();
}
-//================================================================
-// Function : componentDataType
-/*! Purpose : Return component data type from entry*/
-//================================================================
+/*!
+ \return true if entry corresponds to component
+*/
bool SalomeApp_Study::isComponent( const QString& entry ) const
{
_PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) );
return obj && QString( obj->GetID().c_str() ) == obj->GetFatherComponent()->GetID().c_str();
}
-//================================================================
-// Function : children
-/*! Purpose : Return entries of children of object*/
-//================================================================
+/*!
+ \return entries of object children
+*/
void SalomeApp_Study::children( const QString& entry, QStringList& child_entries ) const
{
_PTR(SObject) SO = studyDS()->FindObjectID( entry.latin1() );
}
}
+/*!
+ Fills list with components names
+ \param comp - list to be filled
+*/
void SalomeApp_Study::components( QStringList& comps ) const
{
for( _PTR(SComponentIterator) it ( studyDS()->NewComponentIterator() ); it->More(); it->Next() )
comps.append( aComponent->ComponentDataType().c_str() );
}
}
+
+/*!
+ \return a list of saved points' IDs
+*/
+std::vector<int> SalomeApp_Study::getSavePoints()
+{
+ std::vector<int> v;
+
+ _PTR(SObject) so = studyDS()->FindComponent("Interface Applicative");
+ if(!so) return v;
+
+ _PTR(StudyBuilder) builder = studyDS()->NewBuilder();
+ _PTR(ChildIterator) anIter ( studyDS()->NewChildIterator( so ) );
+ for(; anIter->More(); anIter->Next())
+ {
+ _PTR(SObject) val( anIter->Value() );
+ _PTR(GenericAttribute) genAttr;
+ if(builder->FindAttribute(val, genAttr, "AttributeParameter")) v.push_back(val->Tag());
+ }
+
+ return v;
+}
+
+/*!
+ Removes a given save point
+*/
+void SalomeApp_Study::removeSavePoint(int savePoint)
+{
+ if(savePoint <= 0) return;
+ _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
+ _PTR(SObject) so = AP->GetSObject();
+ _PTR(StudyBuilder) builder = studyDS()->NewBuilder();
+ builder->RemoveObjectWithChildren(so);
+}
+
+/*!
+ \return a name of save point
+*/
+QString SalomeApp_Study::getNameOfSavePoint(int savePoint)
+{
+ _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
+ _PTR(IParameters) ip = ClientFactory::getIParameters(AP);
+ return ip->getProperty("AP_SAVEPOINT_NAME").c_str();
+}
+
+/*!
+ Sets a name of save point
+*/
+void SalomeApp_Study::setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint)
+{
+ _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
+ _PTR(IParameters) ip = ClientFactory::getIParameters(AP);
+ ip->setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.latin1());
+}
+
+/*!
+ \return a name of the component where visual parameters are stored
+*/
+std::string SalomeApp_Study::getVisualComponentName()
+{
+ return "Interface Applicative";
+}
+
+/*!
+ Slot: called on change of a root of a data model. Redefined from CAM_Study
+*/
+void SalomeApp_Study::updateModelRoot( const CAM_DataModel* dm )
+{
+ LightApp_Study::updateModelRoot( dm );
+
+ // calling updateSavePointDataObjects in order to set correct order of "Gui states" object
+ // it must always be the last one.
+ ((SalomeApp_Application*)application())->updateSavePointDataObjects( this );
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_STUDY_H
#define SALOMEAPP_STUDY_H
#include "SalomeApp.h"
#include <LightApp_Study.h>
+#include <string>
#ifdef WIN32
#pragma warning( disable:4251 )
virtual void children( const QString&, QStringList& ) const;
virtual void components( QStringList& ) const;
+ std::vector<int> getSavePoints();
+ void removeSavePoint(int savePoint);
+ QString getNameOfSavePoint(int savePoint);
+ void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
+ virtual std::string getVisualComponentName();
+
protected:
virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
virtual bool openDataModel( const QString&, CAM_DataModel* );
void setStudyDS(const _PTR(Study)& s );
+protected slots:
+ virtual void updateModelRoot( const CAM_DataModel* );
+
private:
QString newStudyName() const;
-// SALOME SalomeApp
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.
//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// SALOME SalomeApp
//
// File : SalomeApp_StudyPropertiesDlg.cxx
// Author : Sergey ANIKIN
-// SALOME SalomeApp
-//
-// Copyright (C) 2005 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SalomeApp_StudyPropertiesDlg.h
// Author : Sergey ANIKIN
// Module : SALOME
-// $Header$
#ifndef SALOMEAPP_STUDY_PROPERTIES_DLG_H
#define SALOMEAPP_STUDY_PROPERTIES_DLG_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_Tools.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_TOOLS_H
#define SALOMEAPP_TOOLS_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeApp_TypeFilter.h"
#include "LightApp_DataOwner.h"
#include "SalomeApp_Study.h"
-#include <SALOMEDS_SObject.hxx>
-
/*!
Constructor.
*/
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMEAPP_TYPEFILTER_H
#define SALOMEAPP_TYPEFILTER_H
<document>
- <section name="desktop" >
- <parameter name="state" value="max"/>
- <parameter name="pos_x" value="100"/>
- <parameter name="pos_y" value="050"/>
- <parameter name="width" value="640"/>
- <parameter name="height" value="480"/>
- </section>
<section name="launch">
+ <!-- SALOME launching parameters -->
<parameter name="gui" value="yes"/>
<parameter name="splash" value="yes"/>
<parameter name="file" value="no"/>
<parameter name="standalone" value="pyContainer,supervContainer"/>
</section>
<section name="language">
+ <!-- Language settings (resource manager)-->
<parameter name="language" value="en"/>
<parameter name="translators" value="%P_msg_%L.qm|%PM_msg_%L.qm|%P_icons.qm|%P_images.qm|%PM_images.qm"/>
</section>
+ <section name="splash" >
+ <!-- Splash screen settings -->
+ <parameter name="image" value="${SUITRoot}/resources/icon_about.png" />
+ <parameter name="info" value="%V" />
+ <parameter name="text_colors" value="#543AA9|#FFFFFF" />
+ <parameter name="progress_colors" value="#0A4E5F|#B2EFED|1" />
+ </section>
<section name="resources">
+ <!-- Resource directories (resource manager)-->
<parameter name="SUIT" value="${SUITRoot}/resources"/>
<parameter name="STD" value="${SUITRoot}/resources"/>
<parameter name="Plot2d" value="${SUITRoot}/resources"/>
<parameter name="OB" value="${SUITRoot}/resources"/>
<parameter name="CAM" value="${SUITRoot}/resources"/>
<parameter name="SUPERVGraph" value="${SUITRoot}/resources"/>
- <parameter name="GEOM" value="${GEOM_ROOT_DIR}/share/salome/resources"/>
- <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
- <parameter name="SMESH" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
- <parameter name="VISU" value="${VISU_ROOT_DIR}/share/salome/resources"/>
- <parameter name="SUPERV" value="${SUPERV_ROOT_DIR}/share/salome/resources"/>
- <parameter name="MED" value="${MED_ROOT_DIR}/share/salome/resources"/>
- <parameter name="StdMeshers" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
- <parameter name="COMPONENT" value="${COMPONENT_ROOT_DIR}/share/salome/resources"/>
- <parameter name="PYCALCULATOR" value="${PYCALCULATOR_ROOT_DIR}/share/salome/resources"/>
- <parameter name="HELLO" value="${HELLO_ROOT_DIR}/share/salome/resources"/>
- <parameter name="PYHELLO" value="${PYHELLO_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="ToolsGUI" value="${SUITRoot}/resources"/>
<parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources"/>
<parameter name="GHS3DPlugin" value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources"/>
- <parameter name="ToolsGUI" value="${SUITRoot}/resources"/>
- </section>
- <section name="PyConsole">
- <parameter name="font" value="Helvetic,12" />
- </section>
- <section name="Study">
- <parameter name="store_positions" value="false" />
- </section>
- <section name="GEOM">
- <parameter name="name" value="Geometry"/>
- <parameter name="icon" value="ModuleGeom.png"/>
- </section>
- <section name="LIGHT">
- <parameter name="name" value="Light"/>
- <parameter name="icon" value="LIGHT.png"/>
</section>
<section name="SMESH">
- <parameter name="name" value="Mesh"/>
- <parameter name="icon" value="ModuleMesh.png"/>
- </section>
- <section name="VISU">
- <parameter name="name" value="Post-Pro"/>
- <parameter name="icon" value="ModuleVisu.png"/>
- </section>
- <section name="SUPERV">
- <parameter name="name" value="Supervisor"/>
- <parameter name="icon" value="ModuleSupervision.png"/>
- </section>
- <section name="MED">
- <parameter name="name" value="Med"/>
- <parameter name="icon" value="ModuleMed.png"/>
- </section>
- <section name="HELLO">
- <parameter name="name" value="Hello"/>
- <parameter name="icon" value="HELLO.png"/>
- </section>
- <section name="PYHELLO">
- <parameter name="name" value="PyHello"/>
- <parameter name="icon" value="PYHELLO.png"/>
- <parameter name="library" value="SalomePyQtGUI"/>
+ <!-- Default SMESH module plugins -->
+ <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin"/>
</section>
-
-<!-- values below this line are just an example, they are not used -->
- <section name="application">
- <parameter name="QuickDirList" value=""/>
- <!-- Here go other common user preferences -->
+ <section name="desktop" >
+ <!-- Default GUI desktop state, position, size -->
+ <parameter name="state" value="normal"/>
+ <parameter name="pos_x" value="center"/>
+ <parameter name="pos_y" value="center"/>
+ <parameter name="width" value="800"/>
+ <parameter name="height" value="600"/>
</section>
<section name="ObjectBrowser" >
- <parameter value="false" name="auto_size" />
- <parameter value="true" name="auto_size_first" />
- <parameter value="true" name="visibility_column_0" />
- <parameter value="false" name="visibility_column_1" />
- <parameter value="false" name="visibility_column_2" />
- <parameter value="false" name="visibility_column_3" />
+ <!-- Object Browser preferences -->
+ <parameter name="auto_size" value="false" />
+ <parameter name="auto_size_first" value="true" />
+ <parameter name="visibility_column_0" value="true" />
+ <parameter name="visibility_column_1" value="false" />
+ <parameter name="visibility_column_2" value="false" />
+ <parameter name="visibility_column_3" value="false" />
+ </section>
+ <section name="PyConsole">
+ <!-- Python console preferences -->
+ <parameter name="font" value="Helvetic,12" />
+ <parameter name="additional_families" value="Helvetic;Helvetica;Helvetica[Adobe];Times;Times[Adobe];Sans Serif;Serif;Monospace;Lucida"/>
</section>
<section name="OCCViewer" >
- <parameter value="35, 136, 145" name="background" />
- <parameter value="1" name="iso_number_u" />
- <parameter value="1" name="iso_number_v" />
- <parameter value="100" name="trihedron_size" />
+ <!-- OCC viewer preferences -->
+ <parameter name="background" value="35, 136, 145" />
+ <parameter name="iso_number_u" value="1" />
+ <parameter name="iso_number_v" value="1" />
+ <parameter name="trihedron_size" value="100" />
</section>
<section name="VTKViewer" >
- <parameter value="0, 0, 0" name="background" />
- <parameter value="105" name="trihedron_size" />
- <parameter value="true" name="relative_size" />
+ <!-- VTK viewer preferences -->
+ <parameter name="background" value="0, 0, 0" />
+ <parameter name="trihedron_size" value="105" />
+ <parameter name="relative_size" value="true" />
</section>
- <section name="ExternalBrowser" >
- <parameter value="/usr/bin/mozilla" name="application" />
- </section>
<section name="Plot2d" >
- <parameter value="255, 255, 255" name="Background" />
- <parameter value="1" name="CurveType" />
- <parameter value="0" name="HorScaleMode" />
- <parameter value="1" name="LegendPos" />
- <parameter value="9" name="MarkerSize" />
- <parameter value="true" name="ShowLegend" />
- <parameter value="0" name="VerScaleMode" />
+ <!-- Plot2d viewer preferences -->
+ <parameter name="Background" value="255, 255, 255"/>
+ <parameter name="CurveType" value="1" />
+ <parameter name="HorScaleMode" value="0" />
+ <parameter name="LegendPos" value="1" />
+ <parameter name="MarkerSize" value="9" />
+ <parameter name="ShowLegend" value="true" />
+ <parameter name="VerScaleMode" value="0" />
</section>
<section name="SUPERVGraph" >
- <parameter value="144, 208, 211" name="Background" />
- <parameter value="63, 213, 255" name="Title" />
- <parameter value="255, 249, 147" name="NodeBody" />
- </section>
- <section name="Geometry" >
- <parameter value="10" name="SettingsGeomStep" />
- <parameter value="0" name="display_mode" />
- <parameter value="255, 255, 0" name="shading_color" />
+ <!-- Supervision viewer preferences -->
+ <parameter name="Background" value="144, 208, 211" />
+ <parameter name="Title" value="63, 213, 255" />
+ <parameter name="NodeBody" value="255, 249, 147" />
</section>
- <section name="SMESH">
- <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin"/>
- <parameter value="255, 0, 0" name="node_color" />
- <parameter value="0, 170, 255" name="fill_color" />
- <parameter value="0, 170, 255" name="outline_color" />
- <parameter value="0, 0, 255" name="backface_color" />
- <parameter value="3" name="node_size" />
- <parameter value="1" name="element_width" />
- <parameter value="75" name="shrink_coeff" />
- <parameter value="0, 255, 255" name="highlight_color" />
- <parameter value="255, 255, 0" name="selection_element_color" />
- <parameter value="255, 255, 255" name="selection_object_color" />
- <parameter value="0.005" name="selection_precision_element" />
- <parameter value="0.005" name="selection_precision_node" />
- <parameter value="5" name="selection_width" />
- <parameter value="5" name="highlight_width" />
- <parameter value="0" name="controls_precision" />
- <parameter value="0.05" name="scalar_bar_horizontal_height" />
- <parameter value="0.5" name="scalar_bar_horizontal_width" />
- <parameter value="0.01" name="scalar_bar_horizontal_x" />
- <parameter value="0.01" name="scalar_bar_horizontal_y" />
- <parameter value="255, 255, 255" name="scalar_bar_label_color" />
- <parameter value="Arial,12" name="scalar_bar_label_font" />
- <parameter value="64" name="scalar_bar_num_colors" />
- <parameter value="5" name="scalar_bar_num_labels" />
- <parameter value="0" name="scalar_bar_orientation" />
- <parameter value="255, 255, 255" name="scalar_bar_title_color" />
- <parameter value="Arial,12" name="scalar_bar_title_font" />
- <parameter value="0.5" name="scalar_bar_vertical_height" />
- <parameter value="0.05" name="scalar_bar_vertical_width" />
- <parameter value="0.01" name="scalar_bar_vertical_x" />
- <parameter value="0.01" name="scalar_bar_vertical_y" />
- <parameter value="true" name="DisplayMode" />
- <parameter value="true" name="auto_update" />
- <parameter value="1" name="display_mode" />
- <parameter value="false" name="auto_groups" />
+ <section name="FileDlg" >
+ <!-- "Open/Save File" dialog box preferences-->
+ <parameter name="QuickDirList" value="${DATA_DIR}" />
</section>
- <section name="VISU" >
- <parameter value="false" name="full_med_loading" />
- <parameter value="false" name="represent_shading" />
- <parameter value="0.05" name="scalar_bar_horizontal_height" />
- <parameter value="0.5" name="scalar_bar_horizontal_width" />
- <parameter value="0.01" name="scalar_bar_horizontal_x" />
- <parameter value="0.01" name="scalar_bar_horizontal_y" />
- <parameter value="255, 255, 255" name="scalar_bar_label_color" />
- <parameter value="Arial,Bold,Italic,Underline,12" name="scalar_bar_label_font" />
- <parameter value="false" name="scalar_bar_logarithmic" />
- <parameter value="0" name="scalar_bar_mode" />
- <parameter value="64" name="scalar_bar_num_colors" />
- <parameter value="5" name="scalar_bar_num_labels" />
- <parameter value="0" name="scalar_bar_orientation" />
- <parameter value="255, 255, 255" name="scalar_bar_title_color" />
- <parameter value="Arial,Bold,Italic,Underline,12" name="scalar_bar_title_font" />
- <parameter value="0.5" name="scalar_bar_vertical_height" />
- <parameter value="0.05" name="scalar_bar_vertical_width" />
- <parameter value="0.01" name="scalar_bar_vertical_x" />
- <parameter value="0.01" name="scalar_bar_vertical_y" />
- <parameter value="0" name="scalar_range_max" />
- <parameter value="0" name="scalar_range_min" />
- <parameter value="0" name="scalar_range_type" />
- <parameter value="1" name="sweeping_number_cycles" />
- <parameter value="20" name="sweeping_number_steps" />
- <parameter value="0.2" name="sweeping_time_step" />
- <parameter value="0" name="mouse_behaviour" />
- <parameter value="10" name="speed_increment" />
- <parameter value="1" name="spacemouse_func1_btn" />
- <parameter value="2" name="spacemouse_func2_btn" />
- <parameter value="10" name="spacemouse_func3_btn" />
- <parameter value="11" name="spacemouse_func4_btn" />
- <parameter value="9" name="spacemouse_func5_btn" />
- <parameter value="10" name="camera_movement_steps" />
- <parameter value="true" name="point_sprite_results" />
- <parameter value="0" name="point_sprite_primitive_type" />
- <parameter value="256" name="point_sprite_clamp" />
- <parameter value="${VISU_ROOT_DIR}/share/salome/resources/sprite_texture.bmp" name="point_sprite_main_texture"/>
- <parameter value="${VISU_ROOT_DIR}/share/salome/resources/sprite_alpha.bmp" name="point_sprite_alpha_texture"/>
- <parameter value="0.5" name="point_sprite_alpha_threshold" />
- <parameter value="10" name="point_sprite_min_size" />
- <parameter value="33" name="point_sprite_max_size" />
- <parameter value="100" name="point_sprite_magnification" />
- <parameter value="2" name="point_sprite_increment" />
- <parameter value="15" name="point_sprite_size" />
- <parameter value="0, 0, 255" name="point_sprite_color" />
- <parameter value="8" name="geom_sphere_resolution" />
- <parameter value="50000" name="geom_sphere_face_limit" />
- <parameter value="true" name="scalar_bar_display_global" />
- <parameter value="0" name="scalar_bar_active_local" />
- <parameter value="1" name="scalar_bar_bicolor" />
- <parameter value="0.01" name="scalar_bar_spacing" />
- <parameter value="0" name="inside_point_sprite_primitive_type" />
- <parameter value="256" name="inside_point_sprite_clamp" />
- <parameter value="${VISU_ROOT_DIR}/share/salome/resources/sprite_texture.bmp" name="inside_point_sprite_main_texture"/>
- <parameter value="${VISU_ROOT_DIR}/share/salome/resources/sprite_alpha.bmp" name="inside_point_sprite_alpha_texture"/>
- <parameter value="0.5" name="inside_point_sprite_alpha_threshold" />
- <parameter value="10" name="inside_point_sprite_min_size" />
- <parameter value="33" name="inside_point_sprite_max_size" />
- <parameter value="100" name="inside_point_sprite_magnification" />
- <parameter value="2" name="inside_point_sprite_increment" />
- <parameter value="8" name="inside_geom_sphere_resolution" />
- <parameter value="50000" name="inside_geom_sphere_face_limit" />
- <parameter value="0" name="outside_point_sprite_primitive_type" />
- <parameter value="256" name="outside_point_sprite_clamp" />
- <parameter value="${VISU_ROOT_DIR}/share/salome/resources/sprite_texture.bmp" name="outside_point_sprite_main_texture"/>
- <parameter value="${VISU_ROOT_DIR}/share/salome/resources/sprite_alpha.bmp" name="outside_point_sprite_alpha_texture"/>
- <parameter value="0.5" name="outside_point_sprite_alpha_threshold" />
- <parameter value="25" name="outside_point_sprite_size" />
- <parameter value="true" name="outside_point_sprite_uniform" />
- <parameter value="85, 0, 127" name="outside_point_sprite_color" />
- <parameter value="8" name="outside_geom_sphere_resolution" />
- <parameter value="50000" name="outside_geom_sphere_face_limit" />
- <parameter value="0.5" name="picking_cursor_size" />
- <parameter value="1.0" name="picking_pyramid_height" />
- <parameter value="255, 255, 0" name="picking_selection_color" />
- <parameter value="0.01" name="picking_point_tolerance" />
- <parameter value="50" name="picking_transparency" />
- <parameter value="0" name="picking_position" />
- <parameter value="1.5" name="picking_zoom_factor" />
- <parameter value="10" name="picking_step_number" />
- <parameter value="false" name="picking_display_parent_mesh" />
- <parameter value="false" name="build_at_once" />
- <parameter value="true" name="build_fields" />
- <parameter value="true" name="build_min_max" />
- <parameter value="true" name="build_groups" />
- <parameter value="true" name="close_at_finish" />
- <parameter value="1" name="recorder_mode" />
- <parameter value="17.3" name="recorder_fps" />
- <parameter value="100" name="recorder_quality" />
- <parameter value="true" name="recorder_progressive" />
+ <section name="Study">
+ <!-- General study settings -->
+ <parameter name="store_positions" value="false" />
+ <parameter name="store_visual_state" value="false" />
</section>
- <!-- Here go optional sections for other modules -->
- <section name="resources">
- <parameter name="salome" value="${KERNEL_ROOT_DIR}/share/salome/res"/>
- <!-- Here go resource directories for other modules -->
+ <section name="ExternalBrowser" >
+ <!-- External HELP browser settings -->
+ <parameter value="/usr/bin/mozilla" name="application" />
</section>
</document>
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: SalomeApp_images.po
// Created: November, 2004
// Author: OCC team
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File: CATHAREGUI_msg_en.po
// Created: 10/25/2004 12:46:36 PM
// Author: Sergey LITONIN
//=======================================================================================
-msgid "BUT_OK"
-msgstr "&OK"
-
msgid "BUT_NEW"
msgstr "&New"
msgid "BUT_LOAD"
msgstr "&Load"
-msgid "BUT_CANCEL"
-msgstr "&Cancel"
-
//=======================================================================================
msgid "SalomeApp_Application::PYTHON_CONSOLE"
msgid "SalomeApp_Application::PRP_DESK_FILE_DUMP_STUDY"
msgstr "Dumps study to the python script"
+msgid "SalomeApp_Application::TOT_DESK_FILE_SAVE_GUI_STATE"
+msgstr "Save GUI state"
+
+msgid "SalomeApp_Application::MEN_DESK_FILE_SAVE_GUI_STATE"
+msgstr "Save GUI state"
+
+msgid "SalomeApp_Application::PRP_DESK_FILE_SAVE_GUI_STATE"
+msgstr "Saves current state of viewers, displayed objects, etc."
+
msgid "SalomeApp_Application::TOT_DESK_FILE_LOAD_SCRIPT"
msgstr "Load python script"
msgid "SalomeApp_Application::MEN_DELETE_INVALID_REFERENCE"
msgstr "Delete Invalid Reference"
+msgid "SalomeApp_Application::PREF_STORE_VISUAL_STATE"
+msgstr "Store/restore last GUI state"
+
+//=======================================================================================
+
+msgid "PUBLISH_IN_STUDY"
+msgstr "Publish in study"
+
+msgid "SAVE_GUI_STATE"
+msgstr "Save GUI state"
+
//=======================================================================================
msgid "SalomeApp_Application::MEN_WINDOWS_NEW"
msgid "SalomeApp_Application::WRN_DUMP_STUDY_FAILED"
msgstr "Dump study failed"
+msgid "SAVE_POINT_OBJECT_TOOLTIP"
+msgstr "Saved GUI state: %1"
+
+msgid "SAVE_POINT_DEF_NAME"
+msgstr "GUI state: "
+
+msgid "SAVE_POINT_ROOT_TOOLTIP"
+msgstr "Persistent GUI states"
+
+msgid "SAVE_POINT_ROOT_NAME"
+msgstr "GUI states"
+
+//=======================================================================================
+
+msgid "SalomeApp_Application::MEN_RESTORE_VS"
+msgstr "Restore"
+
+msgid "SalomeApp_Application::MEN_RENAME_VS"
+msgstr "Rename"
+
+msgid "SalomeApp_Application::MEN_DELETE_VS"
+msgstr "Delete"
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : InquireServersQThread.cxx
// Author : Vasily RUSYAEV
#define MARGIN_SIZE 5
#define SPACING_SIZE 3
+/*!
+ Constructor
+*/
InquireServersGUI::InquireServersGUI()
: QVBox(0, "SFA splash", Qt::WDestructiveClose | Qt::WStyle_Customize | Qt::WStyle_NoBorder | WType_TopLevel | WStyle_StaysOnTop | WX11BypassWM )
{
myThread->start();
}
+/*!
+ Sets pixmap of splash screen
+ \param pix - new pixmap
+*/
void InquireServersGUI::setPixmap( QPixmap pix )
{
if ( !pix.isNull() )
}
}
+/*!
+ Destructor
+*/
InquireServersGUI::~InquireServersGUI()
{
delete myThread;
}
+/*!
+ Gets parameters from qApp
+ \param _argc - variable to return number of arguments
+ \param _argv - variable to return array of arguments
+*/
void InquireServersGUI::getArgs( int& _argc, char *** _argv)
{
_argc = qApp->argc();
*_argv = qApp->argv();
}
-//=================================================================================
-// function : ClickOnCancel()
-// purpose : cancel loading of SALOME
-//=================================================================================
+/*!
+ Cancel loading of SALOME
+*/
void InquireServersGUI::ClickOnCancel()
{
myThread->stop(); //it's necessary to stop asking servers
qApp->exit( 1 );
}
+/*!
+ Custom event filter
+*/
void InquireServersGUI::customEvent( QCustomEvent* pe )
{
switch( pe->type() )
}
}
+/*!
+ \return status of thread exit
+*/
int InquireServersGUI::getExitStatus()
{
return myThread->getExitStatus();
}
+/*!
+ Constructor
+*/
InquireServersQThread::InquireServersQThread( InquireServersGUI* r )
: receiver(r), myExitStatus(0)
{
}
}
+/*!
+ The main loop of this thread
+*/
void InquireServersQThread::run()
{
while ( IsChecking && receiver )
qApp->exit( myExitStatus );
}
+/*!
+ Stops this thread
+*/
void InquireServersQThread::stop()
{
IsChecking = false;
myExitStatus = 1;
}
+/*!
+ Destructor
+*/
InquireServersQThread::~InquireServersQThread()
{
}
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : InquireServersQThread.h
// Author : Vasily RUSYAEV
// Module : SALOME
-// $Header$
#include <qthread.h>
#include <qvbox.h>
#include <SALOME_Session.hxx>
-/**********************************************************
-** Class: InquireEvent
-** Descr: Contains QCustomEvents for posting to InquireServersQThread
-** Level: Private
-***********************************************************/
+/*!
+ \class InquireEvent
+ Contains QCustomEvents for posting to InquireServersQThread
+*/
class SESSION_EXPORT InquireEvent : public QCustomEvent
{
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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
EXPORT_HEADERS= Session_Session_i.hxx \
Session_ServerLauncher.hxx \
Session_ServerThread.hxx \
+ Session_ServerCheck.hxx \
SalomeApp_Engine_i.hxx
# Libraries targets
LIB_SRC=Session_Session_i.cxx \
Session_ServerThread.cxx \
Session_ServerLauncher.cxx \
- Session_SignalsHandler.cxx \
+ Session_ServerCheck.cxx \
SalomeApp_Engine_i.cxx \
- InquireServersQThread.cxx
-LIB_MOC = InquireServersQThread.h
+LIB_MOC =
# Executables targets
BIN = SALOME_Session_Server
BIN_SERVER_IDL =
BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl SALOME_GenericObj.idl
-CPPFLAGS += $(QT_MT_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(OCC_INCLUDES)
+CPPFLAGS += $(QT_MT_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) $(KERNEL_CXXFLAGS) -I$(OCC_INCLUDES)
CXXFLAGS += $(OCC_CXXFLAGS) $(BOOST_CPPFLAGS)
-LDFLAGS += $(QT_MT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeNS -lsuit -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lwith_loggerTraceCollector -lEvent -lCASCatch -lSalomeCatalog -lSalomeDS $(CAS_KERNEL)
+LDFLAGS += $(QT_MT_LIBS) $(KERNEL_LDFLAGS) -lSalomeNS -lsuit -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lwith_loggerTraceCollector -lEvent -lSalomeCatalog -lSalomeDSClient $(CAS_KERNEL)
LDFLAGSFORBIN= $(LDFLAGS) $(OMNIORB_LIBS) $(HDF5_LIBS) -lqtx -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS -lSalomeHDFPersist -lSalomeDSImpl -lSalomeGenericObj -lRegistry -lSalomeNotification -lSALOMEBasics
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SALOME_NamingService.hxx"
#include "SALOMETraceCollector.hxx"
-#include "InquireServersQThread.h" // splash
-
#include <iostream>
#ifndef WNT
#include <unistd.h>
#include <qfile.h>
#include <qapplication.h>
#include <qwaitcondition.h>
+#include <qregexp.h>
#include "Utils_SALOME_Exception.hxx"
#include "Utils_CorbaException.hxx"
#include <utilities.h>
#include "Session_Session_i.hxx"
#include "Session_ServerLauncher.hxx"
+#include "Session_ServerCheck.hxx"
+#include <QtxSplash.h>
#include "SUIT_Tools.h"
#include "SUIT_Session.h"
#include "SUIT_Application.h"
+#include "SUIT_Desktop.h"
#include "SUIT_MessageBox.h"
#include "SUIT_ResourceMgr.h"
-
#include "SUIT_ExceptionHandler.h"
-extern "C" int HandleSignals( QApplication *theQApplication );
-
/*! - read arguments, define list of server to launch with their arguments.
* - wait for naming service
* - create and run a thread for launch of all servers
QString version() const { return myExtAppVersion; }
protected:
- QString userFileName( const QString& appName ) const
+ QString userFileName( const QString& appName, const bool for_load ) const
{
if ( version().isNull() ) return "";
- return SUIT_ResourceMgr::userFileName( myExtAppName );
+ return SUIT_ResourceMgr::userFileName( myExtAppName, for_load );
+ }
+
+ virtual int userFileId( const QString& _fname ) const
+ {
+ QRegExp exp( "\\.SalomeApprc\\.([a-zA-Z0-9.]+)$" );
+ QRegExp vers_exp( "^([0-9]+)([A-Za-z]?)([0-9]*)$" );
+
+ QString fname = QFileInfo( _fname ).fileName();
+ if( exp.exactMatch( fname ) )
+ {
+ QStringList vers = QStringList::split( ".", exp.cap( 1 ) );
+ int major=0, minor=0;
+ major = vers[0].toInt();
+ minor = vers[1].toInt();
+ if( vers_exp.search( vers[2] )==-1 )
+ return -1;
+ int release = 0, dev1 = 0, dev2 = 0;
+ release = vers_exp.cap( 1 ).toInt();
+ dev1 = vers_exp.cap( 2 )[ 0 ].latin1();
+ dev2 = vers_exp.cap( 3 ).toInt();
+
+ int dev = dev1*100+dev2, id = major;
+ id*=100; id+=minor;
+ id*=100; id+=release;
+ id*=10000; id+=dev;
+ return id;
+ }
+
+ return -1;
}
public:
class GetInterfaceThread : public QThread
{
public:
- GetInterfaceThread( SALOME::Session_var s ) : session ( s ) {}
+ GetInterfaceThread( SALOME::Session_var s ) : session ( s )
+ {
+ start();
+ }
protected:
virtual void run()
{
// ---------------------------- MAIN -----------------------
int main( int argc, char **argv )
{
+ // Install Qt debug messages handler
qInstallMsgHandler( MessageOutput );
-
- // QApplication should be create before all other operations
- // When uses QApplication::libraryPaths() ( example, QFile::encodeName() )
- // qApp used for detection of the executable dir path.
+
+ // Create Qt application instance;
+ // this should be done the very first!
SALOME_QApplication _qappl( argc, argv );
ASSERT( QObject::connect( &_qappl, SIGNAL( lastWindowClosed() ), &_qappl, SLOT( quit() ) ) );
+ // Add application library path (to search style plugin etc...)
QString path = QDir::convertSeparators( SUIT_Tools::addSlash( QString( ::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) );
_qappl.addLibraryPath( path );
+ // Set SALOME style to the application
_qappl.setStyle( "salome" );
+ bool isGUI = isFound( "GUI", argc, argv );
+ bool isSplash = isFound( "SPLASH", argc, argv );
+ // Show splash screen (only if both the "GUI" and "SPLASH" parameters are set)
+ QtxSplash* splash = 0;
+ if ( isGUI && isSplash ) {
+ // ...create resource manager
+ SUIT_ResourceMgr resMgr( "SalomeApp", QString( "%1Config" ) );
+ resMgr.setCurrentFormat( "xml" );
+ resMgr.loadLanguage( "LightApp", "en" );
+ // ...get splash preferences
+ QString splashIcon, splashInfo, splashTextColors, splashProgressColors;
+ resMgr.value( "splash", "image", splashIcon );
+ resMgr.value( "splash", "info", splashInfo, false );
+ resMgr.value( "splash", "text_colors", splashTextColors );
+ resMgr.value( "splash", "progress_colors", splashProgressColors );
+ QPixmap px( splashIcon );
+ if ( px.isNull() ) // try to get splash pixmap from resources
+ px = resMgr.loadPixmap( "LightApp", QObject::tr( "ABOUT_SPLASH" ) );
+ if ( !px.isNull() ) {
+ // ...set splash pixmap
+ splash = QtxSplash::splash( px );
+ // ...set splash text colors
+ if ( !splashTextColors.isEmpty() ) {
+ QStringList colors = QStringList::split( "|", splashTextColors );
+ QColor c1, c2;
+ if ( colors.count() > 0 ) c1 = QColor( colors[0] );
+ if ( colors.count() > 1 ) c2 = QColor( colors[1] );
+ splash->setTextColors( c1, c2 );
+ }
+ else {
+ splash->setTextColors( Qt::white, Qt::black );
+ }
+ // ...set splash progress colors
+ if ( !splashProgressColors.isEmpty() ) {
+ QStringList colors = QStringList::split( "|", splashProgressColors );
+ QColor c1, c2;
+ int gradType = QtxSplash::Vertical;
+ if ( colors.count() > 0 ) c1 = QColor( colors[0] );
+ if ( colors.count() > 1 ) c2 = QColor( colors[1] );
+ if ( colors.count() > 2 ) gradType = colors[2].toInt();
+ splash->setProgressColors( c1, c2, gradType );
+ }
+ // ...set splash text font
+ QFont f = splash->font();
+ f.setBold( true );
+ splash->setFont( f );
+ // ...show splash initial status
+ if ( !splashInfo.isEmpty() ) {
+ splashInfo.replace( QRegExp( "%A" ), QObject::tr( "APP_NAME" ) );
+ splashInfo.replace( QRegExp( "%V" ), QObject::tr( "ABOUT_VERSION" ).arg( salomeVersion() ) );
+ splashInfo.replace( QRegExp( "%L" ), QObject::tr( "ABOUT_LICENSE" ) );
+ splashInfo.replace( QRegExp( "%C" ), QObject::tr( "ABOUT_COPYRIGHT" ) );
+ splashInfo.replace( QRegExp( "\\\\n" ), "\n" );
+ splash->message( splashInfo );
+ }
+ // ...set 'hide on click' flag
+#ifdef _DEBUG_
+ splash->setHideOnClick( true );
+#endif
+ // ...show splash
+ splash->show();
+ qApp->processEvents();
+ }
+ }
+
+ // Initialization
int result = -1;
CORBA::ORB_var orb;
Session_ServerLauncher* myServerLauncher = 0;
try {
-
- // Python initialisation : only once
-
- int _argc = 1;
+ // ...initialize Python (only once)
+ int _argc = 1;
char* _argv[] = {""};
KERNEL_PYTHON::init_python( _argc,_argv );
PyEval_RestoreThread( KERNEL_PYTHON::_gtstate );
if ( !KERNEL_PYTHON::salome_shared_modules_module ) // import only once
KERNEL_PYTHON::salome_shared_modules_module = PyImport_ImportModule( "salome_shared_modules" );
- if ( !KERNEL_PYTHON::salome_shared_modules_module )
- {
+ if ( !KERNEL_PYTHON::salome_shared_modules_module ) {
INFOS( "salome_shared_modules_module == NULL" );
PyErr_Print();
}
PyEval_ReleaseThread( KERNEL_PYTHON::_gtstate );
- // Create ORB, get RootPOA object, NamingService, etc.
+ // ...create ORB, get RootPOA object, NamingService, etc.
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
ASSERT( SINGLETON_<ORB_INIT>::IsAlreadyExisting() );
int orbArgc = 1;
orb = init( orbArgc, argv );
- // Install SALOME thread event handler
+ // ...install SALOME thread event handler
SALOME_Event::GetSessionThread();
CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" );
INFOS( "Caught unknown exception." );
}
- // CORBA Servant Launcher
- QMutex _GUIMutex;
- QWaitCondition _ServerLaunch, _SessionStarted;
-
- if ( !result )
- {
- _GUIMutex.lock(); // to block Launch server thread until wait( mutex )
-
- // Activate embedded CORBA servers: Registry, SALOMEDS, etc.
- myServerLauncher = new Session_ServerLauncher( argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch, &_SessionStarted );
- myServerLauncher->start();
-
- _ServerLaunch.wait( &_GUIMutex ); // to be reseased by Launch server thread when ready:
+ QMutex _GUIMutex, _SessionMutex, _SplashMutex;
+ QWaitCondition _ServerLaunch, _SessionStarted, _SplashStarted;
+
+ // lock session mutex to ensure that GetInterface is not called
+ // until all initialization is done
+ _SessionMutex.lock();
+
+ if ( !result ) {
+ // Start embedded servers launcher (Registry, SALOMEDS, etc.)
+ // ...lock mutex to block embedded servers launching thread until wait( mutex )
+ _GUIMutex.lock();
+ // ...create launcher
+ myServerLauncher = new Session_ServerLauncher( argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch, &_SessionMutex, &_SessionStarted );
+ // ...block this thread until launcher is ready
+ _ServerLaunch.wait( &_GUIMutex );
- // show splash screen if "SPLASH" parameter was passed ( default )
- if ( isFound( "SPLASH", argc, argv ) )
- {
- // create temporary resource manager just to load splash icon
- SUIT_ResourceMgr resMgr( "SalomeApp", QString( "%1Config" ) );
- resMgr.setCurrentFormat( "xml" );
- resMgr.loadLanguage( "LightApp", "en" );
-
- // create splash object: widget ( splash with progress bar ) and "pinging" thread
- InquireServersGUI splash;
- splash.setPixmap( resMgr.loadPixmap( "LightApp", QObject::tr( "ABOUT_SPLASH" ) ) );
- SUIT_Tools::centerWidget( &splash, _qappl.desktop() );
-
- _qappl.setMainWidget( &splash );
- QObject::connect( &_qappl, SIGNAL( lastWindowClosed() ), &_qappl, SLOT( quit() ) );
- splash.show(); // display splash with running progress bar
- _qappl.exec(); // wait untill splash closes ( progress runs till end or Cancel is pressed )
-
- result = splash.getExitStatus(); // 1 is error
+ // Start servers check thread (splash)
+ if ( splash ) {
+ // ...lock mutex to block splash thread until wait( mutex )
+ _SplashMutex.lock();
+ // ...create servers checking thread
+ Session_ServerCheck sc( &_SplashMutex, &_SplashStarted );
+ // ...block this thread until servers checking is finished
+ _SplashStarted.wait( &_SplashMutex );
+ // ...unlock mutex 'cause it is no more needed
+ _SplashMutex.unlock();
+ // get servers checking thread status
+ result = splash->error();
+ QString info = splash->message().isEmpty() ? "%1" : QString( "%1\n%2" ).arg( splash->message() );
+ splash->setStatus( info.arg( "Activating desktop..." ) );
}
- else
- _SessionStarted.wait();
- }
- // call Session::GetInterface() if "GUI" parameter was passed ( default )
- if ( !result && isFound( "GUI", argc, argv ) )
- {
- CORBA::Object_var obj = _NS->Resolve( "/Kernel/Session" );
- SALOME::Session_var session = SALOME::Session::_narrow( obj ) ;
- ASSERT ( ! CORBA::is_nil( session ) );
-
- INFOS( "Session activated, Launch IAPP..." );
- guiThread = new GetInterfaceThread( session );
- guiThread->start();
+ // Finalize embedded servers launcher
+ // ...block this thread until launcher is finished
+ _ServerLaunch.wait( &_GUIMutex );
+ // ...unlock mutex 'cause it is no more needed
+ _GUIMutex.unlock();
}
- if ( !result )
- {
+ if ( !result ) {
+ // Launch GUI activator
+ if ( isGUI ) {
+ // ...retrieve Session interface reference
+ CORBA::Object_var obj = _NS->Resolve( "/Kernel/Session" );
+ SALOME::Session_var session = SALOME::Session::_narrow( obj ) ;
+ ASSERT ( ! CORBA::is_nil( session ) );
+ // ...create GUI launcher
+ INFOS( "Session activated, Launch IAPP..." );
+ guiThread = new GetInterfaceThread( session );
+ }
// GUI activation
// Allow multiple activation/deactivation of GUI
- while ( true )
- {
+ while ( true ) {
MESSAGE( "waiting wakeAll()" );
- _ServerLaunch.wait( &_GUIMutex ); // to be reseased by Launch server thread when ready:
+ _SessionStarted.wait( &_SessionMutex ); // to be reseased by Launch server thread when ready:
// atomic operation lock - unlock on mutex
// unlock mutex: serverThread runs, calls _ServerLaunch->wakeAll()
// this thread wakes up, and lock mutex
- _GUIMutex.unlock();
+ _SessionMutex.unlock();
// SUIT_Session creation
aGUISession = new SALOME_Session();
// aGUISession contains SalomeApp_ExceptionHandler
// Run GUI loop
MESSAGE( "run(): starting the main event loop" );
+
+ if ( splash )
+ splash->finish( aGUIApp->desktop() );
+
result = _qappl.exec();
+
+ if ( splash )
+ delete splash;
+ splash = 0;
if ( result == SUIT_Session::FROM_GUI ) // desktop is closed by user from GUI
break;
aGUISession = 0;
// Prepare _GUIMutex for a new GUI activation
- _GUIMutex.lock();
+ _SessionMutex.lock();
}
}
+ // unlock Session mutex
+ _SessionMutex.unlock();
+
if ( myServerLauncher )
myServerLauncher->KillAll(); // kill embedded servers
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
SalomeApp_Engine_i* SalomeApp_Engine_i::myInstance = NULL;
+/*!
+ Constructor
+*/
SalomeApp_Engine_i::SalomeApp_Engine_i()
{
myInstance = this;
}
+/*!
+ Destructor
+*/
SalomeApp_Engine_i::~SalomeApp_Engine_i()
{
}
mapOfListOfFiles[componentName] = theListOfFiles;
}
+/*!
+ \return shared instance of engine
+*/
SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance()
{
return myInstance;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#if !defined(SESSION_SERVERCHECK_HXX)
#define SESSION_SERVERCHECK_HXX
-#ifdef WNT
-#include <SALOME_WNT.hxx>
-#else
-#define SALOME_WNT_EXPORT
-#endif
+#include <SALOME_Session.hxx>
#include <qthread.h>
#include <qapplication.h>
/*!
Class Session_ServerCheck : check SALOME servers
*/
-class SALOME_WNT_EXPORT Session_ServerCheck : public QThread
+class SESSION_EXPORT Session_ServerCheck : public QThread
{
public:
// constructor
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
using namespace std;
-//=============================================================================
/*!
- * default constructor not for use
+ default constructor not for use
*/
-//=============================================================================
-
Session_ServerLauncher::Session_ServerLauncher()
{
ASSERT(0); // must not be called
}
-//=============================================================================
/*!
- * constructor
- */
-//=============================================================================
-
+ constructor
+*/
Session_ServerLauncher::Session_ServerLauncher(int argc,
char ** argv,
CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
QMutex *GUIMutex,
QWaitCondition *ServerLaunch,
+ QMutex *SessionMutex,
QWaitCondition *SessionStarted)
{
_argc = argc;
_root_poa = PortableServer::POA::_duplicate(poa);
_GUIMutex = GUIMutex;
_ServerLaunch = ServerLaunch;
+ _SessionMutex = SessionMutex;
_SessionStarted = SessionStarted;
+
+ // start thread
+ start();
}
-//=============================================================================
/*!
- * destructor
- */
-//=============================================================================
-
+ destructor
+*/
Session_ServerLauncher::~Session_ServerLauncher()
{
}
-//=============================================================================
/*!
- * Check args and activate servers
- */
-//=============================================================================
-
+ Check args and activate servers
+*/
void Session_ServerLauncher::run()
{
- _GUIMutex->lock(); // lock released by calling thread when ready: wait(mutex)
- _GUIMutex->unlock();
+ // wait until main thread is ready
+ _GUIMutex->lock(); // ... lock mutex (it is unlocked my calling thread
+ // wait condition's wait(mutex)
+ _GUIMutex->unlock(); // ... and unlock it 'cause it is not more needed
+
+ // wake main thread
_ServerLaunch->wakeAll();
CheckArgs();
ActivateAll();
- _SessionStarted->wakeAll(); // wake main thread
+ // wait until main thread is ready
+ _GUIMutex->lock(); // ... lock mutex (it is unlocked my calling thread
+ // wait condition's wait(mutex)
+ _GUIMutex->unlock(); // ... and unlock it 'cause it is not more needed
- _orb->run(); // this thread wait, during omniORB process events
+ // wake main thread
+ _ServerLaunch->wakeAll();
+
+ // run ORB
+ _orb->run(); // this thread waits, during omniORB process events
}
-//=============================================================================
/*!
- * controls and dispatchs arguments given with command
- */
-//=============================================================================
-
+ controls and dispatchs arguments given with command
+*/
void Session_ServerLauncher::CheckArgs()
{
int argState = 0;
throw SALOME_Exception(LOCALIZED("Error in command arguments, missing parenthesis ')'"));
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerLauncher::ActivateAll()
{
list<ServArg>::iterator itServ;
std::cout << "*** activating [" << argc << "] : " << argv[0] << std::endl;
Session_ServerThread* aServerThread
- = new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
+ = new Session_ServerThread(argc, argv, _orb,_root_poa);
_serverThreads.push_front(aServerThread);
aServerThread->Init();
char** argv = new char*[argc];
argv[0] = "Session";
Session_SessionThread* aServerThread
- = new Session_SessionThread(argc, argv, _orb,_root_poa,_GUIMutex,_ServerLaunch);
+ = new Session_SessionThread(argc, argv, _orb,_root_poa,_SessionMutex,_SessionStarted);
_serverThreads.push_front(aServerThread);
aServerThread->Init();
}
-//=============================================================================
/*!
- * Destruction des classes serveur dans l'ordre inverse de creation
- */
-//=============================================================================
-
+ Destruction des classes serveur dans l'ordre inverse de creation
+*/
void Session_ServerLauncher::KillAll()
{
MESSAGE("Session_ServerLauncher::KillAll()");
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
PortableServer::POA_ptr poa,
QMutex *GUIMutex,
QWaitCondition *ServerLaunch,
+ QMutex *SessionMutex,
QWaitCondition *SessionStarted);
virtual ~Session_ServerLauncher();
void run();
private:
int _argc;
char ** _argv;
- CORBA::ORB_var _orb;
- PortableServer::POA_var _root_poa;
- QMutex* _GUIMutex;
- QWaitCondition *_ServerLaunch;
- QWaitCondition *_SessionStarted;
- list<ServArg> _argServToLaunch;
- vector<string> _argCopy;
+ CORBA::ORB_var _orb;
+ PortableServer::POA_var _root_poa;
+ QMutex* _GUIMutex;
+ QWaitCondition* _ServerLaunch;
+ QMutex* _SessionMutex;
+ QWaitCondition* _SessionStarted;
+ list<ServArg> _argServToLaunch;
+ vector<string> _argCopy;
list<Session_ServerThread*> _serverThreads;
};
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SALOME_Container_i.hxx"
#include "SALOME_ContainerManager.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
+#include <SALOMEDSClient.hxx>
+#include <SALOMEDSClient_ClientFactory.hxx>
#include "SALOME_ModuleCatalog_impl.hxx"
#include "RegistryService.hxx"
#include "Session_Session_i.hxx"
"SalomeAppEngine",
"ContainerManager"};
-//=============================================================================
/*!
- * default constructor not for use
- */
-//=============================================================================
-
+ default constructor not for use
+*/
Session_ServerThread::Session_ServerThread()
{
ASSERT(0); // must not be called
}
-//=============================================================================
/*!
- * constructor
- */
-//=============================================================================
-
+ constructor
+*/
Session_ServerThread::Session_ServerThread(int argc,
char ** argv,
CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex)
+ PortableServer::POA_ptr poa)
{
//MESSAGE("Session_ServerThread Constructor " << argv[0]);
_argc = argc;
_argv = argv;
_orb = CORBA::ORB::_duplicate(orb);
_root_poa = PortableServer::POA::_duplicate(poa);
- _GUIMutex = GUIMutex;
_servType =-1;
_NS = new SALOME_NamingService(_orb); // one instance per server to limit
// multi thread coherence problems
}
-//=============================================================================
/*!
- * destructor
- */
-//=============================================================================
-
+ destructor
+*/
Session_ServerThread::~Session_ServerThread()
{
//MESSAGE("~Session_ServerThread "<< _argv[0]);
}
-//=============================================================================
/*!
- * run the thread : activate one servant, the servant type is given by
- * argument _argv[0]
- */
-//=============================================================================
-
+ run the thread : activate one servant, the servant type is given by
+ argument _argv[0]
+*/
void Session_ServerThread::Init()
{
MESSAGE("Session_ServerThread::Init "<< _argv[0]);
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateModuleCatalog(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateSALOMEDS(int argc,
char ** argv)
{
// counted objects, they will be deleted by the POA when they are no
// longer needed.
- SALOMEDS_StudyManager_i * myStudyManager_i
- = new SALOMEDS_StudyManager_i(_orb,_root_poa);
-
- // Activate the objects. This tells the POA that the objects are
- // ready to accept requests.
-
- PortableServer::ObjectId_var myStudyManager_iid
- = _root_poa->activate_object(myStudyManager_i);
- myStudyManager_i->register_name("/myStudyManager");
+ ClientFactory::createStudyManager(_orb,_root_poa);
}
catch(CORBA::SystemException&)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateRegistry(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateContainerManager(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateContainer(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateEngine(int /*argc*/, char ** /*argv*/)
{
try
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateSession(int argc,
char ** argv)
{
MESSAGE("Session_ServerThread::ActivateSession() not implemented!");
}
+/*!
+ constructor
+*/
Session_SessionThread::Session_SessionThread(int argc,
char** argv,
CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
QMutex* GUIMutex,
QWaitCondition* GUILauncher)
-: Session_ServerThread(argc, argv, orb, poa, GUIMutex),
+: Session_ServerThread(argc, argv, orb, poa),
+ _GUIMutex( GUIMutex ),
_GUILauncher( GUILauncher )
{
}
+/*!
+ destructor
+*/
Session_SessionThread::~Session_SessionThread()
{
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
Session_ServerThread(int argc,
char ** argv,
CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex);
+ PortableServer::POA_ptr poa);
virtual ~Session_ServerThread();
void Init();
protected:
int _servType;
CORBA::ORB_var _orb;
PortableServer::POA_var _root_poa;
- QMutex* _GUIMutex;
SALOME_NamingService * _NS;
};
protected:
virtual void ActivateSession ( int argc, char ** argv );
private:
+ QMutex* _GUIMutex;
QWaitCondition* _GUILauncher;
};
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
-//=============================================================================
-/*! SALOME_Session_i
- * constructor
- */
-//=============================================================================
-
+/*!
+ constructor
+*/
SALOME_Session_i::SALOME_Session_i(int argc,
char ** argv,
CORBA::ORB_ptr orb,
//MESSAGE("constructor end");
}
-//=============================================================================
-/*! GetVisuComponent
- * returns Visu component
- */
-//=============================================================================
-
+/*!
+ returns Visu component
+*/
Engines::Component_ptr SALOME_Session_i::GetComponent(const char* theLibraryName)
{
typedef Engines::Component_ptr TGetImpl(CORBA::ORB_ptr,
return Engines::Component::_nil();
}
-//=============================================================================
-/*! ~SALOME_Session_i
- * destructor
- */
-//=============================================================================
-
+/*!
+ destructor
+*/
SALOME_Session_i::~SALOME_Session_i()
{
//MESSAGE("destructor end");
}
-//=============================================================================
-/*! NSregister
- * tries to find the Corba Naming Service and to register the session,
- * gives naming service interface to _IAPPThread
- */
-//=============================================================================
-
+/*!
+ tries to find the Corba Naming Service and to register the session,
+ gives naming service interface to _IAPPThread
+*/
void SALOME_Session_i::NSregister()
{
SALOME::Session_ptr pSession = SALOME::Session::_narrow(_this());
//MESSAGE("Session registered in Naming Service");
}
-//=============================================================================
-/*! GetInterface
- * Launches the GUI if there is none.
- * The Corba method is oneway (corba client does'nt wait for GUI completion)
- */
-//=============================================================================
-
+/*!
+ Launches the GUI if there is none.
+ The Corba method is oneway (corba client does'nt wait for GUI completion)
+*/
void SALOME_Session_i::GetInterface()
{
_GUIMutex->lock();
}
}
-//=============================================================================
-/*! StopSession
- * Kills the session if there are no active studies nore GUI
- */
-//=============================================================================
+/*!
+ Kills the session if there are no active studies nore GUI
+*/
class CloseEvent : public SALOME_Event
{
public:
}
};
+/*!
+ Processes event to close session
+*/
void SALOME_Session_i::StopSession()
{
ProcessVoidEvent( new CloseEvent() );
}
-//=============================================================================
-/*! StatSession
- * Send a SALOME::StatSession structure (see idl) to the client
- * (number of running studies and presence of GUI)
- */
-//=============================================================================
-
+/*!
+ Send a SALOME::StatSession structure (see idl) to the client
+ (number of running studies and presence of GUI)
+*/
class QtLock
{
public:
{
long aStudyId=-1;
if ( SUIT_Session::session() && SUIT_Session::session()->activeApplication() ) {
- aStudyId = SUIT_Session::session()->activeApplication()->activeStudy()->id();
+ if ( SUIT_Session::session()->activeApplication()->activeStudy() ) // mkr : IPAL12128
+ aStudyId = SUIT_Session::session()->activeApplication()->activeStudy()->id();
}
return aStudyId;
}
bool SALOME_Session_i::restoreVisualState(CORBA::Long theSavePoint)
-{
+{
+ class TEvent: public SALOME_Event {
+ int _savePoint;
+ public:
+ TEvent(int savePoint) { _savePoint = savePoint; }
+ virtual void Execute() {
+ SUIT_Study* study = SUIT_Session::session()->activeApplication()->activeStudy();
+ if ( study ) {
+ study->restoreState(_savePoint);
+ }
+ }
+ };
+
+ if(SUIT_Session::session() && SUIT_Session::session()->activeApplication() ) {
+ SUIT_Study* study = SUIT_Session::session()->activeApplication()->activeStudy();
+ if(!study) SUIT_Session::session()->activeApplication()->createEmptyStudy();
+ ProcessVoidEvent( new TEvent(theSavePoint) );
+ return true;
+ }
+
return false;
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
+++ /dev/null
-// 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
-
-
-#include <stdexcept>
-#include <qapplication.h>
-
-#include <CASCatch_CatchSignals.hxx>
-#include <CASCatch_ErrorHandler.hxx>
-#include <CASCatch_Failure.hxx>
-
-extern "C" int HandleSignals(QApplication *theQApplication)
-{
- int aRet = -1;
- CASCatch_CatchSignals aCatchSignals;
- aCatchSignals.Activate();
-
- CASCatch_TRY {
- aRet = theQApplication->exec();
- }
- CASCatch_CATCH(CASCatch_Failure) {
- aCatchSignals.Deactivate();
- Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
- throw std::runtime_error( aFail->GetError() );
- }
-
- aCatchSignals.Deactivate();
- return aRet;
-}
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : SalomeApp
mkdir -p $@
$(INSTALL_COPYLIB):
- (cd $(bindir)/styles; ln -sf $(patsubst %.la, ../../../lib/salome/%.so, $(filter %.la, $(LIB))) $@) || true
+ (cd $(bindir)/styles; ln -sf $(patsubst %.la, ../../../lib@LIB_LOCATION_SUFFIX@/salome/%.so, $(filter %.la, $(LIB))) $@) || true
@CONCLUDE@
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SalomeStyle.h"
Descr: Style for SALOME platform
*/
+/*!
+ Constructor
+*/
SalomeStyle::SalomeStyle()
: myTitleParent( 0 )
{
qApp->installEventFilter( this );
}
+/*!
+ Destructor
+*/
SalomeStyle::~SalomeStyle()
{
}
+/*!
+ Delayed initialization of style
+*/
void SalomeStyle::polish( QWidget* w )
{
if ( !w )
PARENT_STYLE::polish( w );
}
+/*!
+ Custom event filter
+*/
bool SalomeStyle::eventFilter( QObject* o, QEvent* e )
{
if ( e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut )
return x;
}
+/*!
+ Mixes two colors, part of first is 1-t, part of second is t
+ \param t - part parameter
+ \param c1, c2 - colors
+ \param res - result color
+*/
void SalomeStyle::mix( const double t, const QColor& c1, const QColor& c2, QColor& res )
{
if( t<0.0 || t>1.0 )
res.setRgb( r, g, b );
}
+/*!
+ Mixes two colors, part of first is 1-t, part of second is t
+ \param t - part parameter
+ \param rgb1, rgb2 - colors (result is stored in rgb1)
+*/
void SalomeStyle::mix( const double t, QRgb& rgb1, const QRgb& rgb2 )
{
if( t<0.0 || t>1.0 )
rgb1 = qRgba( c[0][0], c[0][1], c[0][2], qAlpha( rgb1 ) );
}
+/*!
+ Mixes colors of pixmap points with other color
+ \param t - part parameter
+ \param pix - pixmap to be processed
+ \param col - other color
+*/
void SalomeStyle::mix( const double t, QPixmap& pix, const QColor& col )
{
if( t<0.0 || t>1.0 )
pix = anImage;
}
+/*!
+ Converts pixmap to grayscale
+ \param pix - pixmap to be processed
+ \param k - factor (gray value after conversion will be multiplied on it and truncated by 255.0)
+*/
void SalomeStyle::toGrayscale( QPixmap& pix, double k )
{
QImage anImage = pix.convertToImage();
pix = anImage;
}
+/*!
+ Draws gradient filling
+ \param p - painter
+ \param r - rect
+ \param c1, c2 - two colors of gradient
+ \param d - direction of gradient
+ \param f - gradient function (maps co-ordinate to part parameter)
+*/
void SalomeStyle::drawGradient( QPainter* p, const QRect& r,
const QColor& c1, const QColor& c2,
const Direction d, gradient_func f ) const
p->restore();
}
+/*!
+ Draws primitive element
+ \param pe - type of primitive element
+ \param p - painter
+ \param r - rect
+ \param cg - group of colors
+ \param flags - is used to control how the PrimitiveElement is drawn
+ \param opt - can be used to control how various PrimitiveElements are drawn
+*/
void SalomeStyle::drawPrimitive( PrimitiveElement pe, QPainter* p, const QRect& r,
const QColorGroup& cg, SFlags flags, const QStyleOption& opt ) const
{
}
}
+/*!
+ Draws control element
+ \param element - type of control element
+ \param p - painter
+ \param widget - widget
+ \param r - rect
+ \param cg - group of colors
+ \param flags - is used to control how the element is drawn
+ \param opt - can be used to control how various elements are drawn
+*/
void SalomeStyle::drawControl( ControlElement element, QPainter* p, const QWidget* widget, const QRect& r,
const QColorGroup& cg, SFlags flags, const QStyleOption& opt ) const
{
}
}
+/*!
+ \return the sub-area for the widget in logical coordinates
+ \param subrect - type of sub area
+ \param w - widget
+*/
QRect SalomeStyle::subRect( SubRect subrect, const QWidget* w ) const
{
QRect r = PARENT_STYLE::subRect( subrect, w );
return r;
}
+/*!
+ Draws the ComplexControl
+ \param control - type of complex control element
+ \param p - painter
+ \param widget - widget
+ \param r - rect
+ \param cg - group of colors
+ \param flags, controls, active - is used to control how the element is drawn
+ \param opt - can be used to control how various elements are drawn
+*/
void SalomeStyle::drawComplexControl( ComplexControl control, QPainter* p, const QWidget* widget,
const QRect& r, const QColorGroup& cg, SFlags flags,
SCFlags controls, SCFlags active, const QStyleOption& opt ) const
}
}
+/*!
+ \return pixmap by type
+ \param st - type of pixmap
+ \param w - widget
+ \param opt - style option flags
+*/
QPixmap SalomeStyle::stylePixmap( StylePixmap st, const QWidget* w, const QStyleOption& opt ) const
{
switch ( st )
}
}
+/*!
+ \return the pixel size
+ \param pm - type of pixel metrics
+ \param widget - widget
+*/
int SalomeStyle::pixelMetric( PixelMetric pm, const QWidget* widget ) const
{
int ret = 0;
return ret;
}
+/*!
+ \return corrected title text
+ \param txt - title text
+ \param w - possible width
+ \param fm - font metrics
+*/
QString SalomeStyle::titleText( const QString& txt, const int W, const QFontMetrics& fm ) const
{
QString res = txt.stripWhiteSpace();
/*!
Class: SalomeStylePlugin [Internal]
- Descr: Plugin for Qt style mechanism
+ Constructor
*/
-
SalomeStylePlugin::SalomeStylePlugin()
{
}
+/*!
+ Destructor
+*/
SalomeStylePlugin::~SalomeStylePlugin()
{
}
+/*!
+ \return keys of styles of plugin
+*/
QStringList SalomeStylePlugin::keys() const
{
return QStringList() << "salome";
}
+/*!
+ \return just created style
+ \param str - style key
+*/
QStyle* SalomeStylePlugin::create( const QString& str )
{
if ( str == "salome" )
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef SALOMESTYLE_H
#define SALOMESTYLE_H
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
LIB_CLIENT_IDL = SALOME_Registry.idl SALOME_Exception.idl
-CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-CXXFLAGS += $(OCC_CXXFLAGS) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS) $(KERNEL_CXXFLAGS)
+CXXFLAGS += $(OCC_CXXFLAGS) $(BOOST_CPPFLAGS) $(KERNEL_CXXFLAGS)
-LDFLAGS += $(QT_MT_LIBS) -lsuit $(CAS_KERNEL) -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeNS -lOpUtil
+LDFLAGS += $(QT_MT_LIBS) -lsuit $(CAS_KERNEL) $(KERNEL_LDFLAGS) -lSalomeNS -lOpUtil
@CONCLUDE@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "ToolsGUI.h"
-//=======================================================================
-// name : GetVisibility
-// Purpose : Verify whether object is visible or not
-//=======================================================================
+/*!
+ \return true if object is visible
+*/
bool ToolsGUI::GetVisibility( _PTR(Study) theStudy,
_PTR(SObject) theObj,
void* theId )
return false;
}
-//=======================================================================
-// name : SetVisibility
-// Purpose : Set flag visibility of object
-//=======================================================================
+/*!
+ Set flag visibility of object
+ \param theStudy - study
+ \param theEntry - entry
+ \param theValue - flag visibility
+ \param theId - id
+*/
bool ToolsGUI::SetVisibility( _PTR(Study) theStudy,
const char* theEntry,
const bool theValue,
return false;
}
-
-
-
-
-
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#define MARGIN_SIZE 11
#define MIN_EDIT_SIZE 250
-//=================================================================================
-// class : ToolsGUI_CatalogGeneratorDlg()
-// purpose : Constructor
-//=================================================================================
+/*!
+ Constructor
+*/
ToolsGUI_CatalogGeneratorDlg::ToolsGUI_CatalogGeneratorDlg( QWidget* parent, const char* name )
: QDialog( parent, name, TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
updateButtonState();
}
-//=================================================================================
-// function : ~ToolsGUI_CatalogGeneratorDlg()
-// purpose : destructor
-//=================================================================================
+/*!
+ destructor
+*/
ToolsGUI_CatalogGeneratorDlg::~ToolsGUI_CatalogGeneratorDlg()
{
}
-//=================================================================================
-// function : getIdlFile()
-// purpose : gets IDL file name entered
-//=================================================================================
+/*!
+ \return IDL file name entered
+*/
QString ToolsGUI_CatalogGeneratorDlg::getIdlFile()
{
return myIdlEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getXmlFile()
-// purpose : gets XML file name entered
-//=================================================================================
+/*!
+ \return XML file name entered
+*/
QString ToolsGUI_CatalogGeneratorDlg::getXmlFile()
{
return myXmlEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getPngFile()
-// purpose : gets PNG file name entered
-//=================================================================================
+/*!
+ \return PNG file name entered
+*/
QString ToolsGUI_CatalogGeneratorDlg::getPngFile()
{
return myPngEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getAuthor()
-// purpose : gets author
-//=================================================================================
+/*!
+ \return author
+*/
QString ToolsGUI_CatalogGeneratorDlg::getAuthor()
{
return myAuthorEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getVersion()
-// purpose : gets version number
-//=================================================================================
+/*!
+ \return version number
+*/
QString ToolsGUI_CatalogGeneratorDlg::getVersion()
{
return myVersionEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getCompName()
-// purpose : gets name of the component
-//=================================================================================
+/*!
+ \return name of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompName()
{
return myCompName->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getCompUserName()
-// purpose : gets username of the component
-//=================================================================================
+/*!
+ \return username of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompUserName()
{
return myCompUserName->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getCompType()
-// purpose : gets type of the component
-//=================================================================================
+/*!
+ \return type of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompMultiStd()
{
return myCompMultiStd->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getComptype()
-// purpose : gets type of the component
-//=================================================================================
+
+/*!
+ \return type of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompType()
{
return myCompType->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getIdlPath()
-// purpose : gets IDL path of modules
-//=================================================================================
+/*!
+ \return IDL path of modules
+*/
QString ToolsGUI_CatalogGeneratorDlg::getIdlPath()
{
cout << "QAD_Desktop::getCatalogue() is not implemented!!";
*/
}
-//=================================================================================
-// function : onBrowseBtnClicked()
-// purpose : <...> (Browse) buttons slot
-//=================================================================================
+/*!
+ SLOT: called on Browse button click
+*/
void ToolsGUI_CatalogGeneratorDlg::onBrowseBtnClicked()
{
QPushButton* send = (QPushButton*)sender();
updateButtonState();
}
-//=================================================================================
-// function : updateButtonState()
-// purpose : Updates <OK> button's state
-//=================================================================================
+/*!
+ Updates <OK> button's state
+*/
void ToolsGUI_CatalogGeneratorDlg::updateButtonState()
{
myApplyBtn->setEnabled( !myIdlEdit->text().stripWhiteSpace().isEmpty() &&
!myXmlEdit->text().stripWhiteSpace().isEmpty() );
}
-//=================================================================================
-// function : onApply()
-// purpose : <Apply> button slot, performs IDL->XML conversion
-//=================================================================================
+/*!
+ <Apply> button slot, performs IDL->XML conversion
+*/
void ToolsGUI_CatalogGeneratorDlg::onApply()
{
QString IDLpath = getIdlPath();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
class QLineEdit;
class QPushButton;
-//=================================================================================
-// class : ToolsGUI_CatalogGeneratorDlg
-// purpose :
-//=================================================================================
class Standard_EXPORT ToolsGUI_CatalogGeneratorDlg : public QDialog
{
Q_OBJECT
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
+/*!
+ Constructor
+*/
ToolsGUI_HelpWindow::ToolsGUI_HelpWindow(QWidget* parent, const char* name )
: QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
{
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : ToolsGUI_IntervalWindow.cxx
// Author : Oksana TCHEBANOVA
#define SPACING_SIZE 6
#define MIN_SPIN_WIDTH 100
+/*!
+ Constructor
+*/
ToolsGUI_IntervalWindow::ToolsGUI_IntervalWindow ( QWidget* parent )
- : QDialog( parent, "ToolsGUI_IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+: QDialog( parent, "ToolsGUI_IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{
BEGIN_OF("ToolsGUI_IntervalWindow constructor")
setCaption( tr( "Refresh Interval" ) );
END_OF("ToolsGUI_IntervalWindow constructor")
}
+
+/*!
+ Destructor
+*/
ToolsGUI_IntervalWindow::~ToolsGUI_IntervalWindow() {}
-/*
+
+/*!
Sets start interval size
*/
void ToolsGUI_IntervalWindow::setValue(const int size)
mySpinBox->setValue(size);
}
-/*
- Gets interval size
+/*!
+ \return interval size
*/
int ToolsGUI_IntervalWindow::getValue()
{
return mySpinBox->value();
}
-/*
- gets a pointer to myButtonOk
+/*!
+ \return a pointer to myButtonOk
*/
QPushButton* ToolsGUI_IntervalWindow::Ok()
{
return myButtonOk;
}
-/*
- gets a pointer to myButtonCancel
+/*!
+ \return a pointer to myButtonCancel
*/
QPushButton* ToolsGUI_IntervalWindow::Cancel()
{
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntervalWindow.hxx
// Author : Oksana TCHEBANOVA
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
a.append( BOLD( QString::number( int( c_info.uid ) ) ) );
a.append( QString( " )<br> " ) + tr( "in directory" ) + QString( " " ));
a.append( BOLD( c_info.cdir ) );
-
+
+ time_t aTime;
a.append( QString( "<br>" ) + tr( "begins" ) + QString( " " ) );
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+ aTime = time_t(c_info.tc_start);
+ char * t1 = (char * )duplicate(ctime(&aTime));
t1 [strlen(t1) -1 ] = ' ';
a.append( BOLD( t1 ) );
delete [] t1;
if (c_info.tc_hello != 0 )
{
- char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
+ aTime = time_t(c_info.tc_hello);
+ char * t2 = (char * )duplicate(ctime(&aTime));
t2 [strlen(t2) -1 ] = ' ';
a.append( tr( "last signal" ) + QString(" : ") );
a.append( BOLD( t2 ) );
}
if ((c_info.tc_end - c_info.difftime) != 0)
{
- char * t3 = (char * )duplicate(ctime(&c_info.tc_end));
+ aTime = time_t(c_info.tc_end);
+ char * t3 = (char * )duplicate(ctime(&aTime));
t3 [strlen(t3) -1 ] = ' ';
a.append( tr( "ends" ) + QString( " " ) );
a.append( BOLD( t3 ) );
_history->clear();
try
{
+ time_t aTime;
_serverhistory = _VarComponents->history();
for (CORBA::ULong i=0; i<_serverhistory->length(); i++)
{
ASSERT( c_info.name!=NULL);
QString a;
a.setNum(int(c_info.pid));
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+ aTime = time_t(c_info.tc_start);
+ char * t1 = (char * )duplicate(ctime(&aTime));
t1 [strlen(t1) -1 ] = ' ';
- char * t2 = (char * )duplicate(ctime(&c_info.tc_end));
+ aTime = time_t(c_info.tc_end);
+ char * t2 = (char * )duplicate(ctime(&aTime));
t2 [strlen(t2) -1 ] = ' ';
QListViewItem * item = new QListViewItem(_history, QString(c_info.name),\
a, QString(c_info.pwname), QString(c_info.machine), \
_clients->clear();
try
{
+ time_t aTime;
_serverclients = _VarComponents->getall();
for (CORBA::ULong i=0; i<_serverclients->length(); i++)
{
ASSERT( c_info.name!=NULL);
QString a;
a.setNum(int(c_info.pid));
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+ aTime = time_t(c_info.tc_start);
+ char * t1 = (char * )duplicate(ctime(&aTime));
t1 [strlen(t1) -1 ] = ' ';
- char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
+ aTime = time_t(c_info.tc_hello);
+ char * t2 = (char * )duplicate(ctime(&aTime));
t2 [strlen(t2) -1 ] = ' ';
QListViewItem * item = new QListViewItem(_clients, QString(c_info.name),\
a, QString(c_info.pwname), QString(c_info.machine), \
END_OF("slotSelectRefresh");
}
+/*!
+ SLOT: called when IntervalWindow's OK button is clicked
+*/
void ToolsGUI_RegWidget::slotIntervalOk()
{
BEGIN_OF("slotIntervalOk");
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
+# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : VTKViewer
@COMMENCE@
# header files
-EXPORT_HEADERS= VTKViewer_Actor.h \
- VTKViewer_CellRectPicker.h \
+EXPORT_HEADERS= \
+ VTKViewer.h \
+ VTKViewer_CellLocationsArray.h \
+ VTKViewer_Actor.h \
VTKViewer_ExtractUnstructuredGrid.h \
VTKViewer_ConvexTool.h \
VTKViewer_Filter.h \
VTKViewer_GeometryFilter.h \
VTKViewer_AppendFilter.h \
VTKViewer_Algorithm.h \
- VTKViewer.h \
VTKViewer_InteractorStyle.h \
VTKViewer_PassThroughFilter.h \
- VTKViewer_RectPicker.h \
VTKViewer_RenderWindow.h \
VTKViewer_RenderWindowInteractor.h \
VTKViewer_ShrinkFilter.h \
PO_FILES = \
VTKViewer_images.po \
- VTKViewer_msg_en.po \
- VTKViewerM_images.po \
- VTKViewerM_msg_en.po
-
+ VTKViewer_msg_en.po
+
# Libraries targets
LIB = libVTKViewer.la
-LIB_SRC= VTKViewer_Actor.cxx \
- VTKViewer_CellRectPicker.cxx \
- VTKViewer_ExtractUnstructuredGrid.cxx \
- VTKViewer_Filter.cxx \
- VTKViewer_GeometryFilter.cxx \
- VTKViewer_AppendFilter.cxx \
- VTKViewer_InteractorStyle.cxx \
- VTKViewer_PassThroughFilter.cxx \
- VTKViewer_RectPicker.cxx \
- VTKViewer_RenderWindow.cxx \
- VTKViewer_RenderWindowInteractor.cxx \
- VTKViewer_ShrinkFilter.cxx \
- VTKViewer_Transform.cxx \
- VTKViewer_TransformFilter.cxx \
- VTKViewer_Trihedron.cxx \
- VTKViewer_Utilities.cxx \
- VTKViewer_VectorText.cxx \
- VTKViewer_ViewManager.cxx \
- VTKViewer_ViewModel.cxx \
- VTKViewer_ConvexTool.cxx \
- VTKViewer_ViewWindow.cxx
+LIB_SRC= \
+ VTKViewer_CellLocationsArray.cxx \
+ VTKViewer_Actor.cxx \
+ VTKViewer_ExtractUnstructuredGrid.cxx \
+ VTKViewer_Filter.cxx \
+ VTKViewer_GeometryFilter.cxx \
+ VTKViewer_AppendFilter.cxx \
+ VTKViewer_InteractorStyle.cxx \
+ VTKViewer_PassThroughFilter.cxx \
+ VTKViewer_RenderWindow.cxx \
+ VTKViewer_RenderWindowInteractor.cxx \
+ VTKViewer_ShrinkFilter.cxx \
+ VTKViewer_Transform.cxx \
+ VTKViewer_TransformFilter.cxx \
+ VTKViewer_Trihedron.cxx \
+ VTKViewer_Utilities.cxx \
+ VTKViewer_VectorText.cxx \
+ VTKViewer_ViewManager.cxx \
+ VTKViewer_ViewModel.cxx \
+ VTKViewer_ConvexTool.cxx \
+ VTKViewer_ViewWindow.cxx
LIB_MOC = \
- VTKViewer_RenderWindow.h \
- VTKViewer_RenderWindowInteractor.h \
- VTKViewer_ViewManager.h \
- VTKViewer_ViewModel.h \
- VTKViewer_ViewWindow.h
+ VTKViewer_RenderWindow.h \
+ VTKViewer_RenderWindowInteractor.h \
+ VTKViewer_ViewManager.h \
+ VTKViewer_ViewModel.h \
+ VTKViewer_ViewWindow.h
BIN = VTKViewer
CPPFLAGS+=$(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES)
-LDFLAGS+=$(VTK_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL)
+LDFLAGS+=$(VTK_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) -lqtx -lsuit
-LDFLAGSFORBIN=$(LDFLAGS) -lqtx -lsuit
+LDFLAGSFORBIN=$(LDFLAGS)
@CONCLUDE@
\ No newline at end of file
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#ifndef VTKVIEWER_H
+#define VTKVIEWER_H
+
#ifdef WNT
-#ifdef VTKVIEWER_EXPORTS
-#define VTKVIEWER_EXPORT __declspec( dllexport )
+# ifdef VTKVIEWER_EXPORTS
+# define VTKVIEWER_EXPORT __declspec( dllexport )
+# else
+# define VTKVIEWER_EXPORT __declspec( dllimport )
+# endif
#else
-#define VTKVIEWER_EXPORT __declspec( dllimport )
+# define VTKVIEWER_EXPORT
#endif
-#else
-#define VTKVIEWER_EXPORT
+
+#include <vtkSystemIncludes.h>
+
+#if !defined(vtkFloatingPointType)
+# define vtkFloatingPointType vtkFloatingPointType
+ typedef float vtkFloatingPointType;
+#endif
+
#endif
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
int VTKViewer_LINE_WIDTH = 3;
-//----------------------------------------------------------------------------
vtkStandardNewMacro(VTKViewer_Actor);
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
VTKViewer_Actor
::VTKViewer_Actor():
myIsHighlighted(false),
myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
VTKViewer_Actor
::~VTKViewer_Actor()
{
myProperty->Delete();
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return name
+*/
const char*
VTKViewer_Actor
::getName()
return myName.c_str();
}
+/*!
+ Sets name
+ \param theName - new name
+*/
void
VTKViewer_Actor
::setName(const char* theName)
myName = theName;
}
-
-//----------------------------------------------------------------------------
+/*!
+ To publish the actor an all its internal devices
+*/
void
VTKViewer_Actor
::AddToRender(vtkRenderer* theRenderer)
theRenderer->AddActor(this);
}
+/*!
+ To remove the actor an all its internal devices
+*/
void
VTKViewer_Actor
::RemoveFromRender(vtkRenderer* theRenderer)
theRenderer->RemoveActor(this);
}
+/*!
+ Used to obtain all dependent actors
+*/
void
VTKViewer_Actor
::GetChildActors(vtkActorCollection*)
{}
-
-//----------------------------------------------------------------------------
+/*!
+ Apply view transformation
+ \param theTransform - view transformation
+*/
void
VTKViewer_Actor
::SetTransform(VTKViewer_Transform* theTransform)
}
+/*!
+ To insert some additional filters and then sets the given #vtkMapper
+*/
void
VTKViewer_Actor
::SetMapper(vtkMapper* theMapper)
InitPipeLine(theMapper);
}
+/*!
+ Initialization
+*/
void
VTKViewer_Actor
::InitPipeLine(vtkMapper* theMapper)
Superclass::SetMapper(theMapper);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Renders actor
+*/
void
VTKViewer_Actor
::Render(vtkRenderer *ren, vtkMapper* m)
{
+ if(vtkDataSet* aDataSet = GetInput()){
+ static vtkFloatingPointType PERCENTS_OF_DETAILS = 0.50;
+ vtkIdType aNbOfPoints = vtkIdType(aDataSet->GetNumberOfPoints()*PERCENTS_OF_DETAILS);
+ if(aNbOfPoints > 0)
+ SetNumberOfCloudPoints(aNbOfPoints);
+ }
+
if(myIsResolveCoincidentTopology){
int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
- float aFactor, aUnit;
+ vtkFloatingPointType aFactor, aUnit;
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
}
}
-
+/*!
+ Set ResolveCoincidentTopology flag
+ \param theIsResolve - new flag value
+*/
void
VTKViewer_Actor
::SetResolveCoincidentTopology(bool theIsResolve)
myIsResolveCoincidentTopology = theIsResolve;
}
+/*!
+ Set polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
VTKViewer_Actor
-::SetPolygonOffsetParameters(float factor, float units)
+::SetPolygonOffsetParameters(vtkFloatingPointType factor,
+ vtkFloatingPointType units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
}
+/*!
+ Get polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
VTKViewer_Actor
-::GetPolygonOffsetParameters(float& factor, float& units)
+::GetPolygonOffsetParameters(vtkFloatingPointType& factor,
+ vtkFloatingPointType& units)
{
factor = myPolygonOffsetFactor;
units = myPolygonOffsetUnits;
}
-
-//----------------------------------------------------------------------------
-float
+/*!
+ \return shrink factor
+*/
+vtkFloatingPointType
VTKViewer_Actor
::GetShrinkFactor()
{
return 1.0;
}
+/*!
+ \return true if the actor is shrunkable
+*/
bool
VTKViewer_Actor
::IsShrunkable()
return false;
}
+/*!
+ \return true if the actor is shrunk
+*/
bool
VTKViewer_Actor
::IsShrunk()
return false;
}
+/*!
+ Insert shrink filter into pipeline
+*/
void
VTKViewer_Actor
::SetShrink()
{}
+/*!
+ Remove shrink filter from pipeline
+*/
void
VTKViewer_Actor
::UnShrink()
{}
-
-//----------------------------------------------------------------------------
+/*!
+ Allows to get initial #vtkDataSet
+*/
vtkDataSet*
VTKViewer_Actor
::GetInput()
return myPassFilter.front()->GetOutput();
}
-
+/*!
+ To calculatate last modified time
+*/
unsigned long int
VTKViewer_Actor
::GetMTime()
return mTime;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
+ param theMode - new mode
+*/
void
VTKViewer_Actor
::SetRepresentation(int theMode)
switch(myRepresentation){
case VTK_POINTS :
case VTK_SURFACE :
- myProperty->DeepCopy(GetProperty());
+ myProperty->SetAmbient(GetProperty()->GetAmbient());
+ myProperty->SetDiffuse(GetProperty()->GetDiffuse());
+ myProperty->SetSpecular(GetProperty()->GetSpecular());
+ break;
}
+
switch(theMode){
case VTK_POINTS :
case VTK_SURFACE :
- GetProperty()->DeepCopy(myProperty);
+ GetProperty()->SetAmbient(myProperty->GetAmbient());
+ GetProperty()->SetDiffuse(myProperty->GetDiffuse());
+ GetProperty()->SetSpecular(myProperty->GetSpecular());
break;
default:
GetProperty()->SetAmbient(1.0);
GetProperty()->SetDiffuse(0.0);
GetProperty()->SetSpecular(0.0);
}
+
switch(theMode){
case 3 :
myGeomFilter->SetInside(true);
myGeomFilter->SetInside(false);
break;
}
+
myRepresentation = theMode;
}
+/*!
+ \return current representation mode
+*/
int
VTKViewer_Actor
::GetRepresentation()
return myRepresentation;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Maps VTK index of a node to corresponding object index
+*/
int
VTKViewer_Actor
::GetNodeObjId(int theVtkID)
return theVtkID;
}
-float*
+/*!
+ Get coordinates of a node for given object index
+*/
+vtkFloatingPointType*
VTKViewer_Actor
::GetNodeCoord(int theObjID)
{
return GetInput()->GetPoint(theObjID);
}
+/*!
+ Get corresponding #vtkCell for given object index
+*/
vtkCell*
VTKViewer_Actor
::GetElemCell(int theObjID)
return GetInput()->GetCell(theObjID);
}
+/*!
+ Maps VTK index of a cell to corresponding object index
+*/
int
VTKViewer_Actor
::GetElemObjId(int theVtkID)
}
-//=================================================================================
-// function : GetObjDimension
-// purpose : Return object dimension.
-// Virtual method shoulb be redifined by derived classes
-//=================================================================================
+/*!
+ \return object dimension. Virtual method should be redifined by derived classes
+*/
int
VTKViewer_Actor
::GetObjDimension( const int theObjId )
return 0;
}
-
+/*!
+ Infinitive means actor without size (point for example),
+ which is not taken into account in calculation of boundaries of the scene
+*/
void
VTKViewer_Actor
::SetInfinitive(bool theIsInfinite)
myIsInfinite = theIsInfinite;
}
-
+/*!
+ \return infinive flag
+*/
bool
VTKViewer_Actor
::IsInfinitive()
{
- return myIsInfinite;
-}
+ if(myIsInfinite)
+ return true;
+ static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT;
+ vtkFloatingPointType aBounds[6];
+ GetBounds(aBounds);
+ for(int i = 0; i < 6; i++)
+ if(fabs(aBounds[i]) > MAX_DISTANCE)
+ return true;
+
+ static vtkFloatingPointType MIN_DISTANCE = 1.0/VTK_LARGE_FLOAT;
+ if(GetLength() < MIN_DISTANCE)
+ return true;
+
+ return false;
+}
-float*
+/*!
+ \return current bounding box
+*/
+vtkFloatingPointType*
VTKViewer_Actor
::GetBounds()
{
}
+/*!
+ \return current bounding box
+*/
void
VTKViewer_Actor
-::GetBounds(float theBounds[6])
+::GetBounds(vtkFloatingPointType theBounds[6])
{
Superclass::GetBounds(theBounds);
}
-//----------------------------------------------------------------------------
bool
VTKViewer_Actor
::IsSetCamera() const
void
VTKViewer_Actor
-::SetSize( const float )
+::SetSize( const vtkFloatingPointType )
{}
::SetCamera( vtkCamera* )
{}
-//----------------------------------------------------------------------------
+
void
VTKViewer_Actor
-::SetOpacity(float theOpacity)
+::SetOpacity(vtkFloatingPointType theOpacity)
{
myOpacity = theOpacity;
GetProperty()->SetOpacity(theOpacity);
}
-float
+vtkFloatingPointType
VTKViewer_Actor
::GetOpacity()
{
}
+/*!
+ Change color
+*/
void
VTKViewer_Actor
-::SetColor(float r,float g,float b)
+::SetColor(vtkFloatingPointType r,
+ vtkFloatingPointType g,
+ vtkFloatingPointType b)
{
GetProperty()->SetColor(r,g,b);
}
+/*!
+ Change color
+*/
void
VTKViewer_Actor
-::SetColor(const float theRGB[3])
+::SetColor(const vtkFloatingPointType theRGB[3])
{
SetColor(theRGB[0],theRGB[1],theRGB[2]);
}
+/*!
+ Get color
+*/
void
VTKViewer_Actor
-::GetColor(float& r,float& g,float& b)
+::GetColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b)
{
- float aColor[3];
+ vtkFloatingPointType aColor[3];
GetProperty()->GetColor(aColor);
r = aColor[0];
g = aColor[1];
}
-//----------------------------------------------------------------------------
+/*!
+ \return display mode
+*/
int
VTKViewer_Actor
::getDisplayMode()
return myDisplayMode;
}
+/*!
+ Change display mode
+*/
void
VTKViewer_Actor
::setDisplayMode(int theMode)
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if the descendant of the VTKViewer_Actor will implement its own highlight or not
+*/
bool
VTKViewer_Actor
::hasHighlight()
return false;
}
+/*!
+ \return true if the VTKViewer_Actor is already highlighted
+*/
bool
VTKViewer_Actor
::isHighlighted()
return myIsHighlighted;
}
+/*!
+ Set preselection mode
+*/
void
VTKViewer_Actor
::SetPreSelected(bool thePreselect)
myIsPreselected = thePreselect;
}
-
-//----------------------------------------------------------------
+/*!
+ Just to update visibility of the highlight devices
+*/
void
VTKViewer_Actor
::highlight(bool theIsHighlight)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
//! Change opacity
virtual
void
- SetOpacity(float theOpacity);
+ SetOpacity(vtkFloatingPointType theOpacity);
//! Get current opacity
virtual
- float
+ vtkFloatingPointType
GetOpacity();
//! Change color
virtual
void
- SetColor(float r,float g,float b);
+ SetColor(vtkFloatingPointType r,
+ vtkFloatingPointType g,
+ vtkFloatingPointType b);
//! Get current color
virtual
void
- GetColor(float& r,float& g,float& b);
+ GetColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b);
//! Change color
virtual
void
- SetColor(const float theRGB[3]);
+ SetColor(const vtkFloatingPointType theRGB[3]);
//----------------------------------------------------------------------------
// For selection mapping purpose
//! Get coordinates of a node for given object index
virtual
- float*
+ vtkFloatingPointType*
GetNodeCoord(int theObjID);
//! Maps VTK index of a cell to corresponding object index
//! To calcualte current bounding box
virtual
- float*
+ vtkFloatingPointType*
GetBounds();
//! To calcualte current bounding box
void
- GetBounds(float bounds[6]);
+ GetBounds(vtkFloatingPointType bounds[6]);
//----------------------------------------------------------------------------
virtual
virtual
void
- SetSize( const float );
+ SetSize( const vtkFloatingPointType );
virtual
void
//! Set ResolveCoincidentTopology parameters
void
- SetPolygonOffsetParameters(float factor, float units);
+ SetPolygonOffsetParameters(vtkFloatingPointType factor,
+ vtkFloatingPointType units);
//! Get current ResolveCoincidentTopology parameters
void
- GetPolygonOffsetParameters(float& factor, float& units);
+ GetPolygonOffsetParameters(vtkFloatingPointType& factor,
+ vtkFloatingPointType& units);
virtual
void
//----------------------------------------------------------------------------
//! Get current shrink factor
virtual
- float
+ vtkFloatingPointType
GetShrinkFactor();
//! Is the actor is shrunkable
protected:
//----------------------------------------------------------------------------
bool myIsResolveCoincidentTopology;
- float myPolygonOffsetFactor;
- float myPolygonOffsetUnits;
+ vtkFloatingPointType myPolygonOffsetFactor;
+ vtkFloatingPointType myPolygonOffsetUnits;
std::string myName;
- float myOpacity;
+ vtkFloatingPointType myOpacity;
int myDisplayMode;
bool myIsInfinite;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "VTKViewer_AppendFilter.h"
-#include "VTKViewer_ConvexTool.h"
-
-#include <vtkSmartPointer.h>
-#include <vtkCellArray.h>
+#include <vtkCell.h>
#include <vtkCellData.h>
-#include <vtkGenericCell.h>
-#include <vtkHexahedron.h>
-#include <vtkMergePoints.h>
+#include <vtkDataSetAttributes.h>
+#include <vtkDataSetCollection.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
-#include <vtkPolyData.h>
-#include <vtkPyramid.h>
-#include <vtkStructuredGrid.h>
-#include <vtkTetra.h>
-#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
-#include <vtkVoxel.h>
-#include <vtkWedge.h>
-#include <vtkDataSetCollection.h>
-
-#include <vector>
-#include <map>
-using namespace std;
-
-#ifdef _DEBUG_
-//static int MYDEBUG = 0;
-//static int MYDEBUGWITHFILES = 0;
-#else
-//static int MYDEBUG = 0;
-//static int MYDEBUGWITHFILES = 0;
-#endif
+#include <vtkPoints.h>
#if defined __GNUC__
#if __GNUC__ == 2
VTKViewer_AppendFilter
::VTKViewer_AppendFilter()
{
- myDoMappingFlag=false;
+ myDoMappingFlag = false;
}
VTKViewer_AppendFilter
VTKViewer_AppendFilter
::SetDoMappingFlag(const bool theFlag)
{
- myDoMappingFlag=theFlag;
+ if(myDoMappingFlag == theFlag)
+ return;
+
+ myDoMappingFlag = theFlag;
+
+ this->Modified();
}
bool
VTKViewer_AppendFilter
::SetPoints(vtkPoints* thePoints)
{
+ if(GetPoints() == thePoints)
+ return;
+
myPoints = thePoints;
+
+ this->Modified();
}
vtkPoints*
VTKViewer_AppendFilter
::Execute()
{
- if (myPoints.GetPointer()) {
+ if(myPoints.GetPointer())
MakeOutput();
- }
- else {
- vtkAppendFilter::Execute();
- }
- if (myDoMappingFlag){
+ else
+ Superclass::Execute();
+
+ if(myDoMappingFlag)
DoMapping();
- }
}
+
void
VTKViewer_AppendFilter
-::Reset()
+::DoMapping()
{
- myNodeIds.clear();
- myCellIds.clear();
myNodeRanges.clear();
myCellRanges.clear();
- myNodeMapObjIDVtkID.clear();
- myCellMapObjIDVtkID.clear();
+
+ vtkIdType aPntStartId = 0;
+ vtkIdType aCellStartId = 0;
+
+ for(vtkIdType aDataSetId = 0; aDataSetId < this->NumberOfInputs; ++aDataSetId){
+ vtkDataSet* aDataSet = (vtkDataSet *)(this->Inputs[aDataSetId]);
+ // Do mapping of the nodes
+ if(!myPoints.GetPointer()){
+ vtkIdType aNbPnts = aDataSet->GetNumberOfPoints();
+ myNodeRanges.push_back(aPntStartId + aNbPnts);
+ aPntStartId += aNbPnts;
+ }
+ // Do mapping of the cells
+ vtkIdType aNbCells = aDataSet->GetNumberOfCells();
+ myCellRanges.push_back(aCellStartId + aNbCells);
+ aCellStartId += aNbCells;
+ }
}
-//==================================================================
-// function: DoMapping
-// purpose :
-//==================================================================
-void
-VTKViewer_AppendFilter
-::DoMapping()
+
+namespace
{
- int i, j, i1, i2, iNodeCnt, iCellCnt;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- vtkIdType aNbPnts, aNbCells, aId;
- vtkDataSet *pDS;
- //
- Reset();
- //
- iNodeCnt=0;
- iCellCnt=0;
- for (i=0; i<NumberOfInputs; ++i) {
- pDS=(vtkDataSet *)Inputs[i];
- //
- // Nodes
- if (!myPoints.GetPointer()) {
- aNbPnts=pDS->GetNumberOfPoints();
- i1=myNodeIds.size();
- i2=i1+aNbPnts-1;
- myNodeRanges.push_back(i1);
- myNodeRanges.push_back(i2);
- //
- for(j=0; j<aNbPnts; ++j) {
- aId=(vtkIdType)j;
- myNodeIds.push_back(aId);
- //
- aMapIt=myNodeMapObjIDVtkID.find(aId);
- if (aMapIt==myNodeMapObjIDVtkID.end()) {
- // if not found
- myNodeMapObjIDVtkID[aId]=iNodeCnt;
- }
- ++iNodeCnt;
- }
- }
- //
- // Cells
- aNbCells=pDS->GetNumberOfCells();
- i1=myCellIds.size();
- i2=i1+aNbCells-1;
- myCellRanges.push_back(i1);
- myCellRanges.push_back(i2);
- for(j=0; j<aNbCells; ++j) {
- aId=(vtkIdType)j;
- myCellIds.push_back(aId);
- //
- aMapIt=myCellMapObjIDVtkID.find(aId);
- if (aMapIt==myCellMapObjIDVtkID.end()) {
- // if not found
- myCellMapObjIDVtkID[aId]=iCellCnt;
- }
- ++iCellCnt;
- }
+ inline
+ vtkIdType
+ GetOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theInputDataSetID = -1;
+
+ vtkIdType aNbInputs = theRanges.size();
+ if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs)
+ return -1;
+
+ vtkIdType aStartId = theRanges[theInputDataSetID];
+ return aStartId + theInputID;
}
}
-//---------------------------------------------------------------
vtkIdType
VTKViewer_AppendFilter
-::GetPointOutputID(vtkIdType theInputID)
+::GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
{
- if (myPoints.GetPointer()) {
+ if(myPoints.GetPointer())
return theInputID;
- }
- //
- int aVtkID=-1;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- //
- aMapIt=myNodeMapObjIDVtkID.find(theInputID);
- if (aMapIt!=myNodeMapObjIDVtkID.end()) {
- // found
- PairOfDataMapOfIntegerInteger& aPair=(*aMapIt);
- aVtkID=aPair.second;
- }
- return aVtkID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myNodeRanges);
}
-//---------------------------------------------------------------
vtkIdType
VTKViewer_AppendFilter
-::GetCellOutputID(vtkIdType theInputID)
+::GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
{
- int aVtkID=-1;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- //
- aMapIt=myCellMapObjIDVtkID.find(theInputID);
- if (aMapIt!=myCellMapObjIDVtkID.end()) {
- // found
- PairOfDataMapOfIntegerInteger& aPair=(*aMapIt);
- aVtkID=aPair.second;
- }
- return aVtkID;
+ if(myPoints.GetPointer())
+ return theInputID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myCellRanges);
}
-//---------------------------------------------------------------
-vtkIdType
+namespace
+{
+ void
+ GetInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theStartID = theInputDataSetID = -1;
+
+ if(theRanges.empty())
+ return;
+
+ const vtkIdType& aRangeEnd = theRanges.back();
+ if(theOutputID < 0 || theOutputID >= aRangeEnd)
+ return;
+
+ vtkIdType aStartId = 0;
+ vtkIdType aNbInputs = theRanges.size();
+ for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){
+ vtkIdType aRange = theRanges[aDataSetId];
+ if(aRange > theOutputID){
+ theInputID = theOutputID - aStartId;
+ theInputDataSetID = aDataSetId;
+ theStartID = aStartId;
+ break;
+ }
+ aStartId = aRange;
+ }
+ }
+}
+
+void
VTKViewer_AppendFilter
-::GetPointInputID(vtkIdType theOutputID,
+::GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID)
{
- if (myPoints.GetPointer()) {
- theInputDataSetID=0;
- return theOutputID;
- }
- //
- int aNb, aNbRanges, aRetID, i, i1, i2, j;
- //
- aRetID=-1;
- theInputDataSetID=-1;
- //
- aNb=myNodeIds.size();
- if (theOutputID<0 || theOutputID>=aNb) {
- return aRetID;
- }
- //
- aRetID=(int)myNodeIds[theOutputID];
- //
- aNbRanges=myNodeRanges.size()/2;
- for (i=0; i<aNbRanges; ++i) {
- j=2*i;
- i1=myNodeRanges[j];
- i2=myNodeRanges[j+1];
- if (theOutputID>=i1 && theOutputID<=i2) {
- theInputDataSetID=i;
- }
+ if(myPoints.GetPointer()) {
+ theStartID = theInputDataSetID = 0;
+ theInputID = theOutputID;
+ return;
}
- //
- return aRetID;
+
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myNodeRanges);
}
-//---------------------------------------------------------------
-vtkIdType
+void
VTKViewer_AppendFilter
-::GetCellInputID(vtkIdType theOutputID,
+::GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID)
{
- int aNb, aNbRanges, aRetID, i, i1, i2, j;
- //
- aRetID=-1;
- theInputDataSetID=-1;
- //
- aNb=myCellIds.size();
- if (theOutputID<0 || theOutputID>=aNb) {
- return aRetID;
- }
- //
- aRetID=(int)myCellIds[theOutputID];
- //
- aNbRanges=myCellRanges.size()/2;
- for (i=0; i<aNbRanges; ++i) {
- j=2*i;
- i1=myCellRanges[j];
- i2=myCellRanges[j+1];
- if (theOutputID>=i1 && theOutputID<=i2) {
- theInputDataSetID=i;
- }
- }
- //
- return aRetID;
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myCellRanges);
}
-//---------------------------------------------------------------
void
VTKViewer_AppendFilter
::MakeOutput()
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef VTKVIEWER_APPENDFILTER_H
#define VTKVIEWER_APPENDFILTER_H
GetPoints();
vtkIdType
- GetPointOutputID(vtkIdType theInputID);
+ GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
vtkIdType
- GetCellOutputID(vtkIdType theInputID);
+ GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
- vtkIdType
- GetPointInputID(vtkIdType theOutputID,
- vtkIdType& theInputDataSetID);
+ void
+ GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
- vtkIdType
- GetCellInputID(vtkIdType theOutputID,
+ void
+ GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID);
+ typedef std::vector<vtkIdType> TVectorIds;
+
protected:
/*! \fn VTKViewer_AppendFilter();
* \brief Constructor
void MakeOutput();
- //
+ bool myDoMappingFlag;
+ TVectorIds myNodeRanges;
+ TVectorIds myCellRanges;
vtkSmartPointer<vtkPoints> myPoints;
-
-private:
- typedef std::vector<vtkIdType> TVectorId;
- typedef std::vector<int> VectorInt;
- typedef std::map <int,int> DataMapOfIntegerInteger;
- typedef DataMapOfIntegerInteger::iterator IteratorOfDataMapOfIntegerInteger;
- typedef DataMapOfIntegerInteger::value_type PairOfDataMapOfIntegerInteger;
-private:
- bool myDoMappingFlag;
- TVectorId myNodeIds;
- TVectorId myCellIds;
- VectorInt myNodeRanges;
- VectorInt myCellRanges;
- DataMapOfIntegerInteger myNodeMapObjIDVtkID;
- DataMapOfIntegerInteger myCellMapObjIDVtkID;
};
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <VTKViewer_CellRectPicker.h>
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : VTKViewer_CellRectPicker.h
// Author : Natalia KOPNOVA
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include "VTKViewer_ConvexTool.h"
-#include <vtkUnstructuredGrid.h>
-#include <vtkTriangle.h>
-#include <vtkConvexPointSet.h>
-#include <vtkUnstructuredGridWriter.h>
-#include <vtkMath.h>
-#include <vtkSmartPointer.h>
-
#include <set>
-#include <iterator>
+#include <map>
#include <algorithm>
-#include <math.h>
-
-typedef vtkUnstructuredGrid TInput;
-typedef std::set<vtkIdType> TUIDS; // unique ids
-typedef std::map<vtkIdType,TUIDS> TPTOIDS; // id points -> unique ids
-
-namespace CONVEX_TOOL
-{
- // all pairs
- typedef std::pair<vtkIdType,vtkIdType> TPair;
- typedef std::set<TPair> TSet;
-
- void
- WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName)
- {
- vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
- aWriter->SetFileName(theFileName.c_str());
- aWriter->SetInput(theDataSet);
- aWriter->Write();
- aWriter->Delete();
- }
+#include <vtkUnstructuredGrid.h>
+#include <vtkGeometryFilter.h>
+#include <vtkDelaunay3D.h>
+#include <vtkGenericCell.h>
+#include <vtkPolyData.h>
+#include <vtkCellData.h>
+#include <vtkPoints.h>
+#include <vtkIdList.h>
+#include <vtkCell.h>
+#include <vtkPlane.h>
+#include <vtkMath.h>
-static float FACE_ANGLE_TOLERANCE=1.5;
-#define EPS 1.0e-38
-#define EPS_T 1.0e-3
-
-#ifdef _DEBUG_
- static int MYDEBUG = 0;
- static int MYDEBUG_REMOVE = 0;
-#else
- static int MYDEBUG = 0;
- static int MYDEBUG_REMOVE = 0;
-#endif
-
-/*! \fn static void GetCenter(TInput* theGrid,TCell theptIds,float *center)
- * \brief Calculation of geometry center.
- * \param theGrid - TInput cell.
- * \param theptIds - point ids.
- * \retval center - output array[3] with coordinates of geometry center.
- */
-static void GetCenter(vtkPoints* thePoints,float center[3])
+namespace
{
- float p[3];
- center[0] = center[1] = center[2] = 0.0;
+ typedef std::vector<vtkIdType> TConnectivities;
- int numPts = thePoints->GetNumberOfPoints();
- if (numPts == 0) return;
-
- // get the center of the cell
- for (int i = 0; i < numPts; i++)
+ struct TPolygon
{
- thePoints->GetPoint(i, p);
- for (int j = 0; j < 3; j++)
+ TConnectivities myConnectivities;
+ vtkFloatingPointType myOrigin[3];
+ vtkFloatingPointType myNormal[3];
+ TPolygon(const TConnectivities& theConnectivities,
+ vtkFloatingPointType theOrigin[3],
+ vtkFloatingPointType theNormal[3]):
+ myConnectivities(theConnectivities)
{
- center[j] += p[j];
+ myOrigin[0] = theOrigin[0];
+ myOrigin[1] = theOrigin[1];
+ myOrigin[2] = theOrigin[2];
+
+ myNormal[0] = theNormal[0];
+ myNormal[1] = theNormal[1];
+ myNormal[2] = theNormal[2];
}
- }
- for (int j = 0; j < 3; j++)
- {
- center[j] /= numPts;
- }
+ };
+
+ typedef std::vector<TPolygon> TPolygons;
}
-/*! \fn static void ReverseIds(TCell &theIds)
- * \brief Reverse ids.
- * \param theIds - points ids.
- * \retval theIds - example input:(1,2,3,4) -> output:(4,3,2,1)
- */
-static void ReverseIds(TCell &theIds)
+/*!
+ Constructor
+*/
+VTKViewer_Triangulator
+::VTKViewer_Triangulator():
+ myInput(NULL),
+ myCellId(-1),
+ myShowInside(-1),
+ myAllVisible(-1),
+ myCellsVisibility(NULL),
+ myCellIds(vtkIdList::New())
+{}
+
+
+/*!
+ Destructor
+*/
+VTKViewer_Triangulator
+::~VTKViewer_Triangulator()
{
- int i;
- vtkIdType tmp;
- vtkIdType npts=theIds.size();
-
- for(i=0;i<(npts/2);i++){
- tmp = theIds[i];
- theIds[i] = theIds[npts-i-1];
- theIds[npts-i-1] = tmp;
- }
+ myCellIds->Delete();
}
-/*! \fn void GetFriends(const TPTOIDS p2faces,const TCellArray f2points,TPTOIDS& face2face_output)
- * \brief Caclulation of connected faces (faceId -> (faceId1,faceId2, ...))
- * \param p2faces - point to faces ids map.
- * \param f2points - faces to points ids map.
- * \retval face2face_output - faces to faces ids map.
- */
-void GetFriends(const TPTOIDS p2faces,const TCellArray f2points,TPTOIDS& face2face_output)
-{
- TCellArray::const_iterator f2pIter = f2points.begin();
- for( ; f2pIter!=f2points.end() ; f2pIter++ ){
- vtkIdType faceId = f2pIter->first;
- TCell face_points = f2pIter->second;
- int nb_face_points = face_points.size();
-
- vtkIdType id1;
- vtkIdType id2;
- TPTOIDS::const_iterator faces1;
- TPTOIDS::const_iterator faces2;
-
- id1 = face_points[0];
- faces1 = p2faces.find(id1);
-
- TUIDS output_faces;
-
- for(int i=1 ; i<nb_face_points ; i++ ){
- id2 = face_points[i];
+bool
+VTKViewer_Triangulator
+::Execute(vtkUnstructuredGrid *theInput,
+ vtkCellData* thInputCD,
+ vtkIdType theCellId,
+ int theShowInside,
+ int theAllVisible,
+ const char* theCellsVisibility,
+ vtkPolyData *theOutput,
+ vtkCellData* theOutputCD,
+ int theStoreMapping,
+ std::vector<vtkIdType>& theVTK2ObjIds,
+ bool theIsCheckConvex)
+{
+ myInput = theInput;
+ myCellId = theCellId;
+ myShowInside = theShowInside;
+ myAllVisible = theAllVisible;
+ myCellsVisibility = theCellsVisibility;
- faces2 = p2faces.find(id2);
-
- std::set_intersection(faces1->second.begin(), faces1->second.end(), faces2->second.begin(), faces2->second.end(),
- std::inserter(output_faces,output_faces.begin()));
-
- id1 = id2;
- faces1 = faces2;
- }
- id1 = face_points[0];
- faces1 = p2faces.find(id1);
- std::set_intersection(faces1->second.begin(), faces1->second.end(), faces2->second.begin(), faces2->second.end(),
- std::inserter(output_faces,output_faces.begin()));
-
- output_faces.erase(faceId); // erase the face id for which we found friends
+ vtkPoints *aPoints = InitPoints();
+ vtkIdType aNumPts = GetNbOfPoints();
+ //cout<<"Triangulator - aNumPts = "<<aNumPts<<"\n";
- if(MYDEBUG){
- cout << "fId[" << faceId <<"]: ";
- std::copy(output_faces.begin(), output_faces.end(), std::ostream_iterator<vtkIdType>(cout, " "));
- cout << endl;
+ if(aNumPts == 0)
+ return true;
+
+ // To calculate the bary center of the cell
+ vtkFloatingPointType aCellCenter[3] = {0.0, 0.0, 0.0};
+ {
+ vtkFloatingPointType aPntCoord[3];
+ for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
+ aPoints->GetPoint(GetPointId(aPntId),aPntCoord);
+ //cout<<"\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}\n";
+ aCellCenter[0] += aPntCoord[0];
+ aCellCenter[1] += aPntCoord[1];
+ aCellCenter[2] += aPntCoord[2];
}
-
- face2face_output[faceId] = output_faces;
+ aCellCenter[0] /= aNumPts;
+ aCellCenter[1] /= aNumPts;
+ aCellCenter[2] /= aNumPts;
}
-}
-/*! \fn bool IsConnectedFacesOnOnePlane( TInput* theGrid,vtkIdType theFId1, vtkIdType theFId2,TUIDS FpIds1, TUIDS FpIds2 )
- * \brief Check is connected faces on one plane.
- * \param theGrid - TInput
- * \param theFId1 - id of first face
- * \param theFId2 - id of second face
- * \param FpIds1 - first face points ids.
- * \param FpIds2 - second face points ids.
- * \return TRUE if two faces on one plane, else FALSE.
- */
-bool IsConnectedFacesOnOnePlane( TInput* theGrid,
- vtkIdType theFId1, vtkIdType theFId2,
- TUIDS FpIds1, TUIDS FpIds2 )
-{
- bool status = false;
- TUIDS common_ids;
- std::set_intersection(FpIds1.begin(), FpIds1.end(), FpIds2.begin(), FpIds2.end(),
- std::inserter(common_ids,common_ids.begin()));
-
- /* Number of common ids = 2 (A1,A2)
-
-
- _ _ _ _ _ _ _ _ _ vectors:
- | \ / | v1 {A2,A1}
- \ / v2 {A1,B1}
- | | A2 | v3 {A1,C1}
- |
- | | |
- |
- | | A1 |
- / \
- |_ _ _ _ _/ \_ _ _ _ _|
- B2 B1 C1 C2
-
- */
- TUIDS::iterator common_iter = common_ids.begin();
- if(common_ids.size() == 2){
- TUIDS::iterator loc_id1_0 = FpIds1.find(*(common_iter));
- common_iter++;
- TUIDS::iterator loc_id1_1 = FpIds1.find(*(common_iter));
-
- TUIDS::iterator loc_id2_0 = FpIds1.begin();
- TUIDS::iterator loc_id2_1 = FpIds2.begin();
-
- vtkIdType A1 = *loc_id1_0;
- vtkIdType A2 = *loc_id1_1;
- vtkIdType B1;
- vtkIdType C1;
-
- for(;loc_id2_0!=FpIds1.end();loc_id2_0++)
- if(*loc_id2_0 != A1 && *loc_id2_0!= A2){
- B1 = *loc_id2_0;
- break;
- }
- for(;loc_id2_1!=FpIds2.end();loc_id2_1++)
- if(*loc_id2_1 != A1 && *loc_id2_1!= A2){
- C1 = *loc_id2_1;
- break;
- }
- if(MYDEBUG) cout <<endl;
- if(MYDEBUG) cout << "FId_1="<<theFId1<<" FId_2="<<theFId2<<endl;
- if(MYDEBUG) cout << " A1="<<A1<<" A2="<<A2<<" B1="<<B1<<" C1="<<C1<<" ->";
- float *p[4];
- float v1[3],v2[3],v3[3];
- p[0] = theGrid->GetPoint(A1);
- p[1] = theGrid->GetPoint(A2);
- p[2] = theGrid->GetPoint(B1);
- p[3] = theGrid->GetPoint(C1);
-
- for(int i=0;i<3;i++){
- v1[i] = p[1][i] - p[0][i];
- v2[i] = p[2][i] - p[0][i];
- v3[i] = p[3][i] - p[0][i];
- }
-
-
- float vec_b1[3];
- vtkMath::Cross(v2,v1,vec_b1);
- float vec_b2[3];
- vtkMath::Cross(v1,v3,vec_b2);
+ vtkFloatingPointType aCellLength = GetCellLength();
+ int aNumFaces = GetNumFaces();
- float b1 = vtkMath::Norm(vec_b1);
+ static vtkFloatingPointType EPS = 1.0E-2;
+ vtkFloatingPointType aDistEps = aCellLength * EPS;
+ //cout<<"\taCellLength = "<<aCellLength<<"; aDistEps = "<<aDistEps<<"\n";
- float b2 = vtkMath::Norm(vec_b2);
- float aCos = vtkMath::Dot(vec_b1,vec_b2)/(b1*b2);
-
- float angle=90.0;
- angle = aCos>=1.0 ? 0.0 : 180*acosf(aCos)/vtkMath::Pi();
-
- if( angle <= FACE_ANGLE_TOLERANCE)
- status = true;
- if (MYDEBUG){
- for(int k=0;k<4;k++){
- cout << " (";
- for(int j=0;j<2;j++){
- cout << p[k][j] << ",";
- }
- cout << p[k][2] << ") ";
- }
- if(status) cout << "angle="<<angle<<" status="<<status<<endl;
- }
-
- } else if (common_ids.size() >2){
- // not implemented yet
- if(MYDEBUG) cout << "Warning! VTKViewer_ConvexTool::IsConnectedFacesOnOnePlane()";
- } else {
- // one or no connection ... continue
- }
+ // To initialize set of points that belong to the cell
+ typedef std::set<vtkIdType> TPointIds;
+ TPointIds anInitialPointIds;
+ for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++)
+ anInitialPointIds.insert(GetPointId(aPntId));
- return status;
-}
-
-/*! \fn void GetAllFacesOnOnePlane( TPTOIDS theFaces, vtkIdType faceId,TUIDS &new_faces, TCell &new_faces_v2 )
- * \brief Calculate faces which on one plane.
- * \param theFaces -
- * \param faceId -
- * \param new_faces -
- * \param new_faces_v2 -
- */
-void GetAllFacesOnOnePlane( TPTOIDS theFaces, vtkIdType faceId,
- TUIDS &new_faces, TCell &new_faces_v2 )
-{
- if (new_faces.find(faceId) != new_faces.end()) return;
+ // To initialize set of points by face that belong to the cell and backward
+ typedef std::set<vtkIdType> TFace2Visibility;
+ TFace2Visibility aFace2Visibility;
- new_faces.insert(new_faces.begin(),faceId);
- new_faces_v2.push_back(faceId);
-
- TPTOIDS::const_iterator aIter1 = theFaces.find(faceId);
- if(aIter1!=theFaces.end()){
- TUIDS::const_iterator aIter2 = (aIter1->second).begin();
- for(;aIter2!=(aIter1->second).end();aIter2++){
- if (new_faces.find(*aIter2) != new_faces.end()) continue;
- GetAllFacesOnOnePlane(theFaces,*aIter2,
- new_faces,new_faces_v2); // recurvise
- }
- }
- return;
-}
+ typedef std::set<TPointIds> TFace2PointIds;
+ TFace2PointIds aFace2PointIds;
-/*! \fn void GetSumm(TCell v1,TCell v2,TCell &output)
- * \brief Gluing two faces (gluing points ids)
- * \param v1 - first face
- * \param v2 - second face
- * \param output - output face.
- */
-void GetSumm(TCell v1,TCell v2,TCell &output)
-{
- output.clear();
-
- if(MYDEBUG) cout << "========================================="<<endl;
- if(MYDEBUG) cout << "v1:";
- if(MYDEBUG) std::copy(v1.begin(), v1.end(), std::ostream_iterator<vtkIdType>(cout, " "));
- if(MYDEBUG) cout << "\tv2:";
- if(MYDEBUG) std::copy(v2.begin(), v2.end(), std::ostream_iterator<vtkIdType>(cout, " "));
- if(MYDEBUG) cout << endl;
-
- TUIDS v1_set;
- std::copy(v1.begin(), v1.end(), std::inserter(v1_set,v1_set.begin()));
- TUIDS v2_set;
- std::copy(v2.begin(), v2.end(), std::inserter(v2_set,v2_set.begin()));
- TUIDS tmpIntersection;
- std::set_intersection(v1_set.begin(),v1_set.end(),v2_set.begin(),v2_set.end(), std::inserter(tmpIntersection,tmpIntersection.begin()));
- if(MYDEBUG) std::copy(tmpIntersection.begin(),tmpIntersection.end(), std::ostream_iterator<vtkIdType>(cout, " "));
- if(MYDEBUG) cout << endl;
-
- if(tmpIntersection.size() < 2)
- if(MYDEBUG) cout << __FILE__ << "[" << __LINE__ << "]: Warning ! Wrong ids" << endl;
-
- TCell::iterator v1_iter = v1.begin();
-
- for(;v1_iter!=v1.end();v1_iter++){
-
- vtkIdType curr_id = *v1_iter;
-
- output.push_back(curr_id);
+ for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
+ vtkCell* aFace = GetFace(aFaceId);
- if(tmpIntersection.find(curr_id) != tmpIntersection.end()){
- TCell::iterator v1_iter_tmp;
- v1_iter_tmp = v1_iter;
- v1_iter++;
-
- if(v1_iter==v1.end()) v1_iter=v1.begin();
-
- curr_id = *v1_iter;
-
- if(tmpIntersection.find(curr_id) != tmpIntersection.end()){
- TCell::iterator v2_iter = v2.begin();
- for(;v2_iter!=v2.end();v2_iter++){
- vtkIdType v2_id = *v2_iter;
- if(tmpIntersection.find(v2_id) == tmpIntersection.end())
- output.push_back(v2_id);
- }
- }
-
- v1_iter = v1_iter_tmp;
- curr_id = *v1_iter;
+ GetCellNeighbors(theCellId, aFace, myCellIds);
+ if((!myAllVisible && !myCellsVisibility[myCellIds->GetId(0)]) ||
+ myCellIds->GetNumberOfIds() <= 0 || myShowInside)
+ {
+ TPointIds aPointIds;
+ vtkIdList *anIdList = aFace->PointIds;
+ aPointIds.insert(anIdList->GetId(0));
+ aPointIds.insert(anIdList->GetId(1));
+ aPointIds.insert(anIdList->GetId(2));
+ aFace2PointIds.insert(aPointIds);
+ aFace2Visibility.insert(aFaceId);
}
}
- if(MYDEBUG) cout << "Result: " ;
- if(MYDEBUG) std::copy(output.begin(),output.end(),std::ostream_iterator<vtkIdType>(cout, " "));
- if(MYDEBUG) cout << endl;
-}
-
-static void GetAndRemoveIdsOnOneLine(vtkPoints* points,
- TUIDS input_points_ids,
- TUIDS input_two_points_ids,
- TUIDS& out_two_points_ids,
- TUIDS& removed_points_ids){
- if (MYDEBUG_REMOVE) cout << EPS <<endl;
- float P[3][3];
- vtkIdType current_points_ids[2];
- if(MYDEBUG_REMOVE)
- if(input_two_points_ids.size()!=2) cout << "Error. Must be two ids in variable input_two_points_ids="<<input_two_points_ids.size()<<endl;
- TUIDS::const_iterator aInPointsIter = input_two_points_ids.begin();
- for(int i=0;i<2 && aInPointsIter!=input_two_points_ids.end();aInPointsIter++,i++){
- current_points_ids[i] = *aInPointsIter;
- if (MYDEBUG_REMOVE) cout << " " << *aInPointsIter;
- }
- if (MYDEBUG_REMOVE) cout << endl;
- bool iscurrent_points_changed = false;
- points->GetPoint(current_points_ids[0],P[0]);
- points->GetPoint(current_points_ids[1],P[1]);
- TUIDS::iterator aPointsIter = input_points_ids.begin();
- for(;aPointsIter!=input_points_ids.end();aPointsIter++){
- if(iscurrent_points_changed){
- points->GetPoint(current_points_ids[0],P[0]);
- points->GetPoint(current_points_ids[1],P[1]);
- iscurrent_points_changed = false;
- if (MYDEBUG_REMOVE)
- cout << " " << current_points_ids[0] << " " << current_points_ids[1] << endl;
- }
- // check: is point on line input_two_points_ids
- points->GetPoint(*aPointsIter,P[2]);
- if (MYDEBUG_REMOVE) {
- cout << "\t" << current_points_ids[0] << ":"<<P[0][0]<<","<<P[0][1]<<","<<P[0][2]<<endl;
- cout << "\t" << current_points_ids[1] << ":"<<P[1][0]<<","<<P[1][1]<<","<<P[1][2]<<endl;
- cout << "\t" << *aPointsIter << ":"<<P[2][0]<<","<<P[2][1]<<","<<P[2][2]<<endl;
- }
-
- // x-x1=(x2-x1)*t -> coeff[0][0] = (x-x1), coeff[0][1] = x2-x1
- // y-y1=(y2-y1)*t -> coeff[1][0] = (y-y1), coeff[1][1] = y2-y1
- // z-z1=(z2-z1)*t -> coeff[2][0] = (z-z1), coeff[2][1] = z2-z1
- float coeff[3][2];
- for(int i=0;i<3;i++){
- coeff[i][0] = P[2][i]-P[0][i];
- coeff[i][1] = P[1][i]-P[0][i];
- }
- bool isok_coord[3];
- bool isok = true;
- float t[3];
- for(int i=0;i<3;i++){
- isok_coord[i] = false;
- if( fabs(coeff[i][0]) <= EPS && fabs(coeff[i][1]) <= EPS) {
- isok_coord[i] = true;
- continue;
- }
- if( fabs(coeff[i][1]) <= EPS && fabs(coeff[i][0]) > EPS) {isok = false;t[i]=1.0/EPS;break;}
- t[i] = (coeff[i][0])/(coeff[i][1]);
- }
- for(int i=0;i<3;i++)
- if (MYDEBUG_REMOVE)
- cout << __LINE__ << " "
- << coeff[i][0] << ","<<coeff[i][1]
- <<" t="<<t[i]<<" isok_coord="<<isok_coord[i]<<endl;
- if(!isok) continue;
-
- if (!isok_coord[0] && !isok_coord[1]){
- if (fabs(t[0]-t[1]) <= EPS_T) isok = true;
- else isok = false;
- }
- if (MYDEBUG_REMOVE) cout << __LINE__ << " 1000 " << isok << endl;
- if(!isok) continue;
- if (!isok_coord[1] && !isok_coord[2]){
- if (fabs(t[1] - t[2]) <= EPS_T) isok = true;
- else isok = false;
- }
- if (MYDEBUG_REMOVE) cout << __LINE__ << " 2000 " << isok << endl;
- if(!isok) continue;
- if (!isok_coord[0] && !isok_coord[2]){
- if (fabs(t[0] - t[2]) <= EPS_T) isok = true;
- else isok = false;
- }
- if (MYDEBUG_REMOVE) cout << __LINE__ << " 3000 " << isok<<endl;
- if(!isok) continue;
-
- float param[3]; // parametric coord for P[0],P[1],P[2] <--->t[0],t[1],t[2]
- // anilize bounds of line
- for(int i=0;i<3;i++){
- for(int j=0;j<3;j++)
- if(!isok_coord[j]) param[i] = (P[i][j]-P[0][j])/(P[1][j]-P[0][j]);
- }
- if (MYDEBUG_REMOVE) cout << "Params: " << param[0] << "," << param[1] << "," << param[2] << endl;
- vtkIdType imax,imin;
- float min,max;
- for(vtkIdType i=0;i<3;i++)
- if(!isok_coord[i]){
- min = param[0];imin=0;
- max = param[0];imax=0;
- break;
- }
- for(vtkIdType i=0;i<3;i++){
- if(min > param[i]) {min = param[i]; imin=i;}
- if(max < param[i]) {max = param[i]; imax=i;}
- }
- if (MYDEBUG_REMOVE)
- cout << "\t min="<<min<<" max="<<max<<" - "<<"imin="<<imin<<" imax="<<imax<<endl;
- // imin - index of left point
- // imax - index of right point
-
- // add id to removed point
- vtkIdType rem_id,id1,id2;
- for(vtkIdType i=0;i<3;i++)
- if (i!=imin && i!=imax) {rem_id = i; break;}
-
- if(rem_id == 0) {
- rem_id = current_points_ids[0];
- id1=current_points_ids[1];
- id2=*aPointsIter;
- }
- else if (rem_id == 1) {
- rem_id = current_points_ids[1];
- id1=current_points_ids[0];
- id2=*aPointsIter;
- }
- else if (rem_id == 2) {
- rem_id = *aPointsIter;
- id1=current_points_ids[0];
- id2=current_points_ids[1];
- }
- if (MYDEBUG_REMOVE)
- cout << " " << current_points_ids[0] <<","<<current_points_ids[1]<<"---->"<<id1<<","<<id2<<endl;
- if((current_points_ids[0] == id1 && current_points_ids[1] == id2) ||
- (current_points_ids[0] == id2 && current_points_ids[1] == id1))
- {}
- else {
- iscurrent_points_changed = true;
- current_points_ids[0] = id1;
- current_points_ids[1] = id2;
- }
-
- removed_points_ids.insert(rem_id);
- }
- out_two_points_ids.insert(current_points_ids[0]);
- out_two_points_ids.insert(current_points_ids[1]);
-}
-
-static vtkSmartPointer<vtkConvexPointSet> RemoveAllUnneededPoints(vtkConvexPointSet* convex){
- vtkSmartPointer<vtkConvexPointSet> out = vtkConvexPointSet::New();
-
- TUIDS two_points,input_points,out_two_points_ids,removed_points_ids,loc_removed_points_ids;
- vtkIdList* aPointIds = convex->GetPointIds();
- int numIds = aPointIds->GetNumberOfIds();
- if (numIds<2) return out;
- TSet good_point_ids;
- TSet aLists[numIds-2];
- for(int i=0;i<numIds-2;i++){
- for(int j=i+1;j<numIds-1;j++){
- TPair aPair(i,j);
- aLists[i].insert(aPair);
- }
- }
- for(vtkIdType i=0;i<numIds-2;i++){
- TUIDS::iterator aRemIter=removed_points_ids.find(i);
- if(aRemIter!=removed_points_ids.end()) continue;
- TSet::iterator aPairIter=aLists[i].begin();
- loc_removed_points_ids.clear();
- out_two_points_ids.clear();
- input_points.clear();
- two_points.clear();
- for(;aPairIter!=aLists[i].end();aPairIter++){
- vtkIdType aFirId = (*aPairIter).first;
- vtkIdType aSecId = (*aPairIter).second;
- aRemIter=removed_points_ids.find(aSecId);
- if(aRemIter!=removed_points_ids.end()) continue;
- TPair aPair1(aFirId,aSecId);
- TPair aPair2(aSecId,aFirId);
- TSet::iterator aGoodIter=good_point_ids.find(aPair1);
- if(aGoodIter!=good_point_ids.end()) continue;
- aGoodIter=good_point_ids.find(aPair2);
- if(aGoodIter!=good_point_ids.end()) continue;
- two_points.insert(aFirId);
- two_points.insert(aSecId);
- if (MYDEBUG_REMOVE)
- cout << "\nInput: " << aFirId<<":"<<aPointIds->GetId(aFirId) << "," << aSecId <<":"<<aPointIds->GetId(aSecId)<< " --- ";
- for(vtkIdType k=aSecId+1;k<numIds;k++) {
- input_points.insert(k);
- if (MYDEBUG_REMOVE) cout << k<<":"<<aPointIds->GetId(k) << ",";
- }
- if (MYDEBUG_REMOVE) {
- cout << endl;
- cout << "\t";
- for(TUIDS::iterator aDelIter = loc_removed_points_ids.begin();aDelIter!=loc_removed_points_ids.end();aDelIter++)
- cout << *aDelIter<<",";
- cout << endl;
- }
- GetAndRemoveIdsOnOneLine(convex->Points,
- input_points,
- two_points,
- out_two_points_ids,
- loc_removed_points_ids);
- TUIDS::iterator aOutIter = out_two_points_ids.begin();
- vtkIdType aFirst=*aOutIter;aOutIter++;vtkIdType aSecond=*aOutIter;
- TPair aPair(aFirst,aSecond);
- good_point_ids.insert(aPair);
- if (MYDEBUG_REMOVE){
- cout << "Output: ";
- TUIDS::iterator aIter = out_two_points_ids.begin();
- for(;aIter!=out_two_points_ids.end();aIter++)
- cout << *aIter << ",";
- cout << " --- ";
- }
- TUIDS::iterator aDelIter = loc_removed_points_ids.begin();
- for(;aDelIter!=loc_removed_points_ids.end();aDelIter++){
- removed_points_ids.insert(*aDelIter);
- if (MYDEBUG_REMOVE) cout << *aDelIter << ",";
- }
- if (MYDEBUG_REMOVE) cout << endl;
- }
- }
- if (MYDEBUG_REMOVE) {
- cout << "============ Resultat ================" <<endl;
- cout << "Removed:";
- for(TUIDS::iterator aIter=removed_points_ids.begin();aIter!=removed_points_ids.end();aIter++)
- cout << *aIter << ",";
- cout << endl;
- }
-
- TUIDS result_ids,all_ids;
- for(vtkIdType i=0;i<numIds;i++) all_ids.insert(i);
- std::set_difference(all_ids.begin(),
- all_ids.end(),
- removed_points_ids.begin(),
- removed_points_ids.end(),
- std::inserter(result_ids,result_ids.begin()));
-
- out->Points->SetNumberOfPoints(result_ids.size());
- out->PointIds->SetNumberOfIds(result_ids.size());
- int aId=0;
- if(MYDEBUG_REMOVE) cout << "Result out:";
- for(TUIDS::iterator aIter=result_ids.begin();aIter!=result_ids.end();aIter++,aId++){
- float P[3];
- convex->Points->GetPoint(*aIter,P);
- out->Points->SetPoint(aId,P);
- out->PointIds->SetId(aId,aPointIds->GetId(*aIter));
- if (MYDEBUG_REMOVE) cout << *aIter << ":" << aPointIds->GetId(*aIter) << " , ";
- }
- if(MYDEBUG_REMOVE) cout << endl;
- out->Modified();
- out->Initialize();
-
- return out;
-}
-void GetPolygonalFaces(vtkUnstructuredGrid* theGrid,int cellId,TCellArray &outputCellArray)
-{
- if (theGrid->GetCellType(cellId) == VTK_CONVEX_POINT_SET){
- // get vtkCell type = VTK_CONVEX_POINT_SET
- if(vtkConvexPointSet* convex_in = static_cast<vtkConvexPointSet*>(theGrid->GetCell(cellId))){
- vtkSmartPointer<vtkConvexPointSet> convex = RemoveAllUnneededPoints(convex_in);
- TCellArray f2points;
- float convex_center[3]; // convex center point coorinat
- int aNbFaces = convex->GetNumberOfFaces();
- int numPts = convex->GetNumberOfPoints();
- if(MYDEBUG_REMOVE) cout << "aNbFaces="<<aNbFaces<<endl;
- if(MYDEBUG_REMOVE) cout << "numPts="<<numPts<<endl;
- TPTOIDS p2faces; // key=pointId , value facesIds set
-
- GetCenter(convex->Points,convex_center);
-
- for (vtkIdType faceId=0; faceId < aNbFaces; faceId++){
- vtkCell *aFace = convex->GetFace(faceId);
- int numFacePts = aFace->GetNumberOfPoints();
- TCell aIds;
-
- int i = 0;
- for(i=0;i<numFacePts;i++)
- aIds.push_back(aFace->GetPointId(i));
-
- float v_a[3],v_b[3],v_convex2face[3]; // vectors
- float *id_0,*id_1,*id_n;
- /*=============================================
- ,+- - - - _
- _ / id_n | v_b {id_0,id_n}
- v_b / _
- / | v_a {id_0,id_1}
- /
- / |
- + id_0
- \
- _ \ |
- v_a \
- \ id_1 |
- "+- - - -
-
- ============================================*/
- id_0 = theGrid->GetPoint(aIds[0]);
- id_1 = theGrid->GetPoint(aIds[1]);
- id_n = theGrid->GetPoint(aIds[numFacePts-1]);
-
- for(i=0;i<3;i++){
- v_a[i] = id_1[i] - id_0[i];
- v_b[i] = id_n[i] - id_0[i];
- v_convex2face[i] = id_0[i] - convex_center[i];
- }
+ ::TPolygons aPolygons;
- if (vtkMath::Determinant3x3(v_a,v_b,v_convex2face) < 0){
- ReverseIds(aIds);
- }
+ for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
+ if(aFace2Visibility.find(aFaceId) == aFace2Visibility.end())
+ continue;
- for(i=0;i<(int)aIds.size();i++){
- TUIDS &acell = p2faces[aIds[i]];
- acell.insert(faceId);
- }
-
- f2points[faceId] = aIds;
+ vtkCell* aFace = GetFace(aFaceId);
- }
-
- TPTOIDS face2face;
- GetFriends(p2faces,f2points,face2face);
+ vtkIdList *anIdList = aFace->PointIds;
+ vtkIdType aNewPts[3] = {anIdList->GetId(0), anIdList->GetId(1), anIdList->GetId(2)};
+
+ // To initialize set of points for the plane where the trinangle face belong to
+ TPointIds aPointIds;
+ aPointIds.insert(aNewPts[0]);
+ aPointIds.insert(aNewPts[1]);
+ aPointIds.insert(aNewPts[2]);
+
+ // To get know, if the points of the trinagle were already observed
+ bool anIsObserved = aFace2PointIds.find(aPointIds) == aFace2PointIds.end();
+ //cout<<"\taFaceId = "<<aFaceId<<"; anIsObserved = "<<anIsObserved;
+ //cout<<"; aNewPts = {"<<aNewPts[0]<<", "<<aNewPts[1]<<", "<<aNewPts[2]<<"}\n";
+
+ if(!anIsObserved){
+ // To get coordinates of the points of the traingle face
+ vtkFloatingPointType aCoord[3][3];
+ aPoints->GetPoint(aNewPts[0],aCoord[0]);
+ aPoints->GetPoint(aNewPts[1],aCoord[1]);
+ aPoints->GetPoint(aNewPts[2],aCoord[2]);
- TPTOIDS face2points;
+ // To calculate plane normal
+ vtkFloatingPointType aVector01[3] = { aCoord[1][0] - aCoord[0][0],
+ aCoord[1][1] - aCoord[0][1],
+ aCoord[1][2] - aCoord[0][2] };
- // copy TCellArray::f2points to TPTOIDS::face2points
- for(TCellArray::iterator f2points_iter=f2points.begin();
- f2points_iter!=f2points.end();
- f2points_iter++){
-
- TUIDS tmp;
- for(TCell::iterator points_iter=(f2points_iter->second).begin();
- points_iter!=(f2points_iter->second).end();
- points_iter++)
- tmp.insert(*points_iter);
-
- face2points[f2points_iter->first] = tmp;
- } // end copy
-
+ vtkFloatingPointType aVector02[3] = { aCoord[2][0] - aCoord[0][0],
+ aCoord[2][1] - aCoord[0][1],
+ aCoord[2][2] - aCoord[0][2] };
- TPTOIDS new_face2faces; // which connected and in one plane
+ // To calculate the normal for the triangle
+ vtkFloatingPointType aNormal[3];
+ vtkMath::Cross(aVector02,aVector01,aNormal);
- TPTOIDS::const_iterator aF2FIter = face2face.begin();
- for(;aF2FIter!=face2face.end();aF2FIter++){
- vtkIdType f_key = aF2FIter->first;
- TUIDS &faces = new_face2faces[f_key];
- //faces.insert(f_key);
- TUIDS f_friends = aF2FIter->second;
- TUIDS::const_iterator a_friends_iter = f_friends.begin();
- for(;a_friends_iter!=f_friends.end();a_friends_iter++){
- vtkIdType friend_id = *a_friends_iter;
- if( IsConnectedFacesOnOnePlane(theGrid,f_key,friend_id,
- (face2points.find(f_key))->second,
- (face2points.find(friend_id))->second)){
- faces.insert(friend_id);
- } // end if
-
- } // end a_friends_iter
- } // end aF2FIter
+ vtkMath::Normalize(aNormal);
- if(MYDEBUG)
+ // To calculate what points belong to the plane
+ // To calculate bounds of the point set
+ vtkFloatingPointType aCenter[3] = {0.0, 0.0, 0.0};
{
- TPTOIDS::const_iterator new_face2face_iter = new_face2faces.begin();
- cout << "Connected faces and on plane:" << endl;
- for(;new_face2face_iter!=new_face2faces.end();new_face2face_iter++){
- cout << "Group ["<<new_face2face_iter->first<<"] :";
- TUIDS::const_iterator new_faces_iter = (new_face2face_iter->second).begin();
- for(;new_faces_iter!=(new_face2face_iter->second).end();new_faces_iter++)
- cout << " " << *new_faces_iter ;
- cout << endl;
+ TPointIds::const_iterator anIter = anInitialPointIds.begin();
+ TPointIds::const_iterator anEndIter = anInitialPointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType aPntId = *anIter;
+ aPoints->GetPoint(aPntId,aPntCoord);
+ vtkFloatingPointType aDist = vtkPlane::DistanceToPlane(aPntCoord,aNormal,aCoord[0]);
+ //cout<<"\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}; aDist = "<<aDist<<"\n";
+ if(fabs(aDist) < aDistEps){
+ aPointIds.insert(aPntId);
+ aCenter[0] += aPntCoord[0];
+ aCenter[1] += aPntCoord[1];
+ aCenter[2] += aPntCoord[2];
+ }
}
+ int aNbPoints = aPointIds.size();
+ aCenter[0] /= aNbPoints;
+ aCenter[1] /= aNbPoints;
+ aCenter[2] /= aNbPoints;
}
- TPTOIDS output_newid2face;
- TCellArray output_newid2face_v2;
+ //To sinchronize orientation of the cell and its face
+ vtkFloatingPointType aVectorC[3] = { aCenter[0] - aCellCenter[0],
+ aCenter[1] - aCellCenter[1],
+ aCenter[2] - aCellCenter[2] };
+ vtkMath::Normalize(aVectorC);
+
+ vtkFloatingPointType aDot = vtkMath::Dot(aNormal,aVectorC);
+ //cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
+ //cout<<"; aVectorC = {"<<aVectorC[0]<<", "<<aVectorC[1]<<", "<<aVectorC[2]<<"}\n";
+ //cout<<"\t\taDot = "<<aDot<<"\n";
+ if(aDot > 0){
+ aNormal[0] = -aNormal[0];
+ aNormal[1] = -aNormal[1];
+ aNormal[2] = -aNormal[2];
+ }
+
+ // To calculate the primary direction for point set
+ vtkFloatingPointType aVector0[3] = { aCoord[0][0] - aCenter[0],
+ aCoord[0][1] - aCenter[1],
+ aCoord[0][2] - aCenter[2] };
+ vtkMath::Normalize(aVector0);
+
+ //cout<<"\t\taCenter = {"<<aCenter[0]<<", "<<aCenter[1]<<", "<<aCenter[2]<<"}";
+ //cout<<"; aVector0 = {"<<aVector0[0]<<", "<<aVector0[1]<<", "<<aVector0[2]<<"}\n";
+
+ // To calculate the set of points by face those that belong to the plane
+ TFace2PointIds aRemoveFace2PointIds;
{
- TUIDS already_in;
- TUIDS already_in_tmp;
- int k=0;
- TPTOIDS::const_iterator new_face2face_iter = new_face2faces.begin();
- for(;new_face2face_iter!=new_face2faces.end();new_face2face_iter++){
- if(already_in.find(new_face2face_iter->first) != already_in.end())
- continue;
- if(new_face2face_iter->second.size() > 1)
- continue;
-
- TCell &tmp_v2 = output_newid2face_v2[k];
- tmp_v2.push_back(new_face2face_iter->first);
- already_in.insert(new_face2face_iter->first);
+ TFace2PointIds::const_iterator anIter = aFace2PointIds.begin();
+ TFace2PointIds::const_iterator anEndIter = aFace2PointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ const TPointIds& anIds = *anIter;
+ TPointIds anIntersection;
+ std::set_intersection(aPointIds.begin(),aPointIds.end(),
+ anIds.begin(),anIds.end(),
+ std::inserter(anIntersection,anIntersection.begin()));
- TUIDS::const_iterator new_faces_iter = (new_face2face_iter->second).begin();
- for(;new_faces_iter!=(new_face2face_iter->second).end();new_faces_iter++){
- if(already_in.find(*new_faces_iter) != already_in.end()) continue;
- already_in.insert(*new_faces_iter);
-
- already_in_tmp.clear();
- already_in_tmp.insert(new_face2face_iter->first);
-
- TUIDS &tmp = output_newid2face[k];
- GetAllFacesOnOnePlane(new_face2faces,*new_faces_iter,
- already_in_tmp,tmp_v2);
-
- for(TUIDS::const_iterator aIter=already_in_tmp.begin();
- aIter!=already_in_tmp.end();
- aIter++)
- {
- already_in.insert(*aIter);
- tmp.insert(*aIter);
- }
+ if(anIntersection == anIds){
+ aRemoveFace2PointIds.insert(anIds);
}
- k++;
}
}
- if(MYDEBUG) {
- cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
- {
- TPTOIDS::const_iterator new_face2face_iter = output_newid2face.begin();
- for(;new_face2face_iter!=output_newid2face.end();new_face2face_iter++){
- cout << "Group ["<<new_face2face_iter->first<<"] :";
- TUIDS::const_iterator new_faces_iter = (new_face2face_iter->second).begin();
- for(;new_faces_iter!=(new_face2face_iter->second).end();new_faces_iter++)
- cout << " " << *new_faces_iter ;
- cout << endl;
- }
- }
- cout << "++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++"<<endl;
- cout << "++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++"<<endl;
- cout << "+++++++++++++++++++++++ ++ ++ ++++++++++++++++++++++++++++"<<endl;
- cout << "+++++++++++++++++++++++++ ++++++++++++++++++++++++++++++"<<endl;
- cout << "++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++"<<endl;
- {
- TCellArray::const_iterator new_face2face_iter = output_newid2face_v2.begin();
- for(;new_face2face_iter!=output_newid2face_v2.end();new_face2face_iter++){
- cout << "Group ["<<new_face2face_iter->first<<"] :";
- TCell::const_iterator new_faces_iter = (new_face2face_iter->second).begin();
- for(;new_faces_iter!=(new_face2face_iter->second).end();new_faces_iter++)
- cout << " " << *new_faces_iter ;
- cout << endl;
- }
+ // To remove from the set of points by face those that belong to the plane
+ {
+ TFace2PointIds::const_iterator anIter = aRemoveFace2PointIds.begin();
+ TFace2PointIds::const_iterator anEndIter = aRemoveFace2PointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ const TPointIds& anIds = *anIter;
+ aFace2PointIds.erase(anIds);
}
}
- TCellArray output_new_face2ids;
-// {
-// TPTOIDS::const_iterator new_face2face_iter = output_newid2face.begin();
-// for(;new_face2face_iter!=output_newid2face.end();new_face2face_iter++){
-
-// vtkIdType new_faceId = new_face2face_iter->first;
-// TUIDS::const_iterator new_faces_iter = (new_face2face_iter->second).begin();
-// vtkIdType fId0 = *new_faces_iter;
-// TCellArray::const_iterator pIds0_iter = f2points.find(fId0);
-// TCell pIds0 = pIds0_iter->second;
-// TCell &output = output_new_face2ids[new_faceId];
-// new_faces_iter++;
-// if(new_face2face_iter->second.size() > 2 ){}
-// for(;new_faces_iter!=(new_face2face_iter->second).end();new_faces_iter++){
-
-// vtkIdType faceId = *new_faces_iter;
-// // find how much nodes in face (f2points)
-// TCellArray::const_iterator pIds_iter = f2points.find(faceId);
-// TCell pIds = pIds_iter->second;
-
-// GetSumm(pIds0,pIds,output);
-// pIds0 = output;
-
-// } // end new_faces_iter
-
-// } // new_face2face_iter
-// }
+ // To sort the planar set of the points accrding to the angle
{
- TCellArray::const_iterator new_face2face_iter = output_newid2face_v2.begin();
- for(;new_face2face_iter!=output_newid2face_v2.end();new_face2face_iter++){
+ typedef std::map<vtkFloatingPointType,vtkIdType> TSortedPointIds;
+ TSortedPointIds aSortedPointIds;
+
+ TPointIds::const_iterator anIter = aPointIds.begin();
+ TPointIds::const_iterator anEndIter = aPointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType aPntId = *anIter;
+ aPoints->GetPoint(aPntId,aPntCoord);
+ vtkFloatingPointType aVector[3] = { aPntCoord[0] - aCenter[0],
+ aPntCoord[1] - aCenter[1],
+ aPntCoord[2] - aCenter[2] };
+ vtkMath::Normalize(aVector);
- vtkIdType new_faceId = new_face2face_iter->first;
- TCell::const_iterator new_faces_iter = (new_face2face_iter->second).begin();
- vtkIdType fId0 = *new_faces_iter;
- TCellArray::const_iterator pIds0_iter = f2points.find(fId0);
- TCell pIds0 = pIds0_iter->second;
- TCell &output = output_new_face2ids[new_faceId];
- new_faces_iter++;
- if(new_face2face_iter->second.size() == 1 ){
- TCellArray::const_iterator pIds_iter = f2points.find(fId0);
- TCell pIds = pIds_iter->second;
- output = pIds;
- continue;
+ vtkFloatingPointType aCross[3];
+ vtkMath::Cross(aVector,aVector0,aCross);
+ bool aGreaterThanPi = vtkMath::Dot(aCross,aNormal) < 0;
+ vtkFloatingPointType aCosinus = vtkMath::Dot(aVector,aVector0);
+ if(aCosinus > 1.0)
+ aCosinus = 1.0;
+ if(aCosinus < -1.0)
+ aCosinus = -1.0;
+ static vtkFloatingPointType a2Pi = 2.0 * vtkMath::Pi();
+ vtkFloatingPointType anAngle = acos(aCosinus);
+ //cout<<"\t\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}";
+ //cout<<"; aGreaterThanPi = "<<aGreaterThanPi<<"; aCosinus = "<<aCosinus<<"; anAngle = "<<anAngle<<"\n";
+ if(aGreaterThanPi){
+ anAngle = a2Pi - anAngle;
+ //cout<<"\t\t\t\tanAngle = "<<anAngle<<"\n";
}
- for(;new_faces_iter!=(new_face2face_iter->second).end();new_faces_iter++){
-
- vtkIdType faceId = *new_faces_iter;
- // find how much nodes in face (f2points)
- TCellArray::const_iterator pIds_iter = f2points.find(faceId);
- TCell pIds = pIds_iter->second;
-
- GetSumm(pIds0,pIds,output);
- pIds0 = output;
+ aSortedPointIds[anAngle] = aPntId;
+ }
- } // end new_faces_iter
-
- } // new_face2face_iter
+ if(!aSortedPointIds.empty()){
+ int aNumFacePts = aSortedPointIds.size();
+ ::TConnectivities aConnectivities(aNumFacePts);
+ TSortedPointIds::const_iterator anIter = aSortedPointIds.begin();
+ TSortedPointIds::const_iterator anEndIter = aSortedPointIds.end();
+ for(vtkIdType anId = 0; anIter != anEndIter; anIter++, anId++){
+ vtkIdType aPntId = anIter->second;
+ aConnectivities[anId] = GetConnectivity(aPntId);
+ }
+ aPolygons.push_back(::TPolygon(aConnectivities,aCenter,aNormal));
+ }
}
-
- if(MYDEBUG) {
- cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
- cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
- cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
+ }
+ }
+
+ if(aPolygons.empty())
+ return true;
+
+ // To check, whether the polygons give a convex polyhedron or not
+ if(theIsCheckConvex){
+ int aNbPolygons = aPolygons.size();
+ for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
+ ::TPolygon& aPolygon = aPolygons[aPolygonId];
+ vtkFloatingPointType* aNormal = aPolygon.myNormal;
+ vtkFloatingPointType* anOrigin = aPolygon.myOrigin;
+ //cout<<"\taPolygonId = "<<aPolygonId<<"\n";
+ //cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
+ //cout<<"; anOrigin = {"<<anOrigin[0]<<", "<<anOrigin[1]<<", "<<anOrigin[2]<<"}\n";
+ for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType anId = GetPointId(aPntId);
+ aPoints->GetPoint(anId,aPntCoord);
+ vtkFloatingPointType aDist = vtkPlane::Evaluate(aNormal,anOrigin,aPntCoord);
+ //cout<<"\t\taPntId = "<<anId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}; aDist = "<<aDist<<"\n";
+ if(aDist < -aDistEps)
+ return false;
}
- outputCellArray = output_new_face2ids;//f2points;
}
- } else {
- // not implemented
}
+
+
+ // To pass resulting set of the polygons to the output
+ {
+ int aNbPolygons = aPolygons.size();
+ for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
+ ::TPolygon& aPolygon = aPolygons[aPolygonId];
+ TConnectivities& aConnectivities = aPolygon.myConnectivities;
+ int aNbPoints = aConnectivities.size();
+ vtkIdType aNewCellId = theOutput->InsertNextCell(VTK_POLYGON,aNbPoints,&aConnectivities[0]);
+ if(theStoreMapping)
+ theVTK2ObjIds.push_back(theCellId);
+ theOutputCD->CopyData(thInputCD,theCellId,aNewCellId);
+ }
+ }
+
+ //cout<<"\tTriangulator - Ok\n";
+ return true;
}
+
+/*!
+ Constructor
+*/
+VTKViewer_OrderedTriangulator
+::VTKViewer_OrderedTriangulator():
+ myCell(vtkGenericCell::New())
+{}
+
+/*!
+ Destructor
+*/
+VTKViewer_OrderedTriangulator
+::~VTKViewer_OrderedTriangulator()
+{
+ myCell->Delete();
+}
+
+vtkPoints*
+VTKViewer_OrderedTriangulator
+::InitPoints()
+{
+ myInput->GetCell(myCellId,myCell);
+ return myInput->GetPoints();
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetNbOfPoints()
+{
+ return myCell->GetNumberOfPoints();
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetPointId(vtkIdType thePointId)
+{
+ return myCell->GetPointId(thePointId);
+}
+
+vtkFloatingPointType
+VTKViewer_OrderedTriangulator
+::GetCellLength()
+{
+ return sqrt(myCell->GetLength2());
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetNumFaces()
+{
+ return myCell->GetNumberOfFaces();
+}
+
+vtkCell*
+VTKViewer_OrderedTriangulator
+::GetFace(vtkIdType theFaceId)
+{
+ return myCell->GetFace(theFaceId);
+}
+
+void
+VTKViewer_OrderedTriangulator
+::GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds)
+{
+ vtkIdList *anIdList = theFace->PointIds;
+ myInput->GetCellNeighbors(theCellId, anIdList, theCellIds);
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetConnectivity(vtkIdType thePntId)
+{
+ return thePntId;
+}
+
+/*!
+ Constructor
+*/
+VTKViewer_DelaunayTriangulator
+::VTKViewer_DelaunayTriangulator():
+ myUnstructuredGrid(vtkUnstructuredGrid::New()),
+ myGeometryFilter(vtkGeometryFilter::New()),
+ myDelaunay3D(vtkDelaunay3D::New()),
+ myFaceIds(vtkIdList::New()),
+ myPoints(vtkPoints::New()),
+ myPolyData(NULL),
+ myPointIds(NULL)
+{
+ myDelaunay3D->SetInput(myUnstructuredGrid);
+ myGeometryFilter->SetInput(myDelaunay3D->GetOutput());
+}
+
+
+
+/*!
+ Destructor
+*/
+VTKViewer_DelaunayTriangulator
+::~VTKViewer_DelaunayTriangulator()
+{
+ myUnstructuredGrid->Delete();
+ myGeometryFilter->Delete();
+ myDelaunay3D->Delete();
+ myFaceIds->Delete();
+ myPoints->Delete();
+}
+
+
+vtkPoints*
+VTKViewer_DelaunayTriangulator
+::InitPoints()
+{
+ myUnstructuredGrid->Initialize();
+ myUnstructuredGrid->Allocate();
+ myUnstructuredGrid->SetPoints(myPoints);
+
+ vtkIdType aNumPts;
+ myInput->GetCellPoints(myCellId,aNumPts,myPointIds);
+ {
+ vtkFloatingPointType aPntCoord[3];
+ myPoints->SetNumberOfPoints(aNumPts);
+ vtkPoints *anInputPoints = myInput->GetPoints();
+ for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
+ anInputPoints->GetPoint(myPointIds[aPntId],aPntCoord);
+ myPoints->SetPoint(aPntId,aPntCoord);
+ }
+ }
+
+ myGeometryFilter->Update();
+ myPolyData = myGeometryFilter->GetOutput();
+
+ return myPoints;
+}
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetNbOfPoints()
+{
+ return myPoints->GetNumberOfPoints();
+}
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetPointId(vtkIdType thePointId)
+{
+ return thePointId;
+}
+
+vtkFloatingPointType
+VTKViewer_DelaunayTriangulator
+::GetCellLength()
+{
+ return myPolyData->GetLength();
+}
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetNumFaces()
+{
+ return myPolyData->GetNumberOfCells();
+}
+
+vtkCell*
+VTKViewer_DelaunayTriangulator
+::GetFace(vtkIdType theFaceId)
+{
+ return myPolyData->GetCell(theFaceId);
+}
+
+void
+VTKViewer_DelaunayTriangulator
+::GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds)
+{
+ myFaceIds->Reset();
+ vtkIdList *anIdList = theFace->PointIds;
+ myFaceIds->InsertNextId(myPointIds[anIdList->GetId(0)]);
+ myFaceIds->InsertNextId(myPointIds[anIdList->GetId(1)]);
+ myFaceIds->InsertNextId(myPointIds[anIdList->GetId(2)]);
+
+ myInput->GetCellNeighbors(theCellId, myFaceIds, theCellIds);
+}
+
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetConnectivity(vtkIdType thePntId)
+{
+ return myPointIds[thePntId];
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _VTKViewer_ConvexTool_H
#define _VTKViewer_ConvexTool_H
-#include <vtkUnstructuredGrid.h>
+#include "VTKViewer.h"
+
#include <vector>
-#include <map>
-typedef std::vector<vtkIdType> TCell; // ptsIds
-typedef std::map<vtkIdType,TCell> TCellArray; // CellId, TCell
+#include <vtkSystemIncludes.h>
+
+class vtkUnstructuredGrid;
+class vtkGeometryFilter;
+class vtkGenericCell;
+class vtkDelaunay3D;
+class vtkPolyData;
+class vtkCellData;
+class vtkPoints;
+class vtkIdList;
+class vtkCell;
+
+class VTKVIEWER_EXPORT VTKViewer_Triangulator
+{
+ public:
+ VTKViewer_Triangulator();
+
+ ~VTKViewer_Triangulator();
+
+ bool
+ Execute(vtkUnstructuredGrid *theInput,
+ vtkCellData* thInputCD,
+ vtkIdType theCellId,
+ int theShowInside,
+ int theAllVisible,
+ const char* theCellsVisibility,
+ vtkPolyData *theOutput,
+ vtkCellData* theOutputCD,
+ int theStoreMapping,
+ std::vector<vtkIdType>& theVTK2ObjIds,
+ bool theIsCheckConvex);
+
+ protected:
+ vtkIdList* myCellIds;
+
+ vtkUnstructuredGrid *myInput;
+ vtkIdType myCellId;
+ int myShowInside;
+ int myAllVisible;
+ const char* myCellsVisibility;
+
+ virtual
+ vtkPoints*
+ InitPoints() = 0;
+
+ virtual
+ vtkIdType
+ GetNbOfPoints() = 0;
+
+ virtual
+ vtkIdType
+ GetPointId(vtkIdType thePointId) = 0;
-/*! This package \namespace CONVEX_TOOL used for:
- * calculation of VTK_POLYGON cell array from VTK_TRIANGLE (triangulation)
- * of VTK_CONVEX_POINT_SET cell type.
- */
-namespace CONVEX_TOOL
+ virtual
+ vtkFloatingPointType
+ GetCellLength() = 0;
+
+ virtual
+ vtkIdType
+ GetNumFaces() = 0;
+
+ virtual
+ vtkCell*
+ GetFace(vtkIdType theFaceId) = 0;
+
+ virtual
+ void
+ GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds) = 0;
+
+ virtual
+ vtkIdType
+ GetConnectivity(vtkIdType thePntId) = 0;
+};
+
+
+class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator
{
- /*! \fn void CONVEX_TOOL::GetPolygonalFaces(vtkUnstructuredGrid* theCell,int cellId,TCellArray &outputCellArray)
- * \brief Main function.
- * \param theCell - vtkUnstructuredGrid cell pointer
- * \param cellId - id of cell type VTK_CONVEX_POINT_SET
- * \retval outputCellArray - output array with new cells types VTK_POLYGON
- */
- void
- WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
- void GetPolygonalFaces(vtkUnstructuredGrid* theCell,int cellId,TCellArray &outputCellArray);
-}
+ public:
+
+ VTKViewer_OrderedTriangulator();
+
+ ~VTKViewer_OrderedTriangulator();
+
+ protected:
+ vtkGenericCell *myCell;
+
+ virtual
+ vtkPoints*
+ InitPoints();
+
+ virtual
+ vtkIdType
+ GetNbOfPoints();
+
+ vtkIdType
+ GetPointId(vtkIdType thePointId);
+
+ virtual
+ vtkFloatingPointType
+ GetCellLength();
+
+ virtual
+ vtkIdType
+ GetNumFaces();
+
+ virtual
+ vtkCell*
+ GetFace(vtkIdType theFaceId);
+
+ virtual
+ void
+ GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds);
+
+ virtual
+ vtkIdType
+ GetConnectivity(vtkIdType thePntId);
+};
+
+
+class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator
+{
+ public:
+
+ VTKViewer_DelaunayTriangulator();
+
+ ~VTKViewer_DelaunayTriangulator();
+
+ protected:
+ vtkUnstructuredGrid* myUnstructuredGrid;
+ vtkGeometryFilter* myGeometryFilter;
+ vtkDelaunay3D* myDelaunay3D;
+ vtkPolyData* myPolyData;
+ vtkIdType *myPointIds;
+ vtkIdList* myFaceIds;
+ vtkPoints* myPoints;
+
+ virtual
+ vtkPoints*
+ InitPoints();
+
+ virtual
+ vtkIdType
+ GetNbOfPoints();
+
+ vtkIdType
+ GetPointId(vtkIdType thePointId);
+
+ virtual
+ vtkFloatingPointType
+ GetCellLength();
+
+ virtual
+ vtkIdType
+ GetNumFaces();
+
+ virtual
+ vtkCell*
+ GetFace(vtkIdType theFaceId);
+
+ virtual
+ void
+ GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds);
+
+ virtual
+ vtkIdType
+ GetConnectivity(vtkIdType thePntId);
+};
+
#endif // _VTKViewer_ConvexTool_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
// File: VISU_ExtractUnstructuredGrid.cxx
#include "VTKViewer_ExtractUnstructuredGrid.h"
-//#include "utilities.h"
+#include "VTKViewer_CellLocationsArray.h"
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
#include <vtkObjectFactory.h>
#include <vtkCellArray.h>
-#include <vtkIntArray.h>
#include <vtkIdList.h>
#include <vtkCell.h>
}
}
if((aNbElems = aConnectivity->GetNumberOfCells())){
- vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+ VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(aNbElems);
aConnectivity->InitTraversal();
}
}
if((aNbElems = aConnectivity->GetNumberOfCells())){
- vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+ VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(aNbElems);
aConnectivity->InitTraversal();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
#define VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// $Header$
#include "VTKViewer_GeometryFilter.h"
+#include "VTKViewer_ConvexTool.h"
#include <vtkSmartPointer.h>
#include <vtkCellArray.h>
#include <vtkVoxel.h>
#include <vtkWedge.h>
-#include <vtkMath.h>
-#include <vtkPlane.h>
-#include <vtkDelaunay3D.h>
-#include <vtkGeometryFilter.h>
-
#include <algorithm>
#include <iterator>
#include <vector>
#endif
#endif
-#define USE_ROBUST_TRIANGULATION
+//#define USE_ROBUST_TRIANGULATION
//----------------------------------------------------------------------------
vtkCxxRevisionMacro(VTKViewer_GeometryFilter, "$Revision$");
{}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::Execute()
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::UnstructuredGridExecute()
vtkPolyData *output = this->GetOutput();
vtkPointData *outputPD = output->GetPointData();
-#ifdef USE_ROBUST_TRIANGULATION
- vtkUnstructuredGrid* anUnstructuredGrid = vtkUnstructuredGrid::New();
- vtkPoints* aDelaunayPoints = vtkPoints::New();
-
- vtkDelaunay3D* aDelaunay3D = vtkDelaunay3D::New();
- aDelaunay3D->SetInput(anUnstructuredGrid);
-
- vtkGeometryFilter* aGeometryFilter = vtkGeometryFilter::New();
- aGeometryFilter->SetInput(aDelaunay3D->GetOutput());
-#endif
+ VTKViewer_OrderedTriangulator anOrderedTriangulator;
+ VTKViewer_DelaunayTriangulator aDelaunayTriangulator;
vtkCellData *outputCD = output->GetCellData();
vtkGenericCell *cell = vtkGenericCell::New();
-
vtkIdList *cellIds = vtkIdList::New();
vtkIdList *faceIds = vtkIdList::New();
char *cellVis;
vtkIdType newCellId;
int faceId, *faceVerts, numFacePts;
- float *x;
+ vtkFloatingPointType *x;
int PixelConvert[4], aNewPts[VTK_CELL_SIZE];
// ghost cell stuff
unsigned char updateLevel = (unsigned char)(output->GetUpdateGhostLevel());
break;
case VTK_CONVEX_POINT_SET: {
- //cout<<"cellId = "<<cellId<<"\n";
-
- vtkIdType aNumPts;
- vtkPoints *aPoints;
-#ifdef USE_ROBUST_TRIANGULATION
- aPoints = aDelaunayPoints;
- anUnstructuredGrid->Initialize();
- anUnstructuredGrid->Allocate();
- anUnstructuredGrid->SetPoints(aDelaunayPoints);
-
- vtkIdType *aPts;
- input->GetCellPoints(cellId,aNumPts,aPts);
- {
- float aPntCoord[3];
- aDelaunayPoints->SetNumberOfPoints(aNumPts);
- vtkPoints *anInputPoints = input->GetPoints();
- for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
- anInputPoints->GetPoint(aPts[aPntId],aPntCoord);
- aDelaunayPoints->SetPoint(aPntId,aPntCoord);
- }
- }
-#else
- input->GetCell(cellId,cell);
- aPoints = input->GetPoints();
- aNumPts = cell->GetNumberOfPoints();
-#endif
- // To calculate the bary center of the cell
- float aCellCenter[3] = {0.0, 0.0, 0.0};
- {
- float aPntCoord[3];
- for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
-#ifdef USE_ROBUST_TRIANGULATION
- aPoints->GetPoint(aPntId,aPntCoord);
-#else
- aPoints->GetPoint(cell->GetPointId(aPntId),aPntCoord);
-#endif
- //cout<<"\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}\n";
- aCellCenter[0] += aPntCoord[0];
- aCellCenter[1] += aPntCoord[1];
- aCellCenter[2] += aPntCoord[2];
- }
- aCellCenter[0] /= aNumPts;
- aCellCenter[1] /= aNumPts;
- aCellCenter[2] /= aNumPts;
- }
-
-#ifdef USE_ROBUST_TRIANGULATION
- aGeometryFilter->Update();
- vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
-
- float aCellLength = aPolyData->GetLength();
- int aNumFaces = aPolyData->GetNumberOfCells();
-#else
- float aCellLength = sqrt(cell->GetLength2());
- int aNumFaces = cell->GetNumberOfFaces();
-#endif
-
- static float EPS = 1.0E-5;
- float aDistEps = aCellLength * EPS;
-
- // To initialize set of points that belong to the cell
- typedef std::set<vtkIdType> TPointIds;
- TPointIds anInitialPointIds;
- for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++){
-#ifdef USE_ROBUST_TRIANGULATION
- anInitialPointIds.insert(aPntId);
-#else
- anInitialPointIds.insert(cell->GetPointId(aPntId));
-#endif
- }
-
- // To initialize set of points by face that belong to the cell and backward
- typedef std::set<vtkIdType> TFace2Visibility;
- TFace2Visibility aFace2Visibility;
-
- typedef std::set<TPointIds> TFace2PointIds;
- TFace2PointIds aFace2PointIds;
-
- for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
-#ifdef USE_ROBUST_TRIANGULATION
- vtkCell* aFace = aPolyData->GetCell(aFaceId);
-#else
- vtkCell* aFace = cell->GetFace(aFaceId);
-#endif
- vtkIdList *anIdList = aFace->PointIds;
- aNewPts[0] = anIdList->GetId(0);
- aNewPts[1] = anIdList->GetId(1);
- aNewPts[2] = anIdList->GetId(2);
-
-#ifdef USE_ROBUST_TRIANGULATION
- faceIds->Reset();
- faceIds->InsertNextId(aPts[aNewPts[0]]);
- faceIds->InsertNextId(aPts[aNewPts[1]]);
- faceIds->InsertNextId(aPts[aNewPts[2]]);
- input->GetCellNeighbors(cellId, faceIds, cellIds);
-#else
- input->GetCellNeighbors(cellId, anIdList, cellIds);
-#endif
- if((!allVisible && !cellVis[cellIds->GetId(0)]) ||
- cellIds->GetNumberOfIds() <= 0 ||
- myShowInside)
- {
- TPointIds aPointIds;
- aPointIds.insert(aNewPts[0]);
- aPointIds.insert(aNewPts[1]);
- aPointIds.insert(aNewPts[2]);
-
- aFace2PointIds.insert(aPointIds);
- aFace2Visibility.insert(aFaceId);
- }
- }
-
- for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
- if(aFace2Visibility.find(aFaceId) == aFace2Visibility.end())
- continue;
-
-#ifdef USE_ROBUST_TRIANGULATION
- vtkCell* aFace = aPolyData->GetCell(aFaceId);
-#else
- vtkCell* aFace = cell->GetFace(aFaceId);
-#endif
- vtkIdList *anIdList = aFace->PointIds;
- aNewPts[0] = anIdList->GetId(0);
- aNewPts[1] = anIdList->GetId(1);
- aNewPts[2] = anIdList->GetId(2);
-
- // To initialize set of points for the plane where the trinangle face belong to
- TPointIds aPointIds;
- aPointIds.insert(aNewPts[0]);
- aPointIds.insert(aNewPts[1]);
- aPointIds.insert(aNewPts[2]);
-
- // To get know, if the points of the trinagle were already observed
- bool anIsObserved = aFace2PointIds.find(aPointIds) == aFace2PointIds.end();
- //cout<<"\taFaceId = "<<aFaceId<<"; anIsObserved = "<<anIsObserved;
- //cout<<"; aNewPts = {"<<aNewPts[0]<<", "<<aNewPts[1]<<", "<<aNewPts[2]<<"}\n";
-
- if(!anIsObserved){
- // To get coordinates of the points of the traingle face
- float aCoord[3][3];
- aPoints->GetPoint(aNewPts[0],aCoord[0]);
- aPoints->GetPoint(aNewPts[1],aCoord[1]);
- aPoints->GetPoint(aNewPts[2],aCoord[2]);
-
- // To calculate plane normal
- float aVector01[3] = { aCoord[1][0] - aCoord[0][0],
- aCoord[1][1] - aCoord[0][1],
- aCoord[1][2] - aCoord[0][2] };
+ bool anIsOk = anOrderedTriangulator.Execute(input,
+ cd,
+ cellId,
+ myShowInside,
+ allVisible,
+ cellVis,
+ output,
+ outputCD,
+ myStoreMapping,
+ myVTK2ObjIds,
+ true);
+ if(!anIsOk)
+ aDelaunayTriangulator.Execute(input,
+ cd,
+ cellId,
+ myShowInside,
+ allVisible,
+ cellVis,
+ output,
+ outputCD,
+ myStoreMapping,
+ myVTK2ObjIds,
+ false);
- float aVector02[3] = { aCoord[2][0] - aCoord[0][0],
- aCoord[2][1] - aCoord[0][1],
- aCoord[2][2] - aCoord[0][2] };
-
- float aCross21[3];
- vtkMath::Cross(aVector02,aVector01,aCross21);
-
- vtkMath::Normalize(aCross21);
-
- // To calculate what points belong to the plane
- // To calculate bounds of the point set
- float aCenter[3] = {0.0, 0.0, 0.0};
- {
- TPointIds::const_iterator anIter = anInitialPointIds.begin();
- TPointIds::const_iterator anEndIter = anInitialPointIds.end();
- for(; anIter != anEndIter; anIter++){
- float aPntCoord[3];
- vtkIdType aPntId = *anIter;
- aPoints->GetPoint(aPntId,aPntCoord);
- float aDist = vtkPlane::DistanceToPlane(aPntCoord,aCross21,aCoord[0]);
- //cout<<"\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}; aDist = "<<aDist<<"\n";
- if(fabs(aDist) < aDistEps){
- aPointIds.insert(aPntId);
- aCenter[0] += aPntCoord[0];
- aCenter[1] += aPntCoord[1];
- aCenter[2] += aPntCoord[2];
- }
- }
- int aNbPoints = aPointIds.size();
- aCenter[0] /= aNbPoints;
- aCenter[1] /= aNbPoints;
- aCenter[2] /= aNbPoints;
- }
-
- // To calculate the primary direction for point set
- float aVector0[3] = { aCoord[0][0] - aCenter[0],
- aCoord[0][1] - aCenter[1],
- aCoord[0][2] - aCenter[2] };
-
- //To sinchronize orientation of the cell and its face
- float aVectorC[3] = { aCenter[0] - aCellCenter[0],
- aCenter[1] - aCellCenter[1],
- aCenter[2] - aCellCenter[2] };
- vtkMath::Normalize(aVectorC);
-
- float aDot = vtkMath::Dot(aCross21,aVectorC);
- //cout<<"\t\taCross21 = {"<<aCross21[0]<<", "<<aCross21[1]<<", "<<aCross21[2]<<"}";
- //cout<<"; aVectorC = {"<<aVectorC[0]<<", "<<aVectorC[1]<<", "<<aVectorC[2]<<"}\n";
- //cout<<"\t\taDot = "<<aDot<<"\n";
- if(aDot > 0){
- aCross21[0] = -aCross21[0];
- aCross21[1] = -aCross21[1];
- aCross21[2] = -aCross21[2];
- }
-
- vtkMath::Normalize(aVector0);
-
- //cout<<"\t\taCenter = {"<<aCenter[0]<<", "<<aCenter[1]<<", "<<aCenter[2]<<"}";
- //cout<<"; aVector0 = {"<<aVector0[0]<<", "<<aVector0[1]<<", "<<aVector0[2]<<"}\n";
-
- // To calculate the set of points by face those that belong to the plane
- TFace2PointIds aRemoveFace2PointIds;
- {
- TFace2PointIds::const_iterator anIter = aFace2PointIds.begin();
- TFace2PointIds::const_iterator anEndIter = aFace2PointIds.end();
- for(; anIter != anEndIter; anIter++){
- const TPointIds& anIds = *anIter;
- TPointIds anIntersection;
- std::set_intersection(aPointIds.begin(),aPointIds.end(),
- anIds.begin(),anIds.end(),
- std::inserter(anIntersection,anIntersection.begin()));
-
- if(anIntersection == anIds){
- aRemoveFace2PointIds.insert(anIds);
- }
- }
- }
-
- // To remove from the set of points by face those that belong to the plane
- {
- TFace2PointIds::const_iterator anIter = aRemoveFace2PointIds.begin();
- TFace2PointIds::const_iterator anEndIter = aRemoveFace2PointIds.end();
- for(; anIter != anEndIter; anIter++){
- const TPointIds& anIds = *anIter;
- aFace2PointIds.erase(anIds);
- }
- }
-
- // To sort the planar set of the points accrding to the angle
- {
- typedef std::map<float,vtkIdType> TSortedPointIds;
- TSortedPointIds aSortedPointIds;
-
- TPointIds::const_iterator anIter = aPointIds.begin();
- TPointIds::const_iterator anEndIter = aPointIds.end();
- for(; anIter != anEndIter; anIter++){
- float aPntCoord[3];
- vtkIdType aPntId = *anIter;
- aPoints->GetPoint(aPntId,aPntCoord);
- float aVector[3] = { aPntCoord[0] - aCenter[0],
- aPntCoord[1] - aCenter[1],
- aPntCoord[2] - aCenter[2] };
- vtkMath::Normalize(aVector);
-
- float aCross[3];
- vtkMath::Cross(aVector,aVector0,aCross);
- bool aGreaterThanPi = vtkMath::Dot(aCross,aCross21) < 0;
- float aCosinus = vtkMath::Dot(aVector,aVector0);
- if(aCosinus > 1.0)
- aCosinus = 1.0;
- if(aCosinus < -1.0)
- aCosinus = -1.0;
- static float a2Pi = 2.0 * vtkMath::Pi();
- float anAngle = acos(aCosinus);
- //cout<<"\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}";
- //cout<<"; aGreaterThanPi = "<<aGreaterThanPi<<"; aCosinus = "<<aCosinus<<"; anAngle = "<<anAngle<<"\n";
- if(aGreaterThanPi)
- anAngle = a2Pi - anAngle;
- aSortedPointIds[anAngle] = aPntId;
- //cout<<"\t\t\tanAngle = "<<anAngle<<"\n";
- }
- if(!aSortedPointIds.empty()){
- aCellType = VTK_POLYGON;
- int numFacePts = aSortedPointIds.size();
- std::vector<vtkIdType> aConnectivities(numFacePts);
- TSortedPointIds::const_iterator anIter = aSortedPointIds.begin();
- TSortedPointIds::const_iterator anEndIter = aSortedPointIds.end();
- for(vtkIdType anId = 0; anIter != anEndIter; anIter++, anId++){
- vtkIdType aPntId = anIter->second;
-#ifdef USE_ROBUST_TRIANGULATION
- aConnectivities[anId] = aPts[aPntId];
-#else
- aConnectivities[anId] = aPntId;
-#endif
- }
- newCellId = output->InsertNextCell(aCellType,numFacePts,&aConnectivities[0]);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
- outputCD->CopyData(cd,cellId,newCellId);
- }
- }
- }
- }
-
break;
}
case VTK_TETRA: {
vtkDebugMacro(<<"Extracted " << input->GetNumberOfPoints() << " points,"
<< output->GetNumberOfCells() << " cells.");
-#ifdef USE_ROBUST_TRIANGULATION
- anUnstructuredGrid->Delete();
- aDelaunayPoints->Delete();
-
- aDelaunay3D->Delete();
- aGeometryFilter->Delete();
-#endif
-
cell->Delete();
cellIds->Delete();
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::SetInside(int theShowInside)
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::SetWireframeMode(int theIsWireframeMode)
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::SetStoreMapping(int theStoreMapping)
}
-//----------------------------------------------------------------------------
-vtkIdType VTKViewer_GeometryFilter::GetElemObjId(int theVtkID)
-{
- if ( myVTK2ObjIds.empty() || theVtkID > (int)myVTK2ObjIds.size() )
- return -1;
-
+vtkIdType VTKViewer_GeometryFilter::GetElemObjId(int theVtkID){
+ if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
#if defined __GNUC_2__
return myVTK2ObjIds[theVtkID];
#else
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_GEOMETRYFILTER_H
#define VTKVIEWER_GEOMETRYFILTER_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "VTKViewer_Actor.h"
#include "VTKViewer_Utilities.h"
#include "VTKViewer_Trihedron.h"
-#include "VTKViewer_RectPicker.h"
#include "VTKViewer_ViewWindow.h"
#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_CellRectPicker.h"
#include "VTKViewer_RenderWindowInteractor.h"
//#include "SALOME_Actor.h"
return anEdgeId;
}
*/
-//----------------------------------------------------------------------------
+
vtkStandardNewMacro(VTKViewer_InteractorStyle);
-//----------------------------------------------------------------------------
+
/*!Constructor.*/
VTKViewer_InteractorStyle::VTKViewer_InteractorStyle()
{
OnSelectionModeChanged();
}
-//----------------------------------------------------------------------------
+
/*!Destructor.*/
VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()
{
m_ViewWnd->RemoveActor(myPreSelectionActor);
}
-//----------------------------------------------------------------------------
+
/*!Set preselection properties.
*\param theRed - red color.
*\param theGreen - green color.
myPreSelectionActor->GetProperty()->SetPointSize(theWidth);
}
-//----------------------------------------------------------------------------
+
/*!Set render window interactor
*\param theInteractor - interactor.
*/
Superclass::SetInteractor(theInteractor);
}
-//----------------------------------------------------------------------------
+
/*!Set view window.
*\param theViewWnd - SALOME VTKViewer_ViewWindow
*/
myPreSelectionActor->Delete();
}
-//----------------------------------------------------------------------------
+
/*!Set GUI window.
*\param theWindow - QWidget window.
*/
myGUIWindow = theWindow;
}
-//----------------------------------------------------------------------------
-/*!Set triedron.
+
+/*!Set trihedron.
*\param theTrihedron - SALOME VTKViewer_Trihedron
*/
void VTKViewer_InteractorStyle::setTriedron(VTKViewer_Trihedron* theTrihedron){
m_Trihedron = theTrihedron;
}
-//----------------------------------------------------------------------------
/*!Rotate camera.
*\param dx -
*\param dy -
myGUIWindow->update();
}
-//----------------------------------------------------------------------------
void VTKViewer_InteractorStyle::PanXY(int x, int y, int oldX, int oldY)
{
TranslateView(x, y, oldX, oldY);
}
-//----------------------------------------------------------------------------
/*! Move the position of the camera along the direction of projection. (dx,dy)*/
void VTKViewer_InteractorStyle::DollyXY(int dx, int dy)
{
myGUIWindow->update();
}
-//----------------------------------------------------------------------------
-/*!*/
void VTKViewer_InteractorStyle::SpinXY(int x, int y, int oldX, int oldY)
{
vtkCamera *cam;
}
-//----------------------------------------------------------------------------
/*!On mouse move event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On Left button down event.
*\param ctrl - CTRL (on/off - integer 0/1)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On left button up event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On left button up event.
*\param ctrl - CTRL (on/off - integer 0/1)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On middle button up event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On right button down event.
*\param ctrl - CTRL (on/off - integer 0/1)
*\param shift - SHIFT (on/off - integer 0/1)
}
}
-//----------------------------------------------------------------------------
/*!On right button up event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
}
-//----------------------------------------------------------------------------
-/** @name XPM - x pixmaps. */
+/*! @name XPM - x pixmaps. */
//@{
/*!Image Zoom cursor*/
const char* imageZoomCursor[] = {
"................................"};
//@}
-//----------------------------------------------------------------------------
/*! Loads cursors for viewer operations - zoom, pan, etc...*/
void VTKViewer_InteractorStyle::loadCursors()
{
}
-//----------------------------------------------------------------------------
/*! event filter - controls mouse and keyboard events during viewer operations*/
bool VTKViewer_InteractorStyle::eventFilter(QObject* object, QEvent* event)
{
}
-//----------------------------------------------------------------------------
/*! starts Zoom operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startZoom()
{
}
-//----------------------------------------------------------------------------
/*! starts Pan operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startPan()
{
qApp->installEventFilter(this);
}
-//----------------------------------------------------------------------------
/*! starts Rotate operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startRotate()
{
}
-//----------------------------------------------------------------------------
/*! starts Spin operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startSpin()
{
-//----------------------------------------------------------------------------
/*! starts Fit Area operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startFitArea()
{
}
-//----------------------------------------------------------------------------
/*!View fit all.*/
void VTKViewer_InteractorStyle::ViewFitAll() {
int aTriedronWasVisible = false;
}
-//----------------------------------------------------------------------------
/*! starts Global Panning operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startGlobalPan()
{
}
-//----------------------------------------------------------------------------
/*!\retval TRUE if needs redrawing*/
bool VTKViewer_InteractorStyle::needsRedrawing()
{
}
-//----------------------------------------------------------------------------
/*! fits viewer contents to rectangle
*\param left - left side
*\param top - top side
}
-//----------------------------------------------------------------------------
/*! starts viewer operation (!internal usage!)*/
void VTKViewer_InteractorStyle::startOperation(int operation)
{
}
-//----------------------------------------------------------------------------
/*! sets proper cursor for window when viewer operation is activated*/
void VTKViewer_InteractorStyle::setCursor(const int operation)
{
}
-//----------------------------------------------------------------------------
/*! called when viewer operation started (!put necessary initialization here!)*/
void VTKViewer_InteractorStyle::onStartOperation()
{
}
-//----------------------------------------------------------------------------
/*! called when viewer operation finished (!put necessary post-processing here!)*/
void VTKViewer_InteractorStyle::onFinishOperation()
{
void VTKViewer_InteractorStyle::TranslateView(int toX, int toY, int fromX, int fromY)
{
vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
- double viewFocus[4], focalDepth, viewPoint[3];
- float newPickPoint[4], oldPickPoint[4], motionVector[3];
+ vtkFloatingPointType viewFocus[4], focalDepth, viewPoint[3];
+ vtkFloatingPointType newPickPoint[4], oldPickPoint[4], motionVector[3];
cam->GetFocalPoint(viewFocus);
this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
viewFocus[2], viewFocus);
focalDepth = viewFocus[2];
- this->ComputeDisplayToWorld(double(toX), double(toY),
+ this->ComputeDisplayToWorld(vtkFloatingPointType(toX), vtkFloatingPointType(toY),
focalDepth, newPickPoint);
- this->ComputeDisplayToWorld(double(fromX),double(fromY),
+ this->ComputeDisplayToWorld(vtkFloatingPointType(fromX),vtkFloatingPointType(fromY),
focalDepth, oldPickPoint);
// camera motion is reversed
const int left, const int top,
const int right, const int bottom)
{
- float* aBounds = theActor->GetBounds();
- float aMin[3], aMax[3];
+ vtkFloatingPointType* aBounds = theActor->GetBounds();
+ vtkFloatingPointType aMin[3], aMax[3];
ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin);
ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax);
if (aMin[0] > aMax[0]) {
- float aBuf = aMin[0];
+ vtkFloatingPointType aBuf = aMin[0];
aMin[0] = aMax[0];
aMax[0] = aBuf;
}
if (aMin[1] > aMax[1]) {
- float aBuf = aMin[1];
+ vtkFloatingPointType aBuf = aMin[1];
aMin[1] = aMax[1];
aMax[1] = aBuf;
}
const int left, const int top,
const int right, const int bottom)
{
- float* aBounds = theCell->GetBounds();
- float aMin[3], aMax[3];
+ vtkFloatingPointType* aBounds = theCell->GetBounds();
+ vtkFloatingPointType aMin[3], aMax[3];
ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin);
ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax);
if (aMin[0] > aMax[0]) {
- float aBuf = aMin[0];
+ vtkFloatingPointType aBuf = aMin[0];
aMin[0] = aMax[0];
aMax[0] = aBuf;
}
if (aMin[1] > aMax[1]) {
- float aBuf = aMin[1];
+ vtkFloatingPointType aBuf = aMin[1];
aMin[1] = aMax[1];
aMax[1] = aBuf;
}
}
/*!Checks: is given point \a thePoint in rectangle*/
-bool VTKViewer_InteractorStyle::IsInRect(float* thePoint,
- const int left, const int top,
- const int right, const int bottom)
+bool VTKViewer_InteractorStyle::IsInRect(vtkFloatingPointType* thePoint,
+ const int left, const int top,
+ const int right, const int bottom)
{
- float aPnt[3];
+ vtkFloatingPointType aPnt[3];
ComputeWorldToDisplay(thePoint[0], thePoint[1], thePoint[2], aPnt);
return ((aPnt[0]>left) && (aPnt[0]<right) && (aPnt[1]>bottom) && (aPnt[1]<top));
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
bool IsInRect(vtkCell* theCell,
const int left, const int top,
const int right, const int bottom);
- bool IsInRect(float* thePoint,
+ bool IsInRect(vtkFloatingPointType* thePoint,
const int left, const int top,
const int right, const int bottom);
int State;
- float MotionFactor;
- float RadianToDegree; // constant: for conv from deg to rad
+ vtkFloatingPointType MotionFactor;
+ vtkFloatingPointType RadianToDegree; // constant: for conv from deg to rad
double myScale;
VTKViewer_Actor *myPreViewActor, *myPreSelectionActor, *mySelectedActor;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_PASSTHROUGHFILTER_H
#define VTKVIEWER_PASSTHROUGHFILTER_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
using namespace std;
-//----------------------------------------------------------------------------
+
vtkStandardNewMacro(VTKViewer_RectPicker);
-//----------------------------------------------------------------------------
+
/*!Constructor. Do nothing*/
VTKViewer_RectPicker::VTKViewer_RectPicker()
{
}
-//----------------------------------------------------------------------------
+
/*!Perform pick operation with selection rectangle provided. Normally the
* first two values for the selection top-left and right-bottom points are
* x-y pixel coordinate, and the third value is =0.
return result;
}
-//----------------------------------------------------------------------------
+
/*! Bounding box intersection with hexahedron. Origin[4][4] starts the ray from corner points,
* dir[4][3] is the vector components of the ray in the x-y-z directions.
* (Notes: the intersection ray dir[4][3] is NOT normalized.)
return inside;
}
-//----------------------------------------------------------------------------
/*! Position of point relative to hexahedron. p1[4][4] is the corner points of top face,
* p2[4][4] is the corner points of bottom face.
* \retval The method returns a non-zero value, if the point is inside.
return inside;
}
-//----------------------------------------------------------------------------
float VTKViewer_RectPicker::IntersectWithHex(float p1[4][4], float p2[4][4], float tol,
vtkAssemblyPath *path, vtkProp3D *prop3D,
vtkAbstractMapper3D *mapper)
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "VTKViewer_RenderWindow.h"
void VTKViewer_RenderWindow::onChangeBackgroundColor()
{
//float red, green, blue;
- float backint[3];
+ vtkFloatingPointType backint[3];
vtkRendererCollection * theRenderers = myRW->GetRenderers();
theRenderers->InitTraversal();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_RENDERWINDOW_H
#define VTKVIEWER_RENDERWINDOW_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "VTKViewer_RenderWindowInteractor.h"
#include "VTKViewer_RenderWindow.h"
myPointPicker->Delete();
}
+/*!
+ Print interactor to stream
+ \param os - stream
+ \param indent
+*/
void VTKViewer_RenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent)
{
vtkRenderWindowInteractor::PrintSelf(os, indent) ;
vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
}
-
-/*
-void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode theMode)
-{
- myCellActor->SetVisibility(false);
- myEdgeActor->SetVisibility(false);
- myPointActor->SetVisibility(false);
-
- switch(theMode){
- case ActorSelection:
- this->SetPicker(myBasicPicker);
- break;
- case NodeSelection:
- this->SetPicker(myPointPicker);
- break;
- case CellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- case EdgeOfCellSelection:
- this->SetPicker(myCellPicker);
- break;
- }
-
- myInteractorStyle->OnSelectionModeChanged();
-}
-*/
-
/*!Sets selection properties.
*\param theRed - red component of color
*\param theGreen - green component of color
return 1 ;
}
-/**@see CreateTimer(int )
- *\retval 1
+/*!
+ \sa CreateTimer(int )
+ \retval 1
*/
int VTKViewer_RenderWindowInteractor::DestroyTimer(void)
{
emit RenderWindowModified();
}
+/*!
+ default key press event (empty implementation)
+*/
void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event)
{
/// NOT_IMPLEMENTED
TUpdateActor theFun)
{
(*theFun)(theMapIndex,theMapActor,theActor);
- float aPos[3];
+ vtkFloatingPointType aPos[3];
theMapActor->GetPosition(aPos);
theActor->SetPosition(aPos);
}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_RENDERWINDOWINTERACTOR_H
#define VTKVIEWER_RENDERWINDOWINTERACTOR_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
int i, j, numIds, abort=0;
vtkIdType cellId, numCells, numPts;
vtkIdType oldId, newId;
- float center[3], *p, pt[3];
+ vtkFloatingPointType center[3], *p, pt[3];
vtkPointData *pd, *outPD;;
vtkIdList *ptIds, *newPtIds;
vtkDataSet *input= this->GetInput();
vtkUnstructuredGrid *output = this->GetOutput();
vtkIdType tenth;
- float decimal;
+ vtkFloatingPointType decimal;
vtkDebugMacro(<<"Shrinking cells");
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_SHRINKFILTER_H
#define VTKVIEWER_SHRINKFILTER_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_TRANSFORM_H
#define VTKVIEWER_TRANSFORM_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_TRANSFORMFILTER_H
#define VTKVIEWER_TRANSFORMFILTER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "VTKViewer_Trihedron.h"
#include "VTKViewer_Actor.h"
Bounds[1] = Bounds[3] = Bounds[5] = -VTK_LARGE_FLOAT;
}
-float*
+/*!
+ \return bounding box
+*/
+vtkFloatingPointType*
VTKViewer_UnScaledActor
::GetBounds()
{
void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer)
{
if(theRenderer){
- float P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}};
+ vtkFloatingPointType P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}};
theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]);
theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]);
- float aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+
- (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
- (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
+ vtkFloatingPointType aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+
+ (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
+ (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
int* aSize = theRenderer->GetRenderWindow()->GetSize();
- float aWinDiag = sqrt(float(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
+ vtkFloatingPointType aWinDiag = sqrt(vtkFloatingPointType(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
vtkDataSet* aDataSet = GetMapper()->GetInput();
- float aLength = aDataSet->GetLength();
- float aPrecision = 1.0E-3;
- float anOldScale = GetScale()[0];
- float aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(float(aSize[0])/float(aSize[1]));
+ aDataSet->Update();
+ vtkFloatingPointType aLength = aDataSet->GetLength();
+ vtkFloatingPointType aPrecision = 1.0E-3;
+ vtkFloatingPointType anOldScale = GetScale()[0];
+ vtkFloatingPointType aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1]));
if(fabs(aScale - anOldScale)/aScale > aPrecision){
SetScale(aScale);
}
vtkFollower::Render(theRenderer);
}
+/*!
+ Constructor
+*/
VTKViewer_Axis::VTKViewer_Axis()
{
/*! \li Initialize the Line pipe-line representation*/
myVisibility = VTKViewer_Trihedron::eOn;
}
+/*!
+ Destructor
+*/
VTKViewer_Axis::~VTKViewer_Axis()
{
/*! \li Destroy of the Label pipe-line representation */
myLineSource->Delete();
}
+/*! Add to renderer
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Axis::AddToRender(vtkRenderer* theRenderer){
/*! \li Order of the calls are important*/
theRenderer->AddActor(myLineActor);
theRenderer->AddActor(myArrowActor);
}
+/*! Remove actor of acis from \a theRenderer which are in myPresent.
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Axis::RemoveFromRender(vtkRenderer* theRenderer){
/*! \li Order of the calls are important*/
theRenderer->RemoveActor(myLineActor);
theRenderer->RemoveActor(myArrowActor);
}
+/*! Sets visibility for all Axis to \a theVis*/
void VTKViewer_Axis::SetVisibility(VTKViewer_Trihedron::TVisibility theVis)
{
switch(theVis){
myVisibility = theVis;
}
-//****************************************************************
+/*! Set camera for myLabelActor
+ */
void VTKViewer_Axis::SetCamera(vtkCamera* theCamera){
myLabelActor->SetCamera(theCamera);
}
+/*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+ */
void VTKViewer_Axis::SetProperty(vtkProperty* theProperty){
myLabelActor->SetProperty(theProperty);
myArrowActor->SetProperty(theProperty);
myLineActor->SetProperty(theProperty);
}
-void VTKViewer_Axis::SetSize(float theSize)
+/*! Set size of VTKViewer_Axis
+ */
+void VTKViewer_Axis::SetSize(vtkFloatingPointType theSize)
{
- float aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize};
+ vtkFloatingPointType aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize};
myLineSource->SetPoint2(aPosition);
myArrowActor->SetPosition(0.0,0.0,0.0);
vtkStandardNewMacro(VTKViewer_Trihedron);
+/*!
+ Constructor
+*/
VTKViewer_Trihedron::VTKViewer_Trihedron()
{
myPresent = vtkActorCollection::New();
myAxis[0] = VTKViewer_XAxis::New();
myAxis[1] = VTKViewer_YAxis::New();
myAxis[2] = VTKViewer_ZAxis::New();
- static float aSize = 100;
+ static vtkFloatingPointType aSize = 100;
SetSize(aSize);
}
+/*!
+ Destructor
+*/
VTKViewer_Trihedron::~VTKViewer_Trihedron()
{
myPresent->RemoveAllItems();
myAxis[i]->Delete();
}
-void VTKViewer_Trihedron::SetSize(float theSize)
+/*! Set size of axes
+ */
+void VTKViewer_Trihedron::SetSize(vtkFloatingPointType theSize)
{
mySize = theSize;
for(int i = 0; i < 3; i++)
myAxis[i]->SetSize(theSize);
}
+/*! Set visibility of axes
+ */
void VTKViewer_Trihedron::SetVisibility(TVisibility theVis)
{
for(int i = 0; i < 3; i++)
myAxis[i]->SetVisibility(theVis);
}
+/*!
+ \return visibility of first axis
+*/
VTKViewer_Trihedron::TVisibility VTKViewer_Trihedron::GetVisibility()
{
return myAxis[0]->GetVisibility();
}
+/*! Add to render all Axis
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Trihedron::AddToRender(vtkRenderer* theRenderer)
{
vtkCamera* aCamera = theRenderer->GetActiveCamera();
}
}
+/*! Remove all actors from \a theRenderer which are in myPresent.
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Trihedron::RemoveFromRender(vtkRenderer* theRenderer)
{
myPresent->InitTraversal();
myAxis[i]->RemoveFromRender(theRenderer);
}
+/*! Return count of visible actors.
+ * \param theRenderer - vtkRenderer pointer
+ */
int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer)
{
//TVisibility aVis = GetVisibility();
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_TRIHEDRON_H
#define VTKVIEWER_TRIHEDRON_H
/*!Create new instance of VTKViewer_UnScaledActor.*/
static VTKViewer_UnScaledActor *New();
- virtual float* GetBounds();
+ virtual vtkFloatingPointType* GetBounds();
virtual void SetSize(int theSize);
virtual void Render(vtkRenderer *theRenderer);
VTKViewer_UnScaledActor* ArrowActor;
};
-//****************************************************************
/*!This class provide support trihedron object in vtk viewer.*/
class VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject
{
static VTKViewer_Trihedron *New();
/*!Sets size of trihedron.
- * \param theSize - float value
+ * \param theSize - vtkFloatingPointType value
*/
- virtual void SetSize(float theSize);
+ virtual void SetSize(vtkFloatingPointType theSize);
/*! Get size of trihedron.
- * \retval mySize - float value
+ * \retval mySize - vtkFloatingPointType value
*/
- virtual float GetSize() { return mySize;}
+ virtual vtkFloatingPointType GetSize() { return mySize;}
enum TVisibility{eOff, eOn, eOnlyLineOn};
VTKViewer_Axis* myAxis[3];
/*! Common size for trihedron, for each axis.*/
- float mySize;
+ vtkFloatingPointType mySize;
};
-//****************************************************************
/*!The base class for concreate Axis.
* Its only duty is to give correct initialization and destruction
* of its pipe-lines
/*! Set size of VTKViewer_Axis
*/
- virtual void SetSize(float theSize);
+ virtual void SetSize(vtkFloatingPointType theSize);
/*! Get label actor.
* \retval Return myLabelActor.
/*! \var myRot[3]
* Orientation vector
*/
- float myDir[3], myRot[3];
+ vtkFloatingPointType myDir[3], myRot[3];
/*! VTKViewer_LineActor actor pointer
*/
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#include "VTKViewer_Utilities.h"
#include "VTKViewer_Actor.h"
+#include <algorithm>
+
// VTK Includes
#include <vtkMath.h>
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
-#include "VTKViewer_Utilities.h"
+using namespace std;
-/*!@see vtkRenderer::ResetCamera(float bounds[6]) method*/
-void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint)
+/*!@see vtkRenderer::ResetCamera(vtkFloatingPointType bounds[6]) method*/
+void
+ResetCamera(vtkRenderer* theRenderer,
+ int theUsingZeroFocalPoint)
{
- if(!theRenderer) return;
- float bounds[6];
- int aCount = ComputeVisiblePropBounds(theRenderer,bounds);
+ if(!theRenderer)
+ return;
+
+ vtkCamera* aCamera = theRenderer->GetActiveCamera();
+ if(!aCamera)
+ return;
+
+ vtkFloatingPointType aBounds[6];
+ int aCount = ComputeVisiblePropBounds(theRenderer,aBounds);
+
if(theUsingZeroFocalPoint || aCount){
- float aLength = bounds[1]-bounds[0];
- aLength = max((bounds[3]-bounds[2]),aLength);
- aLength = max((bounds[5]-bounds[4]),aLength);
+ static vtkFloatingPointType MIN_DISTANCE = 1.0 / VTK_LARGE_FLOAT;
+
+ vtkFloatingPointType aLength = aBounds[1]-aBounds[0];
+ aLength = max((aBounds[3]-aBounds[2]),aLength);
+ aLength = max((aBounds[5]-aBounds[4]),aLength);
- double vn[3];
- if ( theRenderer->GetActiveCamera() != NULL )
- theRenderer->GetActiveCamera()->GetViewPlaneNormal(vn);
- else{
+ if(aLength < MIN_DISTANCE)
return;
- }
+
+ vtkFloatingPointType aWidth =
+ sqrt((aBounds[1]-aBounds[0])*(aBounds[1]-aBounds[0]) +
+ (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
+ (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
+
+ if(aWidth < MIN_DISTANCE)
+ return;
+
+ vtkFloatingPointType aViewPlaneNormal[3];
+ aCamera->GetViewPlaneNormal(aViewPlaneNormal);
- float center[3] = {0.0, 0.0, 0.0};
+ vtkFloatingPointType aCenter[3] = {0.0, 0.0, 0.0};
if(!theUsingZeroFocalPoint){
- center[0] = (bounds[0] + bounds[1])/2.0;
- center[1] = (bounds[2] + bounds[3])/2.0;
- center[2] = (bounds[4] + bounds[5])/2.0;
+ aCenter[0] = (aBounds[0] + aBounds[1])/2.0;
+ aCenter[1] = (aBounds[2] + aBounds[3])/2.0;
+ aCenter[2] = (aBounds[4] + aBounds[5])/2.0;
}
- theRenderer->GetActiveCamera()->SetFocalPoint(center[0],center[1],center[2]);
-
- float width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
- (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
- (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
+ aCamera->SetFocalPoint(aCenter[0],aCenter[1],aCenter[2]);
- double ang = theRenderer->GetActiveCamera()->GetViewAngle();
- float distance = 2.0*width/tan(ang*vtkMath::Pi()/360.0);
+ vtkFloatingPointType aViewAngle = aCamera->GetViewAngle();
+ vtkFloatingPointType aDistance = 2.0*aWidth/tan(aViewAngle*vtkMath::Pi()/360.0);
// check view-up vector against view plane normal
- double *vup = theRenderer->GetActiveCamera()->GetViewUp();
- if ( fabs(vtkMath::Dot(vup,vn)) > 0.999 ){
- theRenderer->GetActiveCamera()->SetViewUp(-vup[2], vup[0], vup[1]);
- }
+ vtkFloatingPointType aViewUp[3];
+ aCamera->GetViewUp(aViewUp);
+ if(fabs(vtkMath::Dot(aViewUp,aViewPlaneNormal)) > 0.999)
+ aCamera->SetViewUp(-aViewUp[2], aViewUp[0], aViewUp[1]);
// update the camera
- theRenderer->GetActiveCamera()->SetPosition(center[0]+distance*vn[0],
- center[1]+distance*vn[1],
- center[2]+distance*vn[2]);
+ aCamera->SetPosition(aCenter[0]+aDistance*aViewPlaneNormal[0],
+ aCenter[1]+aDistance*aViewPlaneNormal[1],
+ aCenter[2]+aDistance*aViewPlaneNormal[2]);
+
// find size of the window
- int* winsize = theRenderer->GetSize();
- if(winsize[0] < winsize[1]) width *= float(winsize[1])/float(winsize[0]);
+ int* aWinSize = theRenderer->GetSize();
+ if(aWinSize[0] < aWinSize[1])
+ aWidth *= vtkFloatingPointType(aWinSize[1])/vtkFloatingPointType(aWinSize[0]);
- if(theUsingZeroFocalPoint) width *= sqrt(2.0);
+ if(theUsingZeroFocalPoint)
+ aWidth *= sqrt(2.0);
- theRenderer->GetActiveCamera()->SetParallelScale(width/2.0);
+ aCamera->SetParallelScale(aWidth/2.0);
}
- //workaround on VTK
- //theRenderer->ResetCameraClippingRange(bounds);
+
ResetCameraClippingRange(theRenderer);
}
/*! Compute the bounds of the visible props*/
-int ComputeVisiblePropBounds(vtkRenderer* theRenderer, float theBounds[6])
+int
+ComputeVisiblePropBounds(vtkRenderer* theRenderer,
+ vtkFloatingPointType theBounds[6])
{
- float *bounds;
- int aCount=0;
+ int aCount = 0;
theBounds[0] = theBounds[2] = theBounds[4] = VTK_LARGE_FLOAT;
theBounds[1] = theBounds[3] = theBounds[5] = -VTK_LARGE_FLOAT;
// loop through all props
vtkActorCollection* aCollection = theRenderer->GetActors();
aCollection->InitTraversal();
- while (vtkActor* prop = aCollection->GetNextActor()) {
+ while (vtkActor* aProp = aCollection->GetNextActor()) {
// if it's invisible, or has no geometry, we can skip the rest
- if ( prop->GetVisibility() )
- {
- if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(prop))
- if(anActor->IsInfinitive()) continue;
- bounds = prop->GetBounds();
- // make sure we haven't got bogus bounds
- if ( bounds != NULL &&
- bounds[0] > -VTK_LARGE_FLOAT && bounds[1] < VTK_LARGE_FLOAT &&
- bounds[2] > -VTK_LARGE_FLOAT && bounds[3] < VTK_LARGE_FLOAT &&
- bounds[4] > -VTK_LARGE_FLOAT && bounds[5] < VTK_LARGE_FLOAT )
- {
- aCount++;
-
- if (bounds[0] < theBounds[0])
- {
- theBounds[0] = bounds[0];
- }
- if (bounds[1] > theBounds[1])
- {
- theBounds[1] = bounds[1];
- }
- if (bounds[2] < theBounds[2])
- {
- theBounds[2] = bounds[2];
- }
- if (bounds[3] > theBounds[3])
- {
- theBounds[3] = bounds[3];
- }
- if (bounds[4] < theBounds[4])
- {
- theBounds[4] = bounds[4];
- }
- if (bounds[5] > theBounds[5])
- {
- theBounds[5] = bounds[5];
- }
- }//not bogus
+ if(aProp->GetVisibility() && aProp->GetMapper()){
+ if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(aProp))
+ if(anActor->IsInfinitive())
+ continue;
+
+ vtkFloatingPointType *aBounds = aProp->GetBounds();
+ static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT;
+ // make sure we haven't got bogus bounds
+ if ( aBounds != NULL &&
+ aBounds[0] > -MAX_DISTANCE && aBounds[1] < MAX_DISTANCE &&
+ aBounds[2] > -MAX_DISTANCE && aBounds[3] < MAX_DISTANCE &&
+ aBounds[4] > -MAX_DISTANCE && aBounds[5] < MAX_DISTANCE )
+ {
+ aCount++;
+
+ theBounds[0] = min(aBounds[0],theBounds[0]);
+ theBounds[2] = min(aBounds[2],theBounds[2]);
+ theBounds[4] = min(aBounds[4],theBounds[4]);
+
+ theBounds[1] = max(aBounds[1],theBounds[1]);
+ theBounds[3] = max(aBounds[3],theBounds[3]);
+ theBounds[5] = max(aBounds[5],theBounds[5]);
+
+ }//not bogus
}
}
return aCount;
}
-/*!@see vtkRenderer::ResetCameraClippingRange(float bounds[6]) method*/
-void ResetCameraClippingRange(vtkRenderer* theRenderer)
+/*!@see vtkRenderer::ResetCameraClippingRange(vtkFloatingPointType bounds[6]) method*/
+void
+ResetCameraClippingRange(vtkRenderer* theRenderer)
{
if(!theRenderer || !theRenderer->VisibleActorCount()) return;
}
// Find the plane equation for the camera view plane
- double vn[3];
+ vtkFloatingPointType vn[3];
anActiveCamera->GetViewPlaneNormal(vn);
- double position[3];
+ vtkFloatingPointType position[3];
anActiveCamera->GetPosition(position);
- float bounds[6];
+ vtkFloatingPointType bounds[6];
theRenderer->ComputeVisiblePropBounds(bounds);
- double center[3];
+ vtkFloatingPointType center[3];
center[0] = (bounds[0] + bounds[1])/2.0;
center[1] = (bounds[2] + bounds[3])/2.0;
center[2] = (bounds[4] + bounds[5])/2.0;
- double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
+ vtkFloatingPointType width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
(bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
(bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
- double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
+ vtkFloatingPointType distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
(position[1]-center[1])*(position[1]-center[1]) +
(position[2]-center[2])*(position[2]-center[2]));
- float range[2] = {distance - width/2.0, distance + width/2.0};
+ vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0};
// Do not let the range behind the camera throw off the calculation.
if (range[0] < 0.0) range[0] = 0.0;
}
/*!Compute trihedron size.*/
-bool ComputeTrihedronSize( vtkRenderer* theRenderer,double& theNewSize,
- const double theSize, const float theSizeInPercents )
+bool
+ComputeTrihedronSize( vtkRenderer* theRenderer,
+ vtkFloatingPointType& theNewSize,
+ const vtkFloatingPointType theSize,
+ const vtkFloatingPointType theSizeInPercents )
{
// calculating diagonal of visible props of the renderer
- float bnd[ 6 ];
+ vtkFloatingPointType bnd[ 6 ];
if ( ComputeVisiblePropBounds( theRenderer, bnd ) == 0 )
{
bnd[ 1 ] = bnd[ 3 ] = bnd[ 5 ] = 100;
bnd[ 0 ] = bnd[ 2 ] = bnd[ 4 ] = 0;
}
- float aLength = 0;
+ vtkFloatingPointType aLength = 0;
aLength = bnd[ 1 ]-bnd[ 0 ];
aLength = max( ( bnd[ 3 ] - bnd[ 2 ] ),aLength );
aLength = max( ( bnd[ 5 ] - bnd[ 4 ] ),aLength );
- static float EPS_SIZE = 5.0E-3;
+ static vtkFloatingPointType EPS_SIZE = 5.0E-3;
theNewSize = aLength * theSizeInPercents / 100.0;
// if the new trihedron size have sufficient difference, then apply the value
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_UTILITIES_H
#define VTKVIEWER_UTILITIES_H
-#include <VTKViewer.h>
+#include "VTKViewer.h"
class vtkRenderer;
-VTKVIEWER_EXPORT extern void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint = false);
-VTKVIEWER_EXPORT extern int ComputeVisiblePropBounds(vtkRenderer* theRenderer, float theBounds[6]);
-VTKVIEWER_EXPORT extern void ResetCameraClippingRange(vtkRenderer* theRenderer);
-VTKVIEWER_EXPORT extern bool ComputeTrihedronSize(vtkRenderer* theRenderer, double& theNewSize,
- const double theSize, const float theSizeInPercents);
+VTKVIEWER_EXPORT
+extern
+void
+ResetCamera(vtkRenderer* theRenderer,
+ int theUsingZeroFocalPoint = false);
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
+VTKVIEWER_EXPORT
+extern
+int
+ComputeVisiblePropBounds(vtkRenderer* theRenderer,
+ vtkFloatingPointType theBounds[6]);
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#endif
+VTKVIEWER_EXPORT
+extern
+void
+ResetCameraClippingRange(vtkRenderer* theRenderer);
+VTKVIEWER_EXPORT
+extern
+bool
+ComputeTrihedronSize(vtkRenderer* theRenderer,
+ vtkFloatingPointType& theNewSize,
+ const vtkFloatingPointType theSize,
+ const vtkFloatingPointType theSizeInPercents);
#endif
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
/*=========================================================================
newPolys->Delete();
}
+/*!
+ Print text to stream
+ \param os - stream
+ \param indent
+*/
void VTKViewer_VectorText::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
/*=========================================================================
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "VTKViewer_ViewManager.h"
#include "VTKViewer_ViewModel.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_VIEWMANAGER_H
#define VTKVIEWER_VIEWMANAGER_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "VTKViewer_ViewModel.h"
#include "VTKViewer_ViewWindow.h"
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_VIEWMODEL_H
#define VTKVIEWER_VIEWMODEL_H
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "VTKViewer_ViewWindow.h"
#include "VTKViewer_ViewModel.h"
::ResetCamera(myRenderer,true);
if(aTriedronIsVisible) myTrihedron->VisibilityOn();
else myTrihedron->VisibilityOff();
- static float aCoeff = 3.0;
+ static vtkFloatingPointType aCoeff = 3.0;
aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
Repaint();
}
/*!Returns background of the viewport*/
QColor VTKViewer_ViewWindow::backgroundColor() const
{
- float backint[3];
+ vtkFloatingPointType backint[3];
if ( myRenderer ) {
myRenderer->GetBackground( backint );
return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255));
int aVisibleNum = myTrihedron->GetVisibleActorCount(myRenderer);
if(aVisibleNum){
// calculating diagonal of visible props of the renderer
- float bnd[6];
+ vtkFloatingPointType bnd[6];
myTrihedron->VisibilityOff();
::ComputeVisiblePropBounds(myRenderer,bnd);
myTrihedron->VisibilityOn();
- float aLength = 0;
+ vtkFloatingPointType aLength = 0;
static bool CalcByDiag = false;
if(CalcByDiag){
aLength = sqrt((bnd[1]-bnd[0])*(bnd[1]-bnd[0])+
aLength = max((bnd[5]-bnd[4]),aLength);
}
- static float aSizeInPercents = 105;
+ static vtkFloatingPointType aSizeInPercents = 105;
QString aSetting;// = SUIT_CONFIG->getSetting("Viewer:TrihedronSize");
if(!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat();
- static float EPS_SIZE = 5.0E-3;
- float aSize = myTrihedron->GetSize();
- float aNewSize = aLength*aSizeInPercents/100.0;
+ static vtkFloatingPointType EPS_SIZE = 5.0E-3;
+ vtkFloatingPointType aSize = myTrihedron->GetSize();
+ vtkFloatingPointType aNewSize = aLength*aSizeInPercents/100.0;
// if the new trihedron size have sufficient difference, then apply the value
if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE){
myTrihedron->SetSize(aNewSize);
QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
return px.convertToImage();
}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString VTKViewer_ViewWindow::getVisualParameters()
+{
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->GetPosition( pos );
+ camera->GetFocalPoint( focalPnt );
+ camera->GetViewUp( viewUp );
+ parScale = camera->GetParallelScale();
+ GetScale( scale );
+
+ QString retStr;
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e",
+ pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1],
+ viewUp[2], parScale, scale[0], scale[1], scale[2] );
+ return retStr;
+}
+
+/*! The method restors visual parameters of this view from a formated string
+ */
+void VTKViewer_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 13 ) {
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+ pos[0] = paramsLst[0].toDouble();
+ pos[1] = paramsLst[1].toDouble();
+ pos[2] = paramsLst[2].toDouble();
+ focalPnt[0] = paramsLst[3].toDouble();
+ focalPnt[1] = paramsLst[4].toDouble();
+ focalPnt[2] = paramsLst[5].toDouble();
+ viewUp[0] = paramsLst[6].toDouble();
+ viewUp[1] = paramsLst[7].toDouble();
+ viewUp[2] = paramsLst[8].toDouble();
+ parScale = paramsLst[9].toDouble();
+ scale[0] = paramsLst[10].toDouble();
+ scale[1] = paramsLst[11].toDouble();
+ scale[2] = paramsLst[12].toDouble();
+
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition( pos );
+ camera->SetFocalPoint( focalPnt );
+ camera->SetViewUp( viewUp );
+ camera->SetParallelScale( parScale );
+ myTransform->SetMatrixScale( scale[0], scale[1], scale[2] );
+ myRWInteractor->Render();
+ }
+}
// 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.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef VTKVIEWER_VIEWWINDOW_H
#define VTKVIEWER_VIEWWINDOW_H
void AddActor( VTKViewer_Actor*, bool update = false );
void RemoveActor( VTKViewer_Actor*, bool update = false);
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
+
public slots:
void onFrontView();
void onBackView();
+++ /dev/null
-# VISU VISUGUI : GUI of VISU 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 :
-# Module :
-
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
-"PO-Revision-Date: 2005-05-10 15:20+0400\n"
-"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-
-msgid "ICON_SVTK_SCALING"
-msgstr "view_scaling.png"
-
-msgid "ICON_GRADUATED_AXES"
-msgstr "view_graduated_axes.png"
+++ /dev/null
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2002-02-22 16:56:46 CET\n"
-"PO-Revision-Date: 2005-06-27 12:38+0400\n"
-"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-
-#: SVTK_NonIsometricDlg.cxx
-
-msgid "SVTK_NonIsometricDlg::MEN_SCALING"
-msgstr "Scaling"
-
-msgid "SVTK_NonIsometricDlg::O&K"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::&Apply"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::&Cancel"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::&Reset"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::DLG_TITLE"
-msgstr "Scaling"
-
-msgid "SVTK_NonIsometricDlg::LBL_X"
-msgstr "X :"
-
-msgid "SVTK_NonIsometricDlg::LBL_Y"
-msgstr "Y :"
-
-msgid "SVTK_NonIsometricDlg::LBL_Z"
-msgstr "Z :"
-
-msgid "SVTK_MainWindow::MNU_SVTK_SCALING"
-msgstr "Scaling"
-
-msgid "SVTK_MainWindow::DSC_SVTK_SCALING"
-msgstr "Scaling"
-
-msgid "SVTK_FontWidget::ARIAL"
-msgstr "Arial"
-
-msgid "SVTK_FontWidget::COURIER"
-msgstr "Courier"
-
-msgid "SVTK_FontWidget::TIMES"
-msgstr "Times"
-
-msgid "SVTK_FontWidget::BOLD"
-msgstr "Bold"
-
-msgid "SVTK_FontWidget::ITALIC"
-msgstr "Italic"
-
-msgid "SVTK_FontWidget::SHADOW"
-msgstr "Shadow"
-
-msgid "SVTK_CubeAxesDlg::CAPTION"
-msgstr "Graduated axes"
-
-msgid "SVTK_CubeAxesDlg::X_AXIS"
-msgstr "X axis"
-
-msgid "SVTK_CubeAxesDlg::Y_AXIS"
-msgstr "Y axis"
-
-msgid "SVTK_CubeAxesDlg::Z_AXIS"
-msgstr "Z axis"
-
-msgid "SVTK_CubeAxesDlg::IS_VISIBLE"
-msgstr "Is visible"
-
-msgid "SVTK_AxisWidget::AXIS_NAME"
-msgstr "Axis name"
-
-msgid "SVTK_AxisWidget::IS_VISIBLE"
-msgstr "Is visible"
-
-msgid "SVTK_AxisWidget::NAME"
-msgstr "Name"
-
-msgid "SVTK_AxisWidget::FONT"
-msgstr "Font"
-
-msgid "SVTK_AxisWidget::LABELS"
-msgstr "Labels"
-
-msgid "SVTK_AxisWidget::NUMBER"
-msgstr "Number"
-
-msgid "SVTK_AxisWidget::OFFSET"
-msgstr "Offset"
-
-msgid "SVTK_AxisWidget::TICK_MARKS"
-msgstr "Tick marks"
-
-msgid "SVTK_AxisWidget::LENGTH"
-msgstr "Length"
-
-msgid "SVTK_MainWindow::MNU_SVTK_GRADUATED_AXES"
-msgstr "Graduated axes"
-
-msgid "SVTK_MainWindow::DSC_SVTK_GRADUATED_AXES"
-msgstr "Graduated axes"
\ No newline at end of file
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#
#
msgid "ERROR"
msgstr "Error"
-msgid "BUT_OK"
-msgstr "Ok"
-
msgid "VTKViewer_Viewer::MEN_DUMP_VIEW"
msgstr "Dump view..."