Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersQP.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | /** |
5 | 5 | * A query printer for maps using the Open Layers API |
6 | 6 | * |
7 | | - * @file SM_OpenLayers.php |
| 7 | + * @file SM_OpenLayersQP.php |
8 | 8 | * @ingroup SMOpenLayers |
9 | 9 | * |
10 | 10 | * @author Jeroen De Dauw |
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFunctions.js |
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSM.php |
— | — | @@ -20,5 +20,5 @@ |
21 | 21 | die( 'Not an entry point.' ); |
22 | 22 | } |
23 | 23 | |
24 | | -// $egMapsServices['osm']['qp'] = array('class' => 'SMOSMQP', 'file' => 'SemanticMaps/OpenStreetMap/SM_OSMQP.php', 'local' => false); |
| 24 | +$egMapsServices['osm']['qp'] = array('class' => 'SMOSMQP', 'file' => 'SemanticMaps/OpenStreetMap/SM_OSMQP.php', 'local' => false); |
25 | 25 | // $egMapsServices['osm']['fi'] = array('class' => 'SMOSMFormInput', 'file' => 'SemanticMaps/OpenStreetMap/SM_OSMFormInput.php', 'local' => false); |
\ No newline at end of file |
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMQP.php |
— | — | @@ -0,0 +1,95 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +/**
|
| 5 | + * A query printer for maps using the Open Layers API optimized for OSM
|
| 6 | + *
|
| 7 | + * @file SM_OSMQP.php
|
| 8 | + * @ingroup SMOSM
|
| 9 | + *
|
| 10 | + * @author Jeroen De Dauw
|
| 11 | + */
|
| 12 | +
|
| 13 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 14 | + die( 'Not an entry point.' );
|
| 15 | +}
|
| 16 | +
|
| 17 | +final class SMOSMQP extends SMMapPrinter {
|
| 18 | +
|
| 19 | + public $serviceName = MapsOSM::SERVICE_NAME;
|
| 20 | +
|
| 21 | + /**
|
| 22 | + * @see SMMapPrinter::setQueryPrinterSettings()
|
| 23 | + *
|
| 24 | + */
|
| 25 | + protected function setQueryPrinterSettings() {
|
| 26 | + global $egMapsOSMZoom, $egMapsOSMPrefix;
|
| 27 | +
|
| 28 | + $this->elementNamePrefix = $egMapsOSMPrefix;
|
| 29 | + $this->defaultZoom = $egMapsOSMZoom;
|
| 30 | +
|
| 31 | + $this->spesificParameters = array(
|
| 32 | + 'zoom' => array(
|
| 33 | + 'default' => '',
|
| 34 | + )
|
| 35 | + );
|
| 36 | + }
|
| 37 | +
|
| 38 | + /**
|
| 39 | + * @see SMMapPrinter::doMapServiceLoad()
|
| 40 | + *
|
| 41 | + */
|
| 42 | + protected function doMapServiceLoad() {
|
| 43 | + global $egOSMMapsOnThisPage;
|
| 44 | +
|
| 45 | + MapsOSM::addOSMDependencies($this->output);
|
| 46 | + $egOSMMapsOnThisPage++;
|
| 47 | +
|
| 48 | + $this->elementNr = $egOSMMapsOnThisPage;
|
| 49 | + }
|
| 50 | +
|
| 51 | + /**
|
| 52 | + * @see SMMapPrinter::addSpecificMapHTML()
|
| 53 | + *
|
| 54 | + */
|
| 55 | + protected function addSpecificMapHTML() {
|
| 56 | + global $wgJsMimeType;
|
| 57 | +
|
| 58 | + $markerItems = array();
|
| 59 | +
|
| 60 | + foreach ($this->m_locations as $location) {
|
| 61 | + // Create a string containing the marker JS
|
| 62 | + list($lat, $lon, $title, $label, $icon) = $location;
|
| 63 | +
|
| 64 | + $title = str_replace("'", "\'", $title);
|
| 65 | + $label = str_replace("'", "\'", $label);
|
| 66 | +
|
| 67 | + $markerItems[] = "getOSMMarkerData($lon, $lat, '$title', '$label', '$icon')";
|
| 68 | + }
|
| 69 | +
|
| 70 | + $markersString = implode(',', $markerItems);
|
| 71 | +
|
| 72 | + $controlItems = MapsMapper::createJSItemsString(explode(',', $this->controls));
|
| 73 | +
|
| 74 | + $this->output .= <<<EOT
|
| 75 | + <script type='$wgJsMimeType'>slippymaps['$this->mapName'] = new slippymap_map('$this->mapName', {
|
| 76 | + mode: 'osm-wm',
|
| 77 | + layer: 'osm-like',
|
| 78 | + locale: '$this->lang',
|
| 79 | + lat: $this->centre_lat,
|
| 80 | + lon: $this->centre_lon,
|
| 81 | + zoom: $this->zoom,
|
| 82 | + width: $this->width,
|
| 83 | + height: $this->height,
|
| 84 | + markers: [$markersString],
|
| 85 | + controls: [$controlItems]
|
| 86 | + });</script>
|
| 87 | +
|
| 88 | + <!-- map div -->
|
| 89 | + <div id='$this->mapName' class='map' style='width:{$this->width}px; height:{$this->height}px;'>
|
| 90 | + <script type='$wgJsMimeType'>slippymaps['$this->mapName'].init();</script>
|
| 91 | + <!-- /map div -->
|
| 92 | + </div>
|
| 93 | +EOT;
|
| 94 | + }
|
| 95 | +
|
| 96 | +}
|
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFormInput.php |
— | — | @@ -0,0 +1,106 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Form input hook that adds an OSM map format to Semantic Forms |
| 6 | + *
|
| 7 | + * @file SM_OSMFormInput.php
|
| 8 | + * @ingroup SMOSM
|
| 9 | + *
|
| 10 | + * @author Jeroen De Dauw |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( 'Not an entry point.' ); |
| 15 | +} |
| 16 | + |
| 17 | +final class SMOSMFormInput extends SMFormInput {
|
| 18 | + |
| 19 | + public $serviceName = MapsOSM::SERVICE_NAME; |
| 20 | + |
| 21 | + /** |
| 22 | + * @see MapsMapFeature::setMapSettings() |
| 23 | + * |
| 24 | + */ |
| 25 | + protected function setMapSettings() { |
| 26 | + global $egMapsOSMZoom, $egMapsOSMPrefix; |
| 27 | + |
| 28 | + $this->elementNamePrefix = $egMapsOSMPrefix; |
| 29 | + $this->showAddresFunction = 'showOSMAddress'; |
| 30 | + |
| 31 | + $this->earthZoom = 1; |
| 32 | + |
| 33 | + $this->defaultZoom = $egMapsOSMZoom; |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * @see MapsMapFeature::addFormDependencies() |
| 38 | + * |
| 39 | + */ |
| 40 | + protected function addFormDependencies() { |
| 41 | + global $wgJsMimeType; |
| 42 | + global $smgScriptPath, $smgOSMFormsOnThisPage, $smgStyleVersion; |
| 43 | + |
| 44 | + MapsOSM::addOLDependencies($this->output); |
| 45 | + |
| 46 | + if (empty($smgOSMFormsOnThisPage)) { |
| 47 | + $smgOSMFormsOnThisPage = 0; |
| 48 | + $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/OpenStreetMap/SM_OSMFunctions.js?$smgStyleVersion'></script>"; |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @see MapsMapFeature::doMapServiceLoad() |
| 54 | + * |
| 55 | + */ |
| 56 | + protected function doMapServiceLoad() { |
| 57 | + global $egOSMMapsOnThisPage, $smgOSMFormsOnThisPage; |
| 58 | + |
| 59 | + self::addFormDependencies(); |
| 60 | + |
| 61 | + $egOSMMapsOnThisPage++; |
| 62 | + $smgOSMFormsOnThisPage++; |
| 63 | + |
| 64 | + $this->elementNr = $egOSMMapsOnThisPage; |
| 65 | + } |
| 66 | +
|
| 67 | + /** |
| 68 | + * @see MapsMapFeature::addSpecificMapHTML() |
| 69 | + * |
| 70 | + */
|
| 71 | + protected function addSpecificMapHTML() { |
| 72 | + global $wgJsMimeType; |
| 73 | + |
| 74 | + $controlItems = MapsMapper::createJSItemsString(explode(',', $this->controls)); |
| 75 | + |
| 76 | + $this->output .= <<<EOT |
| 77 | + addOnloadHook(makeOSMFormInput( |
| 78 | + '$this->mapName', |
| 79 | + '$this->coordsFieldName', |
| 80 | + { |
| 81 | + mode: 'osm-wm', |
| 82 | + layer: 'osm-like', |
| 83 | + locale: '$this->lang', |
| 84 | + lat: $this->centre_lat, |
| 85 | + lon: $this->centre_lon, |
| 86 | + zoom: $this->zoom, |
| 87 | + width: $this->width, |
| 88 | + height: $this->height, |
| 89 | + controls: [$controlItems] |
| 90 | + } |
| 91 | + )); |
| 92 | + |
| 93 | + <div id='$this->mapName' class='map' style='width:{$this->width}px; height:{$this->height}px;'> |
| 94 | + <script type='$wgJsMimeType'>slippymaps['$this->mapName'].init();</script> |
| 95 | + </div> |
| 96 | +EOT; |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * @see SMFormInput::manageGeocoding() |
| 101 | + * |
| 102 | + */ |
| 103 | + protected function manageGeocoding() { |
| 104 | + $this->enableGeocoding = false; |
| 105 | + } |
| 106 | + |
| 107 | +} |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | die( 'Not an entry point.' ); |
25 | 25 | } |
26 | 26 | |
27 | | -define('SM_VERSION', '0.5 a12'); |
| 27 | +define('SM_VERSION', '0.5 a13'); |
28 | 28 | |
29 | 29 | $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps'; |
30 | 30 | $smgIP = $IP . '/extensions/SemanticMaps'; |
— | — | @@ -37,8 +37,8 @@ |
38 | 38 | |
39 | 39 | $wgHooks['AdminLinks'][] = 'smfAddToAdminLinks'; |
40 | 40 | |
41 | | -$wgAutoloadClasses['SMGeoCoordsValue'] = $smgIP . '/SM_GeoCoordsValue.php'; |
42 | | -$wgHooks['smwInitDatatypes'][] = 'smfInitGeoCoordsType'; |
| 41 | +//$wgAutoloadClasses['SMGeoCoordsValue'] = $smgIP . '/SM_GeoCoordsValue.php'; |
| 42 | +//$wgHooks['smwInitDatatypes'][] = 'smfInitGeoCoordsType'; |
43 | 43 | |
44 | 44 | $wgExtensionMessagesFiles['SemanticMaps'] = $smgIP . '/SemanticMaps.i18n.php'; |
45 | 45 | |
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php |
— | — | @@ -48,14 +48,19 @@ |
49 | 49 | } |
50 | 50 | |
51 | 51 | private static function initializeParams() { |
52 | | - global $egMapsDefaultService; |
| 52 | + global $egMapsDefaultService, $egMapsDefaultCentre; |
53 | 53 | |
54 | 54 | self::$parameters = array( |
55 | 55 | 'format' => array( |
56 | 56 | 'aliases' => array(), |
57 | 57 | 'criteria' => array(), |
58 | 58 | 'default' => $egMapsDefaultService |
59 | | - ), |
| 59 | + ), |
| 60 | + 'centre' => array( |
| 61 | + 'aliases' => array('center'), |
| 62 | + 'criteria' => array(), |
| 63 | + 'default' => $egMapsDefaultCentre |
| 64 | + ), |
60 | 65 | ); |
61 | 66 | } |
62 | 67 | |
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | * |
68 | 68 | * @param unknown_type $res |
69 | 69 | * @param unknown_type $outputmode |
| 70 | + * |
70 | 71 | * @return array |
71 | 72 | */ |
72 | 73 | public final function getResultText($res, $outputmode) { |
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsQP.php |
— | — | @@ -34,7 +34,12 @@ |
35 | 35 | $this->spesificParameters = array( |
36 | 36 | 'zoom' => array( |
37 | 37 | 'default' => '', |
38 | | - ) |
| 38 | + ), |
| 39 | + 'overlays' => array( |
| 40 | + 'aliases' => array(), |
| 41 | + 'criteria' => array(), |
| 42 | + 'default' => '' |
| 43 | + ), |
39 | 44 | ); |
40 | 45 | } |
41 | 46 | |