Project

General

Profile

« Previous | Next » 

Revision 8cd78f15

Added by Andreas Kohlbecker over 12 years ago

related to #2664 (Specimen maps are not shown in cyprus dev portal) - now the occurrence map is colored

View differences:

5.x/modules/cdm_dataportal/cdm_dataportal.module
125 125
    $query_string .= '&mlp=3&mc_s=Georgia,15,blue&mc=' . $map_caption;
126 126
  }
127 127

  
128
  // either occurrence or distribution - combined maps will be possible in future
129
  if ($occurrenceQuery){
128
  if (getEDITMapServiceVersionNumber() >= 1.1) {
130 129

  
131
    $map_service_script_name = "points.php";
130
    // either occurrence or distribution - combined maps will be possible in future
131
    if ($occurrenceQuery){
132 132

  
133
    //fix $occurrenceQuery
134
    $occurrenceQuery = str_replace("&image=false", "", $occurrenceQuery);
135
    //$occurrenceQuery .= '&l=v%3Aatbi%2Ce_w_0';
136
    $occurrenceQuery .= '&l=v:e_w_0';
137

  
138
    $query_string .= "&" .$occurrenceQuery;
139

  
140
  } else if($distributionQuery){
141

  
142
    $query_string .= "&" .$distributionQuery;
143

  
144
    $map_service_script_name = "areas.php";
145

  
146
    // apply Plain Image map settings
147
    if (getEDITMapServiceVersionNumber() >= 1.1){
148
      /*
149
       * example : title=a:Naturalized++non-invasive
150
      * &ad=cyprusdivs:bdcode:a:5&as=a:ff9900,,0.1,&l=tdwg4
151
      * &ms=500&bbox=32,34,35,36&img=true&legend=1&mlp=3
152
      * &mc_s=Georgia,15,blue&mc=&recalculate=false
153
      *
154
      * http://edit.br.fgov.be/edit_wp5/v1/rest_gen.php?
155
      * l=background_gis:b,cyprusdivs&ad=cyprusdivs%3Abdcode%3Aa%3A8%2C4
156
      * &as=a%3A339966%2C%2C0.1%2C|b:0000ff,,
157
      * &bbox=32%2C34%2C35%2C36&img=true&legend=1&mc=&mc_s=Georgia%2C15%2Cblue
158
      * &mlp=3&ms=500&recalculate=false&title=a%3Aindigenous
159
      */
160

  
161
      $map_service_script_name = "rest_gen.php";
162

  
163
      $bgcolor_areaStyleId= "y";
164
      $baselayer_areaStyleId= "z";
165
      $bgcolor_layer='';
166
      $additional_area_styles = array();
167

  
168
      // background color:
169
      if(variable_get('map_bg_color', '')){
170
        $bgcolor_layer = "background_gis:".$bgcolor_areaStyleId;
171
        $additional_area_styles[] = $bgcolor_areaStyleId . ":" . variable_get('map_bg_color', '') . ",,";
172
      }
133
      //fix $occurrenceQuery
134
      $occurrenceQuery = str_replace("&image=false", "", $occurrenceQuery);
135
      //$occurrenceQuery .= '&l=v%3Aatbi%2Ce_w_0';
136
      $occurrenceQuery .= '&l=tdwg4&as='; // will be replaced below // HACK!!!
137
      $query_string .= "&" .$occurrenceQuery;
173 138

  
174
      //TODO HACK to replace the default base layer which currently is tdwg4 !!!
175
      if(strpos($query_string, "?l=") !== FALSE){
176
        $layer_param_token = "?l=";
177
      } else {
178
        $layer_param_token = "&l=";
179
      }
180
      if(strpos($query_string, "?as=") !== FALSE){
181
        $areystyle_param_token = "?as=";
182
      } else {
183
        $areystyle_param_token = "&as=";
184
      }
139
    } else if($distributionQuery){
185 140

  
186
      if(variable_get('map_base_layer', '')){
187
        $query_string = str_replace($layer_param_token."tdwg4", "$layer_param_token".variable_get('map_base_layer', ''). ":" . $baselayer_areaStyleId, $query_string);
188
      } else {
189
        $query_string = str_replace($layer_param_token."tdwg4", $layer_param_token."tdwg4:".$baselayer_areaStyleId . ",", $query_string);
190
      }
141
      $query_string .= "&" .$distributionQuery;
191 142

  
192
      if($bgcolor_layer){
193
        $query_string = str_replace($layer_param_token, $layer_param_token . $bgcolor_layer . ",", $query_string);
194
      }
143
    }
195 144

  
196
      if(variable_get('map_base_layer_style', '')){
197
        $additional_area_styles[] = $baselayer_areaStyleId . ":" . variable_get('map_base_layer_style', '');
198
      }
145
    //  apply Plain Image map settings special for version >= 1.1
146
    /*
147
     * example : title=a:Naturalized++non-invasive
148
    * &ad=cyprusdivs:bdcode:a:5&as=a:ff9900,,0.1,&l=tdwg4
149
    * &ms=500&bbox=32,34,35,36&img=true&legend=1&mlp=3
150
    * &mc_s=Georgia,15,blue&mc=&recalculate=false
151
    *
152
    * http://edit.br.fgov.be/edit_wp5/v1/rest_gen.php?
153
    * l=background_gis:b,cyprusdivs&ad=cyprusdivs%3Abdcode%3Aa%3A8%2C4
154
    * &as=a%3A339966%2C%2C0.1%2C|b:0000ff,,
155
    * &bbox=32%2C34%2C35%2C36&img=true&legend=1&mc=&mc_s=Georgia%2C15%2Cblue
156
    * &mlp=3&ms=500&recalculate=false&title=a%3Aindigenous
157
    */
158

  
159
    $map_service_script_name = "rest_gen.php";
160

  
161
    $bgcolor_areaStyleId= "y";
162
    $baselayer_areaStyleId= "z";
163
    $bgcolor_layer='';
164
    $additional_area_styles = array();
165

  
166
    // background color:
167
    if(variable_get('map_bg_color', '')){
168
      $bgcolor_layer = "background_gis:".$bgcolor_areaStyleId;
169
      $additional_area_styles[] = $bgcolor_areaStyleId . ":" . variable_get('map_bg_color', '') . ",,";
170
    }
199 171

  
200
      foreach ($additional_area_styles as $as) {
201
        $query_string = str_replace($areystyle_param_token, $areystyle_param_token . $as . "|", $query_string);
202
      }
172
    //TODO HACK to replace the default base layer which currently is tdwg4 !!! only needed for distribution maps
173
    if(strpos($query_string, "?l=") !== FALSE){
174
      $layer_param_token = "?l=";
175
    } else {
176
      $layer_param_token = "&l=";
177
    }
178
    if(strpos($query_string, "?as=") !== FALSE){
179
      $areystyle_param_token = "?as=";
180
    } else {
181
      $areystyle_param_token = "&as=";
182
    }
183
    if(variable_get('map_base_layer', '')){
184
      $query_string = str_replace($layer_param_token."tdwg4", "$layer_param_token".variable_get('map_base_layer', ''). ":" . $baselayer_areaStyleId, $query_string);
185
    } else {
186
      $query_string = str_replace($layer_param_token."tdwg4", $layer_param_token."tdwg4:".$baselayer_areaStyleId . ",", $query_string);
187
    }
188

  
189
    if($bgcolor_layer){
190
      $query_string = str_replace($layer_param_token, $layer_param_token . $bgcolor_layer . ",", $query_string);
191
    }
203 192

  
193
    if(variable_get('map_base_layer_style', '')){
194
      $additional_area_styles[] = $baselayer_areaStyleId . ":" . variable_get('map_base_layer_style', '');
204 195
    }
205
  } // end of if($distributionQuery)
196

  
197
    foreach ($additional_area_styles as $as) {
198
      $query_string = str_replace($areystyle_param_token, $areystyle_param_token . $as . "|", $query_string);
199
    }
200

  
201
  } else {
202
    // pre 1.1. version of map service
203
    if ($occurrenceQuery){
204

  
205
      $map_service_script_name = "point.php";
206

  
207
      //fix $occurrenceQuery
208
      $occurrenceQuery = str_replace("&image=false", "", $occurrenceQuery);
209
      //$occurrenceQuery .= '&l=v%3Aatbi%2Ce_w_0';
210
      $occurrenceQuery .= '&l=v:e_w_0';
211
      $query_string .= "&" .$occurrenceQuery;
212

  
213
    } else if($distributionQuery){
214

  
215
      $query_string .= "&" .$distributionQuery;
216
      $map_service_script_name = "areas.php";
217

  
218
    }
219

  
220
  }
206 221

  
207 222
  $mapUri = url("$server/$map_service_script_name?$query_string");
208 223
  $out = '<img class="distribution_map" src="' . $mapUri . '" alt="Map" />';
......
1665 1680
 * @param - $footnote_list_key
1666 1681
 */
1667 1682
function cdm_annotations_as_footnotekeys($cdmBase_list, $footnote_list_key = null){
1683
  static $annotations_types_filter;
1684

  
1685
  if(!$annotations_types_filter) {
1686
    unserialize(ANNOTATIONS_TYPES_AS_FOOTNOTES_DEFAULT);
1687
  }
1688

  
1668 1689
  $footNoteKeys = array();
1690

  
1669 1691
  //is argument cdmBase an array?
1670 1692
  if (!is_array($cdmBase_list)){
1671 1693
    $cdmBase_array = array();
......
1673 1695
  }else{
1674 1696
    $cdmBase_array = $cdmBase_list;
1675 1697
  }
1698

  
1676 1699
  //getting the key for the footnotemanager
1677 1700
  if( $footnote_list_key ){
1678 1701
    $footnoteListKey = $footnote_list_key;
1679 1702
  }else{
1680 1703
    $footnoteListKey = RenderHints::getFootnoteListKey() . '-annotations';
1681 1704
  }
1705

  
1682 1706
  //adding the footnotes keys
1707
  $annotations_types_filter = unserialize(ANNOTATIONS_TYPES_AS_FOOTNOTES_DEFAULT);
1683 1708
  foreach($cdmBase_array as $cdmBase_element){
1684
    $annotations = cdm_ws_getAnnotationsFor($cdmBase_element, variable_get('annotations_types_as_footnotes', unserialize(ANNOTATIONS_TYPES_AS_FOOTNOTES_DEFAULT)));
1709
    $annotations = cdm_ws_getAnnotationsFor($cdmBase_element, variable_get('annotations_types_as_footnotes', $annotations_types_filter));
1685 1710
    if(is_array($annotations)){
1686 1711
      foreach($annotations as $annotation){
1687 1712
          $footNoteKeys[] = FootnoteManager::addNewFootnote($footnoteListKey, $annotation->text);
1688 1713
      }
1689 1714
    }
1690 1715
  }
1716

  
1691 1717
  return $footNoteKeys;
1692 1718
}
1693 1719

  

Also available in: Unified diff