openlayers_test.maps.inc 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <?php
  2. /**
  3. * @file
  4. * Holds testing maps
  5. */
  6. /**
  7. * Separated implementation of hook_openlayers_maps().
  8. */
  9. function _openlayers_test_openlayers_maps() {
  10. $items = array();
  11. // Map with some behaviors
  12. $behaviors_test = new stdClass();
  13. $behaviors_test->api_version = 1;
  14. $behaviors_test->name = 'behaviors_test';
  15. $behaviors_test->title = t('Test: Behaviors');
  16. $behaviors_test->description = t('This is a test map.');
  17. $behaviors_test->data = array(
  18. 'projection' => '900913',
  19. 'width' => 'auto',
  20. 'default_layer' => 'osm_mapnik',
  21. 'height' => '400px',
  22. 'image_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/img/',
  23. 'css_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/style.css',
  24. 'center' => array(
  25. 'initial' => array(
  26. 'centerpoint' => '0,0',
  27. 'zoom' => '2'
  28. )
  29. ),
  30. 'options' => array(
  31. 'displayProjection' => '4326',
  32. 'maxExtent' => openlayers_get_extent('4326'),
  33. ),
  34. 'behaviors' => array(
  35. 'openlayers_behavior_panzoombar' => array(),
  36. 'openlayers_behavior_layerswitcher' => array(),
  37. 'openlayers_behavior_attribution' => array(),
  38. 'openlayers_behavior_keyboarddefaults' => array(),
  39. 'openlayers_behavior_navigation' => array(),
  40. 'openlayers_behavior_fullscreen' => array(),
  41. 'openlayers_behavior_mouseposition' => array(),
  42. 'openlayers_behavior_dragpan' => array(),
  43. 'openlayers_behavior_boxselect' => array(),
  44. 'openlayers_behavior_permalink' => array(),
  45. 'openlayers_behavior_scaleline' => array(),
  46. 'openlayers_behavior_zoombox' => array(),
  47. 'openlayers_behavior_zoomtomaxextent' => array(),
  48. ),
  49. 'layers' => array(
  50. 'osm_mapnik' => 'osm_mapnik',
  51. )
  52. );
  53. $items['behaviors_test'] = $behaviors_test;
  54. // Map integrating a Views overlay
  55. $openlayers_maps_cck_views = new stdClass;
  56. $openlayers_maps_cck_views->api_version = 1;
  57. $openlayers_maps_cck_views->name = 'openlayers_test_map_cck_views';
  58. $openlayers_maps_cck_views->title = 'Test: OpenLayers Test Views';
  59. $openlayers_maps_cck_views->description = 'This map tests a custom content type with a WKT field and a views layer.';
  60. $openlayers_maps_cck_views->data = array(
  61. 'width' => 'auto',
  62. 'height' => '400px',
  63. 'image_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/img/',
  64. 'css_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/style.css',
  65. 'center' => array(
  66. 'initial' => array(
  67. 'centerpoint' => '0,0',
  68. 'zoom' => '2',
  69. ),
  70. 'restrict' => array(
  71. 'restrictextent' => 0,
  72. 'restrictedExtent' => '',
  73. ),
  74. ),
  75. 'behaviors' => array(
  76. 'openlayers_behavior_attribution' => array(),
  77. 'openlayers_behavior_keyboarddefaults' => array(),
  78. 'openlayers_behavior_layerswitcher' => array(),
  79. 'openlayers_behavior_navigation' => array(),
  80. 'openlayers_behavior_panzoombar' => array(),
  81. 'openlayers_behavior_popup' => array(),
  82. ),
  83. 'default_layer' => 'osm_mapnik',
  84. 'layers' => array(
  85. 'osm_mapnik' => 'osm_mapnik',
  86. 'openlayers_test_view_openlayers_1' => 'openlayers_test_view_openlayers_1',
  87. ),
  88. 'layer_styles' => array(),
  89. 'layer_activated' => array(
  90. 'openlayers_test_view_openlayers_1' => 'openlayers_test_view_openlayers_1',
  91. ),
  92. 'layer_switcher' => array(
  93. 'openlayers_test_view_openlayers_1' => 'openlayers_test_view_openlayers_1',
  94. ),
  95. 'projection' => '900913',
  96. 'displayProjection' => '4326',
  97. 'styles' => array(
  98. 'default' => 'default',
  99. 'select' => 'default',
  100. 'temporary' => 'default',
  101. ),
  102. 'options' => NULL,
  103. );
  104. // GeoJSON example
  105. $openlayers_maps = new stdClass;
  106. $openlayers_maps->disabled = FALSE;
  107. $openlayers_maps->api_version = 1;
  108. $openlayers_maps->name = 'geojson';
  109. $openlayers_maps->title = 'Test: Using GeoJSON';
  110. $openlayers_maps->description = 'This map uses direct data in a GeoJSON layer, as well as a URL based GeoJSON layer.';
  111. $openlayers_maps->data = array(
  112. 'width' => 'auto',
  113. 'height' => '400px',
  114. 'image_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/img/',
  115. 'css_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/style.css',
  116. 'center' => array(
  117. 'initial' => array(
  118. 'centerpoint' => '0,0',
  119. 'zoom' => '2',
  120. ),
  121. 'restrict' => array(
  122. 'restrictextent' => 0,
  123. 'restrictedExtent' => '',
  124. ),
  125. ),
  126. 'behaviors' => array(
  127. 'openlayers_behavior_attribution' => array(),
  128. 'openlayers_behavior_keyboarddefaults' => array(),
  129. 'openlayers_behavior_layerswitcher' => array(
  130. 'ascending' => 1,
  131. 'roundedCorner' => 1,
  132. 'roundedCornerColor' => '#222222',
  133. ),
  134. 'openlayers_behavior_navigation' => array(
  135. 'zoomWheelEnabled' => 1,
  136. 'documentDrag' => 0,
  137. ),
  138. 'openlayers_behavior_panzoombar' => array(),
  139. 'openlayers_behavior_popup' => array(
  140. 'layers' => array(
  141. 'test_geojson_direct_data' => 'test_geojson_direct_data',
  142. 'test_geojson_url' => 'test_geojson_url',
  143. ),
  144. ),
  145. ),
  146. 'default_layer' => 'mapquest_osm',
  147. 'layers' => array(
  148. 'mapquest_osm' => 'mapquest_osm',
  149. 'mapquest_openaerial' => 'mapquest_openaerial',
  150. 'test_geojson_direct_data' => 'test_geojson_direct_data',
  151. 'test_geojson_url' => 'test_geojson_url',
  152. ),
  153. 'layer_styles' => array(
  154. 'test_geojson_direct_data' => 'default',
  155. 'test_geojson_url' => 'default_marker_blue',
  156. ),
  157. 'layer_styles_select' => array(
  158. 'test_geojson_direct_data' => 'default_select',
  159. 'test_geojson_url' => 'default_marker_green',
  160. ),
  161. 'projection' => '900913',
  162. 'displayProjection' => '4326',
  163. 'styles' => array(
  164. 'default' => 'default',
  165. 'select' => 'default_select',
  166. 'temporary' => 'default',
  167. ),
  168. );
  169. $items[$openlayers_maps->name] = $openlayers_maps;
  170. // GeoJSON example
  171. $openlayers_maps = new stdClass;
  172. $openlayers_maps->disabled = FALSE;
  173. $openlayers_maps->api_version = 1;
  174. $openlayers_maps->name = 'kml';
  175. $openlayers_maps->title = 'Test: Using KML';
  176. $openlayers_maps->description = 'This map uses a KML feed.';
  177. $openlayers_maps->data = array(
  178. 'width' => 'auto',
  179. 'height' => '400px',
  180. 'image_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/img/',
  181. 'css_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/style.css',
  182. 'center' => array(
  183. 'initial' => array(
  184. 'centerpoint' => '-122.08452530529, 37.421872987049',
  185. 'zoom' => '17',
  186. ),
  187. 'restrict' => array(
  188. 'restrictextent' => 0,
  189. 'restrictedExtent' => '',
  190. ),
  191. ),
  192. 'behaviors' => array(
  193. 'openlayers_behavior_attribution' => array(),
  194. 'openlayers_behavior_keyboarddefaults' => array(),
  195. 'openlayers_behavior_layerswitcher' => array(
  196. 'ascending' => 1,
  197. 'roundedCorner' => 1,
  198. 'roundedCornerColor' => '#222222',
  199. ),
  200. 'openlayers_behavior_navigation' => array(
  201. 'zoomWheelEnabled' => 1,
  202. 'documentDrag' => 0,
  203. ),
  204. 'openlayers_behavior_panzoombar' => array(),
  205. 'openlayers_behavior_popup' => array(
  206. 'layers' => array(
  207. 'test_geojson_direct_data' => 'test_kml_url',
  208. ),
  209. ),
  210. ),
  211. 'default_layer' => 'mapquest_osm',
  212. 'layers' => array(
  213. 'mapquest_osm' => 'mapquest_osm',
  214. 'mapquest_openaerial' => 'mapquest_openaerial',
  215. 'test_kml_url' => 'test_kml_url',
  216. ),
  217. 'layer_styles' => array(
  218. 'test_kml_url' => 'default',
  219. ),
  220. 'layer_styles_select' => array(
  221. 'test_kml_url' => 'default_select',
  222. ),
  223. 'projection' => '900913',
  224. 'displayProjection' => '4326',
  225. 'styles' => array(
  226. 'default' => 'default',
  227. 'select' => 'default_select',
  228. 'temporary' => 'default',
  229. ),
  230. );
  231. $items[$openlayers_maps->name] = $openlayers_maps;
  232. // We only want to provide the Views/CCK map if the
  233. // modules are installed and the view is provide
  234. if (module_exists('content') && module_exists('views') && module_exists('content_copy')) {
  235. $layers = openlayers_layers_load();
  236. if (!empty($layers['openlayers_test_view_openlayers_1'])) {
  237. $items['openlayers_test_map_cck_views'] = $openlayers_maps_cck_views;
  238. }
  239. }
  240. // Return maps
  241. return $items;
  242. }