Example #1
0
  public void createScenario(ModelStoryline storyline) throws ThinklabException {

    browser.setVisible(false);
    sceditor.setVisible(true);
    sceditor.setStoryline(storyline);
    sceditor.setLocation(map.getZoom(), (ArealExtent) storyline.getContext().getSpace());
  }
Example #2
0
  public static void moveMapTo(OLmaps mp, ShapeValue value) {

    Coordinate p1 = null, p2 = null;
    ShapeValue env = new ShapeValue(value.getEnvelope());
    try {
      env = env.transform(Geospace.get().getStraightGeoCRS());
    } catch (ThinklabException e2) {
      throw new ThinklabRuntimeException(e2);
    }
    ReferencedEnvelope e = env.getEnvelope();

    try {
      p1 =
          JTS.transform(
              new Coordinate(e.getMinX(), e.getMinY()),
              null,
              ARIESWebappPlugin.get().geoToGoogleTransform);
      p2 =
          JTS.transform(
              new Coordinate(e.getMaxX(), e.getMaxY()),
              null,
              ARIESWebappPlugin.get().geoToGoogleTransform);

    } catch (TransformException e1) {
      // shouldn't happen
      throw new ThinklabRuntimeException(e1);
    }

    mp.setBounds(p1.x, p1.y, p2.x, p2.y);
  }
Example #3
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);
  }
Example #4
0
  public void moveMapTo(OLmaps mp, RasterGrid grid) {

    Coordinate p1 = null, p2 = null;
    try {
      p1 =
          JTS.transform(
              new Coordinate(grid.getLeft(), grid.getBottom()),
              null,
              ARIESWebappPlugin.get().geoToGoogleTransform);
      p2 =
          JTS.transform(
              new Coordinate(grid.getRight(), grid.getTop()),
              null,
              ARIESWebappPlugin.get().geoToGoogleTransform);

    } catch (TransformException e) {
      // shouldn't happen
      throw new ThinklabRuntimeException(e);
    }

    mp.setBounds(p1.x, p1.y, p2.x, p2.y);
  }