|
| 1 | +/** |
| 2 | +* Copyright 2012-2016, Plotly, Inc. |
| 3 | +* All rights reserved. |
| 4 | +* |
| 5 | +* This source code is licensed under the MIT license found in the |
| 6 | +* LICENSE file in the root directory of this source tree. |
| 7 | +*/ |
| 8 | + |
| 9 | + |
| 10 | +'use strict'; |
| 11 | + |
| 12 | +var params = module.exports = {}; |
| 13 | + |
| 14 | +// projection names to d3 function name |
| 15 | +params.projNames = { |
| 16 | + // d3.geo.projection |
| 17 | + 'equirectangular': 'equirectangular', |
| 18 | + 'mercator': 'mercator', |
| 19 | + 'orthographic': 'orthographic', |
| 20 | + 'natural earth': 'naturalEarth', |
| 21 | + 'kavrayskiy7': 'kavrayskiy7', |
| 22 | + 'miller': 'miller', |
| 23 | + 'robinson': 'robinson', |
| 24 | + 'eckert4': 'eckert4', |
| 25 | + 'azimuthal equal area': 'azimuthalEqualArea', |
| 26 | + 'azimuthal equidistant': 'azimuthalEquidistant', |
| 27 | + 'conic equal area': 'conicEqualArea', |
| 28 | + 'conic conformal': 'conicConformal', |
| 29 | + 'conic equidistant': 'conicEquidistant', |
| 30 | + 'gnomonic': 'gnomonic', |
| 31 | + 'stereographic': 'stereographic', |
| 32 | + 'mollweide': 'mollweide', |
| 33 | + 'hammer': 'hammer', |
| 34 | + 'transverse mercator': 'transverseMercator', |
| 35 | + 'albers usa': 'albersUsa', |
| 36 | + 'winkel tripel': 'winkel3' |
| 37 | +}; |
| 38 | + |
| 39 | +// name of the axes |
| 40 | +params.axesNames = ['lonaxis', 'lataxis']; |
| 41 | + |
| 42 | +// max longitudinal angular span (EXPERIMENTAL) |
| 43 | +params.lonaxisSpan = { |
| 44 | + 'orthographic': 180, |
| 45 | + 'azimuthal equal area': 360, |
| 46 | + 'azimuthal equidistant': 360, |
| 47 | + 'conic conformal': 180, |
| 48 | + 'gnomonic': 160, |
| 49 | + 'stereographic': 180, |
| 50 | + 'transverse mercator': 180, |
| 51 | + '*': 360 |
| 52 | +}; |
| 53 | + |
| 54 | +// max latitudinal angular span (EXPERIMENTAL) |
| 55 | +params.lataxisSpan = { |
| 56 | + 'conic conformal': 150, |
| 57 | + 'stereographic': 179.5, |
| 58 | + '*': 180 |
| 59 | +}; |
| 60 | + |
| 61 | +// defaults for each scope |
| 62 | +params.scopeDefaults = { |
| 63 | + world: { |
| 64 | + lonaxisRange: [-180, 180], |
| 65 | + lataxisRange: [-90, 90], |
| 66 | + projType: 'equirectangular', |
| 67 | + projRotate: [0, 0, 0] |
| 68 | + }, |
| 69 | + usa: { |
| 70 | + lonaxisRange: [-180, -50], |
| 71 | + lataxisRange: [15, 80], |
| 72 | + projType: 'albers usa' |
| 73 | + }, |
| 74 | + europe: { |
| 75 | + lonaxisRange: [-30, 60], |
| 76 | + lataxisRange: [30, 80], |
| 77 | + projType: 'conic conformal', |
| 78 | + projRotate: [15, 0, 0], |
| 79 | + projParallels: [0, 60] |
| 80 | + }, |
| 81 | + asia: { |
| 82 | + lonaxisRange: [22, 160], |
| 83 | + lataxisRange: [-15, 55], |
| 84 | + projType: 'mercator', |
| 85 | + projRotate: [0, 0, 0] |
| 86 | + }, |
| 87 | + africa: { |
| 88 | + lonaxisRange: [-30, 60], |
| 89 | + lataxisRange: [-40, 40], |
| 90 | + projType: 'mercator', |
| 91 | + projRotate: [0, 0, 0] |
| 92 | + }, |
| 93 | + 'north america': { |
| 94 | + lonaxisRange: [-180, -45], |
| 95 | + lataxisRange: [5, 85], |
| 96 | + projType: 'conic conformal', |
| 97 | + projRotate: [-100, 0, 0], |
| 98 | + projParallels: [29.5, 45.5] |
| 99 | + }, |
| 100 | + 'south america': { |
| 101 | + lonaxisRange: [-100, -30], |
| 102 | + lataxisRange: [-60, 15], |
| 103 | + projType: 'mercator', |
| 104 | + projRotate: [0, 0, 0] |
| 105 | + } |
| 106 | +}; |
| 107 | + |
| 108 | +// angular pad to avoid rounding error around clip angles |
| 109 | +params.clipPad = 1e-3; |
| 110 | + |
| 111 | +// map projection precision |
| 112 | +params.precision = 0.1; |
| 113 | + |
| 114 | +// default land and water fill colors |
| 115 | +params.landColor = '#F0DC82'; |
| 116 | +params.waterColor = '#3399FF'; |
| 117 | + |
| 118 | +// locationmode to layer name |
| 119 | +params.locationmodeToLayer = { |
| 120 | + 'ISO-3': 'countries', |
| 121 | + 'USA-states': 'subunits', |
| 122 | + 'country names': 'countries' |
| 123 | +}; |
| 124 | + |
| 125 | +// SVG element for a sphere (use to frame maps) |
| 126 | +params.sphereSVG = {type: 'Sphere'}; |
| 127 | + |
| 128 | +// N.B. base layer names must be the same as in the topojson files |
| 129 | + |
| 130 | +// base layer with a fill color |
| 131 | +params.fillLayers = ['ocean', 'land', 'lakes']; |
| 132 | + |
| 133 | +// base layer with a only a line color |
| 134 | +params.lineLayers = ['subunits', 'countries', 'coastlines', 'rivers', 'frame']; |
| 135 | + |
| 136 | +// all base layers - in order |
| 137 | +params.baseLayers = [ |
| 138 | + 'ocean', 'land', 'lakes', |
| 139 | + 'subunits', 'countries', 'coastlines', 'rivers', |
| 140 | + 'lataxis', 'lonaxis', |
| 141 | + 'frame' |
| 142 | +]; |
| 143 | + |
| 144 | +params.layerNameToAdjective = { |
| 145 | + ocean: 'ocean', |
| 146 | + land: 'land', |
| 147 | + lakes: 'lake', |
| 148 | + subunits: 'subunit', |
| 149 | + countries: 'country', |
| 150 | + coastlines: 'coastline', |
| 151 | + rivers: 'river', |
| 152 | + frame: 'frame' |
| 153 | +}; |
| 154 | + |
| 155 | +// base layers drawn over choropleth |
| 156 | +params.baseLayersOverChoropleth = ['rivers', 'lakes']; |
0 commit comments