set newNodes 0
set nested false
set initialValues false
set containerName "Plan view"
set getFunction "GetHorizontalPlane"
set setFunction "SetHorizontalPlane"
set removeFunction "RemoveHorizontalPlane"
set iconFile "icons/16/menu_create_horizontal_planes.png"
set iconFileZ "icons/16/HPlaneF.png"
proc setInitial {} {
if {$::initialValues == "false"} {
set ::commentInitial [$::comment getCurrentValue]
set ::seriesInitial [$::series getCurrentValue]
set ::sequenceInitial [$::sequence getCurrentValue]
set ::elevationInitial [$::elevation getCurrentValue]
set ::lowerInitial [$::lower getCurrentValue]
set ::upperInitial [$::upper getCurrentValue]
set ::initialValues true
}
}
proc changedData {} {
setInitial
if {[string compare $::commentInitial [$::comment getCurrentValue]] != 0 ||
[string compare $::seriesInitial [$::series getCurrentValue]] != 0 ||
$::sequenceInitial != [$::sequence getCurrentValue] ||
$::elevationInitial != [$::elevation getCurrentValue] ||
$::lowerInitial != [$::lower getCurrentValue] ||
$::upperInitial != [$::upper getCurrentValue]} {
return true
}
return false
}
proc fetchPlane { tree } {
set rootNode [$tree getRootNode]
if {[$rootNode getChildCount] > 0} {
if {[string compare "[$tree getSelectedNode]" ""] == 0} {
set rootNode [$tree getRootNode]
set child [$rootNode getChildAt 0]
set grandChild [$child getChildAt 0]
set ::nested true
$tree setSelectedNode $child
$tree expandPath "$::containerName\\[$child getLabelText]\\[$grandChild getLabelText]"
set ::nested false
}
if {[string compare "[$tree getSelectedNode]" ""] != 0 &&
[[$tree getSelectedNode] isLeaf]} {
set leaf [$tree getSelectedNode]
set group_name [[$leaf getParent] getLabelText]
set params [GuidoExecServer "$::getFunction" [subst {name = "[[$tree getSelectedNode] getCurrentValue]" group = "$group_name"}]]
$::comment setCurrentValue "[GuidoGetParamBufferValue $params comment]"
$::series setCurrentValue "[GuidoGetParamBufferValue $params group]"
$::sequence setCurrentValue "[GuidoGetParamBufferValue $params sequence]"
$::created setCurrentValue "[GuidoGetParamBufferValue $params created]"
$::updated setCurrentValue "[GuidoGetParamBufferValue $params updated]"
$::elevation setCurrentValue "[GuidoGetParamBufferValue $params elevation]"
$::lower setCurrentValue "[GuidoGetParamBufferValue $params lower]"
$::upper setCurrentValue "[GuidoGetParamBufferValue $params upper]"
set ::initialValues false
setInitial
}
$::depend setCurrentValue "true"
$::updated setInputAllowed false
$::created setInputAllowed false
$::verb setCurrentValue "Editing:"
$::noun setCurrentValue "[[$tree getSelectedNode] getCurrentValue]"
$::noun_group setCurrentValue "[[[$tree getSelectedNode] getParent] getLabelText]"
} else {
$::depend setCurrentValue "false"
$::verb setCurrentValue "Creating:"
$::noun setCurrentValue ""
$::noun_group setCurrentValue ""
}
}
proc doSavePlane {name} {
set params [GuidoExecServer "$::setFunction" [subst {name = "$name"
comment = "[$::comment getCurrentValue]"
group = "[$::series getCurrentValue]"
sequence = "[$::sequence getCurrentValue]"
created = "[$::created getCurrentValue]"
updated = "[$::updated getCurrentValue]"
elevation = "[$::elevation getCurrentValue]"
lower = "[$::lower getCurrentValue]"
upper = "[$::upper getCurrentValue]"}]]
set status "[GuidoGetParamBufferValue $params status ]"
return $status
}
proc blankFields {} {
$::comment setCurrentValue ""
$::series setCurrentValue ""
$::sequence setCurrentValue 0
$::elevation setCurrentValue 0.0
$::lower setCurrentValue 0.0
$::upper setCurrentValue 0.0
$::depend setCurrentValue "true"
$::updated setInputAllowed false
$::created setInputAllowed false
set ::initialValues false
setInitial
}
proc validate {} {
set valid true
if {[$::lower getCurrentValue] == [$::upper getCurrentValue]} {
GuidoMessage warning "The definition should have thickness."
set valid false
$::lower requestFocus
}
if {[$::lower getCurrentValue] > [$::elevation getCurrentValue] ||
[$::upper getCurrentValue] < [$::elevation getCurrentValue]} {
GuidoMessage warning "Reference elevation does not fall between upper & lower limits."
set valid false
$::elevation requestFocus
}
if {[$::lower getCurrentValue] > [$::upper getCurrentValue]} {
GuidoMessage warning "The lower elevation must be less than the upper elevation."
set valid false
$::lower requestFocus
}
set seriesValue [string trim "[$::series getCurrentValue]"]
if {[string length $seriesValue] == 0} {
GuidoMessage warning "The group cannot be left blank."
set valid false
$::series requestFocus
}
return $valid
}
set buffer [ GuidoExecServer GetTCLPath { } ]
set tclPath [ GuidoGetParamBufferValue $buffer tclPath ]
source "$tclPath/commonPlane.tcl"
set editPlane ""
GuidoForm form {
-default_buttons
-label "Plan Plane Properties"
-tip "FRM_HORIZONTALPLANE_2"
-layout BorderLayout
GuidoPanel top {
-position North
-layout FlowLayout Left 0 0
GuidoField depend {
-default "false"
-visible false
}
source "$tclPath/toolbarPlane.tcl"
$newProfile setIconByName "icons/16/menu_create_horizontal_planes.png"
}
GuidoPanel bottom {
-layout BorderLayout
-border etched true
GuidoScrollPane scroll {
-height 15
GuidoTree planes_tree {
-label ""
-editable false
-no_mlt
-multiple_selection false
set buffer [GuidoExecServer PlaneTreeStructure [subst {type = "$::containerName"}]]
set nSeries "[GuidoGetParamBufferValue $buffer nSeries ]"
set editPlane "[GuidoGetParamBufferValue $buffer editPlane ]"
for {set i 0} {$i < $nSeries} {incr i} {
set pname "[GuidoGetParamBufferValue $buffer series_$i]"
GuidoTreeBranch branch_$i {
-label_no_mlt "$pname"
set nPlanes "[GuidoGetParamBufferValue $buffer nPlanes_$i]"
for {set j 0} {$j < $nPlanes} {incr j} {
set name "[GuidoGetParamBufferValue $buffer "plane\_$i\_$j"]"
GuidoTreeLeaf leaf\_$i\_$j {
-default $name
-label $name
-no_mlt
-action focusGained {[leafChanged $form $planes_tree]}
-menu_enabled true
-menu $::leafPopup
}
if {$i == 0 && $j == 0 && [string compare $editPlane ""] == 0} {
set editPlane $pname/$name
}
}
}
}
}
}
$scroll setScrollSize 15 15
$planes_tree setTreeIcons icons/16/menu_create_horizontal_planes.png icons/16/menu_create_horizontal_planes.png icons/16/HPlaneF.png
GuidoPanel editableWrapper {
-position East
-layout OverlayLayout
GuidoPanel no_planes {
-dependency {[$depend getCurrentValue] == "false"}
GuidoLabel no_planes_label {
-label "FRM_HORIZONTALPLANE_1"
-width 31
}
}
GuidoPanel editable {
-position East
-layout CentreLineLayout
-border etched true
-label "Definition"
-dependency {[$depend getCurrentValue] != "false"}
global comment
GuidoField comment {
-display_length 20
-label "PLANES_LABEL_COMMENTS"
-max_length 100
-action focusGained {[setInitial]}
-tip "You can add an arbitrary comment for this plane."
}
GuidoFiller fill1 {
-height 1
}
GuidoFiller fill1 {
-height 1
}
GuidoField elevation {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_REFERENCE_ELEVATION"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "The elevation of the plane."
}
GuidoField lower {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_LOWER_ELEVATION_LIMIT"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_HORIZONTALPLANE_3"
}
GuidoField upper {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_UPPER_ELEVATION_LIMIT"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_HORIZONTALPLANE_4"
}
GuidoFiller fill1 {
-height 1
}
GuidoFiller fill1 {
-height 1
}
GuidoField series {
-display_length 6
-label "PLANES_LABEL_GROUP_NAME"
-max_length 32
-action focusGained {[setInitial]}
-null false
-tip "FRM_HORIZONTALPLANE_5"
-format group
}
GuidoField sequence {
-format integer
-display_length 6
-label "PLANES_LABEL_SEQUENCE"
-max_length 100
-low_bound 0
-action focusGained {[setInitial]}
-null false
-tip "FRM_HORIZONTALPLANE_6"
}
GuidoFiller fill1 {
-height 1
}
GuidoFiller fill1 {
-height 1
}
GuidoLabel createdLabel {
-label "PLANES_LABEL_CREATION_DATE"
}
GuidoField created {
-display_length 6
-input false
}
GuidoLabel updatedLabel {
-label "PLANES_LABEL_LAST_UPDATE"
}
GuidoField updated {
-display_length 6
-input false
}
}
}
}
GuidoPanel status {
-position South
-layout CentrelineLayout
-border etched true
GuidoLabel verb {
-label "Editing:"
}
GuidoLabel noun {
-no_mlt
}
GuidoFiller noun_group_filler {
-height 1
}
GuidoLabel noun_group {
-visible false
-no_mlt
}
}
-action stateChanged {[formClosed $form $planes_tree]}
fetchPlane $planes_tree
if {[string compare $editPlane ""] != 0} {
set parts [split $editPlane /]
set group [lindex $parts 0]
set leaf [lindex $parts 1]
selectLeaf $planes_tree $group $leaf true
}
}
