From: admin Date: Wed, 28 Dec 2005 09:21:58 +0000 (+0000) Subject: This commit was generated by cvs2git to create branch 'BR-D5-38-2003'. X-Git-Tag: TG-D5-38-2003_D2005-29-12~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=445f27b67607c70256211c5843a90c9abac76501;p=modules%2Fvisu.git This commit was generated by cvs2git to create branch 'BR-D5-38-2003'. Cherrypick from master 2005-12-28 09:21:56 UTC jfa 'Join modifications from branch BR_3_1_0deb': INSTALL bin/VERSION build_configure doc/salome/tui/VISU/sources/static/tree.js resources/VISUCatalog.xml src/VISUGUI/VISU_msg_en.po src/VISUGUI/VisuGUI_CutLinesDlg.cxx src/VISUGUI/VisuGUI_CutPlanesDlg.cxx src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx src/VISUGUI/VisuGUI_DeformedShapeDlg.h src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx src/VISUGUI/VisuGUI_IsoSurfacesDlg.h src/VISUGUI/VisuGUI_StreamLinesDlg.cxx src/VISUGUI/VisuGUI_StreamLinesDlg.h src/VISUGUI/VisuGUI_VectorsDlg.cxx src/VISUGUI/VisuGUI_VectorsDlg.h src/VISU_SWIG/VISU_Example_01.py src/VISU_SWIG/VISU_Example_02.py src/VISU_SWIG/VISU_Example_04.py src/VISU_SWIG/VISU_Example_06.py --- diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..151559b0 --- /dev/null +++ b/INSTALL @@ -0,0 +1,5 @@ +This is the version 3.1.0 of VISU +Compatible with : + - KERNEL 3.1.0 + - SALOMEGUI 3.1.0 + - MED 3.1.0 diff --git a/bin/VERSION b/bin/VERSION new file mode 100755 index 00000000..12ccd0e5 --- /dev/null +++ b/bin/VERSION @@ -0,0 +1 @@ +THIS IS SALOME - VISU VERSION: 3.1.0 diff --git a/build_configure b/build_configure new file mode 100755 index 00000000..05354d02 --- /dev/null +++ b/build_configure @@ -0,0 +1,217 @@ +#!/bin/bash + +# +# Tool for updating list of .in file for the SALOME project +# and regenerating configure script +# +# Author : Marc Tajchman - CEA +# Date : 10/10/2002 +# $Header$ +# + +ORIG_DIR=`pwd` +CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` + +######################################################################## +# Test if the KERNEL_ROOT_DIR is set correctly + +if test ! -d "${KERNEL_ROOT_DIR}"; then + echo "failed : KERNEL_ROOT_DIR variable is not correct !" + exit +fi + +# Test if the KERNEL_SRC is set correctly + +#if test ! -d "${KERNEL_SRC}"; then +# echo "failed : KERNEL_SRC variable is not correct !" +# exit +#fi +######################################################################## +# find_in - utility function +# +# usage : +# find_in directory filename +# +# Finds files following the *.in pattern, recursively in the +# directory (first argument). +# Results are appended into the file (second argument) +# +# Difference from the standard unix find is that files are tested +# before directories +# + +find_in() +{ + local i + local f=$2 + +# if the first argument is not a directory, returns + + if [ ! -d "$1" ] ; then + return + fi + +# dont look in the CVS directories + + case $1 in + */CVS) return ;; + */adm_local/*) return ;; + *) ;; + esac + +# for each regular file contained in the directory +# test if it's a .in file + + for i in "$1"/* + do + if [ -f "$i" ] ; then + case $i in + *.in) echo " "$i" \\" >> $f;; + *) ;; + esac + fi + done + +# for each subdirectory of the first argument, proceeds recursively + + for i in "$1"/* + do + if [ -d "$i" ] ; then + find_in "$i" "$f" + fi + done +} + + +####################################################################### +# Generate list of .in files (Makefile.in, config.h.in, etc) +# appending it in file configure.in + +cd ${CONF_DIR} +ABS_CONF_DIR=`pwd` + +# +# Common part of the configure.in file +# +chmod u+w configure.in.base +if ! \cp -f configure.in.base configure.in_tmp1 +then + echo + echo "error : can't create files in" ${CONF_DIR} + echo "aborting ..." + chmod u-w configure.in.base + exit +fi +chmod u-w configure.in.base + +if [ -e "${CONF_DIR}/salome_adm" ] ; then + \rm -f ${CONF_DIR}/salome_adm +fi + + +# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files +echo "" >> configure.in_tmp1 +echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1 + +echo "" >> configure.in_tmp1 +echo "AC_OUTPUT([ \\" >> configure.in_tmp1 + +# +# List of .in files in the adm/unix directory +# These files MUST be on top of AC_OUTPUT list so we +# put them "manually" +# + +echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 + +\rm -f configure.in_tmp2 configure.in_tmp3 +touch configure.in_tmp2 +find_in . configure.in_tmp2 +sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 > configure.in_tmp2 +sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 +#sed '/^.*salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +#sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +#sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 + +echo "])" >> configure.in_tmp1 + +# delete the link created for AC_OUTPUT +#echo "" >> configure.in_tmp1 +#echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1 +\mv configure.in_tmp1 configure.in_new +\rm -f configure.in_tmp2 configure.in_tmp3 + + +######################################################################## +# Create new (or replace old) configure.in file +# Print a message if the file is write protected +# + +echo +if test ! -f configure.in +then + echo -n "Creating new file 'configure.in' ... " + if \mv configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo "error, check your file permissions" + fi +else + echo -n "Updating 'configure.in' file ... " + if ! \cp configure.in configure.in_old >& /dev/null + then + echo + echo + echo "Can't backup previous configure.in" + echo -n "Continue (you will not be able to revert) - (Y/N) ? " + read R + case "x$R" in + xn*) exit;; + xN*) exit;; + esac + echo + echo -n " " + fi + if \cp configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo + echo "error, can't update previous configure.in" + fi +fi + +######################################################################## +# Use autoconf to rebuild the configure script +# + +if test -f configure +then + echo -n "Updating 'configure' script ... " +else + echo -n "Creating 'configure' script ... " +fi + +aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files +if autoconf +then + echo "done" +else + echo "failed (check file permissions and/or user quotas ...)" +fi + +cd ${ORIG_DIR} + +echo diff --git a/doc/salome/tui/VISU/sources/static/tree.js b/doc/salome/tui/VISU/sources/static/tree.js new file mode 100755 index 00000000..55430919 --- /dev/null +++ b/doc/salome/tui/VISU/sources/static/tree.js @@ -0,0 +1,85 @@ +foldersTree = gFld("SALOME v.3.1.0 ", "", "") + insDoc(foldersTree, gLnk("Main Page", "", "main.html")) + +aux1 = insFld(foldersTree, gFld("TUI Reference Guide", "")) + aux2 = insFld(aux1, gFld("Modules", "")) + aux3 = insFld(aux2, gFld("SALOME VISU module", "")) + insDoc(aux3, gLnk("Overview", "", "overview_VISU.html")) + aux4 = insFld(aux3, gFld("Packages", "")) + insDoc(aux4, gLnk("VISU", "", "namespaceVISU.html")) + insDoc(aux3, gLnk("Examples", "", "examples_VISU.html")) + + +/*! Data structures +*/ + insDoc(aux1, gLnk("Data Structures", "", "annotated.html")) + +/*! insDoc(aux1, gLnk("VISU::Animation", "", "interfaceVISU_1_1Animation.html")) + insDoc(aux1, gLnk("VISU::Base", "", "interfaceVISU_1_1Base.html")) + insDoc(aux1, gLnk("VISU::Container", "", "interfaceVISU_1_1Container.html")) + insDoc(aux1, gLnk("VISU::Curve", "", "interfaceVISU_1_1Curve.html")) + insDoc(aux1, gLnk("VISU::CutLines", "", "interfaceVISU_1_1CutLines.html")) + insDoc(aux1, gLnk("VISU::CutPlanes", "", "interfaceVISU_1_1CutPlanes.html")) + insDoc(aux1, gLnk("VISU::DeformedShape", "", "interfaceVISU_1_1DeformedShape.html")) + insDoc(aux1, gLnk("VISU::IsoSurfaces", "", "interfaceVISU_1_1IsoSurfaces.html")) + insDoc(aux1, gLnk("VISU::Mesh", "", "interfaceVISU_1_1Mesh.html")) + insDoc(aux1, gLnk("VISU::Prs3d", "", "interfaceVISU_1_1Prs3d.html")) + insDoc(aux1, gLnk("VISU::PrsObject", "", "interfaceVISU_1_1PrsObject.html")) + insDoc(aux1, gLnk("VISU::Result", "", "interfaceVISU_1_1Result.html")) + insDoc(aux1, gLnk("VISU::ScalarMap", "", "interfaceVISU_1_1ScalarMap.html")) + insDoc(aux1, gLnk("VISU::StreamLines", "", "interfaceVISU_1_1StreamLines.html")) + insDoc(aux1, gLnk("VISU::Table", "", "interfaceVISU_1_1Table.html")) + insDoc(aux1, gLnk("VISU::TableView", "", "interfaceVISU_1_1TableView.html")) + insDoc(aux1, gLnk("VISU::Vectors", "", "interfaceVISU_1_1Vectors.html")) + insDoc(aux1, gLnk("VISU::View", "", "interfaceVISU_1_1View.html")) + insDoc(aux1, gLnk("VISU::View3D", "", "interfaceVISU_1_1View3D.html")) + insDoc(aux1, gLnk("VISU::ViewManager", "", "interfaceVISU_1_1ViewManager.html")) + insDoc(aux1, gLnk("VISU::VISU_Gen", "", "interfaceVISU_1_1VISU__Gen.html")) + insDoc(aux1, gLnk("VISU::XYPlot", "", "interfaceVISU_1_1XYPlot.html")) +*/ + insDoc(aux1, gLnk("Class Hierarchy", "", "hierarchy.html")) + +/*! + aux2 = insFld(aux1, gFld("VISU::Base", "", "interfaceVISU_1_1Base.html")) + insDoc(aux2, gLnk("VISU::Animation", "", "interfaceVISU_1_1Animation.html")) + aux3 = insFld(aux2, gFld("VISU::PrsObject", "", "interfaceVISU_1_1PrsObject.html")) + insDoc(aux3, gLnk("VISU::Container", "", "interfaceVISU_1_1Container.html")) + insDoc(aux3, gLnk("VISU::Curve", "", "interfaceVISU_1_1Curve.html")) + aux4 = insFld(aux3, gFld("VISU::Prs3d", "", "interfaceVISU_1_1Prs3d.html")) + insDoc(aux4, gLnk("VISU::Mesh", "", "interfaceVISU_1_1Mesh.html")) + aux5 = insFld(aux4, gFld("VISU::ScalarMap", "", "interfaceVISU_1_1ScalarMap.html")) + insDoc(aux5, gLnk("VISU::CutLines", "", "interfaceVISU_1_1CutLines.html")) + insDoc(aux5, gLnk("VISU::CutPlanes", "", "interfaceVISU_1_1CutPlanes.html")) + aux6 = insFld(aux5, gFld("VISU::DeformedShape", "", "interfaceVISU_1_1DeformedShape.html")) + insDoc(aux6, gLnk("VISU::StreamLines", "", "interfaceVISU_1_1StreamLines.html")) + insDoc(aux6, gLnk("VISU::Vectors", "", "interfaceVISU_1_1Vectors.html")) + insDoc(aux5, gLnk("VISU::IsoSurfaces", "", "interfaceVISU_1_1IsoSurfaces.html")) + insDoc(aux3, gLnk("VISU::Table", "", "interfaceVISU_1_1Table.html")) + insDoc(aux2, gLnk("VISU::Result", "", "interfaceVISU_1_1Result.html")) + aux3 = insFld(aux2, gFld("VISU::View", "", "interfaceVISU_1_1View.html")) + insDoc(aux3, gLnk("VISU::TableView", "", "interfaceVISU_1_1TableView.html")) + insDoc(aux3, gLnk("VISU::View3D", "", "interfaceVISU_1_1View3D.html")) + insDoc(aux3, gLnk("VISU::XYPlot", "", "interfaceVISU_1_1XYPlot.html")) + insDoc(aux2, gLnk("VISU::ViewManager", "", "interfaceVISU_1_1ViewManager.html")) + insDoc(aux2, gLnk("VISU::VISU_Gen", "", "interfaceVISU_1_1VISU__Gen.html")) + insDoc(aux2, gLnk("VISU::VISU_Gen", "", "interfaceVISU_1_1VISU__Gen.html")) + insDoc(aux2, gLnk("VISU::VISU_Gen", "", "interfaceVISU_1_1VISU__Gen.html")) +*/ + insDoc(aux1, gLnk("Class methods list", "", "functions.html")) +/*! +aux1 = insFld(foldersTree, gFld("Namespace List", "", "namespaces.html")) + insDoc(aux1, gLnk("VISU", "", "namespaceVISU.html")) +*/ + insDoc(aux1, gLnk("Namespace Members", "", "namespacemembers.html")) + + insDoc(aux1, gLnk("File List", "", "files.html")) + +/*! + insDoc(aux1, gLnk("VISU_Gen.idl", "", "VISU__Gen_8idl.html")) +*/ + +aux1 = insFld(foldersTree, gFld("IDL/Python mapping", "")) + insDoc(aux1, gLnk("Mapping of VISU IDL definitions to Python language", "", "page2.html")) + +/*! insDoc(foldersTree, gLnk("Graphical Class Hierarchy", "", "inherits.html")) +*/ diff --git a/resources/VISUCatalog.xml b/resources/VISUCatalog.xml new file mode 100644 index 00000000..32e2edb5 --- /dev/null +++ b/resources/VISUCatalog.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + VISU + Post-Pro + VISU + NRI + 3.1.0 + Post-Pro component + 1 + ModuleVisu.png + hostname = localhost + + + diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po new file mode 100644 index 00000000..e25236e9 --- /dev/null +++ b/src/VISUGUI/VISU_msg_en.po @@ -0,0 +1,1246 @@ +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2002-02-22 16:56:46 CET\n" +"PO-Revision-Date: 2005-06-27 12:38+0400\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +msgid "BUT_OK" +msgstr "OK" + +msgid "BUT_APPLY" +msgstr "Apply" + +msgid "BUT_CLOSE" +msgstr "Close" + +msgid "BUT_CANCEL" +msgstr "Cancel" + +msgid "WRN_VISU" +msgstr "Post-Pro Warning" + +msgid "WRN_VISU_WARNING" +msgstr "Warning" + +msgid "INF_DONE" +msgstr " done" + +msgid "WRN_STUDY_LOCKED" +msgstr "Current Study is locked" + +msgid "WRN_NO_AVAILABLE_DATA" +msgstr "No Available data in selection" + +msgid "ERR_CANT_FIND_VISU_COMPONENT" +msgstr "Failed to activate VISU engine!" + +msgid "ERR_CANT_FIND_MED_COMPONENT" +msgstr "Failed to activate MED engine!" + +msgid "ERR_CANT_BUILD_PRESENTATION" +msgstr "The object can't be built" + +msgid "ERR_CANT_CREATE_ACTOR" +msgstr "Can't create actor for this presentation" + +# Preferences for VISU module (VisuGUI.cxx) + +msgid "VISU_SCALAR_BAR" +msgstr "Scalar Bar" + +msgid "VISU_FONT" +msgstr "Font" + +msgid "VISU_FONT_ARIAL" +msgstr "Arial" + +msgid "VISU_FONT_COURIER" +msgstr "Courier" + +msgid "VISU_FONT_TIMES" +msgstr "Times" + +msgid "VISU_TITLE" +msgstr "Title" + +msgid "VISU_LABELS" +msgstr "Labels" + +msgid "VISU_COLORS_AND_LABELS" +msgstr "Colors && Labels" + +msgid "VISU_NB_COLORS" +msgstr "Nb. of colors" + +msgid "VISU_NB_LABELS" +msgstr "Nb. of labels" + +msgid "VISU_ORIENTATION" +msgstr "Orientation" + +msgid "VISU_VERTICAL" +msgstr "Vertical" + +msgid "VISU_HORIZONTAL" +msgstr "Horizontal" + +msgid "VISU_ORIGIN_AND_SIZE" +msgstr "Origin && Size" + +msgid "VISU_X" +msgstr "X:" + +msgid "VISU_Y" +msgstr "Y:" + +msgid "VISU_WIDTH" +msgstr "Width:" + +msgid "VISU_HEIGHT" +msgstr "Height:" + +msgid "VISU_PREF_SECOND_TAB" +msgstr "Scalar range, Sweep, MED import, Shading" + +msgid "VISU_SCALAR_RANGE" +msgstr "Scalar range" + +msgid "VISU_SCALAR_MODE" +msgstr "Scalar mode" + +msgid "VISU_MODULUS" +msgstr "Modulus" + +msgid "VISU_COMPONENT" +msgstr "Component" + +msgid "VISU_LOGARITHMIC_SCALING" +msgstr "Logarithmic scaling" + +msgid "VISU_RANGE_TO_USE" +msgstr "Range to use" + +msgid "VISU_FIELD_RANGE" +msgstr "Field range" + +msgid "VISU_IMPOSED_RANGE" +msgstr "Imposed range" + +msgid "VISU_MINMAX_IMPOSED_RANGE" +msgstr "Min and max for imposed range" + +msgid "VISU_MIN" +msgstr "Min:" + +msgid "VISU_MAX" +msgstr "Max:" + +msgid "VISU_SWEEPING_PREF" +msgstr "Sweeping preferences" + +msgid "VISU_TIME_STEP" +msgstr "Time step(second)" + +msgid "VISU_NB_CYCLES" +msgstr "Number of cycles" + +msgid "VISU_NB_STEPS" +msgstr "Number of steps" + +msgid "VISU_PREF_MED_IMPORT" +msgstr "MED files import" + +msgid "VISU_PREF_MED_FULL_LOAD" +msgstr "Full MED loading" + +msgid "VISU_PREF_REPRESENT_PROPS" +msgstr "Representation properties" + +msgid "VISU_PREF_SHADING" +msgstr "Use Shading" + +#: VisuGUI.cxx + +msgid "VisuGUI::MEN_IMPORT_FROM_FILE" +msgstr "Import from File" + +msgid "VisuGUI::MEN_EXPLORE_MED_FILE" +msgstr "Explore MED File" + +msgid "VisuGUI::MEN_IMPORT_TABLE" +msgstr "Import table from File" + +msgid "VisuGUI::MEN_SCALAR_MAP" +msgstr "Scalar Map" + +msgid "VisuGUI::MEN_DEFORMED_SHAPE" +msgstr "Deformed Shape" + +msgid "VisuGUI::MEN_VISUALIZATION" +msgstr "Visualization" + +msgid "VisuGUI::TOOL_VISUALISATION" +msgstr "Visualization Toolbar" + +msgid "VisuGUI::TOOL_REPRESENTATION" +msgstr "Representation Toolbar" + +msgid "VisuGUI::MEN_SHOW_ANIMATION" +msgstr "Show..." + +msgid "VisuGUI::MEN_ANIMATION" +msgstr "Animation..." + +msgid "VisuGUI::MEN_CELL_COLOR" +msgstr "Cell color" + +msgid "VisuGUI::MEN_CLEAR_CONTAINER" +msgstr "Clear" + +msgid "VisuGUI::MEN_COLOR" +msgstr "Color..." + +msgid "VisuGUI::MEN_CREATE_CURVES" +msgstr "Create Curves" + +msgid "VisuGUI::MEN_CREATE_MANY_PRS" +msgstr "Create Presentations" + +msgid "VisuGUI::MEN_CREATE_PLOT2D" +msgstr "Create Plot2d View" + +msgid "VisuGUI::MEN_CREATE_PRS" +msgstr "Create Presentation" + +msgid "VisuGUI::MEN_CREATE_TABLE" +msgstr "Create Table" + +msgid "VisuGUI::MEN_CURVE_PROPS" +msgstr "Properties..." + +msgid "VisuGUI::MEN_CUT_LINES" +msgstr "Cut Lines" + +msgid "VisuGUI::MEN_CUT_PLANES" +msgstr "Cut Planes" + +msgid "VisuGUI::MEN_DISPLAY" +msgstr "Display" + +msgid "VisuGUI::MEN_DISPLAY_ONLY" +msgstr "Display Only" + +msgid "VisuGUI::MEN_EDGE_COLOR" +msgstr "Edge Color" + +msgid "VisuGUI::MEN_EDIT_CONTAINER" +msgstr "Edit..." + +msgid "VisuGUI::MEN_EDIT_PRS" +msgstr "Edit..." + +msgid "VisuGUI::MEN_ERASE" +msgstr "Erase" + +msgid "VisuGUI::MEN_EXPORT_TABLE" +msgstr "Export Table" + +msgid "VisuGUI::MEN_INSIDEFRAME" +msgstr "Insideframe" + +msgid "VisuGUI::MEN_ISO_SURFACES" +msgstr "Iso Surfaces" + +msgid "VisuGUI::MEN_LINE_WIDTH" +msgstr "Line Width" + +msgid "VisuGUI::MEN_OPACITY" +msgstr "Opacity" + +msgid "VisuGUI::MEN_POINTS" +msgstr "Points" + +msgid "VisuGUI::MEN_PROPERTIES" +msgstr "Properties" + +msgid "VisuGUI::MEN_RENAME" +msgstr "Rename..." + +msgid "VisuGUI::MEN_RENAME_CONTAINER" +msgstr "Rename..." + +msgid "VisuGUI::MEN_RENAME_TABLE" +msgstr "Rename..." + +msgid "VisuGUI::MEN_REPRESENTATION" +msgstr "Representation" + +msgid "VisuGUI::MEN_SELECTION_INFO" +msgstr "Selection Info..." + +msgid "VisuGUI::MEN_SHOW_TABLE" +msgstr "Show Table" + +msgid "VisuGUI::MEN_SHRINK" +msgstr "Shrink" + +msgid "VisuGUI::MEN_SHADING" +msgstr "Shading On" + +msgid "VisuGUI::MEN_NOSHADING" +msgstr "Shading Off" + +msgid "VisuGUI::MEN_STREAM_LINES" +msgstr "Stream Lines" + +msgid "VisuGUI::MEN_SURFACE" +msgstr "Surface" + +msgid "VisuGUI::MEN_SURFACEFRAME" +msgstr "Surfaceframe" + +msgid "VisuGUI::MEN_SWEEP" +msgstr "Sweep" + +msgid "VisuGUI::MEN_UNSHRINK" +msgstr "Unshrink" + +msgid "VisuGUI::MEN_VECTORS" +msgstr "Vectors" + +msgid "VisuGUI::MEN_WIREFRAME" +msgstr "Wireframe" + +msgid "VisuGUI::MEN_DELETE_VIEWPARAMS" +msgstr "Delete view parameters" + +msgid "VisuGUI::MEN_RESTORE_VIEWPARAMS" +msgstr "Restore view parameters" + +msgid "VisuGUI::MEN_SAVE_VIEWPARAMS" +msgstr "Save view parameters" + +msgid "VisuGUI::MEN_COPY_PRS" +msgstr "Copy" + +msgid "VisuGUI::MEN_SELECTION" +msgstr "Selection" + +msgid "VisuGUI::MEN_DISPLAY_SELECTION" +msgstr "Display Selection" + +msgid "VisuGUI::MEN_ERASE_ALL" +msgstr "Erase All" + +msgid "VisuGUI::MEN_SCALING" +msgstr "Scaling" + +msgid "VisuGUI::MEN_CUBE_AXES" +msgstr "Graduated axes" + +msgid "VisuGUI::MEN_GLOBAL_SELECTION" +msgstr "Global Selection" + +msgid "VisuGUI::MEN_PARTIAL_SELECTION" +msgstr "Partial Selection" + +msgid "VisuGUI::MEN_IMPORT_MED_STRUCTURE" +msgstr "Import Structure" + +msgid "VisuGUI::MEN_IMPORT_MED_TIMESTAMP" +msgstr "Import TimeStamp" + +msgid "VisuGUI::MEN_IMPORT_MED_FIELD" +msgstr "Import Field" + +msgid "VisuGUI::MEN_DELETE_OBJS" +msgstr "Delete" + +msgid "VisuGUI::MEN_PLOT_3D" +msgstr "Plot3D" + +msgid "VisuGUI::MEN_TRANSLATE_PRS" +msgstr "Translate Presentation" + +msgid "VisuGUI::MEN_CLIPPING" +msgstr "Clipping planes" + +msgid "VisuGUI::MEN_MERGE_SCALAR_BARS" +msgstr "Merge Scalar Range" + +msgid "VisuGUI::MEN_FREE_SCALAR_BARS" +msgstr "Use Field Range" + +msgid "VisuGUI::MEN_ARRANGE_ACTORS" +msgstr "Arrange Actors" + + +msgid "VisuGUI::ERR_ERROR_IN_THE_FILE" +msgstr "Error in the file" + +msgid "VisuGUI::ERR_ERROR_DURING_EXPORT" +msgstr "Error has been occured during exporting to file" + +msgid "VisuGUI::ERR_ACTIVATE_VIEW3D" +msgstr "Please activate 3D view before" + + +msgid "VisuGUI::FLT_ALL_FILES" +msgstr "All Files (*.*)" + +msgid "VisuGUI::FLT_MED_FILES" +msgstr "MED Files (*.med)" + +msgid "VisuGUI::FLT_TABLE_FILES" +msgstr "Tables (*.xls *.txt *.tab)" + + +msgid "VisuGUI::DLG_OPACITY_TITLE" +msgstr "Opacity" + +msgid "VisuGUI::DLG_OPACITY_CMT1" +msgstr "Set value between" + +msgid "VisuGUI::DLG_OPACITY_CMT2" +msgstr "0 (transparent) and 100 (opaque)" + +msgid "VisuGUI::DLG_LINEWIDTH_TITLE" +msgstr "Line Width" + +msgid "VisuGUI::DLG_LINEWIDTH_CMT1" +msgstr "Set value between" + +msgid "VisuGUI::DLG_LINEWIDTH_CMT2" +msgstr "1 (thin) and 10 (thick)" + + +#: VisuGUI_CursorDlg.cxx + +msgid "VisuGUI_CursorDlg::&OK" +msgstr "" + +msgid "VisuGUI_CursorDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_CursorDlg::TextLabel1" +msgstr "Set value between" + +msgid "VisuGUI_CursorDlg::TextLabel2" +msgstr "minimal and maximal" + + +#: VisuGUI_CutLinesDlg.cxx + +msgid "VisuGUI_CutLinesDlg::LBL_INVERT_CURVES" +msgstr "Invert all curves" + +msgid "VisuGUI_CutLinesDlg::LBL_GENERATE_CURVES" +msgstr "Generate Curves" + +msgid "VisuGUI_CutLinesDlg::LBL_GENERATE_TABLE" +msgstr "Generate Data Table" + +msgid "VisuGUI_CutLinesDlg::LBL_LINES_CUT" +msgstr "Cut planes" +#?msgstr "Cut lines" + +msgid "VisuGUI_CutLinesDlg::LBL_LINES_PLANE" +msgstr "Plane of lines" + +msgid "VisuGUI_CutLinesDlg::LBL_NB_PLANS" +msgstr "Number of planes:" + +msgid "VisuGUI_CutLinesDlg::LBL_POS" +msgstr "Displacement (0...1):" + +msgid "VisuGUI_CutLinesDlg::LBL_ROTATION" +msgstr "Rotations" + +msgid "VisuGUI_CutLinesDlg::LBL_ROT_X" +msgstr "Rotation around X (Y to Z):" + +msgid "VisuGUI_CutLinesDlg::LBL_ROT_Y" +msgstr "Rotation around Y (Z to X):" + +msgid "VisuGUI_CutLinesDlg::LBL_ROT_Z" +msgstr "Rotation around Z (X to Y):" + +msgid "VisuGUI_CutLinesDlg::LBL_SHOW_PREVIEW" +msgstr "Show preview" + +msgid "VisuGUI_CutLinesDlg::TXT_ORIENTATION" +msgstr "Orientation" + +msgid "VisuGUI_CutLinesDlg::BASE_PLANE_POS" +msgstr "Base plane position" + +msgid "VisuGUI_CutLinesDlg::SET_DEFAULT" +msgstr "Set default" + +msgid "VisuGUI_CutLinesDlg::PARALLEL_XOY" +msgstr "|| X-Y" + +msgid "VisuGUI_CutLinesDlg::PARALLEL_YOZ" +msgstr "|| Y-Z" + +msgid "VisuGUI_CutLinesDlg::PARALLEL_ZOX" +msgstr "|| Z-X" + + +#: VisuGUI_CutPlanesDlg.cxx + +msgid "VisuGUI_CutPlanesDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_CutPlanesDlg::&OK" +msgstr "" + +msgid "VisuGUI_CutPlanesPane::PARALLEL_XOY" +msgstr "// X-Y" + +msgid "VisuGUI_CutPlanesPane::PARALLEL_YOZ" +msgstr "// Y-Z" + +msgid "VisuGUI_CutPlanesPane::PARALLEL_ZOX" +msgstr "// Z-X" + +msgid "VisuGUI_CutPlanesPane::LBL_POS" +msgstr "Displacement (0...1):" + +msgid "VisuGUI_CutPlanesPane::LBL_SHOW_PREVIEW" +msgstr "Show preview" + +msgid "VisuGUI_CutPlanesPane::LBL_NB_PLANS" +msgstr "Number of planes:" + +msgid "VisuGUI_CutPlanesPane::TXT_ORIENTATION" +msgstr "Orientation" + +msgid "VisuGUI_CutPlanesPane::LBL_ROT_X" +msgstr "Rotation around X (Y to Z):" + +msgid "VisuGUI_CutPlanesPane::LBL_ROT_Y" +msgstr "Rotation around Y (Z to X):" + +msgid "VisuGUI_CutPlanesPane::LBL_ROT_Z" +msgstr "Rotation around Z (X to Y):" + +msgid "VisuGUI_CutPlanesPane::LBL_ROTATION" +msgstr "Rotations" + + +#: VisuGUI_DeformedShapeDlg.cxx + +msgid "VisuGUI_DeformedShapeDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_DeformedShapeDlg::&OK" +msgstr "" + +msgid "VisuGUI_DeformedShapeDlg::DLG_TITLE" +msgstr "Deformed Shape" + +msgid "VisuGUI_DeformedShapeDlg::DEFORMED_SHAPE_TAB" +msgstr "Deformed Shape" + +msgid "VisuGUI_DeformedShapeDlg::SCALAR_BAR_TAB" +msgstr "Scalar Bar" + +msgid "VisuGUI_DeformedShapeDlg::MAGNITUDE_COLORING" +msgstr "Magnitude coloring" + +msgid "VisuGUI_DeformedShapeDlg::SCALE_FACTOR" +msgstr "Scale Factor:" + + +#: VisuGUI_EditContainerDlg.cxx + +msgid "VisuGUI_EditContainerDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_EditContainerDlg::&OK" +msgstr "" + +msgid "VisuGUI_EditContainerDlg::LBL_STUDY" +msgstr "Study" + +msgid "VisuGUI_EditContainerDlg::LBL_CONTAINER" +msgstr "Container" + +msgid "VisuGUI_EditContainerDlg::TXT_TABLE" +msgstr "Table" + +msgid "VisuGUI_EditContainerDlg::TXT_CURVE" +msgstr "Curve" + + +#: VisuGUI_FileDlg.cxx + +msgid "VisuGUI_FileDlg::FULL_LOAD" +msgstr "Full loading for current file" + + +#: VisuGUI_IsoSurfacesDlg.cxx + +msgid "VisuGUI_IsoSurfacesDlg::&OK" +msgstr "" + +msgid "VisuGUI_IsoSurfacesDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_IsoSurfPane::MSG_MINMAX_VALUES" +msgstr "Min value can not be higher or equal to Max value" + +msgid "VisuGUI_IsoSurfPane::MAX_VALUE" +msgstr "Maximum value:" + +msgid "VisuGUI_IsoSurfPane::MIN_VALUE" +msgstr "Minimum value:" + +msgid "VisuGUI_IsoSurfPane::NB_SURFACES" +msgstr "Number of surfaces:" + +msgid "VisuGUI_IsoSurfacesDlg::DEFINE_ISOSURFACES" +msgstr "Iso Surfaces Definition" + + +#: VisuGUI_NonIsometricDlg.cxx + +msgid "VisuGUI_NonIsometricDlg::O&K" +msgstr "" + +msgid "VisuGUI_NonIsometricDlg::&Apply" +msgstr "" + +msgid "VisuGUI_NonIsometricDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_NonIsometricDlg::&Reset" +msgstr "" + +msgid "VisuGUI_NonIsometricDlg::DLG_TITLE" +msgstr "Scaling" + +msgid "VisuGUI_NonIsometricDlg::LBL_X" +msgstr "X :" + +msgid "VisuGUI_NonIsometricDlg::LBL_Y" +msgstr "Y :" + +msgid "VisuGUI_NonIsometricDlg::LBL_Z" +msgstr "Z :" + + +#: VisuGUI_ScalarBarDlg.cxx + +msgid "VisuGUI_ScalarBarDlg::&OK" +msgstr "" + +msgid "VisuGUI_ScalarBarDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_ScalarBarDlg::DLG_PREF_TITLE" +msgstr "Scalar Bar Preferences" + +msgid "VisuGUI_ScalarBarDlg::DLG_PROP_TITLE" +msgstr "Scalar Bar Properties" + +msgid "VisuGUI_ScalarBarPane::SCALAR_RANGE_GRP" +msgstr "Scalar range" + +msgid "VisuGUI_ScalarBarPane::LOGARITHMIC_SCALING" +msgstr "Logarithmic scaling" + +msgid "VisuGUI_ScalarBarPane::FIELD_RANGE_BTN" +msgstr "Use field range" + +msgid "VisuGUI_ScalarBarPane::IMPOSED_RANGE_BTN" +msgstr "Use imposed range" + +msgid "VisuGUI_ScalarBarPane::LBL_MIN" +msgstr "Min:" + +msgid "VisuGUI_ScalarBarPane::LBL_MAX" +msgstr "Max:" + +msgid "VisuGUI_ScalarBarPane::COLORS_LABELS_GRP" +msgstr "Colors and labels" + +msgid "VisuGUI_ScalarBarPane::LBL_NB_COLORS" +msgstr "Nb. of colors:" + +msgid "VisuGUI_ScalarBarPane::LBL_NB_LABELS" +msgstr "Nb. of labels:" + +msgid "VisuGUI_ScalarBarPane::ORIENTATION_GRP" +msgstr "Orientation" + +msgid "VisuGUI_ScalarBarPane::VERTICAL_BTN" +msgstr "Vertical" + +msgid "VisuGUI_ScalarBarPane::HORIZONTAL_BTN" +msgstr "Horizontal" + +msgid "VisuGUI_ScalarBarPane::ORIGIN_GRP" +msgstr "Origin" + +msgid "VisuGUI_ScalarBarPane::LBL_X" +msgstr "X:" + +msgid "VisuGUI_ScalarBarPane::LBL_Y" +msgstr "Y:" + +msgid "VisuGUI_ScalarBarPane::LBL_SHOW_PREVIEW" +msgstr "Show preview" + +msgid "VisuGUI_ScalarBarPane::DIMENSIONS_GRP" +msgstr "Dimensions" + +msgid "VisuGUI_ScalarBarPane::LBL_WIDTH" +msgstr "Width:" + +msgid "VisuGUI_ScalarBarPane::LBL_HEIGHT" +msgstr "Height:" + +msgid "VisuGUI_ScalarBarPane::SAVE_DEFAULT_CHK" +msgstr "Save as default values" + +msgid "VisuGUI_ScalarBarPane::MSG_MINMAX_VALUES" +msgstr "Min value can not be higher or equal to Max value" + +msgid "VisuGUI_ScalarBarPane::WRN_LOGARITHMIC_RANGE" +msgstr "Logarithmic scaling: use imposed range values > 0" + +msgid "VisuGUI_ScalarBarPane::WRN_LOGARITHMIC_FIELD_RANGE" +msgstr "Logarithmic scaling: field range contains negative values, use imposed range instead" + +msgid "VisuGUI_TextPrefDlg::&OK" +msgstr "" + +msgid "VisuGUI_TextPrefDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_TextPrefDlg::TIT_TEXT_PREF" +msgstr "Text property" + +msgid "VisuGUI_TextPrefDlg::LBL_TITLE" +msgstr "Title" + +msgid "VisuGUI_TextPrefDlg::LBL_BOLD" +msgstr "Bold" + +msgid "VisuGUI_TextPrefDlg::LBL_ITALIC" +msgstr "Italic" + +msgid "VisuGUI_TextPrefDlg::LBL_SHADOW" +msgstr "Shadow" + +msgid "VisuGUI_TextPrefDlg::LBL_LABELS" +msgstr "Labels" + + +#: VisuGUI_StreamLinesDlg.cxx + +msgid "VisuGUI_StreamLinesDlg::&OK" +msgstr "" + +msgid "VisuGUI_StreamLinesDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_StreamLinesDlg::DLG_TITLE" +msgstr "Stream lines Preferences" + +msgid "VisuGUI_StreamLinesDlg::SOURCE_GRP" +msgstr "Source" + +msgid "VisuGUI_StreamLinesDlg::LBL_SOURCE_TYPE" +msgstr "Source type" + +msgid "VisuGUI_StreamLinesDlg::LBL_USED_POINTS" +msgstr "Used points (0..1)" + +msgid "VisuGUI_StreamLinesDlg::LBL_STEP_LENGTH" +msgstr "Step Length" + +msgid "VisuGUI_StreamLinesDlg::LBL_INTEGRATION_STEP" +msgstr "Integration Step" + +msgid "VisuGUI_StreamLinesDlg::LBL_PROPAGATION_TIME" +msgstr "Propagation Time" + +msgid "VisuGUI_StreamLinesDlg::LBL_DIRECTION" +msgstr "Direction" + +msgid "VisuGUI_StreamLinesDlg::MAGNITUDE_COLORING_CHK" +msgstr "Magnitude coloring" + +msgid "VisuGUI_StreamLinesDlg::USE_COLOR_BTN" +msgstr "Use Color" + + +#: VisuGUI_SweepPrefDlg.cxx + +msgid "VisuGUI_SweepPrefDlg::&OK" +msgstr "" + +msgid "VisuGUI_SweepPrefDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_SweepPrefDlg::DLG_TITLE" +msgstr "Sweeping Preferences" + +msgid "VisuGUI_SweepPrefDlg::LBL_TIME_STEP" +msgstr "Time step (second):" + +msgid "VisuGUI_SweepPrefDlg::LBL_NB_CYCLES" +msgstr "Number of cycles:" + +msgid "VisuGUI_SweepPrefDlg::LBL_NB_STEPS" +msgstr "Number of steps:" + + +#: VisuGUI_TimeAnimation.cxx + +msgid "VisuGUI_TimeAnimationDlg::&OK" +msgstr "" + +msgid "VisuGUI_TimeAnimationDlg::ERROR" +msgstr "Error" + +msgid "VisuGUI_TimeAnimationDlg::MSG_NO_ANIMATIONDATA" +msgstr "There is no data for animation" + + +#: VisuGUI_VectorsDlg.cxx + +msgid "VisuGUI_VectorsDlg::&OK" +msgstr "" + +msgid "VisuGUI_VectorsDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_VectorsDlg::DLG_TITLE" +msgstr "Vector Field Representation" + +msgid "VisuGUI_VectorsDlg::LBL_SCALE_FACTOR" +msgstr "Scale factor:" + +msgid "VisuGUI_VectorsDlg::LBL_LINE_WIDTH" +msgstr "Line width:" + +msgid "VisuGUI_VectorsDlg::MAGNITUDE_COLORING_CHK" +msgstr "Magnitude coloring" + +msgid "VisuGUI_VectorsDlg::SEL_COLOR_BTN" +msgstr "Select Color" + +msgid "VisuGUI_VectorsDlg::USE_GLYPHS_CHK" +msgstr "Use glyphs" + +msgid "VisuGUI_VectorsDlg::GLYPH_TYPE_GRP" +msgstr "Glyph type" + +msgid "VisuGUI_VectorsDlg::ARROWS_BTN" +msgstr "Arrows" + +msgid "VisuGUI_VectorsDlg::CONES2_BTN" +msgstr "Cones (2)" + +msgid "VisuGUI_VectorsDlg::CONES6_BTN" +msgstr "Cones (6)" + +msgid "VisuGUI_VectorsDlg::GLYPH_POSITION_GRP" +msgstr "Glyph position" + +msgid "VisuGUI_VectorsDlg::TAIL_BTN" +msgstr "Tail" + +msgid "VisuGUI_VectorsDlg::CENTER_BTN" +msgstr "Center" + +msgid "VisuGUI_VectorsDlg::HEAD_BTN" +msgstr "Head" + + +#: VisuGUI_NameDlg.cxx + +msgid "VisuGUI_NameDlg::TLT_RENAME" +msgstr "Rename" + +msgid "VisuGUI_NameDlg::NAME_LBL" +msgstr "Name: " + +#: VisuGUI_TableDlg.cxx + +msgid "VisuGUI_TableDlg::VIEW_TABLE_TLT" +msgstr "View Table" + +msgid "VisuGUI_TableDlg::EDIT_TABLE_TLT" +msgstr "Edit Table" + +msgid "VisuGUI_TableDlg::TABLE_OF_INTEGER_TLT" +msgstr "Table of integer" + +msgid "VisuGUI_TableDlg::TABLE_OF_REAL_TLT" +msgstr "Table of real" + +msgid "VisuGUI_TableDlg::ERR_TABLE_NOT_AVAILABLE" +msgstr "Table is not available" + +msgid "VisuGUI_TableWidget::UNITS_TLT" +msgstr "Units" + +msgid "VisuGUI_TableWidget::ADD_ROW_BTN" +msgstr "Add Row" + +msgid "VisuGUI_TableWidget::REMOVE_ROW_BTN" +msgstr "Remove Row(s)" + +msgid "VisuGUI_TableWidget::ADD_COLUMN_BTN" +msgstr "Add Column" + +msgid "VisuGUI_TableWidget::REMOVE_COLUMN_BTN" +msgstr "Remove Column(s)" + +msgid "VisuGUI_TableWidget::ADJUST_CELLS_BTN" +msgstr "Adjust Cells" + +msgid "VisuGUI_TableWidget::SELECT_ALL_BTN" +msgstr "Select All" + +msgid "VisuGUI_TableWidget::CLEAR_BTN" +msgstr "Clear" + +msgid "VisuGUI_TableWidget::SET_TITLE_TLT" +msgstr "Set title" + +msgid "VisuGUI_TableWidget::TITLE_LBL" +msgstr "Title:" + +# -------------- Clipping -------------- + +#Title +msgid "VisuGUI_ClippingDlg::TITLE" +msgstr "Change Clipping" + +msgid "VisuGUI_ClippingDlg::GRP_PLANES" +msgstr "Clipping planes" + +msgid "VisuGUI_ClippingDlg::BUT_NEW" +msgstr "New" + +msgid "VisuGUI_ClippingDlg::BUT_DELETE" +msgstr "Delete" + +msgid "VisuGUI_ClippingDlg::GRP_PARAMETERS" +msgstr "Parameters" + +msgid "VisuGUI_ClippingDlg::TAB_NON_STRUCTURED" +msgstr "Non structured" + +msgid "VisuGUI_ClippingDlg::TAB_IJK_STRUCTURED" +msgstr "IJK (Structured)" + +msgid "VisuGUI_ClippingDlg::SHOW_PREVIEW_CHK" +msgstr "Show preview" + +msgid "VisuGUI_ClippingDlg::AUTO_APPLY_CHK" +msgstr "Auto Apply" + +msgid "VisuGUI_ClippingDlg::PARALLEL_XOY_COMBO_ITEM" +msgstr "|| X-Y" + +msgid "VisuGUI_ClippingDlg::PARALLEL_YOZ_COMBO_ITEM" +msgstr "|| Y-Z" + +msgid "VisuGUI_ClippingDlg::PARALLEL_ZOX_COMBO_ITEM" +msgstr "|| Z-X" + +msgid "VisuGUI_ClippingDlg::LBL_ORIENTATION" +msgstr "Orientation" + +msgid "VisuGUI_ClippingDlg::LBL_DISTANCE" +msgstr "Distance" + +msgid "VisuGUI_ClippingDlg::LBL_ROTATION_YZ" +msgstr "Rotation around X (Y to Z):" + +msgid "VisuGUI_ClippingDlg::LBL_ROTATION_ZY" +msgstr "Rotation around X (Z to Y):" + +msgid "VisuGUI_ClippingDlg::LBL_ROTATION_ZX" +msgstr "Rotation around Y (Z to X):" + +msgid "VisuGUI_ClippingDlg::LBL_ROTATION_XZ" +msgstr "Rotation around Y (X to Z):" + +msgid "VisuGUI_ClippingDlg::LBL_ROTATION_XY" +msgstr "Rotation around Z (X to Y):" + +msgid "VisuGUI_ClippingDlg::LBL_ROTATION_YX" +msgstr "Rotation around Z (Y to X):" + +msgid "VisuGUI_ClippingDlg::GRP_IJK_AXIS" +msgstr "Axis" + +msgid "VisuGUI_ClippingDlg::I_RADIO_BTN" +msgstr "I" + +msgid "VisuGUI_ClippingDlg::J_RADIO_BTN" +msgstr "J" + +msgid "VisuGUI_ClippingDlg::K_RADIO_BTN" +msgstr "K" + +msgid "VisuGUI_ClippingDlg::LBL_IJK_INDEX" +msgstr "Index (from 0 to ...)" + +msgid "VisuGUI_ClippingDlg::LBL_IJK_INDEX_TO_arg" +msgstr "Index (from 0 to %1) " + +msgid "VisuGUI_ClippingDlg::REVERSE_NORMAL_CHK" +msgstr "Reverse normal" + +msgid "VisuGUI_ClippingDlg::PLANES_COMBO_ITEM_i" +msgstr "Plane# %1" + +msgid "VisuGUI_ClippingDlg::PLANES_COMBO_ITEM_no" +msgstr "No planes" + +msgid "VisuGUI_ClippingDlg::WRN_EMPTY_RESULTING_PRS" +msgstr "Impossible to use given clipping planes because of VTK restrictions. \n Please, provide non-empty resulting presentation." + +# -------------- Plot 3D -------------- + +msgid "VisuGUI_Plot3DDlg::TITLE" +msgstr "Plot3D Definition" + +msgid "VisuGUI_Plot3DDlg::PLOT3D_TAB_TITLE" +msgstr "Plot 3D" + +msgid "VisuGUI_Plot3DDlg::SCALAR_BAR_TAB_TITLE" +msgstr "Scalar Bar" + +msgid "VisuGUI_Plot3DPane::ORIENTATION" +msgstr "Orientation" + +msgid "VisuGUI_Plot3DPane::ROTATIONS" +msgstr "Rotations" + +msgid "VisuGUI_Plot3DPane::ROTATION_X" +msgstr "Rotation around X (Y to Z):" + +msgid "VisuGUI_Plot3DPane::ROTATION_Y" +msgstr "Rotation around Y (Z to X):" + +msgid "VisuGUI_Plot3DPane::ROTATION_Z" +msgstr "Rotation around Z (X to Y):" + +msgid "VisuGUI_Plot3DPane::POSITION" +msgstr "Position" + +msgid "VisuGUI_Plot3DPane::POSITION_VALUE" +msgstr "Value: " + +msgid "VisuGUI_Plot3DPane::RELATIVE" +msgstr "Relative" + +msgid "VisuGUI_Plot3DPane::SCALE" +msgstr "Scale Factor:" + +msgid "VisuGUI_Plot3DPane::PRESENTATION_TYPE" +msgstr "Presentation type" + +msgid "VisuGUI_Plot3DPane::SURFACE" +msgstr "Surface" + +msgid "VisuGUI_Plot3DPane::CONTOUR" +msgstr "Contour" + +msgid "VisuGUI_Plot3DPane::NUMBER_CONTOURS" +msgstr "Number of contours:" + +msgid "VisuGUI_Plot3DPane::PREVIEW" +msgstr "Preview cutting plane" + +# -------------------------------------- + +msgid "TIT_OFFSETDLG" +msgstr "Translate Presentation" + +msgid "BTN_RESET" +msgstr "Reset" + +# -------------------------------------- + +msgid "VisuGUI_CubeAxesDlg::CAPTION" +msgstr "Graduated axes" + +msgid "VisuGUI_AxisWg::AXIS_NAME" +msgstr "Axis name" + +msgid "VisuGUI_AxisWg::IS_VISIBLE" +msgstr "Is visible" + +msgid "VisuGUI_CubeAxesDlg::X_AXIS" +msgstr "X axis" + +msgid "VisuGUI_CubeAxesDlg::Y_AXIS" +msgstr "Y axis" + +msgid "VisuGUI_CubeAxesDlg::Z_AXIS" +msgstr "Z axis" + +msgid "VisuGUI_AxisWg::NAME" +msgstr "Name" + +msgid "VisuGUI_AxisWg::FONT" +msgstr "Font" + +msgid "VisuGUI_AxisWg::LABELS" +msgstr "Labels" + +msgid "VisuGUI_AxisWg::NUMBER" +msgstr "Number" + +msgid "VisuGUI_AxisWg::OFFSET" +msgstr "Offset" + +msgid "VisuGUI_AxisWg::TICK_MARKS" +msgstr "Tick marks" + +msgid "VisuGUI_AxisWg::LENGTH" +msgstr "Length" + +msgid "VisuGUI_FontWg::ARIAL" +msgstr "Arial" + +msgid "VisuGUI_FontWg::COURIER" +msgstr "Courier" + +msgid "VisuGUI_FontWg::TIMES" +msgstr "Times" + +msgid "VisuGUI_FontWg::BOLD" +msgstr "Bold" + +msgid "VisuGUI_FontWg::ITALIC" +msgstr "Italic" + +msgid "VisuGUI_FontWg::SHADOW" +msgstr "Shadow" + +msgid "VisuGUI_CubeAxesDlg::IS_VISIBLE" +msgstr "Is visible" + + +#: VisuGUI_SetupPlot2dDlg.cxx:71 +msgid "ATTRIBUTES_LBL" +msgstr "Attributes" + +#: VisuGUI_SetupPlot2dDlg.cxx:68 +msgid "AXIS_LBL" +msgstr "Axis" + +#: VisuGUI_SetupPlot2dDlg.cxx:69 +msgid "DATA_LBL" +msgstr "Data" + +#: VisuGUI_SetupPlot2dDlg.cxx:49 +msgid "TLT_SETUP_PLOT2D" +msgstr "Setup Plot 2d" + +#: VisuGUI_SetupPlot2dDlg.cxx:70 +msgid "UNITS_LBL" +msgstr "Units" + +#: VisuGUI_SetupPlot2dDlg.cxx:445 +msgid "VisuGUI_ItemContainer::H" +msgstr " H " + +#: VisuGUI_SetupPlot2dDlg.cxx:450 +msgid "VisuGUI_ItemContainer::V" +msgstr " V " + +#: VisuGUI_SetupPlot2dDlg.cxx:458 +msgid "VisuGUI_ItemContainer::AUTO_CHECK_LBL" +msgstr "Auto assign" + +#: VisuGUI_SetupPlot2dDlg.cxx:475 +msgid "VisuGUI_ItemContainer::CIRCLE_MARKER_LBL" +msgstr "Circle" + +#: VisuGUI_SetupPlot2dDlg.cxx:482 +msgid "VisuGUI_ItemContainer::CROSS_MARKER_LBL" +msgstr "Cross" + +#: VisuGUI_SetupPlot2dDlg.cxx:467 +msgid "VisuGUI_ItemContainer::DAHSDOTDOT_LINE_LBL" +msgstr "DashDotDot" + +#: VisuGUI_SetupPlot2dDlg.cxx:466 +msgid "VisuGUI_ItemContainer::DASHDOT_LINE_LBL" +msgstr "DashDot" + +#: VisuGUI_SetupPlot2dDlg.cxx:464 +msgid "VisuGUI_ItemContainer::DASH_LINE_LBL" +msgstr "Dash" + +#: VisuGUI_SetupPlot2dDlg.cxx:477 +msgid "VisuGUI_ItemContainer::DIAMOND_MARKER_LBL" +msgstr "Diamond" + +#: VisuGUI_SetupPlot2dDlg.cxx:465 +msgid "VisuGUI_ItemContainer::DOT_LINE_LBL" +msgstr "Dot" + +#: VisuGUI_SetupPlot2dDlg.cxx:478 +msgid "VisuGUI_ItemContainer::DTRIANGLE_MARKER_LBL" +msgstr "Downward triangle" + +#: VisuGUI_SetupPlot2dDlg.cxx:480 +msgid "VisuGUI_ItemContainer::LTRIANGLE_MARKER_LBL" +msgstr "Leftward triangle" + +#: VisuGUI_SetupPlot2dDlg.cxx:462 +msgid "VisuGUI_ItemContainer::NONE_LINE_LBL" +msgstr "None" + +#: VisuGUI_SetupPlot2dDlg.cxx:474 +msgid "VisuGUI_ItemContainer::NONE_MARKER_LBL" +msgstr "None" + +#: VisuGUI_SetupPlot2dDlg.cxx:476 +msgid "VisuGUI_ItemContainer::RECTANGLE_MARKER_LBL" +msgstr "Rectangle" + +#: VisuGUI_SetupPlot2dDlg.cxx:481 +msgid "VisuGUI_ItemContainer::RTRIANGLE_MARKER_LBL" +msgstr "Rightward triangle" + +#: VisuGUI_SetupPlot2dDlg.cxx:463 +msgid "VisuGUI_ItemContainer::SOLID_LINE_LBL" +msgstr "Solid" + +#: VisuGUI_SetupPlot2dDlg.cxx:479 +msgid "VisuGUI_ItemContainer::UTRIANGLE_MARKER_LBL" +msgstr "Upward triangle" + +#: VisuGUI_SetupPlot2dDlg.cxx:483 +msgid "VisuGUI_ItemContainer::XCROSS_MARKER_LBL" +msgstr "Diagonal cross" + +#: VisuGUI_SetupPlot2dDlg.cxx:404 +msgid "VisuGUI_SetupPlot2dDlg::BUT_NO" +msgstr "No" + +#: VisuGUI_SetupPlot2dDlg.cxx:403 +msgid "VisuGUI_SetupPlot2dDlg::BUT_YES" +msgstr "Yes" + +#: VisuGUI_SetupPlot2dDlg.cxx:402 +msgid "VisuGUI_SetupPlot2dDlg::QUE_WANT_SAME_UNITS" +msgstr "Do you want to choose all items with the same units for vertical axis?" + diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx new file mode 100644 index 00000000..a9983bf3 --- /dev/null +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -0,0 +1,891 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : VisuGUI_CutLinesDlg.cxx +// Author : VSV +// Module : VISU + +#include "VisuGUI_CutLinesDlg.h" + +#include "VisuGUI.h" +#include "VisuGUI_Tools.h" + +#include "VISU_Gen_i.hh" +#include "VISU_CutLines_i.hh" + +#include "VISU_PipeLine.hxx" +#include "VISU_PipeLineUtils.hxx" +#include "VISU_CutLinesPL.hxx" + +#include "SVTK_ViewWindow.h" + +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" + +#include "SUIT_Desktop.h" + +#include "OB_Browser.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +bool VisuGUI_CutLinesDlg::MYGenerateTable = true; +bool VisuGUI_CutLinesDlg::MYGenerateCurve = true; + +VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) + : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myPreviewActor(0),myPreviewActorGlyphs(0) +{ + setCaption("Cut Lines Definition"); + setSizeGripEnabled(true); + + QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6); + aMainLayout->setSpacing(5); + + hasInit = false; + + // Tab pane + QTabWidget* aTabPane = new QTabWidget(this); + + // Plane of lines + QFrame* aPlanePane = new QFrame(this); + QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6); + + mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane); + mySelPlane->setInsideSpacing( 5 ); + mySelPlane->setInsideMargin( 5 ); + + QRadioButton* aBxy = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane); // 0 + QRadioButton* aByz = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane); // 1 + QRadioButton* aBzx = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane); // 2 + aBxy->setChecked(false); + aByz->setChecked(false); + aBzx->setChecked(true); + + aPlaneLayout->addWidget( mySelPlane ); + + QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane ); + aRotBox->setColumnLayout(2, Qt::Horizontal ); + + myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox); + myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox ); + myRotXSpn->setValue( 0 ); + myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox ); + myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox ); + myRotYSpn->setValue( 0 ); + + aPlaneLayout->addWidget( aRotBox ); + + QHGroupBox* aBaseBox = new QHGroupBox (tr("BASE_PLANE_POS"), aPlanePane); + myBasePlanePos = new QLineEdit (aBaseBox); + mydvalidator = new QDoubleValidator(this); + mydvalidator->setDecimals(32); + myBasePlanePos->setValidator(mydvalidator); + + myCBSetDef = new QCheckBox (tr("SET_DEFAULT"),aBaseBox); + + aPlaneLayout->addWidget(aBaseBox); + + QHBox* aPosBox = new QHBox (aPlanePane); + aPosBox->setSpacing(5); + QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox); + myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox); + myPosSpn->setValue(0.5); + aPlaneLayout->addWidget(aPosBox); + + myPreviewCheck = new QCheckBox (tr("LBL_SHOW_PREVIEW"), aPlanePane); + myPreviewCheck->setChecked(false); + aPlaneLayout->addWidget(myPreviewCheck); + + myAllCurvesInvertedCheck = new QCheckBox(tr("LBL_INVERT_CURVES"), aPlanePane); + myAllCurvesInvertedCheck->setChecked(false); + aPlaneLayout->addWidget(myAllCurvesInvertedCheck); + + myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane); + myCreateTable->setChecked(MYGenerateTable); + aPlaneLayout->addWidget( myCreateTable ); + + QHBox* aCheckPane = new QHBox(aPlanePane); + QLabel* aLbl = new QLabel(" ", aCheckPane); + aCheckPane->setStretchFactor(aLbl, 0); + myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane); + aCheckPane->setStretchFactor(aCheckPane, 0); + myCurvesCheck->setChecked(MYGenerateCurve); + myCurvesCheck->setEnabled(MYGenerateTable); + QLabel* aLbl2 = new QLabel(" ", aCheckPane); + aCheckPane->setStretchFactor(aLbl2, 1); + aPlaneLayout->addWidget( aCheckPane ); + + aPlaneLayout->addStretch(); + + + aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") ); + + // Number of lines + QFrame* aLinesPane = new QFrame(this); + QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 ); + + mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane); + mySelPlane2->setInsideSpacing( 5 ); + mySelPlane2->setInsideMargin( 5 ); + + QRadioButton* aBxy2 = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane2); // 0 + QRadioButton* aByz2 = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane2); // 1 + QRadioButton* aBzx2 = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane2); // 2 + aBzx2->setEnabled(false); + aByz2->setChecked(true); + aLinesLayout->addWidget( mySelPlane2 ); + + QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane ); + aRotBox2->setColumnLayout(2, Qt::Horizontal ); + + myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2); + myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 ); + myRotXSpn2->setValue( 0 ); + myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 ); + myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 ); + myRotYSpn2->setValue( 0 ); + aLinesLayout->addWidget( aRotBox2 ); + + QHBox* aNbBox = new QHBox(aLinesPane); + aNbBox->setSpacing(5); + QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox ); + myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox ); + myNbSpn->setValue( 10 ); + + aLinesLayout->addWidget( aNbBox ); + + myPosTable = new QTable(aLinesPane, "Positions of cut planes" ); + myPosTable->setMaximumHeight( 227 ); + myPosTable->setMinimumWidth( 294 ); + myPosTable->setNumCols(2); + myPosTable->setNumRows(0); + + QHeader *th = myPosTable->horizontalHeader(); + th->setLabel( 0, "Position" ); + th->setLabel( 1, "Set default" ); + + aLinesLayout->addWidget( myPosTable ); + + QHBox* aPosBox2 = new QHBox(aLinesPane); + aPosBox2->setSpacing(5); + QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 ); + myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 ); + myPosSpn2->setValue( 0.5 ); + aLinesLayout->addWidget( aPosBox2 ); + aLinesLayout->addStretch(); + + aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") ); + + myScalarPane = new VisuGUI_ScalarBarPane(this, false); + myScalarPane->setMargin( 5 ); + aTabPane->addTab(myScalarPane, "Scalar Bar"); + + aMainLayout->addWidget(aTabPane); + + // Dialog buttons + QHBox* aBtnBox = new QHBox(this); + aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken); + aBtnBox->setLineWidth( 1 ); + QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout(); + aBtnLayout->setAutoAdd( false ); + aBtnLayout->setSpacing( 5 ); + aBtnLayout->setMargin( 11 ); + + QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox); + aOkBtn->setAutoDefault( TRUE ); + aOkBtn->setDefault( true ); + aBtnLayout->addWidget(aOkBtn); + + aBtnLayout->addStretch(); + + QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox); + aBtnLayout->addWidget(aCloseBtn); + + aMainLayout->addWidget(aBtnBox); + + myCutLines = NULL; + + // signals and slots connections + connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int))); + connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault())); + connect(myPosSpn , SIGNAL(valueChanged(double)) , this, SLOT(setBaseDefault())); + connect(mySelPlane2 , SIGNAL(clicked(int)) , this, SLOT(onCutSelect(int))); + connect(myNbSpn , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable())); + connect(th , SIGNAL(clicked(int)) , this, SLOT(setDefault(int))); + connect(myPosSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable())); + connect(myPreviewCheck, SIGNAL(toggled(bool)) , this, SLOT(onPreviewCheck(bool))); + connect(myAllCurvesInvertedCheck, SIGNAL(toggled(bool)),this, SLOT(onAllCurvesInvertedCheck(bool))); + connect(myPosTable , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int))); + connect(myRotXSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double))); + connect(myRotYSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double))); + connect(myRotXSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double))); + connect(myRotYSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double))); + connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&))); + connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool))); + + connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept())); + connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject())); + //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject())); + //connect(VisuGUI::application()->desktop(), + // SIGNAL(windowActivated(SUIT_ViewWindow*)), + // this, SLOT(onWindowActivated(SUIT_ViewWindow*))); +} + +/*! + Destructor +*/ +VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg() +{ + cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<Destroy(); + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + vf->Repaint(); +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs) +{ + myPrs = thePrs; + myScalarPane->initFromPrsObject(thePrs); + + myRotXSpn->setValue(thePrs->GetRotateX()*180./PI); + myRotYSpn->setValue(thePrs->GetRotateY()*180./PI); + myPosSpn->setValue(thePrs->GetDisplacement()); + setOrientation(thePrs->GetOrientationType()); + + myNbSpn->setValue( (int)thePrs->GetNbLines() ); + myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI); + myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI); + myPosSpn2->setValue(thePrs->GetDisplacement2()); + setOrientation2(thePrs->GetOrientationType2()); + + hasInit = true; + myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false); + myCutLines->SameAs(thePrs); + myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted()); + if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true); + myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) ); + myCBSetDef->setChecked(thePrs->IsDefault()); + DrawTable(); + + // Draw Preview + if (myPreviewCheck->isChecked()) { + createPlanes(); + } +} + +//------------------------------------------------------------------------------ +int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs) +{ + myScalarPane->storeToPrsObject(thePrs); + + thePrs->SetOrientation(getOrientaion(), + myRotXSpn->value()*PI/180., + myRotYSpn->value()*PI/180.); + thePrs->SetDisplacement(myPosSpn->value()); + thePrs->SetNbLines((int)myNbSpn->value()); + + thePrs->SetOrientation2(getOrientaion(false), + myRotXSpn2->value()*PI/180., + myRotYSpn2->value()*PI/180.); + thePrs->SetDisplacement2(myPosSpn2->value()); + + if (!myCBSetDef->isChecked()) + thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble()); + else thePrs->SetDefault(); + + for (int i = 0; i < (int)myNbSpn->value(); ++i) { + if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked()) + thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() ); + else thePrs->SetDefaultPosition(i); + } + if (myAllCurvesInvertedCheck->isChecked()) + thePrs->SetAllCurvesInverted(true); + return 1; +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::createPlanes() +{ + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView == NULL) return; + if (myCutLines == NULL) return; + if (myPreviewActor != 0) return; + + storeToPrsObject(myCutLines); + myCutLines->GetPL()->Update(); + vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData(); + vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); + aPlaneMapper->SetInput(aPolyData->GetOutput()); + aPlaneMapper->ScalarVisibilityOff(); + + myPreviewActorGlyphs = myPreviewActorGlyphs = SALOME_Actor::New(); + myPreviewActorGlyphs->PickableOff(); + updateGlyphs(false); + + myPreviewActor = SALOME_Actor::New(); + myPreviewActor->PickableOff(); + myPreviewActor->SetMapper(aPlaneMapper); + aPlaneMapper->Delete(); + aView->AddActor(myPreviewActor); + aView->AddActor(myPreviewActorGlyphs); + aView->getRenderer()->Render(); + aView->onFitAll(); +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::deletePlanes() +{ + if (myPreviewActor == 0) return; + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()){ + aView->RemoveActor(myPreviewActor); + aView->RemoveActor(myPreviewActorGlyphs); + } + myPreviewActor->Delete(); + myPreviewActorGlyphs->Delete(); + myPreviewActor = 0; + myPreviewActorGlyphs = 0; +} + + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::onPlaneSelect (int theId) +{ + for (int i = 0; i < mySelPlane2->count(); i++) + mySelPlane2->find(i)->setEnabled(true); + QButton* aBtn = mySelPlane2->find(theId); + aBtn->setEnabled(false); + switch (theId) { + case 0: + myRotXLbl->setText( tr("LBL_ROT_X")); + myRotYLbl->setText( tr("LBL_ROT_Y")); + ((QRadioButton*)mySelPlane2->find(1))->setChecked(true); + onCutSelect(1, false); + break; + case 1: + myRotXLbl->setText( tr("LBL_ROT_Y")); + myRotYLbl->setText( tr("LBL_ROT_Z")); + ((QRadioButton*)mySelPlane2->find(2))->setChecked(true); + onCutSelect(2, false); + break; + case 2: + myRotXLbl->setText( tr("LBL_ROT_Z")); + myRotYLbl->setText( tr("LBL_ROT_X")); + ((QRadioButton*)mySelPlane2->find(0))->setChecked(true); + onCutSelect(0, false); + } + setBaseDefault(false); + DrawTable(); +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate) +{ + switch (theId) { + case 0: + myRotXLbl2->setText( tr("LBL_ROT_X")); + myRotYLbl2->setText( tr("LBL_ROT_Y")); + break; + case 1: + myRotXLbl2->setText( tr("LBL_ROT_Y")); + myRotYLbl2->setText( tr("LBL_ROT_Z")); + break; + case 2: + myRotXLbl2->setText( tr("LBL_ROT_Z")); + myRotYLbl2->setText( tr("LBL_ROT_X")); + } + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView) { + if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) { + /*myCutLines->SetOrientation2(getOrientaion(false), + myRotXSpn2->value()*PI/180., + myRotYSpn2->value()*PI/180.); + myCutLines->SetDisplacement2(myPosSpn2->value());*/ + //myCutLines->GetPL()->Update(); + deletePlanes(); + createPlanes(); + //aView->Repaint(); + } + } +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate) +{ + if (!hasInit) return; + + if (myCBSetDef->isChecked()) { + if (!myCutLines->IsDefault()) myCutLines->SetDefault(); + /*myCutLines->SetOrientation(getOrientaion(), + myRotXSpn->value()*PI/180., + myRotYSpn->value()*PI/180.); + myCutLines->SetDisplacement(myPosSpn->value());*/ + /* float aPos = myCutLines->GetBasePlanePosition(); + myBasePlanePos->setText( QString::number(aPos) ); + myBasePlanePos->setEnabled(false);*/ + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView) { + if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) { + //myCutLines->SetBasePlanePosition(aPos); + // myCutLines->GetPL()->Update(); + deletePlanes(); + createPlanes(); + //aView->Repaint(); + } + } + float aPos = myCutLines->GetBasePlanePosition(); + myBasePlanePos->setText( QString::number(aPos) ); + myBasePlanePos->setEnabled(false); + } else { + myBasePlanePos->setEnabled(true); + } +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::DrawTable() +{ + if (!hasInit) return; + + int aNbRows = myPosTable->numRows(); + int aNbPlanes = (int)myNbSpn->value(); + + myCutLines->SetOrientation(getOrientaion(), + myRotXSpn->value()*PI/180., + myRotYSpn->value()*PI/180.); + + myCutLines->SetNbLines(aNbPlanes); + myCutLines->SetDisplacement2(myPosSpn2->value()); + myCutLines->SetOrientation2(getOrientaion(false), + myRotXSpn2->value()*PI/180., + myRotYSpn2->value()*PI/180.); + + if (aNbRows>0) + for (int i = 0; i < aNbRows; ++i) { + QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 ); + if (aItem == 0) break; + if (!aItem->isChecked()) + myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble()); + } + + if (aNbPlanes > aNbRows) + myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows ); + else if (aNbPlanes < aNbRows) + myPosTable->setNumRows(aNbPlanes); + + int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes; + for (int i = 0; isetText(i, 0, QString::number(myCutLines->GetLinePosition(i))); + ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i)); + } + + QHeader *vh = myPosTable->verticalHeader(); + QString str("Plane# %1"); + for (int i=aMin; iGetLinePosition(i))); + aEditItem->setReplaceable(false); + aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i)); + myPosTable->setItem(i, 0, aEditItem); + + QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0); + aCheck->setChecked(myCutLines->IsDefaultPosition(i)); + aCheck->setReplaceable(false); + myPosTable->setItem(i, 1, aCheck); + + vh->setLabel( i, str.arg(i+1) ); + } + // Update preview + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView) { + if (myPreviewCheck->isChecked()) { + // myCutLines->GetPL()->Update(); + deletePlanes(); + createPlanes(); + //aView->Repaint(); + } + } +} + +void VisuGUI_CutLinesDlg::updateGlyphs(bool update){ + if (myPreviewActorGlyphs == 0 ) return; + const float *aDirLn = myCutLines->GetCutLinesPL()->GetDirLn(); + const float *aBasePnt = myCutLines->GetCutLinesPL()->GetBasePnt(); + float aSecondPnt[3]; + float aBoundCenter[3]; + + vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData(); + vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); + aPlaneMapper->SetInput(aPolyData->GetOutput()); + float bounds[6]; + aPlaneMapper->GetBounds(bounds); + + for(int i=0; i<3; i++) aBoundCenter[i] = (bounds[i*2] + bounds[i*2+1])/2.0; + for(int i=0; i<3; i++){ + if (!myAllCurvesInvertedCheck->isChecked()) + aSecondPnt[i] = aBasePnt[i] + aDirLn[i]; + else + aSecondPnt[i] = -aBasePnt[i] - aDirLn[i]; + } + + float max_bound = 0; + max_bound < bounds[1]-bounds[0] ? max_bound = bounds[1] - bounds[0] : max_bound = max_bound; + max_bound < bounds[3]-bounds[2] ? max_bound = bounds[3] - bounds[2] : max_bound = max_bound; + max_bound < bounds[5]-bounds[4] ? max_bound = bounds[5] - bounds[4] : max_bound = max_bound; + + vtkPolyData* profile = vtkPolyData::New(); + vtkPoints* aPoints = vtkPoints::New(); + vtkGlyph3D* glyphs = vtkGlyph3D::New(); + vtkFloatArray *aFloatArray = vtkFloatArray::New(); + vtkGlyphSource2D* source = vtkGlyphSource2D::New(); + + source->FilledOn(); + source->SetCenter(aBoundCenter); + source->SetGlyphTypeToArrow(); + + aPoints->InsertNextPoint(aBasePnt); + profile->SetPoints(aPoints); + + aFloatArray->SetNumberOfComponents(3); + for(int i=0; i<3 ;i++) + aFloatArray->InsertNextValue(aSecondPnt[i]); + + vtkDataSetAttributes* aDataSetAttributes; + aDataSetAttributes = profile->GetPointData(); + aDataSetAttributes->SetVectors(aFloatArray); + + glyphs->SetScaleFactor(0.25*max_bound); + glyphs->SetVectorModeToUseVector(); + glyphs->SetScaleModeToScaleByVector(); + glyphs->SetInput(profile); + glyphs->SetSource(source->GetOutput()); + + vtkPolyDataMapper* aGlyphsMapper = vtkPolyDataMapper::New(); + aGlyphsMapper->ScalarVisibilityOff(); + aGlyphsMapper->SetInput(glyphs->GetOutput()); + + myPreviewActorGlyphs->SetMapper(aGlyphsMapper); + + profile->Delete(); + glyphs->Delete(); + aPoints->Delete(); + aGlyphsMapper->Delete(); + aFloatArray->Delete(); + source->Delete(); + aPlaneMapper->Delete(); + + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + if (update) + vf->Repaint(); +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::setDefault (int all) +{ + myPosTable->setCurrentCell(-1, 1); + myPosTable->clearSelection(); + if (all == 0) return; + if (all == 1) + for (int i = 0; i < (int)myNbSpn->value(); ++i) + ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true); + + for (int i = 0; i < (int)myNbSpn->value(); ++i) { + if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) { + myCutLines->SetDefaultPosition(i); + myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i))); + myPosTable->item( i, 0 )->setEnabled(false); + } else + myPosTable->item( i, 0 )->setEnabled(true); + } +} + +//------------------------------------------------------------------------------ +VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane) +{ + QHButtonGroup* aBG; + + if (IsBasePlane) + aBG = mySelPlane; + else + aBG = mySelPlane2; + + VISU::CutPlanes::Orientation orient; + switch (aBG->id(aBG->selected())) { + case 0: + orient = VISU::CutPlanes::XY; + break; + case 1: + orient = VISU::CutPlanes::YZ; + break; + case 2: + orient = VISU::CutPlanes::ZX; + } + return orient; +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient) +{ + switch (orient) { + case VISU::CutPlanes::XY: + ((QRadioButton*)mySelPlane->find(0))->setChecked(true); + onPlaneSelect(0); + break; + case VISU::CutPlanes::YZ: + ((QRadioButton*)mySelPlane->find(1))->setChecked(true); + onPlaneSelect(1); + break; + case VISU::CutPlanes::ZX: + ((QRadioButton*)mySelPlane->find(2))->setChecked(true); + onPlaneSelect(2); + } +} + +//------------------------------------------------------------------------------ +void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient) +{ + switch (orient) { + case VISU::CutPlanes::XY: + ((QRadioButton*)mySelPlane2->find(0))->setChecked(true); + onCutSelect(0); + break; + case VISU::CutPlanes::YZ: + ((QRadioButton*)mySelPlane2->find(1))->setChecked(true); + onCutSelect(1); + break; + case VISU::CutPlanes::ZX: + ((QRadioButton*)mySelPlane2->find(2))->setChecked(true); + onCutSelect(2); + } +} + +void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol) +{ + if (theCol == 0) { + QString aTxt = myPosTable->text(theRow, 0); + bool isChanged = !aTxt.isEmpty(); + ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged); + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView) { + if (myPreviewCheck->isChecked()) { + //Update Preview + //myCutLines->SetLinePosition( theRow, aTxt.toDouble()); + // myCutLines->GetPL()->Update(); + deletePlanes(); + createPlanes(); + //aView->Repaint(); + } + } + } else if (theCol == 1){ + bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked(); + if (isDefault) { + //myCutLines->SetDefaultPosition(theRow); + // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow))); + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView) { + if (myPreviewCheck->isChecked()) { + //Update Preview + // myCutLines->GetPL()->Update(); + deletePlanes(); + createPlanes(); + //aView->Repaint(); + } + } + myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow))); + } + myPosTable->item(theRow, 0)->setEnabled(!isDefault); + } +} + +void VisuGUI_CutLinesDlg::accept() +{ + //if ( !VisuGUI::CheckActiveStudyLock() ) { + // reject(); + // return; + //} + MYGenerateTable = myCreateTable->isChecked(); + MYGenerateCurve = myCurvesCheck->isChecked(); + // if (myScalarPane->check()) { + /*jfa tmp:((QWidget*)sender())->setDisabled(true); + storeToPrsObject(myPrs); + if (myIsCreation) { + if (isGenerateTable()) { + visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry()); + if (isGenerateCurves()) { + SALOMEDSClient_Study* aStudy = study()->studyDS(); + SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry()); + if( aSObject ) { + SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject ); + SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder(); + for ( ;aIter->More(); aIter->Next()) { + SALOMEDSClient_SObject* aTblObj = aIter->Value(); + if ( aTblObj ) { + SALOMEDSClient_GenericAttribute* anAttr; + if (aTblObj->FindAttribute(anAttr, "AttributeName")) { + visuGUI->CreatePlot(aTblObj); + } + } + } + } + } + } + if (GET_VTK_VIEWWINDOW(myMgr)) { + try { + visuGUI->CreateActor(myPrs); + } catch (...) { + reject(); + return; + } + GET_VTK_VIEWWINDOW(myMgr)->onFitAll(); + } + } else { + visuGUI->RecreateActor(myPrs); + if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) { + vf->getRenderer()->ResetCameraClippingRange(); + vf->Repaint(); + } + } + // Remove old Table + SALOMEDSClient_Study* aStudy = study()->studyDS(); + SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry()); + if( aSObject ) { + SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject ); + SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder(); + for ( ;aIter->More(); aIter->Next()) { + SALOMEDSClient_SObject* aTblObj = aIter->Value(); + if ( aTblObj ) { + SALOMEDSClient_GenericAttribute* anAttr; + if (aTblObj->FindAttribute(anAttr, "AttributeName")) { + aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child + break; + } + } + } + if (isGenerateTable()) { + visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str()); + if (isGenerateCurves()) { + SALOMEDSClient_Study* aStudy = study()->studyDS(); + SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject ); + SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder(); + for ( ;aIter->More(); aIter->Next()) { + SALOMEDSClient_SObject* aTblObj = aIter->Value(); + if ( aTblObj ) { + SALOMEDSClient_GenericAttribute* anAttr; + if (aTblObj->FindAttribute(anAttr, "AttributeName")) { + visuGUI->CreatePlot(aTblObj); + } + } + } + } + } + } + } + VisuGUI::application()->objectBrowser()->updateTree();*/ + myScalarPane->deletePreview(); + deletePlanes(); + QDialog::accept(); + // } +} + +void VisuGUI_CutLinesDlg::reject() +{ + /*jfa tmp:if (myIsCreation) { + myPrs->RemoveFromStudy(); + VisuGUI::application()->objectBrowser()->updateTree(); + }*/ + myScalarPane->deletePreview(); + deletePlanes(); + QDialog::reject(); +} + +void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview) +{ + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (thePreview) { + //storeToPrsObject(myCutLines); + // myCutLines->GetPL()->Update(); + createPlanes(); + //vf->onFitAll(); + } else { + deletePlanes(); + vf->Repaint(); + } + } +} + +/*! Inverting all curves in the table + */ +void VisuGUI_CutLinesDlg::onAllCurvesInvertedCheck(bool theInvert) +{ + if (myAllCurvesInvertedCheck->isChecked()){ + myCutLines->SetAllCurvesInverted(true); + myPrs->SetAllCurvesInverted(true); + } + else { + myCutLines->SetAllCurvesInverted(false); + myPrs->SetAllCurvesInverted(false); + } + updateGlyphs(true); +} + +void VisuGUI_CutLinesDlg::onRotation (double theValue) +{ + if (myCutLines == NULL) return; + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView) { + if (myPreviewCheck->isChecked()) { + + /*myCutLines->SetOrientation(getOrientaion(), + myRotXSpn->value()*PI/180., + myRotYSpn->value()*PI/180.); + myCutLines->SetOrientation2(getOrientaion(false), + myRotXSpn2->value()*PI/180., + myRotYSpn2->value()*PI/180.);*/ + // myCutLines->GetPL()->Update(); + deletePlanes(); + createPlanes(); + //aView->Repaint(); + } + } +} + +void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue) +{ + if (myCutLines == NULL) return; + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView) { + if (myPreviewCheck->isChecked()) { + //myCutLines->SetBasePlanePosition(theValue.toDouble()); + // myCutLines->GetPL()->Update(); + deletePlanes(); + createPlanes(); + //aView->Repaint(); + } + } +} + +//jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd) +//jfa tmp:{ +//jfa tmp: if (theWnd != myStudyWnd) +//jfa tmp: reject(); +//jfa tmp:} diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx new file mode 100644 index 00000000..c4072907 --- /dev/null +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -0,0 +1,559 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUI_CutPlanesDlg.cxx +// Author : Laurent CORNABE & Hubert ROLLAND +// Module : VISU +// $Header$ + +#include "VisuGUI_CutPlanesDlg.h" + +#include "VisuGUI.h" +#include "VisuGUI_Tools.h" + +#include "VISU_CutPlanes_i.hh" +#include "VISU_CutPlanesPL.hxx" + +#include "OB_Browser.h" + +#include "SVTK_ViewWindow.h" + +#include "SalomeApp_Application.h" + +#include "SUIT_Application.h" +#include "SUIT_Desktop.h" +#include "SUIT_ViewWindow.h" +#include "SUIT_ViewManager.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +//extern VisuGUI *visuGUI; + +VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent) + : QFrame(theParent), myPreviewActor(0) +{ + QGridLayout* TopLayout = new QGridLayout( this ); + TopLayout->setSpacing( 6 ); + TopLayout->setMargin( 10 ); + + QButtonGroup* SelPlane = new QButtonGroup (tr("TXT_ORIENTATION"), this, "SelPlane"); + //SelPlane->setTitle(tr("TXT_ORIENTATION")); + SelPlane->setColumnLayout(0, Qt::Vertical); + SelPlane->layout()->setSpacing( 0 ); + SelPlane->layout()->setMargin( 0 ); + QGridLayout* SelPlaneLayout = new QGridLayout( SelPlane->layout() ); + SelPlaneLayout->setAlignment( Qt::AlignTop ); + SelPlaneLayout->setSpacing( 6 ); + SelPlaneLayout->setMargin( 11 ); + + RBxy = new QRadioButton (tr("PARALLEL_XOY"), SelPlane, "RBxy"); + RByz = new QRadioButton (tr("PARALLEL_YOZ"), SelPlane, "RByz"); + RBzx = new QRadioButton (tr("PARALLEL_ZOX"), SelPlane, "RBzx"); + SelPlaneLayout->addWidget( RBxy, 0, 0 ); + SelPlaneLayout->addWidget( RByz, 0, 1 ); + SelPlaneLayout->addWidget( RBzx, 0, 2 ); + + QLabel* LabelPosi_3 = new QLabel (tr("LBL_NB_PLANS"), this, "LabelPosi_3"); + + nbPlan = new QSpinBox( 1, 100, 1, this, "nbPlan" ); + nbPlan->setValue( 1 ); + nbPlan->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + myPosTable = new QTable (this, "Positions of planes"); + myPosTable->setMaximumHeight( 227 ); + myPosTable->setMinimumWidth( 294 ); + myPosTable->setNumCols(2); + myPosTable->setNumRows(0); + connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) ); + + QHeader *th = myPosTable->horizontalHeader(); + th->setLabel( 0, "Position" ); + th->setLabel( 1, "Set default" ); + th->setStyle("QStyle::CE_PushButton"); + + QGroupBox* GBrot = new QGroupBox (tr("LBL_ROTATION"), this, "GBrot"); + GBrot->setColumnLayout(0, Qt::Vertical); + GBrot->layout()->setSpacing( 0 ); + GBrot->layout()->setMargin( 0 ); + QGridLayout* GBrotLayout = new QGridLayout( GBrot->layout() ); + GBrotLayout->setAlignment( Qt::AlignTop ); + GBrotLayout->setSpacing( 6 ); + GBrotLayout->setMargin( 11 ); + + LabelRot1 = new QLabel (tr("LBL_ROT_X"), GBrot, "LabelRot1"); + GBrotLayout->addWidget( LabelRot1, 0, 0 ); + + Rot1 = new QtxDblSpinBox( -180, 180, 10, GBrot ); + Rot1->setValue( 0 ); + Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) ); + GBrotLayout->addWidget( Rot1, 0, 1 ); + + LabelRot2 = new QLabel (tr("LBL_ROT_Y"), GBrot, "LabelRot2"); + GBrotLayout->addWidget( LabelRot2, 1, 0 ); + + Rot2 = new QtxDblSpinBox( -180, 180, 10, GBrot ); + Rot2->setValue( 0 ); + Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) ); + GBrotLayout->addWidget( Rot2, 1, 1 ); + + QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this); + myPosSpn = new QtxDblSpinBox( 0, 1, 0.1, this ); + + myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this); + myPreviewCheck->setChecked(false); + connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) ); + + TopLayout->addMultiCellWidget( SelPlane, 0, 0, 0, 1 ); + TopLayout->addMultiCellWidget( GBrot, 1, 1, 0, 1 ); + TopLayout->addWidget( LabelPosi_3, 2, 0 ); + TopLayout->addWidget( nbPlan, 2, 1 ); + TopLayout->addMultiCellWidget( myPosTable, 3, 3, 0, 1 ); + TopLayout->setRowStretch ( 3, 3 ); + TopLayout->addWidget(aPosLbl, 4, 0 ); + TopLayout->addWidget(myPosSpn, 4, 1 ); + TopLayout->addMultiCellWidget( myPreviewCheck, 5, 5, 0, 1 ); + + // signals and slots connections + connect( SelPlane, SIGNAL( clicked( int )), this, SLOT( orientationChanged( int ) ) ); + connect( nbPlan, SIGNAL( valueChanged( int )), this, SLOT( DrawTable( ) ) ); + connect( myPosSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) ); + connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) ); + + // default values + myCutPlanes = NULL; + hasInit = false; + X1 = 0; X2 = 0; + Y1 = 0; Y2 = 0; + Z1 = 0; Z2 = 0; + RByz->setChecked( true ); + +} // End of Constructor + +VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane() +{ + cout<<"### VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane"<Destroy(); + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + vf->Repaint(); +} + +void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs) +{ + setNbPlanes(thePrs->GetNbPlanes()); + setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI); + setPlanePos(thePrs->GetOrientationType()); + myPosSpn->setValue(thePrs->GetDisplacement()); + hasInit = true; + // init table + myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false); + myCutPlanes->SameAs(thePrs); + DrawTable(); + + // Draw Preview + if (myPreviewCheck->isChecked()) { + createPlanes(); + } +} + +void VisuGUI_CutPlanesPane::createPlanes() +{ + if (VISU::GetViewWindow() == NULL) return; + if (myCutPlanes == NULL) return; + if (myPreviewActor != 0) return; + + vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData(); + if (!aPolyData->GetOutput()->GetNumberOfCells()) { + onPreviewCheck(false); + return; + } + vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); + aPlaneMapper->SetInput(aPolyData->GetOutput()); + aPlaneMapper->ScalarVisibilityOff(); + + myPreviewActor = SALOME_Actor::New(); + myPreviewActor->PickableOff(); + myPreviewActor->SetMapper(aPlaneMapper); + aPlaneMapper->Delete(); + VISU::GetViewWindow()->AddActor(myPreviewActor); +} + +int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs) +{ + thePrs->SetOrientation(getOrientaion(), getRotation1()*PI/180., getRotation2()*PI/180.); + thePrs->SetNbPlanes(getNbPlanes()); + thePrs->SetDisplacement(myPosSpn->value()); + for (int i = 0; i < getNbPlanes(); ++i) { + QCheckTableItem* anItem = (QCheckTableItem*)myPosTable->item(i, 1); + if (!anItem) + break; + if (!anItem->isChecked()) + thePrs->SetPlanePosition(i, myPosTable->text(i, 0).toDouble()); + else + thePrs->SetDefault(i); + } + return 1; +} + +/*! + Called when orientation is changed +*/ +void VisuGUI_CutPlanesPane::orientationChanged (int Id) +{ + if (Id == 0) { // RBxy->isChecked() + LabelRot1->setText(tr("LBL_ROT_X")); + LabelRot2->setText(tr("LBL_ROT_Y")); + } else if (Id == 1) { // RByz->isChecked() + LabelRot1->setText(tr("LBL_ROT_Y")); + LabelRot2->setText(tr("LBL_ROT_Z")); + } else { + LabelRot1->setText(tr("LBL_ROT_Z")); + LabelRot2->setText(tr("LBL_ROT_X")); + } + DrawTable(); +} + +/*! + Sets planes orientation and position +*/ +void VisuGUI_CutPlanesPane::setPlanePos (const VISU::CutPlanes::Orientation orient) +{ + if (orient == VISU::CutPlanes::XY) // xy + { + RBxy->setChecked( true ); + orientationChanged( 0 ); + } + else if (orient == VISU::CutPlanes::YZ) // yz + { + RByz->setChecked( true ); + orientationChanged( 1 ); + } + else // zx + { + RBzx->setChecked( true ); + orientationChanged( 2 ); + } + +} + +/*! + Gets planes orientation +*/ +VISU::CutPlanes::Orientation VisuGUI_CutPlanesPane::getOrientaion() +{ + VISU::CutPlanes::Orientation orient; + if ( RBxy->isChecked() ) // xy + orient = VISU::CutPlanes::XY; + else if ( RByz->isChecked() ) // yz + orient = VISU::CutPlanes::YZ; + else if ( RBzx->isChecked() ) // zx + orient = VISU::CutPlanes::ZX; + return orient; +} + +/*! + Sets planes rotation +*/ +void VisuGUI_CutPlanesPane::setRotation (const double r1, const double r2) +{ + Rot1->setValue( r1 ); + Rot2->setValue( r2 ); +} + +/*! + Draw the table of planes positions +*/ +void VisuGUI_CutPlanesPane::DrawTable() +{ + if (myCutPlanes == NULL) return; + if (!hasInit) return; + + int aNbRows = myPosTable->numRows(); + int aNbPlanes = getNbPlanes(); + + myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.); + myCutPlanes->SetNbPlanes(aNbPlanes); + myCutPlanes->SetDisplacement(myPosSpn->value()); + if (aNbRows>0) + for (int i = 0; i < aNbRows; ++i) { + QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 ); + if (aItem == 0) break; + if (!aItem->isChecked()) + myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble()); + } + + if (aNbPlanes > aNbRows) + myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows ); + else if (aNbPlanes < aNbRows) + myPosTable->setNumRows(aNbPlanes); + + int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes; + for (int i = 0; isetText(i, 0, QString::number(myCutPlanes->GetPlanePosition(i))); + ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutPlanes->IsDefault(i)); + } + + QHeader *vh = myPosTable->verticalHeader(); + QString str("Plane# %1"); + for (int i=aMin; iGetPlanePosition(i))); + aEditItem->setReplaceable(false); + aEditItem->setEnabled(!myCutPlanes->IsDefault(i)); + myPosTable->setItem(i, 0, aEditItem); + + QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0); + aCheck->setChecked(myCutPlanes->IsDefault(i)); + aCheck->setReplaceable(false); + myPosTable->setItem(i, 1, aCheck); + + vh->setLabel( i, str.arg(i+1) ); + } + + // Update preview + if (myPreviewCheck->isChecked()) { + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + myCutPlanes->GetPL()->Update(); + deletePlanes(); + createPlanes(); + vf->Repaint(); + } + } +} + +void VisuGUI_CutPlanesPane::setDefault (int all) +{ + myPosTable->setCurrentCell(-1, 1); + myPosTable->clearSelection(); + if (all == 0) return; + if (all == 1) + for (int i = 0; i < getNbPlanes(); ++i) + ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true); + + for (int i = 0; i < getNbPlanes(); ++i) { + if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) { + myCutPlanes->SetDefault(i); + myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i))); + myPosTable->item( i, 0 )->setEnabled(false); + } else + myPosTable->item( i, 0 )->setEnabled(true); + } +} + +void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol) +{ + if (theCol == 0) { + QString aTxt = myPosTable->text(theRow, 0); + bool isChanged = !aTxt.isEmpty(); + ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged); + + if (myPreviewCheck->isChecked()) { + //Update Preview + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble()); + myCutPlanes->GetPL()->Update(); + deletePlanes(); + createPlanes(); + vf->Repaint(); + } + } + } else { + bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked(); + if (isDefault) { + myCutPlanes->SetDefault(theRow); + myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow))); + + if (myPreviewCheck->isChecked()) { + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + //Update Preview + myCutPlanes->GetPL()->Update(); + deletePlanes(); + createPlanes(); + vf->Repaint(); + } + } + } + myPosTable->item(theRow, 0)->setEnabled(!isDefault); + } +} + +void VisuGUI_CutPlanesPane::deletePlanes() +{ + if (myPreviewActor == 0) return; + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + vf->RemoveActor(myPreviewActor); + myPreviewActor->Delete(); + myPreviewActor = 0; +} + +void VisuGUI_CutPlanesPane::onRotation (double theValue) +{ + if (myCutPlanes == NULL) return; + if (myPreviewCheck->isChecked()) { + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.); + myCutPlanes->GetPL()->Update(); + deletePlanes(); + createPlanes(); + vf->Repaint(); + } + } +} + +void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview) +{ + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (thePreview) { + storeToPrsObject(myCutPlanes); + myCutPlanes->GetPL()->Update(); + createPlanes(); + vf->onFitAll(); + } else { + deletePlanes(); + vf->Repaint(); + } + } +} + +//################################################################### + + +/*! + Constructor +*/ +VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule) + : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutPlanesDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + setCaption("Cut Planes Definition"); + setSizeGripEnabled(true); + + QVBoxLayout* TopLayout = new QVBoxLayout (this); + TopLayout->setSpacing(6); + TopLayout->setMargin(11); + + // Tab pane + QTabWidget* aTabBox = new QTabWidget(this); + myCutPane = new VisuGUI_CutPlanesPane(this/*, myMgr*/); + aTabBox->addTab(myCutPane, "Cut Planes"); + myScalarPane = new VisuGUI_ScalarBarPane(this, false); + myScalarPane->setMargin(5); + aTabBox->addTab(myScalarPane, "Scalar Bar"); + + TopLayout->addWidget(aTabBox); + + QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons"); + GroupButtons->setGeometry(QRect(10, 10, 281, 48)); + GroupButtons->setTitle(""); + GroupButtons->setColumnLayout(0, Qt::Vertical); + GroupButtons->layout()->setSpacing(0); + GroupButtons->layout()->setMargin(0); + QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); + GroupButtonsLayout->setAlignment(Qt::AlignTop); + GroupButtonsLayout->setSpacing(6); + GroupButtonsLayout->setMargin(11); + + QPushButton* buttonOk = new QPushButton(tr("&OK"), GroupButtons, "buttonOk"); + buttonOk->setAutoDefault(TRUE); + buttonOk->setDefault(TRUE); + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + + QPushButton* buttonCancel = new QPushButton(tr("&Cancel"), GroupButtons, "buttonCancel"); + buttonCancel->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + + TopLayout->addWidget(GroupButtons); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject())); + //connect(VisuGUI::application()->desktop(), + // SIGNAL(windowActivated(SUIT_ViewWindow*)), + // this, SLOT(onWindowActivated(SUIT_ViewWindow*))); +} + +void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::CutPlanes_i* thePrs) +{ + myPrs = thePrs; + myScalarPane->initFromPrsObject(thePrs); + myCutPane->initFromPrsObject(thePrs); +} + +int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::CutPlanes_i* thePrs) +{ + return (myScalarPane->storeToPrsObject(thePrs) && + myCutPane->storeToPrsObject(thePrs)); +} + +void VisuGUI_CutPlanesDlg::accept() +{ + //if ( !VisuGUI::CheckActiveStudyLock() ) { + // reject(); + // return; + //} + if (myScalarPane->check()) + { + myScalarPane->deletePreview(); + QDialog::accept(); + } +} + +void VisuGUI_CutPlanesDlg::reject() { + myScalarPane->deletePreview(); + QDialog::reject(); +} + +//void VisuGUI_CutPlanesDlg::onWindowActivated (SUIT_ViewWindow* theWnd) +//{ +// if (theWnd != myStudyWnd) +// reject(); +//} + +//################################################################### + +QWidget* VisuGUI_NumEditItem::createEditor() const +{ + QLineEdit *editline = new QLineEdit(text(), table()->viewport()); + QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport()); + dvalidator->setDecimals(32); + editline->setValidator(dvalidator); + return editline; +} diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx new file mode 100644 index 00000000..da99973c --- /dev/null +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -0,0 +1,151 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUI_MagnitudeDlg.cxx +// Author : Laurent CORNABE & Hubert ROLLAND +// Module : VISU +// $Header$ + +#include "VisuGUI_DeformedShapeDlg.h" + +#include "VisuGUI_Tools.h" + +#include "VISU_DeformedShape_i.hh" + +#include "SalomeApp_Module.h" +#include "SUIT_Desktop.h" + +#include +#include + +using namespace std; + +/*! + * Constructor + */ +VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule) + : QDialog(VISU::GetDesktop(theModule), "VisuGUI_DeformedShapeDlg", true, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + setCaption(tr("DLG_TITLE")); + setSizeGripEnabled(TRUE); + + QVBoxLayout* TopLayout = new QVBoxLayout (this); + TopLayout->setSpacing(6); + TopLayout->setMargin(11); + + QTabWidget* aTabBox = new QTabWidget (this); + + // Deformed shape pane + QVBox* aBox = new QVBox (this); + aBox->setMargin(11); + QFrame* TopGroup = new QFrame (aBox, "TopGroup"); + TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken); + TopGroup->setLineWidth(1); + QGridLayout* TopGroupLayout = new QGridLayout (TopGroup); + TopGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + TopGroupLayout->setSpacing(6); + TopGroupLayout->setMargin(11); + + // Scale factor + QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup, "ScaleLabel"); + TopGroupLayout->addWidget(ScaleLabel, 0, 0); + + ScalFact = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, TopGroup); + ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + ScalFact->setPrecision(5); + ScalFact->setValue(0.1); + TopGroupLayout->addWidget(ScalFact, 0, 1); + + // Magnitude coloring + UseMagn = new QCheckBox (tr("MAGNITUDE_COLORING"), TopGroup, "UseMagn"); + UseMagn->setChecked(true); + TopGroupLayout->addMultiCellWidget(UseMagn, 1, 1, 0, 1); + + aTabBox->addTab(aBox, tr("DEFORMED_SHAPE_TAB")); + + // Scalar bar pane + myScalarPane = new VisuGUI_ScalarBarPane (this, false); + myScalarPane->setMargin(5); + + aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB")); + + // Buttons + QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons"); + GroupButtons->setGeometry(QRect(10, 10, 281, 48)); + GroupButtons->setColumnLayout(0, Qt::Vertical); + GroupButtons->layout()->setSpacing(0); + GroupButtons->layout()->setMargin(0); + QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout()); + GroupButtonsLayout->setAlignment(Qt::AlignTop); + GroupButtonsLayout->setSpacing(6); + GroupButtonsLayout->setMargin(11); + + QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk"); + buttonOk->setAutoDefault(TRUE); + buttonOk->setDefault(TRUE); + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + + GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding, + QSizePolicy::Minimum), 0, 1); + + QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel"); + buttonCancel->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + + // Add Tab box and Buttons to the top layout + TopLayout->addWidget(aTabBox); + TopLayout->addWidget(GroupButtons); + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); +} + +void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::DeformedShape_i* thePrs) +{ + myScalarPane->initFromPrsObject(thePrs); + setFactor(thePrs->GetScale()); + UseMagn->setChecked(thePrs->IsColored()); +} + +int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) { + myScalarPane->storeToPrsObject(thePrs); + thePrs->SetScale(getFactor()); + thePrs->ShowColored(isColored()); + return 1; +} + +void VisuGUI_DeformedShapeDlg::accept() { + if (myScalarPane->check()) + { + myScalarPane->deletePreview(); + QDialog::accept(); + } +} + +void VisuGUI_DeformedShapeDlg::reject() +{ + myScalarPane->deletePreview(); + QDialog::reject(); +} diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h new file mode 100644 index 00000000..573c439a --- /dev/null +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h @@ -0,0 +1,77 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUI_MagnitudeDlg.h +// Author : Laurent CORNABE & Hubert ROLLAND +// Module : VISU +// $Header$ + +#ifndef VISUGUI_DEFORMEDSHAPEDLS_H +#define VISUGUI_DEFORMEDSHAPEDLS_H + +#include "VisuGUI_ScalarBarDlg.h" + +#include "QtxDblSpinBox.h" + +#include +#include +#include +#include +#include + +class SalomeApp_Module; + +namespace VISU{ + class DeformedShape_i; +} + +class VisuGUI_DeformedShapeDlg : public QDialog +{ + Q_OBJECT + +public: + VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule); + ~VisuGUI_DeformedShapeDlg() {}; + + double getFactor() + { return ScalFact->value(); } + void setFactor(double theFactor) + { ScalFact->setValue(theFactor); } + + bool isColored() + { return UseMagn->isChecked(); } + + void initFromPrsObject(VISU::DeformedShape_i* thePrs); + int storeToPrsObject(VISU::DeformedShape_i* thePrs); + +protected slots: + void accept(); + void reject(); + + private: + QtxDblSpinBox* ScalFact; + QCheckBox* UseMagn; + VisuGUI_ScalarBarPane* myScalarPane; +}; + +#endif // VISUGUI_DEFORMEDSHAPEDLS_H diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx new file mode 100644 index 00000000..34d170b9 --- /dev/null +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx @@ -0,0 +1,225 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUI_IsoSurfacesDlg.cxx +// Author : Laurent CORNABE & Hubert ROLLAND +// Module : VISU +// $Header$ + +#include "VisuGUI_IsoSurfacesDlg.h" + +#include "VisuGUI.h" +#include "VisuGUI_Tools.h" + +#include "SalomeApp_Application.h" + +#include "SUIT_Desktop.h" +#include "SUIT_MessageBox.h" + +#include + +#include +#include +#include + +using namespace std; + + +VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent) + : QVBox(parent) +{ + QFrame* TopGroup = new QFrame( this, "TopGroup" ); + TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken); + TopGroup->setLineWidth(1); + + QGridLayout* TopGroupLayout = new QGridLayout(TopGroup); + TopGroupLayout->setAlignment( Qt::AlignTop ); + TopGroupLayout->setSpacing( 6 ); + TopGroupLayout->setMargin( 11 ); + + QLabel* LabelNbr = new QLabel (tr("NB_SURFACES"), TopGroup, "LabelNbr"); + TopGroupLayout->addWidget( LabelNbr, 0, 0 ); + NbrIso = new QSpinBox( 1, 100, 1, TopGroup, "NbrIso" ); + NbrIso->setValue( 1 ); + TopGroupLayout->addWidget( NbrIso, 0, 1 ); + + QLabel* LabelMin = new QLabel (tr("MIN_VALUE"), TopGroup, "LabelMin"); + TopGroupLayout->addWidget(LabelMin, 1, 0); + //MinIso = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, TopGroup ); + MinIso = new QLineEdit( TopGroup ); + MinIso->setValidator( new QDoubleValidator(TopGroup) ); + MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + MinIso->setMinimumSize( 70, 0 ); + LabelMin->setBuddy(MinIso); + TopGroupLayout->addWidget( MinIso, 1, 1 ); + + QLabel* LabelMax = new QLabel (tr("MAX_VALUE"), TopGroup, "LabelMax"); + TopGroupLayout->addWidget( LabelMax, 2, 0 ); + //MaxIso = new QtxSpinBoxDbl( -DBL_MAX, DBL_MAX, 0.1, TopGroup ); + MaxIso = new QLineEdit( TopGroup ); + MaxIso->setValidator( new QDoubleValidator(TopGroup) ); + MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + MaxIso->setMinimumSize( 70, 0 ); + LabelMax->setBuddy(MaxIso); + TopGroupLayout->addWidget( MaxIso, 2, 1 ); + + +// CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup); +// CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) ); +// TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1); +// CBUpdate->setChecked(false); + QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup); + TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1); + connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) ); + +// CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup); +// CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) ); +// TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1); +} + +void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs) +{ + NbrIso->setValue(thePrs->GetNbSurfaces()); + MinIso->setText(QString::number(thePrs->GetSubMin())); + MaxIso->setText(QString::number(thePrs->GetSubMax())); +// switch(thePrs->GetScaling()){ +// case VISU::LOGARITHMIC : +// CBLog->setChecked(true); +// break; +// default: +// CBLog->setChecked(false); +// } +} + +int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs) +{ + thePrs->SetNbSurfaces(NbrIso->value()); + thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble()); + return 1; +// if (CBUpdate->isChecked()) +// { +// thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble()); +// if (CBLog->isChecked()) +// thePrs->SetScaling(VISU::LOGARITHMIC); +// else +// thePrs->SetScaling(VISU::LINEAR); +// } +} + +void VisuGUI_IsoSurfPane::onCBUpdate() +{ + // if (CBUpdate->isChecked()) { + myScalarPane->setRange(MinIso->text().toDouble(), MaxIso->text().toDouble(), true); + // } +// CBLog->setDisabled(false); +// else CBLog->setDisabled(true); +} + +bool VisuGUI_IsoSurfPane::check() +{ + if (MinIso->text().toDouble() >= MaxIso->text().toDouble()) { + MESSAGE(tr("MSG_MINMAX_VALUES")); + SUIT_MessageBox::warn1( this,tr("WRN_VISU"), + tr("MSG_MINMAX_VALUES"), + tr("BUT_OK")); + return false; + } // else if (/* CBUpdate->isChecked() && CBLog->isChecked() && */ +// (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) ) { +// SUIT_MessageBox::warn1( this, +// tr("WRN_VISU"), +// tr("WRN_LOGARITHMIC_RANGE_ISOSURF"), +// tr("BUT_OK")); +// return false; +// } + return true; +} + + + + + +/*! + Constructor +*/ +VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule) + : QDialog(VISU::GetDesktop(theModule), "VisuGUI_IsoSurfacesDlg", true, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + setCaption(tr("DEFINE_ISOSURFACES")); + setSizeGripEnabled( TRUE ); + + QVBoxLayout* TopLayout = new QVBoxLayout(this); + TopLayout->setSpacing( 6 ); + TopLayout->setMargin(11); + + QTabWidget* aTabBox = new QTabWidget(this); + myIsoPane = new VisuGUI_IsoSurfPane(this); + myIsoPane->setMargin( 5 ); + aTabBox->addTab(myIsoPane, "Iso Surface"); + myScalarPane = new VisuGUI_ScalarBarPane(this, false); + myIsoPane->setScalarBarPane(myScalarPane); + myScalarPane->setMargin( 5 ); + aTabBox->addTab(myScalarPane, "Scalar Bar"); + + TopLayout->addWidget(aTabBox); + + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + + TopLayout->addWidget(GroupButtons); + + // signals and slots connections + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +void VisuGUI_IsoSurfacesDlg::accept() +{ + if (myIsoPane->check() && myScalarPane->check()) + { + myScalarPane->deletePreview(); + QDialog::accept(); + } +} + +void VisuGUI_IsoSurfacesDlg::reject() +{ + myScalarPane->deletePreview(); + QDialog::reject(); +} diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h new file mode 100644 index 00000000..dc0547f1 --- /dev/null +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h @@ -0,0 +1,95 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUI_IsoSurfacesDlg.h +// Author : Laurent CORNABE & Hubert ROLLAND +// Module : VISU +// $Header$ + +#ifndef VISUGUI_ISOSURFACESDLG_H +#define VISUGUI_ISOSURFACESDLG_H + +#include "VisuGUI_ScalarBarDlg.h" +#include "VISU_IsoSurfaces_i.hh" + +#include +#include +#include +#include +#include +#include +#include + +class SalomeApp_Module; + +class VisuGUI_IsoSurfPane : public QVBox +{ + Q_OBJECT; + + public: + VisuGUI_IsoSurfPane (QWidget* parent); + ~VisuGUI_IsoSurfPane() {}; + + void initFromPrsObject(VISU::IsoSurfaces_i* thePrs); + int storeToPrsObject(VISU::IsoSurfaces_i* thePrs); + + void setScalarBarPane(VisuGUI_ScalarBarPane* theScalarPane) {myScalarPane = theScalarPane;} + VisuGUI_ScalarBarPane* getScalarBarPane() {return myScalarPane;} + + bool check(); + + protected slots: + void onCBUpdate(); + + private: + QLineEdit* MinIso; + QLineEdit* MaxIso; + QSpinBox* NbrIso; + VisuGUI_ScalarBarPane* myScalarPane; +}; + + +class VisuGUI_IsoSurfacesDlg : public QDialog +{ + Q_OBJECT; + + public: + VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule); + ~VisuGUI_IsoSurfacesDlg() {}; + + void initFromPrsObject(VISU::IsoSurfaces_i* thePrs) + {myScalarPane->initFromPrsObject(thePrs); myIsoPane->initFromPrsObject(thePrs);} + + int storeToPrsObject(VISU::IsoSurfaces_i* thePrs) + {return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs);} + + protected slots: + void accept(); + void reject(); + + private: + VisuGUI_IsoSurfPane* myIsoPane; + VisuGUI_ScalarBarPane* myScalarPane; +}; + +#endif // VISUGUI_ISOSURFACESDLG_H diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx new file mode 100644 index 00000000..aba09d66 --- /dev/null +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -0,0 +1,554 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : VisuGUI_StreamLinesDlg.cxx +// Author : Vitaly SMETANNIKOV +// Module : VISU + +#include "VisuGUI_StreamLinesDlg.h" + +#include "VisuGUI.h" +#include "VisuGUI_Tools.h" + +#include "VISU_Mesh_i.hh" +#include "VISU_Gen_i.hh" +#include "VISU_StreamLines_i.hh" +#include "VISU_StreamLinesPL.hxx" +#include "VISU_Actor.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include "SVTK_ViewWindow.h" + +#include "SUIT_Desktop.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_MessageBox.h" + +#include "SALOME_ListIO.hxx" + +#include + +#include +#include +#include +#include +#include + +using namespace std; + +VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) + : QDialog(VISU::GetDesktop(theModule), "VisuGUI_StreamLinesDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myVisuGUI(theModule) +{ + myPrs = NULL; + setCaption(tr("DLG_TITLE")); + setSizeGripEnabled(TRUE); + + QVBoxLayout* aBoxLayout = new QVBoxLayout(this); + aBoxLayout->setSpacing( 6 ); + aBoxLayout->setMargin( 11 ); + + QTabWidget* aTabBox = new QTabWidget(this); + + QFrame* aTopBox = new QFrame(this); + aTopBox->setMargin( 11 ); + QGridLayout* TopLayout = new QGridLayout( aTopBox ); + TopLayout->setAlignment( Qt::AlignTop ); + TopLayout->setSpacing( 8 ); + TopLayout->setMargin( 11 ); + + // Source box + QGroupBox* aSourceBox = new QGroupBox (tr("SOURCE_GRP"), aTopBox); + aSourceBox->setColumnLayout(0, Qt::Vertical); + QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() ); + aSrcLayout->setSpacing( 6 ); + aSrcLayout->setMargin( 0 ); + + QLabel* aTypeLbl = new QLabel( tr( "LBL_SOURCE_TYPE" ), aSourceBox); + aSrcLayout->addWidget(aTypeLbl, 0, 0); + + myUseSrcCombo = new QComboBox(aSourceBox); + const char* aChoise[] = { "None", "Entity", "Family", "Group", "Presentation", 0 }; + myUseSrcCombo->insertStrList(aChoise); + aSrcLayout->addWidget(myUseSrcCombo, 0, 1); + + mySrcCombo = new QComboBox(aSourceBox); + mySrcCombo->setEnabled((myUseSrcCombo->currentItem() == 0)); + + connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int))); + + // Find All prs obj + //SUIT_Study* aActiveStudy = VISU::(myVisuGUI); + _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI)); + LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI); + SALOME_ListIO selected; + aSel->selectedObjects(selected); + if (selected.Extent() > 0) { + Handle(SALOME_InteractiveObject) aIO = selected.First(); + if (aIO->hasEntry()) { + _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + mySelectionObj = aSObject; + CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj); + VISU::Result_var aResult; + if (CORBA::is_nil(anObject)) { + mySelectionObj = mySelectionObj->GetFather(); + } + _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj); + + for (aIter->InitEx(true); aIter->More(); aIter->Next()) { + _PTR(SObject) aChildSObj = aIter->Value(); + CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj); + + if (!CORBA::is_nil(aChildObject)) { + VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); + if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object + if ((aPrsObj->GetType() != VISU::TSTREAMLINES) && + (aPrsObj->GetType() != VISU::TMESH)) { + _PTR(GenericAttribute) anAttr; + if (aChildSObj->FindAttribute(anAttr, "AttributeName")) { + _PTR(AttributeName) aName (anAttr); + myPrsLst += QString(aName->Value().c_str()); + myPrsList.append(aPrsObj); + continue; + } + } + } + } + // else { // This is not a Prs object + _PTR(GenericAttribute) anAttr; + if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + string aComm = aComment->Value(); + QString strIn (aComm.c_str()); + VISU::Storable::TRestoringMap aMap; + VISU::Storable::StrToMap(strIn,aMap); + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); + if (isExist) { + if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) { + _PTR(GenericAttribute) aNameAttr; + if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) { + _PTR(AttributeName) aName (aNameAttr); + VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); + switch (aType) { + case VISU::TFAMILY: + myFamilisLst += QString(aName->Value().c_str()); + myFamilyList.append(aPrsObj); + break; + case VISU::TGROUP: + myGroupsLst += QString(aName->Value().c_str()); + myGroupList.append(aPrsObj); + break; + case VISU::TENTITY: + myEntitiesLst += QString(aName->Value().c_str()); + myEntityList.append(aPrsObj); + break; + } + } + } + } + } + } + } + } + + // connect(myUseSrcChk, SIGNAL(toggled(bool)), mySrcCombo, SLOT(setEnabled(bool))); + aSrcLayout->addMultiCellWidget(mySrcCombo, 1, 1, 0, 1); + + QLabel* aPercentLbl = new QLabel (tr("LBL_USED_POINTS"), aSourceBox); + aSrcLayout->addWidget(aPercentLbl, 2, 0); + + myPntPercent = new QtxDblSpinBox( 0, 1, 0.1, aSourceBox ); + aSrcLayout->addWidget(myPntPercent, 2, 1); + + TopLayout->addMultiCellWidget(aSourceBox, 0, 0, 0, 1); + + QLabel* aStepLenLbl = new QLabel (tr("LBL_STEP_LENGTH"), aTopBox); + TopLayout->addWidget(aStepLenLbl, 1, 0); + myStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox ); + myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + TopLayout->addWidget(myStepLen, 1, 1); + connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double))); + + QLabel* aIntegStepLenLbl = new QLabel (tr("LBL_INTEGRATION_STEP"), aTopBox); + TopLayout->addWidget(aIntegStepLenLbl, 2, 0); + myIntegStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox ); + myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + TopLayout->addWidget(myIntegStepLen, 2, 1); + connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double))); + + QLabel* aPropagationLbl = new QLabel (tr("LBL_PROPAGATION_TIME"), aTopBox); + TopLayout->addWidget(aPropagationLbl, 3, 0); + myPropTime = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 1, aTopBox ); + myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + TopLayout->addWidget(myPropTime, 3, 1); + connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double))); + + QLabel* aDirLbl = new QLabel (tr("LBL_DIRECTION"),aTopBox); + TopLayout->addWidget(aDirLbl, 4, 0); + myDirCombo = new QComboBox(aTopBox); + myDirCombo->insertItem("Forward"); + myDirCombo->insertItem("Backward"); + myDirCombo->insertItem("Both"); + TopLayout->addWidget(myDirCombo, 4, 1); + + myUseScalar = new QCheckBox (tr("MAGNITUDE_COLORING_CHK"), aTopBox, "UseMagn"); + connect( myUseScalar, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) ); + TopLayout->addWidget(myUseScalar, 5, 0); + + SelColor = new QPushButton (tr("USE_COLOR_BTN"), aTopBox, "SelColor"); + connect( SelColor, SIGNAL( clicked() ), this, SLOT( setVColor() ) ); + TopLayout->addWidget( SelColor, 5, 1); + + aTabBox->addTab(aTopBox, "Stream Lines"); + myScalarPane = new VisuGUI_ScalarBarPane(this, false); + myScalarPane->setMargin( 5 ); + aTabBox->addTab(myScalarPane, "Scalar Bar"); + + aBoxLayout->addWidget(aTabBox); + + QGroupBox* aGroupButtons = new QGroupBox( this, "GroupButtons" ); + aGroupButtons->setColumnLayout(0, Qt::Vertical ); + aGroupButtons->layout()->setSpacing( 0 ); + aGroupButtons->layout()->setMargin( 0 ); + + QGridLayout* aGroupButtonsLayout = new QGridLayout( aGroupButtons->layout() ); + aGroupButtonsLayout->setAlignment( Qt::AlignTop ); + aGroupButtonsLayout->setSpacing( 6 ); + aGroupButtonsLayout->setMargin( 11 ); + + QPushButton* aOkBtn = new QPushButton( tr( "&OK" ), aGroupButtons, "buttonOk" ); + aOkBtn->setAutoDefault( TRUE ); + aOkBtn->setDefault( TRUE ); + aGroupButtonsLayout->addWidget( aOkBtn, 0, 0 ); + aGroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + + QPushButton* aCancelBtn = new QPushButton( tr( "&Cancel" ) , aGroupButtons, "buttonCancel" ); + aCancelBtn->setAutoDefault( TRUE ); + aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 ); + connect( aOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); + + aBoxLayout->addWidget(aGroupButtons); + + enableSetColor(); +} + + + +void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs) +{ + myScalarPane->initFromPrsObject(thePrs); + + myPrs = thePrs; + static int aNbOfSteps = 30; + VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetStreamLinesPL(); + float aMin, aMax; + aMin = aStreamLinesPL->GetMinPropagationTime(); + aMax = aStreamLinesPL->GetMaxPropagationTime(); + myPropTime->setRange(aMin,aMax); + myPropTime->setValue(aStreamLinesPL->GetPropagationTime()); + myPropTime->setLineStep((aMax-aMin)/aNbOfSteps); + + aMin = aStreamLinesPL->GetMinStepLength(); + aMax = aStreamLinesPL->GetMaxStepLength(); + myStepLen->setRange(aMin,aMax); + myStepLen->setValue(aStreamLinesPL->GetStepLength()); + myStepLen->setLineStep((aMax-aMin)/aNbOfSteps); + + aMin = aStreamLinesPL->GetMinIntegrationStep(); + aMax = aStreamLinesPL->GetMaxIntegrationStep(); + myIntegStepLen->setRange(aMin,aMax); + myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep()); + myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps); + + switch (thePrs->GetDirection()) { + case VISU::StreamLines::FORWARD: + myDirCombo->setCurrentItem(0); + break; + case VISU::StreamLines::BACKWARD: + myDirCombo->setCurrentItem(1); + break; + case VISU::StreamLines::BOTH: + myDirCombo->setCurrentItem(2); + } + myUseScalar->setChecked(thePrs->IsColored()); + myPntPercent->setValue(thePrs->GetUsedPoints()); + + mySrcCombo->setEnabled(false); + QString aSrcEntry = thePrs->GetSourceEntry(); + + SALOMEDS::Color anOldColor = thePrs->GetColor(); + QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B)); + setColor(aColor); + enableSetColor(); + +#define INITPRS(PRSLIST, PRSNUM) \ + for (int i = 0; i < PRSLIST.count(); i++) { \ + VISU::Prs3d_i* aPrs = dynamic_cast(VISU::GetServant(PRSLIST[i]).in()); \ + if (aPrs == NULL) continue; \ + if (aSrcEntry == aPrs->GetEntry()) { \ + onSourceTypeChange(PRSNUM); \ + myUseSrcCombo->setCurrentItem(PRSNUM); \ + mySrcCombo->setEnabled(true); \ + mySrcCombo->setCurrentItem(i); \ + return; \ + } \ + } + + if (!aSrcEntry.isEmpty()) { + INITPRS(myEntityList, 1); + INITPRS(myFamilyList, 2); + INITPRS(myGroupList, 3); + INITPRS(myPrsList, 4); + } +#undef INITPRS +} + +int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs) +{ + bool isAccepted = myScalarPane->storeToPrsObject(thePrs); + if (isAccepted) { + thePrs->ShowColored(myUseScalar->isChecked()); + if (!thePrs->IsColored()) { + SALOMEDS::Color aColor; + aColor.R = myColor.red()/255.; + aColor.G = myColor.green()/255.; + aColor.B = myColor.blue()/255.; + thePrs->SetColor(aColor); + } + + VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH; + switch (myDirCombo->currentItem()) { + case 0: + aDirection = VISU::StreamLines::FORWARD; + break; + case 1: + aDirection = VISU::StreamLines::BACKWARD; + break; + case 2: + aDirection = VISU::StreamLines::BOTH; + } + + VISU::Prs3d_var aPrs; + int aSrcSelection = myUseSrcCombo->currentItem(); + int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1; + if ((aSrcSelection > 0) && (aSrcItem > -1)) { + VISU::VISUType aType; + QString aName; + switch (aSrcSelection) { + case 1: // Entity + aPrs = myEntityList[aSrcItem]; + aType = VISU::TENTITY; + aName = myEntitiesLst[aSrcItem]; + break; + case 2: // Family + aPrs = myFamilyList[aSrcItem]; + aType = VISU::TFAMILY; + aName = myFamilisLst[aSrcItem]; + break; + case 3: // Group + aPrs = myGroupList[aSrcItem]; + aType = VISU::TGROUP; + aName = myGroupsLst[aSrcItem]; + break; + case 4: // Presentation + aPrs = myPrsList[aSrcItem]; + break; + } + if (CORBA::is_nil(aPrs) && aSrcSelection != 4) { + aPrs = createMesh(aType, aName); + } + } + isAccepted = thePrs->SetParams(myIntegStepLen->value(), + myPropTime->value(), + myStepLen->value(), + aPrs, + myPntPercent->value(), + aDirection); + } + //if (!isAccepted) + // SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("WRN_VISU"), + // tr("ERR_CANT_BUILD_PRESENTATION"), + // tr("BUT_OK")); + return isAccepted; +} + +/*! + Sets color +*/ +void VisuGUI_StreamLinesDlg::setColor( QColor color ) +{ + myColor = color; + SelColor->setPaletteBackgroundColor(myColor); +} + + +/*! + Called when "Select Color" buttonx clicked +*/ +void VisuGUI_StreamLinesDlg::setVColor() +{ + QColor cnew = QColorDialog::getColor( myColor, this ); + if ( cnew.isValid() ) + setColor( cnew ); +} + + +/*! + Enbled/disables magnitude coloring +*/ +void VisuGUI_StreamLinesDlg::enableMagnColor( bool enable ) +{ + myUseScalar->setEnabled( enable ); + enableSetColor(); +} + +/*! + Called when "Magnitude Coloring" check box clicked +*/ +void VisuGUI_StreamLinesDlg::enableSetColor() +{ + SelColor->setEnabled(!myUseScalar->isChecked() ); +} + +void VisuGUI_StreamLinesDlg::StepLengthChanged(double theValue){ +} + +void VisuGUI_StreamLinesDlg::IntegrationStepChanged(double theValue) { +} + +void VisuGUI_StreamLinesDlg::PropagationTimeChanged(double theValue) { + myStepLen->setMaxValue(theValue); +} + +void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) { + mySrcCombo->clear(); + if (theIndex == 0) { + mySrcCombo->setEnabled(false); + return; + } else + mySrcCombo->setEnabled(true); + + switch(theIndex) { + case 1: // Entity + mySrcCombo->insertStringList(myEntitiesLst); + return; + case 2: // Family + mySrcCombo->insertStringList(myFamilisLst); + return; + case 3: // Group + mySrcCombo->insertStringList(myGroupsLst); + return; + case 4: // Presentation + mySrcCombo->insertStringList(myPrsLst); + return; + } +} + + +VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName) +{ + return VISU::Mesh::_nil(); +/* + CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj); + VISU::Result_var aResult; + if (!CORBA::is_nil(anObject)) { + aResult = VISU::Result::_narrow(anObject); + } + if (CORBA::is_nil(aResult)) { + SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"), + tr("WRN_NO_AVAILABLE_DATA"), + tr("BUT_OK")); + return VISU::Mesh::_nil(); + } + SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj ); + VISU::Storable::TRestoringMap aMap; + + for (aIter->InitEx(true); aIter->More(); aIter->Next() ) { + SALOMEDSClient_SObject* aChildSObj = aIter->Value(); + SALOMEDSClient_GenericAttribute* anAttr; + if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { + SALOMEDSClient_AttributeComment* aComment = dynamic_cast( anAttr ); + CORBA::String_var aComm = aComment->Value().c_str(); + QString strIn(aComm.in()); + aMap.clear(); + VISU::Storable::StrToMap(strIn,aMap); + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); + if (isExist) { + if (aType != theType) continue; + + SALOMEDSClient_GenericAttribute* aNameAttr; + if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) { + SALOMEDSClient_AttributeName* aName = dynamic_cast(aNameAttr); + if (QString(aName->Value()) == theName) break; //use current map + } + } + } + } + VISU::Mesh_var aMesh; + QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName"); + switch (theType) { + case VISU::TFAMILY: + { + VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt(); + aMesh = VisuGUI::GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.latin1(),anEntity,theName.latin1()); + } + break; + case VISU::TGROUP: + { + aMesh = VisuGUI::GetVisuGen()->GroupMesh(aResult,aMeshName.latin1(), theName.latin1()); + } + break; + case VISU::TENTITY: + { + VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt(); + aMesh = VisuGUI::GetVisuGen()->MeshOnEntity(aResult,aMeshName.latin1(),anEntity); + } + break; + } + if(!CORBA::is_nil(aMesh)){ // Create Actor + VISU::Mesh_i* pPresent = dynamic_cast(VISU::GetServant(aMesh).in()); + if(SVTK_ViewWindow* vf = VISU::GetViewWindow()){ + try{ + pPresent->SetPresentationType(VISU::POINT); + VISU_Actor *anActor = pPresent->CreateActor(); + vf->AddActor(anActor); + }catch(...){ + SUIT_MessageBox::warn1 ( VisuGUI::application()->desktop(), tr("VISU_WARNING"), + tr("ERR_CANT_CREATE_ACTOR"), + tr("BUT_OK") ); + } + } + } else { + SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"), + tr("ERR_CANT_BUILD_PRESENTATION"), + tr("BUT_OK")); + } + return aMesh._retn(); +*/ +} + +void VisuGUI_StreamLinesDlg::accept() { + if (myScalarPane->check()) + { + myScalarPane->deletePreview(); + QDialog::accept(); + } +} + +void VisuGUI_StreamLinesDlg::reject() +{ + myScalarPane->deletePreview(); + QDialog::reject(); +} diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.h b/src/VISUGUI/VisuGUI_StreamLinesDlg.h new file mode 100644 index 00000000..c5f45e20 --- /dev/null +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.h @@ -0,0 +1,86 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : VisuGUI_StreamLinesDlg.h +// Author : Vitaly SMETANNIKOV +// Module : VISU + +#ifndef VISUGUI_STREAMLINESDLG_H +#define VISUGUI_STREAMLINESDLG_H + +#include "VisuGUI_ScalarBarDlg.h" + +#include +#include +#include +#include + +class SalomeApp_Module; +class QtxDblSpinBox; + +namespace VISU{ + class StreamLines_i; +} + +class VisuGUI_StreamLinesDlg: public QDialog +{ + Q_OBJECT +public: + VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule); + ~VisuGUI_StreamLinesDlg() {}; + + void initFromPrsObject(VISU::StreamLines_i* thePrs); + int storeToPrsObject(VISU::StreamLines_i* thePrs); + void setColor( QColor color ); + void enableMagnColor( bool enable ); + +protected slots: + void accept(); + void reject(); + +private slots: + void onSelectionActive(bool theActive); + void StepLengthChanged(double theValue); + void IntegrationStepChanged(double theValue); + void PropagationTimeChanged(double theValue); + void onSourceTypeChange(int theIndex); + +private: + VISU::Mesh_ptr createMesh(VISU::VISUType theType, QString theName); + + QtxDblSpinBox* myStepLen; + QtxDblSpinBox* myIntegStepLen; + QtxDblSpinBox* myPropTime; + QComboBox* myDirCombo; + QCheckBox* myUseScalar; + QPushButton* SelColor; + QColor myColor; + //QCheckBox* myUseSrcChk; + QComboBox* myUseSrcCombo; + QtxDblSpinBox* myPntPercent; + QComboBox* mySrcCombo; + + VisuGUI_ScalarBarPane* myScalarPane; + + QValueList myPrsList; + QValueList myEntityList; + QValueList myFamilyList; + QValueList myGroupList; + QStringList myEntitiesLst; + QStringList myFamilisLst; + QStringList myGroupsLst; + QStringList myPrsLst; + + _PTR(SObject) mySelectionObj; + VISU::StreamLines_i* myPrs; + SalomeApp_Module* myVisuGUI; + +private slots: + void setVColor(); + void enableSetColor(); +}; + +#endif //VISUGUI_STREAMLINESDLG_H diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.cxx b/src/VISUGUI/VisuGUI_VectorsDlg.cxx new file mode 100644 index 00000000..a5e2f2c5 --- /dev/null +++ b/src/VISUGUI/VisuGUI_VectorsDlg.cxx @@ -0,0 +1,422 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUI_VectorsDlg.cxx +// Author : Laurent CORNABE & Hubert ROLLAND +// Module : VISU +// $Header$ + +#include "VisuGUI_VectorsDlg.h" + +#include "VisuGUI.h" +//#include "VisuGUI_Selection.h" +#include "VisuGUI_Tools.h" + +#include "VISU_Vectors_i.hh" + +#include "SalomeApp_Module.h" +#include "SUIT_Desktop.h" + +#include +#include +#include + +using namespace std; + +/*! + Constructor +*/ +VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule) + : QDialog(VISU::GetDesktop(theModule), "VisuGUI_VectorsDlg", true, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + setCaption(tr("DLG_TITLE")); + setSizeGripEnabled(TRUE); + + QVBoxLayout* TopLayout = new QVBoxLayout( this ); + TopLayout->setSpacing( 6 ); + TopLayout->setMargin( 11 ); + + QTabWidget* aTabBox = new QTabWidget(this); + + QVBox* aBox = new QVBox(this); + aBox->setMargin( 11 ); + + TopGroup = new QButtonGroup( aBox, "TopGroup" ); + TopGroup->setColumnLayout(0, Qt::Vertical ); + TopGroup->layout()->setSpacing( 0 ); + TopGroup->layout()->setMargin( 5 ); + QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() ); + TopGroupLayout->setAlignment( Qt::AlignTop ); + TopGroupLayout->setSpacing( 6 ); + TopGroupLayout->setMargin( 11 ); + + // Scale factor + ScaleLabel = new QLabel (tr("LBL_SCALE_FACTOR"), TopGroup, "ScaleLabel"); + + ScalFact = new QtxDblSpinBox( 1e-20, 1.0E+38, 0.1, TopGroup ); + ScalFact->setPrecision( 5 ); + ScalFact->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + ScalFact->setValue( 0.1 ); + + TopGroupLayout->addWidget( ScaleLabel, 0, 0 ); + TopGroupLayout->addWidget( ScalFact, 0, 1 ); + + // Line width + LineWidLabel = new QLabel (tr("LBL_LINE_WIDTH"), TopGroup, "LineWidLabel"); + + LinWid = new QSpinBox( 1, 10, 1, TopGroup, "LinWid" ); + LinWid->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + LinWid->setValue( 1 ); + + TopGroupLayout->addWidget( LineWidLabel, 1, 0 ); + TopGroupLayout->addWidget( LinWid, 1, 1 ); + + // Color + UseMagn = new QCheckBox (tr("MAGNITUDE_COLORING_CHK"), TopGroup, "UseMagn"); + //UseMagn->setText(tr("MAGNITUDE_COLORING_CHK")); + SelColor = new QPushButton (tr("SEL_COLOR_BTN"), TopGroup, "SelColor"); + + /* ColorLab = new QLabel( TopGroup, "ColorLab" ); + ColorLab->setFixedSize( SelColor->sizeHint().height(), SelColor->sizeHint().height() ); + ColorLab->setFrameStyle( QLabel::Plain | QLabel::Box ); + */ + TopGroupLayout->addWidget( UseMagn, 2, 0 ); + //TopGroupLayout->addWidget( ColorLab, 2, 1 ); + TopGroupLayout->addWidget( SelColor, 2, 1 ); + + // Gliphs + UseGlyph = new QCheckBox (tr("USE_GLYPHS_CHK"), TopGroup, "UseGlyph"); + + TypeGlyph = new QButtonGroup (tr("GLYPH_TYPE_GRP"), TopGroup, "TypeGlyph"); + TypeGlyph->setColumnLayout(0, Qt::Vertical ); + TypeGlyph->layout()->setSpacing( 0 ); + TypeGlyph->layout()->setMargin( 0 ); + QGridLayout* TypeGlyphLayout = new QGridLayout( TypeGlyph->layout() ); + TypeGlyphLayout->setAlignment( Qt::AlignTop ); + TypeGlyphLayout->setSpacing( 6 ); + TypeGlyphLayout->setMargin( 11 ); + + RBArrows = new QRadioButton (tr("ARROWS_BTN") , TypeGlyph, "RBArrows"); + TypeGlyphLayout->addWidget( RBArrows, 0, 0 ); + RBCones2 = new QRadioButton (tr("CONES2_BTN"), TypeGlyph, "RBCones2"); + TypeGlyphLayout->addWidget( RBCones2, 1, 0 ); + RBCones6 = new QRadioButton (tr("CONES6_BTN"), TypeGlyph, "RBCones6"); + TypeGlyphLayout->addWidget( RBCones6, 2, 0 ); + + PosGlyph = new QButtonGroup (tr("GLYPH_POSITION_GRP"), TopGroup, "PosGlyph"); + PosGlyph->setColumnLayout(0, Qt::Vertical ); + PosGlyph->layout()->setSpacing( 0 ); + PosGlyph->layout()->setMargin( 0 ); + QGridLayout* PosGlyphLayout = new QGridLayout( PosGlyph->layout() ); + PosGlyphLayout->setAlignment( Qt::AlignTop ); + PosGlyphLayout->setSpacing( 6 ); + PosGlyphLayout->setMargin( 11 ); + + RBTail = new QRadioButton (tr("TAIL_BTN" ), PosGlyph, "RBTail"); + PosGlyphLayout->addWidget( RBTail, 0, 0 ); + RBCent = new QRadioButton (tr("CENTER_BTN"), PosGlyph, "RBCent"); + PosGlyphLayout->addWidget( RBCent, 1, 0 ); + RBHead = new QRadioButton (tr("HEAD_BTN" ), PosGlyph, "RBHead"); + PosGlyphLayout->addWidget( RBHead, 2, 0 ); + + TopGroupLayout->addMultiCellWidget( UseGlyph, 3, 3, 0, 2 ); + TopGroupLayout->addWidget( TypeGlyph, 4, 0 ); + TopGroupLayout->addMultiCellWidget( PosGlyph, 4, 4, 1, 2 ); + + // Common buttons =========================================================== + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + + // top layout + aTabBox->addTab(aBox, "Vectors"); + myScalarPane = new VisuGUI_ScalarBarPane(this, false); + myScalarPane->setMargin( 5 ); + aTabBox->addTab(myScalarPane, "Scalar Bar"); + + TopLayout->addWidget( aTabBox ); + TopLayout->addWidget( GroupButtons ); + + // signals and slots connections + connect( UseGlyph, SIGNAL( clicked() ), this, SLOT( enableGlyphType() ) ); + connect( SelColor, SIGNAL( clicked() ), this, SLOT( setVColor() ) ); + connect( UseMagn, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) ); + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + + // default values + UseMagn->setChecked( TRUE ); + UseGlyph->setChecked( TRUE ); + RBArrows->setChecked( TRUE ); + RBTail->setChecked( TRUE ); + setColor( QColor( 255, 0, 0 ) ); + enableGlyphType(); + enableSetColor(); +} + + + +void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) { + myScalarPane->initFromPrsObject(thePrs); + setScaleFactor(thePrs->GetScale()); + setLineWidth((int)thePrs->GetLineWidth()); + setUseMagnColor(thePrs->IsColored()); + SALOMEDS::Color anOldColor = thePrs->GetColor(); + QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B)); + setColor(aColor); + + if (thePrs->GetGlyphType() != VISU::Vectors::NONE) { + setUseGlyphs(true); + setGlyphType(thePrs->GetGlyphType()); + setGlyphPos(thePrs->GetGlyphPos()); + } else + setUseGlyphs(false); + + enableSetColor(); +} + + +int VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) { + myScalarPane->storeToPrsObject(thePrs); + thePrs->SetScale(getScaleFactor()); + thePrs->SetLineWidth(getLineWidth()); + thePrs->ShowColored(getUseMagnColor()); + if(!thePrs->IsColored()){ + SALOMEDS::Color aColor; + aColor.R = myColor.red()/255.; + aColor.G = myColor.green()/255.; + aColor.B = myColor.blue()/255.; + thePrs->SetColor(aColor); + } + if (getUseGlyphs()) { + thePrs->SetGlyphPos(getGlyphPos()); + thePrs->SetGlyphType(getGlyphType()); + } else + thePrs->SetGlyphType(VISU::Vectors::NONE); + return 1; +} + + + +/*! + Called when "Use glyphs" check box clicked +*/ +void VisuGUI_VectorsDlg::enableGlyphType() +{ + TypeGlyph->setEnabled( UseGlyph->isChecked() ); + PosGlyph->setEnabled( UseGlyph->isChecked() ); +} + +/*! + Called when "Magnitude Coloring" check box clicked +*/ +void VisuGUI_VectorsDlg::enableSetColor() +{ + SelColor->setEnabled(!UseMagn->isChecked() ); + //ColorLab->setEnabled( UseMagn->isEnabled() && !UseMagn->isChecked() ); +} + +/*! + Called when "Select Color" buttonx clicked +*/ +void VisuGUI_VectorsDlg::setVColor() +{ + QColor cnew = QColorDialog::getColor( myColor, this ); + if ( cnew.isValid() ) + setColor( cnew ); +} + +/*! + Sets Scale factor +*/ +void VisuGUI_VectorsDlg::setScaleFactor( double sf ) +{ + ScalFact->setValue( sf ); +} + +/*! + Gets Scale factor +*/ +double VisuGUI_VectorsDlg::getScaleFactor() +{ + return ScalFact->value(); +} + +/*! + Sets Line width +*/ +void VisuGUI_VectorsDlg::setLineWidth( int lw ) +{ + LinWid->setValue( lw ); +} + +/*! + Gets Line width +*/ +int VisuGUI_VectorsDlg::getLineWidth() +{ + return LinWid->value(); +} + +/*! + Sets "Use Magnitude Coloring" flag +*/ +void VisuGUI_VectorsDlg::setUseMagnColor( bool on ) +{ + UseMagn->setChecked( on ); + enableSetColor(); +} + +/*! + Gets "Use Magnitude Coloring" flag state +*/ +bool VisuGUI_VectorsDlg::getUseMagnColor() +{ + return UseMagn->isChecked(); +} + +/*! + Sets "Use Glyphs" flag +*/ +void VisuGUI_VectorsDlg::setUseGlyphs( bool on ) +{ + UseGlyph->setChecked( on ); + enableGlyphType(); +} + +/*! + Gets "Use Glyphs" flag state +*/ +bool VisuGUI_VectorsDlg::getUseGlyphs() +{ + return UseGlyph->isChecked(); +} + +/*! + Sets color +*/ +void VisuGUI_VectorsDlg::setColor( QColor color ) +{ + myColor = color; + SelColor->setPaletteBackgroundColor(myColor); +/* QPalette pal = ColorLab->palette(); + QColorGroup ca = pal.active(); + ca.setColor( QColorGroup::Background, myColor ); + pal.setActive( ca ); + ColorLab->setPalette( pal );*/ +} + +/*! + Sets glyphs type : 0 - arrows, 1 - cones2, 2 - cones6 +*/ +void VisuGUI_VectorsDlg::setGlyphType(VISU::Vectors::GlyphType type ) +{ + if ( type == VISU::Vectors::CONE2) + RBCones2->setChecked( true ); + else if ( type == VISU::Vectors::CONE6) + RBCones6->setChecked( true ); + else + RBArrows->setChecked( true ); +} + +/*! + Gets glyphs type : 0 - arrows, 1 - cones2, 2 - cones6 +*/ +VISU::Vectors::GlyphType VisuGUI_VectorsDlg::getGlyphType() +{ + VISU::Vectors::GlyphType type; + if ( RBCones2->isChecked() ) + type = VISU::Vectors::CONE2; + else if ( RBCones6->isChecked() ) + type = VISU::Vectors::CONE6; + else + type = VISU::Vectors::ARROW; + return type; +} + +/*! + Sets glyph position : -1 - tail, 0 - center, 1 - head +*/ +void VisuGUI_VectorsDlg::setGlyphPos(VISU::Vectors::GlyphPos pos) +{ + if ( pos == VISU::Vectors::TAIL) + RBTail->setChecked(true); + else if ( pos == VISU::Vectors::HEAD) + RBHead->setChecked(true); + else + RBCent->setChecked(true); +} + +/*! + Gets glyph position : -1 - tail, 0 - center, 1 - head +*/ +VISU::Vectors::GlyphPos VisuGUI_VectorsDlg::getGlyphPos() +{ + VISU::Vectors::GlyphPos pos; + if ( RBTail->isChecked() ) + pos = VISU::Vectors::TAIL; + else if ( RBHead->isChecked() ) + pos = VISU::Vectors::HEAD; + else + pos = VISU::Vectors::CENTER; + return pos; +} + +/*! + Enbled/disables magnitude coloring +*/ +void VisuGUI_VectorsDlg::enableMagnColor( bool enable ) +{ + UseMagn->setEnabled( enable ); + enableSetColor(); +} + + +void VisuGUI_VectorsDlg::accept() { + if (myScalarPane->check()) + { + myScalarPane->deletePreview(); + QDialog::accept(); + } +} + +void VisuGUI_VectorsDlg::reject() +{ + myScalarPane->deletePreview(); + QDialog::reject(); +} diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.h b/src/VISUGUI/VisuGUI_VectorsDlg.h new file mode 100644 index 00000000..2abdf591 --- /dev/null +++ b/src/VISUGUI/VisuGUI_VectorsDlg.h @@ -0,0 +1,117 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUI_VectorsDlg.h +// Author : Laurent CORNABE & Hubert ROLLAND +// Module : VISU +// $Header$ + +#ifndef VISUGUI_VECTORSDLG_H +#define VISUGUI_VECTORSDLG_H + +#include "VisuGUI_ScalarBarDlg.h" +#include "QtxDblSpinBox.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SALOMEconfig.h" +#include CORBA_CLIENT_HEADER(VISU_Gen) + +class SalomeApp_Module; + +namespace VISU{ + class Vectors_i; +} + +class VisuGUI_VectorsDlg : public QDialog +{ + Q_OBJECT + +public: + VisuGUI_VectorsDlg (SalomeApp_Module* theModule); + ~VisuGUI_VectorsDlg() {}; + + void setScaleFactor( double sf ); + double getScaleFactor(); + void setLineWidth( int lw ); + int getLineWidth(); + void setUseMagnColor( bool on ); + bool getUseMagnColor(); + void setUseGlyphs( bool on ); + bool getUseGlyphs(); + void setColor( QColor color); + QColor getColor(); + + void setGlyphType(VISU::Vectors::GlyphType type ); + VISU::Vectors::GlyphType getGlyphType(); + + void setGlyphPos(VISU::Vectors::GlyphPos pos); + VISU::Vectors::GlyphPos getGlyphPos(); + void enableMagnColor( bool enable ); + + void initFromPrsObject(VISU::Vectors_i* thePrs); + int storeToPrsObject(VISU::Vectors_i* thePrs); + +protected slots: + void accept(); + void reject(); + +private: + QGroupBox* TopGroup; + QCheckBox* UseMagn; + //QLabel* ColorLab; + QPushButton* SelColor; + QLabel* LineWidLabel; + QSpinBox* LinWid; + QLabel* ScaleLabel; + QtxDblSpinBox* ScalFact; + QCheckBox* UseGlyph; + QButtonGroup* TypeGlyph; + QRadioButton* RBCones6; + QRadioButton* RBCones2; + QRadioButton* RBArrows; + QButtonGroup* PosGlyph; + QRadioButton* RBTail; + QRadioButton* RBCent; + QRadioButton* RBHead; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + + QColor myColor; + VisuGUI_ScalarBarPane* myScalarPane; + +private slots: + void enableGlyphType(); + void setVColor(); + void enableSetColor(); +}; + +#endif // VISUGUI_VECTORSDLG_H diff --git a/src/VISU_SWIG/VISU_Example_01.py b/src/VISU_SWIG/VISU_Example_01.py new file mode 100644 index 00000000..d8c19b65 --- /dev/null +++ b/src/VISU_SWIG/VISU_Example_01.py @@ -0,0 +1,196 @@ +# T 2.23, 28: Displaying fields (scalar and vectorial) on nodes, change presentation options. +# Uses MED files ResOK_0000.med and Fields_group3D.med +# +# This script is equivalent to non-regression test script 003/A1 + +import salome +import visu_gui +import SALOMEDS +import VISU +import os + +datadir = os.getenv("DATA_DIR") + "/MedFiles/" + +#%====================Stage1: Creating a new study====================% + +print "**** Stage1: Creating a new study" + +print "Creating a new study..................", +myVisu = visu_gui.myVisu +myVisu.SetCurrentStudy(salome.myStudy) +myViewManager = myVisu.GetViewManager() +if myViewManager is None : print "Error" +else : print "OK" + +#%====================Stage2: Importing MED file====================% + +print "**** Stage2: Importing MED file" + +print 'Import "ResOK_0000.med"...............', +medFile = datadir + "ResOK_0000.med" +myResult = myVisu.ImportFile(medFile) +if myResult is None : print "Error" +else : print "OK" + +print 'Creating new View3D...................', +myView = myViewManager.Create3DView() +if myView is None : print "Error" +else : print "OK" + +myMeshName = 'dom' +myCellEntity = VISU.CELL +myNodeEntity = VISU.NODE + +#%====================Stage3: Displaying vector field====================% + +print "**** Stage3: Displaying vector field" + +print "Creating Scalar Map.......", +scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if scalarmap is None : print "Error" +else : print "OK" +scalarmap.SetSize(0.15, 0.8) +myView.DisplayOnly(scalarmap) +myView.FitAll() + +print "Creating Stream Lines.....", +streamlines = myVisu.StreamLinesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if streamlines is None : print "Error" +else : print "OK" +myView.DisplayOnly(streamlines) + +print "Creating Vectors..........", +vectors = myVisu.VectorsOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if vectors is None : print "Error" +else : print "OK" +myView.DisplayOnly(vectors) + + +print "Creating Iso Surfaces.....", +isosurfaces = myVisu.IsoSurfacesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if isosurfaces is None : print "Error" +else : print "OK" +myView.DisplayOnly(isosurfaces) + +print "Creating Cut Planes.......", +cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if cutplanes is None : print "Error" +else : print "OK" +cutplanes.SetNbPlanes(30) +cutplanes.SetOrientation(VISU.CutPlanes.YZ, 0, 0) +myView.DisplayOnly(cutplanes) + +#%====================Stage4: Opening a new study and Med file import====================% + +# Opening a new study tempoparily commented due to a problem +# with python initialization. To be restored after bug 10000 fixing. + +#print "**** Stage4: Opening a new study and Med file import" +print "**** Stage4: Med file import" + +#print "Creating a new study..................", +#newStudy = salome.myStudyManager.NewStudy('newStudy') +newStudy = salome.myStudy # temporarily +#myVisu.SetCurrentStudy(newStudy) +myViewManager = myVisu.GetViewManager() +myView = myViewManager.Create3DView() +if myView is None : print "Error" +else : print "OK" + +print 'Importing "Fields_group3D.med"........', +medFile = datadir + "Fields_group3D.med" +myResult1 = myVisu.ImportFile(medFile) +if myResult1 is None : print "Error" +myView1 = myViewManager.Create3DView() +if myView1 is None : print "Error" +else : print "OK" + +#%====================Stage5: Displaying scalar field====================% + +print "**** Stage5: Displaying scalar field" + +myMeshName1 = 'mailles_MED' + +print "Creating Scalar Map.......", +scalarmap1 = myVisu.ScalarMapOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1); +if scalarmap1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(scalarmap1) +myView1.FitAll() + +print "Creating Iso Surfaces.....", +isosurfaces1 = myVisu.IsoSurfacesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1); +if isosurfaces1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(isosurfaces1) + +print "Creating Cut Planes.......", +cutplanes1 = myVisu.CutPlanesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1); +if cutplanes1 is None : print "Error" +else : print "OK" +cutplanes1.SetOrientation(VISU.CutPlanes.YZ, 0, 0) +myView1.DisplayOnly(cutplanes1) + +#%====================Stage6: Object browser popup====================% + +print "**** Stage6: Object browser popup" + +print "Creating mesh.............", +mesh = myVisu.MeshOnEntity(myResult1,myMeshName1,myCellEntity); +if mesh is None : print "Error" +else : print "OK" +myView1.DisplayOnly(mesh) + + +print "Changing type of presentation of mesh:" +mesh.SetPresentationType(VISU.WIREFRAME) +PrsType = mesh.GetPresentationType() +print "Presentation type..", PrsType +myView1.DisplayOnly(mesh) + +mesh.SetPresentationType(VISU.SHADED) +PrsType = mesh.GetPresentationType() +print "Presentation type.....", PrsType +myView1.DisplayOnly(mesh) + +mesh.SetPresentationType(VISU.POINT) +PrsType = mesh.GetPresentationType() +print "Presentation type......", PrsType +myView1.DisplayOnly(mesh) +myView1.Update() + +mesh.SetPresentationType(VISU.SHRINK) +PrsType = mesh.GetPresentationType() +print "Presentation type.....", PrsType +myView1.DisplayOnly(mesh) + +print "Changing color of mesh....", +aColor = SALOMEDS.Color(0,0,1) +mesh.SetCellColor(aColor) +myView1.DisplayOnly(mesh) +print "OK" + +print "Renaming ScalarMap........", +SObj = newStudy.FindObjectIOR(scalarmap1.GetID()) +newName = 'Renamed Object' +SObj.Name = newName +print "OK" + +print "Deleting Cut Planes.......", +SObj = newStudy.FindObjectIOR(cutplanes1.GetID()) +myBuilder = newStudy.NewBuilder() +myBuilder.RemoveObject(SObj) +print "OK" + +print "Changing first IsoSurfaces", +myVisu.SetCurrentStudy(salome.myStudy) +myView.DisplayOnly(isosurfaces) +isosurfaces.SetNbSurfaces(25) +print "OK" + +myView.Maximize() +myView.DisplayOnly(isosurfaces) + +print "Hide IsoSurfaces..........", +myView.Erase(isosurfaces) +print "OK" diff --git a/src/VISU_SWIG/VISU_Example_02.py b/src/VISU_SWIG/VISU_Example_02.py new file mode 100644 index 00000000..38f2b6b6 --- /dev/null +++ b/src/VISU_SWIG/VISU_Example_02.py @@ -0,0 +1,360 @@ +# T 2.24: Save/retrieve view parameters. +# Uses MED file fra.med from ${DATA_DIR}/MedFiles directory. +# +# This script is equivalent to non-regression test script 003/A3 + +import salome +import visu_gui +import SALOMEDS +import VISU +import os + +medFile = os.getenv("DATA_DIR") + "/MedFiles/fra.med" + +#%====================Stage1: Creating a new study====================% + +print "**** Stage1: Creating a new study " + +print "Creating a new study..................", +myVisu = visu_gui.myVisu +myVisu.SetCurrentStudy(salome.myStudy) +myViewManager = myVisu.GetViewManager() +if myViewManager is None : print "Error" +else : print "OK" + +#%====================Stage2: Saving view parameters before import====================% + +print "**** Stage2: Saving view parameters before import " + +myView = myViewManager.Create3DView() + +print "Zooming trihedron.....................", +aScale = myView.GetParallelScale() +myView.SetParallelScale(aScale*4) +print "OK" + +print "Rotating trihedron....................", +aPoint = (100,100,100) +myView.SetPointOfView(aPoint) +print "OK" + +print "Saving view parameters................", +aViewParamsName1 = 'ViewParams:1' +aSaveRes = myView.SaveViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +#%====================Stage3: Import MED file====================% + +print "**** Stage3: Import MED file" + +print 'Importing "fra.med"...................', +myResult = myVisu.ImportFile(medFile) +if myResult is None : print "Error" +else : print "OK" + +print "Creating mesh.........................", +myMeshName = 'LE VOLUME' +myCellEntity = VISU.CELL +mesh = myVisu.MeshOnEntity(myResult,myMeshName,myCellEntity); +if mesh is None : print "Error" +else : print "OK" + +myView.Maximize() +myView.Display(mesh) +myView.FitAll() + +#%====================Stage4: Saving view parameters after import====================% + +print "**** Stage4: Saving view parameters after import" + +print "Creating Scalar Map...................", +myFieldName = 'TAUX_DE_VIDE' +myNodeEntity = VISU.NODE +scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,myFieldName,1); +if scalarmap is None : print "Error" +else : print "OK" +myView.DisplayOnly(scalarmap) + +print "Zooming 3D view.......................", +aScale = myView.GetParallelScale() +myView.SetParallelScale(aScale*2) +print "OK" + +print "Setting view point(LEFT)..............", +myView.SetView((VISU.View3D.LEFT)) +print "OK" + +print "Saving view parameters................", +aViewParamsName2 = 'ViewParams:2' +aSaveRes = myView.SaveViewParams(aViewParamsName2) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Creating Cut Planes...................", +cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,myFieldName,1); +if cutplanes is None : print "Error" +else : print "OK" +cutplanes.SetNbPlanes(4) +myView.DisplayOnly(cutplanes) + +print "Setting scaling.......................", + +#Define parameters of scaling: +myXParam = 5 +myYParam = 5 +myZParam = 1 + +myXAxis = VISU.View3D.XAxis +myYAxis = VISU.View3D.YAxis +myZAxis = VISU.View3D.ZAxis + +myView.ScaleView(myXAxis,myXParam) +myView.ScaleView(myYAxis,myYParam) +myView.ScaleView(myZAxis,myZParam) +print "OK" + +print "Rotating 3d view......................", +aPoint = (100,40,0) +myView.SetPointOfView(aPoint) +print "OK" + +print "Fit All...............................", +myView.FitAll() +print "OK" + +print "Saving view parameters................", +aViewParamsName3 = 'ViewParams:3' +aSaveRes = myView.SaveViewParams(aViewParamsName3) +if aSaveRes != 1 : print "Error" +else : print "OK" + +#%====================Stage5: Restoring view parameters====================% + +print "**** Stage5: Restoring view parameters" + +print "Restoring first view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName1) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Restoring second view parameters......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName2) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaing only Scalar Map.............", +myView.DisplayOnly(scalarmap) +print "OK" + +print "Displaing only Cut Planes.............", +myView.DisplayOnly(cutplanes) +print "OK" + +print "Restoring third view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName3) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaing only Mesh...................", +myView.DisplayOnly(mesh) +print "OK" + +print "Displaing only Scalar Map.............", +myView.DisplayOnly(scalarmap) +print "OK" + +print "Displaing only Cut Planes.............", +myView.DisplayOnly(cutplanes) +print "OK" + +#%====================Stage6: Changing of view parameters====================% + +print "**** Stage6: Changing of view parameters" + +print "Remove scaling........................", +myView.RemoveScale() +print "OK" + +print "Fit All...............................", +myView.FitAll() +print "OK" + +print "Rotating 3d view......................", +aPoint = (0,60,150) +myView.SetPointOfView(aPoint) +print "OK" + +print "Resaving first view parameters........", +aSaveRes = myView.SaveViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Restoring third view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName3) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Restoring first view parameters.......", +aRestoreRes = myView.RestoreViewParams(aViewParamsName1) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaying only Mesh..................", +myView.DisplayOnly(mesh) +print "OK" + +print "Displaying only Scalar Map............", +myView.DisplayOnly(scalarmap) +print "OK" + +#%====================Stage7: Saving of created view parameters====================% + +print "**** Stage7: Saving of created view parameters" + +print "Saving study..........................", + +str = os.getenv("TmpDir") +if str == None: + str = "/tmp" + +file = str+'/VISU_005.hdf' + +salome.myStudyManager.SaveAs(file, salome.myStudy, 0) +study_id = salome.myStudy._get_StudyId() +print "OK" + +file_new = str+'/VISU_005_new.hdf' +command = "mv " + file + " " + file_new +os.system(command) +file = file_new + +# Opening a study tempoparily commented due to a problem +# with python initialization. To be restored after bug 10000 fixing. + +#print "Opening just saved study..............", +# +#openedStudy = salome.myStudyManager.Open(file)] +openedStudy = salome.myStudy # temporarily +#myVisu.SetCurrentStudy(openedStudy) +myViewManager = myVisu.GetViewManager() +myView1 = myViewManager.Create3DView() +if myView1 is None : print "Error" +else : print "OK" + +import time +time.sleep(1) + +print "Restoring first view parameters.......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName1) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +Builder = openedStudy.NewBuilder() +#SCom = openedStudy.FindComponent("VISU") +#Builder.LoadWith(SCom ,myVisu) + +print "Displaying Scalar Map.................", +SObj = openedStudy.FindObject('ScalarMap') +scalarmap1 = visu_gui.visu.SObjectToObject(SObj) +if scalarmap1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(scalarmap1) + +print "Displaying Cut Planes.................", +SObj = openedStudy.FindObject('CutPlanes') +cutplanes1 = visu_gui.visu.SObjectToObject(SObj) +if cutplanes1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(cutplanes1) + +print "Restoring second view parameters......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName2) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaying Scalar Map.................", +myView1.DisplayOnly(scalarmap1) +print "OK" + +print "Restoring third view parameters.......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName3) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +print "Displaying Cut Planes.................", +myView1.DisplayOnly(cutplanes1) +print "OK" + +#%====================Stage8: Changing of saved session====================% + +print "**** Stage8: Changing of saved session" + +print "Deleting ViewParams:3,1,2.............", +SObj = openedStudy.FindObject(aViewParamsName3) +Builder.RemoveObject(SObj) +SObj = openedStudy.FindObject(aViewParamsName1) +Builder.RemoveObject(SObj) +SObj = openedStudy.FindObject(aViewParamsName2) +Builder.RemoveObject(SObj) +print "OK" + +SObjList2 = openedStudy.FindObjectByName(aViewParamsName1, "VISU") +print "FindObjectByName(aViewParamsName1, VISU) returned ", len(SObjList2), " objects" + +print "Zooming trihedron.....................", +aScale = myView.GetParallelScale() +myView1.SetParallelScale(aScale*2) +myView1.Update() +print "OK" + +print "Rotating trihedron....................", +aPoint = (200,40,-40) +myView1.SetPointOfView(aPoint) +print "OK" + +print "Saving view parameters................", +aSaveRes = myView1.SaveViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Renaming ViewParams:1.................", +SObj = openedStudy.FindObject(aViewParamsName1) +SObj.Name = "New_view" +print "OK" + +print "Setting scaling.......................", +#Define parameters of scaling: +myXParam = 4 +myYParam = 4 +myZParam = 8 + +myXAxis = VISU.View3D.XAxis +myYAxis = VISU.View3D.YAxis +myZAxis = VISU.View3D.ZAxis + +myView1.ScaleView(myXAxis,myXParam) +myView1.ScaleView(myYAxis,myYParam) +myView1.ScaleView(myZAxis,myZParam) +print "OK" + +myView1.FitAll() + +print "Saving view parameters................", +aSaveRes = myView1.SaveViewParams(aViewParamsName2) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Restoring first view parameters.......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName1) +if aSaveRes != 1 : print "Error" +else : print "OK" + +print "Restoring second view parameters......", +aRestoreRes = myView1.RestoreViewParams(aViewParamsName2) +if aRestoreRes != 1 : print "Error" +else : print "OK" + +# Remove the study file +command = "rm -r " + file +os.system(command) diff --git a/src/VISU_SWIG/VISU_Example_04.py b/src/VISU_SWIG/VISU_Example_04.py new file mode 100644 index 00000000..9ae4d110 --- /dev/null +++ b/src/VISU_SWIG/VISU_Example_04.py @@ -0,0 +1,255 @@ +# Show some results presentations in different 3D and 2D viewers +# with different options (view parameters and display modes). +# Uses MED files fra.med and TimeStamps.med from ${DATA_DIR}/MedFiles directory. +# +# Pay attention to a viewer title to know its purpose. +# +# This script is equivalent to script VISU_SWIG/visu_view3d.py + +import os +import time +import math +import VISU +import SALOMEDS +from visu_gui import * + +aDelay = 1 + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The window will be soon destroyed!") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +myView.Maximize() +print "myView.Maximize()" +time.sleep(aDelay) + +myView.Restore() +print "myView.Restore()" +time.sleep(aDelay) + +myView.Minimize() +print "myView.Minimize()" +time.sleep(aDelay) + +myViewManager.Destroy(myView) +print "myViewManager.Destroy(myView)" +time.sleep(aDelay) + + +medFile = "fra.med" +myFieldName = "VITESSE"; + +aMeshName ="LE VOLUME" +anEntity = VISU.NODE +aTimeStampId = 1 + +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +myResult = myVisu.ImportFile(medFile) + +myView = myViewManager.Create3DView(); + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.3,1.0) +myView.SetBackground(aColor); + +myView.SetTitle("The viewer will display ScalarMap") +print "myViewManager.Create3DView()" + +aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) + +myView.Display(aScalarMap); +print "myView.Display(aScalarMap)" +myView.SetFocalPoint([0,0,0]); +print "myView.SetFocalPoint(...)" +myView.SetParallelScale(2); +print "myView.SetParallelScale(...)" +myView.FitAll(); + +aMax = aScalarMap.GetMax() +aMin = aScalarMap.GetMin() +aDelta = (aMax - aMin)/2.0 +aNbColors = aScalarMap.GetNbColors() +aNbColors = 64 +for i in range(2,aNbColors) : + aScalarMap.SetNbColors(i) + aX = aMin + aDelta*i/aNbColors + aY = aMax - aDelta*i/aNbColors + aScalarMap.SetRange(aX,aY) + myView.Update(); + time.sleep(aDelay) + +aScalarMap.SetRange(aMin,aMax) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + +myView = myViewManager.Create3DView(); +myView.SetTitle("Here we will display CutPlanes") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.7,0.0) +myView.SetBackground(aColor); + +aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) +print "myVisu.CutPlanesOnField(...)" + +myView.DisplayOnly(aCutPlanes); +print "myView.DisplayOnly(aCutPlanes)" + +aPoint = myView.GetPointOfView(); +aPoint[0] = aPoint[0] + 10; +myView.SetPointOfView(aPoint); +print "myView.SetPointOfView(...)" +myView.ScaleView(VISU.View3D.YAxis,10.0); +myView.ScaleView(VISU.View3D.XAxis,3.0); +print "myView.ScaleView(...)" +time.sleep(aDelay) + +myView.FitAll(); + +aNbPlanes = aCutPlanes.GetNbPlanes() +aNbPlanes = 30 +aXAngle = aCutPlanes.GetRotateX() +aYAngle = aCutPlanes.GetRotateY() +anOrientation = aCutPlanes.GetOrientationType() +for i in range(aNbPlanes,1,-1) : + aCutPlanes.SetNbPlanes(i) + aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aCutPlanes.SetOrientation(anOrientation,aX,aY) + myView.Update(); + time.sleep(aDelay) + +aNbPlanes = 10 +aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0) +for i in range(1,aNbPlanes) : + aCutPlanes.SetNbPlanes(i) + myView.Update(); + time.sleep(aDelay) + +myView.SaveViewParams('AAA') +print "myView.SaveViewParams('AAA')" +time.sleep(aDelay) + +aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0) +myView.RemoveScale(); + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + +myView = myViewManager.Create3DView(); +print "myViewManager.Create3DView()" + +myView.SetTitle("IsoSurface's viewer") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(1.0,0.7,0.0) +myView.SetBackground(aColor); +time.sleep(aDelay) + +aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) + +myView.DisplayOnly(aIsoSurfaces); +myView.FitAll(); +print "myView.DisplayOnly(aCutPlanes)" +time.sleep(aDelay) + +aNbSurfaces = aIsoSurfaces.GetNbSurfaces() +aNbSurfaces = 32 +for i in range(2,aNbSurfaces) : + aIsoSurfaces.SetNbSurfaces(i) + myView.Update(); + time.sleep(aDelay) + +aIsoSurfaces.SetNbSurfaces(10) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for CutLines") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.7,0.7,0.7) +myView.SetBackground(aColor); +time.sleep(aDelay) + +aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) +aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0) +aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0) + +myView.DisplayOnly(aCutLines); +myView.FitAll(); +print "myView.DisplayOnly(aCutLines)" +time.sleep(aDelay) + +aSObj = myStudy.FindObjectIOR(aCutLines.GetID()) +aTable = myVisu.CreateTable( aSObj.GetID() ) +print "myVisu.CreateTable(...)" + +aTableView = myViewManager.CreateTableView(aTable) +aTableView.SetTitle('Changed Title') + +aContainer = myVisu.CreateContainer() +print "myVisu.CreateContainer(...)" + +aNbCurve = aTable.GetNbRows() - 1 +for i in range(2,aNbCurve): + aCurve = myVisu.CreateCurve( aTable, 1, i ) + print i, aCurve + aContainer.AddCurve(aCurve) + + +myView = myViewManager.CreateXYPlot(); +myView.SetTitle("The viewer for Curves from CutLines") +print "myViewManager.CreateXYPlot()" +time.sleep(aDelay) + +myView.Display(aContainer) + + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "vitesse"; + +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +myResult = myVisu.ImportFile(medFile) + +anAnim = myVisu.CreateAnimation(myView); +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(2)[1] +aSObj = aSObj.FindSubObject(2)[1] +anAnim.addField(aSObj) +anAnim.setPresentationType(0,VISU.TISOSURFACE) +print "Generate presentations" +anAnim.generatePresentations(0) +print "Generate frames" +anAnim.generateFrames() +print "Start Animation" +anAnim.setSpeed(99) +anAnim.startAnimation() +myView.FitAll() +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break diff --git a/src/VISU_SWIG/VISU_Example_06.py b/src/VISU_SWIG/VISU_Example_06.py new file mode 100644 index 00000000..622b6cb4 --- /dev/null +++ b/src/VISU_SWIG/VISU_Example_06.py @@ -0,0 +1,61 @@ +# Import a table from file and show it in Plot2d viewer + +import salome +import math +import SALOMEDS +import VISU +from visu_gui import * + +# >>> Getting study builder ================================================== +myStudy = salome.myStudy +myBuilder = myStudy.NewBuilder() + +# >>> Getting (loading) VISU component ======================================= +myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") +myComponent = myStudy.FindComponent("VISU") +myVisu.SetCurrentStudy(myStudy) +if not myComponent: + myComponent = myBuilder.NewComponent("VISU") + aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") + #aName.SetValue("Visu") + aName.SetValue( salome.sg.getComponentUserName("VISU") ) + + A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap"); + aPixmap = A2._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" ); + + myBuilder.DefineComponentInstance(myComponent,myVisu) + +# >>> Import a tables from a file ============================================ +aFileName = os.getenv("DATA_DIR") + "/Tables/tables_test.xls" +sobj = myVisu.ImportTables(aFileName) + +# >>> Create container and insert curves ===================================== +myContainer = myVisu.CreateContainer() + +chiter = myStudy.NewChildIterator(sobj) +while chiter.More(): + sobj_table = chiter.Value() + + # >>> Create Visu table ==================================================== + myVisuTableReal = myVisu.CreateTable(sobj_table.GetID()) + + nbRows = myVisuTableReal.GetNbRows() + + # >>> Create curves ======================================================== + for i in range(1, nbRows): + myCurve = myVisu.CreateCurve(myVisuTableReal, 1, i+1) + myContainer.AddCurve(myCurve) + + chiter.Next() + +# >>> Updating Object Browser ================================================ +salome.sg.updateObjBrowser(1) + +# >>> Display curves in Plot2d viewer ======================================== +myViewManager = myVisu.GetViewManager(); +myView = myViewManager.CreateXYPlot(); +myView.SetTitle("The viewer for Curves from the Table") +myView.Display(myContainer) + +# ============================================================================