Update MetaCarta.js to new Feature architecture. Soon this is going to be removed from here and renamed MCFeature.js
git-svn-id: http://svn.openlayers.org/trunk/openlayers@372 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1,45 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
MCFeature = Class.create();
|
||||||
|
MCFeature.prototype = {
|
||||||
|
|
||||||
|
/** @type String */
|
||||||
|
id: "",
|
||||||
|
|
||||||
/** Parse a feature from an XML node
|
/** @type OpenLayers.Size */
|
||||||
* MC specific at the moment
|
|
||||||
*/
|
|
||||||
OpenLayers.Feature.MetaCarta = Class.create();
|
|
||||||
OpenLayers.Feature.MetaCarta.prototype= {
|
|
||||||
|
|
||||||
// Object
|
|
||||||
listeners:null,
|
|
||||||
|
|
||||||
// ol.Size
|
|
||||||
size:null,
|
size:null,
|
||||||
|
|
||||||
// ol.LatLon
|
/** @type OpenLayers.LonLat */
|
||||||
_latlon:null,
|
lonlat:null,
|
||||||
|
|
||||||
// str
|
/** @type String */
|
||||||
id:"",
|
markerImage: "",
|
||||||
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;
|
|
||||||
|
|
||||||
var node = OpenLayers.Util.getNodes(docpt, "position")[0];
|
/** @type String */
|
||||||
node = OpenLayers.Util.getNodes(node, "gml:Point")[0];
|
srsName: "",
|
||||||
this.srsName = node.getAttribute('srsName');
|
|
||||||
var temp = OpenLayers.Util.getTagText(node, "gml:coordinates");
|
/** @type String */
|
||||||
this._latlon = ol.LatLon.fromString(temp);
|
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.title = OpenLayers.Util.getTagText(docpt, "title");
|
||||||
this.location = OpenLayers.Util.getTagText(docpt, "locationName");
|
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.
|
this.size = new ol.Size(20, 25); // TODO: Fix this hard coded value.
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
destroy: function() {
|
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() {
|
toString:function() {
|
||||||
var s = this.title + " relevance:" + this.relevance +
|
return this.title + " relevance:" + this.relevance +
|
||||||
" [" + this.geoRelevance + "]";
|
" [" + this.geoRelevance + "]";
|
||||||
s += " Fid [" + this.fid + "] @ " + this._latlon.toString();
|
s += " Fid [" + this.fid + "] @ " + this._latlon.toString();
|
||||||
s += " Location [" + this.geoExtract + "]";
|
s += " Location [" + this.geoExtract + "]";
|
||||||
return s;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/* MARKER DATA INTERFACE FUNCTIONS:
|
|
||||||
*
|
|
||||||
* getLatLon(), getImage()
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ret(ol.Point)
|
* @param {OpenLayers.Marker} marker
|
||||||
*/
|
*/
|
||||||
getLatLon:function() { return this._latlon.copyOf(); },
|
loadEvents: function(marker) {
|
||||||
|
marker.events.register("mousedown", marker, this.onMarkerMouseDown);
|
||||||
|
|
||||||
|
// this.onMarkerMouseDown.bindAsEventListener(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ret(ol.Point)
|
* @param {Event} evt
|
||||||
*/
|
*/
|
||||||
getImage:function() { return this.markerImage; },
|
onMarkerMouseDown: function(evt) {
|
||||||
|
alert("yo!");
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
/** html content based on feature information
|
* @returns HTML content based on feature information - for use with Popups
|
||||||
*
|
* @type String
|
||||||
* ret(str):
|
*/
|
||||||
*/
|
|
||||||
getContentHTML:function() {
|
getContentHTML:function() {
|
||||||
|
|
||||||
var contentHTML = "";
|
var contentHTML = "";
|
||||||
|
|
||||||
contentHTML += "<div style='margin: 0.25em'>"
|
contentHTML += "<div style='margin: 0.25em'>"
|
||||||
@@ -135,15 +142,15 @@ OpenLayers.Feature.MetaCarta.prototype= {
|
|||||||
return contentHTML;
|
return contentHTML;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** html content based on feature information
|
/**
|
||||||
*
|
* @returns HTML content based on feature information- for use with ListDiv
|
||||||
* ret(str):
|
* @type String
|
||||||
*/
|
*/
|
||||||
getDivListHTML:function() {
|
getDivListHTML:function() {
|
||||||
|
|
||||||
var divHTML = '';
|
var divHTML = '';
|
||||||
|
|
||||||
divHTML += '<div id="' + this.fid + '">';
|
divHTML += '<div id="' + this.id + '">';
|
||||||
divHTML += '<a href="' + this.docurl + '">';
|
divHTML += '<a href="' + this.docurl + '">';
|
||||||
divHTML += this.title;
|
divHTML += this.title;
|
||||||
divHTML += '</a><div>';
|
divHTML += '</a><div>';
|
||||||
@@ -153,9 +160,8 @@ OpenLayers.Feature.MetaCarta.prototype= {
|
|||||||
return divHTML;
|
return divHTML;
|
||||||
},
|
},
|
||||||
|
|
||||||
/////////////////////////////////
|
/** @final @type String */
|
||||||
who:function(){return ("Feature.js");} //last
|
CLASS_NAME: "MCFeature"
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user