set metresToFeet 3.180
set milesToKm 1.609344
proc calculateCurveLengths { } {
global velocity
global transition_length
global super_elevation
global curve_table
global radius
global status
global Locked
global curve_table
global metresToFeet
global milesToKm
global frmhorizontal_road_table
set system [GuidoSSIOption get "distance units"]
if {[$velocity validateObject] } {
set design_velocity [ $velocity getCurrentValue ]
if { $system == "IMPERIAL" } {
set design_velocity  [ expr  $rad * milesToKm ]
}
for { set i 0 } { $i < [$curve_table getRowCount]} { incr i } {
set row_radius [$radius getCurrentValue $i ]
set row_transition_length [$transition_length  getCurrentValue $i]
set row_super_elevation [$super_elevation getCurrentValue $i]
set row_fixed [$Locked getCurrentValue $i]
if { $row_fixed == "N" && $row_radius > 0 } {
if { $system == "IMPERIAL" } {
set row_radius  [ expr  $rad / $metresToFeet ]
}
$super_elevation setCurrentValue $i [expr 180.0 / 3.1415926535 * 0.45 * $design_velocity * $design_velocity / ( 127.0 * $row_radius ) ]
set length [expr 0.02145 * $design_velocity * $design_velocity * $design_velocity / ( 0.3 * $row_radius ) ]
if { $system == "IMPERIAL" } {
set length  [  expr $length  * $metresToFeet ]
}
$transition_length setCurrentValue $i $length
$curve_table setEditingCell $i 1
set obj [$transition_length getObject ]
$obj fireGuidoActionEvent valueChanged
set obj2 [$super_elevation getObject ]
$obj2 fireGuidoActionEvent valueChanged
}
if { $row_fixed == "N" && $row_radius <= 0 } {
$transition_length setCurrentValue $i 0
$super_elevation setCurrentValue $i 0
}
}
}
}
GuidoForm frmhorizontal_road_table {
-default_buttons
-label "Design Horizontal Alignment"
-layout BorderLayout
-legacy_validation
-defaults_management_calls_actions
-help_id 260
GuidoPanel frmhorizontal_road_table_37 {
-position North
-layout BoxLayout Y_AXIS
GuidoPanel frmhorizontal_road_table_36 {
-layout CentreLineLayout
-border etched true
-label "Design segment"
GuidoField output_string {
-label "Output string"
-display_length 5
-format integer
-null false
-max_length 5
-translate none
-legacy_action
-low_bound 1
-high_bound 32000
-tip OUTPUT_STRING_TIP
}
GuidoField road_name {
-display_length 16
-format none
-label Name
-max_length 32
-next_focus initial_chainage
-translate none
-tip ROAD_NAME_TIP
}
GuidoField initial_chainage {
-decimals 2
-display_length 6
-format double
-label "Initial Chainage"
-low_bound 0
-max_length 16
-next_focus chainage
-null false
-translate upper
-tip ROAD_INITIAL_CHAINAGE_DESC
}
GuidoField chainage {
-decimals 2
-display_length 6
-format double
-label "Chainage interval"
-low_bound .1
-max_length 16
-null false
-translate upper
-legacy_action
-next_focus velocity
-tip ROAD_CHAINAGE_INTERVAL_TIP
}
}
GuidoPanel frmhorizontal_road_table_f36 {
-layout BoxLayout X_AXIS
GuidoPanel frmhorizontal_road_table_b36 {
-layout BoxLayout X_AXIS
-border etched true
-label "Calculate road parameters"
GuidoPanel frmhorizontal_road_table_e36 {
-layout BoxLayout Y_AXIS
GuidoPanel frmhorizontal_road_table_a36 {
-layout CentreLineLayout
GuidoField velocity {
-decimals 2
-display_length 6
-format double
-label ROAD_VEHICLE_VELOCITY
-low_bound 0
-max_length 16
-next_focus calculate_length_btn
-null false
-tip ROAD_HOR_CALCULATE_TIP
-translate upper
}
}
GuidoButton calculate_length_btn {
-caption "Calculate"
-tip ROAD_HOR_CALCULATE_TIP
-action valueChanged {[calculateCurveLengths]}
-next_focus curve_table
}
}
}
GuidoFiller frmhorizontal_road_table_fil4 {
-width 1
}
}
}
GuidoPanel road_design_panel {
-position Center
-layout BorderLayout
-border etched true
-label "Road design details"
GuidoScrollPane frmhorizontal_road_table_33 {
-position Center
-height 9
GuidoTable curve_table {
-instances 3 1
-interactive false
GuidoField radius {
-display_length 6
-format double
-label Radius
-legacy_action
-low_bound 0
-max_length 16
-null false
-translate upper
-decimals 2
-tip ROAD_HORIZONTAL_RADIUS_TIP
}
GuidoCheckBox Locked {
-default false
-label Fixed
-selected_value Y
-unselected_value N
-default N
-tip ROAD_HOR_CALCULATE_TIP
}
GuidoField transition_length {
-display_length 6
-format double
-label "Transition length"
-legacy_action
-legacy_validation
-low_bound 0
-max_length 30
-null false
-translate upper
-decimals 2
-tip ROAD_HOR_TRANSITION_LENGTH_TIP
}
GuidoField super_elevation {
-display_length 7
-format none
-label ROAD_SUPER_ELEVATION
-legacy_action
-legacy_validation
-max_length 30
-null false
-decimals 2
-translate none
-tip ROAD_SUPER_ELEVATION_TIP
}
GuidoField status {
-display_length 7
-format none
-input false
-label Status
-max_length 30
-null false
-translate none
-tip ROAD_HOR_STATUS_TIP
}
}
}
}
}
