proc graphicsPickGrid { prompt dataset_var grid_var } {
upvar $dataset_var dataset
upvar $grid_var grid
GuidoApp app "PICK GRID"
$app setParam prompt $prompt
set return_code [$app invoke]
if { $return_code == "0" } {
set dataset [$app getParam dataset]
set grid [$app getParam grid]
return 1
} else {
return 0
}
}
proc updateGridNames { layerName gridCombo } {
$gridCombo setValues "ALL_GRIDS"
$gridCombo setAlternativeMLTKeys "All grids"
if { $layerName != "ALL_LAYERS" } {
set buffer [ GuidoExecServer "getGridsInLayer" [subst { layer = "$layerName" } ] ]
set gridnames [GuidoGetParamBufferValue $buffer grids]
set gridlist [split $gridnames "\n"]
foreach item $gridlist {
$gridCombo addItem $item
}
}
}
proc showGridPickerForm { formtitle layer_var grid_var helpid_var} {
upvar $grid_var grid
upvar $layer_var layer
global gridComboBox
set return_value 0
GuidoForm grid_picker_form {
-label $formtitle
-layout CentreLineLayout
-default_buttons
-tip "GRID_PICKER_FORM_HELP"
-help_id $helpid_var
GuidoComboBox layerComboBox {
-exclusive true
-label "Layer"
-display_length 20
-null false
-value_in "ALL_LAYERS"
-alternative_mlt_keys "All layers"
-action valueChanged { [updateGridNames [$layerComboBox getCurrentValue] $gridComboBox] }
-tip "GRAPHICS_PICK_GRID_0"
}
GuidoComboBox gridComboBox {
-exclusive true
-label "Grid surface"
-display_length 20
-value_in "ALL_GRIDS"
-alternative_mlt_keys "All grids"
-null false
-tip "GRAPHICS_PICK_GRID_1"
}
}
set buffer [ GuidoExecServer "GetLayerNames" {} ]
set layernames [GuidoGetParamBufferValue $buffer layers]
set layernameslist [split $layernames "\n"]
foreach item $layernameslist {
$layerComboBox addItem $item
}
set return_code [$grid_picker_form interact]
if { $return_code == "apply" } {
set layer [$layerComboBox getCurrentValue]
set grid [$gridComboBox getCurrentValue]
set return_value 1
}
$grid_picker_form destroy
return $return_value
}
