diff --git a/lib/OpenLayers/Feature/MetaCarta.js b/lib/OpenLayers/Feature/MetaCarta.js index 3b5246f766..cbb645cfbc 100644 --- a/lib/OpenLayers/Feature/MetaCarta.js +++ b/lib/OpenLayers/Feature/MetaCarta.js @@ -1,45 +1,60 @@ +/** + * @class + */ +MCFeature = Class.create(); +MCFeature.prototype = { + /** @type String */ + id: "", -/** Parse a feature from an XML node -* MC specific at the moment -*/ -OpenLayers.Feature.MetaCarta = Class.create(); -OpenLayers.Feature.MetaCarta.prototype= { - - // Object - listeners:null, - - // ol.Size + /** @type OpenLayers.Size */ size:null, - // ol.LatLon - _latlon:null, + /** @type OpenLayers.LonLat */ + lonlat:null, - // str - id:"", - fid:null, - srsName:null, - title:null, - location:null, - docurl:null, - extract:null, - geoExtract:null, - relevance:null, - geoRelevance:null, - markerImage:null, - - initialize: function(fNode) { - this.listeners = new Object(); - - var docpt = OpenLayers.Util.getNodes(fNode, "docpoint")[0]; - this.fid = docpt.getAttribute('fid'); - this.id = this.fid; + /** @type String */ + markerImage: "", - var node = OpenLayers.Util.getNodes(docpt, "position")[0]; - node = OpenLayers.Util.getNodes(node, "gml:Point")[0]; - this.srsName = node.getAttribute('srsName'); - var temp = OpenLayers.Util.getTagText(node, "gml:coordinates"); - this._latlon = ol.LatLon.fromString(temp); + /** @type String */ + srsName: "", + + /** @type String */ + title: "", + + /** @type String */ + location: "", + + /** @type String */ + docurl: "", + + /** @type String */ + extract: "", + + /** @type String */ + geoExtract: "", + + /** @type String */ + relevance: "", + + /** @type String */ + geoRelevance: "", + + /** + * @constructor + * + * @param {XMLNode} node + */ + initialize: function(node) { + + var docpt = OpenLayers.Util.getNodes(node, "docpoint")[0]; + this.id = docpt.getAttribute('fid'); + + var position = OpenLayers.Util.getNodes(docpt, "position")[0]; + var point = OpenLayers.Util.getNodes(position, "gml:Point")[0]; + this.srsName = point.getAttribute('srsName'); + var coords = OpenLayers.Util.getTagText(point, "gml:coordinates"); + this.lonlat = OpenLayers.LonLat.fromString(coords); this.title = OpenLayers.Util.getTagText(docpt, "title"); this.location = OpenLayers.Util.getTagText(docpt, "locationName"); @@ -53,55 +68,47 @@ OpenLayers.Feature.MetaCarta.prototype= { this.size = new ol.Size(20, 25); // TODO: Fix this hard coded value. }, + /** + * + */ destroy: function() { - this.listeners = null; - this.fid = null; - this.id = null; - this.srsName = null; - this._latlon = null; - this.title = null; - this.location = null; - this.docurl = null; - this.extract = null; - this.geoExtract = null; - this.relevance = null; - this.geoRelevance = null; - this.markerImage = null; - this.size = null; }, + + /** + * @returns String version of this MCFeature, for easy debugging + * @type String + */ toString:function() { - var s = this.title + " relevance:" + this.relevance + + return this.title + " relevance:" + this.relevance + " [" + this.geoRelevance + "]"; s += " Fid [" + this.fid + "] @ " + this._latlon.toString(); s += " Location [" + this.geoExtract + "]"; - return s; }, - /* MARKER DATA INTERFACE FUNCTIONS: - * - * getLatLon(), getImage() - * - */ - /** - * ret(ol.Point) - */ - getLatLon:function() { return this._latlon.copyOf(); }, + * @param {OpenLayers.Marker} marker + */ + loadEvents: function(marker) { + marker.events.register("mousedown", marker, this.onMarkerMouseDown); + +// this.onMarkerMouseDown.bindAsEventListener(this)); + }, - /** - * ret(ol.Point) - */ - getImage:function() { return this.markerImage; }, + /** + * @param {Event} evt + */ + onMarkerMouseDown: function(evt) { + alert("yo!"); + }, - - /** html content based on feature information - * - * ret(str): - */ + /** + * @returns HTML content based on feature information - for use with Popups + * @type String + */ getContentHTML:function() { - + var contentHTML = ""; contentHTML += "
" @@ -135,15 +142,15 @@ OpenLayers.Feature.MetaCarta.prototype= { return contentHTML; }, - /** html content based on feature information - * - * ret(str): - */ + /** + * @returns HTML content based on feature information- for use with ListDiv + * @type String + */ getDivListHTML:function() { var divHTML = ''; - divHTML += '
'; + divHTML += '
'; divHTML += ''; divHTML += this.title; divHTML += '
'; @@ -153,9 +160,8 @@ OpenLayers.Feature.MetaCarta.prototype= { return divHTML; }, - ///////////////////////////////// - who:function(){return ("Feature.js");} //last - + /** @final @type String */ + CLASS_NAME: "MCFeature" };