PageSourceSearch

https://www.bgcgh.ca/wp-content/plugins/wp-google-maps/js/v8/circle.js?ver=10.0.09+pro-10.0.07

js bgcgh.ca collected 2026-10-06 18:38:47 UTC 4,785 bytes, 232 lines download raw bytes

1/**
2 * @namespace WPGMZA
3 * @module Circle
4 * @requires WPGMZA.Shape
5 * @pro-requires WPGMZA.ProShape
6 */
7jQuery(function($) {
8	
9	var Parent = WPGMZA.Shape;
10	
11	
12	/**
13	 * Base class for circles. <strong>Please <em>do not</em> call this constructor directly. Always use createInstance rather than instantiating this class directly.</strong> Using createInstance allows this class to be externally extensible.
14	 * @class WPGMZA.Circle
15	 * @constructor WPGMZA.Circle
16	 * @memberof WPGMZA
17	 * @augments WPGMZA.Feature
18	 * @see WPGMZA.Circle.createInstance
19	 */
20	WPGMZA.Circle = function(options, engineCircle)
21	{
22		var self = this;
23		
24		WPGMZA.assertInstanceOf(this, "Circle");
25		
26		this.center = new WPGMZA.LatLng();
27		this.radius = 100;
28		
29		Parent.apply(this, arguments);
30	}
31	
32
33	if(WPGMZA.isProVersion())
34		Parent = WPGMZA.ProShape;
35
36	WPGMZA.extend(WPGMZA.Circle, Parent);
37	
38	Object.defineProperty(WPGMZA.Circle.prototype, "fillColor", {
39		
40		enumerable: true,
41		
42		"get": function()
43		{
44			if(!this.color || !this.color.length)
45				return "#ff0000";
46			
47			return this.color;
48		},
49		"set" : function(a){
50			this.color = a;
51		}
52		
53	});
54	
55	Object.defineProperty(WPGMZA.Circle.prototype, "fillOpacity", {
56	
57		enumerable: true,
58		
59		"get": function()
60		{
61			if(!this.opacity && this.opacity != 0)
62				return 0.5;
63			
64			return parseFloat(this.opacity);
65		},
66		"set": function(a){
67			this.opacity = a;
68		}
69	
70	});
71	
72	Object.defineProperty(WPGMZA.Circle.prototype, "strokeColor", {
73		
74		enumerable: true,
75		
76		"get": function()
77		{
78			if(!this.lineColor){
79				return "#000000";
80			}
81			return this.lineColor;
82		},
83		"set": function(a){
84			this.lineColor = a;
85		}
86		
87	});
88	
89	Object.defineProperty(WPGMZA.Circle.prototype, "strokeOpacity", {
90		
91		enumerable: true,
92		
93		"get": function()
94		{
95			if(!this.lineOpacity && this.lineOpacity != 0)
96				return 0;
97			
98			return parseFloat(this.lineOpacity);
99		},
100		"set": function(a){
101			this.lineOpacity = a;
102		}
103		
104	});
105	
106	/**
107	 * Creates an instance of a circle, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
108	 * @method
109	 * @memberof WPGMZA.Circle
110	 * @param {object} options Options for the object (optional)
111	 */
112	WPGMZA.Circle.createInstance = function(options, engineCircle)
113	{
114		var constructor;
115		
116		switch(WPGMZA.settings.engine)
117		{
118			case "open-layers":
119			case "open-layers-latest":
120				if(WPGMZA.isProVersion()){
121					constructor = WPGMZA.OLProCircle;
122					break;
123				}
124				constructor = WPGMZA.OLCircle;
125				break;
126			case "leaflet":
127			case "leaflet-azure":
128			case "leaflet-stadia":
129			case "leaflet-maptiler":
130			case "leaflet-locationiq":
131			case "leaflet-zerocost":
132				if(WPGMZA.isProVersion()){
133					constructor = WPGMZA.LeafletProCircle;
134					break;
135				}
136				constructor = WPGMZA.LeafletCircle;
137				break;
138			
139			default:
140				if(WPGMZA.isProVersion()){
141					constructor = WPGMZA.GoogleProCircle;
142					break;
143				}
144				constructor = WPGMZA.GoogleCircle;
145				break;
146		}
147		
148		return new constructor(options, engineCircle);
149	}
150	
151	/**
152	 * Gets the circles center
153	 *
154	 * @method
155	 * @memberof WPGMZA.Circle
156	 * @returns {WPGMZA.LatLng}
157	 */
158	WPGMZA.Circle.prototype.getCenter = function()
159	{
160		return this.center.clone();
161	}
162	
163	/**
164	 * Sets the circles center
165	 *
166	 * @method
167	 * @memberof WPGMZA.Circle
168	 * @param {object|WPGMZA.LatLng} latLng either a literal or as a WPGMZA.LatLng
169	 */
170	WPGMZA.Circle.prototype.setCenter = function(latLng)
171	{
172		this.center.lat = latLng.lat;
173		this.center.lng = latLng.lng;
174	}
175	
176	/**
177	 * Gets the circles radius, in kilometers
178	 *
179	 * @method
180	 * @memberof WPGMZA.Circle
181	 * @param {object|WPGMZA.LatLng} latLng either a literal or as a WPGMZA.LatLng
182	 * @returns {WPGMZA.LatLng}
183	 */
184	WPGMZA.Circle.prototype.getRadius = function()
185	{
186		return this.radius;
187	}
188	
189	/**
190	 * Sets the circles radius, in kilometers
191	 *
192	 * @method
193	 * @memberof WPGMZA.Circle
194	 * @param {number} radius The radius
195	 * @returns {void}
196	 */
197	WPGMZA.Circle.prototype.setRadius = function(radius)
198	{
199		this.radius = radius;
200	}
201	
202	/**
203	 * Returns the map that this circle is being displayed on
204	 *
205	 * @method
206	 * @memberof WPGMZA.Circle
207	 * @return {WPGMZA.Map}
208	 */
209	WPGMZA.Circle.prototype.getMap = function()
210	{
211		return this.map;
212	}
213	
214	/**
215	 * Puts this circle on a map
216	 *
217	 * @method
218	 * @memberof WPGMZA.Circle
219	 * @param {WPGMZA.Map} map The target map
220	 * @return {void}
221	 */
222	WPGMZA.Circle.prototype.setMap = function(map)
223	{
224		if(this.map)
225			this.map.removeCircle(this);
226		
227		if(map)
228			map.addCircle(this);
229			
230	}
231	
232});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.