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