示例#1
0
  public void resetCaseStudy() throws ThinklabException {

    storylineViews.clear();
    currentStoryline = null;

    /*
     * reset ROI and all modules
     */
    userModel.clearAnalysis();

    /*
     * ask the user model to give us all the modules we have access to.
     */
    userModel.initializeModules();

    moduleViews.clear();
    sidebar.resetModules();
    createModuleViews();

    /*
     * restore interface
     */
    selectionBar.setVisible(true);
    selectionBar.idle(false);
    gazetteer.setValue("");
    getBanner().setStoryline(null);

    ZK.resetComponent(this.storyline);

    this.storyline.setVisible(false);
    this.mapwindow.setVisible(true);

    browserState = 0;
    sidebar.redisplay();
  }
示例#2
0
  public void onClick$subpolyg(Event e) {

    selectionBar.painting(true);
    this.picmode = SUBTRACT;
    setStatus(STATUS.DRAWING_SUBTRACT_MODE);
    getVectorLayer().setEditControl("polygon");
  }
示例#3
0
  public void onClick$addpolyg(Event e) {

    selectionBar.painting(false);
    this.picmode = ADD;
    setStatus(STATUS.DRAWING_ADD_MODE);
    getVectorLayer().setEditControl("polygon");
  }
示例#4
0
  public void onClick$run(Event e) {

    getVectorLayer().clearFeatures();
    shapeShown = false;

    selectionBar.setVisible(false);

    /*
     * 	1. prepare info page for case study with area picture, list of possible storylines with explanations,
     * 	   instructions for use, and pointers to web site where it counts. Also: form to save area for later,
     * 	   disabled if not logged in.
     *
     *  2. Fill in enabled modules with storylines. Only show enabled ones with option to show those that are
     *     not enabled.
     *
     *  3. Each storyline badge should bring up main page for storyline when clicked. That should have a main area
     *     for the ES and one for the storyline-specific info. Model should look for the components and get
     *     the descriptions from the concepts. Links to web site wherever necessary. Page has "start" etc on
     *     it. Instead of list of pages, have "Computation is ongoing" or "Computation is waiting" or
     *     "Computation is not active (activate)". When computed. the area becomes the index for the result
     *     pages.
     *
     *  4. All possible downloads should be clearly marked on storyline page.
     */

    try {
      userModel.startAnalysis();
    } catch (ThinklabException e1) {
      throw new ThinklabRuntimeException(e1);
    }

    browserState = 1;

    /*
     * create view for all storylines and collect in storylineViews map
     *
     * show all module storylines in their modules, activate those with > 0 storylines,
     * and show each model storyline in each module.
     */
    getBanner().setStoryline(userModel.getStoryline());

    for (SidebarModule view : moduleViews) {
      view.display();
    }

    /*
     * create view for user storyline and display it. The map window becomes invisible until
     * session reset.
     */
    ZK.resetComponent(this.storyline);
    storylineViews.clear();
    currentStoryline = null;

    addStorylineView(
        userModel.getStoryline(), new UserStorylineView(userModel.getStoryline(), this));

    this.mapwindow.setVisible(false);
    this.storyline.setVisible(true);
    showStoryline(userModel.getStoryline(), null);
  }
示例#5
0
  public void onClick$resetdraw(Event e) {

    selectionBar.idle(false);

    this.picmode = IDLE;
    setStatus(STATUS.IDLE);

    getVectorLayer().clearFeatures();
    try {
      userModel.resetRegionOfInterest(null);
    } catch (ThinklabException e1) {
      throw new ThinklabRuntimeException(e1);
    }
  }
示例#6
0
  public void onFeatureAdded$vector(Event e) {

    boolean userDrawn = (this.picmode == ADD || this.picmode == SUBTRACT);
    FeatureAddedEvent ev = (FeatureAddedEvent) e;

    if (userDrawn) {
      selectionBar.idle(true);
      getVectorLayer().setEditControl("navigate");
    }

    try {

      boolean redraw = false;
      ShapeValue shape = new ShapeValue(map.getProjectionId() + " " + ev.getFeatureWKT());

      /*
       * happens when user draws too fast, especially with slow
       * browsers
       */
      if (!shape.isValid()) {
        setStatus(STATUS.INVALID_SHAPE);
        if (userModel.getRegionOfInterest() == null) getVectorLayer().clearFeatures();
        return;
      }

      if (this.picmode == ADD) {
        redraw = userModel.addRegionOfInterest(shape);
      } else if (this.picmode == SUBTRACT) {
        redraw = true;
        userModel.subtractRegionOfInterest(shape);
      }

      this.picmode = IDLE;

      if (redraw) {
        getVectorLayer().clearFeatures();
        getVectorLayer()
            .addFeature(NameGenerator.newName("sh"), userModel.getRegionOfInterest().getWKT());
      }

    } catch (ThinklabException e1) {
      throw new ThinklabRuntimeException(e1);
    }

    if (userDrawn) setStatus(STATUS.IDLE);
  }
示例#7
0
  public void setRegionFromGazetteer(String s) {

    if (s != null && !s.equals("")) {

      try {
        ShapeValue sh = Geospace.get().retrieveFeature(s);
        if (sh != null) {

          sh = sh.transform(Geospace.get().getGoogleCRS());

          userModel.resetRegionOfInterest(sh);
          selectionBar.idle(true);
          moveMapTo(map, sh);

          getVectorLayer().clearFeatures();
          getVectorLayer().addFeature("sel", sh.getWKT());
        }
      } catch (ThinklabException e1) {
        throw new ThinklabRuntimeException(e1);
      }
    }
  }
示例#8
0
  @Override
  public void initialize() {

    this.selectionBar = new SelectionBar();

    selectionBar.afterCompose();

    /*
     * build basic UI, same for all usages.
     */
    this.setContent(
        ZK.div(
            ZK.hbox(
                    ZK.sidebar(270, 700)
                        .headersclass(STYLE.MODULE_HEADER)
                        .labelsclass(STYLE.MODULE_TITLE, STYLE.MODULE_TITLE_DISABLED)
                        .headersize(24)
                        .id("sidebar"),
                    ZK.separator(false).width(10).height(700).sclass(STYLE.SEPARATOR),
                    ZK.vbox(
                            ZK.c(selectionBar),
                            OLMAPS
                                .map(
                                    OLMAPS.googlelayer().maptype("physical").id("google"),
                                    OLMAPS.vectorlayer().drawcontrols(true).id("vector"))
                                .zoom(2)
                                .center(1073500.73, 4482706.85)
                                .height(700)
                                .width(MAPWIDTH)
                                .id("map"),
                            ZK.window()
                                .width(MAPWIDTH)
                                .height(700)
                                .bgcolor("#cccccc")
                                .color("#000000")
                                .scroll()
                                .id("tableview")
                                .hide(),
                            ZK.c(new ARIESStatusBar(STATUS.get(), this))
                                .id("statusbar")
                                .height(28)
                                .width("100%"),
                            ZK.imagebutton("/aries/images/world48.png")
                                .id("view")
                                .tooltip("Toggle world views")
                                .sclass("mapbutton"))
                        .spacing(0)
                        .id("mapwindow"),

                    /*
                     * container for storylines, to be shown when we have made our selection
                     */
                    ZK.window().width(MAPWIDTH).height(760).id("storyline").hide())
                .id("browser")
                .spacing(0),

            /*
             * container for scenario editor - FIXME this should be just in the storyline window
             */
            ZK.c(new ScenarioEditor(this, 1270, 760)).id("sceditor").hide()));
  }