set tclPath [ GuidoGetParamBufferValue [ GuidoExecServer GetTCLPath { } ] tclPath ]
source "$tclPath/../scripts/graphicsPickGrid.tcl"
set tryAgain 1
while { $tryAgain } {
set tryAgain 0
set pickResult [ showGridPickerForm "Convert grid surfaces to DTMs" layername grids "1742"]
if { $pickResult } {
GuidoForm gridToDTMForm {
-label "Convert a grid surface to a DTM"
-tip "GRID_TO_DTM_FORM_TIP"
-layout CentreLineLayout
-default_buttons
GuidoField outputTriobject {
-label "Output triobject"
-display_length 5
-default "1"
-tip "GRID_TO_DTM_OUTPUT_TRIOBJ_TIP"
}
GuidoField outputTrisolation {
-label "Output trisolation"
-display_length 5
-default "1"
-tip "GRID_TO_DTM_OUTPUT_TRISOL_TIP"
}
GuidoFiller f0 {
-height 1
}
GuidoFiller f1 {
-height 1
}
GuidoLabel l1 {
-label "Action for converted grids"
}
GuidoButtonGroupPanel oldGridAction {
-layout BoxLayout Y_AXIS
GuidoRadioButton deleteAction {
-caption "Delete the grid"
-selected_value "delete"
-default true
-tip "GRID_TO_DTM_DELETE_ACTION"
}
GuidoRadioButton hideAction {
-caption "Hide the grid"
-selected_value "hide"
-tip "GRID_TO_DTM_HIDE_ACTION"
}
GuidoRadioButton nothingAction {
-caption "Do nothing"
-selected_value "nothing"
-tip "GRID_TO_DTM_NO_ACTION"
}
}
GuidoFiller f2 {
-height 1
}
GuidoFiller f3 {
-height 1
}
GuidoLabel l2 {
-label "Create new surfaces as distinct"
}
GuidoButtonGroupPanel objectCreation {
-layout BoxLayout Y_AXIS
GuidoRadioButton triobjectCreation {
-caption "Triobjects"
-selected_value "triobject"
-tip "GRID_TO_CREATE_TRIOBJECTS"
}
GuidoRadioButton trisolationCreation {
-caption "Trisolations"
-selected_value "trisolation"
-default true
-tip "GRID_TO_CREATE_TRISOLATIONS"
}
}
GuidoFiller f4 {
-height 1
}
GuidoFiller f5 {
-height 1
}
GuidoLabel l3 {
-label "Output the surface to"
}
GuidoButtonGroupPanel outputLayerChoice {
-layout BoxLayout Y_AXIS
GuidoRadioButton originalLayer {
-caption "Original layer"
-selected_value "original"
-default true
-tip "GRID_TO_DTM_ORIGINAL_LAYER_TIP"
}
GuidoRadioButton newLayer {
-caption "New layer"
-selected_value "new"
-tip "GRID_TO_DTM_NEW_LAYER_TIP"
}
}
GuidoFiller f6 {
-height 1
}
GuidoFiller f7 {
-height 1
}
GuidoField outputLayer {
-label "Output layer"
-default ""
-display_length 15
-max_length 20
-dependency { "[$outputLayerChoice getCurrentValue]" ==  "new" }
-tip "GRID_TO_DTM_OUTPUT_LAYER_TIP"
}
}
set return_code [$gridToDTMForm interact]
if {$return_code == "apply"} {
GuidoApp app "GRID TO DTM"
if { $layername == "ALL_LAYERS" } {
$app setParam allLayers true
} else {
$app setParam dataset $layername
}
if { $grids == "ALL_GRIDS" } {
$app setParam allGrids true
} else {
$app setParam grid [join $grids "\n"]
}
$app setParam triobject [$outputTriobject getCurrentValue]
$app setParam trisolation [$outputTrisolation getCurrentValue]
$app setParam gridAction [$oldGridAction getCurrentValue]
if {[$objectCreation getCurrentValue] == "triobject"} {
$app setParam incrementTriobjects true
} else {
$app setParam incrementTriobjects false
}
if {[$outputLayerChoice getCurrentValue] == "new"} {
$app setParam outputLayer [$outputLayer getCurrentValue]
}
set result [$app invoke]
$app destroy
} else {
set tryAgain 1
}
}
}
