1 |
4307
|
leinfelder
|
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
|
2 |
|
|
<html>
|
3 |
|
|
<head>
|
4 |
|
|
<title>
|
5 |
|
|
<a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008 Overview
|
6 |
|
|
</title>
|
7 |
|
|
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
8 |
|
|
<script>
|
9 |
|
|
function asd() {
|
10 |
|
|
|
11 |
|
|
parent.document.title="GeoRSS.js Overview";
|
12 |
|
|
|
13 |
|
|
}
|
14 |
|
|
</script>
|
15 |
|
|
</head>
|
16 |
|
|
<body bgcolor="white" onload="asd();">
|
17 |
|
|
|
18 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
19 |
|
|
<a name="navbar_top"><!-- --></a>
|
20 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
21 |
|
|
<tr>
|
22 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
23 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
24 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
25 |
|
|
<tr align="center" valign="top">
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
29 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
33 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
34 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
35 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
36 |
|
|
</tr>
|
37 |
|
|
</table>
|
38 |
|
|
</td>
|
39 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top">
|
40 |
|
|
<em>
|
41 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
42 |
|
|
</td>
|
43 |
|
|
</tr>
|
44 |
|
|
|
45 |
|
|
<tr>
|
46 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
47 |
|
|
PREV
|
48 |
|
|
NEXT</font></td>
|
49 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
50 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
51 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
52 |
|
|
|
53 |
|
|
<script>
|
54 |
|
|
<!--
|
55 |
|
|
if(window==top) {
|
56 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
57 |
|
|
}
|
58 |
|
|
//-->
|
59 |
|
|
</script>
|
60 |
|
|
<noscript>
|
61 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
62 |
|
|
</noscript>
|
63 |
|
|
</font></td>
|
64 |
|
|
</tr>
|
65 |
|
|
</table>
|
66 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
67 |
|
|
|
68 |
|
|
<hr>
|
69 |
|
|
<center>
|
70 |
|
|
|
71 |
|
|
<h2>GeoRSS.js</h2>
|
72 |
|
|
|
73 |
|
|
</center>
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
<h4>Summary</h4>
|
79 |
|
|
<p>
|
80 |
|
|
|
81 |
|
|
No overview generated for 'GeoRSS.js'<BR/><BR/>
|
82 |
|
|
|
83 |
|
|
</p>
|
84 |
|
|
|
85 |
|
|
<hr>
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
<table border="1" cellpadding="3" cellspacing="0" width="100%">
|
89 |
|
|
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
|
90 |
|
|
<td colspan=2><font size="+2">
|
91 |
|
|
|
92 |
|
|
<b>Class Summary</b>
|
93 |
|
|
|
94 |
|
|
</font></td>
|
95 |
|
|
</tr>
|
96 |
|
|
|
97 |
|
|
<tr bgcolor="white" class="TableRowColor">
|
98 |
|
|
<td width="15%"><b><a href="GeoRSS.html">GeoRSS</a></b></td>
|
99 |
|
|
<td> </td>
|
100 |
|
|
</tr>
|
101 |
|
|
|
102 |
|
|
</table>
|
103 |
|
|
<hr/>
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
107 |
|
|
|
108 |
|
|
<!-- ========== END METHOD SUMMARY =========== -->
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
<pre class="sourceview"><span class="comment">/*
|
112 |
|
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
113 |
|
|
$Id: GeoRSS.js 3882 2008-02-27 15:41:33Z gjvoosten $
|
114 |
|
|
*/</span>
|
115 |
|
|
<span class="comment">
|
116 |
|
|
// Ensure this object's dependancies are loaded.</span>
|
117 |
|
|
mapbuilder.loadScript(baseDir+<span class="literal">"/model/ModelBase.js"</span>);
|
118 |
|
|
|
119 |
|
|
<span class="comment">/**
|
120 |
|
|
* Stores a GML Feature or FeatureCollection as defined by the
|
121 |
|
|
* Open Geospatial Consortium (http://www.opengeospatial.org/).
|
122 |
|
|
*
|
123 |
|
|
* WARNING: This model is only to be used if you do not want to embed the GeoRSS feed
|
124 |
|
|
* in the context doc. See also MAP-271
|
125 |
|
|
* <span class="attrib">@deprecated</span>
|
126 |
|
|
* <span class="attrib">@constructor</span>
|
127 |
|
|
* <span class="attrib">@base</span> ModelBase
|
128 |
|
|
* <span class="attrib">@author</span> Cameron Shorter
|
129 |
|
|
* <span class="attrib">@requires</span> Sarissa
|
130 |
|
|
* <span class="attrib">@param</span> modelNode The model's XML object node from the configuration document.
|
131 |
|
|
* <span class="attrib">@param</span> parent The parent model for the object.
|
132 |
|
|
*/</span>
|
133 |
|
|
<span class="reserved">function</span> GeoRSS(modelNode, parent) {
|
134 |
|
|
<span class="comment"> // Inherit the ModelBase functions and parameters</span>
|
135 |
|
|
ModelBase.apply(<span class="reserved">this</span>, new Array(modelNode, parent));
|
136 |
|
|
|
137 |
|
|
<span class="comment">/** init
|
138 |
|
|
* <span class="attrib">@param</span> objRef Pointer to this object.
|
139 |
|
|
*/</span>
|
140 |
|
|
<span class="reserved">this</span>.initItems = <span class="reserved">function</span>(objRef) {
|
141 |
|
|
var items = objRef.doc.selectNodes(<span class="literal">"rdf:RDF/rss:item"</span>);
|
142 |
|
|
<span class="reserved">if</span>( items.length == 0 ) {
|
143 |
|
|
items = objRef.doc.selectNodes(<span class="literal">"atom:feed/atom:entry"</span>);
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
<span class="reserved">for</span> (var i=0; i<items.length; ++i) {
|
147 |
|
|
var item = items[i];
|
148 |
|
|
item.setAttribute(<span class="literal">"divid"</span>, <span class="literal">"RSS_Item_"</span>+mbIds.getId());
|
149 |
|
|
}
|
150 |
|
|
}
|
151 |
|
|
<span class="comment"> // OBE this.addFirstListener("loadModel",this.initItems,this);</span>
|
152 |
|
|
|
153 |
|
|
<span class="comment">/**
|
154 |
|
|
* Returns the list of nodes selected by the nodeSelectpath
|
155 |
|
|
* <span class="attrib">@return</span> list of nodes selected
|
156 |
|
|
*/</span>
|
157 |
|
|
<span class="reserved">this</span>.getFeatureNodes = <span class="reserved">function</span>() {
|
158 |
|
|
<span class="reserved">return</span> <span class="reserved">this</span>.doc.selectNodes(<span class="reserved">this</span>.nodeSelectXpath);
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
<span class="comment">/**
|
162 |
|
|
* Returns a label for a node in the feature list
|
163 |
|
|
* <span class="attrib">@param</span> featureNode the feature node to selectfrom
|
164 |
|
|
* <span class="attrib">@return</span> a label for this feature
|
165 |
|
|
*/</span>
|
166 |
|
|
<span class="reserved">this</span>.getFeatureName = <span class="reserved">function</span>(featureNode) {
|
167 |
|
|
var labelNode = featureNode.selectSingleNode(<span class="literal">"rss:title"</span>);
|
168 |
|
|
<span class="reserved">if</span>( labelNode == null )
|
169 |
|
|
labelNode = featureNode.selectSingleNode(<span class="literal">"atom:title"</span>);
|
170 |
|
|
<span class="reserved">return</span> labelNode?getNodeValue(labelNode):mbGetMessage(<span class="literal">"noRssTitle"</span>);
|
171 |
|
|
}
|
172 |
|
|
|
173 |
|
|
<span class="comment">/**
|
174 |
|
|
* Returns an ID value for a node in the feature list
|
175 |
|
|
* <span class="attrib">@param</span> featureNode the feature node to selectfrom
|
176 |
|
|
* <span class="attrib">@return</span> ID for this feature
|
177 |
|
|
*/</span>
|
178 |
|
|
<span class="reserved">this</span>.getFeatureId = <span class="reserved">function</span>(featureNode) {
|
179 |
|
|
var id = featureNode.getAttribute(<span class="literal">"divid"</span>)
|
180 |
|
|
<span class="reserved">if</span>( id )
|
181 |
|
|
<span class="reserved">return</span> id;
|
182 |
|
|
|
183 |
|
|
<span class="reserved">return</span> <span class="literal">"no_id"</span>;
|
184 |
|
|
}
|
185 |
|
|
|
186 |
|
|
<span class="comment">/**
|
187 |
|
|
* Returns a point geometry for the feature
|
188 |
|
|
* <span class="attrib">@param</span> featureNode the feature node to select from
|
189 |
|
|
* <span class="attrib">@return</span> the geometric point for the node
|
190 |
|
|
*/</span>
|
191 |
|
|
<span class="reserved">this</span>.getFeaturePoint = <span class="reserved">function</span>(featureNode) {
|
192 |
|
|
<span class="reserved">if</span> (featureNode.selectSingleNode(<span class="literal">"geo:long"</span>)) {
|
193 |
|
|
var pointX = getNodeValue(featureNode.selectSingleNode(<span class="literal">"geo:long"</span>));
|
194 |
|
|
var pointY = getNodeValue(featureNode.selectSingleNode(<span class="literal">"geo:lat"</span>));
|
195 |
|
|
<span class="reserved">return</span> new Array(pointX, pointY);
|
196 |
|
|
} <span class="reserved">else</span> {
|
197 |
|
|
var pos = featureNode.selectSingleNode(<span class="literal">"georss:where/gml:Point/gml:pos"</span>)
|
198 |
|
|
<span class="reserved">if</span>( pos != null ) {
|
199 |
|
|
var coordstr = getNodeValue(pos);
|
200 |
|
|
<span class="comment"> //alert("coords:"+coordstr );</span>
|
201 |
|
|
var coords = coordstr.split(<span class="literal">" "</span>)
|
202 |
|
|
var pointX = coords[0]
|
203 |
|
|
var pointY = coords[1]
|
204 |
|
|
<span class="reserved">return</span> new Array(pointX, pointY);
|
205 |
|
|
} <span class="reserved">else</span> {
|
206 |
|
|
<span class="reserved">return</span> new Array(0,0); //or some other error to <span class="reserved">return</span>?
|
207 |
|
|
}
|
208 |
|
|
}
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
<span class="comment">/**
|
212 |
|
|
* Returns the geometry for the feature
|
213 |
|
|
* <span class="attrib">@param</span> featureNode the feature node to select from
|
214 |
|
|
* <span class="attrib">@return</span> the geometric point for the node
|
215 |
|
|
*/</span>
|
216 |
|
|
<span class="reserved">this</span>.getFeatureGeometry = <span class="reserved">function</span>(featureNode) {
|
217 |
|
|
<span class="reserved">if</span> (featureNode.selectSingleNode(<span class="literal">"geo:long"</span>)) {
|
218 |
|
|
var pointX = getNodeValue(featureNode.selectSingleNode(<span class="literal">"geo:long"</span>));
|
219 |
|
|
var pointY = getNodeValue(featureNode.selectSingleNode(<span class="literal">"geo:lat"</span>));
|
220 |
|
|
<span class="reserved">return</span> <span class="literal">"POINT "</span> + pointX + <span class="literal">","</span> + pointY;
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
var pos = featureNode.selectSingleNode(<span class="literal">"georss:where/gml:Point/gml:pos"</span>)
|
224 |
|
|
<span class="reserved">if</span>( pos != null ) {
|
225 |
|
|
var coordstr = getNodeValue(pos);
|
226 |
|
|
<span class="reserved">return</span> <span class="literal">"POINT "</span> + coordstr;
|
227 |
|
|
}
|
228 |
|
|
|
229 |
|
|
var posList = featureNode.selectSingleNode(<span class="literal">"georss:where/gml:LineString/gml:posList"</span>)
|
230 |
|
|
<span class="reserved">if</span>( posList != null ) { //WARNING: could overflow so get all nodes
|
231 |
|
|
var children = posList.childNodes;
|
232 |
|
|
var count = children.length;
|
233 |
|
|
var text=<span class="literal">""</span>;
|
234 |
|
|
<span class="reserved">for</span>( var i=0; i<count; i++ ) {
|
235 |
|
|
text += children[i].nodeValue;
|
236 |
|
|
}
|
237 |
|
|
<span class="comment"> //alert("count:"+ count + " length:"+text.length)</span>
|
238 |
|
|
|
239 |
|
|
<span class="reserved">return</span> <span class="literal">"LINESTRING "</span> + text;
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
var posList = featureNode.selectSingleNode(<span class="literal">"georss:where/gml:Polygon/gml:exterior/gml:LinearRing"</span>)
|
243 |
|
|
<span class="reserved">if</span>( posList != null ) {
|
244 |
|
|
var coordstr = getNodeValue(posList);
|
245 |
|
|
<span class="reserved">return</span> <span class="literal">"POLYGON "</span> + coordstr;
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
alert(mbGetMessage(<span class="literal">"invalidGmlGeom"</span>));
|
249 |
|
|
<span class="reserved">return</span> null
|
250 |
|
|
}
|
251 |
|
|
|
252 |
|
|
<span class="comment">/**
|
253 |
|
|
* Get the GML Node out of the RSS feed
|
254 |
|
|
*/</span>
|
255 |
|
|
<span class="reserved">this</span>.getFeatureGml = <span class="reserved">function</span>(featureNode) {
|
256 |
|
|
var where = featureNode.selectSingleNode(<span class="literal">"georss:where"</span>)
|
257 |
|
|
<span class="reserved">if</span>( where != null ) {
|
258 |
|
|
var gml = where.firstChild;
|
259 |
|
|
<span class="reserved">return</span> gml;
|
260 |
|
|
} <span class="reserved">else</span> {
|
261 |
|
|
<span class="reserved">return</span> null;
|
262 |
|
|
}
|
263 |
|
|
}
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
<span class="comment">/**
|
267 |
|
|
* Returns a specific icon for that entry
|
268 |
|
|
* <span class="attrib">@param</span> featureNode the feature node to select from
|
269 |
|
|
* <span class="attrib">@return</span> the geometric point for the node
|
270 |
|
|
*/</span>
|
271 |
|
|
<span class="reserved">this</span>.getFeatureIcon = <span class="reserved">function</span>( featureNode ) {
|
272 |
|
|
<span class="reserved">if</span>( featureNode == null )
|
273 |
|
|
<span class="reserved">return</span> null;
|
274 |
|
|
<span class="comment">
|
275 |
|
|
// look for an icon tag</span>
|
276 |
|
|
var icon = featureNode.selectSingleNode(<span class="literal">"atom:icon"</span>);
|
277 |
|
|
<span class="reserved">if</span> (icon != undefined) {
|
278 |
|
|
<span class="reserved">return</span> getNodeValue(icon);
|
279 |
|
|
} <span class="reserved">else</span> {
|
280 |
|
|
<span class="reserved">return</span> null;
|
281 |
|
|
}
|
282 |
|
|
}
|
283 |
|
|
}
|
284 |
|
|
|
285 |
|
|
</pre>
|
286 |
|
|
<hr>
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
291 |
|
|
<a name="navbar_top"><!-- --></a>
|
292 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
293 |
|
|
<tr>
|
294 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
295 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
296 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
297 |
|
|
<tr align="center" valign="top">
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
301 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
305 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
306 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
307 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
308 |
|
|
</tr>
|
309 |
|
|
</table>
|
310 |
|
|
</td>
|
311 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
312 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
313 |
|
|
</td>
|
314 |
|
|
</tr>
|
315 |
|
|
|
316 |
|
|
<tr>
|
317 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
318 |
|
|
PREV
|
319 |
|
|
NEXT</font></td>
|
320 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
321 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
322 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
323 |
|
|
|
324 |
|
|
<script>
|
325 |
|
|
<!--
|
326 |
|
|
if(window==top) {
|
327 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
328 |
|
|
}
|
329 |
|
|
//-->
|
330 |
|
|
</script>
|
331 |
|
|
<noscript>
|
332 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
333 |
|
|
</noscript>
|
334 |
|
|
</font></td>
|
335 |
|
|
</tr>
|
336 |
|
|
</table>
|
337 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
338 |
|
|
|
339 |
|
|
<hr>
|
340 |
|
|
<font size="-1">
|
341 |
|
|
|
342 |
|
|
</font>
|
343 |
|
|
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Sun Apr 27 20:30:54 2008</div>
|
344 |
|
|
</body>
|
345 |
|
|
</html>
|