annotate geotemco/js/Map/CircleObject.js @ 25:057b56c62b13

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