2 /* This extension creates a map using OpenLayers to show sledrun details and sledrun overviews.
3 This extension depends on no other extension.
9 <wrgmap lat="47.267648" lon="11.40465" zoom="10"/>
11 (Shows icons for all sledruns. lat, lon and zoom are optional.)
17 <wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
19 <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
20 <gasthaus name="Stiglreith">47.238186 11.221940</gasthaus>
21 <gasthaus name="Sulzstich">47.240287 11.203006</gasthaus>
22 <parkplatz>47.245789 11.238971</parkplatz>
23 <parkplatz>47.237627 11.218886</parkplatz>
24 <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
25 <achtung name="Kreuzung mit Schipiste">47.2383200 11.2235592</achtung>
108 * <wrmap>...</wrmap> has to be valid XML.
109 * All coordinates are in WGS84 coordinate system.
110 * Coordinates have the preferred format "latitude N longitude E",
111 however for parsing the N and E can be omitted.
112 * <wrmap> has the following attributes:
113 * lat (float): latitude of map-center, optional.
114 * lon (float): longitude of map-center, optional.
115 * zoom (integer): zoom level of the map (google zoom levels). optional.
116 * width (integer): width of the map in pixel. optional (100% if omitted)
117 * height (integer): height of the map in pixel. optional.
118 * <wrmap> can have any number of the following sub-elements:
130 * The order may be used by the renderer to determine in which order the
131 elements should be drawn.
132 * <gasthaus>, <haltestelle>, <parkplatz>, <achtung> and <punkt> define points
133 * The elements may have the following attributes:
134 * name (string): defines the name (not the label) of the element
135 * wiki (string): name of a MediaWiki page the point refers to
136 * The content is exactly one coordinate pair.
137 * <rodelbahn>, <alternative>, <gehweg>, <lift>, <anfahrt> and <linie>
138 define non-closed polygons.
139 * They may have the following attributes:
140 farbe (hex format, e.g. #12a50f): color of the line
141 dicke (int): width of the line in pixel
142 * The content of the elements are a whitespace separated list of
146 For transmitting the map to javascript, geojson is used in the <div> element of the map.
147 This way, an extra request is avoided. The geojson format used here consists of a single
148 "FeatureCollection" (representing the <wrmap>) containing the sub-elements of wrmap
150 The features have an properties key that has a hash as values with the properties of
151 the XML subelements of wrmap. Optional attributes/properties can be omitted.
152 Additionally one mandatory property key is called 'type' and has the sub-element's name
154 The featurecollection itself has a properties key as well containing the attributes of
161 $wgExtensionCredits['parserhook'][] = array(
162 'name' => 'Winterrodeln Map',
163 'version' => '3.0.4',
164 'author' =>'Philipp Spitzer',
165 'url' => 'http://www.winterrodeln.org/trac/wiki/WrMap',
166 'description' => 'This extension creates a map using OpenLayers to show sledrun details and sledrun overviews.'
171 $wgResourceModules['ext.wrmap'] = array(
172 'scripts' => array('openlayers/OpenLayers.min.js', 'wrmap.js'),
173 // 'scripts' => array('openlayers/OpenLayers.js', 'wrmap.js'), // non-minimized version for debugging
174 'styles' => array('openlayers/theme/default/style.css', 'openlayers/theme/default/google.css'),
176 // When your module is loaded, these messages will be available through mw.msg()
177 //'messages' => array( 'myextension-hello-world', 'myextension-goodbye-world' ),
179 // If your scripts need code from other modules, list their identifiers as dependencies
180 // and ResourceLoader will make sure they're loaded before you.
181 // You don't need to manually list 'mediawiki' or 'jquery', which are always loaded.
182 //'dependencies' => array( 'jquery.ui.datepicker' ),
184 // You need to declare the base path of the file paths in 'scripts' and 'styles'
185 'localBasePath' => dirname( __FILE__ ),
187 // ... and the base from the browser as well. For extensions this is made easy,
188 // you can use the 'remoteExtPath' property to declare it relative to where the wiki
189 // has $wgExtensionAssetsPath configured:
190 'remoteExtPath' => 'wrmap',
196 $wgAutoloadClasses['WrMap'] = dirname(__FILE__) . '/wrmap.body.php';
197 $wgAutoloadClasses['WrGMap'] = $wgAutoloadClasses['WrMap'];
200 $wgHooks['ParserFirstCallInit'][] = 'wrMapParserFirstCallInit';
203 function wrMapParserFirstCallInit($parser) {
204 $parser->setHook('wrgmap', 'WrGMap::render');
205 $parser->setHook('wrmap', 'WrMap::render');