OpenLayers.Layer.Freemap je javascriptová knižnica do openlayers, ktorá je inšpirovaná knižnicou pre OSM. Cieľom je uľahčiť vytváranie vlastných aplikácií použijúc naše dlaždice.

Knižnica robí:

Pozor: testovacia verzia, NEPOUŽÍVAŤ


js

OpenLayers.Layer.Freemap = OpenLayers.Class(OpenLayers.Layer.OSM, {
	 name: "Freemap",
	 attribution: "Dáta CC-By-SA z <a href='http://openstreetmap.org/'>OpenStreetMap</a>, vizualizácia <a href='http://freemap.sk'>Freemap.sk</a>",
	 sphericalMercator: true,
	 url: 'http://tile.openstreetmap.org/${z}/${x}/${y}.png',
	 clone: function(obj) {
		 if (obj == null) {
			 obj = new OpenLayers.Layer.Freemap(
				 this.name, this.url, this.getOptions());
		 }  
		 obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
		 return obj;
	 },
	 wrapDateLine: true,
	 CLASS_NAME: "OpenLayers.Layer.Freemap"
});

/**
 * Class: OpenLayers.Layer.Freemap.T
 *
 * Inherits from:
 *  - <OpenLayers.Layer.Freemap>
 */
OpenLayers.Layer.Freemap.T = OpenLayers.Class(OpenLayers.Layer.Freemap, {
	/**
	 * Constructor: OpenLayers.Layer.Freemap.T
	 *
	 * Parameters:
	 * name - {String}
	 * options - {Object} Hashtable of extra options to tag onto the layer
	 */
	initialize: function(name, options) {
		var url = [
			"http://freemap.lnx.sk/presets/T/${z}/${x}/${y}.png",
			"http://t1.freemap.sk/T/${z}/${x}/${y}.png",
			"http://t2.freemap.sk/T/${z}/${x}/${y}.png",
				"http://localhost/${z}/${x}/${y}.png"
		];
		options = OpenLayers.Util.extend({
			numZoomLevels: 16,
			buffer: 0,
			transitionEffect: "resize"
		}, options);
		var newArguments = [name, url, options];
		OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
	},

	CLASS_NAME: "OpenLayers.Layer.Freemap.T"
});


Inicializácia:

map.addLayer(lnew OpenLayers.Layer.Freemap.T("Turistika"));
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki