# Señalización para entrada y salida de estaciones
# Con luz verde, amarilla y roja.
#
#
#
#
Aspect: red
   IconE: sw_b_r_b_r_b_E.xpm
   IconW: sw_b_r_b_r_b_W.xpm
   IconN: sw_b_r_b_r_b_N.xpm
   IconS: sw_b_r_b_r_b_S.xpm
   Action: stop

Aspect: double_red
   IconE: sw_b_r_b_r_b_E.xpm
   IconW: sw_b_r_b_r_b_W.xpm
   IconN: sw_b_r_b_r_b_N.xpm
   IconS: sw_b_r_b_r_b_S.xpm
   Action: stop


Aspect: yellow
   IconE: sw_y_b_b_b_b_E.xpm
   IconW: sw_y_b_b_b_b_W.xpm
   IconN: sw_y_b_b_b_b_N.xpm
   IconS: sw_y_b_b_b_b_S.xpm
   Action: proceed

Aspect: yellow_blinking
   IconE: sw_b_b_b_b_b_E.xpm sw_y_b_b_b_b_E.xpm
   IconW: sw_b_b_b_b_b_W.xpm sw_y_b_b_b_b_W.xpm
   IconN: sw_b_b_b_b_b_N.xpm sw_y_b_b_b_b_N.xpm
   IconS: sw_b_b_b_b_b_S.xpm sw_y_b_b_b_b_S.xpm
   Action: proceed


Aspect: yellow_sw_blinking
   IconE: sw_b_b_b_b_b_E.xpm sw_b_b_b_b_2y_E.xpm
   IconW: sw_b_b_b_b_b_W.xpm sw_b_b_b_b_2y_W.xpm
   IconN: sw_b_b_b_b_b_N.xpm sw_b_b_b_b_2y_N.xpm
   IconS: sw_b_b_b_b_b_S.xpm sw_b_b_b_b_2y_S.xpm
   Action: speedlimit60

Aspect: yellow_fix_yellow_sw_blinking
   IconE: sw_y_b_b_b_b_E.xpm sw_y_b_b_b_2y_E.xpm
   IconW: sw_y_b_b_b_b_W.xpm sw_y_b_b_b_2y_W.xpm
   IconN: sw_y_b_b_b_b_N.xpm sw_y_b_b_b_2y_N.xpm
   IconS: sw_y_b_b_b_b_S.xpm sw_y_b_b_b_2y_S.xpm
   Action: speedlimit60

Aspect: yellow_blinking_yellow_sw_blinking
   IconE: sw_b_b_b_b_b_E.xpm sw_y_b_b_b_2y_E.xpm
   IconW: sw_b_b_b_b_b_W.xpm sw_y_b_b_b_2y_W.xpm
   IconN: sw_b_b_b_b_b_N.xpm sw_y_b_b_b_2y_N.xpm
   IconS: sw_b_b_b_b_b_S.xpm sw_y_b_b_b_2y_S.xpm
   Action: speedlimit60


Aspect: green
   IconE: sw_b_b_g_b_b_E.xpm
   IconW: sw_b_b_g_b_b_W.xpm
   IconN: sw_b_b_g_b_b_N.xpm
   IconS: sw_b_b_g_b_b_S.xpm
   Action: proceed

OnInit:
   .aspect = double_red
end

OnCleared:
   if .aspect = red or .aspect = double_red 
      if next.aspect = red or next.aspect = double_red 
         if .switchThrown
            .aspect = yellow_fix_yellow_sw_blinking
         else
            .aspect = yellow
         end
      else
         if next.aspect = yellow or next.aspect = yellow_fix_yellow_sw_blinking
             if .switchThrown
			.aspect = yellow_blinking_yellow_sw_blinking
             else
                  .aspect = yellow_blinking
             end
         else
            if .switchThrown
               .aspect = yellow_sw_blinking 
            else
               .aspect = green
            end
         end 
      end 
   end
end

OnUpdate:
  if .aspect = red or .aspect = double_red 
    return
  end
  if next.aspect = red or next.aspect = double_red 
      if .switchThrown
            .aspect = yellow_fix_yellow_sw_blinking
         else
            .aspect = yellow
         end
      else
         if next.aspect = yellow or next.aspect = yellow_fix_yellow_sw_blinking
             if .switchThrown
			.aspect = yellow_blinking_yellow_sw_blinking
             else
                  .aspect = yellow_blinking
             end
         else

            if .switchThrown
               .aspect = yellow_sw_blinking 
            else
               .aspect = green
            end
         end 
      end 
  end
end

