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:
132 * The order may be used by the renderer to determine in which order the
133 elements should be drawn.
134 * <gasthaus>, <haltestelle>, <parkplatz>, <achtung>, <foto>, <verleih> and <punkt> define points
135 * The elements may have the following attributes:
136 * name (string): defines the name (not the label) of the element
137 * wiki (string): name of a MediaWiki page the point refers to
138 * The content is exactly one coordinate pair.
139 * <rodelbahn>, <alternative>, <gehweg>, <lift>, <anfahrt> and <linie>
140 define non-closed polygons.
141 * They may have the following attributes:
142 farbe (hex format, e.g. #12a50f): color of the line
143 dicke (int): width of the line in pixel
144 * The content of the elements are a whitespace separated list of
148 For transmitting the map to javascript, geojson is used in the <div> element of the map.
149 This way, an extra request is avoided. The geojson format used here consists of a single
150 "FeatureCollection" (representing the <wrmap>) containing the sub-elements of wrmap
152 The features have an properties key that has a hash as values with the properties of
153 the XML subelements of wrmap. Optional attributes/properties can be omitted.
154 Additionally one mandatory property key is called 'type' and has the sub-element's name
156 The featurecollection itself has a properties key as well containing the attributes of
163 $wgExtensionCredits['parserhook'][] = array(
164 'name' => 'Winterrodeln Map',
165 'version' => '3.2.1',
166 'author' =>'Philipp Spitzer',
167 'url' => 'http://www.winterrodeln.org/trac/wiki/WrMap',
168 'description' => 'This extension creates a map using OpenLayers to show sledrun details and sledrun overviews.'
173 $wgResourceModules['ext.wrmap'] = array(
174 'scripts' => array('openlayers/OpenLayers.min.js', 'wrmap.js'),
175 // 'scripts' => array('openlayers/OpenLayers.js', 'wrmap.js'), // non-minimized version for debugging
176 'styles' => array('openlayers/theme/default/style.css', 'openlayers/theme/default/google.css'),
178 // When your module is loaded, these messages will be available through mw.msg()
179 //'messages' => array( 'myextension-hello-world', 'myextension-goodbye-world' ),
181 // If your scripts need code from other modules, list their identifiers as dependencies
182 // and ResourceLoader will make sure they're loaded before you.
183 // You don't need to manually list 'mediawiki' or 'jquery', which are always loaded.
184 //'dependencies' => array( 'jquery.ui.datepicker' ),
186 // You need to declare the base path of the file paths in 'scripts' and 'styles'
187 'localBasePath' => dirname( __FILE__ ),
189 // ... and the base from the browser as well. For extensions this is made easy,
190 // you can use the 'remoteExtPath' property to declare it relative to where the wiki
191 // has $wgExtensionAssetsPath configured:
192 'remoteExtPath' => 'wrmap',
198 $wgAutoloadClasses['WrMap'] = dirname(__FILE__) . '/wrmap.body.php';
199 $wgAutoloadClasses['WrGMap'] = $wgAutoloadClasses['WrMap'];
202 $wgHooks['ParserFirstCallInit'][] = 'wrMapParserFirstCallInit';
205 function wrMapParserFirstCallInit($parser) {
206 $parser->setHook('wrgmap', 'WrGMap::render');
207 $parser->setHook('wrmap', 'WrMap::render');