-This is the version 2.0.0 of KERNEL
+This is the version 2.1.0 of KERNEL
Previous versions :
- - 1.4.1
+ - 2.0.0
+ - 1.4.1
- 1.3.0
- 1.2.1
showNS.py
# copy header files in common directory
-ifeq ($(HAVE_SSTREAM),yes)
- include_list=include/salome/SALOMEconfig.h
+OWN_CONFIG_H=@OWN_CONFIG_H@
+
+ifeq ($(OWN_CONFIG_H),yes)
+ ifeq ($(HAVE_SSTREAM),yes)
+ include_list=include/salome/SALOMEconfig.h include/salome/config.h
+ else
+ include_list=include/salome/SALOMEconfig.h include/salome/config.h include/salome/sstream
+ endif
else
- include_list=include/salome/SALOMEconfig.h include/salome/sstream
+ ifeq ($(HAVE_SSTREAM),yes)
+ include_list=include/salome/SALOMEconfig.h
+ else
+ include_list=include/salome/SALOMEconfig.h include/salome/sstream
+ endif
endif
inc: idl $(include_list)
cp -p $< $@; \
fi; \
+include/salome/config.h: salome_adm/unix/config.h
+ -$(RM) $@
+ $(LN_S) ../../$< $@
+
include/salome/sstream: salome_adm/unix/sstream
-$(RM) $@
$(LN_S) ../../$< $@
distclean-other:
-$(RM) salome_adm/unix/*~ salome_adm/unix/*% salome_adm/unix/*.bak salome_adm/unix/*.new salome_adm/unix/*.old
-$(RM) salome_adm/unix/make_*
- -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h
+ -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h salome_adm/unix/config.h
-$(RM) config.cache config.log config.status
@MODULE@
-THIS IS SALOME - KERNEL VERSION: 2.0.0
+THIS IS SALOME - KERNEL VERSION: 2.1.0
pass
elif self.space == ["Configuration-list","modules-list","module","plugin"] and "name" in attrs.getNames():
key = str(self.currentModuleName)+"_plugins"
- if not self.opts.has_key("key"):
+ if not self.opts.has_key(key):
self.opts[key]=[]
pass
self.opts[key].append(attrs.getValue("name"))
#!/bin/bash
-NSPORT=2809
-echo -n "Searching for free port for the SALOME Naming Service: "
-while [ ${NSPORT} -lt 3000 ]; do
- NSPORT=`expr ${NSPORT} + 1`
- aRes=`netstat -ltn | grep -E :${NSPORT}`
- if [ -z "$aRes" ]; then
-cat > ${OMNIORB_CONFIG} <<EOF
-ORBInitRef NameService=corbaname::`hostname`:${NSPORT}
-EOF
- echo ${NSPORT} - Ok
- break
- fi
- echo -n "${NSPORT}; "
-done
+searchFreePort() {
+ echo -n "Searching for a free port for naming service: "
+ export NSPORT=2810
+ local limit=$NSPORT
+ let limit=limit+100
+ while [ 1 ]
+ do
+ aRes=`netstat -ltn | grep -E :${NSPORT}`
+ if [ -z "$aRes" ]; then
+ echo ${NSPORT} - Ok
+ local myhost=`hostname`
+ export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
+ local initref="NameService=corbaname::"`hostname`":$NSPORT"
+ echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+ break
+ fi
+ echo -n "${NSPORT} "
+ if [[ $NSPORT -eq $limit ]] ; then
+ echo
+ echo "Can't find a free port to launch omniNames"
+ echo "Try to kill the running servers and then launch SALOME again."
+ exit
+ fi
+ let NSPORT=NSPORT+1
+ done
+}
+
+searchFreePort
if [ $# -ne 0 ] ; then
python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
# ---------
# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome
#
-# parameters read from $HOME/.salome/salome.launch
-# if the config file does not exist, it is created with default values
+# - parameters for launching are taken from $HOME/.salome/salome.launch;
+# - if the config file does not exist, it is created with default values.
#
#
# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
#
# parameters from command line supersede those from $HOME/.salome/salome.launch
#
-# Some CORBA servers could be launched in the SALOME_Session_Server
+# Some CORBA servers can be launched in the SALOME_Session_Server's process
# (embedded = same process) or in a separate process (standalone):
# --> registry,study,moduleCatalog,cppContainer
# Other CORBA servers could only be launched in separate process (standalone):
#!/bin/csh -f
-runSalome --gui --modules=GEOM,SMESH,DATA,VISU,SUPERV,MED --containers=cpp,python --killall
+runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --containers=cpp,python --killall
add_path(os.path.join(plugin_root,"bin",args['appname']), "PATH")
pass
pass
-
+
+# set environment for SUPERV module
+os.environ["ENABLE_MACRO_NODE"]="1"
+
import orbmodule
#
if "GEOM" in modules_list:
print "GEOM OCAF Resources"
os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share",args['appname'],"resources")
+ print "GEOM Shape Healing Resources"
+ os.environ["CSF_ShHealingDefaults"]=os.path.join(modules_root_dir["GEOM"],"share",args['appname'],"resources")
if 'study' not in args['embedded']:
SalomeDSServer().run()
<module name="GEOM"/>
<module name="SMESH">
<plugin name="NETGENPlugin"/>
+ <plugin name="GHS3DPlugin"/>
</module>
- <module name="DATA"/>
<module name="VISU"/>
<module name="SUPERV"/>
<module name="MED"/>
touch configure.in_tmp2
find_in . configure.in_tmp2
sed '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3
-sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
+sed '/configure.in/d;/make_config.in/d' configure.in_tmp3 > configure.in_tmp2
sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
echo "])" >> configure.in_tmp1
echo "failed (check file permissions and/or user quotas ...)"
fi
+###############################################################
+# Creating make_config
+#
+if test -f make_config
+then
+ echo -n "Updating 'make_config' script ... "
+else
+ echo -n "Creating 'make_config' script ... "
+fi
+
+if autoconf -o make_config make_config.in
+then
+ echo "done"
+else
+ echo "failed (check file permissions and/or user quotas ...)"
+fi
+
cd ${ORIG_DIR}
echo
-<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
-\r
-<html>\r
-\r
-<!--(==============================================================)-->\r
-<!--(Document created with RoboEditor. )============================-->\r
-<!--(==============================================================)-->\r
-\r
-<head>\r
-\r
-<title>Running SALOME</title>\r
-\r
-<!--(Meta)==========================================================-->\r
-\r
-<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
-<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
-<meta name=generator-major-version content=0.1>\r
-<meta name=generator-minor-version content=1>\r
-<meta name=filetype content=kadov>\r
-<meta name=filetype-version content=1>\r
-<meta name=page-count content=1>\r
-<meta name=layout-height content=1118>\r
-<meta name=layout-width content=707>\r
-\r
-\r
-<!--(Links)=========================================================-->\r
-\r
- <link rel='stylesheet' href='../default_ns.css'>\r
-<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!DOCTYPE doctype PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
+<html>
+<head>
+<!--(==============================================================)--><!--(Document created with RoboEditor. )============================--><!--(==============================================================)-->
+ <title>Running SALOME</title>
+ <!--(Meta)==========================================================-->
+
+ <meta http-equiv="content-type"
+ content="text/html; charset=windows-1252">
+
+ <meta name="generator"
+ content="RoboHELP by eHelp Corporation - www.ehelp.com">
+
+ <meta name="generator-major-version" content="0.1">
+
+ <meta name="generator-minor-version" content="1">
+
+ <meta name="filetype" content="kadov">
+
+ <meta name="filetype-version" content="1">
+
+ <meta name="page-count" content="1">
+
+ <meta name="layout-height" content="1118">
+
+ <meta name="layout-width" content="707">
+ <!--(Links)=========================================================-->
+
+ <link rel="stylesheet" href="../default_ns.css">
+
+ <script type="text/javascript" language="JavaScript"
+ title="WebHelpSplitCss">\r
<!--\r
if (navigator.appName !="Netscape")\r
{ document.write("<link rel='stylesheet' href='../default.css'>");}\r
//-->\r
-</script>\r
-<style type="text/css">\r
+ </script>
+ <style type="text/css">\r
<!--\r
h1.whs1 {font-family: 'Times New Roman', serif;}\r
p.whs2 {margin-left: 0px; font-style: italic; color: #000000; font-family: 'Arial Black', sans-serif;}\r
p.whs29 {font-family: 'Times New Roman', serif; margin-left: 80px;}\r
p.whs30 {font-family: 'Courier New', monospace; margin-left: 0px;}\r
-->\r
-</style>\r
-<script type="text/javascript" language="JavaScript">\r
+ </style>
+ <script type="text/javascript" language="JavaScript">\r
<!--\r
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
{\r
document.write(strNSS);\r
}\r
//-->\r
-</script>\r
-<script type="text/javascript" language="JavaScript" title="BSSC Special Effects" src="../ehlpdhtm.js"></script><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+ </script>
+ <script type="text/javascript" language="JavaScript"
+ title="BSSC Special Effects" src="../ehlpdhtm.js"></script>
+ <script type="text/javascript" language="JavaScript"
+ title="WebHelpInlineScript">\r
<!--\r
function reDo() {\r
if (innerWidth != origWidth || innerHeight != origHeight)\r
}\r
onerror = null; \r
//-->\r
-</script>\r
-<style type="text/css">\r
+ </script>
+ <style type="text/css">\r
<!--\r
div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
-->\r
-</style>\r
-<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
-<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
-<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
-<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
-<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
-</head>\r
-\r
-<!--(Body)==========================================================-->\r
-\r
-\r
-<body>\r
-\r
+ </style>
+ <script type="text/javascript" language="javascript1.2"
+ src="../whmsg.js"></script>
+ <script type="text/javascript" language="javascript" src="../whver.js"></script>
+ <script type="text/javascript" language="javascript1.2"
+ src="../whproxy.js"></script>
+ <script type="text/javascript" language="javascript1.2"
+ src="../whutils.js"></script>
+ <script type="text/javascript" language="javascript1.2"
+ src="../whtopic.js"></script><!--(Body)==========================================================-->
+</head>
+ <body>
+
<script type="text/javascript" language="javascript1.2">\r
<!--\r
if (window.gbWhTopic)\r
else\r
document.location.reload();\r
//-->\r
-</script>\r
-<h1 class="whs1">Running SALOME</h1>\r
-\r
-<p class="whs2">To launch SALOME:</p>\r
-\r
-<p class="whs3"> </p>\r
-\r
-<p class="whs4">1. Install the SALOME package into a definite \r
- directory (ex. <span style="font-weight: bold;"><B>SALOME</B></span>) on your \r
- hard disk. It is preferable if you use the <a href="installing_salome_pro.htm">special \r
- installation procedure</a> allowing to install the SALOME \r
- platform and all corresponding applications. </p>\r
-\r
-<p class="whs5"> </p>\r
-\r
-<p class="whs6">2.<span style="font-family: 'Courier New', monospace;"> \r
- </span>The installation shell script will create a special file: <b>env.csh</b> \r
- (CShell file) in your <b><i><span style="font-style: normal; font-weight: bold;"><B>SALOME</B></span><span \r
- style="font-weight: normal; font-style: normal;"> </span></i></b>directory. \r
- This file contains all environment variables necessary for launching SALOME \r
- platform with other application products provided with SALOME installation \r
- package. You have a possibility to add one of them into your profile if \r
- you enter in the command console the following:</p>\r
-\r
-<p class="whs6"> </p>\r
-\r
-<p class="whs6"><span style="font-family: 'Courier New', monospace;">source \r
- env.csh </span></p>\r
-\r
-<p class="whs6"> </p>\r
-\r
-<p class="whs7"><img src="../tip1.gif" x-maintain-ratio="TRUE" width="35px" height="37px" border="0" class="img_whs8"> <span style="font-family: 'Times New Roman', serif;">During \r
- the installation procedure you have a possibility <a href="installing_salome_pro.htm#profile">to \r
- set your profile automatically.</a> </span> </p>\r
-\r
-<p class="whs9"> </p>\r
-\r
-<p> </p>\r
-\r
-<p class="whs10">3. Launch SALOME platform, using the following \r
- Python script located in the <span style="font-weight: bold;"><B>SALOME/KERNEL/bin/salome</B></span> \r
- directory:</p>\r
-\r
-<p class="whs11"> </p>\r
-\r
-<ul type="disc" class="whs12">\r
- \r
- <li class=kadov-p><p class="whs10"><span style="font-weight: bold;"><B>runSalome.py</B></span> \r
- [command line options]</p></li>\r
-</ul>\r
-\r
-<p class="whs10"> </p>\r
-\r
-<!--(Table)=========================================================-->\r
-<table x-use-null-cells resizable="no" cellspacing="0" width="96.029%" class="whs13">\r
-<script language='JavaScript'><!--\r
+</script>
+<h1 class="whs1">Running SALOME</h1>
+
+<p class="whs2">To launch SALOME:</p>
+
+<p class="whs3"> </p>
+
+<p class="whs4">1. Install the SALOME package into a definite directory
+(ex. <span style="font-weight: bold;"><b>SALOME</b></span>) on your hard
+disk. It is preferable if you use the <a href="readme.html">special installation
+procedure</a> allowing to install the SALOME platform and all corresponding
+applications. </p>
+
+<p class="whs5"> </p>
+
+<p class="whs6">2.<span style="font-family: 'Courier New',monospace;">
+</span>The installation shell script will create a special file: <b>env.csh</b>
+ (CShell file) in your <b><i><span
+ style="font-style: normal; font-weight: bold;"><b>SALOME</b></span><span
+ style="font-weight: normal; font-style: normal;"> </span></i></b>directory.
+ This file contains all environment variables necessary for launching SALOME
+ platform with other application products provided with SALOME installation
+ package. You have a possibility to add one of them into your profile if
+ you enter in the command console the following:</p>
+
+<p class="whs6"> </p>
+
+<p class="whs6"><span style="font-family: 'Courier New',monospace;">source
+ env.csh </span></p>
+
+<p class="whs6"> </p>
+
+<p class="whs10">3. Launch SALOME platform, using the following Python
+script located in the <span style="font-weight: bold;"><b>SALOME/KERNEL/bin/salome</b></span>
+ directory:</p>
+
+<p class="whs11"> </p>
+
+<ul type="disc" class="whs12">
+ <li class="kadov-p">
+ <p class="whs10"><span style="font-weight: bold;"><b>runSalome.py</b></span>
+ [command line options]</p>
+ </li>
+
+</ul>
+
+<p class="whs10"> </p>
+ <!--(Table)=========================================================-->
+<table x-use-null-cells="" resizable="no" cellspacing="0" width="96%"
+ class="whs13">
+
+ <script language="JavaScript"><!--\r
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4)) document.write("</table><table x-use-null-cells resizable='no' cellspacing='0' width='96.029%' border='1' bordercolor='silver' bordercolorlight='silver' bordercolordark='silver'>");\r
-//--></script>\r
-<col class="whs14">\r
-<col class="whs15">\r
-\r
-<tr valign="top" class="whs16">\r
-<td bgcolor="#400080" width="214px" class="whs17">\r
-<p class="whs18">Options</td>\r
-<td bgcolor="#400080" width="390px" class="whs19">\r
-<p class="whs18">Description</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--help</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-h</B></span> </td>\r
-<td width="390px" class="whs21">\r
-<p>print this help</p>\r
-<p> </td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--gui</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-g</B></span> </td>\r
-<td width="390px" class="whs21">\r
-<p>launch with GUI</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td width="214px" class="whs20">\r
-<p> <span style="font-weight: bold;"><B><a \r
- name=batchmode></a>--terminal</B></span> <span style="font-style: italic;"><I>or \r
- </I></span><span style="font-weight: bold;"><B>-t</B></span> </td>\r
-<td width="390px" class="whs21">\r
-<p>launch without GUI in batch mode</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--logger</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-l</B></span> </td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs21">\r
-<p>redirection of log messages into a definite file </td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--xterm</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-x</B></span> </td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs21">\r
-<p>the servers open an xterm window and log messages are displayed in this \r
- window</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--modules=module1,module2,...</B></span> \r
- <span style="font-style: italic;"><I>or</I></span> <span style="font-weight: bold;"><B>-m=module1,module2,...</B></span></td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs21">\r
-<p>list of SALOME modules which will be loaded into the module catalogue</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs22">\r
-<p><span style="font-weight: bold;"><B>--containers=cpp,python,superv</B></span></p>\r
-<p><span style="font-style: italic;"><I>or</I></span> <span style="font-weight: bold;"><B>-c=cpp,python,superv</B></span></td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs23">\r
-<p>launch of cpp, python and supervision containers</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs24">\r
-<p><span style="font-weight: bold;"><B>--portkill</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-p</B></span></td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs25">\r
-<p>kill SALOME launched with the current port</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs26">\r
-<p><span style="font-weight: bold;"><B>--killall</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-k</B></span> </td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs27">\r
-<p>kill SALOME</td></tr>\r
-<script language='JavaScript'><!--\r
+//--></script>
+ <col class="whs14"> <col class="whs15"> <tbody>
+ <tr valign="top" class="whs16">
+ <td bgcolor="#400080" width="214" class="whs17">
+ <p class="whs18">Options</p>
+ </td>
+ <td bgcolor="#400080" width="390" class="whs19">
+ <p class="whs18">Description</p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td width="214" class="whs20">
+ <p><span style="font-weight: bold;"><b>--help</b></span> <span
+ style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-h</b></span> </p>
+ </td>
+ <td width="390" class="whs21">
+ <p>print this help</p>
+
+ <p> </p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td width="214" class="whs20">
+ <p><span style="font-weight: bold;"><b>--gui</b></span> <span
+ style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-g</b></span> </p>
+ </td>
+ <td width="390" class="whs21">
+ <p>launch with GUI</p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td width="214" class="whs20">
+ <p> <span style="font-weight: bold;"><b><a name="batchmode"></a>--terminal</b></span>
+ <span style="font-style: italic;"><i>or </i></span><span
+ style="font-weight: bold;"><b>-t</b></span> </p>
+ </td>
+ <td width="390" class="whs21">
+ <p>launch without GUI in batch mode</p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs20">
+ <p><span style="font-weight: bold;"><b>--logger</b></span> <span
+ style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-l</b></span> </p>
+ </td>
+ <td colspan="1" rowspan="1" width="390" class="whs21">
+ <p>redirection of log messages into a definite file </p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs20">
+ <p><span style="font-weight: bold;"><b>--xterm</b></span> <span
+ style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-x</b></span> </p>
+ </td>
+ <td colspan="1" rowspan="1" width="390" class="whs21">
+ <p>the servers open an xterm window and log messages are displayed
+in this window</p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs20">
+ <p><span style="font-weight: bold;"><b>--modules=module1,module2,...</b></span>
+ <span style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-m=module1,module2,...</b></span></p>
+ </td>
+ <td colspan="1" rowspan="1" width="390" class="whs21">
+ <p>list of SALOME modules which will be loaded into the module catalogue</p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs22">
+ <p><span style="font-weight: bold;"><b>--containers=cpp,python,superv</b></span></p>
+
+ <p><span style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-c=cpp,python,superv</b></span></p>
+ </td>
+ <td colspan="1" rowspan="1" width="390" class="whs23">
+ <p>launch of cpp, python and supervision containers</p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs24">
+ <p><span style="font-weight: bold;"><b>--portkill</b></span> <span
+ style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-p</b></span></p>
+ </td>
+ <td colspan="1" rowspan="1" width="390" class="whs25">
+ <p>kill SALOME launched with the current port</p>
+ </td>
+ </tr>
+ <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs26">
+ <p><span style="font-weight: bold;"><b>--killall</b></span> <span
+ style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-k</b></span> </p>
+ </td>
+ <td colspan="1" rowspan="1" width="390" class="whs27">
+ <p>kill SALOME</p>
+ </td>
+ </tr>
+
+ <script language="JavaScript"><!--\r
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4)) document.write("</table></table><table>");\r
-//--></script>\r
-</table>\r
-\r
-<p class="whs10"> </p>\r
-\r
-<p class="whs28"><img src="../tip1.gif" x-maintain-ratio="TRUE" width="35px" height="37px" border="0" class="img_whs8"><span style="font-weight: normal; font-family: 'Times New Roman', serif;"> \r
- If the </span><span style="font-family: 'Times New Roman', serif;">runSalome.py \r
- </span><span style="font-family: 'Times New Roman', serif; font-weight: normal;">script \r
- is launched without prompting any options, they will be taken by default \r
- from the xml file </span><span style="font-family: 'Times New Roman', serif;">salome.launch</span><span \r
- style="font-family: 'Times New Roman', serif; font-weight: normal;">, \r
- which has been automatically created in your home directory: </span><span \r
- style="font-family: 'Times New Roman', serif;">HOME/.salome/</span><span \r
- style="font-family: 'Times New Roman', serif; font-weight: normal;">. \r
- </span> </p>\r
-\r
-<p class="whs29"> </p>\r
-\r
-<p class="whs29"> </p>\r
-\r
-<p class="whs30">\r
-<a href="javascript:void(0);" onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;} if (parseInt(navigator.appVersion) >=2 && typeof(PopupMenu_Invoke) == 'function') PopupMenu_Invoke(e,'','About SALOME PRO architecture','about_salome_pro_architecture.htm','Installing SALOME PRO','installing_salome_pro.htm','Introduction to SALOME PRO','introduction_to_salome_pro.htm');return false;" title="Related Topics"><img src="../ss_btn_related_topics.gif" border=0 height=17 width=82 alt="Related Topics"></a></p>\r
-\r
-<p class="whs30"> </p>\r
-\r
-<p class="whs30"> </p>\r
-\r
-<p class="whs30"> </p>\r
-\r
-<script type="text/javascript" language="JavaScript" title="WebHelpRelatedTopics"><!--\r
+//--></script>
+ </tbody>
+</table>
+
+<p class="whs10"> </p>
+
+<p class="whs28"><img src="../tip1.gif" x-maintain-ratio="TRUE"
+ width="35" height="37" border="0" class="img_whs8">
+<span style="font-weight: normal; font-family: 'Times New Roman',serif;">
+ If the </span><span style="font-family: 'Times New Roman',serif;">runSalome.py
+ </span><span
+ style="font-family: 'Times New Roman',serif; font-weight: normal;">script
+ is launched without prompting any options, they will be taken by default
+ from the xml file </span><span
+ style="font-family: 'Times New Roman',serif;">salome.launch</span><span
+ style="font-family: 'Times New Roman',serif; font-weight: normal;">, which
+has been automatically created in your home directory: </span><span
+ style="font-family: 'Times New Roman',serif;">HOME/.salome/</span><span
+ style="font-family: 'Times New Roman',serif; font-weight: normal;">. </span> </p>
+
+<p class="whs29"> </p>
+
+<p class="whs29"> </p>
+
+<p class="whs30"> <a href="javascript:void(0);"
+ onclick="var e; if (parseInt(navigator.appVersion)>=4){e=event;} if (parseInt(navigator.appVersion) >=2 && typeof(PopupMenu_Invoke) == 'function') PopupMenu_Invoke(e,'','About SALOME PRO architecture','about_salome_pro_architecture.htm','Installing SALOME PRO','readme.html','Introduction to SALOME PRO','introduction_to_salome_pro.htm');return false;"
+ title="Related Topics"><img src="../ss_btn_related_topics.gif"
+ border="0" height="17" width="82" alt="Related Topics">
+</a></p>
+
+<p class="whs30"> </p>
+
+<p class="whs30"> </p>
+
+<p class="whs30"> </p>
+
+<script type="text/javascript" language="JavaScript"
+ title="WebHelpRelatedTopics"><!--\r
if (parseInt(navigator.appVersion) >= 3 && typeof (WritePopupMenuLayer) == "function")\r
WritePopupMenuLayer();\r
-//--></script><script type="text/javascript" language="javascript1.2">\r
+//--></script>
+<script type="text/javascript" language="javascript1.2">\r
<!--\r
if (window.writeIntopicBar)\r
writeIntopicBar(0);\r
//-->\r
-</script>\r
-</body>\r
-\r
-</html>\r
+</script> <br>
+</body>
+</html>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = FindObjectID ( aObjectID )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SObject CreateObjectID ( in ID aObjectID )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateObjectID ( aObjectID )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>SObject FindObjectIOR ( in ID aObjectIOR )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = FindObjectIOR ( aObjectIOR )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>void EnableUseCaseAutoFilling ( in boolean isEnabled )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>EnableUseCaseAutoFilling ( isEnabled )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void AddPostponed ( in string theIOR )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>AddPostponed ( theIOR )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void AddCreatedPostponed ( in string theIOR )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>AddCreatedPostponed ( theIOR )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RemovePostponed ( in long theUndoLimit )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RemovePostponed ( theUndoLimit )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void UndoPostponed ( in long theWay )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>UndoPostponed ( theWay )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
<td bgcolor= "lightgreen"><div align="center"><b>Addreference ( anObject, theReferencedObject )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RemoveReference ( in SObject anObject )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RemoveReference ( anObject )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>void AddDirectory ( in string theName )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>AddDirectory ( theName )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>Callback SetOnRemoveSObject ( in Callback theCallback )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = SetOnRemoveSObject ( theCallback )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetName ( in SObject theSO, in string theValue )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetName ( theSO, theValue )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetComment ( in SObject theSO, in string theValue )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetComment ( theSO, theValue )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetIOR ( in SObject theSO, in string theValue )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetIOR ( theSO, theValue )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
<td bgcolor= "lightgreen"><div align="center"><b>return_value = Tag ( )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>short Depth ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Depth ( )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>boolean FindSubObject ( in long atag, out SObject obj )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>[ return_value, obj ] = FindSubObject ( atag )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>Study GetStudy ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetStudy ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>Object GetObject ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetObject ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string GetName ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetName ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string GetComment ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetComment ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string GetIOR ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetIOR ( )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
<td bgcolor= "lightgreen"><div align="center"><b>void CheckLocked ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>CheckLocked ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string Store ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Store ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void Restore ( in string theData )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Restore ( theData )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string Type ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Type ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SObject GetSObject ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetSObject ( )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface AttributeExternalFileDef</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string Value ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Value ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetValue ( in string value )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetValue ( value )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface AttributeFileType</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string Value ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Value ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetValue ( in string value )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetValue ( value )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
<td colspan="11"><font size="+3"><b><div align="center"><i>interface AttributeDrawable</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td bgcolor= "lightgreen"><div align="center"><b>boolean Kill_impl ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = Kill_impl ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string getHostName ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = getHostName ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long getPID ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = getPID ( )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetContainerRef ( )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void setProperties ( in FieldsDict dico )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>setProperties ( dico )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>FieldsDict getProperties ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = getProperties ( )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>void Names ( in string aGraphName, in string aNodeName )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>Names ( aGraphName, aNodeName )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>Acomponent GetComponent ( in string componentname )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetComponent ( componentname )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>Component GetComponentInfo ( in string componentName )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetComponentInfo ( componentName )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void ImportXmlCatalogFile ( in string filename )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>ImportXmlCatalogFile ( filename )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void shutdown ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>shutdown ( )</b></div></td>
+</tr>
</table><br>
</b></HTML>
<td bgcolor= "lightgreen"><div align="center"><b>GetInterface ( )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>Component GetVisuGen ( )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetVisuGen ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Component GetVisuComponent ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetVisuComponent ( )</b></div></td>
</tr>
<tr>
<td bgcolor= "lightgreen"><div align="center"><b>void StopSession ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>void ping ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>ping ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long GetActiveStudyId ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetActiveStudyId ( )</b></div></td>
+</tr>
</table><br>
</b></HTML>
<td bgcolor= "lightgreen"><div align="center"><b>string Coucou ( in long L )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = Coucou ( L )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void Setenv ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Setenv ( )</b></div></td>
+</tr>
</table><br>
</b></HTML>
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME v.2.0.0"
+PROJECT_NAME = "SALOME v.2.1.0"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
-foldersTree = gFld("<b>SALOME v.2.0.0 </b>", "", "")
+foldersTree = gFld("<b>SALOME v.2.1.0 </b>", "", "")
insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
--- /dev/null
+ -1
+ 2411
+ 1 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00
+ 2 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 0.0000000000000000E+00
+ 3 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 0.0000000000000000E+00
+ 4 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 0.0000000000000000E+00
+ 5 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 0.0000000000000000E+00
+ 6 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 0.0000000000000000E+00
+ 7 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 0.0000000000000000E+00
+ 8 0 0 0
+ 0.0000000000000000E+00 -1.4350000000000000E+01 0.0000000000000000E+00
+ 9 0 0 0
+ 0.0000000000000000E+00 -1.5500000000000000E+01 5.0000000000000000E-01
+ 10 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 1.7000000000000000E+00
+ 11 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 3.3500000000000001E+00
+ 12 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 4.9500000000000002E+00
+ 13 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 7.1550000000000002E+00
+ 14 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 9.3599999999999994E+00
+ 15 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 1.2359999999999999E+01
+ 16 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 1.5359999999999999E+01
+ 17 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 1.7609999999999999E+01
+ 18 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 1.8969999999999999E+01
+ 19 0 0 0
+ 0.0000000000000000E+00 -1.6129999999999999E+01 2.0800000000000001E+01
+ 20 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 2.1449999999999999E+01
+ 21 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 2.1449999999999999E+01
+ 22 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 2.1366000000000000E+01
+ 23 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 2.1239000000000001E+01
+ 24 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 2.1111999999999998E+01
+ 25 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 2.1027999999999999E+01
+ 26 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 2.0916000000000000E+01
+ 27 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 2.0000000000000000E+00
+ 28 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 1.8969999999999999E+01
+ 29 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 2.0000000000000000E+00
+ 30 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 2.0000000000000000E+00
+ 31 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 2.0000000000000000E+00
+ 32 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 2.0000000000000000E+00
+ 33 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 2.0000000000000000E+00
+ 34 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 2.0000000000000000E+00
+ 35 0 0 0
+ 0.0000000000000000E+00 -1.2877000000000001E+01 3.2160000000000002E+00
+ 36 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 4.9500000000000002E+00
+ 37 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 7.1550000000000002E+00
+ 38 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 9.3599999999999994E+00
+ 39 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 1.2359999999999999E+01
+ 40 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 1.5359999999999999E+01
+ 41 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 1.7609999999999999E+01
+ 42 0 0 0
+ 0.0000000000000000E+00 -1.4130000000000001E+01 1.8969999999999999E+01
+ 43 0 0 0
+ 0.0000000000000000E+00 -1.3600000000000000E+01 2.0000000000000000E+00
+ 44 0 0 0
+ 0.0000000000000000E+00 -1.5199999999999999E+01 3.8500000000000001E+00
+ 45 0 0 0
+ 0.0000000000000000E+00 -1.4500000000000000E+01 3.8500000000000001E+00
+ 46 0 0 0
+ 0.0000000000000000E+00 -1.4150000000000000E+01 3.1040000000000001E+00
+ 47 0 0 0
+ 0.0000000000000000E+00 -1.5199999999999999E+01 2.0000000000000000E+00
+ 48 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 3.6600000000000001E+00
+ 49 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 4.9500000000000002E+00
+ 50 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 3.0000000000000000E+00
+ 51 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 2.7999999999999998E+00
+ 52 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 1.7609999999999999E+01
+ 53 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 0.0000000000000000E+00
+ 54 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 0.0000000000000000E+00
+ 55 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 0.0000000000000000E+00
+ 56 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 0.0000000000000000E+00
+ 57 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 0.0000000000000000E+00
+ 58 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 0.0000000000000000E+00
+ 59 0 0 0
+ 0.0000000000000000E+00 1.4350000000000000E+01 0.0000000000000000E+00
+ 60 0 0 0
+ 0.0000000000000000E+00 1.5500000000000000E+01 5.0000000000000000E-01
+ 61 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 1.7000000000000000E+00
+ 62 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 3.3500000000000001E+00
+ 63 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 4.9500000000000002E+00
+ 64 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 7.1550000000000002E+00
+ 65 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 9.3599999999999994E+00
+ 66 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 1.2359999999999999E+01
+ 67 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 1.5359999999999999E+01
+ 68 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 1.7609999999999999E+01
+ 69 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 1.8969999999999999E+01
+ 70 0 0 0
+ 0.0000000000000000E+00 1.6129999999999999E+01 2.0800000000000001E+01
+ 71 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 2.1449999999999999E+01
+ 72 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 2.1449999999999999E+01
+ 73 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 2.1449999999999999E+01
+ 74 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 2.1366000000000000E+01
+ 75 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 2.1239000000000001E+01
+ 76 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 2.1111999999999998E+01
+ 77 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 2.1027999999999999E+01
+ 78 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 2.0916000000000000E+01
+ 79 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 2.0000000000000000E+00
+ 80 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 2.0000000000000000E+00
+ 81 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 2.0000000000000000E+00
+ 82 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 2.0000000000000000E+00
+ 83 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 2.0000000000000000E+00
+ 84 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 2.0000000000000000E+00
+ 85 0 0 0
+ 0.0000000000000000E+00 1.2877000000000001E+01 3.2160000000000002E+00
+ 86 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 4.9500000000000002E+00
+ 87 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 7.1550000000000002E+00
+ 88 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 9.3599999999999994E+00
+ 89 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 1.2359999999999999E+01
+ 90 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 1.5359999999999999E+01
+ 91 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 1.7609999999999999E+01
+ 92 0 0 0
+ 0.0000000000000000E+00 1.4130000000000001E+01 1.8969999999999999E+01
+ 93 0 0 0
+ 0.0000000000000000E+00 1.3600000000000000E+01 2.0000000000000000E+00
+ 94 0 0 0
+ 0.0000000000000000E+00 1.5199999999999999E+01 3.8500000000000001E+00
+ 95 0 0 0
+ 0.0000000000000000E+00 1.4500000000000000E+01 3.8500000000000001E+00
+ 96 0 0 0
+ 0.0000000000000000E+00 1.4150000000000000E+01 3.1040000000000001E+00
+ 97 0 0 0
+ 0.0000000000000000E+00 1.5199999999999999E+01 2.0000000000000000E+00
+ 98 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 3.6600000000000001E+00
+ 99 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 4.9500000000000002E+00
+ 100 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 3.0000000000000000E+00
+ 101 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 7.1550000000000002E+00
+ 102 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 9.3599999999999994E+00
+ 103 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 1.2359999999999999E+01
+ 104 0 0 0
+ 0.0000000000000000E+00 0.0000000000000000E+00 1.5359999999999999E+01
+ 105 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 7.1550000000000002E+00
+ 106 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 9.3599999999999994E+00
+ 107 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 1.2359999999999999E+01
+ 108 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 1.5359999999999999E+01
+ 109 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 1.7609999999999999E+01
+ 110 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 3.2149999999999999E+00
+ 111 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 3.2149999999999999E+00
+ 112 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 3.2149999999999999E+00
+ 113 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 3.2149999999999999E+00
+ 114 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 3.2149999999999999E+00
+ 115 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 3.2149999999999999E+00
+ 116 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 3.2149999999999999E+00
+ 117 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 3.2149999999999999E+00
+ 118 0 0 0
+ 0.0000000000000000E+00 2.3999999999999999E+00 1.8969999999999999E+01
+ 119 0 0 0
+ 0.0000000000000000E+00 -1.2877000000000001E+01 4.9500000000000002E+00
+ 120 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 4.9500000000000002E+00
+ 121 0 0 0
+ 0.0000000000000000E+00 1.2877000000000001E+01 4.9500000000000002E+00
+ 122 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 4.9500000000000002E+00
+ 123 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 4.9500000000000002E+00
+ 124 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 7.1550000000000002E+00
+ 125 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 1.7609999999999999E+01
+ 126 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 1.7609999999999999E+01
+ 127 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 7.1550000000000002E+00
+ 128 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 1.7609999999999999E+01
+ 129 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 4.9500000000000002E+00
+ 130 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 1.7609999999999999E+01
+ 131 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 7.1550000000000002E+00
+ 132 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 7.1550000000000002E+00
+ 133 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 4.9500000000000002E+00
+ 134 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 4.9500000000000002E+00
+ 135 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 4.9500000000000002E+00
+ 136 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 9.3599999999999994E+00
+ 137 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 1.2359999999999999E+01
+ 138 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 1.5359999999999999E+01
+ 139 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 4.9500000000000002E+00
+ 140 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 4.9500000000000002E+00
+ 141 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 1.5359999999999999E+01
+ 142 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 1.2359999999999999E+01
+ 143 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 9.3599999999999994E+00
+ 144 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 9.3599999999999994E+00
+ 145 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 1.2359999999999999E+01
+ 146 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 1.5359999999999999E+01
+ 147 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 1.5359999999999999E+01
+ 148 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 1.2359999999999999E+01
+ 149 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 9.3599999999999994E+00
+ 150 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 4.9500000000000002E+00
+ 151 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 4.9500000000000002E+00
+ 152 0 0 0
+ 0.0000000000000000E+00 4.0000000000000000E+00 1.8969999999999999E+01
+ 153 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 1.8969999999999999E+01
+ 154 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 1.8969999999999999E+01
+ 155 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 1.8969999999999999E+01
+ 156 0 0 0
+ 0.0000000000000000E+00 1.2000000000000000E+01 1.8969999999999999E+01
+ 157 0 0 0
+ 0.0000000000000000E+00 -2.3999999999999999E+00 1.8969999999999999E+01
+ 158 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 1.8969999999999999E+01
+ 159 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 1.8969999999999999E+01
+ 160 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 1.8969999999999999E+01
+ 161 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 1.8969999999999999E+01
+ 162 0 0 0
+ 0.0000000000000000E+00 -1.2000000000000000E+01 1.8969999999999999E+01
+ 163 0 0 0
+ 3.3999999999999999E+00 -4.0000000000000000E+00 0.0000000000000000E+00
+ 164 0 0 0
+ 3.3999999999999999E+00 -2.3999999999999999E+00 0.0000000000000000E+00
+ 165 0 0 0
+ 3.3999999999999999E+00 4.0000000000000000E+00 0.0000000000000000E+00
+ 166 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 0.0000000000000000E+00
+ 167 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 0.0000000000000000E+00
+ 168 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 3.6600000000000001E+00
+ 169 0 0 0
+ 3.3999999999999999E+00 -5.5999999999999996E+00 0.0000000000000000E+00
+ 170 0 0 0
+ 3.3999999999999999E+00 -8.0000000000000000E+00 0.0000000000000000E+00
+ 171 0 0 0
+ 3.3999999999999999E+00 -1.0400000000000000E+01 0.0000000000000000E+00
+ 172 0 0 0
+ 3.3999999999999999E+00 -4.0000000000000000E+00 2.0000000000000000E+00
+ 173 0 0 0
+ 3.3999999999999999E+00 -2.3999999999999999E+00 2.0000000000000000E+00
+ 174 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 2.0000000000000000E+00
+ 175 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 2.0000000000000000E+00
+ 176 0 0 0
+ 3.3999999999999999E+00 4.0000000000000000E+00 2.0000000000000000E+00
+ 177 0 0 0
+ 3.3999999999999999E+00 5.5999999999999996E+00 0.0000000000000000E+00
+ 178 0 0 0
+ 3.3999999999999999E+00 8.0000000000000000E+00 0.0000000000000000E+00
+ 179 0 0 0
+ 3.3999999999999999E+00 1.0400000000000000E+01 0.0000000000000000E+00
+ 180 0 0 0
+ 3.3999999999999999E+00 -2.3999999999999999E+00 3.0000000000000000E+00
+ 181 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 7.1550000000000002E+00
+ 182 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 7.1550000000000002E+00
+ 183 0 0 0
+ 3.3999999999999999E+00 -8.0000000000000000E+00 2.0000000000000000E+00
+ 184 0 0 0
+ 3.3999999999999999E+00 -1.0400000000000000E+01 2.0000000000000000E+00
+ 185 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 3.6600000000000001E+00
+ 186 0 0 0
+ 3.3999999999999999E+00 -1.2000000000000000E+01 0.0000000000000000E+00
+ 187 0 0 0
+ 3.3999999999999999E+00 -1.2000000000000000E+01 2.0000000000000000E+00
+ 188 0 0 0
+ 3.3999999999999999E+00 -1.4350000000000000E+01 0.0000000000000000E+00
+ 189 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 1.7609999999999999E+01
+ 190 0 0 0
+ 3.3999999999999999E+00 -1.2877000000000001E+01 3.2160000000000002E+00
+ 191 0 0 0
+ 3.3999999999999999E+00 -1.5500000000000000E+01 5.0000000000000000E-01
+ 192 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 1.7609999999999999E+01
+ 193 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 1.9800000000000001E+01
+ 194 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 1.7000000000000000E+00
+ 195 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 3.3500000000000001E+00
+ 196 0 0 0
+ 3.3999999999999999E+00 8.0000000000000000E+00 2.0000000000000000E+00
+ 197 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 7.1550000000000002E+00
+ 198 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 7.1550000000000002E+00
+ 199 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 7.1550000000000002E+00
+ 200 0 0 0
+ 3.3999999999999999E+00 1.2000000000000000E+01 0.0000000000000000E+00
+ 201 0 0 0
+ 3.3999999999999999E+00 1.0400000000000000E+01 2.0000000000000000E+00
+ 202 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 1.7609999999999999E+01
+ 203 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 1.7609999999999999E+01
+ 204 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 1.7609999999999999E+01
+ 205 0 0 0
+ 3.3999999999999999E+00 1.4350000000000000E+01 0.0000000000000000E+00
+ 206 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 4.9500000000000002E+00
+ 207 0 0 0
+ 3.3999999999999999E+00 1.2000000000000000E+01 2.0000000000000000E+00
+ 208 0 0 0
+ 3.3999999999999999E+00 1.5500000000000000E+01 5.0000000000000000E-01
+ 209 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 7.1550000000000002E+00
+ 210 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 1.2359999999999999E+01
+ 211 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 7.1550000000000002E+00
+ 212 0 0 0
+ 3.3999999999999999E+00 1.2877000000000001E+01 3.2160000000000002E+00
+ 213 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 1.7000000000000000E+00
+ 214 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 3.3500000000000001E+00
+ 215 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 7.1550000000000002E+00
+ 216 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 4.9500000000000002E+00
+ 217 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 9.3599999999999994E+00
+ 218 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 1.2359999999999999E+01
+ 219 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 4.9500000000000002E+00
+ 220 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 7.1550000000000002E+00
+ 221 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 7.1550000000000002E+00
+ 222 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 4.9500000000000002E+00
+ 223 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 1.2359999999999999E+01
+ 224 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 9.3599999999999994E+00
+ 225 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 1.5359999999999999E+01
+ 226 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 1.7609999999999999E+01
+ 227 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 1.8969999999999999E+01
+ 228 0 0 0
+ 3.3999999999999999E+00 -1.6129999999999999E+01 2.0800000000000001E+01
+ 229 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 9.3599999999999994E+00
+ 230 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 1.2359999999999999E+01
+ 231 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 1.2359999999999999E+01
+ 232 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 9.3599999999999994E+00
+ 233 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 1.5359999999999999E+01
+ 234 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 1.5359999999999999E+01
+ 235 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 1.7609999999999999E+01
+ 236 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 1.8969999999999999E+01
+ 237 0 0 0
+ 3.3999999999999999E+00 1.6129999999999999E+01 2.0800000000000001E+01
+ 238 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 2.0916000000000000E+01
+ 239 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 1.8969999999999999E+01
+ 240 0 0 0
+ 3.3999999999999999E+00 -1.2000000000000000E+01 2.1027999999999999E+01
+ 241 0 0 0
+ 3.3999999999999999E+00 -1.0400000000000000E+01 2.1111999999999998E+01
+ 242 0 0 0
+ 3.3999999999999999E+00 -8.0000000000000000E+00 2.1239000000000001E+01
+ 243 0 0 0
+ 3.3999999999999999E+00 -5.5999999999999996E+00 2.1366000000000000E+01
+ 244 0 0 0
+ 3.3999999999999999E+00 -4.0000000000000000E+00 2.1449999999999999E+01
+ 245 0 0 0
+ 3.3999999999999999E+00 -2.3999999999999999E+00 2.1449999999999999E+01
+ 246 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 2.1449999999999999E+01
+ 247 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 2.1449999999999999E+01
+ 248 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 1.7609999999999999E+01
+ 249 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 1.7609999999999999E+01
+ 250 0 0 0
+ 3.3999999999999999E+00 4.0000000000000000E+00 2.1449999999999999E+01
+ 251 0 0 0
+ 3.3999999999999999E+00 5.5999999999999996E+00 2.1366000000000000E+01
+ 252 0 0 0
+ 3.3999999999999999E+00 8.0000000000000000E+00 2.1239000000000001E+01
+ 253 0 0 0
+ 3.3999999999999999E+00 1.0400000000000000E+01 2.1111999999999998E+01
+ 254 0 0 0
+ 3.3999999999999999E+00 1.2000000000000000E+01 2.1027999999999999E+01
+ 255 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 2.0916000000000000E+01
+ 256 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 1.8969999999999999E+01
+ 257 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 7.1550000000000002E+00
+ 258 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 7.1550000000000002E+00
+ 259 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 1.5359999999999999E+01
+ 260 0 0 0
+ 2.2000000000000002E+00 2.3999999999999999E+00 4.9500000000000002E+00
+ 261 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 9.3599999999999994E+00
+ 262 0 0 0
+ 2.2000000000000002E+00 2.3999999999999999E+00 9.3599999999999994E+00
+ 263 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 1.5359999999999999E+01
+ 264 0 0 0
+ 2.2000000000000002E+00 2.3999999999999999E+00 1.5359999999999999E+01
+ 265 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 1.7609999999999999E+01
+ 266 0 0 0
+ 3.3999999999999999E+00 -1.4130000000000001E+01 1.7609999999999999E+01
+ 267 0 0 0
+ 3.3999999999999999E+00 1.4130000000000001E+01 1.7609999999999999E+01
+ 268 0 0 0
+ 2.2000000000000002E+00 -1.2877000000000001E+01 4.9500000000000002E+00
+ 269 0 0 0
+ 2.2000000000000002E+00 -2.3999999999999999E+00 4.9500000000000002E+00
+ 270 0 0 0
+ 2.2000000000000002E+00 1.2877000000000001E+01 4.9500000000000002E+00
+ 271 0 0 0
+ 2.2000000000000002E+00 4.0000000000000000E+00 4.9500000000000002E+00
+ 272 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 9.3599999999999994E+00
+ 273 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 1.2359999999999999E+01
+ 274 0 0 0
+ 0.0000000000000000E+00 -4.0000000000000000E+00 1.5359999999999999E+01
+ 275 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 1.5359999999999999E+01
+ 276 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 1.2359999999999999E+01
+ 277 0 0 0
+ 3.3999999999999999E+00 -5.5999999999999996E+00 2.0000000000000000E+00
+ 278 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 4.9500000000000002E+00
+ 279 0 0 0
+ 0.0000000000000000E+00 -1.0400000000000000E+01 9.3599999999999994E+00
+ 280 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 9.3599999999999994E+00
+ 281 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 1.2359999999999999E+01
+ 282 0 0 0
+ 0.0000000000000000E+00 5.5999999999999996E+00 1.5359999999999999E+01
+ 283 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 1.2359999999999999E+01
+ 284 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 1.2359999999999999E+01
+ 285 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 1.5359999999999999E+01
+ 286 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 1.5359999999999999E+01
+ 287 0 0 0
+ 0.0000000000000000E+00 1.0400000000000000E+01 9.3599999999999994E+00
+ 288 0 0 0
+ 0.0000000000000000E+00 8.0000000000000000E+00 9.3599999999999994E+00
+ 289 0 0 0
+ 3.3999999999999999E+00 5.5999999999999996E+00 2.0000000000000000E+00
+ 290 0 0 0
+ 2.2000000000000002E+00 -2.3999999999999999E+00 9.3599999999999994E+00
+ 291 0 0 0
+ 2.2000000000000002E+00 -2.3999999999999999E+00 1.5359999999999999E+01
+ 292 0 0 0
+ 2.2000000000000002E+00 -1.2000000000000000E+01 4.9500000000000002E+00
+ 293 0 0 0
+ 2.2000000000000002E+00 -1.2000000000000000E+01 1.5359999999999999E+01
+ 294 0 0 0
+ 3.3999999999999999E+00 -2.3999999999999999E+00 1.9800000000000001E+01
+ 295 0 0 0
+ 2.2000000000000002E+00 -1.2000000000000000E+01 9.3599999999999994E+00
+ 296 0 0 0
+ 2.2000000000000002E+00 4.0000000000000000E+00 9.3599999999999994E+00
+ 297 0 0 0
+ 3.3999999999999999E+00 -1.2000000000000000E+01 1.9527999999999999E+01
+ 298 0 0 0
+ 2.2000000000000002E+00 4.0000000000000000E+00 1.5359999999999999E+01
+ 299 0 0 0
+ 2.2000000000000002E+00 1.2000000000000000E+01 1.5359999999999999E+01
+ 300 0 0 0
+ 2.2000000000000002E+00 1.2000000000000000E+01 4.9500000000000002E+00
+ 301 0 0 0
+ 2.2000000000000002E+00 1.2000000000000000E+01 9.3599999999999994E+00
+ 302 0 0 0
+ 3.3999999999999999E+00 -1.3600000000000000E+01 2.0000000000000000E+00
+ 303 0 0 0
+ 3.3999999999999999E+00 1.2000000000000000E+01 1.9527999999999999E+01
+ 304 0 0 0
+ 3.3999999999999999E+00 -4.0000000000000000E+00 2.7999999999999998E+00
+ 305 0 0 0
+ 3.3999999999999999E+00 -2.3999999999999999E+00 3.6600000000000001E+00
+ 306 0 0 0
+ 2.2000000000000002E+00 -4.0000000000000000E+00 4.9500000000000002E+00
+ 307 0 0 0
+ 3.3999999999999999E+00 1.3600000000000000E+01 2.0000000000000000E+00
+ 308 0 0 0
+ 2.2000000000000002E+00 5.5999999999999996E+00 4.9500000000000002E+00
+ 309 0 0 0
+ 2.2000000000000002E+00 1.0400000000000000E+01 4.9500000000000002E+00
+ 310 0 0 0
+ 2.2000000000000002E+00 8.0000000000000000E+00 4.9500000000000002E+00
+ 311 0 0 0
+ 2.2000000000000002E+00 -1.0400000000000000E+01 4.9500000000000002E+00
+ 312 0 0 0
+ 3.3999999999999999E+00 4.0000000000000000E+00 3.0000000000000000E+00
+ 313 0 0 0
+ 2.2000000000000002E+00 -8.0000000000000000E+00 4.9500000000000002E+00
+ 314 0 0 0
+ 2.2000000000000002E+00 -5.5999999999999996E+00 4.9500000000000002E+00
+ 315 0 0 0
+ 3.3999999999999999E+00 -1.5199999999999999E+01 2.0000000000000000E+00
+ 316 0 0 0
+ 3.3999999999999999E+00 -1.4150000000000000E+01 3.1040000000000001E+00
+ 317 0 0 0
+ 3.3999999999999999E+00 -4.0000000000000000E+00 1.9949999999999999E+01
+ 318 0 0 0
+ 3.3999999999999999E+00 -1.0400000000000000E+01 1.9611999999999998E+01
+ 319 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 4.9500000000000002E+00
+ 320 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 1.7609999999999999E+01
+ 321 0 0 0
+ 3.3999999999999999E+00 4.0000000000000000E+00 1.9949999999999999E+01
+ 322 0 0 0
+ 3.3999999999999999E+00 1.5199999999999999E+01 2.0000000000000000E+00
+ 323 0 0 0
+ 3.3999999999999999E+00 1.4150000000000000E+01 3.1040000000000001E+00
+ 324 0 0 0
+ 3.3999999999999999E+00 1.0400000000000000E+01 1.9611999999999998E+01
+ 325 0 0 0
+ 3.3999999999999999E+00 -1.5199999999999999E+01 3.8500000000000001E+00
+ 326 0 0 0
+ 3.3999999999999999E+00 -1.4500000000000000E+01 3.8500000000000001E+00
+ 327 0 0 0
+ 3.3999999999999999E+00 -8.0000000000000000E+00 1.9739000000000001E+01
+ 328 0 0 0
+ 3.3999999999999999E+00 -5.5999999999999996E+00 1.9866000000000000E+01
+ 329 0 0 0
+ 3.3999999999999999E+00 8.0000000000000000E+00 1.9739000000000001E+01
+ 330 0 0 0
+ 3.3999999999999999E+00 5.5999999999999996E+00 1.9866000000000000E+01
+ 331 0 0 0
+ 3.3999999999999999E+00 1.5199999999999999E+01 3.8500000000000001E+00
+ 332 0 0 0
+ 3.3999999999999999E+00 1.4500000000000000E+01 3.8500000000000001E+00
+ 333 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 1.5359999999999999E+01
+ 334 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 1.5359999999999999E+01
+ 335 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 1.2359999999999999E+01
+ 336 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 1.2359999999999999E+01
+ 337 0 0 0
+ 0.0000000000000000E+00 -8.0000000000000000E+00 9.3599999999999994E+00
+ 338 0 0 0
+ 0.0000000000000000E+00 -5.5999999999999996E+00 9.3599999999999994E+00
+ 339 0 0 0
+ 3.3999999999999999E+00 0.0000000000000000E+00 1.8969999999999999E+01
+ 340 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 7.1550000000000002E+00
+ 341 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 1.5359999999999999E+01
+ 342 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 9.3599999999999994E+00
+ 343 0 0 0
+ 3.3999999999999999E+00 2.3999999999999999E+00 1.2359999999999999E+01
+ 344 0 0 0
+ 6.7999999999999998E+00 -2.3999999999999999E+00 0.0000000000000000E+00
+ 345 0 0 0
+ 6.7999999999999998E+00 -4.0000000000000000E+00 0.0000000000000000E+00
+ 346 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 0.0000000000000000E+00
+ 347 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 0.0000000000000000E+00
+ 348 0 0 0
+ 6.7999999999999998E+00 4.0000000000000000E+00 0.0000000000000000E+00
+ 349 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 2.0000000000000000E+00
+ 350 0 0 0
+ 6.7999999999999998E+00 -2.3999999999999999E+00 2.0000000000000000E+00
+ 351 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 3.6600000000000001E+00
+ 352 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 2.0000000000000000E+00
+ 353 0 0 0
+ 6.7999999999999998E+00 -5.5999999999999996E+00 0.0000000000000000E+00
+ 354 0 0 0
+ 6.7999999999999998E+00 -4.0000000000000000E+00 2.0000000000000000E+00
+ 355 0 0 0
+ 6.7999999999999998E+00 -8.0000000000000000E+00 0.0000000000000000E+00
+ 356 0 0 0
+ 6.7999999999999998E+00 -1.0400000000000000E+01 0.0000000000000000E+00
+ 357 0 0 0
+ 6.7999999999999998E+00 5.5999999999999996E+00 0.0000000000000000E+00
+ 358 0 0 0
+ 6.7999999999999998E+00 4.0000000000000000E+00 2.0000000000000000E+00
+ 359 0 0 0
+ 6.7999999999999998E+00 8.0000000000000000E+00 0.0000000000000000E+00
+ 360 0 0 0
+ 6.7999999999999998E+00 1.0400000000000000E+01 0.0000000000000000E+00
+ 361 0 0 0
+ 6.7999999999999998E+00 -1.2000000000000000E+01 0.0000000000000000E+00
+ 362 0 0 0
+ 6.7999999999999998E+00 -8.0000000000000000E+00 2.0000000000000000E+00
+ 363 0 0 0
+ 6.7999999999999998E+00 -1.0400000000000000E+01 2.0000000000000000E+00
+ 364 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 7.1550000000000002E+00
+ 365 0 0 0
+ 6.7999999999999998E+00 -1.2000000000000000E+01 2.0000000000000000E+00
+ 366 0 0 0
+ 6.7999999999999998E+00 -1.4350000000000000E+01 0.0000000000000000E+00
+ 367 0 0 0
+ 6.7999999999999998E+00 -1.2877000000000001E+01 3.2160000000000002E+00
+ 368 0 0 0
+ 6.7999999999999998E+00 -1.5500000000000000E+01 5.0000000000000000E-01
+ 369 0 0 0
+ 6.7999999999999998E+00 1.2000000000000000E+01 0.0000000000000000E+00
+ 370 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 1.7000000000000000E+00
+ 371 0 0 0
+ 6.7999999999999998E+00 8.0000000000000000E+00 2.0000000000000000E+00
+ 372 0 0 0
+ 2.2000000000000002E+00 -4.0000000000000000E+00 9.3599999999999994E+00
+ 373 0 0 0
+ 6.7999999999999998E+00 1.0400000000000000E+01 2.0000000000000000E+00
+ 374 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 9.3599999999999994E+00
+ 375 0 0 0
+ 2.2000000000000002E+00 -4.0000000000000000E+00 1.5359999999999999E+01
+ 376 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 4.9500000000000002E+00
+ 377 0 0 0
+ 6.7999999999999998E+00 1.4350000000000000E+01 0.0000000000000000E+00
+ 378 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 3.3500000000000001E+00
+ 379 0 0 0
+ 6.7999999999999998E+00 1.2000000000000000E+01 2.0000000000000000E+00
+ 380 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 4.9500000000000002E+00
+ 381 0 0 0
+ 2.2000000000000002E+00 -1.0400000000000000E+01 1.5359999999999999E+01
+ 382 0 0 0
+ 6.7999999999999998E+00 1.5500000000000000E+01 5.0000000000000000E-01
+ 383 0 0 0
+ 2.2000000000000002E+00 -1.0400000000000000E+01 9.3599999999999994E+00
+ 384 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 7.1550000000000002E+00
+ 385 0 0 0
+ 2.2000000000000002E+00 5.5999999999999996E+00 9.3599999999999994E+00
+ 386 0 0 0
+ 2.2000000000000002E+00 1.0400000000000000E+01 9.3599999999999994E+00
+ 387 0 0 0
+ 2.2000000000000002E+00 8.0000000000000000E+00 9.3599999999999994E+00
+ 388 0 0 0
+ 6.7999999999999998E+00 1.2877000000000001E+01 3.2160000000000002E+00
+ 389 0 0 0
+ 2.2000000000000002E+00 5.5999999999999996E+00 1.5359999999999999E+01
+ 390 0 0 0
+ 2.2000000000000002E+00 1.0400000000000000E+01 1.5359999999999999E+01
+ 391 0 0 0
+ 2.2000000000000002E+00 8.0000000000000000E+00 1.5359999999999999E+01
+ 392 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 1.7000000000000000E+00
+ 393 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 7.1550000000000002E+00
+ 394 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 1.2359999999999999E+01
+ 395 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 9.3599999999999994E+00
+ 396 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 3.3500000000000001E+00
+ 397 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 4.9500000000000002E+00
+ 398 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 1.2359999999999999E+01
+ 399 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 9.3599999999999994E+00
+ 400 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 4.9500000000000002E+00
+ 401 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 1.5359999999999999E+01
+ 402 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 7.1550000000000002E+00
+ 403 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 7.1550000000000002E+00
+ 404 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 1.2359999999999999E+01
+ 405 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 1.5359999999999999E+01
+ 406 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 9.3599999999999994E+00
+ 407 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 9.3599999999999994E+00
+ 408 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 1.7609999999999999E+01
+ 409 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 1.5359999999999999E+01
+ 410 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 1.8969999999999999E+01
+ 411 0 0 0
+ 6.7999999999999998E+00 -1.6129999999999999E+01 2.0800000000000001E+01
+ 412 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 1.2359999999999999E+01
+ 413 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 1.2359999999999999E+01
+ 414 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 1.5359999999999999E+01
+ 415 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 1.7609999999999999E+01
+ 416 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 1.8969999999999999E+01
+ 417 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 2.0916000000000000E+01
+ 418 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 1.8969999999999999E+01
+ 419 0 0 0
+ 6.7999999999999998E+00 1.6129999999999999E+01 2.0800000000000001E+01
+ 420 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 1.5359999999999999E+01
+ 421 0 0 0
+ 6.7999999999999998E+00 -1.2000000000000000E+01 2.1027999999999999E+01
+ 422 0 0 0
+ 6.7999999999999998E+00 -1.0400000000000000E+01 2.1111999999999998E+01
+ 423 0 0 0
+ 6.7999999999999998E+00 -8.0000000000000000E+00 2.1239000000000001E+01
+ 424 0 0 0
+ 6.7999999999999998E+00 -5.5999999999999996E+00 2.1366000000000000E+01
+ 425 0 0 0
+ 6.7999999999999998E+00 -4.0000000000000000E+00 2.1449999999999999E+01
+ 426 0 0 0
+ 6.7999999999999998E+00 -2.3999999999999999E+00 2.1449999999999999E+01
+ 427 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 2.1449999999999999E+01
+ 428 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 2.1449999999999999E+01
+ 429 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 2.0916000000000000E+01
+ 430 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 1.8969999999999999E+01
+ 431 0 0 0
+ 6.7999999999999998E+00 4.0000000000000000E+00 2.1449999999999999E+01
+ 432 0 0 0
+ 6.7999999999999998E+00 1.2000000000000000E+01 2.1027999999999999E+01
+ 433 0 0 0
+ 6.7999999999999998E+00 1.0400000000000000E+01 2.1111999999999998E+01
+ 434 0 0 0
+ 6.7999999999999998E+00 5.5999999999999996E+00 2.1366000000000000E+01
+ 435 0 0 0
+ 6.7999999999999998E+00 8.0000000000000000E+00 2.1239000000000001E+01
+ 436 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 4.9500000000000002E+00
+ 437 0 0 0
+ 6.7999999999999998E+00 -5.5999999999999996E+00 2.0000000000000000E+00
+ 438 0 0 0
+ 6.7999999999999998E+00 -2.3999999999999999E+00 3.0000000000000000E+00
+ 439 0 0 0
+ 6.7999999999999998E+00 5.5999999999999996E+00 2.0000000000000000E+00
+ 440 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 3.6600000000000001E+00
+ 441 0 0 0
+ 2.2000000000000002E+00 -8.0000000000000000E+00 1.5359999999999999E+01
+ 442 0 0 0
+ 2.2000000000000002E+00 -5.5999999999999996E+00 1.5359999999999999E+01
+ 443 0 0 0
+ 2.2000000000000002E+00 -8.0000000000000000E+00 9.3599999999999994E+00
+ 444 0 0 0
+ 2.2000000000000002E+00 -5.5999999999999996E+00 9.3599999999999994E+00
+ 445 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 1.7609999999999999E+01
+ 446 0 0 0
+ 6.7999999999999998E+00 -1.4130000000000001E+01 1.7609999999999999E+01
+ 447 0 0 0
+ 6.7999999999999998E+00 1.4130000000000001E+01 1.7609999999999999E+01
+ 448 0 0 0
+ 6.7999999999999998E+00 0.0000000000000000E+00 1.8969999999999999E+01
+ 449 0 0 0
+ 6.7999999999999998E+00 -4.0000000000000000E+00 2.7999999999999998E+00
+ 450 0 0 0
+ 6.7999999999999998E+00 -2.3999999999999999E+00 3.6600000000000001E+00
+ 451 0 0 0
+ 6.7999999999999998E+00 4.0000000000000000E+00 3.0000000000000000E+00
+ 452 0 0 0
+ 6.7999999999999998E+00 -1.3600000000000000E+01 2.0000000000000000E+00
+ 453 0 0 0
+ 1.0199999999999999E+01 -2.3999999999999999E+00 0.0000000000000000E+00
+ 454 0 0 0
+ 1.0199999999999999E+01 -4.0000000000000000E+00 0.0000000000000000E+00
+ 455 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 0.0000000000000000E+00
+ 456 0 0 0
+ 1.0199999999999999E+01 2.3999999999999999E+00 0.0000000000000000E+00
+ 457 0 0 0
+ 1.0199999999999999E+01 4.0000000000000000E+00 0.0000000000000000E+00
+ 458 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 4.9500000000000002E+00
+ 459 0 0 0
+ 1.0199999999999999E+01 -2.3999999999999999E+00 2.0000000000000000E+00
+ 460 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 2.0000000000000000E+00
+ 461 0 0 0
+ 1.0199999999999999E+01 2.3999999999999999E+00 2.0000000000000000E+00
+ 462 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 3.6600000000000001E+00
+ 463 0 0 0
+ 1.0199999999999999E+01 -5.5999999999999996E+00 0.0000000000000000E+00
+ 464 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 1.9800000000000001E+01
+ 465 0 0 0
+ 1.0199999999999999E+01 -4.0000000000000000E+00 2.0000000000000000E+00
+ 466 0 0 0
+ 1.0199999999999999E+01 -8.0000000000000000E+00 0.0000000000000000E+00
+ 467 0 0 0
+ 1.0199999999999999E+01 5.5999999999999996E+00 0.0000000000000000E+00
+ 468 0 0 0
+ 6.7999999999999998E+00 1.3600000000000000E+01 2.0000000000000000E+00
+ 469 0 0 0
+ 1.0199999999999999E+01 -1.0400000000000000E+01 0.0000000000000000E+00
+ 470 0 0 0
+ 1.0199999999999999E+01 4.0000000000000000E+00 2.0000000000000000E+00
+ 471 0 0 0
+ 1.0199999999999999E+01 8.0000000000000000E+00 0.0000000000000000E+00
+ 472 0 0 0
+ 1.0199999999999999E+01 1.0400000000000000E+01 0.0000000000000000E+00
+ 473 0 0 0
+ 1.0199999999999999E+01 -1.2000000000000000E+01 0.0000000000000000E+00
+ 474 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 7.1550000000000002E+00
+ 475 0 0 0
+ 1.0199999999999999E+01 -8.0000000000000000E+00 2.0000000000000000E+00
+ 476 0 0 0
+ 1.0199999999999999E+01 -1.0400000000000000E+01 2.0000000000000000E+00
+ 477 0 0 0
+ 6.7999999999999998E+00 -1.4150000000000000E+01 3.1040000000000001E+00
+ 478 0 0 0
+ 1.0199999999999999E+01 -1.2000000000000000E+01 2.0000000000000000E+00
+ 479 0 0 0
+ 1.0199999999999999E+01 -1.4350000000000000E+01 0.0000000000000000E+00
+ 480 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 7.1550000000000002E+00
+ 481 0 0 0
+ 6.7999999999999998E+00 -1.5199999999999999E+01 2.0000000000000000E+00
+ 482 0 0 0
+ 6.7999999999999998E+00 -1.5199999999999999E+01 3.8500000000000001E+00
+ 483 0 0 0
+ 6.7999999999999998E+00 -1.4500000000000000E+01 3.8500000000000001E+00
+ 484 0 0 0
+ 1.0199999999999999E+01 1.2000000000000000E+01 0.0000000000000000E+00
+ 485 0 0 0
+ 1.0199999999999999E+01 -1.2877000000000001E+01 3.2160000000000002E+00
+ 486 0 0 0
+ 1.0199999999999999E+01 8.0000000000000000E+00 2.0000000000000000E+00
+ 487 0 0 0
+ 1.0199999999999999E+01 -1.5500000000000000E+01 5.0000000000000000E-01
+ 488 0 0 0
+ 1.0199999999999999E+01 1.0400000000000000E+01 2.0000000000000000E+00
+ 489 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 9.3599999999999994E+00
+ 490 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 1.7000000000000000E+00
+ 491 0 0 0
+ 1.0199999999999999E+01 1.4350000000000000E+01 0.0000000000000000E+00
+ 492 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 9.3599999999999994E+00
+ 493 0 0 0
+ 1.0199999999999999E+01 1.2000000000000000E+01 2.0000000000000000E+00
+ 494 0 0 0
+ 6.7999999999999998E+00 1.5199999999999999E+01 2.0000000000000000E+00
+ 495 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 4.9500000000000002E+00
+ 496 0 0 0
+ 6.7999999999999998E+00 1.4150000000000000E+01 3.1040000000000001E+00
+ 497 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 3.3500000000000001E+00
+ 498 0 0 0
+ 1.0199999999999999E+01 1.5500000000000000E+01 5.0000000000000000E-01
+ 499 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 4.9500000000000002E+00
+ 500 0 0 0
+ 6.7999999999999998E+00 1.5199999999999999E+01 3.8500000000000001E+00
+ 501 0 0 0
+ 6.7999999999999998E+00 1.4500000000000000E+01 3.8500000000000001E+00
+ 502 0 0 0
+ 6.7999999999999998E+00 -1.2000000000000000E+01 1.9527999999999999E+01
+ 503 0 0 0
+ 1.0199999999999999E+01 1.2877000000000001E+01 3.2160000000000002E+00
+ 504 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 7.1550000000000002E+00
+ 505 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 7.1550000000000002E+00
+ 506 0 0 0
+ 6.7999999999999998E+00 -2.3999999999999999E+00 1.9800000000000001E+01
+ 507 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 1.7000000000000000E+00
+ 508 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 1.2359999999999999E+01
+ 509 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 1.2359999999999999E+01
+ 510 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 9.3599999999999994E+00
+ 511 0 0 0
+ 6.7999999999999998E+00 1.2000000000000000E+01 1.9527999999999999E+01
+ 512 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 9.3599999999999994E+00
+ 513 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 1.5359999999999999E+01
+ 514 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 4.9500000000000002E+00
+ 515 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 1.2359999999999999E+01
+ 516 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 3.3500000000000001E+00
+ 517 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 4.9500000000000002E+00
+ 518 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 1.5359999999999999E+01
+ 519 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 7.1550000000000002E+00
+ 520 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 1.2359999999999999E+01
+ 521 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 7.1550000000000002E+00
+ 522 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 1.5359999999999999E+01
+ 523 0 0 0
+ 6.7999999999999998E+00 2.3999999999999999E+00 1.7609999999999999E+01
+ 524 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 9.3599999999999994E+00
+ 525 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 9.3599999999999994E+00
+ 526 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 1.5359999999999999E+01
+ 527 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 1.7609999999999999E+01
+ 528 0 0 0
+ 1.0199999999999999E+01 -5.5999999999999996E+00 2.0000000000000000E+00
+ 529 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 1.2359999999999999E+01
+ 530 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 4.9500000000000002E+00
+ 531 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 1.8969999999999999E+01
+ 532 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 1.2359999999999999E+01
+ 533 0 0 0
+ 1.0199999999999999E+01 -1.6129999999999999E+01 2.0800000000000001E+01
+ 534 0 0 0
+ 1.0199999999999999E+01 5.5999999999999996E+00 2.0000000000000000E+00
+ 536 0 0 0
+ 6.7999999999999998E+00 -1.0400000000000000E+01 1.9611999999999998E+01
+ 538 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 1.5359999999999999E+01
+ 539 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 1.5359999999999999E+01
+ 540 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 1.8969999999999999E+01
+ 541 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 2.0916000000000000E+01
+ 542 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 1.7609999999999999E+01
+ 543 0 0 0
+ 6.7999999999999998E+00 -4.0000000000000000E+00 1.9949999999999999E+01
+ 544 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 1.8969999999999999E+01
+ 545 0 0 0
+ 6.7999999999999998E+00 -8.0000000000000000E+00 1.9739000000000001E+01
+ 546 0 0 0
+ 6.7999999999999998E+00 -5.5999999999999996E+00 1.9866000000000000E+01
+ 547 0 0 0
+ 1.0199999999999999E+01 -1.2000000000000000E+01 2.1027999999999999E+01
+ 548 0 0 0
+ 1.0199999999999999E+01 1.6129999999999999E+01 2.0800000000000001E+01
+ 549 0 0 0
+ 6.7999999999999998E+00 4.0000000000000000E+00 1.9949999999999999E+01
+ 550 0 0 0
+ 1.0199999999999999E+01 -1.0400000000000000E+01 2.1111999999999998E+01
+ 551 0 0 0
+ 6.7999999999999998E+00 1.0400000000000000E+01 1.9611999999999998E+01
+ 552 0 0 0
+ 6.7999999999999998E+00 8.0000000000000000E+00 1.9739000000000001E+01
+ 553 0 0 0
+ 6.7999999999999998E+00 5.5999999999999996E+00 1.9866000000000000E+01
+ 554 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 1.8969999999999999E+01
+ 555 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 2.0916000000000000E+01
+ 556 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 2.1449999999999999E+01
+ 557 0 0 0
+ 1.0199999999999999E+01 -8.0000000000000000E+00 2.1239000000000001E+01
+ 558 0 0 0
+ 1.0199999999999999E+01 -2.3999999999999999E+00 2.1449999999999999E+01
+ 559 0 0 0
+ 1.0199999999999999E+01 -4.0000000000000000E+00 2.1449999999999999E+01
+ 560 0 0 0
+ 1.0199999999999999E+01 -5.5999999999999996E+00 2.1366000000000000E+01
+ 561 0 0 0
+ 1.0199999999999999E+01 2.3999999999999999E+00 2.1449999999999999E+01
+ 562 0 0 0
+ 1.0199999999999999E+01 1.2000000000000000E+01 2.1027999999999999E+01
+ 563 0 0 0
+ 1.0199999999999999E+01 4.0000000000000000E+00 2.1449999999999999E+01
+ 564 0 0 0
+ 1.0199999999999999E+01 1.0400000000000000E+01 2.1111999999999998E+01
+ 565 0 0 0
+ 1.0199999999999999E+01 5.5999999999999996E+00 2.1366000000000000E+01
+ 566 0 0 0
+ 1.0199999999999999E+01 8.0000000000000000E+00 2.1239000000000001E+01
+ 569 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 1.7609999999999999E+01
+ 570 0 0 0
+ 1.0199999999999999E+01 -1.4130000000000001E+01 1.7609999999999999E+01
+ 583 0 0 0
+ 1.0199999999999999E+01 1.4130000000000001E+01 1.7609999999999999E+01
+ 591 0 0 0
+ 1.0199999999999999E+01 0.0000000000000000E+00 1.8969999999999999E+01
+ 592 0 0 0
+ 1.0199999999999999E+01 -3.2556229999999999E-02 9.5263449999999992E+00
+ -1
+ -1
+ 2412
+ 1 44 2 1 7 4
+ 1 167 164 2
+ 2 44 2 1 7 4
+ 167 346 344 164
+ 3 44 2 1 7 4
+ 346 455 453 344
+ 9 44 2 1 7 4
+ 2 164 163 3
+ 10 44 2 1 7 4
+ 164 344 345 163
+ 11 44 2 1 7 4
+ 344 453 454 345
+ 17 44 2 1 7 4
+ 3 163 169 4
+ 18 44 2 1 7 4
+ 163 345 353 169
+ 19 44 2 1 7 4
+ 345 454 463 353
+ 25 44 2 1 7 4
+ 4 169 170 5
+ 26 44 2 1 7 4
+ 169 353 355 170
+ 27 44 2 1 7 4
+ 353 463 466 355
+ 33 44 2 1 7 4
+ 5 170 171 6
+ 34 44 2 1 7 4
+ 170 355 356 171
+ 35 44 2 1 7 4
+ 355 466 469 356
+ 41 44 2 1 7 4
+ 6 171 186 7
+ 42 44 2 1 7 4
+ 171 356 361 186
+ 43 44 2 1 7 4
+ 356 469 473 361
+ 49 44 2 1 7 4
+ 7 186 188 8
+ 50 44 2 1 7 4
+ 186 361 366 188
+ 51 44 2 1 7 4
+ 361 473 479 366
+ 57 44 2 1 7 4
+ 8 188 191 9
+ 58 44 2 1 7 4
+ 188 366 368 191
+ 59 44 2 1 7 4
+ 366 479 487 368
+ 65 44 2 1 7 4
+ 9 191 194 10
+ 66 44 2 1 7 4
+ 191 368 370 194
+ 67 44 2 1 7 4
+ 368 487 490 370
+ 73 44 2 1 7 4
+ 10 194 195 11
+ 74 44 2 1 7 4
+ 194 370 378 195
+ 75 44 2 1 7 4
+ 370 490 497 378
+ 81 44 2 1 7 4
+ 11 195 206 12
+ 82 44 2 1 7 4
+ 195 378 380 206
+ 83 44 2 1 7 4
+ 378 497 499 380
+ 89 44 2 1 7 4
+ 12 206 209 13
+ 90 44 2 1 7 4
+ 206 380 384 209
+ 91 44 2 1 7 4
+ 380 499 505 384
+ 97 44 2 1 7 4
+ 13 209 217 14
+ 98 44 2 1 7 4
+ 209 384 395 217
+ 99 44 2 1 7 4
+ 384 505 510 395
+ 105 44 2 1 7 4
+ 14 217 218 15
+ 106 44 2 1 7 4
+ 217 395 398 218
+ 107 44 2 1 7 4
+ 395 510 515 398
+ 113 44 2 1 7 4
+ 15 218 225 16
+ 114 44 2 1 7 4
+ 218 398 405 225
+ 115 44 2 1 7 4
+ 398 515 522 405
+ 121 44 2 1 7 4
+ 16 225 226 17
+ 122 44 2 1 7 4
+ 225 405 408 226
+ 123 44 2 1 7 4
+ 405 522 527 408
+ 129 44 2 1 7 4
+ 17 226 227 18
+ 130 44 2 1 7 4
+ 226 408 410 227
+ 131 44 2 1 7 4
+ 408 527 531 410
+ 137 44 2 1 7 4
+ 18 227 228 19
+ 138 44 2 1 7 4
+ 227 410 411 228
+ 139 44 2 1 7 4
+ 410 531 533 411
+ 145 44 2 1 7 4
+ 20 245 244 21
+ 146 44 2 1 7 4
+ 245 426 425 244
+ 147 44 2 1 7 4
+ 426 558 559 425
+ 153 44 2 1 7 4
+ 21 244 243 22
+ 154 44 2 1 7 4
+ 244 425 424 243
+ 155 44 2 1 7 4
+ 425 559 560 424
+ 161 44 2 1 7 4
+ 22 243 242 23
+ 162 44 2 1 7 4
+ 243 424 423 242
+ 163 44 2 1 7 4
+ 424 560 557 423
+ 169 44 2 1 7 4
+ 23 242 241 24
+ 170 44 2 1 7 4
+ 242 423 422 241
+ 171 44 2 1 7 4
+ 423 557 550 422
+ 177 44 2 1 7 4
+ 24 241 240 25
+ 178 44 2 1 7 4
+ 241 422 421 240
+ 179 44 2 1 7 4
+ 422 550 547 421
+ 185 44 2 1 7 4
+ 25 240 238 26
+ 186 44 2 1 7 4
+ 240 421 417 238
+ 187 44 2 1 7 4
+ 421 547 541 417
+ 193 44 2 1 7 4
+ 26 238 228 19
+ 194 44 2 1 7 4
+ 238 417 411 228
+ 195 44 2 1 7 4
+ 417 541 533 411
+ 201 44 2 1 7 4
+ 27 174 173 29
+ 202 44 2 1 7 4
+ 174 349 350 173
+ 203 44 2 1 7 4
+ 349 460 459 350
+ 209 44 2 1 7 4
+ 29 173 172 30
+ 210 44 2 1 7 4
+ 173 350 354 172
+ 211 44 2 1 7 4
+ 350 459 465 354
+ 217 44 2 1 7 4
+ 30 172 277 31
+ 218 44 2 1 7 4
+ 172 354 437 277
+ 219 44 2 1 7 4
+ 354 465 528 437
+ 225 44 2 1 7 4
+ 31 277 183 32
+ 226 44 2 1 7 4
+ 277 437 362 183
+ 227 44 2 1 7 4
+ 437 528 475 362
+ 233 44 2 1 7 4
+ 32 183 184 33
+ 234 44 2 1 7 4
+ 183 362 363 184
+ 235 44 2 1 7 4
+ 362 475 476 363
+ 241 44 2 1 7 4
+ 33 184 187 34
+ 242 44 2 1 7 4
+ 184 363 365 187
+ 243 44 2 1 7 4
+ 363 476 478 365
+ 249 44 2 1 7 4
+ 34 187 190 35
+ 250 44 2 1 7 4
+ 187 365 367 190
+ 251 44 2 1 7 4
+ 365 478 485 367
+ 257 44 2 1 7 4
+ 36 216 215 37
+ 258 44 2 1 7 4
+ 216 376 393 215
+ 259 44 2 1 7 4
+ 376 495 504 393
+ 265 44 2 1 7 4
+ 37 215 224 38
+ 266 44 2 1 7 4
+ 215 393 399 224
+ 267 44 2 1 7 4
+ 393 504 512 399
+ 273 44 2 1 7 4
+ 38 224 223 39
+ 274 44 2 1 7 4
+ 224 399 404 223
+ 275 44 2 1 7 4
+ 399 512 520 404
+ 281 44 2 1 7 4
+ 39 223 233 40
+ 282 44 2 1 7 4
+ 223 404 409 233
+ 283 44 2 1 7 4
+ 404 520 526 409
+ 289 44 2 1 7 4
+ 40 233 266 41
+ 290 44 2 1 7 4
+ 233 409 446 266
+ 291 44 2 1 7 4
+ 409 526 570 446
+ 297 44 2 1 7 4
+ 41 266 239 42
+ 298 44 2 1 7 4
+ 266 446 418 239
+ 299 44 2 1 7 4
+ 446 570 540 418
+ 305 44 2 1 7 4
+ 42 239 238 26
+ 306 44 2 1 7 4
+ 239 418 417 238
+ 307 44 2 1 7 4
+ 418 540 541 417
+ 313 44 2 1 7 4
+ 2 164 173 29
+ 314 44 2 1 7 4
+ 164 344 350 173
+ 315 44 2 1 7 4
+ 344 453 459 350
+ 321 44 2 1 7 4
+ 4 169 277 31
+ 322 44 2 1 7 4
+ 169 353 437 277
+ 323 44 2 1 7 4
+ 353 463 528 437
+ 329 44 2 1 7 4
+ 7 186 187 34
+ 330 44 2 1 7 4
+ 186 361 365 187
+ 331 44 2 1 7 4
+ 361 473 478 365
+ 337 44 2 1 7 4
+ 36 216 206 12
+ 338 44 2 1 7 4
+ 216 376 380 206
+ 339 44 2 1 7 4
+ 376 495 499 380
+ 345 44 2 1 7 4
+ 38 224 217 14
+ 346 44 2 1 7 4
+ 224 399 395 217
+ 347 44 2 1 7 4
+ 399 512 510 395
+ 353 44 2 1 7 4
+ 40 233 225 16
+ 354 44 2 1 7 4
+ 233 409 405 225
+ 355 44 2 1 7 4
+ 409 526 522 405
+ 361 44 2 1 7 4
+ 35 190 216 36
+ 362 44 2 1 7 4
+ 190 367 376 216
+ 363 44 2 1 7 4
+ 367 485 495 376
+ 369 44 2 1 7 4
+ 1 167 166 53
+ 370 44 2 1 7 4
+ 167 346 347 166
+ 371 44 2 1 7 4
+ 346 455 456 347
+ 377 44 2 1 7 4
+ 53 166 165 54
+ 378 44 2 1 7 4
+ 166 347 348 165
+ 379 44 2 1 7 4
+ 347 456 457 348
+ 385 44 2 1 7 4
+ 54 165 177 55
+ 386 44 2 1 7 4
+ 165 348 357 177
+ 387 44 2 1 7 4
+ 348 457 467 357
+ 393 44 2 1 7 4
+ 55 177 178 56
+ 394 44 2 1 7 4
+ 177 357 359 178
+ 395 44 2 1 7 4
+ 357 467 471 359
+ 401 44 2 1 7 4
+ 56 178 179 57
+ 402 44 2 1 7 4
+ 178 359 360 179
+ 403 44 2 1 7 4
+ 359 471 472 360
+ 409 44 2 1 7 4
+ 57 179 200 58
+ 410 44 2 1 7 4
+ 179 360 369 200
+ 411 44 2 1 7 4
+ 360 472 484 369
+ 417 44 2 1 7 4
+ 58 200 205 59
+ 418 44 2 1 7 4
+ 200 369 377 205
+ 419 44 2 1 7 4
+ 369 484 491 377
+ 425 44 2 1 7 4
+ 59 205 208 60
+ 426 44 2 1 7 4
+ 205 377 382 208
+ 427 44 2 1 7 4
+ 377 491 498 382
+ 433 44 2 1 7 4
+ 60 208 213 61
+ 434 44 2 1 7 4
+ 208 382 392 213
+ 435 44 2 1 7 4
+ 382 498 507 392
+ 441 44 2 1 7 4
+ 61 213 214 62
+ 442 44 2 1 7 4
+ 213 392 396 214
+ 443 44 2 1 7 4
+ 392 507 516 396
+ 449 44 2 1 7 4
+ 62 214 219 63
+ 450 44 2 1 7 4
+ 214 396 400 219
+ 451 44 2 1 7 4
+ 396 516 517 400
+ 457 44 2 1 7 4
+ 63 219 220 64
+ 458 44 2 1 7 4
+ 219 400 402 220
+ 459 44 2 1 7 4
+ 400 517 521 402
+ 465 44 2 1 7 4
+ 64 220 229 65
+ 466 44 2 1 7 4
+ 220 402 406 229
+ 467 44 2 1 7 4
+ 402 521 524 406
+ 473 44 2 1 7 4
+ 65 229 230 66
+ 474 44 2 1 7 4
+ 229 406 412 230
+ 475 44 2 1 7 4
+ 406 524 529 412
+ 481 44 2 1 7 4
+ 66 230 234 67
+ 482 44 2 1 7 4
+ 230 412 414 234
+ 483 44 2 1 7 4
+ 412 529 538 414
+ 489 44 2 1 7 4
+ 67 234 235 68
+ 490 44 2 1 7 4
+ 234 414 415 235
+ 491 44 2 1 7 4
+ 414 538 542 415
+ 497 44 2 1 7 4
+ 68 235 236 69
+ 498 44 2 1 7 4
+ 235 415 416 236
+ 499 44 2 1 7 4
+ 415 542 544 416
+ 505 44 2 1 7 4
+ 69 236 237 70
+ 506 44 2 1 7 4
+ 236 416 419 237
+ 507 44 2 1 7 4
+ 416 544 548 419
+ 513 44 2 1 7 4
+ 71 246 247 72
+ 514 44 2 1 7 4
+ 246 427 428 247
+ 515 44 2 1 7 4
+ 427 556 561 428
+ 521 44 2 1 7 4
+ 72 247 250 73
+ 522 44 2 1 7 4
+ 247 428 431 250
+ 523 44 2 1 7 4
+ 428 561 563 431
+ 529 44 2 1 7 4
+ 73 250 251 74
+ 530 44 2 1 7 4
+ 250 431 434 251
+ 531 44 2 1 7 4
+ 431 563 565 434
+ 537 44 2 1 7 4
+ 74 251 252 75
+ 538 44 2 1 7 4
+ 251 434 435 252
+ 539 44 2 1 7 4
+ 434 565 566 435
+ 545 44 2 1 7 4
+ 75 252 253 76
+ 546 44 2 1 7 4
+ 252 435 433 253
+ 547 44 2 1 7 4
+ 435 566 564 433
+ 553 44 2 1 7 4
+ 76 253 254 77
+ 554 44 2 1 7 4
+ 253 433 432 254
+ 555 44 2 1 7 4
+ 433 564 562 432
+ 561 44 2 1 7 4
+ 77 254 255 78
+ 562 44 2 1 7 4
+ 254 432 429 255
+ 563 44 2 1 7 4
+ 432 562 555 429
+ 569 44 2 1 7 4
+ 78 255 237 70
+ 570 44 2 1 7 4
+ 255 429 419 237
+ 571 44 2 1 7 4
+ 429 555 548 419
+ 577 44 2 1 7 4
+ 27 174 175 79
+ 578 44 2 1 7 4
+ 174 349 352 175
+ 579 44 2 1 7 4
+ 349 460 461 352
+ 585 44 2 1 7 4
+ 79 175 176 80
+ 586 44 2 1 7 4
+ 175 352 358 176
+ 587 44 2 1 7 4
+ 352 461 470 358
+ 593 44 2 1 7 4
+ 80 176 289 81
+ 594 44 2 1 7 4
+ 176 358 439 289
+ 595 44 2 1 7 4
+ 358 470 534 439
+ 601 44 2 1 7 4
+ 81 289 196 82
+ 602 44 2 1 7 4
+ 289 439 371 196
+ 603 44 2 1 7 4
+ 439 534 486 371
+ 609 44 2 1 7 4
+ 82 196 201 83
+ 610 44 2 1 7 4
+ 196 371 373 201
+ 611 44 2 1 7 4
+ 371 486 488 373
+ 617 44 2 1 7 4
+ 83 201 207 84
+ 618 44 2 1 7 4
+ 201 373 379 207
+ 619 44 2 1 7 4
+ 373 488 493 379
+ 625 44 2 1 7 4
+ 84 207 212 85
+ 626 44 2 1 7 4
+ 207 379 388 212
+ 627 44 2 1 7 4
+ 379 493 503 388
+ 633 44 2 1 7 4
+ 86 222 221 87
+ 634 44 2 1 7 4
+ 222 397 403 221
+ 635 44 2 1 7 4
+ 397 514 519 403
+ 641 44 2 1 7 4
+ 87 221 232 88
+ 642 44 2 1 7 4
+ 221 403 407 232
+ 643 44 2 1 7 4
+ 403 519 525 407
+ 649 44 2 1 7 4
+ 88 232 231 89
+ 650 44 2 1 7 4
+ 232 407 413 231
+ 651 44 2 1 7 4
+ 407 525 532 413
+ 657 44 2 1 7 4
+ 89 231 259 90
+ 658 44 2 1 7 4
+ 231 413 420 259
+ 659 44 2 1 7 4
+ 413 532 539 420
+ 665 44 2 1 7 4
+ 90 259 267 91
+ 666 44 2 1 7 4
+ 259 420 447 267
+ 667 44 2 1 7 4
+ 420 539 583 447
+ 673 44 2 1 7 4
+ 91 267 256 92
+ 674 44 2 1 7 4
+ 267 447 430 256
+ 675 44 2 1 7 4
+ 447 583 554 430
+ 681 44 2 1 7 4
+ 92 256 255 78
+ 682 44 2 1 7 4
+ 256 430 429 255
+ 683 44 2 1 7 4
+ 430 554 555 429
+ 689 44 2 1 7 4
+ 53 166 175 79
+ 690 44 2 1 7 4
+ 166 347 352 175
+ 691 44 2 1 7 4
+ 347 456 461 352
+ 697 44 2 1 7 4
+ 55 177 289 81
+ 698 44 2 1 7 4
+ 177 357 439 289
+ 699 44 2 1 7 4
+ 357 467 534 439
+ 705 44 2 1 7 4
+ 58 200 207 84
+ 706 44 2 1 7 4
+ 200 369 379 207
+ 707 44 2 1 7 4
+ 369 484 493 379
+ 713 44 2 1 7 4
+ 86 222 219 63
+ 714 44 2 1 7 4
+ 222 397 400 219
+ 715 44 2 1 7 4
+ 397 514 517 400
+ 721 44 2 1 7 4
+ 88 232 229 65
+ 722 44 2 1 7 4
+ 232 407 406 229
+ 723 44 2 1 7 4
+ 407 525 524 406
+ 729 44 2 1 7 4
+ 90 259 234 67
+ 730 44 2 1 7 4
+ 259 420 414 234
+ 731 44 2 1 7 4
+ 420 539 538 414
+ 737 44 2 1 7 4
+ 85 212 222 86
+ 738 44 2 1 7 4
+ 212 388 397 222
+ 739 44 2 1 7 4
+ 388 503 514 397
+ 745 44 2 1 7 4
+ 1 167 174 27
+ 746 44 2 1 7 4
+ 167 346 349 174
+ 747 44 2 1 7 4
+ 346 455 460 349
+ 753 44 2 1 7 4
+ 27 174 168 48
+ 754 44 2 1 7 4
+ 174 349 351 168
+ 755 44 2 1 7 4
+ 349 460 462 351
+ 761 44 2 1 7 4
+ 48 168 278 49
+ 762 44 2 1 7 4
+ 168 351 436 278
+ 763 44 2 1 7 4
+ 351 462 530 436
+ 769 44 2 1 7 4
+ 49 278 182 101
+ 770 44 2 1 7 4
+ 278 436 364 182
+ 771 44 2 1 7 4
+ 436 530 480 364
+ 777 44 2 1 7 4
+ 101 182 261 102
+ 778 44 2 1 7 4
+ 182 364 374 261
+ 779 44 2 1 7 4
+ 364 480 492 374
+ 785 44 2 1 7 4
+ 102 261 210 103
+ 786 44 2 1 7 4
+ 261 374 394 210
+ 787 44 2 1 7 4
+ 374 492 508 394
+ 793 44 2 1 7 4
+ 103 210 263 104
+ 794 44 2 1 7 4
+ 210 394 401 263
+ 795 44 2 1 7 4
+ 394 508 518 401
+ 801 44 2 1 7 4
+ 104 263 265 52
+ 802 44 2 1 7 4
+ 263 401 445 265
+ 803 44 2 1 7 4
+ 401 518 569 445
+ 809 44 2 1 7 4
+ 52 265 339 28
+ 810 44 2 1 7 4
+ 265 445 448 339
+ 811 44 2 1 7 4
+ 445 569 591 448
+ 817 44 2 1 7 4
+ 71 246 339 28
+ 818 44 2 1 7 4
+ 246 427 448 339
+ 819 44 2 1 7 4
+ 427 556 591 448
+ 825 44 2 1 7 4
+ 71 246 245 20
+ 826 44 2 1 7 4
+ 246 427 426 245
+ 827 44 2 1 7 4
+ 427 556 558 426
+ 838 11 2 1 7 2
+ 0 0 0
+ 450 436
+ 839 11 2 1 7 2
+ 0 0 0
+ 305 278
+ 845 11 2 1 7 2
+ 0 0 0
+ 449 450
+ 846 11 2 1 7 2
+ 0 0 0
+ 304 305
+ 852 11 2 1 7 2
+ 0 0 0
+ 437 449
+ 853 11 2 1 7 2
+ 0 0 0
+ 277 304
+ 859 11 2 1 7 2
+ 0 0 0
+ 350 349
+ 860 11 2 1 7 2
+ 0 0 0
+ 173 174
+ 861 11 2 1 7 2
+ 0 0 0
+ 29 27
+ 867 11 2 1 7 2
+ 0 0 0
+ 346 344
+ 868 11 2 1 7 2
+ 0 0 0
+ 167 164
+ 869 11 2 1 7 2
+ 0 0 0
+ 1 2
+ 875 11 2 1 7 2
+ 0 0 0
+ 477 452
+ 876 11 2 1 7 2
+ 0 0 0
+ 316 302
+ 882 11 2 1 7 2
+ 0 0 0
+ 483 477
+ 883 11 2 1 7 2
+ 0 0 0
+ 326 316
+ 889 11 2 1 7 2
+ 0 0 0
+ 482 483
+ 890 11 2 1 7 2
+ 0 0 0
+ 325 326
+ 896 11 2 1 7 2
+ 0 0 0
+ 481 482
+ 897 11 2 1 7 2
+ 0 0 0
+ 315 325
+ 903 11 2 1 7 2
+ 0 0 0
+ 452 481
+ 904 11 2 1 7 2
+ 0 0 0
+ 302 315
+ 910 11 2 1 7 2
+ 0 0 0
+ 446 502
+ 911 11 2 1 7 2
+ 0 0 0
+ 266 297
+ 917 11 2 1 7 2
+ 0 0 0
+ 502 536
+ 918 11 2 1 7 2
+ 0 0 0
+ 297 318
+ 924 11 2 1 7 2
+ 0 0 0
+ 536 545
+ 925 11 2 1 7 2
+ 0 0 0
+ 318 327
+ 931 11 2 1 7 2
+ 0 0 0
+ 545 546
+ 932 11 2 1 7 2
+ 0 0 0
+ 327 328
+ 938 11 2 1 7 2
+ 0 0 0
+ 546 543
+ 939 11 2 1 7 2
+ 0 0 0
+ 328 317
+ 945 11 2 1 7 2
+ 0 0 0
+ 543 506
+ 946 11 2 1 7 2
+ 0 0 0
+ 317 294
+ 952 11 2 1 7 2
+ 0 0 0
+ 506 445
+ 953 11 2 1 7 2
+ 0 0 0
+ 294 265
+ 954 11 2 1 7 2
+ 0 0 0
+ 216 268
+ 955 11 2 1 7 2
+ 0 0 0
+ 268 292
+ 956 11 2 1 7 2
+ 0 0 0
+ 292 311
+ 957 11 2 1 7 2
+ 0 0 0
+ 311 313
+ 958 11 2 1 7 2
+ 0 0 0
+ 313 314
+ 959 11 2 1 7 2
+ 0 0 0
+ 314 306
+ 960 11 2 1 7 2
+ 0 0 0
+ 306 269
+ 961 11 2 1 7 2
+ 0 0 0
+ 224 295
+ 962 11 2 1 7 2
+ 0 0 0
+ 295 383
+ 963 11 2 1 7 2
+ 0 0 0
+ 383 443
+ 964 11 2 1 7 2
+ 0 0 0
+ 443 444
+ 965 11 2 1 7 2
+ 0 0 0
+ 444 372
+ 966 11 2 1 7 2
+ 0 0 0
+ 372 290
+ 967 11 2 1 7 2
+ 0 0 0
+ 233 293
+ 968 11 2 1 7 2
+ 0 0 0
+ 293 381
+ 969 11 2 1 7 2
+ 0 0 0
+ 381 441
+ 970 11 2 1 7 2
+ 0 0 0
+ 441 442
+ 971 11 2 1 7 2
+ 0 0 0
+ 442 375
+ 972 11 2 1 7 2
+ 0 0 0
+ 375 291
+ 978 11 2 1 7 2
+ 0 0 0
+ 451 458
+ 979 11 2 1 7 2
+ 0 0 0
+ 312 319
+ 985 11 2 1 7 2
+ 0 0 0
+ 439 451
+ 986 11 2 1 7 2
+ 0 0 0
+ 289 312
+ 992 11 2 1 7 2
+ 0 0 0
+ 352 349
+ 993 11 2 1 7 2
+ 0 0 0
+ 175 174
+ 994 11 2 1 7 2
+ 0 0 0
+ 79 27
+ 1000 11 2 1 7 2
+ 0 0 0
+ 346 347
+ 1001 11 2 1 7 2
+ 0 0 0
+ 167 166
+ 1002 11 2 1 7 2
+ 0 0 0
+ 1 53
+ 1008 11 2 1 7 2
+ 0 0 0
+ 496 468
+ 1009 11 2 1 7 2
+ 0 0 0
+ 323 307
+ 1015 11 2 1 7 2
+ 0 0 0
+ 501 496
+ 1016 11 2 1 7 2
+ 0 0 0
+ 332 323
+ 1022 11 2 1 7 2
+ 0 0 0
+ 500 501
+ 1023 11 2 1 7 2
+ 0 0 0
+ 331 332
+ 1029 11 2 1 7 2
+ 0 0 0
+ 494 500
+ 1030 11 2 1 7 2
+ 0 0 0
+ 322 331
+ 1036 11 2 1 7 2
+ 0 0 0
+ 468 494
+ 1037 11 2 1 7 2
+ 0 0 0
+ 307 322
+ 1043 11 2 1 7 2
+ 0 0 0
+ 447 511
+ 1044 11 2 1 7 2
+ 0 0 0
+ 267 303
+ 1050 11 2 1 7 2
+ 0 0 0
+ 511 551
+ 1051 11 2 1 7 2
+ 0 0 0
+ 303 324
+ 1057 11 2 1 7 2
+ 0 0 0
+ 551 552
+ 1058 11 2 1 7 2
+ 0 0 0
+ 324 329
+ 1064 11 2 1 7 2
+ 0 0 0
+ 552 553
+ 1065 11 2 1 7 2
+ 0 0 0
+ 329 330
+ 1071 11 2 1 7 2
+ 0 0 0
+ 553 549
+ 1072 11 2 1 7 2
+ 0 0 0
+ 330 321
+ 1073 11 2 1 7 2
+ 0 0 0
+ 222 270
+ 1074 11 2 1 7 2
+ 0 0 0
+ 270 300
+ 1075 11 2 1 7 2
+ 0 0 0
+ 300 309
+ 1076 11 2 1 7 2
+ 0 0 0
+ 309 310
+ 1077 11 2 1 7 2
+ 0 0 0
+ 310 308
+ 1078 11 2 1 7 2
+ 0 0 0
+ 308 271
+ 1079 11 2 1 7 2
+ 0 0 0
+ 271 260
+ 1080 11 2 1 7 2
+ 0 0 0
+ 232 301
+ 1081 11 2 1 7 2
+ 0 0 0
+ 301 386
+ 1082 11 2 1 7 2
+ 0 0 0
+ 386 387
+ 1083 11 2 1 7 2
+ 0 0 0
+ 387 385
+ 1084 11 2 1 7 2
+ 0 0 0
+ 385 296
+ 1085 11 2 1 7 2
+ 0 0 0
+ 296 262
+ 1086 11 2 1 7 2
+ 0 0 0
+ 259 299
+ 1087 11 2 1 7 2
+ 0 0 0
+ 299 390
+ 1088 11 2 1 7 2
+ 0 0 0
+ 390 391
+ 1089 11 2 1 7 2
+ 0 0 0
+ 391 389
+ 1090 11 2 1 7 2
+ 0 0 0
+ 389 298
+ 1091 11 2 1 7 2
+ 0 0 0
+ 298 264
+ 1097 11 2 1 7 2
+ 0 0 0
+ 346 349
+ 1098 11 2 1 7 2
+ 0 0 0
+ 167 174
+ 1099 11 2 1 7 2
+ 0 0 0
+ 1 27
+ 1100 11 2 1 7 2
+ 0 0 0
+ 291 263
+ 1101 11 2 1 7 2
+ 0 0 0
+ 290 261
+ 1102 11 2 1 7 2
+ 0 0 0
+ 269 278
+ 1103 11 2 1 7 2
+ 0 0 0
+ 263 264
+ 1104 11 2 1 7 2
+ 0 0 0
+ 261 262
+ 1105 11 2 1 7 2
+ 0 0 0
+ 278 260
+ 1106 11 2 1 7 2
+ 0 0 0
+ 319 340
+ 1107 11 2 1 7 2
+ 0 0 0
+ 340 342
+ 1108 11 2 1 7 2
+ 0 0 0
+ 342 343
+ 1109 11 2 1 7 2
+ 0 0 0
+ 343 341
+ 1110 11 2 1 7 2
+ 0 0 0
+ 341 320
+ 1111 11 2 1 7 2
+ 0 0 0
+ 320 321
+ 1112 11 2 1 7 2
+ 0 0 0
+ 458 474
+ 1118 11 2 1 7 2
+ 0 0 0
+ 474 489
+ 1124 11 2 1 7 2
+ 0 0 0
+ 489 509
+ 1130 11 2 1 7 2
+ 0 0 0
+ 509 513
+ 1136 11 2 1 7 2
+ 0 0 0
+ 513 523
+ 1142 11 2 1 7 2
+ 0 0 0
+ 523 549
+ 1153 11 2 1 7 2
+ 0 0 0
+ 448 591
+ 1154 11 2 1 7 2
+ 0 0 0
+ 339 448
+ 1155 11 2 1 7 2
+ 0 0 0
+ 28 339
+ 1156 11 2 1 7 2
+ 0 0 0
+ 28 118
+ 1157 11 2 1 7 2
+ 0 0 0
+ 118 152
+ 1158 11 2 1 7 2
+ 0 0 0
+ 152 153
+ 1159 11 2 1 7 2
+ 0 0 0
+ 153 154
+ 1160 11 2 1 7 2
+ 0 0 0
+ 154 155
+ 1161 11 2 1 7 2
+ 0 0 0
+ 28 157
+ 1162 11 2 1 7 2
+ 0 0 0
+ 157 158
+ 1163 11 2 1 7 2
+ 0 0 0
+ 158 159
+ 1164 11 2 1 7 2
+ 0 0 0
+ 159 160
+ 1165 11 2 1 7 2
+ 0 0 0
+ 155 156
+ 1166 11 2 1 7 2
+ 0 0 0
+ 156 92
+ 1167 11 2 1 7 2
+ 0 0 0
+ 160 161
+ 1168 11 2 1 7 2
+ 0 0 0
+ 161 162
+ 1169 11 2 1 7 2
+ 0 0 0
+ 162 42
+ 1175 44 2 1 7 4
+ 438 351 349 350
+ 1176 44 2 1 7 4
+ 180 168 174 173
+ 1177 44 2 1 7 4
+ 50 48 27 29
+ 1183 44 2 1 7 4
+ 450 436 351 438
+ 1184 44 2 1 7 4
+ 305 278 168 180
+ 1190 44 2 1 7 4
+ 449 438 350 354
+ 1191 44 2 1 7 4
+ 304 180 173 172
+ 1197 44 2 1 7 4
+ 354 350 344 345
+ 1198 44 2 1 7 4
+ 172 173 164 163
+ 1199 44 2 1 7 4
+ 30 29 2 3
+ 1205 44 2 1 7 4
+ 437 354 345 353
+ 1206 44 2 1 7 4
+ 277 172 163 169
+ 1207 44 2 1 7 4
+ 31 30 3 4
+ 1213 44 2 1 7 4
+ 362 437 353 355
+ 1214 44 2 1 7 4
+ 183 277 169 170
+ 1215 44 2 1 7 4
+ 32 31 4 5
+ 1221 44 2 1 7 4
+ 363 362 355 356
+ 1222 44 2 1 7 4
+ 184 183 170 171
+ 1223 44 2 1 7 4
+ 33 32 5 6
+ 1229 44 2 1 7 4
+ 365 363 356 361
+ 1230 44 2 1 7 4
+ 187 184 171 186
+ 1236 44 2 1 7 4
+ 452 365 361 366
+ 1237 44 2 1 7 4
+ 302 187 186 188
+ 1238 44 2 1 7 4
+ 43 34 7 8
+ 1244 44 2 1 7 4
+ 481 452 366 368
+ 1245 44 2 1 7 4
+ 315 302 188 191
+ 1246 44 2 1 7 4
+ 47 43 8 9
+ 1252 44 2 1 7 4
+ 477 367 365 452
+ 1253 44 2 1 7 4
+ 316 190 187 302
+ 1254 44 2 1 7 4
+ 46 35 34 43
+ 1260 44 2 1 7 4
+ 483 376 367 477
+ 1261 44 2 1 7 4
+ 326 216 190 316
+ 1262 44 2 1 7 4
+ 45 36 35 46
+ 1268 44 2 1 7 4
+ 378 482 481 370
+ 1269 44 2 1 7 4
+ 195 325 315 194
+ 1270 44 2 1 7 4
+ 11 44 47 10
+ 1276 44 2 1 7 4
+ 380 376 483 482
+ 1277 44 2 1 7 4
+ 206 216 326 325
+ 1278 44 2 1 7 4
+ 12 36 45 44
+ 1284 44 2 1 7 4
+ 384 393 376 380
+ 1285 44 2 1 7 4
+ 209 215 216 206
+ 1286 44 2 1 7 4
+ 13 37 36 12
+ 1292 44 2 1 7 4
+ 395 399 393 384
+ 1293 44 2 1 7 4
+ 217 224 215 209
+ 1294 44 2 1 7 4
+ 14 38 37 13
+ 1300 44 2 1 7 4
+ 398 404 399 395
+ 1301 44 2 1 7 4
+ 218 223 224 217
+ 1302 44 2 1 7 4
+ 15 39 38 14
+ 1308 44 2 1 7 4
+ 405 409 404 398
+ 1309 44 2 1 7 4
+ 225 233 223 218
+ 1310 44 2 1 7 4
+ 16 40 39 15
+ 1316 44 2 1 7 4
+ 408 446 409 405
+ 1317 44 2 1 7 4
+ 226 266 233 225
+ 1318 44 2 1 7 4
+ 17 41 40 16
+ 1324 44 2 1 7 4
+ 410 418 446 408
+ 1325 44 2 1 7 4
+ 227 239 266 226
+ 1326 44 2 1 7 4
+ 18 42 41 17
+ 1332 44 2 1 7 4
+ 411 417 418 410
+ 1333 44 2 1 7 4
+ 228 238 239 227
+ 1334 44 2 1 7 4
+ 19 26 42 18
+ 1340 44 2 1 7 4
+ 417 421 502 418
+ 1341 44 2 1 7 4
+ 238 240 297 239
+ 1342 44 2 1 7 4
+ 26 25 162 42
+ 1348 44 2 1 7 4
+ 421 422 536 502
+ 1349 44 2 1 7 4
+ 240 241 318 297
+ 1350 44 2 1 7 4
+ 25 24 161 162
+ 1356 44 2 1 7 4
+ 422 423 545 536
+ 1357 44 2 1 7 4
+ 241 242 327 318
+ 1358 44 2 1 7 4
+ 24 23 160 161
+ 1364 44 2 1 7 4
+ 423 424 546 545
+ 1365 44 2 1 7 4
+ 242 243 328 327
+ 1366 44 2 1 7 4
+ 23 22 159 160
+ 1372 44 2 1 7 4
+ 424 425 543 546
+ 1373 44 2 1 7 4
+ 243 244 317 328
+ 1374 44 2 1 7 4
+ 22 21 158 159
+ 1380 44 2 1 7 4
+ 425 426 506 543
+ 1381 44 2 1 7 4
+ 244 245 294 317
+ 1382 44 2 1 7 4
+ 21 20 157 158
+ 1383 44 2 1 7 4
+ 44 45 46 47
+ 1384 44 2 1 7 4
+ 110 113 33 34
+ 1385 44 2 1 7 4
+ 113 112 32 33
+ 1386 44 2 1 7 4
+ 112 111 31 32
+ 1387 44 2 1 7 4
+ 111 51 30 31
+ 1388 44 2 1 7 4
+ 51 50 29 30
+ 1389 44 2 1 7 4
+ 119 123 110 35
+ 1390 44 2 1 7 4
+ 123 135 113 110
+ 1391 44 2 1 7 4
+ 135 150 112 113
+ 1392 44 2 1 7 4
+ 150 151 111 112
+ 1393 44 2 1 7 4
+ 151 133 51 111
+ 1394 44 2 1 7 4
+ 133 120 50 51
+ 1395 44 2 1 7 4
+ 120 49 48 50
+ 1396 44 2 1 7 4
+ 37 131 119 36
+ 1397 44 2 1 7 4
+ 131 211 135 123
+ 1398 44 2 1 7 4
+ 211 258 150 135
+ 1399 44 2 1 7 4
+ 258 257 151 150
+ 1400 44 2 1 7 4
+ 257 181 133 151
+ 1401 44 2 1 7 4
+ 181 124 120 133
+ 1402 44 2 1 7 4
+ 38 143 131 37
+ 1403 44 2 1 7 4
+ 143 279 211 131
+ 1404 44 2 1 7 4
+ 279 337 258 211
+ 1405 44 2 1 7 4
+ 337 338 257 258
+ 1406 44 2 1 7 4
+ 338 272 181 257
+ 1407 44 2 1 7 4
+ 272 136 124 181
+ 1408 44 2 1 7 4
+ 39 142 143 38
+ 1409 44 2 1 7 4
+ 142 276 279 143
+ 1410 44 2 1 7 4
+ 276 335 337 279
+ 1411 44 2 1 7 4
+ 335 336 338 337
+ 1412 44 2 1 7 4
+ 336 273 272 338
+ 1413 44 2 1 7 4
+ 273 137 136 272
+ 1414 44 2 1 7 4
+ 40 141 142 39
+ 1415 44 2 1 7 4
+ 141 275 276 142
+ 1416 44 2 1 7 4
+ 275 333 335 276
+ 1417 44 2 1 7 4
+ 333 334 336 335
+ 1418 44 2 1 7 4
+ 334 274 273 336
+ 1419 44 2 1 7 4
+ 274 138 137 273
+ 1420 44 2 1 7 4
+ 41 125 141 40
+ 1421 44 2 1 7 4
+ 125 189 275 141
+ 1422 44 2 1 7 4
+ 189 248 333 275
+ 1423 44 2 1 7 4
+ 248 249 334 333
+ 1424 44 2 1 7 4
+ 249 192 274 334
+ 1425 44 2 1 7 4
+ 192 126 138 274
+ 1426 44 2 1 7 4
+ 42 162 125 41
+ 1427 44 2 1 7 4
+ 162 161 189 125
+ 1428 44 2 1 7 4
+ 161 160 248 189
+ 1429 44 2 1 7 4
+ 160 159 249 248
+ 1430 44 2 1 7 4
+ 159 158 192 249
+ 1431 44 2 1 7 4
+ 158 157 126 192
+ 1432 44 2 1 7 4
+ 268 119 123 292
+ 1433 44 2 1 7 4
+ 292 123 135 311
+ 1434 44 2 1 7 4
+ 311 135 150 313
+ 1435 44 2 1 7 4
+ 313 150 151 314
+ 1436 44 2 1 7 4
+ 314 151 133 306
+ 1437 44 2 1 7 4
+ 306 133 120 269
+ 1438 44 2 1 7 4
+ 216 36 119 268
+ 1439 44 2 1 7 4
+ 224 38 143 295
+ 1440 44 2 1 7 4
+ 295 143 279 383
+ 1441 44 2 1 7 4
+ 383 279 337 443
+ 1442 44 2 1 7 4
+ 443 337 338 444
+ 1443 44 2 1 7 4
+ 444 338 272 372
+ 1444 44 2 1 7 4
+ 372 272 136 290
+ 1445 44 2 1 7 4
+ 233 40 141 293
+ 1446 44 2 1 7 4
+ 293 141 275 381
+ 1447 44 2 1 7 4
+ 381 275 333 441
+ 1448 44 2 1 7 4
+ 441 333 334 442
+ 1449 44 2 1 7 4
+ 442 334 274 375
+ 1450 44 2 1 7 4
+ 375 274 138 291
+ 1456 44 2 1 7 4
+ 440 351 349 352
+ 1457 44 2 1 7 4
+ 185 168 174 175
+ 1458 44 2 1 7 4
+ 98 48 27 79
+ 1464 44 2 1 7 4
+ 458 436 351 440
+ 1465 44 2 1 7 4
+ 319 278 168 185
+ 1471 44 2 1 7 4
+ 451 440 352 358
+ 1472 44 2 1 7 4
+ 312 185 175 176
+ 1478 44 2 1 7 4
+ 358 352 347 348
+ 1479 44 2 1 7 4
+ 176 175 166 165
+ 1480 44 2 1 7 4
+ 80 79 53 54
+ 1486 44 2 1 7 4
+ 439 358 348 357
+ 1487 44 2 1 7 4
+ 289 176 165 177
+ 1488 44 2 1 7 4
+ 81 80 54 55
+ 1494 44 2 1 7 4
+ 371 439 357 359
+ 1495 44 2 1 7 4
+ 196 289 177 178
+ 1496 44 2 1 7 4
+ 82 81 55 56
+ 1502 44 2 1 7 4
+ 373 371 359 360
+ 1503 44 2 1 7 4
+ 201 196 178 179
+ 1504 44 2 1 7 4
+ 83 82 56 57
+ 1510 44 2 1 7 4
+ 379 373 360 369
+ 1511 44 2 1 7 4
+ 207 201 179 200
+ 1512 44 2 1 7 4
+ 84 83 57 58
+ 1518 44 2 1 7 4
+ 468 379 369 377
+ 1519 44 2 1 7 4
+ 307 207 200 205
+ 1520 44 2 1 7 4
+ 93 84 58 59
+ 1526 44 2 1 7 4
+ 494 468 377 382
+ 1527 44 2 1 7 4
+ 322 307 205 208
+ 1528 44 2 1 7 4
+ 97 93 59 60
+ 1534 44 2 1 7 4
+ 496 388 379 468
+ 1535 44 2 1 7 4
+ 323 212 207 307
+ 1536 44 2 1 7 4
+ 96 85 84 93
+ 1542 44 2 1 7 4
+ 501 397 388 496
+ 1543 44 2 1 7 4
+ 332 222 212 323
+ 1544 44 2 1 7 4
+ 95 86 85 96
+ 1550 44 2 1 7 4
+ 396 500 494 392
+ 1551 44 2 1 7 4
+ 214 331 322 213
+ 1552 44 2 1 7 4
+ 62 94 97 61
+ 1558 44 2 1 7 4
+ 400 397 501 500
+ 1559 44 2 1 7 4
+ 219 222 332 331
+ 1560 44 2 1 7 4
+ 63 86 95 94
+ 1566 44 2 1 7 4
+ 402 403 397 400
+ 1567 44 2 1 7 4
+ 220 221 222 219
+ 1568 44 2 1 7 4
+ 64 87 86 63
+ 1574 44 2 1 7 4
+ 406 407 403 402
+ 1575 44 2 1 7 4
+ 229 232 221 220
+ 1576 44 2 1 7 4
+ 65 88 87 64
+ 1582 44 2 1 7 4
+ 412 413 407 406
+ 1583 44 2 1 7 4
+ 230 231 232 229
+ 1584 44 2 1 7 4
+ 66 89 88 65
+ 1590 44 2 1 7 4
+ 414 420 413 412
+ 1591 44 2 1 7 4
+ 234 259 231 230
+ 1592 44 2 1 7 4
+ 67 90 89 66
+ 1598 44 2 1 7 4
+ 415 447 420 414
+ 1599 44 2 1 7 4
+ 235 267 259 234
+ 1600 44 2 1 7 4
+ 68 91 90 67
+ 1606 44 2 1 7 4
+ 416 430 447 415
+ 1607 44 2 1 7 4
+ 236 256 267 235
+ 1608 44 2 1 7 4
+ 69 92 91 68
+ 1614 44 2 1 7 4
+ 419 429 430 416
+ 1615 44 2 1 7 4
+ 237 255 256 236
+ 1616 44 2 1 7 4
+ 70 78 92 69
+ 1622 44 2 1 7 4
+ 429 432 511 430
+ 1623 44 2 1 7 4
+ 255 254 303 256
+ 1624 44 2 1 7 4
+ 78 77 156 92
+ 1630 44 2 1 7 4
+ 432 433 551 511
+ 1631 44 2 1 7 4
+ 254 253 324 303
+ 1632 44 2 1 7 4
+ 77 76 155 156
+ 1638 44 2 1 7 4
+ 433 435 552 551
+ 1639 44 2 1 7 4
+ 253 252 329 324
+ 1640 44 2 1 7 4
+ 76 75 154 155
+ 1646 44 2 1 7 4
+ 435 434 553 552
+ 1647 44 2 1 7 4
+ 252 251 330 329
+ 1648 44 2 1 7 4
+ 75 74 153 154
+ 1654 44 2 1 7 4
+ 434 431 549 553
+ 1655 44 2 1 7 4
+ 251 250 321 330
+ 1656 44 2 1 7 4
+ 74 73 152 153
+ 1662 44 2 1 7 4
+ 431 428 464 549
+ 1663 44 2 1 7 4
+ 250 247 193 321
+ 1664 44 2 1 7 4
+ 73 72 118 152
+ 1670 44 2 1 7 4
+ 428 427 448 464
+ 1671 44 2 1 7 4
+ 247 246 339 193
+ 1672 44 2 1 7 4
+ 72 71 28 118
+ 1673 44 2 1 7 4
+ 94 95 96 97
+ 1674 44 2 1 7 4
+ 114 117 83 84
+ 1675 44 2 1 7 4
+ 117 116 82 83
+ 1676 44 2 1 7 4
+ 116 115 81 82
+ 1677 44 2 1 7 4
+ 115 100 80 81
+ 1678 44 2 1 7 4
+ 100 98 79 80
+ 1679 44 2 1 7 4
+ 121 129 114 85
+ 1680 44 2 1 7 4
+ 129 139 117 114
+ 1681 44 2 1 7 4
+ 139 140 116 117
+ 1682 44 2 1 7 4
+ 140 134 115 116
+ 1683 44 2 1 7 4
+ 134 122 100 115
+ 1684 44 2 1 7 4
+ 122 99 98 100
+ 1685 44 2 1 7 4
+ 99 49 48 98
+ 1686 44 2 1 7 4
+ 87 132 121 86
+ 1687 44 2 1 7 4
+ 132 199 139 129
+ 1688 44 2 1 7 4
+ 199 198 140 139
+ 1689 44 2 1 7 4
+ 198 197 134 140
+ 1690 44 2 1 7 4
+ 197 127 122 134
+ 1691 44 2 1 7 4
+ 88 149 132 87
+ 1692 44 2 1 7 4
+ 149 287 199 132
+ 1693 44 2 1 7 4
+ 287 288 198 199
+ 1694 44 2 1 7 4
+ 288 280 197 198
+ 1695 44 2 1 7 4
+ 280 144 127 197
+ 1696 44 2 1 7 4
+ 89 148 149 88
+ 1697 44 2 1 7 4
+ 148 283 287 149
+ 1698 44 2 1 7 4
+ 283 284 288 287
+ 1699 44 2 1 7 4
+ 284 281 280 288
+ 1700 44 2 1 7 4
+ 281 145 144 280
+ 1701 44 2 1 7 4
+ 90 147 148 89
+ 1702 44 2 1 7 4
+ 147 285 283 148
+ 1703 44 2 1 7 4
+ 285 286 284 283
+ 1704 44 2 1 7 4
+ 286 282 281 284
+ 1705 44 2 1 7 4
+ 282 146 145 281
+ 1706 44 2 1 7 4
+ 91 128 147 90
+ 1707 44 2 1 7 4
+ 128 202 285 147
+ 1708 44 2 1 7 4
+ 202 203 286 285
+ 1709 44 2 1 7 4
+ 203 204 282 286
+ 1710 44 2 1 7 4
+ 204 130 146 282
+ 1711 44 2 1 7 4
+ 92 156 128 91
+ 1712 44 2 1 7 4
+ 156 155 202 128
+ 1713 44 2 1 7 4
+ 155 154 203 202
+ 1714 44 2 1 7 4
+ 154 153 204 203
+ 1715 44 2 1 7 4
+ 153 152 130 204
+ 1716 44 2 1 7 4
+ 270 121 129 300
+ 1717 44 2 1 7 4
+ 300 129 139 309
+ 1718 44 2 1 7 4
+ 309 139 140 310
+ 1719 44 2 1 7 4
+ 310 140 134 308
+ 1720 44 2 1 7 4
+ 308 134 122 271
+ 1721 44 2 1 7 4
+ 271 122 99 260
+ 1722 44 2 1 7 4
+ 222 86 121 270
+ 1723 44 2 1 7 4
+ 232 88 149 301
+ 1724 44 2 1 7 4
+ 301 149 287 386
+ 1725 44 2 1 7 4
+ 386 287 288 387
+ 1726 44 2 1 7 4
+ 387 288 280 385
+ 1727 44 2 1 7 4
+ 385 280 144 296
+ 1728 44 2 1 7 4
+ 259 90 147 299
+ 1729 44 2 1 7 4
+ 299 147 285 390
+ 1730 44 2 1 7 4
+ 390 285 286 391
+ 1731 44 2 1 7 4
+ 391 286 282 389
+ 1732 44 2 1 7 4
+ 389 282 146 298
+ 1733 44 2 1 7 4
+ 136 102 101 124
+ 1734 44 2 1 7 4
+ 137 103 102 136
+ 1735 44 2 1 7 4
+ 138 104 103 137
+ 1736 44 2 1 7 4
+ 124 101 49 120
+ 1737 44 2 1 7 4
+ 126 52 104 138
+ 1738 44 2 1 7 4
+ 157 28 52 126
+ 1739 44 2 1 7 4
+ 269 120 49 278
+ 1740 44 2 1 7 4
+ 290 136 102 261
+ 1741 44 2 1 7 4
+ 291 138 104 263
+ 1742 44 2 1 7 4
+ 278 49 99 260
+ 1743 44 2 1 7 4
+ 127 105 99 122
+ 1744 44 2 1 7 4
+ 105 101 49 99
+ 1745 44 2 1 7 4
+ 144 106 105 127
+ 1746 44 2 1 7 4
+ 106 102 101 105
+ 1747 44 2 1 7 4
+ 145 107 106 144
+ 1748 44 2 1 7 4
+ 107 103 102 106
+ 1749 44 2 1 7 4
+ 146 108 107 145
+ 1750 44 2 1 7 4
+ 108 104 103 107
+ 1751 44 2 1 7 4
+ 296 144 106 262
+ 1752 44 2 1 7 4
+ 262 106 102 261
+ 1753 44 2 1 7 4
+ 298 146 108 264
+ 1754 44 2 1 7 4
+ 264 108 104 263
+ 1755 44 2 1 7 4
+ 130 109 108 146
+ 1756 44 2 1 7 4
+ 109 52 104 108
+ 1757 44 2 1 7 4
+ 152 118 109 130
+ 1758 44 2 1 7 4
+ 118 28 52 109
+ 1759 44 2 1 7 4
+ 340 182 278 319
+ 1760 44 2 1 7 4
+ 342 261 182 340
+ 1761 44 2 1 7 4
+ 343 210 261 342
+ 1762 44 2 1 7 4
+ 341 263 210 343
+ 1763 44 2 1 7 4
+ 320 265 263 341
+ 1764 44 2 1 7 4
+ 193 339 265 320
+ 1765 44 2 1 7 4
+ 474 364 436 458
+ 1771 44 2 1 7 4
+ 489 374 364 474
+ 1777 44 2 1 7 4
+ 509 394 374 489
+ 1783 44 2 1 7 4
+ 513 401 394 509
+ 1789 44 2 1 7 4
+ 523 445 401 513
+ 1795 44 2 1 7 4
+ 464 448 445 523
+ 1801 44 2 1 7 4
+ 71 20 157 28
+ 1802 44 2 1 7 4
+ 246 245 294 339
+ 1803 44 2 1 7 4
+ 427 426 506 448
+ 1809 44 2 1 7 4
+ 34 33 6 7
+ 1815 41 2 1 7 3
+ 506 448 445
+ 1816 41 2 1 7 3
+ 294 339 265
+ 1822 41 2 1 7 3
+ 449 450 438
+ 1823 41 2 1 7 3
+ 304 305 180
+ 1829 41 2 1 7 3
+ 437 449 354
+ 1830 41 2 1 7 3
+ 277 304 172
+ 1836 41 2 1 7 3
+ 380 482 378
+ 1837 41 2 1 7 3
+ 206 325 195
+ 1838 41 2 1 7 3
+ 12 44 11
+ 1843 41 2 1 7 3
+ 370 481 368
+ 1844 41 2 1 7 3
+ 194 315 191
+ 1845 41 2 1 7 3
+ 10 47 9
+ 1846 41 2 1 7 3
+ 43 46 47
+ 1847 41 2 1 7 3
+ 35 110 34
+ 1849 41 2 1 7 3
+ 36 119 35
+ 1850 41 2 1 7 3
+ 131 123 119
+ 1851 41 2 1 7 3
+ 239 297 266
+ 1852 41 2 1 7 3
+ 418 502 446
+ 1863 41 2 1 7 3
+ 451 458 440
+ 1864 41 2 1 7 3
+ 312 319 185
+ 1870 41 2 1 7 3
+ 439 451 358
+ 1871 41 2 1 7 3
+ 289 312 176
+ 1877 41 2 1 7 3
+ 400 500 396
+ 1878 41 2 1 7 3
+ 219 331 214
+ 1879 41 2 1 7 3
+ 63 94 62
+ 1884 41 2 1 7 3
+ 392 494 382
+ 1885 41 2 1 7 3
+ 213 322 208
+ 1886 41 2 1 7 3
+ 61 97 60
+ 1887 41 2 1 7 3
+ 93 96 97
+ 1888 41 2 1 7 3
+ 85 114 84
+ 1890 41 2 1 7 3
+ 86 121 85
+ 1891 41 2 1 7 3
+ 132 129 121
+ 1892 41 2 1 7 3
+ 256 303 267
+ 1893 41 2 1 7 3
+ 430 511 447
+ 1899 41 2 1 7 3
+ 193 321 320
+ 1900 41 2 1 7 3
+ 464 549 523
+ -1
inc: $(top_builddir)/idl/salome $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
$(top_builddir)/idl/salome:
- mkdir $@
+ mkdir -p $@
$(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%)
# $(CP) $< $@
# install python client (generated from idl file
-install: install-pyidl install-idl
+install: $(top_builddir)/idl/salome install-pyidl install-idl
# create directory $(idldir) and copy idl files into it
install-idl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
\return the %tag of a %SObject.
*/
short Tag();
+/*! Gets the depth of a %SObject
+
+ \return the depth of a %SObject.
+*/
+ short Depth();
/*! Looks for subobjects of a given %SObject.
\param atag Tag of the given %SObject
Determines whether the server has already been loaded or not.
*/
void ping();
+/*!
+ Get Active study ID
+*/
+ long GetActiveStudyId();
} ;
} ;
--- /dev/null
+# make_config.in: template for make_config script
+# make_config is used by check_cas.m4 to generate
+# config.h file in case it cannot be found in OCC
+# and SALOME include paths
+#=================================================
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(salome_adm/unix)
+AC_CONFIG_SRCDIR(salome_adm/unix/config.h.in)
+AC_CONFIG_AUX_DIR(salome_adm/unix/config_files)
+AC_CANONICAL_HOST
+
+AC_CONFIG_HEADERS(./salome_adm/unix/config.h)
+
+AC_ISC_POSIX
+AC_C_BIGENDIAN
+
+dnl Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC_C_O
+
+AC_PROG_AWK
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_YACC
+AC_PROG_MAKE_SET
+
+dnl Replace `main' with a function in -le:
+AC_CHECK_LIB(e, main)
+
+dnl Replace `main' with a function in -links:
+AC_CHECK_LIB(inks, main)
+
+dnl Checks for X window system directories.
+AC_PATH_X
+if test "x$ac_x_includes" = "x"; then
+ X_INCLUDE=""
+else
+ X_INCLUDE="-I$ac_x_includes"
+fi
+if test "x$ac_x_libraries" = "x"; then
+ X_LIBS="-lXt -lX11"
+else
+ X_LIBS="-L$ac_x_libraries -lXt -lX11"
+fi
+
+dnl Checks for header files.
+
+AC_HEADER_STDC
+AC_LANG([C])
+AC_MSG_CHECKING([ for C header files ])
+AC_CHECK_HEADERS(dlfcn.h dl.h ieeefp.h time.h sys/time.h pwd.h)
+AC_CHECK_HEADERS(sys/statvfs.h sys/vfs.h sys/param.h osfcn.h netdb.h)
+AC_CHECK_HEADERS(sys/ioctl.h net/if.h sys/systeminfo.h sys/utsname.h)
+AC_CHECK_HEADERS(sysent.h unistd.h sys/unistd.h sys/socket.h)
+AC_CHECK_HEADERS(ndir.h sys/ndir.h sys/dir.h signal.h sys/signal.h)
+AC_CHECK_HEADERS(sigfpe.h floatingpoint.h sys/machsig.h sys/siginfo.h)
+AC_CHECK_HEADERS(malloc.h strings.h sys/stat.h sys/sem.h sys/ipc.h)
+AC_CHECK_HEADERS(sys/times.h dirent.h getopt.h sys/vnode.h)
+
+
+AC_LANG([C++])
+AC_MSG_CHECKING([ for C++ header files ])
+AC_CHECK_HEADERS(istream ostream istream fstream ios iomanip iostream )
+AC_CHECK_HEADERS(stream.h strstream.h istream.h ostream.h fstream.h stdlib.h ios.h iostream.h)
+AC_CHECK_HEADERS(iomanip.h limits.h values.h float.h)
+AC_CHECK_HEADERS(siginfo.h bits/sigset.h bstring.h sys/types.h sys/select.h)
+AC_CHECK_HEADERS(X11/extensions/transovl.h X11/extensions/readdisplay.h)
+AC_CHECK_HEADERS(X11/extensions/multibuf.h)
+AC_CHECK_HEADERS(sys/filio.h sys/mman.h libc.h)
+
+dnl Checks for library functions.
+AC_TYPE_SIGNAL
+
+AC_OUTPUT()
include/salome/SALOMEconfig.h:
+include/salome/config.h:
+
include/salome/sstream:
depend:
--- /dev/null
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* define if the compiler allows redefinition of stream input and output */
+#undef DEF_IOS_OK
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the <bits/sigset.h> header file. */
+#undef HAVE_BITS_SIGSET_H
+
+/* Define to 1 if you have the <bstring.h> header file. */
+#undef HAVE_BSTRING_H
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <dl.h> header file. */
+#undef HAVE_DL_H
+
+/* Define to 1 if you have the <DPS/dpsXclient.h> header file. */
+#undef HAVE_DPS_DPSXCLIENT_H
+
+/* Define if we have a function called "finite" in -lm. */
+#undef HAVE_FINITE
+
+/* Define to 1 if you have the <floatingpoint.h> header file. */
+#undef HAVE_FLOATINGPOINT_H
+
+/* Define to 1 if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
+
+/* Define to 1 if you have the <fstream> header file. */
+#undef HAVE_FSTREAM
+
+/* Define to 1 if you have the <fstream.h> header file. */
+#undef HAVE_FSTREAM_H
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+#undef HAVE_IEEEFP_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <iomanip> header file. */
+#undef HAVE_IOMANIP
+
+/* Define to 1 if you have the <iomanip.h> header file. */
+#undef HAVE_IOMANIP_H
+
+/* Define to 1 if you have the <ios> header file. */
+#undef HAVE_IOS
+
+/* Define to 1 if you have the <iostream> header file. */
+#undef HAVE_IOSTREAM
+
+/* Define to 1 if you have the <iostream.h> header file. */
+#undef HAVE_IOSTREAM_H
+
+/* Define to 1 if you have the <ios.h> header file. */
+#undef HAVE_IOS_H
+
+/* Define to 1 if you have the <istream> header file. */
+#undef HAVE_ISTREAM
+
+/* Define to 1 if you have the <istream.h> header file. */
+#undef HAVE_ISTREAM_H
+
+/* Define to 1 if you have the <libc.h> header file. */
+#undef HAVE_LIBC_H
+
+/* Define to 1 if you have the `e' library (-le). */
+#undef HAVE_LIBE
+
+/* Define to 1 if you have the `inks' library (-links). */
+#undef HAVE_LIBINKS
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define if we have a function called "mallinfo" in -lmalloc. */
+#undef HAVE_MALLINFO
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <ndir.h> header file. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the <net/if.h> header file. */
+#undef HAVE_NET_IF_H
+
+/* Define to 1 if you have the <osfcn.h> header file. */
+#undef HAVE_OSFCN_H
+
+/* Define to 1 if you have the <ostream> header file. */
+#undef HAVE_OSTREAM
+
+/* Define to 1 if you have the <ostream.h> header file. */
+#undef HAVE_OSTREAM_H
+
+/* Define to 1 if you have the `putenv' function. */
+#undef HAVE_PUTENV
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* Define to 1 if you have the `regcomp' function. */
+#undef HAVE_REGCOMP
+
+/* Define to 1 if you have the `re_comp' function. */
+#undef HAVE_RE_COMP
+
+/* Define to 1 if you have the <sigfpe.h> header file. */
+#undef HAVE_SIGFPE_H
+
+/* Define to 1 if you have the <siginfo.h> header file. */
+#undef HAVE_SIGINFO_H
+
+/* Define to 1 if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
+/* Define to 1 if you have the `statfs' function. */
+#undef HAVE_STATFS
+
+/* Define to 1 if you have the `statvfs' function. */
+#undef HAVE_STATVFS
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcspn' function. */
+#undef HAVE_STRCSPN
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the <stream.h> header file. */
+#undef HAVE_STREAM_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <strstream.h> header file. */
+#undef HAVE_STRSTREAM_H
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define if we have a function called "ieee_handler" in -lsunmath. */
+#undef HAVE_SUNMATH
+
+/* Define to 1 if you have the <sysent.h> header file. */
+#undef HAVE_SYSENT_H
+
+/* Define to 1 if you have the <sys/dir.h> header file. */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+#undef HAVE_SYS_FILIO_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#undef HAVE_SYS_IPC_H
+
+/* Define to 1 if you have the <sys/machsig.h> header file. */
+#undef HAVE_SYS_MACHSIG_H
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file. */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+#undef HAVE_SYS_SEM_H
+
+/* Define to 1 if you have the <sys/siginfo.h> header file. */
+#undef HAVE_SYS_SIGINFO_H
+
+/* Define to 1 if you have the <sys/signal.h> header file. */
+#undef HAVE_SYS_SIGNAL_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/statvfs.h> header file. */
+#undef HAVE_SYS_STATVFS_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/systeminfo.h> header file. */
+#undef HAVE_SYS_SYSTEMINFO_H
+
+/* Define to 1 if you have the <sys/times.h> header file. */
+#undef HAVE_SYS_TIMES_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/unistd.h> header file. */
+#undef HAVE_SYS_UNISTD_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <sys/vfs.h> header file. */
+#undef HAVE_SYS_VFS_H
+
+/* Define to 1 if you have the <sys/vnode.h> header file. */
+#undef HAVE_SYS_VNODE_H
+
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <values.h> header file. */
+#undef HAVE_VALUES_H
+
+/* Define to 1 if you have the <X11/extensions/multibuf.h> header file. */
+#undef HAVE_X11_EXTENSIONS_MULTIBUF_H
+
+/* Define to 1 if you have the <X11/extensions/readdisplay.h> header file. */
+#undef HAVE_X11_EXTENSIONS_READDISPLAY_H
+
+/* Define to 1 if you have the <X11/extensions/transovl.h> header file. */
+#undef HAVE_X11_EXTENSIONS_TRANSOVL_H
+
+/* Define to 1 if you have the <Xmu/Editres.h> header file. */
+#undef HAVE_XMU_EDITRES_H
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* define if the class ostream has member function form */
+#undef OSTREAM_FORM_OK
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define if compiler has function prototypes */
+#undef PROTOTYPES
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* define if the function semctl takes a value */
+#undef SEMCTL_NO_REFERENCE
+
+/* define if the function semop takes a value */
+#undef SEMOP_NO_REFERENCE
+
+/* define if semun has member __buf */
+#undef SEMUN_BUF_DEFINED
+
+/* define if the union semun is in sys/sem.h */
+#undef SEMUN_DEFINED
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Define to 1 if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
AC_SUBST(CAS_LDPATH)
+OWN_CONFIG_H=no
+
CAS_CPPFLAGS=""
CAS_CXXFLAGS=""
CAS_LDFLAGS=""
occ_ok=no
+own_config_h=no
+
dnl libraries directory location
case $host_os in
dnl cascade headers
CPPFLAGS_old="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -Wno-deprecated -DHAVE_WOK_CONFIG_H"
+ CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -I$KERNEL_ROOT_DIR/include/salome -Wno-deprecated -DHAVE_WOK_CONFIG_H"
CXXFLAGS_old="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -funsigned-char"
+
+ echo
+ echo
+ echo testing config.h
+ echo
+ echo
+
+ AC_CHECK_HEADER(config.h, own_config_h=no, [
+ echo
+ echo
+ echo "config.h file not found! Generating it..."
+ echo
+ echo
+ mv confdefs.h backup_confdefs.h
+ ${ROOT_SRCDIR}/make_config
+ rm -rf ${ROOT_BUILDDIR}/*.log
+ rm -rf ${ROOT_BUILDDIR}/*.status
+ mv backup_confdefs.h confdefs.h
+ rm -f backup_confdefs.h
+ own_config_h=yes
+ echo
+ echo
+ ])
+
+ if test "x$own_config_h" = xyes ; then
+ OWN_CONFIG_H=yes
+ fi
+
+ CPPFLAGS="$CPPFLAGS -I$ROOT_BUILDDIR/salome_adm/unix"
+
AC_CHECK_HEADER(Standard_Type.hxx,occ_ok=yes ,occ_ok=no)
CPPFLAGS="$CPPFLAGS_old"
CXXFLAGS="$CXXFLAGS_old"
fi
+AC_SUBST(OWN_CONFIG_H)
+
if test "x$occ_ok" = xyes ; then
CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -DHAVE_WOK_CONFIG_H"
AC_MSG_CHECKING(for OpenCascade libraries)
CPPFLAGS_old="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS -Wno-deprecated"
+ CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome -I$ROOT_BUILDDIR/salome_adm/unix -Wno-deprecated"
CXXFLAGS_old="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $CAS_CXXFLAGS"
LIBS_old="$LIBS"
if test "x$omniORB_ok" = "xyes"
then
- OMNIORB_IDLCXXFLAGS="-I$OMNIORB_ROOT/idl"
+ OMNIORB_IDLCXXFLAGS="-nf -I$OMNIORB_ROOT/idl"
OMNIORB_IDLPYFLAGS="-bpython -I$OMNIORB_ROOT/idl"
AC_SUBST(OMNIORB_IDLCXXFLAGS)
AC_SUBST(OMNIORB_IDLPYFLAGS)
if test "x$PYQTDIR" = x; then
PYQTDIR="/usr"
fi
-
+
if test "x$PYQT_SIPS" = x; then
PYQT_SIPS="/usr/share/sip/qt"
fi
PYQTBIN=$PYQTDIR
fi
-AC_CHECK_FILE("$PYQTBIN/pyuic",pyqt_ok=yes,pyqt_ok=no)
+if test "x$PYUIC" = x; then
+ PYUIC="$PYQTBIN/pyuic"
+fi
+
+AC_CHECK_FILE("$PYUIC",pyqt_ok=yes,pyqt_ok=no)
if test "x$pyqt_ok" = xyes ; then
AC_CHECK_FILES("$PYQTLIB/qt.py",pyqt_ok=yes,pyqt_ok=no)
esac],
enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl
+CXXFLAGS="$CXXFLAGS -Wno-deprecated -Wparentheses -Wreturn-type -Wmissing-declarations -Wunused "
+
+CXXVERSION=`$CXX --version`
+if test "X$CXXVERSION" != "X2.95.3"; then
+ CXXFLAGS="${CXXFLAGS} -fmessage-length=0 "
+fi
+
if test "X$enable_production" = "Xyes"; then
CFLAGS="$CFLAGS -O"
- CXXFLAGS="$CXXFLAGS -O -Wno-deprecated "
+ CXXFLAGS="$CXXFLAGS -O -Wuninitialized "
fi
])
if test "X$enable_debug" = "Xyes"; then
CFLAGS="$CFLAGS -g -D_DEBUG_ "
- CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ -Wno-deprecated "
+ CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ "
fi
])
# C++
CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
# BOOST Library
# PYQT
PYQT_SIPS = @PYQT_SIPS@
PYQT_LIBS = @PYQT_LIBS@
+PYQT_INCLUDES = @PYQT_INCLUDES@
+PYUIC = @PYUIC@
# openGL
OGL_INCLUDES=@OGL_INCLUDES@
# copy python scripts in $(top_builddir)/bin/salome
#
+
+UI_FILES = $(notdir $(wildcard $(srcdir)/*.ui))
+UI_PY_FILES_PY = $(patsubst %.ui, %.py, $(UI_FILES))
+UI_PY_FILES = $(filter-out $(EXPORT_PYSCRIPTS) ,$(UI_PY_FILES_PY))
+
DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
-pyscripts: $(DEST_PYSCRIPTS)
+DEST_UI_PY_FILES = $(UI_PY_FILES:%=$(top_builddir)/bin/salome/%)
+pyscripts: $(DEST_PYSCRIPTS) $(UI_PY_FILES) $(DEST_UI_PY_FILES)
$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
cp -f $< $@
+# generate generic python scripts from *.ui files
+#
+$(UI_PY_FILES): %.py: %.ui
+ $(PYUIC) $< -o $@
+
+# copy ui-generated python scripts in $(top_builddir)/bin
+#
+$(DEST_UI_PY_FILES): $(top_builddir)/bin/salome/%: %
+ cp -f $< $@
+
# copy pyqt files in $(PYTHON_SHARED_SITE)
#
PYTHON_SHARED_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
done
# Install python script in $(bindir)
-install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
+install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) $(UI_PY_FILES:%=install-%)
+
+$(UI_PY_FILES:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(bindir)/.
$(EXPORT_PYSCRIPTS:%=install-%): install-%: %
$(INSTALL_PROGRAM) $< $(bindir)/.
fi; \
done
+# Uninstall python script in $(bindir)
+ @for f in X $(UI_PY_FILES); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f ; \
+ fi; \
+ done
+
# Uninstall pyqt script in $(sharedpydir)
@for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
if test $$f != X; then \
--- /dev/null
+// KERNEL Utils : common utils for KERNEL
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+
+
+#include "CASCatch_SignalsHandler.h"
+#include <OSD.hxx>
+
+
+CASCatch_SignalsHandler::CASCatch_SignalsHandler(bool theFloatingSignal)
+{
+ OSD::SetSignal(theFloatingSignal);
+}
--- /dev/null
+// KERNEL Utils : common utils for KERNEL
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+
+#ifndef _CASCATCH_SIGNALSHANDLER_H_
+#define _CASCATCH_SIGNALSHANDLER_H_
+
+
+#include "Utils_SignalsHandler.h"
+#include <Standard_ErrorHandler.hxx>
+
+class CASCatch_SignalsHandler: private Utils_SignalsHandler{
+ public:
+ CASCatch_SignalsHandler(bool theFloatingSignal = true);
+};
+
+
+#endif
--- /dev/null
+# SALOME Utils : general SALOME's definitions and tools
+#
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Marc Tajchman (CEA)
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= CASCatch_SignalsHandler.h
+
+# Libraries targets
+LIB = libCASCatch.la
+LIB_SRC = CASCatch_SignalsHandler.cxx
+
+CPPFLAGS += $(OCC_INCLUDES)
+CXXFLAGS += $(OCC_CXXFLAGS)
+LDFLAGS+= $(CAS_KERNEL)
+
+@CONCLUDE@
+
+
// Get the PID of the Container
long Engines_Container_i::getPID() {
- return(_pid);
+ return (long)getpid();
}
// Get the hostName of the Container
# Executables targets
BIN = SALOME_Container
-BIN_SRC =
+BIN_SRC = SALOME_Container_SignalsHandler.cxx
BIN_SERVER_IDL = SALOME_Component.idl
-CPPFLAGS+= $(PYTHON_INCLUDES)
+CPPFLAGS+= $(PYTHON_INCLUDES) $(OCC_INCLUDES)
+CXXFLAGS+=$(OCC_CXXFLAGS)
LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace
-LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS)
+LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) -lCASCatch
@CONCLUDE@
long CpuUsed_impl() ;
protected:
- string _instanceName ;
- string _interfaceName ;
- string _serviceName ;
- string _graphName ;
- string _nodeName ;
+ std::string _instanceName ;
+ std::string _interfaceName ;
+ std::string _serviceName ;
+ std::string _graphName ;
+ std::string _nodeName ;
CORBA::ORB_ptr _orb;
PortableServer::POA_ptr _poa;
PortableServer::ObjectId * _id;
Engines_Component_i * _thisObj ;
RegistryConnexion *_myConnexionToRegistry;
NOTIFICATION_Supplier* _notifSupplier;
- map<std::string,CORBA::Any>_fieldsDict;
+ std::map<std::string,CORBA::Any>_fieldsDict;
private:
pthread_t _ThreadId ;
// Module : SALOME
// $Header$
+#include <iostream>
+#include <string>
#include <stdio.h>
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_Container_i.hxx"
-#include <iostream>
-#include <string>
#include "utilities.h"
-#include "Utils_CatchSignals.h"
-using namespace std;
#ifdef CHECKTIME
#include <Utils_Timer.hxx>
#include <Python.h>
-static PyMethodDef MethodPyVoidMethod[] =
- {
- { NULL, NULL }
- };
+extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
+
+using namespace std;
+
+static PyMethodDef MethodPyVoidMethod[] = {{ NULL, NULL }};
int main(int argc, char* argv[])
{
INFOS_COMPILATION;
- BEGIN_OF(argv[0])
-
- Py_Initialize() ;
+ BEGIN_OF(argv[0]);
+
+ Py_Initialize() ;
PySys_SetArgv( argc , argv ) ;
Py_InitModule( "InitPyRunMethod" , MethodPyVoidMethod ) ;
-
- try
- {
-
- // Initialise the ORB.
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
-
- // Obtain a reference to the root POA.
- // obtain the root poa manager
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var root_poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- int CONTAINER=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
-
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var pman;
- for (int i = 1; i<=NumberOfTries; i++)
- {
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try
- {
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- root_poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(root_poa))
- pman = root_poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);
- }
- catch( CORBA::COMM_FAILURE& )
- {
- MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+
+ try{
+ // Initialise the ORB.
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
+
+ // Obtain a reference to the root POA.
+ // obtain the root poa manager
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var root_poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ int CONTAINER=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if(Env != NULL && strlen(Env))
+ EnvL=1;
+
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var pman;
+ for(int i = 1; i <= NumberOfTries; i++){
+ if(i != 1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try{
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ root_poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(root_poa))
+ pman = root_poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ }catch(CORBA::COMM_FAILURE&){
+ MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ if(!CORBA::is_nil(inc)){
+ MESSAGE( "Container: Naming Service was found" );
+ if(EnvL == 1){
+ for(int j = 1; j <= NumberOfTries; j++){
+ if(j != 1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try{
+ object = inc->resolve(name);
+ }catch(CosNaming::NamingContext::NotFound){
+ MESSAGE( "Container: Logger Server wasn't found" );
+ }catch(...){
+ MESSAGE( "Container: Unknown exception" );
}
- if(!CORBA::is_nil(inc))
- {
- MESSAGE( "Container: Naming Service was found" );
- if(EnvL==1)
- {
- for(int j=1; j<=NumberOfTries; j++)
- {
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try
- {
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound)
- {
- MESSAGE( "Container: Logger Server wasn't found" );
- }
- catch(...)
- {
- MESSAGE( "Container: Unknown exception" );
- }
- if (!CORBA::is_nil(object))
- {
- MESSAGE( "Container: Logger Server was found" );
- CONTAINER=1;
- break;
- }
- }
- }
+ if(!CORBA::is_nil(object)){
+ MESSAGE( "Container: Logger Server was found" );
+ CONTAINER = 1;
+ break;
}
- if ((CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
- }
-
- // define policy objects
- PortableServer::ImplicitActivationPolicy_var implicitActivation =
- root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
-
- // default = NO_IMPLICIT_ACTIVATION
- PortableServer::ThreadPolicy_var threadPolicy =
- root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
- // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
-
- // create policy list
- CORBA::PolicyList policyList;
- policyList.length(2);
- policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
- policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
-
- // create the child POA
- PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
- PortableServer::POA_var factory_poa =
- root_poa->create_POA("factory_poa", pman, policyList) ;
- //with nil_mgr instead of pman, a new POA manager is created with the new POA
-
- // destroy policy objects
- implicitActivation->destroy() ;
- threadPolicy->destroy() ;
-
- char *containerName = "";
- if (argc >1)
- {
- containerName = argv[1] ;
+ }
}
+ }
+ if(CONTAINER == 1 || (EnvL == 0 && !CORBA::is_nil(inc)))
+ break;
+ }
- Engines_Container_i * myContainer
- = new Engines_Container_i(orb, factory_poa, containerName , argc , argv );
-
- // Engines_Container_i * myContainer
- // = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa);
-
- // use naming service
- // myContainer->_NS.init_orb(orb);
- // Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this());
- // myContainer->_NS.Register(pCont, argv[2]);
+ // define policy objects
+ PortableServer::ImplicitActivationPolicy_var implicitActivation =
+ root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
+
+ // default = NO_IMPLICIT_ACTIVATION
+ PortableServer::ThreadPolicy_var threadPolicy =
+ root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL);
+ // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
+
+ // create policy list
+ CORBA::PolicyList policyList;
+ policyList.length(2);
+ policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
+ policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
+
+ // create the child POA
+ PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
+ PortableServer::POA_var factory_poa =
+ root_poa->create_POA("factory_poa", pman, policyList) ;
+ //with nil_mgr instead of pman, a new POA manager is created with the new POA
+
+ // destroy policy objects
+ implicitActivation->destroy() ;
+ threadPolicy->destroy() ;
+
+ char *containerName = "";
+ if(argc > 1){
+ containerName = argv[1] ;
+ }
+
+ Engines_Container_i * myContainer
+ = new Engines_Container_i(orb, factory_poa, containerName , argc , argv );
+
+ // Engines_Container_i * myContainer
+ // = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa);
+
+ // use naming service
+ // myContainer->_NS.init_orb(orb);
+ // Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this());
+ // myContainer->_NS.Register(pCont, argv[2]);
+
+ pman->activate();
- pman->activate();
-
#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
- timer.ShowAbsolute();
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
#endif
- Utils_CatchSignals aCatch;
- aCatch.Activate();
-
- orb->run();
-
- aCatch.Deactivate();
- orb->destroy();
- }
- catch(CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.")
- }
- catch(PortableServer::POA::WrongPolicy&)
- {
- INFOS("Caught CORBA::WrongPolicyException.")
- }
- catch(PortableServer::POA::ServantAlreadyActive&)
- {
- INFOS("Caught CORBA::ServantAlreadyActiveException")
- }
- catch(CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.")
- }
- catch(...)
- {
- INFOS("Caught unknown exception.")
- }
+
+ HandleServerSideSignals(orb);
+
+ orb->destroy();
+ }catch(CORBA::SystemException&){
+ INFOS("Caught CORBA::SystemException.");
+ }catch(PortableServer::POA::WrongPolicy&){
+ INFOS("Caught CORBA::WrongPolicyException.");
+ }catch(PortableServer::POA::ServantAlreadyActive&){
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }catch(CORBA::Exception&){
+ INFOS("Caught CORBA::Exception.");
+ }catch(std::exception& exc){
+ INFOS("Caught std::exception - "<<exc.what());
+ }catch(...){
+ INFOS("Caught unknown exception.");
+ }
END_OF(argv[0]);
}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include <stdexcept>
+#include <CORBA.h>
+
+#include "CASCatch_SignalsHandler.h" // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+
+extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB)
+{
+ CASCatch_SignalsHandler aSignalsHandler;
+ try {
+ theORB->run();
+ }catch(Standard_Failure){
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ throw std::runtime_error(aFail->GetMessageString());
+ }
+}
#ifndef _SALOME_CONTAINER_I_HXX_
#define _SALOME_CONTAINER_I_HXX_
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Component)
+
#include <iostream>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOME_Component)
#include <omnithread.h>
#include <map>
#include <string>
class SALOME_NamingService;
-class Engines_Container_i: public POA_Engines::Container,
- public PortableServer::RefCountServantBase
+class Engines_Container_i: public virtual POA_Engines::Container,
+ public virtual PortableServer::RefCountServantBase
{
public:
Engines_Container_i();
// Module : SALOME
// $Header$
-using namespace std;
-#define WRITE_CATA_DATA_TYPE
#include "SALOME_DataTypeCatalog_Handler.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+// contains all the data types defined in the catalog
+ListOfParserDataType _datatypelist;
+
//----------------------------------------------------------------------
// Function : SALOME_DataTypeCatalog_Handler
// Purpose : Constructor
#ifndef SALOME_DATA_CATALOG_HANDLER_H
#define SALOME_DATA_CATALOG_HANDLER_H
-#include "utilities.h"
#include "SALOME_DataTypeCatalog_Parser.hxx"
#include <qxml.h>
#include <string>
private:
QString errorProt ;
- string content;
+ std::string content;
const char* test_data_type_name ;
const char* test_data_type_interf_read ;
#include <vector>
// Type Definitions
-typedef vector<string> ListOfParserDataTypeName;
+typedef std::vector<std::string> ListOfParserDataTypeName;
struct ParserDataType{
- string Parserdata_name ;
- string Parserdata_interface_read;
- string Parserdata_interface_write;
+ std::string Parserdata_name ;
+ std::string Parserdata_interface_read;
+ std::string Parserdata_interface_write;
ListOfParserDataTypeName Parserdata_parents ;
};
-typedef vector<ParserDataType> ListOfParserDataType;
+typedef std::vector<ParserDataType> ListOfParserDataType;
-#ifdef WRITE_CATA_DATA_TYPE
// contains all the data types defined in the catalog
-ListOfParserDataType _datatypelist;
-#else
extern ListOfParserDataType _datatypelist;
-#endif
+
#endif // SALOME_DATA_CATALOG_PARSER_H
#include <qsemaphore.h>
#include <qapplication.h>
#include <qthread.h>
+#include <pthread.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUG = 0;
#endif
+
+static pthread_t myThread;
+
+void SALOME_Event::GetSessionThread(){
+ myThread = pthread_self();
+}
+
+bool SALOME_Event::IsSessionThread(){
+ bool aResult = myThread == pthread_self();
+ if(MYDEBUG) INFOS("IsSessionThread() - "<<aResult);
+ return aResult;
+}
+
+
//===========================================================
/*!
* SALOME_Event::SALOME_Event
* Constructor
*/
//===========================================================
-SALOME_Event::SALOME_Event():
- myWait( true ),
- myAutoRelease( false )
-{
- if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this<<", myWait = "<<myWait );
- if ( myWait ) {
- // Prepare the semaphore
- mySemaphore = new QSemaphore( 2 );
- mySemaphore->operator+=( 2 );
- }
+SALOME_Event::SALOME_Event(){
+ if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this );
+ // Prepare the semaphore
+ mySemaphore = new QSemaphore( 2 );
+ *mySemaphore += 2;
}
//===========================================================
* Destructor
*/
//===========================================================
-SALOME_Event::~SALOME_Event()
-{
- if(MYDEBUG) MESSAGE( "SALOME_Event::~SALOME_Event(): this = "<<this<<", myWait = "<<myWait );
- if ( myWait ) {
- if ( mySemaphore->available() < mySemaphore->total() )
- mySemaphore->operator-=( mySemaphore->total() - mySemaphore->available() );
- delete mySemaphore;
- }
+SALOME_Event::~SALOME_Event(){
+ if(MYDEBUG) MESSAGE( "SALOME_Event::~SALOME_Event(): this = "<<this );
+ if ( mySemaphore->available() < mySemaphore->total() )
+ *mySemaphore -= mySemaphore->total() - mySemaphore->available();
+ delete mySemaphore;
}
//===========================================================
//===========================================================
void SALOME_Event::process()
{
- if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<", myWait = "<<myWait );
QThread::postEvent( qApp, new QCustomEvent( SALOME_EVENT, (void*)this ) );
- if ( myWait ) {
- if(MYDEBUG) MESSAGE( "SALOME_Event::process(): available = " << mySemaphore->available() );
- if ( !mySemaphore->available() )
- mySemaphore->operator+=( 1 );
-
- if(MYDEBUG) MESSAGE( "SALOME_Event::process() COMPLETED: this = "<<this<<", myWait = "<<myWait );
- }
- if ( myAutoRelease )
- release();
+ if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<", *mySemaphore += 1 " );
+ *mySemaphore += 1;
+ if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<" - COMPLETED" );
}
//===========================================================
//===========================================================
void SALOME_Event::processed()
{
- if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this<<", myWait = "<<myWait );
- if ( myWait ) {
- if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): available = " << mySemaphore->available() );
- if ( !mySemaphore->available() ) {
- // process() takes control over mySemaphore after the next line is executed
- mySemaphore->operator-=( 1 );
-
- if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): semaphore DECREMENTED" );
-
- // Current thread will block here until process() completes
- mySemaphore->operator+=( mySemaphore->total() );
- }
- }
- if(MYDEBUG) MESSAGE( "SALOME_Event::processed() COMPLETED: this = "<<this<<", myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this );
+ // process() takes control over mySemaphore after the next line is executed
+ *mySemaphore -= 1;
}
-
-//===========================================================
-/*!
- * SALOME_Event::release
- * Wakes up the desktop
- */
-//===========================================================
-void SALOME_Event::release()
-{
- if(MYDEBUG) MESSAGE( "SALOME_Event::release(): this = "<<this<<", myWait = "<<myWait );
- if ( myWait ) {
- if(MYDEBUG) MESSAGE( "SALOME_Event::release(): available = " << mySemaphore->available() );
- mySemaphore->operator-=( mySemaphore->total() - mySemaphore->available() );
- }
- if(MYDEBUG) MESSAGE( "SALOME_Event::release() COMPLETED: this = "<<this<<", myWait = "<<myWait );
-}
-
-
-
-
* no need to protect such fields with a mutex, for only one thread working with
* a SALOME_Event object is active at any moment.
*
- * It is possible to make the thread that creates SALOME_Event
- * wait until the event is processed by the component GUI, SALOME_Event
- * should be constructed with <wait> == TRUE in such a case.
- *
- * SALOME_Event objects should be created on the heap. QAD_Desktop deletes
- * these objects as soon as they have been processed.
- *
* Usage:
- * - create SALOME_Event object on the heap with proper <type> and <wait> parameters.
+ * - create SALOME_Event.
* Components can derive their own event class from SALOME_Event
* in order to pass custom data to the event handler.
- * - call process() method to post the event. Between process() and release()
+ * - call process() method to post the event. After process() execution
* it is possible to examine fields of your custom event object.
- * - call release() method to wake up the desktop (you can also set <autoRelease>
+ * - perform delete operator on the event to wake up the desktop (you can also set <autoRelease>
* parameter to TRUE to automatically wake up desktop after process()
*
* processed() method is used by the desktop to signal that event processing
* has been completed.
*
* Caveats:
- * 1. Never create SALOME_Event with <wait> == TRUE in code that is
- * supposed to be called within main GUI thread, for this will result
- * in GUI process deadlock.
- * 2. Always call release() method after process() if you use <wait> parameters as TRUE,
- * otherwise processed() method will never return and main GUI thread will be blocked!
- * 3. Never use pointers to the event after it has been released (either by calling release()
- * or automatically by process() if <autoRelease> == TRUE) to avoid application crashes!
+ * There is no.
*/
//===========================================================
-class SALOME_Event
-{
+class SALOME_Event{
public:
SALOME_Event();
virtual ~SALOME_Event();
// To do real work
virtual void Execute() = 0;
+ static bool IsSessionThread();
void process();
+
+protected:
void processed();
+ friend class QAD_Desktop;
- void release();
+ static void GetSessionThread();
+ friend int main(int, char **);
private:
- bool myWait;
- bool myAutoRelease;
QSemaphore* mySemaphore;
};
// Template function for processing events with result returing
template<class TEvent> inline typename TEvent::TResult ProcessEvent(TEvent* theEvent){
- theEvent->process();
- typename TEvent::TResult aResult = theEvent->myResult;
- theEvent->release();
+ typename TEvent::TResult aResult;
+ if(SALOME_Event::IsSessionThread()){
+ theEvent->Execute();
+ aResult = theEvent->myResult;
+ }else{
+ theEvent->process();
+ aResult = theEvent->myResult;
+ }
+ delete theEvent;
return aResult;
}
// Template function for processing events without result
inline void ProcessVoidEvent(SALOME_Event* theEvent){
- theEvent->process();
- theEvent->release();
+ if(SALOME_Event::IsSessionThread()){
+ theEvent->Execute();
+ }else{
+ theEvent->process();
+ }
+ delete theEvent;
}
#include "SALOME_GenericObj_i.hh"
#include "utilities.h"
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
using namespace SALOME;
+using namespace std;
GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){
- MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
- "; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
+ if(MYDEBUG)
+ MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
+ "; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
if(CORBA::is_nil(thePOA))
myPOA = PortableServer::RefCountServantBase::_default_POA();
else
PortableServer::POA_ptr GenericObj_i::_default_POA(){
- //return PortableServer::RefCountServantBase::_default_POA();
return PortableServer::POA::_duplicate(myPOA);
}
void GenericObj_i::Register(){
- MESSAGE("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter)
+ if(MYDEBUG)
+ MESSAGE("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter)
++myRefCounter;
}
void GenericObj_i::Destroy(){
- MESSAGE("GenericObj_i::Destroy "<<this<<"; myRefCounter = "<<myRefCounter)
+ if(MYDEBUG)
+ MESSAGE("GenericObj_i::Destroy "<<this<<"; myRefCounter = "<<myRefCounter)
if(--myRefCounter <= 0){
PortableServer::ObjectId_var anObjectId = myPOA->servant_to_id(this);
myPOA->deactivate_object(anObjectId.in());
return -1;
};
+
+ return length;
};
#include "HDFfile.hxx"
#include <string>
-using namespace std;
class HDFConvert
{
public:
-static int FromAscii(const string& file, const HDFcontainerObject& hdf_container, const string& nomdataset);
+static int FromAscii(const std::string& file, const HDFcontainerObject& hdf_container, const std::string& nomdataset);
};
/* Exception */
#include <iostream>
-using namespace std;
class HDFexception
{
public :
HDFexception(const char *message) {
- cerr << message << endl;
+ std::cerr << message << std::endl;
}
};
int InquireServersGUI::getExitStatus()
{
- myThread->getExitStatus();
+ return myThread->getExitStatus();
}
InquireServersQThread::InquireServersQThread( InquireServersGUI* r )
#if !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)
#define AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_
+#include <strstream.h>
+#include "Logger.hh"
+
//these declarations for files don't using OCC includes (for example HDF)
# ifdef WNT
# endif /* WNT */
-using namespace std;
-
-#include <strstream.h>
-#include "Logger.hh"
-
-class SALOME_Trace : public ostrstream
+class SALOME_Trace : public std::ostrstream
{
public:
virtual ~SALOME_Trace();
TWrapper aMedW(aFileName);
int aNbMeshes = aMed.GetNbMeshes();
- cout<<"GetNbMeshes() = "<<aNbMeshes<<endl;
+ MESSAGE("GetNbMeshes() = "<<aNbMeshes);
string aName;
for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
aMed.GetMeshInfo(iMesh+1,*aMeshInfo);
int aDim = aMeshInfo->myDim;
aName = aMeshInfo->GetName();
- cout<<"GetMeshInfo - aName = '"<<aName<<"'; aDim = "<<aDim<<endl;
+ MESSAGE("GetMeshInfo - aName = '"<<aName<<"'; aDim = "<<aDim);
*aNewMeshInfo = *aMeshInfo;
aName[0] += 1;
aNewMeshInfo->SetName(aName);
TEntityInfo aEntityInfo = aMed.GetEntityInfo(*aMeshInfo);
med_int aNbFields = aMed.GetNbFields();
- cout<<"GetNbFields() = "<<aNbFields<<endl;
+ MESSAGE("GetNbFields() = "<<aNbFields);
for(int iField = 0; iField < aNbFields; iField++){
med_int aNbComp = aMed.GetNbComp(iField+1);
PFieldInfo aFieldInfo(new TFieldInfo(aMeshInfo,aNbComp));
aMed.GetFieldInfo(iField+1,*aFieldInfo);
- cout<<"\taName = '"<<aFieldInfo->GetName()<<"'; aNbComp = "<<aNbComp<<"; ";
+ MESSAGE("\taName = '"<<aFieldInfo->GetName()<<"'; aNbComp = "<<aNbComp<<"; ");
aMedW.SetFieldInfo(*aFieldInfo);
med_entite_maillage anEntity;
TGeom aTGeom;
med_int aNbTimeStamps = aMed.GetNbTimeStamps(*aFieldInfo,aEntityInfo,
anEntity,aTGeom);
- cout<<"GetNbTimeStamps = "<<aNbTimeStamps<<endl;
+ MESSAGE("GetNbTimeStamps = "<<aNbTimeStamps);
PTimeStampInfo aTimeStampInfo(new TTimeStampInfo(aFieldInfo,anEntity,aTGeom));
for(int iTimeStamp = 0; iTimeStamp < aNbTimeStamps; iTimeStamp++){
aMed.GetTimeStampInfo(iTimeStamp+1, *aTimeStampInfo);
for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
med_geometrie_element aGeom = aMeshValueIter->first;
TValue aValue = aMeshValueIter->second;
- cout<<"\t\taGeom = "<<aGeom<<"; aValue = "<<aValue.size()<<": ";
+ MESSAGE("\t\taGeom = "<<aGeom<<"; aValue = "<<aValue.size()<<": ");
for(int i = 0, iEnd = aValue.size()/aNbComp; i < iEnd; i++){
for(int j = 0, ij = i*aNbComp; j < aNbComp; j++, ij++){
- //cout<<aValue[ij]<<",";
+ //MESSAGE(aValue[ij]<<",");
}
- //cout<<" ";
+ //MESSAGE(" ");
}
- cout<<"\n";
+ MESSAGE("\n");
}
}
}
int aNbFam = aMed.GetNbFamilies(*aMeshInfo);
- cout<<"GetNbFamilies() = "<<aNbFam<<endl;
+ MESSAGE("GetNbFamilies() = "<<aNbFam);
for(int iFam = 0; iFam < aNbFam; iFam++){
int aNbAttr = aMed.GetNbFamAttr(iFam+1,*aMeshInfo);
int aNbGroup = aMed.GetNbFamGroup(iFam+1,*aMeshInfo);
PFamilyInfo aFamilyInfo(new TFamilyInfo(aMeshInfo,aNbGroup,aNbAttr));
aMed.GetFamilyInfo(iFam+1,*aFamilyInfo);
aName = aFamilyInfo->GetName();
- cout<<"\taName = '"<<aName<<"'; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<endl;
+ MESSAGE("\taName = '"<<aName<<"'; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup);
aName[0] += 1;
aFamilyInfo->SetName(aName);
aFamilyInfo->myMeshInfo = aNewMeshInfo;
aName = aFamilyInfo->GetName();
for(int iGroup = 0; iGroup < aNbGroup; iGroup++){
aName = aFamilyInfo->GetGroupName(iGroup);
- cout<<"\t\taGroupName = '"<<aName<<"'\n";
+ MESSAGE("\t\taGroupName = '"<<aName<<"'");
aName[0] += 1;
aFamilyInfo->SetGroupName(iGroup,aName);
}
aMedW.SetFamilyInfo(*aFamilyInfo);
}
- cout<<"GetEntityInfo - aNbEntities = "<<aEntityInfo.size()<<endl;
+ MESSAGE("GetEntityInfo - aNbEntities = "<<aEntityInfo.size());
TEntityInfo::iterator anEntityInfoIter = aEntityInfo.begin();
for(; anEntityInfoIter != aEntityInfo.end(); anEntityInfoIter++){
const med_entite_maillage& anEntity = anEntityInfoIter->first;
- cout<<"\tanEntity = "<<anEntity<<endl;
+ MESSAGE("\tanEntity = "<<anEntity);
if(anEntity == MED_NOEUD){
int aNbNodes = aMed.GetNbNodes(*aMeshInfo);
PNodeInfo aNodeInfo(new TNodeInfo(aMeshInfo,aNbNodes));
aMed.GetNodeInfo(*aNodeInfo);
- cout<<"\tGetNodeInfo - aNbNodes = "<<aNbNodes<<": ";
+ MESSAGE("\tGetNodeInfo - aNbNodes = "<<aNbNodes<<": ");
TNodeCoord& aCoord = aNodeInfo->myCoord;
for(int iNode = 0; iNode < aNbNodes; iNode++){
for(int iDim = 0, anId = iNode*aDim; iDim < aDim; iDim++, anId++){
- //cout<<aCoord[anId]<<",";
+ //MESSAGE(aCoord[anId]<<",");
aCoord[anId] += 1.0;
}
- //cout<<" ";
+ //MESSAGE(" ");
}
- cout<<endl;
+ MESSAGE(endl);
aNodeInfo->myMeshInfo = aNewMeshInfo;
aMedW.SetNodeInfo(*aNodeInfo);
continue;
for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
const med_geometrie_element& aGeom = anTGeomIter->first;
med_int& aNbElem = anTGeomIter->second;
- cout<<"\t\taGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ";
+ MESSAGE("\t\taGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ");
PCellInfo aCellInfo(new TCellInfo(aMeshInfo,aNbElem,anEntity,aGeom));
aMed.GetCellInfo(*aCellInfo);
for(int iElem = 0; iElem < aCellInfo->myNbElem; iElem++){
int i = iElem*aCellInfo->myConnDim;
for(int iConn = 0; iConn < aCellInfo->myConnDim; iConn++, i++){
- //cout<<aCellInfo->myConn[i]<<",";
+ //MESSAGE(aCellInfo->myConn[i]<<",");
}
- //cout<<" ";
+ //MESSAGE(" ");
}
- cout<<endl;
+ MESSAGE(endl);
aCellInfo->myMeshInfo = aNewMeshInfo;
aMedW.SetCellInfo(*aCellInfo);
}
}
}
- cout<<"OK"<<endl;
+ MESSAGE("OK");
}
ReadMed(argv[1]);
return 0;
}catch(std::exception& exc){
- cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+ MESSAGE("Follow exception was accured :\n"<<exc.what());
}catch(...){
- cout<<"Unknown exception was accured in VISU_Convertor_impl"<<endl;
+ MESSAGE("Unknown exception was accured in VISU_Convertor_impl");
}
return 1;
}
--- /dev/null
+ THE Q PUBLIC LICENSE
+ version 1.0
+
+ Copyright (C) 1999-2000 Trolltech AS, Norway.
+ Everyone is permitted to copy and
+ distribute this license document.
+
+The intent of this license is to establish freedom to share and change the
+software regulated by this license under the open source model.
+
+This license applies to any software containing a notice placed by the
+copyright holder saying that it may be distributed under the terms of
+the Q Public License version 1.0. Such software is herein referred to as
+the Software. This license covers modification and distribution of the
+Software, use of third-party application programs based on the Software,
+and development of free software which uses the Software.
+
+ Granted Rights
+
+1. You are granted the non-exclusive rights set forth in this license
+ provided you agree to and comply with any and all conditions in this
+ license. Whole or partial distribution of the Software, or software
+ items that link with the Software, in any form signifies acceptance of
+ this license.
+
+2. You may copy and distribute the Software in unmodified form provided
+ that the entire package, including - but not restricted to - copyright,
+ trademark notices and disclaimers, as released by the initial developer
+ of the Software, is distributed.
+
+3. You may make modifications to the Software and distribute your
+ modifications, in a form that is separate from the Software, such as
+ patches. The following restrictions apply to modifications:
+
+ a. Modifications must not alter or remove any copyright notices in
+ the Software.
+
+ b. When modifications to the Software are released under this
+ license, a non-exclusive royalty-free right is granted to the
+ initial developer of the Software to distribute your modification
+ in future versions of the Software provided such versions remain
+ available under these terms in addition to any other license(s) of
+ the initial developer.
+
+4. You may distribute machine-executable forms of the Software or
+ machine-executable forms of modified versions of the Software, provided
+ that you meet these restrictions:
+
+ a. You must include this license document in the distribution.
+
+ b. You must ensure that all recipients of the machine-executable forms
+ are also able to receive the complete machine-readable source code
+ to the distributed Software, including all modifications, without
+ any charge beyond the costs of data transfer, and place prominent
+ notices in the distribution explaining this.
+
+ c. You must ensure that all modifications included in the
+ machine-executable forms are available under the terms of this
+ license.
+
+5. You may use the original or modified versions of the Software to
+ compile, link and run application programs legally developed by you
+ or by others.
+
+6. You may develop application programs, reusable components and other
+ software items that link with the original or modified versions of the
+ Software. These items, when distributed, are subject to the following
+ requirements:
+
+ a. You must ensure that all recipients of machine-executable forms of
+ these items are also able to receive and use the complete
+ machine-readable source code to the items without any charge
+ beyond the costs of data transfer.
+
+ b. You must explicitly license all recipients of your items to use
+ and re-distribute original and modified versions of the items in
+ both machine-executable and source code forms. The recipients must
+ be able to do so without any charges whatsoever, and they must be
+ able to re-distribute to anyone they choose.
+
+
+ c. If the items are not available to the general public, and the
+ initial developer of the Software requests a copy of the items,
+ then you must supply one.
+
+ Limitations of Liability
+
+In no event shall the initial developers or copyright holders be liable
+for any damages whatsoever, including - but not restricted to - lost
+revenue or profits or other direct, indirect, special, incidental or
+consequential damages, even if they have been advised of the possibility
+of such damages, except to the extent invariable law, if any, provides
+otherwise.
+
+ No Warranty
+
+The Software and this license document are provided AS IS with NO WARRANTY
+OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE.
+ Choice of Law
+
+This license is governed by the Laws of Norway. Disputes shall be settled
+by Oslo City Court.
--- /dev/null
+This package includes the msg2qm tool for resources compiling.
+It is a part of Qt 3.0.5 toolkit.
+The files in this package are distributed under conditions of the Q Public License.
\ No newline at end of file
-// SALOME MSG2QM : duplication of Qt tool
-//
-// 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 : msg2qm.cxx
-// Module : SALOME
+/////////////////////////////////////////////////////////////////////////////
+// Module : MSG2QM
+// File : msg2qm.cxx
+// Description : This is a duplication of Qt tool for resources compiling
+/////////////////////////////////////////////////////////////////////////////
-using namespace std;
/****************************************************************************
** $Id$
**
** Copyright (C) 1998 by Trolltech AS. All rights reserved.
**
*****************************************************************************/
+
+using namespace std;
#include <qfile.h>
#include <qtextstream.h>
#include <qtextcodec.h>
pos++;
pos++;
while ( pos < int(line.length()) && line[pos] != '\"' ) {
- if ( line[pos] == '\\') {
+ // 0xa5: the yen sign is the Japanese backslash
+ if ( line[pos] == '\\' || line[pos] == QChar(0xa5) ) {
pos++;
switch (char(line[pos]) ) {
case 'n':
@COMMENCE@
-SUBDIRS = MSG2QM SALOMELocalTrace Logger SALOMELogger Utils PatchQt \
+SUBDIRS = MSG2QM SALOMELocalTrace Logger Utils SALOMELogger CASCatch PatchQt \
GenericObj MEDWrapper NamingService Registry \
ModuleCatalog DataTypeCatalog RessourcesCatalog \
Notification NOTIFICATION_SWIG \
- Container TestContainer LifeCycleCORBA HDFPersist \
+ Container TestContainer LifeCycleCORBA HDFPersist Prs \
VTKFilter OBJECT \
TOOLSDS SALOMEDS Event \
SALOMEGUI Plot2d VTKViewer OCCViewer \
// Module : SALOME
// $Header$
-using namespace std;
#include "SALOME_ModuleCatalog_Acomponent_impl.hxx"
#include "Utils_ExceptHandlers.hxx"
UNEXPECT_CATCH(MC_NotFound, SALOME_ModuleCatalog::NotFound);
+#include "utilities.h"
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
//----------------------------------------------------------------------
// Function : SALOME_ModuleCatalog_AcomponentImpl
// Purpose : Constructor
SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl
(SALOME_ModuleCatalog::Component &C) : _Component(C)
{
- BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
+ if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
- END_OF("SALOME_ModuleCatalog_AcomponentImpl");
+ if(MYDEBUG) END_OF("SALOME_ModuleCatalog_AcomponentImpl");
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
SALOME_ModuleCatalog_AcomponentImpl::~SALOME_ModuleCatalog_AcomponentImpl()
{
- BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl");
+ if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl");
- END_OF("~SALOME_ModuleCatalog_AcomponentImpl");
+ if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_AcomponentImpl");
}
//----------------------------------------------------------------------
SALOME_ModuleCatalog::ListOfInterfaces*
SALOME_ModuleCatalog_AcomponentImpl::GetInterfaceList()
{
- BEGIN_OF("GetInterfaceList");
+ if(MYDEBUG) BEGIN_OF("GetInterfaceList");
SALOME_ModuleCatalog::ListOfInterfaces_var _list
= new SALOME_ModuleCatalog::ListOfInterfaces;
for (unsigned int ind = 0; ind < _length_interfaces; ind++)
{
_list[ind] = CORBA::string_dup(_Component.interfaces[ind].interfacename);
- MESSAGE("The component " << _Component.name
- << " contains " << _list[ind] << " as interface");
+ if(MYDEBUG) MESSAGE("The component " << _Component.name
+ << " contains " << _list[ind] << " as interface");
}
- END_OF("GetInterfaceList");
+ if(MYDEBUG) END_OF("GetInterfaceList");
return _list._retn();
}
SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename)
throw(SALOME_ModuleCatalog::NotFound)
{
- BEGIN_OF("GetInterface");
- SCRUTE(interfacename);
+ if(MYDEBUG) BEGIN_OF("GetInterface");
+ if(MYDEBUG) SCRUTE(interfacename);
SALOME_ModuleCatalog::DefinitionInterface *_interface =
new SALOME_ModuleCatalog::DefinitionInterface;
}
}
- SCRUTE(_find);
+ if(MYDEBUG) SCRUTE(_find);
if (!_find)
{
// The interface was not found, the exception should be thrown
message += " of the component ";
message += _Component.name;
message += " was not found";
- MESSAGE(message)
- throw SALOME_ModuleCatalog::NotFound(message.c_str());
+ if(MYDEBUG) MESSAGE(message);
+ throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- END_OF("GetInterface");
+ if(MYDEBUG) END_OF("GetInterface");
return _interface;
}
SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename)
throw(SALOME_ModuleCatalog::NotFound)
{
- BEGIN_OF("GetServiceList");
- SCRUTE(interfacename);
+ if(MYDEBUG) BEGIN_OF("GetServiceList");
+ if(MYDEBUG) SCRUTE(interfacename);
SALOME_ModuleCatalog::ListOfServices_var _list
= new SALOME_ModuleCatalog::ListOfServices;
for (unsigned int ind1 = 0; ind1 < _length_services ; ind1++)
{
_list[ind1] = CORBA::string_dup(I.interfaceservicelist[ind1].ServiceName);
- MESSAGE("The interface " << interfacename << " of the component "
- << _Component.name << " contains " << _list[ind1] << " as a service")
+ if(MYDEBUG) MESSAGE("The interface " << interfacename << " of the component "
+ << _Component.name << " contains " << _list[ind1] << " as a service")
}
}
}
message += " of the component ";
message += _Component.name;
message += " was not found";
- MESSAGE(message)
- throw SALOME_ModuleCatalog::NotFound(message.c_str());
+ if(MYDEBUG) MESSAGE(message);
+ throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- END_OF("GetServiceList");
+ if(MYDEBUG) END_OF("GetServiceList");
return _list._retn();
}
const char* servicename)
throw(SALOME_ModuleCatalog::NotFound)
{
- BEGIN_OF("GetService");
- SCRUTE(interfacename);
- SCRUTE(servicename);
+ if(MYDEBUG) BEGIN_OF("GetService");
+ if(MYDEBUG) SCRUTE(interfacename);
+ if(MYDEBUG) SCRUTE(servicename);
Unexpect aCatch( MC_NotFound );
SALOME_ModuleCatalog::Service *service = new SALOME_ModuleCatalog::Service;
// looking for the specified interface
for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++)
{
- SCRUTE(ind);
- SCRUTE(_Component.interfaces[ind].interfacename);
+ if(MYDEBUG) SCRUTE(ind);
+ if(MYDEBUG) SCRUTE(_Component.interfaces[ind].interfacename);
SALOME_ModuleCatalog::DefinitionInterface &I = _Component.interfaces[ind];
if (strcmp(interfacename, I.interfacename) == 0)
for (unsigned int ind1 = 0; ind1 < I.interfaceservicelist.length() ; ind1++)
{
SALOME_ModuleCatalog::Service &S = I.interfaceservicelist[ind1];
- SCRUTE(ind1);
- SCRUTE(S.ServiceName);
+ if(MYDEBUG) SCRUTE(ind1);
+ if(MYDEBUG) SCRUTE(S.ServiceName);
if (strcmp(servicename, S.ServiceName) == 0)
{
}
}
- SCRUTE(_find);
+ if(MYDEBUG) SCRUTE(_find);
if (!_find)
{
// The interface was not found, the exception should be thrown
message += " of the component ";
message += _Component.name;
message += " was not found";
- MESSAGE(message)
- throw SALOME_ModuleCatalog::NotFound(message.c_str());
+ if(MYDEBUG) MESSAGE(message);
+ throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- END_OF("GetService");
+ if(MYDEBUG) END_OF("GetService");
return service;
}
SALOME_ModuleCatalog_AcomponentImpl::GetDefaultService(const char* interfacename)
throw(SALOME_ModuleCatalog::NotFound)
{
- BEGIN_OF("GetDefaultService");
- SCRUTE(interfacename);
+ if(MYDEBUG) BEGIN_OF("GetDefaultService");
+ if(MYDEBUG) SCRUTE(interfacename);
Unexpect aCatch( MC_NotFound );
SALOME_ModuleCatalog::Service *_service = new SALOME_ModuleCatalog::Service;
message += " of the component ";
message += _Component.name;
message += " was not found";
- MESSAGE(message)
- throw SALOME_ModuleCatalog::NotFound(message.c_str());
+ if(MYDEBUG) MESSAGE(message);
+ throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- END_OF("GetDefaultService");
+ if(MYDEBUG) END_OF("GetDefaultService");
return _service;
}
SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename)
throw(SALOME_ModuleCatalog::NotFound)
{
- BEGIN_OF("GetPathPrefix");
- SCRUTE(machinename);
+ if(MYDEBUG) BEGIN_OF("GetPathPrefix");
+ if(MYDEBUG) SCRUTE(machinename);
Unexpect aCatch( MC_NotFound );
// Variables initialisation
}
}
- SCRUTE(_find);
+ if(MYDEBUG) SCRUTE(_find);
if (!_find)
{
// The computer was not found, the exception should be thrown
message += machinename;
message += " was not found in the catalog associated to the component ";
message += _Component.name;
- MESSAGE(message)
+ if(MYDEBUG) MESSAGE(message);
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- END_OF("GetPathPrefix");
+ if(MYDEBUG) END_OF("GetPathPrefix");
return _path;
}
// duplicate out DataStreamParameters
_length = S_in.ServiceoutDataStreamParameter.length();
- SCRUTE(_length);
+ if(MYDEBUG) SCRUTE(_length);
S_out.ServiceoutDataStreamParameter.length(_length);
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
// duplicate service list
unsigned int _length = I_in.interfaceservicelist.length();
- SCRUTE(_length);
+ if(MYDEBUG) SCRUTE(_length);
I_out.interfaceservicelist.length(_length);
for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
#ifndef ACOMPONENT_IMPL_H
#define ACOMPONENT_IMPL_H
-#include "utilities.h"
#include "SALOME_ModuleCatalog_Parser.hxx"
#include <SALOMEconfig.h>
// $Header$
#define WRITE_CATA_COMPONENT
+
#include "SALOME_ModuleCatalog_Handler.hxx"
#include "SALOME_ModuleCatalog_Parser_IO.hxx"
-using namespace std;
+#include "utilities.h"
+
#include <sstream>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
//----------------------------------------------------------------------
// Function : SALOME_ModuleCatalog_Handler
// Purpose : Constructor
//----------------------------------------------------------------------
SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
{
- BEGIN_OF("SALOME_ModuleCatalog_Handler");
+ if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler");
// XML Tags initialisation
// Used in the function endElement
test_component="component";
- END_OF("SALOME_ModuleCatalog_Handler");
+ if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler");
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler()
{
- BEGIN_OF("~SALOME_ModuleCatalog_Handler()")
- END_OF("~SALOME_ModuleCatalog_Handler()")
+ if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_Handler()")
+ if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()")
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
bool SALOME_ModuleCatalog_Handler::startDocument()
{
- MESSAGE("Begin parse document")
+ if(MYDEBUG) MESSAGE("Begin parse document");
// Empty the private elements
_pathList.resize(0);
_pathPrefix.listOfComputer.resize(0);
//tag test_inParameter_name
if ((qName.compare(test_inParameter_name)==0)) {
- SCRUTE(parent);
- SCRUTE(grandparent);
+ if(MYDEBUG) SCRUTE(parent);
+ if(MYDEBUG) SCRUTE(grandparent);
if (grandparent.compare(test_inDataStreamParameter_list) == 0)
_inDataStreamParam.name = content ;
else
{
if (parent.compare(test_inParameter_list)==0) {
- MESSAGE("add inParameter : " << _inParam.name);
+ if(MYDEBUG) MESSAGE("add inParameter : " << _inParam.name);
_inParamList.push_back(_inParam) ;
// Empty temporary structures
}
else if ((qName.compare(test_inDataStreamParameter)==0)) {
- MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name);
+ if(MYDEBUG) MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name);
_inDataStreamParamList.push_back(_inDataStreamParam) ;
// Empty temporary structures
//tag test_inParameter_list
if((qName.compare(test_inParameter_list)==0))
{
- SCRUTE(_inParamList.size());
+ if(MYDEBUG) SCRUTE(_inParamList.size());
_aService.inParameters = _inParamList;
_inParamList.resize(0);
return true;
//tag test_inDataStreamParameter_list
if((qName.compare(test_inDataStreamParameter_list)==0))
{
- SCRUTE(_inDataStreamParamList.size());
+ if(MYDEBUG) SCRUTE(_inDataStreamParamList.size());
_aService.inDataStreamParameters = _inDataStreamParamList;
_inDataStreamParamList.resize(0);
}
//tag test_outDataStreamParameter_list
if((qName.compare(test_outDataStreamParameter_list)==0))
{
- SCRUTE(_outDataStreamParamList.size());
+ if(MYDEBUG) SCRUTE(_outDataStreamParamList.size());
_aService.outDataStreamParameters = _outDataStreamParamList;
_outDataStreamParamList.resize(0);
return true;
}
+
// Parameter out
- SCRUTE(qName);
+ if(MYDEBUG) SCRUTE(qName);
// tag test_outParameter_type
if ((qName.compare(test_outParameter_type)==0)) {
//tag test_outDataStreamParameter_name
if ((qName.compare(test_outDataStreamParameter_name)==0)) {
- SCRUTE(grandparent);
- SCRUTE(test_outDataStreamParameter_list);
+ if(MYDEBUG) SCRUTE(grandparent);
+ if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list);
if (grandparent.compare(test_outDataStreamParameter_list) == 0)
_outDataStreamParam.name = content ;
else
{
if (parent.compare(test_outParameter_list)==0) {
- MESSAGE("add outParameter : " << _outParam.name);
+ if(MYDEBUG) MESSAGE("add outParameter : " << _outParam.name);
_outParamList.push_back(_outParam) ;
// Empty temporary structures
}
else if ((qName.compare(test_outDataStreamParameter)==0)) {
- MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name);
+ if(MYDEBUG) MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name);
_outDataStreamParamList.push_back(_outDataStreamParam) ;
// Empty temporary structures
//tag test_outParameter_list
if((qName.compare(test_outParameter_list)==0))
{
- SCRUTE(_outParamList.size());
+ if(MYDEBUG) SCRUTE(_outParamList.size());
_aService.outParameters = _outParamList;
_outParamList.resize(0);
return true;
{
// ofstream f("/tmp/logs/xxx.log", std::ofstream::app);
// f << "---------------------------------------------------------" << std::endl;
- BEGIN_OF("endDocument");
+ if(MYDEBUG) BEGIN_OF("endDocument");
//_pathlist
for (unsigned int ind = 0; ind < _pathList.size(); ind++)
{
- MESSAGE("Path :"<<_pathList[ind].path)
+ if(MYDEBUG) MESSAGE("Path :"<<_pathList[ind].path);
for (unsigned int i = 0; i < _pathList[ind].listOfComputer.size(); i++)
- MESSAGE("Computer name :" << _pathList[ind].listOfComputer[i])
+ if(MYDEBUG) MESSAGE("Computer name :" << _pathList[ind].listOfComputer[i]);
}
// _moduleList
-// SCRUTE(_moduleList.size());
+// if(MYDEBUG) SCRUTE(_moduleList.size());
// for (unsigned int ind = 0; ind < _moduleList.size(); ind++)
// {
// f << _moduleList[ind] << std::endl;
// }
- MESSAGE("Document parsed");
- END_OF("endDocument");
+ if(MYDEBUG) MESSAGE("Document parsed");
+ if(MYDEBUG) END_OF("endDocument");
return true;
}
#ifndef SALOME_CATALOG_HANDLER_H
#define SALOME_CATALOG_HANDLER_H
-#include "utilities.h"
#include "SALOME_ModuleCatalog_Parser.hxx"
#include <qxml.h>
#include <string>
private:
QString errorProt ;
- string content;
+ std::string content;
QString test_path_prefix_name ;
QString test_computer_name ;
#include "SALOME_ModuleCatalog_Parser_IO.hxx"
#include <string>
+#include <iostream>
#include "utilities.h"
+using namespace std;
+
std::ostream & operator<< (std::ostream & f, const ParserParameter & P)
{
f << " name : " << P.name << std::endl;
#include <qfileinfo.h>
using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
static const char* SEPARATOR = ":";
//----------------------------------------------------------------------
//----------------------------------------------------------------------
SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA::ORB_ptr orb) : _orb(orb)
{
- MESSAGE("Catalog creation");
+ if(MYDEBUG) MESSAGE("Catalog creation");
// Conversion rules for component types
ComponentTypeConvert[GEOM]
// Parse the arguments given at server run
if (!_parseArguments(argc, argv,&_general_path,&_personal_path))
- MESSAGE( "Error while argument parsing" );
+ if(MYDEBUG) MESSAGE( "Error while argument parsing" );
// Test existency of files
- if (_general_path == NULL)
- MESSAGE( "Error the general catalog should be indicated" )
- else
- {
- // Affect the _general_module_list and _general_path_list members
- // with the common catalog
-
- QStringList dirList
- = QStringList::split( SEPARATOR, _general_path,
- false ); // skip empty entries
-
- for ( int i = 0; i < dirList.count(); i++ ) {
- QFileInfo fileInfo( dirList[ i ] );
- if ( fileInfo.isFile() && fileInfo.exists() ) {
- _parse_xml_file(fileInfo.filePath(),
- _general_module_list,
- _general_path_list);
- }
+ if (_general_path == NULL){
+ if(MYDEBUG) MESSAGE( "Error the general catalog should be indicated" );
+ }else{
+ // Affect the _general_module_list and _general_path_list members
+ // with the common catalog
+
+ QStringList dirList
+ = QStringList::split( SEPARATOR, _general_path,
+ false ); // skip empty entries
+
+ for ( int i = 0; i < dirList.count(); i++ ) {
+ QFileInfo fileInfo( dirList[ i ] );
+ if ( fileInfo.isFile() && fileInfo.exists() ) {
+ _parse_xml_file(fileInfo.filePath(),
+ _general_module_list,
+ _general_path_list);
}
-
- // Verification of _general_path_list content
- if(!_verify_path_prefix(_general_path_list))
- MESSAGE( "Error while parsing the general path list, "
- "differents paths are associated to the same computer,"
- "the first one will be choosen")
- else
- MESSAGE("General path list OK");
+ }
- if(_personal_path != NULL)
- {
- // Initialize the _personal_module_list and
- // _personal_path_list members with the personal catalog files
- _parse_xml_file(_personal_path,
- _personal_module_list,
- _personal_path_list);
-
- // Verification of _general_path_list content
- if(!_verify_path_prefix(_personal_path_list))
- MESSAGE("Error while parsing the personal path list, "
- "differents paths are associated to the same computer, "
- "the first one will be choosen" )
- else
- MESSAGE("Personal path list OK");
- }
- else
- MESSAGE("No personal catalog indicated or error while "
- "opening the personal catalog");
+ // Verification of _general_path_list content
+ if(!_verify_path_prefix(_general_path_list)){
+ if(MYDEBUG) MESSAGE( "Error while parsing the general path list, "
+ "differents paths are associated to the same computer,"
+ "the first one will be choosen");
+ }else{
+ if(MYDEBUG) MESSAGE("General path list OK");
}
+
+ if(_personal_path != NULL){
+ // Initialize the _personal_module_list and
+ // _personal_path_list members with the personal catalog files
+ _parse_xml_file(_personal_path,
+ _personal_module_list,
+ _personal_path_list);
+
+ // Verification of _general_path_list content
+ if(!_verify_path_prefix(_personal_path_list)){
+ if(MYDEBUG) MESSAGE("Error while parsing the personal path list, "
+ "differents paths are associated to the same computer, "
+ "the first one will be choosen" );
+ }else {
+ if(MYDEBUG) MESSAGE("Personal path list OK");
+ }
+ }else
+ if(MYDEBUG) MESSAGE("No personal catalog indicated or error while "
+ "opening the personal catalog");
+ }
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl()
{
- MESSAGE("Catalog Destruction");
+ if(MYDEBUG) MESSAGE("Catalog Destruction");
}
//----------------------------------------------------------------------
char *
SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) {
- MESSAGE("Begin of GetPathPrefix")
+ if(MYDEBUG) MESSAGE("Begin of GetPathPrefix");
// Variables initialisation
char* _path = NULL;
bool _find = false ;
SALOME_ModuleCatalog::ListOfComponents*
SALOME_ModuleCatalogImpl::GetComponentList()
{
- MESSAGE("Begin of GetComponentList");
+ if(MYDEBUG) MESSAGE("Begin of GetComponentList");
SALOME_ModuleCatalog::ListOfComponents_var _list_components =
new SALOME_ModuleCatalog::ListOfComponents;
_list_components->length(_personal_module_list.size());
// All the components defined in the personal catalog are taken
- for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
- {
- _list_components[ind]=(_personal_module_list[ind].name).c_str();
- SCRUTE(_list_components[ind]) ;
- }
+ for(unsigned int ind=0; ind < _personal_module_list.size();ind++){
+ _list_components[ind]=(_personal_module_list[ind].name).c_str();
+ if(MYDEBUG) SCRUTE(_list_components[ind]) ;
+ }
int indice = _personal_module_list.size() ;
bool _find = false;
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
- for (unsigned int ind=0; ind < _general_module_list.size();ind++)
- {
- _find = false;
- for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
- {
- // searching if the component is already defined in
- // the personal catalog
- if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
- _find = true;
- }
- if (!_find)
- {
- MESSAGE("A new component " << _general_module_list[ind].name
- << " has to be to added in the list");
- _list_components->length(indice+1);
- // The component is not already defined => has to be taken
- _list_components[indice]=(_general_module_list[ind].name).c_str();
- SCRUTE(_list_components[indice]) ;
-
- indice++;
- }
- else
- MESSAGE("The component " <<_general_module_list[ind].name
- << " was already defined in the personal catalog") ;
- }
-
- MESSAGE ( "End of GetComponentList" )
+ for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+ _find = false;
+ for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
+ // searching if the component is already defined in
+ // the personal catalog
+ if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
+ _find = true;
+ }
+ if(!_find){
+ if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name
+ << " has to be to added in the list");
+ _list_components->length(indice+1);
+ // The component is not already defined => has to be taken
+ _list_components[indice]=(_general_module_list[ind].name).c_str();
+ if(MYDEBUG) SCRUTE(_list_components[indice]) ;
+
+ indice++;
+ }else{
+ if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name
+ << " was already defined in the personal catalog") ;
+ }
+ }
+
+ if(MYDEBUG) MESSAGE ( "End of GetComponentList" );
return _list_components._retn();
}
SALOME_ModuleCatalog::ListOfIAPP_Affich*
SALOME_ModuleCatalogImpl::GetComponentIconeList()
{
- MESSAGE("Begin of GetComponentIconeList");
+ if(MYDEBUG) MESSAGE("Begin of GetComponentIconeList");
SALOME_ModuleCatalog::ListOfIAPP_Affich_var _list_components_icone =
new SALOME_ModuleCatalog::ListOfIAPP_Affich;
_list_components_icone->length(_personal_module_list.size());
// All the components defined in the personal catalog are taken
- for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
- {
- _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
- _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
- _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
- //SCRUTE(_list_components_icone[ind].modulename);
- //SCRUTE(_list_components_icone[ind].moduleicone);
- }
-
+ for(unsigned int ind=0; ind < _personal_module_list.size();ind++){
+ _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
+ _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
+ _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
+ //if(MYDEBUG) SCRUTE(_list_components_icone[ind].modulename);
+ //if(MYDEBUG) SCRUTE(_list_components_icone[ind].moduleicone);
+ }
+
int indice = _personal_module_list.size() ;
bool _find = false;
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
- for (unsigned int ind=0; ind < _general_module_list.size();ind++)
- {
- _find = false;
- for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
- {
- // searching if the component is aleready defined in
- // the personal catalog
- if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
- _find = true;
- }
- if (!_find)
- {
- // MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
- _list_components_icone->length(indice+1);
- // The component is not already defined => has to be taken
- _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();
- _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();
- _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str();
- //SCRUTE(_list_components_icone[indice].modulename) ;
- //SCRUTE(_list_components_icone[indice].moduleicone);
-
- indice++;
- }
- // else
- //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog");
- }
-
+ for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+ _find = false;
+ for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
+ // searching if the component is aleready defined in
+ // the personal catalog
+ if((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
+ _find = true;
+ }
+ if(!_find){
+ // if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+ _list_components_icone->length(indice+1);
+ // The component is not already defined => has to be taken
+ _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();
+ _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();
+ _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str();
+ //if(MYDEBUG) SCRUTE(_list_components_icone[indice].modulename) ;
+ //if(MYDEBUG) SCRUTE(_list_components_icone[indice].moduleicone);
+
+ indice++;
+ }
+ // else
+ //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog");
+ }
+
return _list_components_icone._retn() ;
}
SALOME_ModuleCatalog::ListOfComponents*
SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type)
{
- MESSAGE("Begin of GetTypedComponentList");
+ if(MYDEBUG) MESSAGE("Begin of GetTypedComponentList");
SALOME_ModuleCatalog::ListOfComponents_var _list_typed_component =
new SALOME_ModuleCatalog::ListOfComponents;
int _j = 0;
{
_list_typed_component->length(_j + 1);
_list_typed_component[_j] = (_moduleList[ind].name).c_str();
- //SCRUTE(_list_typed_component[_j])
+ //if(MYDEBUG) SCRUTE(_list_typed_component[_j]);
_j++;
}
}
}
if (!_find)
{
- //MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+ //if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
_list_typed_component->length(indice+1);
// The component is not already defined => has to be taken
_list_typed_component[indice]=(_general_module_list[ind].name).c_str();
- //SCRUTE(_list_typed_component[indice]) ;
+ //if(MYDEBUG) SCRUTE(_list_typed_component[indice]) ;
indice++;
}
//else
- //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
+ //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
}
}
else {
// Not found in the personal catalog and in the general catalog
// return NULL object
- MESSAGE("Component with name " << name
- << " not found in catalog");
+ if(MYDEBUG) MESSAGE("Component with name " << name
+ << " not found in catalog");
compo = NULL;
}
for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
if (name.compare(_personal_module_list[ind].name) == 0)
{
- MESSAGE("Component named " << name
- << " found in the personal catalog");
+ if(MYDEBUG) MESSAGE("Component named " << name
+ << " found in the personal catalog");
C_parser = &(_personal_module_list[ind]);
break;
}
{
if (name.compare(_general_module_list[ind].name) == 0)
{
- MESSAGE("Component named " << name
- << " found in the general catalog");
+ if(MYDEBUG) MESSAGE("Component named " << name
+ << " found in the general catalog");
C_parser = &(_general_module_list[ind]);
break;
}
ParserComponents& modulelist,
ParserPathPrefixes& pathList)
{
- BEGIN_OF("_parse_xml_file");
- SCRUTE(file);
+ if(MYDEBUG) BEGIN_OF("_parse_xml_file");
+ if(MYDEBUG) SCRUTE(file);
SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler();
QFile xmlFile(file);
// duplicate service list
unsigned int _length = I_parser.services.size();
- SCRUTE(_length);
+ if(MYDEBUG) SCRUTE(_length);
// I_corba.interfaceservicelist
// = new SALOME_ModuleCatalog::ListOfInterfaceService;
I_corba.interfaceservicelist.length(_length);
// duplicate out DataStreamParameters
_length = S_parser.outDataStreamParameters.size();
- SCRUTE(_length);
+ if(MYDEBUG) SCRUTE(_length);
S_corba.ServiceoutDataStreamParameter.length(_length);
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
// = (it_type == DataStreamTypeConvert.end())
// ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
- SCRUTE(P_parser.type);
+ if(MYDEBUG) SCRUTE(P_parser.type);
P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
for (it_type = DataStreamTypeConvert.begin();
it_type != DataStreamTypeConvert.end();
P_corba.Parametertype = it_type->second;
break;
}
- SCRUTE(P_corba.Parametertype);
+ if(MYDEBUG) SCRUTE(P_corba.Parametertype);
// duplicate parameter type
// = (it_type == DataStreamTypeConvert.end())
// ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
- SCRUTE(P_parser.dependency);
+ if(MYDEBUG) SCRUTE(P_parser.dependency);
P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
for (it_dep = DataStreamDepConvert.begin();
it_dep != DataStreamDepConvert.end();
break;
}
- SCRUTE(P_corba.Parameterdependency);
+ if(MYDEBUG) SCRUTE(P_corba.Parameterdependency);
}
//----------------------------------------------------------------------
{
if(_machine_list[ind].compare(_machine_list[ind1]) == 0)
{
- MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list")
+ if(MYDEBUG) MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list");
_return_value = false;
}
}
\param name string argument
\return pointer on a component, NULL if not found
*/
- ParserComponent *findComponent(const string & name);
+ ParserComponent *findComponent(const std::string & name);
//! method to create a CORBA component description from parser
/*!
// Module : SALOME
// $Header$
-using namespace std;
#include "SALOME_NamingService.hxx"
#include "ServiceUnreachable.hxx"
+
+#include "utilities.h"
+
#include <iostream>
#include <cstring>
+using namespace std;
+
//----------------------------------------------------------------------
/*! Function : SALOME_NamingService
* Purpose : Constructor and Initialisation of _root_context
//!method to get all the contexts contained in the current direcotry
// Get only objects, isn't iterative
- vector<string> list_directory()
+ std::vector<std::string> list_directory()
throw(ServiceUnreachable);
//! method to destroy an association Path-Object Reference
event->filterable_data[5].value >>= Anode;
event->filterable_data[6].value >>= Astamp;
event->remainder_of_body >>= Amessage;
- *graph = strdup(Agraph);
- *node = strdup(Anode);
- *type = strdup(Atype);
- *message = strdup(Amessage);
- *sender = strdup(Asender);
+ *graph = CORBA::string_dup(Agraph);
+ *node = CORBA::string_dup(Anode);
+ *type = CORBA::string_dup(Atype);
+ *message = CORBA::string_dup(Amessage);
+ *sender = CORBA::string_dup(Asender);
*counter = (long)Acounter;
- *date = strdup(Adate);
+ *date = CORBA::string_dup(Adate);
*stamp = (long)Astamp;
};
};
Handle_SALOME_AISShape.hxx \
SALOME_AISObject.hxx \
Handle_SALOME_AISObject.hxx \
- VTKViewer_Common.h
-
# Libraries targets
LIB_SRC = SALOME_InteractiveObject.cxx \
SALOME_Actor.cxx \
SALOME_AISShape.cxx\
- SALOME_AISObject.cxx
+ SALOME_AISObject.cxx\
LIB_CLIENT_IDL =
#endif
class SALOME_InteractiveObject;
class TopoDS_Shape;
+class TColStd_IndexedMapOfInteger;
class SALOME_AISShape : public AIS_Shape {
Standard_EXPORT virtual Standard_Boolean hasIO() = 0;
Standard_EXPORT virtual Standard_CString getName() = 0;
Standard_EXPORT virtual void setName(Standard_CString aName) = 0;
+Standard_EXPORT virtual void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ) = 0;
Standard_EXPORT ~SALOME_AISShape();
#include "utilities.h"
// VTK Includes
+#include <vtkCell.h>
+#include <vtkRenderer.h>
+#include <vtkPolyData.h>
#include <vtkObjectFactory.h>
#include <vtkDataSetMapper.h>
#include <vtkPolyDataMapper.h>
SALOME_Actor::SALOME_Actor(){
- PreviewProperty = NULL;
- ispreselected = Standard_False;
- myProperty = vtkProperty::New();
+ myIsHighlighted = myIsPreselected = false;
- myRepresentation = 2;
+ myRepresentation = 1;
+ myDisplayMode = myRepresentation - 1;
+
+ myProperty = vtkProperty::New();
+ PreviewProperty = NULL;
myIsInfinite = false;
+ myIsResolveCoincidentTopology = true;
+
+ vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+ myPolygonOffsetUnits);
myStoreMapping = false;
myGeomFilter = SALOME_GeometryFilter::New();
myTransformFilter->SetTransform(theTransform);
}
+
void SALOME_Actor::SetMapper(vtkMapper* theMapper){
+ InitPipeLine(theMapper);
+}
+
+void SALOME_Actor::InitPipeLine(vtkMapper* theMapper){
if(theMapper){
int anId = 0;
-#if defined __GNUC_2__
- myPassFilter[anId]->SetInput(theMapper->GetInput());
-#else
- myPassFilter.at(anId)->SetInput(theMapper->GetInput());
-#endif
- myGeomFilter->SetStoreMapping(myStoreMapping);
-#if defined __GNUC_2__
- myGeomFilter->SetInput(myPassFilter[anId]->GetOutput());
-#else
- myGeomFilter->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
-
- anId++;
-
-#if defined __GNUC_2__
- myPassFilter[anId]->SetInput(myGeomFilter->GetOutput());
- myPassFilter[anId+1]->SetInput(myPassFilter[anId]->GetOutput());
-#else
- myPassFilter.at(anId)->SetInput(myGeomFilter->GetOutput());
- myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
+ myPassFilter[ anId ]->SetInput( theMapper->GetInput() );
+ myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+ anId++; // 1
+ myGeomFilter->SetStoreMapping( myStoreMapping );
+ myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
- anId++;
-#if defined __GNUC_2__
- myPassFilter[anId+1]->SetInput(myPassFilter[anId]->GetOutput());
-#else
- myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
+ anId++; // 2
+ myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
+ myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
- anId++;
-#if defined __GNUC_2__
- myTransformFilter->SetInput(myPassFilter[anId]->GetPolyDataOutput());
-#else
- myTransformFilter->SetInput(myPassFilter.at(anId)->GetPolyDataOutput());
-#endif
+ anId++; // 3
+ myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
- anId++;
-#if defined __GNUC_2__
- myPassFilter[anId]->SetInput(myTransformFilter->GetOutput());
- myPassFilter[anId+1]->SetInput(myPassFilter[anId]->GetOutput());
-#else
- myPassFilter.at(anId)->SetInput(myTransformFilter->GetOutput());
- myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
+ anId++; // 4
+ myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
+ myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
- anId++;
- if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper))
-#if defined __GNUC_2__
+ anId++; // 5
+ if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper)){
aMapper->SetInput(myPassFilter[anId]->GetOutput());
-#else
- aMapper->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
- else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper))
-#if defined __GNUC_2__
+ }else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper)){
aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput());
-#else
- aMapper->SetInput(myPassFilter.at(anId)->GetPolyDataOutput());
-#endif
+ }
}
vtkLODActor::SetMapper(theMapper);
}
-vtkPolyData* SALOME_Actor::GetPolyDataInput(){
- return myPassFilter.back()->GetPolyDataOutput();
+
+void SALOME_Actor::Render(vtkRenderer *ren, vtkMapper* m){
+ if(myIsResolveCoincidentTopology){
+ int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
+ float aFactor, aUnit;
+ vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+
+ vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
+ vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+ myPolygonOffsetUnits);
+ vtkLODActor::Render(ren,m);
+
+ vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+ vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
+ }else{
+ vtkLODActor::Render(ren,m);
+ }
+}
+
+
+void SALOME_Actor::SetResolveCoincidentTopology(bool theIsResolve) {
+ myIsResolveCoincidentTopology = theIsResolve;
+}
+
+void SALOME_Actor::SetPolygonOffsetParameters(float factor, float units){
+ myPolygonOffsetFactor = factor;
+ myPolygonOffsetUnits = units;
+}
+
+void SALOME_Actor::GetPolygonOffsetParameters(float& factor, float& units){
+ factor = myPolygonOffsetFactor;
+ units = myPolygonOffsetUnits;
+}
+
+
+vtkDataSet* SALOME_Actor::GetInput(){
+ return myPassFilter.front()->GetOutput();
}
void SALOME_Actor::SetRepresentation(int theMode) {
switch(myRepresentation){
- case 0 :
- case 2 :
+ case VTK_POINTS :
+ case VTK_SURFACE :
myProperty->DeepCopy(GetProperty());
}
switch(theMode){
- case 0 :
- case 2 :
+ case VTK_POINTS :
+ case VTK_SURFACE :
GetProperty()->DeepCopy(myProperty);
break;
default:
- break;
GetProperty()->SetAmbient(1.0);
GetProperty()->SetDiffuse(0.0);
GetProperty()->SetSpecular(0.0);
myGeomFilter->SetInside(true);
GetProperty()->SetRepresentation(1);
break;
- case 0 :
+ case VTK_POINTS :
GetProperty()->SetPointSize(SALOME_POINT_SIZE);
default :
GetProperty()->SetRepresentation(theMode);
return myRepresentation;
}
+
+vtkCell* SALOME_Actor::GetElemCell(int theObjID){
+ return GetInput()->GetCell(theObjID);
+}
+
+
+float* SALOME_Actor::GetNodeCoord(int theObjID){
+ return GetInput()->GetPoint(theObjID);
+}
+
+
//=================================================================================
// function : GetObjDimension
// purpose : Return object dimension.
//=================================================================================
int SALOME_Actor::GetObjDimension( const int theObjId )
{
- if ( theObjId < 0 )
- return 0;
-
- std::vector<int> aVtkList = GetVtkId( theObjId );
- int nbVtk = aVtkList.size();
-
- if ( nbVtk == 0 )
- return 0;
- else if ( nbVtk > 1 )
- return 3;
- else // nbVtk = 1
- {
- if ( vtkDataSet* aGrid = GetMapper()->GetInput() )
- {
- if ( vtkCell* aCell = aGrid->GetCell( aVtkList.front() ) )
- return aCell->GetCellDimension();
- }
- }
+ if ( vtkCell* aCell = GetElemCell(theObjId) )
+ return aCell->GetCellDimension();
return 0;
}
+bool SALOME_Actor::IsInfinitive(){
+ return myIsInfinite;
+}
+void SALOME_Actor::SetOpacity(float theOpacity){
+ myOpacity = theOpacity;
+ GetProperty()->SetOpacity(theOpacity);
+}
+float SALOME_Actor::GetOpacity(){
+ return myOpacity;
+}
+void SALOME_Actor::SetColor(float r,float g,float b){
+ GetProperty()->SetColor(r,g,b);
+}
+void SALOME_Actor::GetColor(float& r,float& g,float& b){
+ float aColor[3];
+ GetProperty()->GetColor(aColor);
+ r = aColor[0];
+ g = aColor[1];
+ b = aColor[2];
+}
+int SALOME_Actor::getDisplayMode(){
+ return myDisplayMode;
+}
-
-
-
-
-
-
-
+void SALOME_Actor::setDisplayMode(int theMode){
+ SetRepresentation(theMode+1);
+ myDisplayMode = GetRepresentation() - 1;
+}
#ifndef SALOME_ACTOR_H
#define SALOME_ACTOR_H
-// SALOME Includes
-#include "VTKViewer_Common.h"
-#include "SALOME_InteractiveObject.hxx"
-
#include <vector>
+#include <vtkLODActor.h>
+#include <vtkProperty.h>
+
+class vtkCell;
+class vtkDataSet;
+class vtkPolyData;
+class vtkCamera;
+
+#include "SALOME_InteractiveObject.hxx"
+
class SALOME_Transform;
class SALOME_GeometryFilter;
class SALOME_TransformFilter;
extern int SALOME_POINT_SIZE;
class SALOME_Actor : public vtkLODActor{
- protected:
- //constructor should be protected due to first implementation of this class
- //it was abstract class
- SALOME_Actor();
- ~SALOME_Actor();
public:
static SALOME_Actor* New();
vtkTypeMacro(SALOME_Actor,vtkLODActor);
virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
- virtual Handle_SALOME_InteractiveObject getIO() { return myIO; }
+ virtual const Handle(SALOME_InteractiveObject)& getIO() { return myIO; }
virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
- virtual Standard_CString getName() { return myName; }
- virtual void setName(Standard_CString aName){
- myName = aName;
- if(hasIO()) myIO->setName(aName);
+ virtual const char* getName() { return myName.c_str(); }
+ virtual void setName(const char* theName){
+ if(hasIO()) myIO->setName(theName);
+ myName = theName;
}
- virtual int getDisplayMode() { return myDisplayMode; }
- virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
-
- virtual bool hasHighlight() { return false; }
- virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }
- virtual Standard_Boolean isHighlighted() { return ishighlighted; }
+ // To generate highlight automaticaly
+ virtual bool hasHighlight() { return false; }
+ virtual void highlight(bool theHighlight) { myIsHighlighted = theHighlight; }
+ virtual bool isHighlighted() { return myIsHighlighted; }
- virtual void SetOpacity(float opa) { m_opacity = opa; }
- virtual float GetOpacity() { return m_opacity; }
+ virtual void SetOpacity(float theOpacity);
+ virtual float GetOpacity();
- virtual void SetColor(float r,float g,float b) {};
- virtual void GetColor(float& r,float& g,float& b) {};
+ virtual void SetColor(float r,float g,float b);
+ virtual void GetColor(float& r,float& g,float& b);
+ void SetColor(const float theRGB[3]){
+ SetColor(theRGB[0],theRGB[1],theRGB[2]);
+ }
vtkSetObjectMacro(PreviewProperty,vtkProperty);
- virtual void SetPreSelected(Standard_Boolean presel = Standard_False) { ispreselected = presel; }
+ virtual void SetPreSelected(bool thePreselect = false) { myIsPreselected = thePreselect;}
+
// Used to obtain all dependent actors
virtual void GetChildActors(vtkActorCollection*) {};
virtual void AddToRender(vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
- typedef std::vector<int> TVectorId;
- virtual int GetObjId(int theVtkID) { return -1;}
- virtual TVectorId GetVtkId(int theObjID) { return TVectorId();}
+
+ // For selection mapping purpose
+ virtual int GetNodeObjId(int theVtkID) { return theVtkID;}
+ virtual float* GetNodeCoord(int theObjID);
+
+ virtual int GetElemObjId(int theVtkID) { return theVtkID;}
+ virtual vtkCell* GetElemCell(int theObjID);
virtual int GetObjDimension( const int theObjId );
virtual void SetMapper(vtkMapper* theMapper);
- virtual vtkPolyData* GetPolyDataInput();
+ virtual vtkDataSet* GetInput();
+
virtual void SetTransform(SALOME_Transform* theTransform);
virtual unsigned long int GetMTime();
virtual void SetRepresentation(int theMode);
virtual int GetRepresentation();
- // Infinitive means actor without size (point for example
+ virtual int getDisplayMode();
+ virtual void setDisplayMode(int theMode);
+
+ // Infinitive means actor without size (point for example),
// which is not taken into account in calculation of boundaries of the scene
- virtual bool IsInfinitive() { return myIsInfinite; }
+ void SetInfinitive(bool theIsInfinite) { myIsInfinite = theIsInfinite; }
+ virtual bool IsInfinitive();
+ void SetResolveCoincidentTopology(bool theIsResolve);
+ void SetPolygonOffsetParameters(float factor, float units);
+ void GetPolygonOffsetParameters(float& factor, float& units);
+
+ virtual void Render(vtkRenderer *, vtkMapper *);
+
+ virtual float GetShrinkFactor() { return 1.0;}
+
+ virtual bool IsShrunkable() { return false;}
+ virtual bool IsShrunk() { return false;}
+
+ virtual void SetShrink() {}
+ virtual void UnShrink() {}
+
+ virtual bool IsSetCamera() const { return false; }
+ virtual bool IsResizable() const { return false; }
+ virtual void SetSize( const float ) {}
+ virtual void SetCamera( vtkCamera* ) {}
+
protected:
- vtkProperty *PreviewProperty;
- Standard_Boolean ispreselected;
+ bool myIsResolveCoincidentTopology;
+ float myPolygonOffsetFactor;
+ float myPolygonOffsetUnits;
Handle(SALOME_InteractiveObject) myIO;
- Standard_CString myName;
+ std::string myName;
- float m_opacity;
- Standard_Boolean ishighlighted;
+ vtkProperty *PreviewProperty;
+ bool myIsPreselected;
+
+ float myOpacity;
+ bool myIsHighlighted;
int myDisplayMode;
bool myIsInfinite;
int myRepresentation;
vtkProperty *myProperty;
+
+ void InitPipeLine(vtkMapper* theMapper);
+
+ SALOME_Actor();
+ ~SALOME_Actor();
};
+
#endif // SALOME_ACTOR_H
+
myReference = "";
}
-SALOME_InteractiveObject::SALOME_InteractiveObject(const Standard_CString anEntry,
- const Standard_CString aComponentDataType,
- const Standard_CString aName)
-{
- myEntry = new char [strlen(anEntry)+1];
- strcpy( myEntry, anEntry);
-
- myName = new char [strlen(aName)+1];
- strcpy( myName, aName);
-
- myComponentDataType = new char [strlen(aComponentDataType)+1];
- strcpy( myComponentDataType, aComponentDataType);
-
- myReference = new char [strlen("")+1];
- strcpy( myReference, "");
-}
-
-void SALOME_InteractiveObject::setEntry(const Standard_CString anEntry){
- myEntry = new char [strlen(anEntry)+1];
- strcpy( myEntry, anEntry);
+SALOME_InteractiveObject::SALOME_InteractiveObject(const char* anEntry,
+ const char* aComponentDataType,
+ const char* aName):
+ myEntry(anEntry),
+ myName(aName),
+ myComponentDataType(aComponentDataType),
+ myReference("")
+{}
+
+void SALOME_InteractiveObject::setEntry(const char* anEntry){
+ myEntry = anEntry;
}
-Standard_CString SALOME_InteractiveObject::getEntry(){
- return myEntry;
+const char* SALOME_InteractiveObject::getEntry(){
+ return myEntry.c_str();
}
-void SALOME_InteractiveObject::setComponentDataType(const Standard_CString aComponentDataType){
- myComponentDataType = new char [strlen(aComponentDataType)+1];
- strcpy( myComponentDataType, aComponentDataType);
+void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType){
+ myComponentDataType = aComponentDataType;
}
-Standard_CString SALOME_InteractiveObject::getComponentDataType(){
- return myComponentDataType;
+const char* SALOME_InteractiveObject::getComponentDataType(){
+ return myComponentDataType.c_str();
}
-void SALOME_InteractiveObject::setName(const Standard_CString aName){
- myName = new char [strlen(aName)+1];
- strcpy( myName, aName);
+void SALOME_InteractiveObject::setName(const char* aName){
+ myName = aName;
}
-Standard_CString SALOME_InteractiveObject::getName(){
- return myName;
+const char* SALOME_InteractiveObject::getName(){
+ return myName.c_str();
}
Standard_Boolean SALOME_InteractiveObject::hasEntry(){
- return !( strcmp(myEntry, "" ) == 0 );
+ return myEntry != "";
}
Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
if ( anIO->hasEntry() && this->hasEntry() ) {
- if ( strcmp(myEntry, anIO->getEntry() ) == 0 )
+ if ( myEntry == anIO->getEntry() )
return Standard_True;
}
return Standard_False;
}
-Standard_Boolean SALOME_InteractiveObject::isComponentType(const Standard_CString ComponentDataType){
- if ( strcmp( myComponentDataType, ComponentDataType) == 0 )
+Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType){
+ if ( myComponentDataType == ComponentDataType )
return Standard_True;
else
return Standard_False;
Standard_Boolean SALOME_InteractiveObject::hasReference()
{
- return !( strcmp(myReference, "" ) == 0 );
+ return myReference != "";
}
-Standard_CString SALOME_InteractiveObject::getReference()
+const char* SALOME_InteractiveObject::getReference()
{
- return myReference;
+ return myReference.c_str();
}
-void SALOME_InteractiveObject::setReference(const Standard_CString aReference)
+void SALOME_InteractiveObject::setReference(const char* aReference)
{
- myReference = new char [strlen(aReference)+1];
- strcpy( myReference, aReference);
+ myReference = aReference;
}
#include <Standard_Boolean.hxx>
#endif
+#include <string>
class SALOME_InteractiveObject : public MMgt_TShared {
// Methods PUBLIC
//
Standard_EXPORT SALOME_InteractiveObject();
-Standard_EXPORT SALOME_InteractiveObject(const Standard_CString anEntry,
- const Standard_CString aComponentDataType,
- const Standard_CString aName = "");
-Standard_EXPORT void setEntry(const Standard_CString anEntry) ;
-Standard_EXPORT Standard_CString getEntry() ;
-Standard_EXPORT void setName(const Standard_CString aName) ;
-Standard_EXPORT Standard_CString getName() ;
+Standard_EXPORT SALOME_InteractiveObject(const char* anEntry,
+ const char* aComponentDataType,
+ const char* aName = "");
+Standard_EXPORT void setEntry(const char* anEntry) ;
+Standard_EXPORT const char* getEntry() ;
+Standard_EXPORT void setName(const char* aName) ;
+Standard_EXPORT const char* getName() ;
Standard_EXPORT Standard_Boolean hasEntry() ;
Standard_EXPORT virtual Standard_Boolean isSame(const Handle(SALOME_InteractiveObject)& anIO) ;
Standard_EXPORT Standard_Boolean hasReference() ;
-Standard_EXPORT Standard_CString getReference() ;
-Standard_EXPORT void setReference(const Standard_CString aReference) ;
+Standard_EXPORT const char* getReference() ;
+Standard_EXPORT void setReference(const char* aReference) ;
-Standard_EXPORT void setComponentDataType(const Standard_CString ComponentDataType) ;
-Standard_EXPORT Standard_CString getComponentDataType() ;
-Standard_EXPORT Standard_Boolean isComponentType(const Standard_CString ComponentDataType) ;
+Standard_EXPORT void setComponentDataType(const char* ComponentDataType) ;
+Standard_EXPORT const char* getComponentDataType() ;
+Standard_EXPORT Standard_Boolean isComponentType(const char* ComponentDataType) ;
+ //Standard_EXPORT Standard_Boolean isComponentType(std::string ComponentDataType) ;
+Standard_EXPORT virtual ~SALOME_InteractiveObject();
+
+// Must be defined for using by NCollection for ceratin of data map
+friend Standard_Boolean IsEqual(const Handle(SALOME_InteractiveObject)& anIO1,
+ const Handle(SALOME_InteractiveObject)& anIO2)
+{ return anIO1->isSame( anIO2 ); }
-Standard_EXPORT ~SALOME_InteractiveObject();
// Fields PROTECTED
//
-Standard_CString myReference;
-Standard_CString myEntry;
-Standard_CString myName;
-Standard_CString myComponentDataType;
+ std::string myReference;
+ std::string myEntry;
+ std::string myName;
+ std::string myComponentDataType;
private:
EXPORT_HEADERS = \
OCCViewer_AISSelector.h \
- OCCViewer_Selector.h \
OCCViewer_Viewer3d.h \
OCCViewer_ViewFrame.h \
OCCViewer_ViewPort.h \
OCCViewer_ViewPort3d.h \
- OCCViewer_VService.h
+ OCCViewer_VService.h \
+ OCCViewer_Prs.h
# Libraries targets
LIB = libOCCViewer.la
LIB_SRC = OCCViewer.cxx \
- OCCViewer_Selector.cxx \
OCCViewer_Viewer3d.cxx \
OCCViewer_ViewFrame.cxx \
OCCViewer_ViewPort.cxx \
OCCViewer_ViewPort3d.cxx \
OCCViewer_AISSelector.cxx \
- OCCViewer_VService.cxx
+ OCCViewer_VService.cxx \
+ OCCViewer_Prs.cxx
LIB_MOC = \
OCCViewer.h \
OCCViewer_AISSelector.h \
- OCCViewer_Selector.h \
OCCViewer_Viewer3d.h \
OCCViewer_ViewFrame.h \
OCCViewer_ViewPort.h \
- OCCViewer_ViewPort3d.h \
+ OCCViewer_ViewPort3d.h
LIB_CLIENT_IDL = SALOMEDS.idl \
SALOME_ModuleCatalog.idl \
CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) -lSalomeGUI
+LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) -lSalomePrs -lSalomeGUI
@CONCLUDE@
Constructor
*/
OCCViewer_AISSelector::OCCViewer_AISSelector( const Handle (AIS_InteractiveContext)& aisContext) :
-myAISContext ( aisContext )
+ myAISContext ( aisContext ),
+ myEnableSelection( true ),
+ myEnableMultipleSelection( true )
{
initialize();
}
QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
myHilightColor = Quantity_NOC_CYAN1;
- mySelectColor = Quantity_NOC_GRAY80;
+ mySelectColor = Quantity_NOC_WHITE;
myAISContext->SetHilightColor( myHilightColor );
myAISContext->SelectionColor( mySelectColor );
'selSelectionCancel'.
Returns 'true' if no error, 'false' otherwise.
*/
-bool OCCViewer_AISSelector::checkSelection ( AIS_StatusOfPick status, bool hadSelection, bool addTo )
+void OCCViewer_AISSelector::checkSelection ( int numSelBefore )
{
- myNumSelected = myAISContext->NbCurrents(); /* update after the last selection */
-
- if ( status == AIS_SOP_NothingSelected && !hadSelection ) {
- emit selSelectionCancel( addTo );
- }
- else if ( status == AIS_SOP_NothingSelected && hadSelection ) {
- emit selSelectionCancel( addTo ); /* unselected now */
- }
- else if ( status == AIS_SOP_OneSelected || status == AIS_SOP_SeveralSelected )
- {
- // if ( !hadSelection || status != AIS_SOP_SeveralSelected )
- // addTo = false;
- // MESSAGE (" AIS_StatusOfPick : " << AIS_SOP_OneSelected )
-
- emit selSelectionDone( addTo ); /* selected ( the same object, may be ) */
- }
- return ( status != AIS_SOP_Error && status != AIS_SOP_NothingSelected );
+ int numSelAfter = numSelected();
+ if ( numSelAfter < 1 && numSelBefore > 0 )
+ emit selSelectionCancel( false );
+ else if ( numSelAfter > 0 )
+ emit selSelectionDone( numSelAfter > 1 );
}
Detects the interactive objects at position (x,y).
Returns 'true' if no error, 'false' otherwise.
*/
-bool OCCViewer_AISSelector::moveTo ( int x, int y, const Handle (V3d_View)& view )
+void OCCViewer_AISSelector::moveTo ( int x, int y, const Handle (V3d_View)& view )
{
if ( !myEnableSelection )
- return false;
+ return;
QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- AIS_StatusOfDetection status = AIS_SOD_Error;
- status = myAISContext->MoveTo (x, y, view);
-
- return ( status != AIS_SOD_Error && status != AIS_SOD_AllBad );
+ myAISContext->MoveTo (x, y, view);
}
/*!
Selects the detected interactive objects.
Calls checkSelection() for checking the status.
*/
-bool OCCViewer_AISSelector::select ()
+void OCCViewer_AISSelector::select ()
{
if ( !myEnableSelection )
- return false;
+ return;
QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- bool hadSelection = ( myNumSelected > 0 );
+ int numBefore = numSelected();
- /* select and send notifications */
- return checkSelection ( myAISContext->Select(), hadSelection, false );
+ myAISContext->Select();
+
+ /* send notifications */
+ checkSelection ( numBefore );
}
/*!
Multiple selection must be enabled to get use of this function.
Calls checkSelection() for checking the status.
*/
-bool OCCViewer_AISSelector::select ( int left, int top, int right, int bottom,
+void OCCViewer_AISSelector::select ( int left, int top, int right, int bottom,
const Handle (V3d_View)& view )
{
if ( !myEnableSelection || !myEnableMultipleSelection )
- return false; /* selection with rectangle is considered as multiple selection */
+ return; /* selection with rectangle is considered as multiple selection */
QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- bool hadSelection = ( myNumSelected > 0 );
+ int numBefore = numSelected();
+
+ myAISContext->Select(left, top, right, bottom, view);
- /* select and send notifications */
- return checkSelection ( myAISContext->Select(left, top, right, bottom, view),
- hadSelection, false );
+ /* send notifications */
+ checkSelection ( numBefore );
}
/*!
Multiple selection must be enabled to get use of this function.
Calls checkSelection() for checking the status.
*/
-bool OCCViewer_AISSelector::shiftSelect ()
+void OCCViewer_AISSelector::shiftSelect ()
{
if ( !myEnableSelection )
- return false;
+ return;
QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- bool hadSelection = ( myNumSelected > 0 ); /* something was selected */
- if ( hadSelection && !myEnableMultipleSelection)
- return false;
+ int numBefore = numSelected();
+
+ if ( numBefore && !myEnableMultipleSelection)
+ myAISContext->Select();
+ else
+ myAISContext->ShiftSelect();
- /* select and send notifications */
- return checkSelection ( myAISContext->ShiftSelect(), hadSelection, true );
+ /* send notifications */
+ checkSelection ( numBefore );
}
/*!
Multiple selection must be enabled to get use of this function.
Calls checkSelection() for checking the status.
*/
-bool OCCViewer_AISSelector::shiftSelect ( int left, int top, int right, int bottom,
+void OCCViewer_AISSelector::shiftSelect ( int left, int top, int right, int bottom,
const Handle (V3d_View)& view )
{
if ( !myEnableSelection || !myEnableMultipleSelection )
- return false; /* selection with rectangle is considered as multiple selection */
+ return; /* selection with rectangle is considered as multiple selection */
QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- bool hadSelection = ( myNumSelected > 0 ); /* something was selected */
- if ( hadSelection && !myEnableMultipleSelection)
- return false;
+ int numBefore = numSelected();
+
+ myAISContext->ShiftSelect(left,top,right,bottom, view);
+
+ /* send notifications */
+ checkSelection ( numBefore );
+}
+
+/*!
+ Enables/disables selection
+*/
+void OCCViewer_AISSelector::enableSelection( bool bEnable )
+{
+ myEnableSelection = bEnable;
+}
+
+/*!
+ Enables/disables multiple selection i.e
+ selection of several objects at the same time.
+ If enabled, non-multiple selection is enabled as well.
+*/
+void OCCViewer_AISSelector::enableMultipleSelection( bool bEnable )
+{
+ myEnableMultipleSelection = bEnable;
+ if ( bEnable ) myEnableSelection = bEnable;
+}
+
+/*!
+ Returns the number of selected objects.
+*/
+int OCCViewer_AISSelector::numSelected() const
+{
+ if ( myAISContext.IsNull() )
+ return 0;
- /* select and send notifications */
- return checkSelection ( myAISContext->ShiftSelect(left,top,right,bottom, view),
- hadSelection, true );
+ if ( myAISContext->HasOpenedContext() )
+ return myAISContext->NbSelected();
+ return myAISContext->NbCurrents();
}
#define OCCViewer_AISSELECTOR_H
#include "QAD.h"
-#include "OCCViewer_Selector.h"
+
+// QT Include
+#include <qobject.h>
// Open CASCADE Includes
#include <Quantity_NameOfColor.hxx>
#include <AIS_InteractiveContext.hxx>
-class QAD_EXPORT OCCViewer_AISSelector : public OCCViewer_Selector
+class QAD_EXPORT OCCViewer_AISSelector : public QObject
{
Q_OBJECT
~OCCViewer_AISSelector();
public:
- bool moveTo ( int, int, const Handle (V3d_View)& );
- bool select ( int, int, int, int, const Handle (V3d_View)& );
- bool shiftSelect ( int, int, int, int, const Handle (V3d_View)& );
- bool select ();
- bool shiftSelect ();
+ void moveTo ( int, int, const Handle (V3d_View)& );
+ void select ( int, int, int, int, const Handle (V3d_View)& );
+ void shiftSelect ( int, int, int, int, const Handle (V3d_View)& );
+ void select ();
+ void shiftSelect ();
void setContext ( const Handle (AIS_InteractiveContext)& );
void setHilightColor ( Quantity_NameOfColor color );
void setSelectColor ( Quantity_NameOfColor color );
-protected:
- bool checkSelection ( AIS_StatusOfPick status, bool hadSelection, bool addTo );
+ void enableSelection( bool );
+ void enableMultipleSelection( bool );
+
+signals:
+ void selSelectionDone( bool bAdded );
+ void selSelectionCancel( bool bAdded );
protected:
+ void checkSelection ( int numBefore );
+ int numSelected() const;
+
+private:
Handle (AIS_InteractiveContext) myAISContext; // graphic context
Quantity_NameOfColor myHilightColor; // color for hilight object
Quantity_NameOfColor mySelectColor; // color for selected object
+ bool myEnableSelection;
+ bool myEnableMultipleSelection;
+
};
#endif
--- /dev/null
+// SALOME OCCViewer : build OCC Viewer into Salome desktop
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : OCCViewer_Prs.cxx
+// Author : Sergey ANIKIN
+// Module : SALOME
+// $Header$
+
+#include "OCCViewer_Prs.h"
+
+//==========================================================
+/*!
+ * OCCViewer_Prs::OCCViewer_Prs
+ * Default constructor
+ */
+//==========================================================
+OCCViewer_Prs::OCCViewer_Prs()
+{
+ myToActivate = true;
+}
+
+//==========================================================
+/*!
+ * OCCViewer_Prs::OCCViewer_Prs
+ * Standard constructor
+ */
+//==========================================================
+OCCViewer_Prs::OCCViewer_Prs( const Handle(AIS_InteractiveObject)& obj )
+{
+ AddObject( obj );
+}
+
+//==========================================================
+/*!
+ * OCCViewer_Prs::~OCCViewer_Prs
+ * Destructor
+ */
+//==========================================================
+OCCViewer_Prs::~OCCViewer_Prs()
+{
+ myObjects.Clear();
+}
+
+//==========================================================
+/*!
+ * OCCViewer_Prs::GetObjects
+ * Get interactive objects list
+ */
+//==========================================================
+void OCCViewer_Prs::GetObjects( AIS_ListOfInteractive& list ) const
+{
+ list = myObjects;
+}
+
+//==========================================================
+/*!
+ * OCCViewer_Prs::AddObject
+ * Add interactive object
+ */
+//==========================================================
+void OCCViewer_Prs::AddObject( const Handle(AIS_InteractiveObject)& obj )
+{
+ myObjects.Append( obj );
+}
+
+//==========================================================
+/*!
+ * OCCViewer_Prs::IsNull
+ * Return 0 if list of the interactive objects is empty
+ * [ Reimplemented from SALOME_Prs ]
+ */
+//==========================================================
+bool OCCViewer_Prs::IsNull() const
+{
+ return myObjects.IsEmpty();
+}
+
+//=================================================================
+/*!
+ * GEOM_Displayer::SetToActivate
+ * This method is used for activisation/deactivisation of
+ * objects in the moment of displaying
+*/
+//=================================================================
+void OCCViewer_Prs::SetToActivate( const bool toActivate )
+{
+ myToActivate = toActivate;
+}
+bool OCCViewer_Prs::ToActivate() const
+{
+ return myToActivate;
+}
--- /dev/null
+// SALOME OCCViewer : build OCC Viewer into Salome desktop
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : OCCViewer_Prs.h
+// Author : Sergey ANIKIN
+// Module : SALOME
+// $Header$
+
+#ifndef OCCVIEWER_PRS_H
+#define OCCVIEWER_PRS_H
+
+#include "SALOME_Prs.h"
+
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_ListOfInteractive.hxx>
+
+class OCCViewer_Prs : public SALOME_OCCPrs
+{
+public:
+ OCCViewer_Prs();
+ // Default constructor
+ OCCViewer_Prs( const Handle(AIS_InteractiveObject)& obj );
+ // Standard constructor
+ ~OCCViewer_Prs();
+ // Destructor
+
+ void GetObjects( AIS_ListOfInteractive& list ) const;
+ // Get interactive objects list
+ void AddObject( const Handle(AIS_InteractiveObject)& obj );
+ // Add interactive object
+
+ bool IsNull() const;
+ // Reimplemented from SALOME_Prs
+
+ /* This method is used for activisation/deactivisation of
+ objects in the moment of displaying */
+ void SetToActivate( const bool );
+ bool ToActivate() const;
+
+private:
+ AIS_ListOfInteractive myObjects; // list of interactive objects
+ bool myToActivate;
+};
+
+#endif
+
+
+
+
#include "OCCViewer_Viewer3d.h"
#include "OCCViewer_ViewPort.h"
#include "OCCViewer_ViewPort3d.h"
+#include "OCCViewer_Prs.h"
#include "QAD.h"
#include "QAD_Tools.h"
void OCCViewer_ViewFrame::onViewRight()
{
Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() ) view3d->SetProj (V3d_Yneg);
+ if ( !view3d.IsNull() )
+ view3d->SetProj( V3d_Ypos );
onViewFitAll();
}
void OCCViewer_ViewFrame::onViewLeft()
{
Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() ) view3d->SetProj (V3d_Ypos);
+ if ( !view3d.IsNull() )
+ view3d->SetProj( V3d_Yneg );
onViewFitAll();
}
myViewer->setPopupServer( App );
}
-void OCCViewer_ViewFrame::undo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry)
+void OCCViewer_ViewFrame::undo(QAD_Study* theStudy, const char* StudyFrameEntry)
{
+ SALOMEDS::Study_var aStudy = theStudy->getStudyDocument();
AIS_ListOfInteractive List1;
myViewer->getAISContext()->ObjectsInCollector(List1);
AIS_ListIteratorOfListOfInteractive ite1(List1);
- while (ite1.More()) {
- if (ite1.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite1.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->hasEntry() ) {
- if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry))
- myViewer->getAISContext()->Display(aSh);
- }
- }
+ for( ; ite1.More(); ite1.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite1.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() &&
+ anObj->hasEntry() &&
+ theStudy->isInViewer( anObj->getEntry(), StudyFrameEntry) )
+ {
+ myViewer->getAISContext()->Display( ite1.Value() );
}
- ite1.Next();
}
AIS_ListOfInteractive List;
myViewer->getAISContext()->DisplayedObjects(List);
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->hasEntry() ) {
- if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry ))
- myViewer->getAISContext()->Erase(aSh,true,true);
- }
- }
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() &&
+ anObj->hasEntry() &&
+ theStudy->isInViewer( anObj->getEntry(), StudyFrameEntry) )
+ {
+ myViewer->getAISContext()->Erase( ite.Value(), true, true );
}
- ite.Next();
}
}
-void OCCViewer_ViewFrame::redo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry)
+void OCCViewer_ViewFrame::redo(QAD_Study* theStudy, const char* StudyFrameEntry)
{
+ SALOMEDS::Study_var aStudy = theStudy->getStudyDocument();
SALOMEDS::SObject_var RefSO;
SALOMEDS::SObject_var SO = aStudy->FindObjectID( StudyFrameEntry );
SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
for (; it->More();it->Next()){
SALOMEDS::SObject_var CSO= it->Value();
- if (CSO->ReferencedObject(RefSO)) {
-
+ if (CSO->ReferencedObject(RefSO))
+ {
AIS_ListOfInteractive List;
myViewer->getAISContext()->ObjectsInCollector(List);
+
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->hasEntry() ) {
- if ( strcmp(IO->getEntry(),RefSO->GetID()) == 0 )
- myViewer->getAISContext()->Display(aSh, false);
- }
- }
- }
- ite.Next();
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), RefSO->GetID() ) == 0 )
+ myViewer->getAISContext()->Display( ite.Value(), false );
}
-
}
}
AIS_ListOfInteractive List1;
myViewer->getAISContext()->DisplayedObjects(List1);
AIS_ListIteratorOfListOfInteractive ite1(List1);
- while (ite1.More()) {
- if (ite1.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite1.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->hasEntry() ) {
- if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry ))
- myViewer->getAISContext()->Erase(aSh,false,true);
- }
- }
- }
- ite1.Next();
+ for ( ; ite1.More(); ite1.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite1.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && !theStudy->isInViewer( anObj->getEntry(), StudyFrameEntry ) )
+ myViewer->getAISContext()->Erase( ite1.Value(), false, true );
}
+
Repaint();
}
/* selection */
Handle(SALOME_InteractiveObject) OCCViewer_ViewFrame::FindIObject(const char* Entry)
{
- Handle(SALOME_InteractiveObject) IO;
Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
AIS_ListOfInteractive List;
List.Append(List1);
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh
- = Handle(SALOME_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() ) {
- IO = aSh->getIO();
- if ( IO->hasEntry() ) {
- if ( strcmp( IO->getEntry(), Entry ) == 0 ) {
- MESSAGE ( "IO found")
- return IO;
- }
- }
- }
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), Entry ) == 0 )
+ {
+ MESSAGE ( "IO found")
+ return anObj;
}
- ite.Next();
}
MESSAGE ( "IO not found")
- return IO;
+ return Handle(SALOME_InteractiveObject)();
}
/* display */
ic->ObjectsInCollector(List1);
List.Append(List1);
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh
- = Handle(SALOME_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) ) {
- ic->Display(aSh, false);
- // ic->AddOrRemoveCurrentObject(aSh, false); repeated in Viewer3d after next statement
- Sel->AddIObject(IO, false);
- break;
- }
- }
+ AIS_ListIteratorOfListOfInteractive ite( List );
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+ {
+ ic->Display( ite.Value(), false );
+ Sel->AddIObject( anObj, false );
+ break;
}
- ite.Next();
}
- if (update)
+
+ if ( update )
Repaint();
}
ic->ObjectsInCollector(List1);
List.Append(List1);
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh
- = Handle(SALOME_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( !IO->isSame( IObject ) ) {
- ic->Erase(aSh, false);
- Sel->RemoveIObject(IO, false);
- } else {
- ic->Display(aSh, false);
- Sel->AddIObject(IO, false);
- }
+ AIS_ListIteratorOfListOfInteractive ite( List );
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() )
+ {
+ if ( !anObj->isSame( IObject ) )
+ {
+ ic->Erase( ite.Value(), false );
+ Sel->RemoveIObject( anObj, false );
+ }
+ else
+ {
+ ic->Display( ite.Value(), false );
+ Sel->AddIObject( anObj, false );
}
}
- ite.Next();
}
+
Repaint();
}
void OCCViewer_ViewFrame::Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update)
AIS_ListOfInteractive List;
ic->DisplayedObjects(List);
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More())
+
+ AIS_ListIteratorOfListOfInteractive ite( List );
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() )
{
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape)))
- {
- Handle(SALOME_AISShape) aSh
- = Handle(SALOME_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() )
- {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) )
- {
- ic->Erase(aSh, false);
- Sel->RemoveIObject(IO, false);
- break;
- }
- }
- }
- ite.Next();
+ if ( anObj->isSame( IObject ) )
+ {
+ ic->Erase( ite.Value(), false );
+ Sel->RemoveIObject( anObj, false );
+ break;
+ }
}
- if (update)
+ }
+
+ if ( update )
Repaint();
}
myViewer->getViewer3d()->Update();
}
-void OCCViewer_ViewFrame::onAdjustTrihedron()
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::getTrihedronSize
+ * Get new an current trihedron size
+ */
+//==========================================================
+bool OCCViewer_ViewFrame::getTrihedronSize( double& theNewSize, double& theSize )
+{
+ theNewSize = 100;
+ theSize = 100;
+
+ Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
+
+ if ( view3d.IsNull() )
+ return false;
+
+ double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0;
+ double aMaxSide;
+ double aPercents;
+
+ view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
+
+ if ( Xmin == RealFirst() || Ymin == RealFirst() || Zmin == RealFirst() ||
+ Xmax == RealLast() || Ymax == RealLast() || Zmax == RealLast() )
+ return false;
+
+ aMaxSide = Xmax - Xmin;
+ if ( aMaxSide < Ymax -Ymin ) aMaxSide = Ymax -Ymin;
+ if ( aMaxSide < Zmax -Zmin ) aMaxSide = Zmax -Zmin;
+
+ static float aSizeInPercents = 105;
+ QString aSetting = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
+ if (!aSetting.isEmpty())
+ aSizeInPercents = aSetting.toFloat();
+
+ static float EPS = 5.0E-3;
+ theSize = myViewer->getTrihedron()->Size();
+ theNewSize = aMaxSide*aSizeInPercents / 100.0;
+
+ return fabs( theNewSize - theSize ) > theSize * EPS ||
+ fabs( theNewSize - theSize) > theNewSize * EPS;
+}
+
+void OCCViewer_ViewFrame::AdjustTrihedrons( const bool forced )
{
Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
-
- if (!ic->IsDisplayed(myViewer->getTrihedron()))
+
+ if ( !myViewer->isTrihedronDisplayed() )
return;
- else
+ else
+ {
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects(List);
+ if ( List.First() == List.Last() && List.First() == myViewer->getTrihedron() )
{
- AIS_ListOfInteractive List;
- ic->Erase( myViewer->getTrihedron() );
- ic->DisplayedObjects(List);
- ic->Display( myViewer->getTrihedron() );
- if (List.IsEmpty())
- {
- myViewer->setTrihedronSize(100);
- return;
+ myViewer->setTrihedronSize( 100 );
+ return;
+ }
+ }
+
+ double aNewSize = 100, aSize = 100;
+ if ( getTrihedronSize( aNewSize, aSize ) || forced )
+ myViewer->setTrihedronSize( aNewSize );
+}
+
+void OCCViewer_ViewFrame::onAdjustTrihedron()
+{
+ AdjustTrihedrons( false );
+}
+
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::Display
+ * Display presentation
+ */
+//==========================================================
+void OCCViewer_ViewFrame::Display( const SALOME_OCCPrs* prs )
+{
+ // try do downcast object
+ const OCCViewer_Prs* anOCCPrs = dynamic_cast<const OCCViewer_Prs*>( prs );
+ if ( !anOCCPrs || anOCCPrs->IsNull() )
+ return;
+
+ // get context
+ Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
+ // get all displayed objects
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects( List );
+ // get objects in he collector
+ AIS_ListOfInteractive ListCollector;
+ ic->ObjectsInCollector( ListCollector );
+
+ // get objects to be displayed
+ AIS_ListOfInteractive anAISObjects;
+ anOCCPrs->GetObjects( anAISObjects );
+
+ AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
+ for ( ; aIter.More(); aIter.Next() ) {
+ Handle(AIS_InteractiveObject) anAIS = aIter.Value();
+ if ( !anAIS.IsNull() ) {
+ // try to find presentation in the viewer
+ bool bDisplayed = false;
+ AIS_ListIteratorOfListOfInteractive ite( List );
+ while ( ite.More() ) {
+ // compare presentations by handles
+ // if the object is already displayed - nothing to do more
+ if ( ite.Value() == anAIS ) {
+
+ // Deactivate object if necessary
+ if ( !anOCCPrs->ToActivate() )
+ ic->Deactivate( anAIS );
+ bDisplayed = true;
+ break;
}
+ ite.Next();
+ }
+ if ( bDisplayed )
+ continue;
+ // then try to find presentation in the collector
+ bDisplayed = false;
+ ite.Initialize( ListCollector );
+ while ( ite.More() ) {
+ // compare presentations by handles
+ // if the object is in collector - display it
+ if ( ite.Value() == anAIS ) {
+ ic->DisplayFromCollector( anAIS, false );
+
+ // Deactivate object if necessary
+ if ( !anOCCPrs->ToActivate() )
+ ic->Deactivate( anAIS );
+ bDisplayed = true;
+ break;
+ }
+ ite.Next();
+ }
+ if ( bDisplayed )
+ continue;
+ // if object is not displayed and not found in the collector - display it
+ if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )
+ {
+ Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anAIS );
+ double aNewSize = 100, aSize = 100;
+ getTrihedronSize( aNewSize, aSize );
+ aTrh->SetSize( aTrh == myViewer->getTrihedron() ? aNewSize : 0.5 * aNewSize );
+ }
+
+ ic->Display( anAIS, false );
+
+ // Deactivate object if necessary
+ if ( !anOCCPrs->ToActivate() )
+ ic->Deactivate( anAIS );
+ }
+ }
+}
+
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::Erase
+ * Erase presentation
+ */
+//==========================================================
+void OCCViewer_ViewFrame::Erase( const SALOME_OCCPrs* prs, const bool forced )
+{
+ // try do downcast object
+ const OCCViewer_Prs* anOCCPrs = dynamic_cast<const OCCViewer_Prs*>( prs );
+ if ( !anOCCPrs || anOCCPrs->IsNull() )
+ return;
+
+ // get context
+ Handle(AIS_InteractiveContext) ic = myViewer->getAISContext();
+
+ // get objects to be erased
+ AIS_ListOfInteractive anAISObjects;
+ anOCCPrs->GetObjects( anAISObjects );
+
+ AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
+ for ( ; aIter.More(); aIter.Next() ) {
+ Handle(AIS_InteractiveObject) anAIS = aIter.Value();
+ if ( !anAIS.IsNull() ) {
+ // erase the object from context : move it to collector
+ ic->Erase( anAIS, false, forced ? false : true );
+ }
+ }
+}
+
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::CreatePrs
+ * Create presentation by entry
+ */
+//==========================================================
+SALOME_Prs* OCCViewer_ViewFrame::CreatePrs( const char* entry )
+{
+ OCCViewer_Prs* prs = new OCCViewer_Prs();
+ if ( entry )
+ {
+ // get context
+ Handle(AIS_InteractiveContext) ic = myViewer->getAISContext();
+
+ // get displayed objects
+ AIS_ListOfInteractive List;
+ ic->DisplayedObjects( List );
+ // get objects in the collector
+ AIS_ListOfInteractive ListCollector;
+ ic->ObjectsInCollector( ListCollector );
+ List.Append( ListCollector );
+
+ AIS_ListIteratorOfListOfInteractive ite( List );
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), entry ) == 0 )
+ prs->AddObject( ite.Value() );
}
+ }
+ return prs;
+}
+
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::LocalSelection
+ * Activates selection of sub shapes
+ */
+//==========================================================
+void OCCViewer_ViewFrame::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
+{
+ Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
+ const OCCViewer_Prs* anOCCPrs = dynamic_cast<const OCCViewer_Prs*>( thePrs );
+ if ( anIC.IsNull() )
+ return;
- if (!view3d.IsNull())
+ // Open local context if there is no one
+ bool allObjects = thePrs == 0 || thePrs->IsNull();
+ if ( !anIC->HasOpenedContext() ) {
+ anIC->ClearCurrents( false );
+ anIC->OpenLocalContext( allObjects, true, true );
+ }
+
+ AIS_ListOfInteractive anObjs;
+ // Get objects to be activated
+ if ( allObjects )
+ anIC->DisplayedObjects( anObjs );
+ else
+ anOCCPrs->GetObjects( anObjs );
+
+ // Activate selection of objects from prs
+ AIS_ListIteratorOfListOfInteractive aIter( anObjs );
+ for ( ; aIter.More(); aIter.Next() ) {
+ Handle(AIS_InteractiveObject) anAIS = aIter.Value();
+ if ( !anAIS.IsNull() )
{
- double Xmin=0, Ymin=0, Zmin=0, Xmax=0, Ymax=0, Zmax=0;
- double aMaxSide;
- double aPercents;
-
- view3d->View()->MinMaxValues(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
-
- if (Xmin==RealFirst() || Ymin==RealFirst() || Zmin==RealFirst() ||
- Xmax==RealLast() || Ymax==RealLast() || Zmax==RealLast())
- return;
-
- aMaxSide = Xmax - Xmin;
- if (aMaxSide < Ymax -Ymin) aMaxSide = Ymax -Ymin;
- if (aMaxSide < Zmax -Zmin) aMaxSide = Zmax -Zmin;
-
- static float aSizeInPercents = 105;
- QString aSetting = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
- if (!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat();
-
- static float EPS = 5.0E-3;
- float aSize = myViewer->getTrihedron()->Size();
- float aNewSize = aMaxSide*aSizeInPercents/100.0;
- // if the new trihedron size have sufficient difference, then apply the value
- if(fabs(aNewSize-aSize) > aSize*EPS || fabs(aNewSize-aSize) > aNewSize*EPS)
- myViewer->setTrihedronSize(aNewSize);
+ if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
+ {
+ anIC->Load( anAIS, -1, false );
+ anIC->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
+ }
+ else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
+ {
+ anIC->Load( anAIS, -1, false );
+ anIC->Activate( anAIS, theMode );
+ }
}
+ }
+}
+
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::GlobalSelection
+ * Deactivates selection of sub shapes
+ */
+//==========================================================
+void OCCViewer_ViewFrame::GlobalSelection( const bool update ) const
+{
+ Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
+ if ( !anIC.IsNull() )
+ anIC->CloseAllContexts( false );
+ if ( update )
+ anIC->CurrentViewer()->Redraw();
+}
+
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::BeforeDisplay
+ * Axiluary method called before displaying of objects
+ */
+//==========================================================
+void OCCViewer_ViewFrame::BeforeDisplay( SALOME_Displayer* d )
+{
+ d->BeforeDisplay( this, SALOME_OCCViewType() );
+}
+
+//==========================================================
+/*!
+ * OCCViewer_ViewFrame::AfterDisplay
+ * Axiluary method called after displaying of objects
+ */
+//==========================================================
+void OCCViewer_ViewFrame::AfterDisplay( SALOME_Displayer* d )
+{
+ d->AfterDisplay( this, SALOME_OCCViewType() );
}
+
// File : OCCViewer_ViewFrame.h
// Author : Nicolas REJNERI
// Module : SALOME
-// $Header$
+// $Header$
#ifndef OCCViewer_ViewFrame_H
#define OCCViewer_ViewFrame_H
bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
/* undo/redo management */
- void undo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry);
- void redo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry);
+ void undo(QAD_Study* aStudy, const char* StudyFrameEntry);
+ void redo(QAD_Study* aStudy, const char* StudyFrameEntry);
/* selection */
Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
void EraseAll();
void Repaint();
+ /* Reimplemented from SALOME_View */
+ void Display( const SALOME_OCCPrs* );
+ void Erase( const SALOME_OCCPrs*, const bool = false );
+ SALOME_Prs* CreatePrs( const char* entry = 0 );
+ virtual void BeforeDisplay( SALOME_Displayer* d );
+ virtual void AfterDisplay ( SALOME_Displayer* d );
+ virtual void LocalSelection( const SALOME_OCCPrs*, const int );
+ virtual void GlobalSelection( const bool = false ) const;
+
+
+ void AdjustTrihedrons( const bool forced = false );
+
+ // Method for activation of sub-shapes selection
+
+
protected:
void closeEvent(QCloseEvent* e);
void resizeEvent(QResizeEvent* e);
void onViewTop();
void onViewTrihedron();
void onAdjustTrihedron();
+
+private:
+ bool getTrihedronSize( double& theNewSize, double& theSize );
protected:
OCCViewer_Viewer3d* myViewer; // my owner
// Module : SALOME
// $Header$
-using namespace std;
#include <stdlib.h>
#if !defined WNT
#include <qpixmap.h>
#include <qintdict.h>
+#include "utilities.h"
+
+using namespace std;
+
/* XPM */
const char* imageZoomCursor[] = {
"32 32 3 1",
#include <Geom_Axis2Placement.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <NCollection_DefineBaseCollection.hxx>
+#include <NCollection_DefineDataMap.hxx>
+
+DEFINE_BASECOLLECTION( OCCViewer_CollectionOfIndexedMapOfShapes, TopTools_IndexedMapOfShape )
+DEFINE_DATAMAP( OCCViewer_MapOfIOIndexedMapOfShape, OCCViewer_CollectionOfIndexedMapOfShapes, Handle_SALOME_InteractiveObject, TopTools_IndexedMapOfShape)
+
+DEFINE_BASECOLLECTION( OCCViewer_CollectionOfMapOfInteger, TColStd_MapOfInteger )
+DEFINE_DATAMAP( OCCViewer_MapOfIOMapOfInteger, OCCViewer_CollectionOfMapOfInteger, Handle_SALOME_InteractiveObject, TColStd_MapOfInteger )
/*!
Constructor
return myTrihedron;
}
-void OCCViewer_Viewer3d::setTrihedronSize(float size)
+void OCCViewer_Viewer3d::setTrihedronSize( float size )
{
- myTrihedron->SetSize(size);
+ AIS_ListOfInteractive aList;
+ myAISContext->DisplayedObjects( aList );
+ myAISContext->ObjectsInCollector( aList );
+
+ AIS_ListIteratorOfListOfInteractive anIter( aList );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anIter.Value() );
+ if ( !aTrh.IsNull() )
+ aTrh->SetSize( aTrh == myTrihedron ? size : 0.5 *size );
+ }
+
myAISContext->UpdateCurrentViewer();
}
myAISContext->DisplayedObjects(List);
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(ite.Value());
+ while (ite.More())
+ {
+ if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape)))
+ {
+ Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) ) {
- aSh->setName( strdup(newName.latin1()) );
- break;
- }
+ if ( aSh->hasIO() )
+ {
+ Handle(SALOME_InteractiveObject) IO = aSh->getIO();
+ if ( IO->isSame( IObject ) )
+ {
+ char* aCopyName = CORBA::string_dup(newName.latin1());
+ aSh->setName( aCopyName );
+ delete( aCopyName );
+ break;
+ }
}
- } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(ite.Value());
+ }
+ else if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
+ {
+ Handle(SALOME_AISObject) aSh = Handle(SALOME_AISObject)::DownCast( ite.Value() );
// Add code here, if someone create a MODULE_AISObject.
}
myAISContext->DisplayedObjects(List);
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(ite.Value());
-
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) ) {
- Quantity_Color CSFColor = Quantity_Color ( thecolor.red()/255., thecolor.green()/255., thecolor.blue()/255., Quantity_TOC_RGB );
- aSh->SetColor ( CSFColor );
- // aSh->SetShadingColor ( CSFColor );
- break;
- }
- }
- } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(ite.Value());
-
- // Add code here, if someone create a MODULE_AISObject.
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+ {
+ Quantity_Color CSFColor = Quantity_Color ( thecolor.red() / 255.,
+ thecolor.green() / 255.,
+ thecolor.blue() / 255.,
+ Quantity_TOC_RGB );
+ ite.Value()->SetColor( CSFColor );
+ break;
}
- ite.Next();
}
+
myV3dViewer->Update();
}
-void OCCViewer_Viewer3d::SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
- int mode)
+void OCCViewer_Viewer3d::SwitchRepresentation( const Handle(SALOME_InteractiveObject)& IObject,
+ int mode )
{
AIS_ListOfInteractive List;
myAISContext->DisplayedObjects(List);
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(ite.Value());
-
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) ) {
- myAISContext->SetDisplayMode(aSh,Standard_Integer(mode),true);
- }
- }
- } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(ite.Value());
-
- // Add code here, if someone create a MODULE_AISObject.
- }
- ite.Next();
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+ myAISContext->SetDisplayMode( ite.Value(), (Standard_Integer)mode ,true );
}
+
myV3dViewer->Update();
}
-void OCCViewer_Viewer3d::SetTransparency(const Handle(SALOME_InteractiveObject)& IObject,
- float transp)
+void OCCViewer_Viewer3d::SetTransparency( const Handle(SALOME_InteractiveObject)& IObject,
+ float transp )
{
AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects(List);
+ myAISContext->DisplayedObjects( List );
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(ite.Value());
-
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) ) {
- myAISContext->SetTransparency( aSh, transp, false );
- myAISContext->Redisplay( aSh, Standard_False, Standard_True );
- }
- }
- } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(ite.Value());
-
- // Add code here, if someone create a MODULE_AISObject.
+ AIS_ListIteratorOfListOfInteractive ite( List );
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+ {
+ myAISContext->SetTransparency( ite.Value(), transp, false );
+ myAISContext->Redisplay( ite.Value(), Standard_False, Standard_True );
}
- ite.Next();
}
+
myV3dViewer->Update();
}
*/
bool OCCViewer_Viewer3d::highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight, bool update )
{
+ bool isInLocal = myAISContext->HasOpenedContext();
+ QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
+ SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
+
AIS_ListOfInteractive List;
myAISContext->DisplayedObjects(List);
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(ite.Value());
-
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) ) {
- if ( highlight ) {
- if ( !myAISContext->IsSelected(aSh) )
- myAISContext->AddOrRemoveCurrentObject(aSh, false);
- } else {
- if ( myAISContext->IsSelected(aSh) )
- myAISContext->AddOrRemoveCurrentObject(aSh, false);
- }
- break;
- }
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+ {
+ if ( !isInLocal )
+ {
+ if ( highlight && !myAISContext->IsSelected( ite.Value() ) )
+ myAISContext->AddOrRemoveCurrentObject( ite.Value(), false );
+ else if ( !highlight && myAISContext->IsSelected( ite.Value() ) )
+ myAISContext->AddOrRemoveCurrentObject( ite.Value(), false );
}
- } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(ite.Value());
-
- // Add code here, if someone create a MODULE_AISObject.
+ // highlight subshapes only when local selection is active
+ else
+ {
+ if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) )
+ {
+ Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() );
+ TColStd_IndexedMapOfInteger MapIndex;
+ Sel->GetIndex( IObject, MapIndex );
+ aSh->highlightSubShapes( MapIndex, highlight );
+ }
+ }
+ break;
}
- ite.Next();
}
- if (update)
- myV3dViewer->Update();
+
+ if ( update )
+ myV3dViewer->Redraw();
+
return false;
}
*/
bool OCCViewer_Viewer3d::unHighlightAll()
{
- myAISContext->ClearCurrents();
+ if ( myAISContext->HasOpenedContext() )
+ myAISContext->ClearSelected();
+ else
+ myAISContext->ClearCurrents();
return false;
}
}
AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(ite.Value());
-
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IObject->isSame( IO ) ) {
- return true;
- }
- }
- } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(ite.Value());
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
- // Add code here, if someone create a MODULE_AISObject.
- }
- ite.Next();
+ if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+ return true;
}
return false;
}
bool OCCViewer_Viewer3d::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
{
AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects(List);
+ myAISContext->DisplayedObjects( List );
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More()) {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(ite.Value());
-
- if ( aSh->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IObject->isSame( IO ) ) {
- return myAISContext->IsDisplayed(aSh);
- }
- }
- } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(ite.Value());
+ AIS_ListIteratorOfListOfInteractive ite( List );
+ for ( ; ite.More(); ite.Next() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
- // Add code here, if someone create a MODULE_AISObject.
- }
- ite.Next();
+ if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+ return myAISContext->IsDisplayed( ite.Value() );
}
+
return false;
}
void OCCViewer_Viewer3d::onMouseMove( QMouseEvent* pe )
{
/* activate hilighting only if no MB pressed */
- if ( pe->state() == Qt::NoButton )
- {
- QAD_Application::getDesktop()->onMouseMove( pe );
-
- OCCViewer_ViewPort* vp = myViewFrame->getViewPort();
- myAISSelector->moveTo ( pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView() );
- }
+ if ( ! ( pe->state() & ( Qt::LeftButton | Qt::MidButton | Qt::RightButton ) ) ) {
+ QAD_Application::getDesktop()->onMouseMove( pe );
+ OCCViewer_ViewPort* vp = myViewFrame->getViewPort();
+ myAISSelector->moveTo ( pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView() );
+ }
}
/*!
{
emit vw3dSelectionDone( bAdded );
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_StudyFrame* myActiveSFrame = myActiveStudy->getActiveStudyFrame();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- MESSAGE ( "OCCViewer_Viewer3d - NB SELECTED INTERACTIVE OBJECT : " << Sel->IObjectCount() )
+// QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
+// QAD_StudyFrame* myActiveSFrame = myActiveStudy->getActiveStudyFrame();
+ // SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+// MESSAGE ( "OCCViewer_Viewer3d - NB SELECTED INTERACTIVE OBJECT : " << Sel->IObjectCount() )
- QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
+ QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
- if ( ActiveComp.isEmpty() ) {
+ if ( ActiveComp.isEmpty() )
+ {
unHighlightAll();
return;
}
+ if ( myAISContext->IndexOfCurrentLocal() <= 0 )
+ globalSelectionDone( bAdded );
+ else
+ localSelectionDone( bAdded );
+
+ myV3dViewer->Update();
+}
+
+/*!
+ Called when an object is selected and there is no opened local context
+*/
+void OCCViewer_Viewer3d::globalSelectionDone( const bool bAdded )
+{
+ SALOME_Selection* Sel = SALOME_Selection::Selection(
+ QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
+
+ MESSAGE ( "OCCViewer_Viewer3d - NB SELECTED INTERACTIVE OBJECT : " << Sel->IObjectCount() )
+
SALOME_ListIO DeltaPos;
DeltaPos.Clear();
SALOME_ListIO DeltaNeg;
DeltaNeg.Clear();
- if ( !bAdded ) { /* select */
- myAISContext->InitCurrent();
- while (myAISContext->MoreCurrent()) {
- if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
-
- if ( aSh->hasIO() ) {
- Handle( SALOME_InteractiveObject) IO = aSh->getIO();
-
- bool itemAllreadySelected = false;
- int nbSel = Sel->IObjectCount();
- if ( nbSel == 0 ) {
- DeltaPos.Append( IO );
- } else {
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- Handle( SALOME_InteractiveObject) IO1 = It.Value();
- if ( IO->isSame( IO1 ) ) {
- itemAllreadySelected = true;
- break;
- }
- }
- if (!itemAllreadySelected)
- DeltaPos.Append( IO );
- }
+ if ( !bAdded )
+ {
+ for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
+
+ if ( !anObj.IsNull() )
+ {
+ bool itemAllreadySelected = false;
+ int nbSel = Sel->IObjectCount();
+ if ( nbSel == 0 )
+ DeltaPos.Append( anObj );
+ else
+ {
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for( ; It.More(); It.Next() )
+ {
+ Handle( SALOME_InteractiveObject) IO1 = It.Value();
+ if ( anObj->isSame( IO1 ) )
+ {
+ itemAllreadySelected = true;
+ break;
+ }
+ }
+ if ( !itemAllreadySelected )
+ DeltaPos.Append( anObj );
}
- } else if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
-
- // Add code here, if someone create a MODULE_AISObject.
}
- myAISContext->NextCurrent();
+ else if ( myAISContext->Current()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
+ {
+ //Handle(SALOME_AISObject) aSh =
+ // Handle(SALOME_AISObject)::DownCast( myAISContext->Current() );
+ // Add code here, if someone create a MODULE_AISObject.
+ }
}
if ( DeltaPos.Extent() > 0 )
Sel->ClearIObjects();
-
- } else { /* shift select */
+
+ }
+ else
+ { /* shift select */
SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
+ for ( ;It.More(); It.Next() )
+ {
Handle( SALOME_InteractiveObject) IO1 = It.Value();
bool itemAllreadySelected = false;
- myAISContext->InitCurrent();
- while (myAISContext->MoreCurrent()) {
- if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
- if ( aSh->hasIO() ) {
- Handle( SALOME_InteractiveObject) IO = aSh->getIO();
-
- if ( IO->isSame( IO1 ) ) {
- itemAllreadySelected = true;
- break;
- }
- }
- } else if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
-
- // Add code here, if someone create a MODULE_AISObject.
- }
- myAISContext->NextCurrent();
+ for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->isSame( IO1 ) )
+ {
+ itemAllreadySelected = true;
+ break;
+ }
+ else if ( myAISContext->Current()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
+ {
+ //Handle(SALOME_AISObject) aSh =
+ // Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
+ // Add code here, if someone create a MODULE_AISObject.
+ }
}
- if (!itemAllreadySelected)
- DeltaNeg.Append( IO1 );
+ if ( !itemAllreadySelected )
+ DeltaNeg.Append( IO1 );
}
myAISContext->InitCurrent();
- while (myAISContext->MoreCurrent()) {
- if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
- if ( aSh->hasIO() ) {
- Handle( SALOME_InteractiveObject) IO = aSh->getIO();
-
- bool itemAllreadySelected = false;
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- Handle( SALOME_InteractiveObject) IO1 = It.Value();
-
- if ( IO->isSame( IO1 ) ) {
- itemAllreadySelected = true;
- break;
- }
- }
-
- if (!itemAllreadySelected )
- DeltaPos.Append( IO );
- }
- } else if ( myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
-
- // Add code here, if someone create a MODULE_AISObject.
+ for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
+
+ if ( !anObj.IsNull() )
+ {
+ bool itemAllreadySelected = false;
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for ( ;It.More(); It.Next() )
+ {
+ Handle( SALOME_InteractiveObject) IO1 = It.Value();
+
+ if ( anObj->isSame( IO1 ) )
+ {
+ itemAllreadySelected = true;
+ break;
+ }
+ }
+
+ if ( !itemAllreadySelected )
+ DeltaPos.Append( anObj );
+ }
+ else if ( myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISObject)))
+ {
+ //Handle(SALOME_AISObject) aSh =
+ // Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
+ // Add code here, if someone create a MODULE_AISObject.
}
- myAISContext->NextCurrent();
}
}
-
+
// MESSAGE ( "VIEWER onSelectionDone DeltaNeg.count() == " << DeltaNeg.count() )
SALOME_ListIteratorOfListIO ItNeg( DeltaNeg );
- for(;ItNeg.More();ItNeg.Next()) {
+ for( ;ItNeg.More();ItNeg.Next() )
+ {
Sel->RemoveIObject( ItNeg.Value(), false );
}
-
+
// MESSAGE ( "VIEWER onSelectionDone DeltaPos.count() == " << DeltaPos.Extent() )
SALOME_ListIteratorOfListIO ItPos( DeltaPos );
- for(;ItPos.More();ItPos.Next()) {
+ for ( ;ItPos.More();ItPos.Next() )
+ {
Sel->AddIObject( ItPos.Value(), false );
- }
- myV3dViewer->Update();
+ }
+}
+
+/*!
+ Called when an object is selected and there is opened local context
+*/
+void OCCViewer_Viewer3d::localSelectionDone( const bool /*bAdded*/ )
+{
+ SALOME_Selection* aSelection = SALOME_Selection::Selection(
+ QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
+
+ aSelection->BlockSignals( true );
+
+ OCCViewer_MapOfIOIndexedMapOfShape aMapsOfShapes; // SALOME_InteractiveObject <--> TopTools_IndexedMapOfShape
+ OCCViewer_MapOfIOMapOfInteger aMapsOfIndexes; // SALOME_InteractiveObject <--> TColStd_MapOfInteger
+
+
+ // Iterate through selected objects and add them to selection
+ for( myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected() )
+ {
+ // Retrive selected shape and subshape
+ Handle(SelectMgr_EntityOwner) anOwner = myAISContext->SelectedOwner();
+ if ( anOwner.IsNull() )
+ continue;
+
+ Handle(AIS_InteractiveObject) anIO =
+ Handle(AIS_InteractiveObject)::DownCast( myAISContext->SelectedInteractive() );
+ if ( anIO.IsNull() )
+ continue;
+
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
+ if ( anObj.IsNull() )
+ continue;
+
+ if ( anIO->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
+ {
+ Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast( anIO );
+ TopoDS_Shape aShape = anAISShape->Shape();
+ TopoDS_Shape aSubShape = anOwner->Shape();
+ if ( aShape.IsNull() || aSubShape.IsNull() )
+ continue;
+
+ // Get index of selected shape
+ if ( aMapsOfShapes.IsBound( anObj ) )
+ {
+ const TopTools_IndexedMapOfShape& aShapes = aMapsOfShapes( anObj );
+ int anIndex = aShapes.FindIndex( aSubShape );
+
+ aMapsOfIndexes( anObj ).Add( anIndex );
+ }
+ else
+ {
+ TopTools_IndexedMapOfShape aShapes;
+ TopExp::MapShapes( aShape, aShapes );
+ int anIndex = aShapes.FindIndex( aSubShape );
+
+ TColStd_MapOfInteger anIndexes;
+ anIndexes.Add( anIndex );
+
+ aMapsOfShapes.Bind( anObj, aShapes );
+ aMapsOfIndexes.Bind( anObj, anIndexes );
+ }
+ }
+ else
+ {
+ aMapsOfShapes.Bind( anObj, TopTools_IndexedMapOfShape() );
+ aMapsOfIndexes.Bind( anObj, TColStd_MapOfInteger() );
+ }
+ }
+
+ // Clear selection
+ aSelection->ClearIObjects();
+
+ // Add object in selection
+ OCCViewer_MapOfIOMapOfInteger::Iterator anIter( aMapsOfIndexes );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ if ( anIter.Value().IsEmpty() )
+ aSelection->AddIObject( anIter.Key(), false );
+ else
+ {
+ aSelection->AddIObject( anIter.Key(), false );
+ aSelection->AddOrRemoveIndex( anIter.Key(), anIter.Value(), false, false );
+ }
+ }
+
+ aSelection->BlockSignals( false );
+ aSelection->SelectionChanged();
}
/*!
{
emit vw3dSelectionCancel();
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_StudyFrame* myActiveSFrame = myActiveStudy->getActiveStudyFrame();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-
- // MESSAGE ( "OCCViewer_Viewer3d - NB SELECTED INTERACTIVE OBJECT : " << Sel->IObjectCount() )
+ QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
SALOME_ListIO DeltaPos;
DeltaPos.Clear();
SALOME_ListIO DeltaNeg;
DeltaNeg.Clear();
- if (!bAdded) { /* select */
+
+ if ( !bAdded )
+ { /* select */
Sel->ClearIObjects();
- } else { /* shiftselect */
+ }
+ else
+ { /* shiftselect */
SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
+ for ( ; It.More(); It.Next() )
+ {
Handle( SALOME_InteractiveObject) IO1 = It.Value();
bool itemAllreadySelected = false;
myAISContext->InitCurrent();
- while (myAISContext->MoreCurrent()) {
- if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- Handle(SALOME_AISShape) aSh =
- Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
- if ( aSh->hasIO() ) {
- Handle( SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame(IO1) ) {
- itemAllreadySelected = true;
- break;
- }
- }
- } else if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
-
- // Add code here, if someone create a MODULE_AISObject.
- }
- myAISContext->NextCurrent();
+ for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->isSame( IO1 ) )
+ {
+ itemAllreadySelected = true;
+ break;
+ }
+ else if ( myAISContext->Current()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
+ {
+ Handle(SALOME_AISObject) aSh =
+ Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
+ // Add code here, if someone create a MODULE_AISObject.
+ }
}
// only if isknown
- if (!itemAllreadySelected)
- DeltaNeg.Append( IO1 );
+ if ( !itemAllreadySelected )
+ DeltaNeg.Append( IO1 );
}
}
// MESSAGE ( "VIEWER onSelectionCancel DeltaNeg.count() == " << DeltaNeg.Extent() )
SALOME_ListIteratorOfListIO ItNeg( DeltaNeg );
- for(;ItNeg.More();ItNeg.Next()) {
+ for ( ; ItNeg.More(); ItNeg.Next() )
Sel->RemoveIObject( ItNeg.Value(), false);
- }
+
myV3dViewer->Update();
}
protected:
OCCViewer_ViewFrame* myViewFrame;
+private:
+
+ void globalSelectionDone( const bool );
+ void localSelectionDone ( const bool );
+
Handle (AIS_InteractiveContext) myAISContext;
OCCViewer_AISSelector* myAISSelector;
bool myEnableSelection;
--- /dev/null
+ THE Q PUBLIC LICENSE
+ version 1.0
+
+ Copyright (C) 1999-2000 Trolltech AS, Norway.
+ Everyone is permitted to copy and
+ distribute this license document.
+
+The intent of this license is to establish freedom to share and change the
+software regulated by this license under the open source model.
+
+This license applies to any software containing a notice placed by the
+copyright holder saying that it may be distributed under the terms of
+the Q Public License version 1.0. Such software is herein referred to as
+the Software. This license covers modification and distribution of the
+Software, use of third-party application programs based on the Software,
+and development of free software which uses the Software.
+
+ Granted Rights
+
+1. You are granted the non-exclusive rights set forth in this license
+ provided you agree to and comply with any and all conditions in this
+ license. Whole or partial distribution of the Software, or software
+ items that link with the Software, in any form signifies acceptance of
+ this license.
+
+2. You may copy and distribute the Software in unmodified form provided
+ that the entire package, including - but not restricted to - copyright,
+ trademark notices and disclaimers, as released by the initial developer
+ of the Software, is distributed.
+
+3. You may make modifications to the Software and distribute your
+ modifications, in a form that is separate from the Software, such as
+ patches. The following restrictions apply to modifications:
+
+ a. Modifications must not alter or remove any copyright notices in
+ the Software.
+
+ b. When modifications to the Software are released under this
+ license, a non-exclusive royalty-free right is granted to the
+ initial developer of the Software to distribute your modification
+ in future versions of the Software provided such versions remain
+ available under these terms in addition to any other license(s) of
+ the initial developer.
+
+4. You may distribute machine-executable forms of the Software or
+ machine-executable forms of modified versions of the Software, provided
+ that you meet these restrictions:
+
+ a. You must include this license document in the distribution.
+
+ b. You must ensure that all recipients of the machine-executable forms
+ are also able to receive the complete machine-readable source code
+ to the distributed Software, including all modifications, without
+ any charge beyond the costs of data transfer, and place prominent
+ notices in the distribution explaining this.
+
+ c. You must ensure that all modifications included in the
+ machine-executable forms are available under the terms of this
+ license.
+
+5. You may use the original or modified versions of the Software to
+ compile, link and run application programs legally developed by you
+ or by others.
+
+6. You may develop application programs, reusable components and other
+ software items that link with the original or modified versions of the
+ Software. These items, when distributed, are subject to the following
+ requirements:
+
+ a. You must ensure that all recipients of machine-executable forms of
+ these items are also able to receive and use the complete
+ machine-readable source code to the items without any charge
+ beyond the costs of data transfer.
+
+ b. You must explicitly license all recipients of your items to use
+ and re-distribute original and modified versions of the items in
+ both machine-executable and source code forms. The recipients must
+ be able to do so without any charges whatsoever, and they must be
+ able to re-distribute to anyone they choose.
+
+
+ c. If the items are not available to the general public, and the
+ initial developer of the Software requests a copy of the items,
+ then you must supply one.
+
+ Limitations of Liability
+
+In no event shall the initial developers or copyright holders be liable
+for any damages whatsoever, including - but not restricted to - lost
+revenue or profits or other direct, indirect, special, incidental or
+consequential damages, even if they have been advised of the possibility
+of such damages, except to the extent invariable law, if any, provides
+otherwise.
+
+ No Warranty
+
+The Software and this license document are provided AS IS with NO WARRANTY
+OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE.
+ Choice of Law
+
+This license is governed by the Laws of Norway. Disputes shall be settled
+by Oslo City Court.
EXPORT_HEADERS = \
qsplitterP.h \
qworkspaceP.h \
- qactionP.h
+ qactionP.h \
+ qfiledialogP.h
# Libraries targets
LIB = libqsplitterP.la
-LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qworkspaceP.cxx qworkspaceP_moc.cxx qactionP.cxx qactionP_moc.cxx
+LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qworkspaceP.cxx qworkspaceP_moc.cxx qactionP.cxx qactionP_moc.cxx qfiledialogP.cxx qfiledialogP_moc.cxx
qsplitterP_moc.cxx: $(inc_builddir)/qsplitterP.h
$(MOC) $(inc_builddir)/qsplitterP.h -o qsplitterP_moc.cxx
qactionP_moc.cxx: $(inc_builddir)/qactionP.h
$(MOC) $(inc_builddir)/qactionP.h -o qactionP_moc.cxx
+qfiledialogP_moc.cxx: $(inc_builddir)/qfiledialogP.h
+ $(MOC) $(inc_builddir)/qfiledialogP.h -o qfiledialogP_moc.cxx
+
CPPFLAGS+=$(QT_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++
CXXFLAGS+=
LDFLAGS+=$(QT_MT_LIBS)
--- /dev/null
+This package includes the patch for Qt toolkit.
+The files in this package are distributed under conditions of the Q Public License.
\ No newline at end of file
-// SALOME PatchQt : patch for Qt
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : qactionP.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qactionP.cxx
+// Description : the patch for Qt's QAction class (qaction.cpp)
+/////////////////////////////////////////////////////////////////////////////
+
+/****************************************************************************
+** $Id$
+**
+** Implementation of QAction class
+**
+** Created : 000000
+**
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the widgets module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
#include "qactionP.h"
-// SALOME PatchQt : patch for Qt
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : qactionP.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qactionP.h
+// Description : the patch for Qt's QAction class (qaction.h)
+/////////////////////////////////////////////////////////////////////////////
+
+/****************************************************************************
+** $Id$
+**
+** Definition of QAction class
+**
+** Created : 000000
+**
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the widgets module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
#ifndef QACTIONP_H
#define QACTIONP_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qfiledialogP.cxx
+// Description : the patch for Qt's QFileDialog class (qfiledialog.cpp)
+/////////////////////////////////////////////////////////////////////////////
+
+/****************************************************************************
+** $Id$
+**
+** Implementation of QFileDialog class
+**
+** Created : 950429
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the dialogs module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "qplatformdefs.h"
+
+// Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED.
+#if defined(connect)
+#undef connect
+#endif
+
+#include "qfiledialogP.h"
+
+#ifndef QT_NO_FILEDIALOG
+
+#include "qlineedit.h"
+#include "qcombobox.h"
+#include "qlistview.h"
+#include "qlistbox.h"
+#include "qlabel.h"
+#include "qpushbutton.h"
+#include "qtoolbutton.h"
+#include "qmessagebox.h"
+#include "qapplication.h"
+#include "private/qapplication_p.h"
+#include "qlayout.h"
+#include "qbitmap.h"
+#include "qpopupmenu.h"
+#include "qwidgetstack.h"
+#include "qbuttongroup.h"
+#include "qptrvector.h"
+#include "qregexp.h"
+#include "qstrlist.h"
+#include "qtimer.h"
+#include "qvbox.h"
+#include "qhbox.h"
+#include "qtooltip.h"
+#include "qheader.h"
+#include "qdragobject.h"
+#include "qmime.h"
+#include "qprogressbar.h"
+#include "qfile.h"
+#include "qcstring.h"
+#include "qobjectlist.h"
+#include "qcheckbox.h"
+#include "qsplitter.h"
+#include "qmap.h"
+#include "qnetworkprotocol.h"
+#include "qsemimodal.h"
+#include "qpainter.h"
+#include "qcleanuphandler.h"
+#include "qstyle.h"
+#include "qcursor.h"
+
+#ifndef Q_OS_TEMP
+#include <time.h>
+#endif
+#include <ctype.h>
+#include <stdlib.h>
+
+#ifdef Q_WS_MAC
+#include "qt_mac.h"
+#undef check
+#endif
+
+#ifdef Q_WS_WIN
+#include "qt_windows.h"
+#endif
+
+/* XPM */
+static const char * const start_xpm[]={
+ "16 15 8 1",
+ "a c #cec6bd",
+ "# c #000000",
+ "e c #ffff00",
+ "b c #999999",
+ "f c #cccccc",
+ "d c #dcdcdc",
+ "c c #ffffff",
+ ". c None",
+ ".....######aaaaa",
+ "...bb#cccc##aaaa",
+ "..bcc#cccc#d#aaa",
+ ".bcef#cccc#dd#aa",
+ ".bcfe#cccc#####a",
+ ".bcef#ccccccccc#",
+ "bbbbbbbbbbbbccc#",
+ "bccccccccccbbcc#",
+ "bcefefefefee#bc#",
+ ".bcefefefefef#c#",
+ ".bcfefefefefe#c#",
+ "..bcfefefefeeb##",
+ "..bbbbbbbbbbbbb#",
+ "...#############",
+ "................"};
+
+/* XPM */
+static const char * const end_xpm[]={
+ "16 15 9 1",
+ "d c #a0a0a0",
+ "c c #c3c3c3",
+ "# c #cec6bd",
+ ". c #000000",
+ "f c #ffff00",
+ "e c #999999",
+ "g c #cccccc",
+ "b c #ffffff",
+ "a c None",
+ "......####aaaaaa",
+ ".bbbb..###aaaaaa",
+ ".bbbb.c.##aaaaaa",
+ ".bbbb....ddeeeea",
+ ".bbbbbbb.bbbbbe.",
+ ".bbbbbbb.bcfgfe.",
+ "eeeeeeeeeeeeefe.",
+ "ebbbbbbbbbbeege.",
+ "ebfgfgfgfgff.ee.",
+ "aebfgfgfgfgfg.e.",
+ "aebgfgfgfgfgf.e.",
+ "aaebgfgfgfgffe..",
+ "aaeeeeeeeeeeeee.",
+ "aaa.............",
+ "aaaaaaaaaaaaaaaa"};
+
+/* XPM */
+static const char* const open_xpm[]={
+ "16 16 6 1",
+ ". c None",
+ "b c #ffff00",
+ "d c #000000",
+ "* c #999999",
+ "c c #cccccc",
+ "a c #ffffff",
+ "................",
+ "................",
+ "...*****........",
+ "..*aaaaa*.......",
+ ".*abcbcba******.",
+ ".*acbcbcaaaaaa*d",
+ ".*abcbcbcbcbcb*d",
+ "*************b*d",
+ "*aaaaaaaaaa**c*d",
+ "*abcbcbcbcbbd**d",
+ ".*abcbcbcbcbcd*d",
+ ".*acbcbcbcbcbd*d",
+ "..*acbcbcbcbb*dd",
+ "..*************d",
+ "...ddddddddddddd",
+ "................"};
+
+/* XPM */
+static const char * const link_dir_xpm[]={
+ "16 16 10 1",
+ "h c #808080",
+ "g c #a0a0a0",
+ "d c #000000",
+ "b c #ffff00",
+ "f c #303030",
+ "# c #999999",
+ "a c #cccccc",
+ "e c #585858",
+ "c c #ffffff",
+ ". c None",
+ "................",
+ "................",
+ "..#####.........",
+ ".#ababa#........",
+ "#abababa######..",
+ "#cccccccccccc#d.",
+ "#cbababababab#d.",
+ "#cabababababa#d.",
+ "#cbababdddddddd.",
+ "#cababadccccccd.",
+ "#cbababdcececcd.",
+ "#cababadcefdfcd.",
+ "#cbababdccgdhcd.",
+ "#######dccchccd.",
+ ".dddddddddddddd.",
+ "................"};
+
+/* XPM */
+static const char * const link_file_xpm[]={
+ "16 16 10 1",
+ "h c #808080",
+ "g c #a0a0a0",
+ "d c #c3c3c3",
+ ". c #7f7f7f",
+ "c c #000000",
+ "b c #bfbfbf",
+ "f c #303030",
+ "e c #585858",
+ "a c #ffffff",
+ "# c None",
+ "################",
+ "..........######",
+ ".aaaaaaaab.#####",
+ ".aaaaaaaaba.####",
+ ".aaaaaaaacccc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaadc###",
+ ".aaaaaaaaaadc###",
+ ".aaaacccccccc###",
+ ".aaaacaaaaaac###",
+ ".aaaacaeaeaac###",
+ ".aaaacaefcfac###",
+ ".aaaacaagchac###",
+ ".ddddcaaahaac###",
+ "ccccccccccccc###"};
+
+/* XPM */
+static const char* const file_xpm[]={
+ "16 16 5 1",
+ ". c #7f7f7f",
+ "# c None",
+ "c c #000000",
+ "b c #bfbfbf",
+ "a c #ffffff",
+ "################",
+ "..........######",
+ ".aaaaaaaab.#####",
+ ".aaaaaaaaba.####",
+ ".aaaaaaaacccc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".aaaaaaaaaabc###",
+ ".bbbbbbbbbbbc###",
+ "ccccccccccccc###"};
+
+/* XPM */
+static const char * const closed_xpm[]={
+ "16 16 6 1",
+ ". c None",
+ "b c #ffff00",
+ "d c #000000",
+ "* c #999999",
+ "a c #cccccc",
+ "c c #ffffff",
+ "................",
+ "................",
+ "..*****.........",
+ ".*ababa*........",
+ "*abababa******..",
+ "*cccccccccccc*d.",
+ "*cbababababab*d.",
+ "*cabababababa*d.",
+ "*cbababababab*d.",
+ "*cabababababa*d.",
+ "*cbababababab*d.",
+ "*cabababababa*d.",
+ "*cbababababab*d.",
+ "**************d.",
+ ".dddddddddddddd.",
+ "................"};
+
+
+/* XPM */
+static const char* const cdtoparent_xpm[]={
+ "15 13 3 1",
+ ". c None",
+ "* c #000000",
+ "a c #ffff99",
+ "..*****........",
+ ".*aaaaa*.......",
+ "***************",
+ "*aaaaaaaaaaaaa*",
+ "*aaaa*aaaaaaaa*",
+ "*aaa***aaaaaaa*",
+ "*aa*****aaaaaa*",
+ "*aaaa*aaaaaaaa*",
+ "*aaaa*aaaaaaaa*",
+ "*aaaa******aaa*",
+ "*aaaaaaaaaaaaa*",
+ "*aaaaaaaaaaaaa*",
+ "***************"};
+
+
+/* XPM */
+static const char* const newfolder_xpm[] = {
+ "15 14 4 1",
+ " c None",
+ ". c #000000",
+ "+ c #FFFF00",
+ "@ c #FFFFFF",
+ " . ",
+ " ",
+ " . ",
+ " . . ",
+ " .... . . . ",
+ " .+@+@. . . ",
+ ".......... . .",
+ ".@+@+@+@+@.. ",
+ ".+@+@+@+@+. . ",
+ ".@+@+@+@+@. . ",
+ ".+@+@+@+@+. ",
+ ".@+@+@+@+@. ",
+ ".+@+@+@+@+. ",
+ "........... "};
+
+/* XPM */
+static const char* const detailedview_xpm[]={
+ "14 11 3 1",
+ ". c None",
+ "* c #000000",
+ "a c #000099",
+ ".****.***.***.",
+ "..............",
+ "aaaaaaaaaaaaaa",
+ "..............",
+ ".****.***.***.",
+ "..............",
+ ".****.***.***.",
+ "..............",
+ ".****.***.***.",
+ "..............",
+ ".****.***.***."};
+
+/* XPM */
+static const char* const previewinfoview_xpm[]={
+ "13 13 4 1",
+ ". c #00007f",
+ "a c black",
+ "# c #cec6bd",
+ "b c #000000",
+ "..#####aaaaaa",
+ ".#.#bb#a#####",
+ "...####a#bbb#",
+ "#######a#####",
+ "#######a#bb##",
+ "..#####a#####",
+ ".#.#bb#a#bbb#",
+ "...####a#####",
+ "#######a#bb##",
+ "#######a#####",
+ "..#####a#bbb#",
+ ".#.#bb#a#####",
+ "...####aaaaaa"};
+
+/* XPM */
+static const char* const previewcontentsview_xpm[]={
+ "14 13 5 1",
+ ". c #00007f",
+ "a c black",
+ "c c #7f007f",
+ "# c #cec6bd",
+ "b c #000000",
+ "..#####aaaaaaa",
+ ".#.#bb#a#####a",
+ "...####a#ccc#a",
+ "#######a#ccc#a",
+ "#######a#####a",
+ "..#####a#bbb#a",
+ ".#.#bb#a#####a",
+ "...####a#bbb#a",
+ "#######a#####a",
+ "#######a#bbb#a",
+ "..#####a#####a",
+ ".#.#bb#a#####a",
+ "...####aaaaaaa"};
+
+/* XPM */
+static const char* const mclistview_xpm[]={
+ "15 11 4 1",
+ "* c None",
+ "b c #000000",
+ ". c #000099",
+ "a c #ffffff",
+ "...*****...****",
+ ".a.*bbb*.a.*bbb",
+ "...*****...****",
+ "***************",
+ "...*****...****",
+ ".a.*bbb*.a.*bbb",
+ "...*****...****",
+ "***************",
+ "...*****...****",
+ ".a.*bbb*.a.*bbb",
+ "...*****...****"};
+
+/* XPM */
+static const char * const back_xpm [] = {
+ "13 11 3 1",
+ "a c #00ffff",
+ "# c #000000",
+ ". c None",
+ ".....#.......",
+ "....##.......",
+ "...#a#.......",
+ "..#aa########",
+ ".#aaaaaaaaaa#",
+ "#aaaaaaaaaaa#",
+ ".#aaaaaaaaaa#",
+ "..#aa########",
+ "...#a#.......",
+ "....##.......",
+ ".....#......."};
+
+static QPixmap * openFolderIcon = 0;
+static QPixmap * closedFolderIcon = 0;
+static QPixmap * detailViewIcon = 0;
+static QPixmap * multiColumnListViewIcon = 0;
+static QPixmap * cdToParentIcon = 0;
+static QPixmap * newFolderIcon = 0;
+static QPixmap * fifteenTransparentPixels = 0;
+static QPixmap * symLinkDirIcon = 0;
+static QPixmap * symLinkFileIcon = 0;
+static QPixmap * fileIcon = 0;
+static QPixmap * startCopyIcon = 0;
+static QPixmap * endCopyIcon = 0;
+static QPixmap * previewContentsViewIcon = 0;
+static QPixmap * previewInfoViewIcon = 0;
+static QPixmap *goBackIcon = 0;
+static QFileIconProviderP * fileIconProvider = 0;
+static QSize *lastSize = 0;
+static QString * workingDirectory = 0;
+
+static bool bShowHiddenFiles = FALSE;
+static int sortFilesBy = (int)QDir::Name;
+static bool sortAscending = TRUE;
+static bool detailViewMode = FALSE;
+
+static QCleanupHandler<QPixmap> qfd_cleanup_pixmap;
+static QCleanupHandler<QSize> qfd_cleanup_size;
+static QCleanupHandler<QString> qfd_cleanup_string;
+
+static bool isDirectoryMode( int m )
+{
+ return m == QFileDialogP::Directory || m == QFileDialogP::DirectoryOnly;
+}
+
+#if defined(Q_WS_WIN)
+
+class QWindowsIconProvider : public QFileIconProviderP
+{
+public:
+ QWindowsIconProvider( QObject *parent=0, const char *name=0 );
+ ~QWindowsIconProvider();
+
+ const QPixmap * pixmap( const QFileInfo &fi );
+
+private:
+ QPixmap defaultFolder;
+ QPixmap defaultFile;
+ QPixmap defaultExe;
+ QPixmap pix;
+ int pixw, pixh;
+ QMap< QString, QPixmap > cache;
+};
+#endif
+
+static void makeVariables() {
+ if ( !openFolderIcon ) {
+ workingDirectory = new QString( QDir::currentDirPath() );
+ qfd_cleanup_string.add( &workingDirectory );
+
+ openFolderIcon = new QPixmap( (const char **)open_xpm);
+ qfd_cleanup_pixmap.add( &openFolderIcon );
+ symLinkDirIcon = new QPixmap( (const char **)link_dir_xpm);
+ qfd_cleanup_pixmap.add( &symLinkDirIcon );
+ symLinkFileIcon = new QPixmap( (const char **)link_file_xpm);
+ qfd_cleanup_pixmap.add( &symLinkFileIcon );
+ fileIcon = new QPixmap( (const char **)file_xpm);
+ qfd_cleanup_pixmap.add( &fileIcon );
+ closedFolderIcon = new QPixmap( (const char **)closed_xpm);
+ qfd_cleanup_pixmap.add( &closedFolderIcon );
+ detailViewIcon = new QPixmap( (const char **)detailedview_xpm);
+ qfd_cleanup_pixmap.add( &detailViewIcon );
+ multiColumnListViewIcon = new QPixmap( (const char **)mclistview_xpm);
+ qfd_cleanup_pixmap.add( &multiColumnListViewIcon );
+ cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm);
+ qfd_cleanup_pixmap.add( &cdToParentIcon );
+ newFolderIcon = new QPixmap( (const char **)newfolder_xpm);
+ qfd_cleanup_pixmap.add( &newFolderIcon );
+ previewInfoViewIcon
+ = new QPixmap( (const char **)previewinfoview_xpm );
+ qfd_cleanup_pixmap.add( &previewInfoViewIcon );
+ previewContentsViewIcon
+ = new QPixmap( (const char **)previewcontentsview_xpm );
+ qfd_cleanup_pixmap.add( &previewContentsViewIcon );
+ startCopyIcon = new QPixmap( (const char **)start_xpm );
+ qfd_cleanup_pixmap.add( &startCopyIcon );
+ endCopyIcon = new QPixmap( (const char **)end_xpm );
+ qfd_cleanup_pixmap.add( &endCopyIcon );
+ goBackIcon = new QPixmap( (const char **)back_xpm );
+ qfd_cleanup_pixmap.add( &goBackIcon );
+ fifteenTransparentPixels = new QPixmap( closedFolderIcon->width(), 1 );
+ qfd_cleanup_pixmap.add( &fifteenTransparentPixels );
+ QBitmap m( fifteenTransparentPixels->width(), 1 );
+ m.fill( Qt::color0 );
+ fifteenTransparentPixels->setMask( m );
+ bShowHiddenFiles = FALSE;
+ sortFilesBy = (int)QDir::Name;
+ detailViewMode = FALSE;
+#if defined(Q_WS_WIN)
+ if ( !fileIconProvider )
+ fileIconProvider = new QWindowsIconProvider( qApp );
+#endif
+ }
+}
+
+QFDProgressAnimation::QFDProgressAnimation( QWidget *parent )
+ : QWidget( parent, "qt_progressanimation" )
+{
+ setFixedSize( 300, 50 );
+ step = -1;
+ next();
+ timer = new QTimer( this );
+ connect( timer, SIGNAL( timeout() ),
+ this, SLOT( next() ) );
+}
+
+void QFDProgressAnimation::start()
+{
+ timer->start( 150, FALSE );
+}
+
+void QFDProgressAnimation::next()
+{
+ ++step;
+ if ( step > 10 )
+ step = 0;
+ repaint();
+}
+
+void QFDProgressAnimation::paintEvent( QPaintEvent * )
+{
+ erase();
+
+ QPainter p;
+ p.begin( this );
+ if ( step == 0 ) {
+ p.drawPixmap( 5, ( height() - startCopyIcon->height() ) / 2,
+ *startCopyIcon );
+ p.drawPixmap( width() - 5 - openFolderIcon->width(),
+ ( height() - openFolderIcon->height() ) / 2 , *openFolderIcon );
+ } else if ( step == 10 ) {
+ p.drawPixmap( 5, ( height() - openFolderIcon->height() ) / 2,
+ *openFolderIcon );
+ p.drawPixmap( width() - 5 - endCopyIcon->width(),
+ ( height() - endCopyIcon->height() ) / 2 , *endCopyIcon );
+ } else {
+ p.drawPixmap( 5, ( height() - openFolderIcon->height() ) / 2,
+ *openFolderIcon );
+ p.drawPixmap( width() - 5 - openFolderIcon->width(),
+ ( height() - openFolderIcon->height() ) / 2 , *openFolderIcon );
+ int x = 10 + openFolderIcon->width();
+ int w = width() - 2 * x;
+ int s = w / 9;
+ p.drawPixmap( x + s * step, ( height() - fileIcon->height() ) / 2 - fileIcon->height(),
+ *fileIcon );
+ }
+}
+
+QFDProgressDialog::QFDProgressDialog( QWidget *parent, const QString &fn, int steps )
+ : QDialog( parent, "", TRUE )
+{
+#ifndef QT_NO_WIDGET_TOPEXTRA
+ setCaption( QFileDialogP::tr( "Copy or Move a File" ) );
+#endif
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ layout->setSpacing( 5 );
+ layout->setMargin( 5 );
+
+ animation = new QFDProgressAnimation( this );
+ layout->addWidget( animation );
+
+ layout->addWidget( new QLabel( QFileDialogP::tr( "Read: %1" ).arg( fn ),
+ this, "qt_read_lbl" ) );
+ readBar = new QProgressBar( steps, this, "qt_readbar" );
+ readBar->reset();
+ readBar->setProgress( 0 );
+ layout->addWidget( readBar );
+ writeLabel = new QLabel( QFileDialogP::tr( "Write: %1" ).arg( QString::null ),
+ this, "qt_write_lbl" );
+ layout->addWidget( writeLabel );
+ writeBar = new QProgressBar( steps, this, "qt_writebar" );
+ writeBar->reset();
+ writeBar->setProgress( 0 );
+ layout->addWidget( writeBar );
+
+ QPushButton *b = new QPushButton( QFileDialogP::tr( "Cancel" ), this,
+ "qt_cancel_btn" );
+ b->setFixedSize( b->sizeHint() );
+ layout->addWidget( b );
+ connect( b, SIGNAL( clicked() ),
+ this, SIGNAL( cancelled() ) );
+
+ animation->start();
+}
+
+void QFDProgressDialog::setReadProgress( int p )
+{
+ readBar->setProgress( p );
+}
+
+void QFDProgressDialog::setWriteProgress( int p )
+{
+ writeBar->setProgress( p );
+}
+
+void QFDProgressDialog::setWriteLabel( const QString &s )
+{
+ writeLabel->setText( QFileDialogP::tr( "Write: %1" ).arg( s ) );
+}
+
+/************************************************************************
+ *
+ * Private QFileDialogP members
+ *
+ ************************************************************************/
+
+class QFileDialogPrivate {
+public:
+ ~QFileDialogPrivate();
+
+ QStringList history;
+
+ bool geometryDirty;
+ QComboBox * paths;
+ QComboBox * types;
+ QLabel * pathL;
+ QLabel * fileL;
+ QLabel * typeL;
+
+ QVBoxLayout * topLevelLayout;
+ QHBoxLayout *buttonLayout, *leftLayout, *rightLayout;
+ QPtrList<QHBoxLayout> extraWidgetsLayouts;
+ QPtrList<QLabel> extraLabels;
+ QPtrList<QWidget> extraWidgets;
+ QPtrList<QWidget> extraButtons;
+ QPtrList<QButton> toolButtons;
+
+ QWidgetStack * stack;
+
+ QToolButton * cdToParent, *newFolder, * detailView, * mcView,
+ *previewInfo, *previewContents, *goBack;
+ QButtonGroup * modeButtons;
+
+ QString currentFileName;
+ QListViewItem *last;
+
+ struct File: public QListViewItem {
+ File( QFileDialogPrivate * dlgp,
+ const QUrlInfo * fi, QListViewItem * parent )
+ : QListViewItem( parent, dlgp->last ), info( *fi ), d(dlgp), i( 0 ), hasMimePixmap( FALSE )
+ { setup(); dlgp->last = this; }
+ File( QFileDialogPrivate * dlgp,
+ const QUrlInfo * fi, QListView * parent )
+ : QListViewItem( parent, dlgp->last ), info( *fi ), d(dlgp), i( 0 ), hasMimePixmap( FALSE )
+ { setup(); dlgp->last = this; }
+ File( QFileDialogPrivate * dlgp,
+ const QUrlInfo * fi, QListView * parent, QListViewItem * after )
+ : QListViewItem( parent, after ), info( *fi ), d(dlgp), i( 0 ), hasMimePixmap( FALSE )
+ { setup(); if ( !nextSibling() ) dlgp->last = this; }
+ ~File();
+
+ QString text( int column ) const;
+ const QPixmap * pixmap( int ) const;
+
+ QUrlInfo info;
+ QFileDialogPrivate * d;
+ QListBoxItem *i;
+ bool hasMimePixmap;
+ };
+
+ class MCItem: public QListBoxItem {
+ public:
+ MCItem( QListBox *, QListViewItem * item );
+ MCItem( QListBox *, QListViewItem * item, QListBoxItem *after );
+ QString text() const;
+ const QPixmap *pixmap() const;
+ int height( const QListBox * ) const;
+ int width( const QListBox * ) const;
+ void paint( QPainter * );
+ QListViewItem * i;
+ };
+
+ class UrlInfoList : public QPtrList<QUrlInfo> {
+ public:
+ UrlInfoList() { setAutoDelete( TRUE ); }
+ int compareItems( QPtrCollection::Item n1, QPtrCollection::Item n2 ) {
+ if ( !n1 || !n2 )
+ return 0;
+
+ QUrlInfo *i1 = ( QUrlInfo *)n1;
+ QUrlInfo *i2 = ( QUrlInfo *)n2;
+
+ if ( i1->isDir() && !i2->isDir() )
+ return -1;
+ if ( !i1->isDir() && i2->isDir() )
+ return 1;
+
+ if ( i1->name() == ".." )
+ return -1;
+ if ( i2->name() == ".." )
+ return 1;
+
+#if defined(Q_OS_WIN32)
+ if ( sortFilesBy == QDir::Name ) {
+ QString name1 = i1->name().lower();
+ QString name2 = i2->name().lower();
+ return name1.compare( name2 );
+ }
+#endif
+ if ( QUrlInfo::equal( *i1, *i2, sortFilesBy ) )
+ return 0;
+ else if ( QUrlInfo::greaterThan( *i1, *i2, sortFilesBy ) )
+ return 1;
+ else if ( QUrlInfo::lessThan( *i1, *i2, sortFilesBy ) )
+ return -1;
+ // can't happen...
+ return 0;
+ }
+ QUrlInfo *operator[]( int i ) {
+ return at( i );
+ }
+ };
+
+ UrlInfoList sortedList;
+ QPtrList<File> pendingItems;
+
+ QFileListBox * moreFiles;
+
+ QFileDialogP::Mode mode;
+
+ QString rw;
+ QString ro;
+ QString wo;
+ QString inaccessible;
+
+ QString symLinkToFile;
+ QString file;
+ QString symLinkToDir;
+ QString dir;
+ QString symLinkToSpecial;
+ QString special;
+ QWidgetStack *preview;
+ bool infoPreview, contentsPreview;
+ QSplitter *splitter;
+ QUrlOperator url, oldUrl;
+ QWidget *infoPreviewWidget, *contentsPreviewWidget;
+ QFilePreviewP *infoPreviewer, *contentsPreviewer;
+ bool hadDotDot;
+
+ bool ignoreNextKeyPress;
+ // ignores the next refresh operation in case the user forced a selection
+ bool ignoreNextRefresh;
+ QFDProgressDialog *progressDia;
+ bool checkForFilter;
+ bool ignoreReturn;
+ bool ignoreStop;
+
+ QTimer *mimeTypeTimer;
+ const QNetworkOperation *currListChildren;
+
+ // this is similar to QUrl::encode but does encode "*" and
+ // doesn't encode whitespaces
+ static QString encodeFileName( const QString& fName ) {
+
+ QString newStr;
+ QCString cName = fName.utf8();
+ const QCString sChars(
+#ifdef Q_WS_WIN
+ "#%"
+#else
+ "<>#@\"&%$:,;?={}|^~[]\'`\\*"
+#endif
+ );
+
+ int len = cName.length();
+ if ( !len )
+ return QString::null;
+ for ( int i = 0; i < len ;++i ) {
+ uchar inCh = (uchar)cName[ i ];
+ if ( inCh >= 128 || sChars.contains(inCh) )
+ {
+ newStr += QChar( '%' );
+ ushort c = inCh / 16;
+ c += c > 9 ? 'A' - 10 : '0';
+ newStr += c;
+ c = inCh % 16;
+ c += c > 9 ? 'A' - 10 : '0';
+ newStr += c;
+ } else {
+ newStr += inCh;
+ }
+ }
+ return newStr;
+ }
+
+};
+
+QFileDialogPrivate::~QFileDialogPrivate()
+{
+ delete modeButtons;
+}
+
+
+
+/************************************************************************
+ *
+ * Internal class QRenameEdit
+ *
+ ************************************************************************/
+
+void QRenameEdit::keyPressEvent( QKeyEvent *e )
+{
+ if ( e->key() == Key_Escape )
+ emit escapePressed();
+ else
+ QLineEdit::keyPressEvent( e );
+ e->accept();
+}
+
+void QRenameEdit::focusOutEvent( QFocusEvent * )
+{
+ emit escapePressed();
+}
+
+/************************************************************************
+ *
+ * Internal class QFileListBox
+ *
+ ************************************************************************/
+
+QFileListBox::QFileListBox( QWidget *parent, QFileDialogP *dlg )
+ : QListBox( parent, "filelistbox" ), filedialog( dlg ),
+ renaming( FALSE ), renameItem( 0 ), mousePressed( FALSE ),
+ firstMousePressEvent( TRUE )
+{
+ changeDirTimer = new QTimer( this );
+ QVBox *box = new QVBox( viewport(), "qt_vbox" );
+ box->setFrameStyle( QFrame::Box | QFrame::Plain );
+ lined = new QRenameEdit( box );
+ lined->setFixedHeight( lined->sizeHint().height() );
+ box->hide();
+ box->setBackgroundMode( PaletteBase );
+ renameTimer = new QTimer( this );
+ connect( lined, SIGNAL( returnPressed() ),
+ this, SLOT (rename() ) );
+ connect( lined, SIGNAL( escapePressed() ),
+ this, SLOT( cancelRename() ) );
+ connect( renameTimer, SIGNAL( timeout() ),
+ this, SLOT( doubleClickTimeout() ) );
+ connect( changeDirTimer, SIGNAL( timeout() ),
+ this, SLOT( changeDirDuringDrag() ) );
+ connect( this, SIGNAL( contentsMoving( int, int ) ),
+ this, SLOT( contentsMoved( int, int ) ) );
+ viewport()->setAcceptDrops( TRUE );
+ dragItem = 0;
+}
+
+void QFileListBox::show()
+{
+ setBackgroundMode( PaletteBase );
+ viewport()->setBackgroundMode( PaletteBase );
+ QListBox::show();
+}
+
+void QFileListBox::keyPressEvent( QKeyEvent *e )
+{
+ if ( ( e->key() == Key_Enter ||
+ e->key() == Key_Return ) &&
+ renaming )
+ return;
+
+ QString keyPressed = ((QKeyEvent *)e)->text().lower();
+ QChar keyChar = keyPressed[0];
+ if ( keyChar.isLetterOrNumber() ) {
+ QListBoxItem * i = 0;
+ if ( currentItem() )
+ i = item( currentItem() );
+ else
+ i = firstItem();
+ if ( i->next() )
+ i = i->next();
+ else
+ i = firstItem();
+ while ( i != item( currentItem() ) ) {
+ QString it = text( index( i ) );
+ if ( it[0].lower() == keyChar ) {
+ clearSelection();
+ setCurrentItem( i );
+ } else {
+ if ( i->next() )
+ i = i->next();
+ else
+ i = firstItem();
+ }
+ }
+ }
+ cancelRename();
+ QListBox::keyPressEvent( e );
+}
+
+void QFileListBox::viewportMousePressEvent( QMouseEvent *e )
+{
+ pressPos = e->pos();
+ mousePressed = FALSE;
+
+ bool didRename = renaming;
+
+ cancelRename();
+ if ( !hasFocus() && !viewport()->hasFocus() )
+ setFocus();
+
+ if ( e->button() != LeftButton ) {
+ QListBox::viewportMousePressEvent( e );
+ firstMousePressEvent = FALSE;
+ return;
+ }
+
+ int i = currentItem();
+ bool wasSelected = FALSE;
+ if ( i != -1 )
+ wasSelected = item( i )->isSelected();
+ QListBox::viewportMousePressEvent( e );
+
+ QFileDialogPrivate::MCItem *i1 = (QFileDialogPrivate::MCItem*)item( currentItem() );
+ if ( i1 )
+ mousePressed = !( (QFileDialogPrivate::File*)i1->i )->info.isDir();
+
+ if ( itemAt( e->pos() ) != item( i ) ) {
+ firstMousePressEvent = FALSE;
+ return;
+ }
+
+ if ( !firstMousePressEvent && !didRename && i == currentItem() && currentItem() != -1 &&
+ wasSelected && filedialog->mode() != QFileDialogP::ExistingFiles &&
+ QUrlInfo( filedialog->d->url, "." ).isWritable() && item( currentItem() )->text() != ".." ) {
+ renameTimer->start( QApplication::doubleClickInterval(), TRUE );
+ renameItem = item( i );
+ }
+
+ firstMousePressEvent = FALSE;
+}
+
+void QFileListBox::viewportMouseReleaseEvent( QMouseEvent *e )
+{
+ dragItem = 0;
+ QListBox::viewportMouseReleaseEvent( e );
+ mousePressed = FALSE;
+}
+
+void QFileListBox::viewportMouseDoubleClickEvent( QMouseEvent *e )
+{
+ renameTimer->stop();
+ QListBox::viewportMouseDoubleClickEvent( e );
+}
+
+void QFileListBox::viewportMouseMoveEvent( QMouseEvent *e )
+{
+ if ( !dragItem )
+ dragItem = itemAt( e->pos() );
+ renameTimer->stop();
+#ifndef QT_NO_DRAGANDDROP
+ if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() && mousePressed ) {
+ QListBoxItem *item = dragItem;
+ dragItem = 0;
+ if ( item ) {
+ if ( !itemRect( item ).contains( e->pos() ) )
+ return;
+ QUriDrag* drag = new QUriDrag( viewport() );
+ drag->setUnicodeUris( filedialog->selectedFiles() );
+
+ if ( lined->parentWidget()->isVisible() )
+ cancelRename();
+
+ connect( drag, SIGNAL( destroyed() ),
+ this, SLOT( dragObjDestroyed() ) );
+ drag->drag();
+
+ mousePressed = FALSE;
+ }
+ } else
+#endif
+ {
+ QListBox::viewportMouseMoveEvent( e );
+ }
+
+}
+
+void QFileListBox::dragObjDestroyed()
+{
+#ifndef QT_NO_DRAGANDDROP
+ //#######
+ //filedialog->rereadDir();
+#endif
+}
+
+#ifndef QT_NO_DRAGANDDROP
+void QFileListBox::viewportDragEnterEvent( QDragEnterEvent *e )
+{
+ startDragUrl = filedialog->d->url;
+ startDragDir = filedialog->dirPath();
+ currDropItem = 0;
+
+ if ( !QUriDrag::canDecode( e ) ) {
+ e->ignore();
+ return;
+ }
+
+ QStringList l;
+ QUriDrag::decodeLocalFiles( e, l );
+ urls = (int)l.count();
+
+ if ( acceptDrop( e->pos(), e->source() ) ) {
+ e->accept();
+ setCurrentDropItem( e->pos() );
+ } else {
+ e->ignore();
+ setCurrentDropItem( QPoint( -1, -1 ) );
+ }
+
+ oldDragPos = e->pos();
+}
+
+void QFileListBox::viewportDragMoveEvent( QDragMoveEvent *e )
+{
+ if ( acceptDrop( e->pos(), e->source() ) ) {
+ switch ( e->action() ) {
+ case QDropEvent::Copy:
+ e->acceptAction();
+ break;
+ case QDropEvent::Move:
+ e->acceptAction();
+ break;
+ case QDropEvent::Link:
+ break;
+ default:
+ break;
+ }
+ if ( oldDragPos != e->pos() )
+ setCurrentDropItem( e->pos() );
+ } else {
+ changeDirTimer->stop();
+ e->ignore();
+ setCurrentDropItem( QPoint( -1, -1 ) );
+ }
+
+ oldDragPos = e->pos();
+}
+
+void QFileListBox::viewportDragLeaveEvent( QDragLeaveEvent * )
+{
+ changeDirTimer->stop();
+ setCurrentDropItem( QPoint( -1, -1 ) );
+//########
+// if ( startDragDir != filedialog->d->url )
+// filedialog->setUrl( startDragUrl );
+}
+
+void QFileListBox::viewportDropEvent( QDropEvent *e )
+{
+ changeDirTimer->stop();
+
+ if ( !QUriDrag::canDecode( e ) ) {
+ e->ignore();
+ return;
+ }
+
+ QStrList l;
+ QUriDrag::decode( e, l );
+
+ bool move = e->action() == QDropEvent::Move;
+// bool supportAction = move || e->action() == QDropEvent::Copy;
+
+ QUrlOperator dest;
+ if ( currDropItem )
+ dest = QUrlOperator( filedialog->d->url, QFileDialogPrivate::encodeFileName( currDropItem->text() ) );
+ else
+ dest = filedialog->d->url;
+ QStringList lst;
+ for ( uint i = 0; i < l.count(); ++i ) {
+ lst << l.at( i );
+ }
+
+ filedialog->d->url.copy( lst, dest, move );
+
+ // ##### what is supportAction for?
+ e->acceptAction();
+ currDropItem = 0;
+}
+
+bool QFileListBox::acceptDrop( const QPoint &pnt, QWidget *source )
+{
+ QListBoxItem *item = itemAt( pnt );
+ if ( !item || item && !itemRect( item ).contains( pnt ) ) {
+ if ( source == viewport() && startDragDir == filedialog->dirPath() )
+ return FALSE;
+ return TRUE;
+ }
+
+ QUrlInfo fi( filedialog->d->url, item->text() );
+
+ if ( fi.isDir() && itemRect( item ).contains( pnt ) )
+ return TRUE;
+ return FALSE;
+}
+
+void QFileListBox::setCurrentDropItem( const QPoint &pnt )
+{
+ changeDirTimer->stop();
+
+ QListBoxItem *item = 0;
+ if ( pnt != QPoint( -1, -1 ) )
+ item = itemAt( pnt );
+ if ( item && !QUrlInfo( filedialog->d->url, item->text() ).isDir() )
+ item = 0;
+ if ( item && !itemRect( item ).contains( pnt ) )
+ item = 0;
+
+ currDropItem = item;
+ if ( currDropItem )
+ setCurrentItem( currDropItem );
+ changeDirTimer->start( 750 );
+}
+#endif // QT_NO_DRAGANDDROP
+
+void QFileListBox::changeDirDuringDrag()
+{
+#ifndef QT_NO_DRAGANDDROP
+ if ( !currDropItem )
+ return;
+ changeDirTimer->stop();
+ QUrl u( filedialog->d->url, QFileDialogPrivate::encodeFileName(currDropItem->text()) );
+ filedialog->setDir( u );
+ currDropItem = 0;
+#endif
+}
+
+void QFileListBox::doubleClickTimeout()
+{
+ startRename();
+ renameTimer->stop();
+}
+
+void QFileListBox::startRename( bool check )
+{
+ if ( check && ( !renameItem || renameItem != item( currentItem() ) ) )
+ return;
+
+ int i = currentItem();
+ setSelected( i, TRUE );
+ QRect r = itemRect( item( i ) );
+ int bdr = item( i )->pixmap() ?
+ item( i )->pixmap()->width() : 16;
+ int x = r.x() + bdr;
+ int y = r.y();
+ int w = item( i )->width( this ) - bdr;
+ int h = QMAX( lined->height() + 2, r.height() );
+ y = y + r.height() / 2 - h / 2;
+
+ lined->parentWidget()->setGeometry( x, y, w + 6, h );
+ lined->setFocus();
+ lined->setText( item( i )->text() );
+ lined->selectAll();
+ lined->setFrame( FALSE );
+ lined->parentWidget()->show();
+ viewport()->setFocusProxy( lined );
+ renaming = TRUE;
+}
+
+void QFileListBox::clear()
+{
+ cancelRename();
+ QListBox::clear();
+}
+
+void QFileListBox::rename()
+{
+ if ( !lined->text().isEmpty() ) {
+ QString file = currentText();
+
+ if ( lined->text() != file )
+ filedialog->d->url.rename( file, lined->text() );
+ }
+ cancelRename();
+}
+
+void QFileListBox::cancelRename()
+{
+ renameItem = 0;
+ lined->parentWidget()->hide();
+ viewport()->setFocusProxy( this );
+ renaming = FALSE;
+ updateItem( currentItem() );
+ if ( lined->hasFocus() )
+ viewport()->setFocus();
+}
+
+void QFileListBox::contentsMoved( int, int )
+{
+ changeDirTimer->stop();
+#ifndef QT_NO_DRAGANDDROP
+ setCurrentDropItem( QPoint( -1, -1 ) );
+#endif
+}
+
+/************************************************************************
+ *
+ * Internal class QFileListView
+ *
+ ************************************************************************/
+
+QFileDialogQFileListView::QFileDialogQFileListView( QWidget *parent, QFileDialogP *dlg )
+ : QListView( parent, "qt_filedlg_listview" ), renaming( FALSE ), renameItem( 0 ),
+ filedialog( dlg ), mousePressed( FALSE ),
+ firstMousePressEvent( TRUE )
+{
+ changeDirTimer = new QTimer( this );
+ QVBox *box = new QVBox( viewport(), "qt_vbox" );
+ box->setFrameStyle( QFrame::Box | QFrame::Plain );
+ lined = new QRenameEdit( box );
+ lined->setFixedHeight( lined->sizeHint().height() );
+ box->hide();
+ box->setBackgroundMode( PaletteBase );
+ renameTimer = new QTimer( this );
+ connect( lined, SIGNAL( returnPressed() ),
+ this, SLOT (rename() ) );
+ connect( lined, SIGNAL( escapePressed() ),
+ this, SLOT( cancelRename() ) );
+ header()->setMovingEnabled( FALSE );
+ connect( renameTimer, SIGNAL( timeout() ),
+ this, SLOT( doubleClickTimeout() ) );
+ connect( changeDirTimer, SIGNAL( timeout() ),
+ this, SLOT( changeDirDuringDrag() ) );
+ disconnect( header(), SIGNAL( sectionClicked( int ) ),
+ this, SLOT( changeSortColumn( int ) ) );
+ connect( header(), SIGNAL( sectionClicked( int ) ),
+ this, SLOT( changeSortColumn2( int ) ) );
+ connect( this, SIGNAL( contentsMoving( int, int ) ),
+ this, SLOT( contentsMoved( int, int ) ) );
+
+ viewport()->setAcceptDrops( TRUE );
+ sortcolumn = 0;
+ ascending = TRUE;
+ dragItem = 0;
+}
+
+void QFileDialogQFileListView::setSorting( int column, bool increasing )
+{
+ if ( column == -1 ) {
+ QListView::setSorting( column, increasing );
+ return;
+ }
+
+ sortAscending = ascending = increasing;
+ sortcolumn = column;
+ switch ( column ) {
+ case 0:
+ sortFilesBy = QDir::Name;
+ break;
+ case 1:
+ sortFilesBy = QDir::Size;
+ break;
+ case 3:
+ sortFilesBy = QDir::Time;
+ break;
+ default:
+ sortFilesBy = QDir::Name; // #### ???
+ break;
+ }
+
+ filedialog->resortDir();
+}
+
+void QFileDialogQFileListView::changeSortColumn2( int column )
+{
+ int lcol = header()->mapToLogical( column );
+ setSorting( lcol, sortcolumn == lcol ? !ascending : TRUE );
+}
+
+void QFileDialogQFileListView::keyPressEvent( QKeyEvent *e )
+{
+ if ( ( e->key() == Key_Enter ||
+ e->key() == Key_Return ) &&
+ renaming )
+ return;
+
+ QString keyPressed = e->text().lower();
+ QChar keyChar = keyPressed[0];
+ if ( keyChar.isLetterOrNumber() ) {
+ QListViewItem * i = 0;
+ if ( currentItem() )
+ i = currentItem();
+ else
+ i = firstChild();
+ if ( i->nextSibling() )
+ i = i->nextSibling();
+ else
+ i = firstChild();
+ while ( i != currentItem() ) {
+ QString it = i->text(0);
+ if ( it[0].lower() == keyChar ) {
+ clearSelection();
+ ensureItemVisible( i );
+ setCurrentItem( i );
+ } else {
+ if ( i->nextSibling() )
+ i = i->nextSibling();
+ else
+ i = firstChild();
+ }
+ }
+ return;
+ }
+
+ cancelRename();
+ QListView::keyPressEvent( e );
+}
+
+void QFileDialogQFileListView::viewportMousePressEvent( QMouseEvent *e )
+{
+ pressPos = e->pos();
+ mousePressed = FALSE;
+
+ bool didRename = renaming;
+ cancelRename();
+ if ( !hasFocus() && !viewport()->hasFocus() )
+ setFocus();
+
+ if ( e->button() != LeftButton ) {
+ QListView::viewportMousePressEvent( e );
+ firstMousePressEvent = FALSE;
+ return;
+ }
+
+ QListViewItem *i = currentItem();
+ QListView::viewportMousePressEvent( e );
+
+ QFileDialogPrivate::File *i1 = (QFileDialogPrivate::File*)currentItem();
+ if ( i1 )
+ mousePressed = !i1->info.isDir();
+
+ if ( itemAt( e->pos() ) != i ||
+ e->x() + contentsX() > columnWidth( 0 ) ) {
+ firstMousePressEvent = FALSE;
+ return;
+ }
+
+ if ( !firstMousePressEvent && !didRename && i == currentItem() && currentItem() &&
+ filedialog->mode() != QFileDialogP::ExistingFiles &&
+ QUrlInfo( filedialog->d->url, "." ).isWritable() && currentItem()->text( 0 ) != ".." ) {
+ renameTimer->start( QApplication::doubleClickInterval(), TRUE );
+ renameItem = currentItem();
+ }
+
+ firstMousePressEvent = FALSE;
+}
+
+void QFileDialogQFileListView::viewportMouseDoubleClickEvent( QMouseEvent *e )
+{
+ renameTimer->stop();
+ QListView::viewportMouseDoubleClickEvent( e );
+}
+
+void QFileDialogQFileListView::viewportMouseReleaseEvent( QMouseEvent *e )
+{
+ QListView::viewportMouseReleaseEvent( e );
+ mousePressed = FALSE;
+ dragItem = 0;
+}
+
+void QFileDialogQFileListView::viewportMouseMoveEvent( QMouseEvent *e )
+{
+ renameTimer->stop();
+ if ( !dragItem )
+ dragItem = itemAt( e->pos() );
+#ifndef QT_NO_DRAGANDDROP
+ if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() && mousePressed ) {
+ QListViewItem *item = dragItem;
+ dragItem = 0;
+ if ( item ) {
+ QUriDrag* drag = new QUriDrag( viewport() );
+ drag->setUnicodeUris( filedialog->selectedFiles() );
+
+ if ( lined->isVisible() )
+ cancelRename();
+
+ connect( drag, SIGNAL( destroyed() ),
+ this, SLOT( dragObjDestroyed() ) );
+ drag->drag();
+
+ mousePressed = FALSE;
+ }
+ }
+#endif
+}
+
+void QFileDialogQFileListView::dragObjDestroyed()
+{
+#ifndef QT_NO_DRAGANDDROP
+ //######
+ //filedialog->rereadDir();
+#endif
+}
+
+#ifndef QT_NO_DRAGANDDROP
+void QFileDialogQFileListView::viewportDragEnterEvent( QDragEnterEvent *e )
+{
+ startDragUrl = filedialog->d->url;
+ startDragDir = filedialog->dirPath();
+ currDropItem = 0;
+
+ if ( !QUriDrag::canDecode( e ) ) {
+ e->ignore();
+ return;
+ }
+
+ QStringList l;
+ QUriDrag::decodeLocalFiles( e, l );
+ urls = (int)l.count();
+
+ if ( acceptDrop( e->pos(), e->source() ) ) {
+ e->accept();
+ setCurrentDropItem( e->pos() );
+ } else {
+ e->ignore();
+ setCurrentDropItem( QPoint( -1, -1 ) );
+ }
+
+ oldDragPos = e->pos();
+}
+
+void QFileDialogQFileListView::viewportDragMoveEvent( QDragMoveEvent *e )
+{
+ if ( acceptDrop( e->pos(), e->source() ) ) {
+ if ( oldDragPos != e->pos() )
+ setCurrentDropItem( e->pos() );
+ switch ( e->action() ) {
+ case QDropEvent::Copy:
+ e->acceptAction();
+ break;
+ case QDropEvent::Move:
+ e->acceptAction();
+ break;
+ case QDropEvent::Link:
+ break;
+ default:
+ break;
+ }
+ } else {
+ changeDirTimer->stop();
+ e->ignore();
+ setCurrentDropItem( QPoint( -1, -1 ) );
+ }
+
+ oldDragPos = e->pos();
+}
+
+void QFileDialogQFileListView::viewportDragLeaveEvent( QDragLeaveEvent * )
+{
+ changeDirTimer->stop();
+ setCurrentDropItem( QPoint( -1, -1 ) );
+//########
+// if ( startDragDir != filedialog->d->url )
+// filedialog->setUrl( startDragUrl );
+}
+
+void QFileDialogQFileListView::viewportDropEvent( QDropEvent *e )
+{
+ changeDirTimer->stop();
+
+ if ( !QUriDrag::canDecode( e ) ) {
+ e->ignore();
+ return;
+ }
+
+ QStringList l;
+ QUriDrag::decodeToUnicodeUris( e, l );
+
+ bool move = e->action() == QDropEvent::Move;
+// bool supportAction = move || e->action() == QDropEvent::Copy;
+
+ QUrlOperator dest;
+ if ( currDropItem )
+ dest = QUrlOperator( filedialog->d->url, QFileDialogPrivate::encodeFileName( currDropItem->text( 0 ) ) );
+ else
+ dest = filedialog->d->url;
+ filedialog->d->url.copy( l, dest, move );
+
+ // ##### what is supportAction for?
+ e->acceptAction();
+ currDropItem = 0;
+}
+
+bool QFileDialogQFileListView::acceptDrop( const QPoint &pnt, QWidget *source )
+{
+ QListViewItem *item = itemAt( pnt );
+ if ( !item || item && !itemRect( item ).contains( pnt ) ) {
+ if ( source == viewport() && startDragDir == filedialog->dirPath() )
+ return FALSE;
+ return TRUE;
+ }
+
+ QUrlInfo fi( filedialog->d->url, item->text( 0 ) );
+
+ if ( fi.isDir() && itemRect( item ).contains( pnt ) )
+ return TRUE;
+ return FALSE;
+}
+
+void QFileDialogQFileListView::setCurrentDropItem( const QPoint &pnt )
+{
+ changeDirTimer->stop();
+
+ QListViewItem *item = itemAt( pnt );
+ if ( pnt == QPoint( -1, -1 ) )
+ item = 0;
+ if ( item && !QUrlInfo( filedialog->d->url, item->text( 0 ) ).isDir() )
+ item = 0;
+
+ if ( item && !itemRect( item ).contains( pnt ) )
+ item = 0;
+
+ currDropItem = item;
+
+ if ( currDropItem )
+ setCurrentItem( currDropItem );
+
+ changeDirTimer->start( 750 );
+}
+#endif // QT_NO_DRAGANDDROP
+
+void QFileDialogQFileListView::changeDirDuringDrag()
+{
+#ifndef QT_NO_DRAGANDDROP
+ if ( !currDropItem )
+ return;
+ changeDirTimer->stop();
+ QUrl u( filedialog->d->url, QFileDialogPrivate::encodeFileName(currDropItem->text( 0 ) ) );
+ filedialog->setDir( u );
+ currDropItem = 0;
+#endif // QT_NO_DRAGANDDROP
+}
+
+
+void QFileDialogQFileListView::doubleClickTimeout()
+{
+ startRename();
+ renameTimer->stop();
+}
+
+void QFileDialogQFileListView::startRename( bool check )
+{
+ if ( check && ( !renameItem || renameItem != currentItem() ) )
+ return;
+
+ QListViewItem *i = currentItem();
+ setSelected( i, TRUE );
+
+ QRect r = itemRect( i );
+ int bdr = i->pixmap( 0 ) ?
+ i->pixmap( 0 )->width() : 16;
+ int x = r.x() + bdr;
+ int y = r.y();
+ int w = columnWidth( 0 ) - bdr;
+ int h = QMAX( lined->height() + 2, r.height() );
+ y = y + r.height() / 2 - h / 2;
+
+ lined->parentWidget()->setGeometry( x, y, w + 6, h );
+ lined->setFocus();
+ lined->setText( i->text( 0 ) );
+ lined->selectAll();
+ lined->setFrame( FALSE );
+ lined->parentWidget()->show();
+ viewport()->setFocusProxy( lined );
+ renaming = TRUE;
+}
+
+void QFileDialogQFileListView::clear()
+{
+ cancelRename();
+ QListView::clear();
+}
+
+void QFileDialogQFileListView::rename()
+{
+ if ( !lined->text().isEmpty() ) {
+ QString file = currentItem()->text( 0 );
+
+ if ( lined->text() != file )
+ filedialog->d->url.rename( file, lined->text() );
+ }
+ cancelRename();
+}
+
+void QFileDialogQFileListView::cancelRename()
+{
+ renameItem = 0;
+ lined->parentWidget()->hide();
+ viewport()->setFocusProxy( this );
+ renaming = FALSE;
+ if ( currentItem() )
+ currentItem()->repaint();
+ if ( lined->hasFocus() )
+ viewport()->setFocus();
+}
+
+void QFileDialogQFileListView::contentsMoved( int, int )
+{
+ changeDirTimer->stop();
+#ifndef QT_NO_DRAGANDDROP
+ setCurrentDropItem( QPoint( -1, -1 ) );
+#endif
+}
+
+
+QFileDialogPrivate::File::~File()
+{
+ if ( d->pendingItems.findRef( this ) )
+ d->pendingItems.removeRef( this );
+}
+
+QString QFileDialogPrivate::File::text( int column ) const
+{
+ makeVariables();
+
+ switch( column ) {
+ case 0:
+ return info.name();
+ case 1:
+ if ( info.isFile() )
+ return QString::number(info.size());
+ else
+ return QString::fromLatin1("");
+ case 2:
+ if ( info.isFile() && info.isSymLink() ) {
+ return d->symLinkToFile;
+ } else if ( info.isFile() ) {
+ return d->file;
+ } else if ( info.isDir() && info.isSymLink() ) {
+ return d->symLinkToDir;
+ } else if ( info.isDir() ) {
+ return d->dir;
+ } else if ( info.isSymLink() ) {
+ return d->symLinkToSpecial;
+ } else {
+ return d->special;
+ }
+ case 3: {
+ return info.lastModified().toString( Qt::LocalDate );
+ }
+ case 4:
+ if ( info.isReadable() )
+ return info.isWritable() ? d->rw : d->ro;
+ else
+ return info.isWritable() ? d->wo : d->inaccessible;
+ }
+
+ return QString::fromLatin1("<--->");
+}
+
+const QPixmap * QFileDialogPrivate::File::pixmap( int column ) const
+{
+ if ( column ) {
+ return 0;
+ } else if ( QListViewItem::pixmap( column ) ) {
+ return QListViewItem::pixmap( column );
+ } else if ( info.isSymLink() ) {
+ if ( info.isFile() )
+ return symLinkFileIcon;
+ else
+ return symLinkDirIcon;
+ } else if ( info.isDir() ) {
+ return closedFolderIcon;
+ } else if ( info.isFile() ) {
+ return fileIcon;
+ } else {
+ return fifteenTransparentPixels;
+ }
+}
+
+QFileDialogPrivate::MCItem::MCItem( QListBox * lb, QListViewItem * item )
+ : QListBoxItem()
+{
+ i = item;
+ if ( lb )
+ lb->insertItem( this );
+}
+
+QFileDialogPrivate::MCItem::MCItem( QListBox * lb, QListViewItem * item, QListBoxItem *after )
+ : QListBoxItem()
+{
+ i = item;
+ if ( lb )
+ lb->insertItem( this, after );
+}
+
+QString QFileDialogPrivate::MCItem::text() const
+{
+ return i->text( 0 );
+}
+
+
+const QPixmap *QFileDialogPrivate::MCItem::pixmap() const
+{
+ return i->pixmap( 0 );
+}
+
+
+int QFileDialogPrivate::MCItem::height( const QListBox * lb ) const
+{
+ if ( pixmap() )
+ return QMAX( lb->fontMetrics().height(), pixmap()->height()) + 2;
+
+ return lb->fontMetrics().height() + 2;
+}
+
+
+int QFileDialogPrivate::MCItem::width( const QListBox * lb ) const
+{
+ QFontMetrics fm = lb->fontMetrics();
+ int w = 2;
+ if ( pixmap() )
+ w += pixmap()->width() + 4;
+ else
+ w += 18;
+ w += fm.width( text() );
+ w += -fm.minLeftBearing();
+ w += -fm.minRightBearing();
+ w += 6;
+ return w;
+}
+
+
+void QFileDialogPrivate::MCItem::paint( QPainter * ptr )
+{
+ QFontMetrics fm = ptr->fontMetrics();
+
+ int h;
+
+ if ( pixmap() )
+ h = QMAX( fm.height(), pixmap()->height()) + 2;
+ else
+ h = fm.height() + 2;
+
+ const QPixmap * pm = pixmap();
+ if ( pm )
+ ptr->drawPixmap( 2, 1, *pm );
+
+ ptr->drawText( pm ? pm->width() + 4 : 22, h - fm.descent() - 2,
+ text() );
+}
+
+static QStringList makeFiltersList( const QString &filter )
+{
+ if ( filter.isEmpty() )
+ return QStringList();
+
+ int i = filter.find( ";;", 0 );
+ QString sep( ";;" );
+ if ( i == -1 ) {
+ if ( filter.find( "\n", 0 ) != -1 ) {
+ sep = "\n";
+ i = filter.find( sep, 0 );
+ }
+ }
+
+ return QStringList::split( sep, filter );
+}
+
+/*!
+ \class QFileDialogP qfiledialog.h
+ \brief The QFileDialogP class provides dialogs that allow users to select files or directories.
+ \ingroup dialogs
+ \mainclass
+
+ The QFileDialogP class enables a user to traverse their file system in
+ order to select one or many files or a directory.
+
+ The easiest way to create a QFileDialogP is to use the static
+ functions. On Windows, these static functions will call the native
+ Windows file dialog and on Mac OS X, these static function will call
+ the native Mac OS X file dialog.
+
+ \code
+ QString s = QFileDialogP::getOpenFileName(
+ "/home",
+ "Images (*.png *.xpm *.jpg)",
+ this,
+ "open file dialog"
+ "Choose a file" );
+ \endcode
+
+ In the above example, a modal QFileDialogP is created using a static
+ function. The startup directory is set to "/home". The file filter
+ is set to "Images (*.png *.xpm *.jpg)". The parent of the file dialog
+ is set to \e this and it is given the identification name - "open file
+ dialog". The caption at the top of file dialog is set to "Choose a
+ file".
+
+ You can create your own QFileDialogP without using the static
+ functions. By calling setMode(), you can set what can be returned by
+ the QFileDialogP.
+
+ \code
+ QFileDialogP* fd = new QFileDialogP( this, "file dialog", TRUE );
+ fd->setMode( QFileDialogP::AnyFile );
+ \endcode
+
+ In the above example, the mode of the file dialog is set to \c
+ AnyFile, meaning that the user can select any file, or even specify a
+ file that doesn't exist. This mode is useful for creating a "File Save
+ As" file dialog. Use \c ExistingFile if the user must select an
+ existing file or \c Directory if only a directory may be selected.
+ (See the \l QFileDialogP::Mode enum for the complete list of modes.)
+
+ You can retrieve the dialog's mode with mode(). Use setFilter() to set
+ the dialog's file filter, e.g.
+
+ \code
+ fd->setFilter( "Images (*.png *.xpm *.jpg)" );
+ \endcode
+
+ In the above example, the filter is set to "Images (*.png *.xpm
+ *.jpg)", this means that only files with the extension \c png, \c xpm
+ or \c jpg will be shown in the QFileDialogP. You can apply
+ several filters by using setFilters() and add additional filters with
+ addFilter(). Use setSelectedFilter() to select one of the filters
+ you've given as the file dialog's default filter. Whenever the user
+ changes the filter the filterSelected() signal is emitted.
+
+ The file dialog has two view modes, QFileDialogP::List which simply
+ lists file and directory names and QFileDialogP::Detail which
+ displays additional information alongside each name, e.g. file size,
+ modification date, etc. Set the mode with setViewMode().
+
+ \code
+ fd->setViewMode( QFileDialogP::Detail );
+ \endcode
+
+ The last important function you will need to use when creating your
+ own file dialog is selectedFile().
+
+ \code
+ QString fileName;
+ if ( fd->exec() == QDialog::Accepted )
+ fileName = fd->selectedFile();
+ \endcode
+
+ In the above example, a modal file dialog is created and shown. If
+ the user clicked OK, then the file they selected is put in \c
+ fileName.
+
+ If you are using the \c ExistingFiles mode then you will need to use
+ selectedFiles() which will return the selected files in a QStringList.
+
+ The dialog's working directory can be set with setDir(). The display
+ of hidden files is controlled with setShowHiddenFiles(). The dialog
+ can be forced to re-read the directory with rereadDir() and re-sort
+ the directory with resortDir(). All the files in the current directory
+ can be selected with selectAll().
+
+ \section1 Creating and using preview widgets
+
+ There are two kinds of preview widgets that can be used with
+ QFileDialogPs: \e content preview widgets and \e information preview
+ widgets. They are created and used in the same way except that the
+ function names differ, e.g. setContentsPreview() and setInfoPreview().
+
+ A preview widget is a widget that is placed inside a QFileDialogP so
+ that the user can see either the contents of the file, or information
+ about the file.
+
+ \code
+ class Preview : public QLabel, public QFilePreviewP
+ {
+ public:
+ Preview( QWidget *parent=0 ) : QLabel( parent ) {}
+
+ void previewUrl( const QUrl &u )
+ {
+ QString path = u.path();
+ QPixmap pix( path );
+ if ( pix.isNull() )
+ setText( "This is not a pixmap" );
+ else
+ setPixmap( pix );
+ }
+ };
+ \endcode
+
+ In the above snippet, we create a preview widget which inherits from
+ QLabel and QFilePreviewP. File preview widgets \e must inherit from
+ QFilePreviewP.
+
+ Inside the class we reimplement QFilePreviewP::previewUrl(), this is
+ where we determine what happens when a file is selected. In the
+ above example we only show a preview of the file if it is a valid
+ pixmap. Here's how to make a file dialog use a preview widget:
+
+ \code
+ Preview* p = new Preview;
+
+ QFileDialogP* fd = new QFileDialogP( this );
+ fd->setContentsPreviewEnabled( TRUE );
+ fd->setContentsPreview( p, p );
+ fd->setPreviewMode( QFileDialogP::Contents );
+ fd->show();
+ \endcode
+
+ The first line creates an instance of our preview widget. We then
+ create our file dialog and call setContentsPreviewEnabled( TRUE ),
+ this tell the file dialog to preview the contents of the currently
+ selected file. We then call setContentsPreview() -- note that we pass
+ the same preview widget twice. Finally, before showing the file
+ dialog, we call setPreviewMode() setting the mode to \e Contents which
+ will show the contents preview of the file that the user has selected.
+
+ If you create another preview widget that is used for displaying
+ information about a file, create it in the same way as the contents
+ preview widget and call setInfoPreviewEnabled(), and
+ setInfoPreview(). Then the user will be able to switch between the
+ two preview modes.
+
+ For more information about creating a QFilePreviewP widget see
+ \l{QFilePreviewP}.
+
+ <img src=qfiledlg-m.png> <img src=qfiledlg-w.png>
+
+*/
+
+
+/*! \enum QFileDialogP::Mode
+
+ This enum is used to indicate what the user may select in the file
+ dialog, i.e. what the dialog will return if the user clicks OK.
+
+ \value AnyFile The name of a file, whether it exists or not.
+ \value ExistingFile The name of a single existing file.
+ \value Directory The name of a directory. Both files and directories
+ are displayed.
+ \value DirectoryOnly The name of a directory. The file dialog will only display directories.
+ \value ExistingFiles The names of zero or more existing files.
+
+ See setMode().
+*/
+
+/*!
+ \enum QFileDialogP::ViewMode
+
+ This enum describes the view mode of the file dialog, i.e. what
+ information about each file will be displayed.
+
+ \value List Display file and directory names with icons.
+ \value Detail Display file and directory names with icons plus
+ additional information, such as file size and modification date.
+
+ See setViewMode().
+*/
+
+/*!
+ \enum QFileDialogP::PreviewMode
+
+ This enum describes the preview mode of the file dialog.
+
+ \value NoPreview No preview is shown at all.
+ \value Contents Show a preview of the contents of the current file
+ using the contents preview widget.
+ \value Info Show information about the current file using the
+ info preview widget.
+
+ See setPreviewMode(), setContentsPreview() and setInfoPreview().
+*/
+
+/*!
+ \fn void QFileDialogP::detailViewSelectionChanged()
+ \internal
+*/
+
+/*!
+ \fn void QFileDialogP::listBoxSelectionChanged()
+ \internal
+*/
+
+extern const char qt_file_dialog_filter_reg_exp[] =
+ "([a-zA-Z0-9 ]*)\\(([a-zA-Z0-9_.*? +;#\\[\\]]*)\\)$";
+
+/*!
+ Constructs a file dialog called \a name, with the parent, \a parent.
+ If \a modal is TRUE then the file dialog is modal; otherwise it is
+ modeless.
+*/
+
+QFileDialogP::QFileDialogP( QWidget *parent, const char *name, bool modal )
+ : QDialog( parent, name, modal,
+ (modal ?
+ (WStyle_Customize | WStyle_DialogBorder | WStyle_Title | WStyle_SysMenu) : 0) )
+{
+ init();
+ d->mode = ExistingFile;
+ d->types->insertItem( tr( "All Files (*)" ) );
+ emit dirEntered( d->url.dirPath() );
+ rereadDir();
+}
+
+
+/*!
+ Constructs a file dialog called \a name with the parent, \a parent.
+ If \a modal is TRUE then the file dialog is modal; otherwise it is
+ modeless.
+
+ If \a dirName is specified then it will be used as the dialog's
+ working directory, i.e. it will be the directory that is shown when
+ the dialog appears. If \a filter is specified it will be used as the
+ dialog's file filter.
+
+*/
+
+QFileDialogP::QFileDialogP( const QString& dirName, const QString & filter,
+ QWidget *parent, const char *name, bool modal )
+ : QDialog( parent, name, modal,
+ (modal ?
+ (WStyle_Customize | WStyle_DialogBorder | WStyle_Title | WStyle_SysMenu) : 0) )
+{
+ init();
+ d->mode = ExistingFile;
+ rereadDir();
+ if ( !dirName.isEmpty() )
+ setSelection( dirName );
+ else if ( workingDirectory && !workingDirectory->isEmpty() )
+ setDir( *workingDirectory );
+
+ if ( !filter.isEmpty() ) {
+ setFilters( filter );
+ if ( !dirName.isEmpty() ) {
+ int dotpos = dirName.find( QChar('.'), 0, FALSE );
+ if ( dotpos != -1 ) {
+ for ( int b=0 ; b<d->types->count() ; b++ ) {
+ if ( d->types->text(b).contains( dirName.right( dirName.length() - dotpos ) ) ) {
+ d->types->setCurrentItem( b );
+ setFilter( d->types->text( b ) );
+ return;
+ }
+ }
+ }
+ }
+ } else {
+ d->types->insertItem( tr( "All Files (*)" ) );
+ }
+}
+
+
+/*!
+ \internal
+ Initializes the file dialog.
+*/
+
+void QFileDialogP::init()
+{
+ setSizeGripEnabled( TRUE );
+ d = new QFileDialogPrivate();
+ d->mode = AnyFile;
+ d->last = 0;
+ d->moreFiles = 0;
+ d->infoPreview = FALSE;
+ d->contentsPreview = FALSE;
+ d->hadDotDot = FALSE;
+ d->ignoreNextKeyPress = FALSE;
+ d->progressDia = 0;
+ d->checkForFilter = FALSE;
+ d->ignoreReturn = FALSE;
+ d->ignoreNextRefresh = FALSE;
+ d->ignoreStop = FALSE;
+ d->pendingItems.setAutoDelete( FALSE );
+ d->mimeTypeTimer = new QTimer( this );
+ connect( d->mimeTypeTimer, SIGNAL( timeout() ),
+ this, SLOT( doMimeTypeLookup() ) );
+
+ d->url = QUrlOperator( QDir::currentDirPath() );
+ d->oldUrl = d->url;
+ d->currListChildren = 0;
+
+ connect( &d->url, SIGNAL( start( QNetworkOperation * ) ),
+ this, SLOT( urlStart( QNetworkOperation * ) ) );
+ connect( &d->url, SIGNAL( finished( QNetworkOperation * ) ),
+ this, SLOT( urlFinished( QNetworkOperation * ) ) );
+ connect( &d->url, SIGNAL( newChildren( const QValueList<QUrlInfo> &, QNetworkOperation * ) ),
+ this, SLOT( insertEntry( const QValueList<QUrlInfo> &, QNetworkOperation * ) ) );
+ connect( &d->url, SIGNAL( removed( QNetworkOperation * ) ),
+ this, SLOT( removeEntry( QNetworkOperation * ) ) );
+ connect( &d->url, SIGNAL( createdDirectory( const QUrlInfo &, QNetworkOperation * ) ),
+ this, SLOT( createdDirectory( const QUrlInfo &, QNetworkOperation * ) ) );
+ connect( &d->url, SIGNAL( itemChanged( QNetworkOperation * ) ),
+ this, SLOT( itemChanged( QNetworkOperation * ) ) );
+ connect( &d->url, SIGNAL( dataTransferProgress( int, int, QNetworkOperation * ) ),
+ this, SLOT( dataTransferProgress( int, int, QNetworkOperation * ) ) );
+
+ nameEdit = new QLineEdit( this, "name/filter editor" );
+ nameEdit->setMaxLength( 255 ); //_POSIX_MAX_PATH
+ connect( nameEdit, SIGNAL(textChanged(const QString&)),
+ this, SLOT(fileNameEditDone()) );
+ nameEdit->installEventFilter( this );
+
+ d->splitter = new QSplitter( this, "qt_splitter" );
+
+ d->stack = new QWidgetStack( d->splitter, "files and more files" );
+
+ d->splitter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+
+ files = new QFileDialogQFileListView( d->stack, this );
+ QFontMetrics fm = fontMetrics();
+ files->addColumn( tr("Name") );
+ files->addColumn( tr("Size") );
+ files->setColumnAlignment( 1, AlignRight );
+ files->addColumn( tr("Type") );
+ files->addColumn( tr("Date") );
+ files->addColumn( tr("Attributes") );
+ files->header()->setStretchEnabled( TRUE, 0 );
+
+ files->setMinimumSize( 50, 25 + 2*fm.lineSpacing() );
+
+ connect( files, SIGNAL( selectionChanged() ),
+ this, SLOT( detailViewSelectionChanged() ) );
+ connect( files, SIGNAL(currentChanged(QListViewItem *)),
+ this, SLOT(updateFileNameEdit(QListViewItem *)) );
+ connect( files, SIGNAL(doubleClicked(QListViewItem *)),
+ this, SLOT(selectDirectoryOrFile(QListViewItem *)) );
+ connect( files, SIGNAL(returnPressed(QListViewItem *)),
+ this, SLOT(selectDirectoryOrFile(QListViewItem *)) );
+ connect( files, SIGNAL(rightButtonPressed(QListViewItem *,
+ const QPoint &, int)),
+ this, SLOT(popupContextMenu(QListViewItem *,
+ const QPoint &, int)) );
+
+ files->installEventFilter( this );
+ files->viewport()->installEventFilter( this );
+
+ d->moreFiles = new QFileListBox( d->stack, this );
+ d->moreFiles->setRowMode( QListBox::FitToHeight );
+ d->moreFiles->setVariableWidth( TRUE );
+
+ connect( d->moreFiles, SIGNAL(selected(QListBoxItem *)),
+ this, SLOT(selectDirectoryOrFile(QListBoxItem *)) );
+ connect( d->moreFiles, SIGNAL( selectionChanged() ),
+ this, SLOT( listBoxSelectionChanged() ) );
+ connect( d->moreFiles, SIGNAL(highlighted(QListBoxItem *)),
+ this, SLOT(updateFileNameEdit(QListBoxItem *)) );
+ connect( d->moreFiles, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint & ) ),
+ this, SLOT( popupContextMenu( QListBoxItem *, const QPoint & ) ) );
+
+ d->moreFiles->installEventFilter( this );
+ d->moreFiles->viewport()->installEventFilter( this );
+
+ okB = new QPushButton( tr("OK"), this, "OK" ); //### Or "Save (see other "OK")
+ okB->setDefault( TRUE );
+ okB->setEnabled( FALSE );
+ connect( okB, SIGNAL(clicked()), this, SLOT(okClicked()) );
+ cancelB = new QPushButton( tr("Cancel") , this, "Cancel" );
+ connect( cancelB, SIGNAL(clicked()), this, SLOT(cancelClicked()) );
+
+ d->paths = new QComboBox( TRUE, this, "directory history/editor" );
+ d->paths->setDuplicatesEnabled( FALSE );
+ d->paths->setInsertionPolicy( QComboBox::NoInsertion );
+ const QFileInfoList * rootDrives = QDir::drives();
+ QFileInfoListIterator it( *rootDrives );
+ QFileInfo *fi;
+ makeVariables();
+
+ while ( (fi = it.current()) != 0 ) {
+ ++it;
+ d->paths->insertItem( *openFolderIcon, fi->absFilePath() );
+ }
+
+ if ( !!QDir::homeDirPath() ) {
+ if ( !d->paths->listBox()->findItem( QDir::homeDirPath() ) )
+ d->paths->insertItem( *openFolderIcon, QDir::homeDirPath() );
+ }
+
+ connect( d->paths, SIGNAL(activated(const QString&)),
+ this, SLOT(setDir(const QString&)) );
+
+ d->paths->installEventFilter( this );
+ QObjectList *ol = d->paths->queryList( "QLineEdit" );
+ if ( ol && ol->first() )
+ ( (QLineEdit*)ol->first() )->installEventFilter( this );
+ delete ol;
+
+ d->geometryDirty = TRUE;
+ d->types = new QComboBox( TRUE, this, "file types" );
+ d->types->setDuplicatesEnabled( FALSE );
+ d->types->setEditable( FALSE );
+ connect( d->types, SIGNAL(activated(const QString&)),
+ this, SLOT(setFilter(const QString&)) );
+ connect( d->types, SIGNAL(activated(const QString&)),
+ this, SIGNAL(filterSelected(const QString&)) );
+
+ d->pathL = new QLabel( d->paths, tr("Look &in:"), this, "qt_looin_lbl" );
+ d->fileL = new QLabel( nameEdit, tr("File &name:"), this, "qt_filename_lbl" );
+ d->typeL = new QLabel( d->types, tr("File &type:"), this, "qt_filetype_lbl" );
+
+#if defined(Q_WS_WIN)
+ if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP ) {
+ d->goBack = new QToolButton( this, "go back" );
+ d->goBack->setAutoRaise( TRUE );
+ d->goBack->setEnabled( FALSE );
+ d->goBack->setFocusPolicy( TabFocus );
+ connect( d->goBack, SIGNAL( clicked() ),
+ this, SLOT( goBack() ) );
+ QToolTip::add( d->goBack, tr( "Back" ) );
+ d->goBack->setIconSet( *goBackIcon );
+ } else {
+ d->goBack = 0;
+ }
+#else
+ d->goBack = 0;
+#endif
+
+ d->cdToParent = new QToolButton( this, "cd to parent" );
+#if defined(Q_WS_WIN)
+ if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
+ d->cdToParent->setAutoRaise( TRUE );
+#endif
+ d->cdToParent->setFocusPolicy( TabFocus );
+#ifndef QT_NO_TOOLTIP
+ QToolTip::add( d->cdToParent, tr( "One directory up" ) );
+#endif
+ d->cdToParent->setIconSet( *cdToParentIcon );
+ connect( d->cdToParent, SIGNAL(clicked()),
+ this, SLOT(cdUpClicked()) );
+
+ d->newFolder = new QToolButton( this, "new folder" );
+#if defined(Q_WS_WIN)
+ if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
+ d->newFolder->setAutoRaise( TRUE );
+#endif
+ d->newFolder->setFocusPolicy( TabFocus );
+#ifndef QT_NO_TOOLTIP
+ QToolTip::add( d->newFolder, tr( "Create New Folder" ) );
+#endif
+ d->newFolder->setIconSet( *newFolderIcon );
+ connect( d->newFolder, SIGNAL(clicked()),
+ this, SLOT(newFolderClicked()) );
+
+ d->modeButtons = new QButtonGroup( 0, "invisible group" );
+ connect( d->modeButtons, SIGNAL(destroyed()),
+ this, SLOT(modeButtonsDestroyed()) );
+ d->modeButtons->setExclusive( TRUE );
+ connect( d->modeButtons, SIGNAL(clicked(int)),
+ d->stack, SLOT(raiseWidget(int)) );
+ connect( d->modeButtons, SIGNAL(clicked(int)),
+ this, SLOT(changeMode(int)) );
+
+ d->mcView = new QToolButton( this, "mclistbox view" );
+#if defined(Q_WS_WIN)
+ if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
+ d->mcView->setAutoRaise( TRUE );
+#endif
+ d->mcView->setFocusPolicy( TabFocus );
+#ifndef QT_NO_TOOLTIP
+ QToolTip::add( d->mcView, tr( "List View" ) );
+#endif
+ d->mcView->setIconSet( *multiColumnListViewIcon );
+ d->mcView->setToggleButton( TRUE );
+ d->stack->addWidget( d->moreFiles, d->modeButtons->insert( d->mcView ) );
+ d->detailView = new QToolButton( this, "list view" );
+#if defined(Q_WS_WIN)
+ if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
+ d->detailView->setAutoRaise( TRUE );
+#endif
+ d->detailView->setFocusPolicy( TabFocus );
+#ifndef QT_NO_TOOLTIP
+ QToolTip::add( d->detailView, tr( "Detail View" ) );
+#endif
+ d->detailView->setIconSet( *detailViewIcon );
+ d->detailView->setToggleButton( TRUE );
+ d->stack->addWidget( files, d->modeButtons->insert( d->detailView ) );
+
+ d->previewInfo = new QToolButton( this, "preview info view" );
+#if defined(Q_WS_WIN)
+ if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
+ d->previewInfo->setAutoRaise( TRUE );
+#endif
+ d->previewInfo->setFocusPolicy( TabFocus );
+#ifndef QT_NO_TOOLTIP
+ QToolTip::add( d->previewInfo, tr( "Preview File Info" ) );
+#endif
+ d->previewInfo->setIconSet( *previewInfoViewIcon );
+ d->previewInfo->setToggleButton( TRUE );
+ d->modeButtons->insert( d->previewInfo );
+
+ d->previewContents = new QToolButton( this, "preview info view" );
+#if defined(Q_WS_WIN)
+ if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
+ d->previewContents->setAutoRaise( TRUE );
+#endif
+ d->previewContents->setFocusPolicy( TabFocus );
+#ifndef QT_NO_TOOLTIP
+ QToolTip::add( d->previewContents, tr( "Preview File Contents" ) );
+#endif
+ d->previewContents->setIconSet( *previewContentsViewIcon );
+ d->previewContents->setToggleButton( TRUE );
+ d->modeButtons->insert( d->previewContents );
+
+ connect( d->detailView, SIGNAL( clicked() ),
+ d->moreFiles, SLOT( cancelRename() ) );
+ connect( d->detailView, SIGNAL( clicked() ),
+ files, SLOT( cancelRename() ) );
+ connect( d->mcView, SIGNAL( clicked() ),
+ d->moreFiles, SLOT( cancelRename() ) );
+ connect( d->mcView, SIGNAL( clicked() ),
+ files, SLOT( cancelRename() ) );
+
+ d->stack->raiseWidget( d->moreFiles );
+ d->mcView->setOn( TRUE );
+
+ QHBoxLayout *lay = new QHBoxLayout( this );
+ lay->setMargin( 6 );
+ d->leftLayout = new QHBoxLayout( lay, 5 );
+ d->topLevelLayout = new QVBoxLayout( (QWidget*)0, 5 );
+ lay->addLayout( d->topLevelLayout, 1 );
+ d->extraWidgetsLayouts.setAutoDelete( FALSE );
+ d->extraLabels.setAutoDelete( FALSE );
+ d->extraWidgets.setAutoDelete( FALSE );
+ d->extraButtons.setAutoDelete( FALSE );
+ d->toolButtons.setAutoDelete( FALSE );
+
+ QHBoxLayout * h;
+
+ d->preview = new QWidgetStack( d->splitter, "qt_preview" );
+
+ d->infoPreviewWidget = new QWidget( d->preview, "qt_preview_info" );
+ d->contentsPreviewWidget = new QWidget( d->preview, "qt_preview_contents" );
+ d->infoPreviewer = d->contentsPreviewer = 0;
+
+ h = new QHBoxLayout( 0 );
+ d->buttonLayout = h;
+ d->topLevelLayout->addLayout( h );
+ h->addWidget( d->pathL );
+ h->addSpacing( 8 );
+ h->addWidget( d->paths );
+ h->addSpacing( 8 );
+ if ( d->goBack )
+ h->addWidget( d->goBack );
+ h->addWidget( d->cdToParent );
+ h->addSpacing( 2 );
+ h->addWidget( d->newFolder );
+ h->addSpacing( 4 );
+ h->addWidget( d->mcView );
+ h->addWidget( d->detailView );
+ h->addWidget( d->previewInfo );
+ h->addWidget( d->previewContents );
+
+ d->topLevelLayout->addWidget( d->splitter );
+
+ h = new QHBoxLayout();
+ d->topLevelLayout->addLayout( h );
+ h->addWidget( d->fileL );
+ h->addWidget( nameEdit );
+ h->addSpacing( 15 );
+ h->addWidget( okB );
+
+ h = new QHBoxLayout();
+ d->topLevelLayout->addLayout( h );
+ h->addWidget( d->typeL );
+ h->addWidget( d->types );
+ h->addSpacing( 15 );
+ h->addWidget( cancelB );
+
+ d->rightLayout = new QHBoxLayout( lay, 5 );
+ d->topLevelLayout->setStretchFactor( d->mcView, 1 );
+ d->topLevelLayout->setStretchFactor( files, 1 );
+
+ updateGeometries();
+
+ if ( d->goBack ) {
+ setTabOrder( d->paths, d->goBack );
+ setTabOrder( d->goBack, d->cdToParent );
+ } else {
+ setTabOrder( d->paths, d->cdToParent );
+ }
+ setTabOrder( d->cdToParent, d->newFolder );
+ setTabOrder( d->newFolder, d->mcView );
+ setTabOrder( d->mcView, d->detailView );
+ setTabOrder( d->detailView, d->moreFiles );
+ setTabOrder( d->moreFiles, files );
+ setTabOrder( files, nameEdit );
+ setTabOrder( nameEdit, d->types );
+ setTabOrder( d->types, okB );
+ setTabOrder( okB, cancelB );
+
+ d->rw = tr( "Read-write" );
+ d->ro = tr( "Read-only" );
+ d->wo = tr( "Write-only" );
+ d->inaccessible = tr( "Inaccessible" );
+
+ d->symLinkToFile = tr( "Symlink to File" );
+ d->symLinkToDir = tr( "Symlink to Directory" );
+ d->symLinkToSpecial = tr( "Symlink to Special" );
+ d->file = tr( "File" );
+ d->dir = tr( "Dir" );
+ d->special = tr( "Special" );
+
+ if ( !lastSize ) {
+ QRect screen = QApplication::desktop()->screenGeometry( QApplication::desktop()->screenNumber( pos() ) );
+ if ( screen.width() < 1024 ||
+ screen.height() < 768 ) {
+ resize( QMIN(screen.width(),420),
+ QMIN(screen.height(),236) );
+ } else {
+ QSize s( files->sizeHint() );
+ s = QSize( s.width() + 300, s.height() + 82 );
+
+ if ( s.width() * 3 > screen.width() * 2 )
+ s.setWidth( screen.width() * 2 / 3 );
+
+ if ( s.height() * 3 > screen.height() * 2 )
+ s.setHeight( screen.height() * 2 / 3 );
+ else if ( s.height() * 3 < screen.height() )
+ s.setHeight( screen.height() / 3 );
+
+ resize( s );
+ }
+ lastSize = new QSize;
+ qfd_cleanup_size.add( &lastSize );
+ *lastSize = size();
+ } else
+ resize( *lastSize );
+
+ if ( detailViewMode ) {
+ d->stack->raiseWidget( files );
+ d->mcView->setOn( FALSE );
+ d->detailView->setOn( TRUE );
+ }
+
+ d->preview->hide();
+ nameEdit->setFocus();
+
+ connect( nameEdit, SIGNAL( returnPressed() ),
+ this, SLOT( fileNameEditReturnPressed() ) );
+}
+
+/*!
+ \internal
+*/
+
+void QFileDialogP::fileNameEditReturnPressed()
+{
+ d->oldUrl = d->url;
+ if ( !isDirectoryMode( d->mode ) ) {
+ okClicked();
+ } else {
+ d->currentFileName = QString::null;
+ if ( nameEdit->text().isEmpty() ) {
+ emit fileSelected( selectedFile() );
+ accept();
+ } else {
+ QUrlInfo f;
+ QFileDialogPrivate::File * c
+ = (QFileDialogPrivate::File *)files->currentItem();
+ if ( c && files->isSelected(c) )
+ f = c->info;
+ else
+ f = QUrlInfo( d->url, nameEdit->text() );
+ if ( f.isDir() ) {
+ setUrl( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text() + "/" ) ) );
+ d->checkForFilter = TRUE;
+ trySetSelection( TRUE, d->url, TRUE );
+ d->checkForFilter = FALSE;
+ }
+ }
+ nameEdit->setText( QString::null );
+ d->ignoreReturn = TRUE;
+ }
+}
+
+/*!
+ \internal
+ Changes the preview mode to the mode specified at \a id.
+*/
+
+void QFileDialogP::changeMode( int id )
+{
+ if ( !d->infoPreview && !d->contentsPreview )
+ return;
+
+ QButton *btn = (QButton*)d->modeButtons->find( id );
+ if ( !btn )
+ return;
+
+ if ( btn == d->previewContents && !d->contentsPreview )
+ return;
+ if ( btn == d->previewInfo && !d->infoPreview )
+ return;
+
+ if ( btn != d->previewContents && btn != d->previewInfo ) {
+ d->preview->hide();
+ } else {
+ if ( files->currentItem() ) {
+ if ( d->infoPreviewer )
+ d->infoPreviewer->previewUrl( QUrl( d->url, files->currentItem()->text( 0 ) ) );
+ if ( d->contentsPreviewer )
+ d->contentsPreviewer->previewUrl( QUrl( d->url, files->currentItem()->text( 0 ) ) );
+ }
+ if ( btn == d->previewInfo )
+ d->preview->raiseWidget( d->infoPreviewWidget );
+ else
+ d->preview->raiseWidget( d->contentsPreviewWidget );
+ d->preview->show();
+ }
+}
+
+/*!
+ Destroys the file dialog.
+*/
+
+QFileDialogP::~QFileDialogP()
+{
+ // since clear might call setContentsPos which would emit
+ // a signal and thus cause a recompute of sizes...
+ files->blockSignals( TRUE );
+ d->moreFiles->blockSignals( TRUE );
+ files->clear();
+ d->moreFiles->clear();
+ d->moreFiles->blockSignals( FALSE );
+ files->blockSignals( FALSE );
+ if ( QApplication::overrideCursor() )
+ QApplication::restoreOverrideCursor();
+ delete d;
+ d = 0;
+}
+
+
+/*!
+ \property QFileDialogP::selectedFile
+
+ \brief the name of the selected file
+
+ If a file was selected selectedFile contains the file's name including
+ its absolute path; otherwise selectedFile is empty.
+
+ \sa QString::isEmpty(), selectedFiles, selectedFilter
+*/
+
+QString QFileDialogP::selectedFile() const
+{
+ QString s = d->currentFileName;
+ // remove the protocol because we do not want to encode it...
+ QString prot = QUrl( s ).protocol();
+ if ( !prot.isEmpty() ) {
+ prot += ":";
+ s.remove( 0, prot.length() );
+ }
+ QUrl u( prot + QFileDialogPrivate::encodeFileName( s ) );
+ if ( u.isLocalFile() ) {
+ QString s = u.toString();
+ if ( s.left( 5 ) == "file:" )
+ s.remove( 0, 5 );
+ return s;
+ }
+ return d->currentFileName;
+}
+
+/*!
+ \property QFileDialogP::selectedFilter
+
+ \brief the filter which the user has selected in the file dialog
+
+ \sa filterSelected(), selectedFiles, selectedFile
+*/
+
+QString QFileDialogP::selectedFilter() const
+{
+ return d->types->currentText();
+}
+
+/*! \overload
+
+ Sets the current filter selected in the file dialog to the
+ \a{n}-th filter in the filter list.
+
+ \sa filterSelected(), selectedFilter(), selectedFiles(), selectedFile()
+*/
+
+void QFileDialogP::setSelectedFilter( int n )
+{
+ d->types->setCurrentItem( n );
+ QString f = d->types->currentText();
+ QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
+ int index = r.search( f );
+ if ( index >= 0 )
+ f = r.cap( 2 );
+ d->url.setNameFilter( f );
+ rereadDir();
+}
+
+/*!
+ Sets the current filter selected in the file dialog to the first
+ one that contains the text \a mask.
+*/
+
+void QFileDialogP::setSelectedFilter( const QString& mask )
+{
+ int n;
+
+ for ( n = 0; n < d->types->count(); n++ ) {
+ if ( d->types->text( n ).contains( mask, FALSE ) ) {
+ d->types->setCurrentItem( n );
+ QString f = mask;
+ QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
+ int index = r.search( f );
+ if ( index >= 0 )
+ f = r.cap( 2 );
+ d->url.setNameFilter( f );
+ rereadDir();
+ return;
+ }
+ }
+}
+
+/*!
+ \property QFileDialogP::selectedFiles
+
+ \brief the list of selected files
+
+ If one or more files are selected, selectedFiles contains their
+ names including their absolute paths. If no files are selected or
+ the mode isn't ExistingFiles selectedFiles is an empty list.
+
+ It is more convenient to use selectedFile() if the mode is
+ \c ExistingFile, \c Directory or \c DirectoryOnly.
+
+ Note that if you want to iterate over the list, you should
+ iterate over a copy, e.g.
+ \code
+ QStringList list = myFileDialog.selectedFiles();
+ QStringList::Iterator it = list.begin();
+ while( it != list.end() ) {
+ myProcessing( *it );
+ ++it;
+ }
+ \endcode
+
+ \sa selectedFile, selectedFilter, QValueList::empty()
+*/
+
+QStringList QFileDialogP::selectedFiles() const
+{
+ QStringList lst;
+
+ if ( mode() == ExistingFiles ) {
+ QStringList selectedLst;
+ QString selectedFiles = nameEdit->text();
+ selectedFiles.truncate( selectedFiles.findRev( '\"' ) );
+ selectedLst = selectedLst.split( QString("\" "), selectedFiles );
+ for ( QStringList::Iterator it = selectedLst.begin(); it != selectedLst.end(); ++it ) {
+ QUrl u;
+ if ( (*it)[0] == '\"' ) {
+ u = QUrl( d->url, QFileDialogPrivate::encodeFileName( (*it).mid(1) ) );
+ } else {
+ u = QUrl( d->url, QFileDialogPrivate::encodeFileName( (*it) ) );
+ }
+ if ( u.isLocalFile() ) {
+ QString s = u.toString();
+ if ( s.left( 5 ) == "file:" )
+ s.remove( 0, 5 );
+ lst << s;
+ } else {
+ lst << u.toString();
+ }
+ }
+ }
+
+ return lst;
+}
+
+/*!
+ Sets the default selection to \a filename. If \a filename is
+ absolute, setDir() is also called to set the file dialog's working
+ directory to the filename's directory.
+
+ \omit
+ Only for external use. Not useful inside QFileDialogP.
+ \endomit
+*/
+
+void QFileDialogP::setSelection( const QString & filename )
+{
+ d->oldUrl = d->url;
+ QString nf = d->url.nameFilter();
+ if ( QUrl::isRelativeUrl( filename ) )
+ d->url = QUrlOperator( d->url, QFileDialogPrivate::encodeFileName( filename ) );
+ else
+ d->url = QUrlOperator( filename );
+ d->url.setNameFilter( nf );
+ d->checkForFilter = TRUE;
+ bool isDirOk;
+ bool isDir = d->url.isDir( &isDirOk );
+ if ( !isDirOk )
+ isDir = d->url.path().right( 1 ) == "/";
+ if ( !isDir ) {
+ QUrlOperator u( d->url );
+ d->url.setPath( d->url.dirPath() );
+ trySetSelection( FALSE, u, TRUE );
+ d->ignoreNextRefresh = TRUE;
+ nameEdit->selectAll();
+ rereadDir();
+ emit dirEntered( d->url.dirPath() );
+ } else {
+ if ( !d->url.path().isEmpty() &&
+ d->url.path().right( 1 ) != "/" ) {
+ QString p = d->url.path();
+ p += "/";
+ d->url.setPath( p );
+ }
+ trySetSelection( TRUE, d->url, FALSE );
+ rereadDir();
+ emit dirEntered( d->url.dirPath() );
+ nameEdit->setText( QString::fromLatin1("") );
+ }
+ d->checkForFilter = FALSE;
+}
+
+/*!
+ \property QFileDialogP::dirPath
+
+ \brief the file dialog's working directory
+
+ \sa dir(), setDir()
+*/
+
+QString QFileDialogP::dirPath() const
+{
+ return d->url.dirPath();
+}
+
+
+/*!
+
+ Sets the filter used in the file dialog to \a newFilter.
+
+ If \a newFilter contains a pair of parentheses containing one or more
+ of <em><b>anything*something</b></em> separated by spaces or by
+ semi-colons then only the text contained in the parentheses is used as
+ the filter. This means that these calls are all equivalent:
+
+ \code
+ fd->setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" );
+ fd->setFilter( "*.cpp *.cc *.C *.cxx *.c++" );
+ fd->setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" );
+ fd->setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );
+ \endcode
+
+ \sa setFilters()
+*/
+
+void QFileDialogP::setFilter( const QString & newFilter )
+{
+ if ( newFilter.isEmpty() )
+ return;
+ QString f = newFilter;
+ QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
+ int index = r.search( f );
+ if ( index >= 0 )
+ f = r.cap( 2 );
+ d->url.setNameFilter( f );
+ if ( d->types->count() == 1 ) {
+ d->types->clear();
+ d->types->insertItem( newFilter );
+ } else {
+ for ( int i = 0; i < d->types->count(); ++i ) {
+ if ( d->types->text( i ).left( newFilter.length() ) == newFilter ) {
+ d->types->setCurrentItem( i );
+ break;
+ }
+ }
+ }
+ rereadDir();
+}
+
+
+/*! \overload
+ Sets the file dialog's working directory to \a pathstr.
+
+ \sa dir()
+*/
+
+void QFileDialogP::setDir( const QString & pathstr )
+{
+ QString dr = pathstr;
+ if ( dr.isEmpty() )
+ return;
+
+#if defined(Q_OS_UNIX)
+ if ( dr.length() && dr[0] == '~' ) {
+ struct passwd *pw;
+ int i;
+
+ i = 0;
+ while( i < (int)dr.length() && dr[i] != '/' )
+ i++;
+ QCString user;
+ if ( i == 1 ) {
+ user = ::getlogin();
+ if ( !user )
+ user = getenv( "LOGNAME" );
+ } else
+ user = dr.mid( 1, i-1 ).local8Bit();
+ dr = dr.mid( i, dr.length() );
+ pw = ::getpwnam( user );
+ if ( pw )
+ dr.prepend( QString::fromLocal8Bit(pw->pw_dir) );
+ }
+#endif
+
+ setUrl( dr );
+}
+
+/*!
+ Returns the current directory shown in the file dialog.
+
+ The ownership of the QDir pointer is transferred to the caller, so
+ it must be deleted by the caller when no longer required.
+
+ \sa setDir()
+*/
+
+const QDir *QFileDialogP::dir() const
+{
+ if ( d->url.isLocalFile() )
+ return new QDir( d->url.path() );
+ else
+ return 0;
+}
+
+/*!
+ Sets the file dialog's working directory to \a dir.
+ \sa dir()
+*/
+
+void QFileDialogP::setDir( const QDir &dir )
+{
+ d->oldUrl = d->url;
+ QString nf( d->url.nameFilter() );
+ d->url = dir.canonicalPath();
+ d->url.setNameFilter( nf );
+ QUrlInfo i( d->url, nameEdit->text() );
+ d->checkForFilter = TRUE;
+ trySetSelection( i.isDir(), QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text() ) ), FALSE );
+ d->checkForFilter = FALSE;
+ rereadDir();
+ emit dirEntered( d->url.path() );
+}
+
+/*!
+ Sets the file dialog's working directory to the directory specified at \a url.
+
+ \sa url()
+*/
+
+void QFileDialogP::setUrl( const QUrlOperator &url )
+{
+ QString nf = d->url.nameFilter();
+
+ d->url = QUrl( d->url, url.toString( FALSE, FALSE ) );
+ d->url.setNameFilter( nf );
+
+ d->checkForFilter = TRUE;
+ if ( !d->url.isDir() ) {
+ QUrlOperator u = d->url;
+ d->url.setPath( d->url.dirPath() );
+ trySetSelection( FALSE, u, FALSE );
+ rereadDir();
+ emit dirEntered( d->url.dirPath() );
+ QString fn = u.fileName();
+ nameEdit->setText( fn );
+ } else {
+ trySetSelection( TRUE, d->url, FALSE );
+ rereadDir();
+ emit dirEntered( d->url.dirPath() );
+ }
+ d->checkForFilter = FALSE;
+}
+
+/*!
+ \property QFileDialogP::showHiddenFiles
+
+ \brief whether hidden files are shown in the file dialog
+
+ The default is FALSE, i.e. don't show hidden files.
+*/
+
+void QFileDialogP::setShowHiddenFiles( bool s )
+{
+ if ( s == bShowHiddenFiles )
+ return;
+
+ bShowHiddenFiles = s;
+ rereadDir();
+}
+
+bool QFileDialogP::showHiddenFiles() const
+{
+ return bShowHiddenFiles;
+}
+
+/*!
+ Rereads the current directory shown in the file dialog.
+
+ The only time you will need to call this function is if the contents of
+ the directory change and you wish to refresh the file dialog to reflect
+ the change.
+
+ \sa resortDir()
+*/
+
+void QFileDialogP::rereadDir()
+{
+ if ( !QApplication::overrideCursor() )
+ QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
+ d->pendingItems.clear();
+ if ( d->mimeTypeTimer->isActive() )
+ d->mimeTypeTimer->stop();
+ d->currListChildren = d->url.listChildren();
+}
+
+
+/*!
+ \fn void QFileDialogP::fileHighlighted( const QString& )
+
+ This signal is emitted when the user highlights a file.
+
+ \sa fileSelected(), filesSelected()
+*/
+
+/*!
+ \fn void QFileDialogP::fileSelected( const QString& )
+
+ This signal is emitted when the user selects a file.
+
+ \sa filesSelected(), fileHighlighted(), selectedFile()
+*/
+
+/*!
+ \fn void QFileDialogP::filesSelected( const QStringList& )
+
+ This signal is emitted when the user selects one or more files in \e
+ ExistingFiles mode.
+
+ \sa fileSelected(), fileHighlighted(), selectedFiles()
+*/
+
+/*!
+ \fn void QFileDialogP::dirEntered( const QString& )
+
+ This signal is emitted when the user enters a directory.
+
+ \sa dir()
+*/
+
+/*!
+ \fn void QFileDialogP::filterSelected( const QString& )
+
+ This signal is emitted when the user selects a filter.
+
+ \sa selectedFilter()
+*/
+
+extern bool qt_resolve_symlinks; // defined in qapplication.cpp
+
+/*!
+ This is a convenience static function that returns an existing file
+ selected by the user. If the user pressed Cancel, it returns a null
+ string.
+
+ \code
+ QString s = QFileDialogP::getOpenFileName(
+ "/home",
+ "Images (*.png *.xpm *.jpg)",
+ this,
+ "open file dialog",
+ "Choose a file to open" );
+ \endcode
+
+ The function creates a modal file dialog called \a name, with
+ parent, \a parent. If a parent is not 0, the dialog will be shown
+ centered over the parent.
+
+ The file dialog's working directory will be set to \a startWith. If \a
+ startWith includes a file name, the file will be selected. The filter
+ is set to \a filter so that only those files which match the filter
+ are shown. The filter selected is set to \a selectedFilter. The parameters
+ \a startWith, \a selectedFilter and \a filter may be QString::null.
+
+ The dialog's caption is set to \a caption. If \a caption is not
+ specified then a default caption will be used.
+
+ Under Windows and Mac OS X, this static function will use the native
+ file dialog and not a QFileDialogP, unless the style of the application
+ is set to something other than the native style.
+
+ Under Unix/X11, the normal behavior of the file dialog is to resolve
+ and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
+ the file dialog will change to /var/tmp after entering /usr/tmp.
+ If \a resolveSymlinks is FALSE, the file dialog will treat
+ symlinks as regular directories.
+
+ \sa getOpenFileNames(), getSaveFileName(), getExistingDirectory()
+*/
+
+QString QFileDialogP::getOpenFileName( const QString & startWith,
+ const QString& filter,
+ QWidget *parent, const char* name,
+ const QString& caption,
+ QString *selectedFilter,
+ bool resolveSymlinks )
+{
+ bool save_qt_resolve_symlinks = qt_resolve_symlinks;
+ qt_resolve_symlinks = resolveSymlinks;
+
+ QStringList filters;
+ if ( !filter.isEmpty() )
+ filters = makeFiltersList( filter );
+
+ makeVariables();
+ QString initialSelection;
+ //### Problem with the logic here: If a startWith is given and a file
+ // with that name exists in D->URL, the box will be opened at D->URL instead of
+ // the last directory used ('workingDirectory').
+ //
+ // hm... isn't that problem exactly the documented behaviour? the
+ // documented behaviour sounds meaningful.
+ if ( !startWith.isEmpty() ) {
+ QUrlOperator u( startWith );
+ if ( u.isLocalFile() && QFileInfo( u.path() ).isDir() ) {
+ *workingDirectory = startWith;
+ } else {
+ if ( u.isLocalFile() ) {
+ QFileInfo fi( u.dirPath() );
+ if ( fi.exists() ) {
+ *workingDirectory = u.dirPath();
+ initialSelection = u.fileName();
+ }
+ } else {
+ *workingDirectory = u.toString();
+ initialSelection = QString::null;//u.fileName();
+ }
+ }
+ }
+
+ if ( workingDirectory->isNull() )
+ *workingDirectory = QDir::currentDirPath();
+
+#if defined(Q_WS_WIN)
+ if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle )
+ return winGetOpenFileName( initialSelection, filter, workingDirectory,
+ parent, name, caption, selectedFilter );
+#elif defined(Q_WS_MAC)
+ if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) ) {
+ QString f = macGetOpenFileNames(filter, workingDirectory,
+ parent, name, caption, FALSE).first();
+ return f;
+ }
+#endif
+
+ QFileDialogP *dlg = new QFileDialogP( *workingDirectory, QString::null, parent, name ? name : "qt_filedlg_gofn", TRUE );
+
+#ifndef QT_NO_WIDGET_TOPEXTRA
+ if ( parent && parent->icon() && !parent->icon()->isNull() )
+ dlg->setIcon( *parent->icon() );
+ else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
+ dlg->setIcon( *qApp->mainWidget()->icon() );
+
+ if ( !caption.isNull() )
+ dlg->setCaption( caption );
+ else
+ dlg->setCaption( QFileDialogP::tr( "Open" ) );
+#endif
+
+ dlg->setFilters( filters );
+ if ( selectedFilter )
+ dlg->setFilter( *selectedFilter );
+ dlg->setMode( QFileDialogP::ExistingFile );
+ QString result;
+ if ( !initialSelection.isEmpty() )
+ dlg->setSelection( initialSelection );
+ if ( dlg->exec() == QDialog::Accepted ) {
+ result = dlg->selectedFile();
+ *workingDirectory = dlg->d->url;
+ if ( selectedFilter )
+ *selectedFilter = dlg->selectedFilter();
+ }
+ delete dlg;
+
+ qt_resolve_symlinks = save_qt_resolve_symlinks;
+
+ return result;
+}
+
+/*!
+ This is a convenience static function that will return a file name
+ selected by the user. The file does not have to exist.
+
+ It creates a modal file dialog called \a name, with parent, \a parent.
+ If a parent is not 0, the dialog will be shown centered over the
+ parent.
+
+ \code
+ QString s = QFileDialogP::getSaveFileName(
+ "/home",
+ "Images (*.png *.xpm *.jpg)",
+ this,
+ "save file dialog"
+ "Choose a filename to save under" );
+ \endcode
+
+ The file dialog's working directory will be set to \a startWith. If \a
+ startWith includes a file name, the file will be selected. The filter
+ is set to \a filter so that only those files which match the filter
+ are shown. The filter selected is set to \a selectedFilter. The parameters
+ \a startWith, \a selectedFilter and \a filter may be QString::null.
+
+ The dialog's caption is set to \a caption. If \a caption is not
+ specified then a default caption will be used.
+
+ Under Windows and Mac OS X, this static function will use the native
+ file dialog and not a QFileDialogP, unless the style of the application
+ is set to something other than the native style.
+
+ Under Unix/X11, the normal behavior of the file dialog is to resolve
+ and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
+ the file dialog will change to /var/tmp after entering /usr/tmp.
+ If \a resolveSymlinks is FALSE, the file dialog will treat
+ symlinks as regular directories.
+
+ \sa getOpenFileName(), getOpenFileNames(), getExistingDirectory()
+*/
+
+QString QFileDialogP::getSaveFileName( const QString & startWith,
+ const QString& filter,
+ QWidget *parent, const char* name,
+ const QString& caption,
+ QString *selectedFilter,
+ bool resolveSymlinks)
+{
+ bool save_qt_resolve_symlinks = qt_resolve_symlinks;
+ qt_resolve_symlinks = resolveSymlinks;
+
+ QStringList filters;
+ if ( !filter.isEmpty() )
+ filters = makeFiltersList( filter );
+
+ makeVariables();
+ QString initialSelection;
+ if ( !startWith.isEmpty() ) {
+ QUrlOperator u( startWith );
+ if ( u.isLocalFile() && QFileInfo( u.path() ).isDir() ) {
+ *workingDirectory = startWith;
+ } else {
+ if ( u.isLocalFile() ) {
+ QFileInfo fi( u.dirPath() );
+ if ( fi.exists() ) {
+ *workingDirectory = u.dirPath();
+ initialSelection = u.fileName();
+ }
+ } else {
+ *workingDirectory = u.toString();
+ initialSelection = QString::null;//u.fileName();
+ }
+ }
+ }
+
+ if ( workingDirectory->isNull() )
+ *workingDirectory = QDir::currentDirPath();
+
+#if defined(Q_WS_WIN)
+ if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle )
+ return winGetSaveFileName( initialSelection, filter, workingDirectory,
+ parent, name, caption, selectedFilter );
+#elif defined(Q_WS_MAC)
+ if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) )
+ return macGetSaveFileName( initialSelection, filter, workingDirectory,
+ parent, name, caption );
+#endif
+
+ QFileDialogP *dlg = new QFileDialogP( *workingDirectory, QString::null, parent, name ? name : "qt_filedlg_gsfn", TRUE );
+
+ Q_CHECK_PTR( dlg );
+#ifndef QT_NO_WIDGET_TOPEXTRA
+ if ( parent && parent->icon() && !parent->icon()->isNull() )
+ dlg->setIcon( *parent->icon() );
+ else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
+ dlg->setIcon( *qApp->mainWidget()->icon() );
+
+ if ( !caption.isNull() )
+ dlg->setCaption( caption );
+ else
+ dlg->setCaption( QFileDialogP::tr( "Save As" ) );
+#endif
+
+ QString result;
+ dlg->setFilters( filters );
+ if ( selectedFilter )
+ dlg->setFilter( *selectedFilter );
+ dlg->setMode( QFileDialogP::AnyFile );
+ if ( !initialSelection.isEmpty() )
+ dlg->setSelection( initialSelection );
+ if ( dlg->exec() == QDialog::Accepted ) {
+ result = dlg->selectedFile();
+ *workingDirectory = dlg->d->url;
+ if ( selectedFilter )
+ *selectedFilter = dlg->selectedFilter();
+ }
+ delete dlg;
+
+ qt_resolve_symlinks = save_qt_resolve_symlinks;
+
+ return result;
+}
+
+/*!
+ \internal
+ Activated when the "OK" button is clicked.
+*/
+
+void QFileDialogP::okClicked()
+{
+ QString fn( nameEdit->text() );
+
+#if defined(Q_WS_WIN)
+ QFileInfo fi( d->url.path() + fn );
+ if ( fi.isSymLink() ) {
+ nameEdit->setText( fi.readLink() );
+ }
+#endif
+
+ if ( fn.contains("*") ) {
+ addFilter( fn );
+ nameEdit->blockSignals( TRUE );
+ nameEdit->setText( QString::fromLatin1("") );
+ nameEdit->blockSignals( FALSE );
+ return;
+ }
+
+ *workingDirectory = d->url;
+ detailViewMode = files->isVisible();
+ *lastSize = size();
+
+ if ( isDirectoryMode( d->mode ) ) {
+ if ( d->ignoreReturn ) {
+ d->ignoreReturn = FALSE;
+ return;
+ }
+ QUrlInfo f( d->url, nameEdit->text() );
+ if ( f.isDir() ) {
+ d->currentFileName = d->url;
+ if ( d->currentFileName.right(1) != "/" )
+ d->currentFileName += '/';
+ if ( f.name() != "." )
+ d->currentFileName += f.name();
+ accept();
+ return;
+ }
+ }
+
+ // if we're in multi-selection mode and something is selected,
+ // accept it and be done.
+ if ( mode() == ExistingFiles ) {
+ if ( ! nameEdit->text().isEmpty() ) {
+ QStringList sf = selectedFiles();
+ bool isdir = FALSE;
+ if ( sf.count() == 1 ) {
+ QUrlOperator u( d->url, sf[0] );
+ bool ok;
+ isdir = u.isDir(&ok) && ok;
+ }
+ if ( !isdir ) {
+ emit filesSelected( sf );
+ accept();
+ return;
+ }
+ }
+ }
+
+ if ( mode() == AnyFile ) {
+ QUrlOperator u( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text()) );
+ if ( !u.isDir() ) {
+ d->currentFileName = u;
+ emit fileSelected( selectedFile() );
+ accept();
+ return;
+ }
+ }
+
+ if ( mode() == ExistingFile ) {
+ QUrl u( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text()) );
+ if ( u.isLocalFile() ) {
+ QFileInfo f( u.path() );
+ if ( !f.exists() )
+ return;
+ } else {
+ QNetworkProtocol *p = QNetworkProtocol::getNetworkProtocol( d->url.protocol() );
+ if ( p && (p->supportedOperations()&QNetworkProtocol::OpListChildren) ) {
+ QUrlInfo ui( d->url, nameEdit->text() );
+ if ( !ui.isValid() )
+ return;
+ }
+ }
+ }
+
+ // If selection is valid, return it, else try
+ // using selection as a directory to change to.
+ if ( !d->currentFileName.isNull() && !d->currentFileName.contains( "*" ) ) {
+ emit fileSelected( selectedFile() );
+ accept();
+ } else {
+ QUrlInfo f;
+ QFileDialogPrivate::File * c
+ = (QFileDialogPrivate::File *)files->currentItem();
+ QFileDialogPrivate::MCItem * m
+ = (QFileDialogPrivate::MCItem *)d->moreFiles->item( d->moreFiles->currentItem() );
+ if ( c && files->isVisible() && files->hasFocus() ||
+ m && d->moreFiles->isVisible() && d->moreFiles->hasFocus() ) {
+ if ( c && files->isVisible() )
+ f = c->info;
+ else
+ f = ( (QFileDialogPrivate::File*)m->i )->info;
+ } else {
+ f = QUrlInfo( d->url, nameEdit->text() );
+ }
+ if ( f.isDir() ) {
+ setUrl( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(f.name() + "/" ) ) );
+ d->checkForFilter = TRUE;
+ trySetSelection( TRUE, d->url, TRUE );
+ d->checkForFilter = FALSE;
+ } else {
+ if ( !nameEdit->text().contains( "/" ) &&
+ !nameEdit->text().contains( "\\" )
+#if defined(Q_OS_WIN32)
+ && nameEdit->text()[ 1 ] != ':'
+#endif
+ )
+ addFilter( nameEdit->text() );
+ else if ( nameEdit->text()[ 0 ] == '/' ||
+ nameEdit->text()[ 0 ] == '\\'
+#if defined(Q_OS_WIN32)
+ || nameEdit->text()[ 1 ] == ':'
+#endif
+ )
+ setDir( nameEdit->text() );
+ else if ( nameEdit->text().left( 3 ) == "../" || nameEdit->text().left( 3 ) == "..\\" )
+ setDir( QUrl( d->url.toString(), QFileDialogPrivate::encodeFileName(nameEdit->text() ) ).toString() );
+ }
+ nameEdit->setText( "" );
+ }
+}
+
+/*!
+ \internal
+ Activated when the "Filter" button is clicked.
+*/
+
+void QFileDialogP::filterClicked()
+{
+ // unused
+}
+
+/*!
+ \internal
+ Activated when the "Cancel" button is clicked.
+*/
+
+void QFileDialogP::cancelClicked()
+{
+ *workingDirectory = d->url;
+ detailViewMode = files->isVisible();
+ *lastSize = size();
+ reject();
+}
+
+
+/*!\reimp
+*/
+
+void QFileDialogP::resizeEvent( QResizeEvent * e )
+{
+ QDialog::resizeEvent( e );
+ updateGeometries();
+}
+
+/*
+ \internal
+ The only correct way to try to set currentFileName
+*/
+bool QFileDialogP::trySetSelection( bool isDir, const QUrlOperator &u, bool updatelined )
+{
+ if ( !isDir && !u.path().isEmpty() && u.path().right( 1 ) == "/" )
+ isDir = TRUE;
+ if ( u.fileName().contains( "*") && d->checkForFilter ) {
+ QString fn( u.fileName() );
+ if ( fn.contains( "*" ) ) {
+ addFilter( fn );
+ d->currentFileName = QString::null;
+ d->url.setFileName( QString::null );
+ nameEdit->setText( QString::fromLatin1("") );
+ return FALSE;
+ }
+ }
+
+ if ( isDir ) {
+ if ( d->preview && d->preview->isVisible() ) {
+ if ( d->infoPreviewer )
+ d->infoPreviewer->previewUrl( u );
+ if ( d->contentsPreviewer )
+ d->contentsPreviewer->previewUrl( u );
+ }
+ }
+
+ QString old = d->currentFileName;
+
+ if ( isDirectoryMode( mode() ) ) {
+ if ( isDir )
+ d->currentFileName = u;
+ else
+ d->currentFileName = QString::null;
+ } else if ( !isDir && mode() == ExistingFiles ) {
+ d->currentFileName = u;
+ } else if ( !isDir || ( mode() == AnyFile && !isDir ) ) {
+ d->currentFileName = u;
+ } else {
+ d->currentFileName = QString::null;
+ }
+ if ( updatelined && !d->currentFileName.isEmpty() ) {
+ // If the selection is valid, or if its a directory, allow OK.
+ if ( !d->currentFileName.isNull() || isDir ) {
+ if ( u.fileName() != ".." ) {
+ QString fn = u.fileName();
+ nameEdit->setText( fn );
+ } else {
+ nameEdit->setText("");
+ }
+ } else
+ nameEdit->setText( QString::fromLatin1("") );
+ }
+
+ if ( !d->currentFileName.isNull() || isDir ) {
+ okB->setEnabled( TRUE );
+ } else if ( !isDirectoryMode( d->mode ) ) {
+ okB->setEnabled( FALSE );
+ }
+
+ if ( d->currentFileName.length() && old != d->currentFileName )
+ emit fileHighlighted( selectedFile() );
+
+ return !d->currentFileName.isNull();
+}
+
+
+/*! Make sure the minimum and maximum sizes of everything are sane.
+*/
+
+void QFileDialogP::updateGeometries()
+{
+ if ( !d || !d->geometryDirty )
+ return;
+
+ d->geometryDirty = FALSE;
+
+ QSize r, t;
+
+ // we really should have a QSize::unite()
+#define RM r.setWidth( QMAX(r.width(),t.width()) ); \
+r.setHeight( QMAX(r.height(),t.height()) )
+
+ // labels first
+ r = d->pathL->sizeHint();
+ t = d->fileL->sizeHint();
+ RM;
+ t = d->typeL->sizeHint();
+ RM;
+ d->pathL->setFixedSize( d->pathL->sizeHint() );
+ d->fileL->setFixedSize( r );
+ d->typeL->setFixedSize( r );
+
+ // single-line input areas
+ r = d->paths->sizeHint();
+ t = nameEdit->sizeHint();
+ RM;
+ t = d->types->sizeHint();
+ RM;
+ r.setWidth( t.width() * 2 / 3 );
+ t.setWidth( QWIDGETSIZE_MAX );
+ t.setHeight( r.height() );
+ d->paths->setMinimumSize( r );
+ d->paths->setMaximumSize( t );
+ nameEdit->setMinimumSize( r );
+ nameEdit->setMaximumSize( t );
+ d->types->setMinimumSize( r );
+ d->types->setMaximumSize( t );
+
+ // buttons on top row
+ r = QSize( 0, d->paths->minimumSize().height() );
+ t = QSize( 21, 20 );
+ RM;
+ if ( r.height()+1 > r.width() )
+ r.setWidth( r.height()+1 );
+ if ( d->goBack )
+ d->goBack->setFixedSize( r );
+ d->cdToParent->setFixedSize( r );
+ d->newFolder->setFixedSize( r );
+ d->mcView->setFixedSize( r );
+ d->detailView->setFixedSize( r );
+
+ QButton *b = 0;
+ if ( !d->toolButtons.isEmpty() ) {
+ for ( b = d->toolButtons.first(); b; b = d->toolButtons.next() )
+ b->setFixedSize( b->sizeHint().width(), r.height() );
+ }
+
+ if ( d->infoPreview ) {
+ d->previewInfo->show();
+ d->previewInfo->setFixedSize( r );
+ } else {
+ d->previewInfo->hide();
+ d->previewInfo->setFixedSize( QSize( 0, 0 ) );
+ }
+
+ if ( d->contentsPreview ) {
+ d->previewContents->show();
+ d->previewContents->setFixedSize( r );
+ } else {
+ d->previewContents->hide();
+ d->previewContents->setFixedSize( QSize( 0, 0 ) );
+ }
+
+ // open/save, cancel
+ r = QSize( 75, 20 );
+ t = okB->sizeHint();
+ RM;
+ t = cancelB->sizeHint();
+ RM;
+
+ okB->setFixedSize( r );
+ cancelB->setFixedSize( r );
+
+ d->topLevelLayout->activate();
+
+#undef RM
+}
+
+
+/*! Updates the file name edit box to \a newItem in the file dialog
+ when the cursor moves in the listview.
+*/
+
+void QFileDialogP::updateFileNameEdit( QListViewItem * newItem )
+{
+ if ( !newItem )
+ return;
+
+ if ( mode() == ExistingFiles ) {
+ detailViewSelectionChanged();
+ QUrl u = QUrl( d->url, QFileDialogPrivate::encodeFileName( ((QFileDialogPrivate::File*)files->currentItem())->info.name() ) );
+ QFileInfo fi( u.toString( FALSE, FALSE ) );
+ if ( !fi.isDir() )
+ emit fileHighlighted( u.toString( FALSE, FALSE ) );
+ } else if ( files->isSelected( newItem ) ) {
+ QFileDialogPrivate::File * i = (QFileDialogPrivate::File *)newItem;
+ if ( i && i->i && !i->i->isSelected() ) {
+ d->moreFiles->blockSignals( TRUE );
+ d->moreFiles->setSelected( i->i, TRUE );
+ d->moreFiles->blockSignals( FALSE );
+ }
+ // Encode the filename in case it had any special characters in it
+ QString encFile = QFileDialogPrivate::encodeFileName( newItem->text( 0 ) );
+ trySetSelection( i->info.isDir(), QUrlOperator( d->url, encFile ), TRUE );
+ }
+}
+
+void QFileDialogP::detailViewSelectionChanged()
+{
+ if ( d->mode != ExistingFiles )
+ return;
+
+ nameEdit->clear();
+ QString str;
+ QListViewItem * i = files->firstChild();
+ d->moreFiles->blockSignals( TRUE );
+ while( i ) {
+ if ( d->moreFiles && isVisible() ) {
+ if ( ( (QFileDialogPrivate::File *)i )->i->isSelected() != i->isSelected() )
+ d->moreFiles->setSelected( ( (QFileDialogPrivate::File *)i )->i, i->isSelected() );
+ }
+ if ( i->isSelected() && !( (QFileDialogPrivate::File *)i )->info.isDir() )
+ str += QString( "\"%1\" " ).arg( i->text( 0 ) );
+ i = i->nextSibling();
+ }
+ d->moreFiles->blockSignals( FALSE );
+ nameEdit->setText( str );
+ nameEdit->setCursorPosition( str.length() );
+ okB->setEnabled( TRUE );
+ if ( d->preview && d->preview->isVisible() && files->currentItem() ) {
+ QUrl u = QUrl( d->url, QFileDialogPrivate::encodeFileName( ((QFileDialogPrivate::File*)files->currentItem())->info.name() ) );
+ if ( d->infoPreviewer )
+ d->infoPreviewer->previewUrl( u );
+ if ( d->contentsPreviewer )
+ d->contentsPreviewer->previewUrl( u );
+ }
+}
+
+void QFileDialogP::listBoxSelectionChanged()
+{
+ if ( d->mode != ExistingFiles )
+ return;
+
+ if ( d->ignoreNextRefresh ) {
+ d->ignoreNextRefresh = FALSE;
+ return;
+ }
+
+ nameEdit->clear();
+ QString str;
+ QListBoxItem * i = d->moreFiles->item( 0 );
+ QListBoxItem * j = 0;
+ int index = 0;
+ files->blockSignals( TRUE );
+ while( i ) {
+ if ( files && isVisible() ) {
+ if ( ( (QFileDialogPrivate::MCItem *)i )->i->isSelected() != i->isSelected() )
+ files->setSelected( ( (QFileDialogPrivate::MCItem *)i )->i, i->isSelected() );
+ }
+ if ( d->moreFiles->isSelected( i )
+ && !( (QFileDialogPrivate::File*)( (QFileDialogPrivate::MCItem *)i )->i )->info.isDir() )
+ {
+ str += QString( "\"%1\" " ).arg( i->text() );
+ if ( j == 0 )
+ j = i;
+ }
+ i = d->moreFiles->item( ++index );
+ }
+ files->blockSignals( FALSE );
+ nameEdit->setText( str );
+ nameEdit->setCursorPosition( str.length() );
+ okB->setEnabled( TRUE );
+ if ( d->preview && d->preview->isVisible() && j ) {
+ QUrl u = QUrl( d->url,
+ QFileDialogPrivate::encodeFileName( ( (QFileDialogPrivate::File*)( (QFileDialogPrivate::MCItem*)j )->i )->info.name() ) );
+ if ( d->infoPreviewer )
+ d->infoPreviewer->previewUrl( u );
+ if ( d->contentsPreviewer )
+ d->contentsPreviewer->previewUrl( u );
+ }
+}
+
+/*! \overload */
+
+void QFileDialogP::updateFileNameEdit( QListBoxItem * newItem )
+{
+ if ( !newItem )
+ return;
+ QFileDialogPrivate::MCItem * i = (QFileDialogPrivate::MCItem *)newItem;
+ if ( d->mode != ExistingFiles && i->i ) {
+ i->i->listView()->setSelected( i->i, i->isSelected() );
+ updateFileNameEdit( i->i );
+ }
+}
+
+
+/*! Updates the dialog when the file name edit changes. */
+
+void QFileDialogP::fileNameEditDone()
+{
+ QUrlInfo f( d->url, nameEdit->text() );
+ if ( mode() != QFileDialogP::ExistingFiles ) {
+ QUrlOperator u( d->url, QFileDialogPrivate::encodeFileName( nameEdit->text() ) );
+ trySetSelection( f.isDir(), u, FALSE );
+ if ( d->preview && d->preview->isVisible() ) {
+ if ( d->infoPreviewer )
+ d->infoPreviewer->previewUrl( u );
+ if ( d->contentsPreviewer )
+ d->contentsPreviewer->previewUrl( u );
+ }
+ }
+}
+
+
+
+/*! This private slot reacts to double-clicks in the list view. The item that
+was double-clicked is specified in \a newItem */
+
+void QFileDialogP::selectDirectoryOrFile( QListViewItem * newItem )
+{
+
+ *workingDirectory = d->url;
+ detailViewMode = files->isVisible();
+ *lastSize = size();
+
+ if ( !newItem )
+ return;
+
+#if defined(Q_WS_WIN)
+ QFileInfo fi( d->url.path() + newItem->text(0) );
+ if ( fi.isSymLink() ) {
+ nameEdit->setText( fi.readLink() );
+ okClicked();
+ return;
+ }
+#endif
+
+ QFileDialogPrivate::File * i = (QFileDialogPrivate::File *)newItem;
+
+ QString oldName = nameEdit->text();
+ if ( i->info.isDir() ) {
+ setUrl( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName( i->info.name() ) + "/" ) );
+ if ( isDirectoryMode( mode() ) ) {
+ QUrlInfo f ( d->url, QString::fromLatin1( "." ) );
+ trySetSelection( f.isDir(), d->url, TRUE );
+ }
+ } else if ( newItem->isSelectable() &&
+ trySetSelection( i->info.isDir(), QUrlOperator( d->url, QFileDialogPrivate::encodeFileName( i->info.name() ) ), TRUE ) ) {
+ if ( !isDirectoryMode( mode() ) ) {
+ emit fileSelected( selectedFile() );
+ accept();
+ }
+ } else if ( isDirectoryMode( d->mode ) ) {
+ d->currentFileName = d->url;
+ accept();
+ }
+ if ( !oldName.isEmpty() && !isDirectoryMode( mode() ) )
+ nameEdit->setText( oldName );
+}
+
+
+void QFileDialogP::selectDirectoryOrFile( QListBoxItem * newItem )
+{
+ if ( !newItem )
+ return;
+
+ QFileDialogPrivate::MCItem * i = (QFileDialogPrivate::MCItem *)newItem;
+ if ( i->i ) {
+ i->i->listView()->setSelected( i->i, i->isSelected() );
+ selectDirectoryOrFile( i->i );
+ }
+}
+
+
+void QFileDialogP::popupContextMenu( QListViewItem *item, const QPoint &p,
+ int )
+{
+ if ( item && d->mode == ExistingFiles )
+ return;
+ if ( item ) {
+ files->setCurrentItem( item );
+ files->setSelected( item, TRUE );
+ }
+
+ PopupAction action;
+ popupContextMenu( item ? item->text( 0 ) : QString::null, TRUE, action, p );
+
+ if ( action == PA_Open )
+ selectDirectoryOrFile( item );
+ else if ( action == PA_Rename )
+ files->startRename( FALSE );
+ else if ( action == PA_Delete )
+ deleteFile( item ? item->text( 0 ) : QString::null );
+ else if ( action == PA_Reload )
+ rereadDir();
+ else if ( action == PA_Hidden ) {
+ bShowHiddenFiles = !bShowHiddenFiles;
+ rereadDir();
+ } else if ( action == PA_SortName ) {
+ sortFilesBy = (int)QDir::Name;
+ sortAscending = TRUE;
+ resortDir();
+ } else if ( action == PA_SortSize ) {
+ sortFilesBy = (int)QDir::Size;
+ sortAscending = TRUE;
+ resortDir();
+ } else if ( action == PA_SortDate ) {
+ sortFilesBy = (int)QDir::Time;
+ sortAscending = TRUE;
+ resortDir();
+ } else if ( action == PA_SortUnsorted ) {
+ sortFilesBy = (int)QDir::Unsorted;
+ sortAscending = TRUE;
+ resortDir();
+ }
+
+}
+
+void QFileDialogP::popupContextMenu( QListBoxItem *item, const QPoint & p )
+{
+ if ( item && d->mode == ExistingFiles )
+ return;
+
+ PopupAction action;
+ popupContextMenu( item ? item->text() : QString::null, FALSE, action, p );
+
+ if ( action == PA_Open )
+ selectDirectoryOrFile( item );
+ else if ( action == PA_Rename )
+ d->moreFiles->startRename( FALSE );
+ else if ( action == PA_Delete )
+ deleteFile( item->text() );
+ else if ( action == PA_Reload )
+ rereadDir();
+ else if ( action == PA_Hidden ) {
+ bShowHiddenFiles = !bShowHiddenFiles;
+ rereadDir();
+ } else if ( action == PA_SortName ) {
+ sortFilesBy = (int)QDir::Name;
+ sortAscending = TRUE;
+ resortDir();
+ } else if ( action == PA_SortSize ) {
+ sortFilesBy = (int)QDir::Size;
+ sortAscending = TRUE;
+ resortDir();
+ } else if ( action == PA_SortDate ) {
+ sortFilesBy = (int)QDir::Time;
+ sortAscending = TRUE;
+ resortDir();
+ } else if ( action == PA_SortUnsorted ) {
+ sortFilesBy = (int)QDir::Unsorted;
+ sortAscending = TRUE;
+ resortDir();
+ }
+}
+
+void QFileDialogP::popupContextMenu( const QString &filename, bool,
+ PopupAction &action, const QPoint &p )
+{
+ action = PA_Cancel;
+
+ bool glob = filename.isEmpty();
+
+ QPopupMenu m( 0, "file dialog context menu" );
+ m.setCheckable( TRUE );
+
+ if ( !glob ) {
+ QString okt;
+ if ( QUrlInfo( d->url, filename ).isDir() ) {
+ okt = tr( "&Open" );
+ } else {
+ if ( mode() == AnyFile )
+ okt = tr( "&Save" );
+ else
+ okt = tr( "&Open" );
+ }
+ int ok = m.insertItem( okt );
+
+ m.insertSeparator();
+ int rename = m.insertItem( tr( "&Rename" ) );
+ int del = m.insertItem( tr( "&Delete" ) );
+
+ if ( filename.isEmpty() || !QUrlInfo( d->url, filename ).isWritable() ||
+ filename == ".." ) {
+ if ( filename.isEmpty() || !QUrlInfo( d->url, filename ).isReadable() )
+ m.setItemEnabled( ok, FALSE );
+ m.setItemEnabled( rename, FALSE );
+ m.setItemEnabled( del, FALSE );
+ }
+
+ if ( mode() == QFileDialogP::ExistingFiles )
+ m.setItemEnabled( rename, FALSE );
+
+ m.move( p );
+ int res = m.exec();
+
+ if ( res == ok )
+ action = PA_Open;
+ else if ( res == rename )
+ action = PA_Rename;
+ else if ( res == del )
+ action = PA_Delete;
+ } else {
+ int reload = m.insertItem( tr( "R&eload" ) );
+
+ QPopupMenu m2( 0, "sort menu" );
+
+ int sname = m2.insertItem( tr( "Sort by &Name" ) );
+ //int stype = m2.insertItem( tr( "Sort by &Type" ) );
+ int ssize = m2.insertItem( tr( "Sort by &Size" ) );
+ int sdate = m2.insertItem( tr( "Sort by &Date" ) );
+ m2.insertSeparator();
+ int sunsorted = m2.insertItem( tr( "&Unsorted" ) );
+
+ //m2.setItemEnabled( stype, FALSE );
+
+ if ( sortFilesBy == (int)QDir::Name )
+ m2.setItemChecked( sname, TRUE );
+ else if ( sortFilesBy == (int)QDir::Size )
+ m2.setItemChecked( ssize, TRUE );
+// else if ( sortFilesBy == 0x16 )
+// m2.setItemChecked( stype, TRUE );
+ else if ( sortFilesBy == (int)QDir::Time )
+ m2.setItemChecked( sdate, TRUE );
+ else if ( sortFilesBy == (int)QDir::Unsorted )
+ m2.setItemChecked( sunsorted, TRUE );
+
+ m.insertItem( tr( "Sort" ), &m2 );
+
+ m.insertSeparator();
+
+ int hidden = m.insertItem( tr( "Show &hidden files" ) );
+ m.setItemChecked( hidden, bShowHiddenFiles );
+
+ m.move( p );
+ int res = m.exec();
+
+ if ( res == reload )
+ action = PA_Reload;
+ else if ( res == hidden )
+ action = PA_Hidden;
+ else if ( res == sname )
+ action = PA_SortName;
+// else if ( res == stype )
+// action = PA_SortType;
+ else if ( res == sdate )
+ action = PA_SortDate;
+ else if ( res == ssize )
+ action = PA_SortSize;
+ else if ( res == sunsorted )
+ action = PA_SortUnsorted;
+ }
+
+}
+
+void QFileDialogP::deleteFile( const QString &filename )
+{
+ if ( filename.isEmpty() )
+ return;
+
+ QUrlInfo fi( d->url, QFileDialogPrivate::encodeFileName( filename ) );
+ QString t = tr( "the file" );
+ if ( fi.isDir() )
+ t = tr( "the directory" );
+ if ( fi.isSymLink() )
+ t = tr( "the symlink" );
+
+ if ( QMessageBox::warning( this,
+ tr( "Delete %1" ).arg( t ),
+ tr( "<qt>Are you sure you wish to delete %1 \"%2\"?</qt>" )
+ .arg( t ).arg(filename),
+ tr( "&Yes" ), tr( "&No" ), QString::null, 1 ) == 0 )
+ d->url.remove( QFileDialogPrivate::encodeFileName( filename ) );
+
+}
+
+void QFileDialogP::fileSelected( int )
+{
+ // unused
+}
+
+void QFileDialogP::fileHighlighted( int )
+{
+ // unused
+}
+
+void QFileDialogP::dirSelected( int )
+{
+ // unused
+}
+
+void QFileDialogP::pathSelected( int )
+{
+ // unused
+}
+
+
+void QFileDialogP::cdUpClicked()
+{
+ QString oldName = nameEdit->text();
+ setUrl( QUrlOperator( d->url, ".." ) );
+ if ( !oldName.isEmpty() )
+ nameEdit->setText( oldName );
+}
+
+void QFileDialogP::newFolderClicked()
+{
+ QString foldername( tr( "New Folder 1" ) );
+ int i = 0;
+ QStringList lst;
+ QListViewItemIterator it( files );
+ for ( ; it.current(); ++it )
+ if ( it.current()->text( 0 ).contains( tr( "New Folder" ) ) )
+ lst.append( it.current()->text( 0 ) );
+
+ if ( !lst.count() == 0 )
+ while ( lst.contains( foldername ) )
+ foldername = tr( "New Folder %1" ).arg( ++i );
+
+ d->url.mkdir( foldername );
+}
+
+void QFileDialogP::createdDirectory( const QUrlInfo &info, QNetworkOperation * )
+{
+ resortDir();
+ if ( d->moreFiles->isVisible() ) {
+ for ( uint i = 0; i < d->moreFiles->count(); ++i ) {
+ if ( d->moreFiles->text( i ) == info.name() ) {
+ d->moreFiles->setCurrentItem( i );
+ d->moreFiles->startRename( FALSE );
+ break;
+ }
+ }
+ } else {
+ QListViewItem *item = files->firstChild();
+ while ( item ) {
+ if ( item->text( 0 ) == info.name() ) {
+ files->setSelected( item, TRUE );
+ files->setCurrentItem( item );
+ files->startRename( FALSE );
+ break;
+ }
+ item = item->nextSibling();
+ }
+ }
+}
+
+
+/*!
+ This is a convenience static function that will return an existing directory
+ selected by the user.
+
+ \code
+ QString s = QFileDialogP::getExistingDirectory(
+ "/home",
+ this,
+ "get existing directory"
+ "Choose a directory",
+ TRUE );
+ \endcode
+
+ This function creates a modal file dialog called \a name, with
+ parent, \a parent. If parent is not 0, the dialog will be shown
+ centered over the parent.
+
+ The dialog's working directory is set to \a dir, and the caption is
+ set to \a caption. Either of these may be QString::null in which case
+ the current directory and a default caption will be used respectively.
+
+ If \a dirOnly is TRUE, then only directories will be shown in
+ the file dialog; otherwise both directories and files will be shown.
+
+ Under Unix/X11, the normal behavior of the file dialog is to resolve
+ and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
+ the file dialog will change to /var/tmp after entering /usr/tmp.
+ If \a resolveSymlinks is FALSE, the file dialog will treat
+ symlinks as regular directories.
+
+ \sa getOpenFileName(), getOpenFileNames(), getSaveFileName()
+*/
+
+QString QFileDialogP::getExistingDirectory( const QString & dir,
+ QWidget *parent,
+ const char* name,
+ const QString& caption,
+ bool dirOnly,
+ bool resolveSymlinks)
+{
+ bool save_qt_resolve_symlinks = qt_resolve_symlinks;
+ qt_resolve_symlinks = resolveSymlinks;
+
+ makeVariables();
+ QString wd;
+ if ( workingDirectory )
+ wd = *workingDirectory;
+
+#if defined(Q_WS_WIN)
+ QString initialDir;
+ if ( !dir.isEmpty() ) {
+ QUrlOperator u( dir );
+ if ( QFileInfo( u.path() ).isDir() )
+ initialDir = dir;
+ } else
+ initialDir = QString::null;
+ if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle && dirOnly )
+ return winGetExistingDirectory( initialDir, parent, name, caption );
+#endif
+#if defined(Q_WS_MAC)
+ if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) )
+ return macGetOpenFileNames("", 0,
+ parent, name, caption, FALSE, TRUE).first();
+#endif
+
+ QFileDialogP *dialog = new QFileDialogP( parent, name ? name : "qt_filedlg_ged", TRUE );
+#ifndef QT_NO_WIDGET_TOPEXTRA
+ if ( !caption.isNull() )
+ dialog->setCaption( caption );
+ else
+ dialog->setCaption( QFileDialogP::tr("Find Directory") );
+#endif
+
+ dialog->setMode( dirOnly ? DirectoryOnly : Directory );
+
+ dialog->d->types->clear();
+ dialog->d->types->insertItem( QFileDialogP::tr("Directories") );
+ dialog->d->types->setEnabled( FALSE );
+
+ QString dir_( dir );
+ dir_ = dir_.simplifyWhiteSpace();
+ if ( dir_.isEmpty() && !wd.isEmpty() )
+ dir_ = wd;
+ QUrlOperator u( dir_ );
+ if ( u.isLocalFile() ) {
+ if ( !dir_.isEmpty() ) {
+ QFileInfo f( u.path() );
+ if ( f.exists() )
+ if ( f.isDir() ) {
+ dialog->setDir( dir_ );
+ wd = dir_;
+ }
+ } else if ( !wd.isEmpty() ) {
+ QUrl tempUrl( wd );
+ QFileInfo f( tempUrl.path() );
+ if ( f.isDir() ) {
+ dialog->setDir( wd );
+ }
+ } else {
+ QString theDir = dir_;
+ if ( theDir.isEmpty() ) {
+ theDir = QDir::currentDirPath();
+ } if ( !theDir.isEmpty() ) {
+ QUrl tempUrl( theDir );
+ QFileInfo f( tempUrl.path() );
+ if ( f.isDir() ) {
+ wd = theDir;
+ dialog->setDir( theDir );
+ }
+ }
+ }
+ } else {
+ dialog->setUrl( dir_ );
+ }
+
+ QString result;
+ dialog->setSelection( dialog->d->url.toString() );
+
+ if ( dialog->exec() == QDialog::Accepted ) {
+ result = dialog->selectedFile();
+ wd = result;
+ }
+ delete dialog;
+
+ if ( !result.isEmpty() && result.right( 1 ) != "/" )
+ result += "/";
+
+ qt_resolve_symlinks = save_qt_resolve_symlinks;
+
+ return result;
+}
+
+
+/*!
+ \property QFileDialogP::mode
+ \brief the file dialog's mode
+
+ The default mode is \c ExistingFile.
+*/
+
+void QFileDialogP::setMode( Mode newMode )
+{
+ if ( d->mode != newMode ) {
+ d->mode = newMode;
+ QString sel = d->currentFileName;
+ if ( isDirectoryMode( newMode ) ) {
+ files->setMultiSelection( FALSE );
+ d->moreFiles->setMultiSelection( FALSE );
+ if ( sel.isNull() )
+ sel = QString::fromLatin1(".");
+ d->types->setEnabled( FALSE );
+ } else if ( newMode == ExistingFiles ) {
+ files->setSelectionMode( QListView::Extended );
+ d->moreFiles->setSelectionMode( QListBox::Extended );
+ d->types->setEnabled( TRUE );
+ } else {
+ files->setMultiSelection( FALSE );
+ d->moreFiles->setMultiSelection( FALSE );
+ d->types->setEnabled( TRUE );
+ }
+ rereadDir();
+ QUrlInfo f( d->url, "." );
+ trySetSelection( f.isDir(), d->url, FALSE );
+ }
+
+ QString okt;
+ bool changeFilters = FALSE;
+ if ( mode() == AnyFile ) {
+ okt = tr("Save");
+ d->fileL->setText( tr("File &name:") );
+ if ( d->types->count() == 1 ) {
+ d->types->setCurrentItem( 0 );
+ if ( d->types->currentText() == "Directories" ) {
+ changeFilters = TRUE;
+ }
+ }
+ }
+ else if ( mode() == Directory || mode() == DirectoryOnly ) {
+ okt = tr("OK");
+ d->fileL->setText( tr("Directory:") );
+ d->types->clear();
+ d->types->insertItem( tr("Directories") );
+ }
+ else {
+ okt = tr("Open");
+ d->fileL->setText( tr("File &name:") );
+ if ( d->types->count() == 1 ) {
+ d->types->setCurrentItem( 0 );
+ if ( d->types->currentText() == "Directories" ) {
+ changeFilters = TRUE;
+ }
+ }
+ }
+
+ if ( changeFilters ) {
+ d->types->clear();
+ d->types->insertItem( tr("All Files (*)") );
+ }
+
+ okB->setText( okt );
+}
+
+QFileDialogP::Mode QFileDialogP::mode() const
+{
+ return d->mode;
+}
+
+/*! \reimp
+*/
+
+void QFileDialogP::done( int i )
+{
+ if ( i == QDialog::Accepted && (d->mode == ExistingFile || d->mode == ExistingFiles) ) {
+ QStringList selection = selectedFiles();
+ for ( uint f = 0; f < selection.count(); f++ ) {
+ QString file = selection[f];
+ if ( file.isNull() )
+ continue;
+ if ( d->url.isLocalFile() && !QFile::exists( file ) ) {
+ QMessageBox::information( this, tr("Error"), tr("%1\nFile not found.\nCheck path and filename.").arg( file ) );
+ return;
+ }
+ }
+ }
+ QDialog::done( i );
+}
+
+/*!
+ \property QFileDialogP::viewMode
+
+ \brief the file dialog's view mode
+
+ If you set the view mode to be \e Detail (the default), then you
+ will see the file's details, such as the size of the file and the
+ date the file was last modified in addition to the file's name.
+
+ If you set the view mode to be \e List, then you will just
+ see a list of the files and folders.
+
+ See \l QFileDialogP::ViewMode
+*/
+
+
+QFileDialogP::ViewMode QFileDialogP::viewMode() const
+{
+ if ( detailViewMode )
+ return Detail;
+ else
+ return List;
+}
+
+void QFileDialogP::setViewMode( ViewMode m )
+{
+ if ( m == Detail ) {
+ detailViewMode = TRUE;
+ d->stack->raiseWidget( files );
+ d->detailView->setOn( TRUE );
+ d->mcView->setOn( FALSE );
+ } else if ( m == List ) {
+ detailViewMode = FALSE;
+ d->stack->raiseWidget( d->moreFiles );
+ d->detailView->setOn( FALSE );
+ d->mcView->setOn( TRUE );
+ }
+}
+
+
+/*!
+ \property QFileDialogP::previewMode
+
+ \brief the preview mode for the file dialog
+
+ If you set the mode to be a mode other than \e NoPreview, you must
+ use setInfoPreview() or setContentsPreview() to set the dialog's
+ preview widget to your preview widget and enable the preview
+ widget(s) with setInfoPreviewEnabled() or
+ setContentsPreviewEnabled().
+
+ \sa infoPreview, contentsPreview, viewMode
+*/
+
+void QFileDialogP::setPreviewMode( PreviewMode m )
+{
+ if ( m == NoPreview ) {
+ d->previewInfo->setOn( FALSE );
+ d->previewContents->setOn( FALSE );
+ } else if ( m == Info && d->infoPreview ) {
+ d->previewInfo->setOn( TRUE );
+ d->previewContents->setOn( FALSE );
+ changeMode( d->modeButtons->id( d->previewInfo ) );
+ } else if ( m == Contents && d->contentsPreview ) {
+ d->previewInfo->setOn( FALSE );
+ d->previewContents->setOn( TRUE );
+ changeMode( d->modeButtons->id( d->previewContents ) );
+ }
+}
+QFileDialogP::PreviewMode QFileDialogP::previewMode() const
+{
+ if ( d->infoPreview && d->previewInfo->isVisible() )
+ return Info;
+ else if ( d->contentsPreview && d->previewContents->isVisible() )
+ return Contents;
+
+ return NoPreview;
+}
+
+
+/*!
+ Adds the specified widgets to the bottom of the file dialog. The
+ label \a l is placed underneath the "file name" and the "file types"
+ labels. The widget \a w is placed underneath the file types combobox.
+ The button \a b is placed underneath the Cancel pushbutton.
+
+ \code
+ MyFileDialog::MyFileDialog( QWidget* parent, const char* name ) :
+ QFileDialogP( parent, name )
+ {
+ QLabel* label = new QLabel( "Added widgets", this );
+ QLineEdit* lineedit = new QLineEdit( this );
+ QToolButton* toolbutton = new QToolButton( this );
+
+ addWidgets( label, lineedit, toolbutton );
+ }
+ \endcode
+
+ If you don't want to have one of the widgets added, pass 0 in that
+ widget's position.
+
+ Every time you call this function, a new row of widgets will be added
+ to the bottom of the file dialog.
+
+ \sa addToolButton(), addLeftWidget(), addRightWidget()
+*/
+
+void QFileDialogP::addWidgets( QLabel * l, QWidget * w, QPushButton * b )
+{
+ if ( !l && !w && !b )
+ return;
+
+ d->geometryDirty = TRUE;
+
+ QHBoxLayout *lay = new QHBoxLayout();
+ d->extraWidgetsLayouts.append( lay );
+ d->topLevelLayout->addLayout( lay );
+
+ if ( !l )
+ l = new QLabel( this, "qt_intern_lbl" );
+ d->extraLabels.append( l );
+ lay->addWidget( l );
+
+ if ( !w )
+ w = new QWidget( this, "qt_intern_widget" );
+ d->extraWidgets.append( w );
+ lay->addWidget( w );
+ lay->addSpacing( 15 );
+
+ if ( b ) {
+ d->extraButtons.append( b );
+ lay->addWidget( b );
+ } else {
+ QWidget *wid = new QWidget( this, "qt_extrabuttons_widget" );
+ d->extraButtons.append( wid );
+ lay->addWidget( wid );
+ }
+
+ updateGeometries();
+}
+
+/*!
+ Adds the tool button \a b to the row of tool buttons at the top of the
+ file dialog. The button is appended to the right of
+ this row. If \a separator is TRUE, a small space is inserted between the
+ last button of the row and the new button \a b.
+
+ \sa addWidgets(), addLeftWidget(), addRightWidget()
+*/
+
+void QFileDialogP::addToolButton( QButton *b, bool separator )
+{
+ if ( !b || !d->buttonLayout )
+ return;
+
+ d->geometryDirty = TRUE;
+
+ d->toolButtons.append( b );
+ if ( separator )
+ d->buttonLayout->addSpacing( 8 );
+ d->buttonLayout->addWidget( b );
+
+ updateGeometries();
+}
+
+/*!
+ Adds the widget \a w to the left-hand side of the file dialog.
+
+ \sa addRightWidget(), addWidgets(), addToolButton()
+*/
+
+void QFileDialogP::addLeftWidget( QWidget *w )
+{
+ if ( !w )
+ return;
+ d->geometryDirty = TRUE;
+
+ d->leftLayout->addWidget( w );
+ d->leftLayout->addSpacing( 5 );
+
+ updateGeometries();
+}
+
+/*!
+ Adds the widget \a w to the right-hand side of the file dialog.
+
+ \sa addLeftWidget(), addWidgets(), addToolButton()
+*/
+
+void QFileDialogP::addRightWidget( QWidget *w )
+{
+ if ( !w )
+ return;
+ d->geometryDirty = TRUE;
+
+ d->rightLayout->addSpacing( 5 );
+ d->rightLayout->addWidget( w );
+
+ updateGeometries();
+}
+
+/*! \reimp */
+
+void QFileDialogP::keyPressEvent( QKeyEvent * ke )
+{
+ if ( !d->ignoreNextKeyPress &&
+ ke && ( ke->key() == Key_Enter ||
+ ke->key() == Key_Return ) ) {
+ ke->ignore();
+ if ( d->paths->hasFocus() ) {
+ ke->accept();
+ if ( d->url == QUrl(d->paths->currentText()) )
+ nameEdit->setFocus();
+ } else if ( d->types->hasFocus() ) {
+ ke->accept();
+ // ### is there a suitable condition for this? only valid
+ // wildcards?
+ nameEdit->setFocus();
+ } else if ( nameEdit->hasFocus() ) {
+ if ( d->currentFileName.isNull() ) {
+ // maybe change directory
+ QUrlInfo i( d->url, nameEdit->text() );
+ if ( i.isDir() ) {
+ nameEdit->setText( QString::fromLatin1("") );
+ setDir( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(i.name()) ) );
+ }
+ ke->accept();
+ } else if ( mode() == ExistingFiles ) {
+ QUrlInfo i( d->url, nameEdit->text() );
+ if ( i.isFile() ) {
+ QListViewItem * i = files->firstChild();
+ while ( i && nameEdit->text() != i->text( 0 ) )
+ i = i->nextSibling();
+ if ( i )
+ files->setSelected( i, TRUE );
+ else
+ ke->accept(); // strangely, means to ignore that event
+ }
+ }
+ } else if ( files->hasFocus() || d->moreFiles->hasFocus() ) {
+ ke->accept();
+ }
+ } else if ( ke->key() == Key_Escape ) {
+ ke->ignore();
+ }
+
+ d->ignoreNextKeyPress = FALSE;
+
+ if ( !ke->isAccepted() ) {
+ QDialog::keyPressEvent( ke );
+ }
+}
+
+
+/*! \class QFileIconProviderP qfiledialog.h
+
+ \brief The QFileIconProviderP class provides icons for QFileDialogP to
+ use.
+
+ \ingroup misc
+
+ By default QFileIconProviderP is not used, but any application or
+ library can subclass it, reimplement pixmap() to return a suitable
+ icon, and make all QFileDialogP objects use it by calling the static
+ function QFileDialogP::setIconProvider().
+
+ It is advisable to make all the icons that QFileIconProviderP returns be
+ the same size or at least the same width. This makes the list view
+ look much better.
+
+ \sa QFileDialogP
+*/
+
+
+/*! Constructs an empty file icon provider called \a name, with the
+ parent \a parent.
+*/
+
+QFileIconProviderP::QFileIconProviderP( QObject * parent, const char* name )
+ : QObject( parent, name )
+{
+ // nothing necessary
+}
+
+
+/*!
+ Returns a pointer to a pixmap that should be used to
+ signify the file with the information \a info.
+
+ If pixmap() returns 0, QFileDialogP draws the default pixmap.
+
+ The default implementation returns particular icons for files, directories,
+ link-files and link-directories. It returns a blank "icon" for other types.
+
+ If you return a pixmap here, it should measure 16x16 pixels.
+*/
+
+const QPixmap * QFileIconProviderP::pixmap( const QFileInfo & info )
+{
+ if ( info.isSymLink() ) {
+ if ( info.isFile() )
+ return symLinkFileIcon;
+ else
+ return symLinkDirIcon;
+ } else if ( info.isDir() ) {
+ return closedFolderIcon;
+ } else if ( info.isFile() ) {
+ return fileIcon;
+ } else {
+ return fifteenTransparentPixels;
+ }
+}
+
+/*!
+ Sets the QFileIconProviderP used by the file dialog to \a provider.
+
+ The default is that there is no QFileIconProviderP and QFileDialogP
+ just draws a folder icon next to each directory and nothing next
+ to files.
+
+ \sa QFileIconProviderP, iconProvider()
+*/
+
+void QFileDialogP::setIconProvider( QFileIconProviderP * provider )
+{
+ fileIconProvider = provider;
+}
+
+
+/*!
+ Returns a pointer to the icon provider currently set on the file dialog.
+ By default there is no icon provider, and this function returns 0.
+
+ \sa setIconProvider(), QFileIconProviderP
+*/
+
+QFileIconProviderP * QFileDialogP::iconProvider()
+{
+ return fileIconProvider;
+}
+
+
+#if defined(Q_WS_WIN)
+
+static QString getWindowsRegString( HKEY key, const char *subKey )
+{
+ QString s;
+ char buf[512];
+ DWORD bsz = sizeof(buf);
+#ifdef Q_OS_TEMP
+ int r = RegQueryValueEx( key, (LPCTSTR)qt_winTchar(subKey, TRUE), 0, 0, (LPBYTE)buf, &bsz );
+#else
+ int r = RegQueryValueExA( key, subKey, 0, 0, (LPBYTE)buf, &bsz );
+#endif
+ if ( r == ERROR_SUCCESS ) {
+ s = buf;
+ } else if ( r == ERROR_MORE_DATA ) {
+ char *ptr = new char[bsz+1];
+#ifdef Q_OS_TEMP
+ r = RegQueryValueEx( key, (LPCTSTR)qt_winTchar(subKey, TRUE), 0, 0, (LPBYTE)ptr, &bsz );
+#else
+ r = RegQueryValueExA( key, subKey, 0, 0, (LPBYTE)ptr, &bsz );
+#endif
+ if ( r == ERROR_SUCCESS )
+ s = ptr;
+ delete [] ptr;
+ }
+ return s;
+}
+
+static void initPixmap( QPixmap &pm )
+{
+ pm.fill( Qt::white );
+}
+
+QWindowsIconProvider::QWindowsIconProvider( QObject *parent, const char *name )
+ : QFileIconProviderP( parent, name )
+{
+ pixw = GetSystemMetrics( SM_CXSMICON );
+ pixh = GetSystemMetrics( SM_CYSMICON );
+
+ HKEY k;
+ HICON si;
+ int r;
+ QString s;
+ UINT res;
+
+#ifdef Q_OS_TEMP
+ // ---------- get default folder pixmap
+ r = RegOpenKeyEx( HKEY_CLASSES_ROOT,
+ L"folder\\DefaultIcon",
+ 0, KEY_READ, &k );
+#else
+ // ---------- get default folder pixmap
+ r = RegOpenKeyExA( HKEY_CLASSES_ROOT,
+ "folder\\DefaultIcon",
+ 0, KEY_READ, &k );
+#endif
+ if ( r == ERROR_SUCCESS ) {
+ s = getWindowsRegString( k, 0 );
+ RegCloseKey( k );
+
+ QStringList lst = QStringList::split( ",", s );
+
+#ifdef Q_OS_TEMP
+ res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar( lst[ 0 ].simplifyWhiteSpace(), TRUE ),
+ lst[ 1 ].simplifyWhiteSpace().toInt(),
+ 0, &si, 1 );
+#else
+ res = ExtractIconExA( lst[ 0 ].simplifyWhiteSpace().latin1(),
+ lst[ 1 ].simplifyWhiteSpace().toInt(),
+ 0, &si, 1 );
+#endif
+
+ if ( res ) {
+ defaultFolder.resize( pixw, pixh );
+ initPixmap( defaultFolder );
+ QPainter p( &defaultFolder );
+ DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
+ p.end();
+ defaultFolder.setMask( defaultFolder.createHeuristicMask() );
+ *closedFolderIcon = defaultFolder;
+ DestroyIcon( si );
+ } else {
+ defaultFolder = *closedFolderIcon;
+ }
+ } else {
+ RegCloseKey( k );
+ }
+
+#ifdef Q_OS_TEMP
+ //------------------------------- get default file pixmap
+ res = (UINT)ExtractIconEx( L"shell32.dll",
+ 0, 0, &si, 1 );
+#else
+ //------------------------------- get default file pixmap
+ res = ExtractIconExA( "shell32.dll",
+ 0, 0, &si, 1 );
+#endif
+
+ if ( res ) {
+ defaultFile.resize( pixw, pixh );
+ initPixmap( defaultFile );
+ QPainter p( &defaultFile );
+ DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
+ p.end();
+ defaultFile.setMask( defaultFile.createHeuristicMask() );
+ *fileIcon = defaultFile;
+ DestroyIcon( si );
+ } else {
+ defaultFile = *fileIcon;
+ }
+
+#ifdef Q_OS_TEMP
+ //------------------------------- get default exe pixmap
+ res = (UINT)ExtractIconEx( L"shell32.dll",
+ 2, 0, &si, 1 );
+#else
+ //------------------------------- get default exe pixmap
+ res = ExtractIconExA( "shell32.dll",
+ 2, 0, &si, 1 );
+#endif
+
+ if ( res ) {
+ defaultExe.resize( pixw, pixh );
+ initPixmap( defaultExe );
+ QPainter p( &defaultExe );
+ DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
+ p.end();
+ defaultExe.setMask( defaultExe.createHeuristicMask() );
+ DestroyIcon( si );
+ } else {
+ defaultExe = *fileIcon;
+ }
+}
+
+QWindowsIconProvider::~QWindowsIconProvider()
+{
+ if ( this == fileIconProvider )
+ fileIconProvider = 0;
+}
+
+const QPixmap * QWindowsIconProvider::pixmap( const QFileInfo &fi )
+{
+ QString ext = fi.extension().upper();
+ QString key = ext;
+ ext.prepend( "." );
+ QMap< QString, QPixmap >::Iterator it;
+
+ if ( fi.isDir() ) {
+ return &defaultFolder;
+ } else if ( ext.lower() != ".exe" ) {
+ it = cache.find( key );
+ if ( it != cache.end() )
+ return &( *it );
+
+ HKEY k, k2;
+#ifdef Q_OS_TEMP
+ int r = RegOpenKeyEx( HKEY_CLASSES_ROOT,
+ (LPCTSTR)qt_winTchar(ext, TRUE),
+ 0, KEY_READ, &k );
+#else
+ int r = RegOpenKeyExA( HKEY_CLASSES_ROOT,
+ ext.latin1(),
+ 0, KEY_READ, &k );
+#endif
+ QString s;
+ if ( r == ERROR_SUCCESS ) {
+ s = getWindowsRegString( k, 0 );
+ } else {
+ cache[ key ] = defaultFile;
+ RegCloseKey( k );
+ return &defaultFile;
+ }
+ RegCloseKey( k );
+
+#ifdef Q_OS_TEMP
+ r = RegOpenKeyEx( HKEY_CLASSES_ROOT,
+ (LPCTSTR)qt_winTchar( s + "\\DefaultIcon", TRUE ),
+ 0, KEY_READ, &k2 );
+#else
+ r = RegOpenKeyExA( HKEY_CLASSES_ROOT,
+ QString( s + "\\DefaultIcon" ).latin1() ,
+ 0, KEY_READ, &k2 );
+#endif
+ if ( r == ERROR_SUCCESS ) {
+ s = getWindowsRegString( k2, 0 );
+ } else {
+ cache[ key ] = defaultFile;
+ RegCloseKey( k2 );
+ return &defaultFile;
+ }
+ RegCloseKey( k2 );
+
+ QStringList lst = QStringList::split( ",", s );
+
+ HICON si;
+ UINT res;
+ QString filepath = lst[ 0 ].stripWhiteSpace();
+ if ( filepath.find("%1") != -1 ) {
+ filepath = filepath.arg( fi.filePath() );
+ if ( ext.lower() == ".dll" ) {
+ pix = defaultFile;
+ return &pix;
+ }
+ }
+
+#ifdef Q_OS_TEMP
+ res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar(filepath, TRUE),
+ lst[ 1 ].stripWhiteSpace().toInt(),
+ NULL, &si, 1 );
+#else
+ res = ExtractIconExA( filepath.latin1(),
+ lst[ 1 ].stripWhiteSpace().toInt(),
+ NULL, &si, 1 );
+#endif
+
+ if ( res ) {
+ pix.resize( pixw, pixh );
+ initPixmap( pix );
+ QPainter p( &pix );
+ DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
+ p.end();
+ pix.setMask( pix.createHeuristicMask() );
+ DestroyIcon( si );
+ } else {
+ pix = defaultFile;
+ }
+
+ cache[ key ] = pix;
+ return &pix;
+ } else {
+ HICON si;
+ UINT res;
+#ifdef Q_OS_TEMP
+ res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar(fi.absFilePath(), TRUE),
+ -1,
+ 0, 0, 1 );
+#else
+ res = ExtractIconExA( fi.absFilePath().latin1(),
+ -1,
+ 0, 0, 1 );
+#endif
+
+ if ( res == 0 ) {
+ return &defaultExe;
+ } else {
+#ifdef Q_OS_TEMP
+ res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar(fi.absFilePath(), TRUE),
+ res - 1,
+ 0, &si, 1 );
+#else
+ res = ExtractIconExA( fi.absFilePath().latin1(),
+ res - 1,
+ 0, &si, 1 );
+#endif
+ }
+
+ if ( res ) {
+ pix.resize( pixw, pixh );
+ initPixmap( pix );
+ QPainter p( &pix );
+ DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
+ p.end();
+ pix.setMask( pix.createHeuristicMask() );
+ DestroyIcon( si );
+ } else {
+ pix = defaultExe;
+ }
+
+ return &pix;
+ }
+
+ // can't happen!
+ return 0;
+}
+#endif
+
+
+
+/*!
+ \reimp
+*/
+bool QFileDialogP::eventFilter( QObject * o, QEvent * e )
+{
+ if ( e->type() == QEvent::KeyPress && ( (QKeyEvent*)e )->key() == Key_F5 ) {
+ rereadDir();
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( e->type() == QEvent::KeyPress && ( (QKeyEvent*)e )->key() == Key_F2 &&
+ ( o == files || o == files->viewport() ) ) {
+ if ( files->isVisible() && files->currentItem() ) {
+ if ( mode() != QFileDialogP::ExistingFiles &&
+ QUrlInfo( d->url, "." ).isWritable() && files->currentItem()->text( 0 ) != ".." ) {
+ files->renameItem = files->currentItem();
+ files->startRename( TRUE );
+ }
+ }
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( e->type() == QEvent::KeyPress && ( (QKeyEvent*)e )->key() == Key_F2 &&
+ ( o == d->moreFiles || o == d->moreFiles->viewport() ) ) {
+ if ( d->moreFiles->isVisible() && d->moreFiles->currentItem() != -1 ) {
+ if ( mode() != QFileDialogP::ExistingFiles &&
+ QUrlInfo( d->url, "." ).isWritable() &&
+ d->moreFiles->item( d->moreFiles->currentItem() )->text() != ".." ) {
+ d->moreFiles->renameItem = d->moreFiles->item( d->moreFiles->currentItem() );
+ d->moreFiles->startRename( TRUE );
+ }
+ }
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( e->type() == QEvent::KeyPress && d->moreFiles->renaming ) {
+ d->moreFiles->lined->setFocus();
+ QApplication::sendEvent( d->moreFiles->lined, e );
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( e->type() == QEvent::KeyPress && files->renaming ) {
+ files->lined->setFocus();
+ QApplication::sendEvent( files->lined, e );
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( e->type() == QEvent::KeyPress &&
+ ((QKeyEvent *)e)->key() == Key_Backspace &&
+ ( o == files ||
+ o == d->moreFiles ||
+ o == files->viewport() ||
+ o == d->moreFiles->viewport() ) ) {
+ cdUpClicked();
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( e->type() == QEvent::KeyPress &&
+ ((QKeyEvent *)e)->key() == Key_Delete &&
+ ( o == files ||
+ o == files->viewport() ) ) {
+ if ( files->currentItem() )
+ deleteFile( files->currentItem()->text( 0 ) );
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( e->type() == QEvent::KeyPress &&
+ ((QKeyEvent *)e)->key() == Key_Delete &&
+ ( o == d->moreFiles ||
+ o == d->moreFiles->viewport() ) ) {
+ int c = d->moreFiles->currentItem();
+ if ( c >= 0 )
+ deleteFile( d->moreFiles->item( c )->text() );
+ ((QKeyEvent *)e)->accept();
+ return TRUE;
+ } else if ( o == files && e->type() == QEvent::FocusOut &&
+ files->currentItem() && mode() != ExistingFiles ) {
+ } else if ( o == files && e->type() == QEvent::KeyPress ) {
+ QTimer::singleShot( 0, this, SLOT(fixupNameEdit()) );
+ } else if ( o == nameEdit && e->type() == QEvent::KeyPress ) {
+ if ( ( nameEdit->cursorPosition() == (int)nameEdit->text().length() || nameEdit->hasSelectedText() ) &&
+ isprint(((QKeyEvent *)e)->ascii()) ) {
+#if defined(_WS_WIN_)
+ QString nt( nameEdit->text().lower() );
+#else
+ QString nt( nameEdit->text() );
+#endif
+ nt.truncate( nameEdit->cursorPosition() );
+ nt += (char)(((QKeyEvent *)e)->ascii());
+ QListViewItem * i = files->firstChild();
+#if defined(_WS_WIN_)
+ while( i && i->text( 0 ).left(nt.length()).lower() != nt )
+#else
+ while( i && i->text( 0 ).left(nt.length()) != nt )
+#endif
+ i = i->nextSibling();
+ if ( i ) {
+ nt = i->text( 0 );
+ int cp = nameEdit->cursorPosition()+1;
+ nameEdit->validateAndSet( nt, cp, cp, nt.length() );
+ return TRUE;
+ }
+ }
+ } else if ( o == nameEdit && e->type() == QEvent::FocusIn ) {
+ fileNameEditDone();
+ } else if ( d->moreFiles->renaming && o != d->moreFiles->lined && e->type() == QEvent::FocusIn ) {
+ d->moreFiles->lined->setFocus();
+ return TRUE;
+ } else if ( files->renaming && o != files->lined && e->type() == QEvent::FocusIn ) {
+ files->lined->setFocus();
+ return TRUE;
+ } else if ( ( o == d->moreFiles || o == d->moreFiles->viewport() ) &&
+ e->type() == QEvent::FocusIn ) {
+ if ( o == d->moreFiles->viewport() && !d->moreFiles->viewport()->hasFocus() ||
+ o == d->moreFiles && !d->moreFiles->hasFocus() )
+ ((QWidget*)o)->setFocus();
+ return FALSE;
+ }
+
+ return QDialog::eventFilter( o, e );
+}
+
+/*!
+ Sets the filters used in the file dialog to \a filters. Each group
+ of filters must be separated by \c{;;} (\e two semi-colons).
+
+ \code
+ QString types("*.png;;*.xpm;;*.jpg");
+ QFileDialogP fd = new QFileDialogP( this );
+ fd->setFilters( types );
+ fd->show();
+ \endcode
+
+*/
+
+void QFileDialogP::setFilters( const QString &filters )
+{
+ QStringList lst = makeFiltersList( filters );
+ setFilters( lst );
+}
+
+/*!
+ \overload
+
+ \a types must be a null-terminated list of strings.
+
+*/
+
+void QFileDialogP::setFilters( const char ** types )
+{
+ if ( !types || !*types )
+ return;
+
+ d->types->clear();
+ while( types && *types ) {
+ d->types->insertItem( QString::fromLatin1(*types) );
+ types++;
+ }
+ d->types->setCurrentItem( 0 );
+ setFilter( d->types->text( 0 ) );
+}
+
+
+/*! \overload void QFileDialogP::setFilters( const QStringList & )
+*/
+
+void QFileDialogP::setFilters( const QStringList & types )
+{
+ if ( types.count() < 1 )
+ return;
+
+ d->types->clear();
+ for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it )
+ d->types->insertItem( *it );
+ d->types->setCurrentItem( 0 );
+ setFilter( d->types->text( 0 ) );
+}
+
+/*!
+ Adds the filter \a filter to the list of filters and makes it the
+ current filter.
+
+ \code
+ QFileDialogP* fd = new QFileDialogP( this );
+ fd->addFilter( "Images (*.png *.jpg *.xpm)" );
+ fd->show();
+ \endcode
+
+ In the above example, a file dialog is created, and the file filter "Images
+ (*.png *.jpg *.xpm)" is added and is set as the current filter. The original
+ filter, "All Files (*)", is still available.
+
+ \sa setFilter(), setFilters()
+*/
+
+void QFileDialogP::addFilter( const QString &filter )
+{
+ if ( filter.isEmpty() )
+ return;
+ QString f = filter;
+ QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
+ int index = r.search( f );
+ if ( index >= 0 )
+ f = r.cap( 2 );
+ for ( int i = 0; i < d->types->count(); ++i ) {
+ QString f2( d->types->text( i ) );
+ int index = r.search( f2 );
+ if ( index >= 0 )
+ f2 = r.cap( 1 );
+ if ( f2 == f ) {
+ d->types->setCurrentItem( i );
+ setFilter( f2 );
+ return;
+ }
+ }
+
+ d->types->insertItem( filter );
+ d->types->setCurrentItem( d->types->count() - 1 );
+ setFilter( d->types->text( d->types->count() - 1 ) );
+}
+
+/*!
+ Since modeButtons is a top-level widget, it may be destroyed by the
+ kernel at application exit. Notice if this happens to
+ avoid double deletion.
+*/
+
+void QFileDialogP::modeButtonsDestroyed()
+{
+ if ( d )
+ d->modeButtons = 0;
+}
+
+
+/*!
+ This is a convenience static function that will return one or more
+ existing files selected by the user.
+
+ \code
+ QStringList files = QFileDialogP::getOpenFileNames(
+ "Images (*.png *.xpm *.jpg)",
+ "/home",
+ this,
+ "open files dialog"
+ "Select one or more files to open" );
+ \endcode
+
+ This function creates a modal file dialog called \a name, with
+ parent \a parent. If \a parent is not 0, the dialog will be shown
+ centered over the parent.
+
+ The file dialog's working directory will be set to \a dir. If \a
+ dir includes a file name, the file will be selected. The filter
+ is set to \a filter so that only those files which match the filter
+ are shown. The filter selected is set to \a selectedFilter. The parameters
+ \a dir, \a selectedFilter and \a filter may be QString::null.
+
+ The dialog's caption is set to \a caption. If \a caption is not
+ specified then a default caption will be used.
+
+ Under Windows and Mac OS X, this static function will use the native
+ file dialog and not a QFileDialogP, unless the style of the application
+ is set to something other than the native style.
+
+ Under Unix/X11, the normal behavior of the file dialog is to resolve
+ and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
+ the file dialog will change to /var/tmp after entering /usr/tmp.
+ If \a resolveSymlinks is FALSE, the file dialog will treat
+ symlinks as regular directories.
+
+ Note that if you want to iterate over the list of files, you should
+ iterate over a copy, e.g.
+ \code
+ QStringList list = files;
+ QStringList::Iterator it = list.begin();
+ while( it != list.end() ) {
+ myProcessing( *it );
+ ++it;
+ }
+ \endcode
+
+ \sa getOpenFileName(), getSaveFileName(), getExistingDirectory()
+*/
+
+QStringList QFileDialogP::getOpenFileNames( const QString & filter,
+ const QString& dir,
+ QWidget *parent,
+ const char* name,
+ const QString& caption,
+ QString *selectedFilter,
+ bool resolveSymlinks )
+{
+ bool save_qt_resolve_symlinks = qt_resolve_symlinks;
+ qt_resolve_symlinks = resolveSymlinks;
+
+ QStringList filters;
+ if ( !filter.isEmpty() )
+ filters = makeFiltersList( filter );
+
+ makeVariables();
+
+ if ( workingDirectory->isNull() )
+ *workingDirectory = QDir::currentDirPath();
+
+ if ( !dir.isEmpty() ) {
+ // #### works only correct for local files
+ QUrlOperator u( dir );
+ if ( u.isLocalFile() && QFileInfo( u ).isDir() ) {
+ *workingDirectory = dir;
+ } else {
+ *workingDirectory = u.toString();
+ }
+ }
+
+#if defined(Q_WS_WIN)
+ if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle )
+ return winGetOpenFileNames( filter, workingDirectory, parent, name, caption, selectedFilter );
+#elif defined(Q_WS_MAC)
+ if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) )
+ return macGetOpenFileNames(filter, workingDirectory, parent, name, caption );
+#endif
+
+ QFileDialogP *dlg = new QFileDialogP( *workingDirectory, QString::null, parent, name ? name : "qt_filedlg_gofns", TRUE );
+
+ Q_CHECK_PTR( dlg );
+#ifndef QT_NO_WIDGET_TOPEXTRA
+ if ( parent && parent->icon() && !parent->icon()->isNull() )
+ dlg->setIcon( *parent->icon() );
+ else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
+ dlg->setIcon( *qApp->mainWidget()->icon() );
+#endif
+
+ dlg->setFilters( filters );
+ if ( selectedFilter )
+ dlg->setFilter( *selectedFilter );
+#ifndef QT_NO_WIDGET_TOPEXTRA
+ if ( !caption.isNull() )
+ dlg->setCaption( caption );
+ else
+ dlg->setCaption( QFileDialogP::tr("Open") );
+#endif
+ dlg->setMode( QFileDialogP::ExistingFiles );
+ QString result;
+ QStringList lst;
+ if ( dlg->exec() == QDialog::Accepted ) {
+ lst = dlg->selectedFiles();
+ *workingDirectory = dlg->d->url;
+ if ( selectedFilter )
+ *selectedFilter = dlg->selectedFilter();
+ }
+ delete dlg;
+
+ qt_resolve_symlinks = save_qt_resolve_symlinks;
+
+ return lst;
+}
+
+/*! Updates the line edit to match the speed-key usage in QListView. */
+
+void QFileDialogP::fixupNameEdit()
+{
+ if ( files->currentItem() && d->mode != ExistingFiles ) {
+ if ( ( (QFileDialogPrivate::File*)files->currentItem() )->info.isFile() )
+ nameEdit->setText( files->currentItem()->text( 0 ) );
+ }
+}
+
+/*!
+ Returns the URL of the current working directory in the file dialog.
+
+ \sa setUrl()
+*/
+
+QUrl QFileDialogP::url() const
+{
+ return d->url;
+}
+
+static bool isRoot( const QUrl &u )
+{
+#if defined(Q_OS_MAC9)
+ QString p = QDir::convertSeparators(u.path());
+ if(p.contains(':') == 1)
+ return TRUE;
+#elif defined(Q_OS_UNIX)
+ if ( u.path() == "/" )
+ return TRUE;
+#elif defined(Q_OS_WIN32)
+ QString p = u.path();
+ if ( p.length() == 3 &&
+ p.right( 2 ) == ":/" )
+ return TRUE;
+ if ( p[ 0 ] == '/' && p[ 1 ] == '/' ) {
+ int slashes = p.contains( '/' );
+ if ( slashes <= 3 )
+ return TRUE;
+ if ( slashes == 4 && p[ (int)p.length() - 1 ] == '/' )
+ return TRUE;
+ }
+#else
+#if defined(Q_CC_GNU)
+#warning "case not covered.."
+#endif
+#endif
+
+ if ( !u.isLocalFile() && u.path() == "/" )
+ return TRUE;
+
+ return FALSE;
+}
+
+void QFileDialogP::urlStart( QNetworkOperation *op )
+{
+ if ( !op )
+ return;
+
+ if ( op->operation() == QNetworkProtocol::OpListChildren ) {
+ if ( isRoot( d->url ) )
+ d->cdToParent->setEnabled( FALSE );
+ else
+ d->cdToParent->setEnabled( TRUE );
+ d->mimeTypeTimer->stop();
+ d->sortedList.clear();
+ d->pendingItems.clear();
+ d->moreFiles->clearSelection();
+ files->clearSelection();
+ d->moreFiles->clear();
+ files->clear();
+ files->setSorting( -1 );
+
+ QString s = d->url.toString( FALSE, FALSE );
+ bool found = FALSE;
+ for ( int i = 0; i < d->paths->count(); ++i ) {
+#if defined(Q_WS_WIN)
+ if ( d->paths->text( i ).lower() == s.lower() ) {
+#else
+ if ( d->paths->text( i ) == s ) {
+#endif
+ found = TRUE;
+ d->paths->setCurrentItem( i );
+ break;
+ }
+ }
+ if ( !found ) {
+ d->paths->insertItem( *openFolderIcon, s, -1 );
+ d->paths->setCurrentItem( d->paths->count() - 1 );
+ }
+ d->last = 0;
+ d->hadDotDot = FALSE;
+
+ if ( d->goBack && d->history.last() != d->url.toString() ) {
+ d->history.append( d->url.toString() );
+ if ( d->history.count() > 1 )
+ d->goBack->setEnabled( TRUE );
+ }
+ }
+}
+
+void QFileDialogP::urlFinished( QNetworkOperation *op )
+{
+ if ( !op )
+ return;
+
+ if ( op->operation() == QNetworkProtocol::OpListChildren ) {
+ if ( QApplication::overrideCursor() )
+ QApplication::restoreOverrideCursor();
+ }
+ if ( op->state() == QNetworkProtocol::StFailed ) {
+ if ( d->paths->hasFocus() )
+ d->ignoreNextKeyPress = TRUE;
+
+ if ( d->progressDia ) {
+ d->ignoreStop = TRUE;
+ d->progressDia->close();
+ delete d->progressDia;
+ d->progressDia = 0;
+ }
+
+ QMessageBox::critical( this, tr( "Error" ), op->protocolDetail() );
+
+ int ecode = op->errorCode();
+ if ( ecode == QNetworkProtocol::ErrListChildren || ecode == QNetworkProtocol::ErrParse ||
+ ecode == QNetworkProtocol::ErrUnknownProtocol || ecode == QNetworkProtocol::ErrLoginIncorrect ||
+ ecode == QNetworkProtocol::ErrValid || ecode == QNetworkProtocol::ErrHostNotFound ||
+ ecode == QNetworkProtocol::ErrFileNotExisting ) {
+ if (d->url != d->oldUrl) {
+ QString nf = d->url.nameFilter();
+ d->url = d->oldUrl;
+ d->url.setNameFilter( nf );
+ rereadDir();
+ }
+ } else {
+ // another error happened, no need to go back to last dir
+ }
+ } else if ( op->operation() == QNetworkProtocol::OpListChildren &&
+ op == d->currListChildren ) {
+ if ( !d->hadDotDot && !isRoot( d->url ) ) {
+ bool ok = TRUE;
+#if defined(Q_WS_WIN)
+ if ( d->url.path().left( 2 ) == "//" )
+ ok = FALSE;
+#endif
+ if ( ok ) {
+ QUrlInfo ui( d->url, ".." );
+ ui.setName( ".." );
+ ui.setDir( TRUE );
+ ui.setFile( FALSE );
+ ui.setSymLink( FALSE );
+ ui.setSize( 0 );
+ QValueList<QUrlInfo> lst;
+ lst << ui;
+ insertEntry( lst, 0 );
+ }
+ }
+ resortDir();
+ } else if ( op->operation() == QNetworkProtocol::OpGet ) {
+ } else if ( op->operation() == QNetworkProtocol::OpPut ) {
+ rereadDir();
+ if ( d->progressDia ) {
+ d->ignoreStop = TRUE;
+ d->progressDia->close();
+ }
+ delete d->progressDia;
+ d->progressDia = 0;
+ }
+}
+
+void QFileDialogP::dataTransferProgress( int bytesDone, int bytesTotal, QNetworkOperation *op )
+{
+ if ( !op )
+ return;
+
+ QString label;
+ QUrl u( op->arg( 0 ) );
+ if ( u.isLocalFile() ) {
+ label = u.path();
+ } else {
+ label = QString( "%1 (on %2)" );
+ label = label.arg( u.path() ).arg( u.host() );
+ }
+
+ if ( !d->progressDia ) {
+ if ( bytesDone < bytesTotal) {
+ d->ignoreStop = FALSE;
+ d->progressDia = new QFDProgressDialog( this, label, bytesTotal );
+ connect( d->progressDia, SIGNAL( cancelled() ),
+ this, SLOT( stopCopy() ) );
+ d->progressDia->show();
+ } else
+ return;
+ }
+
+ if ( d->progressDia ) {
+ if ( op->operation() == QNetworkProtocol::OpGet ) {
+ if ( d->progressDia ) {
+ d->progressDia->setReadProgress( bytesDone );
+ }
+ } else if ( op->operation() == QNetworkProtocol::OpPut ) {
+ if ( d->progressDia ) {
+ d->progressDia->setWriteLabel( label );
+ d->progressDia->setWriteProgress( bytesDone );
+ }
+ } else {
+ return;
+ }
+ }
+}
+
+void QFileDialogP::insertEntry( const QValueList<QUrlInfo> &lst, QNetworkOperation *op )
+{
+ if ( op && op->operation() == QNetworkProtocol::OpListChildren &&
+ op != d->currListChildren )
+ return;
+ QValueList<QUrlInfo>::ConstIterator it = lst.begin();
+ for ( ; it != lst.end(); ++it ) {
+ const QUrlInfo &inf = *it;
+ if ( d->mode == DirectoryOnly && !inf.isDir() )
+ continue;
+ if ( inf.name() == ".." ) {
+ d->hadDotDot = TRUE;
+ if ( isRoot( d->url ) )
+ continue;
+#if defined(Q_WS_WIN)
+ if ( d->url.path().left( 2 ) == "//" )
+ continue;
+#endif
+ } else if ( inf.name() == "." )
+ continue;
+
+#if defined(Q_WS_WIN)
+ if ( !bShowHiddenFiles ) {
+ if ( d->url.isLocalFile() ) {
+ QString file = d->url.path() + inf.name();
+#if defined(UNICODE)
+ if ( qWinVersion() & Qt::WV_NT_based ) {
+ if ( GetFileAttributesW( (TCHAR*)qt_winTchar( file, TRUE ) ) & FILE_ATTRIBUTE_HIDDEN )
+ continue;
+ }
+ else
+#endif
+ {
+ if ( GetFileAttributesA( file.local8Bit() ) & FILE_ATTRIBUTE_HIDDEN )
+ continue;
+ }
+ } else {
+ if ( inf.name() != ".." && inf.name()[0] == QChar('.') )
+ continue;
+ }
+ }
+#else
+ if ( !bShowHiddenFiles && inf.name() != ".." ) {
+ if ( inf.name()[ 0 ] == QChar( '.' ) )
+ continue;
+ }
+
+#endif
+ if ( !d->url.isLocalFile() ) {
+ QFileDialogPrivate::File * i = 0;
+ QFileDialogPrivate::MCItem *i2 = 0;
+ i = new QFileDialogPrivate::File( d, &inf, files );
+ i2 = new QFileDialogPrivate::MCItem( d->moreFiles, i );
+
+ if ( d->mode == ExistingFiles && inf.isDir() ||
+ ( isDirectoryMode( d->mode ) && inf.isFile() ) ) {
+ i->setSelectable( FALSE );
+ i2->setSelectable( FALSE );
+ }
+
+ i->i = i2;
+ }
+
+ d->sortedList.append( new QUrlInfo( inf ) );
+ }
+}
+
+void QFileDialogP::removeEntry( QNetworkOperation *op )
+{
+ if ( !op )
+ return;
+
+ QUrlInfo *i = 0;
+ QListViewItemIterator it( files );
+ bool ok1 = FALSE, ok2 = FALSE;
+ for ( i = d->sortedList.first(); it.current(); ++it, i = d->sortedList.next() ) {
+ if ( ( (QFileDialogPrivate::File*)it.current() )->info.name() == op->arg( 0 ) ) {
+ d->pendingItems.removeRef( (QFileDialogPrivate::File*)it.current() );
+ delete ( (QFileDialogPrivate::File*)it.current() )->i;
+ delete it.current();
+ ok1 = TRUE;
+ }
+ if ( i && i->name() == op->arg( 0 ) ) {
+ d->sortedList.removeRef( i );
+ i = d->sortedList.prev();
+ ok2 = TRUE;
+ }
+ if ( ok1 && ok2 )
+ break;
+ }
+}
+
+void QFileDialogP::itemChanged( QNetworkOperation *op )
+{
+ if ( !op )
+ return;
+
+ QUrlInfo *i = 0;
+ QListViewItemIterator it1( files );
+ bool ok1 = FALSE, ok2 = FALSE;
+ // first check whether the new file replaces an existing file.
+ for ( i = d->sortedList.first(); it1.current(); ++it1, i = d->sortedList.next() ) {
+ if ( ( (QFileDialogPrivate::File*)it1.current() )->info.name() == op->arg( 1 ) ) {
+ delete ( (QFileDialogPrivate::File*)it1.current() )->i;
+ delete it1.current();
+ ok1 = TRUE;
+ }
+ if ( i && i->name() == op->arg( 1 ) ) {
+ d->sortedList.removeRef( i );
+ i = d->sortedList.prev();
+ ok2 = TRUE;
+ }
+ if ( ok1 && ok2 )
+ break;
+ }
+
+ i = 0;
+ QListViewItemIterator it( files );
+ ok1 = FALSE;
+ ok2 = FALSE;
+ for ( i = d->sortedList.first(); it.current(); ++it, i = d->sortedList.next() ) {
+ if ( ( (QFileDialogPrivate::File*)it.current() )->info.name() == op->arg( 0 ) ) {
+ ( (QFileDialogPrivate::File*)it.current() )->info.setName( op->arg( 1 ) );
+ ok1 = TRUE;
+ }
+ if ( i && i->name() == op->arg( 0 ) ) {
+ i->setName( op->arg( 1 ) );
+ ok2 = TRUE;
+ }
+ if ( ok1 && ok2 )
+ break;
+ }
+
+ resortDir();
+}
+
+/*!
+ \property QFileDialogP::infoPreview
+
+ \brief whether the file dialog can provide preview information about
+ the currently selected file
+
+ The default is FALSE.
+*/
+bool QFileDialogP::isInfoPreviewEnabled() const
+{
+ return d->infoPreview;
+}
+
+void QFileDialogP::setInfoPreviewEnabled( bool info )
+{
+ if ( info == d->infoPreview )
+ return;
+ d->geometryDirty = TRUE;
+ d->infoPreview = info;
+ updateGeometries();
+}
+
+
+/*!
+ \property QFileDialogP::contentsPreview
+
+ \brief whether the file dialog can provide a contents preview of the
+ currently selected file
+
+ The default is FALSE.
+
+ \sa setContentsPreview() setInfoPreviewEnabled()
+*/
+// ### improve the above documentation: how is the preview done, how can I add
+// support for customized preview, etc.
+
+bool QFileDialogP::isContentsPreviewEnabled() const
+{
+ return d->contentsPreview;
+}
+
+void QFileDialogP::setContentsPreviewEnabled( bool contents )
+{
+ if ( contents == d->contentsPreview )
+ return;
+ d->geometryDirty = TRUE;
+ d->contentsPreview = contents;
+ updateGeometries();
+}
+
+
+/*!
+ Sets the widget to be used for displaying information about the file
+ to the widget \a w and a preview of that information to the
+ QFilePreviewP \a preview.
+
+ Normally you would create a preview widget that derives from both QWidget and
+ QFilePreviewP, so you should pass the same widget twice.
+
+ \code
+ class Preview : public QLabel, public QFilePreviewP
+ {
+ public:
+ Preview( QWidget *parent=0 ) : QLabel( parent ) {}
+
+ void previewUrl( const QUrl &u )
+ {
+ QString path = u.path();
+ QPixmap pix( path );
+ if ( pix.isNull() )
+ setText( "This is not a pixmap" );
+ else
+ setText( "This is a pixmap" );
+ }
+ };
+
+ //...
+
+ int main( int argc, char** argv )
+ {
+ Preview* p = new Preview;
+
+ QFileDialogP* fd = new QFileDialogP( this );
+ fd->setInfoPreviewEnabled( TRUE );
+ fd->setInfoPreview( p, p );
+ fd->setPreviewMode( QFileDialogP::Info );
+ fd->show();
+ }
+
+ \endcode
+
+ \sa setContentsPreview(), setInfoPreviewEnabled(), setPreviewMode()
+
+*/
+
+void QFileDialogP::setInfoPreview( QWidget *w, QFilePreviewP *preview )
+{
+ if ( !w || !preview )
+ return;
+
+ if ( d->infoPreviewWidget ) {
+ d->preview->removeWidget( d->infoPreviewWidget );
+ delete d->infoPreviewWidget;
+ }
+ if ( d->infoPreviewer )
+ delete d->infoPreviewer;
+ d->infoPreviewWidget = w;
+ d->infoPreviewer = preview;
+ w->reparent( d->preview, 0, QPoint( 0, 0 ) );
+}
+
+/*!
+ Sets the widget to be used for displaying the contents of the file
+ to the widget \a w and a preview of those contents to the
+ QFilePreviewP \a preview.
+
+ Normally you would create a preview widget that derives from both QWidget and
+ QFilePreviewP, so you should pass the same widget twice.
+
+ \code
+ class Preview : public QLabel, public QFilePreviewP
+ {
+ public:
+ Preview( QWidget *parent=0 ) : QLabel( parent ) {}
+
+ void previewUrl( const QUrl &u )
+ {
+ QString path = u.path();
+ QPixmap pix( path );
+ if ( pix.isNull() )
+ setText( "This is not a pixmap" );
+ else
+ setPixmap( pix );
+ }
+ };
+
+ //...
+
+ int main( int argc, char** argv )
+ {
+ Preview* p = new Preview;
+
+ QFileDialogP* fd = new QFileDialogP( this );
+ fd->setContentsPreviewEnabled( TRUE );
+ fd->setContentsPreview( p, p );
+ fd->setPreviewMode( QFileDialogP::Contents );
+ fd->show();
+ }
+ \endcode
+
+ \sa setContentsPreviewEnabled(), setInfoPreview(), setPreviewMode()
+*/
+
+void QFileDialogP::setContentsPreview( QWidget *w, QFilePreviewP *preview )
+{
+ if ( !w || !preview )
+ return;
+
+ if ( d->contentsPreviewWidget ) {
+ d->preview->removeWidget( d->contentsPreviewWidget );
+ delete d->contentsPreviewWidget;
+ }
+ if ( d->contentsPreviewer )
+ delete d->contentsPreviewer;
+ d->contentsPreviewWidget = w;
+ d->contentsPreviewer = preview;
+ w->reparent( d->preview, 0, QPoint( 0, 0 ) );
+}
+
+/*!
+ Re-sorts the displayed directory.
+
+ \sa rereadDir()
+*/
+
+void QFileDialogP::resortDir()
+{
+ d->mimeTypeTimer->stop();
+ d->pendingItems.clear();
+
+ QFileDialogPrivate::File *item = 0;
+ QFileDialogPrivate::MCItem *item2 = 0;
+
+ d->sortedList.sort();
+
+ if ( files->childCount() > 0 || d->moreFiles->count() > 0 ) {
+ d->moreFiles->clear();
+ files->clear();
+ d->last = 0;
+ files->setSorting( -1 );
+ }
+
+ QUrlInfo *i = sortAscending ? d->sortedList.first() : d->sortedList.last();
+ for ( ; i; i = sortAscending ? d->sortedList.next() : d->sortedList.prev() ) {
+ item = new QFileDialogPrivate::File( d, i, files );
+ item2 = new QFileDialogPrivate::MCItem( d->moreFiles, item, item2 );
+ item->i = item2;
+ d->pendingItems.append( item );
+ if ( d->mode == ExistingFiles && item->info.isDir() ||
+ ( isDirectoryMode( d->mode ) && item->info.isFile() ) ) {
+ item->setSelectable( FALSE );
+ item2->setSelectable( FALSE );
+ }
+ }
+
+ // ##### As the QFileIconProviderP only support QFileInfo and no
+ // QUrlInfo it can be only used for local files at the moment. In
+ // 3.0 we have to change the API of QFileIconProviderP to work on
+ // QUrlInfo so that also remote filesystems can be show mime-type
+ // specific icons.
+ if ( d->url.isLocalFile() )
+ d->mimeTypeTimer->start( 0 );
+}
+
+/*!
+ Stops the current copy operation.
+*/
+
+void QFileDialogP::stopCopy()
+{
+ if ( d->ignoreStop )
+ return;
+
+ d->url.blockSignals( TRUE );
+ d->url.stop();
+ if ( d->progressDia ) {
+ d->ignoreStop = TRUE;
+ QTimer::singleShot( 100, this, SLOT( removeProgressDia() ) );
+ }
+ d->url.blockSignals( FALSE );
+}
+
+/*!
+ \internal
+*/
+
+void QFileDialogP::removeProgressDia()
+{
+ if ( d->progressDia )
+ delete d->progressDia;
+ d->progressDia = 0;
+}
+
+/*!
+ \internal
+*/
+
+void QFileDialogP::doMimeTypeLookup()
+{
+ if ( !iconProvider() ) {
+ d->pendingItems.clear();
+ d->mimeTypeTimer->stop();
+ return;
+ }
+
+ d->mimeTypeTimer->stop();
+ if ( d->pendingItems.count() == 0 ) {
+ return;
+ }
+
+ QRect r;
+ QFileDialogPrivate::File *item = d->pendingItems.first();
+ if ( item ) {
+ QFileInfo fi;
+ if ( d->url.isLocalFile() ) {
+ fi.setFile( QUrl( d->url.path(), QFileDialogPrivate::encodeFileName( item->info.name() ) ).path( FALSE ) );
+ } else
+ fi.setFile( item->info.name() ); // #####
+ const QPixmap *p = iconProvider()->pixmap( fi );
+ if ( p && p != item->pixmap( 0 ) &&
+ ( !item->pixmap( 0 ) || p->serialNumber() != item->pixmap( 0 )->serialNumber() ) &&
+ p != fifteenTransparentPixels ) {
+ item->hasMimePixmap = TRUE;
+
+ // evil hack to avoid much too much repaints!
+ qApp->processEvents();
+ files->setUpdatesEnabled( FALSE );
+ files->viewport()->setUpdatesEnabled( FALSE );
+ if ( item != d->pendingItems.first() )
+ return;
+ item->setPixmap( 0, *p );
+ qApp->processEvents();
+ files->setUpdatesEnabled( TRUE );
+ files->viewport()->setUpdatesEnabled( TRUE );
+
+ if ( files->isVisible() ) {
+ QRect ir( files->itemRect( item ) );
+ if ( ir != QRect( 0, 0, -1, -1 ) ) {
+ r = r.unite( ir );
+ }
+ } else {
+ QRect ir( d->moreFiles->itemRect( item->i ) );
+ if ( ir != QRect( 0, 0, -1, -1 ) ) {
+ r = r.unite( ir );
+ }
+ }
+ }
+ if ( d->pendingItems.count() )
+ d->pendingItems.removeFirst();
+ }
+
+ if ( d->moreFiles->isVisible() ) {
+ d->moreFiles->viewport()->repaint( r, FALSE );
+ } else {
+ files->viewport()->repaint( r, FALSE );
+ }
+
+ if ( d->pendingItems.count() )
+ d->mimeTypeTimer->start( 0 );
+ else if ( d->moreFiles->isVisible() )
+ d->moreFiles->triggerUpdate( TRUE );
+}
+
+/*!
+ If \a b is TRUE then all the files in the current directory are selected;
+ otherwise, they are deselected.
+*/
+
+void QFileDialogP::selectAll( bool b )
+{
+ if ( d->mode != ExistingFiles )
+ return;
+ d->moreFiles->selectAll( b );
+ files->selectAll( b );
+}
+
+void QFileDialogP::goBack()
+{
+ if ( !d->goBack || !d->goBack->isEnabled() )
+ return;
+ d->history.remove( d->history.last() );
+ if ( d->history.count() < 2 )
+ d->goBack->setEnabled( FALSE );
+ setUrl( d->history.last() );
+}
+
+// a class with wonderfully inflexible flexibility. why doesn't it
+// just subclass QWidget in the first place? 'you have to derive your
+// preview widget from QWidget and from this class' indeed.
+
+/*!
+ \class QFilePreviewP qfiledialog.h
+ \ingroup misc
+ \brief The QFilePreviewP class provides file previewing in QFileDialogP.
+
+ This class is an abstract base class which is used to implement
+ widgets that can display a preview of a file in a QFileDialogP.
+
+ You must derive the preview widget from both QWidget and from this
+ class. Then you must reimplement this class's previewUrl() function,
+ which is called by the file dialog if the preview of a file
+ (specified as a URL) should be shown.
+
+ See also QFileDialog::setPreviewMode(), QFileDialogP::setContentsPreview(),
+ QFileDialogP::setInfoPreview(), QFileDialogP::setInfoPreviewEnabled(),
+ QFileDialogP::setContentsPreviewEnabled().
+
+ For an example of a preview widget see qt/examples/qdir/qdir.cpp.
+*/
+
+/*!
+ Constructs the QFilePreviewP.
+*/
+
+QFilePreviewP::QFilePreviewP()
+{
+}
+
+/*!
+ \fn void QFilePreviewP::previewUrl( const QUrl &url )
+
+ This function is called by QFileDialogP if a preview
+ for the \a url should be shown. Reimplement this
+ function to provide file previewing.
+*/
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qfiledialogP.h
+// Description : the patch for Qt's QFileDialog class (qfiledialog.h)
+/////////////////////////////////////////////////////////////////////////////
+
+/****************************************************************************
+** $Id$
+**
+** Definition of QFileDialog class
+**
+** Created : 950428
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the dialogs module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QFILEDIALOGP_H
+#define QFILEDIALOGP_H
+
+class QPushButton;
+class QButton;
+class QLabel;
+class QWidget;
+class QFileDialog;
+class QTimer;
+class QNetworkOperation;
+class QLineEdit;
+class QListViewItem;
+class QListBoxItem;
+class QProgressBar;
+class QFileDialogPrivate;
+class QFileDialogQFileListView;
+
+#ifndef QT_H
+#include "qdir.h"
+#include "qdialog.h"
+#include "qurloperator.h"
+#include "qurlinfo.h"
+#include "qlistbox.h"
+#include "qlistview.h"
+#include "qlineedit.h"
+#endif // QT_H
+
+#ifndef QT_NO_FILEDIALOG
+
+class Q_EXPORT QFileIconProviderP : public QObject
+{
+ Q_OBJECT
+public:
+ QFileIconProviderP( QObject * parent = 0, const char* name = 0 );
+ virtual const QPixmap * pixmap( const QFileInfo & );
+
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ QFileIconProviderP( const QFileIconProviderP & );
+ QFileIconProviderP& operator=( const QFileIconProviderP & );
+#endif
+};
+
+class Q_EXPORT QFilePreviewP
+{
+public:
+ QFilePreviewP();
+ virtual void previewUrl( const QUrl &url ) = 0;
+
+};
+
+class Q_EXPORT QFileDialogP : public QDialog
+{
+ Q_OBJECT
+ Q_ENUMS( Mode ViewMode PreviewMode )
+ // ##### Why are this read-only properties ?
+ Q_PROPERTY( QString selectedFile READ selectedFile )
+ Q_PROPERTY( QString selectedFilter READ selectedFilter )
+ Q_PROPERTY( QStringList selectedFiles READ selectedFiles )
+ // #### Should not we be able to set the path ?
+ Q_PROPERTY( QString dirPath READ dirPath )
+ Q_PROPERTY( bool showHiddenFiles READ showHiddenFiles WRITE setShowHiddenFiles )
+ Q_PROPERTY( Mode mode READ mode WRITE setMode )
+ Q_PROPERTY( ViewMode viewMode READ viewMode WRITE setViewMode )
+ Q_PROPERTY( PreviewMode previewMode READ previewMode WRITE setPreviewMode )
+ Q_PROPERTY( bool infoPreview READ isInfoPreviewEnabled WRITE setInfoPreviewEnabled )
+ Q_PROPERTY( bool contentsPreview READ isContentsPreviewEnabled WRITE setContentsPreviewEnabled )
+
+public:
+ QFileDialogP( const QString& dirName, const QString& filter = QString::null,
+ QWidget* parent=0, const char* name=0, bool modal = FALSE );
+ QFileDialogP( QWidget* parent=0, const char* name=0, bool modal = FALSE );
+ ~QFileDialogP();
+
+ // recommended static functions
+
+ static QString getOpenFileName( const QString &initially = QString::null,
+ const QString &filter = QString::null,
+ QWidget *parent = 0, const char* name = 0,
+ const QString &caption = QString::null,
+ QString *selectedFilter = 0,
+ bool resolveSymlinks = TRUE);
+ static QString getSaveFileName( const QString &initially = QString::null,
+ const QString &filter = QString::null,
+ QWidget *parent = 0, const char* name = 0,
+ const QString &caption = QString::null,
+ QString *selectedFilter = 0,
+ bool resolveSymlinks = TRUE);
+ static QString getExistingDirectory( const QString &dir = QString::null,
+ QWidget *parent = 0,
+ const char* name = 0,
+ const QString &caption = QString::null,
+ bool dirOnly = TRUE,
+ bool resolveSymlinks = TRUE);
+ static QStringList getOpenFileNames( const QString &filter= QString::null,
+ const QString &dir = QString::null,
+ QWidget *parent = 0,
+ const char* name = 0,
+ const QString &caption = QString::null,
+ QString *selectedFilter = 0,
+ bool resolveSymlinks = TRUE);
+
+ // other static functions
+
+ static void setIconProvider( QFileIconProviderP * );
+ static QFileIconProviderP* iconProvider();
+
+ // non-static function for special needs
+
+ QString selectedFile() const;
+ QString selectedFilter() const;
+ virtual void setSelectedFilter( const QString& );
+ virtual void setSelectedFilter( int );
+
+ void setSelection( const QString &);
+
+ void selectAll( bool b );
+
+ QStringList selectedFiles() const;
+
+ QString dirPath() const;
+
+ void setDir( const QDir & );
+ const QDir *dir() const;
+
+ void setShowHiddenFiles( bool s );
+ bool showHiddenFiles() const;
+
+ void rereadDir();
+ void resortDir();
+
+ enum Mode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly };
+ void setMode( Mode );
+ Mode mode() const;
+
+ enum ViewMode { Detail, List };
+ enum PreviewMode { NoPreview, Contents, Info };
+ void setViewMode( ViewMode m );
+ ViewMode viewMode() const;
+ void setPreviewMode( PreviewMode m );
+ PreviewMode previewMode() const;
+
+ bool eventFilter( QObject *, QEvent * );
+
+ bool isInfoPreviewEnabled() const;
+ bool isContentsPreviewEnabled() const;
+ void setInfoPreviewEnabled( bool );
+ void setContentsPreviewEnabled( bool );
+
+ void setInfoPreview( QWidget *w, QFilePreviewP *preview );
+ void setContentsPreview( QWidget *w, QFilePreviewP *preview );
+
+ QUrl url() const;
+
+ void addFilter( const QString &filter );
+
+public slots:
+ void done( int );
+ void setDir( const QString& );
+ void setUrl( const QUrlOperator &url );
+ void setFilter( const QString& );
+ void setFilters( const QString& );
+ void setFilters( const char ** );
+ void setFilters( const QStringList& );
+
+protected:
+ void resizeEvent( QResizeEvent * );
+ void keyPressEvent( QKeyEvent * );
+
+ void addWidgets( QLabel *, QWidget *, QPushButton * );
+ void addToolButton( QButton *b, bool separator = FALSE );
+ void addLeftWidget( QWidget *w );
+ void addRightWidget( QWidget *w );
+
+signals:
+ void fileHighlighted( const QString& );
+ void fileSelected( const QString& );
+ void filesSelected( const QStringList& );
+ void dirEntered( const QString& );
+ void filterSelected( const QString& );
+
+private slots:
+ void detailViewSelectionChanged();
+ void listBoxSelectionChanged();
+ void changeMode( int );
+ void fileNameEditReturnPressed();
+ void stopCopy();
+ void removeProgressDia();
+
+ void fileSelected( int );
+ void fileHighlighted( int );
+ void dirSelected( int );
+ void pathSelected( int );
+
+ void updateFileNameEdit( QListViewItem *);
+ void selectDirectoryOrFile( QListViewItem * );
+ void popupContextMenu( QListViewItem *, const QPoint &, int );
+ void popupContextMenu( QListBoxItem *, const QPoint & );
+ void updateFileNameEdit( QListBoxItem *);
+ void selectDirectoryOrFile( QListBoxItem * );
+ void fileNameEditDone();
+
+ void okClicked();
+ void filterClicked(); // not used
+ void cancelClicked();
+
+ void cdUpClicked();
+ void newFolderClicked();
+
+ void fixupNameEdit();
+
+ void doMimeTypeLookup();
+
+ void updateGeometries();
+ void modeButtonsDestroyed();
+ void urlStart( QNetworkOperation *op );
+ void urlFinished( QNetworkOperation *op );
+ void dataTransferProgress( int bytesDone, int bytesTotal, QNetworkOperation * );
+ void insertEntry( const QValueList<QUrlInfo> &fi, QNetworkOperation *op );
+ void removeEntry( QNetworkOperation * );
+ void createdDirectory( const QUrlInfo &info, QNetworkOperation * );
+ void itemChanged( QNetworkOperation * );
+ void goBack();
+
+private:
+ enum PopupAction {
+ PA_Open = 0,
+ PA_Delete,
+ PA_Rename,
+ PA_SortName,
+ PA_SortSize,
+ PA_SortType,
+ PA_SortDate,
+ PA_SortUnsorted,
+ PA_Cancel,
+ PA_Reload,
+ PA_Hidden
+ };
+
+ void init();
+ bool trySetSelection( bool isDir, const QUrlOperator &, bool );
+ void deleteFile( const QString &filename );
+ void popupContextMenu( const QString &filename, bool withSort,
+ PopupAction &action, const QPoint &p );
+
+ QDir reserved; // was cwd
+ QString fileName;
+
+ friend class QFileDialogQFileListView;
+ friend class QFileListBox;
+
+ QFileDialogPrivate *d;
+ QFileDialogQFileListView *files;
+
+ QLineEdit *nameEdit; // also filter
+ QPushButton *okB;
+ QPushButton *cancelB;
+
+#if defined(Q_WS_WIN)
+ static QString winGetOpenFileName( const QString &initialSelection,
+ const QString &filter,
+ QString* workingDirectory,
+ QWidget *parent = 0,
+ const char* name = 0,
+ const QString& caption = QString::null,
+ QString* selectedFilter = 0 );
+ static QString winGetSaveFileName( const QString &initialSelection,
+ const QString &filter,
+ QString* workingDirectory,
+ QWidget *parent = 0,
+ const char* name = 0,
+ const QString& caption = QString::null,
+ QString* selectedFilter = 0 );
+ static QStringList winGetOpenFileNames( const QString &filter,
+ QString* workingDirectory,
+ QWidget *parent = 0,
+ const char* name = 0,
+ const QString& caption = QString::null,
+ QString* selectedFilter = 0 );
+ static QString winGetExistingDirectory( const QString &initialDirectory,
+ QWidget* parent = 0,
+ const char* name = 0,
+ const QString& caption = QString::null);
+ static QString resolveLinkFile( const QString& linkfile );
+#endif
+#if defined(Q_WS_MACX) || defined(Q_WS_MAC9)
+ static QString macGetSaveFileName( const QString &, const QString &,
+ QString *, QWidget *, const char*,
+ const QString& );
+ static QStringList macGetOpenFileNames( const QString &, QString*,
+ QWidget *, const char *,
+ const QString&, bool = TRUE,
+ bool = FALSE );
+#endif
+
+
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ QFileDialogP( const QFileDialogP & );
+ QFileDialogP &operator=( const QFileDialogP & );
+#endif
+};
+
+/******************************************************************
+ *
+ * Definitions of view classes
+ *
+ ******************************************************************/
+
+class QRenameEdit : public QLineEdit
+{
+ Q_OBJECT
+
+public:
+ QRenameEdit( QWidget *parent )
+ : QLineEdit( parent, "qt_rename_edit" )
+ {}
+
+protected:
+ void keyPressEvent( QKeyEvent *e );
+ void focusOutEvent( QFocusEvent *e );
+
+signals:
+ void escapePressed();
+
+};
+
+class QFileListBox : public QListBox
+{
+ friend class QFileDialogP;
+
+ Q_OBJECT
+
+private:
+ QFileListBox( QWidget *parent, QFileDialogP *d );
+
+ void clear();
+ void show();
+ void startRename( bool check = TRUE );
+ void viewportMousePressEvent( QMouseEvent *e );
+ void viewportMouseReleaseEvent( QMouseEvent *e );
+ void viewportMouseDoubleClickEvent( QMouseEvent *e );
+ void viewportMouseMoveEvent( QMouseEvent *e );
+#ifndef QT_NO_DRAGANDDROP
+ void viewportDragEnterEvent( QDragEnterEvent *e );
+ void viewportDragMoveEvent( QDragMoveEvent *e );
+ void viewportDragLeaveEvent( QDragLeaveEvent *e );
+ void viewportDropEvent( QDropEvent *e );
+ bool acceptDrop( const QPoint &pnt, QWidget *source );
+ void setCurrentDropItem( const QPoint &pnt );
+#endif
+ void keyPressEvent( QKeyEvent *e );
+
+private slots:
+ void rename();
+ void cancelRename();
+ void doubleClickTimeout();
+ void changeDirDuringDrag();
+ void dragObjDestroyed();
+ void contentsMoved( int, int );
+
+private:
+ QRenameEdit *lined;
+ QFileDialogP *filedialog;
+ bool renaming;
+ QTimer* renameTimer;
+ QListBoxItem *renameItem, *dragItem;
+ QPoint pressPos, oldDragPos;
+ bool mousePressed;
+ int urls;
+ QString startDragDir;
+ QListBoxItem *currDropItem;
+ QTimer *changeDirTimer;
+ bool firstMousePressEvent;
+ QUrlOperator startDragUrl;
+
+};
+
+
+class QFileDialogQFileListView : public QListView
+{
+ Q_OBJECT
+
+public:
+ QFileDialogQFileListView( QWidget *parent, QFileDialogP *d );
+
+ void clear();
+ void startRename( bool check = TRUE );
+ void setSorting( int column, bool increasing = TRUE );
+
+ QRenameEdit *lined;
+ bool renaming;
+ QListViewItem *renameItem;
+
+private:
+ void viewportMousePressEvent( QMouseEvent *e );
+ void viewportMouseDoubleClickEvent( QMouseEvent *e );
+ void keyPressEvent( QKeyEvent *e );
+ void viewportMouseReleaseEvent( QMouseEvent *e );
+ void viewportMouseMoveEvent( QMouseEvent *e );
+#ifndef QT_NO_DRAGANDDROP
+ void viewportDragEnterEvent( QDragEnterEvent *e );
+ void viewportDragMoveEvent( QDragMoveEvent *e );
+ void viewportDragLeaveEvent( QDragLeaveEvent *e );
+ void viewportDropEvent( QDropEvent *e );
+ bool acceptDrop( const QPoint &pnt, QWidget *source );
+ void setCurrentDropItem( const QPoint &pnt );
+#endif
+
+private slots:
+ void rename();
+ void cancelRename();
+ void changeSortColumn2( int column );
+ void doubleClickTimeout();
+ void changeDirDuringDrag();
+ void dragObjDestroyed();
+ void contentsMoved( int, int );
+
+private:
+ QFileDialogP *filedialog;
+ QTimer* renameTimer;
+ QPoint pressPos, oldDragPos;
+ bool mousePressed;
+ int urls;
+ QString startDragDir;
+ QListViewItem *currDropItem, *dragItem;
+ QTimer *changeDirTimer;
+ bool firstMousePressEvent;
+ bool ascending;
+ int sortcolumn;
+ QUrlOperator startDragUrl;
+
+};
+
+/****************************************************************************
+ *
+ * Classes for copy progress dialog
+ *
+ ****************************************************************************/
+
+class QFDProgressAnimation : public QWidget
+{
+ Q_OBJECT
+
+public:
+ QFDProgressAnimation( QWidget *parent );
+ void start();
+
+private slots:
+ void next();
+
+protected:
+ void paintEvent( QPaintEvent *e );
+
+private:
+ int step;
+ QTimer *timer;
+
+};
+
+class QFDProgressDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QFDProgressDialog( QWidget *parent, const QString &fn, int steps );
+
+ void setReadProgress( int p );
+ void setWriteProgress( int p );
+ void setWriteLabel( const QString &s );
+
+signals:
+ void cancelled();
+
+private:
+ QProgressBar *readBar;
+ QProgressBar *writeBar;
+ QLabel *writeLabel;
+ QFDProgressAnimation *animation;
+
+};
+
+#endif
+
+#endif // QFILEDIALOG_H
-// SALOME PatchQt : patch for Qt
-//
-// 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 : qsplitterP.cxx
-// Module : SALOME
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qsplitterP.cxx
+// Description : the patch for Qt's QSplitter class (qsplitter.cpp)
+/////////////////////////////////////////////////////////////////////////////
-using namespace std;
/****************************************************************************
** $Id$
**
** not clear to you.
**
**********************************************************************/
+
+using namespace std;
#include "qsplitterP.h"
#ifndef QT_NO_COMPLEXWIDGETS
-// SALOME PatchQt : patch for Qt
-//
-// 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 : qsplitterP.h
-// Module : SALOME
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qsplitterP.h
+// Description : the patch for Qt's QSplitter class (qsplitter.h)
+/////////////////////////////////////////////////////////////////////////////
/****************************************************************************
** $Id$
QSplitterPHandle* getHandleBefore(QWidget* w);
// VSR 21/11/02 <- ================================
+// ASL 07/09/04
+ bool isCompressed( const QWidget* ) const;
+// ASL 07/09/04
+
protected:
void childEvent( QChildEvent * );
int idAfter( QWidget* ) const;
QWidget* widgetBefore( int id ) const;
QWidget* widgetAfter( int id ) const;
- bool isCompressed(const QWidget*) const;
+
QSize minSize( const QWidget *w ) const;
QSize maxSize( const QWidget *w ) const;
-// SALOME PatchQt : patch for Qt
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : qworkspaceP.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qworkspaceP.cxx
+// Description : the patch for Qt's QWorkspace class (qworkspace.cpp)
+/////////////////////////////////////////////////////////////////////////////
+
+/****************************************************************************
+** $Id$
+**
+** Implementation of the QWorkspace class
+**
+** Created : 931107
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the workspace module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition licenses may use this
+** file in accordance with the Qt Commercial License Agreement provided
+** with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
using namespace std;
#include "qworkspaceP.h"
-// SALOME PatchQt : patch for Qt
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : qworkspaceP.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
+/////////////////////////////////////////////////////////////////////////////
+// Module : PatchQt
+// File : qworkspaceP.h
+// Description : the patch for Qt's QWorkspace class (qworkspace.h)
+/////////////////////////////////////////////////////////////////////////////
+
+/****************************************************************************
+** $Id$
+**
+** Definition of the QWorkspace class
+**
+** Created : 990210
+**
+** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the workspace module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition licenses may use this
+** file in accordance with the Qt Commercial License Agreement provided
+** with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
#ifndef QWORKSPACEP_H
#define QWORKSPACEP_H
Plot2d_ViewFrame.h \
Plot2d_SetupViewDlg.h \
Plot2d_SetupPlot2dDlg.h \
- Plot2d_FitDataDlg.h
+ Plot2d_FitDataDlg.h \
+ Plot2d_Prs.h
# .po files to transform in .qm
#PO_FILES = \
Plot2d_ViewFrame.cxx \
Plot2d_SetupViewDlg.cxx \
Plot2d_SetupPlot2dDlg.cxx \
- Plot2d_FitDataDlg.cxx
+ Plot2d_FitDataDlg.cxx \
+ Plot2d_Prs.cxx
LIB_MOC = \
Plot2d.h \
SALOME_Exception.idl
CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomeGUI
+LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomePrs -lSalomeGUI
@CONCLUDE@
/*!
Returns true if contains no curves
*/
-bool Plot2d_CurveContainer::isEmpty()
+bool Plot2d_CurveContainer::isEmpty() const
{
return myCurves.isEmpty();
}
void removeCurve( const int index, bool alsoDelete = false ) ;
void clear( bool alsoDelete = false );
int count();
- bool isEmpty();
+ bool isEmpty() const;
Plot2d_Curve* curve( const int index );
private:
--- /dev/null
+// SALOME OCCViewer : build OCC Viewer into Salome desktop
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : Plot2d_Prs.cxx
+// Author : Sergey ANIKIN
+// Module : SALOME
+// $Header$
+
+#include "Plot2d_Prs.h"
+
+//==========================================================
+/*!
+ * Plot2d_Prs::Plot2d_Prs
+ * Default constructor
+ */
+//==========================================================
+Plot2d_Prs::Plot2d_Prs()
+{
+}
+
+//==========================================================
+/*!
+ * Plot2d_Prs::Plot2d_Prs
+ * Standard constructor
+ */
+//==========================================================
+Plot2d_Prs::Plot2d_Prs( const Plot2d_Curve* obj )
+{
+ AddObject( obj );
+}
+
+//==========================================================
+/*!
+ * Plot2d_Prs::~Plot2d_Prs
+ * Destructor
+ */
+//==========================================================
+Plot2d_Prs::~Plot2d_Prs()
+{
+ myObjects.clear();
+}
+
+//==========================================================
+/*!
+ * Plot2d_Prs::GetObjects
+ * Get curves list
+ */
+//==========================================================
+Plot2d_CurveContainer Plot2d_Prs::GetObjects() const
+{
+ return myObjects;
+}
+
+//==========================================================
+/*!
+ * Plot2d_Prs::AddObject
+ * Add curbe
+ */
+//==========================================================
+void Plot2d_Prs::AddObject( const Plot2d_Curve* obj )
+{
+ myObjects.addCurve( (Plot2d_Curve*)obj );
+}
+
+//==========================================================
+/*!
+ * Plot2d_Prs::IsNull
+ * Return 0 if list of the curves is empty
+ * [ Reimplemented from SALOME_Prs ]
+ */
+//==========================================================
+bool Plot2d_Prs::IsNull() const
+{
+ return myObjects.isEmpty();
+}
--- /dev/null
+// SALOME OCCViewer : build OCC Viewer into Salome desktop
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : Plot2d_Prs.h
+// Author : Sergey ANIKIN
+// Module : SALOME
+// $Header$
+
+#ifndef PLOT2D_PRS_H
+#define PLOT2D_PRS_H
+
+#include "SALOME_Prs.h"
+#include <Plot2d_CurveContainer.h>
+
+class Plot2d_Curve;
+
+class Plot2d_Prs : public SALOME_Prs2d
+{
+public:
+ Plot2d_Prs();
+ // Default constructor
+ Plot2d_Prs( const Plot2d_Curve* obj );
+ // Standard constructor
+ ~Plot2d_Prs();
+ // Destructor
+
+ Plot2d_CurveContainer GetObjects() const;
+ // Get curves list
+ void AddObject( const Plot2d_Curve* obj );
+ // Add curve
+
+ bool IsNull() const;
+ // Reimplemented from SALOME_Prs
+
+private:
+ Plot2d_CurveContainer myObjects; // list of curves
+};
+
+#endif
#include <qcolordialog.h>
#include <qspinbox.h>
+#include "utilities.h"
+
+using namespace std;
+
#define DLG_SIZE_WIDTH 500
#define DLG_SIZE_HEIGHT 400
#define MAX_LINE_WIDTH 100
frameLayout->addWidget( item->myVBtn, row, 1 );
frameLayout->addWidget( item->myTitleLab, row, 3 );
if ( rowTitles->length() > 0 )
- item->myTitleLab->setText( QString( strdup( rowTitles[ i ] ) ) );
+ item->myTitleLab->setText( QString( rowTitles[ i ] ) );
frameLayout->addWidget( item->myUnitLab, row, 5 );
if ( rowUnits->length() > 0 )
- item->myUnitLab->setText( QString( strdup( rowUnits[ i ] ) ) );
+ item->myUnitLab->setText( QString( rowUnits[ i ] ) );
frameLayout->addWidget( item->myAutoCheck, row, 7 );
frameLayout->addWidget( item->myLineCombo, row, 8 );
frameLayout->addWidget( item->myLineSpin, row, 9 );
frameLayout->addWidget( item->myVBtn, row, 1 );
frameLayout->addWidget( item->myTitleLab, row, 3 );
if ( rowTitles->length() > 0 )
- item->myTitleLab->setText( QString( strdup( rowTitles[ i ] ) ) );
+ item->myTitleLab->setText( QString( rowTitles[ i ] ) );
frameLayout->addWidget( item->myUnitLab, row, 5 );
if ( rowUnits->length() > 0 )
- item->myUnitLab->setText( QString( strdup( rowUnits[ i ] ) ) );
+ item->myUnitLab->setText( QString( rowUnits[ i ] ) );
frameLayout->addWidget( item->myAutoCheck, row, 7 );
frameLayout->addWidget( item->myLineCombo, row, 8 );
frameLayout->addWidget( item->myLineSpin, row, 9 );
Plot2d_Curve* curve = new Plot2d_Curve();
// curve titles
if ( rowTitles->length() > 0 ) {
- curve->setHorTitle( strdup( rowTitles[ horIndex ] ) );
- curve->setVerTitle( strdup( rowTitles[ verIndex[i] ] ) );
+ curve->setHorTitle( QString( rowTitles[ horIndex ] ) );
+ curve->setVerTitle( QString( rowTitles[ verIndex[i] ] ) );
}
// curve units
if ( rowUnits->length() > 0 ) {
- curve->setHorUnits( strdup( rowUnits[ horIndex ] ) );
- curve->setVerUnits( strdup( rowUnits[ verIndex[i] ] ) );
+ curve->setHorUnits( QString( rowUnits[ horIndex ] ) );
+ curve->setVerUnits( QString( rowUnits[ verIndex[i] ] ) );
}
// curve data
int nbPoints = 0;
Plot2d_Curve* curve = new Plot2d_Curve();
// curve titles
if ( rowTitles->length() > 0 ) {
- curve->setHorTitle( strdup( rowTitles[ horIndex ] ) );
- curve->setVerTitle( strdup( rowTitles[ verIndex[i] ] ) );
+ curve->setHorTitle( QString( rowTitles[ horIndex ] ) );
+ curve->setVerTitle( QString( rowTitles[ verIndex[i] ] ) );
}
// curve units
if ( rowUnits->length() > 0 ) {
- curve->setHorUnits( strdup( rowUnits[ horIndex ] ) );
- curve->setVerUnits( strdup( rowUnits[ verIndex[i] ] ) );
+ curve->setHorUnits( QString( rowUnits[ horIndex ] ) );
+ curve->setVerUnits( QString( rowUnits[ verIndex[i] ] ) );
}
// curve data
int nbPoints = 0;
#include "Plot2d_ViewFrame.h"
#include "Plot2d_SetupViewDlg.h"
+#include "Plot2d_Prs.h"
+
#include "QAD_Desktop.h"
#include "QAD_ResourceMgr.h"
#include "QAD_FileDlg.h"
QSize( myMarkerSize, myMarkerSize ) ) );
}
myPlot->setCurveTitle( curveKey, curve->getVerTitle() );
+ myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
myPlot->curve( curveKey )->setEnabled( true );
updateTitles();
if ( update )
}
return false;
}
+
+//==========================================================
+/*!
+ * Plot2d_ViewFrame::Display
+ * Display presentation
+ */
+//==========================================================
+void Plot2d_ViewFrame::Display( const SALOME_Prs2d* prs )
+{
+ // try do downcast object
+ const Plot2d_Prs* aPlot2dPrs = dynamic_cast<const Plot2d_Prs*>( prs );
+ if ( !aPlot2dPrs || aPlot2dPrs->IsNull() )
+ return;
+
+ // display all curves from presentation
+ Plot2d_CurveContainer aCurves = aPlot2dPrs->GetObjects();
+ displayCurves( aCurves );
+}
+
+//==========================================================
+/*!
+ * Plot2d_ViewFrame::Erase
+ * Erase presentation
+ */
+//==========================================================
+void Plot2d_ViewFrame::Erase( const SALOME_Prs2d* prs, const bool )
+{
+ // try do downcast object
+ const Plot2d_Prs* aPlot2dPrs = dynamic_cast<const Plot2d_Prs*>( prs );
+ if ( !aPlot2dPrs || aPlot2dPrs->IsNull() )
+ return;
+
+ // erase all curves from presentation
+ Plot2d_CurveContainer aCurves = aPlot2dPrs->GetObjects();
+ eraseCurves( aCurves );
+}
+
+//==========================================================
+/*!
+ * Plot2d_ViewFrame::CreatePrs
+ * Create presentation by entry
+ */
+//==========================================================
+SALOME_Prs* Plot2d_ViewFrame::CreatePrs( const char* entry )
+{
+ Plot2d_Prs* prs = new Plot2d_Prs();
+ if ( entry ) {
+ QIntDictIterator<Plot2d_Curve> it( myCurves );
+ for ( ; it.current(); ++it ) {
+ if ( it.current()->hasIO() && !strcmp( it.current()->getIO()->getEntry(), entry ) ) {
+ prs->AddObject( it.current() );
+ }
+ }
+ }
+ return prs;
+}
+
+//==========================================================
+/*!
+ * Plot2d_ViewFrame::BeforeDisplay
+ * Axiluary method called before displaying of objects
+ */
+//==========================================================
+void Plot2d_ViewFrame::BeforeDisplay( SALOME_Displayer* d )
+{
+ d->BeforeDisplay( this, SALOME_Plot2dViewType() );
+}
+
+//==========================================================
+/*!
+ * Plot2d_ViewFrame::AfterDisplay
+ * Axiluary method called after displaying of objects
+ */
+//==========================================================
+void Plot2d_ViewFrame::AfterDisplay( SALOME_Displayer* d )
+{
+ d->AfterDisplay( this, SALOME_Plot2dViewType() );
+}
void EraseAll();
void Repaint();
+ /* Reimplemented from SALOME_View */
+ void Display( const SALOME_Prs2d* );
+ void Erase( const SALOME_Prs2d*, const bool = false );
+ SALOME_Prs* CreatePrs( const char* entry = 0 );
+ virtual void BeforeDisplay( SALOME_Displayer* d );
+ virtual void AfterDisplay ( SALOME_Displayer* d );
+
/* event filter */
bool eventFilter( QObject* o, QEvent* e );
--- /dev/null
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+EXPORT_HEADERS = SALOME_Prs.h
+
+# Libraries targets
+
+LIB = libSalomePrs.la
+LIB_SRC = SALOME_Prs.cxx
+
+LIB_CLIENT_IDL =
+
+# Executables targets
+BIN =
+BIN_SRC =
+
+CPPFLAGS+=
+LDFLAGS+=
+
+
+@CONCLUDE@
--- /dev/null
+// File: SALOME_Prs.cxx
+// Created: Wed Apr 28 15:03:43 2004
+// Author: Sergey ANIKIN
+// <san@startrex.nnov.opencascade.com>
+
+
+#include "SALOME_Prs.h"
+
+#include "utilities.h"
+
+using namespace std;
+
+//===========================================================
+/*!
+ * Function: SALOME_OCCPrs::DisplayIn
+ * Purpose: Dispatches display operation to proper Display()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_OCCPrs::DisplayIn( SALOME_View* v ) const
+{
+ if ( v ) v->Display( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_OCCPrs::EraseIn
+ * Purpose: Dispatches display operation to proper Erase()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_OCCPrs::EraseIn( SALOME_View* v, const bool forced ) const
+{
+ if ( v ) v->Erase( this, forced );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_OCCPrs::LocalSelectionIn
+ * Purpose: Dispatches operation to proper LocalSelectionIn()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+ if ( v ) v->LocalSelection( this, mode );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_OCCPrs::Update
+ * Purpose: Dispatches update operation to proper Update()
+ * method of SALOME_Displayer
+ */
+//===========================================================
+void SALOME_OCCPrs::Update( SALOME_Displayer* d )
+{
+ if ( d ) d->Update( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_VTKPrs::DisplayIn
+ * Purpose: Dispatches display operation to proper Display()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_VTKPrs::DisplayIn( SALOME_View* v ) const
+{
+ if ( v ) v->Display( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_VTKPrs::EraseIn
+ * Purpose: Dispatches display operation to proper Erase()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_VTKPrs::EraseIn( SALOME_View* v, const bool forced ) const
+{
+ if ( v ) v->Erase( this, forced );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_VTKPrs::LocalSelectionIn
+ * Purpose: Dispatches operation to proper LocalSelectionIn()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_VTKPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+ if ( v ) v->LocalSelection( this, mode );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_VTKPrs::Update
+ * Purpose: Dispatches update operation to proper Update()
+ * method of SALOME_Displayer
+ */
+//===========================================================
+void SALOME_VTKPrs::Update( SALOME_Displayer* d )
+{
+ if ( d ) d->Update( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Prs2d::DisplayIn
+ * Purpose: Dispatches display operation to proper Display()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_Prs2d::DisplayIn( SALOME_View* v ) const
+{
+ if ( v ) v->Display( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Prs2d::EraseIn
+ * Purpose: Dispatches display operation to proper Erase()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_Prs2d::EraseIn( SALOME_View* v, const bool forced ) const
+{
+ if ( v ) v->Erase( this, forced );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Prs2d::LocalSelectionIn
+ * Purpose: Dispatches operation to proper LocalSelectionIn()
+ * method of SALOME_View
+ */
+//===========================================================
+void SALOME_Prs2d::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+ if ( v ) v->LocalSelection( this, mode );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Prs2d::Update
+ * Purpose: Dispatches update operation to proper Update()
+ * method of SALOME_Displayer
+ */
+//===========================================================
+void SALOME_Prs2d::Update( SALOME_Displayer* d )
+{
+ if ( d ) d->Update( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Display
+ * Purpose: Gives control to SALOME_Prs object, so that
+ * it could perform double dispatch
+ */
+//===========================================================
+void SALOME_View::Display( const SALOME_Prs* prs )
+{
+ prs->DisplayIn( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Erase
+ * Purpose: Gives control to SALOME_Prs object, so that
+ * it could perform double dispatch
+ */
+//===========================================================
+void SALOME_View::Erase( const SALOME_Prs* prs, const bool forced )
+{
+ prs->EraseIn( this, forced );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::LocalSelection
+ * Purpose: Gives control to SALOME_Prs object, so that
+ * it could perform double dispatch
+ */
+//===========================================================
+void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
+{
+ prs->LocalSelectionIn( this, mode );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Display
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::Display( const SALOME_OCCPrs* )
+{
+ MESSAGE( "SALOME_View::Display( const SALOME_OCCPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Display
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::Display( const SALOME_VTKPrs* )
+{
+ MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Display
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::Display( const SALOME_Prs2d* )
+{
+ MESSAGE( "SALOME_View::Display( const SALOME_Prs2d& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Erase
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::Erase( const SALOME_OCCPrs*, const bool )
+{
+ MESSAGE( "SALOME_View::Erase( const SALOME_OCCPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Erase
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
+{
+ MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::Erase
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
+{
+ MESSAGE( "SALOME_View::Erase( const SALOME_Prs2d& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::LocalSelection
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
+{
+ MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called! \
+ Probably, selection is being activated in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::LocalSelection
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
+{
+ MESSAGE( "SALOME_View::LocalSelection( const SALOME_VTKPrs* ) called! \
+ Probably, selection is being activated in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::LocalSelection
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::LocalSelection( const SALOME_Prs2d*, const int )
+{
+ MESSAGE( "SALOME_View::LocalSelection( const SALOME_Prs2d* ) called! \
+ Probably, selection is being activated in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_View::GlobalSelection
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_View::GlobalSelection( const bool ) const
+{
+ MESSAGE( "SALOME_View::GlobalSelection() called! \
+ Probably, selection is being activated in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Displayer::UpdatePrs
+ * Purpose: Gives control to SALOME_Prs object, so that
+ * it could perform double dispatch
+ */
+//===========================================================
+void SALOME_Displayer::UpdatePrs( SALOME_Prs* prs )
+{
+ prs->Update( this );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Displayer::Update
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_Displayer::Update( SALOME_OCCPrs* )
+{
+ MESSAGE( "SALOME_Displayer::Update( SALOME_OCCPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Displayer::Update
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_Displayer::Update( SALOME_VTKPrs* )
+{
+ MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
+//===========================================================
+/*!
+ * Function: SALOME_Displayer::Update
+ * Purpose: Virtual method, should be reimplemented in successors,
+ * by default issues a warning and does nothing.
+ */
+//===========================================================
+void SALOME_Displayer::Update( SALOME_Prs2d* )
+{
+ MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
--- /dev/null
+// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_Prs.h
+// Author : Sergey ANIKIN
+// Module : SALOME
+// $Header$
+
+#ifndef SALOME_PRS_H
+#define SALOME_PRS_H
+
+class SALOME_View;
+class SALOME_Displayer;
+
+//===========================================================
+/*!
+ * Class: SALOME_Prs
+ * Description: Base class for SALOME graphic object wrappers - presentations.
+ * Presentations are temporary objects, so they can be created on the stack.
+ */
+//===========================================================
+
+class SALOME_Prs
+{
+public:
+ virtual ~SALOME_Prs() {}
+ // Destructor
+
+ virtual void DisplayIn( SALOME_View* ) const = 0;
+ // Key method for double dispatch of display operation
+
+ virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
+ // Key method for double dispatch of erase operation
+
+ virtual void Update( SALOME_Displayer* ) = 0;
+ // Key method for double dispatch of update operation
+
+ virtual bool IsNull() const = 0;
+ // Should return true, if this presentation contains a graphic object
+
+ virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
+ // Key method for double dispatch of activation of subshapes selection
+};
+
+//===========================================================
+/*!
+ * Class: SALOME_OCCPrs
+ * Description: Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.
+ * This intermediate class is necessary to avoid dependencies from OCC libs.
+ */
+//===========================================================
+
+class SALOME_OCCPrs : public SALOME_Prs
+{
+public:
+ virtual void DisplayIn( SALOME_View* ) const;
+ // It uses double dispatch in order to
+ // invoke Display() method corresponding to the actual type of presentation.
+
+ virtual void EraseIn( SALOME_View*, const bool = false ) const;
+ // It uses double dispatch in order to
+ // invoke Erase() method corresponding to the actual type of presentation.
+
+ virtual void Update( SALOME_Displayer* );
+ // It uses double dispatch in order to
+ // invoke Update() method corresponding to the actual type of presentation.
+
+ virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+ // Key method for double dispatch of activation of subshapes selection
+};
+
+//===========================================================
+/*!
+ * Class: SALOME_VTKPrs
+ * Description: Base class for VTK graphic object (vtkActor) wrappers
+ * This intermediate class is necessary to avoid dependencies from VTK libs.
+ */
+//===========================================================
+
+class SALOME_VTKPrs : public SALOME_Prs
+{
+public:
+ virtual void DisplayIn( SALOME_View* ) const;
+ // It uses double dispatch in order to
+ // invoke Display() method corresponding to the actual type of presentation.
+
+ virtual void EraseIn( SALOME_View*, const bool = false ) const;
+ // It uses double dispatch in order to
+ // invoke Erase() method corresponding to the actual type of presentation.
+
+ virtual void Update( SALOME_Displayer* );
+ // It uses double dispatch in order to
+ // invoke Update() method corresponding to the actual type of presentation.
+
+ virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+ // Key method for double dispatch of activation of subshapes selection
+};
+
+//===========================================================
+/*!
+ * Class: SALOME_Prs2d
+ * Description: Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
+ */
+//===========================================================
+
+class SALOME_Prs2d : public SALOME_Prs
+{
+public:
+ virtual void DisplayIn( SALOME_View* ) const;
+ // It uses double dispatch in order to
+ // invoke Display() method corresponding to the actual type of presentation.
+
+ virtual void EraseIn( SALOME_View*, const bool = false ) const;
+ // It uses double dispatch in order to
+ // invoke Erase() method corresponding to the actual type of presentation.
+
+ virtual void Update( SALOME_Displayer* );
+ // It uses double dispatch in order to
+ // invoke Update() method corresponding to the actual type of presentation.
+
+ virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+ // Key method for double dispatch of activation of subshapes selection
+};
+
+/////////////////////////////////////////////////////////////////////////
+// Base classes for object wrappers for any other visualization libraries
+// should be added here!
+/////////////////////////////////////////////////////////////////////////
+
+//===========================================================
+/*!
+ * Class: SALOME_View
+ * Description: Base class for SALOME views (or view frames)
+ */
+//===========================================================
+
+class SALOME_View
+{
+public:
+ virtual ~SALOME_View() {}
+ // Destructor
+
+ void Display( const SALOME_Prs* );
+ // This Display() method should be called to display given presentation
+ // created anywhere by anybody. It simply passes control to SALOME_Prs object
+ // so that it could perform double dispatch.
+ void Erase( const SALOME_Prs*, const bool = false );
+ // This Erase() method should be called to erase given presentation
+ // created anywhere by anybody. It simply passes control to SALOME_Prs object
+ // so that it could perform double dispatch.
+
+ void LocalSelection( const SALOME_Prs*, const int );
+ // This LocalSelection() method should be called to activate sub-shapes selection
+ // created anywhere by anybody. It simply passes control to SALOME_Prs object
+ // so that it could perform double dispatch.
+
+ // Interface for derived views
+
+ // Display() methods for ALL kinds of presentation should appear here
+ virtual void Display( const SALOME_OCCPrs* );
+ virtual void Display( const SALOME_VTKPrs* );
+ virtual void Display( const SALOME_Prs2d* );
+ // Add new Display() methods here...
+
+ // Erase() methods for ALL kinds of presentation should appear here
+ virtual void Erase( const SALOME_OCCPrs*, const bool = false );
+ virtual void Erase( const SALOME_VTKPrs*, const bool = false );
+ virtual void Erase( const SALOME_Prs2d*, const bool = false );
+ // Add new Erase() methods here...
+
+ // LocalSelection() methods for ALL kinds of presentation should appear here
+ virtual void LocalSelection( const SALOME_OCCPrs*, const int );
+ virtual void LocalSelection( const SALOME_VTKPrs*, const int );
+ virtual void LocalSelection( const SALOME_Prs2d* , const int );
+
+ virtual void GlobalSelection( const bool = false ) const;
+ // Deactivates selection of sub-shapes (must be redefined with OCC viewer)
+
+ // Creates empty presenation of corresponding type
+ virtual SALOME_Prs* CreatePrs( const char* entry = 0 ) { return 0; }
+
+ // Axiluary methods called before and after displaying of objects
+ virtual void BeforeDisplay( SALOME_Displayer* d ) {}
+ virtual void AfterDisplay ( SALOME_Displayer* d ) {}
+};
+
+//===========================================================
+/*!
+ * Classes: SALOME_Displayer
+ * Description: These classes are used to specify type of view
+ * VTK, OCC or Plot2d
+ */
+//===========================================================
+
+class SALOME_OCCViewType {};
+class SALOME_VTKViewType {};
+class SALOME_Plot2dViewType {};
+
+//===========================================================
+/*!
+ * Class: SALOME_Displayer
+ * Description: Base class for SALOME displayers
+ */
+//===========================================================
+
+class SALOME_Displayer
+{
+public:
+ virtual ~SALOME_Displayer() {}
+ // Destructor
+
+ void UpdatePrs( SALOME_Prs* );
+ // This Update() method should be called to update given presentation
+ // created anywhere by anybody. It simply passes control to SALOME_Prs object
+ // so that it could perform double dispatch.
+
+ // Interface for derived displayers
+
+ // Update() methods for ALL kinds of presentation should appear here
+ virtual void Update( SALOME_OCCPrs* );
+ virtual void Update( SALOME_VTKPrs* );
+ virtual void Update( SALOME_Prs2d* );
+ // Add new Update() methods here...
+
+ // Axiluary methods called before and after displaying of objects
+ virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ) {};
+ virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ) {};
+ virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType& ) {};
+ virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType& ) {};
+ virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ) {};
+ virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ) {};
+};
+
+#endif
+
connect( _refresh, SIGNAL( clicked() ), this, SLOT( slotListeSelect() ) );
QToolTip::add( _refresh, "", toolTipGroup(), tr("Immediately updates list of components") );
+ /* PAL5540 - this button is needless
QPushButton* help = new QPushButton( tr( "Help" ), topbar );
connect( help, SIGNAL( clicked() ), this, SLOT( slotHelp() ) );
QToolTip::add( help, "", toolTipGroup(), tr("Opens Help window") );
+ */
_interval = new QPushButton( tr( "Interval" ), topbar );
connect( _interval, SIGNAL( clicked() ), this, SLOT( slotSelectRefresh() ) );
// Module : SALOME
//$Header$
-using namespace std;
-#define WRITE_RESSOURCES_TYPE
#include "SALOME_RessourcesCatalog_Handler.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+ListOfParserressources _ressources_list;
+
//----------------------------------------------------------------------
//Function : SALOME_RessourcesCatalog_Handler
//Purpose: Constructor
#ifndef SALOME_RESSOURCES_CATALOG_HANDLER
#define SALOME_RESSOURCES_CATALOG_HANDLER
-#include "utilities.h"
#include "SALOME_RessourcesCatalog_Parser.hxx"
+
#include <qxml.h>
#include <string>
#include <vector>
private :
QString errorProt;
- string content;
+ std::string content;
const char* test_computer;
const char* test_computer_name;
struct ParserProc{
long Parsernumber;
- string Parsermodel_name;
+ std::string Parsermodel_name;
float Parsercpu_mhz;
float Parsercache_size;
};
-typedef vector<ParserProc> ListOfParserProc;
+typedef std::vector<ParserProc> ListOfParserProc;
enum Parsercontainertype {Cpp, python, NP};
-typedef vector<Parsercontainertype> ListOfParserContainerType;
+typedef std::vector<Parsercontainertype> ListOfParserContainerType;
struct Parserressources{
- string Parsername;
- string ParserOS;
- string ParserOS_version;
+ std::string Parsername;
+ std::string ParserOS;
+ std::string ParserOS_version;
ListOfParserProc Parserprocs;
ListOfParserContainerType Parsercontainertype;
};
-typedef vector<Parserressources> ListOfParserressources;
+typedef std::vector<Parserressources> ListOfParserressources;
-#ifdef WRITE_RESSOURCES_TYPE
-ListOfParserressources _ressources_list;
-#else
extern ListOfParserressources _ressources_list;
-#endif
+
#endif //SALOME_RESSOURCES_CATALOG_PARSER
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
# _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
# La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
}
char* SALOMEDS_AttributeDrawable_i::Store() {
- return strdup(IsDrawable()?"1":"0");
+ return CORBA::string_dup(IsDrawable()?"1":"0");
}
void SALOMEDS_AttributeDrawable_i::Restore(const char* value) {
}
char* SALOMEDS_AttributeExpandable_i::Store() {
- return strdup(IsExpandable()?"1":"0");
+ return CORBA::string_dup(IsExpandable()?"1":"0");
}
void SALOMEDS_AttributeExpandable_i::Restore(const char* value) {
void SALOMEDS_AttributeName_i::SetValue(const char* value) {
CheckLocked();
- CORBA::String_var Str = CORBA::string_dup(value);
- Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
+ //CORBA::String_var Str = CORBA::string_dup(value);
+ //Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
+ Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString((char*)value));
}
char* SALOMEDS_AttributeName_i::Store() {
}
char* SALOMEDS_AttributeOpened_i::Store() {
- return strdup(IsOpened()?"1":"0");
+ return CORBA::string_dup(IsOpened()?"1":"0");
}
void SALOMEDS_AttributeOpened_i::Restore(const char* value) {
}
void SALOMEDS_AttributePythonObject_i::Restore(const char* value) {
- char* aString = strdup(value);
+ char* aString = CORBA::string_dup(value);
SetObject(aString + 1, aString[0]=='s');
+ delete(aString);
}
// Module : SALOME
// $Header$
-using namespace std;
#include "SALOMEDS_AttributeReal_i.hxx"
#include "SALOMEDS_SObject_i.hxx"
+#include <sstream>
+
+using namespace std;
+
+static const char* write_double(double value)
+{
+ std::ostringstream os;
+ unsigned char* array = (unsigned char*)&value;
+ for(int i = 0; i < sizeof(double); i++) {
+ unsigned tmp = (unsigned short)array[i];
+ os << " " << tmp;
+ }
+ return os.str().c_str();
+}
+
+static double read_double(const char* str)
+{
+ std::istringstream is(str);
+ double value;
+ unsigned char* array = (unsigned char*)(&value);
+ for(int i = 0; i < sizeof(double); i++) {
+ unsigned tmp;
+ is >> tmp;
+ array[i] = (unsigned char)tmp;
+ }
+ return value;
+}
CORBA::Double SALOMEDS_AttributeReal_i::Value() {
return Handle(TDataStd_Real)::DownCast(_myAttr)->Get();
}
char* SALOMEDS_AttributeReal_i::Store() {
- char* RealVal = new char[25];
- sprintf(RealVal, "%f", Value());
- return RealVal;
+ // char* RealVal = new char[35];
+ // sprintf(RealVal, "%.20f", Value());
+ //return RealVal;
+ return (char*)write_double( (double)Value() );
}
void SALOMEDS_AttributeReal_i::Restore(const char* value) {
- char *err = NULL;
- CORBA::Double r = strtod(value, &err);
- if (err != value) SetValue(r);
+ //char *err = NULL;
+ //CORBA::Double r = strtod(value, &err);
+ //if (err != value) SetValue(r);
+ SetValue( read_double(value) );
}
+
}
char* SALOMEDS_AttributeSelectable_i::Store() {
- return strdup(IsSelectable()?"1":"0");
+ return CORBA::string_dup(IsSelectable()?"1":"0");
}
void SALOMEDS_AttributeSelectable_i::Restore(const char* value) {
void SALOMEDS_AttributeSequenceOfInteger_i::Restore(const char* value) {
Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
- char* aCopy = strdup(value);
+ char* aCopy = CORBA::string_dup(value);
char* adr = strtok(aCopy, " ");
while (adr) {
CORBA::Long l = atol(adr);
void SALOMEDS_AttributeSequenceOfReal_i::Restore(const char* value) {
Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
- char* aCopy = strdup(value);
+ char* aCopy = CORBA::string_dup(value);
char* adr = strtok(aCopy, " ");
char *err = NULL;
while (adr) {
void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName) {
CheckLocked();
Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr);
- aProp->SetFirstName(TCollection_ExtendedString(strdup(theName)));
+ aProp->SetFirstName((char*)theName);
}
char* SALOMEDS_AttributeStudyProperties_i::GetUserName() {
CORBA::Long theYear) {
CheckLocked();
Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr);
- aProp->SetUserName(strdup(theName));
+ aProp->SetUserName((char*)theName);
aProp->SetModificationDate((int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear);
}
void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames,
}
void SALOMEDS_AttributeStudyProperties_i::Restore(const char* value) {
- char* aCopy = strdup(value);
+ char* aCopy = CORBA::string_dup(value);
if (aCopy[0] == 'f') SetCreationMode("from scratch");
else if (aCopy[0] == 'c') SetCreationMode("copy from");
else SetCreationMode("none");
Handle(TDataStd_TreeNode) aNode = Handle(TDataStd_TreeNode)::DownCast(_myAttr);
Handle(TDF_Data) DF = TDocStd_Document::Get(_myAttr->Label())->GetData();
- char* aCopy = strdup(value);
+ char* aCopy = CORBA::string_dup(value);
char* adr = strtok(aCopy, " ");
TDF_Label aLabel;
if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID());
aNode->SetFirst(aDepNode);
}
+ delete(aCopy);
}
// defines for creation attributes objects
-//cout<<"*** Create new CORBA attribute for "<<#CORBA_Name<<endl;
+//MESSAGE("*** Create new CORBA attribute for "<<#CORBA_Name);
#define __ReturnCORBAAttribute(OCAF_Name, CORBA_Name) if (theAttr->ID() == OCAF_Name::GetID()) { \
SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(Handle(OCAF_Name)::DownCast(theAttr), theOrb); \
return Attr->CORBA_Name::_this(); \
}
-//cout<<"Create New Attribute "<<#CORBA_Name<<endl;
+//MESSAGE("Create New Attribute "<<#CORBA_Name);
#define __FindOrCreateAttribute(OCAF_Name, CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
Handle(OCAF_Name) anAttr; \
if (!Lab.FindAttribute(OCAF_Name::GetID(), anAttr)) { \
return Attr->CORBA_Name::_this(); \
}
-//cout<<"Create New Attribute "<<#CORBA_Name<<endl;
+//MESSAGE("Create New Attribute "<<#CORBA_Name);
#define __FindOrCreateAttributeLocked(OCAF_Name, CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
Handle(OCAF_Name) anAttr; \
if (!Lab.FindAttribute(OCAF_Name::GetID(), anAttr)) { \
if (!_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),ior) )
return false;
TCollection_AsciiString ch(ior->Get());
- IOR = strdup(ch.ToCString());
+ IOR = CORBA::string_dup(ch.ToCString());
return true;
}
return _lab.Tag();
}
+//============================================================================
+/*! Function :
+ * Purpose :
+ */
+//============================================================================
+CORBA::Short SALOMEDS_SObject_i::Depth()
+{
+ return _lab.Depth();
+}
+
//============================================================================
/*! Function :
* Purpose :
virtual char* GetIOR();
virtual CORBA::Short Tag();
+ virtual CORBA::Short Depth();
static char* AttributeIDToType(Standard_GUID);
aDriver->Load(anSCO, aStreamFile.in(), aDir, aMultifileState[0]=='M');
if(!aResult) {
RemoveAttribute( anSCO, "AttributeIOR" );
- if (isASCII) {
- SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
- aFilesToRemove->length(1);
- aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
- SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
- }
- delete aHDFUrl;
+
MESSAGE("Can't load component");
- THROW_SALOME_CORBA_EXCEPTION("Unable to load component data",SALOME::BAD_PARAM);
- // throw HDFexception("Unable to load component");
+ //THROW_SALOME_CORBA_EXCEPTION("Unable to load component data",SALOME::BAD_PARAM);
+ throw HDFexception("Unable to load component");
}
delete(aDir);
if (isASCII) {
SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
aFilesToRemove->length(1);
- aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
- SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+ aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str())]));
+ SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str(), aFilesToRemove, true);
}
delete aHDFUrl;
}
if (isASCII) {
SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
aFilesToRemove->length(1);
- aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
- SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+ aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str())]));
+ SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str(), aFilesToRemove, true);
}
delete aHDFUrl;
if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
- return;
+ THROW_SALOME_CORBA_EXCEPTION("No persistent file Name found",SALOME::BAD_PARAM);
}
try {
Lab.ForgetAttribute(TDF_Reference::GetID());
- TDF_Label RefLab;
+ //SRN: 30 Aug, 2004 : fix from Ecole l'ete version
+
+ TDF_Label RefLab;
ASSERT(!CORBA::is_nil(theReferencedObject));
CORBA::String_var roid = theReferencedObject->GetID();
TDF_Tool::Label(_doc->GetData(),roid,RefLab);
-
- RemoveAttribute(theReferencedObject, "AttributeTarget");
- //if(!CORBA::is_nil(_callbackOnRemove) && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
+
+ Handle(SALOMEDS_TargetAttribute) aTarget;
+ if(RefLab.FindAttribute(SALOMEDS_TargetAttribute::GetID(), aTarget)) aTarget->Remove(Lab);
}
//============================================================================
CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand()
{
- _doc->HasOpenCommand();
+ return _doc->HasOpenCommand();
}
//============================================================================
// Assign the value of the IOR in the study->root
const char* IORStudy = _orb->object_to_string(Study);
- SALOMEDS_IORAttribute::Set(Doc->Main().Root(),TCollection_ExtendedString(strdup(IORStudy)),_orb);
+ SALOMEDS_IORAttribute::Set(Doc->Main().Root(),TCollection_ExtendedString((char*)IORStudy),_orb);
// set Study properties
SALOMEDS::AttributeStudyProperties_ptr aProp = Study->GetProperties();
sprintf(aHDFUrl, "%shdf_from_ascii.hdf", aResultPath);
delete(aResultPath);
} else {
- aHDFUrl = strdup(aUrl);
+ aHDFUrl = CORBA::string_dup(aUrl);
}
hdf_file = new HDFfile(aHDFUrl);
SALOMEDS_IORAttribute::Set(Doc->Main().Root(),
TCollection_ExtendedString(CORBA::string_dup(IORStudy)),_orb);
- SALOMEDS_PersRefAttribute::Set(Doc->Main(),strdup(aUrl));
+ SALOMEDS_PersRefAttribute::Set(Doc->Main(),(char*)aUrl);
if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) {
delete aHDFUrl;
if (isASCII) {
SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
aFilesToRemove->length(1);
- aFilesToRemove[0] = strdup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
- SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+ aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str())]));
+ SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str(), aFilesToRemove, true);
}
delete aHDFUrl;
delete hdf_file; // all related hdf objects will be deleted
if (strcmp(anAttrList[a]->Type(), "AttributeIOR") == 0) continue; // never write AttributeIOR to file
if (strcmp(anAttrList[a]->Type(), "AttributeExternalFileDef") == 0) continue; // never write ExternalFileDef to file
if (strcmp(anAttrList[a]->Type(), "AttributeFileType") == 0) continue; // never write FileType to file
- CORBA::String_var aSaveStr = strdup(anAttrList[a]->Store());
+ CORBA::String_var aSaveStr = CORBA::string_dup(anAttrList[a]->Store());
size[0] = (hdf_int32) strlen(aSaveStr) + 1;
HDFdataset *hdf_dataset = new HDFdataset(anAttrList[a]->Type(),hdf_group_sobject,HDF_STRING,size,1);
hdf_dataset->CreateOnDisk();
hdf_dataset->WriteOnDisk(aSaveStr);
hdf_dataset->CloseOnDisk();
- //cout<<"********** Write Attribute "<<anAttrList[a]->Type()<<" : "<<aSaveStr<<" done"<<endl;
+ //MESSAGE("********** Write Attribute "<<anAttrList[a]->Type()<<" : "<<aSaveStr<<" done");
hdf_dataset=0; //will be deleted by hdf_sco_group destructor
}
// Reference attribute has no CORBA attribute representation, so, GetAllAttributes can not return this attribute
SALOMEDS::SObject_var RefSO;
if(SO->ReferencedObject(RefSO)) {
- CORBA::String_var attribute_reference = strdup(RefSO->GetID());
+ CORBA::String_var attribute_reference = CORBA::string_dup(RefSO->GetID());
size[0] = strlen(attribute_reference) + 1 ;
HDFdataset *hdf_dataset = new HDFdataset("Reference",hdf_group_sobject,HDF_STRING,size,1);
hdf_dataset->CreateOnDisk();
MESSAGE("attribute StudyProperties " << aProperty << " wrote on file");
hdf_dataset->CloseOnDisk();
hdf_dataset=0; //will be deleted by hdf_sco_group destructor
- delete(aProperty);
+ //delete(aProperty);
+ delete [] aProperty;
aProp->SetModified(0);
}
for (; itcomponent1->More(); itcomponent1->Next())
{
SALOMEDS::SComponent_var sco = itcomponent1->Value();
+
// if there is an associated Engine call its method for saving
CORBA::String_var IOREngine;
try {
-
if (!sco->ComponentIOR(IOREngine)) {
SALOMEDS::GenericAttribute_var aGeneric;
- SALOMEDS::AttributeName_var aName;
- if(sco->FindAttribute(aGeneric, "AttributeName"))
- aName = SALOMEDS::AttributeName::_narrow(aGeneric);
-
+ SALOMEDS::AttributeComment_var aName;
+ if(sco->FindAttribute(aGeneric, "AttributeComment"))
+ aName = SALOMEDS::AttributeComment::_narrow(aGeneric);
+
if (!aName->_is_nil()) {
CORBA::String_var aCompType = aName->Value();
-
CORBA::String_var aFactoryType;
if (strcmp(aCompType, "SUPERV") == 0) aFactoryType = "SuperVisionContainer";
else aFactoryType = "FactoryServer";
Engines::Component_var aComp =
SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType, aCompType);
-
if (aComp->_is_nil()) {
Engines::Component_var aComp =
SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", aCompType);
SALOMEDS::TMPFile_var aStream;
- if (theASCII) aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl),theMultiFile);
- else aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl),theMultiFile);
+ if (theASCII) aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
+ else aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
HDFdataset *hdf_dataset;
hdf_size aHDFSize[1];
}
}
- CORBA::String_var scoid = strdup(SO->GetID());
+ CORBA::String_var scoid = CORBA::string_dup(SO->GetID());
hdf_group_sobject = new HDFgroup(scoid,hdf_group_datatype);
hdf_group_sobject->CreateOnDisk();
SaveAttributes(SO, hdf_group_sobject);
Standard_ExtCharacter val2 = ToExtCharacter(':');
theUrl.ChangeAll(val1,val2);
TCollection_AsciiString ch(theUrl);
- return strdup(ch.ToCString());
+ return CORBA::string_dup(ch.ToCString());
}
//============================================================================
if (!Handle(SALOMEDS_IORAttribute)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theSource, anEntry);
- SALOMEDS::SObject_var aSO = theSourceStudy->FindObjectID(strdup(anEntry.ToCString()));
+ SALOMEDS::SObject_var aSO = theSourceStudy->FindObjectID(anEntry.ToCString());
// if (theEngine->CanCopy(aSO)) {
CORBA::Long anObjID;
// TCollection_ExtendedString aResStr(strdup((char*)(theEngine->CopyFrom(aSO, anObjID))));
// set component data type to the name attribute of root label
if (!aStructureOnly) {
TDataStd_Comment::Set(aTargetDocument->Main().Root(),
- TCollection_ExtendedString(strdup(Engine->ComponentDataType())));
+ TCollection_ExtendedString(Engine->ComponentDataType()));
}
// set to the Root label integer attribute: study id
TDataStd_Integer::Set(aTargetDocument->Main().Root(), aStudy->StudyId());
// iterate all theObject's label children
TDF_Label aStartLabel;
- char* aStartID = strdup(theObject->GetID());
+ char* aStartID = CORBA::string_dup(theObject->GetID());
TDF_Tool::Label(aDocument->GetData(), aStartID, aStartLabel);
+ delete(aStartID);
Standard_Integer aSourceStartDepth = aStartLabel.Depth();
// copy main source label
CORBA::Object_var obj = _orb->string_to_object(IOREngine);
SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
if (CORBA::is_nil(Engine)) return false;
- return Engine->CanPaste(strdup(TCollection_AsciiString(aCompName->Get()).ToCString()), anObjID->Get());
+ return Engine->CanPaste(TCollection_AsciiString(aCompName->Get()).ToCString(), anObjID->Get());
}
//============================================================================
/*! Function : PasteLabel
aAuxSourceLabel.FindAttribute(TDataStd_Integer::GetID(), anObjID);
Handle(TDataStd_Comment) aComponentName;
theSource.Root().FindAttribute(TDataStd_Comment::GetID(), aComponentName);
- CORBA::String_var aCompName = strdup(TCollection_AsciiString(aComponentName->Get()).ToCString());
+ CORBA::String_var aCompName = CORBA::string_dup(TCollection_AsciiString(aComponentName->Get()).ToCString());
if (theEngine->CanPaste(aCompName, anObjID->Get())) {
SALOMEDS::TMPFile_var aTMPFil = new SALOMEDS::TMPFile();
TCollection_AsciiString anEntry;
TDF_Tool::Entry(aTargetLabel, anEntry);
- SALOMEDS::SObject_var aPastedSO = theDestinationStudy->FindObjectID(strdup(anEntry.ToCString()));
+ SALOMEDS::SObject_var aPastedSO = theDestinationStudy->FindObjectID(anEntry.ToCString());
if (isFirstElement) {
SALOMEDS::SObject_var aDestSO =
theEngine->PasteInto(aTMPFil.in(),
if (aNameStart) TDataStd_Name::Set(aTargetLabel, aNameStart);
else TDataStd_Name::Set(aTargetLabel, TCollection_ExtendedString("Reference to:")+anEntry);
}
- delete(anEntry);
+ delete [] anEntry;
}
return aTargetLabel;
const Standard_GUID& SALOMEDS_TableOfStringAttribute::GetID()
{
- static Standard_GUID SALOMEDS_TableOfStringAttributeID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
+ static Standard_GUID SALOMEDS_TableOfStringAttributeID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDS_TableOfStringAttributeID;
}
if (anIterator.Value().Length()) { // check empty string in the value table
theStream << anIterator.Key() << "\n";
unsigned long aValueSize = anIterator.Value().Length();
- theStream.write((char*)&aValueSize, sizeof(unsigned long));
+ theStream<<aValueSize << "\n";
theStream.write((TCollection_AsciiString(anIterator.Value()).ToCString()),aValueSize);
+ theStream<<"\n";
} else { // write index only of kind: "0key"; "05", for an example
theStream << "0" << anIterator.Key() << "\n";
}
aValue = "";
else {
unsigned long aValueSize;
- theStream.read((char*)&aValueSize, sizeof(unsigned long));
+ theStream >> aValueSize;
+ theStream.read(aValueString, 1); // an '\n' omitting
theStream.read(aValueString, aValueSize);
+ theStream.read(aValueString, 1); // an '\n' omitting
aValue = aValueString;
}
myTable.Bind(aKey, aValue);
Backup();
Handle(TDF_Reference) aReference;
if (theReferencedObject.FindAttribute(TDF_Reference::GetID(),aReference)) {
+ TDF_ListIteratorOfAttributeList anIter(GetVariables());
+ for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == theReferencedObject) return; //BugID: PAL6192
GetVariables().Append(aReference);
} else {
MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object");
if(_root.IsNull()) return 0;
Handle(TDataStd_Name) aNameAttrib;
- TCollection_ExtendedString aName(strdup(theName));
+ TCollection_ExtendedString aName((char*)theName);
if (!_root->FindAttribute(TDataStd_Name::GetID(), aNameAttrib))
aNameAttrib = TDataStd_Name::Set(_root->Label(), aName);
Handle(TDataStd_Name) aName;
if (!_root->FindAttribute(TDataStd_Name::GetID(), aName)) return aString._retn();
- aString = strdup(TCollection_AsciiString(aName->Get()).ToCString());
+ aString = CORBA::string_dup(TCollection_AsciiString(aName->Get()).ToCString());
return aString._retn();
}
TDF_Label aChild = aLabel.FindChild(anInteger->Get());
aNode = TDataStd_TreeNode::Set(aChild, aBasicGUID);
aFatherNode->Append(aNode);
- TDataStd_Name::Set(aChild, TCollection_ExtendedString(strdup(theName)));
+ TDataStd_Name::Set(aChild, TCollection_ExtendedString((char*)theName));
SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aChild, _orb);
SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
#---------------
msgid "INF_VERSION"
-msgstr "Version 2.0.0"
+msgstr "Version 2.1.0"
msgid "INF_COPYRIGHT"
-msgstr " "
+msgstr "Copyright : CEA"
msgid "INF_LICENSE"
msgstr " "
#: SALOMEGUI_AboutDlg.cxx:42
msgid "ABOUT_TLT"
-msgstr "About SALOME"
+msgstr "About PAL/SALOME"
#: QAD_Config.cxx:84
msgid "MEN_APPNAME"
#: QAD_Application.cxx:133
msgid "QAD_Application::APP_DEFAULTTITLE"
-msgstr "SALOME 2.0.0"
+msgstr "PAL/SALOME 2.1.0"
#: QAD_Desktop.cxx:424
msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME 2.0.0"
+msgstr "PAL/SALOME 2.1.0"
SALOME_NumberFilter.hxx \
Handle_SALOME_NumberFilter.hxx \
SALOME_DataMapOfIOMapOfInteger.hxx \
+ SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx \
Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx \
SALOMEGUI.h \
SALOMEGUI_LoadStudiesDlg.h \
SALOME_Exception.idl
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSalomePrs
LIBS+= $(PYTHON_LIBS)
*/
PyInterp_PyQt::PyInterp_PyQt(): PyInterp_base()
{
- initialize();
}
PyInterp_PyQt::~PyInterp_PyQt()
// Module : SALOME
// $Header$
+
#include <string>
#include <vector>
#include "SALOMEGUI_CloseDlg.h"
#include "SALOMEGUI_ActivateComponentDlg.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "SALOME_Event.hxx"
myCntUntitled(0),
//NRImyHelpWindow(0),
myDefaultTitle( tr("DESK_DEFAULTTITLE") ),
-myQueryClose( true )
+myQueryClose( true ),
+myAboutToClose( false )
{
/* Force reading of user config file */
QAD_CONFIG->readConfigFile();
QString resDir;
/* find component icon */
- QString iconfile = strdup(list_composants[ind].moduleicone) ;
- QString modulename = strdup(list_composants[ind].modulename) ;
- QString moduleusername = strdup(list_composants[ind].moduleusername) ;
+ QString iconfile = CORBA::string_dup(list_composants[ind].moduleicone) ;
+ QString modulename = CORBA::string_dup(list_composants[ind].modulename) ;
+ QString moduleusername = CORBA::string_dup(list_composants[ind].moduleusername) ;
// MESSAGE ( " MODULE = " << modulename )
// MESSAGE ( " MODULE icon = " << iconfile )
*/
bool QAD_Desktop::eventFilter( QObject* o, QEvent* e )
{
- if (e->type() == 2000 ) {
+ if (e->type() == QEvent::Close && o == this )
+ myAboutToClose = true;
+ else if (e->type() == 2000 ) {
QMessageBox::information (this, tr ( "Help Information" ), tr ( "Can't run choosen browser.\nRunning default browser (Mozilla). "));
return TRUE;
}
QMessageBox::critical(this, tr ( "Help Error" ), tr ( "Can't run the default browser.") );
return TRUE;
}
- else if ( e->type() == QEvent::ContextMenu ) {
- QContextMenuEvent* ce = (QContextMenuEvent*)e;
- if ( o->inherits("QRenameEdit") ) {
+ else if ( e->type() == QEvent::ContextMenu ) {
+ QContextMenuEvent* ce = (QContextMenuEvent*)e;
+ if ( o->inherits("QRenameEdit") ) {
return TRUE;
}
else if ( o->inherits("QLineEdit") ) {
}
else if ( e->type() == SALOME_EVENT ) {
SALOME_Event* aSE = (SALOME_Event*)((QCustomEvent*)e)->data();
- processEvent( aSE );
- // Signal the calling thread that the event has been processed
- aSE->processed();
+ processEvent(aSE);
((QCustomEvent*)e)->setData( 0 );
- delete aSE;
return TRUE;
}
return QMainWindow::eventFilter( o, e );
*/
void QAD_Desktop::processEvent( SALOME_Event* theEvent )
{
- if ( !theEvent )
- return;
- theEvent->Execute();
+ if(theEvent){
+ theEvent->Execute();
+ // Signal the calling thread that the event has been processed
+ theEvent->processed();
+ }
}
/*!
myCatalogue->GetComponentIconeList();
for (unsigned int ind = 0; ind < list_composants->length(); ind++) {
- QString aModuleName = strdup(list_composants[ind].modulename) ;
+ QString aModuleName = CORBA::string_dup(list_composants[ind].modulename) ;
QString dir;
if (dir = getenv( aModuleName + "_ROOT_DIR")) {
dir = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + "doc/salome/" );
QString aFileName = aModuleName + "_index.html";
if ( QFileInfo( dir + aFileName ).exists() ) {
- QString aModuleUserName = strdup(list_composants[ind].moduleusername) ;
+ QString aModuleUserName = CORBA::string_dup(list_composants[ind].moduleusername) ;
if ( aModuleUserName == "Salome" ) aModuleUserName = "Kernel" ;
QActionP* moduleHelpAction = new QActionP( "", aModuleUserName + " Help" , 0, this, aModuleName);
QAD_ASSERT(connect( moduleHelpAction, SIGNAL(activated()), this, SLOT(onHelpContentsModule() )));
QAD_NO, QAD_NO ) == QAD_YES;
}
- if ( doClose ) {
- for ( QAD_Application* app = myApps.first(); app; app = myApps.next() ) {
- QList<QAD_Study>& studies = app->getStudies();
- for(QAD_Study* study = studies.first(); study != 0; study = studies.next()) {
- if(myQueryClose && study->getStudyDocument()->IsModified()) {
- SALOMEGUI_CloseDlg aDlg( this );
- switch ( aDlg.exec() ) {
- case 1:
- if ( !onSaveStudy( study ) ) {
- putInfo( tr("INF_CANCELLED") );
- e->ignore();
- return;
- }
- break;
- case 2:
- case 3:
- break;
- case 0:
- default:
- e->ignore();
+ for ( QAD_Application* app = myApps.first(); doClose && app; app = myApps.next() ) {
+ QList<QAD_Study>& studies = app->getStudies();
+ for(QAD_Study* study = studies.first(); doClose && study != 0; study = studies.next()) {
+ if(myQueryClose && study->getStudyDocument()->IsModified()) {
+ SALOMEGUI_CloseDlg aDlg( this );
+ switch ( aDlg.exec() ) {
+ case 1:
+ if ( !onSaveStudy( study ) ) {
putInfo( tr("INF_CANCELLED") );
- return;
+ doClose = false;
}
+ break;
+ case 2:
+ case 3:
+ break;
+ case 0:
+ default:
+ doClose = false;
+ putInfo( tr("INF_CANCELLED") );
}
- study->close();
}
+ if ( doClose )
+ study->close();
}
}
+
myQueryClose = true;
- doClose ? e->accept() : e->ignore();
+
+ if ( !doClose ) {
+ myAboutToClose = false;
+ // onActiveStudyChanged() is normally caused by QWorkspace::eventFilter(),
+ // but this call was blocked by myAboutToClose == true, so now we should do it manually
+ onActiveStudyChanged();
+
+ e->ignore();
+ }
+ else
+ e->accept();
}
/*!
tr("ERR_ERROR"),
tr("ERR_DOC_CANTOPEN") + "\n" + name,
tr("BUT_OK") );
- } else if (myActiveComp != "") {
- QApplication::setOverrideCursor( Qt::waitCursor );
- loadComponentData(mapComponentName[myActiveComp]);
- openStudy->updateObjBrowser(true);
- QApplication::restoreOverrideCursor();
- }
+ }
break;
}
}
bool QAD_Desktop::loadComponentData( const QString& compName )
{
+ QAD_WaitCursor wc;
+
+ if ( compName.isEmpty() ) {
+ MESSAGE("loadComponentData(): empty component name passed!")
+ return false;
+ }
+
// Open component's data in active study if any
MESSAGE("loadComponentData(): Opening " << compName << " component data ")
if (!myActiveStudy) {
comp = getEngine( "FactoryServerPy", compName);
}
+ if ( CORBA::is_nil( comp ) ) {
+ MESSAGE("loadComponentData(): Engine is null");
+ return false;
+ }
+
SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
SALOMEDS::SComponent_var SCO = SALOMEDS::SComponent::_narrow(aStudy->FindObject( getComponentUserName(compName) ));
if (!SCO->_is_nil()) {
- if (!CORBA::is_nil(comp)) {
- SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
- if (!CORBA::is_nil(driver)) {
- SALOMEDS::StudyBuilder_var B = aStudy->NewBuilder();
- if (!CORBA::is_nil(B)) {
-// QAD_Operation* op = new QAD_Operation( myActiveStudy );
-// op->start();
+ SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
+ if (!CORBA::is_nil(driver)) {
+ SALOMEDS::StudyBuilder_var B = aStudy->NewBuilder();
+ if (!CORBA::is_nil(B)) {
+ try {
B->LoadWith(SCO,driver);
-// op->finish();
- } else {
+ }
+ catch( const SALOME::SALOME_Exception& ) {
+ // Oops, something went wrong while loading -> return an error
return false;
}
- } else {
- MESSAGE("loadComponentData(): Driver is null");
- return false;
- }
+ }
} else {
- MESSAGE("loadComponentData(): Engine is null");
+ MESSAGE("loadComponentData(): Driver is null");
+ // Incorrect! All components should inherit SALOMEDS::Driver
return false;
}
} else {
MESSAGE("loadComponentData(): SComponent is null");
- return false;
+ // Don't return false here, for there might be no data
+ // for a given component in the study yet
}
return true;
if (SCO->FindAttribute(anAttr, "AttributeName")) {
aName = SALOMEDS::AttributeName::_narrow(anAttr);
name = aName->Value();
- SALOME_ModuleCatalog::Acomponent_var Comp = myCatalogue->GetComponent( mapComponentName[name] );
+ if ( getComponentName( name ).isEmpty() )
+ return;
+ SALOME_ModuleCatalog::Acomponent_var Comp = myCatalogue->GetComponent( getComponentName(name) );
if ( !Comp->_is_nil() ) {
SALOME_ModuleCatalog::ListOfComponents_var list_type_composants =
} else if ( list_type_composants->length() > 1 ) {
SALOMEGUI_OpenWith* aDlg = new SALOMEGUI_OpenWith( this );
for (unsigned int ind = 0; ind < list_type_composants->length();ind++) {
- QString compusername = getComponentUserName( strdup(list_type_composants[ind]) );
+ QString compusername = getComponentUserName( (char*)list_type_composants[ind] );
if ( !compusername.isEmpty() )
aDlg->addComponent( compusername );
}
*/
bool QAD_Desktop::loadComponent(QString Component)
{
+ if ( Component.isEmpty() ) {
+ MESSAGE("loadComponent(): empty component name passed!")
+ return false;
+ }
+
QAD_WaitCursor wc;
QString resDir("/"); //NRI : Pb under Windows
if (myActiveMenus)
nbToolbars = myActiveMenus->getToolBarList().count();
- // san - avoid loading component GUI library multiple times
- QString aUserName( getComponentUserName( Component ) );
-
- SALOMEGUI* anActiveGUI = getComponentGUI(aUserName);
- if ( !anActiveGUI )
- return false;
-
- /* SETTINGS */
- anActiveGUI->SetSettings( this, (char*)Component.latin1() );
-
/* COMPONENT INTERFACE */
SALOME_ModuleCatalog::Acomponent_ptr aComponent =
myCatalogue->GetComponent(Component.latin1());
//NRI if (component.compare(QString("Salome"))!= 0) {
if (component.compare( getComponentUserName( "KERNEL" ) )!= 0) {
// QApplication::setOverrideCursor( Qt::waitCursor );
+ bool isOk = ( !isLoadData || loadComponentData( getComponentName(component) ) );
+ if ( !isOk ) {
+ QAD_MessageBox::error1( this,
+ tr("ERR_ERROR"),
+ tr("ERR_COMP_DATA_NOT_LOADED").arg( component ),
+ tr("BUT_OK") );
+ }
+
+ if ( !isOk || !loadComponent( getComponentName(component) ) ) {
+ myCombo->setCurrentItem (0);
+ for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
+ aButton->setOn(false);
+ }
+ myActiveComp = "";
+ return;
+ }
+
myActiveComp = component;
SALOME_Selection* oldSel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
}
myActiveStudy->Selection( component );
- if ( !loadComponent(mapComponentName[component]) ) {
- myCombo->setCurrentItem (0);
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- aButton->setOn(false);
- }
- myActiveComp = "";
- }
SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
SALOME_ListIteratorOfListIO It( oldSel->StoredIObjects() );
}
- // Open new component's data in active study if any
- if(isLoadData) loadComponentData(mapComponentName[component]);
-
oldSel->Clear();
+
+ /* SETTINGS */
+ // IMPORTANT: SetSettings() should be called AFTER SALOME_Selection
+ // has been created for a newly activated component
+ getComponentGUI(component)->SetSettings( this, (char*)getComponentName(component).latin1() );
+
myActiveStudy->updateObjBrowser(true);
// QApplication::restoreOverrideCursor();
*/
void QAD_Desktop::clearMenus()
{
- onActiveStudyChanged();
+ // san - commented as presumably obsolete
+ // onActiveStudyChanged();
/* menus */
myMenusList.clear();
SALOMEGUI* QAD_Desktop::getComponentGUI( const QString& component )
{
SALOMEGUI* aCompGUI = 0;
+ if ( component.isEmpty() || getComponentName( component ).isEmpty() )
+ return aCompGUI;
// Load component GUI if requested for the first time
if ( myComponents.find( component ) == myComponents.end() ) {
}
+/*!
+ Returns name of active component
+*/
+QString QAD_Desktop::getComponentDataType() const
+{
+ using namespace SALOMEDS;
+ Study_var aStudy = getActiveStudy()->getStudyDocument();
+ SObject_var aSObject = aStudy->FindObject(myActiveComp.latin1());
+ SComponent_var aComponent = SComponent::_narrow(aSObject);
+ if(!aComponent->_is_nil()){
+ CORBA::String_var aString = aComponent->ComponentDataType();
+ return aString.in();
+ }
+ return "";
+}
+
void QAD_Desktop::definePopup(QString & theContext,
QString & theParent,
QString & theObject )
void QAD_Desktop::onActiveStudyChanged()
{
+ // Avoid recursive calls caused by QAD_MessageBox
+ static bool isRecursion = false;
+ if ( isRecursion || myAboutToClose )
+ return;
+
+ if (myActiveComp != "") {
+ // Try to load active component's data in the activated study
+ if ( !loadComponentData(mapComponentName[myActiveComp]) ) {
+ isRecursion = true;
+ QAD_MessageBox::error1( this,
+ tr("ERR_ERROR"),
+ tr("ERR_COMP_DATA_NOT_LOADED").arg( myActiveComp ),
+ tr("BUT_OK") );
+ // Error while loading component's data -> deactivate it
+ deactivateComponent();
+ if (!myXmlHandler->myIdList.IsEmpty()) clearMenus();
+ myCombo->setCurrentItem (0);
+ for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
+ aButton->setOn(false);
+ }
+ myActiveComp = "";
+ isRecursion = false;
+ return;
+ }
+ else
+ myActiveStudy->updateObjBrowser(true);
+ }
+
SALOMEGUI* anActiveGUI = getActiveGUI();
if ( anActiveGUI )
anActiveGUI->ActiveStudyChanged(this);
virtual void helpContext(const QString& path, const QString& dir = QString::null);
*/
bool loadComponent(QString);
+ bool loadComponentData( const QString& );
QString changeXmlInputSourceData(QString theData, QString theComponent);
void activateComponent(const QString& theName, bool isLoadData = true);
void deactivateComponent();
const QString& getActiveComponent() const;
SALOMEGUI* getActiveGUI();
SALOMEGUI* getComponentGUI( const QString& ); // accepts component`s user name
+ QString getComponentDataType() const;
SALOME_NamingService* getNameService() {return myNameService;}
Engines::Component_var getEngine(const char *containerName,
virtual void updateCaption( UpdateCommand );
virtual void updateMenu( UpdateCommand );
- bool loadComponentData( const QString& );
-
protected slots:
virtual void onNewStudy();
virtual void onNewStudy(QAD_Application* app);
SALOME_LifeCycleCORBA * myEnginesLifeCycle;
QComboBox * myCombo;
bool myQueryClose;
+ bool myAboutToClose;
bool _islibso;
ComponentMap myComponents;
Constructor
*/
QAD_FileDlg::QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool modal ) :
-QFileDialog( parent, 0, modal ),
+QFileDialogP( parent, 0, modal ),
myValidator( 0 ),
myQuickCombo( 0 ),
myOpen( open )
{
if ( parent->icon() )
- setIcon( *parent->icon() );
+ setIcon( *parent->icon() );
setSizeGripEnabled( true );
-
+
if (showQuickDir) {
// inserting quick dir combo box
QLabel* lab = new QLabel(tr("Quick path:"), this);
{
// mySelectedFile = QFileDialog::selectedFile().simplifyWhiteSpace(); //VSR- 06/12/02
if ( mode() != ExistingFiles ) {
- mySelectedFile = QFileDialog::selectedFile(); //VSR+ 06/12/02
+ mySelectedFile = QFileDialogP::selectedFile(); //VSR+ 06/12/02
addExtension();
}
// mySelectedFile = mySelectedFile.simplifyWhiteSpace(); //VSR- 06/12/02
*/
if ( acceptData() ) {
myLastVisitedPath = dirPath();
- QFileDialog::accept();
+ QFileDialogP::accept();
}
}
void QAD_FileDlg::reject()
{
mySelectedFile = QString::null;
- QFileDialog::reject();
+ QFileDialogP::reject();
}
/*!
if ( !initial.isEmpty() ) {
fd->processPath( initial ); // VSR 24/03/03 check for existing of directory has been added to avoid QFileDialog's bug
}
- fd->setFilters( filters );
+
+ fd->setFilters( filters );
+
if ( validator )
fd->setValidator( validator );
fd->exec();
}
fd->setMode( DirectoryOnly );
fd->setFilters(tr("DIRECTORIES_FILTER"));
+
fd->exec();
QString dirname = fd->selectedFile();
delete fd;
qApp->processEvents();
return dirname;
-
}
#ifndef QAD_FILEDIALOG_H
#define QAD_FILEDIALOG_H
-#include <qfiledialog.h>
#include <qcombobox.h>
+
+#include <qfiledialogP.h>
#include "QAD.h"
#include "QAD_FileValidator.h"
-class QAD_EXPORT QAD_FileDlg : public QFileDialog
+class QAD_EXPORT QAD_FileDlg : public QFileDialogP
{
Q_OBJECT
public:
QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir = true, bool modal = true );
- ~QAD_FileDlg();
+ virtual ~QAD_FileDlg();
public:
bool isOpenDlg() const;
const QString& initial,
const QString& caption,
bool showQuickDir = true);
+
+protected:
+ virtual bool acceptData();
+
private:
- bool acceptData();
void addExtension();
bool processPath( const QString& path );
QAD_FileValidator* myValidator; /* file validator */
static QString myLastVisitedPath; /* last visited path */
QComboBox* myQuickCombo; /* quick dir combo box */
-
};
#endif
// Module : SALOME
// $Header$
-using namespace std;
#include "QAD_FileValidator.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_MessageBox.h"
+#include "utilities.h"
+
#include <qfile.h>
#include <qfileinfo.h>
+using namespace std;
+
/* constructor */
QAD_FileValidator::QAD_FileValidator(QWidget* parent) :
myParent(parent)
// Module : SALOME
// $Header$
-using namespace std;
#include "QAD_ListView.h"
#include <qheader.h>
#include "QAD_Desktop.h"
-//#include <QAD_Application.h>
-//#include <QAD_Document.h>
-
-
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include "utilities.h"
+
+using namespace std;
+
//////////////////////////////////////////////////////////////////////
// QAD_ListView class implementation
//////////////////////////////////////////////////////////////////////
#include <qtooltip.h>
#include <qdragobject.h>
#include <qstringlist.h>
+#include <qmap.h>
+
using namespace std;
//VRV: porting on Qt 3.0.5
}
+/*!
+ Returns true if item is collapsed has collapsed children
+*/
+static bool hasCollapsed( QListViewItem* item )
+{
+ if ( !item )
+ return false;
+
+ bool res = ( item->childCount() && !item->isOpen() );
+ for ( QListViewItem* child = item->firstChild(); !res && child; child = child->nextSibling() )
+ res = hasCollapsed( child );
+
+ return res;
+}
+
+/*!
+ Expands item and all its children
+*/
+static void expand(QListViewItem* item)
+{
+ if ( !item )
+ return;
+
+ item->setOpen( true );
+
+ for ( QListViewItem* child = item->firstChild(); child; child = child->nextSibling() )
+ expand( child );
+}
+
/*!
Builds popup menu
*/
this,
SLOT( onEditAttribute() ) );
}
+
+ bool canExpand = false;
+ for ( QListViewItemIterator it( getListView() ); it.current() && !canExpand; ++it )
+ canExpand = canExpand || ( it.current()->isSelected() && hasCollapsed( it.current() ) );
+
+ if ( canExpand ) {
+ if ( myPopup->count() > 0 )
+ myPopup->insertSeparator();
+ myPopup->insertItem( tr( "EXPAND_ALL_CMD" ),
+ this,
+ SLOT( onExpandAll() ) );
+ }
}
} else {
// NRI 02/12/2002
}
}
+/*!
+ Called on "Expand all" popup menu command
+*/
+void QAD_ObjectBrowser::onExpandAll()
+{
+ for ( QListViewItemIterator it( getListView() ); it.current(); ++it )
+ if ( it.current()->isSelected() )
+ expand( it.current() );
+}
+
/*!
Returns Object Browser list view
*/
SALOMEDS::SObject_var CSO = it->Value();
SALOMEDS::SObject_var RefSO;
QString ior = "";
- QString CSOEntry = strdup( CSO->GetID() );
+ QString CSOEntry = CORBA::string_dup( CSO->GetID() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
SALOMEDS::AttributeComment_var aCmnt;
if ( CSO->ReferencedObject(RefSO) && !RefSO->_is_nil() ) {
- QString RefSOEntry = strdup( RefSO->GetID() );
+ QString RefSOEntry = CORBA::string_dup( RefSO->GetID() );
if (CSO->FindAttribute(anAttr, "AttributeName") || RefSO->FindAttribute(anAttr, "AttributeName")) {
aName = SALOMEDS::AttributeName::_narrow(anAttr);
if (RefSO->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- ior = strdup( anIOR->Value() );
+ ior = CORBA::string_dup( anIOR->Value() );
}
valueString = getValueFromObject( RefSO );
-// AddItem (Item, QString(" * ") + strdup( aName->Value() ), RefSOEntry, ior, 2, CSOEntry);
+// AddItem (Item, QString(" * ") + CORBA::string_dup( aName->Value() ), RefSOEntry, ior, 2, CSOEntry);
Item = AddItem(theParentItem,
- QString(" * ") + strdup( aName->Value() ),
+ QString(" * ") + CORBA::string_dup( aName->Value() ),
RefSOEntry,
ior,
2,
// getting IOR
if (CSO->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- ior = strdup( anIOR->Value() );
+ ior = CORBA::string_dup( anIOR->Value() );
}
// getting Name and adding new Item
if (CSO->FindAttribute(anAttr, "AttributeName") ) {
aName = SALOMEDS::AttributeName::_narrow(anAttr);
- Item = AddItem(theParentItem, strdup( aName->Value() ), CSOEntry, ior, 0, "", valueString);
+ Item = AddItem(theParentItem, CORBA::string_dup( aName->Value() ), CSOEntry, ior, 0, "", valueString);
myListViewMap[ CSOEntry ].append( Item );
}
else {
for (; itcomp->More(); itcomp->Next()) {
QAD_ObjectBrowserItem* Item = 0;
SALOMEDS::SComponent_var SC = itcomp->Value();
- QString dataType = strdup( SC->ComponentDataType() );
+ QString dataType = CORBA::string_dup( SC->ComponentDataType() );
QString ior = "";
- QString SCEntry = strdup( SC->GetID() );
+ QString SCEntry = CORBA::string_dup( SC->GetID() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
if (SC->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- ior = strdup( anIOR->Value() );
+ ior = CORBA::string_dup( anIOR->Value() );
}
bool caseIAPP = false;
if ( ShowIAPP.compare("true") == 0 ) {
if (SC->FindAttribute(anAttr, "AttributeName")) {
aName = SALOMEDS::AttributeName::_narrow(anAttr);
- Item = AddItem (myListView, strdup( aName->Value() ), strdup( SCEntry ), ior, 1, "");
+ Item = AddItem (myListView, CORBA::string_dup( aName->Value() ), SCEntry, ior, 1, "");
myListViewMap[ SCEntry ].append( Item );
}
else {
caseIAPP = false;
if (SC->FindAttribute(anAttr, "AttributeName")) {
aName = SALOMEDS::AttributeName::_narrow(anAttr);
- Item = AddItem (myListView, strdup( aName->Value() ), SCEntry, ior, 1, "");
+ Item = AddItem (myListView, CORBA::string_dup( aName->Value() ), SCEntry, ior, 1, "");
myListViewMap[ SCEntry ].append( Item );
}
else {
QAD_ObjectBrowserItem* root = ( QAD_ObjectBrowserItem* )myUseCaseView->firstChild();
SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
SALOMEDS::SObject_var SOCurrent = UCBuilder->GetCurrentObject();
- QString UCName = QString( strdup( UCBuilder->GetName() ) );
+ QString UCName = CORBA::string_dup( UCBuilder->GetName() );
if ( UCName.isEmpty() )
UCName = QString( tr( "Root" ) );
// creating root item if is not yet created
if ( !UCIter->_is_nil() ) {
for ( ; UCIter->More(); UCIter->Next() ) {
SALOMEDS::SObject_var UCObject = UCIter->Value();
- QString UCEntry = strdup( UCObject->GetID() );
+ QString UCEntry = CORBA::string_dup( UCObject->GetID() );
ucList[ UCEntry ] = UCObject;
}
}
SALOMEDS::AttributeTextHighlightColor_var aTextHighlightColor;
QString valueString;
QString ior = "";
- QString UCEntry = strdup( UCObject->GetID() );
+ QString UCEntry = CORBA::string_dup( UCObject->GetID() );
SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
SALOMEDS::SObject_var SOCurrent = UCBuilder->GetCurrentObject();
// if ( !bFound ) {
if ( UCObject->ReferencedObject( RefSO ) && !RefSO->_is_nil() ) {
- QString RefSOEntry = strdup( RefSO->GetID() );
+ QString RefSOEntry = CORBA::string_dup( RefSO->GetID() );
if ( UCObject->FindAttribute( anAttr, "AttributeName" ) || RefSO->FindAttribute( anAttr, "AttributeName" ) ) {
aName = SALOMEDS::AttributeName::_narrow( anAttr );
if ( RefSO->FindAttribute( anAttr, "AttributeIOR" ) ) {
anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
- ior = strdup( anIOR->Value() );
+ ior = CORBA::string_dup( anIOR->Value() );
}
valueString = getValueFromObject( RefSO );
if ( !UCSubItem ) {
UCSubItem = AddItem( UCItem,
- QString( " * " ) + strdup( aName->Value() ),
+ QString( " * " ) + CORBA::string_dup( aName->Value() ),
RefSOEntry,
ior,
2,
myUseCaseMap[ RefSOEntry ].append( UCSubItem );
}
else {
- UCSubItem->setName( QString( " * " ) + strdup( aName->Value() ) );
+ UCSubItem->setName( QString( " * " ) + CORBA::string_dup( aName->Value() ) );
UCSubItem->setEntry( RefSOEntry );
UCSubItem->setIOR( ior );
UCSubItem->setReference( UCEntry );
// getting IOR
if ( UCObject->FindAttribute( anAttr, "AttributeIOR" ) ) {
anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
- ior = strdup( anIOR->Value() );
+ ior = CORBA::string_dup( anIOR->Value() );
}
// getting Name and adding new Item
if ( UCObject->FindAttribute( anAttr, "AttributeName" ) ) {
aName = SALOMEDS::AttributeName::_narrow( anAttr );
if ( !UCSubItem ) {
- UCSubItem = AddItem( UCItem, strdup( aName->Value() ), UCEntry, ior, 0, "", valueString );
+ UCSubItem = AddItem( UCItem, CORBA::string_dup( aName->Value() ), UCEntry, ior, 0, "", valueString );
myUseCaseMap[ UCEntry ].append( UCSubItem );
}
else {
- UCSubItem->setName( strdup( aName->Value() ) );
+ UCSubItem->setName( CORBA::string_dup( aName->Value() ) );
UCSubItem->setEntry( UCEntry );
UCSubItem->setIOR( ior );
UCSubItem->setReference( "" );
if ( !UCIter->_is_nil() ) {
for ( ; UCIter->More(); UCIter->Next() ) {
SALOMEDS::SObject_var UCSubObject = UCIter->Value();
- QString UCSubEntry = strdup( UCSubObject->GetID() );
+ QString UCSubEntry = CORBA::string_dup( UCSubObject->GetID() );
ucList[ UCSubEntry ] = UCSubObject;
}
}
QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
if (theItem != NULL && ( Sel->IObjectCount()>0 || ActiveComp.isEmpty() ) ) {
+
+ // PAL5618: if IO is presented by several items, assure that the selected IO
+ // is presented exactly by theItem: difference is in reference
+ QAD_ObjectBrowserItem *item = (QAD_ObjectBrowserItem *) theItem;
+ QString theEntry = item->getEntry();
+ const SALOME_ListIO& SelIO = Sel->StoredIObjects();
+ for ( SALOME_ListIteratorOfListIO SelIt( SelIO ); SelIt.More(); SelIt.Next() ) {
+ const Handle(SALOME_InteractiveObject)& IO = SelIt.Value();
+ if ( strcmp ( IO->getEntry(), theEntry ) == 0 )
+ IO->setReference( item->getReference() );
+ }
+
createPopup();
if ( myPopup ) {
SALOME_ListIO DeltaNeg;
DeltaNeg.Clear();
+ typedef QMap<QString, SALOME_InteractiveObject*> SelMap;
+
+ SelMap currMap, allMap;
+ for( SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); It.More(); It.Next() )
+ currMap.insert( It.Value()->getEntry(), It.Value().operator->() );
+
QListViewItemIterator it( whoIs );
for ( ; it.current(); ++it ) {
QAD_ObjectBrowserItem* item = (QAD_ObjectBrowserItem*)it.current();
if ( !theEntry.isEmpty() ) {
if ( item->isSelected() ) {
- bool itemAlreadySelected = false;
-
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IO = It.Value();
- if ( strcmp ( IO->getEntry(), theEntry ) == 0 ) {
- itemAlreadySelected = true;
- break;
- }
- }
-
- if (!itemAlreadySelected) {
+ allMap.insert( theEntry, 0 );
+
+ if ( !currMap.contains( theEntry ) ) {
Handle(SALOME_InteractiveObject) newIO;
SALOMEDS::SObject_var obj = aStudy->FindObjectID( theEntry.latin1() );
if ( !obj->_is_nil() ) {
SALOMEDS::SComponent_var comp = obj->GetFatherComponent();
if ( !comp->_is_nil() ) {
- Standard_CString datatype = comp->ComponentDataType();
- newIO = new SALOME_InteractiveObject( strdup(theEntry),
- datatype,
- strdup(theName) );
- newIO->setReference( strdup(theRef) );
+ //Standard_CString datatype = comp->ComponentDataType();
+ const char* datatype = comp->ComponentDataType();
+ // newIO = new SALOME_InteractiveObject( CORBA::string_dup(theEntry),
+ // datatype,
+ // CORBA::string_dup(theName) );
+ newIO = new SALOME_InteractiveObject( theEntry, datatype, theName );
+ newIO->setReference( CORBA::string_dup(theRef) );
}
} else {
- newIO = new SALOME_InteractiveObject( strdup(theEntry),
- "",
- strdup(theName) );
- newIO->setReference( strdup(theRef) );
+ //newIO = new SALOME_InteractiveObject( CORBA::string_dup(theEntry),
+ // "",
+ // CORBA::string_dup(theName) );
+ newIO = new SALOME_InteractiveObject( theEntry, "", theName );
+ newIO->setReference( CORBA::string_dup(theRef) );
}
if (!newIO.IsNull()) {
DeltaPos.Append( newIO );
}
}
- } else {
- SALOME_ListIteratorOfListIO It1( Sel->StoredIObjects() );
- for(;It1.More();It1.Next()) {
- Handle(SALOME_InteractiveObject) IO = It1.Value();
- if ( strcmp( IO->getEntry(), item->getEntry() ) == 0 ) {
- DeltaNeg.Append( IO );
- break;
- }
- }
- }
+ } else if ( currMap.contains( theEntry ) )
+ DeltaNeg.Append( currMap[theEntry] );
}
}
for(;ItPos.More();ItPos.Next()) {
Sel->AddIObject( ItPos.Value() );
}
+
+ for ( SelMap::iterator it = currMap.begin(); it != currMap.end(); ++it )
+ if ( !allMap.contains( it.key() ) )
+ Sel->RemoveIObject( it.data() );
+
if ( myApp )
myApp->updateActions();
}
// Table of integer
if ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
aTableInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
- QString tlt = QString( strdup( aTableInt->GetTitle() ) );
+ QString tlt = QString( aTableInt->GetTitle() );
if ( !tlt.isEmpty() )
tlt += " ";
int nbRows = aTableInt->GetNbRows() ;
// Table of real
if ( SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
aTableReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
- QString tlt = QString( strdup( aTableReal->GetTitle() ) );
+ QString tlt = QString( aTableReal->GetTitle() );
if ( !tlt.isEmpty() )
tlt += " ";
int nbRows = aTableReal->GetNbRows() ;
// Comment
if ( SO->FindAttribute(anAttr, "AttributeComment") ) {
aComment = SALOMEDS::AttributeComment::_narrow( anAttr );
- QString val = QString( strdup( aComment->Value() ) );
+ QString val = QString( aComment->Value() );
return val;
}
return QString::null;
{
if ( myStudy->_is_nil() )
return;
+
+ // Check if the study is locked
QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
QAD_Study* myActiveStudy = Desktop->getActiveStudy();
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ if ( aStudy->GetProperties()->IsLocked() )
+ {
+ QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ return;
+ }
+
SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
SALOMEDS::SObject_var Current = UCBuilder->GetCurrentObject();
if ( ucSelected.count() == 1 ) {
QAD_ObjectBrowserItem* useCaseItem = ( QAD_ObjectBrowserItem* )( ucSelected.at( 0 ) );
if ( isRootItem( useCaseItem ) ) {
- QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), strdup( UCBuilder->GetName() ) );
+ QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), UCBuilder->GetName() );
if ( !name.isEmpty() ) {
- bool ok = UCBuilder->SetName( strdup( name.latin1() ) );
+ bool ok = UCBuilder->SetName( name.latin1() );
myActiveStudy->updateUseCaseBrowser( );
}
}
else/* if ( UCBuilder->IsUseCase( myStudy->FindObjectID( (( QAD_ObjectBrowserItem* )( ucSelected.at(0) ))->getEntry() ) ) )*/ {
- QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), strdup( useCaseItem->getName() ) );
+ QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), CORBA::string_dup( useCaseItem->getName() ) );
if ( !name.isEmpty() ) {
myActiveStudy->renameIObject( Sel->firstIObject(), name );
}
*/
void QAD_ObjectBrowser::onUseCaseBtn()
{
+ // Check if the study is locked
+ QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
+ QAD_Study* myActiveStudy = Desktop->getActiveStudy();
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ if ( aStudy->GetProperties()->IsLocked() )
+ {
+ QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ return;
+ }
+
if ( sender() == myNewBtn ) {
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = Desktop->getActiveStudy();
SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
UCBuilder->AddUseCase( tr( "NEW_OBJECT" ) );
myActiveStudy->updateUseCaseBrowser();
void showPopupMenu(QListViewItem*);
void showUseCasePopupMenu(QListViewItem*);
+ void onExpandAll();
void onExpanded (QListViewItem*);
void onCollapsed(QListViewItem*);
void onUseCasePopupMenu( int );
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
//NRI
+#include "utilities.h"
using namespace std;
_isInHistory = true;
_currentCommand = text(endLine).remove(0,SIZEPR);
_currentCommand.truncate( _currentCommand.length() - 1 );
- SCRUTE(_currentCommand);
}
QString previousCommand = myInterp->getPrevious();
if (previousCommand.compare(BEGIN_HISTORY_PY) != 0)
// $Header$
+
+
#include "QAD_PyInterp_mono.h"
#include "utilities.h"
return;
}
- SharedLib.SetName( strdup(ComponentLib) );
+ const Standard_CString aCopyCL = CORBA::string_dup(ComponentLib);
+ SharedLib.SetName( aCopyCL);
+ delete(aCopyCL);
+
bool ok = SharedLib.DlOpen(OSD_RTLD_LAZY);
if (!ok) {
h->unCompressAfter();
}
+void QAD_RightFrame::compressLeft()
+{
+ QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
+ if( h )
+ h->compressBefore();
+}
+
+void QAD_RightFrame::compressRight()
+{
+ QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
+ if( h )
+ h->compressAfter();
+}
+
+void QAD_RightFrame::unCompressLeft()
+{
+ QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
+ if( h )
+ h->unCompressBefore();
+}
+
+void QAD_RightFrame::unCompressRight()
+{
+ QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
+ if( h )
+ h->unCompressAfter();
+}
+
+bool QAD_RightFrame::isCompressedViewFrame() const
+{
+ return isCompressed( myViewFrame );
+}
+
+bool QAD_RightFrame::isCompressedPython() const
+{
+ return mySplitter->isCompressed( getPyEditor() );
+}
+
+bool QAD_RightFrame::isCompressedMessage() const
+{
+ return mySplitter->isCompressed( getMessage() );
+}
+
void compressUp();
void unCompressBottom();
void unCompressUp();
-
+
+ void compressLeft();
+ void compressRight();
+ void unCompressLeft();
+ void unCompressRight();
+
+ bool isCompressedViewFrame() const;
+ bool isCompressedPython() const;
+ bool isCompressedMessage() const;
+
protected:
ViewType myViewType;
myIsReadOnly = state;
}
+bool QAD_Study::isLocked()
+{
+ bool state = false;
+ if ( !CORBA::is_nil( myStudy ) )
+ state = myStudy->GetProperties()->IsLocked();
+ return state;
+}
+
//=======================================================================//
// Study operations //
//=======================================================================//
title, VIEW_OCC,
myInterp, myMutex );
- Standard_CString name = strdup(sf->title().latin1());
+ Standard_CString name = CORBA::string_dup(sf->title().latin1());
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
aName = SALOMEDS::AttributeName::_narrow(anAttr);
aName->SetValue(name);
for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf; sf = myStudyFrames.next() ) {
/* Update Viewer */
- sf->getRightFrame()->getViewFrame()->undo( myStudy, sf->entry() );
+ sf->getRightFrame()->getViewFrame()->undo( this, sf->entry() );
}
updateCaptions();
/* Update Viewer */
for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf; sf = myStudyFrames.next() ) {
- sf->getRightFrame()->getViewFrame()->redo( myStudy, sf->entry() );
+ sf->getRightFrame()->getViewFrame()->redo( this, sf->entry() );
}
updateCaptions();
SALOMEDS::AttributeName_var aName;
anAttr = aStudyBuilder->FindOrCreateAttribute(obj, "AttributeName");
aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(strdup(newName.latin1()));
+ aName->SetValue(newName.latin1());
}
// VSR 13/03/03 - rename Interactive object
bool isModified() const;
bool isReadOnly() const;
void setReadOnly(bool state);
+ bool isLocked();
const QString& getTitle() const;
int getStudyId();
const QString& getPath() const;
\brief Frame window which contains QAD_LeftFrame and QAD_RightFrame.
*/
+#include "QAD_StudyFrame.h"
#include "QAD_StudyFrame.h"
#include "QAD_RightFrame.h"
#include "QAD_LeftFrame.h"
*/
void QAD_StudyFrame::compressLeft()
{
- mySplitter->compress(myLeftFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->compressBefore();
}
void QAD_StudyFrame::compressRight()
{
- mySplitter->compress(myRightFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->compressAfter();
}
void QAD_StudyFrame::unCompressLeft()
{
- mySplitter->unCompress(myLeftFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->unCompressBefore();
}
void QAD_StudyFrame::unCompressRight()
{
- mySplitter->unCompress(myRightFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->unCompressAfter();
+}
+
+bool QAD_StudyFrame::isCompressedLeft() const
+{
+ return mySplitter->isCompressed(myLeftFrm);
+}
+
+bool QAD_StudyFrame::isCompressedRight() const
+{
+ return mySplitter->isCompressed(myRightFrm);
}
/*!
void unCompressLeft();
void unCompressRight();
+ bool isCompressedLeft() const;
+ bool isCompressedRight() const;
+
signals:
void sfStudyFrameActivated( QAD_StudyFrame* );
void sfStudyFrameClosing( QAD_StudyFrame*);
// Module : SALOME
// $Header$
-using namespace std;
#include "QAD.h"
#include "QAD_ViewFrame.h"
#include "QAD_Application.h"
#include <qimage.h>
#include "utilities.h"
+using namespace std;
+
/*!
Constructor
*/
{
}
-bool QAD_ViewFrame::isInViewer(SALOMEDS::Study_var aStudy,
- const char* anEntry, const char* StudyFrameEntry)
-{
- SALOMEDS::SObject_var RefSO;
- SALOMEDS::SObject_var SO = aStudy->FindObjectID(StudyFrameEntry);
- SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
- for (; it->More();it->Next()){
- SALOMEDS::SObject_var CSO= it->Value();
- if (CSO->ReferencedObject(RefSO))
- if ( strcmp( anEntry, RefSO->GetID() ) == 0 )
- return 1;
- }
- return 0;
-}
-
-//san:T3.13 - it's up to VTKViewer_ViewFrame to implement (or not implement) getRenderer() method. Be careful!
-/*
-vtkRenderer* QAD_ViewFrame::getRenderer()
-{
- MESSAGE ( "Only redefined VTKViewer")
- return NULL;
-}
-*/
-
/*
Dumps 3d-Viewer contents into image file
File format is defined by file's extension; supported formats : PNG, BMP, GIF, JPG
#include "QAD_StudyFrame.h"
#include "SALOME_InteractiveObject.hxx"
#include "SALOME_Selection.h"
+#include "SALOME_Prs.h"
+
+class QAD_Study;
// QT Include
#include <qmainwindow.h>
-//class vtkRenderer;
-class QAD_EXPORT QAD_ViewFrame : public QMainWindow
+class QAD_EXPORT QAD_ViewFrame : public QMainWindow, public SALOME_View
{
Q_OBJECT
virtual ViewType getTypeView() const = 0;
virtual QWidget* getViewWidget() = 0;
-// virtual vtkRenderer* getRenderer();
virtual void setBackgroundColor( const QColor& ) = 0;
virtual QColor backgroundColor() const = 0;
virtual bool isVisible( const Handle(SALOME_InteractiveObject)& IObject ) = 0;
/* undo/redo management */
- virtual void undo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry) = 0;
- virtual void redo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry) = 0;
-
- static bool isInViewer(SALOMEDS::Study_var aStudy,
- const char* anEntry,
- const char* StudyFrameEntry);
+ virtual void undo(QAD_Study* aStudy, const char* StudyFrameEntry) {}
+ virtual void redo(QAD_Study* aStudy, const char* StudyFrameEntry) {}
/* selection */
virtual Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) = 0;
msgid "ERR_GET_GUI_NOT_FOUND"
msgstr "GetComponentGUI() function not found in %1 library!"
+msgid "ERR_EMPTY_COMP_NAME"
+msgstr "Component name not found for %1"
+
+msgid "ERR_COMP_DATA_NOT_LOADED"
+msgstr "Persistent data for %1 component has not been loaded!\nProbably, persistent data file is missing or corrupted.\nThe component will be deactivated."
+
#---------------
# QUESTION
#---------------
msgid "EDIT_VALUE_CMD"
msgstr "Edit value"
+msgid "EXPAND_ALL_CMD"
+msgstr "Expand all"
+
msgid "PLOT_TABLE_CMD"
msgstr "Plot table"
#include "QAD_Resource.h"
#include "QAD_Tools.h"
#include "QAD_WaitCursor.h"
+#include "QAD_MessageBox.h"
// QT Includes
#include <qapplication.h>
}
QAD_StudyFrame* sf = myActiveStudy->getActiveStudyFrame();
- Standard_CString name = strdup(sf->title().latin1());
+ Standard_CString name = CORBA::string_dup(sf->title().latin1());
SALOMEDS::SComponent_var father = aStudy->FindComponent("Interface Applicative");
SALOMEDS::SObject_var newObj = B->NewObject(father);
QAD_ViewFrame* viewFrame = myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame();
+ // Ensure that parent component's data are loaded
+ QString compName = desktop->getComponentName( parentComp );
+ if ( compName.isEmpty() ) {
+ waitCursor.stop();
+ QAD_MessageBox::error1( desktop,
+ tr("ERR_ERROR"),
+ tr("ERR_EMPTY_COMP_NAME").arg( parentComp ),
+ tr("BUT_OK"));
+ return;
+ }
+
+ desktop->loadComponentData( compName );
+
// Build the graphic presentation (it is stored in the corresponding viewer)
+ bool isComponent = false;
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ bool needRepaint = false;
+
// Copy the selection
SALOME_ListIteratorOfListIO itInit( Sel->StoredIObjects() );
SALOME_ListIO selList;
for (; itInit.More(); itInit.Next()) {
- selList.Append(itInit.Value());
+ Handle(SALOME_InteractiveObject) IObject = itInit.Value();
+ if ( IObject->hasEntry() ) {
+ // check whether the component is selected
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry() );
+ if ( !obj->_is_nil() && strcmp( obj->GetFatherComponent()->GetID(), obj->GetID() ) == 0 ) {
+ selList.Clear();
+ isComponent = true;
+ selList.Append( IObject );
+ break;
+ }
+ }
+ selList.Append( IObject );
}
-
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- bool needRepaint = false;
-
if (id == QAD_DisplayOnly_Popup_ID)
viewFrame->EraseAll();
- SALOME_ListIteratorOfListIO It( selList );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
-
- // First check whether the object is a component or a child object
- bool isComponent = false;
-
- if (!IObject->hasEntry()) continue;
-
- SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
- if (!obj->_is_nil()) {
- SALOMEDS::SComponent_var comp = obj->GetFatherComponent();
- isComponent = (strcmp(comp->GetID(), obj->GetID()) == 0);
- }
-
- // For component -> display all children
- if (isComponent) {
- SALOMEDS::ChildIterator_ptr it = aStudy->NewChildIterator(obj);
- it->InitEx(true);
- for ( ; it->More(); it->Next()) {
- SALOMEDS::SObject_ptr child = it->Value();
+ // For component -> display all children
+ if ( isComponent ) {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( selList.First()->getEntry() );
+ SALOMEDS::ChildIterator_ptr It = aStudy->NewChildIterator( obj );
+ It->InitEx( true );
+ for ( ; It->More(); It->Next() ) {
+ SALOMEDS::SObject_ptr child = It->Value();
+ SALOMEDS::SObject_ptr ref;
+ if ( !child->ReferencedObject( ref ) ) {
Handle(SALOME_InteractiveObject) childIObject = new SALOME_InteractiveObject();
- childIObject->setEntry(child->GetID());
-
+ childIObject->setEntry( child->GetID() );
// Ensure that proper 3D presentation exists for IObject
aGUI->BuildPresentation(childIObject);
viewFrame->Display(childIObject, false);
needRepaint = true;
}
- } else { // for child object -> simply display it (no children are displayed)
+ }
+ }
+ else { // for child object -> simply display it (no children are displayed)
+ SALOME_ListIteratorOfListIO It( selList );
+ for( ;It.More();It.Next() ) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
// Ensure that proper 3D presentation exists for IObject
aGUI->BuildPresentation(IObject);
viewFrame->Display(IObject, false);
needRepaint = true;
}
-
}
- if (needRepaint)
+ if ( needRepaint )
viewFrame->Repaint();
myActiveStudy->updateObjBrowser(true);
// Module : SALOME
// $Header$
-using namespace std;
+#include "SALOMEGUI_Swig.hxx"
+
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Study.h"
#include "QAD_RightFrame.h"
#include "QAD_StudyFrame.h"
-#include "SALOMEGUI_Swig.hxx"
-#include "utilities.h"
+
+#include "SALOME_Event.hxx"
#include "SALOME_Selection.h"
#include "SALOME_InteractiveObject.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+namespace SALOME{
+ QAD_ViewFrame* GetViewFrame(QAD_Study* theStudy){
+ return theStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame();
+ }
+
+ Handle(SALOME_InteractiveObject) FindIObject(QAD_Study* theStudy, const char *theEntry)
+ {
+ return GetViewFrame(theStudy)->FindIObject(theEntry);
+ }
+}
+
/*!
Constructor
*/
SALOMEGUI_Swig::SALOMEGUI_Swig()
-// VSR 06-05-03 : _studyId(0)
{
// MESSAGE("Constructeur");
}
*/
QAD_Study* SALOMEGUI_Swig::getActiveStudy()
{
- QAD_Application* app = QAD_Application::getDesktop()->getActiveApp();
- if ( app ) return app->getActiveStudy();
+ if(QAD_Application* app = QAD_Application::getDesktop()->getActiveApp())
+ return app->getActiveStudy();
return 0;
}
*/
void SALOMEGUI_Swig::updateObjBrowser( bool updateSelection )
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myActiveStudy = getActiveStudy();
- if ( !myActiveStudy) return;
- // end of VSR 06-05-03 =====================================================
- myActiveStudy->updateObjBrowser( updateSelection );
+ if(QAD_Study* myActiveStudy = getActiveStudy())
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_Study,bool>
+ (myActiveStudy,&QAD_Study::updateObjBrowser,updateSelection));
}
/*!
*/
int SALOMEGUI_Swig::getActiveStudyId()
{
- // NRI 24-02-03 :
- // if (_studyId ==0)
- // {
- // QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- // _name = myStudy->getTitle();
-
- // VSR 06-05-03 ============================================================
- // _studyId = QAD_Application::getDesktop()->getActiveStudy()->getStudyId();
- int _studyId = 0;
- QAD_Study* myActiveStudy = getActiveStudy();
- if ( myActiveStudy) _studyId = myActiveStudy->getStudyId();
- // SCRUTE(_studyId);
- // end of VSR 06-05-03 =====================================================
- // }
- return _studyId;
+ if(QAD_Study* myActiveStudy = getActiveStudy())
+ return myActiveStudy->getStudyId();
+ return 0;
}
/*!
*/
const char *SALOMEGUI_Swig::getActiveStudyName()
{
- // VSR 06-05-03 ============================================================
- // QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- // _name = myStudy->getTitle();
- QString _name = QString::null;
- QAD_Study* myActiveStudy = getActiveStudy();
- if ( myActiveStudy) _name = myActiveStudy->getTitle();
- // end of VSR 06-05-03 =====================================================
-
- // NRI 24-02-03 :
- //if (_studyId ==0)
- // getActiveStudyId();
- return _name.latin1();
+ if(QAD_Study* myActiveStudy = getActiveStudy())
+ return myActiveStudy->getTitle().latin1();
+ return QString::null;
}
/*!
*/
int SALOMEGUI_Swig::SelectedCount()
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return 0;
- // end of VSR 06-05-03 =====================================================
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
- return Sel->IObjectCount();
+ if(QAD_Study* myStudy = getActiveStudy()){
+ SALOME_Selection* Sel = SALOME_Selection::Selection(myStudy->getSelection());
+ return Sel->IObjectCount();
+ }
+ return 0;
}
/*!
*/
const char* SALOMEGUI_Swig::getSelected(int i)
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return "";
- // end of VSR 06-05-03 =====================================================
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- int index = 0;
- for(;It.More();It.Next())
- {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if ( i == index++ )
- {
+ if(QAD_Study* myStudy = getActiveStudy()){
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myStudy->getSelection() );
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ int index = 0;
+ for(;It.More();It.Next()){
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ if( i == index++ ){
if ( IObject->hasEntry() )
return IObject->getEntry();
}
}
+ }
return "";
}
/*!
Add object with Entry into selection.
*/
-void SALOMEGUI_Swig::AddIObject(const char *Entry)
+void SALOMEGUI_Swig::AddIObject(const char *theEntry)
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
-
- if ( !IsInCurrentView( Entry ) )
- return;
-
- Handle(SALOME_InteractiveObject) IO =
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
- Sel->AddIObject( IO );
+ if(QAD_Study* myStudy = getActiveStudy()){
+ SALOME_Selection* aSel = SALOME_Selection::Selection( myStudy->getSelection() );
+ if(IsInCurrentView(theEntry)){
+ Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+ if(anIO.IsNull()) return;
+ ProcessEvent(new TMemFun2ArgEvent<SALOME_Selection,int,
+ const Handle(SALOME_InteractiveObject)&,bool,
+ Handle(SALOME_InteractiveObject)>
+ (aSel,&SALOME_Selection::AddIObject,anIO,true));
+ }
+ }
}
/*!
Removes object with Entry into selection.
*/
-void SALOMEGUI_Swig::RemoveIObject(const char *Entry)
+void SALOMEGUI_Swig::RemoveIObject(const char *theEntry)
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
-
- if ( !IsInCurrentView( Entry ) )
- return;
-
- Handle(SALOME_InteractiveObject) IO =
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
- Sel->RemoveIObject( IO );
+ if(QAD_Study* myStudy = getActiveStudy()){
+ SALOME_Selection* aSel = SALOME_Selection::Selection( myStudy->getSelection() );
+ if(IsInCurrentView(theEntry)){
+ Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+ if(anIO.IsNull()) return;
+ ProcessEvent(new TMemFun2ArgEvent<SALOME_Selection,int,
+ const Handle(SALOME_InteractiveObject)&,bool,
+ Handle(SALOME_InteractiveObject)>
+ (aSel,&SALOME_Selection::RemoveIObject,anIO,true));
+ }
+ }
}
*/
void SALOMEGUI_Swig::ClearIObjects()
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
- Sel->ClearIObjects();
+ if(QAD_Study* myStudy = getActiveStudy()){
+ SALOME_Selection* aSel = SALOME_Selection::Selection( myStudy->getSelection() );
+ ProcessVoidEvent(new TVoidMemFunEvent<SALOME_Selection>
+ (aSel,&SALOME_Selection::ClearIObjects));
+ }
}
/*!
Display
*/
-void SALOMEGUI_Swig::Display(const char *Entry)
+void SALOMEGUI_Swig::Display(const char *theEntry)
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
-
- if ( !IsInCurrentView( Entry ) )
- return;
-
- Handle(SALOME_InteractiveObject) IO =
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Display(IO);
+ if(QAD_Study* myStudy = getActiveStudy()){
+ if(IsInCurrentView(theEntry)){
+ Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+ if(anIO.IsNull()) return;
+ QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<QAD_ViewFrame,
+ const Handle(SALOME_InteractiveObject)&,bool,
+ Handle(SALOME_InteractiveObject)>
+ (aViewFrame,&QAD_ViewFrame::Display,anIO,true));
+ }
+ }
}
/*!
Display only
*/
-void SALOMEGUI_Swig::DisplayOnly(const char *Entry)
+void SALOMEGUI_Swig::DisplayOnly(const char *theEntry)
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
-
- if ( !IsInCurrentView( Entry ) )
- return;
-
- Handle(SALOME_InteractiveObject) IO =
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-
- if ( !IO.IsNull() ) {
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->DisplayOnly(IO);
+ if(QAD_Study* myStudy = getActiveStudy()){
+ if(IsInCurrentView(theEntry)){
+ Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+ if(anIO.IsNull()) return;
+ QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_ViewFrame,
+ const Handle(SALOME_InteractiveObject)&,
+ Handle(SALOME_InteractiveObject)>
+ (aViewFrame,&QAD_ViewFrame::DisplayOnly,anIO));
+ }
}
}
/*!
Erase
*/
-void SALOMEGUI_Swig::Erase(const char *Entry)
+void SALOMEGUI_Swig::Erase(const char *theEntry)
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
-
- if ( !IsInCurrentView( Entry ) )
- return;
-
- Handle(SALOME_InteractiveObject) IO =
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Erase(IO);
+ if(QAD_Study* myStudy = getActiveStudy()){
+ if(IsInCurrentView(theEntry)){
+ Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+ if(anIO.IsNull()) return;
+ QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<QAD_ViewFrame,
+ const Handle(SALOME_InteractiveObject)&,bool,
+ Handle(SALOME_InteractiveObject)>
+ (aViewFrame,&QAD_ViewFrame::Erase,anIO,true));
+ }
+ }
}
/*!
*/
void SALOMEGUI_Swig::DisplayAll()
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->DisplayAll();
+ if(QAD_Study* myStudy = getActiveStudy()){
+ QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+ ProcessVoidEvent(new TVoidMemFunEvent<QAD_ViewFrame>
+ (aViewFrame,&QAD_ViewFrame::DisplayAll));
+ }
}
/*!
*/
void SALOMEGUI_Swig::EraseAll()
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return;
- // end of VSR 06-05-03 =====================================================
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
-
- Sel->ClearIObjects();
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->EraseAll();
+ ClearIObjects();
+ if(QAD_Study* myStudy = getActiveStudy()){
+ QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+ ProcessVoidEvent(new TVoidMemFunEvent<QAD_ViewFrame>
+ (aViewFrame,&QAD_ViewFrame::EraseAll));
+ }
}
/*!
Checks if object is displayed in current viewer
*/
-bool SALOMEGUI_Swig::IsInCurrentView(const char *Entry)
+bool SALOMEGUI_Swig::IsInCurrentView(const char *theEntry)
{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Study* myStudy = getActiveStudy();
- if ( !myStudy) return false;
- // end of VSR 06-05-03 =====================================================
- return myStudy->isInViewer( Entry, myStudy->getActiveStudyFrame()->entry() );
+ if(QAD_Study* myStudy = getActiveStudy())
+ return myStudy->isInViewer( theEntry, myStudy->getActiveStudyFrame()->entry() );
+ return false;
}
-
-/*!
- Gets VTK renderer if available
-*/
-//san:T3.13 - move getRenderer() implementation from here to SalomePy.cxx
-/*vtkRenderer *SALOMEGUI_Swig::getRenderer(int viewId)
-{
- // VSR 06-05-03 ============================================================
- //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_Application* app = QAD_Application::getDesktop()->getActiveApp();
- if ( !app ) return NULL;
- QAD_Study* myStudy = app->getActiveStudy();
- if ( !myStudy) return NULL;
- // end of VSR 06-05-03 =====================================================
- int nbStudyFrames = myStudy->getStudyFramesCount();
- vtkRenderer *myRenderer = NULL;
- if (viewId == -1) // find the first frame with VTK viewer & get renderer
- {
- int i=0;
- for(i=0; i<nbStudyFrames; i++)
- {
- if ( myStudy->getStudyFrame(i)->getTypeView() == VIEW_VTK )
- {
- myRenderer = myStudy->getStudyFrame(i)->getRightFrame()->getViewFrame()->getRenderer();
- break;
- }
- }
- }
- else // get the VTK renderer of a given frame
- {
- SCRUTE(viewId);
- if ((viewId >=0) && (viewId <nbStudyFrames))
- myRenderer = myStudy->getStudyFrame(viewId)->getRightFrame()->getViewFrame()->getRenderer();
- }
- if (myRenderer == NULL) MESSAGE("No VTK Renderer available !");
- return myRenderer;
-}
-*/
-
#include <Standard.hxx>
-class vtkRenderer;
+#include "SALOME_InteractiveObject.hxx"
+
class QAD_Study;
+class QAD_ViewFrame;
+
+namespace SALOME{
+ QAD_ViewFrame* GetViewFrame(QAD_Study* theStudy);
+ Handle(SALOME_InteractiveObject) FindIObject(QAD_Study* theStudy, const char *theEntry);
+}
+
class SALOMEGUI_Swig
{
SALOMEGUI_Swig();
~SALOMEGUI_Swig();
- //san:T3.13 - move getRenderer() implementation from here to SalomePy.cxx
- //static vtkRenderer* getRenderer(int viewId = -1);
-
void updateObjBrowser( bool updateSelection );
QAD_Study* getActiveStudy();
int getActiveStudyId();
}
if ( !bEmptyRow ) { // Skip rows with no data !!!
// set row title
- tblIntAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? strdup( "" ) : strdup( rowTitles[ i ] ) );
+ tblIntAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? QString( "" ) : QString( rowTitles[ i ] ) );
// set row unit
- tblIntAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? strdup( "" ) : strdup( units[ i ] ) );
+ tblIntAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? QString( "" ) : QString( units[ i ] ) );
nRow++;
}
}
if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!!
// column titles
for ( i = 0; i < colTitles.count(); i++ )
- tblIntAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? strdup( "" ) : strdup( colTitles[ i ] ) );
+ tblIntAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? QString( "" ) : QString( colTitles[ i ] ) );
}
}
// title
}
if ( !bEmptyRow ) { // Skip rows with no data !!!
// set row title
- tblRealAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? strdup( "" ) : strdup( rowTitles[ i ] ) );
+ tblRealAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? QString( "" ) : QString( rowTitles[ i ] ) );
// set row unit
- tblRealAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? strdup( "" ) : strdup( units[ i ] ) );
+ tblRealAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? QString( "" ) : QString( units[ i ] ) );
nRow++;
}
}
if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!!
// column titles
for ( i = 0; i < colTitles.count(); i++ )
- tblRealAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? strdup( "" ) : strdup( colTitles[ i ] ) );
+ tblRealAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? QString( "" ) : QString( colTitles[ i ] ) );
}
}
// title
try {
SALOMEGUI_Table* tbl = myIntTable->getTable();
// title
- myIntTable->setTableTitle( strdup( tblIntAttr->GetTitle() ) );
+ myIntTable->setTableTitle( CORBA::string_dup( tblIntAttr->GetTitle() ) );
// nb of rows & cols
int nbRows = tblIntAttr->GetNbRows() ;
int nbCols = tblIntAttr->GetNbColumns();
SALOMEDS::StringSeq_var rowTitles = tblIntAttr->GetRowTitles();
for ( i = 0; i < nbRows; i++ ) {
if ( rowTitles->length() > 0 )
- strlist.append( strdup( rowTitles[i] ) );
+ strlist.append( CORBA::string_dup( rowTitles[i] ) );
else
strlist.append( "" );
}
SALOMEDS::StringSeq_var colTitles = tblIntAttr->GetColumnTitles();
for ( i = 0; i < nbCols; i++ ) {
if ( colTitles->length() > 0 )
- strlist.append( strdup( colTitles[i] ) );
+ strlist.append( CORBA::string_dup( colTitles[i] ) );
else
strlist.append( "" );
}
SALOMEDS::StringSeq_var rowUnits = tblIntAttr->GetRowUnits();
if ( rowUnits->length() > 0 ) {
for ( i = 0; i < nbRows; i++ )
- strlist.append( strdup( rowUnits[i] ) );
+ strlist.append( CORBA::string_dup( rowUnits[i] ) );
myIntTable->setUnits( strlist );
}
// data
try {
SALOMEGUI_Table* tbl = myRealTable->getTable();
// title
- myRealTable->setTableTitle( strdup( tblRealAttr->GetTitle() ) );
+ myRealTable->setTableTitle( CORBA::string_dup( tblRealAttr->GetTitle() ) );
// nb of rows & cols
int nbRows = tblRealAttr->GetNbRows() ;
int nbCols = tblRealAttr->GetNbColumns();
SALOMEDS::StringSeq_var rowTitles = tblRealAttr->GetRowTitles();
for ( i = 0; i < nbRows; i++ ) {
if ( rowTitles->length() > 0 )
- strlist.append( strdup( rowTitles[i] ) );
+ strlist.append( CORBA::string_dup( rowTitles[i] ) );
else
strlist.append( "" );
}
SALOMEDS::StringSeq_var colTitles = tblRealAttr->GetColumnTitles();
for ( i = 0; i < nbCols; i++ ) {
if ( colTitles->length() > 0 )
- strlist.append( strdup( colTitles[i] ) );
+ strlist.append( CORBA::string_dup( colTitles[i] ) );
else
strlist.append( "" );
}
SALOMEDS::StringSeq_var rowUnits = tblRealAttr->GetRowUnits();
if ( rowUnits->length() > 0 ) {
for ( i = 0; i < nbRows; i++ )
- strlist.append( strdup( rowUnits[i] ) );
+ strlist.append( CORBA::string_dup( rowUnits[i] ) );
myRealTable->setUnits( strlist );
}
// data
#endif
class Standard_NoSuchObject;
class SALOME_InteractiveObject;
-class TColStd_MapOfInteger;
+class TColStd_IndexedMapOfInteger;
class TColStd_MapTransientHasher;
class SALOME_DataMapOfIOMapOfInteger;
class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
Standard_EXPORT SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger(const SALOME_DataMapOfIOMapOfInteger& aMap);
Standard_EXPORT void Initialize(const SALOME_DataMapOfIOMapOfInteger& aMap) ;
Standard_EXPORT const Handle_SALOME_InteractiveObject& Key() const;
-Standard_EXPORT const TColStd_MapOfInteger& Value() const;
+Standard_EXPORT const TColStd_IndexedMapOfInteger& Value() const;
#ifndef _SALOME_InteractiveObject_HeaderFile
#include "SALOME_InteractiveObject.hxx"
#endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
#endif
#ifndef _TColStd_MapTransientHasher_HeaderFile
#include <TColStd_MapTransientHasher.hxx>
#define TheKey Handle_SALOME_InteractiveObject
#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.hxx>
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
#define Hasher TColStd_MapTransientHasher
#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
#include <Handle_SALOME_InteractiveObject.hxx>
#endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
#endif
#ifndef _TCollection_MapNode_HeaderFile
#include <TCollection_MapNode.hxx>
#include <TCollection_MapNodePtr.hxx>
#endif
class SALOME_InteractiveObject;
-class TColStd_MapOfInteger;
+class TColStd_IndexedMapOfInteger;
class TColStd_MapTransientHasher;
class SALOME_DataMapOfIOMapOfInteger;
class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
// }
// Methods PUBLIC
//
-Standard_EXPORT inline SALOME_DataMapNodeOfDataMapOfIOMapOfInteger(const Handle(SALOME_InteractiveObject)& K,const TColStd_MapOfInteger& I,const TCollection_MapNodePtr& n);
+Standard_EXPORT inline SALOME_DataMapNodeOfDataMapOfIOMapOfInteger(const Handle(SALOME_InteractiveObject)& K,const TColStd_IndexedMapOfInteger& I,const TCollection_MapNodePtr& n);
Standard_EXPORT inline Handle_SALOME_InteractiveObject& Key() const;
-Standard_EXPORT inline TColStd_MapOfInteger& Value() const;
+Standard_EXPORT inline TColStd_IndexedMapOfInteger& Value() const;
Standard_EXPORT ~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger();
// Fields PRIVATE
//
Handle_SALOME_InteractiveObject myKey;
-TColStd_MapOfInteger myValue;
+TColStd_IndexedMapOfInteger myValue;
};
#define TheKey Handle_SALOME_InteractiveObject
#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.hxx>
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
#define Hasher TColStd_MapTransientHasher
#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
#ifndef _SALOME_InteractiveObject_HeaderFile
#include "SALOME_InteractiveObject.hxx"
#endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
#endif
#ifndef _TColStd_MapTransientHasher_HeaderFile
#include <TColStd_MapTransientHasher.hxx>
Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
#define TheKey Handle_SALOME_InteractiveObject
#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.hxx>
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
#define Hasher TColStd_MapTransientHasher
#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
class Standard_DomainError;
class Standard_NoSuchObject;
class SALOME_InteractiveObject;
-class TColStd_MapOfInteger;
+class TColStd_IndexedMapOfInteger;
class TColStd_MapTransientHasher;
class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
Clear();
}
-Standard_EXPORT Standard_Boolean Bind(const Handle(SALOME_InteractiveObject)& K,const TColStd_MapOfInteger& I) ;
+Standard_EXPORT Standard_Boolean Bind(const Handle(SALOME_InteractiveObject)& K,const TColStd_IndexedMapOfInteger& I) ;
Standard_EXPORT Standard_Boolean IsBound(const Handle(SALOME_InteractiveObject)& K) const;
Standard_EXPORT Standard_Boolean UnBind(const Handle(SALOME_InteractiveObject)& K) ;
-Standard_EXPORT const TColStd_MapOfInteger& Find(const Handle(SALOME_InteractiveObject)& K) const;
- const TColStd_MapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) const
+Standard_EXPORT const TColStd_IndexedMapOfInteger& Find(const Handle(SALOME_InteractiveObject)& K) const;
+ const TColStd_IndexedMapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) const
{
return Find(K);
}
-Standard_EXPORT TColStd_MapOfInteger& ChangeFind(const Handle(SALOME_InteractiveObject)& K) ;
- TColStd_MapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K)
+Standard_EXPORT TColStd_IndexedMapOfInteger& ChangeFind(const Handle(SALOME_InteractiveObject)& K) ;
+ TColStd_IndexedMapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K)
{
return ChangeFind(K);
}
#ifndef _SALOME_InteractiveObject_HeaderFile
#include "SALOME_InteractiveObject.hxx"
#endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
#endif
#ifndef _TColStd_MapTransientHasher_HeaderFile
#include <TColStd_MapTransientHasher.hxx>
#define TheKey Handle_SALOME_InteractiveObject
#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.hxx>
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
#define Hasher TColStd_MapTransientHasher
#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
// Module : SALOME
// $Header$
-using namespace std;
/*!
\class SALOME_Selection SALOME_Selection.h
\brief Selection Mechanism of Interactive Object.
#include "utilities.h"
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+using namespace std;
static QList<SALOME_Selection>& SALOME_Sel_GetSelections()
{
QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
if ( !IsOk(anObject) ) {
- MESSAGE ( "The Object not authorized by Filters" )
+ if(MYDEBUG) INFOS ( "The Object not authorized by Filters" )
myActiveStudy->highlight(anObject,false, update);
return -1;
}
//! Returns the first InteractiveObject in the selection.
Handle(SALOME_InteractiveObject) SALOME_Selection::firstIObject()
{
- return myIObjects.First();
+ return myIObjects.Extent() > 0 ? myIObjects.First() : Handle(SALOME_InteractiveObject)();
}
//! Returns the last InteractiveObject in the selection.
Handle(SALOME_InteractiveObject) SALOME_Selection::lastIObject()
{
- return myIObjects.Last();
+ return myIObjects.Extent() > 0 ? myIObjects.Last() : Handle(SALOME_InteractiveObject)();
}
/*!
return myMapIOSubIndex.IsBound(IObject);
}
-void SALOME_Selection::GetIndex( const Handle(SALOME_InteractiveObject)& IObject, TColStd_MapOfInteger& theIndex )
+void SALOME_Selection::GetIndex( const Handle(SALOME_InteractiveObject)& IObject, TColStd_IndexedMapOfInteger& theIndex )
{
if ( myMapIOSubIndex.IsBound(IObject) ) {
theIndex = myMapIOSubIndex.Find(IObject);
if ( !myMapIOSubIndex.IsBound( IObject ) ) {
return false;
}
- TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+ TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
return MapIndex.Contains( index );
}
-
+static bool removeIndex( TColStd_IndexedMapOfInteger& MapIndex,
+ const int Index)
+{
+ int i = MapIndex.FindIndex( Index ); // i==0 if Index is not in the MapIndex
+ if ( i ) {
+ // only the last key can be removed
+ int indexLast = MapIndex.FindKey( MapIndex.Extent() );
+ if ( indexLast == Index )
+ MapIndex.RemoveLast();
+ else {
+ TColStd_IndexedMapOfInteger aNewMap;
+ aNewMap.ReSize( MapIndex.Extent() - 1 );
+ for ( int j = 1; j <= MapIndex.Extent(); j++ ) {
+ int ind = MapIndex( j );
+ if ( ind != Index )
+ aNewMap.Add( ind );
+ }
+ MapIndex = aNewMap;
+ }
+ }
+ return i;
+}
bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
bool modeShift,
bool update)
{
- MESSAGE ( " SALOME_Selection::AddOrRemoveIndex " << index << " - " << modeShift );
+ if(MYDEBUG) INFOS( " SALOME_Selection::AddOrRemoveIndex " << index << " - " << modeShift );
QAD_Desktop* myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
if ( !myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_MapOfInteger Empty;
+ TColStd_IndexedMapOfInteger Empty;
myMapIOSubIndex.Bind( IObject, Empty );
}
- TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+ TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
- if ( MapIndex.Contains( index )) {
- if ( modeShift ) {
- MapIndex.Remove( index );
- myActiveStudy->highlight( IObject, true, update );
- }
- } else {
- if ( !modeShift )
- MapIndex.Clear();
+ bool anIsConatains = MapIndex.Contains( index );
+ if (anIsConatains)
+ removeIndex( MapIndex, index );
+
+ if (!modeShift)
+ MapIndex.Clear();
+
+ if(!anIsConatains)
MapIndex.Add( index );
- myActiveStudy->highlight( IObject, true, update );
- emit currentSelectionChanged();
- return true;
- }
if ( MapIndex.IsEmpty() ) {
myMapIOSubIndex.UnBind( IObject );
RemoveIObject( IObject, update );
}
+ myActiveStudy->highlight( IObject, true, update );
+
emit currentSelectionChanged();
return false;
}
QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
if ( !myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_MapOfInteger Empty;
+ TColStd_IndexedMapOfInteger Empty;
myMapIOSubIndex.Bind( IObject, Empty );
}
- TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+ TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
TColStd_MapIteratorOfMapOfInteger It;
It.Initialize(theIndices);
- bool add = true;
-
- if (MapIndex.Contains(It.Key()))
- {
- if (!modeShift) return add;
- add = false;
- }
- else if (!modeShift)
+ if (!modeShift)
MapIndex.Clear();
- if (add)
- for(;It.More();It.Next())
- MapIndex.Add(It.Key());
- else
- for(;It.More();It.Next())
- MapIndex.Remove(It.Key());
-
+ for(;It.More();It.Next())
+ MapIndex.Add(It.Key());
+ if ( MapIndex.IsEmpty() ) {
+ myMapIOSubIndex.UnBind( IObject );
+ RemoveIObject( IObject, update );
+ }
+
myActiveStudy->highlight( IObject, true, update );
- if ( MapIndex.IsEmpty() ) myMapIOSubIndex.UnBind( IObject );
+
emit currentSelectionChanged();
- return add;
+ return !MapIndex.IsEmpty();
}
bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
- const std::vector<int>& theIndices,
+ const TContainerOfId& theIndices,
bool modeShift,
bool update)
{
QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
if ( !myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_MapOfInteger Empty;
+ TColStd_IndexedMapOfInteger Empty;
myMapIOSubIndex.Bind( IObject, Empty );
}
- TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+ TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
- bool add = true;
-
- if (MapIndex.Contains(theIndices[0]))
- {
- if (!modeShift) return add;
- add = false;
- }
- else if (!modeShift)
+ if (!modeShift)
MapIndex.Clear();
- if (add)
- for (int i=0; i<theIndices.size();i++)
- MapIndex.Add(theIndices[i]);
- else
- for (int i=0; i<theIndices.size();i++)
- MapIndex.Remove(theIndices[i]);
-
- myActiveStudy->highlight( IObject, true, update );
- if ( MapIndex.IsEmpty() )
+ TContainerOfId::const_iterator anIter = theIndices.begin();
+ TContainerOfId::const_iterator anIterEnd = theIndices.end();
+ for(; anIter != anIterEnd; anIter++)
+ MapIndex.Add(*anIter);
+
+ if ( MapIndex.IsEmpty() ) {
myMapIOSubIndex.UnBind( IObject );
+ RemoveIObject( IObject, update );
+ }
+
+ myActiveStudy->highlight( IObject, true, update );
+
emit currentSelectionChanged();
- return add;
+ return !MapIndex.IsEmpty();
}
void SALOME_Selection::RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index )
{
if ( myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
- if ( MapIndex.Contains( index ) )
- MapIndex.Remove( index );
+ TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+ removeIndex( MapIndex, index );
}
}
+void SALOME_Selection::ClearIndex()
+{
+ myMapIOSubIndex.Clear();
+}
+
+
+//================================================================
+// Function : GEOMBase_Helper
+// Purpose : Block signal currentSelectionChanged. Use this method to
+// deactivate signal before big modification of selection.
+// After this modification this signal must be activated and
+// method SelectionChanged must be called to notify other oblects
+// ( dialogs for example )
+//================================================================
+void SALOME_Selection::BlockSignals( const bool theState )
+{
+ blockSignals( theState );
+}
+
+//================================================================
+// Function : SelectionChanged
+// Purpose : Enit signal currentSelectionChanged()
+//================================================================
+void SALOME_Selection::SelectionChanged()
+{
+ emit currentSelectionChanged();
+}
// Open CASCADE Include
#include <TColStd_MapOfInteger.hxx>
-#include <vector>
+#include <set>
enum Selection_Mode {
NodeSelection,
bool HasIndex( const Handle(SALOME_InteractiveObject)& IObject );
void GetIndex( const Handle(SALOME_InteractiveObject)& IObject,
- TColStd_MapOfInteger& theIndex );
+ TColStd_IndexedMapOfInteger& theIndex );
+ typedef std::set<int> TContainerOfId;
+
bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index, bool modeShift, bool update=true );
bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const TColStd_MapOfInteger& theIndices, bool modeShift, bool update=true );
- bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const std::vector<int>& theIndices, bool modeShift, bool update=true );
+ bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const TContainerOfId& theIndices, bool modeShift, bool update=true );
void RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index );
bool IsIndexSelected(const Handle(SALOME_InteractiveObject)& IObject, int index);
+ void ClearIndex();
+
+ void BlockSignals( const bool );
+ void SelectionChanged();
signals:
void currentSelectionChanged();
#include <iostream>
#include "SALOME_Log.hxx"
-using namespace std;
-
-SALOME_Log* SALOME_Log::_singleton = 0;
-// log line size: if too short, log line is truncated, without crash...
-char SALOME_LogStr[1024];
+using namespace std;
-SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
+SALOME_Log::SALOME_Log()
{
}
{
}
-SALOME_Log* SALOME_Log::Instance()
+SALOME_Log& SALOME_Log::Instance()
{
- if (_singleton == 0) _singleton = new SALOME_Log();
- return _singleton;
+ static SALOME_Log instance;
+ return instance;
}
void SALOME_Log::putMessage(std::ostream& msg)
seekp(0);
}
-
#ifndef _SALOME_LOG_HXX_
#define _SALOME_LOG_HXX_
+#include <iostream>
+#include <strstream>
+
//these declarations for files don't using OCC includes (for example HDF)
# ifdef WNT
# endif /* WNT */
-
-#include <iostream>
-#include <strstream>
-
-using namespace std;
-
-class SALOME_Log : public ostrstream
+class SALOME_Log : public std::ostrstream
{
-private:
- static SALOME_Log* _singleton;
-protected:
- //disable creation of instances: force use static SALOME_Log& Instance()
- SALOME_Log();
public:
virtual ~SALOME_Log();
- static Standard_EXPORT SALOME_Log* Instance();
+ static Standard_EXPORT SALOME_Log& Instance();
Standard_EXPORT void putMessage(std::ostream& msg);
+
+protected:
+ //disable creation of instances: force use static SALOME_Log& Instance()
+ SALOME_Log();
};
+
#define SLog SALOME_Log::Instance()
#endif
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(Logger)
-SALOME_Logger::Logger_ptr m_pInterfaceLogger; // object reference on Logger server
+#include "utilities.h"
-SALOME_Log* SALOME_Log::_singleton = 0;
+// class SALOME_LoggerClient : public SALOME_Log
+// {
+// protected:
+// SALOME_Logger::Logger_var m_pInterfaceLogger; // object reference on Logger server
+// };
-// log line size: if too short, log line is truncated, without crash...
-char SALOME_LogStr[1024];
+SALOME_Logger::Logger_ptr m_pInterfaceLogger; // object reference on Logger server
-SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
+SALOME_Log::SALOME_Log()
{
- cout << "SALOME_LoggerClient: constructor" << endl;
+ MESSAGE("SALOME_LoggerClient: constructor");
//get reference on object reference from NS
//and initialize m_pInterfaceLogger
}
catch( CORBA::COMM_FAILURE& )
{
- cout<<"SALOME_LoggerClient: CORBA::COMM_FAILURE: Unable to contact the Naming Service"<<endl;
+ MESSAGE("SALOME_LoggerClient: CORBA::COMM_FAILURE: Unable to contact the Naming Service");
}
catch(...)
{
- cout<<"SALOME_LoggerClient: Unknown exception dealing with Naming Service"<<endl;
+ MESSAGE("SALOME_LoggerClient: Unknown exception dealing with Naming Service");
}
if(!CORBA::is_nil(inc))
obj = inc->resolve(name);
m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
if (!CORBA::is_nil(m_pInterfaceLogger))
- cout<<"SALOME_LoggerClient: Logger Server was found"<<endl;
+ MESSAGE("SALOME_LoggerClient: Logger Server was found");
break;
}
}
}
catch (const CosNaming::NamingContext::NotFound&)
{
- // cout << "Caught exception: Naming Service can't found Logger";
+ // MESSAGE("Caught exception: Naming Service can't found Logger");
}
catch (CORBA::COMM_FAILURE&)
{
- // cout << "Caught CORBA::SystemException CommFailure.";
+ // MESSAGE("Caught CORBA::SystemException CommFailure.");
}
catch (CORBA::SystemException&)
{
- // cout << "Caught CORBA::SystemException.";
+ // MESSAGE("Caught CORBA::SystemException.");
}
catch (CORBA::Exception&)
{
- // cout << "Caught CORBA::Exception.";
+ // MESSAGE("Caught CORBA::Exception.");
}
catch (...)
{
- // cout << "Caught unknown exception.";
+ // MESSAGE("Caught unknown exception.");
}
//cerr << "-----SALOME_Trace::SALOME_Trace----"<<endl;
}
{
}
-SALOME_Log* SALOME_Log::Instance()
+SALOME_Log& SALOME_Log::Instance()
{
- if (_singleton == 0) _singleton = new SALOME_Log();
- return _singleton;
+ static SALOME_Log instance;
+ return instance;
}
void SALOME_Log::putMessage(std::ostream& msg)
* The creation of Python interpretor must be protected par a C++ Lock because of C threads
*/
ThreadLock aPyLock = GetPyThreadLock("SALOME_PYQT_GUI::initInterp");
- interp=new PyInterp_PyQt();
+ interp = new PyInterp_PyQt();
+ interp->initialize();
mapInterp[StudyID] = interp;
}
// imports Python GUI module and puts it in _module attribute
QAD_Desktop* parent)
{
MESSAGE("SALOME_PYQT_GUI::OnGUIEvent");
+ ThreadLock aPyLock = GetPyThreadLock("SALOME_PYQT_GUI::OnGUIEvent");
PyLockWrapper aLock = interp->GetLockWrapper();
PyObjWrapper res(PyObject_CallMethod(_module,"OnGUIEvent","i",theCommandID));
if theComponentPaste:
aSObj = theSO.GetFatherComponent()
theInfo = theInfo + "(paste for component)"
- if not myStudyManager.Paste(aSObj):
- raise RuntimeError, "<Paste> for "+theInfo+" returns false"
+ if myStudyManager.Paste(aSObj) == None:
+ raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
aNewTree = GetTree(aRoot)
aLen = len(aTree)
for a in range(0,aLen):
#--------------------------------------------------------------------------
# initialise the ORB
-orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+orb = None
+
+while orb == None:
+ orb = CORBA.ORB_init([''], CORBA.ORB_ID)
# create an LifeCycleCORBA instance
lcc = LifeCycleCORBA(orb)
+while lcc._catalog == None:
+ lcc = LifeCycleCORBA(orb)
+
#create a naming service instance
naming_service = SALOME_NamingServicePy_i(orb)
# get Study Manager reference
-obj = naming_service.Resolve('myStudyManager')
+obj=None
+while obj == None:
+ obj = naming_service.Resolve('myStudyManager')
myStudyManager = obj._narrow(SALOMEDS.StudyManager)
# create new study
myStudyId = myStudy._get_StudyId()
print myStudyId
+
subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
face=subShapeList[0]
-name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
+name = geompy.SubShapeName(face, box)
print name
idface=geompy.addToStudyInFather(box,face,name)
subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
shell = subShellList[0]
-name = geompy.SubShapeName( shell._get_Name(), box._get_Name() )
+name = geompy.SubShapeName(shell, box)
print name
idshell=geompy.addToStudyInFather(box,shell,name)
edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
edge=edgeList[0];
-name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
+name = geompy.SubShapeName(edge, face)
print name
idedge=geompy.addToStudyInFather(face,edge,name)
/* selection */
- Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { };
+ Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
/* display */
void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
LIB_SRC=\
SALOME_Session_i.cxx \
Session_ServerThread.cxx \
- Session_ServerLauncher.cxx
+ Session_ServerLauncher.cxx \
+ SALOME_Session_SignalsHandler.cxx
# Executables targets
BIN = SALOME_Session_Server
CPPFLAGS+=$(QT_MT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+=$(QT_MT_LIBS) $(HDF5_LIBS) -lSalomeHDFPersist -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace -lSalomeContainer -lRegistry -lSalomeNotification -lSalomeDS -lTOOLSDS -lSalomeGenericObj -lSalomeCatalog -lEvent
+LDFLAGS+=$(QT_MT_LIBS) $(HDF5_LIBS) -lSalomeHDFPersist -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace -lSalomeContainer -lRegistry -lSalomeNotification -lSalomeDS -lTOOLSDS -lSalomeGenericObj -lSalomeCatalog -lEvent -lSalomePrs $(CAS_LDPATH) -lTKBO -lCASCatch
@CONCLUDE@
#include "SALOME_NamingService.hxx"
#include <iostream>
#include <unistd.h>
-using namespace std;
#include <qthread.h>
#include <qapplication.h>
#include "QAD_Config.h"
#include "QAD_Tools.h"
#include "QAD_ResourceMgr.h"
-#include "Utils_CatchSignals.h"
#include "Utils_SALOME_Exception.hxx"
#include "Utils_CorbaException.hxx"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
-
+#include "SALOME_Event.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Session)
#include "Session_ServerLauncher.hxx"
+extern "C" int HandleSignals(QApplication *theQApplication);
+
/*! - read arguments, define list of server to launch with their arguments.
* - wait for naming service
* - create and run a thread for launch of all servers
*
*/
-// ----------------------------------------------------------------------------
-
-
-
-// ----------------------------------------------------------------------------
-
//! CORBA server for SALOME Session
/*!
* SALOME_Session Server launches a SALOME session servant.
* - get session state
*/
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
int main(int argc, char **argv)
{
try
{
+ SALOME_Event::GetSessionThread();
+
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
int orbArgc = 1;
SALOME_NamingService *_NS = new SALOME_NamingService(orb);
- Utils_CatchSignals aCatch;
- aCatch.Activate();
-
// CORBA Servant Launcher
-
QMutex _GUIMutex ;
QWaitCondition _ServerLaunch;
_GUIMutex.lock(); // to block Launch server thread until wait(mutex)
= new Session_ServerLauncher(argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch);
myServerLauncher->start();
- MESSAGE("waiting wakeAll()");
- _ServerLaunch.wait(&_GUIMutex); // to be reseased by Launch server thread when ready:
- // atomic operation lock - unlock on mutex
- // unlock mutex: serverThread runs, calls _ServerLaunch->wakeAll()
- // this thread wakes up, and lock mutex
+ QApplication *_qappl = 0;
+
+ // Allow multiple activation/deactivation of GUI
+ while ( 1 ) {
+ MESSAGE("waiting wakeAll()");
+ _ServerLaunch.wait(&_GUIMutex); // to be reseased by Launch server thread when ready:
+ // atomic operation lock - unlock on mutex
+ // unlock mutex: serverThread runs, calls _ServerLaunch->wakeAll()
+ // this thread wakes up, and lock mutex
+
+ INFOS("Session activated, Launch IAPP...");
- INFOS("Session activated, Launch IAPP...");
+ int qappArgc = 1;
+ if ( !_qappl )
+ _qappl = new QApplication(qappArgc, argv );
- int qappArgc = 1;
- QApplication *_qappl = new QApplication(qappArgc, argv );
- INFOS("creation QApplication");
- _GUIMutex.unlock();
+ INFOS("creation QApplication");
+ _GUIMutex.unlock();
- QAD_ASSERT ( QObject::connect(_qappl, SIGNAL(lastWindowClosed()), _qappl, SLOT(quit()) ) );
- SALOMEGUI_Application* _mw = new SALOMEGUI_Application ( "MDTV-Standard", "HDF", "hdf" );
- INFOS("creation SALOMEGUI_Application");
-
- SCRUTE(_NS);
- if ( !SALOMEGUI_Application::addToDesktop ( _mw, _NS ) )
- {
+ QAD_ASSERT ( QObject::connect(_qappl, SIGNAL(lastWindowClosed()), _qappl, SLOT(quit()) ) );
+ SALOMEGUI_Application* _mw = new SALOMEGUI_Application ( "MDTV-Standard", "HDF", "hdf" );
+ INFOS("creation SALOMEGUI_Application");
+
+ SCRUTE(_NS);
+ if ( !SALOMEGUI_Application::addToDesktop ( _mw, _NS ) ) {
QAD_MessageBox::error1 ( 0,
QObject::tr("ERR_ERROR"),
QObject::tr("ERR_APP_INITFAILED"),
QObject::tr("BUT_OK") );
}
- else
- {
-
+ else {
QFileInfo prgInfo(argv[0]);
QDir prgDir(prgInfo.dirPath(true));
QAD_CONFIG->setPrgDir(prgDir); // CWD is program directory
_qappl->setPalette( QAD_Application::getPalette() );
- //Utils_CatchSignals aCatch;
- //aCatch.Activate();
-
/* Run 'SALOMEGUI' application */
QAD_Application::run();
// T2.12 - catch exceptions thrown on attempts to modified a locked study
- while (1)
- {
- try
- {
- MESSAGE("run(): starting the main event loop");
- int _ret = _qappl->exec();
- break;
- }
- catch (SALOME::SALOME_Exception& e)
- {
- QtCatchCorbaException(e);
- }
- catch(SALOMEDS::StudyBuilder::LockProtection&)
- {
- INFOS("run(): An attempt to modify a locked study has not been handled by QAD_Operation");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- }
- catch (const CORBA::Exception& e)
- {
- CORBA::Any tmp;
- tmp<<= e;
- CORBA::TypeCode_var tc = tmp.type();
- const char *p = tc->name();
- INFOS ("run(): CORBA exception of the kind : "<<p<< " is caught");
+ while (1) {
+ try
+ {
+ MESSAGE("run(): starting the main event loop");
+ int _ret = HandleSignals(_qappl);
+ break;
+ }
+ catch (SALOME::SALOME_Exception& e)
+ {
+ QtCatchCorbaException(e);
+ }
+ catch(SALOMEDS::StudyBuilder::LockProtection&)
+ {
+ INFOS("run(): An attempt to modify a locked study has not been handled by QAD_Operation");
+ QApplication::restoreOverrideCursor();
+ QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ }
+ catch (const CORBA::Exception& e)
+ {
+ CORBA::Any tmp;
+ tmp<<= e;
+ CORBA::TypeCode_var tc = tmp.type();
+ const char *p = tc->name();
+ INFOS ("run(): CORBA exception of the kind : "<<p<< " is caught");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION")
- + QObject::tr(" CORBA exception ") + QObject::tr(p),
- QObject::tr("BUT_OK") );
- }
- catch(std::exception& e)
- {
- INFOS("run(): An exception has been caught");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION")+ " " +QObject::tr(e.what()),
- QObject::tr("BUT_OK") );
- }
- catch(...)
- {
- INFOS("run(): An exception has been caught");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION"),
- QObject::tr("BUT_OK") );
- }
- }
- //aCatch.Deactivate();
+ QApplication::restoreOverrideCursor();
+ QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
+ QObject::tr("ERR_ERROR"),
+ QObject::tr("ERR_APP_EXCEPTION")
+ + QObject::tr(" CORBA exception ") + QObject::tr(p),
+ QObject::tr("BUT_OK") );
+ }
+ catch(std::exception& e)
+ {
+ INFOS("run(): An exception has been caught");
+ QApplication::restoreOverrideCursor();
+ QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
+ QObject::tr("ERR_ERROR"),
+ QObject::tr("ERR_APP_EXCEPTION")+ "\n" +QObject::tr(e.what()),
+ QObject::tr("BUT_OK") );
+ }
+ catch(...)
+ {
+ INFOS("run(): An exception has been caught");
+ QApplication::restoreOverrideCursor();
+ QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
+ QObject::tr("ERR_ERROR"),
+ QObject::tr("ERR_APP_EXCEPTION"),
+ QObject::tr("BUT_OK") );
+ }
+ }
QString confMsg = "Settings create "
+ QAD_CONFIG->getConfigDir().absPath() + "/" + QObject::tr("MEN_APPNAME") + ".conf";
MESSAGE (confMsg);
QAD_CONFIG->createConfigFile(true);
}
+
+ // Prepare _GUIMutex for a new GUI activation
+ _GUIMutex.lock();
+ }
+
//orb->shutdown(0);
myServerLauncher->KillAll();
- aCatch.Deactivate();
}
catch (SALOME_Exception& e)
{
{
INFOS("Caught unknown exception.");
}
- MESSAGE("End of SALOME_Session_Server");
return 0 ;
}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include <stdexcept>
+#include <qapplication.h>
+
+#include "CASCatch_SignalsHandler.h" // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+
+extern "C" int HandleSignals(QApplication *theQApplication)
+{
+ CASCatch_SignalsHandler aSignalsHandler;
+ int aRet = -1;
+ try {
+ aRet = theQApplication->exec();
+ }catch(Standard_Failure){
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ throw std::runtime_error(aFail->GetMessageString());
+ }
+ return aRet;
+}
#include "SALOME_Session_i.hxx"
#include "SALOME_NamingService.hxx"
-#include "SALOME_Session_QThread.hxx"
+#include "SALOME_Event.hxx"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
*/
//=============================================================================
-SALOME_Session_i::SALOME_Session_i(int argc, char ** argv, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, QMutex* GUIMutex)
+SALOME_Session_i::SALOME_Session_i(int argc,
+ char ** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex* GUIMutex,
+ QWaitCondition* GUILauncher)
{
_argc = argc ;
_argv = argv ;
_orb = CORBA::ORB::_duplicate(orb) ;
_poa = PortableServer::POA::_duplicate(poa) ;
_GUIMutex = GUIMutex;
- MESSAGE("constructor end");
+ _GUILauncher = GUILauncher;
+ //MESSAGE("constructor end");
}
//=============================================================================
Engines::Component_ptr SALOME_Session_i::GetVisuComponent()
{
- MESSAGE("SALOME_Session_i::GetVisuGen");
+ //MESSAGE("SALOME_Session_i::GetVisuGen");
typedef Engines::Component_ptr TGetImpl(CORBA::ORB_ptr,
PortableServer::POA_ptr,
SALOME_NamingService*,QMutex*);
SALOME_Session_i::~SALOME_Session_i()
{
- MESSAGE("destructor end");
+ //MESSAGE("destructor end");
}
//=============================================================================
{
INFOS("Caught unknown exception from Naming Service");
}
- MESSAGE("Session registered in Naming Service");
+ //MESSAGE("Session registered in Naming Service");
}
//=============================================================================
void SALOME_Session_i::GetInterface()
{
- _GUIMutex->lock() ; // get access to boolean _isGUI
- //_isGUI = _IAPPThread->running();
- if(!_isGUI)
- {
- _isGUI = TRUE ;
- //_IAPPThread->start() ;
- }
- _GUIMutex->unlock() ; // release access to boolean _isGUI
+ if( !QAD_Application::getDesktop() ) {
+ _GUILauncher->wakeAll();
+ MESSAGE("SALOME_Session_i::GetInterface() called, starting GUI...")
+ }
}
//=============================================================================
* Kills the session if there are no active studies nore GUI
*/
//=============================================================================
+class CloseEvent : public SALOME_Event
+{
+public:
+ virtual void Execute() {
+ if ( QAD_Application::getDesktop() )
+ QAD_Application::getDesktop()->closeDesktop( true );
+ }
+};
void SALOME_Session_i::StopSession()
{
- qApp->lock();
- QAD_Application::getDesktop()->closeDesktop( true );
- qApp->unlock();
+ ProcessVoidEvent( new CloseEvent() );
}
//=============================================================================
*/
//=============================================================================
+class QtLock
+{
+public:
+ QtLock() { if ( qApp ) qApp->lock(); }
+ ~QtLock() { if ( qApp ) qApp->unlock(); }
+};
+
+
SALOME::StatSession SALOME_Session_i::GetStatSession()
{
// update Session state
- //qApp->lock(); // rollback bug
_GUIMutex->lock();
- //_isGUI = _IAPPThread->running();
- _isGUI = 1;
+
_runningStudies = 0;
- if (_isGUI)
- {
- qApp->lock();
- if ( QAD_Application::getDesktop() && QAD_Application::getDesktop()->getActiveApp() )
- _runningStudies = QAD_Application::getDesktop()->getActiveApp()->getStudies().count();
- qApp->unlock();
- }
+ {
+ QtLock lock;
+ _isGUI = QAD_Application::getDesktop();
+ if ( _isGUI && QAD_Application::getDesktop()->getActiveApp() )
+ _runningStudies = QAD_Application::getDesktop()->getActiveApp()->getStudies().count();
+ }
+
_GUIMutex->unlock();
- //qApp->unlock();
+
// getting stat info
SALOME::StatSession_var myStats = new SALOME::StatSession ;
if (_runningStudies)
return myStats._retn() ;
}
+CORBA::Long SALOME_Session_i::GetActiveStudyId()
+{
+ long aStudyId=-1;
+ if( QAD_Application::getDesktop() && QAD_Application::getDesktop()->getActiveStudy()) {
+ aStudyId = QAD_Application::getDesktop()->getActiveStudy()->getStudyId();
+ }
+ return aStudyId;
+}
public virtual PortableServer::RefCountServantBase
{
public:
- SALOME_Session_i(int argc, char ** argv, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, QMutex* GUIMutex);
+ SALOME_Session_i(int argc,
+ char ** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex* GUIMutex,
+ QWaitCondition* GUILauncher);
~SALOME_Session_i();
//! Launch Graphical User Interface
//! Register the servant to Naming Service
void NSregister();
+
+ CORBA::Long GetActiveStudyId();
void ping(){};
char **_argv;
CORBA::Boolean _isGUI ;
QMutex* _GUIMutex ;
+ QWaitCondition* _GUILauncher;
int _runningStudies ;
CORBA::ORB_var _orb;
PortableServer::POA_var _poa;
void Session_ServerLauncher::run()
{
- MESSAGE("Session_ServerLauncher::run");
+ //MESSAGE("Session_ServerLauncher::run");
_GUIMutex->lock(); // lock released by calling thread when ready: wait(mutex)
- MESSAGE("Server Launcher thread free to go...");
+ //MESSAGE("Server Launcher thread free to go...");
_GUIMutex->unlock();
CheckArgs();
ActivateAll();
- _ServerLaunch->wakeAll();
_orb->run(); // this thread wait, during omniORB process events
}
int argc=1;
char** argv = new char*[argc];
argv[0] = "Session";
- Session_ServerThread* aServerThread
- = new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
+ Session_SessionThread* aServerThread
+ = new Session_SessionThread(argc, argv, _orb,_root_poa,_GUIMutex,_ServerLaunch);
_serverThreads.push_front(aServerThread);
aServerThread->Init();
PortableServer::POA_ptr poa,
QMutex *GUIMutex)
{
- MESSAGE("Session_ServerThread Constructor " << argv[0]);
+ //MESSAGE("Session_ServerThread Constructor " << argv[0]);
_argc = argc;
_argv = argv;
_orb = CORBA::ORB::_duplicate(orb);
Session_ServerThread::~Session_ServerThread()
{
- MESSAGE("~Session_ServerThread "<< _argv[0]);
+ //MESSAGE("~Session_ServerThread "<< _argv[0]);
}
//=============================================================================
void Session_ServerThread::ActivateSession(int argc,
char ** argv)
+{
+ MESSAGE("Session_ServerThread::ActivateSession() not implemented!");
+}
+
+Session_SessionThread::Session_SessionThread(int argc,
+ char** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex* GUIMutex,
+ QWaitCondition* GUILauncher)
+: Session_ServerThread(argc, argv, orb, poa, GUIMutex),
+ _GUILauncher( GUILauncher )
+{
+}
+
+Session_SessionThread::~Session_SessionThread()
+{
+}
+
+void Session_SessionThread::ActivateSession(int argc,
+ char ** argv)
{
try
{
INFOS("Session thread started");
SALOME_Session_i * mySALOME_Session
- = new SALOME_Session_i(argc, argv, _orb, _root_poa, _GUIMutex) ;
+ = new SALOME_Session_i(argc, argv, _orb, _root_poa, _GUIMutex, _GUILauncher) ;
PortableServer::ObjectId_var mySALOME_Sessionid
= _root_poa->activate_object(mySALOME_Session);
INFOS("poa->activate_object(mySALOME_Session)");
char ** argv);
void ActivateContainer(int argc,
char ** argv);
- void ActivateSession(int argc,
+ virtual void ActivateSession(int argc,
char ** argv);
-private:
+protected:
int _argc;
char ** _argv;
int _servType;
SALOME_NamingService *_NS;
};
+class Session_SessionThread : public Session_ServerThread
+{
+public:
+ Session_SessionThread() {}
+ Session_SessionThread(int argc,
+ char** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex* GUIMutex,
+ QWaitCondition* GUILauncher);
+ virtual ~Session_SessionThread();
+
+protected:
+ virtual void ActivateSession(int argc,
+ char ** argv);
+private:
+ QWaitCondition* _GUILauncher;
+};
+
#endif
// function : GetTempDir
// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
//============================================================================
-char* SALOMEDS_Tool::GetTmpDir()
+std::string SALOMEDS_Tool::GetTmpDir()
{
//Find a temporary directory to store a file
OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
aDir.Build(aProtection);
- return CORBA::string_dup(aTmpDir.ToCString());
+ return aTmpDir.ToCString();
}
//============================================================================
OSD_File anOSDFile(anOSDPath);
if(!anOSDFile.Exists()) continue;
+ OSD_Protection aProtection = anOSDFile.Protection();
+ aProtection.SetUser(OSD_RW);
+ anOSDFile.SetProtection(aProtection);
+
anOSDFile.Remove();
}
const int theNamesOnly)
{
int i, aLength = theFiles.length();
- if(aLength == 0) return NULL;
+ if(aLength == 0)
+// return NULL;
+ return (new SALOMEDS::TMPFile);
TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory)); //Get a temporary directory for saved a file
//Check if the file exists
if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
- TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);
+ TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);
OSD_Path anOSDPath(aFullPath);
OSD_File anOSDFile(anOSDPath);
if(!anOSDFile.Exists()) continue;
aBufferSize += 4; //4 bytes for a number of the files that will be written to the stream;
unsigned char* aBuffer = new unsigned char[aBufferSize];
- if(aBuffer == NULL) return NULL;
+ if(aBuffer == NULL)
+// return NULL;
+ return (new SALOMEDS::TMPFile);
//Initialize 4 bytes of the buffer by 0
memset(aBuffer, 0, 4);
for(i=0; i<aLength; i++) {
ifstream *aFile;
if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
- TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);
+ TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);
OSD_Path anOSDPath(aFullPath);
OSD_File anOSDFile(anOSDPath);
if(!anOSDFile.Exists()) continue;
// function : PutStreamToFile
// purpose : converts the stream "theStream" to the files
//============================================================================
-SALOMEDS::ListOfFileNames*
+SALOMEDS::ListOfFileNames_var
SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
const char* theToDirectory,
const int theNamesOnly)
delete[] aFileName;
}
- return aFiles._retn();
+ return aFiles;
}
//============================================================================
// function : GetNameFromPath
// purpose : Returns the name by the path
//============================================================================
-char* SALOMEDS_Tool::GetNameFromPath(const char* thePath) {
- if (thePath == NULL) return strdup("");
- OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
+std::string SALOMEDS_Tool::GetNameFromPath(const char* thePath) {
+ if (thePath == NULL) return string("");
+ OSD_Path aPath = OSD_Path(TCollection_AsciiString((char*)thePath));
TCollection_AsciiString aNameString(aPath.Name());
- return CORBA::string_dup(aNameString.ToCString());
+ return aNameString.ToCString();
}
//============================================================================
// function : GetDirFromPath
// purpose : Returns the dir by the path
//============================================================================
-char* SALOMEDS_Tool::GetDirFromPath(const char* thePath) {
- if (thePath == NULL) return strdup("");
- OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
+std::string SALOMEDS_Tool::GetDirFromPath(const char* thePath) {
+ if (thePath == NULL) return string("");
+ OSD_Path aPath = OSD_Path(TCollection_AsciiString((char*)thePath));
TCollection_AsciiString aDirString(aPath.Trek());
aDirString.ChangeAll('|','/');
- return CORBA::string_dup(aDirString.ToCString());
+ return aDirString.ToCString();
}
#ifndef __SALOMEDS_Tool_H__
#define __SALOMEDS_Tool_H__
-
+#include <string>
// IDL headers
-#include <SALOMEDS.hh>
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
class SALOMEDS_Tool
{
+
public:
// Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
// otherwise return /tmp/something/ for Unix or c:\something\ for WNT
- static char* GetTmpDir();
+ static std::string GetTmpDir();
// Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
const int theNamesOnly = 0);
// Converts a byte sequence <theStream> to files and places them in <theToDirectory>
- static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
+ static SALOMEDS::ListOfFileNames_var PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
const char* theToDirectory,
const int theNamesOnly = 0);
// Returns the name by the path
// for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
- static char* GetNameFromPath(const char* thePath);
+ static std::string GetNameFromPath(const char* thePath);
// Returns the directory by the path
// for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
- static char* GetDirFromPath(const char* thePath);
+ static std::string GetDirFromPath(const char* thePath);
};
#endif
// Module : SALOME
// $Header$
-using namespace std;
#include "ToolsGUI_CatalogGeneratorDlg.h"
#include "QAD_Application.h"
#include <TCollection_AsciiString.hxx>
#include <Standard_CString.hxx>
+#include "utilities.h"
+
+using namespace std;
+
#define SPACING_SIZE 6
#define MARGIN_SIZE 11
#define MIN_EDIT_SIZE 250
QString IDLpath = "";
for (unsigned int ind = 0; ind < list_composants->length();ind++) {
- QString modulename = strdup(list_composants[ind].modulename) ;
+ QString modulename = CORBA::string_dup(list_composants[ind].modulename) ;
QCString dir;
if (dir = getenv( modulename + "_ROOT_DIR")) {
#include "Utils_CommException.hxx"
using namespace std;
+static ostream& operator<<(ostream& os, const CORBA::Exception& e)
+{
+ CORBA::Any tmp;
+ tmp<<= e;
+ CORBA::TypeCode_var tc = tmp.type();
+ const char *p = tc->name();
+ os<<"Test blocking exception was catch of the kind : ";
+ if ( *p != '\0' ) {
+ os<<p;
+ }
+ else {
+ os << tc->id();
+ }
+
+ return os;
+}
+
+
int main (int argc, char * argv[])
{
catch(CORBA::COMM_FAILURE& ex) {
INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.")
}
- catch(CORBA::SystemException&) {
- INFOS("Caught a CORBA::SystemException.")
+ catch(CORBA::SystemException& e) {
+ INFOS("Caught a CORBA::SystemException."<<e)
}
- catch(CORBA::Exception&) {
- INFOS("Caught CORBA::Exception.")
+ catch(CORBA::Exception& e) {
+ INFOS("Caught CORBA::Exception."<<e)
}
catch(...) {
INFOS("Caught unknown exception.")
Utils_SINGLETON.hxx \
Utils_DESTRUCTEUR_GENERIQUE.hxx \
Utils_ExceptHandlers.hxx \
- Utils_CatchSignals.h
+ Utils_SignalsHandler.h
EXPORT_PYSCRIPTS = Utils_Identity.py SALOME_utilities.py
# Libraries targets
Utils_Identity.cxx Utils_ORB_INIT.cxx \
Utils_DESTRUCTEUR_GENERIQUE.cxx \
Utils_ExceptHandlers.cxx \
- Utils_CatchSignals.cxx
+ Utils_SignalsHandler.cxx
LIB_SERVER_IDL = SALOME_Exception.idl
// Module : SALOME
// $Header$
-using namespace std;
-void Nettoyage( void ) ;
# include <iostream>
-# include "utilities.h"
-# include "Utils_DESTRUCTEUR_GENERIQUE.hxx"
# include <list>
extern "C"
{
# include <stdlib.h>
}
-static list<DESTRUCTEUR_GENERIQUE_*> *Destructeurs=0 ;
+# include "Utils_DESTRUCTEUR_GENERIQUE.hxx"
+# include "utilities.h"
+void Nettoyage();
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+using namespace std;
+static list<DESTRUCTEUR_GENERIQUE_*> *Destructeurs=0 ;
/*! \class ATEXIT_
*
ATEXIT_( void )
{
ASSERT (Destructeurs==0);
- MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561)
+ if(MYDEBUG) MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561)
Destructeurs = new list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeurs alloué dynamiquement (cf. ci-dessous) ,
// il est utilisé puis détruit par la fonction Nettoyage
int cr = atexit( Nettoyage ); // exécute Nettoyage lors de exit, après la destruction des données statiques !
~ATEXIT_( )
{
- MESSAGE("Destruction ATEXIT") ;
+ if(MYDEBUG) MESSAGE("Destruction ATEXIT") ;
}
};
void Nettoyage( void )
{
- BEGIN_OF("Nettoyage( void )") ;
+ if(MYDEBUG) BEGIN_OF("Nettoyage( void )") ;
ASSERT(Destructeurs) ;
- SCRUTE( Destructeurs->size() ) ;
+ if(MYDEBUG) SCRUTE( Destructeurs->size() ) ;
if( Destructeurs->size() )
{
list<DESTRUCTEUR_GENERIQUE_*>::iterator it = Destructeurs->end() ;
do
{
- MESSAGE( "DESTRUCTION d'un SINGLETON") ;
+ if(MYDEBUG) MESSAGE( "DESTRUCTION d'un SINGLETON");
it-- ;
DESTRUCTEUR_GENERIQUE_* ptr = *it ;
//Destructeurs->remove( *it ) ;
}while( it!= Destructeurs->begin() ) ;
Destructeurs->clear() ;
- SCRUTE( Destructeurs->size() ) ;
+ if(MYDEBUG) SCRUTE( Destructeurs->size() ) ;
ASSERT( Destructeurs->size()==0 ) ;
ASSERT( Destructeurs->empty() ) ;
}
delete Destructeurs;
Destructeurs=0;
- END_OF("Nettoyage( void )") ;
+ if(MYDEBUG) END_OF("Nettoyage( void )") ;
return ;
}
// <ota@localhost.localdomain>
-#include <Utils_ExceptHandlers.hxx>
+#include "Utils_ExceptHandlers.hxx"
#include "Utils_CorbaException.hxx"
#include "Utils_SALOME_Exception.hxx"
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
#define Utils_ExceptHandlers_HeaderFile
#include <stdexcept>
-#include <utilities.h>
typedef void (*PVF)();
PVF old;
public :
Unexpect( PVF f )
- { old = set_unexpected(f); }
- ~Unexpect() { set_unexpected(old); }
+ { old = std::set_unexpected(f); }
+ ~Unexpect() { std::set_unexpected(old); }
};
class Terminate {//save / retrieve terminate function
PVF old;
public :
Terminate( PVF f )
- { old = set_terminate(f); }
- ~Terminate() { set_terminate(old); }
+ { old = std::set_terminate(f); }
+ ~Terminate() { std::set_terminate(old); }
};
#define UNEXPECT_CATCH(FuncName, ExceptionConstructor) \
-void FuncName () {\
+inline void FuncName () {\
throw ExceptionConstructor (); \
}
//Example of the usage
//Definitions :
extern void SalomeException();
extern void SALOME_SalomeException();
+
#endif
delete [] (char*)_name ;
(char*&)_name = NULL ;
- delete [] (char*)_dir ;
- (char*&)_dir = NULL ;
-
+ //delete [] (char*)_dir ;
+ //(char*&)_dir = NULL ;
+ free((char*)_dir);
+
delete [] (char*)_adip ;
(char*&)_adip = NULL ;
}
# include <exception>
# include <iostream>
-using namespace std;
-
# define LOCALIZED(message) #message , __FILE__ , __LINE__
-class SALOME_Exception : public exception
+
+class SALOME_Exception : public std::exception
{
private :
SALOME_Exception( const char *text, const char *fileName=0, const unsigned int lineNumber=0 );
SALOME_Exception( const SALOME_Exception &ex );
~SALOME_Exception() throw ();
- friend ostream & operator<<( ostream &os , const SALOME_Exception &ex );
+ friend std::ostream & operator<<( std::ostream &os , const SALOME_Exception &ex );
virtual const char *what( void ) const throw () ;
} ;
MESSAGE("Destruction du SINGLETON_") ;
- list<DESTRUCTEUR_GENERIQUE_ *>::iterator k ;
+ std::list<DESTRUCTEUR_GENERIQUE_ *>::iterator k ;
for( k=DESTRUCTEUR_GENERIQUE_::Destructeurs.begin() ; k!=DESTRUCTEUR_GENERIQUE_::Destructeurs.end();k++)
{
if ( *k == PtrSingleton->_Instance )
--- /dev/null
+// KERNEL Utils : common utils for KERNEL
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+
+
+#include <stdexcept>
+#include <stdio.h>
+#include <signal.h>
+
+#include "Utils_SignalsHandler.h"
+
+
+//============================================================================
+//function : Handler
+//purpose : univisal handler for signals
+//============================================================================
+static void Handler(int theSigId)
+{
+ char aMessage[256] = "";
+ sprintf(aMessage,"Signal with ID = %d was cautch!",theSigId);
+ throw std::runtime_error(aMessage);
+}
+
+
+//=======================================================================
+//function : SetSigHandler
+//purpose : Redefine signal handlers. If the handler of the signal is
+// set as SIG_IGN. That's why the shells often ignore some
+// signal when starting child processes. We keep it.
+//=======================================================================
+static void SetSignalHandler(Utils_SignalsHandler::TSigHandlerCont& theSigHandlerCont,
+ int theSigId)
+{
+ TSigHandler anOldHandler = signal(theSigId,&Handler);
+ if(anOldHandler == SIG_IGN)
+ signal(theSigId,SIG_IGN);
+ theSigHandlerCont[theSigId] = anOldHandler;
+}
+
+static TSigHandler StoreSignalHandler(Utils_SignalsHandler::TSigHandlerCont& theSigHandlerCont,
+ int theSigId)
+{
+ TSigHandler anOldHandler = signal(theSigId,&Handler);
+ signal(theSigId,anOldHandler);
+ if(anOldHandler == SIG_IGN)
+ signal(theSigId,SIG_IGN);
+ theSigHandlerCont[theSigId] = anOldHandler;
+ return anOldHandler;
+}
+
+static void RestoreSigHandler(TSigHandler theSigHandler,
+ int theSigId)
+{
+ signal(theSigId,theSigHandler);
+}
+
+
+//=======================================================================
+//function : Utils_SignalsHandler
+//purpose : Constructor
+//=======================================================================
+Utils_SignalsHandler::Utils_SignalsHandler()
+{
+ StoreSignalHandler(mySigHandlerCont,SIGHUP); // floating point exception
+ StoreSignalHandler(mySigHandlerCont,SIGFPE); // floating point exception
+
+ StoreSignalHandler(mySigHandlerCont,SIGINT); // interrupt
+ StoreSignalHandler(mySigHandlerCont,SIGQUIT); // quit
+ StoreSignalHandler(mySigHandlerCont,SIGBUS); // bus error
+ StoreSignalHandler(mySigHandlerCont,SIGILL); // illegal instruction
+ StoreSignalHandler(mySigHandlerCont,SIGTERM); // termination
+ StoreSignalHandler(mySigHandlerCont,SIGSEGV); // segmentation
+ //StoreSignalHandler(mySigHandlerCont,SIGABRT); // abort (ANSI).
+ StoreSignalHandler(mySigHandlerCont,SIGSTKFLT); // stack fault.
+}
+
+
+//=======================================================================
+//function : Utils_SignalsHandler
+//purpose : destructor
+//=======================================================================
+Utils_SignalsHandler::~Utils_SignalsHandler()
+{
+ TSigHandlerCont::iterator anIter = mySigHandlerCont.begin();
+ TSigHandlerCont::iterator anIterEnd = mySigHandlerCont.end();
+ for(; anIter != anIterEnd; anIter++)
+ RestoreSigHandler(anIter->second,anIter->first);
+}
+
+
+//=======================================================================
+//function : SetSigHandler
+//purpose : sets new handler for pointed signal
+//=======================================================================
+TSigHandler Utils_SignalsHandler::SetSigHandler(int theSigId,
+ TSigHandler theSigHandler)
+{
+ TSigHandler anOldHandler = signal(theSigId,theSigHandler);
+ if(anOldHandler == SIG_IGN)
+ signal(theSigId,SIG_IGN);
+ mySigHandlerCont[theSigId] = anOldHandler;
+ return anOldHandler;
+}
--- /dev/null
+// KERNEL Utils : common utils for KERNEL
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+
+#ifndef _UTILS_SIGNALSHANDLER_H_
+#define _UTILS_SIGNALSHANDLER_H_
+
+
+#include <map>
+typedef void (*TSigHandler)(int);
+
+
+class Utils_SignalsHandler{
+ public:
+ Utils_SignalsHandler();
+ ~Utils_SignalsHandler();
+
+ TSigHandler GetSigHandler(int theSigId);
+ TSigHandler SetSigHandler(int theSigId, TSigHandler theSigHandler);
+ typedef std::map<int,TSigHandler> TSigHandlerCont;
+
+ private:
+ TSigHandlerCont mySigHandlerCont;
+};
+
+
+class Utils_CASSignalsHandler: private Utils_SignalsHandler{
+ public:
+ Utils_CASSignalsHandler();
+};
+
+
+#endif
# include <stream.h>
using namespace std;
+#include "utilities.h"
+
static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
#ifndef CLK_TCK
void Utils_Timer::Show() {
bool StopSav = Stopped;
if (!StopSav) Stop();
- cout << "CPU user time: " << Cumul_user << " seconds " << endl;
- cout << "CPU system time: " << Cumul_sys << " seconds " << endl;
+ MESSAGE("CPU user time: " << Cumul_user << " seconds ");
+ MESSAGE("CPU system time: " << Cumul_sys << " seconds ");
if (!StopSav) Start();
}
void Utils_Timer::ShowAbsolute(){
unsigned long Absolute_user = (unsigned long) ((timeval*)RefToCurrentTimeB)->tv_sec ;
- cout << "Absolute time: " << Absolute_user << " seconds " << endl;
+ MESSAGE("Absolute time: " << Absolute_user << " seconds ");
}
}
#include "utilities.h"
+using namespace std;
+
const char* duplicate( const char *const str )
{
ASSERT(str!=NULL) ;
#include <string>
#include <iostream>
-#include <cstdlib>
#include "SALOME_Log.hxx"
/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
-#define INFOS(msg) {SLog->putMessage(*SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
-#define PYSCRIPT(msg) {SLog->putMessage(*SLog<<"---PYSCRIPT--- "<<msg<<endl);}
+#define INFOS(msg) {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::ends);}
+#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<std::endl<<std::ends);}
/* --- To print date and time of compilation of current source --- */
#define COMPILER "KCC"
#elif defined ( __PGI )
#define COMPILER "pgCC"
-#elif defined ( __alpha )
-#define COMPILER "cxx"
#else
#define COMPILER "undefined"
#endif
#endif
#define INFOS_COMPILATION { \
- SLog->putMessage(\
- *SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
+ SLog.putMessage(\
+ SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
<< "COMPILED with " << COMPILER \
<< ", " << __DATE__ \
- << " at " << __TIME__ <<endl); }
+ << " at " << __TIME__ <<std::endl<<std::ends); }
#ifdef _DEBUG_
/* --- the following MACROS are useful at debug time --- */
-#define MYTRACE *SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : "
+#define MYTRACE SLog<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "
-#define MESSAGE(msg) {SLog->putMessage( MYTRACE <<msg<<endl<<ends); }
-#define SCRUTE(var) {SLog->putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
+#define MESSAGE(msg) {SLog.putMessage(MYTRACE<<msg<<std::endl<<std::ends);}
+#define SCRUTE(var) {SLog.putMessage(MYTRACE<<#var<<"="<<var<<std::endl<<std::ends);}
-#define REPERE *SLog << " --------------" << endl
-#define BEGIN_OF(msg) {REPERE;MYTRACE<<"Begin of: " <<msg<<endl;REPERE;}
-#define END_OF(msg) {REPERE;MYTRACE<<"Normal end of: "<<msg<<endl;REPERE;}
+#define BEGIN_OF(msg) {SLog.putMessage(MYTRACE<<"Begin of: "<<msg<<"\n\n"<<std::ends);}
+#define END_OF(msg) {SLog.putMessage(SLog<<"\n"<<std::ends); \
+ SLog.putMessage(MYTRACE<<"Normal end of: "<<msg<<"\n"<<std::ends);}
-#define HERE {cout<<flush ;cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<flush ;}
+#define HERE {std::cout<<std::flush ;std::cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<std::flush;}
-#define INTERRUPTION(code) {HERE;cerr<<"INTERRUPTION return code= "<<code<< endl;std::exit(code);}
+#define INTERRUPTION(code) {HERE; \
+ cerr<<"INTERRUPTION return code= "<<code<<std::endl; \
+ std::exit(code);}
#ifndef ASSERT
#define ASSERT(condition) \
- if (!(condition)){HERE;cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<endl;INTERRUPTION(1);}
+ if(!(condition)){ \
+ HERE; \
+ std::cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<std::endl; \
+ INTERRUPTION(1); \
+ }
+
#endif /* ASSERT */
#define HERE
#define SCRUTE(var) {}
#define MESSAGE(msg) {}
-#define REPERE
#define BEGIN_OF(msg) {}
#define END_OF(msg) {}
EXPORT_HEADERS = SALOME_Transform.h \
SALOME_TransformFilter.h \
SALOME_PassThroughFilter.h \
+ SALOME_ShrinkFilter.h \
SALOME_GeometryFilter.h \
SALOME_ExtractUnstructuredGrid.h
LIB_SRC = SALOME_Transform.cxx \
SALOME_TransformFilter.cxx \
SALOME_PassThroughFilter.cxx \
+ SALOME_ShrinkFilter.cxx \
SALOME_GeometryFilter.cxx \
SALOME_ExtractUnstructuredGrid.cxx
using namespace std;
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
#endif
this->Modified();
}
-vtkIdType SALOME_ExtractUnstructuredGrid::GetOutId(int theOutId) const{
+vtkIdType SALOME_ExtractUnstructuredGrid::GetInputId(int theOutId) const{
if(myCellIds.empty() && myCellTypes.empty()) return theOutId;
if(myOut2InId.empty() || theOutId > myOut2InId.size()) return -1;
#if defined __GNUC_2__
#endif
}
-vtkIdType SALOME_ExtractUnstructuredGrid::GetInId(int theInId) const{
+vtkIdType SALOME_ExtractUnstructuredGrid::GetOutputId(int theInId) const{
if(myCellIds.empty() && myCellTypes.empty()) return theInId;
TMapId::const_iterator anIter = myIn2OutId.find(theInId);
if(anIter == myIn2OutId.end()) return -1;
}
}
}
- if(aNbElems = aConnectivity->GetNumberOfCells()){
+ if((aNbElems = aConnectivity->GetNumberOfCells())){
vtkIntArray* aCellLocationsArray = vtkIntArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(aNbElems);
}
}
}
- if(aNbElems = aConnectivity->GetNumberOfCells()){
+ if((aNbElems = aConnectivity->GetNumberOfCells())){
vtkIntArray* aCellLocationsArray = vtkIntArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(aNbElems);
// Remove the cell from the output
void RegisterCell(vtkIdType theCellId);
int IsCellsRegistered() { return !myCellIds.empty();}
- int ClearRegisteredCells() {
+ void ClearRegisteredCells() {
myCellIds.clear();
Modified();
}
// Remove every cells with the type from the output
void RegisterCellsWithType(vtkIdType theCellType);
int IsCellsWithTypeRegistered() { return !myCellTypes.empty();}
- int ClearRegisteredCellsWithType() {
+ void ClearRegisteredCellsWithType() {
myCellTypes.clear();
Modified();
}
void SetStoreMapping(int theStoreMapping);
int GetStoreMapping(){ return myStoreMapping;}
- vtkIdType GetOutId(int theOutId) const;
- vtkIdType GetInId(int theInId) const;
+ vtkIdType GetInputId(int theOutId) const;
+ vtkIdType GetOutputId(int theInId) const;
typedef std::vector<vtkIdType> TVectorId;
typedef std::map<vtkIdType,vtkIdType> TMapId;
}
-vtkIdType SALOME_GeometryFilter::GetObjId(int theVtkID){
+vtkIdType SALOME_GeometryFilter::GetElemObjId(int theVtkID){
if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
#if defined __GNUC_2__
return myVTK2ObjIds[theVtkID];
}
-SALOME_GeometryFilter::TVectorId SALOME_GeometryFilter::GetVtkId(int theObjID){
- TVectorId aVect;
- if(myObj2VTKIds.empty() || theObjID > myObj2VTKIds.size()) return aVect;
-#if defined __GNUC_2__
- return myObj2VTKIds[theObjID];
-#else
- return myObj2VTKIds.at(theObjID);
-#endif
-}
-
-
void SALOME_GeometryFilter::UnstructuredGridExecute()
{
vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)this->GetInput();
// (Have to compute visibility first for 3D cell boundarys)
int progressInterval = numCells/20 + 1;
if(myStoreMapping){
- myVTK2ObjIds.clear(); myObj2VTKIds.clear(); //apo
+ myVTK2ObjIds.clear();
myVTK2ObjIds.reserve(numCells);
- myObj2VTKIds.resize(numCells);
}
for (cellId=0, Connectivity->InitTraversal();
Connectivity->GetNextCell(npts,pts);
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
break;
newCellId = output->InsertNextCell(VTK_LINE,npts,pts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
break;
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
break;
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
break;
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
break;
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
}
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
}
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
}
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
}
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping){
myVTK2ObjIds.push_back(cellId); //apo
- myObj2VTKIds[cellId].push_back(newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
}
cout<<myVTK2ObjIds[i]<<", ";
}
cout<<"\n";
- for(int i = 0, iEnd = myObj2VTKIds.size(); i < iEnd; i++){
- TVectorId& aVectorId = myObj2VTKIds[i];
- cout<<aVectorId.size()<<": ";
- for(int j = 0, jEnd = aVectorId.size(); j < jEnd; j++){
- cout<<aVectorId[j]<<", ";
- }
- cout<<"\n";
- }
- cout<<"\n";
}
// Update ourselves and release memory
void SetStoreMapping(int theStoreMapping);
int GetStoreMapping(){ return myStoreMapping;}
- typedef std::vector<vtkIdType> TVectorId;
- virtual vtkIdType GetObjId(int theVtkID);
- virtual TVectorId GetVtkId(int theObjID);
+ virtual vtkIdType GetNodeObjId(int theVtkID) { return theVtkID;}
+ virtual vtkIdType GetElemObjId(int theVtkID);
protected:
SALOME_GeometryFilter();
int myShowInside;
int myStoreMapping;
+ typedef std::vector<vtkIdType> TVectorId;
TVectorId myVTK2ObjIds;
- typedef std::vector<TVectorId> TVecVectorId;
- TVecVectorId myObj2VTKIds;
};
#endif
--- /dev/null
+// SALOME OBJECT : kernel of SALOME 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 : SALOME_GeometryFilter.cxx
+// Author : Michael ZORIN
+// Module : SALOME
+// $Header$
+
+#include "SALOME_ShrinkFilter.h"
+
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#include <vtkIdList.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkUnstructuredGrid.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
+vtkCxxRevisionMacro(SALOME_ShrinkFilter, "$Revision$");
+vtkStandardNewMacro(SALOME_ShrinkFilter);
+
+
+SALOME_ShrinkFilter::SALOME_ShrinkFilter():
+ myStoreMapping(0)
+{}
+
+
+SALOME_ShrinkFilter::~SALOME_ShrinkFilter()
+{}
+
+
+void SALOME_ShrinkFilter::Execute()
+{
+ vtkPoints *newPts;
+ int i, j, numIds, abort=0;
+ vtkIdType cellId, numCells, numPts;
+ vtkIdType oldId, newId;
+ float center[3], *p, pt[3];
+ vtkPointData *pd, *outPD;;
+ vtkIdList *ptIds, *newPtIds;
+ vtkDataSet *input= this->GetInput();
+ vtkUnstructuredGrid *output = this->GetOutput();
+ vtkIdType tenth;
+ float decimal;
+
+ vtkDebugMacro(<<"Shrinking cells");
+
+ numCells=input->GetNumberOfCells();
+ numPts = input->GetNumberOfPoints();
+ if (numCells < 1 || numPts < 1)
+ {
+ vtkErrorMacro(<<"No data to shrink!");
+ return;
+ }
+
+ ptIds = vtkIdList::New();
+ ptIds->Allocate(VTK_CELL_SIZE);
+ newPtIds = vtkIdList::New();
+ newPtIds->Allocate(VTK_CELL_SIZE);
+
+ output->Allocate(numCells);
+ newPts = vtkPoints::New();
+ newPts->Allocate(numPts*8,numPts);
+ pd = input->GetPointData();
+ outPD = output->GetPointData();
+ outPD->CopyAllocate(pd,numPts*8,numPts);
+
+ // Traverse all cells, obtaining node coordinates. Compute "center" of cell,
+ // then create new vertices shrunk towards center.
+ //
+ tenth = numCells/10 + 1;
+ decimal = 0.0;
+ if(myStoreMapping){
+ myVTK2ObjIds.clear();
+ myVTK2ObjIds.reserve(numCells);
+ }
+
+ for (cellId=0; cellId < numCells && !abort; cellId++)
+ {
+ input->GetCellPoints(cellId, ptIds);
+ numIds = ptIds->GetNumberOfIds();
+
+ //abort/progress methods
+ if (cellId % tenth == 0)
+ {
+ decimal += 0.1;
+ this->UpdateProgress (decimal);
+ abort = this->GetAbortExecute();
+ }
+
+ // get the center of the cell
+ center[0] = center[1] = center[2] = 0.0;
+ for (i=0; i < numIds; i++)
+ {
+ p = input->GetPoint(ptIds->GetId(i));
+ for (j=0; j < 3; j++)
+ {
+ center[j] += p[j];
+ }
+ }
+ for (j=0; j<3; j++)
+ {
+ center[j] /= numIds;
+ }
+
+ // Create new points and cells
+ newPtIds->Reset();
+ for (i=0; i < numIds; i++)
+ {
+ p = input->GetPoint(ptIds->GetId(i));
+ for (j=0; j < 3; j++)
+ {
+ pt[j] = center[j] + this->ShrinkFactor*(p[j] - center[j]);
+ }
+
+ oldId = ptIds->GetId(i);
+ newId = newPts->InsertNextPoint(pt);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(oldId);
+ newPtIds->InsertId(i,newId);
+
+ outPD->CopyData(pd, oldId, newId);
+ }
+ output->InsertNextCell(input->GetCellType(cellId), newPtIds);
+ }//for all cells
+
+ // Update ourselves and release memory
+ //
+ output->GetCellData()->PassData(input->GetCellData());
+
+ output->SetPoints(newPts);
+ output->Squeeze();
+
+ ptIds->Delete();
+ newPtIds->Delete();
+ newPts->Delete();
+}
+
+
+void SALOME_ShrinkFilter::SetStoreMapping(int theStoreMapping){
+ myStoreMapping = theStoreMapping;
+ this->Modified();
+}
+
+
+vtkIdType SALOME_ShrinkFilter::GetNodeObjId(int theVtkID){
+ if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
+ return myVTK2ObjIds[theVtkID];
+}
--- /dev/null
+// SALOME OBJECT : kernel of SALOME 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 : SALOME_GeometryFilter.h
+// Author : Michael ZORIN
+// Module : SALOME
+// $Header$
+
+
+#ifndef __SALOME_ShrinkFilter_h
+#define __SALOME_ShrinkFilter_h
+
+#include <vtkShrinkFilter.h>
+#include <vector>
+
+class SALOME_ShrinkFilter : public vtkShrinkFilter
+{
+public:
+ static SALOME_ShrinkFilter *New();
+ vtkTypeRevisionMacro(SALOME_ShrinkFilter, vtkShrinkFilter);
+
+ void SetStoreMapping(int theStoreMapping);
+ int GetStoreMapping(){ return myStoreMapping;}
+
+ virtual vtkIdType GetNodeObjId(int theVtkID);
+ virtual vtkIdType GetElemObjId(int theVtkID) { return theVtkID;}
+
+protected:
+ SALOME_ShrinkFilter();
+ ~SALOME_ShrinkFilter();
+
+ void Execute();
+ void UnstructuredGridExecute();
+
+private:
+ int myStoreMapping;
+ typedef std::vector<vtkIdType> TVectorId;
+ TVectorId myVTK2ObjIds;
+};
+
+#endif
VTKViewer_ViewFrame.h \
VTKViewer_RenderWindowInteractor.h \
VTKViewer_InteractorStyleSALOME.h \
- VTKViewer_Filter.h
+ VTKViewer_Filter.h \
+ VTKViewer_Prs.h \
+ VTKViewer_Trihedron.h \
+ VTKViewer_VectorText.h
# Libraries targets
LIB = libVTKViewer.la
VTKViewer_RectPicker.cxx \
VTKViewer_CellRectPicker.cxx \
VTKViewer_Utilities.cxx \
- VTKViewer_Filter.cxx
+ VTKViewer_Filter.cxx \
+ VTKViewer_Actor.cxx \
+ VTKViewer_Prs.cxx
LIB_MOC = \
VTKViewer.h \
SALOME_Component.idl \
SALOME_Exception.idl
-CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES)
-CXXFLAGS+=
-LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomeGUI
+CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES)
+
+LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomePrs -lSalomeGUI
@CONCLUDE@
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "VTKViewer_Actor.h"
+
+#include "SALOME_PassThroughFilter.h"
+
+// VTK Includes
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+#include <vtkRenderer.h>
+
+#include <vtkCell.h>
+#include <vtkPolyData.h>
+#include <vtkShrinkFilter.h>
+
+#include "utilities.h"
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+static void CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet){
+ vtkPoints *aPoints = vtkPoints::New();
+ vtkIdType iEnd = theSourceDataSet->GetNumberOfPoints();
+ aPoints->SetNumberOfPoints(iEnd);
+ for(vtkIdType i = 0; i < iEnd; i++){
+ aPoints->SetPoint(i,theSourceDataSet->GetPoint(i));
+ }
+ theGrid->SetPoints(aPoints);
+ aPoints->Delete();
+}
+
+
+//=======================================================================
+
+vtkStandardNewMacro(VTKViewer_Actor);
+
+VTKViewer_Actor::VTKViewer_Actor()
+{
+ myRenderer = NULL;
+ myIsInfinite = true;
+
+ Visibility = Pickable = false;
+
+ myUnstructuredGrid = vtkUnstructuredGrid::New();
+ myUnstructuredGrid->Allocate();
+
+ myIsShrunk = false;
+ myIsShrinkable = true;
+ myShrinkFilter = vtkShrinkFilter::New();
+
+ myMapper = vtkDataSetMapper::New();
+
+ myMapper->SetInput(myUnstructuredGrid);
+ Superclass::InitPipeLine(myMapper);
+
+ SetResolveCoincidentTopology(false);
+}
+
+
+void VTKViewer_Actor::SetShrinkFactor(float theValue){
+ myShrinkFilter->SetShrinkFactor(theValue);
+ Modified();
+}
+
+
+void VTKViewer_Actor::SetShrink()
+{
+ if ( !myIsShrinkable ) return;
+ if ( vtkDataSet* aDataSet = myPassFilter[0]->GetOutput() )
+ {
+ myShrinkFilter->SetInput( aDataSet );
+ myPassFilter[1]->SetInput( myShrinkFilter->GetOutput() );
+ myIsShrunk = true;
+ }
+}
+
+void VTKViewer_Actor::UnShrink()
+{
+ if ( !myIsShrunk ) return;
+ if ( vtkDataSet* aDataSet = myPassFilter[0]->GetOutput() )
+ {
+ myPassFilter[1]->SetInput( aDataSet );
+ myPassFilter[1]->Modified();
+ myIsShrunk = false;
+ Modified();
+ }
+}
+
+
+//----------------------------------------------------------------------------
+VTKViewer_Actor::~VTKViewer_Actor()
+{
+ if(MYDEBUG) INFOS("VTKViewer_Actor::~VTKViewer_Actor()");
+
+ myMapper->RemoveAllInputs();
+ myMapper->Delete();
+
+ myShrinkFilter->UnRegisterAllOutputs();
+ myShrinkFilter->Delete();
+
+ myUnstructuredGrid->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+void VTKViewer_Actor::MapCells(SALOME_Actor* theMapActor,
+ const TColStd_IndexedMapOfInteger& theMapIndex)
+{
+ myUnstructuredGrid->Reset();
+
+ vtkDataSet *aSourceDataSet = theMapActor->GetInput();
+ CopyPoints(myUnstructuredGrid,aSourceDataSet);
+
+ int aNbOfParts = theMapIndex.Extent();
+ for(int ind = 1; ind <= aNbOfParts; ind++){
+ int aPartId = theMapIndex( ind );
+ vtkCell* aCell = theMapActor->GetElemCell(aPartId);
+ myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+ //for (int i = 0, iEnd = aCell->GetNumberOfEdges(); i < iEnd; i++){
+ // vtkCell* anEdgeCell = aCell->GetEdge(i);
+ // myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
+ //}
+ }
+
+ UnShrink();
+ if(theMapActor->IsShrunk()){
+ SetShrinkFactor(theMapActor->GetShrinkFactor());
+ SetShrink();
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void VTKViewer_Actor::MapPoints(SALOME_Actor* theMapActor,
+ const TColStd_IndexedMapOfInteger& theMapIndex)
+{
+ myUnstructuredGrid->Reset();
+ if(int aNbOfParts = theMapIndex.Extent()){
+ vtkPoints *aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints(aNbOfParts);
+ for(int i = 0; i < aNbOfParts; i++){
+ int aPartId = theMapIndex( i+1 );
+ float* aCoord = theMapActor->GetNodeCoord(aPartId);
+ aPoints->SetPoint(i,aCoord);
+ myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,&i);
+ }
+ myUnstructuredGrid->SetPoints(aPoints);
+ aPoints->Delete();
+ }
+
+ UnShrink();
+}
+
+
+//----------------------------------------------------------------------------
+void VTKViewer_Actor::MapEdge(SALOME_Actor* theMapActor,
+ const TColStd_IndexedMapOfInteger& theMapIndex)
+{
+ myUnstructuredGrid->Reset();
+
+ vtkDataSet *aSourceDataSet = theMapActor->GetInput();
+ CopyPoints(myUnstructuredGrid,aSourceDataSet);
+
+ int iEnd = theMapIndex.Extent();
+ int aCellId = -1, aCellCounter = 0;
+ for(int i = 1; i <= iEnd; i++){
+ int anId = theMapIndex( i );
+ if(anId > 0) {
+ aCellCounter++;
+ aCellId = anId;
+ }
+ }
+
+ if(aCellCounter == 1){
+ vtkCell* aCell = theMapActor->GetElemCell(aCellId);
+ if(aCell->GetCellType() <= VTK_LINE){
+ myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+ }else{
+ int aNbOfParts = aCell->GetNumberOfEdges();
+ for(int i = 1; i <= iEnd; i++){
+ int aPartId = theMapIndex(i);
+ if( aPartId < 0){
+ aPartId = -aPartId-1;
+ if(0 > aPartId || aPartId >= aNbOfParts) break;
+ vtkCell* anEdgeCell = aCell->GetEdge(aPartId);
+ myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
+ }
+ }
+ }
+ }else{
+ int aNbOfParts = aSourceDataSet->GetNumberOfCells();
+ for(int i = 1; i <= iEnd; i++){
+ int aPartId = theMapIndex( i );
+ if(aPartId > 0){
+ if(aPartId >= aNbOfParts) break;
+ vtkCell* aCell = aSourceDataSet->GetCell(aPartId);
+ myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+ }
+ }
+ }
+
+ UnShrink();
+ if(theMapActor->IsShrunk()){
+ SetShrinkFactor(theMapActor->GetShrinkFactor());
+ SetShrink();
+ }
+}
+
+//----------------------------------------------------------------------------
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef VTKVIEWER_ACTOR_H
+#define VTKVIEWER_ACTOR_H
+
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+class vtkRenderer;
+class vtkShrinkFilter;
+class vtkDataSetMapper;
+class vtkUnstructuredGrid;
+
+#include "SALOME_Actor.h"
+
+class VTKViewer_Actor : public SALOME_Actor {
+ public:
+ vtkTypeMacro(VTKViewer_Actor,SALOME_Actor);
+ static VTKViewer_Actor* New();
+ virtual ~VTKViewer_Actor();
+
+ void SetShrinkFactor(float value);
+ virtual void SetShrink();
+ virtual void UnShrink();
+
+ void MapCells(SALOME_Actor* theMapActor,
+ const TColStd_IndexedMapOfInteger& theMapIndex);
+
+ void MapPoints(SALOME_Actor* theMapActor,
+ const TColStd_IndexedMapOfInteger& theMapIndex);
+
+ void MapEdge(SALOME_Actor* theMapActor,
+ const TColStd_IndexedMapOfInteger& theMapIndex);
+
+ protected:
+ vtkUnstructuredGrid* myUnstructuredGrid;
+ vtkDataSetMapper* myMapper;
+
+ vtkRenderer* myRenderer;
+
+ vtkShrinkFilter* myShrinkFilter;
+ bool myIsShrinkable;
+ bool myIsShrunk;
+
+ VTKViewer_Actor();
+};
+
+#endif
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// 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 : VTKViewer_ViewFrame.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#ifndef VTKViewer_Algorithm_H
+#define VTKViewer_Algorithm_H
+
+class vtkActor;
+class vtkActorCollection;
+
+namespace SALOME{
+ namespace VTK{
+
+ template<typename TActor, typename TFunction>
+ TFunction ForEach(vtkActorCollection *theCollection, TFunction theFun)
+ {
+ if(theCollection){
+ theCollection->InitTraversal();
+ while(vtkActor *anAct = theCollection->GetNextActor())
+ if(TActor *anActor = dynamic_cast<TActor*>(anAct))
+ theFun(anActor);
+ }
+ return theFun;
+ }
+
+
+ template<typename TActor, typename TPredicate, typename TFunction>
+ TFunction ForEachIf(vtkActorCollection *theCollection,
+ TPredicate thePredicate,
+ TFunction theFun)
+ {
+ if(theCollection){
+ theCollection->InitTraversal();
+ while(vtkActor *anAct = theCollection->GetNextActor())
+ if(TActor *anActor = dynamic_cast<TActor*>(anAct))
+ if(thePredicate(anActor))
+ theFun(anActor);
+ }
+ return theFun;
+ }
+
+
+ template<typename TActor, typename TPredicate>
+ TActor* Find(vtkActorCollection *theCollection, TPredicate thePredicate)
+ {
+ if(theCollection){
+ theCollection->InitTraversal();
+ while(vtkActor *anAct = theCollection->GetNextActor())
+ if(TActor *anActor = dynamic_cast<TActor*>(anAct))
+ if(thePredicate(anActor))
+ return anActor;
+ }
+ return NULL;
+ }
+
+ }
+}
+
+#endif
dir[i] = p2[i] - p1[i];
}
- input->GetCell(curData.cellId, cell2);
+ actor->GetMapper()->GetInput()->GetCell(curData.cellId, cell2);
result = IntersectCells(cell1, cellData.depth,
cell2, curData.depth, dir);
if (result > 0) {
VTKViewer_Filter();\r
virtual ~VTKViewer_Filter();\r
\r
- bool IsValid( SALOME_Actor*, const int theCellId );\r
- virtual bool IsValid( const int theCellId ) const = 0;\r
+ bool IsValid( SALOME_Actor*, const int theId );\r
+ virtual bool IsValid( const int theId ) const = 0;\r
+ virtual int GetId() const = 0;\r
+ virtual bool IsNodeFilter() const = 0;\r
\r
virtual void SetActor( SALOME_Actor* );\r
-\r
+ \r
protected:\r
\r
SALOME_Actor* myActor;\r
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// 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 : VTKViewer_ViewFrame.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#ifndef VTKViewer_Functor_H
+#define VTKViewer_Functor_H
+
+#include <functional>
+
+#include <string>
+#include "SALOME_InteractiveObject.hxx"
+
+namespace SALOME{
+ namespace VTK{
+
+
+ template<class TActor> struct TIsSameEntry
+ {
+ std::string myEntry;
+ TIsSameEntry(const char* theEntry): myEntry(theEntry){}
+ bool operator()(TActor* theActor){
+ if(theActor->hasIO()){
+ Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+ if(anIO->hasEntry())
+ return myEntry == anIO->getEntry();
+ }
+ return false;
+ }
+ };
+
+
+ template<class TActor> struct TIsSameIObject
+ {
+ Handle(SALOME_InteractiveObject) myIObject;
+ TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject):
+ myIObject(theIObject)
+ {}
+ bool operator()(TActor* theActor){
+ if(theActor->hasIO()){
+ Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+ return myIObject->isSame(anIO);
+ }
+ return false;
+ }
+ };
+
+
+ template<class TActor, class TArg, class TStoreArg = TArg> struct TSetFunction
+ {
+ typedef void (TActor::* TAction)(TArg);
+ TAction myAction;
+ TStoreArg myArg;
+ TSetFunction(TAction theAction, TArg theArg):
+ myAction(theAction), myArg(theArg)
+ {}
+ void operator()(TActor* theActor){
+ (theActor->*myAction)(myArg);
+ }
+ };
+
+
+ template<class TActor, class TArg = int> struct TSetVisibility: TSetFunction<TActor,TArg>
+ {
+ TSetVisibility(TArg theArg):
+ TSetFunction<TActor,TArg>(&TActor::SetVisibility,theArg)
+ {}
+ };
+
+
+ }
+}
+
+
+#endif
// $Header$
#include "VTKViewer_InteractorStyleSALOME.h"
+
#include "VTKViewer_RenderWindowInteractor.h"
#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_ViewFrame.h"
+
#include "VTKViewer_Utilities.h"
#include "VTKViewer_Trihedron.h"
#include "VTKViewer_RectPicker.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
-#include "SALOME_Selection.h"
#include "SALOME_Actor.h"
+#include "VTKViewer_Actor.h"
+#include "SALOME_Selection.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <vtkObjectFactory.h>
#include <vtkMath.h>
#include <vtkCommand.h>
-#include <vtkAssemblyNode.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
#include <vtkPicker.h>
#include <vtkPointPicker.h>
#include <vtkCellPicker.h>
#include <vtkLine.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkExtractEdges.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkDataSetCollection.h>
-#include <vtkImageData.h>
+#include <vtkMapper.h>
+#include <vtkDataSet.h>
+#include <vtkSmartPointer.h>
#include <qapplication.h>
//VRV: porting on Qt 3.0.5
using namespace std;
-extern int SetVisibility(vtkActorCollection* theCollection, int theParam);
-extern int GetVisibility(vtkActorCollection* theCollection);
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+static bool IsStored(Handle(SALOME_InteractiveObject)& theIO,
+ const SALOME_ListIO& theListIO)
+{
+ if (!theListIO.IsEmpty()){
+ SALOME_ListIteratorOfListIO anIter(theListIO);
+ for(; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if(theIO->isSame(anIO)) {
+ theIO = anIO; //Added by SRN, fix SAL1307
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+static bool IsSelected(Handle(SALOME_InteractiveObject)& theIO,
+ SALOME_Selection* theSel)
+{
+ return IsStored(theIO,theSel->StoredIObjects());
+}
+
+
+static int GetEdgeId(vtkPicker *thePicker, SALOME_Actor *theActor, int theObjId){
+ int anEdgeId = -1;
+ if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
+ float aPickPosition[3];
+ thePicker->GetPickPosition(aPickPosition);
+ float aMinDist = 1000000.0, aDist = 0;
+ for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
+ if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
+ int subId; float pcoords[3], closestPoint[3], weights[3];
+ aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
+ if (aDist < aMinDist) {
+ aMinDist = aDist;
+ anEdgeId = i;
+ }
+ }
+ }
+ }
+ return anEdgeId;
+}
+
+
+static bool CheckDimensionId(Selection_Mode theMode, SALOME_Actor *theActor, vtkIdType theObjId){
+ switch(theMode){
+ case CellSelection:
+ return true;
+ case EdgeSelection:
+ return ( theActor->GetObjDimension( theObjId ) == 1 );
+ case FaceSelection:
+ return ( theActor->GetObjDimension( theObjId ) == 2 );
+ case VolumeSelection:
+ return ( theActor->GetObjDimension( theObjId ) == 3 );
+ };
+ return false;
+}
+
//----------------------------------------------------------------------------
vtkStandardNewMacro(VTKViewer_InteractorStyleSALOME);
this->ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
loadCursors();
- myPActor = vtkActor::New();
- myPActor->PickableOff();
- myPActor->GetProperty()->SetColor(0,1,1);
- myPActor->GetProperty()->SetLineWidth(5);
- myPActor->GetProperty()->SetPointSize(5);
+ myPreSelectionActor = VTKViewer_Actor::New();
+ myPreSelectionActor->GetProperty()->SetColor(0,1,1);
+ myPreSelectionActor->GetProperty()->SetLineWidth(5);
+ myPreSelectionActor->GetProperty()->SetPointSize(5);
+
+ OnSelectionModeChanged();
}
//----------------------------------------------------------------------------
VTKViewer_InteractorStyleSALOME::~VTKViewer_InteractorStyleSALOME()
{
+ if(MYDEBUG) INFOS("VTKViewer_InteractorStyleSALOME::~VTKViewer_InteractorStyleSALOME()");
+ m_ViewFrame->RemoveActor(myPreSelectionActor);
}
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::setPreselectionProp(const double& theRed, const double& theGreen,
const double& theBlue, const int& theWidth)
{
- myPActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
- myPActor->GetProperty()->SetLineWidth(theWidth);
- myPActor->GetProperty()->SetPointSize(theWidth);
+ myPreSelectionActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+ myPreSelectionActor->GetProperty()->SetLineWidth(theWidth);
+ myPreSelectionActor->GetProperty()->SetPointSize(theWidth);
+}
+
+//----------------------------------------------------------------------------
+void VTKViewer_InteractorStyleSALOME::SetInteractor(vtkRenderWindowInteractor *theInteractor){
+ m_Interactor = dynamic_cast<VTKViewer_RenderWindowInteractor*>(theInteractor);
+ Superclass::SetInteractor(theInteractor);
+}
+
+//----------------------------------------------------------------------------
+void VTKViewer_InteractorStyleSALOME::setViewFrame(VTKViewer_ViewFrame* theViewFrame){
+ m_ViewFrame = theViewFrame;
+ m_ViewFrame->AddActor(myPreSelectionActor);
+ myPreSelectionActor->Delete();
+}
+
+//----------------------------------------------------------------------------
+void VTKViewer_InteractorStyleSALOME::setGUIWindow(QWidget* theWindow){
+ myGUIWindow = theWindow;
}
//----------------------------------------------------------------------------
cam->Elevation(ryf);
cam->OrthogonalizeViewUp();
::ResetCameraClippingRange(this->CurrentRenderer);
- this->Interactor->Render();
+ //this->Interactor->Render();
+ myGUIWindow->update();
}
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::PanXY(int x, int y, int oldX, int oldY)
{
TranslateView(x, y, oldX, oldY);
- //vtkRenderWindowInteractor *rwi = this->Interactor;
- /* VSV Light follows camera: if (this->CurrentLight)
- {
- vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
- this->CurrentLight->SetPosition(cam->GetPosition());
- this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
- }*/
-
- this->Interactor->Render();
+ //this->Interactor->Render();
+ myGUIWindow->update();
}
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::ControlLblSize(double aOldScale, double aNewScale) {
- return;
-}
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::DollyXY(int dx, int dy)
aCam->Dolly(zoomFactor);
::ResetCameraClippingRange(this->CurrentRenderer);
}
-
- /* VSV Light follows camera: if (this->CurrentLight)
- {
- this->CurrentLight->SetPosition(cam->GetPosition());
- this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
- }*/
-
- this->Interactor->Render();
+
+ //this->Interactor->Render();
+ myGUIWindow->update();
}
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::SpinXY(int x, int y, int oldX, int oldY)
{
- vtkRenderWindowInteractor *rwi = this->Interactor;
vtkCamera *cam;
if (this->CurrentRenderer == NULL)
cam->Roll(newAngle - oldAngle);
cam->OrthogonalizeViewUp();
- rwi->Render();
+ //this->Interactor->Render();
+ myGUIWindow->update();
}
}
return;
}
+
+
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::OnLeftButtonUp(int vtkNotUsed(ctrl),
int shift,
}
}
+
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::OnMiddleButtonDown(int ctrl,
int shift,
startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
}
}
+
+
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::OnMiddleButtonUp(int vtkNotUsed(ctrl),
int shift,
}
}
+
//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::OnRightButtonDown(int ctrl,
int shift,
}
//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::PrintSelf(ostream& os, vtkIndent indent)
-{
- vtkInteractorStyle::PrintSelf(os,indent);
-
-}
-
/* XPM */
const char* imageZoomCursor[] = {
"32 32 3 1",
"................................",
"................................"};
+
+//----------------------------------------------------------------------------
// loads cursors for viewer operations - zoom, pan, etc...
void VTKViewer_InteractorStyleSALOME::loadCursors()
{
myCursorState = false;
}
+
+//----------------------------------------------------------------------------
// event filter - controls mouse and keyboard events during viewer operations
bool VTKViewer_InteractorStyleSALOME::eventFilter(QObject* object, QEvent* event)
{
return QObject::eventFilter(object, event);
}
+
+//----------------------------------------------------------------------------
// starts Zoom operation (e.g. through menu command)
void VTKViewer_InteractorStyleSALOME::startZoom()
{
qApp->installEventFilter(this);
}
+
+//----------------------------------------------------------------------------
// starts Pan operation (e.g. through menu command)
void VTKViewer_InteractorStyleSALOME::startPan()
{
qApp->installEventFilter(this);
}
+//----------------------------------------------------------------------------
// starts Rotate operation (e.g. through menu command)
void VTKViewer_InteractorStyleSALOME::startRotate()
{
qApp->installEventFilter(this);
}
+
+//----------------------------------------------------------------------------
// starts Spin operation (e.g. through menu command)
void VTKViewer_InteractorStyleSALOME::startSpin()
{
}
+
+//----------------------------------------------------------------------------
// starts Fit Area operation (e.g. through menu command)
void VTKViewer_InteractorStyleSALOME::startFitArea()
{
}
+//----------------------------------------------------------------------------
void VTKViewer_InteractorStyleSALOME::ViewFitAll() {
int aTriedronWasVisible = false;
if(m_Trihedron){
}
+//----------------------------------------------------------------------------
// starts Global Panning operation (e.g. through menu command)
void VTKViewer_InteractorStyleSALOME::startGlobalPan()
{
myScale = cam->GetParallelScale();
ViewFitAll();
- // make fit all
-// int TriedronWasVisible = false;
-// if(m_Trihedron){
-// TriedronWasVisible =
-// m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
-// if(TriedronWasVisible) m_Trihedron->VisibilityOff();
-// }
-
-// ::ResetCamera(this->CurrentRenderer);
-
-// if(m_Trihedron)
-// if(TriedronWasVisible)
-// m_Trihedron->VisibilityOn();
- //VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(this->Interactor->GetRenderWindow());
if (myGUIWindow) myGUIWindow->update();
qApp->installEventFilter(this);
}
+
+//----------------------------------------------------------------------------
// returns TRUE if needs redrawing
bool VTKViewer_InteractorStyleSALOME::needsRedrawing()
{
State == VTK_INTERACTOR_STYLE_CAMERA_NONE;
}
+
+//----------------------------------------------------------------------------
// fits viewer contents to rect
void VTKViewer_InteractorStyleSALOME::fitRect(const int left,
const int top,
::ResetCameraClippingRange(this->CurrentRenderer);
}
- //vtkRenderWindowInteractor *rwi = this->Interactor;
- /* VSV Light follows camera: if (this->CurrentLight) {
- this->CurrentLight->SetPosition(cam->GetPosition());
- this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
- }*/
- // rwi->Render();
- //VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(rwi->GetRenderWindow());
myGUIWindow->update();
}
-
+//----------------------------------------------------------------------------
// starts viewer operation (!internal usage!)
void VTKViewer_InteractorStyleSALOME::startOperation(int operation)
{
}
}
+
+//----------------------------------------------------------------------------
// sets proper cursor for window when viewer operation is activated
void VTKViewer_InteractorStyleSALOME::setCursor(const int operation)
{
}
}
+
+//----------------------------------------------------------------------------
// called when viewer operation started (!put necessary initialization here!)
void VTKViewer_InteractorStyleSALOME::onStartOperation()
{
}
}
+
+//----------------------------------------------------------------------------
// called when viewer operation finished (!put necessary post-processing here!)
void VTKViewer_InteractorStyleSALOME::onFinishOperation()
{
QAD_Study* aActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
SALOME_Selection* aSel = SALOME_Selection::Selection( aActiveStudy->getSelection() );
- vtkRenderWindowInteractor *rwi = this->Interactor;
// VSV: LOD actor activisation
// rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) {
// making fit rect opeation
int w, h, x, y;
- rwi->GetSize(w, h);
+ m_Interactor->GetSize(w, h);
int x1, y1, x2, y2;
x1 = rect.left();
y1 = h - rect.top() - 1;
}
else {
if (myPoint == myOtherPoint) {
- // process point selection
+ // process point selection
int w, h, x, y;
- rwi->GetSize(w, h);
+ m_Interactor->GetSize(w, h);
x = myPoint.x();
y = h - myPoint.y() - 1;
- vtkActorCollection* listactors = NULL;
+
this->FindPokedRenderer(x, y);
- rwi->StartPickCallback();
+ m_Interactor->StartPickCallback();
-// vtkPicker* aPicker = vtkPicker::SafeDownCast(rwi->GetPicker());
-// if (aPicker)
-// aPicker->SetTolerance(0.01);
-
- rwi->GetPicker()->Pick(x, y, 0.0, this->CurrentRenderer);
+ vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
+ aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
- if ( rwi->GetPicker()->IsA("vtkCellPicker") ) {
- vtkCellPicker* picker;
- if ( (picker = vtkCellPicker::SafeDownCast(rwi->GetPicker())) ) {
- int aVtkId = picker->GetCellId();
- // INFOS ( " CellId : " << aVtkId );
- if ( aVtkId >= 0 ) {
- vtkActor* ac = picker->GetActor();
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
- INFOS ( " NAME Actor : " << SActor->getName() << ", CellId : " << aVtkId );
-
- //Cell selection /////////////////////////////// NB
- if ( aSelectionMode == CellSelection ) {
- if ( SActor->hasIO() && isValid( SActor, aVtkId, aSelectionMode ) ) {
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- // Look in the current selection
- SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
- Standard_Boolean IsSelected = false;
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- if(IO->isSame(IOS)) {
- IsSelected = true;
- IO = IOS; //Added by SRN, fix SAL1307
- break;
- }
- }
-
- int anObjId = SActor->GetObjId(aVtkId);
- std::vector<int> aVtkList;
- if (anObjId != -1) {
- aVtkList = SActor->GetVtkId(anObjId);
- }
-
- if (IsSelected) {
- // This IO is already in the selection
- if (aVtkList.size() > 0)
- bool add = aSel->AddOrRemoveIndex( IO, aVtkList, myShiftState, false );
- else
- bool add = aSel->AddOrRemoveIndex( IO, aVtkId, myShiftState, false );
- } else {
- if (!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- if (aVtkList.size() > 0)
- bool add = aSel->AddOrRemoveIndex( IO, aVtkList, myShiftState, false );
- else
- bool add = aSel->AddOrRemoveIndex( IO, aVtkId, myShiftState, false );
- aSel->AddIObject( IO, false );
- }
- }
- }
- //Edge, Face, Volume and EdgeOfCell selection ////////////////////////// NB
- else if ( aSelectionMode == EdgeSelection ||
- aSelectionMode == FaceSelection ||
- aSelectionMode == VolumeSelection ||
- aSelectionMode == EdgeOfCellSelection ) {
- if ( SActor->hasIO() && isValid( SActor, aVtkId, aSelectionMode ) ) {
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if (vtkDataSet* UGrid = SActor->GetMapper()->GetInput()) {
- if (vtkCell* pickedCell = UGrid->GetCell(aVtkId)) {
- bool result = false;
- int edgeId = -1;
- int anObjId = SActor->GetObjId(aVtkId);
- std::vector<int> aVtkList;
- if (anObjId > -1)
- aVtkList = SActor->GetVtkId(anObjId);
-
- if (aSelectionMode == EdgeSelection) {
- if ( SActor->GetObjDimension( anObjId ) == 1 )
- result = true;
- }
- else if ( aSelectionMode == FaceSelection ) {
- if ( SActor->GetObjDimension( anObjId ) == 2 )
- result = true;
- }
- else if (aSelectionMode == VolumeSelection) {
- if ( SActor->GetObjDimension( anObjId ) == 3 )
- result = true;
- }
- else {
- float pickPosition[3];
- picker->GetPickPosition(pickPosition);
- float distMin = 1000000.0, dist = 0;
- for (int i = 0, iEnd = pickedCell->GetNumberOfEdges(); i < iEnd; i++){
- vtkCell* edge = pickedCell->GetEdge(i);
- if (vtkLine* line = vtkLine::SafeDownCast(edge)){
- float pcoords[3],closestPoint[3],weights[3];
- int subId;
- line->EvaluatePosition(pickPosition,closestPoint,subId,pcoords,dist,weights);
- if (dist < distMin) {
- distMin = dist;
- edgeId = i;
- }
- }
- }
- if (edgeId != -1 || pickedCell->GetCellDimension() == 1)
- result = true;
- INFOS("edgeID transformed = "<<edgeId);
- }
- if (result) {
- // Look in the current selection
- SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
- Standard_Boolean IsSelected = false;
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- if(IO->isSame(IOS)) {
- IO = IOS; //Added by SRN, fix SAL1307
- IsSelected = true;
- break;
- }
- }
- if (!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- // aSel->SetSelectionMode(EdgeSelection, true);
- if (aVtkList.size() > 0)
- aSel->AddOrRemoveIndex( IO, aVtkList, true, false);
- else
- aSel->AddOrRemoveIndex( IO, aVtkId, true, false);
- if (edgeId >= 0)
- aSel->AddOrRemoveIndex( IO, -edgeId-1, true, true );
- aSel->AddIObject( IO, false );
- }
- }
+ SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
+
+ if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) {
+ int aVtkId = picker->GetCellId();
+ if ( aVtkId >= 0 && SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
+ int anObjId = SActor->GetElemObjId(aVtkId);
+ if(anObjId >= 0){
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(aSelectionMode != EdgeOfCellSelection) {
+ if(CheckDimensionId(aSelectionMode,SActor,anObjId)){
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId);
+ if (IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ } else {
+ if (!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
}
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ aSel->AddIObject( IO, false );
}
}
- }
- } else {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- }
- } else if ( rwi->GetPicker()->IsA("vtkPointPicker") ) {
- vtkPointPicker* picker;
- if ( (picker = vtkPointPicker::SafeDownCast(rwi->GetPicker())) ) {
- INFOS ( " PointId : " << picker->GetPointId() );
- if ( picker->GetPointId() >= 0 ) {
- vtkActor* ac = picker->GetActor();
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
- INFOS ( " NAME Actor : " << SActor->getName() );
- if ( SActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- /*
- if (IO.IsNull())
- break;
- if (aSelActiveCompOnly &&
- strcmp(aActiveComponent->ComponentDataType(),
- IO->getComponentDataType()) != 0) {
- break;
+ }else{
+ if (!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ int anEdgeId = GetEdgeId(picker,SActor,anObjId);
+ if (anEdgeId >= 0) {
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
+ aSel->AddOrRemoveIndex( IO, anObjId, true, false);
+ aSel->AddOrRemoveIndex( IO, -anEdgeId-1, true, true );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }
+ } else {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ } else if ( vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker) ) {
+ int aVtkId = picker->GetPointId();
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
+ if ( SActor && SActor->hasIO() ) {
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ if(anObjId >= 0){
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ } else {
+ if(!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
}
- */
- // Look in the current selection
- SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
- Standard_Boolean IsSelected = false;
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- if(IO->isSame(IOS)) {
- IO = IOS; //Added by SRN, fix SAL1307
- IsSelected = true;
- break;
- }
- }
- if(IsSelected) {
- // This IO is already in the selection
- bool add = aSel->AddOrRemoveIndex( IO, picker->GetPointId(), myShiftState, false );
- } else {
- if(!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- bool add = aSel->AddOrRemoveIndex( IO, picker->GetPointId(), myShiftState, false );
- aSel->AddIObject( IO, false );
- }
- }
- }
- } else {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- }
- } else {
- vtkPicker* picker;
- if ( (picker = vtkPicker::SafeDownCast(rwi->GetPicker())) ) {
- listactors = picker->GetActors();
- }
- if ( listactors->GetNumberOfItems() == 0 ) {
- // No selection clear all
- this->PropPicked = 0;
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- } else {
- vtkActor* ac;
- listactors->InitTraversal();
- ac = listactors->GetNextActor();
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
- if ( SActor->hasIO() ) {
- this->PropPicked++;
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- // Look in the current selection
- SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
- Standard_Boolean IsSelected = false;
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- if( IO->isSame(IOS) ) {
- IO = IOS; //Added by SRN, fix SAL1307
- IsSelected = true;
- break;
- }
- }
- if(IsSelected) {
- // This IO is already in the selection
- if(myShiftState) {
- aSel->RemoveIObject(IO);
- }
- }
- else {
- if(!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- aSel->AddIObject( IO, false );
- }
- }
- }
- }
- }
- rwi->EndPickCallback();
+ if(MYDEBUG) INFOS(" PointId : "<<anObjId);
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }
+ } else {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ } else {
+ if ( SActor && SActor->hasIO() ) {
+ this->PropPicked++;
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ if(myShiftState) {
+ aSel->RemoveIObject(IO);
+ }
+ }
+ else {
+ if(!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ aSel->AddIObject( IO, false );
+ }
+ }else{
+ // No selection clear all
+ this->PropPicked = 0;
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ }
+ m_Interactor->EndPickCallback();
} else {
//processing rectangle selection
- SALOMEDS::SComponent_var aActiveComponent =
- SALOMEDS::SComponent::_narrow(aActiveStudy->getStudyDocument()->
- FindObject(QAD_Application::getDesktop()->getActiveComponent()));
- if(aSelActiveCompOnly && aActiveComponent->_is_nil()) return;
- rwi->StartPickCallback();
+ QString aComponentDataType = QAD_Application::getDesktop()->getComponentDataType();
+ if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return;
+ m_Interactor->StartPickCallback();
if (!myShiftState) {
this->PropPicked = 0;
QRect rect(myPoint, myOtherPoint);
rect = rect.normalize();
int w, h, x, y;
- rwi->GetSize(w, h);
+ m_Interactor->GetSize(w, h);
int x1, y1, x2, y2;
x1 = rect.left();
y1 = h - rect.top() - 1;
y2 = h - rect.bottom() - 1;
switch (aSelectionMode) {
- case NodeSelection: // Nodes selection
- {
- if (! rwi->GetPicker()->IsA("vtkPointPicker") ) break;
- vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(rwi->GetPicker());
+ case NodeSelection: {
+ if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(m_Interactor->GetPicker()) ) {
vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
aListActors->InitTraversal();
- vtkActor* aActor;
- for (int k = 0; k < aListActors->GetNumberOfItems(); k++) {
- aActor = aListActors->GetNextActor();
- if (aActor != NULL) {
- if (aActor->GetVisibility() == 0)
- continue;
- vtkAbstractMapper3D* aMapper3D = aActor->GetMapper();
- if ((aMapper3D != NULL) && (aActor->IsA("SALOME_Actor"))) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor);
-
- if ((SActor != NULL) && (SActor->hasIO())) {
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if (IO.IsNull())
- continue;
- if (aSelActiveCompOnly &&
- strcmp(aActiveComponent->ComponentDataType(),
- IO->getComponentDataType()) != 0) {
- continue;
- }
-
- vtkMapper* aMapper;
- vtkVolumeMapper* aVolumeMapper;
- vtkDataSet* aDataSet;
-
- if ( (aMapper = vtkMapper::SafeDownCast(aMapper3D)) != NULL ) {
- aDataSet = aMapper->GetInput();
- } else if ((aVolumeMapper = vtkVolumeMapper::SafeDownCast(aMapper3D)) != NULL ){
- aDataSet = aVolumeMapper->GetInput();
- } else {
- continue;
- }
- if (aDataSet) {
-
- std::vector<int> anIndices;
- for (int i=0; i < aDataSet->GetNumberOfPoints(); i++) {
- float* aPoint;
- aPoint = aDataSet->GetPoint(i);
- if (IsInRect(aPoint, x1, y1, x2, y2)) {
- float aDisp[3];
- ComputeWorldToDisplay(aPoint[0],
- aPoint[1],
- aPoint[2], aDisp);
- aPointPicker->Pick(aDisp[0], aDisp[1], 0.0, CurrentRenderer);
-
- int pid = aPointPicker->GetPointId();
- if ( pid >= 0) { // && (!aSel->IsIndexSelected(IO, aPointPicker->GetPointId()))) {
- std::vector<int>::iterator found =
- find(anIndices.begin(), anIndices.end(), pid);
- if (found == anIndices.end())
- anIndices.push_back(pid);
- }
+ while (vtkActor* aActor = aListActors->GetNextActor()) {
+ if (!aActor->GetVisibility())
+ continue;
+ if(SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor)) {
+ if (SActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if (IO.IsNull())
+ continue;
+ if (aSelActiveCompOnly && aComponentDataType != IO->getComponentDataType())
+ continue;
+ if (vtkDataSet* aDataSet = SActor->GetInput()) {
+ SALOME_Selection::TContainerOfId anIndices;
+ for(int i = 0; i < aDataSet->GetNumberOfPoints(); i++) {
+ float aPoint[3];
+ aDataSet->GetPoint(i,aPoint);
+ if (IsInRect(aPoint,x1,y1,x2,y2)){
+ float aDisp[3];
+ ComputeWorldToDisplay(aPoint[0],aPoint[1],aPoint[2],aDisp);
+ if(aPointPicker->Pick(aDisp[0],aDisp[1],0.0,CurrentRenderer)){
+ if(vtkActorCollection *anActorCollection = aPointPicker->GetActors()){
+ if(anActorCollection->IsItemPresent(SActor)){
+ float aPickedPoint[3];
+ aPointPicker->GetMapperPosition(aPickedPoint);
+ vtkIdType aVtkId = aDataSet->FindPoint(aPickedPoint);
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ){
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ anIndices.insert(anObjId);
+ }
+ }
+ }
}
}
- if (!anIndices.empty()) {
- aSel->AddOrRemoveIndex(IO, anIndices, true, false);
- aSel->AddIObject(IO, false);
- anIndices.clear();
- }
+ }
+ if (!anIndices.empty()) {
+ aSel->AddOrRemoveIndex(IO, anIndices, true, false);
+ aSel->AddIObject(IO, false);
+ anIndices.clear();
+ }else{
+ aSel->RemoveIObject(IO, false);
}
}
}
}
}
break;
+ }
case CellSelection:
case EdgeOfCellSelection:
case EdgeSelection:
case FaceSelection:
case VolumeSelection:
{
- VTKViewer_CellRectPicker* picker = VTKViewer_CellRectPicker::New();
+ vtkSmartPointer<VTKViewer_CellRectPicker> picker = VTKViewer_CellRectPicker::New();
picker->SetTolerance(0.001);
picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
-
+
vtkActorCollection* aListActors = picker->GetActors();
- vtkActor* aActor;
aListActors->InitTraversal();
- while(aActor = aListActors->GetNextActor()) {
- if (aActor->IsA("SALOME_Actor")) {
- SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor);
+ while(vtkActor* aActor = aListActors->GetNextActor()) {
+ if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
if (aSActor->hasIO()) {
Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
- // INFOS ( " NAME Object : " << aIO->getName() << " from " << aIO->getComponentDataType() );
- if (aSelActiveCompOnly &&
- strcmp(aActiveComponent->ComponentDataType(),
- aIO->getComponentDataType()) != 0) {
+ if (aSelActiveCompOnly && aComponentDataType != aIO->getComponentDataType())
continue;
- }
VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
if ( !cellList.empty() ) {
- INFOS ( " NAME Actor : " << aSActor->getName() );
- std::vector<int> anIndexes;
- if (aSelectionMode == CellSelection) {
- VTKViewer_CellDataSet::iterator it;
- for (it = cellList.begin(); it != cellList.end(); ++it) {
- int aCellId = (*it).cellId;
- if ( !isValid( aSActor, aCellId, aSelectionMode ) )
- continue;
-
- int aObjId = aSActor->GetObjId(aCellId);
- std::vector<int> aVtkList;
- if ( aObjId != -1 )
- aVtkList = aSActor->GetVtkId(aObjId);
-
- if (aVtkList.size() > 0) {
- std::vector<int>::iterator it;
- for (it = aVtkList.begin(); it != aVtkList.end(); ++it) {
- std::vector<int>::iterator found =
- find(anIndexes.begin(), anIndexes.end(), *it);
- if (found == anIndexes.end())
- anIndexes.push_back(*it);
- }
- }
- else
- anIndexes.push_back(aCellId);
- }
- }
- else {
- if ( vtkDataSet* aDataSet = aSActor->GetMapper()->GetInput() ) {
- VTKViewer_CellDataSet::iterator it;
- for ( it = cellList.begin(); it != cellList.end(); ++it ) {
- int aCellId = (*it).cellId;
-
- if ( !isValid( aSActor, aCellId, aSelectionMode ) )
- continue;
-
- int aObjId = aSActor->GetObjId(aCellId);
- std::vector<int> aVtkList;
- if (aObjId != -1)
- aVtkList = aSActor->GetVtkId(aObjId);
- bool result = false;
- if (vtkCell* aCell = aDataSet->GetCell(aCellId)) {
- if ( aSelectionMode == EdgeSelection ) {
- if ( aSActor->GetObjDimension( aObjId ) == 1 )
- result = true;
- }
- else if ( aSelectionMode == FaceSelection ) {
- if ( aSActor->GetObjDimension( aObjId ) == 2 )
- result = true;
- }
- else if ( aSelectionMode == VolumeSelection ) {
- if ( aSActor->GetObjDimension( aObjId ) == 3 )
- result = true;
- }
- }
- if ( result ) {
- if (aVtkList.size() > 0) {
- std::vector<int>::iterator it;
- for (it = aVtkList.begin(); it != aVtkList.end(); ++it) {
- std::vector<int>::iterator found =
- find(anIndexes.begin(), anIndexes.end(), *it);
- if (found == anIndexes.end())
- anIndexes.push_back(*it);
- }
- }
- else
- anIndexes.push_back(aCellId);
- }
+ if(MYDEBUG) INFOS ( " NAME Actor : " << aSActor->getName() );
+ SALOME_Selection::TContainerOfId anIndexes;
+ VTKViewer_CellDataSet::iterator it;
+ for ( it = cellList.begin(); it != cellList.end(); ++it ) {
+ int aCellId = (*it).cellId;
+
+ if ( !IsValid( aSActor, aCellId ) )
+ continue;
+
+ int anObjId = aSActor->GetElemObjId(aCellId);
+ if (anObjId != -1){
+ if ( CheckDimensionId(aSelectionMode,aSActor,anObjId) ) {
+ anIndexes.insert(anObjId);
}
}
}
break;
case ActorSelection: // objects selection
{
- VTKViewer_RectPicker* picker = VTKViewer_RectPicker::New();
+ vtkSmartPointer<VTKViewer_RectPicker> picker = VTKViewer_RectPicker::New();
picker->SetTolerance(0.001);
picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
vtkActorCollection* aListActors = picker->GetActors();
- vtkActor* aActor;
SALOME_ListIO aListIO;
aListActors->InitTraversal();
- while(aActor = aListActors->GetNextActor()) {
- if (aActor->IsA("SALOME_Actor")) {
- SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor);
+ while(vtkActor* aActor = aListActors->GetNextActor()) {
+ if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
if (aSActor->hasIO()) {
Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
- bool isStored = false;
- if (!aListIO.IsEmpty()) {
- SALOME_ListIteratorOfListIO It(aListIO);
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- if( aIO->isSame(IOS) ) {
- aIO = IOS; //Added by SRN, fix SAL1307
- isStored = true;
- break;
- }
- }
- }
- if (!isStored)
+ if (!IsStored(aIO,aListIO))
aListIO.Append(aIO);
}
}
}
} // end case 4
} //end switch
- rwi->EndPickCallback();
+ m_Interactor->EndPickCallback();
}
aActiveStudy->update3dViewers();
}
case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
{
int w, h, x, y;
- rwi->GetSize(w, h);
+ m_Interactor->GetSize(w, h);
x = myPoint.x();
y = h - myPoint.y() - 1;
Place(x, y);
// called when selection mode changed (!put necessary initialization here!)
void VTKViewer_InteractorStyleSALOME::OnSelectionModeChanged()
{
- myPActor->VisibilityOff();
+
+ myPreSelectionActor->SetVisibility(false);
+ myElemId = myEdgeId = myNodeId = -1;
+ mySelectedActor = NULL;
}
// called when user moves mouse inside viewer window and there is no active viewer operation
// processing highlighting
QAD_Study* anActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
SALOME_Selection* Sel = SALOME_Selection::Selection( anActiveStudy->getSelection() );
-
Selection_Mode aSelectionMode = Sel->SelectionMode();
- myPActor->VisibilityOff();
-
- vtkRenderWindowInteractor *rwi = this->Interactor;
+
int w, h, x, y;
- rwi->GetSize(w, h);
+ m_Interactor->GetSize(w, h);
x = mousePos.x(); y = h - mousePos.y() - 1;
this->FindPokedRenderer(x,y);
- rwi->StartPickCallback();
- rwi->GetPicker()->Pick(x, y, 0.0, this->CurrentRenderer);
-
- if (rwi->GetPicker()->IsA("vtkCellPicker")) {
- vtkCellPicker* picker = vtkCellPicker::SafeDownCast(rwi->GetPicker());
- int aVtkId = picker->GetCellId();
- // INFOS ( " Preselected CellId : " << picker->GetCellId() );
- if ( aVtkId >= 0 ) {
- vtkActor* ac = picker->GetActor();
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
- // INFOS ( " NAME Actor : " << SActor->getName() );
+ m_Interactor->StartPickCallback();
+ myPreSelectionActor->SetVisibility(false);
- if (rwi->IsA("VTKViewer_RenderWindowInteractor")) {
- VTKViewer_RenderWindowInteractor* aRWI =
- VTKViewer_RenderWindowInteractor::SafeDownCast(rwi);
+ vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
+ aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
- //Cell selection //////////////////////////////////// NB
- if ( aSelectionMode == CellSelection )
- {
- if ( SActor->hasIO() && isValid( SActor, aVtkId, CellSelection ) )
- {
- int anObjId = SActor->GetObjId(aVtkId);
- std::vector<int> aVtkList;
- if (anObjId != -1)
- aVtkList = SActor->GetVtkId(anObjId);
-
- if (aVtkList.size() > 0)
- aRWI->setCellData(SActor->getIO(), aVtkList, myPActor);
- else
- aRWI->setCellData(SActor->getIO(), aVtkId, myPActor);
-
- this->CurrentRenderer->AddActor(myPActor);
- myPActor->GetProperty()->SetRepresentationToSurface();
- myPActor->VisibilityOn();
+ SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
+
+ if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) {
+ int aVtkId = picker->GetCellId();
+ if ( aVtkId >= 0 ) {
+ int anObjId = SActor->GetElemObjId(aVtkId);
+ if ( SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
+ bool anIsSameObjId = (mySelectedActor == SActor && myElemId == anObjId);
+ bool aResult = anIsSameObjId;
+ if(!anIsSameObjId) {
+ if(aSelectionMode != EdgeOfCellSelection) {
+ aResult = CheckDimensionId(aSelectionMode,SActor,anObjId);
+ if(aResult){
+ mySelectedActor = SActor;
+ myElemId = anObjId;
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId);
+ m_Interactor->setCellData(anObjId,SActor,myPreSelectionActor);
}
}
-
- //Edge, Face, Volume and EdgeOfCell selection ////////////////////////// NB
- else if ( aSelectionMode == EdgeSelection ||
- aSelectionMode == FaceSelection ||
- aSelectionMode == VolumeSelection ||
- aSelectionMode == EdgeOfCellSelection ) {
- if ( SActor->hasIO() && isValid( SActor, aVtkId, aSelectionMode ) )
- {
- if (vtkDataSet* UGrid = SActor->GetMapper()->GetInput()) {
- if (vtkCell* pickedCell = UGrid->GetCell(aVtkId)) {
- bool result = false;
- int edgeId = -1;
- int anObjId = SActor->GetObjId(aVtkId);
- std::vector<int> aVtkList;
- if (anObjId > -1)
- aVtkList = SActor->GetVtkId(anObjId);
-
- if ( aSelectionMode == EdgeSelection ) {
- if ( SActor->GetObjDimension( anObjId ) == 1 )
- result = true;
- }
- else if ( aSelectionMode == FaceSelection ) {
- if ( SActor->GetObjDimension( anObjId ) == 2 )
- result = true;
- }
- else if ( aSelectionMode == VolumeSelection ) {
- if ( SActor->GetObjDimension( anObjId ) == 3 )
- result = true;
- }
- else {
- float pickPosition[3];
- picker->GetPickPosition(pickPosition);
- float distMin = 1000000.0, dist = 0;
- for (int i = 0, iEnd = pickedCell->GetNumberOfEdges(); i < iEnd; i++){
- vtkCell* edge = pickedCell->GetEdge(i);
- if(vtkLine* line = vtkLine::SafeDownCast(edge)){
- float pcoords[3],closestPoint[3],weights[3];
- int subId;
- line->EvaluatePosition(pickPosition,closestPoint,subId,pcoords,dist,weights);
- if (dist < distMin) {
- distMin = dist;
- edgeId = i;
- }
- }
- }
- if (edgeId != -1 || pickedCell->GetCellDimension() == 1)
- result = true;
- // INFOS("edgeID transformed = "<<edgeId);
- }
- if (result)
- {
- this->CurrentRenderer->RemoveActor(myPActor);
- if (edgeId == -1) {
- if (aVtkList.size() > 0)
- aRWI->setCellData(SActor->getIO(), aVtkList, myPActor);
- else
- aRWI->setCellData(SActor->getIO(), aVtkId, myPActor);
- }
- else
- aRWI->setEdgeData(SActor->getIO(), aVtkId, -edgeId-1, myPActor);
-
- this->CurrentRenderer->AddActor(myPActor);
- myPActor->GetProperty()->SetRepresentationToSurface();
- myPActor->VisibilityOn();
- }
- }
- }
- }
+ }
+ if(aSelectionMode == EdgeOfCellSelection){
+ int anEdgeId = GetEdgeId(picker,SActor,anObjId);
+ bool anIsSameEdgeId = (myEdgeId != anEdgeId) && anIsSameObjId;
+ aResult = anIsSameEdgeId;
+ if(!anIsSameEdgeId) {
+ aResult = (anEdgeId >= 0);
+ if (aResult) {
+ mySelectedActor = SActor;
+ myEdgeId = anEdgeId;
+ myElemId = anObjId;
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
+ m_Interactor->setEdgeData(anObjId,SActor,-anEdgeId-1,myPreSelectionActor);
+ }
}
}
+ if(aResult) {
+ myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
+ myPreSelectionActor->SetVisibility(true);
+ }
}
}
}
- else if (rwi->GetPicker()->IsA("vtkPointPicker")) {
- vtkPointPicker* picker = vtkPointPicker::SafeDownCast(rwi->GetPicker());
- // INFOS ( " Preselected PointId : " << picker->GetPointId() );
- if (picker->GetPointId() >= 0) {
- vtkActor* ac = picker->GetActor();
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
- // INFOS ( " NAME Actor : " << SActor->getName() );
-
- if (rwi->IsA("VTKViewer_RenderWindowInteractor")) {
- VTKViewer_RenderWindowInteractor* aRWI =
- VTKViewer_RenderWindowInteractor::SafeDownCast(rwi);
-
- if ( SActor->hasIO() ) {
- myPActor->VisibilityOff();
- this->CurrentRenderer->RemoveActor(myPActor);
- aRWI->setPointData(SActor->getIO(), picker->GetPointId(), myPActor);
- this->CurrentRenderer->AddActor(myPActor);
- myPActor->GetProperty()->SetRepresentationToSurface();
- myPActor->VisibilityOn();
- }
+ else if (vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker)) {
+ int aVtkId = picker->GetPointId();
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
+ if ( SActor && SActor->hasIO() ) {
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ bool anIsSameObjId = (mySelectedActor == SActor && myNodeId == anObjId);
+ if(!anIsSameObjId) {
+ mySelectedActor = SActor;
+ myNodeId = anObjId;
+ if(MYDEBUG) INFOS(" PointId : "<<anObjId);
+ m_Interactor->setPointData(anObjId,SActor,myPreSelectionActor);
}
+ myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
+ myPreSelectionActor->SetVisibility(true);
}
}
}
- else if ( rwi->GetPicker()->IsA("vtkPicker") ) {
- vtkPicker* picker = vtkPicker::SafeDownCast(rwi->GetPicker());
- vtkActor* ac = picker->GetActor();
-
- if ( ac != NULL ) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
- if ( preview != SActor ) {
- if ( preview != NULL ) {
- preview->SetPreSelected( false );
- }
- preview = SActor;
+ else if ( vtkPicker* picker = vtkPicker::SafeDownCast(aPicker) ) {
+ if ( SActor ) {
+ if ( myPreViewActor != SActor ) {
+ if ( myPreViewActor != NULL ) {
+ myPreViewActor->SetPreSelected( false );
+ }
+ myPreViewActor = SActor;
- if ( SActor->hasIO() ) {
- Handle( SALOME_InteractiveObject) IO = SActor->getIO();
-
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- Standard_Boolean IsSelected = false;
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- if(IO->isSame(IOS)) {
- IsSelected = true;
- break;
- }
- }
-
- if ( !IsSelected ) {
+ if ( SActor->hasIO() ) {
+ Handle( SALOME_InteractiveObject) IO = SActor->getIO();
+ if ( !IsSelected(IO,Sel) ) {
// Find All actors with same IO
- vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while( ac ) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IOS = anActor->getIO();
- if(IO->isSame(IOS)) {
- anActor->SetPreSelected( true );
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- // INFOS ( " NAME PREVIEW " << SActor->getName() );
- }
- }
- }
+ vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
+ theActors->InitTraversal();
+ while( vtkActor *ac = theActors->GetNextActor() ) {
+ if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
+ if ( anActor->hasIO() ) {
+ Handle(SALOME_InteractiveObject) IOS = anActor->getIO();
+ if(IO->isSame(IOS)) {
+ anActor->SetPreSelected( true );
+ }
+ }
+ }
+ }
+ //if(MYDEBUG) INFOS ( " NAME PREVIEW " << SActor->getName() );
+ }
+ }
}
} else {
- preview = NULL;
+ myPreViewActor = NULL;
vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while( ac ) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
+ while( vtkActor *ac = theActors->GetNextActor() ) {
+ if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
anActor->SetPreSelected( false );
}
- ac = theActors->GetNextActor();
}
}
}
- rwi->EndPickCallback();
- rwi->Render();
-
+ m_Interactor->EndPickCallback();
+ //m_Interactor->Render();
+ myGUIWindow->update();
+
this->LastPos[0] = x;
this->LastPos[1] = y;
}
cam->SetParallelScale(myScale);
::ResetCameraClippingRange(this->CurrentRenderer);
- /* VSV Light follows camera: if (this->CurrentLight) {
- this->CurrentLight->SetPosition(cam->GetPosition());
- this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
- }*/
- //VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(this->Interactor->GetRenderWindow());
if (myGUIWindow) myGUIWindow->update();
}
return ((aPnt[0]>left) && (aPnt[0]<right) && (aPnt[1]>bottom) && (aPnt[1]<top));
}
-void VTKViewer_InteractorStyleSALOME::SetFaceFilter( const Handle(VTKViewer_Filter)& f )
+void VTKViewer_InteractorStyleSALOME::SetFilter( const Handle(VTKViewer_Filter)& theFilter )
{
- myFaceFilter = f;
+ myFilters[ theFilter->GetId() ] = theFilter;
}
-void VTKViewer_InteractorStyleSALOME::RemoveFaceFilter()
+bool VTKViewer_InteractorStyleSALOME::IsFilterPresent( const int theId )
{
- myFaceFilter.Nullify();
+ return myFilters.find( theId ) != myFilters.end();
}
-void VTKViewer_InteractorStyleSALOME::SetEdgeFilter( const Handle(VTKViewer_Filter)& f )
+void VTKViewer_InteractorStyleSALOME::RemoveFilter( const int theId )
{
- myEdgeFilter = f;
+ if ( IsFilterPresent( theId ) )
+ myFilters.erase( theId );
}
-void VTKViewer_InteractorStyleSALOME::RemoveEdgeFilter()
-{
- myEdgeFilter.Nullify();
-}
-bool VTKViewer_InteractorStyleSALOME::isValid( SALOME_Actor* theActor,
- const int theId,
- const Selection_Mode theSelMode )
+bool VTKViewer_InteractorStyleSALOME::IsValid( SALOME_Actor* theActor,
+ const int theId,
+ const bool theIsNode )
{
- if ( theSelMode != CellSelection &&
- theSelMode != FaceSelection &&
- theSelMode != EdgeSelection )
- return true;
-
- if ( theSelMode == CellSelection )
+ std::map<int, Handle(VTKViewer_Filter)>::const_iterator anIter;
+ for ( anIter = myFilters.begin(); anIter != myFilters.end(); ++anIter )
{
- vtkDataSet* aUGrid = theActor->GetMapper()->GetInput();
- if ( aUGrid != 0 )
- {
- vtkCell* aCell = aUGrid->GetCell( theId );
- if ( aCell != 0 )
- {
- int nbPoints = aCell->GetNumberOfPoints();
- if ( nbPoints == 2 )
- return myEdgeFilter.IsNull() || myEdgeFilter->IsValid( theActor, theId );
- else
- return myFaceFilter.IsNull() || myFaceFilter->IsValid( theActor, theId );
-
- return true;
- }
- }
- return false;
+ const Handle(VTKViewer_Filter)& aFilter = anIter->second;
+ if ( theIsNode == aFilter->IsNodeFilter() &&
+ !aFilter->IsValid( theActor, theId ) )
+ return false;
}
- else if ( theSelMode == FaceSelection )
- return myFaceFilter.IsNull() || myFaceFilter->IsValid( theActor, theId );
- else if ( theSelMode == EdgeSelection )
- return myEdgeFilter.IsNull() || myEdgeFilter->IsValid( theActor, theId );
-
return true;
}
+
+Handle(VTKViewer_Filter) VTKViewer_InteractorStyleSALOME::GetFilter( const int theId )
+{
+ return IsFilterPresent( theId ) ? myFilters[ theId ] : Handle(VTKViewer_Filter)();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#define __VTKViewer_InteractorStyleSALOME_h
#include <vtkInteractorStyle.h>
+
+class vtkCell;
+class vtkRenderWindowInteractor;
+
#include <qobject.h>
#include <qcursor.h>
-#include "SALOME_Actor.h"
+
#include "VTKViewer_Filter.h"
-#include "SALOME_Selection.h"
+class SALOME_Actor;
+class VTKViewer_Actor;
class VTKViewer_Trihedron;
+class VTKViewer_ViewFrame;
+class VTKViewer_RenderWindowInteractor;
#define VTK_INTERACTOR_STYLE_CAMERA_NONE 0
#define VTK_INTERACTOR_STYLE_CAMERA_ROTATE 1
// parent. This class should not normally be instantiated by application
// programmers.
static VTKViewer_InteractorStyleSALOME *New();
+ vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkInteractorStyle);
+
+ virtual void SetInteractor(vtkRenderWindowInteractor *theInteractor);
+ void setViewFrame(VTKViewer_ViewFrame* theViewFrame);
+ void setGUIWindow(QWidget* theWindow);
void setTriedron(VTKViewer_Trihedron* theTrihedron);
void setPreselectionProp(const double& theRed = 0, const double& theGreen = 1,
const double& theBlue = 1, const int& theWidth = 5);
- vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkObject);
- void PrintSelf(ostream& os, vtkIndent indent);
-
// Generic event bindings must be overridden in subclasses
void OnMouseMove (int ctrl, int shift, int x, int y);
void OnLeftButtonDown(int ctrl, int shift, int x, int y);
void ViewFitAll();
- void SetEdgeFilter( const Handle(VTKViewer_Filter)& );
- void SetFaceFilter( const Handle(VTKViewer_Filter)& );
- void RemoveFaceFilter();
- void RemoveEdgeFilter();
+ void SetFilter( const Handle(VTKViewer_Filter)& );
+ Handle(VTKViewer_Filter) GetFilter( const int );
+ bool IsFilterPresent( const int );
+ void RemoveFilter( const int );
+ bool IsValid( SALOME_Actor* theActor,
+ const int theId,
+ const bool theIsNode = false );
+
protected:
VTKViewer_InteractorStyleSALOME();
const int left, const int top,
const int right, const int bottom);
- bool isValid( SALOME_Actor* theActor, const int theCellId, const Selection_Mode theSelMode );
-
int State;
float MotionFactor;
float RadianToDegree; // constant: for conv from deg to rad
double myScale;
- SALOME_Actor* preview;
- vtkActor* myPActor;
+ SALOME_Actor* myPreViewActor;
-public:
+ VTKViewer_Actor* myPreSelectionActor;
+ SALOME_Actor* mySelectedActor;
+ int myElemId;
+ int myEdgeId;
+ int myNodeId;
+
+ public:
bool eventFilter(QObject* object, QEvent* event);
- void ControlLblSize(double aOldScale, double aNewScale);
void startZoom();
void startPan();
void startGlobalPan();
void startFitArea();
void startSpin();
bool needsRedrawing();
- QWidget* getGUIWindow() {return myGUIWindow;}
- void setGUIWindow(QWidget* theWin) { myGUIWindow = theWin;}
-protected:
+ protected:
void loadCursors();
void startOperation(int operation);
void onStartOperation();
void onCursorMove(QPoint mousePos);
void setCursor(const int operation);
-protected:
+
+ protected:
QCursor myDefCursor;
QCursor myPanCursor;
QCursor myZoomCursor;
bool myShiftState;
int ForcedState;
+ VTKViewer_RenderWindowInteractor* m_Interactor;
+ VTKViewer_ViewFrame* m_ViewFrame;
VTKViewer_Trihedron* m_Trihedron;
-
QWidget* myGUIWindow;
- Handle(VTKViewer_Filter) myEdgeFilter;
- Handle(VTKViewer_Filter) myFaceFilter;
+ std::map<int, Handle(VTKViewer_Filter)> myFilters;
// members from old version
double DeltaElevation;
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VTKViewer_Prs.cxx
+// Author : Sergey ANIKIN
+// Module : SALOME
+// $Header$
+
+#include "VTKViewer_Prs.h"
+
+//==========================================================
+/*!
+ * VTKViewer_Prs::VTKViewer_Prs
+ * Default constructor
+ */
+//==========================================================
+VTKViewer_Prs::VTKViewer_Prs() : myObjects( 0 )
+{
+}
+
+//==========================================================
+/*!
+ * VTKViewer_Prs::VTKViewer_Prs
+ * tandard constructora
+ */
+//==========================================================
+VTKViewer_Prs::VTKViewer_Prs( const vtkActor* obj )
+{
+ AddObject( obj );
+}
+
+//==========================================================
+/*!
+ * VTKViewer_Prs::~VTKViewer_Prs
+ * Destructor
+ */
+//==========================================================
+VTKViewer_Prs:: ~VTKViewer_Prs()
+{
+ if ( myObjects ) myObjects->Delete();
+}
+
+//==========================================================
+/*!
+ * VTKViewer_Prs::GetObjects
+ * Get actors list
+ */
+//==========================================================
+vtkActorCollection* VTKViewer_Prs::GetObjects() const
+{
+ return myObjects;
+}
+
+//==========================================================
+/*!
+ * VTKViewer_Prs::AddObject
+ * Add actor
+ */
+//==========================================================
+void VTKViewer_Prs::AddObject( const vtkActor* obj )
+{
+ if ( !myObjects)
+ myObjects = vtkActorCollection::New();
+ myObjects->AddItem( (vtkActor*)obj );
+}
+
+//==========================================================
+/*!
+ * VTKViewer_Prs::IsNull
+ * Return 0 if list of the actors is empty
+ * [ Reimplemented from SALOME_Prs ]
+ */
+//==========================================================
+bool VTKViewer_Prs::IsNull() const
+{
+ return !myObjects || myObjects->GetNumberOfItems() <= 0;
+}
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VTKViewer_Prs.h
+// Author : Sergey ANIKIN
+// Module : SALOME
+// $Header$
+
+#ifndef VTKVIEWER_PRS_H
+#define VTKVIEWER_PRS_H
+
+#include "SALOME_Prs.h"
+
+#include <vtkActorCollection.h>
+
+class VTKViewer_Prs : public SALOME_VTKPrs
+{
+public:
+ VTKViewer_Prs();
+ // Default constructor
+ VTKViewer_Prs( const vtkActor* obj );
+ // Standard constructor
+ ~VTKViewer_Prs();
+ // Destructor
+
+ vtkActorCollection* GetObjects() const;
+ // Get actors list
+ void AddObject( const vtkActor* obj );
+ // Add actor
+
+ bool IsNull() const;
+ // Reimplemented from SALOME_Prs
+
+private:
+ vtkActorCollection* myObjects; // list of actors
+};
+
+#endif
// $Header$
#include "VTKViewer_RenderWindowInteractor.h"
-#include "VTKViewer_RenderWindow.h"
+
#include "VTKViewer_InteractorStyleSALOME.h"
+#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_ViewFrame.h"
+
+#include "VTKViewer_Algorithm.h"
+#include "VTKViewer_Functor.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
-//#include "SALOME_Selection.h"
-#include "SALOME_Actor.h"
+#include "VTKViewer_Actor.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// VTK Includes
-#include <vtkAssemblyNode.h>
-#include <vtkActor.h>
-#include <vtkInteractorStyle.h>
#include <vtkObjectFactory.h>
#include <vtkPicker.h>
#include <vtkCellPicker.h>
#include <vtkPointPicker.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkSphereSource.h>
-#include <vtkDataSet.h>
-#include <vtkMaskPoints.h>
-#include <vtkVertex.h>
#include <vtkRendererCollection.h>
-#include <vtkPolyDataWriter.h>
// QT Includes
#include <qkeycode.h>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+#include "utilities.h"
+
using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New() {
vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ;
if( ret ) {
VTKViewer_RenderWindowInteractor::VTKViewer_RenderWindowInteractor() {
this->Enabled = 0 ;
this->mTimer = new QTimer( this ) ;
- this->displaymode = 0;
+ myDisplayMode = 0;
myGUIWindow = 0;
- vtkPicker* thepicker = vtkPicker::New();
- thepicker->SetTolerance(0);
- this->SetPicker(thepicker);
+
+ myBasicPicker = vtkPicker::New();
+ myCellPicker = vtkCellPicker::New();
+ myPointPicker = vtkPointPicker::New();
+
+ myCellActor = VTKViewer_Actor::New();
+ myCellActor->PickableOff();
+ myCellActor->GetProperty()->SetColor(1,1,0);
+ myCellActor->GetProperty()->SetLineWidth(5);
+ myCellActor->GetProperty()->SetRepresentationToSurface();
+
+ myEdgeActor = VTKViewer_Actor::New();
+ myEdgeActor->PickableOff();
+ myEdgeActor->GetProperty()->SetColor(1,0,0);
+ myEdgeActor->GetProperty()->SetLineWidth(5);
+ myEdgeActor->GetProperty()->SetRepresentationToWireframe();
+
+ myPointActor = VTKViewer_Actor::New();
+ myPointActor->PickableOff();
+ myPointActor->GetProperty()->SetColor(1,1,0);
+ myPointActor->GetProperty()->SetPointSize(5);
+ myPointActor->GetProperty()->SetRepresentationToPoints();
connect(mTimer, SIGNAL(timeout()), this, SLOT(TimerFunc())) ;
}
VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor() {
+ if(MYDEBUG) INFOS("VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor()");
+
delete mTimer ;
+
+ myViewFrame->RemoveActor(myCellActor);
+ myViewFrame->RemoveActor(myEdgeActor);
+ myViewFrame->RemoveActor(myPointActor);
+
+ myCellActor->Delete();
+ myEdgeActor->Delete();
+ myPointActor->Delete();
+
+ myBasicPicker->Delete();
+ myCellPicker->Delete();
+ myPointPicker->Delete();
}
void VTKViewer_RenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent) {
this->Size[0] = ((aSize[0] > 0) ? aSize[0] : 300);
this->Size[1] = ((aSize[1] > 0) ? aSize[1] : 300);
+ this->SetPicker(myBasicPicker);
+
+ SetSelectionTolerance();
+
//
// Enable the interactor.
//
//
this->Initialized = 1 ;
- myTolNodes = 0.025;
- myTolItems = 0.001;
+ return ;
+}
- Cell_Actor = vtkActor::New();
- Cell_Actor->PickableOff();
- Cell_Actor->GetProperty()->SetColor(1,1,0);
- Cell_Actor->GetProperty()->SetLineWidth(5);
- Cell_Actor->GetProperty()->SetRepresentationToSurface();
- Edge_Actor = vtkActor::New();
- Edge_Actor->PickableOff();
- Edge_Actor->GetProperty()->SetColor(1,0,0);
- Edge_Actor->GetProperty()->SetLineWidth(5);
- Edge_Actor->GetProperty()->SetRepresentationToWireframe();
+//----------------------------------------------------------------------------
+void VTKViewer_RenderWindowInteractor::setGUIWindow(QWidget* theWindow){
+ myGUIWindow = theWindow;
+}
- Point_Actor = vtkActor::New();
- Point_Actor->PickableOff();
- Point_Actor->GetProperty()->SetColor(1,1,0);
- Point_Actor->GetProperty()->SetPointSize(5);
- Point_Actor->GetProperty()->SetRepresentationToPoints();
+//----------------------------------------------------------------------------
+void VTKViewer_RenderWindowInteractor::setViewFrame(VTKViewer_ViewFrame* theViewFrame){
+ myViewFrame = theViewFrame;
- return ;
+ myViewFrame->InsertActor(myCellActor);
+ myViewFrame->InsertActor(myEdgeActor);
+ myViewFrame->InsertActor(myPointActor);
}
+//----------------------------------------------------------------------------
+void VTKViewer_RenderWindowInteractor::MoveInternalActors()
+{
+ myViewFrame->MoveActor(myCellActor);
+ myViewFrame->MoveActor(myEdgeActor);
+ myViewFrame->MoveActor(myPointActor);
+}
+//----------------------------------------------------------------------------
void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *theInteractor){
myInteractorStyle = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(theInteractor);
vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
}
-void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode mode)
+void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode theMode)
{
- Cell_Actor->VisibilityOff();
- Edge_Actor->VisibilityOff();
- Point_Actor->VisibilityOff();
-
- selectionmode = mode;
- if ( mode == NodeSelection ) {
- vtkPointPicker* thepicker = vtkPointPicker::New();
- thepicker->SetTolerance(myTolNodes);
- this->SetPicker(thepicker);
- } else if ( mode == EdgeOfCellSelection ) {
- vtkCellPicker* thepicker = vtkCellPicker::New();
- thepicker->SetTolerance(myTolItems);
- this->SetPicker(thepicker);
- } else if ( mode == CellSelection || mode == EdgeSelection ||
- mode == FaceSelection || mode == VolumeSelection ) {
- vtkCellPicker* thepicker = vtkCellPicker::New();
- thepicker->SetTolerance(myTolItems);
- this->SetPicker(thepicker);
- } else if ( mode == ActorSelection ) {
- vtkPicker* thepicker = vtkPicker::New();
- thepicker->SetTolerance(myTolItems);
- this->SetPicker(thepicker);
+ myCellActor->SetVisibility(false);
+ myEdgeActor->SetVisibility(false);
+ myPointActor->SetVisibility(false);
+
+ switch(theMode){
+ case ActorSelection:
+ this->SetPicker(myBasicPicker);
+ break;
+ case NodeSelection:
+ this->SetPicker(myPointPicker);
+ break;
+ case CellSelection:
+ case EdgeSelection:
+ case FaceSelection:
+ case VolumeSelection:
+ case EdgeOfCellSelection:
+ this->SetPicker(myCellPicker);
+ break;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else
- return;
- Style->OnSelectionModeChanged();
+ myInteractorStyle->OnSelectionModeChanged();
}
void VTKViewer_RenderWindowInteractor::SetSelectionProp(const double& theRed, const double& theGreen,
const double& theBlue, const int& theWidth)
{
- Cell_Actor->GetProperty()->SetColor(theRed, theGreen, theBlue);
- Cell_Actor->GetProperty()->SetLineWidth(theWidth);
+ myCellActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+ myCellActor->GetProperty()->SetLineWidth(theWidth);
- Point_Actor->GetProperty()->SetColor(theRed, theGreen, theBlue);
- Point_Actor->GetProperty()->SetPointSize(theWidth);
+ myPointActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+ myPointActor->GetProperty()->SetPointSize(theWidth);
}
void VTKViewer_RenderWindowInteractor::SetSelectionTolerance(const double& theTolNodes, const double& theTolItems)
{
myTolNodes = theTolNodes;
myTolItems = theTolItems;
- if (this->GetPicker()->IsA("vtkPointPicker")) {
- vtkPointPicker* picker = vtkPointPicker::SafeDownCast(this->GetPicker());
- picker->SetTolerance(theTolNodes);
- }
- else if (this->GetPicker()->IsA("vtkPicker")) {
- vtkPicker* picker = vtkPicker::SafeDownCast(this->GetPicker());
- picker->SetTolerance(theTolItems);
- }
+
+ myBasicPicker->SetTolerance(myTolItems);
+ myCellPicker->SetTolerance(myTolItems);
+ myPointPicker->SetTolerance(myTolNodes);
+
}
void VTKViewer_RenderWindowInteractor::Enable() {
if( ! this->Enabled ) {
return ;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else {
- emit RenderWindowModified() ;
- return;
- }
- Style->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ;
- if (Style->needsRedrawing() )
+ myInteractorStyle->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ;
+ if (myInteractorStyle->needsRedrawing() )
emit RenderWindowModified() ;
}
if( ! this->Enabled ) {
return ;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else
- return;
- Style->OnLeftButtonDown((event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y());
+ myInteractorStyle->OnLeftButtonDown((event->state() & ControlButton),
+ (event->state() & ShiftButton),
+ event->x(), event->y());
}
void VTKViewer_RenderWindowInteractor::LeftButtonReleased(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else
- return;
- Style->OnLeftButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
+ myInteractorStyle->OnLeftButtonUp( (event->state() & ControlButton),
+ (event->state() & ShiftButton),
+ event->x(), event->y() ) ;
}
void VTKViewer_RenderWindowInteractor::MiddleButtonPressed(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else
- return;
- Style->OnMiddleButtonDown((event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
+ myInteractorStyle->OnMiddleButtonDown((event->state() & ControlButton),
+ (event->state() & ShiftButton),
+ event->x(), event->y() ) ;
}
void VTKViewer_RenderWindowInteractor::MiddleButtonReleased(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else
- return;
- Style->OnMiddleButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
+ myInteractorStyle->OnMiddleButtonUp( (event->state() & ControlButton),
+ (event->state() & ShiftButton),
+ event->x(), event->y() ) ;
}
void VTKViewer_RenderWindowInteractor::RightButtonPressed(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else
- return;
- Style->OnRightButtonDown( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
+ myInteractorStyle->OnRightButtonDown( (event->state() & ControlButton),
+ (event->state() & ShiftButton),
+ event->x(), event->y() ) ;
}
void VTKViewer_RenderWindowInteractor::RightButtonReleased(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
}
- VTKViewer_InteractorStyleSALOME* Style = 0;
- if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
- Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- else
- return;
- Style->OnRightButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
+ myInteractorStyle->OnRightButtonUp( (event->state() & ControlButton),
+ (event->state() & ShiftButton),
+ event->x(), event->y() ) ;
}
void VTKViewer_RenderWindowInteractor::ButtonPressed(const QMouseEvent *event) {
return ;
}
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* ac)
-{
- vtkActor* anActor;
-
- for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
- if ( anActor->IsA("GEOM_Actor") ) {
- SALOME_Actor* SALOMEactor = SALOME_Actor::SafeDownCast(anActor);
- // Specific for GEOM actor
- if ( SALOMEactor->getDisplayMode() == 1 )
- SALOMEactor->setDisplayMode(0);
- } else {
- anActor->GetProperty()->SetRepresentationToWireframe();
- }
- }
- this->RenderWindow->Render();
- emit RenderWindowModified() ;
-}
int VTKViewer_RenderWindowInteractor::GetDisplayMode() {
- return displaymode;
-}
-
-void VTKViewer_RenderWindowInteractor::SetDisplayMode(int mode) {
- if(mode==0) ChangeRepresentationToWireframe();
- else ChangeRepresentationToSurface();
- displaymode = mode;
-}
-
-void VTKViewer_RenderWindowInteractor::SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
- bool update) {
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- if ( anActor->IsA("GEOM_Actor") ) {
- // GEOM actor
- if ( anActor->getDisplayMode() == 0 ) anActor->setDisplayMode(1);
- else anActor->setDisplayMode(0);
- }
- else {
- if(anActor->GetProperty()->GetRepresentation() <= 1)
- anActor->GetProperty()->SetRepresentationToSurface();
- else
- anActor->GetProperty()->SetRepresentationToWireframe();
- }
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- if (update) {
- this->RenderWindow->Render();
- emit RenderWindowModified() ;
- }
+ return myDisplayMode;
+}
+
+void VTKViewer_RenderWindowInteractor::SetDisplayMode(int theMode) {
+ if(theMode == 0)
+ ChangeRepresentationToWireframe();
+ else
+ ChangeRepresentationToSurface();
+ myDisplayMode = theMode;
}
+void VTKViewer_RenderWindowInteractor::SetDisplayMode(const Handle(SALOME_InteractiveObject)& theIObject, int theMode){
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TSetFunction<SALOME_Actor,int>
+ (&SALOME_Actor::setDisplayMode,theMode));
+}
+
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe()
- // change all actors to wireframe
{
- vtkActorCollection *ac;
- vtkActor *anActor, *aPart;
-
- ac = GetRenderer()->GetActors();
- ChangeRepresentationToWireframe(ac);
+ ChangeRepresentationToWireframe(GetRenderer()->GetActors());
}
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
+{
+ ChangeRepresentationToSurface(GetRenderer()->GetActors());
+}
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* ac)
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
{
- vtkActor *anActor, *aPart;
-
- for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
- if ( anActor->IsA("GEOM_Actor") ) {
- SALOME_Actor* SALOMEactor = SALOME_Actor::SafeDownCast(anActor);
- // Specific for GEOM actor
- if ( SALOMEactor->getDisplayMode() == 0 )
- SALOMEactor->setDisplayMode(1);
- } else {
- anActor->GetProperty()->SetRepresentationToSurface();
- }
- }
- this->RenderWindow->Render();
- emit RenderWindowModified() ;
+ using namespace SALOME::VTK;
+ ForEach<SALOME_Actor>(theCollection,
+ TSetFunction<SALOME_Actor,int>
+ (&SALOME_Actor::setDisplayMode,0));
+ emit RenderWindowModified();
}
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
- // change all actors to "surface" or solid
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
{
- vtkActorCollection *ac;
- vtkActor *anActor, *aPart;
-
- ac = GetRenderer()->GetActors();
- ChangeRepresentationToSurface(ac);
+ using namespace SALOME::VTK;
+ ForEach<SALOME_Actor>(theCollection,
+ TSetFunction<SALOME_Actor,int>
+ (&SALOME_Actor::setDisplayMode,1));
+ emit RenderWindowModified();
}
+
vtkRenderer* VTKViewer_RenderWindowInteractor::GetRenderer()
{
vtkRendererCollection * theRenderers = this->RenderWindow->GetRenderers();
return theRenderers->GetNextItem();
}
+
+struct TErase{
+ SALOME::VTK::TSetFunction<vtkActor,int> mySetFunction;
+ TErase():
+ mySetFunction(&vtkActor::SetVisibility,false)
+ {}
+ void operator()(SALOME_Actor* theActor){
+ theActor->SetVisibility(false);
+ // Erase dependent actors
+ vtkActorCollection* aCollection = vtkActorCollection::New();
+ theActor->GetChildActors(aCollection);
+ SALOME::VTK::ForEach<vtkActor>(aCollection,mySetFunction);
+ aCollection->Delete();
+ }
+};
+
void VTKViewer_RenderWindowInteractor::EraseAll()
{
- vtkActorCollection *ac;
- vtkActor *anActor, *aPart;
-
- ac = GetRenderer()->GetActors();
- for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
- if ( anActor->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( anActor );
- SActor->SetVisibility(false);
- }
- }
+ using namespace SALOME::VTK;
+ ForEach<SALOME_Actor>(GetRenderer()->GetActors(),
+ TErase());
+
emit RenderWindowModified() ;
}
+
void VTKViewer_RenderWindowInteractor::DisplayAll()
-{
- vtkActorCollection *ac;
- vtkActor *anActor, *aPart;
-
- ac = GetRenderer()->GetActors();
- for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
- if ( anActor->IsA("SALOME_Actor") ) {
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( anActor );
- SActor->SetVisibility( true );
- }
- }
+{
+ vtkActorCollection* aCollection = GetRenderer()->GetActors();
+ using namespace SALOME::VTK;
+ ForEach<SALOME_Actor>(aCollection,TSetVisibility<SALOME_Actor>(true));
+
emit RenderWindowModified() ;
}
-void VTKViewer_RenderWindowInteractor::Erase( SALOME_Actor* SActor, bool update)
+
+void VTKViewer_RenderWindowInteractor::Erase(SALOME_Actor* theActor, bool update)
{
- SActor->SetVisibility( false );
+ TErase()(theActor);
- // Erase dependent actors
- vtkActorCollection* theChildActors = vtkActorCollection::New();
- SActor->GetChildActors(theChildActors);
+ if(update)
+ emit RenderWindowModified();
+}
- theChildActors->InitTraversal();
- vtkActor *ac = theChildActors->GetNextActor();
- while(!(ac==NULL)) {
- ac->SetVisibility( false );
- ac = theChildActors->GetNextActor();
- }
- if (update)
+void VTKViewer_RenderWindowInteractor::Erase(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
+{
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TErase());
+
+ if(update)
emit RenderWindowModified();
}
-void VTKViewer_RenderWindowInteractor::Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+struct TRemoveAction{
+ vtkRenderer* myRen;
+ TRemoveAction(vtkRenderer* theRen): myRen(theRen){}
+ void operator()(SALOME_Actor* theActor){
+ myRen->RemoveActor(theActor);
+ }
+};
+
+void VTKViewer_RenderWindowInteractor::Remove(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
{
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- Erase(anActor, false);
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- if (update)
- emit RenderWindowModified() ;
+ vtkRenderer* aRen = GetRenderer();
+
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(aRen->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TRemoveAction(aRen));
+
+ if(update)
+ emit RenderWindowModified();
}
-void VTKViewer_RenderWindowInteractor::Remove(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+float VTKViewer_RenderWindowInteractor::GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject)
{
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- aren->RemoveActor(anActor);
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- if (update)
- emit RenderWindowModified() ;
+ using namespace SALOME::VTK;
+ SALOME_Actor* anActor =
+ Find<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject));
+ if(anActor)
+ return 1.0 - anActor->GetOpacity();
+ return -1.0;
}
-float VTKViewer_RenderWindowInteractor::GetTransparency(const Handle(SALOME_InteractiveObject)& IObject) {
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- if ( anActor->IsA("GEOM_Actor") ) {
- // GEOM actor
- return (1-(anActor->GetOpacity()));
- }
- else return (1-anActor->GetProperty()->GetOpacity());
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- return -1;
-}
-
-void VTKViewer_RenderWindowInteractor::SetTransparency(const Handle(SALOME_InteractiveObject)& IObject, float trans) {
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- if ( anActor->IsA("GEOM_Actor") ) {
- // GEOM actor
- anActor->SetOpacity(1-trans);
- }
- else anActor->GetProperty()->SetOpacity(1-trans);
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
+
+void VTKViewer_RenderWindowInteractor::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject, float theTrans)
+{
+ float anOpacity = 1.0 - theTrans;
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TSetFunction<SALOME_Actor,float>
+ (&SALOME_Actor::SetOpacity,anOpacity));
}
-void VTKViewer_RenderWindowInteractor::Display( SALOME_Actor* SActor, bool update)
+
+void VTKViewer_RenderWindowInteractor::Display(SALOME_Actor* theActor, bool update)
{
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- aren->AddActor( SActor );
- SActor->SetVisibility( true );
- }
+ GetRenderer()->AddActor(theActor);
+ theActor->SetVisibility(true);
- if (update) {
- Render();
+ if(update)
emit RenderWindowModified();
- }
}
-void VTKViewer_RenderWindowInteractor::Display(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+void VTKViewer_RenderWindowInteractor::Display(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
{
- Standard_Boolean isalreadydisplayed = false;
-
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- anActor->SetVisibility( true );
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- if (update)
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TSetVisibility<SALOME_Actor>(true));
+
+ if(update)
emit RenderWindowModified() ;
}
-void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event) {
-// MESSAGE ( " vtkQGLRenderWindowInteractor::KeyPressed " )
-// if (!QAD_Application::getDesktop()->getActiveComponent().isEmpty()) {
-// QAD_Application::getDesktop()->onKeyPress( event );
-// }
-}
+void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event){}
+
+
+struct THighlightAction{
+ bool myIsHighlight;
+ VTKViewer_InteractorStyleSALOME* myInteractorStyle;
+ THighlightAction(VTKViewer_InteractorStyleSALOME* theInteractorStyle,
+ bool theIsHighlight):
+ myInteractorStyle(theInteractorStyle),
+ myIsHighlight(theIsHighlight)
+ {}
+ void operator()(SALOME_Actor* theActor){
+ if(theActor->GetMapper()){
+ if(theActor->hasHighlight())
+ theActor->highlight(myIsHighlight);
+ else{
+ if(theActor->GetVisibility() && myIsHighlight)
+ myInteractorStyle->HighlightProp(theActor);
+ else if(!myIsHighlight)
+ myInteractorStyle->HighlightProp(NULL);
+ }
+ }
+ }
+};
-bool VTKViewer_RenderWindowInteractor::highlight( const Handle(SALOME_InteractiveObject)& IObject,
+bool VTKViewer_RenderWindowInteractor::highlight( const Handle(SALOME_InteractiveObject)& theIObject,
bool hilight,
bool update)
{
- VTKViewer_InteractorStyleSALOME* aStyle =
- VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- if(!aStyle) return false;
- vtkRendererCollection* aRenColl = this->RenderWindow->GetRenderers();
- aRenColl->InitTraversal();
- while(vtkRenderer* aRen = this->RenderWindow->GetRenderers()->GetNextItem()){
- vtkActorCollection* theActors = aRen->GetActors();
- theActors->InitTraversal();
- while(vtkActor *anAct = theActors->GetNextActor()) {
- if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(anAct)){
- if(anActor->hasIO()){
- if(IObject->isSame(anActor->getIO())){
- if(anActor->GetMapper() == NULL)
- return false;
- //highlight or unhilight actors
- if(anActor->hasHighlight())
- anActor->highlight(hilight);
- else{
- if(anActor->GetVisibility() == 1 && hilight)
- aStyle->HighlightProp(anActor);
- else if(!hilight)
- aStyle->HighlightProp(NULL);
- }
- }
- }
- }
- }
- }
- if(update){
- Render();
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ THighlightAction(myInteractorStyle,hilight));
+
+ if(update)
emit RenderWindowModified();
- }
+
return false;
}
-void VTKViewer_RenderWindowInteractor::Update() {
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
-
- while(!(ac==NULL)) {
- ac->ApplyProperties();
- //VSV: No in VTK: ac->Update();
- ac = theActors->GetNextActor();
- }
- aren->ResetCamera();
- emit RenderWindowModified() ;
+
+struct TUpdateAction{
+ void operator()(vtkActor* theActor){
+ theActor->ApplyProperties();
}
+};
+
+void VTKViewer_RenderWindowInteractor::Update() {
+ vtkRenderer* aRen = GetRenderer();
+
+ using namespace SALOME::VTK;
+ ForEach<vtkActor>(aRen->GetActors(),TUpdateAction());
+
+ aRen->ResetCamera();
+
+ emit RenderWindowModified();
}
-bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
- VTKViewer_InteractorStyleSALOME* aStyle =
- VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
- if(aStyle) aStyle->HighlightProp(NULL);
- vtkRendererCollection* aRenColl = this->RenderWindow->GetRenderers();
- aRenColl->InitTraversal();
- while(vtkRenderer* aRen = this->RenderWindow->GetRenderers()->GetNextItem()){
- vtkActorCollection* theActors = aRen->GetActors();
- if(theActors->IsItemPresent(Point_Actor))
- aRen->RemoveActor(Point_Actor);
- if(theActors->IsItemPresent(Edge_Actor))
- aRen->RemoveActor(Edge_Actor);
- if(theActors->IsItemPresent(Cell_Actor))
- aRen->RemoveActor(Cell_Actor);
-
- theActors->InitTraversal();
- while(vtkActor *anAct = theActors->GetNextActor()) {
- if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(anAct)){
- if(anActor->hasIO()){
- //highlight or unhilight actors
- if(anActor->hasHighlight())
- anActor->highlight(false);
- }
- }
+void VTKViewer_RenderWindowInteractor::unHighlightSubSelection(){
+ myPointActor->SetVisibility(false);
+ myEdgeActor->SetVisibility(false);
+ myCellActor->SetVisibility(false);
+}
+
+
+struct TUnHighlightAllAction{
+ void operator()(SALOME_Actor* theActor){
+ if(theActor->hasIO()){
+ if(theActor->hasHighlight())
+ theActor->highlight(false);
}
}
+};
+
+bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
+ unHighlightSubSelection();
+
+ using namespace SALOME::VTK;
+ ForEach<SALOME_Actor>(GetRenderer()->GetActors(),
+ TUnHighlightAllAction());
+
emit RenderWindowModified() ;
return false;
}
// Color methods
//-----------------
-void VTKViewer_RenderWindowInteractor::SetColor(const Handle(SALOME_InteractiveObject)& IObject,QColor thecolor) {
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- if ( anActor->IsA("GEOM_Actor") ) {
- // GEOM actor
- anActor->SetColor(float(thecolor.red())/255,float(thecolor.green())/255,float(thecolor.blue())/255);
- }
- else {
- anActor->GetProperty()->SetColor(float(thecolor.red())/255,float(thecolor.green())/255,float(thecolor.blue())/255);
- }
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
-}
-
-QColor VTKViewer_RenderWindowInteractor::GetColor(const Handle(SALOME_InteractiveObject)& IObject) {
- vtkRenderer* aren;
- QColor emptycolor(0,0,0);
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- if ( anActor->IsA("GEOM_Actor") ) {
- // GEOM actor
- float r,g,b;
- anActor->GetColor(r,g,b);
- return QColor(int(r*255),int(g*255),int(b*255));
- }
- else {
- float color[3];
- anActor->GetProperty()->GetColor(color);
- return QColor(int(color[0]*255),int(color[1]*255),int(color[2]*255));
- }
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- return emptycolor;
+void VTKViewer_RenderWindowInteractor::SetColor(const Handle(SALOME_InteractiveObject)& theIObject,QColor theColor)
+{
+ float aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.};
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TSetFunction<SALOME_Actor,const float*>
+ (&SALOME_Actor::SetColor,aColor));
}
-
-
-bool VTKViewer_RenderWindowInteractor::isInViewer(const Handle(SALOME_InteractiveObject)& IObject)
+QColor VTKViewer_RenderWindowInteractor::GetColor(const Handle(SALOME_InteractiveObject)& theIObject)
{
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- //MESSAGE ( " VTKViewer_RenderWindowInteractor::isInViewer = TRUE" )
- return true;
- }
- }
- }
- ac = theActors->GetNextActor();
- }
+ using namespace SALOME::VTK;
+ SALOME_Actor* anActor =
+ Find<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject));
+ if(anActor){
+ float r,g,b;
+ anActor->GetColor(r,g,b);
+ return QColor(int(r*255),int(g*255),int(b*255));
}
- //MESSAGE ( " VTKViewer_RenderWindowInteractor::isInViewer = FALSE" )
- return false;
+ return QColor(0,0,0);
}
-bool VTKViewer_RenderWindowInteractor::isVisible(const Handle(SALOME_InteractiveObject)& IObject)
+
+bool VTKViewer_RenderWindowInteractor::isInViewer(const Handle(SALOME_InteractiveObject)& theIObject)
{
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- return anActor->GetVisibility();
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- return false;
+ using namespace SALOME::VTK;
+ SALOME_Actor* anActor =
+ Find<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject));
+ return anActor != NULL;
}
-void VTKViewer_RenderWindowInteractor::rename(const Handle(SALOME_InteractiveObject)& IObject, QString newName)
+
+bool VTKViewer_RenderWindowInteractor::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
{
- vtkRenderer* aren;
- for (this->RenderWindow->GetRenderers()->InitTraversal();
- (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
- vtkActorCollection* theActors = aren->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- if ( IObject->isSame( anActor->getIO() ) ) {
- anActor->setName(strdup(newName));
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
+ using namespace SALOME::VTK;
+ SALOME_Actor* anActor =
+ Find<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject));
+ return anActor != NULL && anActor->GetVisibility();
+}
- emit RenderWindowModified() ;
+
+void VTKViewer_RenderWindowInteractor::rename(const Handle(SALOME_InteractiveObject)& theIObject, QString theName)
+{
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TSetFunction<SALOME_Actor,const char*,QString>
+ (&SALOME_Actor::setName,theName.latin1()));
}
-bool VTKViewer_RenderWindowInteractor::highlight(const Handle(SALOME_InteractiveObject)& IObject,
- const TColStd_MapOfInteger& MapIndex,
- VTKViewer_RenderWindowInteractor::TCreateMapperFun theFun,
- vtkActor *theActor, bool hilight, bool update )
+
+//----------------------------------------------------------------------------
+bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor, VTKViewer_Actor* theActor,
+ TUpdateActor theFun, bool hilight, bool update)
{
- if(MapIndex.Extent() == 0) return false;
- vtkRenderer* aRen = GetRenderer();
- vtkActorCollection* anActorColl = aRen->GetActors();
- if ( anActorColl->IsItemPresent(theActor) != 0 )
- aRen->RemoveActor(theActor);
+ if(theMapIndex.Extent() == 0) return false;
if (hilight) {
- setActorData(IObject, MapIndex, theFun, theActor);
- aRen->AddActor(theActor);
- theActor->VisibilityOn();
+ setActorData(theMapIndex,theMapActor,theActor,theFun);
+ theActor->SetVisibility(true);
}
else {
- theActor->VisibilityOff();
+ theActor->SetVisibility(false);
}
if(update){
return false;
}
-void VTKViewer_RenderWindowInteractor::setActorData(const Handle(SALOME_InteractiveObject)& IObject,
- const TColStd_MapOfInteger& MapIndex,
- VTKViewer_RenderWindowInteractor::TCreateMapperFun theFun,
- vtkActor* theActor)
+void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor *theActor,
+ TUpdateActor theFun)
{
- vtkActorCollection* anActorColl = GetRenderer()->GetActors();
- anActorColl->InitTraversal();
- vtkActor *ac = NULL;
- while ((ac = anActorColl->GetNextActor()) != NULL) {
- if (ac->IsA("SALOME_Actor")){
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(ac);
- if (anActor->hasIO()) {
- if (IObject->isSame(anActor->getIO())) {
- if (vtkPolyData* aSourcePolyData = anActor->GetPolyDataInput()) {
- vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
- (*theFun)(aSourcePolyData,aMapper,MapIndex);
- theActor->SetMapper(aMapper);
- aMapper->Delete();
- break;
- }
- }
- }
- }
- }
+ (*theFun)(theMapIndex,theMapActor,theActor);
}
-static void CellCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper,
- const TColStd_MapOfInteger& theMapIndex)
+//----------------------------------------------------------------------------
+static void CellsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor)
{
- vtkPolyData* aPolyData = vtkPolyData::New();
- aPolyData->Allocate();
-
- vtkIdList *ptIds = vtkIdList::New();
- ptIds->Allocate(theSourcePolyData->GetMaxCellSize());
- // vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
- aPolyData->SetPoints(theSourcePolyData->GetPoints());
- TColStd_MapIteratorOfMapOfInteger ite(theMapIndex);
- int aNbOfParts = theSourcePolyData->GetNumberOfCells();
- for(; ite.More(); ite.Next()){
- int aPartId = ite.Key();
- if(0 > aPartId || aPartId >= aNbOfParts) break;
- theSourcePolyData->GetCellPoints(aPartId,ptIds);
- vtkCell* aCell = theSourcePolyData->GetCell(aPartId);
- aPolyData->InsertNextCell(aCell->GetCellType(),ptIds);
- for (int i = 0, iEnd = aCell->GetNumberOfEdges(); i < iEnd; i++){
- vtkCell* anEdgeCell = aCell->GetEdge(i);
- aPolyData->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
- }
- }
- ptIds->Delete();
- theMapper->SetInput(aPolyData);
- aPolyData->Delete();
+ theActor->MapCells(theMapActor,theMapIndex);
}
-bool VTKViewer_RenderWindowInteractor::highlightCell(const Handle(SALOME_InteractiveObject)& IObject,
+bool VTKViewer_RenderWindowInteractor::highlightCell(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
bool hilight,
- const TColStd_MapOfInteger& MapIndex,
- bool update )
-{
- return highlight(IObject,MapIndex,&CellCreateMapper,Cell_Actor,hilight,update);
-}
-
-void VTKViewer_RenderWindowInteractor::setCellData(const Handle(SALOME_InteractiveObject)& IObject,
- const int& theIndex, vtkActor* theActor )
+ bool update)
{
- TColStd_MapOfInteger MapIndex; MapIndex.Add(theIndex);
- return setActorData(IObject,MapIndex,&CellCreateMapper,theActor);
+ return highlight(theMapIndex,theMapActor,myCellActor,&CellsUpdateActor,hilight,update);
}
-void VTKViewer_RenderWindowInteractor::setCellData(const Handle(SALOME_InteractiveObject)& IObject,
- const std::vector<int>& theIndexes, vtkActor* theActor )
+void VTKViewer_RenderWindowInteractor::setCellData(const int& theIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor)
{
- TColStd_MapOfInteger MapIndex;
- std::vector<int>::const_iterator it;
- for (it = theIndexes.begin(); it != theIndexes.end(); ++it)
- MapIndex.Add(*it);
- return setActorData(IObject,MapIndex,&CellCreateMapper,theActor);
+ TColStd_IndexedMapOfInteger MapIndex;
+ MapIndex.Add(theIndex);
+ theActor->MapCells(theMapActor,MapIndex);
}
-static void PointCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper,
- const TColStd_MapOfInteger& theMapIndex)
+//----------------------------------------------------------------------------
+static void PointsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor)
{
- vtkPolyData* aPolyData = vtkPolyData::New();
- aPolyData->Allocate();
-
- vtkPoints *aPoints = vtkPoints::New();
- vtkMaskPoints* aMaskPoints = vtkMaskPoints::New();
- TColStd_MapIteratorOfMapOfInteger ite(theMapIndex);
- aPoints->SetNumberOfPoints(theMapIndex.Extent());
- int aNbOfParts = theSourcePolyData->GetNumberOfPoints();
- for(int i = 0; ite.More(); ite.Next(),i++){
- int aPartId = ite.Key();
- if(0 > aPartId || aPartId >= aNbOfParts) break;
- aPoints->SetPoint(i,theSourcePolyData->GetPoint(aPartId));
- }
- aPolyData->SetPoints(aPoints);
- aPoints->Delete();
- aMaskPoints->SetInput(aPolyData);
- aMaskPoints->SetGenerateVertices(1);
- aMaskPoints->SetOnRatio(1);
- theMapper->SetInput(aMaskPoints->GetOutput());
- aMaskPoints->Delete();
+ theActor->MapPoints(theMapActor,theMapIndex);
}
-bool VTKViewer_RenderWindowInteractor::highlightPoint(const Handle(SALOME_InteractiveObject)& IObject,
- bool hilight, const TColStd_MapOfInteger& MapIndex,
+bool VTKViewer_RenderWindowInteractor::highlightPoint(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ bool hilight,
bool update)
{
- return highlight(IObject,MapIndex,&PointCreateMapper,Point_Actor,hilight,update);
+ return highlight(theMapIndex,theMapActor,myPointActor,&PointsUpdateActor,hilight,update);
}
-
-void VTKViewer_RenderWindowInteractor::setPointData(const Handle(SALOME_InteractiveObject)& IObject,
- const int& theIndex, vtkActor* theActor )
+void VTKViewer_RenderWindowInteractor::setPointData(const int& theIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor)
{
- TColStd_MapOfInteger MapIndex; MapIndex.Add(theIndex);
- return setActorData(IObject,MapIndex,&PointCreateMapper,theActor);
+ TColStd_IndexedMapOfInteger MapIndex;
+ MapIndex.Add(theIndex);
+ theActor->MapPoints(theMapActor,MapIndex);
}
-static void EdgeCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper,
- const TColStd_MapOfInteger& theMapIndex)
+//----------------------------------------------------------------------------
+static void EdgesUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor)
{
- vtkPolyData* aPolyData = vtkPolyData::New();
- aPolyData->Allocate();
-
- vtkIdList *ptIds = vtkIdList::New();
- ptIds->Allocate(theSourcePolyData->GetMaxCellSize());
- vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
- aPolyData->SetPoints(theSourcePolyData->GetPoints());
- int aCellId = -1, aCellCounter = 0;
- for(TColStd_MapIteratorOfMapOfInteger ite(theMapIndex); ite.More(); ite.Next()){
- if(ite.Key() > 0){
- aCellId = ite.Key();
- aCellCounter++;
- }
- }
- if(aCellCounter == 1){
- vtkCell* aCell = theSourcePolyData->GetCell(aCellId);
- if(aCell->GetCellType() <= VTK_LINE){
- aPolyData->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- }else{
- TColStd_MapIteratorOfMapOfInteger ite(theMapIndex);
- int aNbOfParts = aCell->GetNumberOfEdges();
- for(; ite.More(); ite.Next()){
- if(ite.Key() < 0){
- int aPartId = -ite.Key()-1;
- if(0 > aPartId || aPartId >= aNbOfParts) break;
- vtkCell* anEdgeCell = aCell->GetEdge(aPartId);
- aPolyData->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
- }
- }
- }
- }else{
- int aNbOfParts = theSourcePolyData->GetNumberOfCells();
- for(TColStd_MapIteratorOfMapOfInteger ite(theMapIndex); ite.More(); ite.Next()){
- if(ite.Key() > 0){
- int aPartId = ite.Key();
- if(0 > aPartId || aPartId >= aNbOfParts) break;
- vtkCell* aCell = theSourcePolyData->GetCell(aPartId);
- aPolyData->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- }
- }
- }
- ptIds->Delete();
- theMapper->SetInput(aPolyData);
- aPolyData->Delete();
+ theActor->MapEdge(theMapActor,theMapIndex);
}
-
-bool VTKViewer_RenderWindowInteractor::highlightEdge( const Handle(SALOME_InteractiveObject)& IObject,
- bool hilight,
- const TColStd_MapOfInteger& MapIndex,
- bool update )
+bool VTKViewer_RenderWindowInteractor::highlightEdge(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ bool hilight,
+ bool update)
{
- return highlight(IObject,MapIndex,&EdgeCreateMapper,Edge_Actor,hilight,update);
+ return highlight(theMapIndex,theMapActor,myEdgeActor,&EdgesUpdateActor,hilight,update);
}
-void VTKViewer_RenderWindowInteractor::setEdgeData(const Handle(SALOME_InteractiveObject)& IObject,
- const int& theCellIndex, const int& theEdgeIndex,
- vtkActor* theActor )
+void VTKViewer_RenderWindowInteractor::setEdgeData(const int& theCellIndex,
+ SALOME_Actor* theMapActor,
+ const int& theEdgeIndex,
+ VTKViewer_Actor* theActor )
{
- TColStd_MapOfInteger MapIndex; MapIndex.Add(theCellIndex); MapIndex.Add(theEdgeIndex);
- return setActorData(IObject,MapIndex,&EdgeCreateMapper,theActor);
+ TColStd_IndexedMapOfInteger MapIndex;
+ MapIndex.Add(theCellIndex);
+ MapIndex.Add(theEdgeIndex);
+ theActor->MapEdge(theMapActor,MapIndex);
}
// now we define the C++ class
#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_Actor.h"
#include "SALOME_Selection.h"
// QT Includes
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-class vtkPolyData;
-class vtkPolyDataMapper;
+class vtkPicker;
+class vtkCellPicker;
+class vtkPointPicker;
+class vtkActorCollection;
+class SALOME_Actor;
+class VTKViewer_Actor;
+class VTKViewer_ViewFrame;
class VTKViewer_RenderWindow;
class VTKViewer_InteractorStyleSALOME;
class VTK_EXPORT VTKViewer_RenderWindowInteractor :
public QObject, public vtkRenderWindowInteractor
{
- Q_OBJECT
+ Q_OBJECT ;
+ friend class VTKViewer_ViewFrame;
public:
static VTKViewer_RenderWindowInteractor *New() ;
//virtual void EndPickCallback();
/* Selection Management */
- bool highlightCell(const Handle(SALOME_InteractiveObject)& IObject, bool hilight,
- const TColStd_MapOfInteger& MapIndex, bool immediatly = true );
- bool highlightEdge(const Handle(SALOME_InteractiveObject)& IObject, bool hilight,
- const TColStd_MapOfInteger& MapIndex, bool immediatly = true ); //NB
- bool highlightPoint(const Handle(SALOME_InteractiveObject)& IObject, bool hilight,
- const TColStd_MapOfInteger& MapIndex, bool immediatly = true );
+ bool highlightCell(const TColStd_IndexedMapOfInteger& MapIndex,
+ SALOME_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
+ bool highlightEdge(const TColStd_IndexedMapOfInteger& MapIndex,
+ SALOME_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
+ bool highlightPoint(const TColStd_IndexedMapOfInteger& MapIndex,
+ SALOME_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
bool highlight(const Handle(SALOME_InteractiveObject)& IObject, bool hiligth, bool immediatly = true );
+ void unHighlightSubSelection();
bool unHighlightAll();
+
bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject);
bool isVisible( const Handle(SALOME_InteractiveObject)& IObject);
void rename(const Handle(SALOME_InteractiveObject)& IObject, QString newName);
const double& theBlue = 0, const int& theWidth = 5);
void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001);
- void setCellData(const Handle(SALOME_InteractiveObject)& IObject,
- const int& theIndex, vtkActor* theActor );
- void setCellData(const Handle(SALOME_InteractiveObject)& IObject,
- const std::vector<int>& theIndexes, vtkActor* theActor );
- void setEdgeData(const Handle(SALOME_InteractiveObject)& IObject,
- const int& theCellIndex, const int& theEdgeIndex,
- vtkActor* theActor ); //NB
- void setPointData(const Handle(SALOME_InteractiveObject)& IObject,
- const int& theIndex, vtkActor* theActor );
-
// Displaymode management
int GetDisplayMode();
void SetDisplayMode(int);
// Switch representation wireframe/shading
- void SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject, bool update = true);
+ void SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject, int theMode);
// Change all actors to wireframe or surface
void ChangeRepresentationToWireframe();
vtkRenderer* GetRenderer();
- QWidget* getGUIWindow() {return myGUIWindow;}
- void setGUIWindow(QWidget* theWin) {myGUIWindow = theWin;}
+ void setGUIWindow(QWidget* theWindow);
+
+ void setViewFrame(VTKViewer_ViewFrame* ViewFrame);
- typedef void (*TCreateMapperFun)(vtkPolyData *theSourcePolyData,
- vtkPolyDataMapper* theMapper,
- const TColStd_MapOfInteger& theMapIndex);
+ void setCellData(const int& theIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor);
+ void setEdgeData(const int& theCellIndex,
+ SALOME_Actor* theMapActor,
+ const int& theEdgeIndex,
+ VTKViewer_Actor* theActor ); //NB
+ void setPointData(const int& theIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor);
+
+ typedef void (*TUpdateActor)(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor* theActor);
protected:
VTKViewer_RenderWindowInteractor();
VTKViewer_InteractorStyleSALOME* myInteractorStyle;
- bool highlight(const Handle(SALOME_InteractiveObject)& IObject,
- const TColStd_MapOfInteger& MapIndex, TCreateMapperFun theFun,
- vtkActor *theActor, bool hilight, bool update );
- void setActorData(const Handle(SALOME_InteractiveObject)& IObject,
- const TColStd_MapOfInteger& MapIndex, TCreateMapperFun theFun,
- vtkActor *theActor );
-
+ bool highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor, VTKViewer_Actor* theActor,
+ TUpdateActor theFun, bool hilight, bool update);
+ void setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
+ SALOME_Actor* theMapActor,
+ VTKViewer_Actor *theActor,
+ TUpdateActor theFun);
+
// Timer used during various mouse events to figure
// out mouse movements.
QTimer *mTimer ;
- //CAI: Display mode
- int displaymode;
+ int myDisplayMode;
//NRI: Selection mode
- Selection_Mode selectionmode;
- vtkActor* Point_Actor;
- vtkActor* Edge_Actor; //NB
- vtkActor* Cell_Actor;
+ VTKViewer_Actor* myPointActor;
+ VTKViewer_Actor* myEdgeActor;
+ VTKViewer_Actor* myCellActor;
+ void MoveInternalActors();
+
+ vtkPicker* myBasicPicker;
+ vtkCellPicker* myCellPicker;
+ vtkPointPicker* myPointPicker;
// User for switching to stereo mode.
int PositionBeforeStereo[2];
void RenderWindowModified() ;
private:
- QWidget* myGUIWindow;
- double myTolNodes;
- double myTolItems;
+ VTKViewer_ViewFrame* myViewFrame;
+ QWidget* myGUIWindow;
+ double myTolNodes;
+ double myTolItems;
};
#endif
//==============================================================================
-class VTKViewer_UnScaledActor: public vtkFollower{
- VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
-
-public:
- vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
- static VTKViewer_UnScaledActor *New();
-
- virtual void SetSize(int theSize);
- virtual void Render(vtkRenderer *theRenderer);
-
-protected:
- VTKViewer_UnScaledActor();
- ~VTKViewer_UnScaledActor(){}
- int mySize;
-};
-
vtkStandardNewMacro(VTKViewer_UnScaledActor);
VTKViewer_UnScaledActor::VTKViewer_UnScaledActor(){}
//==============================================================================
-class VTKViewer_LineActor: public vtkFollower{
- VTKViewer_LineActor(const VTKViewer_LineActor&);
-
-public:
- vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
- static VTKViewer_LineActor *New();
-
- void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
- void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor);
- virtual void Render(vtkRenderer *theRenderer);
-
-protected:
- VTKViewer_LineActor(){
- LabelActor = NULL;
- ArrowActor = NULL;
- }
- ~VTKViewer_LineActor(){
- SetLabelActor(NULL);
- SetArrowActor(NULL);
- }
-
- VTKViewer_UnScaledActor* LabelActor;
- VTKViewer_UnScaledActor* ArrowActor;
-};
-
vtkStandardNewMacro(VTKViewer_LineActor);
vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor);
}
//==============================================================================
-
// The base class for concreate Axis
// Its only duty is to give correct initialization and destruction
// of its pipe-lines
-class VTKViewer_Axis : public vtkObject{
-protected:
- VTKViewer_Axis();
- VTKViewer_Axis(const VTKViewer_Axis&);
- virtual ~VTKViewer_Axis();
- public:
- vtkTypeMacro(VTKViewer_Axis,vtkObject);
-
- virtual void AddToRender(vtkRenderer* theRenderer){
- //Order of the calls are important
- theRenderer->AddActor(myLineActor);
- theRenderer->AddActor(myLabelActor);
- theRenderer->AddActor(myArrowActor);
- }
-
- virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
- virtual VTKViewer_Trihedron::TVisibility GetVisibility() {
- return myVisibility;
- }
-
- virtual void SetCamera(vtkCamera* theCamera){
- myLabelActor->SetCamera(theCamera);
- }
-
- virtual void SetProperty(vtkProperty* theProperty){
- myLabelActor->SetProperty(theProperty);
- myArrowActor->SetProperty(theProperty);
- myLineActor->SetProperty(theProperty);
- }
-
- virtual void SetSize(float theSize);
-
- virtual VTKViewer_UnScaledActor* GetLabel(){
- return myLabelActor;
- }
-
- virtual VTKViewer_UnScaledActor* GetArrow(){
- return myArrowActor;
- }
-
-protected:
- VTKViewer_Trihedron::TVisibility myVisibility;
- float myDir[3], myRot[3];
-
- VTKViewer_LineActor *myLineActor;
- //vtkActor *myLineActor;
- VTKViewer_UnScaledActor *myArrowActor;
- VTKViewer_UnScaledActor *myLabelActor;
-
- vtkPolyDataMapper *myMapper[3];
- vtkLineSource *myLineSource;
- vtkConeSource *myConeSource;
- VTKViewer_VectorText* myVectorText;
-};
VTKViewer_Axis::VTKViewer_Axis(){
+
// Initialize the Line pipe-line representation
myLineSource = vtkLineSource::New();
- myLineSource->SetPoint1(0.0,0.0,0.0);
+ myLineSource->SetPoint1( 0, 0, 0 );
myMapper[0] = vtkPolyDataMapper::New();
myMapper[0]->SetInput(myLineSource->GetOutput());
// Destroy of the Arrow pipe-line representation
myLineActor->Delete();
- myMapper[2]->RemoveAllInputs();
- myMapper[2]->Delete();
+ myMapper[0]->RemoveAllInputs();
+ myMapper[0]->Delete();
myLineSource->Delete();
}
myLabelActor->AddPosition(aPosition);
}
+void VTKViewer_Axis::AddToRender( vtkRenderer* theRenderer )
+{
+ //Order of the calls are important
+ theRenderer->AddActor( myLineActor );
+ theRenderer->AddActor( myLabelActor );
+ theRenderer->AddActor( myArrowActor );
+}
+
+void VTKViewer_Axis::SetCamera( vtkCamera* theCamera )
+{
+ myLabelActor->SetCamera(theCamera);
+}
+
+void VTKViewer_Axis::SetProperty( vtkProperty* theProperty )
+{
+ myLabelActor->SetProperty(theProperty);
+ myArrowActor->SetProperty(theProperty);
+ myLineActor->SetProperty(theProperty);
+ }
+
//==============================================================================
class VTKViewer_XAxis : public VTKViewer_Axis{
protected:
#define VTKViewer_Trihedron_H
#include <vtkObject.h>
+#include <vtkFollower.h>
class vtkActorCollection;
class VTKViewer_Axis;
class vtkRenderer;
+class vtkPolyDataMapper;
+class vtkLineSource;
+class vtkConeSource;
+class VTKViewer_VectorText;
+class vtkCamera;
+class vtkProperty;
+
+//==============================================================================
+
+class VTKViewer_UnScaledActor: public vtkFollower{
+ VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
+
+public:
+ vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
+ static VTKViewer_UnScaledActor *New();
+
+ virtual void SetSize(int theSize);
+ virtual void Render(vtkRenderer *theRenderer);
+
+protected:
+ VTKViewer_UnScaledActor();
+ ~VTKViewer_UnScaledActor(){}
+ int mySize;
+};
+
+//==============================================================================
+
+class VTKViewer_LineActor: public vtkFollower{
+ VTKViewer_LineActor(const VTKViewer_LineActor&);
+
+public:
+ vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
+ static VTKViewer_LineActor *New();
+
+ void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
+ void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor);
+ virtual void Render(vtkRenderer *theRenderer);
+
+protected:
+ VTKViewer_LineActor(){
+ LabelActor = NULL;
+ ArrowActor = NULL;
+ }
+ ~VTKViewer_LineActor(){
+ SetLabelActor(NULL);
+ SetArrowActor(NULL);
+ }
+
+ VTKViewer_UnScaledActor* LabelActor;
+ VTKViewer_UnScaledActor* ArrowActor;
+};
+
+//================================================
class VTKViewer_Trihedron : public vtkObject{
protected:
float mySize;
};
+//==============================================================================
+// The base class for concreate Axis
+// Its only duty is to give correct initialization and destruction
+// of its pipe-lines
+class VTKViewer_Axis : public vtkObject{
+protected:
+ VTKViewer_Axis();
+ VTKViewer_Axis(const VTKViewer_Axis&);
+ virtual ~VTKViewer_Axis();
+ public:
+ vtkTypeMacro(VTKViewer_Axis,vtkObject);
+
+ virtual void AddToRender(vtkRenderer* theRenderer);
+
+ virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
+ virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; }
+
+ virtual void SetCamera(vtkCamera* theCamera);
+ virtual void SetProperty(vtkProperty* theProperty);
+ virtual void SetSize(float theSize);
+
+ virtual VTKViewer_UnScaledActor* GetLabel(){ return myLabelActor; }
+ virtual VTKViewer_UnScaledActor* GetArrow(){ return myArrowActor; }
+
+protected:
+ VTKViewer_Trihedron::TVisibility myVisibility;
+ float myDir[3], myRot[3];
+
+ VTKViewer_LineActor *myLineActor;
+ //vtkActor *myLineActor;
+ VTKViewer_UnScaledActor *myArrowActor;
+ VTKViewer_UnScaledActor *myLabelActor;
+
+ vtkPolyDataMapper *myMapper[3];
+ vtkLineSource *myLineSource;
+ vtkConeSource *myConeSource;
+ VTKViewer_VectorText* myVectorText;
+};
+
#endif
#include "VTKViewer_Utilities.h"
#include "VTKViewer_Trihedron.h"
#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_RenderWindowInteractor.h"
#include "VTKViewer_InteractorStyleSALOME.h"
+#include "VTKViewer_Algorithm.h"
+#include "VTKViewer_Functor.h"
+#include "VTKViewer_Prs.h"
+#include "SALOME_Actor.h"
#include "SALOME_Transform.h"
#include "SALOME_TransformFilter.h"
#include "SALOME_GeometryFilter.h"
// VTK Includes
#include <vtkActor.h>
+#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkTransform.h>
+#include <vtkActorCollection.h>
+
+#include <TColStd_IndexedMapOfInteger.hxx>
using namespace std;
// Create an interactor.
m_RWInteractor = VTKViewer_RenderWindowInteractor::New();
- m_RWInteractor->setGUIWindow(m_RW);
m_RWInteractor->SetRenderWindow(m_RW->getRenderWindow());
VTKViewer_InteractorStyleSALOME* RWS = VTKViewer_InteractorStyleSALOME::New();
- RWS->setGUIWindow(m_RW);
m_RWInteractor->SetInteractorStyle(RWS);
+ RWS->Delete();
+
+ m_RWInteractor->setGUIWindow(m_RW);
+ RWS->setGUIWindow(m_RW);
m_RWInteractor->Initialize();
+ m_RWInteractor->setViewFrame(this);
RWS->setTriedron(m_Triedron);
+ RWS->setViewFrame(this);
//SRN: additional initialization, to init CurrentRenderer of vtkInteractorStyle
RWS->FindPokedRenderer(0, 0);
}
VTKViewer_ViewFrame::~VTKViewer_ViewFrame() {
- m_Transform->Delete() ;
// In order to ensure that the interactor unregisters
// this RenderWindow, we assign a NULL RenderWindow to
// it before deleting it.
m_RWInteractor->SetRenderWindow(NULL) ;
m_RWInteractor->Delete() ;
+ m_Transform->Delete() ;
//m_RW->Delete() ;
m_Renderer->RemoveAllProps();
// NRI : BugID 1137: m_Renderer->Delete() ;
m_Triedron->Delete();
- MESSAGE("VTKViewer_ViewFrame::~VTKViewer_ViewFrame()");
+ INFOS("VTKViewer_ViewFrame::~VTKViewer_ViewFrame()");
}
/*!
return m_Triedron->GetVisibility() == VTKViewer_Trihedron::eOn;
}
-void VTKViewer_ViewFrame::onAdjustTrihedron(){
- if(!isTrihedronDisplayed())
+bool VTKViewer_ViewFrame::ComputeTrihedronSize( double& theNewSize, double& theSize )
+{
+ // calculating diagonal of visible props of the renderer
+ float bnd[ 6 ];
+ m_Triedron->VisibilityOff();
+ if ( ::ComputeVisiblePropBounds( m_Renderer, bnd ) == 0 )
+ {
+ bnd[ 1 ] = bnd[ 3 ] = bnd[ 5 ] = 100;
+ bnd[ 0 ] = bnd[ 2 ] = bnd[ 100 ] = 0;
+ }
+ m_Triedron->VisibilityOn();
+ float aLength = 0;
+ static bool CalcByDiag = false;
+ if ( CalcByDiag )
+ {
+ aLength = sqrt( ( bnd[1]-bnd[0])*(bnd[1]-bnd[0] )+
+ ( bnd[3]-bnd[2])*(bnd[3]-bnd[2] )+
+ ( bnd[5]-bnd[4])*(bnd[5]-bnd[4] ) );
+ }
+ else
+ {
+ aLength = bnd[ 1 ]-bnd[ 0 ];
+ aLength = max( ( bnd[ 3 ] - bnd[ 2 ] ),aLength );
+ aLength = max( ( bnd[ 5 ] - bnd[ 4 ] ),aLength );
+ }
+
+ static float aSizeInPercents = 105;
+ QString aSetting = QAD_CONFIG->getSetting( "Viewer:TrihedronSize" );
+ if ( !aSetting.isEmpty() )
+ aSizeInPercents = aSetting.toFloat();
+
+ static float EPS_SIZE = 5.0E-3;
+ theSize = m_Triedron->GetSize();
+ theNewSize = aLength * aSizeInPercents / 100.0;
+
+ // if the new trihedron size have sufficient difference, then apply the value
+ return fabs( theNewSize - theSize) > theSize * EPS_SIZE ||
+ fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE;
+}
+
+double VTKViewer_ViewFrame::GetTrihedronSize() const
+{
+ return m_Triedron->GetSize();
+}
+
+void VTKViewer_ViewFrame::AdjustTrihedrons( const bool forcedUpdate )
+{
+ if ( !isTrihedronDisplayed() && !forcedUpdate )
return;
- int aVisibleNum = m_Triedron->GetVisibleActorCount(m_Renderer);
- if(aVisibleNum){
- // calculating diagonal of visible props of the renderer
- float bnd[6];
- m_Triedron->VisibilityOff();
- ::ComputeVisiblePropBounds(m_Renderer,bnd);
- m_Triedron->VisibilityOn();
- float aLength = 0;
- static bool CalcByDiag = false;
- if(CalcByDiag){
- aLength = sqrt((bnd[1]-bnd[0])*(bnd[1]-bnd[0])+
- (bnd[3]-bnd[2])*(bnd[3]-bnd[2])+
- (bnd[5]-bnd[4])*(bnd[5]-bnd[4]));
- }else{
- aLength = bnd[1]-bnd[0];
- aLength = max((bnd[3]-bnd[2]),aLength);
- aLength = max((bnd[5]-bnd[4]),aLength);
- }
-
- static float aSizeInPercents = 105;
- QString aSetting = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
- if(!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat();
-
- static float EPS_SIZE = 5.0E-3;
- float aSize = m_Triedron->GetSize();
- float aNewSize = aLength*aSizeInPercents/100.0;
+
+ int aVisibleNum = m_Triedron->GetVisibleActorCount( m_Renderer );
+ if ( aVisibleNum || forcedUpdate )
+ {
// if the new trihedron size have sufficient difference, then apply the value
- if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE){
- m_Triedron->SetSize(aNewSize);
+ double aNewSize = 100, anOldSize;
+ if ( ComputeTrihedronSize( aNewSize, anOldSize ) || forcedUpdate )
+ {
+ m_Triedron->SetSize( aNewSize );
+ // itearte throuh displayed objects and set size if necessary
+
+ vtkActorCollection* anActors = getRenderer()->GetActors();
+ anActors->InitTraversal();
+ while( vtkActor* anActor = anActors->GetNextActor() )
+ {
+ if( SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast( anActor ) )
+ {
+ if ( aSActor->IsResizable() )
+ aSActor->SetSize( 0.5 * aNewSize );
+ }
+ }
}
}
+
::ResetCameraClippingRange(m_Renderer);
}
+void VTKViewer_ViewFrame::onAdjustTrihedron()
+{
+ AdjustTrihedrons( false );
+}
+
/*!
Display/hide Trihedron
*/
*/
void VTKViewer_ViewFrame::onViewLeft(){
vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(0,1,0);
+ camera->SetPosition(0,-1,0);
camera->SetViewUp(0,0,1);
camera->SetFocalPoint(0,0,0);
onViewFitAll();
*/
void VTKViewer_ViewFrame::onViewRight(){
vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(0,-1,0);
+ camera->SetPosition(0,1,0);
camera->SetViewUp(0,0,1);
camera->SetFocalPoint(0,0,0);
onViewFitAll();
*/
void VTKViewer_ViewFrame::onViewFitAll(){
m_RWInteractor->GetInteractorStyleSALOME()->ViewFitAll();
-// int aTriedronWasVisible = isTrihedronDisplayed();
-// if(m_Triedron->GetVisibleActorCount(m_Renderer)){
-// m_Triedron->VisibilityOff();
-// ::ResetCamera(m_Renderer);
-// }else{
-// m_Triedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
-// ::ResetCamera(m_Renderer,true);
-// }
-// if(aTriedronWasVisible) m_Triedron->VisibilityOn();
-// else m_Triedron->VisibilityOff();
-
Repaint();
}
SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
m_RWInteractor->highlight(IObject, highlight, update);
- switch (Sel->SelectionMode()) {
- case NodeSelection:
- if ( Sel->HasIndex( IObject ) ) {
- TColStd_MapOfInteger MapIndex;
- Sel->GetIndex( IObject, MapIndex );
- m_RWInteractor->highlightPoint(IObject, highlight, MapIndex, update);
- }
- break;
- case EdgeOfCellSelection:
- if ( Sel->HasIndex( IObject ) ) {
- TColStd_MapOfInteger MapIndex;
- Sel->GetIndex( IObject, MapIndex );
- m_RWInteractor->highlightEdge(IObject, highlight, MapIndex, update);
- }
- break;
- case CellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- if ( Sel->HasIndex( IObject ) ) {
- TColStd_MapOfInteger MapIndex;
- Sel->GetIndex( IObject, MapIndex );
- m_RWInteractor->highlightCell(IObject, highlight, MapIndex, update);
+ if(Sel->HasIndex(IObject) && IObject->hasEntry()){
+ TColStd_IndexedMapOfInteger MapIndex;
+ Sel->GetIndex(IObject,MapIndex);
+ using namespace SALOME::VTK;
+ const char* anEntry = IObject->getEntry();
+ vtkActorCollection* aCollection = getRenderer()->GetActors();
+ if(SALOME_Actor* anActor = Find<SALOME_Actor>(aCollection,TIsSameEntry<SALOME_Actor>(anEntry))){
+ switch (Sel->SelectionMode()) {
+ case NodeSelection:
+ m_RWInteractor->highlightPoint(MapIndex,anActor,highlight,update);
+ break;
+ case EdgeOfCellSelection:
+ m_RWInteractor->highlightEdge(MapIndex,anActor,highlight,update);
+ break;
+ case CellSelection:
+ case EdgeSelection:
+ case FaceSelection:
+ case VolumeSelection:
+ m_RWInteractor->highlightCell(MapIndex,anActor,highlight,update);
+ break;
+ }
}
- break;
+ }else{
+ m_RWInteractor->unHighlightSubSelection();
}
}
m_RW->setPopupServer( App );
}
-void VTKViewer_ViewFrame::undo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry)
+/* selection */
+Handle(SALOME_InteractiveObject) VTKViewer_ViewFrame::FindIObject(const char* theEntry)
{
- vtkActorCollection* theActors = m_Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = anActor->getIO();
- if ( IO->hasEntry() ) {
- /*if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry)) {
- m_RWInteractor->Erase(IO);
- }*/
- }
- }
- }
- ac = theActors->GetNextActor();
- }
+ using namespace SALOME::VTK;
+ SALOME_Actor* anActor =
+ Find<SALOME_Actor>(getRenderer()->GetActors(),
+ TIsSameEntry<SALOME_Actor>(theEntry));
+ if(anActor)
+ return anActor->getIO();
+
+ return Handle(SALOME_InteractiveObject)();
}
-void VTKViewer_ViewFrame::redo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry)
+/* display */
+void VTKViewer_ViewFrame::Display(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
{
- SALOMEDS::SObject_var RefSO;
- SALOMEDS::SObject_var SO = aStudy->FindObjectID( StudyFrameEntry );
- SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
- for (; it->More();it->Next()){
- SALOMEDS::SObject_var CSO= it->Value();
- if (CSO->ReferencedObject(RefSO)) {
- vtkActorCollection* theActors = m_Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = anActor->getIO();
- if ( IO->hasEntry() ) {
- /*if ( strcmp(IO->getEntry(),RefSO->GetID()) == 0 )
- m_RWInteractor->Display(IO);*/
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- }
- }
+ QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
+ SALOME_Selection* aSel = SALOME_Selection::Selection(aStudy->getSelection());
+
+ m_RWInteractor->Display(theIObject,false);
+ aSel->AddIObject(theIObject,false);
+
+ if(update)
+ Repaint();
}
-/* selection */
-Handle(SALOME_InteractiveObject) VTKViewer_ViewFrame::FindIObject(const char* Entry)
-{
- Handle(SALOME_InteractiveObject) IO;
- vtkActorCollection* theActors = m_Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- IO = anActor->getIO();
- if ( IO->hasEntry() ) {
- if ( strcmp( IO->getEntry(), Entry ) == 0 ) {
- return IO;
- }
- }
- }
- }
- ac = theActors->GetNextActor();
+struct TDisplayAction{
+ SALOME_Selection* mySel;
+ Handle(SALOME_InteractiveObject) myIO;
+ TDisplayAction(SALOME_Selection* theSel,
+ Handle(SALOME_InteractiveObject) theIO):
+ mySel(theSel), myIO(theIO)
+ {}
+ void operator()(SALOME_Actor* theActor){
+ theActor->SetVisibility(true);
+ mySel->AddIObject(myIO,false);
}
- return IO;
-}
+};
-/* display */
-void VTKViewer_ViewFrame::Display(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+void VTKViewer_ViewFrame::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject)
{
- QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
-
- vtkActorCollection* theActors = m_Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL))
- {
- if ( ac->IsA("SALOME_Actor") )
- {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() )
- {
- Handle(SALOME_InteractiveObject) IO = anActor->getIO();
- if ( IO->isSame(IObject) )
- {
- m_RWInteractor->Display(IO, false);
- Sel->AddIObject(IO, false);
- break;
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- if (update)
- Repaint();
-}
+ QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
+ SALOME_Selection* aSel = SALOME_Selection::Selection(aStudy->getSelection());
+ aSel->ClearIObjects();
+ m_RWInteractor->EraseAll();
+
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TDisplayAction(aSel,theIObject));
-void VTKViewer_ViewFrame::DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject)
-{
- QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
-
- vtkActorCollection* theActors = m_Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL)) {
- if ( ac->IsA("SALOME_Actor") ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IO = anActor->getIO();
- if ( !IO->isSame(IObject) ) {
- m_RWInteractor->Erase(IO, false);
- Sel->RemoveIObject(IO, false);
- } else {
- anActor->SetVisibility(true);
- Sel->AddIObject(IO, false);
- }
- }
- }
- ac = theActors->GetNextActor();
- }
Repaint();
}
-void VTKViewer_ViewFrame::Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+struct TEraseAction: TDisplayAction{
+ VTKViewer_RenderWindowInteractor* myRWInteractor;
+ TEraseAction(SALOME_Selection* theSel,
+ Handle(SALOME_InteractiveObject) theIO,
+ VTKViewer_RenderWindowInteractor* theRWInteractor):
+ TDisplayAction(theSel,theIO),
+ myRWInteractor(theRWInteractor)
+ {}
+ void operator()(SALOME_Actor* theActor){
+ myRWInteractor->Erase(myIO,false);
+ mySel->RemoveIObject(myIO,false);
+ }
+};
+
+void VTKViewer_ViewFrame::Erase(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
{
- QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel
- = SALOME_Selection::Selection( myStudy->getSelection() );
-
- vtkActorCollection* theActors = m_Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *ac = theActors->GetNextActor();
- while(!(ac==NULL))
- {
- if ( ac->IsA("SALOME_Actor") )
- {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor->hasIO() )
- {
- Handle(SALOME_InteractiveObject) IO = anActor->getIO();
- if ( IO->isSame( IObject ) ) {
- m_RWInteractor->Erase(IO, false);
- Sel->RemoveIObject(IO, false);
- break;
- }
- }
- }
- ac = theActors->GetNextActor();
- }
- if (update)
+ QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
+ SALOME_Selection* aSel = SALOME_Selection::Selection(aStudy->getSelection());
+
+ using namespace SALOME::VTK;
+ ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>(theIObject),
+ TEraseAction(aSel,theIObject,m_RWInteractor));
+
+ if(update)
Repaint();
}
Repaint();
}
-void VTKViewer_ViewFrame::AddActor( SALOME_Actor* theActor, bool update /*=false*/ ){
- theActor->SetVisibility(true);
+void VTKViewer_ViewFrame::InsertActor( SALOME_Actor* theActor, bool theMoveInternalActors ){
theActor->AddToRender(m_Renderer);
theActor->SetTransform(m_Transform);
- if(update) Repaint();
+ if(theMoveInternalActors)
+ m_RWInteractor->MoveInternalActors();
+}
+
+void VTKViewer_ViewFrame::AddActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ ){
+ InsertActor(theActor);
+ if(theUpdate)
+ Repaint();
}
-void VTKViewer_ViewFrame::RemoveActor( SALOME_Actor* theActor, bool update /*=false*/ ){
+void VTKViewer_ViewFrame::RemoveActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ ){
theActor->RemoveFromRender(m_Renderer);
- if(update) Repaint();
+ if(theUpdate)
+ Repaint();
+}
+
+void VTKViewer_ViewFrame::MoveActor(SALOME_Actor* theActor)
+{
+ RemoveActor(theActor);
+ InsertActor(theActor,true);
+}
+
+//==========================================================
+/*!
+ * VTKViewer_ViewFrame::Display
+ * Display presentation
+ */
+//==========================================================
+void VTKViewer_ViewFrame::Display( const SALOME_VTKPrs* prs )
+{
+ // try do downcast object
+ const VTKViewer_Prs* aVTKPrs = dynamic_cast<const VTKViewer_Prs*>( prs );
+ if ( !aVTKPrs || aVTKPrs->IsNull() )
+ return;
+
+ vtkActorCollection* actors = aVTKPrs->GetObjects();
+ if ( !actors )
+ return;
+
+ actors->InitTraversal();
+ vtkActor* actor;
+ while( ( actor = actors->GetNextActor() ) )
+ {
+ SALOME_Actor* salomeActor = SALOME_Actor::SafeDownCast( actor );
+ if ( salomeActor )
+ {
+ // just display the object
+ m_RWInteractor->Display( salomeActor, false );
+ if ( salomeActor->IsSetCamera() )
+ salomeActor->SetCamera( getRenderer()->GetActiveCamera() );
+ }
+ }
+}
+
+//==========================================================
+/*!
+ * VTKViewer_ViewFrame::Erase
+ * Erase presentation
+ */
+//==========================================================
+void VTKViewer_ViewFrame::Erase( const SALOME_VTKPrs* prs, const bool forced )
+{
+ // try do downcast object
+ const VTKViewer_Prs* aVTKPrs = dynamic_cast<const VTKViewer_Prs*>( prs );
+ if ( !aVTKPrs || aVTKPrs->IsNull() )
+ return;
+
+ vtkActorCollection* actors = aVTKPrs->GetObjects();
+ if ( !actors )
+ return;
+
+ actors->InitTraversal();
+ vtkActor* actor;
+ while( ( actor = actors->GetNextActor() ) ) {
+ SALOME_Actor* salomeActor = SALOME_Actor::SafeDownCast( actor );
+ if ( salomeActor ) {
+ // just erase the object
+ m_RWInteractor->Erase( salomeActor, forced );
+ }
+ }
+}
+
+//==========================================================
+/*!
+ * VTKViewer_ViewFrame::CreatePrs
+ * Create presentation by entry
+ */
+//==========================================================
+SALOME_Prs* VTKViewer_ViewFrame::CreatePrs( const char* entry )
+{
+ VTKViewer_Prs* prs = new VTKViewer_Prs();
+ if ( entry ) {
+ vtkActorCollection* theActors = m_Renderer->GetActors();
+ theActors->InitTraversal();
+ vtkActor* ac;
+ while( ( ac = theActors->GetNextActor() ) ) {
+ SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
+ if ( anActor && anActor->hasIO() && !strcmp( anActor->getIO()->getEntry(), entry ) ) {
+ prs->AddObject( ac );
+ }
+ }
+ }
+ return prs;
+}
+
+//==========================================================
+/*!
+ * VTKViewer_ViewFrame::BeforeDisplay
+ * Axiluary method called before displaying of objects
+ */
+//==========================================================
+void VTKViewer_ViewFrame::BeforeDisplay( SALOME_Displayer* d )
+{
+ d->BeforeDisplay( this, SALOME_VTKViewType() );
+}
+
+//==========================================================
+/*!
+ * VTKViewer_ViewFrame::AfterDisplay
+ * Axiluary method called after displaying of objects
+ */
+//==========================================================
+void VTKViewer_ViewFrame::AfterDisplay( SALOME_Displayer* d )
+{
+ d->AfterDisplay( this, SALOME_VTKViewType() );
}
#include "QAD.h"
#include "QAD_ViewFrame.h"
-#include "VTKViewer_RenderWindowInteractor.h"
-#include "VTKViewer_RenderWindow.h"
-
-// VTK Includes
class vtkRenderer;
-class vtkTransform;
+
+class SALOME_Actor;
+class SALOME_Transform;
+
class VTKViewer_Trihedron;
+class VTKViewer_RenderWindow;
+class VTKViewer_RenderWindowInteractor;
+
class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
Q_OBJECT;
bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
- /* undo/redo management */
- void undo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry);
- void redo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry);
-
-
/* selection */
Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
void Repaint(bool theUpdateTrihedron);
void Repaint() { Repaint(true); }
+ /* Reimplemented from SALOME_View */
+ void Display( const SALOME_VTKPrs* );
+ void Erase( const SALOME_VTKPrs*, const bool = false );
+ SALOME_Prs* CreatePrs( const char* entry = 0 );
+ virtual void BeforeDisplay( SALOME_Displayer* d );
+ virtual void AfterDisplay ( SALOME_Displayer* d );
+
//apply existing transformation on adding SALOME_Actor
void SetScale(double theScale[3]);
void GetScale(double theScale[3]);
void AddActor(SALOME_Actor*, bool update = false);
void RemoveActor(SALOME_Actor*, bool update = false);
+ void AdjustTrihedrons( const bool forced );
+ bool ComputeTrihedronSize( double& theNewSize, double& theOldSize );
+ double GetTrihedronSize() const;
public slots:
void onViewPan();
void onViewZoom();
void onAdjustTrihedron();
private:
- double m_ViewUp[3];
- double m_ViewNormal[3];
-
- void InitialSetup();
+ void InitialSetup();
- vtkRenderer* m_Renderer;
- VTKViewer_RenderWindow* m_RW;
+ double m_ViewUp[3];
+ double m_ViewNormal[3];
+
+ vtkRenderer* m_Renderer;
+ VTKViewer_RenderWindow* m_RW;
VTKViewer_RenderWindowInteractor* m_RWInteractor;
- VTKViewer_Trihedron *m_Triedron;
- SALOME_Transform *m_Transform;
+ friend class VTKViewer_RenderWindowInteractor;
+ void InsertActor(SALOME_Actor* theActor, bool theMoveInternalActors = false);
+ void MoveActor(SALOME_Actor* theActor);
+
+ VTKViewer_Trihedron* m_Triedron;
+ SALOME_Transform* m_Transform;
};
#endif