]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/blobdiff - wrmap.php
Changed map output to DOM based output.
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.php
index 5cbf067f6372b294a3c4bdc5b04f52c95868d3d7..931ceedf50c4f7f27515bf284310f901b71ea279 100644 (file)
--- a/wrmap.php
+++ b/wrmap.php
@@ -22,7 +22,7 @@ Example 2
 <parkplatz>47.245789 11.238971</parkplatz>
 <parkplatz>47.237627 11.218886</parkplatz>
 <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
-<achtung name="Kreuzung mit Schipiste">47.2383200,11.2235592</achtung>
+<achtung name="Kreuzung mit Schipiste">47.2383200 11.2235592</achtung>
 
 <gehweg>
 47.238587 11.203360
@@ -100,12 +100,67 @@ Example 2
 
 </wrmap>
 
-lat, lon and zoom are optional.
+
+
+Definition
+----------
+
+* <wrmap>...</wrmap> has to be valid XML.
+* All coordinates are in WGS84 coordinate system.
+* Coordinates have the preferred format "latitude N longitude E",
+  however for parsing the N and E can be omitted.
+* <wrmap> has the following attributes:
+       * lat (float): latitude of map-center, optional.
+       * lon (float): longitude of map-center, optional.
+       * zoom (integer): zoom level of the map (google zoom levels). optional.
+       * width (integer): width of the map in pixel. optional (100% if omitted)
+       * height (integer): height of the map in pixel. optional.
+       * <wrmap> can have any number of the following sub-elements:
+               * <gasthaus>
+               * <haltestelle>
+               * <parkplatz>
+               * <achtung>
+               * <punkt>
+               * <rodelbahn>
+               * <alternative>
+               * <gehweg>
+               * <lift>
+               * <anfahrt>
+               * <linie>
+       * The order may be used by the renderer to determine in which order the 
+         elements should be drawn.
+* <gasthaus>, <haltestelle>, <parkplatz>, <achtung> and <punkt> define points
+       * The elements may have the following attributes:
+               * name (string): defines the name (not the label) of the element
+               * wiki (string): name of a MediaWiki page the point refers to
+       * The content is exactly one coordinate pair.
+* <rodelbahn>, <alternative>, <gehweg>, <lift>, <anfahrt> and <linie>
+  define non-closed polygons.
+       * They may have the following attributes:
+               farbe (hex format, e.g. #12a50f): color of the line
+               dicke (int): width of the line in pixel
+       * The content of the elements are a whitespace separated list of 
+               coordinates.
+
+
+For transmitting the map to javascript, geojson is used in the <div> element of the map.
+This way, an extra request is avoided. The geojson format used here consists of a single
+"FeatureCollection" (representing the <wrmap>) containing the sub-elements of wrmap
+as features.
+The features have an properties key that has a hash as values with the properties of 
+the XML subelements of wrmap. Optional attributes/properties can be omitted.
+Additionally one mandatory property key is called 'type' and has the sub-element's name
+as value.
+The featurecollection itself has a properties key as well containing the attributes of
+the wrmap element.
+
+
+
 */
 
 $wgExtensionCredits['parserhook'][] = array(
        'name' => 'Winterrodeln Map',
-       'version' => '3.0.0',
+       'version' => '3.0.4',
        'author' =>'Philipp Spitzer', 
        'url' => 'http://www.winterrodeln.org/trac/wiki/WrMap', 
        'description' => 'This extension creates a map using OpenLayers to show sledrun details and sledrun overviews.'
@@ -114,7 +169,8 @@ $wgExtensionCredits['parserhook'][] = array(
 
 
 $wgResourceModules['ext.wrmap'] = array(
-       'scripts' => array('openlayers/OpenLayers.js', 'wrmap.js'),
+       'scripts' => array('openlayers/OpenLayers.min.js', 'wrmap.js'),
+       // 'scripts' => array('openlayers/OpenLayers.js', 'wrmap.js'), // non-minimized version for debugging
        'styles' => array('openlayers/theme/default/style.css', 'openlayers/theme/default/google.css'),
 
        // When your module is loaded, these messages will be available through mw.msg()