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