set metresToFeet 3.180
set milesToKm 1.609344
set units [ GuidoSSIOption get "distance units" ]
proc calculateTransition {} {
global required_velocity
global transition_length
global radius
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 ]
}
set length [ expr  0.02145 * $velocity * $velocity * $velocity / ( $rad * .3 ) ]
if { $units == "IMPERIAL" } {
set length  [  expr $length  * $metresToFeet ]
}
$transition_length setCurrentValue $length
}
}
proc setDefaults {} {
global required_velocity
global metresToFeet 3.180
global units
if { $units == "IMPERIAL" } {
$required_velocity setDefault [ expr $milesToKm * [$required_velocity getCurrentValue ] ]
}
}
GuidoForm frm00058 {
-layout BoxLayout Y_AXIS
-default_buttons
-action initial { [setDefaults] }
-label "Parameters for a curve between tangents"
-tip CRV_TAN_TIP
GuidoPanel p0 {
-layout CentrelineLayout
-border etched true
GuidoField radius {
-display_length 10
-format double
-label Radius
-low_bound .0001
-max_length 16
-null false
-tip "Enter the radius of the circle that defines the curve."
-translate upper
}
GuidoField arcdist {
-display_length 10
-format double
-label "Arc distance"
-low_bound .001
-max_length 16
-null false
-tip CRV_END_ARC_TIP
-translate upper
}
GuidoPanel frm00058_7 {
-label "Curve type"
-layout BoxLayout X_AXIS
-tip CRV_TAN_INTEXT_TIP
GuidoButtonGroupPanel curve_type {
GuidoRadioButton frm00058_5 {
-caption internal
-selected_value internal
}
GuidoRadioButton frm00058_6 {
-caption external
-selected_value external
}
}
}
GuidoCheckBox use_transition {
-default false
-label "Use transition curve"
-selected_value Y
-unselected_value N
-tip ROAD_HOR_TRANSITION_LENGTH_TIP
}
GuidoField transition_length {
-dependency {"[ $use_transition getCurrentValue]" == "Y"}
-display_length 16
-format double
-high_bound 9999999
-label "Transition length"
-low_bound .01
-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_transition getCurrentValue]" == "Y"}
-display_length 14
-format double
-high_bound 9999999
-label Velocity
-low_bound .001
-max_length 14
-null false
-translate upper
-tip CRV_CALCULATE_TRANSITITION_LENGTH_TIP
}
}
GuidoFiller space {
-width 1.0
}
GuidoPanel p3 {
-layout CentrelineLayout
GuidoButton calculate_length {
-dependency {"[ $use_transition getCurrentValue]" == "Y"}
-caption "Calculate"
-height 1.0
-action valueChanged {[calculateTransition]}
-tip CRV_CALCULATE_TRANSITITION_LENGTH_TIP
}
}
}
}
