GpsGate Server JavaScript API

Map  1.0.0

GpsGate Server JavaScript API > Map > ilayer.js (source view)
Search:
 
Filters
/**
 *
 * @module Interface
 *
 */


/**
 * <i>if you only need to add map support you don't need to implement this</i><br />
 * interface for layers on the map.<br />
 * Layer is essentially an overlay but with grouping and ordering etc.<br />
 * see <a href="Franson.Map.IOverlay.html">Franson.Map.IOverlay</a> <br />
 * All maps need at least one layer, objects are then added as Overlays
 * @class Franson.Map.ILayer
 * @constructor
 */
Franson.Map.ILayer = function(id, name/*, [...]*/) // document the params?
{
	// typical

	/**
	 * @type string
	 */
	this.id = id;

	/**
	 * @type {string}
	 * @private
	 */
	this._name = name;

	// [...]
};


// methods
Franson.Map.ILayer.prototype =
{
	/**
	 * IOverlay (+ root..)
	 * root is the "handle" we get from mapSurface to attach to
	 * @method initialize
	 * @param {Franson.Map.MapSurface} mapSurface
	 * @param {dojox.gfx.Container} root
	 */
	initialize: function(mapSurface, root)
	{
		// typical
		this._mapSurface = mapSurface;
		this._root = root;
		// [...]
	},

	/**
	 * destructor
	 * @method destroy
	 */
	destroy: function() // todo: shouldn't this document an optional "deep" param also?
	{
		// [...]
		this.remove();
		disconnectAll(this);
	},

	/**
	 * @method getSurface
	 * @return {Franson.Map.MapSurface}
	 */
	getSurface: function()
	{
		// typical
		return this._mapSurface;
	},

	/**
	 * remove? (make part of "physical layer" sub-class instead?)
	 * @method getRooot
	 * @return {dojox.gfx.Group}
	 */
	getRoot: function()
	{
		// typical
		return this._root;
	},

	/**
	 * @method redraw
	 * @param {boolean} [force=false]
 	 */
	redraw: function(force)
	{
		// [...]
	},

	/**
	 * @method remove
	 */
	remove: function()
	{
		// typical
		this._root.removeShape();
		// [...]
		signal(this, 'onremove');
	},

	/**
	 * @method getName
	 * @return {string}
	 */
	getName: function()
	{
		// typical
		return this._name;
	},

	/**
	 * @method setName
	 * @param {string} name
	 */
	setName: function(name)
	{
		// tyical
		this._name = name;
	},

	/**
	 * see <a href="http://code.google.com/apis/maps/documentation/reference.html#GMap2.addOverlay">GMap.addOverlay()</a>
	 * @method addOverlay
	 * @param {Franson.Map.IOverlay} overlay
	 */
	addOverlay: function(overlay)
	{
		// [...]
		// signal?
	},

	/**
	 * see <a href="http://code.google.com/apis/maps/documentation/reference.html#GMap2.removeOverlay">GMap.removeOverlay()</a>
	 * @method removeOverlay
	 * @param {Franson.Map.IOverlay} overlay
	 */
	removeOverlay: function(overlay)
	{
		// [...]
		// ? disconnectAll(overlay); // hmm, this is quite useful I'd say. but GMap doesn't do this..
	},

	/**
	 * see <a href="http://code.google.com/apis/maps/documentation/reference.html#GMap2.clearOverlays">GMap.clearOverlays()</a>
	 * remove all overlays
	 * @method clearOverlays
	 */
	clearOverlays: function()
	{
		// [...]
	},

	/**
	 * @method hide
	 */
	hide: function()
	{
		// [...]
		signal(this, 'onvisibilitychanged', false);
	},

	/**
	 * @method show
	 */
	show: function()
	{
		// [...]
		signal(this, 'onvisibilitychanged', true);
	},

	/**
	 * @method isHidden
	 * @return {boolean}
	 */
	isHidden: function()
	{
		// [...]
	}
};

/**
 * fired in <a href="#method_show">show()</a> and <a href="#method_hide">hide()</a>
 * @event onvisibilitychanged
 * @param {boolean} visible
 */

/**
 * fired in <a href="#method_remove">remove()</a>
 * @event onremove
 */

Copyright © 2009 Franson Technology AB, Sweden. All rights reserved.