00001 <?php
00002
00012 if ( !defined( 'MEDIAWIKI' ) ) {
00013 die( 'Not an entry point.' );
00014 }
00015
00016 final class SMOSMQP extends SMMapPrinter {
00017
00018 public $serviceName = MapsOSM::SERVICE_NAME;
00019
00024 protected function setQueryPrinterSettings() {
00025 global $egMapsOSMZoom, $egMapsOSMPrefix;
00026
00027 $this->elementNamePrefix = $egMapsOSMPrefix;
00028 $this->defaultZoom = $egMapsOSMZoom;
00029 }
00030
00035 protected function doMapServiceLoad() {
00036 global $egOSMMapsOnThisPage;
00037
00038 MapsOSM::addOSMDependencies( $this->output );
00039 $egOSMMapsOnThisPage++;
00040
00041 $this->elementNr = $egOSMMapsOnThisPage;
00042 }
00043
00048 protected function addSpecificMapHTML( Parser $parser ) {
00049 global $wgJsMimeType;
00050
00051 $markerItems = array();
00052
00053 foreach ( $this->m_locations as $location ) {
00054
00055 list( $lat, $lon, $title, $label, $icon ) = $location;
00056
00057 $markerItems[] = "getOSMMarkerData($lon, $lat, '$title', '$label', '$icon')";
00058 }
00059
00060 $markersString = implode( ',', $markerItems );
00061
00062 $this->output .= <<<EOT
00063 <script type='$wgJsMimeType'>slippymaps['$this->mapName'] = new slippymap_map('$this->mapName', {
00064 mode: 'osm-wm',
00065 layer: 'osm-like',
00066 locale: '$this->lang',
00067 lat: $this->centreLat,
00068 lon: $this->centreLon,
00069 zoom: $this->zoom,
00070 width: $this->width,
00071 height: $this->height,
00072 markers: [$markersString],
00073 controls: [$this->controls]
00074 });</script>
00075
00076 <!-- map div -->
00077 <div id='$this->mapName' class='map' style='width:{$this->width}px; height:{$this->height}px;'>
00078 <script type='$wgJsMimeType'>slippymaps['$this->mapName'].init();</script>
00079 <!-- /map div -->
00080 </div>
00081 EOT;
00082 }
00083
00087 public function getParameters() {
00088 $params = parent::getParameters();
00089
00090 $params[] = array( 'name' => 'controls', 'type' => 'enum-list', 'description' => wfMsg( 'semanticmaps_paramdesc_controls' ), 'values' => MapsOSM::getControlNames() );
00091
00092 return $params;
00093 }
00094
00095 }