view src/econnect/wp3_3/client/widgets/map/StiMap.java @ 61:eac73bf1ce6e CellTable

add overlay functionality (beta)
author Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
date Fri, 14 Dec 2012 16:33:36 +0100
parents cf06b77a8bbd
children d69066d16e45
line wrap: on
line source

package econnect.wp3_3.client.widgets.map;

import com.google.gwt.core.client.JavaScriptObject;
import econnect.wp3_3.client.core.StiCore;

/**
 * Implementation of the wrapper for the STIMap class of the STI JavaScript source
*/
public class StiMap extends JavaScriptObject {
	
	protected StiMap(){
	}
	
    /**
     * Initializes a STIMap element
     *
     * @param core the core of the STI
     * @param window the window div id for the container for the map element
     * @param container the container div id for the map element
     * @return a STIMap object
    */
	public static native StiMap createStiMap(StiCore core, String window, String container) /*-{
		return new $wnd.STIMap(core, window, container);
	}-*/;
	
	/**
	 * activates the a control of the map
	*/
	public final native void activate( String status ) /*-{
		this.activate(status);
	}-*/;
	
	/**
	 * deactivates the a control of the map
	*/
	public final native void deactivate( String status ) /*-{
		this.deactivate(status);
	}-*/;
	
	/**
	 * Getter for number of base layers of the map
	 * 
	 * @return the number of base layers
	*/
	public final native int getMapCount() /*-{
		return this.baseLayers.length;
	}-*/;	
	
	/**
	 * Getter for the name of a specific base layer
	 * 
	 * @return the name of a specific base layer
	*/
	public final native String getMapName( int index ) /*-{
		return this.baseLayers[index].name;
	}-*/;
	
	/**
	 * Setter for the top base layer
	 * 
	 * @param index the index of the base layer to set
	*/
	public final native void setMap( int index ) /*-{
		this.setMap(index);
	}-*/;

	/**
	 * Setter for the top base layer
	 * 
	 * @param index the index of the base layer to set
	*/
	public final native void setOverlay( int index ) /*-{
		this.setOverlay(index);
	}-*/;
	
	/**
	 * Getter for the number of zoom levels; depends on the number of zoomlevels which is coded in the js source
	 * 
	 * @return the number of zoom levels
	*/
	public final native int getNumZoomLevels() /*-{
		return this.openlayersMap.getNumZoomLevels();
	}-*/;	
	
	/**
	 * Getter for the actual zoom level
	 * 
	 * @return the actual zoom level
	*/
	public final native float getZoom() /*-{
		return this.openlayersMap.getZoom();
	}-*/;

	/**
	 * Changes the zoom of the map
	 * 
	 * @param delta the change of zoom levels
	*/	
	public final native void zoom(float delta) /*-{
		this.zoom(delta);
	}-*/;
	
	/**
	 * Changes connection status
	 * 
	 * @return boolean value, if connections are enabled or not
	*/	
	public final native boolean connectionsClick() /*-{
		return this.connectionsClick();
	}-*/;	

	/**
	 * Configures the map
	*/	
	public final native void configure(int zoom, float cLon, float cLat, int mapId) /*-{
		this.configure(zoom,cLon,cLat,mapId);
	}-*/;
	
	/**
	 * returns index of the current base layer
	*/	
	public final native int baseLayerIndex() /*-{
		return this.openlayersMap.getLayerIndex(this.openlayersMap.baseLayer);
	}-*/;
	
	/**
	 * returns center longitude
	*/	
	public final native float centerLon() /*-{
		return this.openlayersMap.getCenter().lon;
	}-*/;

	/**
	 * returns center latitude
	*/	
	public final native int centerLat() /*-{
		return this.openlayersMap.getCenter().lat;
	}-*/;

	/**
	 * returns center latitude
	*/	
	public final native int getConnections() /*-{
		if( this.showConnections ){
			return 1;
		}		
		return 0;
	}-*/;

	/**
	 * returns center latitude
	*/	
	public final native void setConnections(int c) /*-{
		if( c == 0 ){
			this.showConnections = false;
		}
		else {
			this.showConnections = true;
		}
	}-*/;

}