1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.ext.geo;
|
10
|
|
11
|
import java.awt.Color;
|
12
|
import java.io.IOException;
|
13
|
import java.io.Reader;
|
14
|
import java.util.Collection;
|
15
|
import java.util.EnumSet;
|
16
|
import java.util.List;
|
17
|
import java.util.Map;
|
18
|
import java.util.Set;
|
19
|
import java.util.UUID;
|
20
|
|
21
|
import javax.xml.stream.XMLStreamException;
|
22
|
|
23
|
import org.springframework.transaction.annotation.Transactional;
|
24
|
|
25
|
import de.micromata.opengis.kml.v_2_2_0.Kml;
|
26
|
import eu.etaxonomy.cdm.api.service.dto.CondensedDistribution;
|
27
|
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO;
|
28
|
import eu.etaxonomy.cdm.api.util.DescriptionUtility;
|
29
|
import eu.etaxonomy.cdm.api.util.DistributionOrder;
|
30
|
import eu.etaxonomy.cdm.model.common.Language;
|
31
|
import eu.etaxonomy.cdm.model.common.Marker;
|
32
|
import eu.etaxonomy.cdm.model.common.MarkerType;
|
33
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
34
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
35
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
36
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
37
|
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
|
38
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
39
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
40
|
|
41
|
/**
|
42
|
* @author a.kohlbecker
|
43
|
* @author n.hoffmann
|
44
|
* @since 18.06.2009
|
45
|
*/
|
46
|
public interface IEditGeoService {
|
47
|
|
48
|
/**
|
49
|
* Retrieve a parameter string to pass to an EditGeoService endpoint
|
50
|
* The endpoint will deliver a a map generated by the Edit Geo Service for the given
|
51
|
* <code>TaxonDescription</code>
|
52
|
*
|
53
|
* @param taxonDescriptions
|
54
|
* A List of <code>TaxonDescription</code> holding the distribution data
|
55
|
* @param subAreaPreference
|
56
|
* enables the <b>Sub area preference rule</b> if set to true,
|
57
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
58
|
* @param statusOrderPreference
|
59
|
* enables the <b>Status order preference rule</b> if set to true,
|
60
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
61
|
* @param hideMarkedAreas
|
62
|
* distributions where the area has a {@link Marker} with one of
|
63
|
* the specified {@link MarkerType}s will be skipped, see
|
64
|
* {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
65
|
* @param presenceAbsenceTermColors
|
66
|
* A map that classifies which <code>PresenceAbsenceTermBase</code> should
|
67
|
* be assigned which <code>Color</code>
|
68
|
* @param langs
|
69
|
* @return
|
70
|
*
|
71
|
*/
|
72
|
public String getDistributionServiceRequestParameterString(
|
73
|
List<TaxonDescription> taxonDescriptions,
|
74
|
boolean subAreaPreference,
|
75
|
boolean statusOrderPreference,
|
76
|
Set<MarkerType> hideMarkedAreas,
|
77
|
Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
|
78
|
List<Language> langs);
|
79
|
|
80
|
|
81
|
/**
|
82
|
*
|
83
|
* @param distributions
|
84
|
* @param subAreaPreference
|
85
|
* enables the <b>Sub area preference rule</b> if set to true,
|
86
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
87
|
* @param statusOrderPreference
|
88
|
* enables the <b>Status order preference rule</b> if set to true,
|
89
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
90
|
* @param presenceAbsenceTermColors
|
91
|
* @param langs
|
92
|
* @return
|
93
|
*/
|
94
|
public String getDistributionServiceRequestParameterString(
|
95
|
Set<Distribution> distributions,
|
96
|
boolean subAreaPreference,
|
97
|
boolean statusOrderPreference,
|
98
|
Set<MarkerType> hideMarkedAreas,
|
99
|
Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
|
100
|
List<Language> langs);
|
101
|
|
102
|
public OccurrenceServiceRequestParameterDto getOccurrenceServiceRequestParameters(
|
103
|
List<SpecimenOrObservationBase> specimensOrObersvations,
|
104
|
Map<SpecimenOrObservationType,Color> specimenOrObservationTypeColors
|
105
|
);
|
106
|
|
107
|
/**
|
108
|
* Adds an area mapping (CDM area -> geo service area). It is recommended to set the mapping
|
109
|
* in a persistent way, so it is available after restarting the application.
|
110
|
* @param area
|
111
|
* @param geoServiceArea
|
112
|
* @throws XMLStreamException
|
113
|
*/
|
114
|
public void setMapping(NamedArea area, GeoServiceArea geoServiceArea);
|
115
|
|
116
|
/**
|
117
|
* Reads csv data containing the attributes from a shape file and adds the
|
118
|
* shapefile data to each area in the given set of {@link NamedAreas}. The
|
119
|
* way this data it attached to the areas is specific to the
|
120
|
* {@link IGeoServiceAreaMapping} implementation. It is recommended to
|
121
|
* create csv file directly from the original shape file by making use of
|
122
|
* the {@code org2ogr} command which is contained in the <a
|
123
|
* href="http://www.gdal.org/ogr2ogr.html">gdal</a> tools:
|
124
|
*
|
125
|
* <pre>
|
126
|
* ogr2ogr -f csv out.csv input_shape_file.shp
|
127
|
* </pre>
|
128
|
*
|
129
|
* @param csvReader
|
130
|
* @param idSearchFields
|
131
|
* An ordered list column names in the the csv file to be
|
132
|
* imported. These columns will be used to search for the
|
133
|
* {@link NamedArea#getIdInVocabulary() IdInVocabulary} of each
|
134
|
* area
|
135
|
* @param wmsLayerName
|
136
|
* @return the resulting table of the import, also together with diagnostic
|
137
|
* messages per NamedArea (id not found, ambiguous mapping)
|
138
|
* @param areaVocabularyUuid
|
139
|
* , can be <code>NULL</code>. The NamedAreas contained in this
|
140
|
* vocabulary will be combined with areas defined in the
|
141
|
* <code>namedAreaUuids</code>
|
142
|
* @param namedAreaUuids
|
143
|
* a set of UUIDS for {@link NamedArea}. Can be <code>NULL</code>.
|
144
|
* Will be combined with the vocabulary if the
|
145
|
* <code>areaVocabularyUuid</code> is also given.
|
146
|
*
|
147
|
* @return
|
148
|
* @throws IOException
|
149
|
*/
|
150
|
@Transactional(readOnly=false)
|
151
|
public abstract Map<NamedArea, String> mapShapeFileToNamedAreas(Reader csvReader,
|
152
|
List<String> idSearchFields, String wmsLayerName, UUID areaVocabularyUuid,
|
153
|
Set<UUID> namedAreaUuids)
|
154
|
throws IOException;
|
155
|
|
156
|
/**
|
157
|
* @param parts
|
158
|
* @param taxonUUID
|
159
|
* @param subAreaPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
160
|
* @param statusOrderPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
161
|
* @param hiddenAreaMarkerTypes see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
162
|
* @param omitLevels see {@link DescriptionUtility#orderDistributions(Set, Collection)}
|
163
|
* @param presenceAbsenceTermColors
|
164
|
* @param languages
|
165
|
* @param propertyPaths
|
166
|
* @param ignoreDistributionStatusUndefined workaround until #9500 is implemented to ignore status "undefined"
|
167
|
* @return
|
168
|
*/
|
169
|
public DistributionInfoDTO composeDistributionInfoFor(EnumSet<DistributionInfoDTO.InfoPart> parts, UUID taxonUUID,
|
170
|
boolean subAreaPreference, boolean statusOrderPreference, Set<MarkerType> hiddenAreaMarkerTypes,
|
171
|
boolean neverUseFallbackAreaAsParent, Set<NamedAreaLevel> omitLevels,
|
172
|
Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
|
173
|
List<Language> languages, List<String> propertyPaths, CondensedDistributionConfiguration config,
|
174
|
DistributionOrder distributionOrder, boolean ignoreDistributionStatusUndefined);
|
175
|
|
176
|
/**
|
177
|
* @param distributions
|
178
|
* @param statusOrderPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
179
|
* @param hiddenAreaMarkerTypes marker types to make areas hidden, this includes fallback-areas which are defined to have visible sub-areas
|
180
|
* @param config the {@link CondensedDistributionConfiguration condensed distribution configuration}
|
181
|
* @param languages
|
182
|
* @return
|
183
|
*/
|
184
|
public CondensedDistribution getCondensedDistribution(Set<Distribution> distributions,
|
185
|
boolean statusOrderPreference,
|
186
|
Set<MarkerType> hiddenAreaMarkerTypes,
|
187
|
CondensedDistributionConfiguration config,
|
188
|
List<Language> langs);
|
189
|
|
190
|
public Kml occurrencesToKML(List<SpecimenOrObservationBase> specimensOrObersvations,
|
191
|
Map<SpecimenOrObservationType, Color> specimenOrObservationTypeColors);
|
192
|
|
193
|
}
|