From bfece3fc4eff8bdafd3e6abb37cc62ca32bd2fdc Mon Sep 17 00:00:00 2001 From: euzuro Date: Fri, 19 May 2006 18:40:32 +0000 Subject: [PATCH] temporary hack to bring over functions from the old application.js git-svn-id: http://svn.openlayers.org/trunk/openlayers@192 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Feature.js | 91 +++++++++++++++++++++++++++++++++------ 1 file changed, 77 insertions(+), 14 deletions(-) diff --git a/lib/OpenLayers/Feature.js b/lib/OpenLayers/Feature.js index b70d006715..d5c8c60020 100644 --- a/lib/OpenLayers/Feature.js +++ b/lib/OpenLayers/Feature.js @@ -3,8 +3,8 @@ /** Parse a feature from an XML node * MC specific at the moment */ -ol.Feature = Class.create(); -ol.Feature.prototype= { +OpenLayers.Feature = Class.create(); +OpenLayers.Feature.prototype= { // Object listeners:null, @@ -31,25 +31,25 @@ ol.Feature.prototype= { initialize: function(fNode) { this.listeners = new Object(); - var docpt = ol.Application.getNodes(fNode, "docpoint")[0]; + var docpt = OpenLayers.getNodes(fNode, "docpoint")[0]; this.fid = docpt.getAttribute('fid'); this.id = this.fid; - var node = ol.Application.getNodes(docpt, "position")[0]; - node = ol.Application.getNodes(node, "gml:Point")[0]; + var node = OpenLayers.getNodes(docpt, "position")[0]; + node = OpenLayers.getNodes(node, "gml:Point")[0]; this.srsName = node.getAttribute('srsName'); - var temp = ol.Application.getTagText(node, "gml:coordinates"); + var temp = OpenLayers.getTagText(node, "gml:coordinates"); this._latlon = ol.LatLon.fromString(temp); - this.title = ol.Application.getTagText(docpt, "title"); - this.location = ol.Application.getTagText(docpt, "locationName"); - this.docurl = ol.Application.getTagText(docpt, "documentUrl"); - this.extract = ol.Application.getTagText(docpt, "extract"); - this.geoExtract = ol.Application.getTagText(docpt, "geoextract"); - this.relevance = ol.Application.getTagText(docpt, "relevance"); - this.geoRelevance = ol.Application.getTagText(docpt, "georelevance"); + this.title = OpenLayers.getTagText(docpt, "title"); + this.location = OpenLayers.getTagText(docpt, "locationName"); + this.docurl = OpenLayers.getTagText(docpt, "documentUrl"); + this.extract = OpenLayers.getTagText(docpt, "extract"); + this.geoExtract = OpenLayers.getTagText(docpt, "geoextract"); + this.relevance = OpenLayers.getTagText(docpt, "relevance"); + this.geoRelevance = OpenLayers.getTagText(docpt, "georelevance"); - this.markerImage = ol.Application.getTagText(docpt, "markerImage"); + this.markerImage = OpenLayers.getTagText(docpt, "markerImage"); this.size = new ol.Size(20, 25); // TODO: Fix this hard coded value. }, @@ -157,3 +157,66 @@ ol.Feature.prototype= { who:function(){return ("Feature.js");} //last }; + +/** +* @param {Array} nodes +* @param {str} tagName +* +* @return {Array} +*/ +OpenLayers._getNodes=function(nodes, tagName) { + var retArray = new Array(); + for (var i=0;i 0)) + { + if (!index) { + index=0; + } + if (result[index].childNodes.length > 1) { + return result.childNodes[1].nodeValue; + } + else if (result[index].childNodes.length == 1) { + return result[index].firstChild.nodeValue; + } + } else { + return ""; + } +}; +