Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -61,7 +61,6 @@ |
62 | 62 | $wgAutoloadClasses['MapsGeoFunctions'] = $incDir . 'Maps_GeoFunctions.php'; |
63 | 63 | $wgAutoloadClasses['MapsGeocoders'] = $incDir . 'Maps_Geocoders.php'; |
64 | 64 | $wgAutoloadClasses['MapsGeocoder'] = $incDir . 'Maps_Geocoder.php'; |
65 | | - $wgAutoloadClasses['MapsImageLayer'] = $incDir . 'Maps_ImageLayer.php'; |
66 | 65 | $wgAutoloadClasses['MapsLayer'] = $incDir . 'Maps_Layer.php'; |
67 | 66 | $wgAutoloadClasses['MapsLayerPage'] = $incDir . 'Maps_LayerPage.php'; |
68 | 67 | $wgAutoloadClasses['MapsLayers'] = $incDir . 'Maps_Layers.php'; |
— | — | @@ -89,6 +88,11 @@ |
90 | 89 | $wgAutoloadClasses['MapsGoogleGeocoder'] = $geoDir . 'Maps_GoogleGeocoder.php'; |
91 | 90 | $wgAutoloadClasses['MapsYahooGeocoder'] = $geoDir . 'Maps_YahooGeocoder.php'; |
92 | 91 | |
| 92 | + // Autoload the "includes/layers/" classes. |
| 93 | + $lyrDir = $incDir . 'layers/'; |
| 94 | + $wgAutoloadClasses['MapsImageLayer'] = $lyrDir . 'Maps_ImageLayer.php'; |
| 95 | + $wgAutoloadClasses['MapsKMLLayer'] = $lyrDir . 'Maps_KMLLayer.php'; |
| 96 | + |
93 | 97 | // Autoload the "includes/manipulations/" classes. |
94 | 98 | $manDir = $incDir . 'manipulations/'; |
95 | 99 | $wgAutoloadClasses['MapsParamCoordSet'] = $manDir . 'Maps_ParamCoordSet.php'; |
— | — | @@ -136,9 +140,6 @@ |
137 | 141 | // Since 0.7.1 |
138 | 142 | $wgHooks['ArticleFromTitle'][] = 'MapsHooks::onArticleFromTitle'; |
139 | 143 | |
140 | | - // Since 0.7.2 |
141 | | - $wgHooks['MappingLayersInitialization'][] = 'MapsImageLayer::register'; |
142 | | - |
143 | 144 | $egMapsFeatures = array(); |
144 | 145 | |
145 | 146 | // Include the settings file. |
Index: trunk/extensions/Maps/Maps_Settings.php |
— | — | @@ -66,8 +66,16 @@ |
67 | 67 | # Registration of the Yahoo! Geocoding service geocoder. |
68 | 68 | $wgHooks['GeocoderFirstCallInit'][] = 'MapsYahooGeocoder::register'; |
69 | 69 | |
| 70 | + # Layers |
| 71 | + |
| 72 | + # Registration of the image layer type. |
| 73 | + $wgHooks['MappingLayersInitialization'][] = 'MapsImageLayer::register'; |
70 | 74 | |
| 75 | + # Registration of the KML layer type. |
| 76 | + $wgHooks['MappingLayersInitialization'][] = 'MapsKMLLayer::register'; |
| 77 | + |
71 | 78 | |
| 79 | + |
72 | 80 | # Mapping services configuration |
73 | 81 | # Note: You can not use aliases in the settings. Use the main service names. |
74 | 82 | |
Index: trunk/extensions/Maps/RELEASE-NOTES |
— | — | @@ -8,8 +8,12 @@ |
9 | 9 | |
10 | 10 | |
11 | 11 | === Maps 0.7.2 === |
12 | | -(2010-10-2x) |
| 12 | +(2010-10-28) |
13 | 13 | |
| 14 | +==== Internal improvements ==== |
| 15 | + |
| 16 | +* Extended the layer handling to support different types of layers, each of which can be supported by one or more mapping services. |
| 17 | + |
14 | 18 | ==== Bug fixes ==== |
15 | 19 | |
16 | 20 | * Fixed incompatibility with MW 1.15.x. |
— | — | @@ -18,6 +22,8 @@ |
19 | 23 | |
20 | 24 | * Fixed small layout issue with pop-ups in Google Maps. |
21 | 25 | |
| 26 | +* Fixed incorrect error on non-existing pages in the Layer namespace. |
| 27 | + |
22 | 28 | === Maps 0.7.1 === |
23 | 29 | (2010-10-20) |
24 | 30 | |
Index: trunk/extensions/Maps/includes/Maps_ImageLayer.php |
— | — | @@ -1,82 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Class for describing image layers. |
6 | | - * |
7 | | - * @since 0.7.2 |
8 | | - * |
9 | | - * @file Maps_ImageLayer.php |
10 | | - * @ingroup Maps |
11 | | - * |
12 | | - * @author Jeroen De Dauw |
13 | | - */ |
14 | | -class MapsImageLayer extends MapsLayer { |
15 | | - |
16 | | - /** |
17 | | - * Registeres the layer. |
18 | | - * |
19 | | - * @since 0.7.2 |
20 | | - */ |
21 | | - public static function register() { |
22 | | - MapsLayers::registerLayer( 'image', __CLASS__, 'openlayers' ); |
23 | | - return true; |
24 | | - } |
25 | | - |
26 | | - /** |
27 | | - * @see MapsLayer::getParameterDefinitions |
28 | | - * |
29 | | - * @since 0.7.2 |
30 | | - * |
31 | | - * @return array |
32 | | - */ |
33 | | - protected function getParameterDefinitions( array $params ) { |
34 | | - $params[] = new Parameter( 'lowerbound', Parameter::TYPE_FLOAT ); |
35 | | - $params[] = new Parameter( 'upperbound', Parameter::TYPE_FLOAT ); |
36 | | - $params[] = new Parameter( 'leftbound', Parameter::TYPE_FLOAT ); |
37 | | - $params[] = new Parameter( 'rightbound', Parameter::TYPE_FLOAT ); |
38 | | - $params[] = new Parameter( 'width', Parameter::TYPE_FLOAT ); |
39 | | - $params[] = new Parameter( 'height', Parameter::TYPE_FLOAT ); |
40 | | - |
41 | | - $params[] = new Parameter( 'zoomlevels', Parameter::TYPE_INTEGER, false ); |
42 | | - |
43 | | - $params['label'] = new Parameter( 'label' ); |
44 | | - |
45 | | - $params['source'] = new Parameter( 'source' ); |
46 | | - $params['source']->addCriteria( new CriterionIsImage() ); |
47 | | - $params['source']->addManipulations( new MapsParamImage() ); |
48 | | - |
49 | | - return $params; |
50 | | - } |
51 | | - |
52 | | - /** |
53 | | - * @see MapsLayer::getJavaScriptDefinition |
54 | | - * |
55 | | - * @since 0.7.1 |
56 | | - * |
57 | | - * @return string |
58 | | - */ |
59 | | - public function getJavaScriptDefinition() { |
60 | | - foreach ( $this->properties as $name => $value ) { |
61 | | - ${ $name } = MapsMapper::encodeJsVar( $value ); |
62 | | - } |
63 | | - |
64 | | - $options = array( 'isImage' => true ); |
65 | | - |
66 | | - if ( $this->properties !== false ) { |
67 | | - $options['numZoomLevels'] = $zoomlevels; |
68 | | - } |
69 | | - |
70 | | - $options = Xml::encodeJsVar( (object)$options ); |
71 | | - |
72 | | - return <<<EOT |
73 | | - new OpenLayers.Layer.Image( |
74 | | - $label, |
75 | | - $source, |
76 | | - new OpenLayers.Bounds($leftbound, $lowerbound, $rightbound, $upperbound), |
77 | | - new OpenLayers.Size($width, $height), |
78 | | - {$options} |
79 | | - ) |
80 | | -EOT; |
81 | | - } |
82 | | - |
83 | | -} |
\ No newline at end of file |
Index: trunk/extensions/Maps/includes/layers/Maps_ImageLayer.php |
— | — | @@ -0,0 +1,82 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for describing image layers. |
| 6 | + * |
| 7 | + * @since 0.7.2 |
| 8 | + * |
| 9 | + * @file Maps_ImageLayer.php |
| 10 | + * @ingroup Maps |
| 11 | + * |
| 12 | + * @author Jeroen De Dauw |
| 13 | + */ |
| 14 | +class MapsImageLayer extends MapsLayer { |
| 15 | + |
| 16 | + /** |
| 17 | + * Registeres the layer. |
| 18 | + * |
| 19 | + * @since 0.7.2 |
| 20 | + */ |
| 21 | + public static function register() { |
| 22 | + MapsLayers::registerLayer( 'image', __CLASS__, 'openlayers' ); |
| 23 | + return true; |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @see MapsLayer::getParameterDefinitions |
| 28 | + * |
| 29 | + * @since 0.7.2 |
| 30 | + * |
| 31 | + * @return array |
| 32 | + */ |
| 33 | + protected function getParameterDefinitions( array $params ) { |
| 34 | + $params[] = new Parameter( 'lowerbound', Parameter::TYPE_FLOAT ); |
| 35 | + $params[] = new Parameter( 'upperbound', Parameter::TYPE_FLOAT ); |
| 36 | + $params[] = new Parameter( 'leftbound', Parameter::TYPE_FLOAT ); |
| 37 | + $params[] = new Parameter( 'rightbound', Parameter::TYPE_FLOAT ); |
| 38 | + $params[] = new Parameter( 'width', Parameter::TYPE_FLOAT ); |
| 39 | + $params[] = new Parameter( 'height', Parameter::TYPE_FLOAT ); |
| 40 | + |
| 41 | + $params[] = new Parameter( 'zoomlevels', Parameter::TYPE_INTEGER, false ); |
| 42 | + |
| 43 | + $params['label'] = new Parameter( 'label' ); |
| 44 | + |
| 45 | + $params['source'] = new Parameter( 'source' ); |
| 46 | + $params['source']->addCriteria( new CriterionIsImage() ); |
| 47 | + $params['source']->addManipulations( new MapsParamImage() ); |
| 48 | + |
| 49 | + return $params; |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @see MapsLayer::getJavaScriptDefinition |
| 54 | + * |
| 55 | + * @since 0.7.1 |
| 56 | + * |
| 57 | + * @return string |
| 58 | + */ |
| 59 | + public function getJavaScriptDefinition() { |
| 60 | + foreach ( $this->properties as $name => $value ) { |
| 61 | + ${ $name } = MapsMapper::encodeJsVar( $value ); |
| 62 | + } |
| 63 | + |
| 64 | + $options = array( 'isImage' => true ); |
| 65 | + |
| 66 | + if ( $zoomlevels !== false ) { |
| 67 | + $options['numZoomLevels'] = $zoomlevels; |
| 68 | + } |
| 69 | + |
| 70 | + $options = Xml::encodeJsVar( (object)$options ); |
| 71 | + |
| 72 | + return <<<EOT |
| 73 | + new OpenLayers.Layer.Image( |
| 74 | + $label, |
| 75 | + $source, |
| 76 | + new OpenLayers.Bounds($leftbound, $lowerbound, $rightbound, $upperbound), |
| 77 | + new OpenLayers.Size($width, $height), |
| 78 | + {$options} |
| 79 | + ) |
| 80 | +EOT; |
| 81 | + } |
| 82 | + |
| 83 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Maps/includes/layers/Maps_ImageLayer.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 84 | + native |
Index: trunk/extensions/Maps/includes/layers/Maps_KMLLayer.php |
— | — | @@ -0,0 +1,76 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for describing KML layers. |
| 6 | + * |
| 7 | + * @since 0.7.2 |
| 8 | + * |
| 9 | + * @file Maps_KMLLayer.php |
| 10 | + * @ingroup Maps |
| 11 | + * |
| 12 | + * @author Jeroen De Dauw |
| 13 | + */ |
| 14 | +class MapsKMLLayer extends MapsLayer { |
| 15 | + |
| 16 | + /** |
| 17 | + * Registeres the layer. |
| 18 | + * |
| 19 | + * @since 0.7.2 |
| 20 | + */ |
| 21 | + public static function register() { |
| 22 | + MapsLayers::registerLayer( 'kml', __CLASS__, 'openlayers' ); |
| 23 | + return true; |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @see MapsLayer::getParameterDefinitions |
| 28 | + * |
| 29 | + * @since 0.7.2 |
| 30 | + * |
| 31 | + * @return array |
| 32 | + */ |
| 33 | + protected function getParameterDefinitions( array $params ) { |
| 34 | + $params['label'] = new Parameter( 'label' ); |
| 35 | + |
| 36 | + $params['source'] = new Parameter( 'source' ); |
| 37 | + $params['source']->addCriteria( new CriterionIsImage() ); |
| 38 | + $params['source']->addManipulations( new MapsParamImage() ); |
| 39 | + |
| 40 | + $params[] = new Parameter( 'maxdepth', Parameter::TYPE_INTEGER, 2 ); |
| 41 | + |
| 42 | + return $params; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @see MapsLayer::getJavaScriptDefinition |
| 47 | + * |
| 48 | + * @since 0.7.1 |
| 49 | + * |
| 50 | + * @return string |
| 51 | + */ |
| 52 | + public function getJavaScriptDefinition() { |
| 53 | + foreach ( $this->properties as $name => $value ) { |
| 54 | + ${ $name } = MapsMapper::encodeJsVar( $value ); |
| 55 | + } |
| 56 | + |
| 57 | + $options = array( |
| 58 | + 'extractStyles' => true, |
| 59 | + 'extractAttributes' => true, |
| 60 | + 'maxDepth' => $maxdepth |
| 61 | + ); |
| 62 | + |
| 63 | + $options = Xml::encodeJsVar( (object)$options ); |
| 64 | + |
| 65 | + return <<<EOT |
| 66 | + new OpenLayers.Layer.GML( |
| 67 | + $label, |
| 68 | + $source, |
| 69 | + { |
| 70 | + format: OpenLayers.Format.KML, |
| 71 | + formatOptions: {$options} |
| 72 | + } |
| 73 | + ) |
| 74 | +EOT; |
| 75 | + } |
| 76 | + |
| 77 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Maps/includes/layers/Maps_KMLLayer.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 78 | + native |