proc prepareRangeValue { formHandle index } {
set rValue "[$formHandle readInputField ranges($index).range]"
return $rValue;
}
proc prepareLabelValue { formHandle index } {
set lValue "[$formHandle readInputField ranges($index).label]"
return $lValue;
}
proc prepareEntityValue { formHandle index } {
set lValue "[$formHandle readInputField ranges($index).entity]"
return $lValue;
}
proc prepareMethodValue { formHandle index } {
set mValue "[$formHandle readInputField ranges($index).method]"
return $mValue;
}
proc prepareStringValue { formHandle index } {
set sValue "line_colour~[$formHandle readInputField ranges($index).line_colour]!"
append sValue "line_weight~[$formHandle readInputField ranges($index).line_weight]!"
append sValue "line_pattern~[$formHandle readInputField ranges($index).line_pattern]!"
append sValue "line_join~[$formHandle readInputField ranges($index).line_join]!"
append sValue "line_end~[$formHandle readInputField ranges($index).line_end]"
return $sValue
}
proc prepareMarkerValue {formHandle index } {
set mValue "marker_symbol~[$formHandle readInputField ranges($index).marker_symbol]!"
append mValue "marker_size~[$formHandle readInputField ranges($index).marker_size]"
return $mValue
}
proc prepareTextValue {formHandle index } {
if {[string match {* *} [$formHandle readInputField ranges($index).size]]} {
scan [$formHandle readInputField ranges($index).size] {%s %s} size units
} else {
scan [$formHandle readInputField ranges($index).size] {%g%s} size units
}
scan [$formHandle readInputField ranges($index).text_path] {%s %s %s} path1 path2 path3
set tValue "text_font_name~[$formHandle readInputField ranges($index).text_font_name]!"
append tValue "size~$size!"
append tValue "units~$units!"
append tValue "slant~[$formHandle readInputField ranges($index).slant]!"
append tValue "text_path~$path1,$path2,$path3"
return $tValue
}
proc preparePolygonValue {formHandle index } {
set transmissionColor [$formHandle readInputField ranges($index).transmission]
if {$transmissionColor == ""} {
set transmissionColor "none"
}
set pValue "face_colour~[$formHandle readInputField ranges($index).face_colour]!"
append pValue "edge_weight~[$formHandle readInputField ranges($index).edge_weight]!"
append pValue "edge_pattern~[$formHandle readInputField ranges($index).edge_pattern]!"
append pValue "specular~[$formHandle readInputField ranges($index).specular]!"
append pValue "transmission~$transmissionColor!"
append pValue "gloss~[$formHandle readInputField ranges($index).gloss]!"
append pValue "face_pattern~[$formHandle readInputField ranges($index).face_pattern]"
return $pValue
}
proc validateExtn { } {
global styles_file
set stylesFileName [$styles_file getCurrentValue]
if { $stylesFileName !=  "" } {
if { ![regexp {[.]} $stylesFileName] } {
$styles_file setCurrentValue "$stylesFileName.ssi"
return
}
}
}
proc setupTable {formHandle} {
global def_range
global def_stringLabel
global def_entity
global def_method
global def_s
global def_m
global def_t1
global def_p
global def_t
global range
global stringLabel
global entity
global method
global s
global m
global t1
global p
global t
set buffer [ GuidoExecServer ServerGetSelectedLegendItem { } ]
set path [GuidoGetParamBufferValue $buffer path]
$def_range setCurrentValue 0 [GuidoMessage translate Default]
$def_stringLabel setCurrentValue 0 [$formHandle readInputField deft_label]
$def_entity setCurrentValue 0 [$formHandle readInputField deft_entity]
$def_method setCurrentValue 0 [$formHandle readInputField deft_method]
set sValue "line_colour~[$formHandle readInputField deft_line_colour]!"
append sValue "line_weight~[$formHandle readInputField deft_line_weight]!"
append sValue "line_pattern~[$formHandle readInputField deft_line_pattern]!"
append sValue "line_join~[$formHandle readInputField deft_line_join]!"
append sValue "line_end~[$formHandle readInputField deft_line_end]"
$def_s setCurrentValue 0 $sValue
set mValue "marker_symbol~[$formHandle readInputField deft_marker_symbol]!"
append mValue "marker_size~[$formHandle readInputField deft_marker_size]"
$def_m setCurrentValue 0 $mValue
if {[string match {* *} [$formHandle readInputField deft_size]]} {
scan [$formHandle readInputField deft_size] {%s %s} size units
} else {
scan [$formHandle readInputField deft_size] {%g%s} size units
}
scan [$formHandle readInputField deft_text_path] {%s %s %s} path1 path2 path3
set tValue "text_font_name~[$formHandle readInputField deft_text_font_name]!"
append tValue "size~$size!"
append tValue "units~$units!"
append tValue "slant~[$formHandle readInputField deft_slant]!"
append tValue "text_path~$path1,$path2,$path3"
$def_t1 setCurrentValue 0 $tValue
set transmissionColor [$formHandle readInputField deft_transmission]
if {$transmissionColor == ""} {
set transmissionColor "none"
}
set pValue "face_colour~[$formHandle readInputField deft_face_colour]!"
append pValue "edge_weight~[$formHandle readInputField deft_edge_weight]!"
append pValue "edge_pattern~[$formHandle readInputField deft_edge_pattern]!"
append pValue "specular~[$formHandle readInputField deft_specular]!"
append pValue "transmission~$transmissionColor!"
append pValue "gloss~[$formHandle readInputField deft_gloss]!"
append pValue "face_pattern~[$formHandle readInputField deft_face_pattern]"
$def_p setCurrentValue 0 $pValue
set numberOfRows [$formHandle numberInputFields ranges]
set index 0
$t setInitialRows $numberOfRows 2 1000
set useRow -1
set useCol -1
for {set row 0} {$row < $numberOfRows} {incr row} {
$range setCurrentValue $row [prepareRangeValue $formHandle $index]
$stringLabel setCurrentValue $row [prepareLabelValue $formHandle $index]
if {$path > ""} {
if {$path == [prepareLabelValue $formHandle $index]} {
set useRow $row
set useCol 1
} else {
if {$path == [prepareRangeValue $formHandle $index]} {
set useRow $row
set useCol 0
}
}
}
$entity setCurrentValue $row [prepareEntityValue $formHandle $index]
$method setCurrentValue $row [prepareMethodValue $formHandle $index]
$s setCurrentValue $row [prepareStringValue $formHandle $index]
$m setCurrentValue $row [prepareMarkerValue $formHandle $index]
$t1 setCurrentValue $row [prepareTextValue $formHandle $index]
$p setCurrentValue $row [preparePolygonValue $formHandle $index]
incr index
}
if {$useRow > -1} {
$t setEditingCell $useRow $useCol
} else {
$def_t setEditingCell 0 1
}
global save_now
global styles_file
$save_now setCurrentValue [$formHandle readInputField save_now]
$styles_file setCurrentValue [$formHandle readInputField styles_file]
}
proc writeNormalValues {formHandle prefix value} {
set valueList [split $value ~!]
for {set index 0 } {$index < [llength $valueList]} {incr index 2} {
set listKey [lindex $valueList $index]
if {[string compare $listKey "transmission"] ==  0} {
if {[string compare [lindex $valueList [expr $index +1]] "none"] ==  0} {
set listValue ""
} else {
set listValue [lindex $valueList [expr $index +1] ]
}
} else {
set listValue [lindex $valueList [expr $index +1] ]
}
$formHandle writeOutputField "$prefix$listKey" $listValue
}
}
proc writeTextValues {formHandle prefix value} {
set textList [split $value ~!]
set size "0.2"
set units "sru"
set sizeFieldName size
for {set index 0 } {$index < [llength $textList]} {incr index 2} {
set textKey [lindex $textList $index]
set textValue [lindex $textList [expr $index +1] ]
switch -exact -- $textKey {
size { set size $textValue }
units { set units $textValue }
text_path {set textValue [join [split $textValue ,] ]
$formHandle writeOutputField "$prefix$textKey" $textValue }
default {$formHandle writeOutputField "$prefix$textKey" $textValue}
}
}
$formHandle writeOutputField "$prefix$sizeFieldName" "$size $units"
}
proc writeOutTable {formHandle} {
global def_range
global def_stringLabel
global def_entity
global def_method
global def_s
global def_m
global def_t1
global def_p
global def_t
global range
global stringLabel
global entity
global method
global s
global m
global t1
global p
global t
if { [string compare [$formHandle getStatus] "legacy preprocess apply"] ==  0 } {
$formHandle preprocessInit
$formHandle writeOutputField "deft_label" [$def_stringLabel getCurrentValue 0]
$formHandle writeOutputField "deft_entity" [$def_entity getCurrentValue 0]
$formHandle writeOutputField "deft_method" [$def_method getCurrentValue 0]
writeNormalValues $formHandle "deft_" [$def_s getCurrentValue 0]
writeNormalValues $formHandle "deft_" [$def_m getCurrentValue 0]
writeNormalValues $formHandle "deft_" [$def_p getCurrentValue 0]
writeTextValues $formHandle "deft_" [$def_t1 getCurrentValue 0]
set rangeName range
set labelName label
set entityName entity
set methodName method
set numberOfRows [$t getRowCount]
set index 0
$formHandle writeOutputField "GuidoTableRowCounter.ranges" $numberOfRows
for {set row 0} {$row < $numberOfRows} {incr row} {
set prefix "ranges($index)."
incr index
$formHandle writeOutputField "$prefix$rangeName" [$range getCurrentValue $row]
$formHandle writeOutputField "$prefix$labelName" [$stringLabel getCurrentValue $row]
$formHandle writeOutputField "$prefix$entityName" [$entity getCurrentValue $row]
$formHandle writeOutputField "$prefix$methodName" [$method getCurrentValue $row]
writeNormalValues $formHandle $prefix [$s getCurrentValue $row]
writeNormalValues $formHandle $prefix [$m getCurrentValue $row]
writeNormalValues $formHandle $prefix [$p getCurrentValue $row]
writeTextValues $formHandle $prefix [$t1 getCurrentValue $row]
}
global save_now
global styles_file
validateExtn
$formHandle writeOutputField "save_now" [$save_now getCurrentValue]
$formHandle writeOutputField "styles_file" [$styles_file getCurrentValue]
$formHandle finishedWritingFields
}
}
GuidoForm frm00249 {
-help_id 1282
-action initial {[setupTable $frm00249]}
-action stateChanged {[writeOutTable $frm00249 ]}
-label "Set Drawing Styles"
-default_buttons
-tip FORM00249_TIP
GuidoPanel pws {
-layout BoxLayout Y_AXIS
GuidoLabel label1 {
-height 1.1
-label "Default Style"
-font_style bold
}
GuidoScrollPane def_sp {
GuidoTable def_t {
-instances 1 1 1
-blank_row_headings true
-column_sorting false
GuidoLabel def_range {
-label Range
-display_length 8
}
GuidoField def_stringLabel {
-display_length 5
-label Label
-format none
-height 1
-tip STYLES_LABEL_TIP
}
GuidoEntityBrowserField def_entity {
-display_length 15
-label Entity
-populate
-null true
-exclusive true
-height 1
-max_length PLT_OBJECT_NAME_LENGTH
-tip STYLES_ENTITY_TIP
}
GuidoComboBox def_method {
-label "Drawing Method"
-default ""
-exclusive false
-display_length 16
-height 1
-null allowed
-value_in "arrow" "line" "polygon" "marker" "x" "y" "z" "d1" "d2" "d3" "label" "#label" "#string-no" "#string-segment-no" "layer-point-no" "none" "marker,z" "line,z/200/5" "line,arrow/100/5"  "#string-segment-no,line,marker" "#string-segment-no,line,marker,arrow/100/5"
-tip STYLES_DRAW_METHOD_TIP
}
StringLineStyles def_s {
-label Line
-tip STYLES_STRING_TIP
}
MarkerSymbols def_m {
-label Markers
-tip STYLES_MARKER_TIP
}
TextStyles def_t1 {
-label Text
-tip STYLES_TEXT_TIP
}
PolygonStyles def_p {
-label Polygon
-tip STYLES_POLYGON_TIP
}
}
}
GuidoLabel label1 {
-height 1.1
-label "Custom Styles"
-font_style bold
}
GuidoScrollPane sp {
-height 18
GuidoTable t {
-instances 1 1 30
-blank_row_headings true
-column_sorting false
-interactive true
GuidoField range {
-label Range
-display_length 8
-format range
-tip STYLES_RANGE_TIP
}
GuidoField stringLabel {
-display_length 5
-label Label
-format none
-height 1
-tip STYLES_LABEL_TIP
}
GuidoEntityBrowserField entity {
-display_length 15
-label Entity
-populate
-null true
-exclusive true
-height 1
-max_length PLT_OBJECT_NAME_LENGTH
-tip STYLES_ENTITY_TIP
}
GuidoComboBox method {
-label "Drawing Method"
-default ""
-exclusive false
-display_length 16
-height 1
-null allowed
-value_in "arrow" "line" "polygon" "marker" "x" "y" "z" "d1" "d2" "d3" "label" "#label" "#string-no" "#string-segment-no" "layer-point-no" "none" "marker,z" "line,z/200/5" "line,arrow/100/5"  "#string-segment-no,line,marker" "#string-segment-no,line,marker,arrow/100/5"
-tip STYLES_DRAW_METHOD_TIP
}
StringLineStyles s {
-label Line
-tip STYLES_STRING_TIP
}
MarkerSymbols m {
-label Markers
-tip STYLES_MARKER_TIP
}
TextStyles t1 {
-label Text
-tip STYLES_TEXT_TIP
}
PolygonStyles p {
-label Polygon
-tip STYLES_POLYGON_TIP
}
}
}
GuidoPanel save_panel {
-layout FlowLayout LEFT
GuidoPanel buffer_styles_file_panel {
-layout FlowLayout LEFT
GuidoCheckBox save_now {
-default false
-label "Save styles when form is applied?"
-selected_value Y
-tip "The styles can be saved to a styles file when the form is applied."
-unselected_value N
-next_focus styles_file
}
}
GuidoPanel hidden_styles_file_panel {
-layout FlowLayout LEFT
-dependency {"[ $save_now getCurrentValue]" == "Y"}
GuidoFileBrowserField styles_file {
-action focusLost {[validateExtn]}
-label Filename
-dependency {"[ $save_now getCurrentValue]" == "Y"}
-display_length 32
-file_mask *.ssi
-default $styles_file
-format none
-max_length 256
-translate lower
-tip STYLES_FILE_TIP
-file_access write
}
}
}
}
$frm00249 legacyProcessValues false
-next_focus def_stringLabel
}
