0
|
1 /*
|
|
2 * CircleObject.js
|
|
3 *
|
|
4 * Copyright (c) 2012, Stefan Jänicke. All rights reserved.
|
|
5 *
|
|
6 * This library is free software; you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU Lesser General Public
|
|
8 * License as published by the Free Software Foundation; either
|
|
9 * version 3 of the License, or (at your option) any later version.
|
|
10 *
|
|
11 * This library is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * Lesser General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU Lesser General Public
|
|
17 * License along with this library; if not, write to the Free Software
|
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
19 * MA 02110-1301 USA
|
|
20 */
|
|
21
|
|
22 /**
|
|
23 * @class CircleObject
|
|
24 * circle object aggregate for the map
|
|
25 * @author Stefan Jänicke (stjaenicke@informatik.uni-leipzig.de)
|
|
26 * @release 1.0
|
|
27 * @release date: 2012-07-27
|
|
28 * @version date: 2012-07-27
|
|
29 *
|
|
30 * @param {float} x the x (longitude) value for the circle
|
|
31 * @param {float} y the y (latitude) value for the circle
|
|
32 * @param {DataObject[]} elements array of data objects belonging to the circle
|
|
33 * @param {float} radius the resulting radius (in pixel) for the circle
|
|
34 * @param {int} search dataset index
|
|
35 * @param {int} weight summed weight of all elements
|
|
36 * @param {JSON} fatherBin bin of the circle object if its part of a circle pack
|
|
37 */
|
|
38 CircleObject = function(originX, originY, shiftX, shiftY, elements, radius, search, weight, fatherBin) {
|
|
39
|
|
40 this.originX = originX;
|
|
41 this.originY = originY;
|
|
42 this.shiftX = shiftX;
|
|
43 this.shiftY = shiftY;
|
|
44 this.elements = elements;
|
|
45 this.radius = radius;
|
|
46 this.search = search;
|
|
47 this.weight = weight;
|
|
48 this.overlay = 0;
|
|
49 this.overlayElements = [];
|
|
50 this.smoothness = 0;
|
|
51 this.fatherBin = fatherBin;
|
|
52
|
|
53 this.feature
|
|
54 this.olFeature
|
|
55 this.percentage = 0;
|
|
56 this.selected = false;
|
|
57
|
|
58 };
|
|
59
|
|
60 CircleObject.prototype = {
|
|
61
|
|
62 /**
|
|
63 * sets the OpenLayers point feature for this point object
|
|
64 * @param {OpenLayers.Feature} pointFeature the point feature for this object
|
|
65 */
|
|
66 setFeature : function(feature) {
|
|
67 this.feature = feature;
|
|
68 },
|
|
69
|
|
70 /**
|
|
71 * sets the OpenLayers point feature for this point object to manage its selection status
|
|
72 * @param {OpenLayers.Feature} olPointFeature the overlay point feature for this object
|
|
73 */
|
|
74 setOlFeature : function(olFeature) {
|
|
75 this.olFeature = olFeature;
|
|
76 },
|
|
77
|
|
78 reset : function() {
|
|
79 this.overlay = 0;
|
|
80 this.overlayElements = [];
|
|
81 this.smoothness = 0;
|
|
82 },
|
|
83
|
|
84 setSelection : function(s) {
|
|
85 this.selected = s;
|
|
86 },
|
|
87
|
|
88 toggleSelection : function() {
|
|
89 this.selected = !this.selected;
|
|
90 }
|
|
91 };
|