GuidoScript scripts/dtmutilities.tcl
global dtmloc
global object_id
global trisolation_id
global obj_name
global tri_name
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 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
}
}
}
GuidoForm frm00315 {
-default_buttons
-label "Apply a boundary to a DTM"
-layout BoxLayout Y_AXIS
-tip 00315_TIP_0
-action final {[destroyMultipleDtms]}
GuidoPanel frm00315_25 {
-layout BoxLayout X_AXIS
GuidoPanel frm00315_25 {
-border etched true
-label "Define the DTM file"
-layout BoxLayout Y_AXIS
GuidoPanel frm00245_37 {
-layout CentreLineLayout Vertical Left
GuidoLabel labelLoc {
-label Location
}
GuidoPanel frm00380_5 {
-layout BoxLayout X_AXIS
GuidoFileBrowserField dtmloc {
-display_length 20
-file_mask *.dtm
-format none
-max_length 252
-null false
-tip 00315_TIP_1
-translate lower
-next_focus object_id
-extension false
}
GuidoButton readDtm1 {
-tip "TIP_POPULATE_TRI_TRIOBJ"
-icon "icons/12/refresh.png"
-action valueChanged {[getObjectsTrisolationsForMultipleDTMS $dtmloc $object_id $obj_name $trisolation_id $tri_name]}
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel triobject {
-label "Object ID"
}
GuidoPanel frm01320_6 {
-layout BoxLayout X_AXIS
GuidoComboBox object_id {
-display_length 5
-format integer
-max_length 32
-next_focus trisolation_id
-translate none
-exclusive false
-action valueChanged {[triobjectChanged $dtmloc $object_id $obj_name $trisolation_id $tri_name]}
}
GuidoFiller filler {
-width 0.2
}
GuidoLabel obj_name {
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoLabel trisol_panel {
-label "Trisolation ID"
}
GuidoPanel frm01320_7 {
-layout BoxLayout X_AXIS
GuidoComboBox trisolation_id {
-display_length 5
-format integer
-max_length 32
-translate none
-exclusive false
-next_focus bdyloc
}
GuidoFiller filler {
-width 0.2
}
GuidoLabel tri_name {
}
}
}
}
GuidoPanel frm00315_30 {
-border etched true
-label "Define the new DTM to create"
-layout BoxLayout Y_AXIS
GuidoPanel frm00245_37 {
-layout CentreLineLayout Vertical Left
GuidoFileBrowserField newdtmloc {
-label Location
-display_length 20
-file_access write
-file_mask *.dtm
-format none
-max_length 252
-tip 00315_TIP_4
-translate lower
-next_focus newobject_id
-extension false
-null false
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField newobject_id {
-display_length 8
-input true
-null false
-format integer
-label "Object ID"
-default 1
-low_bound 1
-max_length 5
-high_bound 32000
-tip 00126_TIP_0010
-next_focus newobj_name
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField newobj_name {
-display_length 8
-label "Object name"
-input true
-tip 00126_TIP_0011
-max_length FIO_MAX_LOCATION_LENGTH
-next_focus newbdyloc
}
}
}
}
GuidoPanel frm00315_30 {
-layout BoxLayout X_AXIS
GuidoPanel frm00315_28 {
-border etched true
-label "Define the boundary string"
-layout BoxLayout Y_AXIS
GuidoPanel bdyloc_panel {
-layout CentreLineLayout Vertical Left
GuidoFileBrowserField bdyloc {
-label Location
-display_length 22
-file_mask *.str
-format none
-max_length 252
-null false
-tip 00315_TIP_2
-translate lower
-extension false
-next_focus bdystr
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField bdystr {
-label String
-display_length 8
-format integer
-high_bound 32000
-low_bound 1
-max_length 5
-null false
-tip 00315_TIP_2
-translate none
-next_focus inout
-validation {[validateBoundaryString $bdyloc $bdystr]}
}
}
GuidoFiller filler {
-height 0.1
}
GuidoPanel frm00315_21 {
-layout CentreLineLayout Vertical Left
-tip 00315_TIP_3
GuidoLabel inout_label {
-label "Retain triangles"
}
GuidoButtonGroupPanel inout {
-layout BoxLayout Y_AXIS
GuidoRadioButton frm00315_19 {
-caption "Inside the boundary"
-selected_value I
}
GuidoRadioButton frm00315_20 {
-caption "Outside the boundary"
-selected_value O
-next_focus newdtmloc
}
}
}
}
GuidoPanel frm00315_32 {
-border etched true
-label "Define the file for the new boundary string"
-layout BoxLayout Y_AXIS
GuidoPanel newbdyloc_panel {
-layout CentreLineLayout VERTICAL LEFT
GuidoFileBrowserField newbdyloc {
-label Location
-display_length 22
-file_access write
-file_mask *.str
-format none
-max_length 252
-tip 00315_TIP_5
-translate lower
-next_focus new_bdystr
-extension false
-null false
-validation {[validateOutPutFiles]}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoField new_bdystr {
-label String
-display_length 8
-format integer
-high_bound 32000
-low_bound 1
-max_length 5
-null false
-tip 00315_TIP_5
-translate none
}
GuidoFiller filler {
-height 2.8
}
}
}
}
$dtmloc setActionCallback focusGained {[storeOldValOne $dtmloc $object_id $trisolation_id]}
$dtmloc setActionCallback valueChanged {[clearFieldListOne $dtmloc $object_id $trisolation_id]}
}
