Example #1
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 #2
0
  public StorylineView createStorylineView(Storyline sl, StorylineControlPanel badge) {

    StorylineView view = null;

    /*
     * create storyline view appropriately. User view is already there.
     */
    Class<? extends StorylineView> moduleViewClass =
        ARIESWebappPlugin.get().getViewClass(sl.getObservable());

    if (moduleViewClass != null) {
      try {
        view = moduleViewClass.newInstance();
      } catch (Exception e) {
        throw new ThinklabRuntimeException(e);
      }
      if (view instanceof ModelStorylineView)
        ((ModelStorylineView) view).initialize(sl, this, badge);
      else view.initialize(sl, this);
    }

    if (view == null) {
      if (sl instanceof ModelStoryline) {
        view = new ModelStorylineView(sl, this, badge);
      } else {
        view = new ModuleStorylineView(sl, this);
      }
    }

    addStorylineView(sl, view);

    return view;
  }
Example #3
0
  private void createModuleViews() {

    for (AriesModule module : userModel.getAllModules()) {

      /*
       * use the class specified in the module storyline if any is
       * given; if not, create a stock AriesModule.
       */
      AriesModuleView mod = null;
      String scl =
          module
              .getStoryline()
              .getTemplate()
              .getDefault("module-sidebar-view-class", AriesModuleView.class.getCanonicalName());
      try {
        Class<?> amc = Class.forName(scl, true, ARIESWebappPlugin.get().getClassLoader());
        Constructor<?> ct = amc.getConstructor(AriesModule.class, AriesBrowser.class);
        mod = (AriesModuleView) ct.newInstance(module, this);
      } catch (Exception e) {
        throw new ThinklabRuntimeException(e);
      }

      addModuleView(mod);
    }
  }
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);
  }