SourceForge: gwt-openlayers/gwt-openlayers: changeset 195:3511257f442f
merged heads
authorEdwin Commandeur <commandeur.edwin@gmail.com>
Tue Oct 27 01:16:59 2009 +0100 (4 weeks ago)
changeset 1953511257f442f
parent 19409138277ac4f
parent 1921c03a2268458
child 19685f43689abbc
merged heads
     1.1 --- a/src/main/java/org/gwtopenmaps/openlayers/client/Bounds.java	Tue Oct 27 01:16:34 2009 +0100
     1.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/Bounds.java	Tue Oct 27 01:16:59 2009 +0100
     1.3 @@ -88,6 +88,13 @@
     1.4  		return BoundsImpl.getMaxY(getJSObject());
     1.5  	}
     1.6  
     1.7 +	public float getWidth() {
     1.8 +		return BoundsImpl.getWidth(getJSObject());
     1.9 +	}
    1.10 +	
    1.11 +	public float getHeight() {
    1.12 +		return BoundsImpl.getHeight(getJSObject());
    1.13 +	}
    1.14  	/**
    1.15  	 * @param significantDigits - Number of significant digits in the bbox coordinates,
    1.16  	 *  	pass null to use the default of 6.
    1.17 @@ -109,4 +116,8 @@
    1.18  	public Geometry toGeometry() {
    1.19  		return Geometry.narrowToGeometry(BoundsImpl.toGeometry(this.getJSObject()));
    1.20  	}
    1.21 +	
    1.22 +	public boolean containsBounds(Bounds bounds, boolean partial, boolean contains ) {
    1.23 +		return BoundsImpl.containsBounds(getJSObject(), bounds.getJSObject(), partial, contains);
    1.24 +	}
    1.25  }
     2.1 --- a/src/main/java/org/gwtopenmaps/openlayers/client/BoundsImpl.java	Tue Oct 27 01:16:34 2009 +0100
     2.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/BoundsImpl.java	Tue Oct 27 01:16:59 2009 +0100
     2.3 @@ -46,7 +46,18 @@
     2.4      }-*/;
     2.5  
     2.6  	public static native JSObject toGeometry(JSObject bounds)/*-{
     2.7 -	return bounds.toGeometry();
     2.8 -}-*/;
     2.9 +	   return bounds.toGeometry();
    2.10 +    }-*/;
    2.11 +	
    2.12 +	public static native boolean containsBounds(JSObject bounds, JSObject in_bounds, boolean partial, boolean contains)/*-{
    2.13 +		return bounds.containsBounds(in_bounds, partial, contains);
    2.14 +	}-*/;
    2.15  
    2.16 +	public static native float getWidth(JSObject bounds)/*-{
    2.17 +		return bounds.getWidth();
    2.18 +	}-*/;
    2.19 +   
    2.20 +	public static native float getHeight(JSObject bounds)/*-{
    2.21 +		return bounds.getHeight();
    2.22 +	}-*/;
    2.23  }
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/control/DragFeature.java	Tue Oct 27 01:16:59 2009 +0100
     3.3 @@ -0,0 +1,16 @@
     3.4 +package org.gwtopenmaps.openlayers.client.control;
     3.5 +
     3.6 +import org.gwtopenmaps.openlayers.client.layer.Vector;
     3.7 +import org.gwtopenmaps.openlayers.client.util.JSObject;
     3.8 +
     3.9 +public class DragFeature extends Control {
    3.10 +    public DragFeature(Vector layer) {
    3.11 +    	this(DragFeatureImpl.create(layer.getJSObject()));
    3.12 +    }
    3.13 +    public DragFeature(Vector layer, DragFeatureOptions options) {
    3.14 +    	this(DragFeatureImpl.create(layer.getJSObject(), options.getJSObject()));
    3.15 +    }
    3.16 +	public DragFeature(JSObject element) {
    3.17 +		super(element);
    3.18 +	}
    3.19 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/control/DragFeatureImpl.java	Tue Oct 27 01:16:59 2009 +0100
     4.3 @@ -0,0 +1,16 @@
     4.4 +package org.gwtopenmaps.openlayers.client.control;
     4.5 +
     4.6 +import org.gwtopenmaps.openlayers.client.util.JSObject;
     4.7 +
     4.8 +public class DragFeatureImpl {
     4.9 +	public static native JSObject create(JSObject layer)/*-{
    4.10 +	return new $wnd.OpenLayers.Control.DragFeature(layer);
    4.11 +    }-*/;
    4.12 +
    4.13 +
    4.14 +    public static native JSObject create(JSObject layer, JSObject options)/*-{
    4.15 +	return new $wnd.OpenLayers.Control.DragFeature(layer, options);
    4.16 +    }-*/;
    4.17 +	   
    4.18 +	   
    4.19 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/control/DragFeatureOptions.java	Tue Oct 27 01:16:59 2009 +0100
     5.3 @@ -0,0 +1,5 @@
     5.4 +package org.gwtopenmaps.openlayers.client.control;
     5.5 +
     5.6 +public class DragFeatureOptions extends ControlOptions {
     5.7 +
     5.8 +}
     6.1 --- a/src/main/java/org/gwtopenmaps/openlayers/client/control/ModifyFeature.java	Tue Oct 27 01:16:34 2009 +0100
     6.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/control/ModifyFeature.java	Tue Oct 27 01:16:59 2009 +0100
     6.3 @@ -3,6 +3,7 @@
     6.4   */
     6.5  package org.gwtopenmaps.openlayers.client.control;
     6.6  
     6.7 +import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
     6.8  import org.gwtopenmaps.openlayers.client.layer.Vector;
     6.9  import org.gwtopenmaps.openlayers.client.util.JSObject;
    6.10  
    6.11 @@ -11,7 +12,10 @@
    6.12   *
    6.13   */
    6.14  public class ModifyFeature extends Control {
    6.15 -    
    6.16 +    public static final int RESHAPE = 1;
    6.17 +    public static final int RESIZE = 2;
    6.18 +    public static final int ROTATE = 4;
    6.19 +    public static final int DRAG = 8;
    6.20      protected ModifyFeature(JSObject modifyFeature){
    6.21          super(modifyFeature);
    6.22      }
    6.23 @@ -20,4 +24,19 @@
    6.24          this(ModifyFeatureImpl.create(vectorLayer.getJSObject()));
    6.25      }
    6.26  
    6.27 +    public ModifyFeature(Vector vectorLayer, ModifyFeatureOptions modifyFeatureOptions) {
    6.28 +    	this(ModifyFeatureImpl.create(vectorLayer.getJSObject(), modifyFeatureOptions.getJSObject()));
    6.29 +    }
    6.30 +    /**
    6.31 +	 *
    6.32 +	 */
    6.33 +	public interface OnModificationStartListener {
    6.34 +		void onModificationStart(VectorFeature vectorFeature);
    6.35 +	}
    6.36 +	public interface OnModificationListener {
    6.37 +		void onModification(VectorFeature vectorFeature);
    6.38 +	}
    6.39 +	public interface OnModificationEndListener {
    6.40 +		void onModificationEnd(VectorFeature vectorFeature);
    6.41 +	}
    6.42  }
     7.1 --- a/src/main/java/org/gwtopenmaps/openlayers/client/control/ModifyFeatureImpl.java	Tue Oct 27 01:16:34 2009 +0100
     7.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/control/ModifyFeatureImpl.java	Tue Oct 27 01:16:59 2009 +0100
     7.3 @@ -1,5 +1,8 @@
     7.4  package org.gwtopenmaps.openlayers.client.control;
     7.5  
     7.6 +import org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationEndListener;
     7.7 +import org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationListener;
     7.8 +import org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationStartListener;
     7.9  import org.gwtopenmaps.openlayers.client.util.JSObject;
    7.10  
    7.11  /**
    7.12 @@ -11,4 +14,31 @@
    7.13      public static native JSObject create(JSObject vectorLayer)/*-{
    7.14          return new $wnd.OpenLayers.Control.ModifyFeature(vectorLayer);
    7.15      }-*/;    
    7.16 +    
    7.17 +    public static native JSObject create(JSObject vectorLayer, JSObject options)/*-{
    7.18 +         return new $wnd.OpenLayers.Control.ModifyFeature(vectorLayer, options);
    7.19 +    }-*/;
    7.20 +
    7.21 +	public static native JSObject createOnModificationStartCallback(OnModificationStartListener listener)/*-{
    7.22 +		var callback = function(obj){
    7.23 +			var vectorFeatureObj = @org.gwtopenmaps.openlayers.client.feature.VectorFeature::narrowToVectorFeature(Lorg/gwtopenmaps/openlayers/client/util/JSObject;)(obj);
    7.24 +			listener.@org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationStartListener::onModificationStart(Lorg/gwtopenmaps/openlayers/client/feature/VectorFeature;)(vectorFeatureObj);
    7.25 +		}                                                                     
    7.26 +		return callback;
    7.27 +	}-*/;
    7.28 +
    7.29 +	public static native JSObject createOnModificationCallback(OnModificationListener listener) /*-{
    7.30 +	        var callback = function(obj){
    7.31 +	        var vectorFeatureObj = @org.gwtopenmaps.openlayers.client.feature.VectorFeature::narrowToVectorFeature(Lorg/gwtopenmaps/openlayers/client/util/JSObject;)(obj);
    7.32 +	        listener.@org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationListener::onModification(Lorg/gwtopenmaps/openlayers/client/feature/VectorFeature;)(vectorFeatureObj);
    7.33 +        }                                                                     
    7.34 +        return callback;
    7.35 +    }-*/;
    7.36 +	public static native JSObject createOnModificationEndCallback(OnModificationEndListener listener)/*-{
    7.37 +	var callback = function(obj){
    7.38 +		var vectorFeatureObj = @org.gwtopenmaps.openlayers.client.feature.VectorFeature::narrowToVectorFeature(Lorg/gwtopenmaps/openlayers/client/util/JSObject;)(obj);
    7.39 +		listener.@org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationEndListener::onModificationEnd(Lorg/gwtopenmaps/openlayers/client/feature/VectorFeature;)(vectorFeatureObj);
    7.40 +	}                                                                     
    7.41 +	return callback;
    7.42 +}-*/;
    7.43  }
     8.1 --- a/src/main/java/org/gwtopenmaps/openlayers/client/control/ModifyFeatureOptions.java	Tue Oct 27 01:16:34 2009 +0100
     8.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/control/ModifyFeatureOptions.java	Tue Oct 27 01:16:59 2009 +0100
     8.3 @@ -1,11 +1,47 @@
     8.4  package org.gwtopenmaps.openlayers.client.control;
     8.5  
     8.6 +import org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationEndListener;
     8.7 +import org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationListener;
     8.8 +import org.gwtopenmaps.openlayers.client.control.ModifyFeature.OnModificationStartListener;
     8.9 +import org.gwtopenmaps.openlayers.client.util.JSObject;
    8.10 +
    8.11  /**
    8.12   * Options specific to Modify Feature Control.
    8.13   *
    8.14   * @author Edwin Commandeur - Atlis EJS
    8.15   *
    8.16   */
    8.17 -public class ModifyFeatureOptions extends ControlOptions{
    8.18 -
    8.19 +public class ModifyFeatureOptions extends ControlOptions {
    8.20 +	
    8.21 +	public void setClickout(boolean clickout) {
    8.22 +		getJSObject().setProperty("clickout", clickout);
    8.23 +	}
    8.24 +	
    8.25 +	public void setToggle(boolean toggle) {
    8.26 +		getJSObject().setProperty("toggle", toggle);
    8.27 +	}
    8.28 +	
    8.29 +	public void setDeleteCodes(int[] deleteCodes) {
    8.30 +		//TODO make the JSArray for the deleteCodes and pass it in... This just shuts off all deleting.
    8.31 +		getJSObject().setProperty("deleteCodes", JSObject.createJSObject());
    8.32 +	}
    8.33 +	
    8.34 +	public void setMode(int mode) {
    8.35 +		getJSObject().setProperty("mode", mode);
    8.36 +	}
    8.37 +	
    8.38 +	public void onModificationStart(OnModificationStartListener listener) {
    8.39 +		JSObject callback = ModifyFeatureImpl.createOnModificationStartCallback(listener);
    8.40 +		getJSObject().setProperty("onModificationStart", callback);
    8.41 +	}
    8.42 +	
    8.43 +	public void onModification(OnModificationListener listener) {
    8.44 +		JSObject callback = ModifyFeatureImpl.createOnModificationCallback(listener);
    8.45 +		getJSObject().setProperty("onModification", callback);
    8.46 +	}
    8.47 +	
    8.48 +	public void onModificationEnd(OnModificationEndListener listener) {
    8.49 +		JSObject callback = ModifyFeatureImpl.createOnModificationEndCallback(listener);
    8.50 +		getJSObject().setProperty("onModificationEnd", callback);
    8.51 +	}
    8.52  }
     9.1 --- a/src/main/java/org/gwtopenmaps/openlayers/client/control/SelectFeatureOptions.java	Tue Oct 27 01:16:34 2009 +0100
     9.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/control/SelectFeatureOptions.java	Tue Oct 27 01:16:59 2009 +0100
     9.3 @@ -28,14 +28,20 @@
     9.4  	public void setToggle() {
     9.5  		getJSObject().setProperty("toggle", true);
     9.6  	}
     9.7 -
     9.8 +	
     9.9  	/**
    9.10  	 *
    9.11  	 */
    9.12  	public void setMultiple() {
    9.13  		getJSObject().setProperty("multiple", true);
    9.14  	}
    9.15 -
    9.16 +	
    9.17 +	/**
    9.18 +	 * Allows features to be selected by dragging a box.
    9.19 +	 */
    9.20 +         public void setBox(boolean box) {
    9.21 +             getJSObject().setProperty("box", box);
    9.22 +        }
    9.23  	/**
    9.24  	 * Triggers when a feature is selected
    9.25  	 * 
    10.1 --- a/src/main/java/org/gwtopenmaps/openlayers/client/handler/HandlerOptions.java	Tue Oct 27 01:16:34 2009 +0100
    10.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/handler/HandlerOptions.java	Tue Oct 27 01:16:59 2009 +0100
    10.3 @@ -1,12 +1,19 @@
    10.4 -package org.gwtopenmaps.openlayers.client.handler;
    10.5 -
    10.6 -import org.gwtopenmaps.openlayers.client.util.JSObject;
    10.7 -import org.gwtopenmaps.openlayers.client.util.JSObjectWrapper;
    10.8 -
    10.9 -public class HandlerOptions extends JSObjectWrapper {
   10.10 -
   10.11 -	protected HandlerOptions(JSObject jsObject) {
   10.12 -		super(jsObject);
   10.13 -	}
   10.14 -
   10.15 -}
   10.16 +package org.gwtopenmaps.openlayers.client.handler;
   10.17 +
   10.18 +import org.gwtopenmaps.openlayers.client.util.JSObject;
   10.19 +import org.gwtopenmaps.openlayers.client.util.JSObjectWrapper;
   10.20 +
   10.21 +public class HandlerOptions extends JSObjectWrapper {
   10.22 +
   10.23 +	protected HandlerOptions(JSObject jsObject) {
   10.24 +		super(jsObject);
   10.25 +	}
   10.26 +
   10.27 +	/**
   10.28 +	 * 
   10.29 +	 * @param keyMask Use bitwise operators and one or more of the OpenLayers.Handler constants to construct a keyMask.
   10.30 +	 */
   10.31 +	public void setKeyMask(int keyMask) {
   10.32 +		getJSObject().setProperty("keyMask", keyMask);
   10.33 +	}
   10.34 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/handler/PathHandlerOptions.java	Tue Oct 27 01:16:59 2009 +0100
    11.3 @@ -0,0 +1,18 @@
    11.4 +package org.gwtopenmaps.openlayers.client.handler;
    11.5 +
    11.6 +import org.gwtopenmaps.openlayers.client.util.JSObject;
    11.7 +/**
    11.8 + * Options which control the behavior of the RegularPolygonHandler
    11.9 + * @author rhs - Roland.Schweitzer@noaa.gov
   11.10 + *
   11.11 + */
   11.12 +public class PathHandlerOptions extends HandlerOptions {
   11.13 +
   11.14 +	protected PathHandlerOptions(JSObject jsObject) {
   11.15 +		super(jsObject);
   11.16 +	}
   11.17 +
   11.18 +	public PathHandlerOptions() { 
   11.19 +		this(JSObject.createJSObject());
   11.20 +	}
   11.21 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/layer/Boxes.java	Tue Oct 27 01:16:59 2009 +0100
    12.3 @@ -0,0 +1,19 @@
    12.4 +package org.gwtopenmaps.openlayers.client.layer;
    12.5 +
    12.6 +import org.gwtopenmaps.openlayers.client.util.JSObject;
    12.7 +
    12.8 +public class Boxes extends Markers {
    12.9 +
   12.10 +	protected Boxes(JSObject element) {
   12.11 +		super(element);
   12.12 +	}
   12.13 +
   12.14 +	public Boxes(String name, BoxesMarkersOptions options) {
   12.15 +		this(BoxesImpl.create(name, options.getJSObject()));
   12.16 +	}
   12.17 +
   12.18 +	public Boxes(String name) {
   12.19 +		this(BoxesImpl.create(name));
   12.20 +	}
   12.21 +
   12.22 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/layer/BoxesImpl.java	Tue Oct 27 01:16:59 2009 +0100
    13.3 @@ -0,0 +1,14 @@
    13.4 +package org.gwtopenmaps.openlayers.client.layer;
    13.5 +
    13.6 +import org.gwtopenmaps.openlayers.client.util.JSObject;
    13.7 +
    13.8 +public class BoxesImpl {
    13.9 +
   13.10 +	public static native JSObject create(String name, JSObject options)/*-{
   13.11 +		return new $wnd.OpenLayers.Layer.Boxes(name, options);
   13.12 +	}-*/;
   13.13 +	
   13.14 +	public static native JSObject create(String name)/*-{
   13.15 +	    return new $wnd.OpenLayers.Layer.Boxes(name);
   13.16 +	}-*/;
   13.17 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/layer/BoxesMarkersOptions.java	Tue Oct 27 01:16:59 2009 +0100
    14.3 @@ -0,0 +1,17 @@
    14.4 +package org.gwtopenmaps.openlayers.client.layer;
    14.5 +
    14.6 +import org.gwtopenmaps.openlayers.client.util.JSObject;
    14.7 +
    14.8 +public class BoxesMarkersOptions extends MarkersOptions {
    14.9 +
   14.10 +	public BoxesMarkersOptions(JSObject jsObject) {
   14.11 +		super(jsObject);
   14.12 +	}
   14.13 +
   14.14 +	public BoxesMarkersOptions() {
   14.15 +		this(JSObject.createJSObject());
   14.16 +	}
   14.17 + 
   14.18 +	
   14.19 +	
   14.20 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/marker/Box.java	Tue Oct 27 01:16:59 2009 +0100
    15.3 @@ -0,0 +1,25 @@
    15.4 +package org.gwtopenmaps.openlayers.client.marker;
    15.5 +
    15.6 +import org.gwtopenmaps.openlayers.client.Bounds;
    15.7 +import org.gwtopenmaps.openlayers.client.LonLat;
    15.8 +import org.gwtopenmaps.openlayers.client.Marker;
    15.9 +import org.gwtopenmaps.openlayers.client.util.JSObject;
   15.10 +
   15.11 +public class Box extends Marker {
   15.12 +
   15.13 +	protected Box(JSObject element) {
   15.14 +		super(element);
   15.15 +	}
   15.16 +
   15.17 +	public Box(Bounds bounds, String borderColor, int borderWidth) {
   15.18 +		this(BoxImpl.create(bounds.getJSObject(), borderColor, borderWidth));
   15.19 +	}
   15.20 +
   15.21 +	public Box(Bounds bounds) {
   15.22 +		this(BoxImpl.create(bounds.getJSObject(), "red", 2));
   15.23 +	}
   15.24 +	public void setBorder(String borderColor, int borderWidth) {
   15.25 +		BoxImpl.setBorder(getJSObject(), borderColor, borderWidth);
   15.26 +	}
   15.27 +
   15.28 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/src/main/java/org/gwtopenmaps/openlayers/client/marker/BoxImpl.java	Tue Oct 27 01:16:59 2009 +0100
    16.3 @@ -0,0 +1,14 @@
    16.4 +package org.gwtopenmaps.openlayers.client.marker;
    16.5 +
    16.6 +import org.gwtopenmaps.openlayers.client.util.JSObject;
    16.7 +
    16.8 +class BoxImpl {
    16.9 +
   16.10 +	public static native JSObject create(JSObject bounds, String borderColor, int borderWidth)/*-{
   16.11 +	     return new $wnd.OpenLayers.Marker.Box(bounds, borderColor, borderWidth);
   16.12 +    }-*/;
   16.13 +	public static native void setBorder(JSObject object, String borderColor, int borderWidth)/*-{
   16.14 +		object.setBorder(borderColor, borderWidth);
   16.15 +	}-*/;
   16.16 +
   16.17 +}