set newNodes 0
set nested false
set initialValues false
set containerName "Vertical sections"
set getFunction "GetVerticalPlane"
set setFunction "SetVerticalPlane"
set removeFunction "RemoveVerticalPlane"
set iconFile "icons/16/menu_create_vertical_planes.png"
set iconFileZ "icons/16/VPlaneF.png"
proc setInitial {} {
if {$::initialValues == "false"} {
set ::commentInitial [$::comment getCurrentValue]
set ::seriesInitial [$::series getCurrentValue]
set ::sequenceInitial [$::sequence getCurrentValue]
set ::awayInitial [$::away getCurrentValue]
set ::towardsInitial [$::towards getCurrentValue]
set ::left_northingInitial [$::left_northing getCurrentValue]
set ::left_eastingInitial [$::left_easting getCurrentValue]
set ::left_elevationInitial [$::left_elevation getCurrentValue]
set ::right_northingInitial [$::right_northing getCurrentValue]
set ::right_eastingInitial [$::right_easting getCurrentValue]
set ::right_elevationInitial [$::right_elevation getCurrentValue]
set ::initialValues true
}
}
proc changedData {} {
setInitial
if {[string compare $::commentInitial [$::comment getCurrentValue]] != 0 ||
[string compare $::seriesInitial [$::series getCurrentValue]] != 0 ||
$::sequenceInitial != [$::sequence getCurrentValue] ||
$::awayInitial != [$::away getCurrentValue] ||
$::towardsInitial != [$::towards getCurrentValue] ||
$::left_northingInitial != [$::left_northing getCurrentValue] ||
$::left_eastingInitial != [$::left_easting getCurrentValue] ||
$::left_elevationInitial != [$::left_elevation getCurrentValue] ||
$::right_northingInitial != [$::right_northing getCurrentValue] ||
$::right_eastingInitial != [$::right_easting getCurrentValue] ||
$::right_elevationInitial != [$::right_elevation 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]"
$::away setCurrentValue "[GuidoGetParamBufferValue $params away]"
$::towards setCurrentValue "[GuidoGetParamBufferValue $params towards]"
$::left_northing setCurrentValue "[GuidoGetParamBufferValue $params left_northing]"
$::left_easting setCurrentValue "[GuidoGetParamBufferValue $params left_easting]"
$::left_elevation setCurrentValue "[GuidoGetParamBufferValue $params left_elevation]"
$::right_northing setCurrentValue "[GuidoGetParamBufferValue $params right_northing]"
$::right_easting setCurrentValue "[GuidoGetParamBufferValue $params right_easting]"
$::right_elevation setCurrentValue "[GuidoGetParamBufferValue $params right_elevation]"
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]"
away = "[$::away getCurrentValue]"
towards = "[$::towards getCurrentValue]"
left_northing = "[$::left_northing getCurrentValue]"
left_easting = "[$::left_easting getCurrentValue]"
left_elevation = "[$::left_elevation getCurrentValue]"
right_northing = "[$::right_northing getCurrentValue]"
right_easting = "[$::right_easting getCurrentValue]"
right_elevation = "[$::right_elevation getCurrentValue]"}]]
set status "[GuidoGetParamBufferValue $params status ]"
return $status
}
proc blankFields {} {
$::comment setCurrentValue ""
$::series setCurrentValue ""
$::sequence setCurrentValue 0
$::away setCurrentValue 0.0
$::towards setCurrentValue 0.0
$::left_northing setCurrentValue 0.0
$::left_easting setCurrentValue 0.0
$::left_elevation setCurrentValue 0.0
$::right_northing setCurrentValue 0.0
$::right_easting setCurrentValue 0.0
$::right_elevation setCurrentValue 0.0
$::depend setCurrentValue "true"
$::updated setInputAllowed false
$::created setInputAllowed false
set ::initialValues false
setInitial
}
proc validate {} {
set valid true
if {[$::away getCurrentValue] == 0.0 && [$::towards getCurrentValue] == 0} {
GuidoMessage warning "The definition should have thickness."
set valid false
$::away requestFocus
}
if {[$::left_elevation getCurrentValue] == [$::right_elevation getCurrentValue]} {
GuidoMessage warning "Min. elevation cannot equal Max. elevation."
set valid false
$::left_elevation requestFocus
}
if {[$::left_elevation getCurrentValue] > [$::right_elevation getCurrentValue]} {
GuidoMessage warning "Min. elevation cannot exceed Max. elevation."
set valid false
$::left_elevation requestFocus
}
if {[$::left_easting getCurrentValue] == [$::right_easting getCurrentValue] &&
[$::left_northing getCurrentValue] == [$::right_northing getCurrentValue]} {
GuidoMessage warning "The vertical plane is not valid. You need to have some horizontal variation between the specified end points."
set valid false
$::left_northing 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 "Vertical Plane Properties"
-tip "FRM_VERTICALPLANE_1"
-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_vertical_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_vertical_planes.png icons/16/menu_create_vertical_planes.png icons/16/VPlaneF.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 {
-layout BorderLayout
-border etched true
-label "Definition"
-dependency {[$depend getCurrentValue] != "false"}
GuidoPanel commentPanel {
-position North
-layout CentreLineLayout
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."
}
GuidoPanel paddingPanel {
-width 6.9
}
}
GuidoPanel nonCommentPanel {
-layout BorderLayout
GuidoPanel orientationPanel {
-layout BorderLayout
-position North
GuidoPanel non2dviewPanel {
-layout BorderLayout
GuidoPanel otherPanel {
-position North
-layout BorderLayout
GuidoPanel pointPanel {
-position West
-layout CentreLineLayout
-border etched true
-label "Left-hand point"
GuidoField left_northing {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_NORTHING"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_VERTICALPLANE_2"
}
GuidoField left_easting {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_EASTING"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_VERTICALPLANE_3"
}
GuidoField left_elevation {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_MIN_ELEVATION"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "The lower limit of the plane."
}
GuidoLabel padding {
-label ""
-visible false
-height 0.1
}
}
GuidoPanel thicknessPanel {
-position East
-layout CentreLineLayout
-border etched true
-label "Right-hand point"
GuidoField right_northing {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_NORTHING"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_VERTICALPLANE_4"
}
GuidoField right_easting {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_EASTING"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_VERTICALPLANE_5"
}
GuidoField right_elevation {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_MAX_ELEVATION"
-max_length 16
-null false
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "The upper limit of the plane."
}
GuidoLabel padding {
-label ""
-visible false
-height 0.1
}
}
}
}
}
GuidoPanel nonDates {
-layout BorderLayout
GuidoPanel non2dviewPanel {
-layout BorderLayout
GuidoPanel otherPanel {
-position North
-layout BorderLayout
GuidoPanel seriesPanel {
-position West
-layout CentreLineLayout
-border etched true
-label "Group"
GuidoField series {
-display_length 6
-label "PLANES_LABEL_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"
}
GuidoLabel padding {
-label "PLANES_LABEL_MAX_ELEVATION"
-visible false
-height 0.1
}
}
GuidoPanel thicknessPanel {
-position East
-layout CentreLineLayout
-border etched true
-label "Plane corridor"
GuidoField away {
-display_length 6
-format double
-decimals 3
-label "PLANES_LABEL_AWAY"
-max_length 16
-null false
-low_bound 0.0
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_VERTICALPLANE_6"
}
GuidoField towards {
-label "PLANES_LABEL_TOWARDS"
-display_length 6
-format double
-decimals 3
-max_length 16
-null false
-low_bound 0.0
-action focusGained {[setInitial]}
-validation {[validate]}
-tip "FRM_VERTICALPLANE_7"
}
GuidoLabel padding {
-label "PLANES_LABEL_MAX_ELEVATION"
-visible false
-height 0.1
}
}
}
GuidoPanel nonSeriesPanel {
-layout BorderLayout
GuidoPanel datesPanel {
-position North
-layout BorderLayout
-border etched true
-label "Dates"
GuidoPanel datesWest {
-position West
-layout CentreLineLayout
GuidoLabel createdLabel {
-label "PLANES_LABEL_CREATION_DATE"
}
GuidoField created {
-display_length 6
-input false
}
GuidoLabel padding {
-label "PLANES_LABEL_MAX_ELEVATION"
-visible false
-height 0.1
}
}
GuidoPanel datesEast {
-position East
-layout CentreLineLayout
GuidoLabel updatedLabel {
-label "PLANES_LABEL_LAST_UPDATE"
}
GuidoField updated {
-display_length 6
-input false
}
GuidoLabel padding {
-label "PLANES_LABEL_MAX_ELEVATION"
-visible false
-height 0.1
}
}
}
}
}
}
}
}
}
}
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
}
}
