/*
 * Pedestrian.fx
 *
 * Created on Feb 10, 2010, 4:53:26 PM
 */

package mdot_gui;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.input.MouseEvent;

/**
 * @author Ali
 */

public class Pedestrian extends CustomNode{

public override function create(): Node {

    visible = false;
    id = "Pedestrian";
        Group{
            content:[
                    Text {
                        translateX: Constants.WINDOW_WIDTH/2 - 175
                        translateY: Constants.WINDOW_HEIGHT/5
                        font : Font {size: 40}
                        fill: Color.WHITE
                        content: "Pedestrian Application"
                    }

                            ToggleButton{
                            id:"btnStartStop"
                            index: 0
                            translateX: Constants.WINDOW_WIDTH/2 - Constants.BUTTON_SIZE/2;
                            translateY: Constants.WINDOW_HEIGHT/3;
                            imageButton1: CommonFunctionsFX.getImage("play_lg");
                            imageButton2: CommonFunctionsFX.getImage("stop1_lg");
                            //Start
                            onclickButton1Action: function(){
                             //Set the vehicle type as PEDESTRIAN
                                    mdot.Main.getMe().setObjectAsString(structures.Constants.HASH_TYPE, structures.Constants.TYPE_PEDESTRIAN_STRING);
                                    //Insert the roadsign flag for dynamic signs
                                    mdot.Main.getMe().setObjectAsString(structures.Constants.HASH_ROADSIGN_ENABLE, "Yes");
                            }
                            //Stop
                            onclickButton2Action: function(){
                                 //Remove roadsign flag from hashtable
                                    mdot.Main.getMe().removeObject(structures.Constants.HASH_ROADSIGN_ENABLE);

                                    //Change type back to vehicle
                                    mdot.Main.getMe().setObjectAsString(structures.Constants.HASH_TYPE, structures.Constants.TYPE_VEHICLE.toString());
                            }
                        }
                    ]
            }
    }
}
