Project

General

Profile

« Previous | Next » 

Revision 7844642a

Added by Andreas Kohlbecker about 4 years ago

ref #8972 switching type_designations_maps to kml

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
2772 2772
  }
2773 2773
}
2774 2774

  
2775
/**
2776
 * Concatenated the uuids of the passed cdm entity with `,` as glue.
2777
 * The returned string is suitable for cdm webservices consuming UUIDList as
2778
 * parameter
2779
 *
2780
 * @param array $cdm_entities
2781
 *
2782
 * @return string
2783
 */
2784
function cdm_uuid_list_parameter_value(array $cdm_entities){
2785
  $uuids = [];
2786
  foreach ($cdm_entities as $entity){
2787
    if(isset($entity) && is_uuid($entity->uuid) ){
2788
      $uuids[] = $entity->uuid;
2789
    }
2790
  }
2791
  return  join(',', $uuids);
2792
}
2793

  
2775 2794
/**
2776 2795
 * Adds java script to create and enable a toggler for the cdm webservice debug block content.
2777 2796
 *
modules/cdm_dataportal/cdm_api/webservice_uris.php
136 136
define('CDM_WS_GEOSERVICE_DISTRIBUTIONMAP', 'ext/edit/mapServiceParameters/taxonDistributionFor/$0');
137 137
define('CDM_WS_GEOSERVICE_OCCURRENCEMAP_FOR_FIELDUNITS', 'ext/edit/mapServiceParameters/taxonOccurrencesForX');
138 138
define('CDM_WS_GEOSERVICE_OCCURRENCEMAP', 'ext/edit/mapServiceParameters/taxonOccurrencesFor/$0');
139
define('CDM_WS_KML_SPECIMENSOROCCURENCES', 'kml/specimensOrOccurences/$0');
140
define('CDM_WS_KML_TYPEDESIGNATIONS', 'kml/typeDesignations/$0');
139 141
define('CDM_WS_KML_TAXON_OCCURRENCE', 'kml/taxonOccurrencesFor/$0');
140 142

  
141 143
define('CDM_WS_OCCURRENCE', 'occurrence');
modules/cdm_dataportal/includes/name.inc
904 904
 */
905 905
function compose_type_designations_map($type_designations)
906 906
{
907
  $points = array();
908
  $map_render_array = array();
909
  foreach ($type_designations as $td) {
910
    if ($td->class == "SpecimenTypeDesignation") {
911
      $derived_unit_facade = cdm_ws_get(CDM_WS_PORTAL_DERIVEDUNIT_FACADE, array($td->typeSpecimen->uuid));
912
      if (isset($derived_unit_facade->exactLocation)) {
913
        $points[] = $derived_unit_facade->exactLocation->latitude . ',' . $derived_unit_facade->exactLocation->longitude;
914
      }
915
    }
916
  }
917

  
918
  if (count($points) > 0) {
919
    // os=1:c/ff0000/10/noLabel&od=1:52.52079,13.57781|-43.46333333333333,172.60355&legend=0
920
    $occurrence_query = 'os=1:c/ff0000/10/noLabel&od=1:' . join('|', $points) . '&legend=0';
921
    // $occurrence_query = 'os=1:c/ff0000/10/noLabel&od=1:52.52079,13.57781|-43.46333333333333,172.60355&legend=0';
922
    $legend_format_query = null;
923
    $distribution_query = NULL;
924
    $map_render_array = compose_map('specimens', $occurrence_query, NULL, $distribution_query, $legend_format_query, []);
925
  }
907
  $typedesignations_uuid_param = cdm_uuid_list_parameter_value($type_designations);
908
  $kml_request_uri = cdm_compose_url(CDM_WS_KML_TYPEDESIGNATIONS, array($typedesignations_uuid_param));
909
  $map_render_array = compose_map('specimens', null, $kml_request_uri, null, null, []);
926 910
  return $map_render_array;
927 911
}
928 912

  

Also available in: Unified diff