Changeset 372
- Timestamp:
- 05/25/06 14:03:15 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Feature/MetaCarta.js
r292 r372 1 /** 2 * @class 3 */ 4 MCFeature = Class.create(); 5 MCFeature.prototype = { 1 6 7 /** @type String */ 8 id: "", 2 9 3 /** Parse a feature from an XML node 4 * MC specific at the moment 5 */ 6 OpenLayers.Feature.MetaCarta = Class.create(); 7 OpenLayers.Feature.MetaCarta.prototype= { 8 9 // Object 10 listeners:null, 11 12 // ol.Size 10 /** @type OpenLayers.Size */ 13 11 size:null, 14 12 15 / / ol.LatLon16 _latlon:null,13 /** @type OpenLayers.LonLat */ 14 lonlat:null, 17 15 18 // str 19 id:"", 20 fid:null, 21 srsName:null, 22 title:null, 23 location:null, 24 docurl:null, 25 extract:null, 26 geoExtract:null, 27 relevance:null, 28 geoRelevance:null, 29 markerImage:null, 16 /** @type String */ 17 markerImage: "", 18 19 /** @type String */ 20 srsName: "", 30 21 31 initialize: function(fNode) {32 this.listeners = new Object();22 /** @type String */ 23 title: "", 33 24 34 var docpt = OpenLayers.Util.getNodes(fNode, "docpoint")[0]; 35 this.fid = docpt.getAttribute('fid'); 36 this.id = this.fid; 25 /** @type String */ 26 location: "", 27 28 /** @type String */ 29 docurl: "", 30 31 /** @type String */ 32 extract: "", 33 34 /** @type String */ 35 geoExtract: "", 36 37 /** @type String */ 38 relevance: "", 39 40 /** @type String */ 41 geoRelevance: "", 42 43 /** 44 * @constructor 45 * 46 * @param {XMLNode} node 47 */ 48 initialize: function(node) { 49 50 var docpt = OpenLayers.Util.getNodes(node, "docpoint")[0]; 51 this.id = docpt.getAttribute('fid'); 37 52 38 var node= OpenLayers.Util.getNodes(docpt, "position")[0];39 node = OpenLayers.Util.getNodes(node, "gml:Point")[0];40 this.srsName = node.getAttribute('srsName');41 var temp = OpenLayers.Util.getTagText(node, "gml:coordinates");42 this. _latlon = ol.LatLon.fromString(temp);53 var position = OpenLayers.Util.getNodes(docpt, "position")[0]; 54 var point = OpenLayers.Util.getNodes(position, "gml:Point")[0]; 55 this.srsName = point.getAttribute('srsName'); 56 var coords = OpenLayers.Util.getTagText(point, "gml:coordinates"); 57 this.lonlat = OpenLayers.LonLat.fromString(coords); 43 58 44 59 this.title = OpenLayers.Util.getTagText(docpt, "title"); … … 54 69 }, 55 70 71 /** 72 * 73 */ 56 74 destroy: function() { 57 this.listeners = null;58 this.fid = null;59 this.id = null;60 this.srsName = null;61 this._latlon = null;62 this.title = null;63 this.location = null;64 this.docurl = null;65 this.extract = null;66 this.geoExtract = null;67 this.relevance = null;68 this.geoRelevance = null;69 this.markerImage = null;70 this.size = null;71 75 }, 72 76 77 78 /** 79 * @returns String version of this MCFeature, for easy debugging 80 * @type String 81 */ 73 82 toString:function() { 74 var s =this.title + " relevance:" + this.relevance +83 return this.title + " relevance:" + this.relevance + 75 84 " [" + this.geoRelevance + "]"; 76 85 s += " Fid [" + this.fid + "] @ " + this._latlon.toString(); 77 86 s += " Location [" + this.geoExtract + "]"; 78 return s;79 87 }, 80 88 81 /* MARKER DATA INTERFACE FUNCTIONS:82 *83 * getLatLon(), getImage()84 *85 */86 87 89 /** 88 * ret(ol.Point) 89 */ 90 getLatLon:function() { return this._latlon.copyOf(); }, 90 * @param {OpenLayers.Marker} marker 91 */ 92 loadEvents: function(marker) { 93 marker.events.register("mousedown", marker, this.onMarkerMouseDown); 94 95 // this.onMarkerMouseDown.bindAsEventListener(this)); 96 }, 91 97 92 98 93 /** 94 * ret(ol.Point) 95 */ 96 getImage:function() { return this.markerImage; }, 99 /** 100 * @param {Event} evt 101 */ 102 onMarkerMouseDown: function(evt) { 103 alert("yo!"); 104 }, 97 105 98 99 /** html content based on feature information 100 * 101 * ret(str): 102 */ 106 /** 107 * @returns HTML content based on feature information - for use with Popups 108 * @type String 109 */ 103 110 getContentHTML:function() { 104 111 105 112 var contentHTML = ""; 106 113 … … 136 143 }, 137 144 138 /** html content based on feature information139 *140 * ret(str): 141 */145 /** 146 * @returns HTML content based on feature information- for use with ListDiv 147 * @type String 148 */ 142 149 getDivListHTML:function() { 143 150 144 151 var divHTML = ''; 145 152 146 divHTML += '<div id="' + this. fid + '">';153 divHTML += '<div id="' + this.id + '">'; 147 154 divHTML += '<a href="' + this.docurl + '">'; 148 155 divHTML += this.title; … … 154 161 }, 155 162 156 ///////////////////////////////// 157 who:function(){return ("Feature.js");} //last 158 163 /** @final @type String */ 164 CLASS_NAME: "MCFeature" 159 165 }; 160 166
