openlayers.styles.inc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * @file
  4. * This file contains styles implementations
  5. *
  6. * @ingroup openlayers
  7. */
  8. /**
  9. * Style Implementation
  10. *
  11. * Internal callback for openlayers style implementation.
  12. *
  13. * @return
  14. * Array of styles for an OpenLayers map
  15. */
  16. function _openlayers_openlayers_styles() {
  17. $styles = array();
  18. // Default style
  19. $style = new stdClass();
  20. $style->api_version = 1;
  21. $style->name = 'default';
  22. $style->title = t('Default style');
  23. $style->description = t('Basic default style.');
  24. $style->data = array(
  25. 'pointRadius' => '6',
  26. 'fillColor' => '#888888',
  27. 'strokeColor' => '#222222',
  28. 'strokeWidth' => '4',
  29. 'fillOpacity' => '0.5',
  30. 'strokeOpacity' => '0.7',
  31. );
  32. $styles[$style->name] = $style;
  33. // Hides features
  34. $style = new stdClass();
  35. $style->api_version = 1;
  36. $style->name = 'invisible';
  37. $style->title = t('Invisible style');
  38. $style->description = t('Invisible default style.');
  39. $style->data = array(
  40. 'pointRadius' => '0',
  41. 'strokeWidth' => '0',
  42. 'fillOpacity' => '0'
  43. );
  44. $styles[$style->name] = $style;
  45. // Default select style
  46. $style = new stdClass();
  47. $style->api_version = 1;
  48. $style->name = 'default_select';
  49. $style->title = t('Default select style');
  50. $style->description = t('Default style for selected geometries');
  51. $style->data = array(
  52. 'pointRadius' => '6',
  53. 'fillColor' => '#222222',
  54. 'strokeColor' => '#888888',
  55. 'strokeWidth' => '4',
  56. 'fillOpacity' => '0.7',
  57. 'strokeOpacity' => '0.8',
  58. );
  59. $styles[$style->name] = $style;
  60. // Marker styles
  61. $markers = array(
  62. 'red' => t('Red'),
  63. 'green' => t('Green'),
  64. 'gold' => t('Gold'),
  65. 'blue' => t('Blue'),
  66. );
  67. foreach ($markers as $marker => $color) {
  68. $style = new stdClass();
  69. $style->api_version = 1;
  70. $style->name = 'default_marker_' . $marker;
  71. $style->title = t('Marker !color', array('!color' => $color));
  72. $style->description = t('!color marker provided by the OpenLayers module.',
  73. array('!color' => $color));
  74. $style->data = array(
  75. 'externalGraphic' => drupal_get_path('module', 'openlayers') .
  76. '/themes/default_dark/img/marker-' . $marker . '.png',
  77. 'graphicWidth' => 21,
  78. 'graphicHeight' => 25,
  79. 'graphicXOffset' => -10,
  80. 'graphicYOffset' => -25,
  81. );
  82. $styles[$style->name] = $style;
  83. }
  84. // Custom black markers
  85. $style = new stdClass();
  86. $style->api_version = 1;
  87. $style->name = 'default_marker_black';
  88. $style->title = t('Marker Black');
  89. $style->description = t('Black marker provided by the OpenLayers module.');
  90. $style->data = array(
  91. 'externalGraphic' => drupal_get_path('module', 'openlayers') .
  92. '/themes/default_dark/markers/marker-black.png',
  93. 'graphicWidth' => 25,
  94. 'graphicHeight' => 41,
  95. 'graphicXOffset' => -12,
  96. 'graphicYOffset' => -41,
  97. );
  98. $styles[$style->name] = $style;
  99. $style = new stdClass();
  100. $style->api_version = 1;
  101. $style->name = 'default_marker_black_small';
  102. $style->title = t('Marker Black Small');
  103. $style->description = t('Small black marker provided by the OpenLayers module.');
  104. $style->data = array(
  105. 'externalGraphic' => drupal_get_path('module', 'openlayers') .
  106. '/themes/default_dark/markers/marker-black-small.png',
  107. 'graphicWidth' => 16,
  108. 'graphicHeight' => 26,
  109. 'graphicXOffset' => -8,
  110. 'graphicYOffset' => -26,
  111. );
  112. $styles[$style->name] = $style;
  113. return $styles;
  114. }