0byt3m1n1
Path:
/
var
/
lib
/
vz
/
www
/
clients
/
client6
/
web11
/
web
/
wp-content
/
plugins
/
wp-google-maps
/
docs
/
[
Home
]
File: marker.js.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: marker.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: marker.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>/** * @namespace WPGMZA * @module Marker * @requires WPGMZA */ (function($) { /** * Constructor * @param json to load (optional) */ WPGMZA.Marker = function(row) { var self = this; WPGMZA.assertInstanceOf(this, "Marker"); this.lat = "36.778261"; this.lng = "-119.4179323999"; this.address = "California"; this.title = null; this.description = ""; this.link = ""; this.icon = ""; this.approved = 1; this.pic = null; WPGMZA.MapObject.apply(this, arguments); if(row && row.heatmap) return; // Don't listen for these events on heatmap markers. this.on("init", function(event) { if(row.position) this.setPosition(row.position); if(row.map) row.map.addMarker(this); }); this.addEventListener("added", function(event) { self.onAdded(event); }); } WPGMZA.Marker.prototype = Object.create(WPGMZA.MapObject.prototype); WPGMZA.Marker.prototype.constructor = WPGMZA.Marker; /** * Gets the constructor. You can use this instead of hard coding the parent class when inheriting, * which is helpful for making subclasses that work with Basic only, Pro, Google, OL or a * combination of the four. * @return function */ WPGMZA.Marker.getConstructor = function() { switch(WPGMZA.settings.engine) { case "google-maps": if(WPGMZA.isProVersion()) return WPGMZA.GoogleProMarker; return WPGMZA.GoogleMarker; break; default: if(WPGMZA.isProVersion()) return WPGMZA.OLProMarker; return WPGMZA.OLMarker; break; } } WPGMZA.Marker.createInstance = function(row) { var constructor = WPGMZA.Marker.getConstructor(); return new constructor(row); } WPGMZA.Marker.ANIMATION_NONE = "0"; WPGMZA.Marker.ANIMATION_BOUNCE = "1"; WPGMZA.Marker.ANIMATION_DROP = "2"; WPGMZA.Marker.prototype.onAdded = function(event) { var self = this; this.infoWindow = WPGMZA.InfoWindow.createInstance(this); this.addEventListener("click", function(event) { self.onClick(event); }); this.addEventListener("mouseover", function(event) { self.onMouseOver(event); }); this.addEventListener("select", function(event) { self.onSelect(event); }); if(this.map.settings.marker == this.id) self.trigger("select"); } /** * This function will hide the last info the user interacted with * @return void */ WPGMZA.Marker.prototype.hidePreviousInteractedInfoWindow = function() { if(!this.map.lastInteractedMarker) return; this.map.lastInteractedMarker.infoWindow.close(); } WPGMZA.Marker.prototype.openInfoWindow = function() { this.hidePreviousInteractedInfoWindow(); this.infoWindow.open(this.map, this); this.map.lastInteractedMarker = this; } WPGMZA.Marker.prototype.onClick = function(event) { } WPGMZA.Marker.prototype.onSelect = function(event) { this.openInfoWindow(); } WPGMZA.Marker.prototype.onMouseOver = function(event) { if(this.map.settings.info_window_open_by == WPGMZA.InfoWindow.OPEN_BY_HOVER) this.openInfoWindow(); } WPGMZA.Marker.prototype.getIcon = function() { return WPGMZA.settings.default_marker_icon; } /** * Gets the position of the marker * @return object */ WPGMZA.Marker.prototype.getPosition = function() { return { lat: parseFloat(this.lat), lng: parseFloat(this.lng) }; } /** * Sets the position of the marker * @return void */ WPGMZA.Marker.prototype.setPosition = function(latLng) { if(latLng instanceof WPGMZA.LatLng) { this.lat = latLng.lat; this.lng = latLng.lng; } else { this.lat = parseFloat(latLng.lat); this.lng = parseFloat(latLng.lng); } } /** * Set the marker animation * @return void */ WPGMZA.Marker.prototype.getAnimation = function(animation) { return this.settings.animation; } /** * Set the marker animation * @return void */ WPGMZA.Marker.prototype.setAnimation = function(animation) { this.settings.animation = animation; } /** * Get the marker visibility * @return void */ WPGMZA.Marker.prototype.getVisible = function(visible) { } /** * Set the marker visibility. This is used by the store locator etc. and is not a setting * @return void */ WPGMZA.Marker.prototype.setVisible = function(visible) { if(!visible && this.infoWindow) this.infoWindow.close(); } WPGMZA.Marker.prototype.setMap = function(map) { if(!map) { if(this.map) this.map.removeMarker(this); return; } map.addMarker(this); } WPGMZA.Marker.prototype.getDraggable = function() { } WPGMZA.Marker.prototype.setDraggable = function(draggable) { } WPGMZA.Marker.prototype.panIntoView = function() { if(!this.map) throw new Error("Marker hasn't been added to a map"); this.map.setCenter(this.getPosition()); } /** * Returns the marker as a JSON object * @return object */ WPGMZA.Marker.prototype.toJSON = function() { var result = WPGMZA.MapObject.prototype.toJSON.call(this); var position = this.getPosition(); $.extend(result, { lat: position.lat, lng: position.lng, address: this.address, title: this.title, description: this.description, link: this.link, icon: this.icon, pic: this.pic, approved: this.approved }); return result; } })(jQuery);</code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Circle.html">Circle</a></li><li><a href="module-Distance.html">Distance</a></li><li><a href="module-Event.html">Event</a></li><li><a href="module-EventDispatcher.html">EventDispatcher</a></li><li><a href="module-FriendlyError.html">FriendlyError</a></li><li><a href="module-Geocoder.html">Geocoder</a></li><li><a href="module-GoogleCircle.html">GoogleCircle</a></li><li><a href="module-GoogleGeocoder.html">GoogleGeocoder</a></li><li><a href="module-GoogleInfoWindow.html">GoogleInfoWindow</a></li><li><a href="module-GoogleMap.html">GoogleMap</a></li><li><a href="module-GoogleMarker.html">GoogleMarker</a></li><li><a href="module-GoogleModernStoreLocator.html">GoogleModernStoreLocator</a></li><li><a href="module-GoogleModernStoreLocatorCircle.html">GoogleModernStoreLocatorCircle</a></li><li><a href="module-GooglePolygon.html">GooglePolygon</a></li><li><a href="module-GooglePolyline.html">GooglePolyline</a></li><li><a href="module-GoogleVertexContextMenu.html">GoogleVertexContextMenu</a></li><li><a href="module-InfoWindow.html">InfoWindow</a></li><li><a href="module-LatLng.html">LatLng</a></li><li><a href="module-LatLngBounds.html">LatLngBounds</a></li><li><a href="module-Map.html">Map</a></li><li><a href="module-MapObject.html">MapObject</a></li><li><a href="module-MapsEngineDialog.html">MapsEngineDialog</a></li><li><a href="module-MapSettings.html">MapSettings</a></li><li><a href="module-Marker.html">Marker</a></li><li><a href="module-ModernStoreLocator.html">ModernStoreLocator</a></li><li><a href="module-ModernStoreLocatorCircle.html">ModernStoreLocatorCircle</a></li><li><a href="module-OLCircle.html">OLCircle</a></li><li><a href="module-OLGeocoder.html">OLGeocoder</a></li><li><a href="module-OLInfoWindow.html">OLInfoWindow</a></li><li><a href="module-OLMap.html">OLMap</a></li><li><a href="module-OLMarker.html">OLMarker</a></li><li><a href="module-OLModernStoreLocator.html">OLModernStoreLocator</a></li><li><a href="module-OLModernStoreLocatorCircle.html">OLModernStoreLocatorCircle</a></li><li><a href="module-OLPolygon.html">OLPolygon</a></li><li><a href="module-OLPolyline.html">OLPolyline</a></li><li><a href="module-Polygon.html">Polygon</a></li><li><a href="module-Polyline.html">Polyline</a></li><li><a href="module-WPGMZA.html">WPGMZA</a></li></ul><h3>Classes</h3><ul><li><a href="module-Circle-Circle.html">Circle</a></li><li><a href="module-ModernStoreLocatorCircle-WPGMZA.ModernStoreLocatorCircle.html">ModernStoreLocatorCircle</a></li><li><a href="module-OLGeocoder-OLGeocoder.html">OLGeocoder</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed May 16 2018 13:18:38 GMT+0100 (GMT Daylight Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>