GuidoScript scripts/dtmutilities.tcl
global loc1
global object1_id
global trisolation1_id
global loc3
global object2_id
global trisolation2_id
global obj1_name
global obj2_name
global tri1_name
global tri2_name
global nqual
global detailed_report
global elevation_range
global upper_surface_object_name
global upper_surface_trisolation_name
global lower_surface_object_name
global lower_surface_trisolation_name
global nsurf
proc storeOldValOne { location object_id trisolation_id } {
global location_old_val_one
if {![info exists location_old_val_one]} {
set location_old_val_one ""
}
set locCheck [$location getCurrentValue]
if {![info exists location_old_val_one]} {
set location_old_val_one ""
}
if { "$location_old_val_one" != "$locCheck" } {
clearFieldListOne $location $object_id $trisolation_id
}
set location_old_val_one [$location getCurrentValue]
}
proc clearFieldListOne { location object_id trisolation_id }  {
global location_old_val_one
if {![info exists location_old_val_one]} {
set location_old_val_one ""
}
set location_new_val [$location getCurrentValue]
if { "$location_old_val_one" != "$location_new_val" } {
$object_id setExclusive false
$object_id removeAllItems
eval [concat {$object_id} {setValues} 1 ]
$object_id setCurrentValue 1
$trisolation_id setExclusive false
$trisolation_id removeAllItems
eval [concat {$trisolation_id} {setValues} 1 ]
$trisolation_id setCurrentValue 1
}
set location_old_val_one $location_new_val
}
proc storeOldValTwo { location object_id trisolation_id } {
global location_old_val_two
if {![info exists location_old_val_two]} {
set location_old_val_two ""
}
set locCheck [$location getCurrentValue]
if {![info exists location_old_val_two]} {
set location_old_val_two ""
}
if { "$location_old_val_two" != "$locCheck"} {
clearFieldListTwo $location $object_id $trisolation_id
}
set location_old_val_two [$location getCurrentValue]
}
proc clearFieldListTwo { location object_id trisolation_id }  {
global location_old_val_two
if {![info exists location_old_val_two]} {
set location_old_val_two ""
}
set location_new_val [$location getCurrentValue]
if { "$location_old_val_two" != "$location_new_val" } {
$object_id setExclusive false
$object_id removeAllItems
eval [concat {$object_id} {setValues} 1 ]
$object_id setCurrentValue 1
$trisolation_id setExclusive false
$trisolation_id removeAllItems
eval [concat {$trisolation_id} {setValues} 1 ]
$trisolation_id setCurrentValue 1
}
set location_old_val_two $location_new_val
}
proc validateBoundaryString {stringFile stringID} {
set location [$stringFile getCurrentValue]
set stringNumber [$stringID getCurrentValue]
set filename ""
append filename $location ".str"
if {[string length $filename] > 4 } {
set buffer [GuidoExecServer DoesBoundaryStringExist [subst {FileName = "$filename" StrNumber = "$stringNumber"}]]
set status [GuidoGetParamBufferValue $buffer status]
if {$status == -10138} {
return false
}
if {$status == -10027} {
GuidoMessage warning APP_STRNOTFND $stringNumber
return false
}
}
}
proc validateUpperAndLowerSurface {upper lower upperobj uppertrisol lowerobj lowertrisol surfaces} {
set numberOfSurfaces [$surfaces getCurrentValue]
set upperDtm [$upper getCurrentValue]
set lowerDtm [$lower getCurrentValue]
set upperDtmObject [$upperobj getCurrentValue]
set lowerDtmObject [$lowerobj getCurrentValue]
set upperDtmTrisol [$uppertrisol getCurrentValue]
set lowerDtmTrisol [$lowertrisol getCurrentValue]
if { "$numberOfSurfaces" == 2} {
if {"$upperDtm" == "$lowerDtm" && "$upperDtmObject" == "$lowerDtmObject" && "$upperDtmTrisol" == "$lowerDtmTrisol"} {
GuidoMessage warning SELECTED_SAME_OBJECT_TRISOLATION
return false
}
}
}
proc validateRangeClassification {} {
global elevation_range
global report_by_elevation
$elevation_range setNullAllowed false
set isReportingByElevation [$report_by_elevation getCurrentValue]
if {"$isReportingByElevation" == "Y" } {
set elevationRange [$elevation_range getCurrentValue]
set buffer [GuidoExecServer ValidateRangeClassification [subst {Range = "$elevationRange"}]]
set status [GuidoGetParamBufferValue $buffer status]
if {$status >= 0} {
return true
} else {
return false
}
}
}
proc setNamesOfObjectAndTrisolation {upper_surface_object_name upper_surface_trisolation_name lower_surface_object_name lower_surface_trisolation_name surfaces} {
global obj1_name
global obj2_name
global tri1_name
global tri2_name
set numberOfSurfaces [$surfaces getCurrentValue]
set tmpobj1_name [$obj1_name getCurrentValue]
set tmpobj2_name [$obj2_name getCurrentValue]
set tmptri1_name [$tri1_name getCurrentValue]
set tmptri2_name [$tri2_name getCurrentValue]
$upper_surface_object_name setCurrentValue $tmpobj1_name
$upper_surface_trisolation_name setCurrentValue $tmptri1_name
if {"$numberOfSurfaces" == "2" } {
$lower_surface_object_name setCurrentValue $tmpobj2_name
$lower_surface_trisolation_name setCurrentValue $tmptri2_name
}
}
proc setDetailedValue {} {
global nqual
global detailed_report
set num [$nqual getCurrentValue]
if {$num >= "0"} {
$detailed_report setCurrentValue "Y"
}
}
GuidoForm frm00095 {
-default_buttons
-label "Surface to surface DTM volumes"
-layout BoxLayout Y_AXIS
-tip "DTM_VOL_DESC"
-action final {[destroyMultipleDtms]}
GuidoPanel frm00095_1 {
-layout CentreLineLayout
GuidoPanel frm00095_2 {
-label "Number of DTMs for volume"
-layout BoxLayout X_AXIS
-tip "A volume may be calculated between two DTMs, or from one DTM to a datum plane of zero."
GuidoButtonGroupPanel nsurf {
-layout BoxLayout Y_AXIS
GuidoRadioButton frm00095_19 {
-caption "An upper surface DTM only"
-default true
-selected_value 1
}
GuidoRadioButton frm00095_20 {
-caption "Upper and lower DTM surfaces"
-selected_value 2
}
}
}
}
GuidoPanel frm00095_3 {
-layout BoxLayout X_AXIS
GuidoPanel frm00095_4 {
-border etched true
-label "Define first DTM with object and trisolation"
-layout BoxLayout Y_AXIS
GuidoPanel frm00095_5 {
-layout CentreLineLayout Vertical Left
GuidoLabel loc1Label {
-label Location
}
GuidoPanel loc1Panel {
-layout BoxLayout X_AXIS
GuidoFileBrowserField loc1 {
-display_length 24
-file_mask *.dtm
-format none
-max_length 252
-next_focus object1_id
-extension false
-tip "DTM_VOL_DESC2"
-translate none
-null false
}
GuidoButton readDtm1 {
-tip "TIP_POPULATE_TRI_TRIOBJ"
-icon "icons/12/refresh.png"
-action valueChanged {[getObjectsTrisolationsForMultipleDTMS $loc1 $object1_id $obj1_name $trisolation1_id $tri1_name]}
-action valueChanged {[setNamesOfObjectAndTrisolation $upper_surface_object_name $upper_surface_trisolation_name $lower_surface_object_name $lower_surface_trisolation_name $nsurf]}
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel triobject1 {
-label "Object ID"
}
GuidoPanel frm00095_6 {
-layout BoxLayout X_AXIS
GuidoComboBox object1_id {
-action valueChanged {[triobjectChanged $loc1 $object1_id $obj1_name $trisolation1_id $tri1_name]}
-display_length 5.7
-format integer
-null false
-max_length 32
-next_focus trisolation1_id
-translate none
-exclusive false
-tip 04949_TIP_1
-action valueChanged {[setNamesOfObjectAndTrisolation $upper_surface_object_name $upper_surface_trisolation_name $lower_surface_object_name $lower_surface_trisolation_name $nsurf]}
}
GuidoFiller filler {
-width 0.2
}
GuidoLabel obj1_name {
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel trisol_panel {
-label "Trisolation ID"
}
GuidoPanel frm00095_7 {
-layout BoxLayout X_AXIS
GuidoComboBox trisolation1_id {
-display_length 5.7
-format integer
-max_length 32
-translate none
-null false
-exclusive false
-action valueChanged {[setNamesOfObjectAndTrisolation $upper_surface_object_name $upper_surface_trisolation_name $lower_surface_object_name $lower_surface_trisolation_name $nsurf]}
-next_focus loc3
-tip 04949_TIP_2
}
GuidoFiller filler {
-width 0.2
}
GuidoLabel tri1_name {
}
}
}
}
GuidoButtonGroupPanel nqual {
-tip "DTM_VOL_DESC_DATUM"
-label "Quality parameters for volume calculations"
-layout BoxLayout Y_AXIS
-display_length 23
-border etched true
-action valueChanged {[setDetailedValue]}
GuidoRadioButton button1 {
-caption "Do not use any quality parameters"
-default true
-next_focus button2
-selected_value 0
}
GuidoRadioButton button2 {
-caption "Use 1 quality parameter"
-next_focus button3
-selected_value 1
}
GuidoRadioButton button3 {
-caption "Use 2 quality parameters"
-selected_value 2
-next_focus decimals
}
}
}
GuidoPanel frm00095_8 {
-layout BoxLayout X_AXIS
GuidoPanel frm00095_9 {
-layout BoxLayout Y_AXIS
GuidoPanel frm00095_10 {
-border etched true
-label "Define second DTM with object and trisolation"
-layout BoxLayout Y_AXIS
GuidoPanel frm00095_11 {
-layout CentreLineLayout Vertical Left
GuidoLabel loc1Label {
-label Location
}
GuidoPanel loc1Panel {
-layout BoxLayout X_AXIS
GuidoFileBrowserField loc3 {
-dependency {"[ $nsurf getCurrentValue]" == "2"}
-display_length 24
-file_mask *.dtm
-format none
-max_length 252
-next_focus object2_id
-tip "DTM_VOL_DESC2"
-translate none
-extension false
-null false
}
GuidoButton readDtm2 {
-tip "TIP_POPULATE_TRI_TRIOBJ"
-icon "icons/12/refresh.png"
-action valueChanged {[getObjectsTrisolationsForMultipleDTMS $loc3 $object2_id $obj2_name $trisolation2_id $tri2_name]}
-action valueChanged {[setNamesOfObjectAndTrisolation $upper_surface_object_name $upper_surface_trisolation_name $lower_surface_object_name $lower_surface_trisolation_name $nsurf]}
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel object2_label {
-label "Object ID"
-dependency {"[ $nsurf getCurrentValue]" == "2"}
}
GuidoPanel frm00095_12 {
-layout BoxLayout X_AXIS
GuidoComboBox object2_id {
-action valueChanged {[triobjectChanged $loc3 $object2_id $obj2_name $trisolation2_id $tri2_name]}
-display_length 5.7
-dependency {"[ $nsurf getCurrentValue]" == "2"}
-format none
-max_length 32
-null false
-translate none
-action valueChanged {[setNamesOfObjectAndTrisolation $upper_surface_object_name $upper_surface_trisolation_name $lower_surface_object_name $lower_surface_trisolation_name $nsurf]}
-exclusive false
-next_focus trisolation2_id
-tip 04949_TIP_1
}
GuidoFiller frm00245_23 {
-width 0.2
}
GuidoLabel obj2_name {
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel trisolation2 {
-label "Trisolation ID"
-dependency {"[ $nsurf getCurrentValue]" == "2"}
}
GuidoPanel frm00095_13 {
-layout BoxLayout X_AXIS
GuidoComboBox trisolation2_id {
-dependency {"[ $nsurf getCurrentValue]" == "2"}
-display_length 5.7
-format none
-max_length 32
-null false
-translate none
-action valueChanged {[setNamesOfObjectAndTrisolation $upper_surface_object_name $upper_surface_trisolation_name $lower_surface_object_name $lower_surface_trisolation_name $nsurf]}
-exclusive false
-next_focus loc2
-validation {[validateUpperAndLowerSurface $loc1 $loc3 $object1_id $trisolation1_id $object2_id $trisolation2_id $nsurf]}
-tip 04949_TIP_2
}
GuidoFiller filler {
-width 0.2
}
GuidoLabel tri2_name {
}
}
}
}
GuidoPanel frm00095_14 {
-label "Define the boundary string"
-layout BoxLayout Y_AXIS
-border etched true
GuidoPanel frm00095_15 {
-layout CentreLineLayout Vertical Left
GuidoCheckBox combdy {
-default false
-selected_value Y
-tip "DTM_DESC_BOUNDARY"
-unselected_value N
}
GuidoLabel description_label {
-label "Use a boundary string"
}
}
GuidoPanel frm00095_16 {
-layout CentreLineLayout Vertical Left
GuidoFiller filler {
-width 1.8
}
GuidoPanel frm00095_17 {
-layout CentreLineLayout Vertical Left
GuidoFileBrowserField loc2 {
-label Location
-dependency {"[ $combdy getCurrentValue]" == "Y"}
-display_length 21.2
-file_mask *.str
-format none
-max_length 252
-tip "DTM_DESC_BOUNDARY"
-translate none
-next_focus nstr
-null false
-extension false
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField nstr {
-label "String number"
-dependency {"[ $combdy getCurrentValue]" == "Y"}
-display_length 8
-format integer
-high_bound 32000
-low_bound 1
-max_length 5
-null false
-tip "DTM_DESC_BOUNDARY"
-translate none
-next_focus nqual
-validation {[validateBoundaryString $loc2 $nstr]}
}
}
}
}
}
GuidoPanel frm00095_18 {
-layout BoxLayout Y_AXIS
-border etched true
-label "Define reporting parameters"
GuidoPanel frm00095_19 {
-layout CentreLineLayout Vertical Left
GuidoField decimals {
-label "Decimals"
-default "0"
-display_length 8
-format integer
-low_bound 0
-high_bound 3
-null false
-max_length 1
-next_focus density
-tip "DTM_VOL_DECIMALS"
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField density {
-label "Density"
-default "1.0"
-display_length 8
-max_length 5
-decimals 3
-format double
-low_bound 0.01
-high_bound 150.0
-null false
-tip "DENSITY_TIP"
-next_focus detailed_report
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoPanel frm00095_20 {
-layout CentreLineLayout Vertical Left
GuidoFiller filler {
-width 3.2
}
GuidoPanel frm00095_21 {
-layout CentreLineLayout Vertical Left
GuidoCheckBox detailed_report {
-default false
-selected_value Y
-tip "DTM_VOL_DETAILED_DESC"
-unselected_value N
-next_focus report_by_elevation
}
GuidoLabel detailed_report_label {
-label "Detailed report"
}
}
}
GuidoPanel frm00095_22 {
-layout CentreLineLayout Vertical Left
-display_length 22
GuidoFiller filler {
-width 3.2
}
GuidoPanel frm00095_23 {
-layout CentreLineLayout Vertical Left
GuidoCheckBox report_by_elevation {
-default false
-selected_value Y
-tip "Select this to allow reporting by elevation."
-unselected_value N
-next_focus elevation_range
}
GuidoLabel report_by_elevation_label {
-label "Report by elevation"
}
GuidoFiller filler {
-width 0.05
}
GuidoPanel frm00095_24 {
-layout CentreLineLayout Vertical Left
GuidoField elevation_range {
-label "Range"
-dependency {"[ $report_by_elevation getCurrentValue]" == "Y"}
-display_length 8
-format range
-max_length 128
-tip "DTM_DESC_INTERVAL"
-translate none
-null false
-validation {[validateRangeClassification]}
}
}
}
}
GuidoFiller filler {
-height 2.5
}
}
}
GuidoPanel hidden {
-layout BoxLayout X_AXIS
GuidoField upper_surface_object_name {
-format string
-visible false
-display_length 10
}
GuidoField upper_surface_trisolation_name {
-format string
-visible false
-display_length 10
}
GuidoField lower_surface_object_name {
-format string
-visible false
-display_length 10
}
GuidoField lower_surface_trisolation_name {
-visible false
-format string
-display_length 10
}
}
$loc1 setActionCallback focusGained {[storeOldValOne $loc1 $object1_id $trisolation1_id]}
$loc1 setActionCallback valueChanged {[clearFieldListOne $loc1 $object1_id $trisolation1_id]}
$loc3 setActionCallback valueChanged {[clearFieldListTwo $loc3 $object2_id $trisolation2_id]}
$loc3 setActionCallback focusGained {[storeOldValTwo $loc3 $object2_id $trisolation2_id]}
}
