Revision: 40972
http://brlcad.svn.sourceforge.net/brlcad/?rev=40972&view=rev
Author: bob1961
Date: 2010-10-13 14:33:51 +0000 (Wed, 13 Oct 2010)
Log Message:
-----------
Added the appendGlobalData proc for appending data to a specified group within
a specified global attribute. Note - the attribute's value is a nested list of
group specific data. Also added the updateGlobalData proc for similarly
updating a global attribute from current data (i.e. data returned from calls to
data_arrows, data_axes, data_labels or data_lines).
Modified Paths:
--------------
brlcad/trunk/src/tclscripts/archer/DataUtils.tcl
Modified: brlcad/trunk/src/tclscripts/archer/DataUtils.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/DataUtils.tcl 2010-10-13 13:55:01 UTC
(rev 40971)
+++ brlcad/trunk/src/tclscripts/archer/DataUtils.tcl 2010-10-13 14:33:51 UTC
(rev 40972)
@@ -29,16 +29,52 @@
destructor {}
public {
+ proc appendGlobalData {_ged _archer _group _attr_name _data_cmd
_data_subcmd _data _pindex_begin _pindex_end}
proc dataPick {_ged _archer _group
_pdata _data_arrows_name _sdata_arrows_name
_data_axes_name _sdata_axes_name
_data_labels_name _sdata_labels_name
_data_lines_name _sdata_lines_name}
+ proc updateGlobalData {_ged _archer _group _attr_name _data_cmd
_data_subcmd}
}
}
################################### Public Section
###################################
+::itcl::body DataUtils::appendGlobalData {_ged _archer _group _attr_name
_data_cmd _data_subcmd _data _pindex_begin _pindex_end} {
+ if {$_group == ""} {
+ $_archer putString "Please select a group before creating $_attr_name."
+ return
+ }
+
+ if {[catch {$_ged attr get _GLOBAL $_attr_name} dataList]} {
+ set dataList {}
+ }
+
+ set i [lsearch -index 0 $dataList $_group]
+
+ if {$i != -1} {
+ set subDataList [lindex $dataList $i]
+ eval lappend subDataList $_data
+ set dataList [lreplace $dataList $i $i $subDataList]
+ } else {
+ lappend dataList [eval list $_group $_data]
+ set subDataList [lindex $dataList end]
+ }
+
+ set dataList [lsort -index 0 -dictionary $dataList]
+ $_archer attr set _GLOBAL $_attr_name $dataList
+
+ $_ged refresh_off
+ set plist {}
+ foreach item [lrange $subDataList 1 end] {
+ lappend plist [lrange $item $_pindex_begin $_pindex_end]
+ }
+ catch {$_ged $_data_cmd $_data_subcmd $plist} msg
+ $_ged refresh_on
+ $_ged refresh_all
+}
+
::itcl::body DataUtils::dataPick {_ged _archer _group
_pdata _data_arrows_name _sdata_arrows_name
_data_axes_name _sdata_axes_name
@@ -447,6 +483,25 @@
}
}
+::itcl::body DataUtils::updateGlobalData {_ged _archer _group _attr_name
_data_cmd _data_subcmd} {
+ if {[catch {$_ged attr get _GLOBAL $_attr_name} gdl]} {
+ set gdl {}
+ }
+
+ # Get the list for the current group
+ set i [lsearch -index 0 $gdl $_group]
+ if {$i == -1} {
+ # This should never happen
+ return
+ }
+
+ set data [$_ged $_data_cmd $_data_subcmd]
+ set gdl [lreplace $gdl $i $i [eval list $_group $data]]
+ $_ged refresh_off
+ catch {$_archer attr set _GLOBAL $_attr_name $gdl}
+ $_ged refresh_on
+}
+
################################### End Public Section
###################################
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits