Package org.movsim.viewer.graphics

Examples of org.movsim.viewer.graphics.TrafficCanvas


        projectMetaData.setProjectName(scenarioName);

        final Simulator simulator = new Simulator();
        initLookAndFeel();

        final TrafficCanvas trafficCanvas = new TrafficCanvas(simulator, properties);
        canvasPanel = new CanvasPanel(resourceBundle, trafficCanvas);
        statusPanel = new StatusPanel(resourceBundle, simulator);

        addToolBar(resourceBundle, trafficCanvas);
        addMenu(resourceBundle, simulator, trafficCanvas);

        add(canvasPanel, BorderLayout.CENTER);
        add(toolBar, BorderLayout.NORTH);

        setSize(1280, 800);
        resize(1280, 800);
        canvasPanel.setSize(1280, 800);
        trafficCanvas.setSize(1280, 800);

        canvasPanel.resized();
        canvasPanel.repaint();

        statusPanel.setWithProgressBar(false);
        statusPanel.reset();
        trafficCanvas.setupTrafficScenario(projectMetaData.getProjectName(), projectMetaData.getPathToProjectFile());
        final String projectName = projectMetaData.getProjectName();
        if (projectName.equals("routing") || projectName.equals("ramp_metering")) {
            trafficCanvas.setVehicleColorMode(TrafficCanvas.VehicleColorMode.EXIT_COLOR);
        }
        trafficCanvas.start();
    }
View Full Code Here


        SwingHelper.activateWindowClosingAndSystemExitButton(this);

        final Simulator simulator = new Simulator();
        initLookAndFeel();

        final TrafficCanvas trafficCanvas = new TrafficCanvas(simulator, properties);
        canvasPanel = new CanvasPanel(resourceBundle, trafficCanvas);
        statusPanel = new StatusPanel(resourceBundle, simulator);
        toolBar = new MovSimToolBar(statusPanel, trafficCanvas, resourceBundle);

        addMenu(resourceBundle, simulator, trafficCanvas, properties);
        add(canvasPanel, BorderLayout.CENTER);
        add(toolBar, BorderLayout.NORTH);

        addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                canvasPanel.resized();
                canvasPanel.repaint();
            }
        });

        initFrameSize(properties);

        if (projectMetaData.hasProjectName()) {
            trafficCanvas.setupTrafficScenario(projectMetaData.getProjectName(),
                    projectMetaData.getPathToProjectFile());
        } else {
            System.out.println("try to load default");
            final String path = "sim/buildingBlocks/";
            URL project = App.class.getClassLoader().getResource(path+"onramp.xml");
            URL projectPath = App.class.getClassLoader().getResource(path);
            File file = new File(project.getFile())// TODO use file, working in applet?
            System.out.println("file exists = "+file.exists());
            System.out.println("project = "+project.getFile());
            trafficCanvas.setupTrafficScenario(file.getName(), projectPath.getFile());
        }
       
        statusPanel.reset();
        trafficCanvas.start();
        setVisible(true);

        boolean isGame = Boolean.parseBoolean(properties.getProperty("isGame"));
        if (isGame) {
            HighscoreFrame.initialize(resourceBundle, simulator, properties);
View Full Code Here

TOP

Related Classes of org.movsim.viewer.graphics.TrafficCanvas

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.