This repository has been archived by the owner on Oct 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DemoApp.java
131 lines (107 loc) · 44.6 KB
/
DemoApp.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package pl.itrack.leafletd3demo.client;
import com.google.gwt.core.client.EntryPoint;
import com.gwidgets.api.leaflet.L;
import com.gwidgets.api.leaflet.options.MapOptions;
import com.gwidgets.api.leaflet.options.TileLayerOptions;
import elemental2.dom.HTMLButtonElement;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import pl.itrack.leafletd3.client.LeafletD3;
import pl.itrack.leafletd3.client.wrapper.HexbinLayer;
import java.util.Arrays;
import java.util.logging.Logger;
import static elemental2.dom.DomGlobal.document;
/**
* A demo project using gwt-leaflet-d3 library.
* Entry point class defining <code>onModuleLoad()</code>.
* <p>
* It's a simple example and the whole application logic is in the main controller.
* In the real life project parts of code would be extracted to separate components and injected here.
* <p>
* MIT License
* <p>
* Copyright (c) 2018 <a href="https://github.com/baldram">Marcin Szalomski</a>
* <p>
*/
public class DemoApp implements EntryPoint {
private static final String MAP_HTML_ID = "map";
private static final String BUTTON_HTML_ID = "generateData";
private static final double CENTER_LATITUDE = 52.233333;
private static final double CENTER_LONGITUDE = 21.016667;
private static final String MAP_URL = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
private static final String ATTRIBUTION = "© <a href=\"http://openstreetmap.org/copyright\">OpenStreetMap</a> contributors";
private static Logger log = Logger.getLogger(DemoApp.class.getName());
private static final double[][] EXAMPLE_DATA = {{20.141859889984868, 52.16308143802469}, {21.061494245784065, 53.39042728016429}, {21.03577582835283, 52.533394569791845}, {20.315795341944682, 52.96303528868884}, {22.175193321689065, 51.57029829471516}, {22.05823176915833, 53.06484222908274}, {18.325858764291578, 53.81685838836188}, {21.386691600278084, 52.644959163606366}, {19.590937815970022, 52.004293869096806}, {19.966678785406774, 50.17884848132632}, {20.277068116303827, 51.13821565817973}, {20.410603115495505, 53.16076971368543}, {20.497951997976124, 50.40323125754625}, {19.402501290355072, 53.7491090633795}, {19.352746263608637, 53.11873529370043}, {19.587786456095497, 51.83294392462122}, {20.066809352249717, 50.29595857388352}, {20.344101698177727, 51.300431448294304}, {23.386514059705924, 51.987188188627265}, {22.203200803247807, 51.148565127499126}, {21.636713375479204, 52.718788315233304}, {21.76247292999215, 50.869625642772235}, {20.662775613695718, 52.4742027370304}, {18.716960371994755, 51.97949087374901}, {19.595450124287023, 51.39212625659811}, {21.415769725466536, 51.79939715077727}, {21.31049864987673, 53.58232792382992}, {20.048138116399656, 51.832837398140654}, {19.67656915829719, 52.40017574628647}, {20.68058767545396, 52.03667215951356}, {19.295700183414265, 50.30258590814865}, {21.164515944262593, 53.521350042982846}, {20.118388808777826, 51.67145315181778}, {22.142636136465363, 53.02739292700452}, {20.337550458346882, 51.861502417621615}, {20.403315300621898, 53.21611167100809}, {20.505615901561132, 52.12113394571489}, {20.535801292991344, 52.17959092263193}, {21.462055218023863, 51.30248512960764}, {22.79968222538458, 53.414253741512695}, {21.073078699503494, 51.39497801461963}, {21.354146239953884, 51.85812324432867}, {21.058379416326073, 51.43504999011515}, {20.78767699594136, 53.72259863722118}, {22.152882089741734, 53.11995308206786}, {20.5810750407799, 52.50973185494264}, {20.240160715952033, 52.18768951249906}, {19.721055642879076, 52.28054247141665}, {19.87008819999163, 52.22992100070653}, {21.087122176911695, 52.50421531256882}, {21.007619086730852, 51.7566935347882}, {17.93408162443936, 53.71935076030126}, {20.392782892636415, 53.545495201056596}, {19.02982331247283, 51.52884289863027}, {20.59500759802661, 52.2242266836331}, {22.12406200079773, 52.40953529539922}, {20.867972546989765, 52.6443482338901}, {20.056906397120724, 51.40816821199083}, {20.69198902718157, 51.313839645786736}, {20.311021117743007, 52.96850244040855}, {21.4693328448955, 52.99583192220889}, {22.197262154572552, 52.145277126555676}, {21.642261932365315, 52.404594737791975}, {21.693057757459876, 52.16621073841047}, {19.838015373831023, 51.75172530030155}, {20.43819478340609, 54.15411382171769}, {19.584378066102378, 51.508321799067154}, {19.47294093725172, 51.41566885732005}, {20.553590970975932, 53.7172407864692}, {20.109323519696716, 52.12546020783613}, {21.404424587772077, 52.51736351263659}, {22.661563547936357, 52.644778299973275}, {21.0849517310538, 51.05972791086317}, {21.792237190329597, 53.2163456353213}, {22.43326064650707, 49.45510329049856}, {20.774291769241866, 51.309706797020866}, {20.79241811513404, 51.6172119492998}, {21.24087287730292, 51.90460888320703}, {20.30182814069708, 52.0767347619327}, {22.856813739839048, 53.823480414122336}, {21.391170871722267, 51.43219016217388}, {22.871817086853316, 52.238289860055744}, {20.199107559953458, 51.729955223988746}, {20.737587059894924, 52.35148854692543}, {21.723315116273618, 51.94182205459191}, {20.799368433243572, 51.43227485987895}, {20.72569518771952, 51.05187449554135}, {20.931192663210535, 53.122740471882054}, {21.533081082973105, 51.73080523841355}, {21.285050474249026, 50.629842136327255}, {19.616818140807442, 51.603781610456615}, {21.29367199955978, 53.06221717361634}, {21.725714226318907, 53.05146593726197}, {20.676592923903435, 51.4031923452895}, {21.02034474156467, 52.78632259030145}, {21.948902562637898, 53.30616466912645}, {20.959228473744908, 52.92627490926493}, {19.527646971964817, 52.00758285735769}, {21.48507155981334, 53.05231887020779}, {20.960721364571423, 51.70018909509548}, {20.37970668869165, 52.60200954791193}, {21.05667287554411, 52.59005270733028}, {19.847107437802233, 52.73676693994679}, {21.303805289717705, 52.95172757761874}, {21.526189416187098, 51.49235974607102}, {20.368558517448278, 53.10779495720803}, {22.457502934684214, 50.965758155637246}, {19.64381580386455, 52.81467117228356}, {19.76726173049742, 53.04834429073874}, {21.77071811879391, 50.67482368599846}, {21.83681678695213, 52.32087699065936}, {21.070206057701117, 52.81375916661261}, {20.95363603464904, 51.50800012907193}, {19.4329170084866, 52.01769044242086}, {19.55511772023189, 53.78856128471586}, {20.753079943068805, 52.22318087671179}, {19.837283130919804, 53.72104063943012}, {20.13316011361545, 52.12823253708315}, {19.53904432979601, 51.25055926634873}, {22.12443359032057, 51.717320506383615}, {20.600264487991428, 51.11737436291081}, {21.319744590536015, 50.39738786963267}, {21.03578503755384, 53.1038733229419}, {21.269898230747316, 52.67227379631305}, {22.287030340679546, 50.42296981897867}, {21.367877690316632, 51.261329091576854}, {21.852778168774954, 51.894849084819825}, {22.440059944158733, 50.56385609944055}, {20.794655237124992, 51.45572907309868}, {21.548263314531596, 53.709262622158306}, {20.081471387706966, 52.95655692142034}, {21.068615004037852, 50.30903372806111}, {18.981701814164495, 52.92044630783844}, {21.475311446201708, 53.27382573438549}, {19.58326729684347, 51.92352220986221}, {21.083053585149756, 53.58851324958361}, {20.62240740297743, 53.06002263225914}, {20.824810729661547, 50.900370730027994}, {19.763003959096693, 51.21377049203501}, {21.21030538426325, 52.09201440287673}, {20.347255351729196, 53.15627885717417}, {20.320903766518867, 52.43827973445113}, {20.222104541450967, 51.01647882662266}, {20.89899484053024, 53.08995622501352}, {22.88807619999345, 50.511462839434564}, {21.81347051576794, 52.370210536697236}, {20.820376002881186, 52.05261999556432}, {21.967567568720284, 50.3887405999045}, {19.92541237915267, 52.8578569288029}, {19.917955740816343, 52.45919818437567}, {19.98642558431258, 53.150216133590355}, {20.850205116992566, 51.84006715621401}, {20.848290254721952, 53.652620717100454}, {21.952998153875374, 50.69766235094701}, {22.706432195254518, 51.2838515270552}, {20.177681483815103, 51.791972376214176}, {20.090945666030844, 52.04029546505356}, {19.58769921147259, 52.2446487448627}, {20.6497140903972, 50.92828396151557}, {20.814660070963182, 51.56939018186497}, {21.418491270516405, 51.083233571570915}, {21.371207102247062, 53.585574374728665}, {22.644435143445698, 52.617009628553966}, {19.884388391354268, 52.65679664950003}, {21.006618441465736, 51.30454528484981}, {20.065618605991848, 51.83681504183785}, {21.033785985849832, 52.39038558263812}, {20.967331700724667, 53.571550117589844}, {20.58812930718604, 53.05111921970753}, {20.384942406011106, 51.40689761247329}, {19.54882470978788, 50.11811757991879}, {19.41607033109679, 51.221273649060024}, {21.125130502597802, 52.79122656572667}, {20.429808856824692, 52.0048997705471}, {21.30807623479027, 50.24502819336696}, {20.97397128925858, 51.60447558021879}, {21.88518099460641, 52.01352642028697}, {21.836581020599084, 53.55992837345614}, {23.02897840522426, 54.73902062583686}, {21.264878805928177, 52.37238708219113}, {18.88075197677398, 51.73049400018646}, {21.4965410411858, 50.84437212590106}, {20.48508687698091, 51.841872127299396}, {21.226036652546558, 51.80622497570584}, {19.944853443877754, 51.47898291344079}, {21.878832015448104, 51.990734184038274}, {22.412417491870418, 52.22495555939935}, {22.6417104500377, 52.865913441324}, {19.39102980330638, 51.98154637721255}, {22.119593883041112, 52.3042878386103}, {20.9385775162504, 52.61031715265715}, {20.66341938970781, 52.15458086302167}, {19.798601299502163, 52.12625390261142}, {21.388132784681897, 53.09183728731837}, {22.885248806559563, 52.522554388197705}, {21.57175413281031, 51.3995532210272}, {22.344871360183685, 50.54256426943264}, {21.416977243522716, 52.431156631611515}, {23.461271858970953, 53.23113862203766}, {19.507125805919756, 52.54462048739449}, {20.80500549137646, 50.617666808285435}, {23.660509878298495, 53.89773022016287}, {21.325768717971716, 51.866767537518776}, {22.033262527942625, 53.203131907511505}, {19.319096634618134, 53.393972183794105}, {21.704996518611853, 50.37890300088785}, {20.37104344340423, 53.36892077774811}, {22.60904207447613, 52.78313681067957}, {22.57149400042017, 51.12528810522108}, {20.62937604454714, 52.288387637107235}, {21.3854558793003, 52.587576244901}, {21.151363873782273, 52.875792227812916}, {21.39477668123177, 51.29640463716763}, {21.744720674599463, 52.70236534383238}, {20.720590482493805, 54.06006231984681}, {22.633385486301425, 53.54976143879073}, {22.342867581428795, 52.70218874626076}, {22.841550485337546, 50.90344709812534}, {20.388718460892136, 51.89184730540601}, {21.951623530777955, 54.22201103381687}, {22.10863535399824, 51.28092334169669}, {23.035398675020108, 51.99721197582774}, {21.935580423477965, 51.36543832005271}, {20.801541736637695, 52.34130758860892}, {21.532847621822924, 51.669850093424365}, {21.958745220881745, 52.52324350066932}, {19.8486900970781, 52.179838231266345}, {22.122943798099893, 52.81189900072764}, {20.731063303833075, 51.98734296621841}, {23.081209067517335, 52.44803318547649}, {20.785475919200515, 52.49967897499019}, {21.85325924062432, 52.2863486896727}, {19.9760980410449, 52.00022374549723}, {19.975265969025223, 53.47640930229858}, {20.7080633082083, 52.559111976449074}, {20.343397396377295, 51.46947489035328}, {21.381318192629426, 51.91699043305099}, {22.6124195926083, 52.5384898820617}, {21.724975468034437, 52.46595859930243}, {19.82001705109799, 51.568773703054454}, {20.507691152974274, 51.89962503944722}, {22.441441410494615, 52.00609311722867}, {19.88347220344555, 53.29599534616903}, {20.909594394408607, 51.65166355161018}, {20.214839753630105, 53.9155785517415}, {20.395059341757126, 53.34170354142269}, {21.86101653471774, 52.25815695576505}, {20.425980024771242, 54.31070078235195}, {19.523974694622773, 51.4402534519051}, {20.882179421944727, 52.403557565669644}, {20.58581631193776, 52.994046194653784}, {20.133973200062663, 52.762245741612595}, {22.731567383896582, 50.72588445039034}, {20.179793553320245, 51.73619884699881}, {24.379751230929983, 52.59332014656982}, {21.2154683843301, 53.0963232605119}, {19.535806846299895, 52.727059292983824}, {19.627388765264314, 51.771778297304266}, {20.455918702229198, 51.24175131539655}, {21.56235737093628, 51.30802671734661}, {23.345758564590284, 52.46727748149926}, {21.566620976689244, 51.364111026641126}, {21.098286638222504, 52.9691427501428}, {21.805613365810878, 53.09458073146089}, {19.985123635680054, 53.92922451867928}, {18.935365390077113, 53.11375673593288}, {20.348685997650406, 51.70857685611227}, {22.172598002829826, 50.38835029222616}, {22.68898878701173, 53.48848234778054}, {21.335981853619064, 52.81423507948116}, {20.249596474768357, 52.040650259137365}, {21.462096606067547, 52.445964285283736}, {22.040828750654768, 52.41124311581575}, {21.545145440038358, 50.3459274702171}, {19.587485187529243, 50.83259736170174}, {21.442934282551786, 52.33283101196104}, {20.845845908455047, 51.71996647672414}, {20.488639631243053, 54.42312349454205}, {20.152642417748954, 52.9736561669568}, {19.857876155297657, 51.938756777608624}, {19.79794644028418, 54.046582861050005}, {19.62378096094045, 52.773701654521375}, {20.677536438187868, 51.01747535290204}, {21.56116190506046, 51.94516879842946}, {20.570780077331378, 51.53835466749167}, {21.294780125616075, 53.59804762052611}, {20.884592145795935, 52.18519801234685}, {18.91952954865139, 54.07941678264966}, {22.434989469479092, 51.9572856562181}, {21.028343503506953, 52.03868648400893}, {20.749143948069584, 52.36204830256616}, {20.268843784164364, 52.96680534183335}, {20.028945039852417, 52.00146724632172}, {20.62267971315964, 52.37564305723187}, {19.426982003013237, 52.551384072842644}, {21.88218249835863, 52.82654889470096}, {21.162816893596435, 51.14628054725395}, {23.106812707398873, 50.451371758634885}, {21.414288052046444, 51.4344925160973}, {21.277910099674507, 54.04433727300632}, {20.806934875529933, 53.13881976151669}, {22.376947944210286, 51.81142642952358}, {21.861981544962905, 52.670388416965814}, {20.723222220294137, 52.48472667129154}, {21.82837111516286, 53.08032395216355}, {21.024788117444537, 53.94466281133801}, {20.31586667865364, 51.930851790897584}, {21.96425913429204, 51.33580772398504}, {21.266974166712227, 52.16997166608996}, {21.438989394065395, 51.8114808419736}, {19.92874438249811, 51.61610050494004}, {21.740052187514163, 51.0838331725793}, {20.400452048993635, 51.43972461906266}, {20.520717568964272, 53.03002136369959}, {22.060828110337585, 52.405193049647906}, {19.667562911438964, 52.57845929290729}, {20.137451978941517, 53.024134250755104}, {21.483391674025896, 52.56267826611768}, {20.722718507791903, 52.18649311881544}, {20.78347122611942, 52.10457772572456}, {21.282453988029772, 53.50355188478419}, {20.00694128201255, 50.31855123646174}, {21.205615866850557, 49.93896517856848}, {20.810961071752846, 53.26726326980094}, {21.883825834930576, 52.74028736702855}, {22.630869142987603, 53.67871717158523}, {22.00269110732287, 51.13296426906075}, {21.43219098466609, 54.189013749339644}, {21.532672608002564, 52.10007597359835}, {20.153682957685994, 51.21641630246541}, {21.22978758521771, 53.728681271245584}, {20.715303019352802, 52.07461241668436}, {21.016867476073916, 51.97156235091413}, {20.277683864084043, 52.63738204294745}, {20.97747364643597, 52.92489628930517}, {21.59249293805905, 53.01587271478174}, {19.7226466701207, 51.16693178668815}, {20.8258032704517, 50.90711409002434}, {20.324277864642813, 52.929062190235236}, {20.916321707143982, 52.70582292516546}, {20.642333079754025, 51.34852486374882}, {19.796469576631168, 51.75597945373073}, {21.119245410403312, 53.28055725201277}, {22.393963383201164, 53.23092867833798}, {21.728262823587738, 51.41043424952445}, {20.498695982059818, 52.60001277120438}, {20.83683775080981, 51.22552705906372}, {20.70694195448052, 52.116710494424545}, {20.624103790595637, 52.9756071815452}, {20.064306328952814, 52.77246660727553}, {20.407818060696126, 53.26567873339487}, {19.979394309853653, 52.158933801997335}, {20.755887782420125, 52.2678188126076}, {21.1285165828335, 53.41358470271746}, {19.686885520090907, 53.01926349388742}, {21.80100126105133, 53.74280673697264}, {22.580436293802748, 50.8552636518289}, {20.106249705638117, 52.37381848534981}, {21.417888857231723, 51.791273545491755}, {22.768828981317043, 53.85263281655683}, {22.06551969724265, 52.221822785545136}, {19.599582493645364, 52.07348660075523}, {20.576866121259485, 52.498786512887}, {18.108778726428987, 53.2629869807229}, {21.11016206905714, 52.33144568512114}, {21.620877044274142, 51.19211950225337}, {19.845516085472195, 51.804972791231215}, {21.521348015965454, 53.28132999019165}, {20.641013368754955, 53.77159614140184}, {21.814562611294594, 51.5367776083431}, {20.381407255344605, 53.25670058062665}, {22.580984890813482, 51.294555092197164}, {20.547663816852285, 51.21581883056586}, {20.073968022170217, 50.811512603406456}, {21.680648095192936, 51.47656366224643}, {20.93679255182166, 50.891935996701044}, {21.789294423538262, 53.36041653136042}, {21.7359898745845, 52.477117367554825}, {21.31451066779306, 52.18806252399334}, {20.144250393014005, 52.08970916636099}, {20.73637203715546, 51.622520531343355}, {21.28706285809897, 50.62908229224265}, {19.95498714188345, 50.41873899627113}, {19.016172868461307, 51.87837697919165}, {21.532078503983595, 53.39468803806119}, {21.074506019368414, 53.69071359311151}, {20.8132341053094, 51.9379638658373}, {20.853122274436537, 51.91613689547279}, {23.18763069648946, 50.283458479070376}, {19.501659665418934, 53.08452499828665}, {21.736195979046478, 52.139512128974125}, {19.688807179553347, 52.171207998621234}, {21.43445209073824, 51.86289210423149}, {23.415022083420084, 51.79381368144682}, {19.790882502583543, 54.6901836230897}, {20.38691303561918, 51.815002846753394}, {21.270884089481832, 51.93510332943101}, {21.92025398065316, 50.143475901322766}, {20.22717039042714, 53.870702887023775}, {20.743629910374214, 53.251100876526195}, {22.946306368490962, 52.18955659280699}, {19.783188327008624, 52.10086782350348}, {20.23394520318503, 52.173771438557615}, {20.66853855605927, 53.873933697092774}, {21.396719748844806, 53.655771240279684}, {20.23946298258878, 54.84423130921843}, {21.21491612277367, 51.79777329084864}, {19.865473373560867, 51.877907364953735}, {23.245851921057934, 52.619035731113904}, {20.61803260245053, 52.5252005291836}, {20.05527961490231, 53.357156872013505}, {20.78467217196972, 52.56802815993938}, {20.03690064723243, 52.248429739297976}, {21.330034161559784, 52.36243751424772}, {19.14638003119428, 52.429494562366564}, {19.967307645787365, 53.20580099518827}, {19.65364095998201, 51.884062745836054}, {20.08231127215747, 50.526478111898655}, {20.020592165959684, 50.436605568403344}, {20.95017470282878, 49.65239835302339}, {20.7327105303656, 53.551884506832714}, {20.354187558756674, 52.20589733287821}, {19.445319836646373, 53.6413667510455}, {20.739902369023955, 52.12301030219471}, {20.932081335933503, 52.75924856653073}, {22.136951344333117, 52.666615060539186}, {20.636841477975036, 53.86284277570865}, {20.776923306202107, 51.149653792395625}, {19.59006946443939, 52.81461845752546}, {23.052481468135696, 51.60605043400325}, {23.60582567095431, 52.101968006583625}, {19.839591341105457, 53.32067246343468}, {21.088085378756993, 53.36364165988912}, {20.02037199331395, 52.48731923861681}, {21.129628095590032, 51.895228548882606}, {20.51759488057169, 51.7564922259803}, {20.141934959831307, 51.828043962693066}, {22.1460917615114, 51.63569220585933}, {21.713284399748535, 50.53572671780729}, {19.9417728683717, 53.29730142760982}, {21.793793805253006, 52.41118996484389}, {21.0916203901563, 52.253681704260245}, {20.62123808551362, 53.02955417364217}, {20.83390532192448, 51.763434015977815}, {22.486106826365297, 53.53743421197624}, {22.41200789029588, 52.01244144166175}, {21.279587172879292, 51.86146292929641}, {19.824407957042155, 53.92314635734887}, {21.559972405564892, 55.648811771990374}, {21.080962724017496, 52.30338845343563}, {20.38140288629237, 50.44761975686538}, {19.893104264522908, 52.113914660200564}, {21.631422757529126, 52.054993063380465}, {21.691891456599027, 52.838991851427046}, {23.225719945588867, 52.79214136577134}, {20.68792598988617, 50.605467014238414}, {20.529700203929572, 53.22490361331266}, {21.190785599809484, 51.574141444143706}, {21.274538270400814, 52.841153944292095}, {20.961146287246937, 53.27910920243964}, {20.63632865239726, 52.245744309144804}, {20.3599923099004, 52.46610300862491}, {21.81241671409612, 51.55103502330813}, {21.51764294308682, 53.12088977418251}, {20.86848699822209, 52.95083244757546}, {20.512311817287042, 54.03213317794736}, {21.089354304760345, 53.796976900763624}, {21.773797292229272, 49.97843722327811}, {21.51334633023574, 52.80001554890819}, {22.476209453748485, 52.276407537879656}, {22.023579516205757, 52.899548065610496}, {20.043749186697635, 53.032889613645}, {20.404555572171375, 53.42437622523692}, {20.62304912446739, 53.31949741249767}, {20.875443546522927, 50.8304987609578}, {21.21451740219564, 51.451702322615375}, {21.521149811843557, 50.373251059412645}, {21.72230482081933, 52.677639417655996}, {21.62261826617553, 51.53072800207469}, {21.099993251760456, 52.75801706638964}, {21.86116526520827, 52.01856224099725}, {20.722975433441963, 53.632482201929626}, {21.862059550870185, 51.02034692860625}, {21.135429803074725, 52.178744140731155}, {22.317394759545042, 51.978458958010584}, {20.958482407404336, 52.1543825464179}, {22.184978120478007, 51.445734832886664}, {22.139104643794933, 52.38372443302476}, {21.314920985667186, 53.70705000069753}, {19.33425524889319, 51.51269442023516}, {22.68199026445724, 51.237524038530374}, {19.621385254315218, 50.99481301546524}, {20.502899143048577, 51.13982429302872}, {22.915918365868023, 53.59086932396873}, {20.8131879381252, 51.06127677568199}, {20.397345524095396, 51.88326925943773}, {21.5608858224813, 52.93898415533151}, {20.402342663706214, 50.7703865764645}, {20.27522700139057, 53.39014101412205}, {22.196195664173175, 51.262939274720075}, {19.110910627156674, 52.238197304889255}, {21.081261384213892, 52.72211821112687}, {21.757531861655995, 50.653201275309264}, {20.933303038708026, 52.23299191390653}, {21.033469198300963, 51.90978630351996}, {19.789534591314347, 51.843295315049474}, {20.29396733764606, 52.79509825389294}, {19.98291469286166, 53.975913685505446}, {21.085782774519096, 51.74224783877634}, {20.954207625346992, 52.23243393224756}, {19.607915616704222, 53.3183770860751}, {19.967013848986475, 52.506790824220474}, {20.639731998173996, 52.70844102097807}, {21.218020885974052, 52.225826627760405}, {22.95906318713171, 51.17155351511934}, {21.142620558753027, 52.7051936154603}, {21.473861324258205, 52.639463280805515}, {21.572799489155443, 52.93681206348943}, {21.16650660922461, 52.44925477006038}, {21.95030807418487, 50.650890547764355}, {21.168422981322493, 51.592962576887764}, {20.119214382141198, 51.90090840641725}, {22.419126182471366, 53.16909113425161}, {21.92387918464839, 49.258282807781065}, {22.031929816124357, 53.31618873975037}, {24.629586457546292, 52.32116809211481}, {22.16722454857035, 52.55228008104456}, {21.99842737291366, 51.15438133059897}, {21.086132801559632, 52.45270558053505}, {20.492822604230984, 51.01478187684154}, {21.711526679446973, 50.98382513057278}, {20.512231478669353, 52.90786759571919}, {18.59983564655556, 51.818191694983426}, {19.793096044245654, 51.27395837481388}, {21.055864971991458, 52.73788759710226}, {22.31688876681099, 54.10070649434941}, {20.175374300814912, 53.24060426828449}, {20.60889834470834, 51.40955897329189}, {19.875059801134324, 52.95386508576085}, {21.423975222013997, 50.10951929957994}, {22.522408883865033, 52.17087274290394}, {21.209152117077966, 50.84797363595848}, {19.675488456587615, 51.30149097675684}, {22.37490445158303, 51.7066779424473}, {21.366265483227227, 53.752144210182415}, {20.202832418449265, 50.47645038093761}, {21.572583483093897, 53.37530865072868}, {22.29966066587263, 51.488601428805424}, {21.539201301770017, 51.0741002285341}, {21.00470652607183, 52.47726612946636}, {22.448433599894358, 51.87789009251152}, {21.465658512462237, 52.01263460923382}, {22.094597034396166, 52.61936519201689}, {20.90937088049621, 51.549980672846175}, {21.946339257333378, 52.184106110007036}, {21.173582024723064, 51.06626973464383}, {20.71525105058269, 52.50854373548727}, {19.338551629839873, 51.5731806047593}, {20.83089679440207, 53.5292818507059}, {20.1837735067601, 50.80172732561802}, {21.104296592518132, 52.4470488297641}, {22.04952885201231, 51.83258421800472}, {22.072635691199853, 53.20941126130651}, {21.966608454067746, 51.1744371423233}, {20.00461821296611, 51.48821244430573}, {21.594988604704344, 52.372843022593685}, {21.53242593161276, 53.53132252514133}, {21.539385488493856, 51.73626805991675}, {20.598334557490723, 51.23376301946744}, {20.174471218128208, 52.46272185507983}, {20.36953424613627, 51.55689937433104}, {22.527625073096612, 52.07809759953887}, {22.003400155736323, 50.04009717474402}, {20.419558534768285, 52.580497056659304}, {18.99956711892848, 52.48859157741903}, {22.92752933268112, 53.097874933580954}, {21.354772203688835, 52.19715472838252}, {21.96015593490295, 52.74162041745615}, {21.137892415320874, 53.04306629248426}, {22.430308269678626, 52.72218530542029}, {20.86577608124361, 52.36721966816469}, {19.863738234118838, 52.46009117873695}, {20.13938228459403, 53.1477700557756}, {22.63652060062017, 52.68650794588724}, {21.527559203286017, 51.49285133759504}, {21.42740355966695, 51.9631600908209}, {20.523919091407187, 52.57453891190023}, {21.517421542396704, 51.30183035141055}, {20.89886354563715, 52.284738503736016}, {20.970326812466954, 52.93689402962314}, {20.78358001218758, 51.898050928289535}, {18.498323610914067, 53.165947098020204}, {20.36313332896634, 53.10431177860202}, {22.603820329334017, 52.830938253112684}, {20.27147632608982, 52.175039957949146}, {20.44182140464104, 52.64201990532545}, {20.81107569869404, 51.55690977951604}, {20.749350956731885, 53.06551282840805}, {21.297148319983425, 51.6465805762889}, {21.224348839457722, 53.0895836836484}, {20.97498109746157, 51.28681278196793}, {21.878760670877647, 53.08580453051244}, {21.15034833849594, 53.294644995265294}, {21.39541168354553, 51.723197269105675}, {21.547253074670348, 51.94995078551778}, {19.73209313171619, 51.99420307640543}, {21.730541244017903, 55.081743816653656}, {20.250748334508152, 51.72861424126417}, {21.580862357326904, 53.149159408881324}, {20.874465768563855, 52.52599388112638}, {20.86010434510391, 52.76055539211825}, {21.44773343637635, 52.89342972945158}, {21.577094045541063, 51.39032127227044}, {22.283189746067368, 51.26860696305889}, {20.574462241257837, 52.989370661385706}, {20.279454749532498, 51.604731034401304}, {22.16313654713976, 51.27778328757043}, {22.30228810951036, 51.97064097523347}, {22.05046549770159, 51.82541386075188}, {22.194106165125632, 50.73184408467776}, {21.02885055169692, 50.69220950255406}, {21.657773773983646, 50.950577378354}, {19.99584284186728, 53.044104686281294}, {21.525402487605948, 52.98909353399567}, {22.410229595047504, 51.85811543021843}, {22.1453827401436, 51.09120954561597}, {20.86249314946941, 52.06801568064095}, {19.144755255269263, 52.93454425051526}, {20.98548965063334, 52.38915420984557}, {19.740218484589395, 51.002397179317306}, {21.372424349619862, 53.433055827777565}, {20.652517265356085, 51.29876940037946}, {20.735454858796604, 52.6706820493332}, {22.873777292453855, 50.76189492051434}, {19.577453081285697, 51.475839853782}, {22.451892263377438, 53.13949610503277}, {22.56397699594782, 52.61626517252292}, {20.73863198051183, 51.81440578079663}, {22.15540629311414, 50.39815533286338}, {21.566747321842403, 51.98543778862953}, {20.92603247219287, 52.59556237412259}, {19.92254328904985, 52.060629677828445}, {22.08146271808238, 50.88194897305977}, {21.24900850563583, 54.99171766588285}, {20.328086837851682, 53.57356271812811}, {18.88395455213697, 51.719523349046064}, {20.6119206932131, 54.08299219503166}, {19.98230643728074, 51.76248734177861}, {18.958837739465412, 51.425323163079845}, {20.488422821479755, 52.300811738771564}, {20.92860259471668, 53.25038651475531}, {19.93600827099305, 51.47465917406999}, {20.796570091242806, 52.88196983166353}, {21.82026807644492, 51.1071358345783}, {21.011076531630582, 52.237105901466634}, {21.780715023364984, 52.05646330391955}, {21.621692050659505, 51.362279554950625}, {20.955401016052644, 53.310914898836934}, {20.392376558758976, 54.06173698978987}, {21.888520779194373, 50.768451400695206}, {21.166298031328342, 51.957207442082556}, {21.52801902997761, 49.47824563897331}, {20.465771858642487, 50.43626309949403}, {19.15538403145589, 52.277291067657124}, {20.760490031623917, 53.26047029524859}, {21.191404850157628, 52.6074185678956}, {21.082916000805028, 51.189762893184174}, {20.69824675601608, 50.54742984752433}, {20.908694979508162, 52.173879957248054}, {19.16641808526605, 51.185642447637896}, {19.859372231181915, 52.162045494906465}, {21.817646417910378, 49.705975469344445}, {21.126438483894162, 51.53683429855504}, {21.094096987134613, 52.85087563811574}, {22.26054491810722, 52.08164012884037}, {21.99635789447522, 52.60290742737855}, {20.974195441429497, 51.43400269240721}, {20.590658302535413, 52.13118986125371}, {19.151558434159043, 53.88861075928876}, {19.979126460252328, 52.17941687401791}, {21.042020517203383, 51.667037942056616}, {20.273260669537578, 50.76656860782846}, {19.642359710098482, 52.453696996709105}, {21.142699404751728, 52.15157925709545}, {21.094216114642204, 53.48475948665576}, {19.86660998432754, 52.25499646759118}, {21.893675639862696, 51.00745138506701}, {22.35420925562982, 52.697258095695894}, {21.226105307512697, 50.65695422820205}, {21.7258538195185, 52.27176892601605}, {21.369146533721594, 52.49370727503247}, {21.44971913820043, 53.103099849590706}, {21.66868735454418, 50.47487746294676}, {22.09561555032625, 52.93600399580575}, {22.39120157530125, 52.50661158548765}, {19.905042749069352, 53.44262835561637}, {21.62814106560437, 51.79435361208422}, {21.902934219559572, 50.99889966532906}, {20.45287053625457, 52.7845429807044}, {22.76935024179904, 52.019981319061785}, {20.860681184593904, 53.1811046930604}, {19.966782851318587, 53.03549561494521}, {20.79831531498502, 53.24946672888196}, {22.509612286376306, 52.19925616072861}, {20.03180750640834, 52.01689611422992}, {19.747196415751148, 52.369808680878656}, {20.824291153788522, 51.70983964015575}, {19.42819517866918, 53.550982707281335}, {20.827423670705926, 54.20848549226807}, {20.128834584864105, 52.26866995585237}, {21.01685646550677, 51.897888866817475}, {22.513073947967044, 50.37513302633667}, {20.996791360340964, 54.086785763581226}, {19.599036249480065, 54.548377215658626}, {21.454980232583466, 52.78521435362253}, {21.643367781059368, 52.64467481913711}, {21.88255283641094, 53.87702104229394}, {21.085291136303685, 50.80680972297565}, {20.317595264750807, 51.18554478647344}, {20.545680323781504, 53.48754978141073}, {20.302568781959756, 53.51358196965659}, {21.170288190707552, 53.765882308954666}, {21.710576563309775, 51.12747900675723}, {20.317632358882552, 51.83354181733428}, {21.349352463988634, 52.29015579314286}, {21.967328124271226, 51.02395774378821}, {19.91838320717595, 51.91101394075475}, {20.783581939787318, 52.60166084902706}, {21.161033828830067, 52.49284458399319}, {21.12372089554499, 51.80852150760948}, {21.7545216859701, 51.8297295624415}, {23.533097783823422, 52.45378784416679}, {22.19116726660434, 52.357860109053945}, {21.09421688193717, 51.72962412388399}, {20.05889551876924, 53.391218217213634}, {20.713492886035084, 53.26963432745008}, {20.676488487227758, 51.80677767065046}, {19.24888134876546, 51.30027091528397}, {21.358406826027007, 51.843190648306475}, {21.686618345621564, 50.86921273961535}, {20.45369805437034, 52.18167432359481}, {20.73386918432956, 50.2852112535826}, {21.286116480936712, 51.86968144704586}, {20.33496622519947, 52.388794958901315}, {20.998961206131387, 50.80027242776057}, {22.217958565025423, 52.73340285688621}, {20.07910363738597, 51.71927505317561}, {19.988945077400064, 50.91735277300666}, {20.028806695864265, 53.00330820976047}, {21.149414978123968, 52.18159348304649}, {19.77393819777701, 52.28324640895018}, {21.799098180961703, 52.29934036682244}, {20.899151421730128, 50.87004885847669}, {20.584786790298995, 50.968015153172864}, {21.649096522320068, 51.852934543933266}, {20.680827988517276, 49.93921537407695}, {20.576604953271733, 50.555868011975555}, {20.95494300897659, 52.89871821709875}, {21.790269533632138, 50.835487450352716}, {19.636979965344448, 52.97899764642518}, {20.47721233875422, 52.69190432384498}, {19.87783574850027, 51.88652335098341}, {21.52097312876325, 52.84651227285959}, {22.32202141277642, 51.690283207499945}, {19.58439092710338, 51.475340549046514}, {20.177680222096857, 52.95169407233585}, {20.812266033496137, 55.002319450990235}, {20.17245129939911, 52.95409002818768}, {19.431002851361033, 51.27450642244309}, {20.828162813833085, 52.637112629046946}, {23.436238023303183, 52.29213380433553}, {19.4207295985666, 51.785138871212716}, {22.194595800877366, 54.59842962337488}, {20.828744238718418, 51.816415581200914}, {20.39903459589769, 54.465574359293036}, {21.597718840247587, 52.18184352372608}, {24.04068581208657, 51.951131952471194}, {21.448204407325317, 51.68702799801761}, {21.263526925106973, 54.80056865704964}, {21.702461532008254, 52.615154187513035}, {21.20361772757931, 52.97991853337123}, {20.809434057935956, 51.09031379157563}, {21.24900994319723, 53.35203522125331}, {19.999536585936696, 52.146835657998494}, {20.544613212255673, 51.43354302933719}, {20.645863040638105, 53.54033703257285}, {21.660277501340264, 53.112890049643724}, {20.07874695140965, 51.845051678627485}, {21.310574195502852, 50.75644499073189}, {20.776958353525043, 51.847324551611706}, {24.224131724766252, 52.996492494357256}, {20.78373034788288, 52.7605481261391}, {19.49762821534693, 52.728695595208066}, {19.793886631986922, 52.56083785045148}, {22.436050009464644, 52.6868055822371}, {20.003495341089625, 50.87600807323521}, {19.978086271912645, 53.044731155829375}, {21.478009566234416, 51.60787145090619}, {21.609256492087052, 54.05041962222231}, {22.230565927714892, 53.18092510681691}, {20.545161832944064, 52.27175959888898}, {19.789804192476158, 53.34358186674409}, {21.997288805087795, 51.35085695860257}, {22.488680304711927, 52.69462777814394}, {20.150330061067738, 53.90626577472741}, {20.75212854224494, 50.52389962300844}, {22.435224341084837, 52.28230730335691}, {22.03865262529372, 51.85100981331171}, {22.43422120977632, 54.35687565986935}, {20.25778090222013, 51.15123874872134}, {22.927037577198497, 50.53235392251621}, {19.877896952317943, 53.34200421691124}, {21.55214167941287, 50.43769805461494}, {19.554368882985997, 54.54162043132523}, {19.364558561512606, 51.27405754018532}, {20.75770810683446, 52.44852408188941}, {21.726921202621092, 53.072824131744134}, {22.27068501825943, 51.45652637410884}, {20.061061525674663, 54.30362000068474}, {22.433571081904134, 51.693937241649195}, {20.643774712925506, 52.716960605750806}, {21.67424219073253, 52.74743237920983}, {21.465166384539618, 53.999376113373316}, {20.158736289147804, 53.345037530050774}, {21.2313011364575, 52.208993067423464}, {19.931677109297702, 51.283867955299506}, {21.617966595527605, 51.61809581016764}, {19.050361796827847, 51.6512141813711}, {22.144082780533033, 52.35980427886385}, {19.460284688058277, 51.75591554727193}, {20.81607114111864, 53.35346490300273}, {22.721548708524814, 52.05827537825161}, {21.39371453081038, 51.971213785888246}, {22.696080701881435, 55.02692811064353}, {22.19481518037218, 51.27934850462075}, {21.60598366068417, 52.11051569796919}, {19.583048537815664, 52.50608885404017}, {18.983302397309238, 50.000716840450266}, {20.51670292981812, 51.95993296924752}, {21.77754433238611, 54.73074651474431}, {20.66592822113737, 51.416138164912454}, {20.808392189690753, 50.88358030681194}, {21.069026245339973, 52.52115026063997}, {20.902755912132378, 51.774346976980475}, {21.871375008596758, 51.38348473848001}, {22.86058439542399, 51.70888801888078}, {21.39029205762056, 49.79013092031055}, {20.616328004593125, 51.91752202632725}, {21.132368469477736, 53.514308522401414}, {20.607892561235687, 53.48461216613326}, {20.7304918058832, 50.81555431221176}, {22.283137685927468, 52.79457996253152}, {20.74603916257418, 50.956766899986526}, {19.25317531710951, 53.06656600399743}, {22.588807552152552, 51.59890825827793}, {19.645462346734163, 50.88089324898067}, {20.0662549151074, 52.402030158639896}, {22.16664470223904, 52.51156092458456}, {21.763445303396594, 52.09449677744532}, {22.49556100595351, 53.93976335271062}, {20.13728238811601, 52.470881334726066}, {21.342414848932954, 52.98584730706637}, {20.865579030923573, 52.644280502584344}, {20.793554516474646, 52.28913194437308}, {21.630272331517915, 52.149653254530165}, {22.103759542653933, 52.27175452326529}, {20.375777735298715, 52.75996870679491}, {21.977139385320832, 53.21586774289654}, {22.102077163927202, 52.108252775404694}, {20.453271676399048, 50.94809099616914}, {19.95885558641874, 51.414122455100326}, {19.35642745192651, 53.47823791699443}, {22.16775053185616, 52.70974793677432}, {20.91966295179522, 54.86970613457467}, {21.90561657731883, 51.519491714724026}, {20.929370276069417, 51.97867639654016}, {19.86944214936384, 51.257788191973916}, {20.897261744070192, 50.165389737816454}, {20.082064238855406, 50.24234918010531}, {20.010080871749373, 53.21752710841325}, {20.735277691978546, 49.93951516946891}, {22.059887395759986, 51.12133584867463}, {22.017656834219657, 51.866233267881256}, {21.301665324169942, 52.55106754750153}, {21.198929664727796, 51.92824472245219}, {20.50195282144883, 53.35079724342852}, {21.725690791128795, 50.83769578236863}, {22.309918237655857, 52.27037526221185}, {21.922557694854625, 52.77409354193672}, {20.204835664188295, 53.29964933613782}, {19.503134087887762, 55.23995984989528}, {21.07116105908213, 51.25990788568342}, {20.193225032341147, 51.166300190325046}, {21.294348738358597, 51.8837340609517}, {20.06454514870577, 52.77497508250212}, {22.54712173252218, 52.251164513451045}, {22.3640635493176, 52.34869129167824}, {20.672583406451693, 51.62049467781885}, {20.638336289134504, 54.094427141456876}, {22.281136170556533, 51.283323411130155}, {20.8981159346686, 52.606770366805364}, {21.42218736587425, 51.17953618177544}, {22.430843026553607, 51.00375232297453}, {21.929446587240108, 51.964855758301596}, {22.343675162520007, 53.122147043848386}, {20.68768620978268, 51.738867849554204}, {20.96305618160762, 52.24800090202843}, {21.59221574993159, 53.28667174980418}, {20.23020956266554, 51.71251708450279}, {21.256540734925174, 53.757708951919916}, {21.442781689246342, 50.78163288025708}, {21.30954626799685, 52.31319095195293}, {20.98848563902829, 52.79047426905373}, {20.980455849754545, 52.56662536478341}, {20.118025409382703, 54.875820810714174}, {20.937712928352937, 52.51545941313123}, {21.648716092175338, 51.04389515509734}, {20.84042076564778, 54.65782893955277}, {20.11931188495543, 51.66345494916299}, {21.051092432495903, 52.78857759821808}, {20.353682192247515, 52.121687309417425}, {18.608942820727833, 52.05479783649134}, {19.63046278858447, 51.24255137698561}, {21.845893895862247, 53.13864007466096}, {21.75578431121093, 51.68552494250662}, {20.386057823752328, 51.18636241755286}, {20.88025167912722, 52.96812423729202}, {20.70355798778732, 51.34478077250737}, {21.312631270095384, 51.25535246001847}, {21.50666371443591, 53.011017671521394}, {20.922205098217084, 51.82022982805795}, {21.091549329630002, 49.55818730202564}, {21.392072156859513, 49.70224952592228}, {19.195220849685324, 52.67018967796216}, {19.683786163680494, 50.469394576805875}, {21.248994950645887, 50.58293155204491}, {19.320899319563363, 51.67355752211609}, {20.889364802840866, 51.82955512310115}, {20.557267814023668, 52.04655384323937}, {21.405360989283672, 53.511428899400975}, {19.188112666806607, 52.33689055061459}, {19.67252112175345, 51.4885889186634}, {20.01620632294435, 50.12565751649147}, {21.954294408323197, 51.12902792579347}, {20.430396959920003, 52.97845813897236}, {21.44328185854883, 49.729188568577094}, {20.78333008827785, 50.874423435417235}, {20.463165958305634, 52.59842724921922}, {21.170329698696744, 54.40637754809664}, {21.253327852364542, 50.523661746231305}, {21.536281066804097, 53.49713598201792}, {21.749969607963102, 51.865385402178326}, {21.38057107201566, 52.390851668495515}, {19.653612797835986, 53.28115496245963}, {22.032083331777624, 51.80244342038528}, {21.15925120170444, 51.633026603160175}, {21.122003977448852, 51.281132587397515}, {20.155870422322124, 53.08208778643718}, {23.50162552761291, 53.82851541004986}, {20.61016023787571, 53.994936341527165}, {20.456010307845276, 52.18722891214477}, {19.931141629613343, 52.57948403554865}, {20.95940740294942, 52.565907490605014}, {22.02727548073166, 51.95655164459025}, {21.779603722044545, 52.948551802025655}, {21.102006070839508, 51.44364239081649}, {20.449679881248176, 51.32497036911199}, {20.68460503921283, 51.08292802091087}, {19.71785311974177, 52.36902629296765}, {20.491645171791248, 51.92604081693008}, {20.66624875229827, 50.511217056948695}, {21.705483269494785, 52.16980212170059}, {20.268360879609272, 52.49733755080392}, {21.03886643998636, 50.862327383121524}, {20.56605067310664, 51.07358609586371}, {19.1842354157974, 51.522074368855094}, {21.883137536797175, 54.71754833616729}, {21.000701966455676, 54.85420273470377}, {20.677927188887676, 51.35194921773517}, {21.734931815972736, 52.673849592322576}, {20.417482933192197, 52.098646285054436}, {19.958842014384604, 52.94410083821608}, {19.87955637629227, 53.451718096799304}, {20.824912687479557, 53.26934583553677}, {21.272889365167217, 52.52660396329109}, {23.209659341773666, 51.75754465933359}, {21.384302216541816, 51.92411275536409}, {22.296755493805133, 52.37243847698051}, {21.63419011371904, 53.484204281814115}, {20.864339425108483, 52.27100960495584}, {19.4666905315489, 52.14921772581063}, {20.124481360080615, 53.637863299677846}, {22.12975285947716, 52.83541318711045}, {21.498218052452422, 53.67019389915553}, {20.19506871252667, 53.82022640823995}, {20.037506728751417, 51.94373187598097}, {22.137938060617422, 51.80687564681559}, {20.59606689021495, 51.9564438808364}, {20.132224689306966, 51.0888097766762}, {19.898257083445444, 49.467559160602946}};
private HexbinLayer<Coordinate> hexbinLayer;
/**
* The GWT application entry point method
*/
@Override
public void onModuleLoad() {
// please note that leaflet.js and leaflet.css are already included from index.html
LeafletD3.init(() -> {
createAndAttachMap();
log.info("The map attached.");
attachRandomizerButton();
});
}
private void createAndAttachMap() {
MapOptions mapOptions = new MapOptions.Builder(
L.latLng(CENTER_LATITUDE, CENTER_LONGITUDE), 6.0, 5.0).dragging(true).build();
final com.gwidgets.api.leaflet.Map map = L.map(MAP_HTML_ID, mapOptions);
TileLayerOptions tileLayerOptions =
new TileLayerOptions.Builder().minZoom(3).maxZoom(8).attribution(ATTRIBUTION).build();
L.tileLayer(MAP_URL, tileLayerOptions).addTo(map);
hexbinLayer = new HexbinLayer<>(
HexbinLayer.Config.create()
.withDuration(500d).withOpacity(0.5).withRadius(12d).build());
hexbinLayer
// .withRadiusRange(new Integer[]{6, 11})
.withColorRange(new String[]{"white", "orange", "red"})
.withColorValue(value -> value.length)
.withRadiusValue(value -> value.length)
.withLng(value -> value.longitude)
.withLat(value -> value.latitude)
.withData(toTypedCoordinates(EXAMPLE_DATA)); // a data have to be set as the last
hexbinLayer.addTo(map);
}
private void attachRandomizerButton() {
HTMLButtonElement buttonElement = (HTMLButtonElement) document.getElementById(BUTTON_HTML_ID);
buttonElement.addEventListener("click", evt -> generateTestData());
}
/**
* Convert stream of values into a type safe one.
*
* @param coordinates simple array with coordinates
* @return type safe coordinates
*/
private Coordinate[] toTypedCoordinates(double[][] coordinates) {
/*
* Please note that the library supports just a simple array.
* This method demonstrates a possibility of using a typed data
* (as you may have more than two values for a data item,
* eg. latitude, longitude, amplitude, eventDate and so on).
* If you prefer a simple array, just initialize HexbinLayer via generics properly, e.g.:
* HexbinLayer<double[][]> hexbinLayer = new HexbinLayer<>();
*/
return Arrays.stream(coordinates)
.map(doubles -> new Coordinate(doubles[0], doubles[1]))
.toArray(Coordinate[]::new);
}
private void generateTestData() {
// this is a simple demo, in real life project, the DataGenerator would be injected
double[][] coordinates = DataGenerator.generateCoordinates(CENTER_LATITUDE, CENTER_LONGITUDE);
hexbinLayer.setData(toTypedCoordinates(coordinates));
}
@JsType
private static class Coordinate {
@JsProperty
double latitude;
@JsProperty
double longitude;
Coordinate(double longitude, double latitude) {
this.latitude = latitude;
this.longitude = longitude;
}
}
}