package org.mwc.debrief.scripting.wrappers;

import org.eclipse.ease.modules.WrapToScript;

import MWC.GenericData.WorldDistance;
import MWC.GenericData.WorldLocation;
import MWC.GenericData.WorldVector;

public class Spatial
{

  /**
   * the units for distances. Note to provide these to ease, we have to add a @WrapToScript
   * annotation. Once we've added this annotation to one public field/method, we have to apply it
   * for all methods
   */
  @WrapToScript
  static public final int METRES = 0;
  @WrapToScript
  static public final int YARDS = 1;
  @WrapToScript
  static public final int KM = 2;
  @WrapToScript
  static public final int NM = 3;
  @WrapToScript
  static public final int MINUTES = 4;
  @WrapToScript
  static public final int DEGS = 5;
  @WrapToScript
  static public final int KYDS = 6;
  @WrapToScript
  static public final int FT = 7;

  @WrapToScript
  public static WorldLocation createLocation(final double dLat,
      final double dLong, final double depth)
  {
    return new WorldLocation(dLat, dLong, depth);
  }

  @WrapToScript
  public static WorldVector createVector(final double distM,
      final double bearingDegs)
  {
    return new WorldVector(MWC.Algorithms.Conversions.Degs2Rads(bearingDegs),
        new WorldDistance(distM, WorldDistance.METRES), null);
  }

  @WrapToScript
  public static WorldVector createVectorKm(final double distKm,
      final double bearingDegs)
  {
    return new WorldVector(MWC.Algorithms.Conversions.Degs2Rads(bearingDegs),
        new WorldDistance(distKm, WorldDistance.KM), null);
  }

  @WrapToScript
  public WorldDistance createDistance(final double value, final int units)
  {
    return new WorldDistance(value, units);
  }

}

@@ -85,16 +85,50 @@
 cript;%0A%0A
+import MWC.GenericData.WorldArea;%0A
 import M
@@ -1073,32 +1073,353 @@
 g, depth);%0A  %7D%0A%0A
+  @WrapToScript%0A  /** produce an area object using the two corners%0A   * %0A   * @param tl top-left corner%0A   * @param br bottom-right corner%0A   * @return MWC.GenericData.WorldArea%0A   */%0A  public static WorldArea createArea(final WorldLocation tl, %0A      final WorldLocation br)%0A  %7B%0A    return new WorldArea(tl, br);%0A  %7D%0A  %0A
   @WrapToScript%0A

introduce createArea() method