vivo/productMods/js/visualization/mapofscience/CustomScimaps.js

62 lines
60 KiB
JavaScript
Raw Normal View History

/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var DISCIPLINES = {"11": {"color": "#61FFE0", "longitude": -74.53125, "label": "Chemical, Mechanical, & Civil Engineering", "latitude": 57.80419}, "10": {"color": "#A61815", "longitude": -52.734375, "label": "Earth Sciences", "latitude": -19.797}, "13": {"color": "#FF82FF", "longitude": -144.140625, "label": "Electrical Engineering & Computer Science", "latitude": 75.89095}, "12": {"color": "#A518FB", "longitude": -129.375, "label": "Math & Physics", "latitude": 81.8504}, "1": {"color": "#FFB52A", "longitude": 76.641, "label": "Health Professionals", "latitude": 83.2171}, "3": {"color": "#FFFF00", "longitude": 164.53125, "label": "Social Sciences", "latitude": 61.69543}, "2": {"color": "#1800FF", "longitude": -45.7031, "label": "Chemistry", "latitude": 81.64863}, "5": {"color": "#FF0000", "longitude": 99.84375, "label": "Brain Research", "latitude": 68.7247}, "4": {"color": "#FFFF80", "longitude": 163.125, "label": "Humanities", "latitude": -14.42333}, "7": {"color": "#B8140B", "longitude": 47.109375, "label": "Infectious Diseases", "latitude": 55.8819}, "6": {"color": "#FF7D47", "longitude": 44.296875, "label": "Medical Specialties", "latitude": 71.36081}, "9": {"color": "#349803", "longitude": -19.6875, "label": "Biology", "latitude": 1.593542}, "8": {"color": "#00FF80", "longitude": 0.0, "label": "Biotechnology", "latitude": 48.58235}};
var SUBDISCIPLINES = {"344": {"latitude": 75.320025, "discipline": "11", "longitude": -92.109375, "label": "Printing"}, "345": {"latitude": 12.554564, "discipline": "9", "longitude": -16.875, "label": "Genetics"}, "346": {"latitude": 74.402163, "discipline": "11", "longitude": -94.21875, "label": "Industrial Chemistry"}, "347": {"latitude": 77.617709, "discipline": "6", "longitude": 56.25, "label": "Obesity"}, "340": {"latitude": 11.178402, "discipline": "9", "longitude": 8.4375, "label": "Parasitology"}, "341": {"latitude": 54.162434, "discipline": "6", "longitude": -1.40625, "label": "Dairy Science"}, "342": {"latitude": 42.55308, "discipline": "11", "longitude": -65.390625, "label": "Water Policy"}, "343": {"latitude": -7.013668, "discipline": "11", "longitude": -38.671875, "label": "Fish Research"}, "348": {"latitude": -21.943046, "discipline": "4", "longitude": 165.234375, "label": "Literary Criticism"}, "349": {"latitude": 31.952162, "discipline": "6", "longitude": 40.78125, "label": "Hepatology"}, "298": {"latitude": 84.865782, "discipline": "1", "longitude": 89.296875, "label": "AIDS Treatment"}, "299": {"latitude": 77.31252, "discipline": "13", "longitude": -140.625, "label": "Wireless Communication"}, "296": {"latitude": 67.609221, "discipline": "11", "longitude": -99.84375, "label": "Vehicle System Design"}, "297": {"latitude": 59.888937, "discipline": "7", "longitude": 35.859375, "label": "Transfusion"}, "294": {"latitude": 27.683528, "discipline": "9", "longitude": -21.09375, "label": "Crop Science"}, "295": {"latitude": 74.775843, "discipline": "13", "longitude": -148.359375, "label": "Fuzzy Sets"}, "292": {"latitude": 79.560546, "discipline": "6", "longitude": 74.53125, "label": "Hospice Care"}, "293": {"latitude": -2.811371, "discipline": "11", "longitude": -54.140625, "label": "Climatology"}, "290": {"latitude": 58.447733, "discipline": "3", "longitude": 157.5, "label": "Science Education"}, "291": {"latitude": 74.775843, "discipline": "12", "longitude": -156.09375, "label": "Design & Analysis of Algorithms"}, "199": {"latitude": 82.214217, "discipline": "2", "longitude": -68.203125, "label": "Catalysis"}, "198": {"latitude": 49.382373, "discipline": "3", "longitude": 168.046875, "label": "Political Geography"}, "195": {"latitude": 81.723188, "discipline": "2", "longitude": -23.203125, "label": "Atomic Spectrometry"}, "194": {"latitude": 80.647035, "discipline": "1", "longitude": 62.578125, "label": "Dental Research"}, "197": {"latitude": 84.865782, "discipline": "1", "longitude": 63.984375, "label": "Public Health Service"}, "196": {"latitude": 16.636192, "discipline": "9", "longitude": -22.5, "label": "Botany"}, "191": {"latitude": 80.872827, "discipline": "1", "longitude": 63.984375, "label": "Prosthetic Dentistry"}, "190": {"latitude": 57.704147, "discipline": "6", "longitude": 33.046875, "label": "Clinical Infectious Disease"}, "193": {"latitude": 74.959392, "discipline": "13", "longitude": -139.921875, "label": "Robotic Systems"}, "192": {"latitude": 79.812302, "discipline": "1", "longitude": 60.46875, "label": "Orthodontics"}, "270": {"latitude": 53.330873, "discipline": "3", "longitude": -179.296875, "label": "Agricultural Economics"}, "271": {"latitude": 65.366837, "discipline": "3", "longitude": 143.4375, "label": "Social Work"}, "272": {"latitude": 83.753911, "discipline": "1", "longitude": 80.15625, "label": "Medical Insurance"}, "273": {"latitude": 81.823794, "discipline": "11", "longitude": -76.640625, "label": "Fluid Phase Equilibrium"}, "274": {"latitude": 52.05249, "discipline": "8", "longitude": 7.734375, "label": "Biotechnology Trends"}, "275": {"latitude": -15.961329, "discipline": "11", "longitude": -58.359375, "label": "Air Quality"}, "276": {"latitude": 68.911005, "discipline": "13", "longitude": -168.046875, "label": "Search Engines; Web Crawling"}, "277": {"latitude": 82.214217, "discipline": "2", "longitude": -78.75, "label": "Colloid"}, "278": {"latitude": 76.351896, "discipline": "1", "longitude": 61.875, "label": "Applied Physiology; Muscle"}, "279": {"latitude": -21.943046,
function createScimapType(map, mapName) {
var sciMapTypeOptions = {
getTileUrl: function(coord, zoom) {
var normalizedCoord = getNormalizedCoord(coord, zoom);
if (!normalizedCoord) {
return mapOfScienceImageFolderPrefix + "tiles/blank.png";
}
var bound = Math.pow(2, zoom);
return mapOfScienceImageFolderPrefix + "tiles/tiles" + zoom + "_" + normalizedCoord.x + "_" +
normalizedCoord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
isPng: true,
minZoom: 1,
maxZoom: 4,
name: mapName
};
var sciMapType = new google.maps.ImageMapType(sciMapTypeOptions);
map.mapTypes.set(mapName, sciMapType);
}
//Normalizes the coords that tiles repeat across the x axis (horizontally)
// like the standard Google map tiles.
function getNormalizedCoord(coord, zoom) {
var y = coord.y;
var x = coord.x;
// tile range in one direction range is dependent on zoom level
// 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc
var tileRange = 1 << zoom;
// don't repeat across y-axis (vertically)
if (y < 0 || y > customTileRange(zoom)) {
return null;
}
// repeat across x-axis (horizontal)
if (x < 0 || x >= tileRange) {
x = (x % tileRange + tileRange) % tileRange;
}
return {
x: x,
y: y
};
}
// horizontal range bound
function customTileRange(zoom) {
if (zoom < 3) {
return zoom;
} else if (zoom == 3){
return 4;
} else if (zoom == 4) {
return 9;
}
}