salomeinclude_DATA = GUI_version.h
EXTRA_DIST += \
+ build_cmake \
+ build_cmake.bat \
build_configure \
clean_configure \
LICENCE
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = subdirs
-CONFIG += ordered
-
-SUBDIRS = src
ENDFOREACH(dir ${VTK_INCLUDE_DIRS})
SET(VTK_LIBS)
-FIND_LIBRARY(VTK_COMMON vtkCommon ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_COMMON vtkCommon PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_COMMON})
-FIND_LIBRARY(VTK_GRAPHICS vtkGraphics ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_GRAPHICS vtkGraphics PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_GRAPHICS})
-FIND_LIBRARY(VTK_IMAGING vtkImaging ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_IMAGING vtkImaging PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_IMAGING})
-FIND_LIBRARY(VTK_FILTERING vtkFiltering ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_FILTERING vtkFiltering PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_FILTERING})
-FIND_LIBRARY(VTK_IO vtkIO ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_IO vtkIO PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_IO})
-FIND_LIBRARY(VTK_RENDERING vtkRendering ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_RENDERING vtkRendering PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_RENDERING})
-FIND_LIBRARY(VTK_HYBRID vtkHybrid ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_HYBRID vtkHybrid PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_HYBRID})
-FIND_LIBRARY(VTK_PARALLEL vtkParallel ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_PARALLEL vtkParallel PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_PARALLEL})
-FIND_LIBRARY(VTK_WIDGETS vtkWidgets ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(VTK_WIDGETS vtkWidgets PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
SET(VTK_LIBS ${VTK_LIBS} ${VTK_WIDGETS})
+FIND_LIBRARY(VTK_GENERIC_FILTERING vtkGenericFiltering PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+SET(VTK_LIBS ${VTK_LIBS} ${VTK_GENERIC_FILTERING})
+FIND_LIBRARY(VTK_INFOVIS vtkInfovis PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+SET(VTK_LIBS ${VTK_LIBS} ${VTK_INFOVIS})
+FIND_LIBRARY(VTK_VOLUME_RENDERING vtkVolumeRendering PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+SET(VTK_LIBS ${VTK_LIBS} ${VTK_VOLUME_RENDERING})
-FIND_LIBRARY(vtkCommonPythonD vtkCommonPythonD ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
-FIND_LIBRARY(vtkGraphicsPythonD vtkGraphicsPythonD ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
-FIND_LIBRARY(vtkImagingPythonD vtkImagingPythonD ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
-FIND_LIBRARY(vtkPythonCore vtkPythonCore ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(vtkCommonPythonD vtkCommonPythonD PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(vtkGraphicsPythonD vtkGraphicsPythonD PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(vtkImagingPythonD vtkImagingPythonD PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
+FIND_LIBRARY(vtkPythonCore vtkPythonCore PATHS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
#IF(NOT WINDOWS)
check_SupervGraphViewer.m4 \
check_VTKViewer.m4 \
check_QxGraphViewer.m4 \
-check_TestRecorder.m4
+check_TestRecorder.m4 \
+check_salome_version.m4
AC_MSG_RESULT([Try $withval as pyuic4 executable])
])
+AC_ARG_WITH(pyrcc4,
+ [ --with-pyrcc4=EXEC pyrcc4 executable ],
+ [PYRCC="$withval"
+ AC_MSG_RESULT([Try $withval as pyrcc4 executable])
+ ])
+
AC_CHECKING(for pyqt)
pyqt_ok=no
+TEST_BIN_DIRS=""
+if test "x${PYQTDIR}" != "x" ; then
+ TEST_BIN_DIRS="${TEST_BIN_DIRS} ${PYQTDIR} ${PYQTDIR}/bin"
+fi
+TEST_BIN_DIRS="${TEST_BIN_DIRS} __CHECK__PATH__"
+if test "x${SIPDIR}" != "x" ; then
+ TEST_BIN_DIRS="${TEST_BIN_DIRS} ${SIPDIR} ${SIPDIR}/bin"
+fi
+if test "x${PYTHONHOME}" != "x" ; then
+ TEST_BIN_DIRS="${TEST_BIN_DIRS} ${PYTHONHOME}/bin"
+fi
+TEST_BIN_DIRS="${TEST_BIN_DIRS} /usr/bin"
+
dnl check pyuic4
if test "x$PYUIC" != "x" ; then
dnl try $withval value
AC_CHECK_FILE($PYUIC,pyqt_ok=yes,pyqt_ok=no)
else
- TEST_BIN_DIRS=""
- if test "x${PYQTDIR}" != "x" ; then
- TEST_BIN_DIRS="${TEST_BIN_DIRS} ${PYQTDIR} ${PYQTDIR}/bin"
- fi
- TEST_BIN_DIRS="${TEST_BIN_DIRS} __CHECK__PATH__"
- if test "x${SIPDIR}" != "x" ; then
- TEST_BIN_DIRS="${TEST_BIN_DIRS} ${SIPDIR} ${SIPDIR}/bin"
- fi
- if test "x${PYTHONHOME}" != "x" ; then
- TEST_BIN_DIRS="${TEST_BIN_DIRS} ${PYTHONHOME}/bin"
- fi
- TEST_BIN_DIRS="${TEST_BIN_DIRS} /usr/bin"
-
dnl search pyuic4
pyqt_ok=no
for d in ${TEST_BIN_DIRS} ; do
AC_MSG_RESULT(Warning! pyuic4 is not found!)
fi
+dnl check pyrcc4
+if test "x$PYRCC" != "x" ; then
+ dnl try $withval value
+ AC_CHECK_FILE($PYRCC,pyqt_ok=yes,pyqt_ok=no)
+else
+ dnl search pyrcc4
+ pyqt_ok=no
+ for d in ${TEST_BIN_DIRS} ; do
+ if test "x${d}" = "x__CHECK__PATH__" ; then
+ AC_PATH_PROG(TEMP, pyrcc4)
+ if test "x${TEMP}" != "x" ; then
+ PYRCC=${TEMP}
+ if test "x$PYQTDIR" = "x" ; then
+ PYQTDIR=`dirname ${PYRCC}`
+ PYQTDIR=`dirname ${PYQTDIR}`
+ fi
+ pyqt_ok=yes
+ break
+ fi
+ else
+ if test -d $d ; then
+ AC_CHECK_FILE(${d}/pyrcc4,pyqt_ok=yes,pyqt_ok=no)
+ if test "x$pyqt_ok" == "xyes" ; then
+ PYRCC=${d}/pyrcc4
+ break
+ fi
+ fi
+ fi
+ done
+fi
+
if test "x$pyqt_ok" == "xyes" ; then
TESTLIBFILE=QtCore.so
TESTSIPFILE=QtCore/QtCoremod.sip
AC_SUBST(PYQT_LIBS)
AC_SUBST(PYQT_SIPS)
AC_SUBST(PYUIC)
+AC_SUBST(PYRCC)
AC_SUBST(PYQT_SIPFLAGS)
dnl AC_LANG_RESTORE
QT_INCLUDES="$QT_BASE $QTCORE_CPPFLAGS $QTGUI_CPPFLAGS $QTOPENGL_CPPFLAGS $QTXML_CPPFLAGS $QTWEBKIT_CPPFLAGS"
- QT_ASSISANT_INCLUDES="$QTASSISTANT_CPPFLAGS $QTNETWORK_CPPFLAGS"
+ QT_ASSISTANT_INCLUDES="$QTASSISTANT_CPPFLAGS $QTNETWORK_CPPFLAGS"
QT_MT_INCLUDES="${QT_INCLUDES}"
fi
fi
--- /dev/null
+dnl Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+# Check SALOME version
+#
+
+AC_DEFUN([CHECK_SALOME_VERSION],[
+AC_REQUIRE([AC_LINKER_OPTIONS])dnl
+
+AC_CHECKING(for salome version)
+
+salome_version_ok=no
+SALOME_VERSION=""
+
+salomeVersionFile=${GUI_ROOT_DIR}/include/salome/GUI_version.h
+SALOME_VERSION=$(grep GUI_VERSION_STR ${salomeVersionFile} | cut -d'"' -f2 | cut -d"." -f1)
+
+if test "x${SALOME_VERSION}" = "x" ; then
+ AC_MSG_WARN("Cannot determine the SALOME version. GUI module is required. Specify the variable GUI_ROOT_DIR")
+else
+ salome_version_ok=yes
+ AC_MSG_RESULT(Using salome version ${SALOME_VERSION})
+fi
+
+AC_SUBST(SALOME_VERSION)
+AC_MSG_RESULT(for salome version: $salome_version_ok)
+
+])dnl
+
# Directory for installing resource files
salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@
+# Directory for installing plugins files
+salomepluginsdir = $(prefix)/share/salome/plugins/@MODULE_NAME@
+
# Directories for installing admin files
admlocaldir = $(prefix)/adm_local
admlocalunixdir = $(admlocaldir)/unix
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-#=======================================================================
-# This section of this makefile comes from the file
-# 'adm/unix/make_conclude' which was generated with config.status
-# from file adm/unix/make_conclude.in
-#=======================================================================
-# -* Makefile *-
-# Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
-# Date : 6/07/2001
-# $Header$
-#
-ifneq ($(GUI_DISABLE_CORBA),yes)
-# ORB Specifics rules
-
-@CORBA@
-
-# transform idl reference in appropriate obj file
-LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
-LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
-else
-LIB_CLIENT_SRC =
-LIB_SERVER_SRC =
-LIB_SWIG_SRC =
-endif
-
-LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx)
-LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx)
-LIB_SRC+=$(LIB_MOC_SRC)
-LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC)
-
-LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo)
-
-ifneq ($(GUI_DISABLE_CORBA),yes)
-LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
-LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
-else
-LIB_CLIENT_OBJ =
-LIB_SERVER_OBJ =
-endif
-
-# transform c file in appropriate libtool obj file (.c, .cc and .cxx)
-LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC)))
-LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC)))
-LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC)))
-LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC)))
-
-# all libtool obj file in library
-LIB_OBJ = $(LIB_OBJ_CXX) $(LIB_OBJ_CC) $(LIB_OBJ_C) $(LIB_CLIENT_OBJ:%.o=%.lo) $(LIB_SERVER_OBJ:%.o=%.lo) $(LIB_SWIG_OBJ) $(LIB_OBJ_F)
-
-# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la)
-LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la, $(filter %.la, $(LIB)))
-LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a, $(filter %.a, $(LIB)))
-LIB_BUILD_SO = $(patsubst %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.so, $(filter %.so, $(LIB)))
-
-ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
-LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
-else
-LIB_SWIG =
-endif
-
-lib: $(LIB_BUILD) $(LIB_BUILD_SO) $(LIB_CLIENT_PY)
-# we don't build static library !
-
-$(LIB_BUILD): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la: %.la
- -$(RM) $@
- -$(RM) $(patsubst %.la, %.so, $@)
- -$(RM) $(patsubst %.la, %.a, $@)
- ln -sf $(CURDIR)/$< $@ || true
- ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \
- $(patsubst %.la, %.so, $@) || true
- ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \
- $(patsubst %.la, %.so, $@).0 || true
-
- if ! test -z $(LIB_SWIG) ; then \
- ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/_$(LIB_SWIG) || true;\
- fi;
-
-$(LIB_BUILD_A): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a: %.a
- -$(RM) $@
- ln -sf $(CURDIR)/$< $@ || true
-
-$(LIB_BUILD_SO): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.so: %.so
- -$(RM) $@
- ln -sf $(CURDIR)/$< $@ || true
-
-$(LIB): $(LIB_OBJ)
- @$(LT) --mode=link $(CXX) -shared -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
-
-# transform idl reference in appropriate obj file
-ifneq ($(GUI_DISABLE_CORBA),yes)
-BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
-BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
-else
-BIN_CLIENT_SRC =
-BIN_SERVER_SRC =
-endif
-BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx)
-BIN_SRC+=$(BIN_MOC_SRC)
-BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
-
-ifneq ($(GUI_DISABLE_CORBA),yes)
-BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
-BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
-else
-BIN_CLIENT_OBJ =
-BIN_SERVER_OBJ =
-endif
-# transform c file in appropriate libtool obj file (.c)
-BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC)))
-# transform c++ file in appropriate libtool obj file (.cc and .cxx)
-BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC)))
-BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC)))
-# all obj file in bin target
-BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ)
-
-bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
-
-BIN_LIB=$(LIB:lib%.la=-l%)
-
-$(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
- -$(RM) $@
- ln -sf $(CURDIR)/$< $@
-
-$(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
-
-# copy python scripts in $(top_builddir)/bin/salome
-#
-
-UI_FILES = $(notdir $(wildcard $(srcdir)/*.ui))
-UI_PY_FILES_PY = $(patsubst %.ui, %.py, $(UI_FILES))
-UI_PY_FILES = $(filter-out $(EXPORT_PYSCRIPTS) ,$(UI_PY_FILES_PY))
-
-DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
-DEST_UI_PY_FILES = $(UI_PY_FILES:%=$(top_builddir)/bin/salome/%)
-pyscripts: $(DEST_PYSCRIPTS) $(UI_PY_FILES) $(DEST_UI_PY_FILES)
-$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
- cp -f $< $@
-
-# generate generic python scripts from *.ui files
-#
-$(UI_PY_FILES): %.py: %.ui
- $(PYUIC) $< -o $@
-
-# copy ui-generated python scripts in $(top_builddir)/bin
-#
-$(DEST_UI_PY_FILES): $(top_builddir)/bin/salome/%: %
- cp -f $< $@
-
-# copy pyqt files in $(PYTHON_SHARED_SITE)
-#
-PYTHON_SHARED_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
-
-$(PYTHON_SHARED_SITE):
- $(INSTALL) -d $@
-
-DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
-sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
-$(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
- cp -f $< $@
-
-check: test
-
-tests: unittest
-
-test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%)
-
-unittest:
- @if test "x$(UNIT_TEST_PROG)" != "x"; then \
- $(top_builddir)/bin/salome/$(UNIT_TEST_PROG); \
- fi;
-
-# copy header file in $(inc_builddir)
-#
-DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
-inc: $(DEST_HEADERS)
-$(DEST_HEADERS): $(inc_builddir)/%: %
- cp -f $< $@
-
-# build resources file (icons and messages) : .qm file from .po file
-RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*))
-RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL))
-RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL))
-RESOURCES_FILES_ALL := $(filter-out %.in, $(RESOURCES_FILES_ALL))
-RESOURCES_FILES ?= $(RESOURCES_FILES_ALL)
-
-resources: resources-po resources-cp
-
-resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
-
-resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%)
-
-$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%): $(top_builddir)/share/salome/resources/$(MODULE_NAME)/% : %
- cp -fr $< $@;
-
-# Make installation directories if they don't exist.
-$(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
- $(INSTALL) -d $@ && chmod 755 $@
-
-# Install the library, the public header files, and programs.
-install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm install-res
- @for f in X $(LIB); do \
- if test $$f != X; then \
- ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \
- fi; \
- done
- @if ! test -z $(LIB_SWIG) ; then \
- (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \
- fi;
- @for f in X $(BIN); do \
- if test $$f != X; then \
- ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
- fi; \
- done
-# Install tests programmes in bindir
- @for f in X $(TEST_PROGS); do \
- if test $$f != X; then \
- ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
- fi; \
- done
-# Install exported includes in includedir
- @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \
- if test $$f != X; then \
- (cp -p -f $$f $(includedir) || exit 1); \
- fi; \
- done
-
-# Install python script in $(bindir)
-install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) $(UI_PY_FILES:%=install-%)
-
-$(UI_PY_FILES:%=install-%): install-%: %
- $(INSTALL_PROGRAM) $< $(bindir)/.
-
-$(EXPORT_PYSCRIPTS:%=install-%): install-%: %
- $(INSTALL_PROGRAM) $< $(bindir)/.
-
-#install-python: $(bindir) $(EXPORT_PYSCRIPTS)
-# @for f in X $(EXPORT_PYSCRIPTS); do \
-# if test $$f != X; then \
-# ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \
-# fi; \
-# done
-
-# Install pyqt script in $(install-sharedpyqt)
-install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%)
-
-$(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
- $(INSTALL_PROGRAM) $< $(sharedpydir)/.
-
-
-# generic rule to install .qm files :
-install-qm: resources
- $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
- @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm); do \
- if test $$f != X; then \
- ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \
- fi; \
- done
-
-# generic rule to install resources files (png, ini ...):
-install-res: resources
- $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
- @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%); do \
- if test $$f != X; then \
- ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \
- fi; \
- done
-
-# Removes those things that `make install' (would have) installed.
-uninstall:
- @if test "X$(LIB)" != X; then \
- for f in $(LIB); do \
- $(LT_UNINSTALL) $(libdir)/$$f; \
- done; \
- fi
- @if test "X$(BIN)" != X; then \
- for f in $(BIN); do \
- $(LT_UNINSTALL) $(bindir)/$$f; \
- done; \
- fi
- @for f in X $(TEST_PROGS); do \
- if test $$f != X; then \
- $(LT_UNINSTALL) $(bindir)/$$f; \
- fi; \
- done
-# Uninstall exported includes in includedir
- @for f in X $(EXPORT_HEADERS); do \
- if test $$f != X; then \
- $(LT_UNINSTALL) $(includedir)/$$f; \
- fi; \
- done
-# Uninstall python script in $(bindir)
- @for f in X $(EXPORT_PYSCRIPTS); do \
- if test $$f != X; then \
- $(LT_UNINSTALL) $(bindir)/$$f ; \
- fi; \
- done
-
-# Uninstall python script in $(bindir)
- @for f in X $(UI_PY_FILES); do \
- if test $$f != X; then \
- $(LT_UNINSTALL) $(bindir)/$$f ; \
- fi; \
- done
-
-# Uninstall pyqt script in $(sharedpydir)
- @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
- if test $$f != X; then \
- $(LT_UNINSTALL) $(sharedpydir)/$$f ; \
- fi; \
- done
-
-# Uninstall qm files
- @for f in X $(PO_FILES:%.po=%.qm); do \
- if test $$f != X; then \
- $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ; \
- fi; \
- done
-
-# remove all dependencies files
-#
-cleandep:
- -$(RM) .dep*
-
-# Removes temporary files without removing the final target files. That is,
-# remove things like object files but not libraries or executables.
-#
-mostlyclean: cleandep
- -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o)
- -$(RM) $(BIN_OBJ) $(BIN:%=%.o)
- -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o)
- -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN)
-
-# Like `mostlyclean' except it also removes the final targets: things like
-# libraries and executables. This target doesn't remove any file that
-# is part of the SALOME distribution.
-#
-clean: mostlyclean
- -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
- -$(RM) TAGS *~ *# core *.core
- -$(RM) -r .libs
- -$(RM) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB)
- -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
- -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
- -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
-# remove idl generated files (sources)
- -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
-# remove idl generated files (headers)
- -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H))
- -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H))
- -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC)
- -$(RM) $(LIB_SWIG_SRC)
-
-# Like `clean' except it also removes files that were created by running
-# configure. If you've unpacked the source and built without creating
-# any other files, then `make distclean' will leave only the files that were
-# in the distribution.
-#
-distclean: clean
- #remove qm file !
- -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
- #remove include files
- -$(RM) $(DEST_HEADERS)
- -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep*
- @if test -f $(srcdir)/Makefile.in; then \
- (@SETX@; $(RM) Makefile); \
- fi
-
-
-#implicits rules
-.cc.o:
- $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
-
-.cc.lo:
- $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
-
-.cxx.o:
- $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
-
-.cxx.lo:
- $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
-
-.c.o:
- $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
-
-.c.lo:
- $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
-
-.f.o:
- $(FC) $(FFLAGS) -c $< -o $@
-
-.f.lo:
- $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
-
-.ui.h:
- $(UIC) -o $@ $<
-
-.ui.cxx:
- $(UIC) -o $@ -i $*.h $<
-
-#pattern rules
-%_moc.cxx : %.h
- $(MOC) $< -o $@
-
-%_wrap.cxx : %.i
- $(SWIG) $(SWIG_FLAGS) -o $@ $<
-
-$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm: %.po
- $(MSG2QM) $< $@ ; \
-
-#------------------------------------------------------------------------------
-# The following section of this makefile contains dependencies between the
-# source files and the header files. If GNU make and GCC are being used then
-# the dependencies are in the form of rules that cause the information to
-# be kept updated automatically. Otherwise the dependencies are listed
-# explicitly and come from the `.distdep' files in the various directories.
-# These files are part of the distribution and are generated automatically on
-# GNU/GCC systems.
-#------------------------------------------------------------------------------
-
-@DEPEND@
# start application
###
- SUITApp LightApp "$*" &
+ MODULES=`echo $MODULES | tr " " ","`
+ SUITApp LightApp --modules=${MODULES} "$*" &
}
###
#exit
# ==================== ON SORT AVANT
-find bin -name Makefile.in | xargs rm -f
-find doc -name Makefile.in | xargs rm -f
-find idl -name Makefile.in | xargs rm -f
-find resources -name Makefile.in | xargs rm -f
-find adm_local -name Makefile.in | xargs rm -f
-find src -name Makefile.in | xargs rm -f
-rm -f Makefile.in
-cd adm_local/unix/config_files
-rm -f config.* depcomp install-sh l*.m4 ltmain.sh missing py-compile
+find . -name Makefile.in | xargs rm -f
+( cd adm_local/unix/config_files && rm -f config.* depcomp install-sh l*.m4 ltmain.sh missing py-compile )
# Modified by : Marc Tajchman (CEA)
# Modified by : Mikhail PONIKAROV (OCN) - autotools usage
#
-AC_INIT([Salome2 Project GUI module], [6.3.1], [webmaster.salome@opencascade.com], [SalomeGUI])
+AC_INIT([Salome2 Project GUI module], [6.4.0], [webmaster.salome@opencascade.com], [SalomeGUI])
AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
src/Session/Makefile \
src/SalomeApp/Makefile \
src/SalomeApp/Test/Makefile \
+ src/SalomeApp/pluginsdemo/Makefile \
+ src/GuiHelpers/Makefile \
+ src/TreeData/Makefile \
+ src/TreeData/Test/Makefile \
src/SALOME_SWIG/Makefile \
src/SALOME_SWIG/supervisionexample.py \
src/SALOME_SWIG/supervisiongeomexample.py \
directory path, or if you do not have write permissions
for the directory you use, the corresponding message box is shown.
-\b Note: you are strongly recommended to avoid using directory names containing spaces.</b> Otherwise you can experience some troubles with the installation.
+<b> Note: you are strongly recommended to avoid using directory names containing spaces.</b> Otherwise you can experience some troubles with the installation.
\n
\anchor figure_4
\image html directorypage.png
removing temporary files can take some time, so the installation
wizard will wait 3 seconds before closing.
-At the end of the installation <b>"Installation completed"</b> message will appear in the status bar. You can return to the previous pages to start a new installation or click \em"Next" button to go to the readme page:
+At the end of the installation <b>"Installation completed"</b> message
+will appear in the status bar. You can return to the previous pages to
+start a new installation or click \em "Next" button to go to the readme page:
\anchor figure_12
\image html readmepage.png
\n\n This function is called when <em>'Install binaries'</em> installation mode is selected by the user. The function is responsible for the extracting of the product from the binaries package. It should create environment for the product in the temporary directory (see also the description of \b print_env() function). It is not necessary to implement this function if you do not provide binaries mode installation for the current product.<br><br>
</li>
<li><b>install_source()</b>
-This function is called to install SALOME modules sources, if <em>'Install binaries'</em> installation mode is selected by the user, and to install prerequisite products sources, in <em>'Install sources'</em> case (\ref Figure_2 "Fig. 2" above). The function is responsible for the building of the product from the sources package. It should create the environment file for the product in the temporary directory (see also the description of print_env() function). It is not necessary to implement this function if you do not provide a sources mode installation for the current product. <br><br>
+This function is called to install SALOME modules sources, if <em>'Install binaries'</em> installation mode is selected by the user, and to install prerequisite products sources, in <em>'Install sources'</em> case (\ref figure_2 "Fig. 2" above). The function is responsible for the building of the product from the sources package. It should create the environment file for the product in the temporary directory (see also the description of print_env() function). It is not necessary to implement this function if you do not provide a sources mode installation for the current product. <br><br>
</li>
<li><b>install_source_and_build()</b>
This function is called when <em>'Install sources and make a compilation'</em> installation mode is selected. This function should be used to unpack SALOME or prerequisite sources package and then call build/install procedure for it.
Wizard if the attribute \b \<disable\> in the XML configuration file is set
to the "true" value.
-*/
\ No newline at end of file
+*/
<li><b>Simple</b> - as a plain text</li>
<li><b>Tree</b> - in a tree-like form</li>
</ul>
-<li><b>Automatic nodes compute limit</b></li> - Size limit for the
+<li><b>Automatic nodes compute limit</b></li> - allows to define the size limit for the
mesh groups for which the number of underlying nodes is calculated
-automatically. If the group size exceeds the value set in preferences,
+automatically. If the group size exceeds the value set in the preferences,
the user will have to press \em Compute button explicitly. Zero value
-means "no limit". Default value is set to 100 000 mesh elements.
+means "no limit". By default the value is set to 100 000 mesh elements.
</li></ul>
<li><b>Automatic Parameters</b></li>
<ul>
</ul>
<li><b>Elements</b></li>
<ul>
-<li><b>Surface color</b> - allows to select the color of surface of elements
+<li><b>Surface color</b> - allows to select the surface color of elements
(seen in Shading mode). Click on the colored line to access to the
\ref select_color_and_font_page "Select Color" dialog box.</li>
-<li><b>Back surface color</b> - allows to select the color of interior surface
-of elements. Use slider to select this color. This color generated on base
-of the <b>Surface color</b> by changing it's brightness and saturation.</li>
-<li><b>Outline color</b> - allows to select the color of borders of
-elements. Click on the colored line to access to the
+<li><b>Back surface color</b> - allows to select the interior surface color
+of elements. Use the slider to select the color generated basing on
+the <b>Surface color</b> by changing its brightness and saturation.</li>
+<li><b>Outline color</b> - allows to select the color of element
+borders. Click on the colored line to access to the
\ref select_color_and_font_page "Select Color" dialog box.</li>
<li><b>Wireframe color</b> - allows to select the color of borders of
elements in the wireframe mode. Click on the colored line to access to the
<ul>
<li><b>Multicolor</b> the histogram is colored as <b>Scalar Bar</b></li>
<li><b>Monocolor</b> the histogram is colored as selected with <b>Distribution color</b> selector</li>
-<ul>
+</ul>
</ul>
*/
<hr>
\image html occ_view_sync.png
-<br><center><b>Synchronize view</b> - synchronize 3d view parameters.</center>
+<br><center><b>Synchronize view</b> - allows to synchronize 3d view parameters.</center>
This button has two states - checked and unchecked. Clicking on this
button opens a drop-down menu listing the compatible 3d views. As soon
-as user selects any view from the list, the parameters (view point,
-position, zoom coefficient etc) of the current view are synchronized
-to the selected view (static synchronization).
+as the user selects any view from the list, the parameters (view point,
+position, zoom coefficient, etc.) of the current view are synchronized
+with the selected view (static synchronization).
In addition, when this button is in the "checked" state, the dynamic
synchronization of the views is performed, i.e. any zoom, pan, rotate
or other view operation done in one view is automatically applied
-to the second view.
+to the other view.
<hr>
\note OCC Viewer features a special <b>Polyline Selection</b>
- <b>Main title</b> the title of the XY plot. By default, it will
consist of the names of the tables, on the basis of which the curve
lines have been constructed.
-- <b>Show legend</b> here you can define the position of the
- <b>Curve type</b> you can select from \b Points, \b Lines and \b Spline.
+- <b>Show legend</b> here you can define the position of the
description table on the XY plot (to the \b Left, to the \b Right, on
\b Top or on \b Bottom).
-- <b>Legend font</b> here you can set type, face and color for the font of Legend item.
+- <b>Legend font</b> here you can set type, face and color for the
+font of Legend item.
- <b>Marker size</b> - size of the points (markers) forming curve lines.
- <b>Background color</b> of the XY plot.
- <b>Scale mode</b> here you can select the type of scaling (\b
Cache</li>
</ul>
-<ul>
<li><b>Animation preferences</b></li>
<ul>
<li><b>Speed</b> - allows to define the speed of the animation.</li>
<ul>
<li><b>Gauss Points Scalar Bar</b></li>
<ul>
-<li><b>Active Bar</b> - this option allows to choose <b>Local</b> or
-<b>Global</b> Bar as active.</li>
-<li><b>Display Global Bar</b> - this option allows to visualize or to
-hide the Global Bar.</li>
-<li><b>Scalar Bar Mode</b> - this option allows to choose between
-<b>Bicolor</b> and <b>Rainbow</b> Scalar Bar Mode.</li>
-<li><b>Spacing</b> - allows to define Spacing from 0.01 to 1.</li>
+ <li><b>Active Bar</b> - this option allows to choose <b>Local</b> or
+ <b>Global</b> Bar as active.</li>
+ <li><b>Display Global Bar</b> - this option allows to visualize or to
+ hide the Global Bar.</li>
+ <li><b>Scalar Bar Mode</b> - this option allows to choose between
+ <b>Bicolor</b> and <b>Rainbow</b> Scalar Bar Mode.</li>
+ <li><b>Spacing</b> - allows to define Spacing from 0.01 to 1.</li>
</ul>
</ul>
<ul>
-<b>Spacemouse</b>
+<li><b>Spacemouse</b></li>
<ul>
<li><b>Decrease Gauss Points Magnification </b> - divides the current
magnification by magnification ratio. </li>
<li><b>Increase Gauss Points Magnification </b> - multiplies the
current magnification by magnification ratio. </li>
-</ulul>
+</ul>
</ul>
<br><br><b>Inside<b> and </b>Outside Cursor Preferences</b> allow to set
<li><b>Information window</b> - allows to define the
<b>Transparency</b> (from 0% = opaque to 100% = transparent) and
<b>Position</b> of the window, which can be:</li>
-<ul>
-<li><b>Centred below the point</b>, or</li>
-<li>located at <b>Top-left corner of the 3D view</b></li>
-</ul>
+<li><ul>
+ <li><b>Centred below the point</b>, or</li>
+ <li>located at <b>Top-left corner of the 3D view</b></li>
+</ul></li>
<li><b>Movement of the Camera</b> can also be define by the user.</li>
-<ul>
-<li><b>Zoom at first selected point</b> - This value is used to define
-the focal distance at the first selected point (at the end of the
-movement of the camera). This value is a ratio that will be multiplied
-by the current zoom value.</li>
-<li><b>Number of steps between two positions</b> - defines the
-smoothness of camera movement at selection by the number of
-iterations. If set to 1 the camera is zoomed and centered at the point
-momentarily. Greater numbers mean very slow camera movement.</li>
-</ul>
+<li><ul>
+ <li><b>Zoom at first selected point</b> - This value is used to define
+ the focal distance at the first selected point (at the end of the
+ movement of the camera). This value is a ratio that will be multiplied
+ by the current zoom value.</li>
+ <li><b>Number of steps between two positions</b> - defines the
+ smoothness of camera movement at selection by the number of
+ iterations. If set to 1 the camera is zoomed and centered at the point
+ momentarily. Greater numbers mean very slow camera movement.</li>
+</ul></li>
<li><b>Display parent mesh element</b> - allows to visualize or hide
the patent mesh element of the selected gauss point.</li>
</ul>
-</ul>
*/
them.</li>
<li>\b Rename - allows to rename the currently selected viewer
window. </li>
+</ul>
\page themes_page Theme
-The look-n-feel of the SALOME desktop can be customized by the user
-via the SALOME theme preferences.
+The look and feel of the SALOME desktop can be customized by the user
+via SALOME style preferences.
<b>SALOME style prefereces</b> dialog box is used for customization of
the look and feel of SALOME style. To open it, select in the Main menu
<b>View -> Theme </b> item.
-If SALOME theme is not used (<b>Use SALOME Style</b> check bos is
-switched off), the global system settings are applied (for
-example, those ones specified by the KDE settings).
-In such a way, the application's look-n-feel attributes (such as
-palette and/or font) can be customized by using of the Qt utility
-<em>qtconfig</em>.
-
-Alternatively look-n-feel of the application desktop can be customized
-using SALOME theme.
-
\image html theme1.png
It is possible to choose a predefined scheme in the list to the left
-or create custom scheme using the controls to the right.
+or to create a custom scheme using the controls to the right.
The dialog box contains two pages.
-The first page allows specifying of the color palette.
+The first page allows specifying the color palette.
- \b Quick button allows automatic color palette definition basing on
-one main color specified by the user.
+the main color specified by the user.
\image html theme2.png
- <b>Widget effect</b> allows to apply special effects to Salome
dialog boxes.
+If SALOME Theme is not used (<b>Use SALOME Style</b> checkbox is
+switched off), the global system settings are applied (for
+example, KDE settings). So, the look and feel of the application (for
+example, palette and/or font) can be customized by using the Qt utility
+<em>qtconfig</em>.
+
+
*/
information about the valid data range. For a floating-point input, the
tooltip also contains information about the expected precision.
-In standard \bSALOME modules the precision value can be adjusted through
+In standard \b SALOME modules the precision value can be adjusted through
\ref setting_preferences_page "user preferences" of the correspodning modules, and the tooltip contains a
reference to the corresponding parameter in the preferences.
<h1> Enable sorting </h1>
-The objects in the object browser are sorted by creation order by default.
+By default the objects in the object browser are sorted in the creation order.
\n
-It is yet possible to enable sorting
-by alphabetical order (or reverse order) by right clicking in the header of the tree (near the "Name" field) and checking "enable sorting" in the popup menu.
+However, it is possible to enable sorting
+in the alphabetical order (or the reverse alphabetical order) by right
+clicking in the header of the tree (near the "Name" field) and
+checking "enable sorting" in the popup menu.
\n
-An arrow appears then near "Name" to reverse the order.
-If unchecking "enable sorting" the objects are sorted with default order again.
-
+It is possible to use the arrow near "Name" to reverse the order.
+If "enable sorting" is unchecked, the objects are sorted in the default order again.
+
*/
--- /dev/null
+/*!
+
+\page using_pluginsmanager Extends SALOME gui functions using python plugins
+
+-# \ref S1_SALOMEPLUGINS
+-# \ref S2_SALOMEPLUGINS
+-# \ref S3_SALOMEPLUGINS
+
+\section S1_SALOMEPLUGINS Objectives
+
+The SALOME python plugin manager allows the end user to extend the
+graphic interface of SALOME with custom functions written as python
+modules. The screenshots below show the example of a tool that creates
+a mesh from a set of geometrical parameters with the support of
+simple graphical interface:
+
+The default menu for plugins is "Tool->Extensions":
+\image html SALOME_pythonplugins_menu.png
+
+In this example, the plugin provides a small interface to input the
+parameters (not provided by the plugin manager):
+\image html SALOME_pythonplugins_dialog.png
+
+Then creates the mesh model:
+\image html SALOME_pythonplugins_result.png
+
+In this example, the end user has to write:
+
+-# the python script that creates the mesh from the parameters, using
+ the GEOM and SMESH python interface, as in a clasic use case.
+-# the dialog box in PyQt to input the parameters
+-# file salome_plugins.py that declares the plugins
+
+This page explains only the last point.
+
+\section S2_SALOMEPLUGINS Principles
+
+The general form of the file salome_plugins.py is:
+
+\code
+import salome_pluginsmanager
+
+# Creation of the plugin
+def myplugin1(context):
+ ...
+ # Here is the code of the plugin myplugin1
+ ...
+
+def myplugin2(context):
+ ...
+ # Here is the code of the plugin myplugin2
+ ...
+
+# Declaration of the plugins to the pluginsmanager
+salome_pluginsmanager.AddFunction('My plugin n°1', 'This action runs the plugin n°1', myplugin1)
+salome_pluginsmanager.AddFunction('My plugin n°2', 'This action runs the plugin n°2', myplugin2)
+...
+\endcode
+
+The procedure is to define a function that implements the plugin, and
+to declare this function to the plugins manager. The implementation
+can be very variable. It is advisable to consider this function as a
+proxy to your code that you can manage in a python package
+installed in the standard SALOME python directories.
+
+In this code, the variable "context" is automatically transmitted by
+the pluginmanager when you request the plugin with at least the following
+attributes:
+
+\code
+activeStudy = context.study
+salomegui = context.sg
+\endcode
+
+Once terminated, this script salome_plugin.py has to be moved to a
+specific place on your filesystem where SALOME is programmed to search
+for plugins. The possible directories are:
+
+-# The directory <*_ROOT_DIR>/share/salome/plugins, when this plugin
+ is developped in the framework of a SALOME module (<*_ROOT_DIR>
+ is the root installation directory of the module).
+-# The directory ~/.config/salome/Plugins for personnal end user
+ plugins
+-# Any path in the shell variable SALOME_PLUGIN_PATH (each path must be
+ separated by a comma ":" for unix and ";" for windows). This
+ variable should be set and exported before running the SALOME application.
+
+\section S3_SALOMEPLUGINS A complete example
+
+Suppose that you write a SALOME script that creates a trihedron for each of
+your studies (a simple and standard SALOME script, that every end user
+is capable to write if he reads the documentation and follows the
+training course):
+
+\code
+# Intialize the geompy factory with the active study
+import salome
+import geompy
+geompy.init_geom(salome.myStudy)
+
+# Create the objects
+Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 10, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 10)
+origin = geompy.MakeVertex(0, 0, 0)
+
+# Register the objects in the active study
+geompy.addToStudy( Vx, "Vx" ))
+geompy.addToStudy( Vy, "Vy" ))
+geompy.addToStudy( Vz, "Vz" ))
+geompy.addToStudy( origin, "origin" ))
+\endcode
+
+The job consists in creating the file salome_plugins.py as follows:
+
+\code
+import salome_pluginsmanager
+def trihedron(context):
+ import geompy
+ # Intialize the geompy factory with the active study
+ activeStudy = context.study
+ geompy.init_geom(activeStudy)
+ # Create the objects
+ Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 10, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 10)
+ origin = geompy.MakeVertex(0, 0, 0)
+ # Register the objects in the active study
+ geompy.addToStudy( Vx, "Vx" )
+ geompy.addToStudy( Vy, "Vy" )
+ geompy.addToStudy( Vz, "Vz" )
+ geompy.addToStudy( origin, "origin" )
+
+# Register the function in the plugin manager
+salome_pluginsmanager.AddFunction('O,Vx,Vy,Vz',
+ 'Creates the trihedron',
+ trihedron)
+
+\endcode
+
+Move this script in the directory
+~/.config/salome/Plugins, run SALOME and enjoy your new function.
+
+*/
\image html vtk_view_highlight.png
<br><center><b>Dynamic pre-selection switch</b> - allows to switch
-on/off dynamic pre-selection of the objects. When the dynamic
-pre-selection is switched on, the objects can be selected by clicking
-of the point/cell belonging to this object, with some performance
-loss. Switch dynamic pre-selection off to have good performance on the
-big objects (like huge meshes).</center>
+on/off dynamic pre-selection of objects. When the dynamic
+pre-selection is switched on, an objects can be selected by clicking
+the point/cell belonging to this object, with some performance
+loss. Switch dynamic pre-selection off to have a good performance on
+big objects (for example, huge meshes).</center>
<hr>
\image html vtk_view_triedre.png
<hr>
\image html vtk_view_sync.png
-<br><center><b>Synchronize view</b> - synchronize 3d view parameters.</center>
+<br><center><b>Synchronize view</b> - allows to synchronize 3d view parameters.</center>
This button has two states - checked and unchecked. Clicking on this
button opens a drop-down menu listing the compatible 3d views. As soon
-as user selects any view from the list, the parameters (view point,
-position, zoom coefficient etc) of the current view are synchronized
-to the selected view (static synchronization).
+as the user selects any view from the list, the parameters (view point,
+position, zoom coefficient, etc.) of the current view are synchronized
+with the selected view (static synchronization).
In addition, when this button is in the "checked" state, the dynamic
synchronization of the views is performed, i.e. any zoom, pan, rotate
or other view operation done in one view is automatically applied
-to the second view.
+to the other view.
<hr>
\image html vtk_view_parallel.png
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = caf
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include ../Qtx ../SUIT ../STD
-LIBS += -L../../lib -lqtx -lsuit -lstd
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += CAF_EXPORTS
-
-HEADERS = CAF.h
-HEADERS += CAF_Application.h
-HEADERS += CAF_Operation.h
-HEADERS += CAF_Study.h
-HEADERS += CAF_Tools.h
-
-SOURCES = CAF_Application.cxx
-SOURCES += CAF_Operation.cxx
-SOURCES += CAF_Study.cxx
-SOURCES += CAF_Tools.cxx
-
-TRANSLATIONS = resources/CAF_images.ts \
- resources/CAF_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm resources/*.xml resources/*.ini
-resources.path = ../../resources
-
-INSTALLS += includes resources
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = CAM
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include ../Qtx ../SUIT ../STD
-LIBS += -L../../lib -lqtx -lsuit -lstd
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += CAM_EXPORTS
-
-HEADERS = CAM.h
-HEADERS += CAM_Application.h
-HEADERS += CAM_DataModel.h
-HEADERS += CAM_DataObject.h
-HEADERS += CAM_Module.h
-HEADERS += CAM_Study.h
-
-SOURCES = CAM_Application.cxx
-SOURCES += CAM_DataModel.cxx
-SOURCES += CAM_DataObject.cxx
-SOURCES += CAM_Module.cxx
-SOURCES += CAM_Study.cxx
-
-TRANSLATIONS = resources/CAM_images.ts \
- resources/CAM_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm resources/*.xml resources/*.ini
-resources.path = ../../resources
-
-INSTALLS += includes resources
#include <cstdio>
+namespace
+{
class BusyLocker
{
public:
bool myPrev;
bool& myBusy;
};
+}
/*!
\brief Create new instance of CAM_Application.
if(version) {
for ( ModuleInfoList::iterator it = myInfoList.begin(); it != myInfoList.end(); ++it ) {
if ( (*it).title == modName ) {
- if( (*it).version.isEmpty() ) {
- (*it).version = QString(version);
- }
- break;
+ if( (*it).version.isEmpty() ) {
+ (*it).version = QString(version);
+ }
+ break;
}
}
}
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = DDS
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-CAS_OCAF = -L$${CASROOT}/Linux/lib -lPTKernel -lTKernel -lTKCDF -lTKLCAF -lTKPCAF -lTKStdSchema
-
-INCLUDEPATH += ../../include $${CAS_CPPFLAGS}
-LIBS += $${CAS_KERNEL} $${CAS_OCAF}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=2 OCC_VERSION_MAINTENANCE=0 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = DDS.h
-HEADERS += DDS_DicGroup.h
-HEADERS += DDS_DicItem.h
-HEADERS += DDS_Dictionary.h
-HEADERS += DDS_KeyWords.h
-
-SOURCES = DDS_DicGroup.cxx
-SOURCES += DDS_DicItem.cxx
-SOURCES += DDS_Dictionary.cxx
-SOURCES += DDS_KeyWords.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = Event
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include
-LIBS +=
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += EVENT_EXPORTS
-
-HEADERS = Event.h
-HEADERS += SALOME_Event.h
-HEADERS += SALOME_EventFilter.h
-
-SOURCES = SALOME_Event.cxx
-SOURCES += SALOME_EventFilter.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = GLViewer
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-GL_LIBS = -L/usr/X11R6/lib$$(LIB_LOCATION_SUFFIX) -lGLU
-
-INCLUDEPATH += $$(QTDIR)/include/QtOpenGL ../../include $${CAS_CPPFLAGS} ../Qtx ../SUIT
-LIBS += -L../../lib -lqtx -lsuit $${GL_LIBS} $${CAS_KERNEL}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += GLVIEWER_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = GLViewer.h
-HEADERS += GLViewer_AspectLine.h
-HEADERS += GLViewer_BaseDrawers.h
-HEADERS += GLViewer_BaseObjects.h
-HEADERS += GLViewer_Compass.h
-HEADERS += GLViewer_Context.h
-HEADERS += GLViewer_CoordSystem.h
-HEADERS += GLViewer_Defs.h
-HEADERS += GLViewer_Drawer.h
-HEADERS += GLViewer_Geom.h
-HEADERS += GLViewer_Grid.h
-HEADERS += GLViewer_Group.h
-HEADERS += GLViewer_MimeData.h
-HEADERS += GLViewer_Object.h
-HEADERS += GLViewer_Selector.h
-HEADERS += GLViewer_Selector2d.h
-HEADERS += GLViewer_Text.h
-HEADERS += GLViewer_Tools.h
-HEADERS += GLViewer_ToolTip.h
-HEADERS += GLViewer_ViewFrame.h
-HEADERS += GLViewer_ViewManager.h
-HEADERS += GLViewer_ViewPort.h
-HEADERS += GLViewer_ViewPort2d.h
-HEADERS += GLViewer_Viewer.h
-HEADERS += GLViewer_Viewer2d.h
-HEADERS += GLViewer_Widget.h
-
-SOURCES = GLViewer_AspectLine.cxx
-SOURCES += GLViewer_BaseDrawers.cxx
-SOURCES += GLViewer_BaseObjects.cxx
-SOURCES += GLViewer_Compass.cxx
-SOURCES += GLViewer_Context.cxx
-SOURCES += GLViewer_CoordSystem.cxx
-SOURCES += GLViewer_Drawer.cxx
-SOURCES += GLViewer_Geom.cxx
-SOURCES += GLViewer_Grid.cxx
-SOURCES += GLViewer_Group.cxx
-SOURCES += GLViewer_MimeData.cxx
-SOURCES += GLViewer_Object.cxx
-SOURCES += GLViewer_Selector.cxx
-SOURCES += GLViewer_Selector2d.cxx
-SOURCES += GLViewer_Text.cxx
-SOURCES += GLViewer_Tools.cxx
-SOURCES += GLViewer_ToolTip.cxx
-SOURCES += GLViewer_ViewFrame.cxx
-SOURCES += GLViewer_ViewManager.cxx
-SOURCES += GLViewer_ViewPort.cxx
-SOURCES += GLViewer_ViewPort2d.cxx
-SOURCES += GLViewer_Viewer.cxx
-SOURCES += GLViewer_Viewer2d.cxx
-SOURCES += GLViewer_Widget.cxx
-
-TRANSLATIONS = resources/GLViewer_images.ts \
- resources/GLViewer_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
# Python modules to be installed
mypkgpython_PYTHON = \
__init__.py \
- SelectVarsDialog_ui.py \
selectvars.py \
- genericdialog_ui.py \
genericdialog.py \
- mytestdialog_ui.py \
mytestdialog.py \
helper.py
--- /dev/null
+# Copyright (C) 2011 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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 : Guillaume Boulant (EDF/R&D)
+#
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+# header files
+salomeinclude_HEADERS = \
+ QtHelper.hxx \
+ SALOME_GuiServices.hxx \
+ SALOME_AppStudyEditor.hxx \
+ StandardApp_Module.hxx
+
+# Libraries targets
+lib_LTLIBRARIES = libSalomeGuiHelpers.la
+
+dist_libSalomeGuiHelpers_la_SOURCES = \
+ SALOME_GuiServices.cxx \
+ SALOME_AppStudyEditor.cxx \
+ StandardApp_Module.cxx
+
+
+QT_CXXFLAGS=@QT_INCLUDES@ @QT_MT_INCLUDES@
+CAS_CXXFLAGS=@CAS_CPPFLAGS@ @CAS_CXXFLAGS@
+BOOST_CPPFLAGS=@BOOST_CPPFLAGS@
+BOOST_LIBS=@BOOST_LIBS@
+CORBA_CXXFLAGS=@OMNIORB_CXXFLAGS@ @OMNIORB_INCLUDES@
+CORBA_LIBS=@OMNIORB_LIBS@
+
+libSalomeGuiHelpers_la_CPPFLAGS = \
+ $(QT_CXXFLAGS) \
+ $(CAS_CXXFLAGS) \
+ $(BOOST_CPPFLAGS) \
+ $(CORBA_CXXFLAGS) \
+ $(KERNEL_CXXFLAGS) \
+ -I$(srcdir)/../SalomeApp \
+ -I$(srcdir)/../LightApp \
+ -I$(srcdir)/../SUIT \
+ -I$(srcdir)/../Qtx \
+ -I$(srcdir)/../CAM \
+ -I$(srcdir)/../STD \
+ -I$(srcdir)/../OBJECT
+
+
+libSalomeGuiHelpers_la_LDFLAGS = \
+ ../SalomeApp/libSalomeApp.la \
+ $(KERNEL_LDFLAGS) -lSalomeKernelHelpers \
+ $(CORBA_LIBS)
+
+#
+# =======================================================
+# Specific definitions for Qt MOC files
+#
+
+# moc-files generation
+%_moc.cxx: %.hxx
+ $(MOC) $< -o $@
+
+# MOC pre-processing
+MOC_FILES_HXX = \
+ StandardApp_Module_moc.cxx
+
+nodist_libSalomeGuiHelpers_la_SOURCES = $(MOC_FILES_HXX)
+
+EXTRA_DIST+=$(MOC_FILES_HXX:%_moc.cxx=%.hxx)
--- /dev/null
+#ifndef _QT_HELPER_HXX_
+#define _QT_HELPER_HXX_
+
+//
+// =============================================================
+// Macro and template functions for type conversions.
+// =============================================================
+//
+#include "Basics_Utils.hxx" // To get ToString macro
+#include <QString>
+
+// This can be used to convert QString into char *.
+#define QCHARSTAR(qstring) qstring.toLatin1().data()
+// This converts a string into a QString
+#define S2QS(string) QString(string.c_str())
+// This converts a QString into a string
+#define QS2S(qstring) ToString(QCHARSTAR(qstring))
+#define QSTRING(any) S2QS(ToString(any))
+
+//
+// =============================================================
+// General helper macros for manipulating widgets values
+// =============================================================
+//
+#define GETTEXT(widget) ToString(QCHARSTAR(widget->text().trimmed()))
+#define SETTEXT(widget,str) widget->setText(str.c_str())
+
+//
+// =============================================================
+// Qt Logger macros
+// =============================================================
+//
+
+// We can use the macros defined by SALOMELocalTrace/utilities.h
+// as proposed in the file KERNEL_helper.hxx. But we can use instead
+// the Qt debug function:
+#include <QDebug>
+#define QDEBUG qWarning()
+//#define QDEBUG qDebug()
+#define QLOG(data) QDEBUG << "[XSALOME] " << data
+#ifdef LOG
+#undef LOG
+#endif
+#define LOG QLOG
+
+#endif // __QT_HELPER_H_
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#include "SALOME_AppStudyEditor.hxx"
+
+#include <SalomeApp_Study.h>
+#include <SALOME_ListIO.hxx>
+#include <LightApp_SelectionMgr.h>
+#include <SALOME_ListIteratorOfListIO.hxx>
+
+SALOME_AppStudyEditor::SALOME_AppStudyEditor(SalomeApp_Application * salomeApp)
+ : SALOME_StudyEditor()
+{
+ _salomeApp = salomeApp;
+ updateActiveStudy();
+}
+
+/**
+ * This updates the editor with the current active study. If the
+ * active study id is identical to the study id currently associated
+ * to this object, then no update is performed.
+ */
+int SALOME_AppStudyEditor::updateActiveStudy() {
+ int activeStudyId = SALOME_AppStudyEditor::getActiveStudyId(_salomeApp);
+ if ( activeStudyId != this->getStudyId() ) {
+ this->setStudyById(activeStudyId);
+ }
+ return activeStudyId;
+}
+
+// GUI context only
+int SALOME_AppStudyEditor::getActiveStudyId(SalomeApp_Application * salomeApp) {
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*> (salomeApp->activeStudy());
+ _PTR(Study) aCStudy = appStudy->studyDS();
+ int studyId = aCStudy->StudyId();
+ return studyId;
+}
+
+SALOMEDS::SObject_ptr SALOME_AppStudyEditor::IObjectToSObject(const Handle(SALOME_InteractiveObject)& iobject) {
+ if (!iobject.IsNull()) {
+ if (iobject->hasEntry()) {
+ SALOMEDS::SObject_var sobject = _study->FindObjectID(iobject->getEntry());
+ return sobject._retn();
+ }
+ }
+ return SALOMEDS::SObject::_nil();
+}
+
+/**
+ * This function creates a list of all the "study objects" (SObject)
+ * that map with the selection in the object browser (the "interactive
+ * objects", IObjects). Please note that the objects belongs to the
+ * active study.
+ */
+SALOME_StudyEditor::SObjectList * SALOME_AppStudyEditor::getSelectedObjects() {
+
+ // _GBO_: please note that the use of this function can be
+ // underoptimal in the case where the number of selected objects is
+ // high, because we create a vector list of SObjects while the list
+ // of IObject can be processed directly. In the case where a high
+ // number of objects is selected (~1000), it's certainly better to
+ // use directly the SALOME_ListIO and iterators on it.
+
+ LightApp_SelectionMgr* aSelectionMgr = _salomeApp->selectionMgr();
+ SALOME_ListIO selectedIObjects;
+ aSelectionMgr->selectedObjects(selectedIObjects);
+ /*
+ * This returns a list containing the selected objects of the objects
+ * browser. Please note that the objects of the browser ARE NOT the
+ * objects of the study. What is returned by this function is a list
+ * of "interactive objects" (IObject) which are objects of the
+ * graphical context. Each of this IObject is characterized by an
+ * entry string that corresponds to the entry string of an associated
+ * "study object" (SObject) in the active study. The mapping can be
+ * done using the function IObjectToSObject.
+ */
+
+ SObjectList * listOfSObject = new SObjectList();
+ SALOME_ListIteratorOfListIO It (selectedIObjects);
+ for (; It.More(); It.Next()) {
+ SALOMEDS::SObject_ptr sobject = this->IObjectToSObject(It.Value());
+ if (!sobject->_is_nil()) {
+ listOfSObject->push_back(sobject);
+ }
+ }
+
+ return listOfSObject;
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef __APP_STUDY_EDITOR_HXX__
+#define __APP_STUDY_EDITOR_HXX__
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include <SalomeApp_Application.h>
+#include <SALOME_InteractiveObject.hxx>
+
+#include "SALOME_StudyEditor.hxx"
+
+class SALOME_AppStudyEditor: public SALOME_StudyEditor {
+public:
+ SALOME_AppStudyEditor(SalomeApp_Application * salomeApp);
+ int updateActiveStudy();
+
+ SALOMEDS::SObject_ptr IObjectToSObject(const Handle(SALOME_InteractiveObject)& iobject);
+ SALOME_StudyEditor::SObjectList * getSelectedObjects();
+
+ static int getActiveStudyId(SalomeApp_Application * salomeApp);
+
+private:
+ SalomeApp_Application * _salomeApp;
+
+};
+
+#endif // __APP_STUDY_EDITOR_HXX__
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#include "SALOME_GuiServices.hxx"
+#include <SUIT_Session.h>
+
+namespace GUI {
+ /*!
+ * Get the SALOME application, i.e. the main GUI framework of
+ * SALOME. This function returns a pointer to the singleton instance
+ * of the SalomeApp_Application.
+ *
+ * The SALOME application can be used to get reference to
+ * the SALOME KERNEL services such that the naming service, the
+ * lifeCycleCORBA, ... Theses services can be retrieved using static
+ * functions (not required to get the singleton instance):
+ *
+ * SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
+ *
+ * Please note that this usage can be done only from within the
+ * SALOME session server process, i.e. the process that embed the
+ * SALOME application.
+ */
+ SalomeApp_Application * getSalomeApplication() {
+ static SalomeApp_Application * app;
+ if ( app == NULL ) {
+ app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ }
+ return app;
+ }
+
+ /*!
+ * Get the selection manager of the SALOME application. The
+ * selection manager can be used to get the selected items in the
+ * objects browser that is a GUI display of the active study.
+ * The function returns a pointer to the selectionMgr attribute of
+ * the SalomeApp_Application singleton instance.
+ */
+ LightApp_SelectionMgr * getSelectionManager() {
+ SalomeApp_Application* anApp = GUI::getSalomeApplication();
+ if ( anApp == NULL ) return NULL;
+ return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
+ }
+
+
+ SUIT_ResourceMgr * getResourcesManager() {
+ return SUIT_Session::session()->resourceMgr();
+ }
+ // Note that the resource manager can be also retrieved from the
+ // SALOME application using the resourceMgr() method:
+ //
+
+ /**
+ * This returns the current active study id if an active study is
+ * defined in the SALOME session, returns -1 otherwise. Note that
+ * the active study doesn't make sense outside of the GUI SALOME
+ * process, i.e. the SALOME_SessionServer embedding the
+ * SalomeApp_Application.
+ */
+ int getActiveStudyId() {
+ SALOME::Session_var aSession = KERNEL::getSalomeSession();
+ if ( CORBA::is_nil(aSession) ) {
+ INFOS("ERR: can't request for active study because the session is NULL");
+ return -1;
+ }
+ return aSession->GetActiveStudyId();
+ }
+
+ /**
+ * This returns the current active study if an active study is
+ * defined in the SALOME session, returns null otherwise.
+ */
+ SALOMEDS::Study_ptr getActiveStudy() {
+ return KERNEL::getStudyById(getActiveStudyId());
+ }
+
+
+ // __GBO__ Question: what is the difference between a
+ // SALOMEDS::Study and a SalomeApp_Study?
+ SalomeApp_Study* getSalomeAppActiveStudy() {
+ SUIT_Application* app = getSalomeApplication();
+ if( app )
+ return dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ else
+ return NULL;
+ }
+
+
+ SALOMEDS::SObject_ptr IObjectToSObject(const Handle(SALOME_InteractiveObject)& iobject) {
+ if (!iobject.IsNull()) {
+ if (iobject->hasEntry()) {
+ SalomeApp_Study* appStudy = getSalomeAppActiveStudy();
+ if ( appStudy != NULL ) {
+ //
+ // IMPORTANT NOTE:
+ //
+ // Note that the SalomeApp_Study give acces to shared
+ // pointer (i.e. _PTR(<BaseClassName>)) that points to proxy
+ // objects (i.e. SALOMEDSClien_<BaseClassName>) that embeds
+ // the CORBA servants (i.e. SALOMEDS::<BaseClassName>_ptr).
+ // Then to retrieve the corba servant, a method is to
+ // retrieve the SALOMEDS::Study servant first and the to
+ // request this servant to get the SObject given its entry.
+ //
+ _PTR(Study) studyClient = appStudy->studyDS();
+ SALOMEDS::Study_var study = KERNEL::getStudyManager()->GetStudyByID(studyClient->StudyId());
+ SALOMEDS::SObject_ptr sobject = study->FindObjectID(iobject->getEntry());
+ return sobject;
+ }
+ }
+ }
+ return SALOMEDS::SObject::_nil();
+ }
+
+}
+
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef __GUI_SERVICES_H__
+#define __GUI_SERVICES_H__
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include <LightApp_SelectionMgr.h>
+#include <SUIT_ResourceMgr.h>
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_KernelServices.hxx>
+
+namespace GUI {
+
+ // SALOME GUI main services
+ SalomeApp_Application * getSalomeApplication();
+ LightApp_SelectionMgr * getSelectionManager();
+ SUIT_ResourceMgr * getResourcesManager();
+
+ // Helper functions to deal with the study in a GUI context.
+ //
+ // First of all, in a GUI context, there is one of the opened
+ // studies that is considered as active. Please note that the active
+ // study is a GUI concept and it can be obtained only in the
+ // SALOME_SessionServer process, i.e. the process that embeds the
+ // SalomeApp_Application. The concept of active study doesn't make
+ // sense outside of the GUI context.
+ //
+ // The active study is associated with an GUI Objects Browser that
+ // displays a graphical representation of the study. The items that
+ // can be selected in the Objects Browser are name Interactive
+ // Objects (instance of class SALOME_InteractiveObject). To work
+ // with data, we have to retrieve from this Interactive Object (IO)
+ // the underlying Study Object (instance of class SALOMEDS::SObject)
+ // and from this last the data object that can be anything (that
+ // depends of the SALOME module technical choices). In general, on
+ // of the attribute of a SObject is a CORBA servant that handles the
+ // data to work with
+ SALOMEDS::Study_ptr getActiveStudy();
+ int getActiveStudyId();
+
+ // Another way to get the active study (to be converted in
+ // SALOMEDS::Study):
+ SalomeApp_Study * getSalomeAppActiveStudy();
+
+ SALOMEDS::SObject_ptr IObjectToSObject(const Handle(SALOME_InteractiveObject)& iobject);
+
+ template<class TInterface> typename TInterface::_var_type
+ IObjectToInterface(const Handle(SALOME_InteractiveObject)& iobject) {
+ SALOMEDS::SObject_ptr sobject = IObjectToSObject(iobject);
+ return KERNEL::SObjectToInterface<TInterface>(sobject);
+ }
+ // _MEM_: note that template functions have to be declared AND
+ // implemented in the header because they are not compiled in this
+ // library but in every client library that includes this header
+ // file. The effective compilation depends on the particular class
+ // used for TInterface.
+
+
+}
+
+#endif // GUI_SERVICES
--- /dev/null
+// Copyright (C) 2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+// Author : Guillaume Boulant (EDF)
+
+#include "StandardApp_Module.hxx"
+
+#include <SUIT_Desktop.h>
+#include <SUIT_Study.h>
+#include <SalomeApp_Application.h>
+#include <SALOME_LifeCycleCORBA.hxx>
+#include "QtxPopupMgr.h"
+
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+// QT Includes
+#include <QIcon>
+#include <QAction>
+
+#include <Basics_Utils.hxx>
+#include "QtHelper.hxx"
+
+// Constructor
+StandardApp_Module::StandardApp_Module() :
+ SalomeApp_Module( "" ),
+ LightApp_Module( "" )
+{
+ // Note that it's no use to specify here the moduleName because it's
+ // automatically determined by the name of the GUI library
+ // (lib<moduleName>.so) just before initialize step. If you want
+ // nevertheless to setup the module name you should specified this
+ // name in the initialize function below using the CAM_module
+ // function setModuleName(QString&). You are warn then that the
+ // loading of resource files may be incorect and should be manually
+ // managed. In conclusion, if you don't need a special
+ // configuration, please conform to the standard convention: if
+ // <moduleName> is the name of the module as declared in the GUI
+ // configuration file (SalomeApp.xml), then you just have to provide
+ // a library whose name is lib<moduleName>.so and which contains a
+ // factory "extern C" function 'CAM_Module* createModule()'
+}
+
+int StandardApp_Module::ACTIONID_DEFAULT_INIT_VALUE = 910;
+int StandardApp_Module::ACTIONID_UNDEFINED = -1;
+
+// Module's initialization
+void StandardApp_Module::initialize( CAM_Application* app )
+{
+ //
+ // ----------------------------------------------------------------
+ // Standard initialization
+ // ----------------------------------------------------------------
+ //
+ SalomeApp_Module::initialize( app );
+ _resourceMgr = app->resourceMgr();
+ // Please note that the moduleName() function is inherited from
+ // CAM_module classe, and that its value is determined automatically
+ // from the name specified in the SalomeApp.xml associated to this
+ // module and which corresponds to the name of the GUI library
+ // (lib<moduleName>.so). For XSALOME, see
+ // share/salome/resources/xsalome/SalomeApp.xml in the install
+ // directory.
+ _defaultMenuId = this->createMenu( QCHARSTAR(moduleName()), -1, -1, 30 );
+ _defaultToolbarId = this->createTool ( QCHARSTAR(moduleName()) );
+ _actionId_internalCount = StandardApp_Module::ACTIONID_DEFAULT_INIT_VALUE;
+
+ //
+ // ----------------------------------------------------------------
+ // The following initializes the GUI widget and associated actions
+ // ----------------------------------------------------------------
+ // These functions may be redefined in specialized version of this class
+ this->createModuleWidgets();
+ this->createModuleActions();
+}
+
+QIcon StandardApp_Module::createIcon(const QString& iconName) {
+ // The icon file is supposed to be available througth the resource
+ // manager, i.e. in the folder containing the XSALOME resources (see
+ // specification in the module file SalomeApp.xml).
+ QPixmap aPixmap = _resourceMgr->loadPixmap( QCHARSTAR(moduleName()), iconName );
+ return QIcon( aPixmap );
+}
+
+int StandardApp_Module::newActionId() {
+ _actionId_internalCount++;
+ return _actionId_internalCount;
+}
+
+/*!
+ * This function creates an action and connects it to a button in the
+ * toolbar and to an item in the menu associated to this module. This
+ * function applies a common and standard procedure with a maximum of
+ * default values. If no identifier is specified, then a static
+ * internal counter is used to associate an identifier to the created
+ * action. In any case, the action identifier is returned.
+ *
+ * Note that the action (object of type QAction) can be retrieved
+ * using the method "QAction * action(int identifier)" of the super
+ * class.
+ */
+int StandardApp_Module::createStandardAction(const QString& label,
+ QObject * slotobject,
+ const char* slotmember,
+ const QString& iconName,
+ const QString& tooltip,
+ const int identifier)
+{
+
+ // If the tooltip is not defined, we choose instead the label text.
+ QString effToolTip(tooltip);
+ if ( effToolTip.isEmpty() )
+ effToolTip = label;
+
+ QIcon actionIcon = this->createIcon(iconName);
+
+ // If the identifier is not specified, then we use an internal
+ // counter.
+ int effIdentifier = identifier;
+ if ( effIdentifier == StandardApp_Module::ACTIONID_UNDEFINED ) {
+ effIdentifier=newActionId();
+ }
+
+ // Creating the action
+ QAction * action= this->createAction( effIdentifier, label, actionIcon,
+ label, effToolTip, 0, getApp()->desktop(),
+ false, slotobject, slotmember);
+
+ return effIdentifier;
+}
+
+/**
+ * Integrate the action in the default toolbar
+ */
+void StandardApp_Module::addActionInToolbar(int actionId) {
+ this->createTool( actionId, _defaultToolbarId );
+}
+
+/**
+ * Integrate the action in the default menu
+ */
+void StandardApp_Module::addActionInMenubar(int actionId) {
+ this->createMenu( actionId, _defaultMenuId, 10 );
+}
+
+/**
+ * Add the specified action as an item in the popup menu, with the
+ * specified visible rule. The default is "visible for object browser".
+ */
+void StandardApp_Module::addActionInPopupMenu(int actionId,const QString& rule) {
+ // _GBO_ for a fine customization of the rule (for example with a
+ // test on the type of the selected object), see the LIGTH module:
+ // implement "LightApp_Selection* createSelection() const;"
+ int parentId = -1;
+ QtxPopupMgr* mgr = this->popupMgr();
+ mgr->insert ( this->action( actionId ), parentId, 0 );
+ mgr->setRule( this->action( actionId ), rule, QtxPopupMgr::VisibleRule );
+}
+
+/*!
+ * This function can be used to create additionnal widget for this
+ * module GUI (e.g. docked widget). It can be redefined in a
+ * specialized version of this class.
+ */
+void StandardApp_Module::createModuleWidgets() {
+ // Nothing to do in this default gui
+}
+
+/*!
+ * This function can be used to defined the list of actions for this
+ * module GUI. It can be redefined in a specialized version of this
+ * class.
+ * Depending on wether you use the method "createStandardAction" or
+ * not, the actions will be automatically plugged in the toolbar and
+ * the menu associated to the module.
+ */
+void StandardApp_Module::createModuleActions() {
+ int actionId = this->createStandardAction("Test", this, SLOT(OnTest()),
+ "f1.png", "Run the default test function");
+ this->addActionInToolbar(actionId);
+}
+
+// Get compatible dockable windows.
+void StandardApp_Module::windows( QMap<int, int>& theMap ) const
+{
+ theMap.clear();
+ theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+ theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+}
+
+// Module's engine IOR
+QString StandardApp_Module::engineIOR() const
+{
+ CORBA::String_var anIOR = getApp()->orb()->object_to_string(getEngine());
+ return QString( anIOR.in() );
+}
+
+/*!
+ * This specifies the filename for the icon to be used for the study
+ * component associated to the module. Note that this icon could be
+ * different than the module icon which is defined by the
+ * SalomeApp.xml file dedicated to this module (see the shared
+ * resources folder dedicated to the module) and which is used for the
+ * toolbar of the SALOME application.
+ */
+QString StandardApp_Module::studyIconName()
+{
+ // By default, we return the module icone name
+ return iconName(); // inherited from CAM_Module
+}
+
+/*!
+ * This can be used to switch the layout of main application
+ * dockwidgets to one of the predefined configuration (see enum
+ * DockLayoutType). When a layout is set, the previous layout is
+ * memorized and can be restored using the unsetDockLayout function (1
+ * step undo). It is typically to be used in the functions
+ * activateModule to setup the layout and deactivateModule to unset
+ * the layout, i.e. restore to the previous state.
+ */
+void StandardApp_Module::setDockLayout(DockLayoutType layoutType) {
+ SUIT_Desktop* desk = getApp()->desktop();
+ _areaAtBottomLeftCorner = desk->corner(Qt::BottomLeftCorner);
+ _areaAtBottomRightCorner = desk->corner(Qt::BottomRightCorner);
+
+ if ( layoutType == DOCKLAYOUT_LEFT_VLARGE ) {
+ desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
+ desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
+ } else {
+ desk->setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea);
+ desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
+ }
+}
+
+/*!
+ * This function restores the layout state that was previously in
+ * place before the last setDockLayout call.
+ */
+void StandardApp_Module::unsetDockLayout() {
+ SUIT_Desktop* desk = getApp()->desktop();
+ desk->setCorner(Qt::BottomLeftCorner, _areaAtBottomLeftCorner);
+ desk->setCorner(Qt::BottomRightCorner, _areaAtBottomRightCorner);
+}
+
+// Module's activation
+bool StandardApp_Module::activateModule( SUIT_Study* theStudy )
+{
+ bool bOk = SalomeApp_Module::activateModule( theStudy );
+
+ setMenuShown( true );
+ setToolShown( true );
+
+ if ( this->createStudyComponentAtActivation() ) {
+ this->createStudyComponent(theStudy);
+ }
+
+ return bOk;
+}
+
+/*!
+ * This function should be implemented in a specialized class and must
+ * return true if you want to automatically create a study component
+ * for this module at activation step (when you first load the module
+ * for a given study). The default function return true.
+ */
+bool StandardApp_Module::createStudyComponentAtActivation() {
+ return true;
+}
+
+/*!
+ * This creates a root entry in the active study for this module, i.e
+ * a SComponent with the name of the module and the icon specified for
+ * the module. This component is associated to the engine (return by
+ * getEngine()) if the engine is a SALOMEDS::Driver.
+ */
+void StandardApp_Module::createStudyComponent(SUIT_Study* theStudy) {
+
+ SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
+ CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
+ SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
+ SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(theStudy->id());
+
+ SALOMEDS::SComponent_var aFather = aDSStudy->FindComponent(QCHARSTAR(moduleName()));
+ if (aFather->_is_nil())
+ {
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aDSStudy->NewBuilder();
+ aFather = aStudyBuilder->NewComponent(QCHARSTAR(moduleName()));
+ SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName");
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue(QCHARSTAR(moduleName()));
+ aName->Destroy();
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap");
+ SALOMEDS::AttributePixMap_var aPixMap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+ aPixMap->SetPixMap(QCHARSTAR(studyIconName()));
+
+ // WARN: The engine should be associated to the SComponent IF
+ // AND ONLY IF it is a SALOMEDS::Driver. Otherwise, there is no
+ // need to do that, and it could even lead to exception
+ // raising (eh, you work on SALOME isn't it?)
+ SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(this->getEngine());
+ if ( ! driver->_is_nil() ) {
+ STDLOG("Associate the SComponent to the engine");
+ aStudyBuilder->DefineComponentInstance(aFather, this->getEngine());
+ }
+ }
+
+}
+
+// Module's deactivation
+bool StandardApp_Module::deactivateModule( SUIT_Study* theStudy )
+{
+ setMenuShown( false );
+ setToolShown( false );
+
+ return SalomeApp_Module::deactivateModule( theStudy );
+}
+
+void StandardApp_Module::OnTest()
+{
+ // Just for test
+ STDLOG("OnTest: engine IOR = "<<QCHARSTAR(engineIOR()));
+}
+
--- /dev/null
+// Copyright (C) 2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+// Author : Guillaume Boulant (EDF)
+
+#ifndef _STANDARDAPP_MODULE_HXX_
+#define _STANDARDAPP_MODULE_HXX_
+
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Module.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Component)
+
+#include <QString>
+
+/*!
+ * This class is provided as the base class for the standard gui part
+ * of a SALOME module. To define a gui part, you just have to
+ * implement the virtual functions:
+ * - getEngine() to specify the engine component associated to this module
+ * - createModuleActions(...) to specify the action functions
+ * - createModuleWidgets(...) to specify special additionnal widgets
+ *
+ * The gui part of a SALOME module is an extension of the SALOME
+ * client Application for this module. Technically speaking, it
+ * consists in a plugin that provides a derived class of CAM_Module
+ * (provided by the GUI module).
+ *
+ * A standard gui is the standard design for most of SALOME module
+ * (object browser on the left, viewer on the rigth, python console on
+ * the bottom, and toolbox in the toolbar with standard definition of
+ * the tool function). This standard design suggests also to specify
+ * the engine associated to the module by implementing the virtual
+ * pure function getEngine(). The engine of a module is the SALOME
+ * component that is associated to the study component for this
+ * module, and generally which is responsible for the persistency
+ * functions or data management for the module.
+ *
+ * See a use case example in the test module Xsalome provided by the
+ * test package (tst/module/gui/Xsalome.hxx and
+ * tst/module/gui/factory.cxx in the XSALOME library).
+ */
+class StandardApp_Module: public SalomeApp_Module
+{
+ Q_OBJECT
+
+public:
+
+ // ================================================================
+ // This part defines the standard interface of the SalomeApp_Module
+ // ================================================================
+
+ StandardApp_Module();
+ void initialize( CAM_Application* );
+ QString engineIOR() const;
+ virtual void windows( QMap<int, int>& theMap ) const;
+
+public slots:
+ bool deactivateModule( SUIT_Study* );
+ bool activateModule( SUIT_Study* );
+
+ // ================================================================
+ // This part defines the specific interface of this class
+ // ================================================================
+
+public:
+ /* Creates an action with standard default values */
+ int createStandardAction(const QString& label,
+ QObject * slotobject,
+ const char* slotmember,
+ const QString& iconName=QString(),
+ const QString& tooltip=QString(),
+ const int identifier=ACTIONID_UNDEFINED);
+
+ void addActionInToolbar(int actionId);
+ void addActionInMenubar(int actionId);
+ void addActionInPopupMenu(int actionId,const QString& rule="client='ObjectBrowser'");
+
+protected:
+ /* Implement this to create additionnal widget (e.g. docked widget) */
+ virtual void createModuleWidgets();
+ /* Implement this to define the actions for this gui */
+ virtual void createModuleActions();
+
+ /* Use this to create a root entry in the study for this module */
+ void createStudyComponent(SUIT_Study*);
+ /* Implement this to say if study component entry should be created
+ at activation step */
+ virtual bool createStudyComponentAtActivation();
+
+ /* The engine is the SALOME component associated to the study */
+ virtual Engines::EngineComponent_ptr getEngine() const = 0;
+ // Note that the function getEngine() is virtual pure and must be
+ // implemented in the specific inherited classes. Note also that the
+ // const flag is required because getEngine is used by functions
+ // with const flags (see for ex: engineIOR()).
+ virtual QString studyIconName();
+
+ QIcon createIcon(const QString& iconName);
+ int newActionId();
+
+ enum DockLayoutType {
+ DOCKLAYOUT_BOTTOM_HLARGE, // Bottom is Horizontal Large
+ DOCKLAYOUT_LEFT_VLARGE, // Left is Vertical Large
+ };
+ virtual void setDockLayout(DockLayoutType layoutType);
+ virtual void unsetDockLayout();
+
+ SUIT_ResourceMgr* _resourceMgr;
+ int _defaultMenuId;
+ int _defaultToolbarId;
+
+ static int ACTIONID_DEFAULT_INIT_VALUE;
+ static int ACTIONID_UNDEFINED;
+
+private:
+ int _actionId_internalCount;
+ Qt::DockWidgetArea _areaAtBottomLeftCorner;
+ Qt::DockWidgetArea _areaAtBottomRightCorner;
+
+ // =========================================================
+ // This part defines slots for test purposes
+ // =========================================================
+
+protected slots:
+ void OnTest();
+};
+
+#endif
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = LightApp
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4
-
-QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-HDF5_INCLUDES = $$(HDF5HOME)/include
-
-KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome
-
-VTK_INCLUDES = $$(VTKHOME)/include/vtk
-
-QWT_INCLUDES = $$(QWTHOME)/include
-
-PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4
-
-INCLUDEPATH += $${PYTHON_INCLUDES} $${QT_INCLUDES} $${CAS_CPPFLAGS} $${HDF5_INCLUDES} $${KERNEL_CXXFLAGS} ../SUIT ../STD ../CAM ../LogWindow ../Prs ../Qtx ../Event #../ObjBrowser
-
-#if ENABLE_VTKVIEWER
- INCLUDEPATH += $${VTK_INCLUDES} ../VTKViewer
-#else
-# DEFINES += DISABLE_VTKVIEWER
-#endif
-
-#if ENABLE_PLOT2DVIEWER
- INCLUDEPATH += $${QWT_INCLUDES} ../Plot2d
-#else
-# DEFINES += DISABLE_PLOT2DVIEWER
-#endif
-
-#if ENABLE_OCCVIEWER
- INCLUDEPATH += ../OCCViewer
-#else !ENABLE_OCCVIEWER
-# DEFINES += DISABLE_OCCVIEWER
-#endif
-
-#if ENABLE_PYCONSOLE
- INCLUDEPATH += $${PYTHON_INCLUDES} ../PyConsole ../PyInterp
-#else !ENABLE_PYCONSOLE
-# DEFINES += DISABLE_PYCONSOLE
-#endif
-
-#if ENABLE_GLVIEWER
- INCLUDEPATH += ../GLViewer
-#else !ENABLE_GLVIEWER
-# DEFINES += DISABLE_GLVIEWER
-#endif
-
-#if ENABLE_SUPERVGRAPHVIEWER
- INCLUDEPATH += ../SUPERVGraph
-#else !ENABLE_SUPERVGRAPHVIEWER
-# DEFINES += DISABLE_SUPERVGRAPHVIEWER
-#endif
-
-#if ENABLE_SALOMEOBJECT
-
- INCLUDEPATH += ../OBJECT
-#if ENABLE_PLOT2DVIEWER
- INCLUDEPATH += ../SPlot2d
-#endif
-
-#if ENABLE_OCCVIEWER
- INCLUDEPATH += ../SOCC
-#endif
-
-#if ENABLE_VTKVIEWER
- INCLUDEPATH += ../SVTK
-#endif
-
-#else !ENABLE_SALOMEOBJECT
-# DEFINES += DISABLE_SALOMEOBJECT
-
-#endif
-
-QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-HDF5_LIBS = -L$$(HDF5HOME)/lib -lhdf5
-
-KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome
-
-PYTHON_LIBS = -L$$(PYTHONHOME)/lib/python2.4/config -lpython2.4 -ldl -lutil
-
-LIBS += $${QT_MT_LIBS} -L../../lib -lsuit -lstd -lCAM -lLogWindow $${CAS_KERNEL} -lSalomePrs $${HDF5_LIBS} $${KERNEL_LDFLAGS} -lSalomeHDFPersist #-lObjBrowser
-
-#if ENABLE_PYCONSOLE
- LIBS += $${PYTHON_LIBS}
-#endif
-
-#if ENABLE_SALOMEOBJECT
- LIBS += -lSalomeObject
-#endif
-
-#if ENABLE_VTKVIEWER
- LIBS += -lVTKViewer
-#if ENABLE_SALOMEOBJECT
- LIBS += -lSVTK
-#endif
-#endif
-
-#if ENABLE_OCCVIEWER
- LIBS += -lOCCViewer
-#if ENABLE_SALOMEOBJECT
- LIBS += -lSOCC
-#endif
-#endif
-
-#if ENABLE_GLVIEWER
- LIBS += -lGLViewer
-#endif
-
-#if ENABLE_PLOT2DVIEWER
- LIBS += -lPlot2d
-#if ENABLE_SALOMEOBJECT
- LIBS += -lSPlot2d
-#endif
-#endif
-
-#if ENABLE_PYCONSOLE
- LIBS += -lPyInterp -lPyConsole
-#endif
-
-#if ENABLE_SUPERVGRAPHVIEWER
- LIBS += -lSUPERVGraph
-#endif
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += LIGHTAPP_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = LightApp.h
-HEADERS += LightApp_AboutDlg.h
-HEADERS += LightApp_Application.h
-HEADERS += LightApp_DataModel.h
-HEADERS += LightApp_DataObject.h
-HEADERS += LightApp_DataOwner.h
-HEADERS += LightApp_DataSubOwner.h
-HEADERS += LightApp_Dialog.h
-HEADERS += LightApp_Displayer.h
-HEADERS += LightApp_Driver.h
-HEADERS += LightApp_EventFilter.h
-HEADERS += LightApp_HDFDriver.h
-HEADERS += LightApp_Module.h
-HEADERS += LightApp_ModuleAction.h
-HEADERS += LightApp_ModuleDlg.h
-HEADERS += LightApp_NameDlg.h
-#HEADERS += LightApp_OBFilter.h
-HEADERS += LightApp_OBSelector.h
-HEADERS += LightApp_Operation.h
-HEADERS += LightApp_Selection.h
-HEADERS += LightApp_SelectionMgr.h
-HEADERS += LightApp_ShowHideOp.h
-HEADERS += LightApp_Study.h
-HEADERS += LightApp_SwitchOp.h
-HEADERS += LightApp_Preferences.h
-HEADERS += LightApp_PreferencesDlg.h
-HEADERS += LightApp_RootObject.h
-HEADERS += LightApp_UpdateFlags.h
-HEADERS += LightApp_WidgetContainer.h
-
-#if ENABLE_VTKVIEWER
-#if ENABLE_SALOMEOBJECT
- HEADERS += LightApp_VTKSelector.h
-#endif
-#endif
-#if ENABLE_OCCVIEWER
- HEADERS += LightApp_OCCSelector.h
-#endif
-#if ENABLE_GLVIEWER
- HEADERS += LightApp_GLSelector.h
-#endif
-
-SOURCES = LightApp_AboutDlg.cxx
-SOURCES += LightApp_Application.cxx
-SOURCES += LightApp_DataModel.cxx
-SOURCES += LightApp_DataObject.cxx
-SOURCES += LightApp_DataOwner.cxx
-SOURCES += LightApp_DataSubOwner.cxx
-SOURCES += LightApp_Dialog.cxx
-SOURCES += LightApp_Displayer.cxx
-SOURCES += LightApp_Driver.cxx
-SOURCES += LightApp_EventFilter.cxx
-SOURCES += LightApp_HDFDriver.cxx
-SOURCES += LightApp_Module.cxx
-SOURCES += LightApp_ModuleAction.cxx
-SOURCES += LightApp_ModuleDlg.cxx
-SOURCES += LightApp_NameDlg.cxx
-#SOURCES += LightApp_OBFilter.cxx
-SOURCES += LightApp_OBSelector.cxx
-SOURCES += LightApp_Operation.cxx
-SOURCES += LightApp_Selection.cxx
-SOURCES += LightApp_SelectionMgr.cxx
-SOURCES += LightApp_ShowHideOp.cxx
-SOURCES += LightApp_Study.cxx
-SOURCES += LightApp_SwitchOp.cxx
-SOURCES += LightApp_Preferences.cxx
-SOURCES += LightApp_PreferencesDlg.cxx
-SOURCES += LightApp_WidgetContainer.cxx
-
-#if ENABLE_VTKVIEWER
-#if ENABLE_SALOMEOBJECT
- SOURCES += LightApp_VTKSelector.cxx
-#endif
-#endif
-#if ENABLE_OCCVIEWER
- SOURCES += LightApp_OCCSelector.cxx
-#endif
-#if ENABLE_GLVIEWER
- SOURCES += LightApp_GLSelector.cxx
-#endif
-
-TRANSLATIONS = resources/LightApp_images.ts \
- resources/LightApp_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
createAction( CloseId, tr( "TOT_CLOSE" ), QIcon(), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ),
- Qt::SHIFT+Qt::Key_C, desk, false, this, SLOT( onCloseWindow() ) );
+ Qt::CTRL+Qt::Key_F4, desk, false, this, SLOT( onCloseWindow() ) );
createAction( CloseAllId, tr( "TOT_CLOSE_ALL" ), QIcon(), tr( "MEN_DESK_CLOSE_ALL" ), tr( "PRP_CLOSE_ALL" ),
0, desk, false, this, SLOT( onCloseAllWindow() ) );
createAction( GroupAllId, tr( "TOT_GROUP_ALL" ), QIcon(), tr( "MEN_DESK_GROUP_ALL" ), tr( "PRP_GROUP_ALL" ),
#endif
createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
- Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
+ Qt::ALT+Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
createMenu( RenameId, windowMenu, -1 );
int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
virtual void run()
{
- if ( !myApp.isEmpty()) {
- QString aCommand = QString( "%1 %2 \"%3\"" ).arg( myApp, myParams, myHelpFile );
- if ( !myContext.isEmpty() )
- aCommand += "#" + myContext;
+ if ( !myApp.isEmpty() && !myHelpFile.isEmpty()) {
+ QString aCommand = QString( "%1 %2 \"%3%4\"" ).arg( myApp, myParams, myHelpFile, myContext.isEmpty() ? QString("") : QString( "#%1" ).arg( myContext ) );
QProcess* proc = new QProcess();
const QString& theFileName,
const QString& theContext )
{
+ QString fileName = theFileName;
+ QString context = theContext;
+ if ( !QFile::exists( fileName ) && theContext.isEmpty() ) {
+ // context might be passed within theFileName argument
+ QStringList comps = fileName.split("#");
+ if ( comps.count() > 1 ) {
+ context = comps.last();
+ comps.removeLast();
+ fileName = comps.join("#");
+ }
+ }
+
QString homeDir = "";
if ( !theComponentName.isEmpty() ) {
QString dir = getenv( ( theComponentName + "_ROOT_DIR" ).toLatin1().constData() );
Qtx::addSlash( theComponentName ) );
}
- QString helpFile = QFileInfo( homeDir + theFileName ).absoluteFilePath();
+ QString helpFile = QFileInfo( homeDir + fileName ).absoluteFilePath();
SUIT_ResourceMgr* resMgr = resourceMgr();
QString platform;
#ifdef WIN32
QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
if ( !anApp.isEmpty() ) {
- RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile, theContext );
+ RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile, context );
rs->start();
}
else {
}
}
else {
- QtxWebBrowser::loadUrl(getFile() + helpFile, theContext );
+ QtxWebBrowser::loadUrl(getFile() + helpFile, context );
}
}
return true;
}
+/*!
+ Does nothing by default. Should be redefined in light modules
+ that want to participate in "Dump study" operation.
+*/
+bool LightApp_DataModel::dumpPython( const QString&, CAM_Study*, bool, QStringList& )
+{
+ return true;
+}
+
/*!
Emit closed()
*/
*/
void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* )
{
- LightApp_ModuleObject* modelRoot = dynamic_cast<LightApp_ModuleObject*>( root() );
+ // san: Previously modelRoot was casted to LightApp_ModuleObject*,
+ // BUT this is incorrect: in full SALOME the model root has different type.
+ // Hopefully LightApp_DataObject* is sufficient here.
+ LightApp_DataObject* modelRoot = dynamic_cast<LightApp_DataObject*>( root() );
DataObjectList ch;
QMap<SUIT_DataObject*,int> aMap;
if( modelRoot )
build();
- modelRoot = dynamic_cast<LightApp_ModuleObject*>( root() );
+ modelRoot = dynamic_cast<LightApp_DataObject*>( root() );
if( modelRoot )
{
DataObjectList new_ch = modelRoot->children();
{
SUIT_AbstractModel* m = dynamic_cast<SUIT_AbstractModel*>( browser ? browser->model() : 0 );
if( m )
- m->unregisterColumn( groupId(), name );
+ m->unregisterColumn( groupId(), name );
+}
+
+/*!
+ Creates the data model's root (module object) using the study services.
+ This is important because different study classes use different moduel object classes.
+ Therefore creation of the module object cannot be done at the data model level
+ where the type of the current study instance should not be known.
+ The module object returned by this method should be then passed to the model's setRoot().
+ \return the module object instance corresponding to the study type
+ \sa CAM_DataModel class
+*/
+CAM_ModuleObject* LightApp_DataModel::createModuleObject( SUIT_DataObject* theRoot ) const
+{
+ LightApp_RootObject* aStudyRoot = dynamic_cast<LightApp_RootObject*>( theRoot );
+ if ( !aStudyRoot )
+ return 0;
+
+ LightApp_Study* aStudy = aStudyRoot->study();
+ if ( aStudy )
+ return aStudy->createModuleObject( const_cast<LightApp_DataModel*>( this ),
+ theRoot );
+ return 0;
}
class LightApp_Study;
class LightApp_DataObject;
class SUIT_DataBrowser;
+class CAM_ModuleObject;
/*!
Description : Base class of data model
virtual bool save( QStringList& );
virtual bool saveAs( const QString&, CAM_Study*, QStringList& );
virtual bool close();
+ virtual bool dumpPython( const QString&,
+ CAM_Study*,
+ bool,
+ QStringList& );
virtual void update( LightApp_DataObject* = 0, LightApp_Study* = 0 );
LightApp_Study* getStudy() const;
virtual void build();
virtual void updateWidgets();
+ virtual CAM_ModuleObject* createModuleObject( SUIT_DataObject* theRoot ) const;
private:
int myGroupId;
return QString();
}
+/*!
+ \brief Returns the string identifier of the data objects referenced by this one.
+
+ This method should be reimplemented in the subclasses.
+ Default implementation returns null string.
+
+ \return ID string of the referenced data object
+*/
+QString LightApp_DataObject::refEntry() const
+{
+ return QString();
+}
+
+/*!
+ \brief Tells if this data objects is a reference to some other or not.
+
+ The base implementation retuns true, if refEntry() returns non-empty string.
+
+ \return true if refEntry() is a non-empty string.
+*/
+bool LightApp_DataObject::isReference() const
+{
+ return !refEntry().isEmpty();
+}
+
/*!
\brief Get the data object unique key.
\return data object key
/*!
\brief Get object text data for the specified column.
- Column with \a id = 0 (NameId) is supposed to be used
+ Column with \a id == NameId is supposed to be used
to get the object name.
- Column with \a id = 1 (EntryId) is supposed to be used
+ Column with \a id == EntryId is supposed to be used
to get the object entry.
+ Column with \a id == RefEntryId is supposed to be used
+ to show the entry of the object referenced by this one.
\param id column id
\return object text data
*/
QString LightApp_DataObject::text( const int id ) const
{
- return id == EntryId ? entry() : CAM_DataObject::text( id );
+ QString txt;
+
+ switch ( id )
+ {
+ case EntryId:
+ txt = entry();
+ break;
+ case RefEntryId:
+ // Issue 21379: reference support at LightApp level
+ if ( isReference() )
+ txt = refEntry();
+ break;
+ default:
+ // Issue 21379: Note that we cannot return some specially decorated
+ // name string (like "* ref_obj_name") when isReference() returns true,
+ // since there is no generic way at LightApp level
+ // to query the object name using refEntry() up to now.
+ // TODO: Think how to make reference name generation
+ // more generic at move it here from SalomeApp level...
+ txt = CAM_DataObject::text( id );
+ break;
+ }
+
+ return txt;
+}
+
+/*!
+ \brief Get data object color for the specified column.
+ \param role color role
+ \param id column id (not used)
+ \return object color for the specified column
+*/
+QColor LightApp_DataObject::color( const ColorRole role, const int id) const
+{
+ QColor c;
+
+ // Issue 21379: reference support at LightApp level
+ // Centralized way for choosing text/background color for references.
+ // Colors for "normal" objects should be chosen by sub-classes.
+ switch ( role )
+ {
+ case Text:
+ case Foreground:
+ // text color (not selected item)
+ // TODO: think how to detect invalid references...
+ if ( isReference() )
+ c = QColor( 255, 0, 0 ); // valid reference (red)
+ break;
+
+ case Highlight:
+ // background color for the highlighted item
+ // TODO: think how to detect invalid references...
+ if ( isReference() )
+ c = QColor( 255, 0, 0 ); // valid reference (red)
+ break;
+
+ case HighlightedText:
+ // text color for the highlighted item
+ if ( isReference() )
+ c = QColor( 255, 255, 255 ); // white
+ break;
+
+ default:
+ break;
+ }
+
+ if ( !c.isValid() )
+ c = CAM_DataObject::color( role, id );
+
+ return c;
}
/*!
public:
//! Column id
- enum {
- EntryId = VisibilityId + 1 //!< entry column
+ enum {
+ EntryId = VisibilityId + 1, //!< entry column
+ RefEntryId //!< reference entry column
};
public:
virtual SUIT_DataObjectKey* key() const;
virtual QString entry() const;
+ virtual QString refEntry() const;
+ virtual bool isReference() const;
+
virtual QString text( const int = NameId ) const;
+ virtual QColor color( const ColorRole, const int = NameId ) const;
virtual SUIT_DataObject* componentObject() const;
virtual QString componentDataType() const;
#include <QtxComboBox.h>
#include <QtxActionSet.h>
#include <QVBoxLayout>
+#include <QApplication>
+#include <QEvent>
/*!
\class LightApp_ModuleAction::ActionSet
\param item identifier
*/
+/*!
+ \class LightApp_ModuleAction::ActivateEvent
+ \brief Internal class to represent custom event for transfer the activation item id.
+ \internal
+*/
+class LightApp_ModuleAction::ActivateEvent : public QEvent
+{
+public:
+ ActivateEvent( QEvent::Type type, int id ) : QEvent( type ), myId( id ) {};
+ ~ActivateEvent() {};
+
+ int id() const { return myId; }
+
+private:
+ int myId;
+};
+
/*!
\class LightApp_ModuleAction
\brief An action, representing the list of modules to be inserted to the
w->removeAction( mySet );
}
+/*!
+ \brief Perform delayed activation with specified id.
+ \param e custom event
+ \return \c true if the event was processed successfully and \c false otherwise.
+*/
+bool LightApp_ModuleAction::event( QEvent* e )
+{
+ if ( e->type() == QEvent::MaxUser )
+ activate( ((ActivateEvent*)e)->id(), false );
+ else
+ return QtxAction::event( e );
+}
+
/*!
\fn void LightApp_ModuleAction::moduleActivated( const QString& name );
\brief Emitted when the module is activated
*/
void LightApp_ModuleAction::onComboActivated( int id )
{
- activate( id, false );
+ QApplication::postEvent( this, new ActivateEvent( QEvent::MaxUser, id ) );
}
private:
class ActionSet;
class ComboAction;
+ class ActivateEvent;
public:
enum { None = 0x00, Buttons = 0x01, ComboItem = 0x02, All = Buttons | ComboItem };
virtual void addedTo( QWidget* );
virtual void removedFrom( QWidget* );
+ virtual bool event( QEvent* );
+
signals:
void moduleActivated( const QString& );
QList<QtxComboBox*> widgets() const;
-protected:
- virtual QWidget* createWidget( QWidget* );
-
signals:
void activatedId( int );
+
+protected:
+ virtual QWidget* createWidget( QWidget* );
};
#endif // LIGHTAPP_MODULEACTION_H
myDriver->RemoveTemporaryFiles(theModuleName, isDirDeleted);
}
+/*!
+ Virtual method that creates the root object (module object) for the given data model.
+ The type of the created object depends on the study class, therefore data model classes
+ should not create their module objects directly and should instead use
+ LightApp_DataModel::createModuleObject() that in its turn relies on this method.
+
+ \param theDataModel - data model instance to create a module object for
+ \param theParent - the module object's parent (normally it's the study root)
+ \return the module object instance
+ \sa LightApp_DataModel class, SalomeApp_Study class, LightApp_ModuleObject class
+*/
+CAM_ModuleObject* LightApp_Study::createModuleObject( LightApp_DataModel* theDataModel,
+ SUIT_DataObject* theParent ) const
+{
+ // Calling addComponent() for symmetry with SalomeApp_Study
+ // Currently it has empty implementation, but maybe in the future things will change...
+ LightApp_Study* that = const_cast<LightApp_Study*>( this );
+ that->addComponent( theDataModel );
+
+ // Avoid creating multiple module objects for the same module
+ CAM_ModuleObject* res = 0;
+
+ DataObjectList children = root()->children();
+ DataObjectList::const_iterator anIt = children.begin(), aLast = children.end();
+ for( ; !res && anIt!=aLast; anIt++ )
+ {
+ LightApp_ModuleObject* obj = dynamic_cast<LightApp_ModuleObject*>( *anIt );
+ if ( obj && obj->name() == theDataModel->module()->moduleName() )
+ res = obj;
+ }
+
+ if ( !res ){
+ res = new LightApp_ModuleObject( theDataModel, theParent );
+ }
+
+ return res;
+}
+
/*!
Fills list with components names
\param comp - list to be filled
class SUIT_Study;
class SUIT_Application;
class CAM_DataModel;
+class CAM_ModuleObject;
class LightApp_DataObject;
+class LightApp_DataModel;
//Map to store visual property of the object.
//Key: Name of the visual property of the object.
protected:
virtual bool openDataModel ( const QString&, CAM_DataModel* );
+ virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel,
+ SUIT_DataObject* theParent ) const;
signals:
void saved ( SUIT_Study* );
ViewMgrMap myViewMgrMap;
friend class LightApp_Application;
+ friend class LightApp_DataModel;
};
#endif
<parameter name="SUPERVGraph" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="QxGraph" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="ToolsGUI" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
+ <parameter name="LogWindow" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
</section>
<section name="desktop" >
<!-- Default GUI desktop state, position, size -->
<message>
<source>ABOUT_CLOSE</source>
<translation>&Fermer</translation>
- </message>
+ </message>
<message>
<source>APP_NAME</source>
<translation>SALOME</translation>
<message>
<source>BROWSER_TITLE</source>
<translation>Aide de SALOME</translation>
- </message>
+ </message>
<message>
<source>BROWSER_TOOLBAR_TITLE</source>
<translation>Navigation</translation>
- </message>
+ </message>
<message>
<source>BROWSER_FILEMENU</source>
<translation>&Fichier</translation>
- </message>
+ </message>
<message>
<source>BROWSER_CLOSE</source>
<translation>&Fermer</translation>
- </message>
+ </message>
<message>
<source>BROWSER_BACK</source>
<translation>Reculer</translation>
- </message>
+ </message>
<message>
<source>BROWSER_FORWARD</source>
<translation>Avancer</translation>
- </message>
+ </message>
<message>
<source>BROWSER_FIND</source>
<translation>&Chercher...</translation>
- </message>
+ </message>
<message>
<source>BROWSER_FINDNEXT</source>
<translation>Chercher &suivant</translation>
- </message>
+ </message>
<message>
<source>BROWSER_FINDPREV</source>
<translation>Chercher &précédent</translation>
<message>
<source>MEN_RENAME_OBJ</source>
<translation>Renommer</translation>
- </message>
+ </message>
<message>
<source>LOG_WINDOW</source>
<translation>Fenêtre de messages</translation>
</message>
<message>
<source>PREF_AUTO_SIZE_FIRST</source>
- <translation>Taille automatique pour la colonne "Nom"</translation>
+ <translation>Taille automatique pour la colonne "Nom"</translation>
</message>
<message>
<source>PREF_RESIZE_ON_EXPAND_ITEM</source>
</message>
<message>
<source>PREF_BROWSE_AFTER_APPLY_AND_CLOSE_ONLY</source>
- <translation>Seulement après "Appliquer et Fermer"</translation>
+ <translation>Seulement après "Appliquer et Fermer"</translation>
</message>
<message>
<source>PREF_BROWSE_ALWAYS</source>
<source>PREF_VIEWER_BACKGROUND</source>
<translation>Couleur de l'arrière-plan</translation>
</message>
+ <message>
+ <source>PREF_VIEWER_SELECTION</source>
+ <translation>Couleur de sélection</translation>
+ </message>
<message>
<source>PREF_XYVIEWER_BACKGROUND</source>
<translation>Couleur de l'arrière-plan (vue XY)</translation>
<source>PREF_FONT</source>
<translation>Police</translation>
</message>
+ <message>
+ <source>PREF_LEGEND_FONT</source>
+ <translation>Police de la légende</translation>
+ </message>
+ <message>
+ <source>PREF_FONT_COLOR</source>
+ <translation>Couleur de police de la légende</translation>
+ </message>
+ <message>
+ <source>PREF_SELECTED_FONT_COLOR</source>
+ <translation>Couleur de surlignement de la légende</translation>
+ </message>
<message>
<source>PREF_LEFT</source>
<translation>Gauche</translation>
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = lib
-TARGET = LogWindow
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include ../Qtx ../SUIT
-LIBS += -L../../lib -lqtx -lsuit
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += LOGWINDOW_EXPORTS
-
-HEADERS = LogWindow.h
-
-SOURCES = LogWindow.cxx
-
-TRANSLATIONS = resources/LogWindow_msg_en.ts
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
# Full (CORBA) SALOME packages
##
if GUI_ENABLE_CORBA
- SUBDIRS_CORBA = TOOLSGUI Session SalomeApp
+ SUBDIRS_CORBA = TOOLSGUI Session SalomeApp GuiHelpers TreeData
endif
+
##
# Extra Python packages
##
DIST_SUBDIRS = CASCatch Qtx Style DDS QDS ObjBrowser SUIT SUITApp STD CAF CAM LogWindow Prs Event OpenGLUtils \
OBJECT ViewerTools GLViewer VTKViewer SVTK OCCViewer SOCC Plot2d SPlot2d SUPERVGraph QxGraph QxScene \
- PyInterp PyConsole LightApp ResExporter TOOLSGUI Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT \
- GUI_PY
+ PyInterp PyConsole LightApp ResExporter TOOLSGUI Session SalomeApp GuiHelpers TreeData \
+ SALOME_SWIG SALOME_PY SALOME_PYQT GUI_PY
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = SalomeObject
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-CAS_LDPATH = -L$${CASROOT}/Linux/lib -lTKV3d
-
-INCLUDEPATH += ../../include $${CAS_CPPFLAGS}
-LIBS += $${CAS_LDPATH}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = SALOME_InteractiveObject.hxx
-HEADERS += Handle_SALOME_InteractiveObject.hxx
-HEADERS += SALOME_AISShape.hxx
-HEADERS += Handle_SALOME_AISShape.hxx
-HEADERS += SALOME_AISObject.hxx
-HEADERS += Handle_SALOME_AISObject.hxx
-HEADERS += SALOME_ListIO.hxx
-HEADERS += SALOME_ListIteratorOfListIO.hxx
-HEADERS += Handle_SALOME_ListNodeOfListIO.hxx
-HEADERS += SALOME_ListNodeOfListIO.hxx
-HEADERS += Handle_SALOME_Filter.hxx
-HEADERS += SALOME_Filter.hxx
-HEADERS += Handle_SALOME_TypeFilter.hxx
-HEADERS += SALOME_TypeFilter.hxx
-HEADERS += SALOME_DataMapOfIOMapOfInteger.hxx
-HEADERS += SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx
-HEADERS += Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
-HEADERS += SALOME_Selection.h
-HEADERS += SALOME_AISObject.ixx
-HEADERS += SALOME_AISObject.jxx
-HEADERS += SALOME_AISShape.ixx
-HEADERS += SALOME_AISShape.jxx
-HEADERS += SALOME_Filter.ixx
-HEADERS += SALOME_Filter.jxx
-HEADERS += SALOME_InteractiveObject.ixx
-HEADERS += SALOME_InteractiveObject.jxx
-HEADERS += SALOME_TypeFilter.ixx
-HEADERS += SALOME_TypeFilter.jxx
-HEADERS += SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
-
-SOURCES = SALOME_InteractiveObject.cxx
-SOURCES += SALOME_AISShape.cxx
-SOURCES += SALOME_AISObject.cxx
-SOURCES += SALOME_ListIO_0.cxx
-SOURCES += SALOME_ListIteratorOfListIO_0.cxx
-SOURCES += SALOME_ListNodeOfListIO_0.cxx
-SOURCES += SALOME_Filter.cxx
-SOURCES += SALOME_TypeFilter.cxx
-SOURCES += SALOME_DataMapOfIOMapOfInteger_0.cxx
-SOURCES += SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx
-SOURCES += SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = OCCViewer
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-OGL_INCLUDES =
-
-OGL_LIBS = -lGL -L/usr/X11R6/lib -lGLU
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-CAS_VIEWER = -L$${CASROOT}/Linux/lib -lTKV3d -lTKService
-
-INCLUDEPATH += ../../include $${OGL_INCLUDES} $${CAS_CPPFLAGS} ../Qtx ../SUIT
-LIBS += -L../../lib -lqtx -lsuit $${OGL_LIBS} $${CAS_KERNEL} $${CAS_VIEWER}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += OCCVIEWER_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = OCCViewer_AISSelector.h
-HEADERS += OCCViewer_ViewManager.h
-HEADERS += OCCViewer_ViewModel.h
-HEADERS += OCCViewer_ViewPort3d.h
-HEADERS += OCCViewer_ViewPort.h
-HEADERS += OCCViewer_ViewWindow.h
-HEADERS += OCCViewer_VService.h
-HEADERS += OCCViewer_CreateRestoreViewDlg.h
-HEADERS += OCCViewer.h
-HEADERS += OCCViewer_ClippingDlg.h
-HEADERS += OCCViewer_SetRotationPointDlg.h
-
-SOURCES = OCCViewer_AISSelector.cxx
-SOURCES += OCCViewer_ViewManager.cxx
-SOURCES += OCCViewer_ViewModel.cxx
-SOURCES += OCCViewer_ViewPort3d.cxx
-SOURCES += OCCViewer_ViewPort.cxx
-SOURCES += OCCViewer_ViewWindow.cxx
-SOURCES += OCCViewer_VService.cxx
-SOURCES += OCCViewer_CreateRestoreViewDlg.cxx
-SOURCES += OCCViewer_SetRotationPointDlg.cxx
-SOURCES += OCCViewer_ClippingDlg.cxx
-
-TRANSLATIONS = resources/OCCViewer_images.ts \
- resources/OCCViewer_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
protected:
protected slots:
- void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
- void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
- void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
- void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
+ virtual void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
+ virtual void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
+ virtual void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
+ virtual void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
void onDumpView();
void onChangeBgColor();
void onChangeBgImageTiled();
void onChangeBgImageStretched();
-private:
+protected:
Handle(V3d_Viewer) myV3dViewer;
Handle(V3d_Viewer) myV3dCollector;
<source>OCC_IMAGE_FILES</source>
<translation>Fichiers images (*.bmp *.png *.jpg *.jpeg *.eps *.ps)</translation>
</message>
+ <message>
+ <source>OCC_BG_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.gif *.pix *.xwd *.rgb *.rs)</translation>
+ </message>
<message>
<source>DSC_MAXIMIZE_VIEW</source>
<translation>Maximiser la vue</translation>
<source>DSC_MINIMIZE_VIEW</source>
<translation>Minimiser la vue</translation>
</message>
+ <message>
+ <source>DSC_SYNCHRONIZE_VIEW</source>
+ <translation>Synchroniser la vue</translation>
+ </message>
<message>
<source>MNU_MAXIMIZE_VIEW</source>
<translation>Maximiser</translation>
<source>MNU_MINIMIZE_VIEW</source>
<translation>Minimiser</translation>
</message>
+ <message>
+ <source>MNU_SYNCHRONIZE_VIEW</source>
+ <translation>Synchroniser</translation>
+ </message>
+ <message>
+ <source>MNU_SYNC_NO_VIEW</source>
+ <translation>[ Pas de vue appropriée ]</translation>
+ </message>
</context>
<context>
<name>OCCViewer_CreateRestoreViewDlg</name>
</message>
<message>
<source>MEN_CHANGE_IMAGE</source>
- <translation>Régler/Changer l''image d'arrière-plan...</translation>
+ <translation>Régler/Changer l''image d'arrière-plan...</translation>
</message>
<message>
<source>SELECT_IMAGE</source>
lib_LTLIBRARIES = libPlot2d.la
# header files
-salomeinclude_HEADERS = \
- Plot2d.h \
- Plot2d_PlotItems.h \
- Plot2d_Object.h \
- Plot2d_Curve.h \
- Plot2d_Histogram.h \
- Plot2d_FitDataDlg.h \
- Plot2d_Prs.h \
- Plot2d_SetupViewDlg.h \
- Plot2d_ViewFrame.h \
- Plot2d_ViewManager.h \
- Plot2d_ViewModel.h \
- Plot2d_ViewWindow.h \
- Plot2d_SetupCurveDlg.h \
- Plot2d_SetupCurveScaleDlg.h \
- Plot2d_ToolTip.h
+salomeinclude_HEADERS = \
+ Plot2d.h \
+ Plot2d_PlotItems.h \
+ Plot2d_Object.h \
+ Plot2d_Curve.h \
+ Plot2d_Histogram.h \
+ Plot2d_FitDataDlg.h \
+ Plot2d_Prs.h \
+ Plot2d_SetupViewDlg.h \
+ Plot2d_ViewFrame.h \
+ Plot2d_ViewManager.h \
+ Plot2d_ViewModel.h \
+ Plot2d_ViewWindow.h \
+ Plot2d_SetupCurveDlg.h \
+ Plot2d_ToolTip.h \
+ Plot2d_SetupCurveScaleDlg.h
+
+if ENABLE_PYCONSOLE
+salomeinclude_HEADERS += \
+ Plot2d_AnaliticCurve.h \
+ Plot2d_AnaliticCurveDlg.h \
+ Plot2d_AnaliticParcer.h
+endif
+
dist_libPlot2d_la_SOURCES = \
Plot2d.cxx \
Plot2d_ViewWindow.cxx \
Plot2d_SetupCurveDlg.cxx \
Plot2d_SetupCurveScaleDlg.cxx \
- Plot2d_ToolTip.cxx
+ Plot2d_ToolTip.cxx
+
+if ENABLE_PYCONSOLE
+dist_libPlot2d_la_SOURCES += \
+ Plot2d_AnaliticCurve.cxx \
+ Plot2d_AnaliticCurveDlg.cxx \
+ Plot2d_AnaliticParcer.cxx
+endif
MOC_FILES = \
Plot2d_FitDataDlg_moc.cxx \
Plot2d_SetupCurveDlg_moc.cxx \
Plot2d_SetupCurveScaleDlg_moc.cxx \
Plot2d_ToolTip_moc.cxx
+
+if ENABLE_PYCONSOLE
+MOC_FILES += Plot2d_AnaliticCurveDlg_moc.cxx
+endif
+
nodist_libPlot2d_la_SOURCES = $(MOC_FILES)
dist_salomeres_DATA = \
resources/plot2d_print.png \
resources/plot2d_settings.png \
resources/plot2d_splines.png \
+ resources/plot2d_analitic_curve.png \
resources/plot2d_zoom.png
nodist_salomeres_DATA = \
libPlot2d_la_CPPFLAGS = $(QT_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) \
-I$(srcdir)/../Qtx -I$(srcdir)/../SUIT
-libPlot2d_la_LDFLAGS = $(QWT_LIBS) $(QT_MT_LIBS) ../SUIT/libsuit.la
+libPlot2d_la_LDFLAGS = $(QWT_LIBS) $(QT_MT_LIBS) $(PYTHON_LIBS) ../SUIT/libsuit.la
#include <QPainter>
+#include <qwt_plot.h>
+#include <qwt_plot_curve.h>
+
+const int MSIZE = 9;
+const int MAX_ATTEMPTS = 10; // max attempts
+
+// color tolerance (used to compare color values)
+const long COLOR_DISTANCE = 100;
+
+
+
+/*!
+ Constructor
+*/
+Plot2d_Point::Plot2d_Point()
+ : x( 0. ), y( 0. )
+{
+}
+
+/*!
+ Constructor
+*/
+Plot2d_Point::Plot2d_Point( double theX, double theY, const QString& theText )
+ : x( theX ), y( theY ), text( theText )
+{
+}
+
+
/*!
\brief Convert Plot2d marker type to Qwt marker type.
\param m Plot2d marker type
{
drawMarker( painter, QPoint( x, y ), QRect( 0, 0, w, h ), plot2qwtMarker( type ), color );
}
+
+
+/*!
+ \brief Create icon pixmap according to the marker type.
+ \param size icon size
+ \param type marker type
+ \param color icon color
+ \return icon
+*/
+QPixmap Plot2d::markerIcon(const QSize &size, const QColor& color, Plot2d::MarkerType type )
+{
+
+ QPixmap px( size );
+ px.fill( QColor( 255, 255, 255, 0 ) );
+ QPainter p( &px );
+ Plot2d::drawMarker( &p, size.width()/2, size.height()/2, MSIZE, MSIZE, type, color );
+ return px;
+}
+
+
+/*!
+ \brief Create icon pixmap according to the line type.
+ \param size icon size
+ \param type line type
+ \param color icon color
+ \return icon
+*/
+QPixmap Plot2d::lineIcon( const QSize& size, const QColor& color, Plot2d::LineType type )
+{
+
+ QPixmap px( size );
+ px.fill( QColor( 255, 255, 255, 0 ) );
+ QPainter p( &px );
+ drawLine( &p, 5, size.height()/2, size.width()-5, size.height()/2, type,
+ color, 1 );
+ return px;
+}
+
+/*!
+ Gets new unique marker for item if possible
+*/
+void Plot2d::getNextMarker( const int rtti, const QwtPlot* thePlot, QwtSymbol::Style& typeMarker,
+ QColor& color, Qt::PenStyle& typeLine )
+{
+ bool bOk = false;
+ int cnt = 0;
+ while ( !bOk ) {
+ int aRed = (int)( 256.0 * rand() / RAND_MAX ); // generate random color
+ int aGreen = (int)( 256.0 * rand() / RAND_MAX ); // ...
+ int aBlue = (int)( 256.0 * rand() / RAND_MAX ); // ...
+ int aMarker = (int)( 9.0 * rand() / RAND_MAX ) + 1;// 9 markers types( not including empty )
+ int aLine = (int)( 5.0 * rand() / RAND_MAX ) + 1;// 5 line types ( not including empty )
+
+ typeMarker = ( QwtSymbol::Style )aMarker;
+ color = QColor( aRed, aGreen, aBlue );
+ typeLine = ( Qt::PenStyle )aLine;
+
+ bOk = ( ++cnt == MAX_ATTEMPTS ) || !existMarker( rtti, thePlot, typeMarker, color, typeLine );
+ }
+}
+
+/*!
+ Checks if marker belongs to any enitity
+*/
+bool Plot2d::existMarker( const int rtti, const QwtPlot* thePlot, const QwtSymbol::Style typeMarker,
+ const QColor& color, const Qt::PenStyle typeLine )
+{
+ bool ok = false;
+
+ QColor bgColor = thePlot->palette().color( QPalette::Background );
+ if ( closeColors( color, bgColor ) ) {
+ ok = true;
+ }
+ else {
+ QwtPlotItemList anItems = thePlot->itemList();
+ QwtPlotItemIterator anIt = anItems.begin(), aLast = anItems.end();
+ QwtPlotItem* anItem;
+ for ( ; anIt != aLast && !ok; anIt++ ) {
+ anItem = *anIt;
+ if ( anItem && anItem->rtti() == rtti ) {
+ QwtPlotCurve* crv = dynamic_cast<QwtPlotCurve*>( anItem );
+ if ( crv ) {
+ QwtSymbol::Style aStyle = crv->symbol().style();
+ QColor aColor = crv->pen().color();
+ Qt::PenStyle aLine = crv->pen().style();
+ ok = closeColors( aColor, color ) && aStyle == typeMarker && aLine == typeLine;
+ }
+ }
+ }
+ }
+ return ok;
+}
+
+/*!
+ Checks if two colors are close to each other
+ uses COLOR_DISTANCE variable as max tolerance for comparing of colors
+*/
+
+bool Plot2d::closeColors( const QColor& color1,
+ const QColor& color2,
+ int distance )
+{
+ long tol =
+ qAbs( color2.red() - color1.red() ) +
+ qAbs( color2.green() - color1.green() ) +
+ qAbs( color2.blue() - color1.blue() ) -
+ ( distance < 0 ? COLOR_DISTANCE : distance );
+
+ return tol <= 0;
+}
#include <Qt>
class QPainter;
+class QwtPlot;
+
+struct PLOT2D_EXPORT Plot2d_Point
+{
+ double x;
+ double y;
+ QString text;
+ Plot2d_Point();
+ Plot2d_Point( double theX, double theY, const QString& theText = QString() );
+};
+
+typedef QList<Plot2d_Point> pointList;
+
namespace Plot2d
{
void drawMarker( QPainter*, int, int, int, int,
MarkerType = Circle,
const QColor& = Qt::black );
+
+ QPixmap markerIcon( const QSize&, const QColor&,
+ Plot2d::MarkerType );
+
+ QPixmap lineIcon( const QSize&, const QColor&,
+ Plot2d::LineType );
+
+ void getNextMarker( const int rtti, const QwtPlot*, QwtSymbol::Style&,
+ QColor&, Qt::PenStyle& );
+
+ bool existMarker( const int rtti , const QwtPlot*, const QwtSymbol::Style,
+ const QColor&, const Qt::PenStyle );
+
+
+ bool closeColors( const QColor&,
+ const QColor&,
+ int distance = -1 );
+
}
#if defined WIN32
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = Plot2d
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-PYTHONVER=2.4
-PYTHONHOME=$$(PYTHONHOME)
-PYTHONINC=$${PYTHONHOME}/include/python$${PYTHONVER}
-
-QWTHOME=$$(QWTHOME)
-QWTINC=$${QWTHOME}/include
-QWTLIB=$${QWTHOME}/lib
-
-INCLUDEPATH += ../../include $${QWTINC} $${PYTHONINC}
-INCLUDEPATH += ../Qtx ../SUIT
-unix:LIBS += -L$${QWTLIB} -lqwt
-win32:LIBS += /LIBPATH:$$(QWTLIB)
-LIBS += -L../../lib -lqtx -lsuit
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += PLOT2D_EXPORTS
-
-HEADERS = Plot2d.h
-HEADERS += Plot2d_Curve.h
-HEADERS += Plot2d_FitDataDlg.h
-HEADERS += Plot2d_Prs.h
-HEADERS += Plot2d_SetupViewDlg.h
-HEADERS += Plot2d_ViewFrame.h
-HEADERS += Plot2d_ViewManager.h
-HEADERS += Plot2d_ViewModel.h
-HEADERS += Plot2d_ViewWindow.h
-HEADERS += Plot2d_SetupCurveDlg.h
-HEADERS += Plot2d_ToolTip.h
-
-SOURCES = Plot2d_Curve.cxx
-SOURCES += Plot2d_FitDataDlg.cxx
-SOURCES += Plot2d_Prs.cxx
-SOURCES += Plot2d_SetupViewDlg.cxx
-SOURCES += Plot2d_ViewFrame.cxx
-SOURCES += Plot2d_ViewManager.cxx
-SOURCES += Plot2d_ViewModel.cxx
-SOURCES += Plot2d_ViewWindow.cxx
-SOURCES += Plot2d_SetupCurveDlg.cxx
-SOURCES += Plot2d_ToolTip.cxx
-
-TRANSLATIONS = resources/Plot2d_msg_en.ts \
- resources/Plot2d_images.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnaliticCurve.cxx
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+#include "Plot2d_AnaliticParcer.h"
+#include "Plot2d_AnaliticCurve.h"
+#include "Plot2d_PlotItems.h"
+
+
+//Init static data;
+
+int Plot2d_AnaliticCurve::myNbCurves = 0;
+
+/*!
+ Constructor
+*/
+Plot2d_AnaliticCurve::Plot2d_AnaliticCurve() :
+ myAutoAssign(true),
+ myColor( 0, 0, 0 ),
+ myMarker( Plot2d::Circle ),
+ myMarkerSize( 0 ),
+ myLine( Plot2d::Solid ),
+ myLineWidth( 0 ),
+ myRangeBegin(0.0),
+ myRangeEnd(100.0),
+ myNbIntervals(100),
+ myExpression(""),
+ myAction(Plot2d_AnaliticCurve::ActAddInView),
+ myState(Plot2d_AnaliticCurve::StateNeedUpdate),
+ myCurve(0),
+ myActive(true)
+{
+ myName = QString("Analitic Curve %1").arg(++myNbCurves);
+}
+
+
+/*!
+ Destructor
+*/
+Plot2d_AnaliticCurve::~Plot2d_AnaliticCurve()
+{
+}
+
+/*!
+ Copy constructor. Makes deep copy of data
+*/
+Plot2d_AnaliticCurve::Plot2d_AnaliticCurve( const Plot2d_AnaliticCurve& curve )
+{
+ myAutoAssign = curve.isAutoAssign();
+ myColor = curve.getColor();
+ myMarker = curve.getMarker();
+ myMarkerSize = curve.getMarkerSize();
+ myLine = curve.getLine();
+ myLineWidth = curve.getLineWidth();
+ myRangeBegin = curve.getRangeBegin();
+ myRangeEnd = curve.getRangeEnd();
+ myNbIntervals= curve.getNbIntervals();
+ myPoints = curve.myPoints;
+ myAction = curve.getAction();
+ myName = curve.getName();
+ myExpression = curve.getExpression();
+ myState = curve.state();
+ myCurve = curve.myCurve;
+ myActive = curve.isActive();
+}
+
+/*!
+ operator=. Makes deep copy of data
+*/
+Plot2d_AnaliticCurve& Plot2d_AnaliticCurve::operator=( const Plot2d_AnaliticCurve& curve )
+{
+ myAutoAssign = curve.isAutoAssign();
+ myColor = curve.getColor();
+ myMarker = curve.getMarker();
+ myMarkerSize = curve.getMarkerSize();
+ myLine = curve.getLine();
+ myLineWidth = curve.getLineWidth();
+ myRangeBegin = curve.getRangeBegin();
+ myRangeEnd = curve.getRangeEnd();
+ myNbIntervals= curve.getNbIntervals();
+ myPoints = curve.myPoints;
+ myAction = curve.getAction();
+ myName = curve.getName();
+ myExpression = curve.getExpression();
+ myState = curve.state();
+ myCurve = curve.myCurve;
+ myActive = curve.isActive();
+ return *this;
+}
+
+/*!
+ Create plot object for the curve
+*/
+QwtPlotItem* Plot2d_AnaliticCurve::plotItem()
+{
+ if(!myCurve) {
+ myCurve = new Plot2d_QwtPlotCurve(QString(""));
+ updatePlotItem();
+ }
+ return myCurve;
+}
+
+/*!
+ Auto fill parameters of object by plot view
+*/
+void Plot2d_AnaliticCurve::autoFill( const QwtPlot* thePlot )
+{
+ QwtSymbol::Style typeMarker;
+ QColor color;
+ Qt::PenStyle typeLine;
+ Plot2d::getNextMarker( QwtPlotItem::Rtti_PlotCurve, thePlot, typeMarker, color, typeLine );
+
+ setColor( color );
+ setLine( Plot2d::qwt2plotLine( typeLine ));
+ setLineWidth(1);
+ setMarker( Plot2d::qwt2plotMarker( typeMarker ) );
+}
+
+/*!
+ Updates curve fields
+*/
+void Plot2d_AnaliticCurve::updatePlotItem()
+{
+ if ( !myCurve )
+ return;
+
+ Plot2d_QwtPlotCurve* aCurve = dynamic_cast<Plot2d_QwtPlotCurve*>(myCurve);
+
+ if(!aCurve)
+ return;
+
+ QwtPlot* aPlot = aCurve->plot();
+ if ( aPlot ) {
+ aCurve->detach();
+ aCurve->attach( aPlot );
+ }
+
+ Qt::PenStyle ps = Plot2d::plot2qwtLine( getLine() );
+ QwtSymbol::Style ms = Plot2d::plot2qwtMarker( getMarker() );
+
+ aCurve->setPen( QPen(getColor() , getLineWidth(), ps ) );
+
+ aCurve->setSymbol( QwtSymbol( ms, QBrush( getColor() ),
+ QPen( getColor()),
+ QSize( getMarkerSize() , getMarkerSize() ) ) );
+ double *x, *y;
+ long nb = getData( &x, &y );
+ aCurve->setData( x, y, nb );
+ aCurve->setTitle(getName());
+}
+
+
+/*!
+ Calculate the curve points.
+*/
+void Plot2d_AnaliticCurve::calculate() {
+ if( state() == Plot2d_AnaliticCurve::StateOk )
+ return;
+
+ if(myRangeBegin > myRangeEnd)
+ return;
+
+ Plot2d_AnaliticParcer* parcer = Plot2d_AnaliticParcer::parcer();
+ double* x = 0;
+ double* y = 0;
+ int nb = parcer->calculate(getExpression(), getRangeBegin(), getRangeEnd(),
+ getNbIntervals(),&x,&y);
+ if( nb > 0 ) {
+ myPoints.clear();
+ for( int i = 0; i < nb; i++ ) {
+ Plot2d_Point pnt(x[i], y[i]);
+ myPoints.append(pnt);
+ }
+ delete x;
+ delete y;
+ myState = Plot2d_AnaliticCurve::StateOk;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets object's data
+*/
+long Plot2d_AnaliticCurve::getData( double** theX, double** theY ) const
+{
+ int aNPoints = getNbIntervals() + 1;
+ *theX = new double[aNPoints];
+ *theY = new double[aNPoints];
+ for (int i = 0; i < aNPoints; i++) {
+ (*theX)[i] = myPoints[i].x;
+ (*theY)[i] = myPoints[i].y;
+ }
+ return aNPoints;
+}
+
+/*!
+ Sets curves's AutoAssign flag - in this case attributes will be set automatically
+*/
+void Plot2d_AnaliticCurve::setAutoAssign( bool on )
+{
+ if( myAutoAssign != on ) {
+ myAutoAssign = on;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets curve's AutoAssign flag state
+*/
+bool Plot2d_AnaliticCurve::isAutoAssign() const
+{
+ return myAutoAssign;
+}
+
+/*!
+ Sets curve's color.
+*/
+void Plot2d_AnaliticCurve::setColor( const QColor& color )
+{
+ if(myColor != color) {
+ myColor = color;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets curve's color
+*/
+QColor Plot2d_AnaliticCurve::getColor() const
+{
+ return myColor;
+}
+
+
+/*!
+ Sets marker type ( and resets AutoAssign flag )
+*/
+void Plot2d_AnaliticCurve::setMarker( Plot2d::MarkerType marker )
+{
+ if(myMarker != marker) {
+ myMarker = marker;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets marker type
+*/
+Plot2d::MarkerType Plot2d_AnaliticCurve::getMarker() const
+{
+ return myMarker;
+}
+
+/*!
+ Sets new marker size
+*/
+void Plot2d_AnaliticCurve::setMarkerSize( const int theSize )
+{
+ if( myMarkerSize != theSize ) {
+ myMarkerSize = theSize < 0 ? 0 : theSize;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets marker size
+*/
+int Plot2d_AnaliticCurve::getMarkerSize() const
+{
+ return myMarkerSize;
+}
+
+/*!
+ Sets line type
+*/
+void Plot2d_AnaliticCurve::setLine( Plot2d::LineType line )
+{
+ if(myLine != line) {
+ myLine = line;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets line type
+*/
+Plot2d::LineType Plot2d_AnaliticCurve::getLine() const
+{
+ return myLine;
+}
+
+
+/*!
+ Sets line width
+*/
+void Plot2d_AnaliticCurve::setLineWidth( const int lineWidth )
+{
+ if( myLineWidth != lineWidth ) {
+ myLineWidth = lineWidth < 0 ? 0 : lineWidth;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets line width
+*/
+int Plot2d_AnaliticCurve::getLineWidth() const
+{
+ return myLineWidth;
+}
+
+/*!
+ Sets number of points
+*/
+void Plot2d_AnaliticCurve::setNbIntervals( const long nb )
+{
+ if( myNbIntervals != nb ) {
+ myNbIntervals = nb < 1 ? 1 : nb;
+ myState = Plot2d_AnaliticCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets number of points
+*/
+long Plot2d_AnaliticCurve::getNbIntervals() const
+{
+ return myNbIntervals;
+}
+
+/*!
+ Sets X coordinate of the first curve points
+*/
+void Plot2d_AnaliticCurve::setRangeBegin( const double coord) {
+ if( myRangeBegin != coord ) {
+ myRangeBegin = coord;
+ myState = Plot2d_AnaliticCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets X coordinate of the first curve points
+*/
+double Plot2d_AnaliticCurve::getRangeBegin() const {
+ return myRangeBegin;
+}
+
+/*!
+ Sets X coordinate of the last curve points
+*/
+void Plot2d_AnaliticCurve::setRangeEnd( const double coord) {
+ if( myRangeEnd != coord ) {
+ myRangeEnd = coord;
+ myState = Plot2d_AnaliticCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets X coordinate of the last curve points
+*/
+double Plot2d_AnaliticCurve::getRangeEnd() const {
+ return myRangeEnd;
+}
+
+/*!
+ Sets the curve expression.
+*/
+void Plot2d_AnaliticCurve::setExpression( const QString& expr ) {
+ if( myExpression != expr ) {
+ myExpression = expr;
+ myState = Plot2d_AnaliticCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets the curve expression.
+*/
+QString Plot2d_AnaliticCurve::getExpression() const {
+ return myExpression;
+}
+
+/*!
+ Sets the curve name.
+*/
+void Plot2d_AnaliticCurve::setName( const QString& name ) {
+ if( myName != name ) {
+ myName = name;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets the curve name.
+*/
+QString Plot2d_AnaliticCurve::getName() const {
+ return myName;
+}
+
+
+/*!
+ Sets the curve action.
+*/
+void Plot2d_AnaliticCurve::setAction(const int act) {
+ if( act == Plot2d_AnaliticCurve::ActNothing ) {
+ myAction = act;
+ return;
+ }
+
+ if(myAction != Plot2d_AnaliticCurve::ActAddInView &&
+ myAction != Plot2d_AnaliticCurve::ActRemoveFromView) {
+ myAction = act;
+ }
+}
+
+/*!
+ Gets the curve action.
+*/
+int Plot2d_AnaliticCurve::getAction() const {
+ return myAction;
+}
+
+/*!
+ Gets the curve state.
+*/
+int Plot2d_AnaliticCurve::state() const {
+ return myState;
+}
+
+/*!
+ Sets the curve active status.
+*/
+void Plot2d_AnaliticCurve::setActive(const bool on) {
+ if( myActive != on ) {
+ myActive = on;
+ setAction(Plot2d_AnaliticCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets the curve active status.
+*/
+bool Plot2d_AnaliticCurve::isActive() const {
+ return myActive;
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnaliticCurve.h
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+#ifndef PLOT2D_ANALITIC_CURVE_H
+#define PLOT2D_ANALITIC_CURVE_H
+
+#include "Plot2d.h"
+
+
+class QwtPlot;
+class QwtPlotItem;
+
+
+class PLOT2D_EXPORT Plot2d_AnaliticCurve
+{
+public:
+
+ /*
+ Action enumeration.
+ */
+ enum {
+ ActAddInView = 0, //! Add curve in view
+ ActRemoveFromView, //! Remove curve from view
+ ActUpdateInView, //! Update curve in view
+ ActNothing //! Do nothing
+ };
+
+ /*
+ State enumeration.
+ */
+ enum {
+ StateOk = 0,
+ StateNeedUpdate
+ };
+
+ Plot2d_AnaliticCurve();
+ Plot2d_AnaliticCurve( const Plot2d_AnaliticCurve& );
+ Plot2d_AnaliticCurve& operator= ( const Plot2d_AnaliticCurve& );
+
+ virtual ~Plot2d_AnaliticCurve();
+
+ virtual QwtPlotItem* plotItem();
+ virtual void autoFill( const QwtPlot* );
+ virtual void updatePlotItem();
+
+ virtual void calculate();
+
+ long getData( double** , double** ) const;
+
+
+ void setAutoAssign( bool );
+ bool isAutoAssign( ) const;
+
+ void setColor( const QColor& );
+ QColor getColor() const;
+
+ void setMarker( Plot2d::MarkerType );
+ Plot2d::MarkerType getMarker() const;
+
+ void setMarkerSize( const int );
+ int getMarkerSize() const;
+
+ void setLine( Plot2d::LineType );
+ Plot2d::LineType getLine() const;
+
+ void setLineWidth( const int );
+ int getLineWidth() const;
+
+ void setNbIntervals( const long );
+ long getNbIntervals() const;
+
+ void setRangeBegin( const double );
+ double getRangeBegin() const;
+
+ void setRangeEnd( const double );
+ double getRangeEnd() const;
+
+ void setExpression( const QString& );
+ QString getExpression() const;
+
+ void setName( const QString& );
+ QString getName() const;
+
+ void setActive(const bool);
+ bool isActive() const;
+
+ void setAction(const int);
+ int getAction() const;
+ int state() const;
+
+
+protected:
+
+ bool myAutoAssign;
+ QColor myColor;
+ Plot2d::MarkerType myMarker;
+ int myMarkerSize;
+ Plot2d::LineType myLine;
+ int myLineWidth;
+ long myNbIntervals;
+ pointList myPoints;
+ double myRangeBegin;
+ double myRangeEnd;
+ QString myExpression;
+ QString myName;
+ int myAction;
+ int myState;
+ QwtPlotItem* myCurve;
+ bool myActive;
+
+private:
+ static int myNbCurves;
+
+};
+
+typedef QList<Plot2d_AnaliticCurve*> AnaliticCurveList;
+
+#endif //PLOT2D_ANALITIC_CURVE_H
+
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : Plot2d_AnaliticCurveDlg.cxx
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+//Local includes
+#include "Plot2d_AnaliticCurveDlg.h"
+#include "Plot2d_AnaliticCurve.h"
+#include "Plot2d_ViewFrame.h"
+
+//Qtx includes
+#include <QtxIntSpinBox.h>
+#include <QtxColorButton.h>
+
+//SUIT includes
+#include <SUIT_MessageBox.h>
+
+//Qt includes
+#include <QListWidget>
+#include <QGroupBox>
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QPushButton>
+
+//qwt includes
+#include <qwt_plot.h>
+#include <qwt_scale_div.h>
+
+
+//debug
+#include <iostream>
+
+// Controls
+#define MIN 0
+#define MAX 10000
+#define STEP 1
+#define MAX_LINE_WIDTH 10
+
+
+/*!
+ Constructor
+*/
+Plot2d_AnaliticCurveDlg::Plot2d_AnaliticCurveDlg( QWidget* parent, QwtPlot* plot )
+ : QDialog( parent , Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+ myPlot(plot)
+{
+ setWindowTitle( tr( "ANALITIC_CURVE_TLT" ) );
+ QGridLayout* mainLayout = new QGridLayout(this);
+
+ //Curves list widget
+ myCurvesList = new QListWidget( this );
+ myCurvesList->setSelectionMode(QAbstractItemView::SingleSelection);
+ myCurvesList->setMaximumSize(QSize(150, 16777215));
+
+ //Curve parameters group box
+ myCurveParams = new QGroupBox( tr( "AC_CURVE_PARAMS" ), this );
+ QGridLayout* paramsLayout = new QGridLayout( myCurveParams );
+
+ QLabel* formulaLabel = new QLabel( tr( "AC_FORMULA" ), myCurveParams );
+ myFormula = new QLineEdit( myCurveParams );
+
+ QLabel* nbIntervalsLabel = new QLabel( tr( "AC_NB_INTERVALS" ), myCurveParams );
+ myNbIntervals = new QtxIntSpinBox( 1, MAX, STEP, myCurveParams );
+
+ paramsLayout->addWidget( formulaLabel, 0, 0, 1, 1 );
+ paramsLayout->addWidget( myFormula, 0, 1, 1, 1 );
+ paramsLayout->addWidget( nbIntervalsLabel, 1, 0, 1, 1 );
+ paramsLayout->addWidget( myNbIntervals, 1, 1, 1, 1 );
+
+ //Curve properties group box
+ myCurveProps = new QGroupBox( tr( "AC_CURVE_PROPS" ), this );
+ QGridLayout* propsLayout = new QGridLayout( myCurveProps );
+
+ myAutoAssign = new QCheckBox( tr( "AC_AUTO_ASSIGN" ), myCurveProps );
+
+ QLabel* markerLabel = new QLabel( tr( "AC_MARKER_TYPE" ), myCurveProps );
+ myMarkerType = new QComboBox( myCurveProps );
+
+
+ QLabel* lineTypeLabel = new QLabel( tr( "AC_LINE_TYPE" ), myCurveProps );
+ myLineType = new QComboBox( myCurveProps );
+
+
+ QLabel* lineWidthLabel = new QLabel( tr( "AC_LINE_WIDTH" ), myCurveProps );
+ myLineWidth = new QtxIntSpinBox( MIN, MAX_LINE_WIDTH, STEP, myCurveProps );
+
+
+
+ QLabel* colorLabel = new QLabel( tr("AC_CURVE_COLOR"), myCurveProps );
+ myColor = new QtxColorButton(myCurveProps);
+
+ propsLayout->addWidget( myAutoAssign, 0, 0, 1, 1 );
+ propsLayout->addWidget( markerLabel, 1, 0, 1, 1 );
+ propsLayout->addWidget( myMarkerType, 1, 1, 1, 1 );
+ propsLayout->addWidget( lineTypeLabel, 2, 0, 1, 1 );
+ propsLayout->addWidget( myLineType, 2, 1, 1, 1 );
+ propsLayout->addWidget( lineWidthLabel, 3, 0, 1, 1 );
+ propsLayout->addWidget( myLineWidth, 3, 1, 1, 1 );
+ propsLayout->addWidget( colorLabel, 4, 0, 1, 1 );
+ propsLayout->addWidget( myColor, 4, 1, 1, 1 );
+
+ propsLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ), 3, 0, 1, 1 );
+ propsLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ), 3, 1, 1, 1 );
+
+
+ //Add && Remove buttons
+ QPushButton* addButton = new QPushButton( tr("AC_ADD_BTN"), this );
+ QPushButton* updateButton = new QPushButton( tr("AC_UPD_BTN"), this );
+ QPushButton* removeButton = new QPushButton( tr("AC_REM_BTN"), this );
+
+ //Ok && Close buttons
+ QFrame* frame = new QFrame( this );
+ QHBoxLayout* horizontalLayout = new QHBoxLayout(frame);
+
+ frame->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ) );
+ frame->setFrameShape( QFrame::StyledPanel );
+ frame->setFrameShadow( QFrame::Raised );
+
+ QPushButton* closeButton = new QPushButton( tr( "AC_CLOSE_BTN" ), frame );
+
+
+ horizontalLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ horizontalLayout->addWidget( closeButton );
+ horizontalLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+
+
+ mainLayout->addWidget( myCurvesList, 0, 0, 3, 1 );
+ mainLayout->addWidget( myCurveParams, 0, 1, 1, 5 );
+ mainLayout->addWidget( myCurveProps, 1, 1, 1, 5 );
+ mainLayout->addWidget( addButton, 2, 1, 1, 1 );
+ mainLayout->addItem( new QSpacerItem( 13, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 2, 2, 1, 1 );
+ mainLayout->addWidget( removeButton, 2, 3, 1, 1 );
+ mainLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 2, 4, 1, 1);
+ mainLayout->addWidget( updateButton, 2, 5, 1, 1);
+ mainLayout->addWidget(frame, 3, 0, 1, 6);
+
+ //Fill combobox
+ QColor cl = myMarkerType->palette().color( QPalette::Text );
+ QSize sz(16, 16);
+ myMarkerType->setIconSize(sz);
+
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::None ), tr( "NONE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Circle ), tr( "CIRCLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Rectangle ), tr( "RECTANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Diamond ), tr( "DIAMOND_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::DTriangle ), tr( "DTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::UTriangle ), tr( "UTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::LTriangle ), tr( "LTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::RTriangle ), tr( "RTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Cross ), tr( "CROSS_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::XCross ), tr( "XCROSS_MARKER_LBL" ) );
+
+ cl = myLineType->palette().color( QPalette::Text );
+ QSize lsz( 40, 16 );
+ myLineType->setIconSize( lsz );
+
+ myLineType->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::NoPen ), tr( "NONE_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Solid ), tr( "SOLID_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Dash ), tr( "DASH_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Dot ), tr( "DOT_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::DashDot ), tr( "DASHDOT_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::DashDotDot ), tr( "DAHSDOTDOT_LINE_LBL" ) );
+
+ //Connections
+ connect( closeButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( addButton, SIGNAL( clicked() ), this, SLOT( onAddCurve() ) );
+ connect( myAutoAssign, SIGNAL( stateChanged(int) ), this, SLOT( onAutoAssign(int) ) );
+ connect( removeButton, SIGNAL( clicked()), this, SLOT(onRemoveCurve()));
+ connect( updateButton, SIGNAL( clicked()), this, SLOT(onUpdateCurve()));
+ connectSelectionChanged();
+
+ //Default values
+ myNbIntervals->setValue(100);
+ checkState();
+}
+
+/*!
+ Destructor
+*/
+Plot2d_AnaliticCurveDlg::~Plot2d_AnaliticCurveDlg()
+{
+}
+
+void Plot2d_AnaliticCurveDlg::setCurveList( AnaliticCurveList& theList ) {
+ AnaliticCurveList::iterator it = theList.begin();
+ QListWidgetItem* newItem = 0;
+ Plot2d_AnaliticCurve* curve;
+ for( ;it != theList.end(); it++ ) {
+ curve = *it;
+ if(!curve) continue;
+ newItem = new QListWidgetItem(curve->getName());
+ newItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
+ newItem->setCheckState(Qt::Checked);
+ myCurvesList->addItem(newItem);
+ newItem->setCheckState(curve->isActive() ? Qt::Checked : Qt::Unchecked );
+ QVariant var;
+ var.setValue((void*)curve);
+ newItem->setData(Qt::UserRole,var);
+ }
+ setCurrentCurve(newItem);
+ checkState();
+}
+
+/*!
+ Return list of the curves.
+*/
+/*void Plot2d_AnaliticCurveDlg::reject() {
+ if( myCurvesList->count() == 0 )
+ QDialog::reject();
+
+ QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ QListWidgetItem* item = items.size() > 0 ? items[0] : 0;
+ if(item) {
+ if(!checkItem(item)) {
+ showErrorMsg();
+ return;
+ } else {
+ updateInView(myCurrentItem);
+ QDialog::reject();
+ }
+ }
+}
+*/
+
+/*!
+ Update curve parameters and curve properties.
+*/
+void Plot2d_AnaliticCurveDlg::setCurrentCurve(QListWidgetItem* item, bool select) {
+ if(item) {
+ QVariant var = item->data(Qt::UserRole);
+ Plot2d_AnaliticCurve* curve = (Plot2d_AnaliticCurve*)var.value<void*>();
+ if(curve) {
+ myFormula->setText( curve->getExpression() );
+ myNbIntervals->setValue( curve->getNbIntervals() );
+ myAutoAssign->setChecked( curve->isAutoAssign() );
+ if(!curve->isAutoAssign()) {
+ myMarkerType->setCurrentIndex( curve->getMarker() );
+ myLineType->setCurrentIndex( curve->getLine() );
+ myLineWidth->setValue( curve->getLineWidth() );
+ myColor->setColor( curve->getColor() );
+ } else {
+ myMarkerType->setCurrentIndex( 0 );
+ myLineType->setCurrentIndex( 0 );
+ myLineWidth->setValue( 1 );
+ myColor->setColor( QColor() );
+ }
+ myCurrentItem = item;
+ if( select ) {
+ disconnectSelectionChanged();
+ item->setSelected(true);
+ connectSelectionChanged();
+ }
+ }
+ }
+}
+
+/*!
+ Enable/Disable "curve parameters" and "curve properties" widgets.
+*/
+void Plot2d_AnaliticCurveDlg::checkState() {
+ bool isEnable = myCurvesList->count() > 0;
+ myCurveParams->setEnabled(isEnable);
+ myCurveProps->setEnabled(isEnable);
+}
+/*!
+ Show error message
+ */
+void Plot2d_AnaliticCurveDlg::showErrorMsg() {
+ SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "AC_CANT_CALCULATE" ) );
+}
+
+/*!
+ Check the curve attached to the item.
+*/
+bool Plot2d_AnaliticCurveDlg::checkItem(const QListWidgetItem* item) {
+ bool res = false;
+ if( !myFormula->text().isEmpty() && item ) {
+ QVariant var = item->data(Qt::UserRole);
+ Plot2d_AnaliticCurve* curve = (Plot2d_AnaliticCurve*)var.value<void*>();
+
+ if( curve ) {
+ curve->setExpression(myFormula->text());
+ QwtScaleDiv* div = myPlot->axisScaleDiv(QwtPlot::xBottom);
+ curve->setRangeBegin(div->lowerBound());
+ curve->setRangeEnd(div->upperBound());
+ curve->setNbIntervals(myNbIntervals->value());
+ curve->calculate();
+ if( curve->state() == Plot2d_AnaliticCurve::StateOk )
+ res = true;
+ }
+ }
+ return res;
+}
+/*!
+ Store properties of the curve attached to the item from "Curve properties" widget.
+*/
+void Plot2d_AnaliticCurveDlg::storeProps( const QListWidgetItem* item) {
+ if( item ) {
+ QVariant var = item->data(Qt::UserRole);
+ Plot2d_AnaliticCurve* curve = (Plot2d_AnaliticCurve*)var.value<void*>();
+ if(curve) {
+ curve->setAutoAssign(myAutoAssign->isChecked());
+ curve->setName(item->text());
+ curve->setActive(item->checkState() == Qt::Checked);
+ if(!myAutoAssign->isChecked()) {
+ curve->setMarker((Plot2d::MarkerType)myMarkerType->currentIndex());
+ curve->setLine((Plot2d::LineType)myLineType->currentIndex());
+ curve->setLineWidth(myLineWidth->value());
+ curve->setColor(myColor->color());
+ }
+ }
+ }
+}
+
+/*!
+ Connect currentItemChanged signal.
+*/
+void Plot2d_AnaliticCurveDlg::connectSelectionChanged() {
+ connect( myCurvesList, SIGNAL( itemSelectionChanged ()),
+ this, SLOT( onCurveSelectionChanged() ) );
+}
+
+/*!
+ Disconnect currentItemChanged signal.
+*/
+void Plot2d_AnaliticCurveDlg::disconnectSelectionChanged() {
+ disconnect( myCurvesList, SIGNAL( itemSelectionChanged ()),
+ this, SLOT( onCurveSelectionChanged() ) );
+}
+
+/*!
+ Private slot. Called then "Add curve" button is clicked
+*/
+void Plot2d_AnaliticCurveDlg::onAddCurve() {
+ /* QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ QListWidgetItem* item = items.size() > 0 ? items[0] : 0;
+ if(item) {
+ if(!checkItem(item)) {
+ showErrorMsg();
+ return;
+ }
+ else {
+ updateInView(item);
+ }
+ }
+ */
+
+ Plot2d_AnaliticCurve* curve = new Plot2d_AnaliticCurve();
+ QListWidgetItem* newItem = new QListWidgetItem(curve->getName());
+ newItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
+ newItem->setCheckState(Qt::Checked);
+ myCurvesList->addItem(newItem);
+ QVariant var;
+ var.setValue((void*)curve);
+ newItem->setData(Qt::UserRole,var);
+
+ bool autoFlag = curve->isAutoAssign();
+ if(autoFlag) {
+ curve->autoFill(myPlot);
+ }
+
+ setCurrentCurve(newItem);
+ checkState();
+}
+
+/*!
+ Private slot. Called then "Remove curve" button is clicked
+*/
+void Plot2d_AnaliticCurveDlg::onRemoveCurve() {
+ disconnectSelectionChanged();
+ QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ QListWidgetItem* selected = items.size() > 0 ? items[0] : 0;
+ int row = myCurvesList->row(selected);
+ int prevRow = (row == 0) ? 1 : row - 1;
+ if( selected ) {
+ QVariant var = selected->data(Qt::UserRole);
+ Plot2d_AnaliticCurve* curve = (Plot2d_AnaliticCurve*)var.value<void*>();
+ if( curve ) {
+ if( curve->getAction() == Plot2d_AnaliticCurve::ActAddInView ) {
+ delete curve;
+ } else {
+ curve->setAction(Plot2d_AnaliticCurve::ActRemoveFromView);
+ updateInView(selected);
+ }
+ }
+ }
+
+ if( prevRow >= 0 && prevRow < myCurvesList->count() ) {
+ myCurvesList->item(prevRow)->setSelected(true);
+ setCurrentCurve(myCurvesList->item(prevRow));
+ }
+
+ selected = myCurvesList->takeItem(row);
+ delete selected;
+ connectSelectionChanged();
+ checkState();
+}
+
+/*!
+ Private slot. Called then selection in the curve list is changed.
+*/
+void Plot2d_AnaliticCurveDlg::onCurveSelectionChanged() {
+
+ QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ QListWidgetItem* selected = items.size() > 0 ? items[0] : 0;
+
+ /* bool ok = myCurrentItem ? checkItem(myCurrentItem) : true;
+
+ if(!ok) {
+ showErrorMsg();
+ disconnectSelectionChanged();
+
+ if( selected )
+ selected->setSelected(false);
+
+ if( myCurrentItem ) {
+ myCurrentItem->setSelected(true);
+ myCurvesList->setCurrentItem(myCurrentItem);
+ }
+
+ connectSelectionChanged();
+
+ } else {
+ updateInView(myCurrentItem);
+ */
+
+ if(selected) {
+ setCurrentCurve(selected, false);
+ }
+ //}
+}
+
+/*!
+ Private slot. Called then "Auto assign" checkbox is clicked
+*/
+void Plot2d_AnaliticCurveDlg::onAutoAssign(int state){
+ bool flag = !state;
+ myMarkerType->setEnabled(flag);
+ myLineType->setEnabled(flag);
+ myLineWidth->setEnabled(flag);
+ myColor->setEnabled(flag);
+
+ QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ QListWidgetItem* selected = items.size() > 0 ? items[0] : 0;
+ if(selected) {
+ QVariant var = selected->data(Qt::UserRole);
+ Plot2d_AnaliticCurve* curve = (Plot2d_AnaliticCurve*)var.value<void*>();
+ if(curve) {
+ curve->setAutoAssign(state);
+ }
+ setCurrentCurve(selected);
+ }
+}
+
+/*!
+ Update curve in the view
+*/
+void Plot2d_AnaliticCurveDlg::updateInView( QListWidgetItem* item ) {
+ storeProps(item);
+ Plot2d_ViewFrame* fr = qobject_cast<Plot2d_ViewFrame*>(parent());
+ QVariant var = item->data(Qt::UserRole);
+
+ Plot2d_AnaliticCurve* curve = (Plot2d_AnaliticCurve*)var.value<void*>();
+ if( fr && curve ) {
+ fr->updateAnaliticCurve(curve, true);
+ }
+}
+
+/*!
+ Private slot. Called then "Update Curve" checkbox is clicked
+*/
+void Plot2d_AnaliticCurveDlg::onUpdateCurve() {
+ QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ int sz = items.size();
+ if( sz > 0 ) {
+ QListWidgetItem* selected = items[0];
+
+ bool ok = myCurrentItem ? checkItem(myCurrentItem) : false;
+ if(!ok) {
+ showErrorMsg();
+ return;
+ } else {
+ updateInView(selected);
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnaliticCurveDlg.h
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+
+#ifndef PLOT2D_ANALITIC_CURVE_DLG_H
+#define PLOT2D_ANALITIC_CURVE_DLG_H
+
+#include "Plot2d.h"
+#include "Plot2d_AnaliticCurve.h"
+
+#include <QDialog>
+
+
+class QListWidget;
+class QListWidgetItem;
+class QGroupBox;
+class QLineEdit;
+class QCheckBox;
+class QComboBox;
+
+class QtxIntSpinBox;
+class QtxColorButton;
+class QwtPlot;
+
+class Plot2d_AnaliticCurve;
+class Plot2d_ViewFrame;
+
+class PLOT2D_EXPORT Plot2d_AnaliticCurveDlg : public QDialog {
+ Q_OBJECT
+public:
+
+ Plot2d_AnaliticCurveDlg( QWidget* parent, QwtPlot* plot );
+ ~Plot2d_AnaliticCurveDlg();
+
+ AnaliticCurveList getCurveList();
+ void setCurveList( AnaliticCurveList& );
+
+private:
+ void setCurrentCurve( QListWidgetItem* , bool = true);
+ void checkState();
+ void showErrorMsg();
+ bool checkItem(const QListWidgetItem* );
+ void storeProps( const QListWidgetItem* );
+ void connectSelectionChanged();
+ void disconnectSelectionChanged();
+ void updateInView(QListWidgetItem*);
+
+private slots:
+ void onAddCurve();
+ void onRemoveCurve();
+ void onAutoAssign(int);
+ void onUpdateCurve();
+ void onCurveSelectionChanged( );
+
+private:
+ QListWidget* myCurvesList;
+
+ QGroupBox* myCurveParams;
+ QLineEdit* myFormula;
+ QtxIntSpinBox* myNbIntervals;
+
+ QGroupBox* myCurveProps;
+ QCheckBox* myAutoAssign;
+ QComboBox* myMarkerType;
+ QComboBox* myLineType;
+ QtxIntSpinBox* myLineWidth;
+ QtxColorButton* myColor;
+
+ QwtPlot* myPlot;
+ QListWidgetItem* myCurrentItem;
+};
+
+#endif //PLOT2D_ANALITIC_CURVE_DLG_H
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnaliticParcer.cxx
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+#include "Plot2d_AnaliticParcer.h"
+#include <structmember.h>
+
+
+/* ==================================
+ * =========== PYTHON ==============
+ * ==================================*/
+
+typedef struct {
+ PyObject_HEAD
+ int softspace;
+ std::string *out;
+ } PyStdOut;
+
+static void
+PyStdOut_dealloc(PyStdOut *self)
+{
+ PyObject_Del(self);
+}
+
+static PyObject *
+PyStdOut_write(PyStdOut *self, PyObject *args)
+{
+ char *c;
+ int l;
+ if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
+ return NULL;
+
+ //std::cerr << c ;
+ *(self->out)=*(self->out)+c;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyMethodDef PyStdOut_methods[] = {
+ {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
+ PyDoc_STR("write(string) -> None")},
+ {NULL, NULL} /* sentinel */
+};
+
+static PyMemberDef PyStdOut_memberlist[] = {
+ {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
+ (char*)"flag indicating that a space needs to be printed; used by print"},
+ {NULL} /* Sentinel */
+};
+
+static PyTypeObject PyStdOut_Type = {
+ /* The ob_type field must be initialized in the module init function
+ * to be portable to Windows without using C++. */
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "PyOut", /*tp_name*/
+ sizeof(PyStdOut), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)PyStdOut_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ /* softspace is writable: we must supply tp_setattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ PyStdOut_methods, /*tp_methods*/
+ PyStdOut_memberlist, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+};
+
+PyObject * newPyStdOut( std::string& out )
+{
+ PyStdOut *self;
+ self = PyObject_New(PyStdOut, &PyStdOut_Type);
+ if (self == NULL)
+ return NULL;
+ self->softspace = 0;
+ self->out=&out;
+ return (PyObject*)self;
+}
+
+
+////////////////////////END PYTHON///////////////////////////
+
+
+//! The only one instance of parcer
+Plot2d_AnaliticParcer* Plot2d_AnaliticParcer::myParcer = 0;
+
+//Define the script
+QString Plot2d_AnaliticParcer::myScript = QString("");
+
+/*!
+ \brief Return the only instance of the Plot2d_AnaliticParcer
+ \return instance of the Plot2d_AnaliticParcer
+*/
+Plot2d_AnaliticParcer* Plot2d_AnaliticParcer::parcer()
+{
+ if ( !myParcer )
+ myParcer = new Plot2d_AnaliticParcer();
+ return myParcer;
+}
+
+/*!
+ \brief Constructor.
+
+ Construct the parcer and initialize python interpritator.
+*/
+Plot2d_AnaliticParcer::Plot2d_AnaliticParcer()
+{
+ /* Initialize the Python interpreter */
+ if (Py_IsInitialized()) {
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ myMainMod = PyImport_AddModule("__main__");
+ myMainDict = PyModule_GetDict(myMainMod);
+ PyGILState_Release(gstate);
+ initScript();
+ }
+}
+
+int Plot2d_AnaliticParcer::calculate( const QString& theExpr,
+ const double theMin,
+ const double theMax,
+ const int theNbStep,
+ double** theX,
+ double** theY) {
+
+ QString aPyScript = myScript;
+ aPyScript = aPyScript.arg(theExpr);
+ int result = -1;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* obj = PyRun_String(qPrintable(aPyScript), Py_file_input, myMainDict, NULL);
+
+ if(obj == NULL) {
+ PyErr_Print();
+ PyGILState_Release(gstate);
+ return result;
+
+ } else {
+ Py_DECREF(obj);
+ }
+
+ PyObject* func = NULL;
+ PyObject* f_y = NULL;
+
+ if(PyObject_HasAttrString(myMainMod, "Y")) {
+ f_y = PyObject_GetAttrString(myMainMod, "Y");
+ }
+
+ if(PyObject_HasAttrString(myMainMod, "coordCalculator")) {
+ func = PyObject_GetAttrString(myMainMod, "coordCalculator");
+ }
+
+ PyObject* new_stderr = NULL;
+
+ if( f_y == NULL || func == NULL ) {
+ fflush(stderr);
+ std::string err_description="";
+ new_stderr = newPyStdOut(err_description);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ return result;
+ }
+
+ PyObject* coords;
+ coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theMin, theMax, theNbStep );
+
+ new_stderr = NULL;
+
+ if (coords == NULL){
+ fflush(stderr);
+ std::string err_description="";
+ new_stderr = newPyStdOut(err_description);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ return result;
+ }
+
+ Py_ssize_t size = PyList_Size( coords );
+ if( size <= 0 ) {
+ Py_DECREF(coords);
+ return result;
+ }
+
+ result = size;
+
+ *theX = new double[size];
+ *theY = new double[size];
+
+ for ( Py_ssize_t i = 0; i< size; ++i ) {
+ PyObject* coord = PyList_GetItem( coords, i );
+ (*theX)[i] = PyFloat_AsDouble(PyList_GetItem(coord, 0));
+ (*theY)[i] = PyFloat_AsDouble(PyList_GetItem(coord, 1));
+ }
+
+ PyGILState_Release(gstate);
+ return result;
+}
+
+/*!
+ \brief Initialize python script.
+*/
+void Plot2d_AnaliticParcer::initScript() {
+ myScript.clear();
+ myScript += "from math import * \n";
+ myScript += "def Y(x): \n";
+ myScript += " return ";
+ myScript += "%1\n";
+
+ myScript += "def coordCalculator(xmin, xmax, nstep): \n";
+ myScript += " coords = [] \n";
+ myScript +=" xstep = (xmax - xmin) / nstep \n";
+ myScript +=" n = 0 \n";
+ myScript +=" while n <= nstep : \n";
+ myScript +=" x = xmin + n*xstep \n";
+ myScript +=" coords.append([x,Y(x)]) \n";
+ myScript +=" n = n+1 \n";
+ myScript +=" return coords \n";
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnaliticParcer.h
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+#ifndef PLOT2D_ANALITIC_PARCER_H
+#define PLOT2D_ANALITIC_PARCER_H
+#include <Python.h>
+
+#include "Plot2d.h"
+
+class PLOT2D_EXPORT Plot2d_AnaliticParcer {
+public:
+ ~Plot2d_AnaliticParcer();
+
+
+ static Plot2d_AnaliticParcer* parcer();
+ int calculate( const QString&, const double,
+ const double, const int,
+ double**, double**);
+
+private:
+ Plot2d_AnaliticParcer();
+ void initScript();
+
+private:
+ static Plot2d_AnaliticParcer* myParcer; //!< instance of the parcer
+ PyObject* myMainMod; //!< main python module
+ PyObject* myMainDict; //!< main python dictionary
+ static QString myScript; //!< python script
+};
+
+#endif //PLOT2D_ANALITIC_PARCER_H
const int DEFAULT_LINE_WIDTH = 0; // (default) line width
const int DEFAULT_MARKER_SIZE = 9; // default marker size
-const int MAX_ATTEMPTS = 10; // max attempts
/*!
Constructor
QwtSymbol::Style typeMarker;
QColor color;
Qt::PenStyle typeLine;
- getNextMarker( thePlot, typeMarker, color, typeLine );
+ Plot2d::getNextMarker( rtti(), thePlot, typeMarker, color, typeLine );
setColor( color );
setLine( Plot2d::qwt2plotLine( typeLine ), DEFAULT_LINE_WIDTH );
return myLineWidth;
}
-/*!
- Gets new unique marker for item if possible
-*/
-void Plot2d_Curve::getNextMarker( const QwtPlot* thePlot, QwtSymbol::Style& typeMarker,
- QColor& color, Qt::PenStyle& typeLine )
-{
- bool bOk = false;
- int cnt = 0;
- while ( !bOk ) {
- int aRed = (int)( 256.0 * rand() / RAND_MAX ); // generate random color
- int aGreen = (int)( 256.0 * rand() / RAND_MAX ); // ...
- int aBlue = (int)( 256.0 * rand() / RAND_MAX ); // ...
- int aMarker = (int)( 9.0 * rand() / RAND_MAX ) + 1;// 9 markers types( not including empty )
- int aLine = (int)( 5.0 * rand() / RAND_MAX ) + 1;// 5 line types ( not including empty )
-
- typeMarker = ( QwtSymbol::Style )aMarker;
- color = QColor( aRed, aGreen, aBlue );
- typeLine = ( Qt::PenStyle )aLine;
-
- bOk = ( ++cnt == MAX_ATTEMPTS ) || !existMarker( thePlot, typeMarker, color, typeLine );
- }
-}
-
-/*!
- Checks if marker belongs to any enitity
-*/
-bool Plot2d_Curve::existMarker( const QwtPlot* thePlot, const QwtSymbol::Style typeMarker,
- const QColor& color, const Qt::PenStyle typeLine )
-{
- bool ok = false;
-
- QColor bgColor = thePlot->palette().color( QPalette::Background );
- if ( closeColors( color, bgColor ) ) {
- ok = true;
- }
- else {
- QwtPlotItemList anItems = thePlot->itemList();
- QwtPlotItemIterator anIt = anItems.begin(), aLast = anItems.end();
- QwtPlotItem* anItem;
- for ( ; anIt != aLast && !ok; anIt++ ) {
- anItem = *anIt;
- if ( anItem && anItem->rtti() == rtti() ) {
- QwtPlotCurve* crv = dynamic_cast<QwtPlotCurve*>( anItem );
- if ( crv ) {
- QwtSymbol::Style aStyle = crv->symbol().style();
- QColor aColor = crv->pen().color();
- Qt::PenStyle aLine = crv->pen().style();
- ok = closeColors( aColor, color ) && aStyle == typeMarker && aLine == typeLine;
- }
- }
- }
- }
- return ok;
-}
void setLineWidth( const int );
int getLineWidth() const;
-protected:
- void getNextMarker( const QwtPlot*, QwtSymbol::Style&,
- QColor&, Qt::PenStyle& );
- bool existMarker( const QwtPlot*, const QwtSymbol::Style,
- const QColor&, const Qt::PenStyle );
-
protected:
QColor myColor;
Plot2d::MarkerType myMarker;
bool ok = false;
QColor bgColor = thePlot->palette().color( QPalette::Background );
- if ( closeColors( theColor, bgColor ) ) {
+ if ( Plot2d::closeColors( theColor, bgColor ) ) {
ok = true;
}
else {
continue;
if ( anItem->rtti() == rtti() ) {
Plot2d_HistogramItem* aHItem = dynamic_cast<Plot2d_HistogramItem*>( anItem );
- ok = aHItem && closeColors( theColor, aHItem->color() );
+ ok = aHItem && Plot2d::closeColors( theColor, aHItem->color() );
}
else if ( anItem->rtti() == QwtPlotItem::Rtti_PlotCurve ) {
QwtPlotCurve* aCurve = dynamic_cast<QwtPlotCurve*>( anItem );
- ok = aCurve && closeColors( theColor, aCurve->pen().color() );
+ ok = aCurve && Plot2d::closeColors( theColor, aCurve->pen().color() );
}
}
}
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
-// color tolerance (used to compare color values)
-const long COLOR_DISTANCE = 100;
-
-
// Static members
QColor Plot2d_Object::mySelectionColor;
QColor Plot2d_Object::myHighlightedLegendTextColor;
}
}
-/*!
- Constructor
-*/
-Plot2d_Point::Plot2d_Point()
- : x( 0. ), y( 0. )
-{
-}
-
-/*!
- Constructor
-*/
-Plot2d_Point::Plot2d_Point( double theX, double theY, const QString& theText )
- : x( theX ), y( theY ), text( theText )
-{
-}
-
/*!
Constructor
*/
return aMaxY;
}
-/*!
- Checks if two colors are close to each other [ static ]
- uses COLOR_DISTANCE variable as max tolerance for comparing of colors
-*/
-
-bool Plot2d_Object::closeColors( const QColor& color1,
- const QColor& color2,
- int distance )
-{
- long tol =
- qAbs( color2.red() - color1.red() ) +
- qAbs( color2.green() - color1.green() ) +
- qAbs( color2.blue() - color1.blue() ) -
- ( distance < 0 ? COLOR_DISTANCE : distance );
-
- return tol <= 0;
-}
-
/*!
Sets object's selected property
*/
#include <QList>
#include <qwt_plot.h>
-struct PLOT2D_EXPORT Plot2d_Point
-{
- double x;
- double y;
- QString text;
- Plot2d_Point();
- Plot2d_Point( double theX, double theY, const QString& theText = QString() );
-};
-
-typedef QList<Plot2d_Point> pointList;
class PLOT2D_EXPORT Plot2d_Object
{
void setSelected(const bool);
bool isSelected() const;
-
- static bool closeColors( const QColor&, const QColor&, int distance = -1 );
static void initColors();
myLineCombo = new QComboBox( this );
myLineCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLineCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLineCombo->setIconSize( QSize( 40, 16 ) );
+ QSize lsz( 40, 16 );
+ myLineCombo->setIconSize( lsz );
// curve width
QLabel* aLineWidthLab = new QLabel( tr( "CURVE_LINE_WIDTH_LAB" ), this );
myMarkerCombo = new QComboBox( this );
myMarkerCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myMarkerCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myMarkerCombo->setIconSize( QSize( 16, 16 ) );
+ QSize sz(16, 16);
+ myMarkerCombo->setIconSize(sz);
// curve color
QLabel* aColorLab = new QLabel( tr( "CURVE_COLOR_LAB" ), this );
topLayout->addLayout( btnLayout, 5, 0, 1, 3 );
// fill then combo boxes
- myLineCombo->addItem( lineIcon( Plot2d::NoPen ), tr( "NONE_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::Solid ), tr( "SOLID_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::Dash ), tr( "DASH_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::Dot ), tr( "DOT_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::DashDot ), tr( "DASHDOT_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::DashDotDot ), tr( "DAHSDOTDOT_LINE_LBL" ) );
-
- myMarkerCombo->addItem( markerIcon( Plot2d::None ), tr( "NONE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Circle ), tr( "CIRCLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Rectangle ), tr( "RECTANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Diamond ), tr( "DIAMOND_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::DTriangle ), tr( "DTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::UTriangle ), tr( "UTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::LTriangle ), tr( "LTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::RTriangle ), tr( "RTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Cross ), tr( "CROSS_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::XCross ), tr( "XCROSS_MARKER_LBL" ) );
+ QColor cl = myLineCombo->palette().color( QPalette::Text );
+
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::NoPen ), tr( "NONE_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Solid ), tr( "SOLID_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Dash ), tr( "DASH_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Dot ), tr( "DOT_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::DashDot ), tr( "DASHDOT_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::DashDotDot ), tr( "DAHSDOTDOT_LINE_LBL" ) );
+
+ cl = myMarkerCombo->palette().color( QPalette::Text );
+
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::None ), tr( "NONE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Circle ), tr( "CIRCLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Rectangle ), tr( "RECTANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Diamond ), tr( "DIAMOND_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::DTriangle ), tr( "DTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::UTriangle ), tr( "UTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::LTriangle ), tr( "LTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::RTriangle ), tr( "RTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Cross ), tr( "CROSS_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::XCross ), tr( "XCROSS_MARKER_LBL" ) );
// default settings
setLine( Plot2d::Solid, 0 ); // solid line, width = 0
return myColorBtn->color();
}
-/*!
- \brief Create icon pixmap according to the line type.
- \param type line type
- \return icon
-*/
-QPixmap Plot2d_SetupCurveDlg::lineIcon( Plot2d::LineType type ) const
-{
- QSize sz = myLineCombo->iconSize();
- QPixmap px( sz );
- px.fill( QColor( 255, 255, 255, 0 ) );
- QPainter p( &px );
- Plot2d::drawLine( &p, 5, sz.height()/2, sz.width()-5, sz.height()/2, type,
- myLineCombo->palette().color( QPalette::Text ), 1 );
- return px;
-}
-
-/*!
- \brief Create icon pixmap according to the marker type.
- \param type marker type
- \return icon
-*/
-QPixmap Plot2d_SetupCurveDlg::markerIcon( Plot2d::MarkerType type ) const
-{
- QSize sz = myMarkerCombo->iconSize();
- QPixmap px( sz );
- px.fill( QColor( 255, 255, 255, 0 ) );
- QPainter p( &px );
- Plot2d::drawMarker( &p, sz.width()/2, sz.height()/2, MSIZE, MSIZE, type,
- myMarkerCombo->palette().color( QPalette::Text ) );
- return px;
-}
-
/*
\brief Update preview widget.
*/
void setColor( const QColor& );
QColor getColor() const;
-private:
- QPixmap lineIcon( Plot2d::LineType ) const;
- QPixmap markerIcon( Plot2d::MarkerType ) const;
private slots:
void updatePreview();
void Plot2d_SetupCurveScaleDlg::setUndefinedValue() {
myValueSpin->setCleared(true);
myValueSpin->setSpecialValueText("");
-}
\ No newline at end of file
+}
#include "Plot2d_FitDataDlg.h"
#include "Plot2d_ViewWindow.h"
#include "Plot2d_SetupViewDlg.h"
+#ifndef DISABLE_PYCONSOLE
+#include "Plot2d_AnaliticCurveDlg.h"
+#include "Plot2d_AnaliticCurve.h"
+#endif
#include "Plot2d_ToolTip.h"
#include "SUIT_Tools.h"
delete dlg;
}
+#ifndef DISABLE_PYCONSOLE
+/*!
+ "Analitic Curves" toolbar action slot
+*/
+void Plot2d_ViewFrame::onAnaliticCurve() {
+ Plot2d_AnaliticCurveDlg* dlg = new Plot2d_AnaliticCurveDlg(this, myPlot);
+ dlg->setCurveList(myAnaliticCurves);
+ dlg->exec();
+ delete dlg;
+}
+#endif
+
+
+#ifndef DISABLE_PYCONSOLE
+/*
+ Update analitic curve
+*/
+void Plot2d_ViewFrame::updateAnaliticCurve(Plot2d_AnaliticCurve* c, bool updateView){
+ if(!c) return;
+ QwtScaleDiv* div = myPlot->axisScaleDiv(QwtPlot::xBottom);
+ c->setRangeBegin(div->lowerBound());
+ c->setRangeEnd(div->upperBound());
+ c->calculate();
+ c->setMarkerSize(myMarkerSize);
+ QwtPlotItem* item = c->plotItem();
+
+ switch( c->getAction() ) {
+ case Plot2d_AnaliticCurve::ActAddInView:
+ if( c->isActive() ) {
+ item->attach( myPlot );
+ }
+ myAnaliticCurves.append(c);
+ c->setAction(Plot2d_AnaliticCurve::ActNothing);
+ break;
+
+ case Plot2d_AnaliticCurve::ActUpdateInView:
+ if(c->isActive()) {
+ item->attach( myPlot );
+ c->updatePlotItem();
+ item->show();
+ } else {
+ item->hide();
+ item->detach();
+ }
+
+ c->setAction(Plot2d_AnaliticCurve::ActNothing);
+ break;
+ case Plot2d_AnaliticCurve::ActRemoveFromView:
+ item->hide();
+ item->detach();
+ myAnaliticCurves.removeAll(c);
+ delete c;
+ break;
+ }
+
+ if(updateView)
+ myPlot->replot();
+}
+#endif
+
+#ifndef DISABLE_PYCONSOLE
+/*
+ Update analitic curves
+*/
+void Plot2d_ViewFrame::updateAnaliticCurves() {
+ AnaliticCurveList::iterator it = myAnaliticCurves.begin();
+ for( ; it != myAnaliticCurves.end(); it++) {
+ updateAnaliticCurve(*it);
+ }
+ myPlot->replot();
+}
+#endif
+
/*!
"Fit Data" command slot
*/
fitData(mode,xMin,xMax,yMin,yMax,y2Min,y2Max);
}
delete dlg;
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
me.pos(), me.globalPos() );
emit contextMenuRequested( &aEvent );
+ }
+#ifndef DISABLE_PYCONSOLE
+ else {
+ updateAnaliticCurves();
}
+#endif
myPlot->canvas()->setCursor( QCursor( Qt::CrossCursor ) );
myPlot->defaultPicker();
myPlot->replot();
if ( myPlot->zoomer() ) myPlot->zoomer()->setZoomBase();
myPnt = event->pos();
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
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 );
+ //Store font in the visual parameters string as:
+ //
+ // ...*FontFamily|FontSize|B|I|U|r:g:b*...
+
+ retStr.sprintf( "%d*%d*%d*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%s|%i|%i|%i|%i|%i:%i:%i",
+ myXMode, myYMode, mySecondY, xmin, xmax, ymin, ymax, y2min, y2max,
+ qPrintable(myLegendFont.family()), myLegendFont.pointSize(),myLegendFont.bold(),
+ myLegendFont.italic(), myLegendFont.underline(),myLegendColor.red(),
+ myLegendColor.green(), myLegendColor.blue());
+
+#ifndef DISABLE_PYCONSOLE
+ //store all analitic curves
+ //store each curve in the following format
+ // ...*Name|isActive|Expresion|NbInervals|isAutoAssign[|MarkerType|LineType|LineWidth|r:g:b]
+ // parameters in the [ ] is optional in case if isAutoAssign == true
+ AnaliticCurveList::iterator it = myAnaliticCurves.begin();
+ Plot2d_AnaliticCurve* c = 0;
+ bool isAuto;
+ for( ; it != myAnaliticCurves.end(); it++) {
+ c = (*it);
+ if(!c) continue;
+ QString curveString("");
+ isAuto = c->isAutoAssign();
+ curveString.sprintf("*%s|%i|%s|%i|%i",
+ qPrintable(c->getName()),
+ c->isActive(),
+ qPrintable(c->getExpression()),
+ c->getNbIntervals(),
+ isAuto);
+
+ retStr+=curveString;
+ if(!isAuto) {
+ QString optCurveString("");
+ optCurveString.sprintf("|%i|%i|%i|%i:%i:%i",
+ (int)c->getMarker(),
+ (int)c->getLine(),
+ c->getLineWidth(),
+ c->getColor().red(),
+ c->getColor().green(),
+ c->getColor().blue());
+ retStr+=optCurveString;
+ }
+ }
+#endif
return retStr;
}
*/
void Plot2d_ViewFrame::setVisualParameters( const QString& parameters )
{
+ double xmin, xmax;
QStringList paramsLst = parameters.split( '*' );
- if ( paramsLst.size() == 9 ) {
- double xmin, xmax, ymin, ymax, y2min, y2max;
+ if ( paramsLst.size() >= 9 ) {
+ double ymin, ymax, y2min, y2max;
myXMode = paramsLst[0].toInt();
myYMode = paramsLst[1].toInt();
mySecondY = (bool)paramsLst[2].toInt();
fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
- }
+ }
+
+ //Restore legend font
+ if(paramsLst.size() >= 10) {
+ QStringList fontList = paramsLst[9].split( '|' );
+ if(fontList.size() == 6) {
+ myLegendFont = QFont(fontList[0]);
+ myLegendFont.setPointSize(fontList[1].toInt());
+ myLegendFont.setBold(fontList[2].toInt());
+ myLegendFont.setItalic(fontList[3].toInt());
+ myLegendFont.setUnderline(fontList[4].toInt());
+ QStringList colorList = fontList[5].split(":");
+ setLegendFont( myLegendFont );
+
+ if(colorList.size() == 3) {
+ myLegendColor = QColor(colorList[0].toInt(),
+ colorList[1].toInt(),
+ colorList[2].toInt());
+ setLegendFontColor( myLegendColor );
+ }
+ }
+ }
+
+#ifndef DISABLE_PYCONSOLE
+ //Restore all analitical curves
+ int startCurveIndex = 10;
+ if( paramsLst.size() >= startCurveIndex+1 ) {
+ for( int i=startCurveIndex; i<paramsLst.size() ; i++ ) {
+ QStringList curveLst = paramsLst[i].split("|");
+ if( curveLst.size() == 5 || curveLst.size() == 9 ) {
+ Plot2d_AnaliticCurve* c = new Plot2d_AnaliticCurve();
+ c->setName(curveLst[0]);
+ c->setActive(curveLst[1].toInt());
+ c->setExpression(curveLst[2]);
+ c->setNbIntervals(curveLst[3].toLong());
+ c->setAutoAssign(curveLst[4].toInt());
+ if( !c->isAutoAssign() ) {
+ c->setMarker((Plot2d::MarkerType)curveLst[5].toInt());
+ c->setLine((Plot2d::LineType)curveLst[6].toInt());
+ c->setLineWidth(curveLst[7].toInt());
+ QStringList colorList = curveLst[8].split(":");
+ if( colorList.size() == 3 ) {
+ c->setColor(QColor(colorList[0].toInt(),
+ colorList[1].toInt(),
+ colorList[2].toInt()));
+ }
+ } else {
+ c->autoFill( myPlot );
+ }
+ c->setAction(Plot2d_AnaliticCurve::ActAddInView);
+ updateAnaliticCurve(c);
+ }
+ }
+ myPlot->replot();
+ }
+#endif
}
/*!
void Plot2d_ViewFrame::onPanLeft()
{
this->incrementalPan( -INCREMENT_FOR_OP, 0 );
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
void Plot2d_ViewFrame::onPanRight()
{
this->incrementalPan( INCREMENT_FOR_OP, 0 );
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
void Plot2d_ViewFrame::onPanUp()
{
this->incrementalPan( 0, -INCREMENT_FOR_OP );
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
void Plot2d_ViewFrame::onPanDown()
{
this->incrementalPan( 0, INCREMENT_FOR_OP );
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
void Plot2d_ViewFrame::onZoomIn()
{
this->incrementalZoom( INCREMENT_FOR_OP, INCREMENT_FOR_OP );
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
void Plot2d_ViewFrame::onZoomOut()
{
this->incrementalZoom( -INCREMENT_FOR_OP, -INCREMENT_FOR_OP );
+#ifndef DISABLE_PYCONSOLE
+ updateAnaliticCurves();
+#endif
}
/*!
return QwtScaleDraw::label( value );
}
-
-
#include "Plot2d.h"
#include "Plot2d_Curve.h"
+#ifndef DISABLE_PYCONSOLE
+#include "Plot2d_AnaliticCurve.h"
+#endif
#include <QWidget>
#include <QMultiHash>
void getFitRangeByCurves( double&, double&, double&, double&,
double&, double& );
+#ifndef DISABLE_PYCONSOLE
+ void updateAnaliticCurves();
+ void updateAnaliticCurve( Plot2d_AnaliticCurve*, bool = false );
+#endif
/* view parameters */
void copyPreferences( Plot2d_ViewFrame* );
Plot2d_Curve* getClosestCurve( QPoint, double&, int& ) const;
Plot2d_Object* getPlotObject( QwtPlotItem* ) const;
-
+ QwtPlotItem* getPlotObject( Plot2d_Object* ) const;
+ QwtPlotCurve* getPlotCurve( Plot2d_Curve* ) const;
+ Plot2d_Plot2d* getPlot() const { return myPlot; }
protected:
int testOperation( const QMouseEvent& );
void readPreferences();
void writePreferences();
QString getInfo( const QPoint& );
virtual void wheelEvent( QWheelEvent* );
- QwtPlotCurve* getPlotCurve( Plot2d_Curve* ) const;
bool hasPlotCurve( Plot2d_Curve* ) const;
void setCurveType( QwtPlotCurve*, int );
- QwtPlotItem* getPlotObject( Plot2d_Object* ) const;
bool hasPlotObject( Plot2d_Object* ) const;
-
-
-
-
public slots:
void onViewPan();
void onViewZoom();
void onViewFitArea();
void onViewGlobalPan();
void onSettings();
+#ifndef DISABLE_PYCONSOLE
+ void onAnaliticCurve();
+#endif
void onFitData();
void onChangeBackground();
void onPanLeft();
void legendClicked( QwtPlotItem* );
protected:
- Plot2d_Plot2d* myPlot;
- int myOperation;
- QPoint myPnt;
-
- int myCurveType;
- bool myShowLegend;
- int myLegendPos;
- QFont myLegendFont;
- QColor myLegendColor;
- int myMarkerSize;
- QColor myBackground;
- QString myTitle, myXTitle, myYTitle, myY2Title;
- bool myTitleEnabled, myXTitleEnabled, myYTitleEnabled, myY2TitleEnabled;
- bool myXGridMajorEnabled, myYGridMajorEnabled, myY2GridMajorEnabled;
- bool myXGridMinorEnabled, myYGridMinorEnabled, myY2GridMinorEnabled;
- int myXGridMaxMajor, myYGridMaxMajor, myY2GridMaxMajor;
- int myXGridMaxMinor, myYGridMaxMinor, myY2GridMaxMinor;
- int myXMode, myYMode;
- double myXDistance, myYDistance, myYDistance2;
- bool mySecondY;
- ObjectDict myObjects;
- bool myIsDefTitle;
+ Plot2d_Plot2d* myPlot;
+ int myOperation;
+ QPoint myPnt;
+
+ int myCurveType;
+ bool myShowLegend;
+ int myLegendPos;
+ QFont myLegendFont;
+ QColor myLegendColor;
+ int myMarkerSize;
+ QColor myBackground;
+ QString myTitle, myXTitle, myYTitle, myY2Title;
+ bool myTitleEnabled, myXTitleEnabled, myYTitleEnabled, myY2TitleEnabled;
+ bool myXGridMajorEnabled, myYGridMajorEnabled, myY2GridMajorEnabled;
+ bool myXGridMinorEnabled, myYGridMinorEnabled, myY2GridMinorEnabled;
+ int myXGridMaxMajor, myYGridMaxMajor, myY2GridMaxMajor;
+ int myXGridMaxMinor, myYGridMaxMinor, myY2GridMaxMinor;
+ int myXMode, myYMode;
+ double myXDistance, myYDistance, myYDistance2;
+ bool mySecondY;
+ ObjectDict myObjects;
+#ifndef DISABLE_PYCONSOLE
+ AnaliticCurveList myAnaliticCurves;
+#endif
+ bool myIsDefTitle;
};
class Plot2d_Plot2d : public QwtPlot
aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SETTINGS" ) ),
tr( "MEN_PLOT2D_SETTINGS" ),
0, this );
+
aAction->setStatusTip( tr( "PRP_PLOT2D_SETTINGS" ) );
connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) );
mgr->registerAction( aAction, CurvSettingsId );
- // 9. Clone
+ // 9. Analitic curves
+ aAction = new QtxAction( tr( "TOT_PLOT2D_ANALITIC_CURVES" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ANALITIC_CURVES" ) ),
+ tr( "MEN_PLOT2D_ANALITIC_CURVES" ),
+ 0, this );
+
+ aAction->setStatusTip( tr( "PRP_PLOT2D_ANALITIC_CURVES" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onAnaliticCurve() ) );
+ mgr->registerAction( aAction, AnaliticCurveId );
+
+
+ // 10. Clone
aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ),
aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
tr( "MNU_CLONE_VIEW" ),
connect( aAction, SIGNAL( triggered( bool ) ), this, SIGNAL( cloneView() ) );
mgr->registerAction( aAction, CloneId );
- // 10. Print
+ // 11. Print
aAction = new QtxAction( tr( "MNU_PRINT_VIEW" ),
aResMgr->loadPixmap( "STD", tr( "ICON_PLOT2D_PRINT" ) ),
tr( "MNU_PRINT_VIEW" ),
mgr->append( toolMgr()->separator(), myToolBar );
mgr->append( LegendId, myToolBar );
mgr->append( CurvSettingsId, myToolBar );
+ mgr->append( AnaliticCurveId, myToolBar );
mgr->append( CloneId, myToolBar );
mgr->append( PrintId, myToolBar );
}
CurvPointsId, CurvLinesId, CurvSplinesId,
LegendId,
CurvSettingsId,
- CloneId, PrintId };
+ CloneId, PrintId,
+ AnaliticCurveId };
public:
Plot2d_ViewWindow( SUIT_Desktop*, Plot2d_Viewer* );
<source>ICON_PLOT2D_SETTINGS</source>
<translation>plot2d_settings.png</translation>
</message>
+ <message>
+ <source>ICON_PLOT2D_ANALITIC_CURVES</source>
+ <translation>plot2d_analitic_curve.png</translation>
+ </message>
<message>
<source>ICON_PLOT2D_CURVES_LINES</source>
<translation>plot2d_lines.png</translation>
<source>TOT_PLOT2D_SETTINGS</source>
<translation>Settings</translation>
</message>
+ <message>
+ <source>TOT_PLOT2D_ANALITIC_CURVES</source>
+ <translation>Analytic curves</translation>
+ </message>
<message>
<source>PLOT2D_CURVE_TYPE_LINES</source>
<translation>Lines</translation>
<source>DSC_ZOOM_VIEW</source>
<translation>Zoom the view</translation>
</message>
+ <message>
+ <source>PRP_PLOT2D_ANALITIC_CURVES</source>
+ <translation>Setups analytic curves properties</translation>
+ </message>
<message>
<source>PRP_PLOT2D_SETTINGS</source>
<translation>Setups view properties</translation>
- </message>
+ </message>
<message>
<source>INF_COORDINATES_SOME_Y</source>
<translation>Coordinates: X : %1, Y : %2 ( %3 )</translation>
<source>MEN_PLOT2D_SETTINGS</source>
<translation>&Settings</translation>
</message>
+ <message>
+ <source>MEN_PLOT2D_ANALITIC_CURVES</source>
+ <translation>Analytic curves</translation>
+ </message>
<message>
<source>CIRCLE_MARKER_LBL</source>
<translation>Circle</translation>
<translation>Background color</translation>
</message>
</context>
+<context>
+ <name>Plot2d_AnaliticCurveDlg</name>
+ <message>
+ <source>ANALITIC_CURVE_TLT</source>
+ <translation>Analitic curves properties</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_PARAMS</source>
+ <translation>Curve parameters</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_PROPS</source>
+ <translation>Curve properties</translation>
+ </message>
+ <message>
+ <source>AC_FORMULA</source>
+ <translation>y(x) = </translation>
+ </message>
+ <message>
+ <source>AC_NB_INTERVALS</source>
+ <translation>Nb. intervals</translation>
+ </message>
+ <message>
+ <source>AC_AUTO_ASSIGN</source>
+ <translation>Auto assign</translation>
+ </message>
+ <message>
+ <source>AC_MARKER_TYPE</source>
+ <translation>Marker type</translation>
+ </message>
+ <message>
+ <source>AC_LINE_TYPE</source>
+ <translation>Line type</translation>
+ </message>
+ <message>
+ <source>AC_LINE_WIDTH</source>
+ <translation>Line Width</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_COLOR</source>
+ <translation>Curve color</translation>
+ </message>
+ <message>
+ <source>AC_ADD_BTN</source>
+ <translation>Add curve</translation>
+ </message>
+ <message>
+ <source>AC_REM_BTN</source>
+ <translation>Remove curve</translation>
+ </message>
+ <message>
+ <source>AC_UPD_BTN</source>
+ <translation>Update Curve</translation>
+ </message>
+ <message>
+ <source>AC_CANT_CALCULATE</source>
+ <translation>Can't calculate curve.
+Please, check input parameters!!!</translation>
+ </message>
+ <message>
+ <source>AC_CLOSE_BTN</source>
+ <translation>&Close</translation>
+ </message>
+</context>
<context>
<name>Plot2d_SetupCurveScaleDlg</name>
<message>
</message>
</context>
</TS>
+
<source>TOT_PLOT2D_SETTINGS</source>
<translation>Paramètres</translation>
</message>
+ <message>
+ <source>TOT_PLOT2D_ANALITIC_CURVES</source>
+ <translation>Courbes analytiques</translation>
+ </message>
<message>
<source>PLOT2D_CURVE_TYPE_LINES</source>
<translation>Lignes</translation>
<source>PLOT2D_ENABLE_LEGEND</source>
<translation>Afficher la légende</translation>
</message>
+ <message>
+ <source>PLOT2D_LEGEND_FONT</source>
+ <translation>Police de la légende</translation>
+ </message>
<message>
<source>DSC_ZOOM_VIEW</source>
<translation>Zoomer la vue</translation>
</message>
+ <message>
+ <source>PRP_PLOT2D_ANALITIC_CURVES</source>
+ <translation>Réglage des propriétés des courbes analytiques</translation>
+ </message>
<message>
<source>PRP_PLOT2D_SETTINGS</source>
<translation>Définit les paramètres de visualisation</translation>
</message>
<message>
<source>PRP_PLOT2D_FITDATA</source>
- <translation>Ajuster la vue à la plage de données indiquées</translation>
+ <translation>Ajuster la vue à la plage de données indiquée</translation>
</message>
<message>
<source>MEN_PLOT2D_MODE_LINEAR_VER</source>
<source>MEN_PLOT2D_SETTINGS</source>
<translation>&Paramètres</translation>
</message>
+ <message>
+ <source>MEN_PLOT2D_ANALITIC_CURVES</source>
+ <translation>Courbes analytiques</translation>
+ </message>
<message>
<source>CIRCLE_MARKER_LBL</source>
<translation>Cercle</translation>
</message>
<message>
<source>PREF_HOR_AXIS_SCALE</source>
- <translation>Echelle de l'axe horizontal:</translation>
+ <translation>Echelle de l'axe horizontal:</translation>
</message>
<message>
<source>PREF_VERT_AXIS_SCALE</source>
- <translation>Echelle de l'axe vertical:</translation>
+ <translation>Echelle de l'axe vertical:</translation>
</message>
<message>
<source>PREF_VIEWER_BACKGROUND</source>
<translation>Couleur du fond</translation>
</message>
</context>
+<context>
+ <name>Plot2d_AnaliticCurveDlg</name>
+ <message>
+ <source>ANALITIC_CURVE_TLT</source>
+ <translation>Propriétés des courbes analytiques</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_PARAMS</source>
+ <translation>Paramètres de la courbe</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_PROPS</source>
+ <translation>Propriétés de la courbe</translation>
+ </message>
+ <message>
+ <source>AC_FORMULA</source>
+ <translation>y(x) = </translation>
+ </message>
+ <message>
+ <source>AC_NB_INTERVALS</source>
+ <translation>Nb. intervalles</translation>
+ </message>
+ <message>
+ <source>AC_AUTO_ASSIGN</source>
+ <translation>Affectation auto.</translation>
+ </message>
+ <message>
+ <source>AC_MARKER_TYPE</source>
+ <translation>Type de marqueur</translation>
+ </message>
+ <message>
+ <source>AC_LINE_TYPE</source>
+ <translation>Type de ligne</translation>
+ </message>
+ <message>
+ <source>AC_LINE_WIDTH</source>
+ <translation>Epaisseur de ligne</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_COLOR</source>
+ <translation>Couleur de la courbe</translation>
+ </message>
+ <message>
+ <source>AC_ADD_BTN</source>
+ <translation>Ajouter une courbe</translation>
+ </message>
+ <message>
+ <source>AC_REM_BTN</source>
+ <translation>Supprimer une courbe</translation>
+ </message>
+ <message>
+ <source>AC_UPD_BTN</source>
+ <translation>Mettre à jour la courbe</translation>
+ </message>
+ <message>
+ <source>AC_CANT_CALCULATE</source>
+ <translation>La courbe ne peut pas être calculée.
+Merci de vérifier les paramètres d'entrée</translation>
+ </message>
+ <message>
+ <source>AC_CLOSE_BTN</source>
+ <translation>&Fermer</translation>
+ </message>
+</context>
+<context>
+ <name>Plot2d_SetupCurveScaleDlg</name>
+ <message>
+ <source>TLT_SETUP_CURVE_SCALE</source>
+ <translation>Mise à l'échelle de courbe(s)</translation>
+ </message>
+ <message>
+ <source>CURVE_SCALE_FACTOR</source>
+ <translation>Facteur d'échelle</translation>
+ </message>
+</context>
</TS>
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = SalomePrs
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += PRS_EXPORTS
-
-HEADERS = SALOME_Prs.h
-
-SOURCES = SALOME_Prs.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
libPyConsole_la_CPPFLAGS = $(PYTHON_INCLUDES) $(QT_INCLUDES) \
-I$(srcdir)/../PyInterp -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx
-libPyConsole_la_LDFLAGS = $(PYTHON_LIBS) $(QT_MT_LIBS)
+libPyConsole_la_LDFLAGS = $(PYTHON_LIBS) $(QT_MT_LIBS) $(KERNEL_LDFLAGS) -lSALOMELocalTrace
libPyConsole_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../PyInterp/libPyInterp.la
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = lib
-TARGET = PyConsole
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-PYTHONVER=2.4
-PYTHONHOME=$$(PYTHONHOME)
-PYTHONINC=$${PYTHONHOME}/include/python$${PYTHONVER}
-PYTHONLIB=$${PYTHONHOME}/lib
-
-INCLUDEPATH += ../../include $${PYTHONINC}
-INCLUDEPATH += ../Qtx ../SUIT ../PyInterp
-unix:LIBS += -L$${PYTHONLIB} -lpython$${PYTHONVER}
-win32:LIBS += /LIBPATH:$$(PYTHONLIB)
-LIBS += -L../../lib -lqtx -lsuit -lPyInterp
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += PYCONSOLE_EXPORTS
-
-HEADERS = PyConsole.h
-HEADERS += PyConsole_Console.h
-HEADERS += PyConsole_Editor.h
-HEADERS += PyConsole_Interp.h
-
-SOURCES = PyConsole_Console.cxx
-SOURCES += PyConsole_Editor.cxx
-SOURCES += PyConsole_Interp.cxx
-
-TRANSLATIONS = resources/PyConsole_msg_en.ts
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = lib
-TARGET = PyInterp
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-PYTHONVER=2.4
-PYTHONHOME=$$(PYTHONHOME)
-PYTHONINC=$${PYTHONHOME}/include/python$${PYTHONVER}
-PYTHONLIB=$${PYTHONHOME}/lib
-
-INCLUDEPATH += ../../include $${PYTHONINC}
-unix:LIBS += -L$${PYTHONLIB} -lpython$${PYTHONVER}
-win32:LIBS += /LIBPATH:$${PYTHONLIB}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += PYINTERP_EXPORTS
-
-HEADERS = PyInterp.h
-HEADERS += PyInterp_Dispatcher.h
-HEADERS += PyInterp_Watcher.h
-HEADERS += PyInterp_Interp.h
-
-SOURCES = PyInterp_Dispatcher.cxx
-SOURCES += PyInterp_Interp.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
//! Enum describes bit flags of the Qt datum view and behaviour
typedef enum
{
- None = 0x00, //!< Non specified any flags (Default behaviour)
- Label = 0x01, //!< Create subwidget for datum label
- Control = 0x02, //!< Create subwidget for datum input control
- Units = 0x04, //!< Create subwidget for datum units of measure
- NotFormat = 0x08, //!< Don't format initial value
- NotAccel = 0x10, //!< Not support accelerators in datum label
- UnitsWithLabel = 0x20, //!< Display units of measure in label like "<label_text> (<units_text>) instead separate text"
+ None = 0x00, //!< Non specified any flags (Default behaviour)
+ Label = 0x01, //!< Create subwidget for datum label
+ Control = 0x02, //!< Create subwidget for datum input control
+ Units = 0x04, //!< Create subwidget for datum units of measure
+ NotFormat = 0x08, //!< Don't format initial value
+ NotAccel = 0x10, //!< Not support accelerators in datum label
+ NotConvert = 0x20, //!< Don't convert numeric value
+ UnitsWithLabel = 0x40, //!< Display units of measure in label like "<label_text> (<units_text>) instead separate text"
All = Label | Control | Units //!< Create all subwidgets
} DatumFlags;
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = QDS
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-INCLUDEPATH += ../../include $${CAS_CPPFLAGS} ../Qtx ../DDS
-LIBS += -L../../lib -lqtx -lDDS $${CAS_KERNEL}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += QDS_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = QDS.h
-HEADERS += QDS_CheckBox.h
-HEADERS += QDS_ComboBox.h
-HEADERS += QDS_Datum.h
-HEADERS += QDS_LineEdit.h
-HEADERS += QDS_SpinBox.h
-HEADERS += QDS_SpinBoxDbl.h
-HEADERS += QDS_TextEdit.h
-HEADERS += QDS_Validator.h
-HEADERS += QDS_RadioBox.h
-#HEADERS += QDS_Table.h
-
-SOURCES = QDS.cxx
-SOURCES += QDS_CheckBox.cxx
-SOURCES += QDS_ComboBox.cxx
-SOURCES += QDS_Datum.cxx
-SOURCES += QDS_LineEdit.cxx
-SOURCES += QDS_SpinBox.cxx
-SOURCES += QDS_SpinBoxDbl.cxx
-SOURCES += QDS_TextEdit.cxx
-SOURCES += QDS_Validator.cxx
-SOURCES += QDS_RadioBox.cxx
-#SOURCES += QDS_Table.cxx
-
-TRANSLATIONS = resources/QDS_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
else if ( txt.isEmpty() )
{
if ( !cb->isEditable() )
- cb->setItemText( cb->currentIndex(), txt );
+ cb->setCleared( true );
else
cb->lineEdit()->setText( txt );
}
- if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentIndex() ) )
+ if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentIndex() ) || isClear != cb->isCleared() )
{
onParamChanged();
QString str = getString();
else
{
res = getString().toDouble();
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
res = myDicItem->ToSI( res );
}
else
{
double val = getString().toDouble();
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
res = (int)myDicItem->ToSI( val );
}
mySourceValue = QString().setNum( num, 'g', 16 );
double val = num;
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
val = myDicItem->FromSI( val );
QString aStr = format( ( flags() & NotFormat ) ? (QString) "" : format(), type(), val );
mySourceValue = QString().setNum( num );
double val = num;
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
val = myDicItem->FromSI( val );
QString aStr = format( ( flags() & NotFormat ) ? (QString) "" : format(), type(), val );
sb->setSingleStep( .1 );
sb->setMinimum( minValue().isEmpty() ? -DBL_MAX : minValue().toDouble() );
sb->setMaximum( maxValue().isEmpty() ? DBL_MAX : maxValue().toDouble() );
-}
\ No newline at end of file
+}
</message>
<message>
<source>DATA_MIN_LIMIT</source>
- <translation> is greater than %1</translation>
+ <translation> greater than %1</translation>
</message>
<message>
<source>DATA_FLOAT</source>
</message>
<message>
<source>DATA_MAX_LIMIT</source>
- <translation> is less than %1</translation>
+ <translation> less than %1</translation>
</message>
<message>
<source>DATA_INPUT_VALUE</source>
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = lib
-TARGET = qtx
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-QT += xml
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += QTX_EXPORTS
-
-HEADERS = Qtx.h
-HEADERS += QtxAction.h
-HEADERS += QtxActionMenuMgr.h
-HEADERS += QtxActionMgr.h
-HEADERS += QtxActionSet.h
-HEADERS += QtxActionToolMgr.h
-HEADERS += QtxColorScale.h
-HEADERS += QtxComboBox.h
-HEADERS += QtxDialog.h
-HEADERS += QtxDockAction.h
-HEADERS += QtxDockWidget.h
-HEADERS += QtxDoubleSpinBox.h
-HEADERS += QtxEvalExpr.h
-HEADERS += QtxGridBox.h
-HEADERS += QtxGroupBox.h
-HEADERS += QtxIntSpinBox.h
-HEADERS += QtxListAction.h
-HEADERS += QtxLogoMgr.h
-HEADERS += QtxMainWindow.h
-HEADERS += QtxMap.h
-HEADERS += QtxMRUAction.h
-HEADERS += QtxPathDialog.h
-HEADERS += QtxPopupMgr.h
-HEADERS += QtxResourceMgr.h
-HEADERS += QtxSplash.h
-HEADERS += QtxToolBar.h
-HEADERS += QtxToolTip.h
-HEADERS += QtxValidator.h
-HEADERS += QtxWorkspace.h
-HEADERS += QtxWorkspaceAction.h
-HEADERS += QtxWorkstack.h
-HEADERS += QtxWorkstackAction.h
-#HEADERS += QtxDirListEditor.h
-#HEADERS += QtxListBox.h
-#HEADERS += QtxListResourceEdit.h
-#HEADERS += QtxListView.h
-#HEADERS += QtxPopupMenu.h
-#HEADERS += QtxResourceEdit.h
-#HEADERS += QtxTable.h
-
-SOURCES = Qtx.cxx
-SOURCES += QtxAction.cxx
-SOURCES += QtxActionMenuMgr.cxx
-SOURCES += QtxActionMgr.cxx
-SOURCES += QtxActionSet.cxx
-SOURCES += QtxActionToolMgr.cxx
-SOURCES += QtxColorScale.cxx
-SOURCES += QtxComboBox.cxx
-SOURCES += QtxDialog.cxx
-SOURCES += QtxDockAction.cxx
-SOURCES += QtxDockWidget.cxx
-SOURCES += QtxDoubleSpinBox.cxx
-SOURCES += QtxEvalExpr.cxx
-SOURCES += QtxGridBox.cxx
-SOURCES += QtxGroupBox.cxx
-SOURCES += QtxIntSpinBox.cxx
-SOURCES += QtxListAction.cxx
-SOURCES += QtxLogoMgr.cxx
-SOURCES += QtxMainWindow.cxx
-SOURCES += QtxMRUAction.cxx
-SOURCES += QtxPathDialog.cxx
-SOURCES += QtxPopupMgr.cxx
-SOURCES += QtxResourceMgr.cxx
-SOURCES += QtxSplash.cxx
-SOURCES += QtxToolBar.cxx
-SOURCES += QtxToolTip.cxx
-SOURCES += QtxValidator.cxx
-SOURCES += QtxWorkspace.cxx
-SOURCES += QtxWorkspaceAction.cxx
-SOURCES += QtxWorkstack.cxx
-SOURCES += QtxWorkstackAction.cxx
-#SOURCES += QtxDirListEditor.cxx
-#SOURCES += QtxListBox.cxx
-#SOURCES += QtxListResourceEdit.cxx
-#SOURCES += QtxListView.cxx
-#SOURCES += QtxPopupMenu.cxx
-#SOURCES += QtxResourceEdit.cxx
-#SOURCES += QtxTable.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = QxGraph
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL
-
-INCLUDEPATH += $${QT_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} ../Qtx ../SUIT
-
-LIBS += $${QT_MT_LIBS} -L../../lib -lsuit
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += QXGRAPH_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = QxGraph_ActiveItem.h
-HEADERS += QxGraph_Prs.h
-HEADERS += QxGraph_Canvas.h
-HEADERS += QxGraph_CanvasView.h
-HEADERS += QxGraph_ViewWindow.h
-HEADERS += QxGraph_ViewManager.h
-HEADERS += QxGraph_ViewModel.h
-HEADERS += QxGraph_Def.h
-HEADERS += QxGraph.h
-
-SOURCES = QxGraph_Prs.cxx
-SOURCES += QxGraph_Canvas.cxx
-SOURCES += QxGraph_CanvasView.cxx
-SOURCES += QxGraph_ViewWindow.cxx
-SOURCES += QxGraph_ViewManager.cxx
-SOURCES += QxGraph_ViewModel.cxx
-
-TRANSLATIONS = resources/QxGraph_images.ts \
- resources/QxGraph_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE =
-TARGET = ResourceExporter
-DESTDIR = ../../bin
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include ../Qtx ../SUIT
-LIBS += -L../../lib -lqtx -lsuit
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES +=
-
-SOURCES = ResourceExporter.cxx
-
SALOME_PYQT_DataModelLight::SALOME_PYQT_DataModelLight(CAM_Module * theModule)
: LightApp_DataModel( theModule ),
myFileName( "" ),
- myStudyURL( "" )
+ myStudyURL( "" ),
+ myModified( false )
{
}
return false;
LightApp_DataModel::open( theURL, aDoc, theListOfFiles );
+
+ setModified( false );
return aModule->open(theListOfFiles);
theListOfFiles.append(QString(aTmpDir.c_str()));
int listSize = theListOfFiles.size();
aModule->save(theListOfFiles);
+
+ setModified( false );
+
//Return true if in the List of files was added item(s)
//else return false
return theListOfFiles.size() > listSize;
return true;
}
+//=================================================================================
+// function : dumpPython()
+// purpose : Re-defined from LigthApp_DataModel in order to participate
+// in dump study process
+//=================================================================================
+bool SALOME_PYQT_DataModelLight::dumpPython( const QString& theURL,
+ CAM_Study* theStudy,
+ bool isMultiFile,
+ QStringList& theListOfFiles )
+{
+ MESSAGE("SALOME_PYQT_DataModelLight::dumpPython()");
+
+ LightApp_DataModel::dumpPython( theURL, theStudy, isMultiFile, theListOfFiles );
+
+ LightApp_Study* study = dynamic_cast<LightApp_Study*>( theStudy );
+ SALOME_PYQT_ModuleLight* aModule = dynamic_cast<SALOME_PYQT_ModuleLight*>(module());
+
+ if(!aModule || !study)
+ return false;
+
+ std::string aTmpDir = study->GetTmpDir( theURL.toLatin1().constData(), isMultiFile );
+
+ theListOfFiles.append( QString( aTmpDir.c_str() ) );
+ int oldSize = theListOfFiles.size();
+
+ aModule->dumpPython( theListOfFiles );
+
+ //Return true if some items have been added, else return false
+ return theListOfFiles.size() > oldSize;
+}
+
//=================================================================================
// function : isModified()
-// purpose : default implementation, always returns false so as not to mask study's isModified()
+// purpose : returns this model's modification status that can be controlled
+// with help of setModified() calls by the underlying Python module
//=================================================================================
bool SALOME_PYQT_DataModelLight::isModified() const
{
- return false;
+ return myModified;
}
//=================================================================================
-// function : isSaved()
-// purpose : default implementation, always returns true so as not to mask study's isSaved()
+// function : setModified()
+// purpose : sets the model's modification status, should be used by
+// the underlying Python module when its data changes.
//=================================================================================
-bool SALOME_PYQT_DataModelLight::isSaved() const
+void SALOME_PYQT_DataModelLight::setModified( bool flag )
{
- return true;
+ myModified = flag;
}
-
//=================================================================================
// function : close()
// purpose : Close data model operation
return;
}
-LightApp_ModuleObject* SALOME_PYQT_DataModelLight::getRoot()
+CAM_DataObject* SALOME_PYQT_DataModelLight::getRoot()
{
LightApp_Study* study = dynamic_cast<LightApp_Study*>( module()->application()->activeStudy() );
- LightApp_ModuleObject *aModelRoot = dynamic_cast<LightApp_ModuleObject*>(root());
- if(aModelRoot == NULL) {
- aModelRoot = new LightApp_ModuleObject(this,study->root());
+ CAM_ModuleObject *aModelRoot = dynamic_cast<CAM_ModuleObject*>(root());
+ if(study && aModelRoot == NULL) {
+ aModelRoot = createModuleObject( study->root() );
aModelRoot->setDataModel( this );
setRoot(aModelRoot);
}
virtual bool saveAs ( const QString&, CAM_Study*, QStringList& );
virtual bool close ();
virtual bool create ( CAM_Study* );
+ virtual bool dumpPython( const QString&,
+ CAM_Study*,
+ bool,
+ QStringList& );
virtual bool isModified () const;
- virtual bool isSaved () const;
+ void setModified( bool );
virtual void update ( LightApp_DataObject* = 0, LightApp_Study* = 0 );
- LightApp_ModuleObject* getRoot();
+ CAM_DataObject* getRoot();
private:
QString myFileName;
QString myStudyURL;
+ bool myModified;
};
#endif // SALOME_PYQT_DATAMODELLIGHT_H
return myEntry;
}
+//=================================================================================
+// function : SALOME_PYQT_DataObjectLight::refEntry()
+// purpose : return entry of the data object referenced by this one (if any)
+//=================================================================================
+QString SALOME_PYQT_DataObjectLight::refEntry() const
+{
+ return myRefEntry;
+}
+
+//=================================================================================
+// function : SALOME_PYQT_DataObjectLight::setRefEntry()
+// purpose : sets entry of the data object referenced by this one
+//=================================================================================
+void SALOME_PYQT_DataObjectLight::setRefEntry( const QString& refEntry )
+{
+ myRefEntry = refEntry;
+}
+
//=================================================================================
// function : SALOME_PYQT_DataObjectLight::name()
// purpose : return name of object
return myToolTip;
}
+//=================================================================================
+// function : SALOME_PYQT_DataObjectLight::toolTip()
+// purpose : return toolTip of object
+//=================================================================================
+QColor SALOME_PYQT_DataObjectLight::color( const ColorRole role, const int id ) const
+{
+ QColor c;
+
+ switch ( role )
+ {
+ case Text:
+ case Foreground:
+ if ( !isReference() )
+ c = myColor;
+ break;
+
+ default:
+ break;
+ }
+
+ // Issue 21379: LightApp_DataObject::color() defines colors for valid references
+ if ( !c.isValid() )
+ c = LightApp_DataObject::color( role, id );
+
+ return c;
+}
bool SALOME_PYQT_DataObjectLight::setName(const QString& name)
{
{
myToolTip = tooltip;
}
+
+void SALOME_PYQT_DataObjectLight::setColor(const QColor& color)
+{
+ myColor = color;
+}
virtual ~SALOME_PYQT_DataObjectLight();
virtual QString entry() const;
+
+ virtual QString refEntry() const;
+ void setRefEntry( const QString& refEntry );
virtual QString name() const;
- QPixmap icon(const int = NameId) const;
- QString toolTip(const int = NameId) const;
-
- bool setName(const QString& name);
- void setIcon(const QString& icon);
- void setToolTip(const QString& tooltip);
+ virtual QPixmap icon(const int = NameId) const;
+ virtual QString toolTip(const int = NameId) const;
+
+ bool setName(const QString& name);
+ void setIcon(const QString& icon);
+ void setToolTip(const QString& tooltip);
+
+ virtual QColor color( const ColorRole, const int = NameId ) const;
+ void setColor(const QColor& color);
private:
QString myEntry;
+ QString myRefEntry;
QString myName;
QString myToolTip;
QPixmap myIcon;
+ QColor myColor;
};
#endif // SALOME_PYQT_DATAOBJECTLIGHT_H
return;
if ( PyObject_HasAttrString(myModule, (char*)"saveFiles") ) {
+ // temporary set myInitModule because saveEvent() method
+ // might be called by the framework when this module is inactive,
+ // but still it should be possible to access this module's data
+ // from Python
+ myInitModule = this;
+
PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"saveFiles",
(char*)"s", (*it).toLatin1().constData()));
+
+ myInitModule = 0;
+
+ if( !res ) {
+ PyErr_Print();
+ }
+ else{
+ // parse the return value
+ // result can be one string...
+ if ( PyString_Check( res ) ) {
+ QString astr = PyString_AsString( res );
+ //SCRUTE(astr);
+ theListOfFiles.append(astr);
+ }
+ //also result can be a list...
+ else if ( PyList_Check( res ) ) {
+ int size = PyList_Size( res );
+ for ( int i = 0; i < size; i++ ) {
+ PyObject* value = PyList_GetItem( res, i );
+ if( value && PyString_Check( value ) ) {
+ theListOfFiles.append( PyString_AsString( value ) );
+ }
+ }
+ }
+ }
+ }
+}
+
+/*
+ * Python dump request.
+ * Called when user activates dump study operation.
+ */
+void SALOME_PYQT_ModuleLight::dumpPython(QStringList& theListOfFiles)
+{
+ MESSAGE("SALOME_PYQT_ModuleLight::dumpPython()")
+ // perform synchronous request to Python event dispatcher
+ class DumpEvent: public PyInterp_LockRequest
+ {
+ public:
+ DumpEvent(PyInterp_Interp* _py_interp,
+ SALOME_PYQT_ModuleLight* _obj,
+ QStringList& _files_list)
+ : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
+ myObj( _obj ) ,
+ myFilesList(_files_list) {}
+ protected:
+ virtual void execute()
+ {
+ myObj->dumpEvent(myFilesList);
+ }
+ private:
+ SALOME_PYQT_ModuleLight* myObj;
+ QStringList& myFilesList;
+ };
+
+ // Posting the request only if dispatcher is not busy!
+ // Executing the request synchronously
+ if ( !PyInterp_Dispatcher::Get()->IsBusy() )
+ PyInterp_Dispatcher::Get()->Exec( new DumpEvent( myInterp, this, theListOfFiles ) );
+}
+
+void SALOME_PYQT_ModuleLight::dumpEvent(QStringList& theListOfFiles)
+{
+ MESSAGE("SALOME_PYQT_ModuleLight::dumpEvent()");
+ QStringList::Iterator it = theListOfFiles.begin();
+ // Python interpreter should be initialized and Python module should be
+ // import first
+ if ( !myInterp || !myModule || (it == theListOfFiles.end()))
+ return;
+
+ if ( PyObject_HasAttrString(myModule, (char*)"dumpStudy") ) {
+ // temporary set myInitModule because dumpEvent() method
+ // might be called by the framework when this module is inactive,
+ // but still it should be possible to access this module's data
+ // from Python
+ myInitModule = this;
+
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"dumpStudy",
+ (char*)"s", (*it).toLatin1().constData()));
+
+ myInitModule = 0;
+
if( !res ) {
PyErr_Print();
}
}
}
+/*
+ * Return color of object
+ */
+QColor SALOME_PYQT_ModuleLight::getColor(const QString& obj)
+{
+ SALOME_PYQT_DataObjectLight* dataObj = findObject( obj );
+ if( dataObj ) {
+ return dataObj->color( SUIT_DataObject::Foreground );
+ }
+ return QColor();
+}
+
+/*
+ * Set color for object
+ */
+void SALOME_PYQT_ModuleLight::setColor(const QString& obj, const QColor& color)
+{
+ SALOME_PYQT_DataObjectLight* dataObj = findObject( obj );
+ if( dataObj ) {
+ dataObj->setColor( color );
+ }
+}
+
+/*
+ * Return entry of the referenced object (if any)
+ */
+QString SALOME_PYQT_ModuleLight::getReference(const QString& obj)
+{
+ SALOME_PYQT_DataObjectLight* dataObj = findObject(obj);
+ if(dataObj) {
+ return dataObj->refEntry();
+ }
+ return QString::null;
+}
+
+
+/*
+ * Set entry of the referenced object
+ */
+void SALOME_PYQT_ModuleLight::setReference(const QString& obj, const QString& refEntry)
+{
+ SALOME_PYQT_DataObjectLight* dataObj = findObject(obj);
+ if(dataObj) {
+ dataObj->setRefEntry(refEntry);
+ }
+}
+
/*
* Remove object by entry
*/
MESSAGE( "SALOME_PYQT_ModuleLight::createDataModel()" );
return new SALOME_PYQT_DataModelLight(this);
}
+
+/*!
+ * Returns the Python module object currently loaded.
+ */
+PyObject* SALOME_PYQT_ModuleLight::getPythonModule()
+{
+ return myModule;
+}
void setPreferenceProperty( const int, const QString&,
const QVariant& );
- void save(QStringList& theListOfFiles);
-
- bool open(QStringList theListOfFiles);
+ void save(QStringList& theListOfFiles);
+ bool open(QStringList theListOfFiles);
+ void dumpPython(QStringList& theListOfFiles);
/*create new SALOME_PYQT_DataObjectLight and return its entry*/
- QString createObject(const QString& parent);
- QString createObject(const QString& name,
- const QString& iconname,
- const QString& tooltip,
- const QString& parent);
+ QString createObject(const QString& parent);
+ QString createObject(const QString& name,
+ const QString& iconname,
+ const QString& tooltip,
+ const QString& parent);
/*Sets Name, Icon and Tool Tip for object*/
void setName(const QString& obj,const QString& iconname);
void setIcon(const QString& obj,const QString& name);
- void setToolTip(const QString& obj, const QString& name);
+ void setToolTip(const QString& obj, const QString& tooltip);
/*Gets Name and Tool Tip for object*/
QString getName(const QString& obj);
QString getToolTip(const QString& obj);
+
+ void setColor(const QString& obj, const QColor& color);
+ QColor getColor(const QString& obj);
+
+ void setReference( const QString& obj,
+ const QString& refEntry );
+ QString getReference( const QString& obj );
+
/*remove object*/
void removeObject(const QString& obj);
/*remove child*/
/*return list of child objets*/
QStringList getChildren(const QString& obj, const bool rec);
+ /*Access to the underlying Python module object */
+ PyObject* getPythonModule();
+
public slots:
virtual bool activateModule( SUIT_Study* );
void connectView( const SUIT_ViewWindow* );
void saveEvent(QStringList& theListOfFiles);
+ void dumpEvent(QStringList& theListOfFiles);
void openEvent(QStringList theListOfFiles, bool& opened);
SALOME_PYQT_DataObjectLight* findObject(const QString& entry);
#endif
#include <SALOME_PYQT_ModuleLight.h> // this include must be first!!!
+#include <SALOME_PYQT_DataModelLight.h>
#include "SalomePyQt.h"
#include <QApplication>
return ProcessEvent( new TGetActiveComponentEvent() );
}
+/*!
+ \fn PyObject* SalomePyQt::getActivePythonModule()
+ \brief Access to Python module object currently loaded into SALOME_PYQT_ModuleLight container.
+ \return Python module object currently loaded into SALOME_PYQT_ModuleLight container
+*/
+
+class TGetActivePyModuleEvent: public SALOME_Event
+{
+public:
+ typedef PyObject* TResult;
+ TResult myResult;
+ TGetActivePyModuleEvent() : myResult( 0 ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = getActiveModule();
+ if ( module )
+ myResult = (PyObject*)module->getPythonModule();
+ }
+};
+PyObject* SalomePyQt::getActivePythonModule()
+{
+ return ProcessEvent( new TGetActivePyModuleEvent() );
+}
+
+/*!
+ \fn bool SalomePyQt::activateModule( const QString& modName )
+ \brief Activates SALOME module with the given name
+ \return True if the module has been activated and False otherwise.
+*/
+
+class TActivateModuleEvent: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ QString myModuleName;
+ TActivateModuleEvent( const QString& modName )
+ : myResult( false ), myModuleName( modName ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ myResult = anApp->activateModule( myModuleName );
+ }
+ }
+};
+bool SalomePyQt::activateModule( const QString& modName )
+{
+ return ProcessEvent( new TActivateModuleEvent( modName ) );
+}
+
/*!
\brief Update an Object Browser of the specified (by identifier) study.
ProcessVoidEvent( new TEvent( studyId, updateSelection ) );
}
+
+/*!
+ SalomePyQt::isModified()
+ \return The modification status of the data model
+ for the currently active Python module
+ \sa setModified()
+*/
+class TIsModifiedEvent: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ TIsModifiedEvent() : myResult( false ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = getActiveModule();
+ if ( !module )
+ return;
+
+ SALOME_PYQT_DataModelLight* aModel =
+ dynamic_cast<SALOME_PYQT_DataModelLight*>( module->dataModel() );
+ if ( aModel )
+ myResult = aModel->isModified();
+ }
+};
+bool SalomePyQt::isModified()
+{
+ return ProcessEvent(new TIsModifiedEvent());
+}
+
+/*!
+ SalomePyQt::setModified()
+
+ Sets the modification status of the data model for
+ the currently active Python module. This method should be used
+ by the Python code in order to enable/disable "Save" operation
+ depending on the module's data state.
+
+ \param New modification status of the data model
+
+ \sa isModified()
+*/
+void SalomePyQt::setModified( bool flag )
+{
+ class TEvent: public SALOME_Event
+ {
+ bool myFlag;
+ public:
+ TEvent( bool flag )
+ : myFlag( flag ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = getActiveModule();
+ if ( !module )
+ return;
+
+ SALOME_PYQT_DataModelLight* aModel =
+ dynamic_cast<SALOME_PYQT_DataModelLight*>( module->dataModel() );
+ LightApp_Application* aLApp =
+ dynamic_cast<LightApp_Application*>( module->application() );
+ if ( !aModel || !aLApp )
+ return;
+
+ aModel->setModified( myFlag );
+ aLApp->updateActions();
+ }
+ };
+ ProcessVoidEvent( new TEvent( flag ) );
+}
+
/*!
\brief Default resource file section name.
\internal
ProcessVoidEvent(new TSetToolTipEvent(obj,tooltip));
}
+/*!
+ SalomePyQt::setReference(obj,refEntry)
+ Set entry to referenced object
+*/
+class TSetRefEvent: public SALOME_Event
+{
+public:
+ QString myObj;
+ QString myRefEntry;
+ TSetRefEvent( const QString& obj,
+ const QString& refEntry) : myObj(obj),
+ myRefEntry(refEntry) {}
+ virtual void Execute() {
+ SALOME_PYQT_ModuleLight* module = getActiveModule();
+ if ( module )
+ module->setReference(myObj,myRefEntry);
+ }
+};
+void SalomePyQt::setReference(const QString& obj,const QString& refEntry)
+{
+ ProcessVoidEvent(new TSetRefEvent(obj,refEntry));
+}
+
+/*!
+ SalomePyQt::setColor(obj,color)
+ Set object color
+*/
+class TSetColorEvent: public SALOME_Event
+{
+public:
+ QString myObj;
+ QColor myColor;
+ TSetColorEvent( const QString& obj,
+ const QColor& color) : myObj(obj),
+ myColor(color) {}
+ virtual void Execute() {
+ SALOME_PYQT_ModuleLight* module = getActiveModule();
+ if ( module )
+ module->setColor(myObj,myColor);
+ }
+};
+void SalomePyQt::setColor(const QString& obj,const QColor& color)
+{
+ ProcessVoidEvent(new TSetColorEvent(obj,color));
+}
+
/*!
SalomePyQt::getName(obj)
Return name of object
return ProcessEvent(new TGetToolTipEvent(obj));
}
+/*!
+ SalomePyQt::getReference(obj)
+ Return entry of the referenced object (if any)
+*/
+class TGetRefEvent: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ QString myObj;
+ TGetRefEvent( const QString& obj ) : myObj(obj) {}
+ virtual void Execute() {
+ SALOME_PYQT_ModuleLight* module = getActiveModule();
+ if ( module )
+ myResult = module->getReference(myObj);
+ }
+};
+QString SalomePyQt::getReference(const QString& obj)
+{
+ return ProcessEvent(new TGetRefEvent(obj));
+}
+
+/*!
+ SalomePyQt::getColor(obj)
+ Return the color of the object
+*/
+class TGetColorEvent: public SALOME_Event
+{
+public:
+ typedef QColor TResult;
+ TResult myResult;
+ QString myObj;
+ TGetColorEvent( const QString& obj ) : myObj(obj) {}
+ virtual void Execute() {
+ SALOME_PYQT_ModuleLight* module = getActiveModule();
+ if ( module )
+ myResult = module->getColor(myObj);
+ }
+};
+QColor SalomePyQt::getColor(const QString& obj)
+{
+ return ProcessEvent(new TGetColorEvent(obj));
+}
/*!
SalomePyQt::removeChild(obj)
#ifndef SALOME_PYQT_H
#define SALOME_PYQT_H
+#include <Python.h>
+
#include <QObject>
#include <QString>
#include <QColor>
static int getStudyId();
static void putInfo( const QString&, const int = 0 );
static const QString getActiveComponent();
+ static PyObject* getActivePythonModule();
+ static bool activateModule( const QString& );
static void updateObjBrowser( const int = 0, bool = true );
+ static bool isModified();
+ static void setModified( bool );
+
static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool );
static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& );
static QString getExistingDirectory( QWidget*, const QString&, const QString& );
static QString getName(const QString& obj);
static QString getToolTip(const QString& obj);
+ static void setColor(const QString& obj,const QColor& color);
+ static QColor getColor(const QString& obj);
+
+ static void setReference( const QString& obj,
+ const QString& refEntry );
+ static QString getReference( const QString& obj );
+
static QIcon loadIcon( const QString&, const QString& );
static void helpContext( const QString&, const QString& );
static int getStudyId() /ReleaseGIL/ ;
static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
static const QString getActiveComponent() /ReleaseGIL/ ;
- static void updateObjBrowser( const int = 0, bool = true ) /ReleaseGIL/ ;
+ static SIP_PYOBJECT getActivePythonModule() /ReleaseGIL/ ;
+ static bool activateModule( const QString& ) /ReleaseGIL/ ;
+ static void updateObjBrowser( const int = 0, bool = true ) /ReleaseGIL/ ;
+
+ static bool isModified() /ReleaseGIL/ ;
+ static void setModified( bool ) /ReleaseGIL/ ;
static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
static QString createObject( const QString& = QString("") ) /ReleaseGIL/ ;
static QString createObject( const QString&,
- const QString&,
- const QString&,
- const QString& = QString("") ) /ReleaseGIL/ ;
+ const QString&,
+ const QString&,
+ const QString& = QString("") ) /ReleaseGIL/ ;
static void setName(const QString& ,const QString& ) /ReleaseGIL/ ;
static void setIcon(const QString& ,const QString& ) /ReleaseGIL/ ;
static QString getName(const QString& ) /ReleaseGIL/ ;
static QString getToolTip(const QString& ) /ReleaseGIL/ ;
+ static void setColor( const QString&, const QColor& ) /ReleaseGIL/ ;
+ static QColor getColor( const QString& ) /ReleaseGIL/ ;
+
+ static void setReference( const QString& ,const QString& ) /ReleaseGIL/ ;
+ static QString getReference( const QString& ) /ReleaseGIL/ ;
+
static void removeObject(const QString& ) /ReleaseGIL/ ;
static void removeChild(const QString& = QString("") ) /ReleaseGIL/ ;
static QStringList getChildren(const QString&=QString("") , const bool = false) /ReleaseGIL/ ;
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# File : Help.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-#
-class SalomeDoc:
- def __init__(self, aDoc):
- self.doc = aDoc
- def __repr__(self):
- print self.doc
- return "---"
- def salome(self):
- doc_salome = '''
-MODULE : salome
----------------
-module salome gives access to Salome ressources:
-variables:
-
- salome:orb : CORBA
- salome.naming_service : instance of naming Service class
- methods:
- Resolve(name) : find a CORBA object (ior) by its pathname
- Register(name) : register a CORBA object under a pathname
- salome.lcc : instance of lifeCycleCORBA class
- methods:
- FindOrLoadComponent(server,name) :
- obtain an Engine (CORBA object)
- or launch the Engine if not found,
- with a Server name and an Engine name
- salome.sg
- methods:
- updateObjBrowser(bool):
- getActiveStudyId():
- getActiveStudyName():
-
- SelectedCount(): returns number of selected objects
- getSelected(i): returns entry of selected object number i
- getAllSelected(): returns list of entry of selected objects
- AddIObject(Entry): select an existing Interactive object
- RemoveIObject(Entry): remove object from selection
- ClearIObjects(): clear selection
-
- Display(*Entry):
- DisplayOnly(Entry):
- Erase(Entry):
- DisplayAll():
- EraseAll():
-
- IDToObject(Entry): returns CORBA reference from entry
-
- salome.myStudyName : active Study Name
- salome.myStudyId : active Study Id
- salome.myStudy : the active Study itself (CORBA ior)
- methods : defined in SALOMEDS.idl
-
-methods:
- salome.DumpStudy(study) : Dump a study, given the ior
----
-'''
- print doc_salome
-
- def geompy(self):
- doc_geompy = '''
-MODULE : geompy
----------------
-module geompy provides an encapsulation of GEOM Engine methods
-variables:
- geompy.geom : a Geometry Engine, found or loaded
- at first import of module geompy.
- methods : defined in GEOM_Gen.idl
- geompy.myBuilder : a study builder
- geompy.father : GEOM root in current study (salome.myStudy)
-
-methods:
- addToStudy(aShape, aName) : add the shape into the current study
- --- all methods of GEOM_Gen.idl that returns a shape are encapsulated,
- with the same interface : shapes are named with their ior
-'''
- print doc_geompy
-
- def supervision(self):
- doc_supervision = '''
-MODULES : SALOME_SuperVisionEditor and SALOME_SuperVisionExecutor
------------------------------------------------------------------
-this modules provide access to Editor and Executor Engine methods
-
-See SUPERV.idl
-
-In order to run the example (supervisionexample.py)
-
- Type : from supervisionexample import *
- supervisionexample.py contains comments
-
-A new python example avoids references to LifeCycleCORBA
- avoids references to NamingService
- avoids references to ModuleCatalog
- avoids SuperVisionComponent creation
- allows G.Input(...) instead of AddInput(G,...)
- replaces Editor/Executor with Graph
- allows Nodes, Ports and Links CORBA objects
- shortens methods names
- ...
-
- See /SuperVisionTest/resources/GraphExample.py
- and GraphExample.xml
----
-'''
- print doc_supervision
-
-
-
-help = SalomeDoc('''
-Availables modules:
- salome : gives access to Salome ressources
- geompy : encapsulation of GEOM Engine methods
- supervision : gives access to SuperVision Engine
-To obtain specific help on a module "truc", type: help.truc()
-To run an example, type: import example3
-''')
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# File : PyInterp.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-#
-import sys
-from omniORB import CORBA
-from LifeCycleCORBA import *
-from libSALOME_Swig import *
-import SALOMEDS
-from SALOME_NamingServicePy import *
-
- #--------------------------------------------------------------------------
-
-def DumpComponent(Study, SO, offset):
- it = Study.NewChildIterator(SO)
- Builder = Study.NewBuilder()
- while it.More():
- CSO = it.Value()
- it.Next()
- anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName")
- AtName = anAttr._narrow(SALOMEDS.AttributeName)
- t_name = AtName.Value()
- if t_name[0] == 1:
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + "--"
- ofs = ofs +1
- print a + ">" + CSO.GetID() + " " + t_name[1]
- t_RefSO = CSO.ReferencedObject()
- if t_RefSO[0] == 1:
- RefSO = t_RefSO[1]
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + " "
- ofs = ofs +1
- print a + ">" + RefSO.GetID()
- DumpComponent(Study, CSO, offset+2)
-
- #--------------------------------------------------------------------------
-
-def DumpStudy(Study):
- itcomp = Study.NewComponentIterator()
- while itcomp.More():
- SC = itcomp.Value()
- itcomp.Next()
- name = SC.ComponentDataType()
- print "-> ComponentDataType is " + name
- DumpComponent(Study, SC, 1)
-
-
- #--------------------------------------------------------------------------
-
-# initialise the ORB
-orb = CORBA.ORB_init([''], CORBA.ORB_ID)
-
-# create an LifeCycleCORBA instance
-lcc = LifeCycleCORBA(orb)
-
-# create an SALOMEGUI_Swig instance
-sg = SALOMEGUI_Swig()
-
-#create an naming service instance
-naming_service = SALOME_NamingServicePy_i(orb)
-
-# get active study name and id
-myStudyName = sg.getActiveStudyName()
-print myStudyName
-
-myStudyId = sg.getActiveStudyId()
-print myStudyId
-
-# get Study Manager reference
-obj = naming_service.Resolve('myStudyManager')
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-
-# get active study
-myStudy = myStudyManager.GetStudyByName(myStudyName)
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# File : salome.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-#
-from omniORB import CORBA
-from LifeCycleCORBA import *
-from libSALOME_Swig import *
-import SALOMEDS
-from SALOME_NamingServicePy import *
-
-from SALOME_utilities import *
-
-#--------------------------------------------------------------------------
-
-def DumpComponent(Study, SO, offset):
- it = Study.NewChildIterator(SO)
- Builder = Study.NewBuilder()
- while it.More():
- CSO = it.Value()
- it.Next()
- anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName")
- AtName = anAttr._narrow(SALOMEDS.AttributeName)
- t_name = AtName.Value()
- if t_name[0] == 1:
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + "--"
- ofs = ofs +1
- MESSAGE( a + ">" + str(CSO.GetID()) + " " + str(t_name[1]) )
- t_RefSO = CSO.ReferencedObject()
- if t_RefSO[0] == 1:
- RefSO = t_RefSO[1]
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + " "
- ofs = ofs +1
- MESSAGE( a + ">" + str(RefSO.GetID()) )
- DumpComponent(Study, CSO, offset+2)
-
- #--------------------------------------------------------------------------
-
-def DumpStudy(Study):
- itcomp = Study.NewComponentIterator()
- while itcomp.More():
- SC = itcomp.Value()
- itcomp.Next()
- name = SC.ComponentDataType()
- MESSAGE( "-> ComponentDataType is " + name )
- DumpComponent(Study, SC, 1)
-
-
- #--------------------------------------------------------------------------
-
-def ImportComponentGUI(ComponentName):
- libName = "lib" + ComponentName + "_Swig"
- command = "from " + libName + " import *"
- exec ( command )
- constructor = ComponentName + "_Swig()"
- command = "gui = " + constructor
- exec ( command )
- return gui
-
- #--------------------------------------------------------------------------
-
-def SalomeGUIgetAllSelected(self):
- selNumber = self.SelectedCount()
- listSelected = []
- for i in range(selNumber):
- listSelected.append(self.getSelected(i))
- return listSelected
-
-class SalomeGUI(SALOMEGUI_Swig):
- getAllSelected = SalomeGUIgetAllSelected
-
- #--------------------------------------------------------------------------
-
-def IDToObject(id):
- myObj = None
- mySO = myStudy.FindObjectID(id);
- if mySO is not None:
- ok, anAttr = mySO.FindAttribute("AttributeIOR")
- if ok:
- AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
- if AtIOR.Value() != "":
- myObj = orb.string_to_object(AtIOR.Value())
- return myObj
-
-def ObjectToSObject(obj):
- mySO = None
- if obj is not None:
- ior = orb.object_to_string(obj)
- if ior != "":
- mySO = myStudy.FindObjectIOR(ior)
- return mySO
-
-def ObjectToID(obj):
- mySO = ObjectToSObject(obj)
- if mySO:
- return mySO.GetID()
- return ""
-
-def IDToSObject(id):
- mySO = myStudy.FindObjectID(id);
- return mySO
-
- #--------------------------------------------------------------------------
-
-# initialise the ORB
-orb = CORBA.ORB_init([''], CORBA.ORB_ID)
-
-# create an LifeCycleCORBA instance
-lcc = LifeCycleCORBA(orb)
-
-# create an SALOMEGUI_Swig instance
-sg = SalomeGUI()
-
-#create an naming service instance
-naming_service = SALOME_NamingServicePy_i(orb)
-
-# get active study name and id
-myStudyName = sg.getActiveStudyName()
-MESSAGE( myStudyName )
-
-myStudyId = sg.getActiveStudyId()
-MESSAGE( str(myStudyId) )
-
-# get Study Manager reference
-obj = naming_service.Resolve('myStudyManager')
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-
-# get active study
-myStudy = myStudyManager.GetStudyByName(myStudyName)
-
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = SOCC
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-INCLUDEPATH += ../../include $${CAS_CPPFLAGS} $${BOOST_CPPFLAGS} ../Qtx ../SUIT ../OBJECT ../Prs ../OCCViewer
-LIBS += -L../../lib -lqtx -lsuit -lSalomeObject -lSalomePrs -lOCCViewer
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += SOCC_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = SOCC.h
-HEADERS += SOCC_ViewModel.h
-HEADERS += SOCC_Prs.h
-HEADERS += SOCC_ViewWindow.h
-
-SOURCES = SOCC_ViewModel.cxx
-SOURCES += SOCC_Prs.cxx
-SOURCES += SOCC_ViewWindow.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = SPlot2d
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-QWTHOME=$$(QWTHOME)
-QWTINC=$${QWTHOME}/include
-QWTLIB=$${QWTHOME}/lib
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-INCLUDEPATH += ../../include $${CAS_CPPFLAGS} ../../include $${QWTINC} $${BOOST_CPPFLAGS}
-INCLUDEPATH += ../Qtx ../SUIT ../Plot2d ../Prs ../OBJECT
-unix:LIBS += -L$${QWTLIB} -lqwt
-win32:LIBS += /LIBPATH:$$(QWTLIB)
-LIBS += -L../../lib -lsuit -lPlot2d -lSalomePrs
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += SPLOT2D_EXPORTS
-
-HEADERS = SPlot2d.h
-HEADERS = SPlot2d_Curve.h
-HEADERS = SPlot2d_Prs.h
-HEADERS = SPlot2d_ViewModel.h
-HEADERS = SPlot2d_ViewWindow.h
-
-SOURCES = SPlot2d_Curve.cxx
-SOURCES += SPlot2d_Curve.cxx
-SOURCES += SPlot2d_Prs.cxx
-SOURCES += SPlot2d_ViewModel.cxx
-SOURCES += SPlot2d_ViewWindow.cxx
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-INSTALLS += includes
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = lib
-TARGET = std
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include ../Qtx ../SUIT
-LIBS += -L../../lib -lqtx -lsuit
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += STD_EXPORTS
-
-HEADERS = STD.h
-HEADERS += STD_Application.h
-HEADERS += STD_MDIDesktop.h
-HEADERS += STD_SDIDesktop.h
-HEADERS += STD_TabDesktop.h
-
-SOURCES = STD_Application.cxx
-SOURCES += STD_MDIDesktop.cxx
-SOURCES += STD_SDIDesktop.cxx
-SOURCES += STD_TabDesktop.cxx
-
-TRANSLATIONS = resources/STD_images.ts \
- resources/STD_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm resources/*.xml resources/*.ini
-resources.path = ../../resources
-
-INSTALLS += includes resources
createAction( FileSaveAsId, tr( "TOT_DESK_FILE_SAVEAS" ), QIcon(),
tr( "MEN_DESK_FILE_SAVEAS" ), tr( "PRP_DESK_FILE_SAVEAS" ),
- Qt::CTRL+Qt::Key_A, desk, false, this, SLOT( onSaveAsDoc() ) );
+ Qt::CTRL+Qt::SHIFT+Qt::Key_S, desk, false, this, SLOT( onSaveAsDoc() ) );
createAction( EditCopyId, tr( "TOT_DESK_EDIT_COPY" ),
resMgr->loadPixmap( "STD", tr( "ICON_EDIT_COPY" ) ),
QAction* a = createAction( ViewStatusBarId, tr( "TOT_DESK_VIEW_STATUSBAR" ),
QIcon(), tr( "MEN_DESK_VIEW_STATUSBAR" ),
- tr( "PRP_DESK_VIEW_STATUSBAR" ), Qt::SHIFT+Qt::Key_S, desk, true );
+ tr( "PRP_DESK_VIEW_STATUSBAR" ), Qt::ALT+Qt::SHIFT+Qt::Key_S, desk, true );
a->setChecked( desk->statusBar()->isVisibleTo( desk ) );
connect( a, SIGNAL( toggled( bool ) ), this, SLOT( onViewStatusBar( bool ) ) );
createAction( HelpAboutId, tr( "TOT_DESK_HELP_ABOUT" ), QIcon(),
tr( "MEN_DESK_HELP_ABOUT" ), tr( "PRP_DESK_HELP_ABOUT" ),
- Qt::SHIFT+Qt::Key_A, desk, false, this, SLOT( onHelpAbout() ) );
+ Qt::ALT+Qt::SHIFT+Qt::Key_A, desk, false, this, SLOT( onHelpAbout() ) );
QtxDockAction* dwa = new QtxDockAction( tr( "TOT_DOCKWINDOWS" ), tr( "MEN_DESK_VIEW_DOCKWINDOWS" ), desk );
// But the workstack must occupy as much space as possible -- set Expanding for it.
myWorkstack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- myWorkstack->setAccel( QtxWorkstack::SplitVertical, Qt::SHIFT + Qt::Key_V );
- myWorkstack->setAccel( QtxWorkstack::SplitHorizontal, Qt::SHIFT + Qt::Key_H );
- myWorkstack->setAccel( QtxWorkstack::Close, Qt::SHIFT + Qt::Key_C );
+ myWorkstack->setAccel( QtxWorkstack::SplitVertical, Qt::ALT + Qt::SHIFT + Qt::Key_V );
+ myWorkstack->setAccel( QtxWorkstack::SplitHorizontal, Qt::ALT + Qt::SHIFT + Qt::Key_H );
+ myWorkstack->setAccel( QtxWorkstack::Close, Qt::CTRL + Qt::Key_F4 );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if ( resMgr ) {
resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HSPLIT" ) ) );
myWorkstackAction->setText( QtxWorkstackAction::SplitHorizontal, tr( "MEN_DESK_WINDOW_HSPLIT" ) );
myWorkstackAction->setStatusTip( QtxWorkstackAction::SplitHorizontal, tr( "PRP_DESK_WINDOW_HSPLIT" ) );
- myWorkstackAction->setAccel( QtxWorkstackAction::SplitHorizontal, Qt::SHIFT + Qt::Key_H );
+ myWorkstackAction->setAccel( QtxWorkstackAction::SplitHorizontal, Qt::ALT + Qt::SHIFT + Qt::Key_H );
// Split Vertical
myWorkstackAction->setIcon( QtxWorkstackAction::SplitVertical,
resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VSPLIT" ) ) );
myWorkstackAction->setText( QtxWorkstackAction::SplitVertical, tr( "MEN_DESK_WINDOW_VSPLIT" ) );
myWorkstackAction->setStatusTip( QtxWorkstackAction::SplitVertical, tr( "PRP_DESK_WINDOW_VSPLIT" ) );
- myWorkstackAction->setAccel( QtxWorkstackAction::SplitVertical, Qt::SHIFT + Qt::Key_V );
+ myWorkstackAction->setAccel( QtxWorkstackAction::SplitVertical, Qt::ALT + Qt::SHIFT + Qt::Key_V );
QtxActionMenuMgr* mMgr = menuMgr();
if ( !mMgr )
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = lib
-TARGET = suit
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include ../Qtx
-LIBS += -L../../lib -lqtx
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += SUIT_EXPORTS
-
-HEADERS = SUIT.h
-HEADERS += SUIT_Accel.h
-HEADERS += SUIT_ActionOperation.h
-HEADERS += SUIT_Application.h
-HEADERS += SUIT_DataObject.h
-HEADERS += SUIT_DataObjectIterator.h
-HEADERS += SUIT_DataObjectKey.h
-HEADERS += SUIT_DataOwner.h
-HEADERS += SUIT_Desktop.h
-HEADERS += SUIT_ExceptionHandler.h
-HEADERS += SUIT_FileDlg.h
-HEADERS += SUIT_FileValidator.h
-HEADERS += SUIT_LicenseDlg.h
-HEADERS += SUIT_MessageBox.h
-HEADERS += SUIT_Operation.h
-HEADERS += SUIT_OverrideCursor.h
-HEADERS += SUIT_PopupClient.h
-HEADERS += SUIT_ResourceMgr.h
-HEADERS += SUIT_SelectionFilter.h
-HEADERS += SUIT_SelectionMgr.h
-HEADERS += SUIT_Selector.h
-HEADERS += SUIT_Session.h
-HEADERS += SUIT_SmartPtr.h
-HEADERS += SUIT_Study.h
-HEADERS += SUIT_Tools.h
-HEADERS += SUIT_TreeSync.h
-HEADERS += SUIT_ViewManager.h
-HEADERS += SUIT_ViewModel.h
-HEADERS += SUIT_ViewWindow.h
-
-SOURCES = SUIT_Accel.cxx
-SOURCES += SUIT_ActionOperation.cxx
-SOURCES += SUIT_Application.cxx
-SOURCES += SUIT_DataObject.cxx
-SOURCES += SUIT_DataObjectIterator.cxx
-SOURCES += SUIT_DataObjectKey.cxx
-SOURCES += SUIT_DataOwner.cxx
-SOURCES += SUIT_Desktop.cxx
-SOURCES += SUIT_ExceptionHandler.cxx
-SOURCES += SUIT_FileDlg.cxx
-SOURCES += SUIT_FileValidator.cxx
-SOURCES += SUIT_LicenseDlg.cxx
-SOURCES += SUIT_MessageBox.cxx
-SOURCES += SUIT_Operation.cxx
-SOURCES += SUIT_OverrideCursor.cxx
-SOURCES += SUIT_PopupClient.cxx
-SOURCES += SUIT_ResourceMgr.cxx
-SOURCES += SUIT_SelectionFilter.cxx
-SOURCES += SUIT_SelectionMgr.cxx
-SOURCES += SUIT_Selector.cxx
-SOURCES += SUIT_Session.cxx
-SOURCES += SUIT_Study.cxx
-SOURCES += SUIT_Tools.cxx
-SOURCES += SUIT_ViewManager.cxx
-SOURCES += SUIT_ViewModel.cxx
-SOURCES += SUIT_ViewWindow.cxx
-
-TRANSLATIONS = resources/SUIT_images.ts \
- resources/SUIT_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
if ( key ) {
SUIT_ViewWindow* vw = ::getParentViewWindow( obj );
if ( vw ) {
- QString type = vw->getViewManager()->getViewModel()->getType();
- if ( myMap.contains( type ) ) {
- IdActionMap idActionMap = myMap[type];
- if ( idActionMap.contains( key ) ) {
- return vw->onAccelAction( idActionMap[key] );
+ if ( vw->getViewManager() && vw->getViewManager()->getViewModel() )
+ {
+ QString type = vw->getViewManager()->getViewModel()->getType();
+ if ( myMap.contains( type ) ) {
+ IdActionMap idActionMap = myMap[type];
+ if ( idActionMap.contains( key ) ) {
+ return vw->onAccelAction( idActionMap[key] );
+ }
}
}
}
}
}
+/*!
+ \brief Make the view item for specified data object is visible.
+ \param obj data object
+*/
+void SUIT_DataBrowser::ensureVisible( SUIT_DataObject* obj )
+{
+ if ( !obj )
+ return;
+
+ DataObjectList lst;
+ lst.append( obj );
+ ensureVisible( lst );
+}
+
+/*!
+ \brief Make the view items for specified data objects is visible.
+ \param lst data object list
+*/
+void SUIT_DataBrowser::ensureVisible( const DataObjectList& lst )
+{
+ QtxTreeView* tv = treeView();
+ SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( model() );
+ if ( !tv || !treeModel )
+ return;
+
+ for ( DataObjectList::const_iterator it = lst.begin(); it != lst.end(); ++it )
+ {
+ QModelIndex idx = treeModel->index( *it );
+ if ( idx.isValid() )
+ tv->scrollTo( idx );
+ }
+}
+
/*!
\brief Add custom actions to the popup menu.
\param menu popup menu
void setAutoSizeColumns( const bool on );
void setResizeOnExpandItem( const bool on );
+ void ensureVisible( SUIT_DataObject* );
+ void ensureVisible( const DataObjectList& );
+
protected:
virtual void contextMenuEvent( QContextMenuEvent* );
/*! Constructor.*/
SUIT_ViewWindow::SUIT_ViewWindow( SUIT_Desktop* theDesktop )
- : QMainWindow( theDesktop ), myIsDropDown( true )
+ : QMainWindow( theDesktop ), myManager( 0 ), myIsDropDown( true )
{
myDesktop = theDesktop;
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-TEMPLATE = app
-TARGET = SUITApp
-DESTDIR = ../../bin
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-INCLUDEPATH += ../../include ../Qtx ../SUIT
-LIBS += -L../../lib -lqtx -lsuit
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-
-HEADERS = SUITApp_Application.h
-
-SOURCES = SUITApp.cxx
-SOURCES += SUITApp_Application.cxx
#define _SUITAPP_INIT_PYTHON_
#include <pthread.h>
+
+// rnv: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+
#include <Python.h>
#ifdef WNT
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = SUPERVGraph
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL
-
-INCLUDEPATH += $${QT_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} ../Qtx ../SUIT ../OBJECT
-
-LIBS += $${QT_MT_LIBS} -L../../lib -lsuit
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += SUPERVGRAPH_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = SUPERVGraph_ViewFrame.h
-HEADERS += SUPERVGraph_ViewManager.h
-HEADERS += SUPERVGraph_ViewModel.h
-HEADERS += SUPERVGraph.h
-
-SOURCES = SUPERVGraph.cxx
-SOURCES += SUPERVGraph_ViewFrame.cxx
-SOURCES += SUPERVGraph_ViewManager.cxx
-SOURCES += SUPERVGraph_ViewModel.cxx
-
-TRANSLATIONS = resources/SUPERVGraph_images.ts \
- resources/SUPERVGraph_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = SVTK
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-VTKHOME = $$(VTKHOME)
-VTK_INCLUDES = $${VTKHOME}/include/vtk
-
-VTK_LIBS = -L$${VTKHOME}/lib/vtk -L$${VTKHOME}/lib/vtk/python -lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets -lGL -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lX11 -lXt
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-OCC_LIBS =
-
-INCLUDEPATH += ../../include $${CAS_CPPFLAGS} $${VTK_INCLUDES} $${BOOST_CPPFLAGS} ../Qtx ../SUIT ../OBJECT ../Prs ../VTKViewer
-LIBS += -L../../lib -lqtx -lsuit -lSalomeObject -lSalomePrs -lVTKViewer $${OCC_LIBS} $${VTK_LIBS}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += SVTK_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = SVTK.h
-HEADERS += SVTK_Prs.h
-HEADERS += SVTK_Actor.h
-HEADERS += SALOME_Actor.h
-HEADERS += SVTK_RectPicker.h
-HEADERS += SVTK_DeviceActor.h
-HEADERS += SVTK_DialogBase.h
-HEADERS += SVTK_FontWidget.h
-HEADERS += SVTK_CubeAxesActor2D.h
-HEADERS += SVTK_Functor.h
-HEADERS += SVTK_View.h
-HEADERS += SVTK_ViewManager.h
-HEADERS += SVTK_ViewModel.h
-HEADERS += SVTK_ViewWindow.h
-HEADERS += SVTK_Renderer.h
-HEADERS += SVTK_InteractorStyle.h
-HEADERS += SVTK_KeyFreeInteractorStyle.h
-HEADERS += SVTK_RenderWindowInteractor.h
-HEADERS += SVTK_GenericRenderWindowInteractor.h
-HEADERS += SVTK_Selector.h
-HEADERS += SVTK_Selection.h
-HEADERS += SVTK_SelectionEvent.h
-HEADERS += SVTK_SpaceMouse.h
-HEADERS += SVTK_Event.h
-HEADERS += SVTK_ViewModelBase.h
-HEADERS += SVTK_SetRotationPointDlg.h
-HEADERS += SVTK_ViewParametersDlg.h
-HEADERS += SVTK_ComboAction.h
-HEADERS += SVTK_Extension.h
-
-SOURCES = SVTK_Prs.cxx
-SOURCES += SVTK_Actor.cxx
-SOURCES += SALOME_Actor.cxx
-SOURCES += SVTK_RectPicker.cxx
-SOURCES += SVTK_DeviceActor.cxx
-SOURCES += SVTK_CubeAxesActor2D.cxx
-SOURCES += SVTK_NonIsometricDlg.cxx
-SOURCES += SVTK_UpdateRateDlg.cxx
-SOURCES += SVTK_CubeAxesDlg.cxx
-SOURCES += SVTK_DialogBase.cxx
-SOURCES += SVTK_FontWidget.cxx
-SOURCES += SVTK_Trihedron.cxx
-SOURCES += SVTK_View.cxx
-SOURCES += SVTK_ViewManager.cxx
-SOURCES += SVTK_ViewModel.cxx
-SOURCES += SVTK_Renderer.cxx
-SOURCES += SVTK_ViewWindow.cxx
-SOURCES += SVTK_InteractorStyle.cxx
-SOURCES += SVTK_KeyFreeInteractorStyle.cxx
-SOURCES += SVTK_RenderWindowInteractor.cxx
-SOURCES += SVTK_GenericRenderWindowInteractor.cxx
-SOURCES += SVTK_SpaceMouse.cxx
-SOURCES += SVTK_Selector.cxx
-SOURCES += SVTK_SetRotationPointDlg.cxx
-SOURCES += SVTK_ViewParametersDlg.cxx
-SOURCES += SVTK_ComboAction.cxx
-SOURCES += SVTK_Extension.cxx
-
-TRANSLATIONS = resources/SVTK_images.ts \
- resources/SVTK_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
+++ /dev/null
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-// File :
-// Author :
-// Module : SALOME
-// $Header$
-//
-#include "SVTK_DialogBase.h"
-
-#include "QtxAction.h"
-
-/*!
- Constructor
-*/
-SVTK_DialogBase
-::SVTK_DialogBase(QtxAction* theAction,
- QWidget* theParent,
- const char* theName,
- bool theModal,
- Qt::WindowFlags theWFalgs):
- QDialog(theParent,
- theWFalgs | Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
- myAction(theAction)
-{
- setObjectName(theName);
- setModal(theModal);
-
- connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
- connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-SVTK_DialogBase
-::~SVTK_DialogBase()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-void
-SVTK_DialogBase
-::onParentShow()
-{
- if(myAction->isChecked())
- show();
- else
- hide();
-}
-
-void
-SVTK_DialogBase
-::onParentHide()
-{
- hide();
-}
-
-void
-SVTK_DialogBase
-::done( int r )
-{
- myAction->setChecked( false );
- QDialog::done( r );
-}
+++ /dev/null
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-// File :
-// Author :
-// Module : SALOME
-// $Header$
-//
-#ifndef SVTK_DIALOGBASE_H
-#define SVTK_DIALOGBASE_H
-
-#include "SVTK.h"
-
-#include <QDialog>
-
-class QtxAction;
-
-class SVTK_EXPORT SVTK_DialogBase : public QDialog
-{
- Q_OBJECT;
-
-public:
- SVTK_DialogBase(QtxAction* theAction,
- QWidget* theParent,
- const char* theName = "",
- bool theModal = FALSE,
- Qt::WindowFlags theWFalgs = 0);
-
- ~SVTK_DialogBase();
-
-protected slots:
- void onParentShow();
- void onParentHide();
- virtual void done( int );
-
-protected:
- QtxAction* myAction;
-};
-
-#endif // SVTK_DIALOGBASE_H
+++ /dev/null
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-// File : SVTK_Extension.cxx
-// Author : Sergey ANIKIN
-// Module : SALOME
-//
-#include "SVTK_Extension.h"
-
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <dlfcn.h>
-#endif
-
-void* SVTK::getOpenGLExtension( const char* theExtension )
-{
-#ifdef WIN32
- return wglGetProcAddress( theExtension );
-#else
- void* OpenGLLibrary = dlopen( "libGL.so", RTLD_LAZY );
- return dlsym( OpenGLLibrary, theExtension );
-#endif
-}
+++ /dev/null
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef SVTK_Extension_H
-#define SVTK_Extension_H
-
-/*!
- \file SVTK_Extension.h
- Functions of loading OpenGL extensions.
-*/
-
-#include "SVTK.h"
-
-namespace SVTK
-{
- SVTK_EXPORT void* getOpenGLExtension( const char* theExtension );
-}
-
-
-#endif
include $(top_srcdir)/adm_local/unix/make_common_starter.am
+SUBDIRS=pluginsdemo
+
if CPPUNIT_IS_OK
if GUI_ENABLE_CORBA
- SUBDIRS = Test
+ SUBDIRS += Test
endif
endif
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = SalomeApp
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4
-
-QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml
-
-QWT_INCLUDES = $$(QWTHOME)/include
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-VTK_INCLUDES = $$(VTKHOME)/include/vtk
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome
-
-CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS
-
-HDF5_INCLUDES = $$(HDF5HOME)/include
-
-PYTHON_LIBS = -L$$(PYTHONHOME)/lib/python2.4/config -lpython2.4 -ldl -lutil
-
-QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL
-
-KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-
-INCLUDEPATH += $${PYTHON_INCLUDES} $${QT_INCLUDES} $${QWT_INCLUDES} $${CAS_CPPFLAGS} $${VTK_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} ../LightApp ../CAM ../Qtx ../SUIT ../OBJECT ../SVTK ../STD ../VTKViewer ../PyConsole ../TOOLSGUI ../PyInterp ../Session ../../idl ../Event ../../salome_adm/unix $${CORBA_INCLUDES} #../ObjBrowser
-
-LIBS += $${QT_MT_LIBS} $${PYTHON_LIBS} $${KERNEL_LDFLAGS} -lOpUtil -lSALOMELocalTrace -lSalomeDSClient -L../../lib -lsuit -lstd -lCAM -lSalomePrs -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPyConsole -lLogWindow -lLightApp -lToolsGUI $${CAS_KERNEL} #-lObjBrowser
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += SALOMEAPP_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG
-
-HEADERS = SalomeApp.h
-HEADERS += SalomeApp_Application.h
-HEADERS += SalomeApp_DataModel.h
-HEADERS += SalomeApp_DataObject.h
-HEADERS += SalomeApp_LoadStudiesDlg.h
-HEADERS += SalomeApp_Module.h
-HEADERS += SalomeApp_Study.h
-HEADERS += SalomeApp_ExceptionHandler.h
-HEADERS += SalomeApp_Tools.h
-HEADERS += SalomeApp_ImportOperation.h
-HEADERS += SalomeApp_Filter.h
-HEADERS += SalomeApp_TypeFilter.h
-HEADERS += SalomeApp_StudyPropertiesDlg.h
-HEADERS += SalomeApp_CheckFileDlg.h
-HEADERS += SalomeApp_VisualState.h
-
-SOURCES = SalomeApp_Module.cxx
-SOURCES += SalomeApp_Application.cxx
-SOURCES += SalomeApp_DataModel.cxx
-SOURCES += SalomeApp_DataObject.cxx
-SOURCES += SalomeApp_LoadStudiesDlg.cxx
-SOURCES += SalomeApp_Study.cxx
-SOURCES += SalomeApp_ExceptionHandler.cxx
-SOURCES += SalomeApp_PyInterp.cxx
-SOURCES += SalomeApp_Tools.cxx
-SOURCES += SalomeApp_ImportOperation.cxx
-SOURCES += SalomeApp_Filter.cxx
-SOURCES += SalomeApp_TypeFilter.cxx
-SOURCES += SalomeApp_StudyPropertiesDlg.cxx
-SOURCES += SalomeApp_ListView.cxx
-SOURCES += SalomeApp_CheckFileDlg.cxx
-SOURCES += SalomeApp_VisualState.cxx
-
-TRANSLATIONS = resources/SalomeApp_images.ts \
- resources/SalomeApp_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
//! Catalog Generator
createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIcon(),
tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
- Qt::SHIFT+Qt::Key_G, desk, false, this, SLOT( onCatalogGen() ) );
+ Qt::ALT+Qt::SHIFT+Qt::Key_G, desk, false, this, SLOT( onCatalogGen() ) );
//! Registry Display
createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ), QIcon(),
QFileInfo aFileInfo(aFileName);
if( aFileInfo.isDir() ) // IPAL19257
return;
+
+ // Issue 21377 - dump study implementation moved to SalomeApp_Study class
+ bool res = appStudy->dump( aFileName, toPublish, isMultiFile, toSaveGUI );
- 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.absolutePath().toStdString(),
- aFileInfo.baseName().toStdString(),
- toPublish,
- isMultiFile);
- if ( toSaveGUI )
- appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
if ( !res )
SUIT_MessageBox::warning( desktop(),
QObject::tr("WRN_WARNING"),
int salomeCat = pref->addPreference( tr( "PREF_CATEGORY_SALOME" ) );
int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat );
int defCols = pref->addPreference( tr( "PREF_GROUP_DEF_COLUMNS" ), obTab );
- for ( int i = SalomeApp_DataObject::EntryId; i <= SalomeApp_DataObject::RefEntryId; i++ )
+ for ( int i = SalomeApp_DataObject::EntryId; i < SalomeApp_DataObject::LastId; i++ )
{
pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i-SalomeApp_DataObject::EntryId ).toLatin1() ), defCols,
LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_id_%d", i-1 ) );
return &_lcc;
}
-/*!Return default engine IOR for light modules*/
-QString SalomeApp_Application::defaultEngineIOR()
-{
- /// Look for a default module engine (needed for CORBAless modules to use SALOMEDS persistence)
- QString anIOR( "" );
- CORBA::Object_ptr anEngine = namingService()->Resolve( "/SalomeAppEngine" );
- if ( !CORBA::is_nil( anEngine ) )
- {
- CORBA::String_var objStr = orb()->object_to_string( anEngine );
- anIOR = QString( objStr.in() );
- }
- return anIOR;
-}
-
/*!Private SLOT. On preferences.*/
void SalomeApp_Application::onProperties()
{
/*!find original object by double click on item */
void SalomeApp_Application::onDblClick( SUIT_DataObject* theObj )
{
- SalomeApp_DataObject* obj = dynamic_cast<SalomeApp_DataObject*>( theObj );
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ // Issue 21379: References are supported at LightApp_DataObject level
+ LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( theObj );
- if( study && obj )
+ if( obj && obj->isReference() )
{
- QString entry = obj->entry();
- _PTR(SObject) sobj = study->studyDS()->FindObjectID( entry.toStdString() ), ref;
-
- if( sobj && sobj->ReferencedObject( ref ) )
- {
- entry = ref->GetID().c_str();
+ QString entry = obj->refEntry();
- SUIT_DataOwnerPtrList aList;
- aList.append( new LightApp_DataOwner( entry ) );
- selectionMgr()->setSelected( aList, false );
+ SUIT_DataOwnerPtrList aList;
+ aList.append( new LightApp_DataOwner( entry ) );
+ selectionMgr()->setSelected( aList, false );
+
+ SUIT_DataBrowser* ob = objectBrowser();
- SUIT_DataBrowser* ob = objectBrowser();
-
- QModelIndexList aSelectedIndexes = ob->selectedIndexes();
- if ( !aSelectedIndexes.isEmpty() )
- ob->treeView()->scrollTo( aSelectedIndexes.first() );
- }
+ QModelIndexList aSelectedIndexes = ob->selectedIndexes();
+ if ( !aSelectedIndexes.isEmpty() )
+ ob->treeView()->scrollTo( aSelectedIndexes.first() );
}
}
void SalomeApp_Application::objectBrowserColumnsVisibility()
{
if ( objectBrowser() )
- for ( int i = SalomeApp_DataObject::EntryId; i <= SalomeApp_DataObject::RefEntryId; i++ )
+ for ( int i = SalomeApp_DataObject::EntryId; i < SalomeApp_DataObject::LastId; i++ )
{
bool shown = resourceMgr()->booleanValue( "ObjectBrowser", QString( "visibility_column_id_%1" ).arg( i-1 ), true );
objectBrowser()->treeView()->setColumnHidden( i, !shown );
static SALOMEDSClient_StudyManager* studyMgr();
static SALOME_NamingService* namingService();
static SALOME_LifeCycleCORBA* lcc();
- static QString defaultEngineIOR();
SUIT_ViewManager* newViewManager(const QString&);
void updateSavePointDataObjects( SalomeApp_Study* );
{
QString txt;
- // add "Value", "IOR", and "Reference Entry" columns
+ // Text for "Value" and "IOR" columns
switch ( id )
{
case ValueId:
case IORId:
txt = ior( referencedObject() );
break;
- case RefEntryId :
- if ( isReference() )
- txt = entry( referencedObject() );
- break;
default:
+ // Issue 21379: LightApp_DataObject::text() treats "Entry"
+ // and "Reference Entry" columns
txt = LightApp_DataObject::text( id );
break;
}
case Foreground:
// text color (not selected item)
if ( isReference() ) {
- if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) )
- c = QColor( 255, 0, 0 ); // valid reference (red)
- else
+ if ( QString(referencedObject()->GetName().c_str()).isEmpty() )
c = QColor( 200, 200, 200 ); // invalid reference (grayed)
}
else if ( myObject ) {
}
}
break;
+
case Highlight:
// background color for the highlighted item
if ( isReference() ) {
- if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) )
- c = QColor( 255, 0, 0 ); // valid reference (red)
- else
+ if ( QString(referencedObject()->GetName().c_str()).isEmpty() )
c = QColor( 200, 200, 200 ); // invalid reference (grayed)
}
else if ( myObject ) {
}
}
break;
- case HighlightedText:
- // text color for the highlighted item
- if ( isReference() )
- c = QColor( 255, 255, 255 ); // white
+ default:
break;
}
+
+ // Issue 21379: LightApp_DataObject::color() defines colors for valid references
if ( !c.isValid() )
c = LightApp_DataObject::color( role, id );
+
return c;
}
return myObject;
}
+/*!
+ \brief Returns the string identifier of the data objects referenced by this one.
+
+ Re-implemented from LightApp_DataObject using SALOMEDS API.
+
+ \return ID string of the referenced SObject
+*/
+QString SalomeApp_DataObject::refEntry() const
+{
+ return entry( referencedObject() );
+}
+
/*!
\brief Check if the data object is a reference.
+
+ Re-implemented from LightApp_DataObject using SALOMEDS API.
+
\return \c true if this data object actually refers to another one
*/
bool SalomeApp_DataObject::isReference() const
\brief Get data object icon for the specified column.
\param id column id
\return object icon for the specified column
+ \sa CAM_ModuleObject class
*/
QPixmap SalomeApp_ModuleObject::icon( const int id ) const
{
- return SalomeApp_DataObject::icon( id );
+ QPixmap p = SalomeApp_DataObject::icon( id );
+ // The module might not provide a separate small icon
+ // for Obj. Browser representation -> always try to scale it
+ // See CAM_ModuleObject::icon()
+ if ( !p.isNull() )
+ p = Qtx::scaleIcon( p, 16 );
+ return p;
}
/*!
public:
//! Column id
enum {
- ValueId = EntryId + 1, //!< value column
- IORId, //!< IOR column
- RefEntryId //!< reference entry column
+ ValueId = RefEntryId + 1, //!< value column
+ IORId, //!< IOR column
+ LastId //!< indicates last Id value
};
public:
virtual _PTR(SObject) object() const;
- bool isReference() const;
+ virtual QString refEntry() const;
+ virtual bool isReference() const;
_PTR(SObject) referencedObject() const;
+
bool hasChildren() const;
bool expandable() const;
#include <QCoreApplication>
#include <QEvent>
+#include <QFileInfo>
#include "SALOME_Event.h"
#include "Basics_Utils.hxx"
QListIterator<CAM_DataModel*> it( list );
QStringList listOfFiles;
while ( it.hasNext() ) {
- if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() ) {
+ // Cast to LightApp class in order to give a chance
+ // to light modules to save their data
+ if ( LightApp_DataModel* aModel =
+ dynamic_cast<LightApp_DataModel*>( it.next() ) ) {
listOfFiles.clear();
aModel->saveAs( theFileName, this, listOfFiles );
if ( !listOfFiles.isEmpty() )
QListIterator<CAM_DataModel*> it( list );
QStringList listOfFiles;
while ( it.hasNext() ) {
- if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() ) {
+ // Cast to LightApp class in order to give a chance
+ // to light modules to save their data
+ if ( LightApp_DataModel* aModel =
+ dynamic_cast<LightApp_DataModel*>( it.next() ) ) {
listOfFiles.clear();
aModel->save(listOfFiles);
if ( !listOfFiles.isEmpty() )
}
}
+/*!
+ Dump study operation. Writes a Python dump file using
+ SALOMEDS services. Additionally, gives a chance to light modules
+ to participate in dump study operation.
+
+ \param theFileName - full path to the output Python file
+ \param toPublish - if true, all objects are published in a study
+ by the output script, including those not orignally present
+ in the current study.
+ \param isMultiFile - if true, each module's dump is written into
+ a separate Python file, otherwise a single output file is written
+ \param toSaveGUI - if true, the GUI state is written
+
+ \return - true if the operation succeeds, and false otherwise.
+*/
+bool SalomeApp_Study::dump( const QString& theFileName,
+ bool toPublish,
+ bool isMultiFile,
+ bool toSaveGUI )
+{
+ int savePoint;
+ _PTR(AttributeParameter) ap;
+ _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
+ _PTR(Study) aStudy = studyDS();
+
+ if( ip->isDumpPython( aStudy ) )
+ ip->setDumpPython( aStudy ); //Unset DumpPython flag.
+
+ if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method
+ ip->setDumpPython( aStudy );
+ //SRN: create a temporary save point
+ savePoint = SalomeApp_VisualState(
+ dynamic_cast<SalomeApp_Application*>( application() ) ).storeState();
+ }
+
+ // Issue 21377 - Each data model is asked to dump its data not present in SALOMEDS study.
+ // This is an optional but important step, it gives a chance to light modules
+ // to dump their data as a part of common dump study operation
+ ModelList list;
+ dataModels( list );
+
+ QListIterator<CAM_DataModel*> it( list );
+ QStringList listOfFiles;
+ while ( it.hasNext() ) {
+ if ( LightApp_DataModel* aModel =
+ dynamic_cast<LightApp_DataModel*>( it.next() ) ) {
+ listOfFiles.clear();
+ if ( aModel->dumpPython( theFileName, this, isMultiFile, listOfFiles ) &&
+ !listOfFiles.isEmpty() )
+ // This call simply passes the data model's dump output to SalomeApp_Engine servant.
+ // This code is shared with persistence mechanism.
+ // NOTE: this should be revised if behavior of saveModuleData() changes!
+ saveModuleData(aModel->module()->name(), listOfFiles);
+ }
+ }
+
+ // Now dump SALOMEDS part that also involves SalomeApp_Engine in case if
+ // any light module is present in the current configuration
+ QFileInfo aFileInfo( theFileName );
+ bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(),
+ aFileInfo.baseName().toStdString(),
+ toPublish,
+ isMultiFile);
+ if ( toSaveGUI )
+ removeSavePoint( savePoint ); //SRN: remove the created temporary save point.
+
+ // Issue 21377 - Clean up light module data in SalomeApp_Engine servant
+ // This code is shared with persistence mechanism.
+ // NOTE: this should be revised if behavior of saveStudyData() changes!
+ saveStudyData( theFileName );
+
+ return res;
+}
+
/*!
\return true, if study is modified in comparison with last open/save
*/
}
/*!
- Saves data from study
+ Re-implemented from LightApp_Study, actually does not save anything but
+ simply cleans up light modules' data
*/
bool SalomeApp_Study::saveStudyData( const QString& theFileName )
{
ModelList list; dataModels( list );
QListIterator<CAM_DataModel*> it( list );
std::vector<std::string> listOfFiles(0);
- while ( it.hasNext() )
- if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() )
- SetListOfFiles(aModel->module()->name().toStdString().c_str(), listOfFiles);
+ while ( it.hasNext() ){
+ LightApp_DataModel* aLModel =
+ dynamic_cast<LightApp_DataModel*>( it.next() );
+ // It is safe to call SetListOfFiles() for any kind of module
+ // because SetListOfFiles() does nothing for full modules :)
+ if ( aLModel )
+ SetListOfFiles(aLModel->module()->name().toStdString().c_str(), listOfFiles);
+ }
return true;
}
myStudyDS = s;
}
+/*!
+ Virtual method re-implemented from LightApp_Study in order to create
+ the module object connected to SALOMEDS - SalomeApp_ModuleObject.
+
+ \param theDataModel - data model instance to create a module object for
+ \param theParent - the module object's parent (normally it's the study root)
+ \return the module object instance
+ \sa LightApp_Study class, LightApp_DataModel class
+*/
+CAM_ModuleObject* SalomeApp_Study::createModuleObject( LightApp_DataModel* theDataModel,
+ SUIT_DataObject* theParent ) const
+{
+ SalomeApp_Study* that = const_cast<SalomeApp_Study*>( this );
+
+ // Ensure that SComponent instance is published in the study for the given module
+ // This line causes automatic creation of SalomeApp_ModuleObject in case if
+ // WITH_SALOMEDS_OBSERVER is defined
+ that->addComponent( theDataModel );
+
+ // SalomeApp_ModuleObject might have been created by SALOMEDS observer
+ // or by someone else so check if it exists first of all
+ CAM_ModuleObject* res = 0;
+
+ DataObjectList children = root()->children();
+ DataObjectList::const_iterator anIt = children.begin(), aLast = children.end();
+ for( ; !res && anIt!=aLast; anIt++ )
+ {
+ SalomeApp_ModuleObject* obj = dynamic_cast<SalomeApp_ModuleObject*>( *anIt );
+ if ( obj && obj->componentDataType() == theDataModel->module()->name() )
+ res = obj;
+ }
+
+ if ( !res ){
+ _PTR(Study) aStudy = studyDS();
+ if ( !aStudy )
+ return res;
+
+ _PTR(SComponent) aComp = aStudy->FindComponent(
+ theDataModel->module()->name().toStdString() );
+ if ( !aComp )
+ return res;
+
+ res = new SalomeApp_ModuleObject( theDataModel, aComp, theParent );
+ }
+
+ return res;
+}
+
/*!
Insert data model.
*/
_PTR(Study) aStudy = studyDS();
if (!aStudy)
return;
- _PTR(SComponent) aComp = aStudy->FindComponent(dm->module()->name().toStdString());
+
+ std::string aCompDataType = dm->module()->name().toStdString();
+
+ _PTR(SComponent) aComp = aStudy->FindComponent(aCompDataType);
if (!aComp) {
// Create SComponent
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
- aComp = aBuilder->NewComponent(dm->module()->name().toStdString());
+ aComp = aBuilder->NewComponent(aCompDataType);
aBuilder->SetName(aComp, dm->module()->moduleName().toStdString());
QString anIconName = dm->module()->iconName();
if (!anIconName.isEmpty()) {
if (anAttr)
anAttr->SetPixMap(anIconName.toStdString());
}
+
// Set default engine IOR
- aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().toStdString());
+ // Issue 21377 - using separate engine for each type of light module
+ std::string anEngineIOR = SalomeApp_Engine_i::EngineIORForComponent( aCompDataType.c_str(),
+ true );
+ aBuilder->DefineComponentInstance(aComp, anEngineIOR);
//SalomeApp_DataModel::BuildTree( aComp, root(), this, /*skipExisitng=*/true );
SalomeApp_DataModel::synchronize( aComp, this );
}
+ else {
+ _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+ aBuilder->SetName(aComp, dm->module()->moduleName().toStdString());
+ QString anIconName = dm->module()->iconName();
+ if (!anIconName.isEmpty()) {
+ _PTR(AttributePixMap) anAttr = aBuilder->FindOrCreateAttribute(aComp, "AttributePixMap");
+ if (anAttr)
+ anAttr->SetPixMap(anIconName.toStdString());
+ }
+ // Set default engine IOR
+ }
}
}
QString anEngine;
// 1. aModule == 0 means that this is a light module (no CORBA enigine)
if (!aModule) {
- anEngine = SalomeApp_Application::defaultEngineIOR();
- aSComp = aStudy->FindComponent(dm->module()->name().toStdString());
+ // Issue 21377 - using separate engine for each type of light module
+ std::string aCompDataType = dm->module()->name().toStdString();
+ anEngine = SalomeApp_Engine_i::EngineIORForComponent( aCompDataType.c_str(), true ).c_str();
+ aSComp = aStudy->FindComponent( aCompDataType );
}
else {
SalomeApp_DataModel* aDM = dynamic_cast<SalomeApp_DataModel*>( dm );
}
/*!
+ Note that this method does not create or activate SalomeApp_Engine_i instance,
+ therefore it can be called safely for any kind of module, but for full
+ modules it returns an empty list.
\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();
+ // Issue 21377 - using separate engine for each type of light module
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
if (aDefaultEngine)
- return aDefaultEngine->GetListOfFiles(id(), theModuleName);
+ return aDefaultEngine->GetListOfFiles(id());
std::vector<std::string> aListOfFiles;
return aListOfFiles;
}
/*!
- Sets list of files used by module: to be used by CORBAless modules
+ Sets list of files used by module: to be used by CORBAless modules.
+ Note that this method does not create or activate SalomeApp_Engine_i instance,
+ therefore it can be called safely for any kind of module, but for full
+ modules it simply does nothing.
\param theModuleName - name of module
\param theListOfFiles - list of files
*/
void SalomeApp_Study::SetListOfFiles ( const char* theModuleName,
const std::vector<std::string> theListOfFiles )
{
- SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
+ // Issue 21377 - using separate engine for each type of light module
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
if (aDefaultEngine)
- aDefaultEngine->SetListOfFiles(theListOfFiles, id(), theModuleName);
+ aDefaultEngine->SetListOfFiles(theListOfFiles, id());
}
/*!
virtual void closeDocument(bool permanently = true);
+ virtual bool dump( const QString&, bool, bool, bool );
+
virtual bool isSaved() const;
virtual bool isModified() const;
virtual void Modified();
virtual void dataModelInserted( const CAM_DataModel* );
virtual bool openDataModel( const QString&, CAM_DataModel* );
void setStudyDS(const _PTR(Study)& s );
-
+ virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel,
+ SUIT_DataObject* theParent ) const;
protected slots:
virtual void updateModelRoot( const CAM_DataModel* );
--- /dev/null
+# Copyright (C) 2010 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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 : Guillaume Boulant (EDF)
+#
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+#
+# Note that the plugins files should be installed in the directory
+# <salomepluginsdir> (ROOT_DIR/share/salome/plugins) or one of this
+# sub-directories (the search of plugins by the plugin manager is
+# recurcive from this folder, in each SALOME module, i.e. each
+# variable *_ROOT_DIR).
+#
+pluginsdir =$(salomepluginsdir)/demo
+plugins_PYTHON = \
+ salome_plugins.py \
+ trihedron.py \
+ tubedialog.py \
+ tube.py
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+import salome_pluginsmanager
+
+DEMO_IS_ACTIVATED=False
+
+# -------------------------------------------------------------------------
+# Example 1: creation of basic objects.
+# The plugin function is implemented here and declared in the pluginsmanager.
+#
+import salome
+
+def trihedron(context):
+ import geompy
+
+ # Intialize the geompy factory with the active study
+ activeStudy = context.study
+ geompy.init_geom(activeStudy)
+
+ # Create the objects
+ Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 10, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 10)
+ origin = geompy.MakeVertex(0, 0, 0)
+
+ # Register the objects in the active study
+ geompy.addToStudy( Vx, "Vx" )
+ geompy.addToStudy( Vy, "Vy" )
+ geompy.addToStudy( Vz, "Vz" )
+ geompy.addToStudy( origin, "origin" )
+
+if DEMO_IS_ACTIVATED:
+ salome_pluginsmanager.AddFunction('O,Vx,Vy,Vz',
+ 'Creates the trihedron',
+ trihedron)
+
+
+# -------------------------------------------------------------------------
+# Example 1 bis: creation of basic objects and automatic display
+def trihedron_withdisplay(context):
+ import geompy
+
+ # Intialize the geompy factory with the active study
+ activeStudy = context.study
+ geompy.init_geom(activeStudy)
+
+ # Create the objects
+ Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 10, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 10)
+ origin = geompy.MakeVertex(0, 0, 0)
+
+ # Register the objects in the active study
+ entries=[]
+ entries.append(geompy.addToStudy( Vx, "Vx" ))
+ entries.append(geompy.addToStudy( Vy, "Vy" ))
+ entries.append(geompy.addToStudy( Vz, "Vz" ))
+ entries.append(geompy.addToStudy( origin, "origin" ))
+
+ # This part is to automatically display the objects in the active viewer.
+ gcomp = salome.ImportComponentGUI("GEOM")
+ for entry in entries:
+ gcomp.createAndDisplayFitAllGO(entry)
+
+if DEMO_IS_ACTIVATED:
+ salome_pluginsmanager.AddFunction('O,Vx,Vy,Vz (2)',
+ 'Creates Basic GEOM objects',
+ trihedron_withdisplay)
+
+# -------------------------------------------------------------------------
+# Example 2: creation of a shape with parameters that can be read from a GUI.
+# The plugin function (tube_shapewithgui) delegates some action to
+# dedicated imported modules (tube.py and tubedialog.py).
+#
+import tube
+
+# A single dialog box is defined and recycled for every call. The
+# fields are initialized with default values given by the tube factory
+# tube.py.
+import tubedialog
+dialog = tubedialog.TubeDialog()
+dialog.setData(tube.DEFAULT_RADIUS, tube.DEFAULT_LENGTH, tube.DEFAULT_WIDTH)
+
+def tube_shapewithgui(context):
+ global tube, dialog
+ activeStudy = context.study
+
+ # Get the parameter values from a gui dialog box. If the dialog is
+ # closed using the Ok button, then the data are requested from the
+ # gui and used to create the shape of the tube.
+ dialog.exec_()
+ if dialog.wasOk():
+ radius, length, width = dialog.getData()
+ shape = tube.createGeometry(activeStudy, radius, length, width)
+
+if DEMO_IS_ACTIVATED:
+ salome_pluginsmanager.AddFunction('Tube shape from parameters',
+ 'Creates a tube object from specified parameters',
+ tube_shapewithgui)
+
+
+# -------------------------------------------------------------------------
+# Example 2 bis: creation of a mesh with parameters that can be read from a GUI.
+# The plugin function (tube_meshwithgui) delegates some action to
+# dedicated imported modules (tube.py and tubedialog.py).
+#
+def tube_meshwithgui(context):
+ global tube, dialog
+ activeStudy = context.study
+
+ # Get the parameter values from a gui dialog box. If the dialog is
+ # closed using the Ok button, then the data are requested from the
+ # gui and used to create the shape of the tube.
+ dialog.exec_()
+ if dialog.wasOk():
+ radius, length, width = dialog.getData()
+ mesh = tube.createModel(activeStudy, radius, length, width)
+
+if DEMO_IS_ACTIVATED:
+ salome_pluginsmanager.AddFunction('Tube mesh from parameters',
+ 'Creates a tube object from specified parameters',
+ tube_meshwithgui)
+
+# -------------------------------------------------------------------------
+# Example 3: run a shell session in a xterm to get a SALOME python console
+def runSalomeShellSession(context):
+ import os
+ command="(xterm -e "+os.environ['KERNEL_ROOT_DIR']+"/runSession)&"
+ os.system(command)
+
+if DEMO_IS_ACTIVATED:
+ salome_pluginsmanager.AddFunction('SALOME shell session',
+ 'Execute a SALOME shell session in an external xterm',
+ runSalomeShellSession)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Example 1: creation of basic objects (O, Vx, Vy, Vz)
+#
+
+# Intialize the geompy factory with the active study
+import geompy
+import salome
+geompy.init_geom(salome.myStudy)
+
+# Create the objects
+Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 10, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 10)
+origin = geompy.MakeVertex(0, 0, 0)
+
+# Register the objects in the active study
+geompy.addToStudy( Vx, "Vx" )
+geompy.addToStudy( Vy, "Vy" )
+geompy.addToStudy( Vz, "Vz" )
+geompy.addToStudy( origin, "origin" )
+
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import salome
+
+DEFAULT_RADIUS = 100
+DEFAULT_LENGTH = 300
+DEFAULT_WIDTH = 20
+
+def createGeometry(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH, width=DEFAULT_WIDTH):
+ '''
+ This function creates the geometry on the specified study and with
+ given parameters.
+ '''
+ print "TUBE: creating the geometry ..."
+ import geompy
+ geompy.init_geom(study)
+
+ radius_ext = radius
+ radius_int = radius_ext - width
+
+ CylinderExt = geompy.MakeCylinderRH(radius_ext, length)
+ CylinderInt = geompy.MakeCylinderRH(radius_int, length)
+ Tube = geompy.MakeCut(CylinderExt, CylinderInt)
+ entry = geompy.addToStudy( Tube, "Tube" )
+ return Tube
+
+def createGeometryWithPartition(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH, width=DEFAULT_WIDTH):
+ '''
+ This function create the geometrical shape with a partition so
+ that the hexaedric algorithm could be used for meshing.
+ '''
+ import geompy
+ shape = createGeometry(study,radius,length,width)
+
+ # We have to create a partition so that we can use an hexaedric
+ # meshing algorithm.
+ print "TUBE: creating a partition ..."
+ toolPlane = geompy.MakeFaceHW(2.1*length,2.1*radius,3)
+ partition = geompy.MakePartition([shape], [toolPlane], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+ entry = geompy.addToStudy( partition, "TubeWithPartition" )
+ return partition
+
+def createMesh(study, shape):
+ '''This function creates the mesh of the specified shape on the specified study'''
+ print "TUBE: creating the mesh ..."
+ import smesh
+
+ smesh.SetCurrentStudy(study)
+ mesh = smesh.Mesh(shape)
+ Regular_1D = mesh.Segment()
+ Nb_Segments = Regular_1D.NumberOfSegments(10)
+ Nb_Segments.SetDistrType( 0 )
+ Quadrangle_2D = mesh.Quadrangle()
+ Hexa_3D = mesh.Hexahedron()
+
+ isDone = mesh.Compute()
+
+ if salome.sg.hasDesktop():
+ smesh.SetName(mesh.GetMesh(), 'TubeMesh')
+ smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
+ smesh.SetName(Nb_Segments, 'Nb. Segments_1')
+ smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
+ smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
+ salome.sg.updateObjBrowser(0)
+
+ return mesh
+
+
+def createModel(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH,width=DEFAULT_WIDTH):
+ '''
+ This function create the geomtrical shape AND the associated mesh.
+ '''
+ # We first create a shape with a partition so that the hexaedric
+ # algorithm could be used.
+ shape = createGeometryWithPartition(study,radius,length,width)
+
+ # Then the mesh can be defined and computed
+ mesh = createMesh(study,shape)
+
+def exportModel(mesh, filename):
+ '''
+ This exports the mesh to the specified filename in the med format
+ '''
+ print "TUBE: exporting mesh to file %s ..."%filename
+ import SMESH
+ mesh.ExportMED(filename, 0, SMESH.MED_V2_2, 1 )
+
+
+#
+# ===================================================================
+# Use cases and test functions
+# ===================================================================
+#
+def TEST_createGeometry():
+ salome.salome_init()
+ theStudy=salome.myStudy
+ createGeometry(theStudy)
+
+def TEST_createMesh():
+ salome.salome_init()
+ theStudy=salome.myStudy
+ shape = createGeometryWithPartition(theStudy)
+ mesh = createMesh(theStudy, shape)
+
+def TEST_createModel():
+ salome.salome_init()
+ theStudy=salome.myStudy
+ createModel(theStudy)
+
+def TEST_exportModel():
+ salome.salome_init()
+ theStudy=salome.myStudy
+ shape = createGeometryWithPartition(theStudy)
+ mesh = createMesh(theStudy, shape)
+ exportModel(mesh,"tubemesh.med")
+
+if __name__ == "__main__":
+ #TEST_createGeometry()
+ #TEST_createMesh()
+ TEST_createModel()
+ #TEST_exportModel()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+import sys
+from PyQt4 import QtGui
+from PyQt4 import QtCore
+
+
+class TubeDialog(QtGui.QDialog):
+ def __init__(self, parent=None):
+ QtGui.QDialog.__init__(self, parent)
+ self.setupUi()
+
+ def setupUi(self):
+ self.setObjectName("Dialog")
+ self.resize(400, 300)
+ self.hboxlayout = QtGui.QHBoxLayout(self)
+ self.hboxlayout.setMargin(9)
+ self.hboxlayout.setSpacing(6)
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.vboxlayout = QtGui.QVBoxLayout()
+ self.vboxlayout.setMargin(0)
+ self.vboxlayout.setSpacing(6)
+ self.vboxlayout.setObjectName("vboxlayout")
+ self.hboxlayout1 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setMargin(0)
+ self.hboxlayout1.setSpacing(6)
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.vboxlayout1 = QtGui.QVBoxLayout()
+ self.vboxlayout1.setMargin(0)
+ self.vboxlayout1.setSpacing(6)
+ self.vboxlayout1.setObjectName("vboxlayout1")
+ self.lblRadius = QtGui.QLabel(self)
+ self.lblRadius.setObjectName("lblRadius")
+ self.vboxlayout1.addWidget(self.lblRadius)
+ self.lblLength = QtGui.QLabel(self)
+ self.lblLength.setObjectName("lblLength")
+ self.vboxlayout1.addWidget(self.lblLength)
+ self.lblWidth = QtGui.QLabel(self)
+ self.lblWidth.setObjectName("lblWidth")
+ self.vboxlayout1.addWidget(self.lblWidth)
+ self.hboxlayout1.addLayout(self.vboxlayout1)
+ self.vboxlayout2 = QtGui.QVBoxLayout()
+ self.vboxlayout2.setMargin(0)
+ self.vboxlayout2.setSpacing(6)
+ self.vboxlayout2.setObjectName("vboxlayout2")
+ self.txtRadius = QtGui.QLineEdit(self)
+ self.txtRadius.setObjectName("txtRadius")
+ self.vboxlayout2.addWidget(self.txtRadius)
+ self.txtLength = QtGui.QLineEdit(self)
+ self.txtLength.setObjectName("txtLength")
+ self.vboxlayout2.addWidget(self.txtLength)
+ self.txtWidth = QtGui.QLineEdit(self)
+ self.txtWidth.setObjectName("txtWidth")
+ self.vboxlayout2.addWidget(self.txtWidth)
+ self.hboxlayout1.addLayout(self.vboxlayout2)
+ self.vboxlayout.addLayout(self.hboxlayout1)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.vboxlayout.addItem(spacerItem)
+ self.buttonBox = QtGui.QDialogButtonBox(self)
+ self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
+ self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok)
+ self.buttonBox.setObjectName("buttonBox")
+ self.vboxlayout.addWidget(self.buttonBox)
+ self.hboxlayout.addLayout(self.vboxlayout)
+
+ self.setWindowTitle("Tube construction")
+ self.lblRadius.setText("Rayon")
+ self.lblLength.setText("Longueur")
+ self.lblWidth.setText("Epaisseur")
+
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
+
+ def accept(self):
+ '''Callback function when dialog is accepted (click Ok)'''
+ self._wasOk = True
+ QtGui.QDialog.accept(self)
+
+ def reject(self):
+ '''Callback function when dialog is rejected (click Cancel)'''
+ self._wasOk = False
+ QtGui.QDialog.reject(self)
+
+ def wasOk(self):
+ return self._wasOk
+
+ def setData(self, radius, length, width):
+ self.txtRadius.setText(str(radius))
+ self.txtLength.setText(str(length))
+ self.txtWidth.setText(str(width))
+
+ def getData(self):
+ try:
+ radius=eval(str(self.txtRadius.text()))
+ length=eval(str(self.txtLength.text()))
+ width=eval(str(self.txtWidth.text()))
+ except:
+ print "pb a la saisie"
+
+ return radius, length, width
+
+
+def TEST_getData():
+ # This use case illustrates the MVC pattern on this simple dialog example.
+ a = QtGui.QApplication(sys.argv)
+
+ tubedialog = TubeDialog()
+ tubedialog.setData(10,50,3)
+ tubedialog.exec_()
+ if tubedialog.wasOk():
+ radius, length, width = tubedialog.getData()
+ print radius, length, width
+
+ sys.exit(0)
+
+def main( args ):
+ a = QtGui.QApplication(sys.argv)
+
+ tubedialog = TubeDialog()
+ tubedialog.setData(10,50,3)
+ sys.exit(tubedialog.exec_())
+
+if __name__=="__main__":
+ #main(sys.argv)
+ TEST_getData()
+
#
"""
-This module is imported from C++ SalomeApp_Application
-and initialized (call to initialize function with 4 parameters)
-module : 0 if it's plugins manager at the application level 1 if it is at the module level
-name : the name of the plugins manager. This name is used to build the name of the plugins files
-basemenuname : the name of the menu into we want to add the menu of the plugins ("Tools" for example)
+This module is imported from C++ SalomeApp_Application and initialized
+(call to initialize function with 4 parameters) module : 0 if it's
+plugins manager at the application level 1 if it is at the module
+level name : the name of the plugins manager. This name is used to
+build the name of the plugins files basemenuname : the name of the
+menu into we want to add the menu of the plugins ("Tools" for example)
menuname : the name of plugins menu
A plugins manager is created when calling initialize.
-The plugins manager creates a submenu <menuname> in the <basemenuname> menu.
+The plugins manager creates a submenu <menuname> in the <basemenuname>
+menu.
-The plugins manager searches in $HOME/.config/salome/Plugins, $HOME/$APPLI/Plugins, $SALOME_PLUGINS_PATH directories
-files named <name>_plugins.py and executes them.
+The plugins manager searches in $HOME/.config/salome/Plugins,
+$HOME/$APPLI/Plugins, $SALOME_PLUGINS_PATH directories files named
+<name>_plugins.py and executes them.
-These files should contain python code that register functions into the plugins manager.
+These files should contain python code that register functions into
+the plugins manager.
-Example of a plugins manager with name salome. It searches files with name salome_plugins.py (example follows)::
+Example of a plugins manager with name salome. It searches files with
+name salome_plugins.py (example follows)::
import salome_pluginsmanager
salome_pluginsmanager.AddFunction('About plugins','About SALOME pluginmanager',about)
-All entries in menu are added in the same order as the calls to AddFunction.
-It is possible to customize this presentation by getting the entries list (salome_pluginsmanager.entries()) and modifying
-it in place. For example, you can do that : salome_pluginsmanager.entries().sort() to order them alphabetically
-or salome_pluginsmanager.entries().remove("a") to remove the entry named "a".
+All entries in menu are added in the same order as the calls to
+AddFunction. It is possible to customize this presentation by getting
+the entries list (salome_pluginsmanager.entries()) and modifying it in
+place. For example, you can do that :
+salome_pluginsmanager.entries().sort() to order them alphabetically or
+salome_pluginsmanager.entries().remove("a") to remove the entry named
+"a".
-It is possible to put entries in submenus. You only need to give a name with / to the entry. for example::
+It is possible to put entries in submenus. You only need to give a
+name with / to the entry. for example::
salome_pluginsmanager.AddFunction('a/b/About','About SALOME pluginmanager',about)
In short to add a plugin:
- 1. import the python module salome_pluginsmanager (in your salome_plugins.py or <module>_plugins.py)
- 2. write a function with one argument context (it's an object with 3 attributes)
- 3. register the function with a call to AddFunction (entry in menu plugins, tooltip, function)
+ 1. import the python module salome_pluginsmanager (in your
+ salome_plugins.py or <module>_plugins.py)
+
+ 2. write a function with one argument context (it's an object with 3
+ attributes)
+
+ 3. register the function with a call to AddFunction (entry in menu plugins,
+ tooltip, function)
context attributes:
if a.text() == m:
return findMenu(lmenu,a.menu())
+PLUGIN_PATH_PATTERN="share/salome/plugins"
+MATCH_ENDING_PATTERN="_plugins.py"
+from salome.kernel.syshelper import walktree
+from salome.kernel.logger import Logger
+#from salome.kernel.termcolor import GREEN
+logger=Logger("PluginsManager") #,color=GREEN)
+# VSR 21/11/2011 : do not show infos in the debug mode
+#logger.showDebug()
+
class PluginsManager:
def __init__(self,module,name,basemenuname,menuname):
self.name=name
self.plugindirs=[]
self.plugins_files=[]
+ # MODULES plugins directory.
+ # The SALOME modules may provides natively some plugins. These
+ # MODULES plugins are supposed to be located in the
+ # installation folder of the module, in the subdirectory
+ # "share/salome/plugins". We first look for these directories.
+ for key in os.environ.keys():
+ if key.endswith("_ROOT_DIR"):
+ rootpath=os.environ[key]
+ dirpath=os.path.join(rootpath,PLUGIN_PATH_PATTERN)
+ if os.path.isdir(dirpath) and dirpath not in self.plugindirs:
+ logger.info("Looking for plugins in the directory %s ..."%dirpath)
+ walktree(dirpath,self.analyseFile)
+
# USER plugins directory
user_dir = os.path.expanduser("~/.config/salome/Plugins")
self.plugindirs.append(user_dir)
+ logger.info("The user directory %s has been added to plugin paths"%user_dir)
# obsolete: USER plugins directory
# (for compatibility reasons only; new plugins should be stored in ~/.config/salome/Plugins)
user_obsolete_dir = os.path.expanduser("~/.salome/Plugins")
self.plugindirs.append(user_obsolete_dir)
+ logger.info("The user directory %s has been added to plugin paths (deprecated)"%user_obsolete_dir)
# APPLI plugins directory
appli=os.getenv("APPLI")
if appli:
appli_dir=os.path.join(os.path.expanduser("~"),appli,"Plugins")
self.plugindirs.append(appli_dir)
+ logger.info("The APPLI directory %s has been added to plugin paths"%appli_dir)
#SALOME_PLUGINS_PATH environment variable (list of directories separated by ":")
pluginspath=os.getenv("SALOME_PLUGINS_PATH")
if pluginspath:
for directory in pluginspath.split(SEP):
self.plugindirs.append(directory)
+ logger.info("The directory %s has been added to plugin paths"%directory)
self.basemenu = find_menu(self.basemenuname)
self.basemenu.connect(self.basemenu, QtCore.SIGNAL("aboutToShow()"), self.importPlugins)
+ def analyseFile(self,filename):
+ """
+ This function checks if the specified file is a plugins python
+ module and add the directory name of this file to the list of
+ plugin paths. This function is aimed to be used as the callback
+ function of the walktree algorithm.
+ """
+ if str(filename).endswith(MATCH_ENDING_PATTERN):
+ dirpath=os.path.dirname(filename)
+ if dirpath not in self.plugindirs:
+ self.plugindirs.append(dirpath)
+ logger.info("The directory %s has been added to plugin paths"%dirpath)
+
def AddFunction(self,name,description,script):
""" Add a plugin function
"""
lasttime=0
plugins_files=[]
- plugins_file_name=self.name+"_plugins.py"
+ plugins_file_name=self.name+MATCH_ENDING_PATTERN
for directory in self.plugindirs:
plugins_file = os.path.join(directory,plugins_file_name)
if os.path.isfile(plugins_file):
try:
execfile(plugins_file,globals(),{})
except:
- print "Error while loading plugins from file:",plugins_file
+ logger.fatal("Error while loading plugins from file %s"%plugins_file)
traceback.print_exc()
self.updateMenu()
{
long id = -1;
if ( !myExtAppName.isEmpty() ) {
+#ifdef WIN32
+ QRegExp exp( QString( "%1\\.%2\\.([a-zA-Z0-9.]+)$" ).arg( myExtAppName ).arg( currentFormat() ) );
+#else
QRegExp exp( QString( "\\.%1rc\\.([a-zA-Z0-9.]+)$" ).arg( myExtAppName ) );
+#endif
QRegExp vers_exp( "^([0-9]+)([A-Za-z]?)([0-9]*)$" );
QString fname = QFileInfo( _fname ).fileName();
//
#include "SalomeApp_Engine_i.hxx"
-#include "SALOMEDS_Tool.hxx"
+#include <SALOME_NamingService.hxx>
+#include <SALOMEDS_Tool.hxx>
+#include <Utils_ORB_INIT.hxx>
+#include <Utils_SINGLETON.hxx>
+#include <Utils_SALOME_Exception.hxx>
+#include <utilities.h>
+
+#include <QApplication>
+#include <QDir>
+#include <QFile>
#include <iostream>
using namespace std;
-SalomeApp_Engine_i* SalomeApp_Engine_i::myInstance = NULL;
-
/*!
Constructor
*/
-SalomeApp_Engine_i::SalomeApp_Engine_i()
+SalomeApp_Engine_i::SalomeApp_Engine_i( const char* theComponentName )
{
- myInstance = this;
+ myComponentName = theComponentName;
+ MESSAGE("SalomeApp_Engine_i::SalomeApp_Engine_i(): myComponentName = " <<
+ myComponentName << ", this = " << this);
}
/*!
*/
SalomeApp_Engine_i::~SalomeApp_Engine_i()
{
+ MESSAGE("SalomeApp_Engine_i::~SalomeApp_Engine_i(): myComponentName = " <<
+ myComponentName << ", this = " << this);
}
SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theComponent,
{
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
- cout << "SalomeApp_Engine_i::Save() isMultiFile = " << isMultiFile << endl;
if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
return aStreamFile._retn();
const int studyId = theComponent->GetStudy()->StudyId();
- cout << "SalomeApp_Engine_i::Save() - studyId = " << studyId << endl;
// Get a temporary directory to store a file
//std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
if (myMap.count(studyId)) {
- cout << "SalomeApp_Engine_i::Save() - myMap.count(studyId)" << endl;
- MapOfListOfFiles mapOfListOfFiles = myMap[studyId];
std::string componentName (theComponent->ComponentDataType());
- cout << "SalomeApp_Engine_i::Save() - componentName = " << componentName << endl;
- ListOfFiles listOfFiles = mapOfListOfFiles[componentName];
+
+ // Error somewhere outside - Save() called with
+ // wrong SComponent instance
+ if ( myComponentName != componentName )
+ return aStreamFile._retn();
+
+ const ListOfFiles& listOfFiles = myMap[studyId];
// listOfFiles must contain temporary directory name in its first item
// and names of files (relatively the temporary directory) in the others
if (n > 0) { // there are some files, containing persistent data of the component
std::string aTmpDir = listOfFiles[0];
- cout << "SalomeApp_Engine_i::Save() - aTmpDir = " << aTmpDir << endl;
// Create a list to store names of created files
SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
return false;
+ // Error somewhere outside - Load() called with
+ // wrong SComponent instance
+ std::string componentName (theComponent->ComponentDataType());
+ if ( myComponentName != componentName )
+ return false;
+
const int studyId = theComponent->GetStudy()->StudyId();
// Create a temporary directory for the component's data files
for (int i = 1; i < n; i++)
listOfFiles[i] = std::string(aSeq[i - 1]);
- //MapOfListOfFiles mapOfListOfFiles;
- //if (myMap.count(studyId))
- // mapOfListOfFiles = myMap[studyId];
- //std::string componentName (theComponent->ComponentDataType());
- //mapOfListOfFiles[componentName] = listOfFiles;
- //myMap[studyId] = mapOfListOfFiles;
-
- SetListOfFiles(listOfFiles, studyId, theComponent->ComponentDataType());
+ SetListOfFiles(listOfFiles, studyId);
return true;
}
-SalomeApp_Engine_i::ListOfFiles SalomeApp_Engine_i::GetListOfFiles (const int theStudyId,
- const char* theComponentName)
+SalomeApp_Engine_i::ListOfFiles SalomeApp_Engine_i::GetListOfFiles (const int theStudyId)
{
ListOfFiles aListOfFiles;
- if (myMap.count(theStudyId))
+ if (myMap.find(theStudyId) != myMap.end())
{
- MapOfListOfFiles mapOfListOfFiles = myMap[theStudyId];
- std::string componentName (theComponentName);
- if (mapOfListOfFiles.count(componentName))
- aListOfFiles = mapOfListOfFiles[componentName];
+ aListOfFiles = myMap[theStudyId];
}
return aListOfFiles;
}
-void SalomeApp_Engine_i::SetListOfFiles (const ListOfFiles theListOfFiles,
- const int theStudyId,
- const char* theComponentName)
+void SalomeApp_Engine_i::SetListOfFiles (const ListOfFiles& theListOfFiles,
+ const int theStudyId)
{
- //if (!myMap.count(theStudyId)) {
- // MapOfListOfFiles mapOfListOfFiles;
- // myMap[theStudyId] = mapOfListOfFiles;
- //}
-
- MapOfListOfFiles& mapOfListOfFiles = myMap[theStudyId];
- std::string componentName (theComponentName);
- mapOfListOfFiles[componentName] = theListOfFiles;
+ myMap[theStudyId] = theListOfFiles;
+}
+
+/*!
+ * DumpPython implementation for light modules
+ */
+Engines::TMPFile* SalomeApp_Engine_i::DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean& isValidScript)
+{
+ MESSAGE("SalomeApp_Engine_i::DumpPython(): myComponentName = "<<
+ myComponentName << ", this = " << this);
+
+ // Temporary solution: returning a non-empty sequence
+ // even if there's nothing to dump, to avoid crashes in SALOMEDS
+ // TODO: Improve SALOMEDSImpl_Study::DumpStudy() by skipping the components
+ // with isValidScript == false, and initialize isValidScript by false below.
+ Engines::TMPFile_var aStreamFile = new Engines::TMPFile(1);
+ aStreamFile->length( 1 );
+ aStreamFile[0] = '\0';
+ isValidScript = true;
+
+ if (CORBA::is_nil(theStudy))
+ return aStreamFile._retn();
+
+ SALOMEDS::Study_var studyDS = SALOMEDS::Study::_narrow( theStudy );
+ const int studyId = studyDS->StudyId();
+
+ if (!myMap.count(studyId))
+ return aStreamFile._retn();
+
+ ListOfFiles listOfFiles = myMap[studyId];
+
+ // listOfFiles must contain temporary directory name in its first item
+ // and names of files (relatively the temporary directory) in the others
+ if ( listOfFiles.size() < 2 )
+ return aStreamFile._retn();
+
+ // there are some files, containing persistent data of the component
+ QString aTmpPath( listOfFiles.front().c_str() );
+ QDir aTmpDir( aTmpPath );
+ if ( !aTmpDir.exists() )
+ return aStreamFile._retn();
+
+ // Calculate file sizes
+ QStringList aFilePaths;
+ QList<qint64> aFileSizes;
+ qint64 aBuffSize = 0;
+ ListOfFiles::const_iterator aFIt = listOfFiles.begin();
+ ListOfFiles::const_iterator aFEnd = listOfFiles.end();
+ aFIt++;
+ for (; aFIt != aFEnd; aFIt++){
+ QString aFileName( (*aFIt).c_str() );
+ if ( !aTmpDir.exists( aFileName ) ){
+ continue;
+ }
+
+ QFile aFile( aTmpDir.filePath( aFileName ) );
+ if ( !aFile.open( QIODevice::ReadOnly ) ){
+ continue;
+ }
+
+ aFilePaths.push_back( aTmpDir.filePath( aFileName ) );
+ aFileSizes.push_back( aFile.size() );
+ aBuffSize += aFileSizes.back();
+
+ aFile.close();
+ }
+
+ if ( !aFilePaths.size() || !aBuffSize )
+ return aStreamFile._retn();
+
+ char* aBuffer = new char[aBuffSize + 1];
+ if ( !aBuffer )
+ return aStreamFile._retn();
+
+ // Convert the file(s) to the byte stream, multiple files are simply
+ // concatenated
+ // TODO: imporve multi-script support if necessary...
+ qint64 aCurrPos = 0;
+ QStringList::const_iterator aFileIt = aFilePaths.begin();
+ QStringList::const_iterator aFileEnd = aFilePaths.end();
+ QList<qint64>::const_iterator aSIt = aFileSizes.begin();
+ for ( ; aFileIt != aFileEnd; aFileIt++, aSIt++ ){
+ QFile aFile( aTmpDir.filePath( *aFileIt ) );
+ if ( !aFile.open( QIODevice::ReadOnly ) ){
+ continue;
+ }
+
+ // Incorrect size of file
+ // Do not remove the bad file to have some diagnostic means
+ if ( aFile.read( aBuffer + aCurrPos, *aSIt ) != *aSIt ){
+ aFile.close();
+ return aStreamFile._retn();
+ }
+
+ aCurrPos += (*aSIt);
+ aFile.remove();
+ }
+
+ // Here we should end up with empty aTmpDir
+ // TODO: Handle QDir::rmdir() error status somehow...
+ aTmpDir.rmdir( aTmpPath );
+
+ aBuffer[aBuffSize] = '\0';
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+ aStreamFile = new Engines::TMPFile(aBuffSize + 1, aBuffSize + 1, anOctetBuf, 1);
+
+ return aStreamFile._retn();
}
/*!
- \return shared instance of engine
+ \return Component data type string for this instance of the engine
*/
-SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance()
+char* SalomeApp_Engine_i::ComponentDataType()
{
- return myInstance;
+ return const_cast<char*>( myComponentName.c_str() );
}
+
+/*!
+ \return
+*/
+CORBA::ORB_var SalomeApp_Engine_i::orb()
+{
+ ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+ // TODO: using QApplication here looks ugly, think how to
+ // obtain the ORB reference in a nicer way...
+ static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+ return _orb;
+}
+
+/*!
+ \return
+*/
+PortableServer::POA_var SalomeApp_Engine_i::poa()
+{
+ static PortableServer::POA_var _poa;
+ if ( CORBA::is_nil( _poa ) ){
+ CORBA::Object_var obj = orb()->resolve_initial_references( "RootPOA" );
+ _poa = PortableServer::POA::_narrow( obj );
+ }
+ return _poa;
+}
+
+/*!
+ \return
+*/
+SALOME_NamingService* SalomeApp_Engine_i::namingService()
+{
+ static SALOME_NamingService _ns(orb());
+ return &_ns;
+}
+
+/*!
+ Internal method, creates a CORBA engine for a light SALOME module
+ with the given "component data type" string,
+ activates it and registers in SALOME naming service with
+ /SalomeAppEngine/comp_data_type path. If the engine is already in the
+ naming service, simply returns and object reference to it.
+ \param theComponentName - synthetic "component data type" used to identify a given light module
+ \return Object reference to the CORBA engine
+*/
+CORBA::Object_ptr SalomeApp_Engine_i::engineForComponent( const char* theComponentName,
+ bool toCreate )
+{
+ CORBA::Object_var anEngine;
+ if ( !theComponentName || !strlen( theComponentName ) )
+ return anEngine._retn();
+
+ std::string aPath( "/SalomeAppEngine/" );
+ aPath += theComponentName;
+ anEngine = namingService()->Resolve( aPath.c_str() );
+
+ // Activating a new instance of the servant
+ if ( toCreate && CORBA::is_nil( anEngine ) ){
+ try {
+ SalomeApp_Engine_i* aServant = new SalomeApp_Engine_i( theComponentName );
+ PortableServer::ObjectId_var id = poa()->activate_object( aServant );
+ anEngine = aServant->_this();
+ aServant->_remove_ref();
+ namingService()->Register( anEngine.in(), aPath.c_str() );
+ }
+ catch (CORBA::SystemException&) {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch (CORBA::Exception&) {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch (...) {
+ INFOS("Caught unknown exception.");
+ }
+ }
+
+ return anEngine._retn();
+}
+
+/*!
+ \param theComponentName - synthetic "component data type" used to identify a given light module
+ \return IOR string for the CORBA engine for a light SALOME module
+ with the given "component data type" string
+ \sa GetInstance( const char* theComponentName )
+*/
+std::string SalomeApp_Engine_i::EngineIORForComponent( const char* theComponentName,
+ bool toCreate )
+{
+ std::string anIOR( "" );
+ CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
+ if ( !CORBA::is_nil( anEngine ) )
+ {
+ CORBA::String_var objStr = orb()->object_to_string( anEngine.in() );
+ anIOR = std::string( objStr.in() );
+ }
+ return anIOR;
+}
+
+/*!
+ \param theComponentName - synthetic "component data type" used to identify a given light module
+ \return A pointer to corresponding C++ engine instance, null means some internal problems.
+ \sa EngineIORForComponent( const char* theComponentName )
+*/
+SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance( const char* theComponentName,
+ bool toCreate )
+{
+ SalomeApp_Engine_i* aServant = 0;
+ CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
+ if ( !CORBA::is_nil( anEngine ) )
+ {
+ PortableServer::Servant aServantBase = poa()->reference_to_servant( anEngine.in() );
+ aServant = dynamic_cast<SalomeApp_Engine_i*>( aServantBase );
+ }
+ MESSAGE("SalomeApp_Engine_i::GetInstance(): theComponentName = " <<
+ theComponentName << ", aServant = " << aServant);
+ return aServant;
+}
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SalomeApp_Engine)
+class SALOME_NamingService;
+
class SESSION_EXPORT SalomeApp_Engine_i: public POA_SalomeApp::Engine,
- public Engines_Component_i
+ public Engines_Component_i
{
public:
- SalomeApp_Engine_i();
+ SalomeApp_Engine_i( const char* theComponentName );
~SalomeApp_Engine_i();
SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile );
+ virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean& isValidScript);
+
public:
typedef std::vector<std::string> ListOfFiles;
- ListOfFiles GetListOfFiles (const int theStudyId,
- const char* theComponentName);
-
- void SetListOfFiles (const ListOfFiles theListOfFiles,
- const int theStudyId,
- const char* theComponentName);
+ ListOfFiles GetListOfFiles (const int theStudyId);
+ void SetListOfFiles (const ListOfFiles& theListOfFiles,
+ const int theStudyId);
- static SalomeApp_Engine_i* GetInstance();
+ static std::string EngineIORForComponent( const char* theComponentName,
+ bool toCreate );
+ static SalomeApp_Engine_i* GetInstance ( const char* theComponentName,
+ bool toCreate );
public:
// methods from SALOMEDS::Driver without implementation. Must be redefined because
SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr, const char*, bool ) {return 0;}
CORBA::Boolean LoadASCII( SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile&, const char*, bool ) {return 0;}
void Close( SALOMEDS::SComponent_ptr ) {}
- char* ComponentDataType() {return 0;}
+ char* ComponentDataType();
char* IORToLocalPersistentID( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean, CORBA::Boolean ) {return 0;}
char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean, CORBA::Boolean ) {return 0;}
bool CanPublishInStudy( CORBA::Object_ptr ) {return 0;}
SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile&, CORBA::Long, SALOMEDS::SObject_ptr ) {return 0;}
private:
- typedef std::map<std::string, ListOfFiles> MapOfListOfFiles;
- typedef std::map<int, MapOfListOfFiles> MapOfMapOfListOfFiles;
- MapOfMapOfListOfFiles myMap;
+ static CORBA::ORB_var orb();
+ static PortableServer::POA_var poa();
+ static SALOME_NamingService* namingService();
+ static CORBA::Object_ptr engineForComponent( const char* theComponentName,
+ bool toCreate );
+
+private:
+ typedef std::map<int, ListOfFiles> MapOfListOfFiles;
+ MapOfListOfFiles myMap;
- static SalomeApp_Engine_i* myInstance;
+ std::string myComponentName;
};
#endif
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-#TEMPLATE = lib
-#TARGET = SalomeSession
-#DESTDIR = ../../lib
-#MOC_DIR = ../../moc
-#OBJECTS_DIR = ../../obj/$$TARGET
-# ================>
-#
-TEMPLATE =
-TARGET = SALOME_Session_Server
-DESTDIR = ../../bin
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-# <================
-
-
-QT_MT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml
-
-PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4
-
-HDF5_INCLUDES = $$(HDF5HOME)/include
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-OMNIORBDIR = $$(OMNIORBDIR)
-CORBA_INCLUDES = $${OMNIORBDIR}/include $${OMNIORBDIR}/include/omniORB4 $${OMNIORBDIR}/include/COS
-
-INCLUDEPATH += $${QT_MT_INCLUDES} $${PYTHON_INCLUDES} $${HDF5_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${CAS_CPPFLAGS} $${CORBA_INCLUDES} ../../salome_adm/unix $$(GUI_ROOT_DIR)/idl ../Qtx ../SUIT ../Event
-
-QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL
-
-KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-LIBS += $${QT_MT_LIBS} $${KERNEL_LDFLAGS} -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lSalomeCatalog -lSalomeDSClient $${CAS_KERNEL} -L../../lib -lwith_loggerTraceCollector -lsuit -lEvent -L$$(GUI_ROOT_DIR)/idl -lSalomeIDLGUI
-
-# ================>
-
-OMNIORB_LIBS = -L$${OMNIORBDIR}/lib -lomniORB4 -lomniDynamic4 -lCOS4 -lCOSDynamic4 -lomnithread
-
-HDF5_LIBS = -L$$(HDF5HOME)/lib -lhdf5
-
-INCLUDEPATH = $${INCLUDEPATH}
-LIBS = $${LIBS} $${OMNIORB_LIBS} $${HDF5_LIBS} -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS -lSalomeHDFPersist -lSalomeDSImpl -lSalomeGenericObj -lRegistry -lSalomeNotification -lSALOMEBasics -L$$(GUI_ROOT_DIR)/lib -lqtx -lSalomeSession
-
-# <================
-
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += SESSION_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG
-
-HEADERS = Session_Session_i.hxx
-HEADERS += Session_ServerLauncher.hxx
-HEADERS += Session_ServerThread.hxx
-HEADERS += Session_ServerCheck.hxx
-HEADERS += SalomeApp_Engine_i.hxx
-
-SOURCES = Session_Session_i.cxx
-SOURCES += Session_ServerThread.cxx
-SOURCES += Session_ServerLauncher.cxx
-SOURCES += Session_ServerCheck.cxx
-SOURCES += SalomeApp_Engine_i.cxx
-
-# ================>
-
-SOURCES += SALOME_Session_Server.cxx
-
-# <================
-
-#includes.files = $$HEADERS
-#includes.path = ../../include
-
-#INSTALLS += includes
-
-
}
case 1: // looking for server type
{
+ // Temporary solution
+ // Issue 21337 - no more SalomeApp_Engine_i activation here
+ // TODO: To be removed as soon as any trace of SalomeAppEngine
+ // has been eliminated from KERNEL scripts
+ if (strcmp(_argv[iarg], "SalomeAppEngine")==0){
+ argState = 0;
+ iarg += 2; // skipping "()"
+ break;
+ }
+ // Temporary solution
+
for (int i=0; i<Session_ServerThread::NB_SRV_TYP; i++)
if (strcmp(_argv[iarg],Session_ServerThread::_serverTypes[i])==0)
{
#include <RegistryService.hxx>
#include "Session_Session_i.hxx"
-#include "SalomeApp_Engine_i.hxx"
#include <Utils_ORB_INIT.hxx>
#include <Utils_SINGLETON.hxx>
using namespace std;
-const int Session_ServerThread::NB_SRV_TYP = 7;
+const int Session_ServerThread::NB_SRV_TYP = 6;
const char* Session_ServerThread::_serverTypes[NB_SRV_TYP] = {"Container",
"ModuleCatalog",
"Registry",
"SALOMEDS",
"Session",
- "SalomeAppEngine",
"ContainerManager"};
/*!
ActivateSession(_argc, _argv);
break;
}
- case 5: // SalomeApp_Engine
- {
- NamingService_WaitForServerReadiness(_NS,"/myStudyManager");
- ActivateEngine(_argc, _argv);
- break;
- }
- case 6: // Container Manager
+ case 5: // Container Manager
{
NamingService_WaitForServerReadiness(_NS,"");
ActivateContainerManager(_argc, _argv);
}
}
-void Session_ServerThread::ActivateEngine(int /*argc*/, char ** /*argv*/)
-{
- try {
- MESSAGE("SalomeApp_Engine thread started");
- SalomeApp_Engine_i* anEngine = new SalomeApp_Engine_i();
- PortableServer::ObjectId_var id =_root_poa->activate_object( anEngine );
- MESSAGE("poa->activate_object( SalomeApp_Engine )");
-
- CORBA::Object_var obj = anEngine->_this();
- anEngine->_remove_ref();
- _NS->Register( obj ,"/SalomeAppEngine");
- }
- catch (CORBA::SystemException&) {
- INFOS("Caught CORBA::SystemException.");
- }
- catch (CORBA::Exception&) {
- INFOS("Caught CORBA::Exception.");
- }
- catch (...) {
- INFOS("Caught unknown exception.");
- }
-}
-
void Session_ServerThread::ActivateSession(int argc,
char ** argv)
{
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = ToolsGUI
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-BOOST_CPPFLAGS = $$(BOOSTDIR)/include
-
-KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome
-
-CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome
-
-INCLUDEPATH += $${CAS_CPPFLAGS} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${CORBA_INCLUDES} ../../salome_adm/unix ../../idl ../Qtx ../SUIT
-LIBS += -L../../lib -lsuit -lSalomeNS -lOpUtil $${CAS_KERNEL} $${KERNEL_LDFLAGS}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = ToolsGUI.h
-HEADERS += ToolsGUI_RegWidget.h
-HEADERS += ToolsGUI_CatalogGeneratorDlg.h
-
-SOURCES = ToolsGUI_CatalogGeneratorDlg.cxx
-SOURCES += ToolsGUI_RegWidget.cxx
-SOURCES += ToolsGUI.cxx
-
-TRANSLATIONS = resources/ToolsGUI_icons.ts \
- resources/ToolsGUI_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#include "DataModel.hxx"
+
+DataModel::DataModel() {
+
+}
+
+DataModel::~DataModel() {
+ _mapDataObjects.clear();
+}
+
+bool DataModel::addDataObject(DataObject * dataObject) {
+ _mapDataObjects[dataObject->getNameId()] = dataObject;
+ return true;
+}
+bool DataModel::removeDataObject(string nameId) {
+ _mapDataObjects.erase(nameId);
+ return true;
+}
+bool DataModel::removeDataObject(DataObject * dataObject) {
+ if ( dataObject == NULL ) return false;
+ return removeDataObject(dataObject->getNameId());
+}
+
+DataObject * DataModel::getDataObject(string id) {
+ return _mapDataObjects[id];
+}
+
+
+
+map<string, DataObject *>::iterator DataModel::begin() {
+ return _mapDataObjects.begin();
+}
+
+map<string, DataObject *>::iterator DataModel::end() {
+ return _mapDataObjects.end();
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+
+#ifndef DATAMODEL_H
+#define DATAMODEL_H
+
+#include "TreeData.hxx"
+
+#include <map>
+#include "DataObject.hxx"
+
+class TREEDATA_EXPORT DataModel {
+
+public:
+ DataModel();
+ ~DataModel();
+
+ /*!
+ * This function can be used to create a specific instance of
+ * DataObject. Note that this function is a pure virtual method and
+ * then no default behavior is done. In particular, the newly
+ * created object is not automatically added to the data model. This
+ * behavior should be implemented in a dedicated version of this
+ * class.
+ */
+ virtual DataObject * newDataObject() = 0;
+
+ /*! Function to add data object to the model */
+ bool addDataObject(DataObject * dataObject);
+ /*! Functions to remove data object from the model */
+ bool removeDataObject(string nameId);
+ bool removeDataObject(DataObject * dataObject);
+ /*! Function to retrieve a data object in the model */
+ DataObject * getDataObject(string nameId);
+
+ map<string, DataObject *>::iterator begin();
+ map<string, DataObject *>::iterator end();
+
+private:
+ map<string, DataObject *> _mapDataObjects;
+
+
+};
+
+#endif // DATAMODEL_H
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#include "DataObject.hxx"
+#include <Basics_Utils.hxx>
+
+// Static assignement
+int DataObject::_lastId=0;
+const string DataObject::_BASENAME = string("object_");
+const string DataObject::pathsep = string("/");
+
+DataObject::DataObject() {
+ _nameId = _BASENAME+ToString(_lastId);
+ _lastId++;
+ // The default label is set to the nameId, but it can be modified
+ // using setLabel whereas the nameId can't be modified.
+ _label = _nameId;
+}
+
+DataObject::~DataObject() {
+ _properties.clear();
+}
+
+void DataObject::setLabel(string label) {
+ _label = label;
+}
+string DataObject::getLabel() {
+ return _label;
+}
+
+string DataObject::getPathName() {
+ string pathName;
+ pathName = this->getPath() + pathsep + this->getLabel();
+ return pathName;
+}
+
+
+string DataObject::getNameId() {
+ return _nameId;
+}
+
+void DataObject::setProperty(string key, string value) {
+ _properties[key] = value;
+}
+string DataObject::getProperty(string key) {
+ return _properties[key];
+}
+
+string DataObject::toString() {
+ string serialize="\n";
+ serialize+="nameId = "+getNameId()+"\n";
+ serialize+="label = "+getLabel()+"\n";
+ serialize+="path = "+getPath();
+ return serialize;
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef DATAOBJECT_H
+#define DATAOBJECT_H
+
+#include "TreeData.hxx"
+
+#include <map>
+#include <string>
+using namespace std;
+
+class TREEDATA_EXPORT DataObject {
+
+public:
+ DataObject();
+ ~DataObject();
+
+ void setLabel(string label);
+ string getLabel();
+ void setProperty(string key, string value);
+ string getProperty(string key);
+
+ /*!
+ * This function specifies the localization of the object in the
+ * hierarchical organization that can be defined by the DataModel it
+ * belongs to.
+ */
+ virtual string getPath() = 0;
+ string getPathName();
+ string getNameId();
+
+ static const string pathsep;
+
+ /*! This function can be used for debug */
+ string toString();
+
+private:
+ /*! The name this object can be displayed with */
+ string _label;
+ /*! The identifier of this object. An identifier is invariant all the session long */
+ string _nameId;
+ /*! The dictionnary of properties that characterize this object */
+ map<string, string> _properties;
+
+ static int _lastId;
+ static const string _BASENAME;
+};
+
+#endif // DATAOBJECT_H
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+
+#include "DataProcessor.hxx"
+#include <Basics_Utils.hxx>
+#include "QtHelper.hxx"
+
+DataProcessor::DataProcessor(DataModel * dataModel) {
+ _dataModel = dataModel;
+}
+
+/*!
+ * This function retrieves in the data model all the DataObject
+ * associated to the item nameIds contained in the specified list. The
+ * input list is what the TreeView sends via the notification signal.
+ */
+DataObjectVector * DataProcessor::extract(QStringList itemNameIdList) {
+ if ( _dataModel == NULL ) {
+ STDLOG("No data model associated to this processor");
+ return NULL;
+ }
+
+ DataObjectVector * dataObjectList = new DataObjectVector();
+
+ // We can request the dataModel to obtain the dataObject associated
+ // to each of the item (iteNameId is a TreeView id, Qt stuff only).
+ QStringList::const_iterator it;
+ for (it = itemNameIdList.constBegin(); it != itemNameIdList.constEnd(); ++it) {
+ QString itemNameId = *it;
+ DataObject * dataObject = _dataModel->getDataObject(QS2S(itemNameId));
+
+ if ( dataObject != NULL ) {
+ dataObjectList->push_back(dataObject);
+ } else {
+ LOG("No data object associated to the item "<<itemNameId);
+ }
+ }
+ return dataObjectList;
+}
+
+
+void DataProcessor::process(QStringList itemNameIdList) {
+ if ( _dataModel == NULL ) {
+ STDLOG("No data model");
+ return;
+ }
+
+ this->preprocess(itemNameIdList);
+
+ // We can request the dataModel to obtain the dataObject associated
+ // to each of the item (iteNameId is a TreeView id, Qt stuff only).
+ QStringList::const_iterator it;
+ for (it = itemNameIdList.constBegin(); it != itemNameIdList.constEnd(); ++it) {
+ QString itemNameId = *it;
+ DataObject * dataObject = _dataModel->getDataObject(QS2S(itemNameId));
+
+ if ( dataObject != NULL ) {
+ this->processDataObject(dataObject);
+ } else {
+ STDLOG("No data object associated to the item "<<QS2S(itemNameId));
+ }
+ }
+
+ this->postprocess(itemNameIdList);
+}
+
+
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef _DATAPROCESSOR_H_
+#define _DATAPROCESSOR_H_
+
+#include "TreeData.hxx"
+
+#include "DataModel.hxx"
+#include "DataObject.hxx"
+#include <QStringList>
+#include <QString>
+
+#include <vector>
+typedef std::vector<DataObject *> DataObjectVector;
+
+//
+// =================================================================
+// This class can be used to automize processing on data objects.
+// The inputs of public functions are list of selected items in the
+// tree view. The function automize the extraction of associated
+// DataObject and can automize the processing of these object if the
+// virtual function processDataObject is implemented.
+// =================================================================
+//
+
+class TREEDATA_EXPORT DataProcessor {
+
+public:
+ DataProcessor(DataModel * dataModel);
+
+ DataObjectVector * extract(QStringList itemNameIdList);
+ void process(QStringList itemNameIdList);
+
+
+protected:
+ virtual void preprocess(QStringList itemNameIdList) {
+ // Implement something to be executed at the begining of the process function
+ };
+ virtual void postprocess(QStringList itemNameIdList) {
+ // Implement something to be executed at the end of the process function
+ };
+ // Implement what must be done with each DataObject during the process function
+ virtual void processDataObject(DataObject * dataObject) = 0;
+
+private:
+ DataModel * _dataModel;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#include "DockWidgets.hxx"
+
+// Qt includes
+#include <QMainWindow>
+
+// SALOME includes
+#include <SUIT_Desktop.h>
+#include <SUIT_DataBrowser.h>
+#include <QtxTreeView.h>
+
+/*!
+ * This create a gui container to hold widgets dedicated to the XCAD
+ * data model. By default, the dock widgets are not visible. Use the
+ * show() method to control the visibility (usefull when activating
+ * and desactivating the module to show/hide the dock widgets).
+ *
+ * This class does not make any hypothesis on what will be embedded in
+ * the dock widgets (only that it is QTreeView). The QTreeView is
+ * defined elsewhere and is generaly rendering a tree model containing
+ * tree items.
+ */
+DockWidgets::DockWidgets(SalomeApp_Application* salomeApp,
+ bool tabify,
+ const char * title) {
+ _salomeApp = salomeApp;
+
+ QMainWindow *parent = _salomeApp->desktop();
+ _dwDataPanel = new QDockWidget(parent);
+ _dwDataPanel->setVisible(false);
+ _dwDataPanel->setWindowTitle(title);
+ parent->addDockWidget(Qt::LeftDockWidgetArea, _dwDataPanel);
+ //
+ // At this step, the _dwDataPanel is located side by side with the object
+ // browser (or one over the other).
+ //
+ // It is possible to tabify the different dock widgets in one single
+ // tabbed widget. See the above example:
+ this->tabify(tabify);
+}
+
+void DockWidgets::tabify(bool tabify) {
+ if ( tabify ) {
+ // We first get the object browser tree view, and then the
+ // associated DockWidget. Note that the tree view is a SALOME
+ // specific extention of the originate QTreeView and called
+ // QtxTreeView.
+ SUIT_DataBrowser* objectBrowser = _salomeApp->objectBrowser();
+ QtxTreeView* treeView = objectBrowser->treeView();
+ QWidget* pw = treeView->parentWidget();
+ QDockWidget* dwObjectBrowser = 0;
+ while ( pw && !dwObjectBrowser ) {
+ dwObjectBrowser = ::qobject_cast<QDockWidget*>( pw );
+ pw = pw->parentWidget();
+ };
+ QMainWindow *parent = _salomeApp->desktop();
+ parent->tabifyDockWidget(_dwDataPanel, dwObjectBrowser);
+ parent->setTabOrder(_dwDataPanel, dwObjectBrowser);
+ parent->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
+ }
+ else {
+ // TO BE IMPLEMENTED
+ }
+}
+
+/*!
+ * This function controls the visibility of the dock widgets.
+ */
+void DockWidgets::show(bool isVisible) {
+ _dwDataPanel->setVisible(isVisible);
+}
+
+/*!
+ * This function initializes the central part of the dock widget with
+ * a tree view that can hold a hierarchical data model.
+ */
+void DockWidgets::setDataView(QTreeView * dataView) {
+ _tvDataView = dataView;
+ _tvDataView->setParent(_dwDataPanel);
+ _tvDataView->setMinimumHeight(200);
+ _dwDataPanel->setWidget(_tvDataView);
+}
+
+void DockWidgets::setPropertiesView(QTreeView * propertiesView) {
+ // Not implemented yet
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef _DOCKWIDGETS_H_
+#define _DOCKWIDGETS_H_
+
+#include "TreeData.hxx"
+
+// Qt includes
+#include <QDockWidget>
+#include <QTreeView>
+
+// SALOME includes
+#include <SalomeApp_Application.h>
+
+class TREEDATA_EXPORT DockWidgets {
+ public:
+ DockWidgets(SalomeApp_Application* salomeApp,
+ bool tabify=false,
+ const char * title="Data Model");
+
+ void tabify(bool tabify);
+ void show(bool isVisible);
+ void setDataView(QTreeView * dataView);
+ void setPropertiesView(QTreeView * propertyView);
+
+ private:
+ SalomeApp_Application* _salomeApp;
+ QDockWidget * _dwDataPanel;
+ QTreeView * _tvDataView;
+};
+
+#endif // _DOCKWIDGETS_H_
--- /dev/null
+# Copyright (C) 2010 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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 : Guillaume Boulant (EDF)
+#
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+SUBDIRS = . Test
+
+# moc-files generation
+%_moc.cxx: %.hxx
+ $(MOC) $< -o $@
+
+mostlyclean-local:
+ rm -f @builddir@/*_moc.cxx
+ rm -f @builddir@/*.qm
+
+# Libraries targets
+lib_LTLIBRARIES = libSalomeTreeData.la
+
+#
+# Generic source files
+#
+salomeinclude_HEADERS = \
+ TreeData.hxx \
+ DockWidgets.hxx \
+ TreeModel.hxx \
+ TreeItem.hxx \
+ TreeView.hxx \
+ TreeObserver.hxx \
+ DataModel.hxx \
+ DataObject.hxx \
+ DataProcessor.hxx \
+ TreeGuiManager.hxx
+
+dist_libSalomeTreeData_la_SOURCES = \
+ DockWidgets.cxx \
+ TreeModel.cxx \
+ TreeItem.cxx \
+ TreeView.cxx \
+ TreeObserver.cxx \
+ DataModel.cxx \
+ DataObject.cxx \
+ DataProcessor.cxx \
+ TreeGuiManager.cxx
+
+# MOC pre-processing
+MOC_FILES_HXX = \
+ TreeModel_moc.cxx \
+ TreeView_moc.cxx \
+ TreeObserver_moc.cxx
+
+nodist_libSalomeTreeData_la_SOURCES = $(MOC_FILES_HXX)
+
+CORBA_CXXFLAGS=@OMNIORB_CXXFLAGS@ @OMNIORB_INCLUDES@
+CORBA_LIBS=@OMNIORB_LIBS@
+
+QT_CXXFLAGS=@QT_INCLUDES@ @QT_MT_INCLUDES@
+CAS_CXXFLAGS=@CAS_CPPFLAGS@ @CAS_CXXFLAGS@
+
+BOOST_CPPFLAGS=@BOOST_CPPFLAGS@
+BOOST_LIBS=@BOOST_LIBS@
+
+libSalomeTreeData_la_CPPFLAGS = \
+ $(QT_CXXFLAGS) \
+ $(CAS_CXXFLAGS) \
+ $(BOOST_CPPFLAGS) \
+ $(CORBA_CXXFLAGS) \
+ $(KERNEL_CXXFLAGS) \
+ -I$(srcdir)/../SalomeApp \
+ -I$(srcdir)/../LightApp \
+ -I$(srcdir)/../CAM \
+ -I$(srcdir)/../STD \
+ -I$(srcdir)/../ObjBrowser \
+ -I$(srcdir)/../SUIT \
+ -I$(srcdir)/../Qtx \
+ -I$(srcdir)/../GuiHelpers
+
+
+
+
+libSalomeTreeData_la_LDFLAGS = \
+ $(CORBA_LIBS) $(QT_LIBS)\
+ $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeKernelHelpers \
+ $(top_builddir)/src/SalomeApp/libSalomeApp.la \
+ $(top_builddir)/src/LightApp/libLightApp.la \
+ $(top_builddir)/src/SUIT/libsuit.la \
+ $(top_builddir)/src/Qtx/libqtx.la \
+ $(top_builddir)/src/CAM/libCAM.la \
+ $(top_builddir)/src/STD/libstd.la \
+ $(top_builddir)/src/ObjBrowser/libObjBrowser.la
--- /dev/null
+# Copyright (C) 2010 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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 : Guillaume Boulant (EDF)
+#
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+# moc-files generation
+%_moc.cxx: %.hxx
+ $(MOC) $< -o $@
+
+mostlyclean-local:
+ rm -f @builddir@/*_moc.cxx
+ rm -f @builddir@/*.qm
+ rm -f @builddir@/*_moc.cxx @builddir@/ui_*.h
+
+# qt forms files generation (uic)
+ui_%.h: %.ui
+ $(UIC) -o $@ $<
+
+
+CORBA_CXXFLAGS=@OMNIORB_CXXFLAGS@ @OMNIORB_INCLUDES@
+CORBA_LIBS=@OMNIORB_LIBS@
+QT_CXXFLAGS=@QT_INCLUDES@ @QT_MT_INCLUDES@
+
+TEST_CPPFLAGS = \
+ $(QT_CXXFLAGS) \
+ $(CORBA_CXXFLAGS) \
+ $(KERNEL_CXXFLAGS) \
+ -I$(top_srcdir)/src/GuiHelpers \
+ -I$(top_srcdir)/src/TreeData \
+ -I.
+
+TEST_LDFLAGS = \
+ $(CORBA_LIBS) $(QT_LIBS) \
+ $(top_builddir)/src/TreeData/libSalomeTreeData.la \
+ $(top_builddir)/src/GuiHelpers/libSalomeGuiHelpers.la \
+ $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeKernelHelpers
+
+# Program targets
+bin_PROGRAMS = TreeData_guitester TreeData_tester
+
+MOC_FILES_HXX = \
+ mainwindow_moc.cxx
+
+UIC_FILES = \
+ ui_mainwindow.h
+
+BUILT_SOURCES = $(UIC_FILES)
+
+nodist_TreeData_guitester_SOURCES = $(MOC_FILES_HXX) $(UIC_FILES)
+
+TreeData_guitester_SOURCES = \
+ testhelper.hxx \
+ testhelper.cxx \
+ guitester.cxx \
+ mainwindow.hxx \
+ mainwindow.cxx \
+ MyDataModel.hxx \
+ MyDataModel.cxx
+
+TreeData_guitester_CPPFLAGS = \
+ $(TEST_CPPFLAGS)
+
+TreeData_guitester_LDFLAGS = \
+ $(TEST_LDFLAGS)
+
+TreeData_tester_SOURCES = \
+ tester.cxx \
+ MyDataModel.cxx
+
+TreeData_tester_CPPFLAGS = \
+ $(TEST_CPPFLAGS)
+
+TreeData_tester_LDFLAGS = \
+ $(TEST_LDFLAGS)
+
+# test data files
+testdir = $(salomeresdir)/testdata
+test_DATA = \
+ data.txt
+
+EXTRA_DIST+=$(test_DATA)
--- /dev/null
+#include "MyDataModel.hxx"
+
+//
+// =================================================================
+// MyDataObject implementation
+// =================================================================
+//
+
+const string MyDataObject::PROPERTY_KEY_TYPE = "type";
+const string MyDataObject::PROPERTY_KEY_CIRCUIT ="circuit";
+const string MyDataObject::PROPERTY_KEY_REPFONC ="rf";
+
+MyDataObject::MyDataObject() : DataObject() {
+ this->setProperty(PROPERTY_KEY_TYPE, "Tuyauterie");
+ this->setProperty(PROPERTY_KEY_CIRCUIT,"RRA");
+ this->setProperty(PROPERTY_KEY_REPFONC,"RF_01");
+}
+
+/*! This function specified the localization of the object in the
+ * hierarchical organization
+ */
+string MyDataObject::getPath() {
+ // We choose here a convention for organizing the path for this
+ // class of object.
+ /*
+ string path = getProperty(PROPERTY_KEY_CIRCUIT) + pathsep
+ + getProperty(PROPERTY_KEY_REPFONC) + pathsep
+ + getProperty(PROPERTY_KEY_TYPE);
+ */
+ string path = getProperty(PROPERTY_KEY_TYPE) + pathsep
+ + getProperty(PROPERTY_KEY_CIRCUIT) + pathsep
+ + getProperty(PROPERTY_KEY_REPFONC);
+
+ return path;
+}
+
+//
+// =================================================================
+// MyDataModel implementation
+// =================================================================
+//
+MyDataModel::MyDataModel() : DataModel() {
+}
+
+DataObject * MyDataModel::newDataObject() {
+ MyDataObject * dataObject = new MyDataObject();
+ return dataObject;
+}
--- /dev/null
+#ifndef _MYDATAMODEL_H_
+#define _MYDATAMODEL_H_
+
+//
+// =================================================================
+// Definition of an atom in the data model as an implementation of
+// the virtual class DataObject
+// =================================================================
+//
+
+#include "DataObject.hxx"
+class MyDataObject: public DataObject {
+public:
+ MyDataObject();
+ virtual string getPath();
+ static const string PROPERTY_KEY_TYPE;
+ static const string PROPERTY_KEY_CIRCUIT;
+ static const string PROPERTY_KEY_REPFONC;
+};
+
+
+//
+// =================================================================
+// Definition of the data model as an implementation of the virtual
+// class DataModel. It implements the DataObject factory.
+// =================================================================
+//
+#include "DataModel.hxx"
+class MyDataModel: public DataModel {
+public:
+ MyDataModel();
+ virtual DataObject * newDataObject();
+};
+
+#endif // _MYDATAMODEL_H_
--- /dev/null
+Tuyauterie;RF1;T1\r
+Tuyauterie;RF1;T2\r
+Tuyauterie;RF1;T3\r
+Tuyauterie;RF2;T1\r
+Tuyauterie;RF3;T1\r
+Tuyauterie;RF3;T2\r
+Composansts;RF1;T1\r
+Composansts;RF1;T2\r
+Composansts;RF3;T2\r
+Genie Civil;RF1;T1\r
+Genie Civil;RF1;T2\r
+Genie Civil;RF1;T3\r
+Genie Civil;RF2;T1\r
+Genie Civil;RF3;T1\r
+Genie Civil;RF3;T2\r
--- /dev/null
+#include <QApplication>
+#include <QMainWindow>
+#include <QDockWidget>
+#include <QTreeView>
+
+#include <Basics_Utils.hxx>
+
+//
+// =================================================================
+// Generic helper functions
+// =================================================================
+//
+/*!
+ * This functions displays a main window that embeds the specified
+ * widget. A dockwidget is used to create a context similar to as the
+ * SALOME target context.
+ */
+void showWidget(QWidget * widget) {
+
+ QMainWindow * window = new QMainWindow();
+
+ // Prepare a gui framework for testing the widget. We use a
+ // dockwidget, just to be in a context similar to as the SALOME
+ // target context.
+ QDockWidget * dwDataPanel = new QDockWidget(window);
+ dwDataPanel->setVisible(true);
+ dwDataPanel->setWindowTitle("XCAD data model");
+ window->addDockWidget(Qt::LeftDockWidgetArea, dwDataPanel);
+
+ // Then plug the widget in the dock widget framework:
+ widget->setParent(dwDataPanel);
+ widget->setMinimumHeight(300);
+ dwDataPanel->setWidget(widget);
+
+ window->show();
+}
+
+//
+// =================================================================
+// Tests functions for TreeModel
+// =================================================================
+//
+#include "TreeModel.hxx"
+#include "MyDataModel.hxx"
+#include "testhelper.hxx"
+
+
+/*!
+ * This function fills the specified tree with data that show
+ * different levels of path in the tree.
+ */
+void _TEST_treemodel_addData_01(TreeModel * dataTreeModel) {
+ // We can first add categories (for example to set categories
+ // properties)
+ QStringList path;
+ DataObject * folder;
+
+ path << "folder_1";
+ folder = TESTHELPER_dummyObject("folder_1.1");
+ dataTreeModel->addData(folder, path);
+ folder = TESTHELPER_dummyObject("folder_1.2");
+ dataTreeModel->addData(folder, path);
+
+ path.clear();
+ path << "folder_2";
+ folder = TESTHELPER_dummyObject("folder_2.1");
+ dataTreeModel->addData(folder, path);
+
+ // Then we can add data
+ DataObject * data;
+ path.clear();
+ path << "folder_1" << "folder_1.1";
+ data = TESTHELPER_dummyObject("data_1.1.1");
+ dataTreeModel->addData(data, path);
+ data = TESTHELPER_dummyObject("data_1.1.2");
+ dataTreeModel->addData(data, path);
+ // You can notice that there is no conceptual difference between a
+ // folder and an item, as in the QTreeModel.
+
+ // No limit to the depth
+ path.clear();
+ path << "xcad" << "data1" << "x" << "y";
+ data = TESTHELPER_dummyObject("z");
+ dataTreeModel->addData(data,path);
+}
+
+#define LOOPSIZE 15
+/*!
+ * This function fills the specified tree with a huge amount of data
+ */
+void _TEST_treemodel_addData_02(TreeModel * dataTreeModel) {
+ QStringList path;
+ DataObject * data;
+
+ START_TIMING(treemodel);
+ for (int i=0; i<LOOPSIZE; i++) {
+ END_TIMING(treemodel,1);
+ for (int j=0; j<LOOPSIZE; j++) {
+ for (int k=0; k<LOOPSIZE; k++) {
+ // The data list corresponds to the path of the item in the tree
+ path << QString("folder_%0").arg(i)
+ << QString("subfolder_%0_%1").arg(i).arg(j);
+ data = TESTHELPER_dummyObject(QString("item_%0_%1_%2").arg(i).arg(j).arg(k));
+ dataTreeModel->addData(data,path);
+ path.clear();
+ }
+ }
+ }
+ END_TIMING(treemodel,1);
+}
+
+void _TEST_treemodel_addData_03(TreeModel * dataTreeModel) {
+ MyDataObject * dataObject = new MyDataObject();
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_TYPE, "Tuyauterie");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_CIRCUIT, "RCP");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_REPFONC, "RF1");
+ dataTreeModel->addData(dataObject);
+
+ dataObject = new MyDataObject();
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_TYPE, "Tuyauterie");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_CIRCUIT, "RCP");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_REPFONC, "RF1");
+ dataTreeModel->addData(dataObject);
+
+ dataObject = new MyDataObject();
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_TYPE, "Tuyauterie");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_CIRCUIT, "RCP");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_REPFONC, "RF2");
+ dataTreeModel->addData(dataObject);
+
+ dataObject = new MyDataObject();
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_TYPE, "Tuyauterie");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_CIRCUIT, "RRA");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_REPFONC, "RF1");
+ dataTreeModel->addData(dataObject);
+
+ dataObject = new MyDataObject();
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_TYPE, "Génie civil");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_CIRCUIT, "RRA");
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_REPFONC, "RF1");
+ dataTreeModel->addData(dataObject);
+}
+
+/*!
+ * This test function shows how it's possible to load data from a file
+ * to populate the tree model.
+ */
+void _TEST_treemodel_loadDataFromFile(TreeModel * dataTreeModel, const QString &filename) {
+ TESTHELPER_loadDataFromFile(dataTreeModel, filename);
+}
+
+/*!
+ * Main test function for the tree model demo.
+ */
+#include "TreeModel.hxx"
+#include "TreeView.hxx"
+void TEST_treemodel() {
+
+ START_TIMING(treemodel);
+
+ // We first prepare a data view embedding a tree model
+ TreeView * dataView = new TreeView();
+ QStringList headers;
+ headers << QObject::tr("Name") << QObject::tr("Value");
+ TreeModel * dataTreeModel = new TreeModel(headers);
+ dataView->setModel(dataTreeModel);
+ END_TIMING(treemodel,1);
+
+ // Then we can fill the tree model with data. Can proceed with
+ // different ways (comment/uncomment which you want to test):
+ _TEST_treemodel_loadDataFromFile(dataTreeModel, TESTHELPER_testfilename(DATAFILENAME));
+ //_TEST_treemodel_addData_01(dataTreeModel);
+ //_TEST_treemodel_addData_02(dataTreeModel);
+ //_TEST_treemodel_addData_03(dataTreeModel);
+ // Finally, show the widget in a main window
+ END_TIMING(treemodel,1);
+
+ showWidget(dataView);
+ END_TIMING(treemodel,1);
+}
+
+//
+// =================================================================
+// Tests functions for TreeModel with interactive changes
+// =================================================================
+//
+#include "mainwindow.hxx"
+void TEST_treemodel_interactif() {
+ MainWindow * window = new MainWindow();
+ window->show();
+}
+
+//
+// =================================================================
+//
+int main(int argc, char * argv[ ])
+{
+ QApplication app(argc, argv);
+ TEST_treemodel();
+ //TST_treemodel_interactif();
+ return app.exec();
+}
--- /dev/null
+#include <QtGui>
+
+#include "mainwindow.hxx"
+#include "TreeModel.hxx"
+
+#include <Basics_Utils.hxx>
+#include "testhelper.hxx"
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+{
+ setupUi(this);
+
+ QStringList headers;
+ headers << tr("Title") << tr("Description");
+
+ TreeModel *model = new TreeModel(headers);
+ TESTHELPER_loadDataFromFile(model, TESTHELPER_testfilename(DATAFILENAME));
+
+ view->setModel(model);
+ for (int column = 0; column < model->columnCount(); ++column)
+ view->resizeColumnToContents(column);
+
+ connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+
+ connect(view->selectionModel(),
+ SIGNAL(selectionChanged(const QItemSelection &,
+ const QItemSelection &)),
+ this, SLOT(updateActions()));
+
+ connect(actionsMenu, SIGNAL(aboutToShow()), this, SLOT(updateActions()));
+ connect(insertRowAction, SIGNAL(triggered()), this, SLOT(insertRow()));
+ connect(insertColumnAction, SIGNAL(triggered()), this, SLOT(insertColumn()));
+ connect(removeRowAction, SIGNAL(triggered()), this, SLOT(removeRow()));
+ connect(removeColumnAction, SIGNAL(triggered()), this, SLOT(removeColumn()));
+ connect(insertChildAction, SIGNAL(triggered()), this, SLOT(insertChild()));
+ connect(newDataAction, SIGNAL(triggered()), this, SLOT(newData()));
+
+ updateActions();
+}
+
+void MainWindow::newData() {
+ LOG("MainWindow::newData(): START");
+
+ bool ok;
+ QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
+ tr("Data path:"), QLineEdit::Normal,
+ "folder/subfolder/item", &ok);
+ if (!ok || text.trimmed().isEmpty())
+ return;
+
+ QStringList path = text.trimmed().split("/");
+ TreeModel *model = (TreeModel *)view->model();
+
+ QString label = path.last();
+ path.removeLast();
+ DataObject * data = TESTHELPER_dummyObject(label);
+ model->addData(data,path);
+
+ LOG("MainWindow::newData(): END");
+}
+
+void MainWindow::insertChild()
+{
+ QModelIndex index = view->selectionModel()->currentIndex();
+ QAbstractItemModel *model = view->model();
+
+ if (model->columnCount(index) == 0) {
+ if (!model->insertColumn(0, index))
+ return;
+ }
+
+ if (!model->insertRow(0, index))
+ return;
+
+ for (int column = 0; column < model->columnCount(index); ++column) {
+ QModelIndex child = model->index(0, column, index);
+ model->setData(child, QVariant("[No data]"), Qt::EditRole);
+ if (!model->headerData(column, Qt::Horizontal).isValid())
+ model->setHeaderData(column, Qt::Horizontal, QVariant("[No header]"),
+ Qt::EditRole);
+ }
+
+ view->selectionModel()->setCurrentIndex(model->index(0, 0, index),
+ QItemSelectionModel::ClearAndSelect);
+ updateActions();
+}
+
+bool MainWindow::insertColumn(const QModelIndex &parent)
+{
+ QAbstractItemModel *model = view->model();
+ int column = view->selectionModel()->currentIndex().column();
+
+ // Insert a column in the parent item.
+ bool changed = model->insertColumn(column + 1, parent);
+ if (changed)
+ model->setHeaderData(column + 1, Qt::Horizontal, QVariant("[No header]"),
+ Qt::EditRole);
+
+ updateActions();
+
+ return changed;
+}
+
+void MainWindow::insertRow()
+{
+ QModelIndex index = view->selectionModel()->currentIndex();
+ QAbstractItemModel *model = view->model();
+
+ if (!model->insertRow(index.row()+1, index.parent()))
+ return;
+
+ updateActions();
+
+ for (int column = 0; column < model->columnCount(index.parent()); ++column) {
+ QModelIndex child = model->index(index.row()+1, column, index.parent());
+ model->setData(child, QVariant("[No data]"), Qt::EditRole);
+ }
+}
+
+bool MainWindow::removeColumn(const QModelIndex &parent)
+{
+ QAbstractItemModel *model = view->model();
+ int column = view->selectionModel()->currentIndex().column();
+
+ // Insert columns in each child of the parent item.
+ bool changed = model->removeColumn(column, parent);
+
+ if (!parent.isValid() && changed)
+ updateActions();
+
+ return changed;
+}
+
+void MainWindow::removeRow()
+{
+ QModelIndex index = view->selectionModel()->currentIndex();
+ QAbstractItemModel *model = view->model();
+ if (model->removeRow(index.row(), index.parent()))
+ updateActions();
+}
+
+void MainWindow::updateActions()
+{
+ bool hasSelection = !view->selectionModel()->selection().isEmpty();
+ removeRowAction->setEnabled(hasSelection);
+ removeColumnAction->setEnabled(hasSelection);
+
+ bool hasCurrent = view->selectionModel()->currentIndex().isValid();
+ insertRowAction->setEnabled(hasCurrent);
+ insertColumnAction->setEnabled(hasCurrent);
+
+ if (hasCurrent) {
+ view->closePersistentEditor(view->selectionModel()->currentIndex());
+
+ int row = view->selectionModel()->currentIndex().row();
+ int column = view->selectionModel()->currentIndex().column();
+ if (view->selectionModel()->currentIndex().parent().isValid())
+ statusBar()->showMessage(tr("Position: (%1,%2)").arg(row).arg(column));
+ else
+ statusBar()->showMessage(tr("Position: (%1,%2) in top level").arg(row).arg(column));
+ }
+}
+
+void MainWindow::contextMenuEvent(QContextMenuEvent *event) {
+ QMenu menu(this);
+ menu.addAction(newDataAction);
+ menu.exec(event->globalPos());
+}
--- /dev/null
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QModelIndex>
+
+#include "ui_mainwindow.h"
+
+class QAction;
+class QTreeView;
+class QWidget;
+
+class MainWindow : public QMainWindow, private Ui::MainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+
+protected:
+ void contextMenuEvent(QContextMenuEvent *event);
+
+public slots:
+ void updateActions();
+
+private slots:
+ void insertChild();
+ bool insertColumn(const QModelIndex &parent = QModelIndex());
+ void insertRow();
+ bool removeColumn(const QModelIndex &parent = QModelIndex());
+ void removeRow();
+ void newData();
+};
+
+#endif
--- /dev/null
+<ui version="4.0" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>573</width>
+ <height>468</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Editable Tree Model</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QTreeView" name="view" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="selectionBehavior" >
+ <enum>QAbstractItemView::SelectItems</enum>
+ </property>
+ <property name="horizontalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerPixel</enum>
+ </property>
+ <property name="animated" >
+ <bool>false</bool>
+ </property>
+ <property name="allColumnsShowFocus" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>573</width>
+ <height>29</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="actionsMenu" >
+ <property name="title" >
+ <string>&Actions</string>
+ </property>
+ <addaction name="insertRowAction" />
+ <addaction name="insertColumnAction" />
+ <addaction name="separator" />
+ <addaction name="removeRowAction" />
+ <addaction name="removeColumnAction" />
+ <addaction name="separator" />
+ <addaction name="insertChildAction" />
+ </widget>
+ <widget class="QMenu" name="fileMenu" >
+ <property name="title" >
+ <string>&File</string>
+ </property>
+ <addaction name="exitAction" />
+ </widget>
+ <widget class="QMenu" name="menuData" >
+ <property name="title" >
+ <string>Data</string>
+ </property>
+ <addaction name="newDataAction" />
+ </widget>
+ <addaction name="fileMenu" />
+ <addaction name="actionsMenu" />
+ <addaction name="menuData" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="exitAction" >
+ <property name="text" >
+ <string>E&xit</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
+ <action name="insertRowAction" >
+ <property name="text" >
+ <string>Insert Row</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+I, R</string>
+ </property>
+ </action>
+ <action name="removeRowAction" >
+ <property name="text" >
+ <string>Remove Row</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+R, R</string>
+ </property>
+ </action>
+ <action name="insertColumnAction" >
+ <property name="text" >
+ <string>Insert Column</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+I, C</string>
+ </property>
+ </action>
+ <action name="removeColumnAction" >
+ <property name="text" >
+ <string>Remove Column</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+R, C</string>
+ </property>
+ </action>
+ <action name="insertChildAction" >
+ <property name="text" >
+ <string>Insert Child</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <action name="newDataAction" >
+ <property name="text" >
+ <string>new</string>
+ </property>
+ </action>
+ </widget>
+ <resources>
+ <include location="editabletreemodel.qrc" />
+ </resources>
+ <connections/>
+</ui>
--- /dev/null
+#include "QtHelper.hxx"
+
+//
+// =================================================================
+// Helper functions for DataObject and DataModel classes
+// =================================================================
+//
+
+// ----
+// A DataObject can't be used as is but must be specialized to
+// specify the behavior in the hierarchic model.
+#include "MyDataModel.hxx"
+
+void TEST_DataObject() {
+ // In this test, the object id should increase at each instance
+ DataObject * dataObject;
+ for (int i=0; i<100; i++) {
+ dataObject = new MyDataObject();
+ QLOG("object nameId = " << dataObject->getNameId().c_str());
+ }
+ QLOG("path = " << dataObject->getPath().c_str());
+ QLOG("pathname = " << dataObject->getPathName().c_str());
+
+ QLOG("serialize= " << dataObject->toString().c_str());
+
+}
+
+void TEST_DataModel() {
+ MyDataModel * dataModel = new MyDataModel();
+
+ int refIter = 53;
+ string refNameId;
+
+ DataObject * dataObject;
+ for (int i=0; i<100; i++) {
+ // We can either create the data object using its constructor or
+ // using the factory of the model (the prefered way):
+ // dataObject = new MyDataObject();
+ dataObject = dataModel->newDataObject();
+ dataObject->setLabel("myobject"+ToString(i));
+ if ( i == refIter ) {
+ refNameId = dataObject->getNameId();
+ }
+ dataModel->addDataObject(dataObject);
+ }
+
+ dataObject = dataModel->getDataObject(refNameId);
+ QLOG("object nameId = " << dataObject->getNameId().c_str());
+ QLOG("path = " << dataObject->getPath().c_str());
+ QLOG("pathname = " << dataObject->getPathName().c_str());
+}
+
+//
+// =================================================================
+//
+int main(int argc, char * argv[ ])
+{
+ TEST_DataObject();
+ //TEST_DataModel();
+}
--- /dev/null
+
+
+#include "testhelper.hxx"
+
+#include <QFile>
+#include <QString>
+
+#include "QtHelper.hxx"
+#include "MyDataModel.hxx"
+
+// Standard C include (for getenv)
+#include <stdlib.h>
+
+QString TESTHELPER_testfilename(const char * basefilename) {
+ QString aFile;
+ char * GUI_ROOT_DIR = getenv("GUI_ROOT_DIR");
+ QString * root;
+ if ( GUI_ROOT_DIR != NULL ) {
+ root = new QString(GUI_ROOT_DIR);
+ }
+ else {
+ root = new QString("/home/gboulant/development/projets/salome/devel/XSALOME/install");
+ }
+ QString relativePathName = "/share/salome/resources/gui/testdata/";
+ aFile.append(*root + relativePathName + basefilename);
+
+ QLOG("The test file is : "<<aFile);
+ return aFile;
+}
+
+/*!
+ * This creates a dummy data object for the needs of the test
+ * functions. The label is the basename of the spécified pathname.
+ */
+DataObject * TESTHELPER_dummyObject(QString label) {
+ MyDataObject * dataObject = new MyDataObject();
+ dataObject->setLabel(QCHARSTAR(label));
+ return dataObject;
+}
+
+
+#define SEP ";"
+/*!
+ * This test function shows how it's possible to load data from a file
+ * to populate the tree model.
+ */
+void TESTHELPER_loadDataFromFile(TreeModel * dataTreeModel, const QString &filename) {
+ QFile file ( filename );
+ file.open ( QIODevice::ReadOnly );
+
+ MyDataObject * dataObject;
+ while ( 1 ) {
+ QByteArray byteArray = file.readLine();
+
+ if ( byteArray.isEmpty() )
+ break;
+
+ QString data = (QString ( byteArray.mid(0, byteArray.size()-1))).trimmed();
+ QStringList dataList = data.split ( SEP );
+ // The data list is used here to set properties (and then the path
+ // of location in the tree model).
+
+ dataObject = new MyDataObject();
+ // The label is autogenerated, but we may specify here a custom
+ // one. We just fill the properties with data values read in the
+ // file.
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_TYPE, QCHARSTAR(dataList[0]));
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_REPFONC, QCHARSTAR(dataList[1]));
+ dataObject->setProperty(MyDataObject::PROPERTY_KEY_CIRCUIT, QCHARSTAR(dataList[2]));
+ if ( ! dataTreeModel->addData(dataObject) ) {
+ QLOG("ERR: data not added");
+ }
+ }
+
+ file.close();
+}
--- /dev/null
+
+#ifndef _TESTHELPER_HXX_
+#define _TESTHELPER_HXX_
+
+#include <QString>
+#include "TreeModel.hxx"
+#include "DataObject.hxx"
+
+#define DATAFILENAME "data.txt"
+
+QString TESTHELPER_testfilename(const char * basefilename);
+DataObject * TESTHELPER_dummyObject(QString label);
+void TESTHELPER_loadDataFromFile(TreeModel * dataTreeModel, const QString &filename);
+
+#endif // _TESTHELPER_HXX_
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef TREEDATA_HXX
+#define TREEDATA_HXX
+
+#ifdef WIN32
+# if defined SALOMETREEDATA_EXPORTS || defined SalomeTreeData_EXPORTS
+# define TREEDATA_EXPORT __declspec( dllexport )
+# else
+# define TREEDATA_EXPORT __declspec( dllimport )
+# endif
+#else
+# define TREEDATA_EXPORT
+#endif
+
+#endif //TREEDATA_HXX
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#include "TreeGuiManager.hxx"
+
+// SALOME includes
+#include <QStringList>
+
+// XCAD includes
+#include "TreeView.hxx"
+#include "QtHelper.hxx"
+
+// TODO:
+// IMP: The constructor should have a dockwidget as argument.
+// The creation of the void dockwidget (without the data tree
+// embedded) should be done previously by the StandardApp_Module.
+// The constructor would fill the dockwidget with a data tree view
+
+/*!
+ * The construction of the gui manager setups a graphic framework that
+ * consists in a set of dock widgets implanted in the SALOME GUI and
+ * embedding a tree view rendering a data model (collection of data
+ * objects) in a hierarchic graphical organisation.
+ *
+ * The data model is a straith list of data objects while the view is
+ * a tree representation of this collection where folders corresponds
+ * to specific properties of the objects.
+ *
+ * This represention is for the needs of navigation in a huge amount
+ * of data and to ease the selection and processing of items.
+ */
+TreeGuiManager::TreeGuiManager(SalomeApp_Application * salomeApp, const char * title)
+ : TreeObserver()
+{
+ _salomeApp = salomeApp;
+
+ bool tabify = false;
+ _dockWidgets = new DockWidgets(_salomeApp, tabify, title);
+
+ // Create a TreeView to be associated to a TreeModel dedicated to
+ // the Xcad data:
+ _dataTreeView = new TreeView();
+ QStringList headers;
+ headers << tr("Name") << tr("Value");
+ _dataTreeModel = new TreeModel(headers);
+ _dataTreeView->setModel(_dataTreeModel);
+
+ // Then plug the TreeView in the dock widget:
+ _dockWidgets->setDataView(_dataTreeView);
+
+ // We specify here the dataview to be observed
+ this->observe(_dataTreeView);
+}
+
+/*!
+ * This returns the SALOME application (SalomeApp_Application
+ * instance) associated to this TreeGuiManager.
+ */
+SalomeApp_Application * TreeGuiManager::getSalomeApplication() {
+ return _salomeApp;
+}
+
+
+/*!
+ * This function set a layout of the different dock widgets in one
+ * single tabbed widget.
+ */
+void TreeGuiManager::tabifyDockWidgets(bool tabify) {
+ _dockWidgets->tabify(tabify);
+}
+
+/*!
+ * This function switch on/off the dock widgets managed by this
+ * gui manager.
+ */
+void TreeGuiManager::showDockWidgets(bool isVisible) {
+ _dockWidgets->show(isVisible);
+}
+
+/*!
+ * This returns the data tree model defined in this
+ * TreeGuiManager. The data tree model is a tree representation of the
+ * data model associated to this TreeGuiManager.
+ */
+TreeModel * TreeGuiManager::getDataTreeModel() {
+ return _dataTreeModel;
+}
+
+/*!
+ * This returns the data tree view defined in this
+ * TreeGuiManager. The data tree view can be request to customize the
+ * popup menu associated to the tree representation.
+ */
+TreeView * TreeGuiManager::getDataTreeView() {
+ return _dataTreeView;
+}
+
+
+/*!
+ * This function specifies the data model to be used by the
+ * TreeGuiManager.
+ */
+void TreeGuiManager::setDataModel(DataModel * dataModel) {
+ _dataModel = dataModel;
+}
+
+DataModel * TreeGuiManager::getDataModel() {
+ return _dataModel;
+}
+
+/*!
+ * This function processes the edit signals received from the
+ * TreeView. This is a default implementation that only prints the
+ * reception of the signal and some information about the dataObject
+ * associated to the item whose id is specified. In practice, the data
+ * model could be requested here to retrieve the data object to be
+ * edited from the nameId.
+ * TO BE IMPLEMENTED IN A DOMAIN SPECIFIC VERSION OF THIS CLASS
+ */
+
+void TreeGuiManager::processItemList(QStringList itemNameIdList,
+ int actionId)
+{
+ // WARN: THIS IS A DEFAULT IMPLEMENTATION GIVEN FOR DEMONSTRATION
+ // OF WHAT TO DO WITH THE PARAMETERS
+
+ QString itemNameId = itemNameIdList[0];
+ LOG("TreeGuiManager: signal received : process item "<<itemNameId);
+ DataObject * dataObject = _dataModel->getDataObject(QS2S(itemNameId));
+ if ( dataObject != NULL ) {
+ LOG("TreeGuiManager: dataObject = "<<dataObject->toString().c_str());
+ } else {
+ LOG("TreeGuiManager: no data object associated to this item");
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef _TREEGUIMANAGER_H_
+#define _TREEGUIMANAGER_H_
+
+#include "TreeData.hxx"
+
+// SALOME includes
+#include <SalomeApp_Application.h>
+
+// TREEDATA includes
+#include "DockWidgets.hxx"
+#include "TreeModel.hxx"
+#include "DataModel.hxx"
+#include "TreeView.hxx"
+#include "TreeObserver.hxx"
+
+class TREEDATA_EXPORT TreeGuiManager : public TreeObserver {
+
+public:
+ TreeGuiManager(SalomeApp_Application * salomeApp, const char * title="Data Model");
+ void tabifyDockWidgets(bool tabify);
+ void showDockWidgets(bool isVisible);
+ SalomeApp_Application * getSalomeApplication();
+
+ TreeModel * getDataTreeModel();
+ TreeView * getDataTreeView();
+
+ void setDataModel(DataModel * dataModel);
+ DataModel * getDataModel();
+
+private:
+ SalomeApp_Application * _salomeApp;
+
+ DockWidgets * _dockWidgets;
+ TreeView * _dataTreeView;
+
+ TreeModel * _dataTreeModel;
+ DataModel * _dataModel;
+
+public slots:
+ virtual void processItemList(QStringList itemNameIdList, int actionId);
+};
+
+#endif /* _TREEGUIMANAGER_H_ */
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+
+#include <QStringList>
+#include "TreeItem.hxx"
+
+TreeItem::TreeItem(const QString &nameId,
+ const QVector<QVariant> &columnValues,
+ TreeItem *parent)
+{
+ this->initialize(nameId, columnValues, parent);
+}
+
+/*!
+ * This initializes the tree item. Called by the constructors.
+ */
+void TreeItem::initialize(const QString &nameId,
+ const QVector<QVariant> &columnValues,
+ TreeItem *parent) {
+ _itemNameId = nameId;
+ _itemData = columnValues;
+ _parentItem = parent;
+
+ // An item is associated to the model of its parent. It can't be
+ //done automatically in the case where the item has no parent. Then
+ //the function associatedToModel has to be called explicitely from
+ //within the user code (for exemple at construction of the model,
+ //when creating the root item).
+ if ( parent != NULL ) {
+ this->associateToModel(parent->associatedModel());
+ }
+}
+
+TreeItem::~TreeItem()
+{
+ qDeleteAll(_childItems);
+ qDeleteAll(_childItemsMapById);
+ qDeleteAll(_childItemsMapByLabel);
+}
+
+/*!
+ * This must be used to specified which model this item belongs to. It
+ * is required because the item sometimes requests its model for
+ * global informations about the data tree. In standard usage, this
+ * function is automatically set when the item is instantiated by
+ * requested the parent item. Then only the root item needs a manual
+ * setting.
+ */
+void TreeItem::associateToModel(TreeModel * model) {
+ _associatedModel = model;
+}
+
+TreeModel * TreeItem::associatedModel() {
+ return _associatedModel;
+}
+
+/*!
+ * This provide an identifier for this item
+ */
+QString TreeItem::nameId() {
+ return _itemNameId;
+}
+
+/*!
+ * This creates an item from the specified dataObject and put it in
+ * the decendency of this item at the specified relativePath. The
+ * created item could not be a direct child of this item in the case
+ * where the relative path is not null. Note that no reference on the
+ * dataObject is kept in this instance. Only the identifier is used to
+ * set the item identifier, and the properties may be used to set the
+ * values of the item (stored in columns).
+ */
+void TreeItem::appendChild(DataObject * dataObject,
+ const QStringList &relativePath) {
+ // Definition of the nameId
+ QString nameId = QString(dataObject->getNameId().c_str());
+
+ // Definition of columns data values
+ QVector<QVariant> columnValues;
+ columnValues << QString(dataObject->getLabel().c_str());
+ columnValues << "No value"; // We could use the dataObject properties
+
+ // Append the item at the specified location with the specified values:
+ this->appendChild(nameId, columnValues, relativePath);
+}
+
+void TreeItem::appendChild(const QString &nameId,
+ const QVector<QVariant> &columnValues,
+ const QStringList &relativePath) {
+
+ if ( relativePath.isEmpty() ) {
+ // It is a direct child => just create and append to this.
+ TreeItem * child = new TreeItem(nameId, columnValues, this);
+ this->appendChild(child);
+ return;
+ }
+
+ // The child is embedded in a sub-folder (to be created if doesn't
+ // exist).
+ // We first check if the sub-folder already exist:
+ TreeItem * folder = this->childByLabel(relativePath[0]);
+ if ( folder == NULL ) {
+ // The folder does not exist. It must be created before going any
+ // further. By convention we choose the folder name as
+ // identifier.
+ QString folderNameId = relativePath[0];
+ QVector<QVariant> folderColumnValues;
+ folderColumnValues << relativePath[0] << "No value";
+ folder = new TreeItem(folderNameId, folderColumnValues, this);
+ this->appendChild(folder);
+ }
+
+ // We create the relative path of the next iteration (delete the
+ // first folder path).
+ QStringList nextRelativePath;
+ for (int i = 1; i < relativePath.size(); ++i)
+ nextRelativePath << relativePath[i];
+
+ folder->appendChild(nameId, columnValues, nextRelativePath);
+}
+
+/*!
+ * This appends the specified child to this item. This item is the
+ * direct parent of the specified child.
+ */
+void TreeItem::appendChild(TreeItem *item)
+{
+ TreeModel * model = this->associatedModel();
+
+ int position = this->childCount();
+ model->beginInsertRows(this->modelIndex(), position, position);
+ _childItems.append(item);
+ _childItemsMapById[item->nameId()] = item;
+ _childItemsMapByLabel[item->data(0).toString()] = item;
+ model->endInsertRows();
+}
+
+/*!
+ * The child() function returns the child that corresponds to the
+ * specified row number in the item's list of child items.
+ */
+TreeItem *TreeItem::child(int row)
+{
+ return _childItems.value(row);
+}
+
+TreeItem *TreeItem::childById(const QString &nameId)
+{
+ QMap <QString, TreeItem*>::iterator it;
+ it = _childItemsMapById.find ( nameId );
+
+ if ( it != _childItemsMapById.end() ) {
+ return it.value();
+ }
+ return NULL;
+}
+
+TreeItem *TreeItem::childByLabel(const QString &label)
+{
+ QMap <QString, TreeItem*>::iterator it;
+ it = _childItemsMapByLabel.find ( label );
+
+ if ( it != _childItemsMapByLabel.end() ) {
+ return it.value();
+ }
+ return NULL;
+}
+
+
+
+int TreeItem::childCount() const
+{
+ return _childItems.count();
+}
+
+/*!
+ * The rowIndex() function reports the item's location within its
+ * parent's list of items.
+ */
+int TreeItem::rowIndex() const
+{
+ if (_parentItem)
+ return _parentItem->_childItems.indexOf(const_cast<TreeItem*>(this));
+
+ return 0;
+}
+
+int TreeItem::columnCount() const
+{
+ return _itemData.count();
+}
+
+QVariant TreeItem::data(int column) const
+{
+ return _itemData.value(column);
+}
+
+TreeItem *TreeItem::parent()
+{
+ return _parentItem;
+}
+
+bool TreeItem::setData(int column, const QVariant &value)
+{
+ if (column < 0 || column >= _itemData.size())
+ return false;
+
+ _itemData[column] = value;
+ return true;
+}
+
+QModelIndex TreeItem::modelIndex(int column)
+{
+ TreeModel * model = this->associatedModel();
+ if (_parentItem && (_parentItem != model->getRootItem()))
+ return model->index(rowIndex(),
+ column,
+ _parentItem->modelIndex());
+ else
+ return model->index(rowIndex(),
+ column,
+ QModelIndex());
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef TREEITEM_H
+#define TREEITEM_H
+
+#include "TreeData.hxx"
+
+#include <QList>
+#include <QVariant>
+#include <QVector>
+#include <QModelIndex>
+
+#include "DataObject.hxx"
+#include "TreeModel.hxx"
+
+class TREEDATA_EXPORT TreeItem
+{
+ public:
+ TreeItem(const QString &nameId, const QVector<QVariant> &columnValues, TreeItem *parent = 0);
+ ~TreeItem();
+
+ QString nameId();
+ void associateToModel(TreeModel * model);
+ TreeModel * associatedModel();
+ QModelIndex modelIndex(int column=0);
+ TreeItem *parent();
+
+ void appendChild(TreeItem * child);
+ void appendChild(DataObject * dataObject,
+ const QStringList &relativePath=QStringList());
+ void appendChild(const QString &nameId,
+ const QVector<QVariant> &columnValues,
+ const QStringList &relativePath=QStringList());
+
+
+
+ TreeItem *child(int row);
+ TreeItem *childById(const QString &nameId);
+ TreeItem *childByLabel(const QString &label);
+ int childCount() const;
+ int columnCount() const;
+ int rowIndex() const;
+ QVariant data(int column) const;
+ bool setData(int column, const QVariant &value);
+
+
+ private:
+ void initialize(const QString &nameId,
+ const QVector<QVariant> &columnValues,
+ TreeItem *parent);
+
+ QList<TreeItem*> _childItems;
+ QMap <QString, TreeItem *> _childItemsMapById;
+ QMap <QString, TreeItem *> _childItemsMapByLabel;
+
+ QString _itemNameId;
+ QVector<QVariant> _itemData;
+ TreeItem * _parentItem;
+ TreeModel * _associatedModel;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+
+#include <QtGui>
+
+#include "TreeItem.hxx"
+#include "TreeModel.hxx"
+
+TreeModel::TreeModel(const QStringList &headers, QObject *parent)
+ : QAbstractItemModel(parent)
+{
+ QVector<QVariant> rootData;
+ foreach (QString header, headers)
+ rootData << header;
+
+ // _MEM_ We have to specify a string identifier for each item so
+ // that it could be easily retrieved by its parent. In the case of
+ // the root item, the value of the identifier doesn't matter => we
+ // choose an arbitrary value
+ //QString rootNameId = "rootItem";
+ _rootItem = new TreeItem("rootItem", rootData);
+ _rootItem->associateToModel(this);
+}
+
+TreeModel::~TreeModel()
+{
+ delete _rootItem;
+}
+
+TreeItem * TreeModel::getRootItem() {
+ return _rootItem;
+}
+
+//
+// =================================================================
+// This part of the implementation is the standard interface required
+// for providing an operational TreeModel. These methods are used by
+// the TreeView for display purpose. We just have to implement how we
+// want the items to be displayed in the view.
+// =================================================================
+//
+int TreeModel::columnCount(const QModelIndex & /* parent */) const
+{
+ return _rootItem->columnCount();
+}
+
+/*!
+ * This function is used by the tree model to inform the tree view of
+ * what data used for rendering of the item in the different possible
+ * role (edition, ...).
+ */
+QVariant TreeModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ if (role != Qt::DisplayRole && role != Qt::EditRole)
+ return QVariant();
+
+ TreeItem *item = getItem(index);
+
+ return item->data(index.column());
+}
+
+Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return 0;
+
+ return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+}
+
+/*!
+ * This retrieves the item asociated to the specified index.
+ */
+TreeItem *TreeModel::getItem(const QModelIndex &index) const
+{
+ // The item associated to an index can be retrieved using the
+ // internalPointer() function on the index object.
+ if (index.isValid()) {
+ TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
+ if (item) return item;
+ }
+ return _rootItem;
+}
+
+QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
+ int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
+ return _rootItem->data(section);
+
+ return QVariant();
+}
+
+/*!
+ * This retrieves the index of the item located at (row,column) place
+ * relative to the parent specified by its index.
+ */
+QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if (parent.isValid() && parent.column() != 0)
+ return QModelIndex();
+
+ TreeItem *parentItem = getItem(parent);
+
+ TreeItem *childItem = parentItem->child(row);
+ if (childItem)
+ return createIndex(row, column, childItem);
+ else
+ return QModelIndex();
+}
+
+QModelIndex TreeModel::parent(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QModelIndex();
+
+ TreeItem *childItem = getItem(index);
+ TreeItem *parentItem = childItem->parent();
+
+ if (parentItem == _rootItem)
+ return QModelIndex();
+
+ return createIndex(parentItem->rowIndex(), 0, parentItem);
+}
+
+int TreeModel::rowCount(const QModelIndex &parent) const
+{
+ TreeItem *parentItem = getItem(parent);
+
+ return parentItem->childCount();
+}
+
+bool TreeModel::setData(const QModelIndex &index, const QVariant &value,
+ int role)
+{
+ if (role != Qt::EditRole)
+ return false;
+
+ TreeItem *item = getItem(index);
+ bool result = item->setData(index.column(), value);
+
+ if (result)
+ emit dataChanged(index, index);
+
+ return result;
+}
+
+bool TreeModel::setHeaderData(int section, Qt::Orientation orientation,
+ const QVariant &value, int role)
+{
+ if (role != Qt::EditRole || orientation != Qt::Horizontal)
+ return false;
+
+ bool result = _rootItem->setData(section, value);
+
+ if (result)
+ emit headerDataChanged(orientation, section, section);
+
+ return result;
+}
+
+
+//
+// =================================================================
+// This part is a specific behavior to get a TreeModel that can
+// organize itself the tree hierarchy using data provided in a
+// filesystem-like format:
+//
+// data="a/b/c" ==> creation/filling of the hierarchy a->b->c
+// The "folder" categories are unique whereas the leaves may exists
+// in multiple instances.
+// =================================================================
+//
+
+/*
+ * The addData functions run a recurcive filling of the tree model, starting
+ * form the rootItem and descending in the tree using the recurcive
+ * function TreeItem::addData.
+ */
+
+bool TreeModel::addData(DataObject * dataObject) {
+ QStringList path = QString(dataObject->getPath().c_str()).split(DataObject::pathsep.c_str());
+ return addData(dataObject, path);
+}
+bool TreeModel::addData(DataObject * dataObject, const QStringList &path) {
+ TreeItem * rootItem = this->getItem();
+ rootItem->appendChild(dataObject, path);
+ return true;
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+
+#ifndef TREEMODEL_H
+#define TREEMODEL_H
+
+#include "TreeData.hxx"
+
+#include <QAbstractItemModel>
+#include <QModelIndex>
+#include <QVariant>
+#include <QStringList>
+
+#include "DataObject.hxx"
+
+class TreeItem;
+class TreeView;
+
+class TREEDATA_EXPORT TreeModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+ // IMPORTANT NOTE:
+ // In this implementation of QAbstractItemModel, a tree item is
+ // associated to the tree model it belongs to (it can request its
+ // model throw a pointer to this model). Then we declare the
+ // TreeItem as a friend class so that it can request the protected
+ // methods (for example beginInsertRows and endInsertRows, required
+ // to manage correctly the addition of an item in the model. An
+ // item can append a child to itself, so it needs to inform the
+ // model when it begins and when it ends).
+ friend class TreeItem;
+ friend class TreeView;
+
+public:
+ TreeModel(const QStringList &headers, QObject *parent = 0);
+ ~TreeModel();
+
+ //
+ // =================================================================
+ // This part of the specification is the standard interface required
+ // for providing an operational TreeModel. These methods are used by
+ // the TreeView for display purpose. We just have to implement how
+ // we want the items to be displayed in the view.
+ // =================================================================
+ //
+ // MEM: note that these methods are not intended to be used
+ // directly. That's the job of the viewer to know how to use
+ // them. We just have to give the implementation for customizing the
+ // appearance of the tree. The implementation generally requests the
+ // items'data to set the appearance features.
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+
+ //
+ // =================================================================
+ // This part is a specific behavior to get a TreeModel that can
+ // organize itself the tree hierarchy using data provided in a
+ // filesystem-like format:
+ //
+ // data="a/b/c" ==> creation/filling of the hierarchy a->b->c
+ // The "folder" categories are unique whereas the leaves may exists
+ // in multiple instances.
+ // =================================================================
+ //
+ bool addData(DataObject * dataObject);
+ bool addData(DataObject * dataObject, const QStringList &path);
+
+ // TODO: We should implement the delete and the update fucntions
+
+ // This part contains helper functions for general purposes
+ TreeItem * getRootItem();
+
+private:
+ TreeItem *getItem(const QModelIndex &index = QModelIndex()) const;
+ TreeItem * _rootItem;
+};
+
+#endif // TREEMODEL_H
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#include "TreeObserver.hxx"
+#include "QtHelper.hxx"
+
+TreeObserver::TreeObserver() : QObject() {
+}
+
+/*!
+ * This declares the TreeView to be observed by this tree events
+ * listener.
+ */
+void TreeObserver::observe(TreeView * treeView) {
+ // We just connect the signals emitted from the treeview to
+ // corresponding slots of this observer.
+ connect(treeView, SIGNAL(itemListToProcess(QStringList,int)),
+ this, SLOT(processItemList(QStringList,int)));
+}
+
+/*!
+ * This slot should be implemented in a specialized version of
+ * TreeObserver to process the signal emitted from the TreeView. The
+ * parameters are:
+ * - itemNameIdList: the list of name identifiers of model objects
+ * associated to the selected qt items in the TreeView (ids for
+ * requesting directly the data model).
+ * - actionId: the identifier of the action selected in the popup menu
+ * that triggered this signal.
+ */
+void TreeObserver::processItemList(QStringList itemNameIdList, int actionId) {
+ LOG("TreeObserver::processItemList: signal received:\n"<<
+ "item list: "<<itemNameIdList<<"\n"<<
+ "action id: "<<actionId);
+}
+
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#ifndef _TREEOBSERVER_
+#define _TREEOBSERVER_
+
+#include "TreeData.hxx"
+
+#include <QObject>
+#include "TreeView.hxx"
+
+class TREEDATA_EXPORT TreeObserver : public QObject {
+
+ Q_OBJECT
+
+public:
+ TreeObserver();
+ void observe(TreeView * treeView);
+
+public slots:
+ /* These slots should be implemented in a specialized version of
+ the TreeObserver to process signals emitted from the TreeView */
+ virtual void processItemList(QStringList itemNameIdList, int actionId);
+};
+
+#endif // _TREEOBSERVER_
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+
+// include Qt
+#include <QString>
+#include <QMenu>
+#include <QModelIndex>
+#include <QAbstractItemView>
+
+// include Xcad
+#include "TreeView.hxx"
+#include "TreeModel.hxx"
+#include "TreeItem.hxx"
+#include "QtHelper.hxx"
+
+TreeView::TreeView(QWidget * parent)
+ : QTreeView(parent)
+{
+ // We authorize the multiple selection of items
+ this->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ _lastActionId = 0;
+
+ // Default actions for tests
+ int displayActionId = addAction(QObject::tr("Afficher"));
+ int editActionId = addAction(QObject::tr("Editer"));
+}
+
+TreeView::~TreeView() {
+}
+
+/*!
+ * This function defines a menu item to add in the popup menu
+ * associated to this TreeView, and return an integer that corresponds
+ * to the unique identifier of this action (identifier used in the
+ * signal emitted to notify observers that an action has been
+ * selected). Then the caller of this function has to take care of
+ * this return id (i.e. has to store it in its internal tables) to be
+ * able to process the notifications from this TreeView.
+ */
+int TreeView::addAction(QString label) {
+ QAction * action = new QAction(this);
+ int actionId = _lastActionId;
+ action->setObjectName(_idToName(actionId));
+ action->setText(label);
+ _listActions << action;
+ _lastActionId++;
+
+ return actionId;
+}
+
+/*!
+ * This function removes all actions previously defined for the popup
+ * menu of this TreeView.
+ */
+void TreeView::clearActions() {
+ _listActions.clear();
+}
+
+/*!
+ * You must use this function to create the name of an action object
+ * from its id.
+ */
+QString TreeView::_idToName(int actionId) {
+ return QString::number(actionId);
+}
+/*!
+ * You must use this function to create the id of an action object
+ * from its name (stored in objectName() attribute of the QAction).
+ */
+int TreeView::_nameToId(QString actionName) {
+ return actionName.toInt();
+}
+
+void TreeView::contextMenuEvent(QContextMenuEvent *event) {
+ if ( _listActions.size() == 0 ) {
+ // Just return there is no actions defined for this popup menu
+ return;
+ }
+
+ // _TODO_ display the QMenu only if the selected item is acceptable
+ QMenu menu(this);
+ for (int i = 0; i < _listActions.size(); ++i) {
+ menu.addAction(_listActions.at(i));
+ }
+ connect(&menu, SIGNAL(triggered(QAction*)),
+ this, SLOT(processMenuAction(QAction*)));
+
+ menu.exec(event->globalPos());
+}
+
+/*!
+ * This SLOT is connected on the signal emited by the menu when an
+ * action is selected.
+ */
+void TreeView::processMenuAction(QAction * actionSelected) {
+ LOG("processMenuAction: START");
+
+ // We first check than at least on item is selected
+ QModelIndexList indexList = this->selectionModel()->selectedRows(0);
+ if ( indexList.isEmpty() ) {
+ LOG("No item selected");
+ return;
+ }
+
+ // Then we can gather the list of model item ids associated the
+ // selection.
+ TreeModel *model = (TreeModel *)this->model();
+ QListIterator<QModelIndex> it(indexList);
+ QStringList nameIdList;
+ while (it.hasNext()) {
+ TreeItem * item = model->getItem(it.next());
+ nameIdList << item->nameId();
+ }
+
+ // Finally, one can emit a signal to observers specifying the list of
+ // id and the type of action (i.e. the action identifier)
+ int actionId = _nameToId(actionSelected->objectName());
+ LOG("TreeView::processMenuAction: signal emitted:\n"<<
+ "item list: "<<nameIdList<<"\n"<<
+ "action id: "<<actionId);
+ emit itemListToProcess(nameIdList, actionId);
+
+ LOG("processMenuAction: END");
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if 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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+
+#ifndef TREEVIEW_H
+#define TREEVIEW_H
+
+#include "TreeData.hxx"
+
+#include <QTreeView>
+#include <QAction>
+#include <QContextMenuEvent>
+#include <QList>
+
+class TREEDATA_EXPORT TreeView : public QTreeView
+{
+ Q_OBJECT
+
+public:
+ TreeView(QWidget * parent = 0 );
+ ~TreeView();
+ int addAction(QString label);
+ void clearActions();
+
+protected:
+ void contextMenuEvent(QContextMenuEvent *event);
+
+private:
+ int _lastActionId;
+ QList<QAction*> _listActions;
+ QString _idToName(int actionId);
+ int _nameToId(QString actionName);
+
+ // ---
+
+private slots:
+ void processMenuAction(QAction * actionSelected);
+
+signals:
+ void itemListToProcess(QStringList itemNameIdList, int actionId);
+};
+
+#endif // TREEVIEW_H
+
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = lib
-TARGET = VTKViewer
-DESTDIR = ../../lib
-MOC_DIR = ../../moc
-OBJECTS_DIR = ../../obj/$$TARGET
-
-VTKHOME = $$(VTKHOME)
-VTK_INCLUDES = $${VTKHOME}/include/vtk
-
-VTK_LIBS = -L$${VTKHOME}/lib/vtk -L$${VTKHOME}/lib/vtk/python -lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets -lGL -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lX11 -lXt
-
-CASROOT = $$(CASROOT)
-CAS_CPPFLAGS = $${CASROOT}/inc
-
-CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
-
-INCLUDEPATH += ../../include $${VTK_INCLUDES} $${CAS_CPPFLAGS} ../Qtx ../SUIT
-LIBS += -L../../lib -lqtx -lsuit $${VTK_LIBS} $${CAS_KERNEL}
-
-CONFIG -= debug release debug_and_release
-CONFIG += qt thread debug dll shared
-
-win32:DEFINES += WIN32
-DEFINES += VTKVIEWER_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
-
-HEADERS = VTKViewer.h
-HEADERS += VTKViewer_CellLocationsArray.h
-HEADERS += VTKViewer_Actor.h
-HEADERS += VTKViewer_ExtractUnstructuredGrid.h
-HEADERS += VTKViewer_ConvexTool.h
-HEADERS += VTKViewer_Filter.h
-HEADERS += VTKViewer_GeometryFilter.h
-HEADERS += VTKViewer_AppendFilter.h
-HEADERS += VTKViewer_Algorithm.h
-HEADERS += VTKViewer_InteractorStyle.h
-HEADERS += VTKViewer_RenderWindow.h
-HEADERS += VTKViewer_RenderWindowInteractor.h
-HEADERS += VTKViewer_ShrinkFilter.h
-HEADERS += VTKViewer_TransformFilter.h
-HEADERS += VTKViewer_Transform.h
-HEADERS += VTKViewer_Trihedron.h
-HEADERS += VTKViewer_Utilities.h
-HEADERS += VTKViewer_ViewManager.h
-HEADERS += VTKViewer_ViewModel.h
-HEADERS += VTKViewer_ViewWindow.h
-HEADERS += VTKViewer_Functor.h
-
-SOURCES = VTKViewer_CellLocationsArray.cxx
-SOURCES += VTKViewer_Actor.cxx
-SOURCES += VTKViewer_ExtractUnstructuredGrid.cxx
-SOURCES += VTKViewer_Filter.cxx
-SOURCES += VTKViewer_GeometryFilter.cxx
-SOURCES += VTKViewer_AppendFilter.cxx
-SOURCES += VTKViewer_InteractorStyle.cxx
-SOURCES += VTKViewer_RenderWindow.cxx
-SOURCES += VTKViewer_RenderWindowInteractor.cxx
-SOURCES += VTKViewer_ShrinkFilter.cxx
-SOURCES += VTKViewer_Transform.cxx
-SOURCES += VTKViewer_TransformFilter.cxx
-SOURCES += VTKViewer_Trihedron.cxx
-SOURCES += VTKViewer_Utilities.cxx
-SOURCES += VTKViewer_ViewManager.cxx
-SOURCES += VTKViewer_ViewModel.cxx
-SOURCES += VTKViewer_ConvexTool.cxx
-SOURCES += VTKViewer_ViewWindow.cxx
-
-TRANSLATIONS = resources/VTKViewer_images.ts \
- resources/VTKViewer_msg_en.ts
-
-ICONS = resources/*.png
-
-includes.files = $$HEADERS
-includes.path = ../../include
-
-resources.files = $$ICONS resources/*.qm
-resources.path = ../../resources
-
-INSTALLS += includes resources
+++ /dev/null
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// SALOME FILTER : interactive object for VISU entities implementation
-// File : SALOME_PassThroughFilter.cxx
-// Author : Laurent CORNABE with help of Nicolas REJNERI
-// Module : SALOME
-//
-#include "VTKViewer_PassThroughFilter.h"
-
-#include <vtkCellData.h>
-#include <vtkDataSet.h>
-#include <vtkObjectFactory.h>
-#include <vtkPointData.h>
-#include <vtkInformation.h>
-#include <vtkInformationVector.h>
-
-vtkCxxRevisionMacro(VTKViewer_PassThroughFilter, "$Revision$");
-vtkStandardNewMacro(VTKViewer_PassThroughFilter);
-
-/*! \class VTKViewer_PassThroughFilter
- * Passive filter take a dataset as input and create a dataset as output.\n
- * The form of the input geometry is not changed in these filters, \n
- * only the point attributes (e.g. scalars, vectors, etc.).
- */
-
-/*!Execute method.Output calculation.*/
-int VTKViewer_PassThroughFilter::RequestData(
- vtkInformation *,
- vtkInformationVector **inputVector,
- vtkInformationVector *outputVector)
-{
- // get the info objects
- vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
- vtkInformation *outInfo = outputVector->GetInformationObject(0);
-
- // get the input and ouptut
- vtkDataSet *input = vtkDataSet::SafeDownCast(
- inInfo->Get(vtkDataObject::DATA_OBJECT()));
- vtkDataSet *output = vtkDataSet::SafeDownCast(
- outInfo->Get(vtkDataObject::DATA_OBJECT()));
-
- // This has to be here because it initialized all field datas.
- output->CopyStructure( input );
-
- //! Pass all. (data object's field data is passed by the
- //! superclass after this method)
- output->GetPointData()->PassData( input->GetPointData() );
- output->GetCellData()->PassData( input->GetCellData() );
-
- return 1;
-}
-
-/*!Methods invoked by print to print information about the object including superclasses.\n
- * Typically not called by the user (use Print() instead) but used in the hierarchical \n
- * print process to combine the output of several classes.
- *\param os - output stream.
- */
-void VTKViewer_PassThroughFilter::PrintSelf(ostream& os, vtkIndent indent)
-{
- this->Superclass::PrintSelf(os,indent);
-}
+++ /dev/null
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef VTKVIEWER_PASSTHROUGHFILTER_H
-#define VTKVIEWER_PASSTHROUGHFILTER_H
-
-#include "VTKViewer.h"
-
-#include <vtkDataSetToDataSetFilter.h>
-
-class VTKVIEWER_EXPORT VTKViewer_PassThroughFilter : public vtkDataSetToDataSetFilter
-{
-public:
- vtkTypeRevisionMacro( VTKViewer_PassThroughFilter, vtkDataSetToDataSetFilter );
- void PrintSelf( ostream& os, vtkIndent indent );
-
- /*!Create a new VTKViewer_PassThroughFilter.*/
- static VTKViewer_PassThroughFilter *New();
-
-protected:
- VTKViewer_PassThroughFilter() {};//!< Null body.
- virtual ~VTKViewer_PassThroughFilter() {};//!< Null body.
-
- virtual int RequestData(vtkInformation *, vtkInformationVector **,
- vtkInformationVector *); //generate output data
-
-private:
- VTKViewer_PassThroughFilter( const VTKViewer_PassThroughFilter& ); //!< Not implemented.
- void operator=( const VTKViewer_PassThroughFilter& ); //!< Not implemented.
-};
-
-#endif
}
outPD->PassData(pd);
outCD->PassData(cd);
+ InvokeEvent("VTKViewer_TransformFilter::TransformationFinished");
return 1;
}
+++ /dev/null
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if 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
-#
-
-TEMPLATE = subdirs
-CONFIG += ordered
-
-SUBDIRS = Qtx
-SUBDIRS += DDS
-SUBDIRS += QDS
-SUBDIRS += SUIT
-SUBDIRS += SUITApp
-SUBDIRS += STD
-SUBDIRS += CAF
-SUBDIRS += CAM
-SUBDIRS += LogWindow
-SUBDIRS += PyInterp
-SUBDIRS += PyConsole
-SUBDIRS += Prs
-SUBDIRS += OBJECT
-SUBDIRS += GLViewer
-SUBDIRS += VTKViewer
-SUBDIRS += SVTK
-SUBDIRS += OCCViewer
-SUBDIRS += SOCC
-SUBDIRS += Plot2d
-SUBDIRS += SPlot2d
-SUBDIRS += SUPERVGraph
-SUBDIRS += QxGraph
-SUBDIRS += Event
-SUBDIRS += LightApp
-SUBDIRS += ResExporter
-SUBDIRS += TOOLSGUI
-SUBDIRS += SalomeApp
-SUBDIRS += Session
$(UIC_FILES_QDIALOG)
qtester_CPPFLAGS = \
- $(QT_CXXFLAGS)
+ $(QT_CXXFLAGS) \
+ -I.
qtester_LDFLAGS = \
$(QT_LIBS)
$(UIC_FILES_GDIALOG)
gtester_CPPFLAGS = \
- $(QT_CXXFLAGS)
+ $(QT_CXXFLAGS) \
+ -I@srcdir@ \
+ -I.
gtester_LDFLAGS = \
$(QT_LIBS)