1
|
/**
|
2
|
* Copyright (C) 2020 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
|
|
10
|
package eu.etaxonomy.cdm.ext.geo.kml;
|
11
|
|
12
|
import java.net.MalformedURLException;
|
13
|
import java.net.URL;
|
14
|
|
15
|
import de.micromata.opengis.kml.v_2_2_0.ColorMode;
|
16
|
import de.micromata.opengis.kml.v_2_2_0.IconStyle;
|
17
|
import de.micromata.opengis.kml.v_2_2_0.KmlFactory;
|
18
|
import de.micromata.opengis.kml.v_2_2_0.Units;
|
19
|
import de.micromata.opengis.kml.v_2_2_0.Vec2;
|
20
|
|
21
|
/**
|
22
|
*
|
23
|
* MOre icons at http://kml4earth.appspot.com/icons.html
|
24
|
*
|
25
|
* @author Andreas Kohlbecker
|
26
|
* @since Apr 21, 2020
|
27
|
*/
|
28
|
public enum MapMarkerIcons {
|
29
|
|
30
|
blu_blank("http://maps.google.com/mapfiles/kml/paddle/blu-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
31
|
blu_circle("http://maps.google.com/mapfiles/kml/paddle/blu-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
32
|
blu_diamond("http://maps.google.com/mapfiles/kml/paddle/blu-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
33
|
blu_square("http://maps.google.com/mapfiles/kml/paddle/blu-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
34
|
blu_stars("http://maps.google.com/mapfiles/kml/paddle/blu-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
35
|
|
36
|
grn_blank("http://maps.google.com/mapfiles/kml/paddle/grn-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
37
|
grn_circle("http://maps.google.com/mapfiles/kml/paddle/grn-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
38
|
grn_diamond("http://maps.google.com/mapfiles/kml/paddle/grn-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
39
|
grn_square("http://maps.google.com/mapfiles/kml/paddle/grn-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
40
|
grn_stars("http://maps.google.com/mapfiles/kml/paddle/grn-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
41
|
|
42
|
ltblu_blank("http://maps.google.com/mapfiles/kml/paddle/ltblu-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
43
|
ltblu_circle("http://maps.google.com/mapfiles/kml/paddle/ltblu-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
44
|
ltblu_diamond("http://maps.google.com/mapfiles/kml/paddle/ltblu-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
45
|
ltblu_square("http://maps.google.com/mapfiles/kml/paddle/ltblu-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
46
|
ltblu_stars("http://maps.google.com/mapfiles/kml/paddle/ltblu-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
47
|
|
48
|
pink_blank("http://maps.google.com/mapfiles/kml/paddle/pink-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
49
|
pink_circle("http://maps.google.com/mapfiles/kml/paddle/pink-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
50
|
pink_diamond("http://maps.google.com/mapfiles/kml/paddle/pink-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
51
|
pink_square("http://maps.google.com/mapfiles/kml/paddle/pink-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
52
|
pink_stars("http://maps.google.com/mapfiles/kml/paddle/pink-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
53
|
|
54
|
purple_blank("http://maps.google.com/mapfiles/kml/paddle/purple-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
55
|
purple_circle("http://maps.google.com/mapfiles/kml/paddle/purple-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
56
|
purple_diamond("http://maps.google.com/mapfiles/kml/paddle/purple-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
57
|
purple_square("http://maps.google.com/mapfiles/kml/paddle/purple-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
58
|
purple_stars("http://maps.google.com/mapfiles/kml/paddle/purple-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
59
|
|
60
|
red_blank("http://maps.google.com/mapfiles/kml/paddle/red-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
61
|
red_circle("http://maps.google.com/mapfiles/kml/paddle/red-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
62
|
red_diamond("http://maps.google.com/mapfiles/kml/paddle/red-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
63
|
red_square("http://maps.google.com/mapfiles/kml/paddle/red-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
64
|
red_stars("http://maps.google.com/mapfiles/kml/paddle/red-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
65
|
|
66
|
ylw_blank("http://maps.google.com/mapfiles/kml/paddle/ylw-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
67
|
ylw_circle("http://maps.google.com/mapfiles/kml/paddle/ylw-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
68
|
ylw_diamond("http://maps.google.com/mapfiles/kml/paddle/ylw-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
69
|
ylw_square("http://maps.google.com/mapfiles/kml/paddle/ylw-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
70
|
ylw_stars("http://maps.google.com/mapfiles/kml/paddle/ylw-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
71
|
|
72
|
orange_blank("http://maps.google.com/mapfiles/kml/paddle/orange-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
73
|
orange_circle("http://maps.google.com/mapfiles/kml/paddle/orange-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
74
|
orange_diamond("http://maps.google.com/mapfiles/kml/paddle/orange-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
75
|
orange_square("http://maps.google.com/mapfiles/kml/paddle/orange-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
76
|
orange_stars("http://maps.google.com/mapfiles/kml/paddle/orange-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
77
|
|
78
|
wht_blank("http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
79
|
wht_circle("http://maps.google.com/mapfiles/kml/paddle/wht-circle.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
80
|
wht_diamond("http://maps.google.com/mapfiles/kml/paddle/wht-diamond.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
81
|
wht_square("http://maps.google.com/mapfiles/kml/paddle/wht-sqare.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
82
|
wht_stars("http://maps.google.com/mapfiles/kml/paddle/wht-stars.png", KmlFactory.createVec2().withX(0.5).withY(0).withXunits(Units.FRACTION).withYunits(Units.FRACTION)),
|
83
|
|
84
|
sunny("http://maps.google.com/mapfiles/kml/shapes/sunny.png", null);
|
85
|
|
86
|
URL url;
|
87
|
Vec2 hotspot;
|
88
|
|
89
|
MapMarkerIcons(String ulr, Vec2 hotspot) {
|
90
|
try {
|
91
|
this.url = new URL(ulr);
|
92
|
if(hotspot != null) {
|
93
|
this.hotspot = hotspot;
|
94
|
}
|
95
|
} catch (MalformedURLException e) {
|
96
|
throw new RuntimeException(e);
|
97
|
}
|
98
|
}
|
99
|
|
100
|
@Override
|
101
|
public String toString() {
|
102
|
return url.toString();
|
103
|
}
|
104
|
|
105
|
public Vec2 hotSpot() {
|
106
|
return hotspot;
|
107
|
}
|
108
|
|
109
|
public IconStyle asIconStyle() {
|
110
|
IconStyle iconStyle = KmlFactory.createIconStyle().withIcon(
|
111
|
KmlFactory.createIcon().withHref(this.toString())
|
112
|
);
|
113
|
iconStyle.setScale(1);
|
114
|
iconStyle.setHotSpot(hotspot);
|
115
|
return iconStyle;
|
116
|
}
|
117
|
|
118
|
}
|