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
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
/** Parse a feature from an XML node
|
/** Parse a feature from an XML node
|
||||||
* MC specific at the moment
|
* MC specific at the moment
|
||||||
*/
|
*/
|
||||||
ol.Feature = Class.create();
|
OpenLayers.Feature = Class.create();
|
||||||
ol.Feature.prototype= {
|
OpenLayers.Feature.prototype= {
|
||||||
|
|
||||||
// Object
|
// Object
|
||||||
listeners:null,
|
listeners:null,
|
||||||
@@ -31,25 +31,25 @@ ol.Feature.prototype= {
|
|||||||
initialize: function(fNode) {
|
initialize: function(fNode) {
|
||||||
this.listeners = new Object();
|
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.fid = docpt.getAttribute('fid');
|
||||||
this.id = this.fid;
|
this.id = this.fid;
|
||||||
|
|
||||||
var node = ol.Application.getNodes(docpt, "position")[0];
|
var node = OpenLayers.getNodes(docpt, "position")[0];
|
||||||
node = ol.Application.getNodes(node, "gml:Point")[0];
|
node = OpenLayers.getNodes(node, "gml:Point")[0];
|
||||||
this.srsName = node.getAttribute('srsName');
|
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._latlon = ol.LatLon.fromString(temp);
|
||||||
|
|
||||||
this.title = ol.Application.getTagText(docpt, "title");
|
this.title = OpenLayers.getTagText(docpt, "title");
|
||||||
this.location = ol.Application.getTagText(docpt, "locationName");
|
this.location = OpenLayers.getTagText(docpt, "locationName");
|
||||||
this.docurl = ol.Application.getTagText(docpt, "documentUrl");
|
this.docurl = OpenLayers.getTagText(docpt, "documentUrl");
|
||||||
this.extract = ol.Application.getTagText(docpt, "extract");
|
this.extract = OpenLayers.getTagText(docpt, "extract");
|
||||||
this.geoExtract = ol.Application.getTagText(docpt, "geoextract");
|
this.geoExtract = OpenLayers.getTagText(docpt, "geoextract");
|
||||||
this.relevance = ol.Application.getTagText(docpt, "relevance");
|
this.relevance = OpenLayers.getTagText(docpt, "relevance");
|
||||||
this.geoRelevance = ol.Application.getTagText(docpt, "georelevance");
|
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.
|
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
|
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<nodes.length;i++) {
|
||||||
|
if (nodes[i].nodeName==tagName) {
|
||||||
|
retArray.push(nodes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** These could/should be made namespace aware?
|
||||||
|
*
|
||||||
|
* @param {} p
|
||||||
|
* @param {str} tagName
|
||||||
|
*
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
OpenLayers.getNodes=function(p, tagName) {
|
||||||
|
var nodes = Try.these(
|
||||||
|
function () {
|
||||||
|
return OpenLayers._getNodes(p.documentElement.childNodes,
|
||||||
|
tagName);
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
return OpenLayers._getNodes(p.childNodes, tagName);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return nodes;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {} parent
|
||||||
|
* @param {str} item
|
||||||
|
* @param {int} index
|
||||||
|
*
|
||||||
|
* @return {str}
|
||||||
|
*/
|
||||||
|
OpenLayers.getTagText = function (parent, item, index) {
|
||||||
|
var result = OpenLayers.getNodes(parent, item);
|
||||||
|
if (result && (result.length > 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 "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user