Mercurial > hg > STI-GWT
comparison war/scripts/sti/PointObject.js @ 3:cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@36 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
| author | StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b> |
|---|---|
| date | Tue, 17 Jul 2012 13:34:40 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 2:2897af43ccc6 | 3:cf06b77a8bbd |
|---|---|
| 1 /** | |
| 2 * describes a temporal point object, that can save elements of different data sets for one place | |
| 3 * | |
| 4 * @constructor | |
| 5 */ | |
| 6 PointObject = function(){ | |
| 7 | |
| 8 this.x; | |
| 9 this.y; | |
| 10 | |
| 11 this.elements = []; | |
| 12 this.size = 0; | |
| 13 this.radius; | |
| 14 | |
| 15 }; | |
| 16 | |
| 17 PointObject.prototype = { | |
| 18 | |
| 19 /** | |
| 20 * adds an elements with a specific searchIndex to this point object | |
| 21 * @param {int} searchIndex the search index of the actual dataset constellation | |
| 22 * @param {DataObject} element the data object to add | |
| 23 */ | |
| 24 addElement: function(searchIndex, element){ | |
| 25 while (this.elements.length - 1 < searchIndex) | |
| 26 this.elements.push([]); | |
| 27 this.elements[searchIndex].push(element); | |
| 28 this.size++; | |
| 29 }, | |
| 30 | |
| 31 /** | |
| 32 * sets x (longitude) and y (latitude) values to this point object | |
| 33 * @param {float} x the x (longitude) value | |
| 34 * @param {float} y the x (latitude) value | |
| 35 */ | |
| 36 setXY: function(x, y){ | |
| 37 this.x = x; | |
| 38 this.y = y; | |
| 39 }, | |
| 40 | |
| 41 /** | |
| 42 * sets the radius of this point object | |
| 43 * @param {int} radius the radius to set | |
| 44 */ | |
| 45 setRadius: function(radius){ | |
| 46 this.radius = radius; | |
| 47 }, | |
| 48 | |
| 49 /** | |
| 50 * adds another point object to this point object. | |
| 51 * here all elements of the other point object are inserted in the element array of this instance | |
| 52 * @param {PointObject} point another point object. | |
| 53 */ | |
| 54 addPoint: function(point){ | |
| 55 for (var i = 0; i < point.elements.length; i++) | |
| 56 for (var j = 0; j < point.elements[i].length; j++) | |
| 57 this.addElement(i, point.elements[i][j]); | |
| 58 } | |
| 59 | |
| 60 }; | |
| 61 | |
| 62 /** | |
| 63 * describes a finally displayed point object. | |
| 64 * each instance of this class corresponds to a specific place and to only one data set | |
| 65 * @param {float} x the x (longitude) value of the point object | |
| 66 * @param {float} y the y (latitude) value of the point object | |
| 67 * @param {DataObject[]} elements array of data objects, that belong a point object instance | |
| 68 * @param {int} radius the resulting radius (in pixel) of the point in the map | |
| 69 * @param {int} search corresponding search index of the elements | |
| 70 * | |
| 71 * @constructor | |
| 72 */ | |
| 73 DisplayPointObject = function(originX, originY, shiftX, shiftY, elements, radius, search){ | |
| 74 | |
| 75 this.originX = originX; | |
| 76 this.originY = originY; | |
| 77 this.shiftX = shiftX; | |
| 78 this.shiftY = shiftY; | |
| 79 this.elements = elements; | |
| 80 this.radius = radius; | |
| 81 this.search = search; | |
| 82 | |
| 83 this.pointFeature; | |
| 84 this.olPointFeature; | |
| 85 this.percentage = 0; | |
| 86 this.selected = false; | |
| 87 | |
| 88 }; | |
| 89 | |
| 90 DisplayPointObject.prototype = { | |
| 91 | |
| 92 /** | |
| 93 * sets the OpenLayers point feature for this point object | |
| 94 * @param {OpenLayers.Feature} pointFeature the point feature for this object | |
| 95 */ | |
| 96 setPointFeature: function(pointFeature){ | |
| 97 this.pointFeature = pointFeature; | |
| 98 }, | |
| 99 | |
| 100 /** | |
| 101 * sets the OpenLayers point feature for this point object to manage its selection status | |
| 102 * @param {OpenLayers.Feature} olPointFeature the overlay point feature for this object | |
| 103 */ | |
| 104 setOlPointFeature: function(olPointFeature){ | |
| 105 this.olPointFeature = olPointFeature; | |
| 106 } | |
| 107 | |
| 108 }; |
