GuidoScript scripts/dtmutilities.tcl
global dtmloc
global object_id
global trisolation_id
global obj_name
global tri_name
global dtmfld
global xmin
global xmax
global ymin
global ymax
global zmin
global zmax
global conmin
global conmax
global dtmloc
global conrng
global ci
global cloc
global annloc
global indloc
global contval
global index
global ptrange
proc validateResultFile {} {
global cloc
global annloc
global indloc
global contval
global index
global ptrange
set cloc_name [$cloc getCurrentValue]
set annloc_name [$annloc getCurrentValue]
set indloc_name [$indloc getCurrentValue]
set contval_required [$contval getCurrentValue]
set index_required [$index getCurrentValue]
if {$contval_required == "Y"} {
$ptrange setNullAllowed false
if {$cloc_name == $annloc_name} {
GuidoMessage warning SAME_RESULT_FILE_NAME
set validationFailed "true"
}
}
if {$index_required == "Y"} {
if {$cloc_name == $indloc_name} {
GuidoMessage warning SAME_RESULT_FILE_NAME
set validationFailed "true"
}
}
if {$index_required == "Y" && $contval_required == "Y"} {
if {$cloc_name == $annloc_name || $cloc_name== $indloc_name || $annloc_name == $indloc_name} {
GuidoMessage warning SAME_RESULT_FILE_NAME
set validationFailed "true"
}
}
if {"$validationFailed" == "true"} {
return false
} else {
return true
}
}
proc getTrisolationBounds {objectId trisolId dfield} {
global xmin
global xmax
global ymin
global ymax
global zmin
global zmax
global conmin
global conmax
global dtmloc
global conrng
global ci
set range_temp ""
set obj_num [$objectId getCurrentValue]
set tri_num [$trisolId getCurrentValue]
set dtmDfield [$dfield getCurrentValue]
set location [$dtmloc getCurrentValue]
set filename ""
append filename $location ".dtm"
if {[string length $location] > 0 && [string length $dtmDfield] > 0} {
set buffer [GuidoExecServer GetTrisolationBounds [subst {FileName = "$filename" CurrentTriobject = "$obj_num" CurrentTrisolation = "$tri_num" DField = "$dtmDfield"}]]
set status [GuidoGetParamBufferValue $buffer status]
if {$status >= 0} {
set x_min [ GuidoGetParamBufferValue $buffer "Xmin" ]
$xmin setCurrentValue [ format "%.3f" $x_min ]
set x_max [ GuidoGetParamBufferValue $buffer "Xmax" ]
$xmax setCurrentValue [ format "%.3f" $x_max ]
set y_min [ GuidoGetParamBufferValue $buffer "Ymin" ]
$ymin setCurrentValue [ format "%.3f" $y_min ]
set y_max [ GuidoGetParamBufferValue $buffer "Ymax" ]
$ymax setCurrentValue [ format "%.3f" $y_max ]
set z_min [ GuidoGetParamBufferValue $buffer "Zmin" ]
$zmin setCurrentValue [ format "%.3f" $z_min ]
set z_max [ GuidoGetParamBufferValue $buffer "Zmax" ]
$zmax setCurrentValue [ format "%.3f" $z_max ]
$conmin setCurrentValue [ GuidoGetParamBufferValue $buffer "conMin" ]
$conmax setCurrentValue [ GuidoGetParamBufferValue $buffer "conMax" ]
set conmin_temp [$conmin getCurrentValue]
set conmax_temp [$conmax getCurrentValue]
set ci_temp [$ci getCurrentValue]
append range_temp $conmin_temp "," $conmax_temp "," $ci_temp
$conrng setCurrentValue "$range_temp"
}
}
}
GuidoForm frm04949 {
-default_buttons
-label "Extract contours from a DTM"
-layout BoxLayout Y_AXIS
-tip "00049_TIP_001"
-action initial {[fill_triobject_trisolation_details $dtmloc $object_id $obj_name $trisolation_id $tri_name]}
-action initial {[getTrisolationBounds $object_id $trisolation_id $dtmfld]}
-action final {[destroyTemporaryProcessedDTMSwa]}
GuidoPanel frm04949_1 {
-layout BoxLayout X_AXIS
GuidoPanel frm04949_2 {
-border etched true
-label "DTM from which contours will be extracted"
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_3 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFileBrowserField dtmloc {
-display_length 24.8
-action valueChanged {[fill_triobject_trisolation_details $dtmloc $object_id $obj_name $trisolation_id $tri_name]}
-file_mask *.dtm
-format none
-null false
-label Location
-extension false
-action valueChanged {[getDFieldNames $dtmloc $dtmfld]}
-input true
-max_length 256
-tip "00048_TIP_1"
-action valueChanged {[getTrisolationBounds $object_id $trisolation_id $dtmfld]}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoComboBox dtmfld {
-display_length 3.7
-format none
-label "Field to contour"
-max_length 4
-translate none
-exclusive false
-tip "00048_TIP_2"
-action valueChanged {[getTrisolationBounds $object_id $trisolation_id $dtmfld]}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel obj_num_label {
-label "Object ID"
}
GuidoPanel frm04949_4 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_5 {
-layout CentreLineLayout VERTICAL LEFT
GuidoComboBox object_id {
-action valueChanged {[fill_triobject_details $dtmloc $object_id $obj_name $trisolation_id $tri_name "false" "false"]}
-display_length 3.7
-format integer
-max_length 32
-translate none
-tip "04949_TIP_1"
-exclusive false
-action valueChanged {[getTrisolationBounds $object_id $trisolation_id $dtmfld]}
}
GuidoFiller filler {
-width 0.5
}
}
GuidoPanel frm04949_6 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel obj_name {
}
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel trisol_num_label {
-label "Trisolation ID"
}
GuidoPanel frm04949_7 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_8 {
-layout CentreLineLayout VERTICAL LEFT
GuidoComboBox trisolation_id {
-display_length 3.7
-format integer
-max_length 32
-translate none
-tip "04949_TIP_2"
-exclusive false
-next_focus conmin
-action valueChanged {[getTrisolationBounds $object_id $trisolation_id $dtmfld]}
-action valueChanged {[fill_trisolation_details $dtmloc $object_id $trisolation_id $tri_name "true" "false"]}
}
GuidoFiller filler {
-width 0.5
}
}
GuidoPanel frm04949_9 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel tri_name {
}
}
}
GuidoFiller northing_filler {
-height 0.1
}
GuidoPanel frm04949_10 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_11 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel northing_label {
-label "Northing"
}
GuidoFiller filler {
-width 3.2
}
}
GuidoPanel frm04949_12 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_13 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel easting_label {
-label "Easting"
}
GuidoFiller filler {
-width 3.7
}
}
GuidoPanel frm04949_14 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel contour_value_label {
-label "Contour value"
}
}
}
}
GuidoLabel min_label {
-label "Minimum"
}
GuidoPanel frm04949_15 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_16 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel ymin {
-display_length 6.5
}
}
GuidoPanel frm04949_17 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_18 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel xmin {
-display_length 7
}
}
GuidoPanel frm04949_19 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel zmin {
-display_length 6
}
}
}
}
GuidoLabel min_label {
-label "Maximum"
}
GuidoPanel frm04949_20 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_21 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel ymax {
-display_length 6.5
}
}
GuidoPanel frm04949_22 {
-layout CentreLineLayout VERTICAL LEFT
GuidoPanel frm04949_23 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel xmax {
-display_length 7
}
}
GuidoPanel frm04949_24 {
-layout CentreLineLayout VERTICAL LEFT
GuidoLabel zmax {
-display_length 6
}
}
}
}
}
}
GuidoPanel frm04949_25 {
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_26 {
-border etched true
-label "Define the contour string file"
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_27 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFileBrowserField cloc {
-display_length 22.3
-label Location
-file_access write
-file_mask *.str
-format none
-null false
-max_length 252
-tip "00050_TIP_1"
-translate none
-extension false
-validation { [ validateResultFile ] }
}
}
}
GuidoPanel frm04949_28 {
-border etched true
-label "Produce contour annotations"
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_29 {
-layout CentreLineLayout VERTICAL LEFT
GuidoCheckBox contval {
-default false
-selected_value Y
-tip 00050_TIP_3
-unselected_value N
}
GuidoLabel contval_label {
-label "Define the contour annotation details"
}
}
GuidoPanel frm04949_30 {
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_31 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFiller filler {
-width 2.2
}
GuidoPanel frm04949_32 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFileBrowserField annloc {
-label Location
-dependency {"[ $contval getCurrentValue]" == "Y"}
-display_length 15.5
-file_access write
-file_mask *.str
-format none
-max_length 252
-tip 00050_TIP_3
-translate none
-extension false
-validation { [ validateResultFile ] }
-action focusGained {[$annloc setNullAllowed false]}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField ptrange {
-label "Annotation range"
-dependency {"[ $contval getCurrentValue]" == "Y"}
-display_length 6
-format range
-max_length 32
-action focusGained {[$ptrange setNullAllowed false]}
-next_focus indloc
-tip "00050_TIP_3"
-translate none
}
}
GuidoFiller filler {
-height 0.9
}
}
}
GuidoFiller filler {
-height 0.1
}
}
}
}
GuidoPanel frm04949_33 {
-layout BoxLayout X_AXIS
GuidoPanel frm04949_34 {
-layout BoxLayout Y_AXIS
-label "Define contours by"
-border etched true
-display_length 33.2
GuidoButtonGroupPanel deftype {
-layout CentreLineLayout VERTICAL LEFT
-tip "01316_TIP_003"
GuidoRadioButton frm04949_35 {
-caption "Interval"
-selected_value I
}
GuidoRadioButton frm04949_36 {
-caption "Range"
-selected_value R
}
}
GuidoPanel frm04949_35 {
-layout BoxLayout X_AXIS
GuidoPanel frm04949_36 {
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_37 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFiller conmax_filler {
-width 1.2
}
GuidoPanel frm04949_38 {
-layout CentreLineLayout VERTICAL LEFT
GuidoField conmin {
-label "Minimum contour"
-display_length 6
-dependency {"[ $deftype getCurrentValue]" == "I"}
-format double
-max_length 10
-null false
-tip "01316_TIP_004"
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField conmax {
-label "Maximum contour"
-display_length 6
-dependency {"[ $deftype getCurrentValue]" == "I"}
-format double
-max_length 10
-null false
-tip "01316_TIP_004"
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField ci {
-label "Contour interval"
-display_length 6
-dependency {"[ $deftype getCurrentValue]" == "I"}
-format double
-max_length 10
-null false
-next_focus conrng
-tip "01316_TIP_004"
}
}
}
}
GuidoPanel frm04949_39 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFiller filler {
-width 0.05
}
GuidoPanel frm04949_40 {
-layout CentreLineLayout VERTICAL LEFT
GuidoField conrng {
-label " Contour range"
-dependency {"[ $deftype getCurrentValue]" == "R"}
-display_length 8
-format none
-next_focus cloc
-max_length 32
-tip "00049_TIP_006"
}
}
}
}
}
GuidoPanel frm04949_41 {
-border etched true
-label "Define plot enhancement requirements"
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_42 {
-layout CentreLineLayout VERTICAL LEFT
GuidoCheckBox index {
-default false
-selected_value Y
-tip 00050_TIP_2
-unselected_value N
}
GuidoLabel index_label {
-label "Create index contour file"
}
}
GuidoPanel frm04949_43 {
-layout BoxLayout Y_AXIS
GuidoPanel frm04949_44 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFiller filler {
-width 2.2
}
GuidoPanel frm04949_45 {
-layout CentreLineLayout VERTICAL LEFT
GuidoFileBrowserField indloc {
-label "Axis Viewer Location"
-dependency {"[ $index getCurrentValue]" == "Y"}
-display_length 17.9
-file_access write
-file_mask *.str
-format none
-max_length 252
-tip 00050_TIP_2
-translate none
-extension false
-validation { [ validateResultFile ] }
-action focusGained {[$indloc setNullAllowed false]}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField valind {
-label "Index value"
-dependency {"[ $index getCurrentValue]" == "Y"}
-display_length 6
-format double
-max_length 16
-null false
-tip "00050_TIP_2"
-translate upper
}
GuidoFiller filler {
-height 1.3
}
}
}
}
}
}
}
