Revision 7e9136ac
Added by Francisco Revilla over 14 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/EditGeoService.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.cdm.ext; |
11 | 11 |
|
12 | 12 |
import java.awt.Color; |
13 |
import java.util.ArrayList; |
|
13 | 14 |
import java.util.HashSet; |
14 | 15 |
import java.util.List; |
15 | 16 |
import java.util.Map; |
... | ... | |
20 | 21 |
import org.springframework.stereotype.Service; |
21 | 22 |
import org.springframework.transaction.annotation.Transactional; |
22 | 23 |
|
24 |
import eu.etaxonomy.cdm.model.common.Language; |
|
23 | 25 |
import eu.etaxonomy.cdm.model.description.Distribution; |
24 | 26 |
import eu.etaxonomy.cdm.model.description.Feature; |
25 | 27 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase; |
... | ... | |
37 | 39 |
@Transactional(readOnly=true) |
38 | 40 |
public class EditGeoService implements IEditGeoService{ |
39 | 41 |
|
42 |
private static final String DEFAULT_BACK_LAYER = "tdwg4"; |
|
43 |
|
|
40 | 44 |
public static final Logger logger = Logger.getLogger(EditGeoService.class); |
41 | 45 |
|
42 | 46 |
@Autowired |
... | ... | |
50 | 54 |
distributionFeature.add(feature); |
51 | 55 |
return distributionFeature; |
52 | 56 |
} |
57 |
|
|
58 |
/* (non-Javadoc) |
|
59 |
* @see eu.etaxonomy.cdm.ext.IEditGeoService#getEditGeoServiceUrlParameterString(java.util.List, java.util.Map, int, int, java.lang.String, java.lang.String, java.util.List) |
|
60 |
*/ |
|
61 |
public String getEditGeoServiceUrlParameterString( |
|
62 |
List<TaxonDescription> taxonDescriptions, |
|
63 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors, |
|
64 |
int width, int height, String bbox, String backLayer, |
|
65 |
List<Language> langs) { |
|
66 |
Set<Distribution> distributions = new HashSet<Distribution>(); |
|
67 |
for(TaxonDescription taxonDescription : taxonDescriptions){ |
|
68 |
List<Distribution> result = (List)dao.getDescriptionElements(taxonDescription, getDistributionFeatures(), Distribution.class, null, null, null); |
|
69 |
distributions.addAll(result); |
|
70 |
} |
|
71 |
|
|
72 |
if(backLayer == null){ |
|
73 |
backLayer = DEFAULT_BACK_LAYER; |
|
74 |
} |
|
75 |
String uriParams = EditGeoServiceUtilities.getEditGeoServiceUrlParameterString(distributions, presenceAbsenceTermColors, width, height, bbox, backLayer, langs); |
|
76 |
|
|
77 |
return uriParams; |
|
78 |
} |
|
53 | 79 |
|
54 | 80 |
/* (non-Javadoc) |
55 | 81 |
* @see eu.etaxonomy.cdm.ext.IEditGeoService#getEditGeoServiceUrlParameterString(eu.etaxonomy.cdm.model.description.TaxonDescription, java.util.Map, int, int, java.lang.String, java.lang.String) |
... | ... | |
57 | 83 |
public String getEditGeoServiceUrlParameterString( |
58 | 84 |
TaxonDescription taxonDescription, |
59 | 85 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors, |
60 |
int width, int height, String bbox, String backLayer) { |
|
86 |
int width, int height, String bbox, String backLayer, |
|
87 |
List<Language> langs) { |
|
61 | 88 |
|
62 |
Set<Distribution> distributions = new HashSet<Distribution>(); |
|
63 |
List<Distribution> result = (List)dao.getDescriptionElements(taxonDescription, getDistributionFeatures(), Distribution.class, null, null, null); |
|
64 |
distributions.addAll(result); |
|
89 |
List<TaxonDescription> taxonDescriptions = new ArrayList<TaxonDescription>(); |
|
90 |
taxonDescriptions.add(taxonDescription); |
|
65 | 91 |
|
66 |
String uriParams = EditGeoServiceUtilities.getEditGeoServiceUrlParameterString(distributions, presenceAbsenceTermColors, 0, 0, null, "tdwg4"); |
|
67 |
|
|
68 |
return uriParams; |
|
92 |
return getEditGeoServiceUrlParameterString(taxonDescriptions, presenceAbsenceTermColors, width, height, bbox, backLayer, langs); |
|
69 | 93 |
} |
70 | 94 |
|
71 | 95 |
/* (non-Javadoc) |
... | ... | |
73 | 97 |
*/ |
74 | 98 |
public String getEditGeoServiceUrlParameterString(Taxon taxon, |
75 | 99 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors, int width, int height, String bbox, |
76 |
String backLayer) { |
|
100 |
String backLayer, |
|
101 |
List<Language> langs) { |
|
77 | 102 |
|
78 | 103 |
List<TaxonDescription> taxonDescriptions = dao.getTaxonDescriptions(taxon, null, null, null, null, null); |
79 | 104 |
|
... | ... | |
84 | 109 |
distCollection.addAll(dists); |
85 | 110 |
} |
86 | 111 |
// generate the uri parameter string |
87 |
|
|
112 |
if(backLayer == null){ |
|
113 |
backLayer = DEFAULT_BACK_LAYER; |
|
114 |
} |
|
88 | 115 |
String uriParams = EditGeoServiceUtilities.getEditGeoServiceUrlParameterString(distCollection, |
89 |
presenceAbsenceTermColors, 0, 0, null, "tdwg4");
|
|
116 |
presenceAbsenceTermColors, width, height, bbox, backLayer, langs);
|
|
90 | 117 |
|
91 | 118 |
return uriParams; |
92 | 119 |
} |
Also available in: Unified diff
geoservice changes in order to implement the map legends ticket #868