apollo_developers/bower_components/ngmap/testapp/layer-data-quakes-advanced.html
venbatechnologies@gmail.com 1809bcf9c9 fixed table for student details
2018-04-23 18:34:11 +05:30

85 lines
3.0 KiB
HTML
Executable File

<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js"></script>
<!-- build:js scripts/ng-map.min.js -->
<script src="../app/scripts/app.js"></script>
<script src="../app/scripts/directives/map_controller.js"></script>
<script src="../app/scripts/directives/map.js"></script>
<script src="../app/scripts/directives/marker.js"></script>
<script src="../app/scripts/directives/shape.js"></script>
<script src="../app/scripts/directives/map-data.js"></script>
<script src="../app/scripts/services/geo_coder.js"></script>
<script src="../app/scripts/services/navigator_geolocation.js"></script>
<script src="../app/scripts/services/attr2_options.js"></script>
<!-- endbuild -->
<script>
var app = app || angular.module('myApp', ['ngMap']);
app.controller('LayerDataQuakesAdvCtrl', function($scope) {
function interpolateHsl(lowHsl, highHsl, fraction) {
var color = [];
for (var i = 0; i < 3; i++) {
// Calculate color based on the fraction.
color[i] = (highHsl[i] - lowHsl[i]) * fraction + lowHsl[i];
}
return 'hsl(' + color[0] + ',' + color[1] + '%,' + color[2] + '%)';
}
$scope.styleFunc = function(feature) {
var low = [151, 83, 34]; // color of mag 1.0
var high = [5, 69, 54]; // color of mag 6.0 and above
var minMag = 1.0;
var maxMag = 6.0;
// fraction represents where the value sits between the min and max
var fraction = (Math.min(feature.getProperty('mag'), maxMag) - minMag) /
(maxMag - minMag);
var color = interpolateHsl(low, high, fraction);
return {
icon: {
path: google.maps.SymbolPath.CIRCLE,
strokeWeight: 0.5,
strokeColor: '#fff',
fillColor: color,
fillOpacity: 2 / feature.getProperty('mag'),
// while an exponent would technically be correct, quadratic looks nicer
scale: Math.pow(feature.getProperty('mag'), 2)
},
zIndex: Math.floor(feature.getProperty('mag'))
};
};
});
</script>
</head>
<body>
<div ng-controller="LayerDataQuakesAdvCtrl">
<map zoom="3" center="20, -160"
styles="[{
'featureType': 'all',
'elementType': 'all',
'stylers': [{'visibility': 'off'}]
}, {
'featureType': 'landscape',
'elementType': 'geometry',
'stylers': [{'visibility': 'on'}, {'color': '#fcfcfc'}]
}, {
'featureType': 'water',
'elementType': 'labels',
'stylers': [{'visibility': 'off'}]
}, {
'featureType': 'water',
'elementType': 'geometry',
'stylers': [{'visibility': 'on'}, {'hue': '#5f94ff'}, {'lightness': 60}]
}]">
<map-data
set-style="styleFunc"
load-geo-json="scripts/quakes.geo.json"></map-data>
</map>
</div>
</body>
</html>