<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
ka-Map Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="kaXmlOverlay.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b>ka-Map</b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
PREV
NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a>
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>kaXmlOverlay.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'kaXmlOverlay.js'<BR/><BR/>
</p>
<hr>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=2><font size="+2">
<b>Class Summary</b>
</font></td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="_BrowserIdent.html">_BrowserIdent</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlFeature.html">kaXmlFeature</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlGraphicElement.html">kaXmlGraphicElement</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlIcon.html">kaXmlIcon</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlLabel.html">kaXmlLabel</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlLinestring.html">kaXmlLinestring</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlOverlay.html">kaXmlOverlay</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlPoint.html">kaXmlPoint</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlPolygon.html">kaXmlPolygon</a></b></td>
<td> </td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="kaXmlSymbol.html">kaXmlSymbol</a></b></td>
<td> </td>
</tr>
</table>
<hr/>
<!-- ========== METHOD SUMMARY =========== -->
<a name="method_summary"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=2>
<font size="+2">
<b>Method Summary</b>
</font>
</td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td align="right" valign="top" width="1%">
<font size="-1">
<code>static Object</code>
</font>
</td>
<td>
<code>
<b>
<a href="GLOBALS.html#!s!loadXMLDoc">loadXMLDoc</a></b>(url)
</code>
<br>
retrieve XML document as document object
</td>
</tr>
</table>
<p>
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/******************************************************************************
* kaXmlOverlay - XML server side generated overlay for kaMap.
*
* Piergiorgio Navone
*
* $Id: overview-summary-kaXmlOverlay.js.html,v 1.1 2006/03/15 15:56:59 pspencer Exp $
*****************************************************************************/</span>
<span class="comment">/******************************************************************************
* BEGIN section in Wiki syntax
!!! kaXmlOverlay Quick HOW-TO
* __1__ Import scripts in your page:
<script type="text/javascript" src="wz_jsgraphics.js"></script>
<script type="text/javascript" src="kaXmlOverlay.js"></script>
* __2__ Let ka-Map initialize itself: the next steps should wait at lest the KAMAP_MAP_INITIALIZED event.
* __3__ Create a kaXmlOverlay object:
myXmlOverlay = new kaXmlOverlay( myKaMap, 250 );
* __4__ Add some objects on the overlay layer. There are two ways to do that
** Call the loadXml method: this method load an XML document from the web server.
myXmlOverlay.loadXml('points.xml');
** Write a JavaScript function to add your objects:
var my_point = myXmlOverlay.addNewPoint('Point ID', longuitude, latitude);
var my_symbol = new kaXmlSymbol();
my_symbol.size = 12;
my_symbol.color = '#ff0000';
my_point.addGraphic(my_symbol);
* __5__ To have a periodic update:
myInterval = setInterval("myMovingOverlay.loadXml('xmlget.php')",5000);
--------------------------------------------
!!! kaXmlOverlay Reference
This document describe the interface of the JavaScript kaXmlOverlay library as well as the XLM documents describing overlays. The document is divided in tree sections:
# A summary of JavaScript objects and functions
# The definition of the XML
# An in deep description of attributes common to both XML and JavaScript functions
!! JavaScript API
In this section there is a list of main classes with methods an properties that you ca use to programmatically add overlays to your map.
A detailed an updated documentation for each function is maintained as JavaDoc like comments in the source code.
! Class kaXmlOverlay
This class represent a map layer where is possible to add overlays.
To instantiate this class use the constructor
kaXmlOverlay( oKaMap, xml_url )
;oKaMap: A kaMap object
;zIndex: The z index of the layer
To load an XML document with overlay description call the method
kaXmlOverlay.prototype.loadXml = function(xml_url)
;xml_url: URL of th XML with points to plot
To add a new point to an overlay
kaXmlOverlay.prototype.addNewPoint = function(pid, x, y)
;pid: Point ID
;x: X geo-coordinate
;y: Y geo-coordinate
;return: A kaXmlPoint object with the given point ID.
To retrieve an existing point from an overlay call
kaXmlOverlay.prototype.getPointObject = function(pid)
;pid: Point ID
;return: The kaXmlPoint object given the point ID. null if not found.
To remove one or more points from the overlay
kaXmlOverlay.prototype.removePoint = function( pid )
;pid: Point ID or a regexp. If pid is null or not present remove all points.
! Class kaXmlPoint
A kaXmlPoint represents a group of graphic object on the overlay layer. The point is placed on the map at specified geographic coordinates. A point can be moved on the map without the need of redrawing all its graphic objects.
To instantiate a new point don't use the constructor but call the ''kaXmlOverlay.addNewPoint()'' function.
To place or move a kaXmlPoint on the map call
kaXmlPoint.prototype.setPosition = function( x, y )
;x: X geo-coordinate
;y: Y geo-coordinate
To clear all graphics associated with the point call the method
kaXmlPoint.prototype.clear = function()
To add graphic objects to a point use the method
kaXmlPoint.prototype.addGraphic = function( obj )
;obj: an object of type kaXmlSymbol, kaXmlIcon, kaXmlLabel, kaXmlLinestring or kaXmlPolygon
To manually set the HTML content of a kaXmlPoint use the method
kaXmlPoint.prototype.setInnerHtml = function(ihtml)
;ihtml: A string containing the HTML
This function delete any other content of the point.
! Graphic objects classes
The graphic objects that can be displayed are:
* kaXmlSymbol
* kaXmlLabel
* kaXmlIcon
* kaXmlLinestring
* kaXmlPolygon
All this classes have a constructor without parameters and different attributes: the attributes are described in the following of the document.
To use one of these objects create a new instance, configure it setting its properties ad add it to a ''kaXmlPoint'' with the method ''addGraphic''.
!! XML Document Type Definition
----------
<!ELEMENT overlay (delete*, point*)>
<!--
Delete from the overlay layer one or more points. If the atribute 'id' is present it's
used as a regular expression to match point id to be deleted. If 'id' is not given
deletes all points.
-->
<!ELEMENT delete EMPTY>
<!--
Define a point with a given ID. If the ID exists it's moved to the new position
otherwise it is drawn on the map.
In order to redraw an existing point to change some attribute in the rendering
let include the attribute redraw="true" or a <delete> element.
-->
<!ELEMENT point (ihtml?, symbol*, icon*, label*, linestring*, polygon*)>
<!--
Insert arbitrary HTML in the point DIV.
-->
<!ELEMENT ihtml (#PCDATA)>
<!ELEMENT symbol EMPTY>
<!ELEMENT icon EMPTY>
<!--
The content of the label element is the text of label.
-->
<!ELEMENT label (#PCDATA)>
<!--
The content of the linestring element is a list of coordinates in the form:
x0 y0, x1 y1, [...], xn yn
-->
<!ELEMENT linestring EMPTY>
<!--
The content of the polygon element is a list of coordinates in the form:
x0 y0, x1 y1, [...], xn yn
-->
<!ELEMENT polygon EMPTY>
<!ATTLIST delete id CDATA #IMPLIED>
<!ATTLIST point id CDATA #REQUIRED>
<!ATTLIST point x CDATA #REQUIRED>
<!ATTLIST point y CDATA #REQUIRED>
<!ATTLIST point redraw (false|true) "false">
<!ATTLIST symbol shape CDATA #IMPLIED>
<!ATTLIST symbol size CDATA #IMPLIED>
<!ATTLIST symbol color CDATA #IMPLIED>
<!ATTLIST symbol opacity CDATA #IMPLIED>
<!ATTLIST icon src CDATA #REQUIRED>
<!ATTLIST icon w CDATA #REQUIRED>
<!ATTLIST icon h CDATA #REQUIRED>
<!ATTLIST icon px CDATA #IMPLIED>
<!ATTLIST icon py CDATA #IMPLIED>
<!ATTLIST icon opacity CDATA #IMPLIED>
<!ATTLIST label color CDATA #IMPLIED>
<!ATTLIST label boxcolor CDATA #IMPLIED>
<!ATTLIST label w CDATA #IMPLIED>
<!ATTLIST label h CDATA #IMPLIED>
<!ATTLIST label px CDATA #IMPLIED>
<!ATTLIST label py CDATA #IMPLIED>
<!ATTLIST label fsize CDATA #IMPLIED>
<!ATTLIST label font CDATA #IMPLIED>
<!ATTLIST linestring color CDATA #IMPLIED>
<!ATTLIST linestring stroke CDATA #IMPLIED>
<!ATTLIST linestring opacity CDATA #IMPLIED>
<!ATTLIST polygon color CDATA #IMPLIED>
<!ATTLI