Ejemplo n.º 1
0
  public static void main(String[] args) {
    // set up controller and image interface
    final Controller controller = new Controller();
    BufferedImage image =
        new BufferedImage(width - border * 2, height - border * 2, BufferedImage.TYPE_INT_ARGB);
    BufferedImageContainer imageContainer = new BufferedImageContainer(image, border);
    controller.setImageContainer(imageContainer);

    // inform controller that this module is running stand alone
    controller.setStandAlone(true);

    // instantiate evacuation area selector
    EvacuationAnalysis evacAnalysis = new EvacuationAnalysis(controller);

    // create default window for running this module standalone
    DefaultWindow frame = new DefaultWindow(controller);

    // set parent component to forward the (re)paint event
    controller.setParentComponent(frame);
    controller.setMainPanel(frame.getMainPanel(), true);

    // start the process chain
    evacAnalysis.start();
    frame.requestFocus();
  }
Ejemplo n.º 2
0
  public EvacuationAnalysis(Controller controller) {
    super(
        controller.getLocale().moduleEvacuationAnalysis(),
        Constants.ModuleType.ANALYSIS,
        controller);

    // disable all layers
    this.processList.add(new DisableLayersProcess(controller));

    // initialize Matsim config
    this.processList.add(new InitMatsimConfigProcess(controller));

    // check if the default render panel is set
    this.processList.add(new InitMainPanelProcess(controller));

    // check if there is already a map viewer running, or just (re)set
    // center position
    this.processList.add(new InitMapLayerProcess(controller));

    // set module listeners
    this.processList.add(
        new SetModuleListenerProcess(controller, this, new EAEventListener(controller)));

    // add grid renderer
    this.processList.add(
        new BasicProcess(controller) {
          @Override
          public void start() {
            if (!this.controller.hasGridRenderer()) {
              gridRenderer = new GridRenderer(controller);
              gridRendererID = gridRenderer.getId();
              this.controller.addRenderLayer(gridRenderer);
            }
          }
        });

    // add toolbox
    this.processList.add(new SetToolBoxProcess(controller, getToolBox()));

    // enable all layers
    this.processList.add(new EnableLayersProcess(controller));

    // enable grid renderer
    this.processList.add(
        new BasicProcess(controller) {
          @Override
          public void start() {
            toolBox.setGridRenderer(gridRenderer);
            readEvents();

            // finally: enable all layers
            controller.enableMapRenderer();

            controller.setToolBoxVisible(true);

            gridRenderer.setEnabled(true);
          }
        });
  }
Ejemplo n.º 3
0
  public DefaultOpenDialog(
      Controller controller,
      final String fileExtension,
      final String fileDescription,
      boolean directory) {
    this.controller = controller;
    if (directory) this.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    else {
      this.setFileFilter(new FileNameExtensionFilter(fileDescription, fileExtension));
    }

    this.setCurrentDirectory(controller.getCurrentWorkingDirectory());
  }