comparison d3s_examples/python-neo4jrestclient/static/platin/js/Map/MapConfig.js @ 8:18ef6948d689

new d3s examples
author Dirk Wintergruen <dwinter@mpiwg-berlin.mpg.de>
date Thu, 01 Oct 2015 17:17:27 +0200
parents
children
comparison
equal deleted inserted replaced
7:45dad9e38c82 8:18ef6948d689
1 /*
2 * MapConfig.js
3 *
4 * Copyright (c) 2012, Stefan Jänicke. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301 USA
20 */
21
22 /**
23 * @class MapConfig
24 * Map Configuration File
25 * @author Stefan Jänicke (stjaenicke@informatik.uni-leipzig.de)
26 * @release 1.0
27 * @release date: 2012-07-27
28 * @version date: 2012-07-27
29 */
30 function MapConfig(options) {
31
32 this.options = {
33 mapWidth : false, // false or desired width css definition for the map
34 mapHeight : '580px', // false or desired height css definition for the map
35 mapTitle : 'GeoTemCo Map View', // title will be shown in map header
36 mapIndex : 0, // index = position in location array; for multiple locations the 2nd map refers to index 1
37 alternativeMap : [
38 {
39 name: 'Barrington Roman Empire',
40 url: 'http://pelagios.dme.ait.ac.at/tilesets/imperium/${z}/${x}/${y}.png',
41 type:'XYZ',
42 attribution: "(c) Barrington Roman Empiry, <a href='http://pelagios.dme.ait.ac.at/maps/greco-roman/'>Pelagios</a>"
43 },
44 {
45 name: 'Maps-for-Free Relief Map',
46 url: 'http://maps-for-free.com/layer/relief/z${z}/row${y}/${z}_${x}-${y}.jpg',
47 type:'XYZ',
48 attribution: "(c) <a href='http://www.maps-for-free.com/html/about.html'>Maps for Free</a>"
49 },
50 {
51 name: 'Contemporary Map (2010)',
52 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
53 layer: 'historic:cntry2010',
54 attribution: "(c) <a href='http://epp.eurostat.ec.europa.eu/portal/page/portal/gisco_Geographical_information_maps/popups/references/administrative_units_statistical_units_1'>EuroStat</a>"
55 },
56 {
57 name: 'Historical Map of 2006',
58 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
59 layer: 'historic:cntry2006',
60 attribution: "(c) <a href='http://epp.eurostat.ec.europa.eu/portal/page/portal/gisco_Geographical_information_maps/popups/references/administrative_units_statistical_units_1'>EuroStat</a>"
61 },
62 {
63 name: 'Historical Map of 1994',
64 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
65 layer: 'historic:cntry1994',
66 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
67 },
68 {
69 name: 'Historical Map of 1945',
70 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
71 layer: 'historic:cntry1945',
72 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
73 },
74 {
75 name: 'Historical Map of 1938',
76 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
77 layer: 'historic:cntry1938',
78 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
79 },
80 {
81 name: 'Historical Map of 1920',
82 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
83 layer: 'historic:cntry1920',
84 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
85 },
86 {
87 name: 'Historical Map of 1914',
88 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
89 layer: 'historic:cntry1914',
90 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
91 },
92 {
93 name: 'Historical Map of 1880',
94 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
95 layer: 'historic:cntry1880',
96 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
97 },
98 {
99 name: 'Historical Map of 1815',
100 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
101 layer: 'historic:cntry1815',
102 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
103 },
104 {
105 name: 'Historical Map of 1783',
106 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
107 layer: 'historic:cntry1783',
108 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
109 },
110 {
111 name: 'Historical Map of 1715',
112 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
113 layer: 'historic:cntry1715',
114 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
115 },
116 {
117 name: 'Historical Map of 1650',
118 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
119 layer: 'historic:cntry1650',
120 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
121 },
122 {
123 name: 'Historical Map of 1530',
124 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
125 layer: 'historic:cntry1530',
126 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
127 },
128 {
129 name: 'Historical Map of 1492',
130 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
131 layer: 'historic:cntry1492',
132 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
133 },
134 {
135 name: 'Historical Map of 1279',
136 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
137 layer: 'historic:cntry1279',
138 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
139 },
140 {
141 name: 'Historical Map of 1000',
142 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
143 layer: 'historic:cntry1000',
144 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
145 },
146 {
147 name: 'Historical Map of 800',
148 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
149 layer: 'historic:cntry800',
150 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
151 },
152 {
153 name: 'Historical Map of 600',
154 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
155 layer: 'historic:cntry600',
156 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
157 },
158 {
159 name: 'Historical Map of 400',
160 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
161 layer: 'historic:cntry400',
162 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
163 },
164 {
165 name: 'Historical Map of 1 BC',
166 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
167 layer: 'historic:cntry1bc',
168 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
169 },
170 {
171 name: 'Historical Map of 200 BC',
172 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
173 layer: 'historic:cntry200bc',
174 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
175 },
176 {
177 name: 'Historical Map of 323 BC',
178 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
179 layer: 'historic:cntry323bc',
180 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
181 },
182 {
183 name: 'Historical Map of 500 BC',
184 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
185 layer: 'historic:cntry500bc',
186 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
187 },
188 {
189 name: 'Historical Map of 1000 BC',
190 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
191 layer: 'historic:cntry1000bc',
192 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
193 },
194 {
195 name: 'Historical Map of 2000 BC',
196 url: 'http://geoserver.mpiwg-berlin.mpg.de/geoserver/mpiwg/wms',
197 layer: 'historic:cntry2000bc',
198 attribution: "(c) <a href='http://webcache.googleusercontent.com/search?q=cache:NbaEeiehhzQJ:library.thinkquest.org/C006628/citations.html&client=ubuntu&hl=de&gl=de&strip=1'> ThinkQuest Team C006628</a>"
199 },
200 ],
201 legend : true, // if a legend at the bottom of the map should be shown or not
202 mapMerge : false, // if the elements of distinct datasets should be merged into one set or not
203 useGraphics : false, // if different graphics should represent different datasets or not
204 graphics : [
205 {
206 shape: "circle",
207 rotation: 0
208 },
209 {
210 shape: "square",
211 rotation: 0
212 },
213 {
214 shape: "triangle",
215 rotation: 0
216 },
217 {
218 shape: "square",
219 rotation: 45
220 }
221 ],
222 googleMaps : false, // enable/disable Google maps (actually, no Google Maps API key is required)
223 bingMaps : false, // enable/disable Bing maps (you need to set the Bing Maps API key below)
224 bingApiKey : 'none', // bing maps api key, see informations at http://bingmapsportal.com/
225 osmMaps : true, // enable/disable OSM maps
226 osmMapsMapQuest : true, // enable/disable OSM maps with MapQuest tiles
227 baseLayer : 'Open Street Map', // initial layer to show (e.g. 'Google Streets')
228 resetMap : true, // show/hide map reset button
229 countrySelect : true, // show/hide map country selection control button
230 polygonSelect : true, // show/hide map polygon selection control button
231 circleSelect : true, // show/hide map circle selection control button
232 squareSelect : true, // show/hide map square selection control button
233 multiSelection : true, // true, if multiple polygons or multiple circles should be selectable
234 popups : true, // enabled popups will show popup windows for circles on the map
235 olNavigation : false, // show/hide OpenLayers navigation panel
236 olLayerSwitcher : false, // show/hide OpenLayers layer switcher
237 olMapOverview : false, // show/hide OpenLayers map overview
238 olKeyboardDefaults : true, // (de)activate Openlayers keyboard defaults
239 olScaleLine : false, // (de)activate Openlayers keyboard defaults
240 geoLocation : true, // show/hide GeoLocation feature
241 boundaries : {
242 minLon : -29,
243 minLat : 35,
244 maxLon : 44,
245 maxLat : 67
246 }, // initial map boundaries or 'false' for no boundaries
247 mapBackground : '#bbd0ed',
248 labelGrid : true, // show label grid on hover
249 maxPlaceLabels : 6, // Integer value for fixed number of place labels: 0 --> unlimited, 1 --> 1 label (won't be shown in popup, 2 --> is not possible because of others & all labels --> 3 labels, [3,...,N] --> [3,...,N] place labels)
250 selectDefault : true, // true, if strongest label should be selected as default
251 maxLabelIncrease : 2, // maximum increase (in em) for the font size of a label
252 labelHover : false, // true, to update on label hover
253 ieHighlightLabel : "color: COLOR1; background-color: COLOR0; filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)';-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)';", // css code for a highlighted place label in IE
254 highlightLabel : "color: COLOR0; text-shadow: 0 0 0.4em black, 0 0 0.4em black, 0 0 0.4em black, 0 0 0.4em COLOR0;", // css code for a highlighted place label
255 ieSelectedLabel : "color: COLOR1; font-weight: bold;", // css code for a selected place label in IE
256 selectedLabel : "color: COLOR1; font-weight: bold;", // css code for a selected place label
257 ieUnselectedLabel : "color: COLOR1; font-weight: normal;", // css code for an unselected place label in IE
258 unselectedLabel : "color: COLOR1; font-weight: normal;", // css code for an unselected place label
259 ieHoveredLabel : "color: COLOR1; font-weight: bold;", // css code for a hovered place label in IE
260 hoveredLabel : "color: COLOR1; font-weight: bold;", // css code for a hovered place label
261 circleGap : 0, // gap between the circles on the map (>=0)
262 circleOverlap : {
263 type: 'area', // 'area' or 'diameter' is possible
264 overlap: 0 // the percentage of allowed overlap (0<=overlap<=1)
265 }, // maximum allowed overlap in percent (if circleGap = 0, circleOverlap will be used)
266 minimumRadius : 4, // minimum radius of a circle with mimimal weight (>0)
267 circleOutline : 2, // false for no outline or a pixel value v with 0 < v
268 circleOpacity : 'balloon', // 'balloon' for dynamic opacity of the circles or a value t with 0 <= t <= 1
269 minTransparency : 0.55, // maximum transparency of a circle
270 maxTransparency : 0.8, // minimum transparency of a circle
271 binning : 'generic', // binning algorithm for the map, possible values are: 'generic', 'square', 'hexagonal', 'triangular' or false for 'no binning'
272 noBinningRadii : 'dynamic', // for 'no binning': 'static' for only minimum radii, 'dynamic' for increasing radii for increasing weights
273 circlePackings : true, // if circles of multiple result sets should be displayed in circle packs, if a binning is performed
274 binCount : 10, // number of bins for x and y dimension for lowest zoom level
275 showDescriptions : true, // true to show descriptions of data items (must be provided by kml/json), false if not
276 mapSelection : true, // show/hide select map dropdown
277 binningSelection : false, // show/hide binning algorithms dropdown
278 mapSelectionTools : true, // show/hide map selector tools
279 dataInformation : true, // show/hide data information
280 overlayVisibility : false, // initial visibility of additional overlays
281 //proxyHost : 'php/proxy.php?address=', //required for selectCountry feature, if the requested GeoServer and GeoTemCo are NOT on the same server
282 placenameTagsStyle : 'value', // the style of the placenames "surrounding" a circle on hover. 'zoom' for tags based on zoom level (old behaviour), 'value' for new value-based
283 hideUnselected : false //hide unselected circles (features) on highlight/selection
284
285 };
286 if ( typeof options != 'undefined') {
287 $.extend(this.options, options);
288 }
289
290 //if the user can change shape/color graphics have to be used
291 //but this will use circles as default shape
292 if (GeoTemConfig.allowUserShapeAndColorChange){
293 this.options.useGraphics = true;
294 }
295
296 };
297
298 MapConfig.prototype.getGraphic = function(id){
299 var dataset = GeoTemConfig.datasets[id];
300
301 var graphic;
302 if (typeof dataset.graphic !== "undefined"){
303 graphic = dataset.graphic;
304 } else{
305 graphic = this.options.graphics[id % this.options.graphics.length];
306 }
307
308 var color;
309 if (typeof dataset.color !== "undefined"){
310 color = dataset.color;
311 } else{
312 color = GeoTemConfig.getColor(id);
313 }
314 return {
315 shape: graphic.shape,
316 rotation: graphic.rotation,
317 color: color
318 };
319 };