SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/location/map-api-adapters/map-adapter-template.js

304 lines
11 KiB
JavaScript

"use strict";
/* global console: true */
/**
* This file defines methods that a map adapter needs to implement.
* The map adapter API is called by Abstract Map API (defined in abstract-map-api.js).
* The methods signatures of map adapters are as same as in Abstract Map API.
* The Abstract Map API implementation delegates some API calls to corresponding API of active map adapter.
*
* NOTE: This file is NOT intended to be used directly. It is used as as a template when adding a new map adapter.
*/
(function () {
var adapter = {};
/**
* Namespace for event static methods
*/
adapter.event = {};
/**
* Add the given listener function to the given event name for the given object instance.
* @param {bmcMaps.MVCObject} abstraction Abstract map object instance
* @param {string} eventType Event name to listen on
* @param {Function} listener Listener function callback
*/
adapter.event.addListener = function (abstraction, eventType, listener) {
//TODO: implementation
console.log("event.addListener", abstraction, eventType, listener);
};
/**
* Trigger the given event on given object instance.
* @param {bmcMaps.MVCObject} abstraction Abstract map object instance
* @param {string} eventType Event name to listen on
*/
adapter.event.trigger = function (abstraction, eventType) {
//TODO: implementation
console.log("event.trigger", abstraction, eventType);
};
/**
* Cross browser event handler registration.
* @param {Node} element HTML node element
* @param {string} eventType Event name to listen on
* @param {Function} listener Listener function callback
*/
adapter.event.addDomListener = function (element, eventType, listener) {
//TODO: implementation
console.log("event.addDomListener", element, eventType, listener);
};
/**
* Like addListener, but the handler removes itself after handling the first event.
* @param {bmcMaps.MVCObject} abstraction Abstract map object instance
* @param {string} eventType Event name to listen on
* @param {Function} listener Listener function callback
*/
adapter.event.addListenerOnce = function (abstraction, eventType, listener) {
//TODO: implementation
console.log("event.addListenerOnce", abstraction, eventType, listener);
};
adapter.MapTypeRegistry = function (map) {
//TODO: implementation
console.log("MapTypeRegistry", map);
};
/**
* Set a custom map type.
* @param {string} id Identifier of map type
* @param {Object} mapType Object to specify a custom map type
*/
adapter.MapTypeRegistry.prototype.set = function (id, mapType) {
//TODO: implementation
console.log("MapTypeRegistry.set", id, mapType);
};
/**
* Create Map object.
* The object returned by this method must implement an interface for map object. Refer to methods of {adapter.Map} for the interface.
* @param {Node} element HTML node element as map container
* @param {Object} options Map options with key-value pairs
*/
adapter.map = function (element, options) {
//TODO: implementation
console.log("map", element, options);
};
adapter.Map = function (element, options) {
//TODO: implementation
console.log("Map", element, options);
};
/**
* Return map type registry object.
* The object returned by this method must implement an interface for map type registry object. Refer to methods of {adapter.MapTypeRegistry} for the interface.
* @return {Object}
*/
adapter.Map.prototype.getMapTypeRegistry = function () {
return new adapter.MapTypeRegistry(this);
};
/**
* Set the position displayed at the center of the map.
* @param {bmcMaps.LatLng} latlng Position to be the center of the map
*/
adapter.Map.prototype.setCenter = function (latlng) {
//TODO: implementation
console.log("Map.setCenter", latlng);
};
/**
* Set the map type to be displayed
* @param {bmcMaps.MapTypeId|String} mapTypeId Identifier of map type to be displayed
*/
adapter.Map.prototype.setMapTypeId = function (mapTypeId) {
//TODO: implementation
console.log("Map.setMapTypeId", mapTypeId);
};
/**
* Return the position displayed at the center of the map.
* @returns {bmcMaps.LatLng} Position of the map center
*/
adapter.Map.prototype.getCenter = function () {
//TODO: implementation
console.log("Map.getCenter");
};
/**
* Set the viewport to contain the given bounds.
* @param {bmcMaps.LatLngBounds} bounds
*/
adapter.Map.prototype.fitBounds = function (bounds) {
//TODO: implementation
console.log("Map.fitBounds", bounds);
};
/**
* Set the zoom level of the map.
* @param {number} zoom
*/
adapter.Map.prototype.setZoom = function (zoom) {
//TODO: implementation
console.log("Map.setZoom", zoom);
};
/**
* Get the zoom level of the map.
* @return {number}
*/
adapter.Map.prototype.getZoom = function () {
//TODO: implementation
console.log("Map.getZoom");
};
/**
* Returns the lat/lng bounds of the current viewport.
* @return {bmcMaps.LatLngBounds}
*/
adapter.Map.prototype.getBounds = function () {
//TODO: implementation
console.log("Map.getBounds");
};
/**
* Returns the current Projection of the map.
* The object returned by this method must implement an interface for map projection object. Refer to methods of {adapter.Projection} for the interface.
* @return {Object}
*/
adapter.Map.prototype.getProjection = function () {
return new adapter.Projection(this);
};
/**
* Pans the map by the minimum amount necessary to contain the given LatLngBounds.
* @param {bmcMaps.LatLngBounds} bounds
*/
adapter.Map.prototype.panToBounds = function (bounds) {
//TODO: implementation
console.log("Map.panToBounds", bounds);
};
/**
* Changes the center of the map to the given LatLng.
* @param {bmcMaps.LatLng} latlng
*/
adapter.Map.prototype.panTo = function (latlng) {
//TODO: implementation
console.log("Map.panTo", latlng);
};
adapter.Projection = function (map) {
//TODO: implementation
console.log("Projection", map);
};
/**
* Translates from world coordinates on a map projection to LatLng values.
* @param {bmcMaps.Point} point World coordinates point
* @return {bmcMaps.LatLng}
*/
adapter.Projection.prototype.fromPointToLatLng = function (point) {
//TODO: implementation
console.log("Projection.fromPointToLatLng", point);
};
/**
* Create an object representing infoWindow.
* The object returned by this method must implement an interface for infoWindow object. Refer to methods of {adapter.InfoWindow} for the interface.
* @param {Object} options Optional properties to set
*/
adapter.infoWindow = function (options) {
//TODO: implementation
console.log("infoWindow", options);
};
adapter.InfoWindow = function (options) {
//TODO: implementation
console.log("InfoWindow", options);
};
/**
* Opens this InfoWindow on the given map.
*/
adapter.InfoWindow.prototype.open = function () {
//TODO: implementation
console.log("InfoWindow.open");
};
/**
* Create an object representing richMarker.
* The object returned by this method must implement an interface for richMarker object. Refer to methods of {adapter.RichMarker} for the interface.
* @param {Object} options Optional properties to set
*/
adapter.richMarker = function (options) {
//TODO: implementation
console.log("richMarker", options);
};
adapter.RichMarker = function (options) {
//TODO: implementation
console.log("RichMarker", options);
};
/**
* Set position to display the marker
* @param {bmcMaps.LatLng} latlng position The position to set
*/
adapter.RichMarker.prototype.setPosition = function (latlng) {
//TODO: implementation
console.log("RichMarker.setPosition", latlng);
};
/**
* Sets the visiblility state of the marker.
*
* @param {boolean} visible The visiblilty of the marker
*/
adapter.RichMarker.prototype.setVisible = function (visible) {
//TODO: implementation
console.log("RichMarker.setVisible", visible);
};
/**
* Create an object representing infoBubble.
* The object returned by this method must implement an interface for infoBubble object. Refer to methods of {adapter.InfoBubble} for the interface.
* @param {Object} options Optional properties to set
*/
adapter.infoBubble = function (options) {
//TODO: implementation
console.log("infoBubble", options);
};
adapter.InfoBubble = function (options) {
//TODO: implementation
console.log("InfoBubble", options);
};
/**
* Open the InfoBubble.
*
* @param {bmcMaps.Map} map Map to open on.
* @param {bmcMaps.MVCObject} anchor Optional anchor to position at.
*/
adapter.InfoBubble.prototype.open = function (map, marker) {
//TODO: implementation
console.log("InfoBubble.open", map, marker);
};
/**
* Close the InfoBubble
*/
adapter.InfoBubble.prototype.close = function () {
//TODO: implementation
console.log("InfoBubble.close");
};
/**
* Get the content of the infobubble.
*
* @return {string|Node} The marker content.
*/
adapter.InfoBubble.prototype.getContent = function () {
//TODO: implementation
console.log("InfoBubble.getContent");
};
/**
* Sets the content of the infobubble.
*
* @param {string|Node} content The content to set.
*/
adapter.InfoBubble.prototype.setContent = function (content) {
//TODO: implementation
console.log("InfoBubble.setContent", content);
};
/**
* Create an object representing markerClusterer.
* The object returned by this method must implement an interface for markerClusterer object. Refer to methods of {adapter.MarkerClusterer} for the interface.
* @param {Object} options Optional properties to set
*/
adapter.markerClusterer = function (map, markers, options) {
//TODO: implementation
console.log("markerClusterer", map, markers, options);
};
adapter.MarkerClusterer = function (map, markers, options) {
//TODO: implementation
console.log("MarkerClusterer", map, markers, options);
};
/**
* Removes all clusters and markers from the map and also removes all markers managed by the clusterer.
*/
adapter.MarkerClusterer.prototype.clearMarkers = function () {
//TODO: implementation
console.log("MarkerClusterer.clearMarkers");
};
bmcMaps.adapters.register('adapter-id', adapter);
})();