Revision 5f5cfe6a
Added by Andreas Kohlbecker about 4 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoService.java | ||
---|---|---|
28 | 28 |
import org.springframework.stereotype.Service; |
29 | 29 |
import org.springframework.transaction.annotation.Transactional; |
30 | 30 |
|
31 |
import de.micromata.opengis.kml.v_2_2_0.Kml; |
|
31 | 32 |
import eu.etaxonomy.cdm.api.service.DistributionTree; |
32 | 33 |
import eu.etaxonomy.cdm.api.service.dto.CondensedDistribution; |
33 | 34 |
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO; |
34 | 35 |
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO.InfoPart; |
35 | 36 |
import eu.etaxonomy.cdm.api.utility.DescriptionUtility; |
36 | 37 |
import eu.etaxonomy.cdm.api.utility.DistributionOrder; |
38 |
import eu.etaxonomy.cdm.ext.geo.kml.KMLDocumentBuilder; |
|
37 | 39 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
38 | 40 |
import eu.etaxonomy.cdm.model.common.Language; |
39 | 41 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
... | ... | |
181 | 183 |
} |
182 | 184 |
|
183 | 185 |
@Override |
184 |
public OccurrenceServiceRequestParameterDto getOccurrenceServiceRequestParameterString(
|
|
185 |
List<SpecimenOrObservationBase> specimensOrObersvations,
|
|
186 |
public OccurrenceServiceRequestParameterDto getOccurrenceServiceRequestParameters(
|
|
187 |
List<SpecimenOrObservationBase> specimensOrObservations,
|
|
186 | 188 |
Map<SpecimenOrObservationType, Color> specimenOrObservationTypeColors) { |
187 | 189 |
|
188 | 190 |
List<Point> fieldUnitPoints = new ArrayList<>(); |
189 | 191 |
List<Point> derivedUnitPoints = new ArrayList<>(); |
190 | 192 |
|
191 |
for (SpecimenOrObservationBase<?> specimenOrObservationBase : specimensOrObersvations) {
|
|
192 |
SpecimenOrObservationBase<?> specimenOrObservation = occurrenceDao |
|
193 |
for (SpecimenOrObservationBase<?> specimenOrObservationBase : specimensOrObservations) {
|
|
194 |
SpecimenOrObservationBase<?> specimensOrObservation = occurrenceDao
|
|
193 | 195 |
.load(specimenOrObservationBase.getUuid()); |
194 | 196 |
|
195 |
if (specimenOrObservation instanceof FieldUnit) { |
|
196 |
GatheringEvent gatherEvent = ((FieldUnit) specimenOrObservation).getGatheringEvent(); |
|
197 |
if (specimensOrObservation instanceof FieldUnit) {
|
|
198 |
GatheringEvent gatherEvent = ((FieldUnit) specimensOrObservation).getGatheringEvent();
|
|
197 | 199 |
if (gatherEvent != null && gatherEvent.getExactLocation() != null){ |
198 | 200 |
fieldUnitPoints.add(gatherEvent.getExactLocation()); |
199 | 201 |
} |
200 | 202 |
} |
201 |
if (specimenOrObservation instanceof DerivedUnit) { |
|
202 |
registerDerivedUnitLocations((DerivedUnit) specimenOrObservation, derivedUnitPoints); |
|
203 |
if (specimensOrObservation instanceof DerivedUnit) {
|
|
204 |
registerDerivedUnitLocations((DerivedUnit) specimensOrObservation, derivedUnitPoints);
|
|
203 | 205 |
} |
204 | 206 |
} |
205 | 207 |
|
206 | 208 |
return EditGeoServiceUtilities.getOccurrenceServiceRequestParameterString(fieldUnitPoints, |
207 | 209 |
derivedUnitPoints, specimenOrObservationTypeColors); |
208 | 210 |
} |
211 |
|
|
212 |
@Override |
|
213 |
public Kml occurrencesToKML( |
|
214 |
List<SpecimenOrObservationBase> specimensOrObservations, |
|
215 |
Map<SpecimenOrObservationType, Color> specimenOrObservationTypeColors) { |
|
216 |
|
|
217 |
KMLDocumentBuilder builder = new KMLDocumentBuilder(); |
|
218 |
|
|
219 |
for (SpecimenOrObservationBase<?> specimenOrObservationBase : specimensOrObservations) { |
|
220 |
builder.addSpecimenOrObservationBase(occurrenceDao.load(specimenOrObservationBase.getUuid())); |
|
221 |
} |
|
222 |
|
|
223 |
Kml kml = builder.build(); |
|
224 |
|
|
225 |
return kml; |
|
226 |
} |
|
209 | 227 |
|
210 | 228 |
public CondensedDistribution getCondensedDistribution(List<TaxonDescription> taxonDescriptions, |
211 | 229 |
boolean statusOrderPreference, |
Also available in: Unified diff
ref #6113 producing more complete kml for DerivedUnits & general controller for HTTP OPTIONS requests