set metresToFeet 3.180
set milesToKm 1.609344
set units [ GuidoSSIOption get "distance units" ]
proc calculateTransition {} {
global required_velocity
global use_exit_transition
global use_entry_transition
global radius
global entry_transition_length
global exit_transition_length
global metresToFeet
global milesToKm
global units
if { [$required_velocity validateObject] && [$radius validateObject]} {
set velocity  [$required_velocity getCurrentValue]
set rad [$radius getCurrentValue]
if { $units == "IMPERIAL" } {
set rad  [ expr  $rad / $metresToFeet ]
set velocity  [ expr  $rad * milesToKm ]
}
if { [$use_entry_transition getCurrentValue] == "Y"} {
set length [ expr  0.02145 * $velocity * $velocity * $velocity / ( $rad * .3 ) ]
if { $units == "IMPERIAL" } {
set length  [  expr $length  * $metresToFeet ]
}
$entry_transition_length setCurrentValue $length
}
if { [$use_exit_transition getCurrentValue] == "Y"} {
set length [ expr  0.02145 * $velocity * $velocity * $velocity / ( $rad * .3 ) ]
if { $units  == "IMPERIAL" } {
set length  [  expr $length  * $metresToFeet ]
}
$exit_transition_length setCurrentValue $length
}
}
}
proc setDefaults {} {
global required_velocity
global metresToFeet
global units
if { $units == "IMPERIAL" } {
$required_velocity setDefault [ expr [$required_velocity getCurrentValue ] * milesToKm]
}
}
GuidoForm frm00057 {
-default_buttons
-layout BoxLayout Y_AXIS
-label "Parameters for a curve at end of line"
-action initial { [setDefaults] }
-tip CRV_END_TIP
GuidoPanel mainPanel {
-layout CentrelineLayout
GuidoPanel frm00057_13 {
-label Direction
-layout BoxLayout X_AXIS
-tip CRV_END_DIRECTION_TIP
GuidoButtonGroupPanel dirn {
GuidoRadioButton frm00057_11 {
-caption Clockwise
-selected_value C
}
GuidoRadioButton frm00057_12 {
-caption Anticlockwise
-selected_value A
}
}
}
GuidoField radius {
-display_length 16
-format double
-high_bound 9999999
-label Radius
-low_bound .1
-max_length 16
-null false
-tip "Enter the radius of the circle that defines the curve."
-translate upper
}
GuidoPanel frm00057_17 {
-label Curve
-layout BoxLayout X_AXIS
-tip CRV_END_LENGTH_TIP
GuidoButtonGroupPanel ang_or_length {
GuidoRadioButton frm00057_15 {
-caption Angle
-selected_value A
}
GuidoRadioButton frm00057_16 {
-caption Length
-selected_value L
}
}
}
GuidoField clen {
-decimals 4
-display_length 16
-format double
-high_bound 9999999
-label "Angle or Length"
-low_bound .1
-max_length 16
-null false
-tip CRV_END_ANG_LEN_TIP
-translate upper
}
GuidoField arcdist {
-display_length 16
-format double
-high_bound 9999999
-label "Arc distance"
-low_bound .1
-max_length 16
-null false
-tip CRV_END_ARC_TIP
-translate upper
}
GuidoCheckBox use_entry_transition {
-dependency {"[ $ang_or_length getCurrentValue]" == "L"}
-default false
-label "Use entry transition curve"
-selected_value Y
-unselected_value N
-tip ROAD_HOR_TRANSITION_LENGTH_TIP
}
GuidoField entry_transition_length {
-dependency {"[ $use_entry_transition getCurrentValue]" == "Y" && "[ $ang_or_length getCurrentValue]" == "L"}
-display_length 16
-format double
-high_bound 9999999
-label "Entry transition length"
-low_bound .1
-max_length 16
-null false
-translate upper
-tip ROAD_HOR_TRANSITION_LENGTH_TIP
}
GuidoCheckBox use_exit_transition {
-dependency {"[ $ang_or_length getCurrentValue]" == "L"}
-default false
-label "Use exit transition curve"
-selected_value Y
-unselected_value N
-tip ROAD_HOR_TRANSITION_LENGTH_TIP
}
GuidoField exit_transition_length {
-dependency {"[ $use_exit_transition getCurrentValue]" == "Y" && "[ $ang_or_length getCurrentValue]" == "L"}
-display_length 16
-format double
-high_bound 9999999
-label "Exit transition length"
-low_bound .1
-max_length 16
-null false
-translate upper
-tip ROAD_HOR_TRANSITION_LENGTH_TIP
}
}
GuidoPanel p1 {
-layout BoxLayout X_AXIS
-border etched true
GuidoPanel p2 {
-layout CentrelineLayout
GuidoField required_velocity {
-default 13.8
-dependency {"[ $use_exit_transition getCurrentValue]" == "Y" ||"[ $use_entry_transition getCurrentValue]" == "Y"}
-display_length 16
-format double
-high_bound 9999999
-label Velocity
-low_bound .001
-max_length 16
-null false
-translate upper
-tip CRV_CALCULATE_TRANSITITION_LENGTH_TIP
}
}
GuidoFiller space {
-width 0.5
}
GuidoPanel p3 {
-layout CentrelineLayout
GuidoButton calculate_length {
-dependency {"[ $use_exit_transition getCurrentValue]" == "Y" ||"[ $use_entry_transition getCurrentValue]" == "Y"}
-caption "Calculate"
-height 1.0
-action valueChanged {[calculateTransition]}
-tip CRV_CALCULATE_TRANSITITION_LENGTH_TIP
}
}
}
}
