/*
 * Pedestrian.fx
 *
 * Created on Mar 23, 2010, 9:54:57 PM
 */
package vismobile;

import javafx.scene.Scene;
import javafx.scene.shape.Rectangle;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import vismobile.ToggleButton;

/**
 * @author Student
 */
public class PoliceCar extends Scene {

    var myRect: Rectangle;
    override var content = [
                Group {
                    var title: Text = Text {
                                font: Font {
                                    size: 24
                                }
                                fill: Color.WHITE
                                content: "Police Car"
                            };
                    var toggle: ToggleButton = ToggleButton {
                                id: "btnStartStop"
                                index: 0
                                imageButton1: CommonFunctionsFX.getImage("play_lg");
                                imageButton2: CommonFunctionsFX.getImage("stop_lg");
                                onclickButton1Action: function () {
                                    //Set the vehicle type as PEDESTRIAN
                                    mdot.Main.getMe().setObjectAsString(structures.Constants.HASH_TYPE, structures.Constants.TYPE_POLICE_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());
                                }
                            }
                    var homeButton: HomeButton =
                            HomeButton {
                                desc: "HOME"
                            }
                    content: [
                        Group {
                            translateX: Main.stage.width / 2 - title.boundsInLocal.width / 2;
                            translateY: (Main.stage.height / 7)
                            content: [
                                title
                            ]
                        }
                        Group {
                            translateX: Main.stage.width / 2 - toggle.boundsInLocal.width / 2;
                            translateY: Main.stage.height / 4;
                            content: [toggle]
                        }
                        Group {
                            translateX: 1//Main.stage.width/2 - toggle.boundsInLocal.width/2;
                            translateY: Main.stage.height - homeButton.boundsInLocal.height;
                            content: [
                                homeButton
                            ]
                        }
                    ]
                }
            ]
}
