Transformed
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.format.KML');
|
||||
goog.require('ol.interaction');
|
||||
goog.require('ol.interaction.Select');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.source.Cluster');
|
||||
goog.require('ol.source.Stamen');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Circle');
|
||||
goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.RegularShape');
|
||||
goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
goog.require('ol.style.Text');
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_extent_ from '../src/ol/extent.js';
|
||||
import _ol_format_KML_ from '../src/ol/format/KML.js';
|
||||
import _ol_interaction_ from '../src/ol/interaction.js';
|
||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||
import _ol_source_Cluster_ from '../src/ol/source/Cluster.js';
|
||||
import _ol_source_Stamen_ from '../src/ol/source/Stamen.js';
|
||||
import _ol_source_Vector_ from '../src/ol/source/Vector.js';
|
||||
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
||||
import _ol_style_Fill_ from '../src/ol/style/Fill.js';
|
||||
import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js';
|
||||
import _ol_style_Stroke_ from '../src/ol/style/Stroke.js';
|
||||
import _ol_style_Style_ from '../src/ol/style/Style.js';
|
||||
import _ol_style_Text_ from '../src/ol/style/Text.js';
|
||||
|
||||
|
||||
var earthquakeFill = new ol.style.Fill({
|
||||
var earthquakeFill = new _ol_style_Fill_({
|
||||
color: 'rgba(255, 153, 0, 0.8)'
|
||||
});
|
||||
var earthquakeStroke = new ol.style.Stroke({
|
||||
var earthquakeStroke = new _ol_style_Stroke_({
|
||||
color: 'rgba(255, 204, 0, 0.2)',
|
||||
width: 1
|
||||
});
|
||||
var textFill = new ol.style.Fill({
|
||||
var textFill = new _ol_style_Fill_({
|
||||
color: '#fff'
|
||||
});
|
||||
var textStroke = new ol.style.Stroke({
|
||||
var textStroke = new _ol_style_Stroke_({
|
||||
color: 'rgba(0, 0, 0, 0.6)',
|
||||
width: 3
|
||||
});
|
||||
var invisibleFill = new ol.style.Fill({
|
||||
var invisibleFill = new _ol_style_Fill_({
|
||||
color: 'rgba(255, 255, 255, 0.01)'
|
||||
});
|
||||
|
||||
@@ -43,9 +43,9 @@ function createEarthquakeStyle(feature) {
|
||||
var magnitude = parseFloat(name.substr(2));
|
||||
var radius = 5 + 20 * (magnitude - 5);
|
||||
|
||||
return new ol.style.Style({
|
||||
return new _ol_style_Style_({
|
||||
geometry: feature.getGeometry(),
|
||||
image: new ol.style.RegularShape({
|
||||
image: new _ol_style_RegularShape_({
|
||||
radius1: radius,
|
||||
radius2: 3,
|
||||
points: 5,
|
||||
@@ -64,13 +64,13 @@ function calculateClusterInfo(resolution) {
|
||||
for (var i = features.length - 1; i >= 0; --i) {
|
||||
feature = features[i];
|
||||
var originalFeatures = feature.get('features');
|
||||
var extent = ol.extent.createEmpty();
|
||||
var extent = _ol_extent_.createEmpty();
|
||||
var j, jj;
|
||||
for (j = 0, jj = originalFeatures.length; j < jj; ++j) {
|
||||
ol.extent.extend(extent, originalFeatures[j].getGeometry().getExtent());
|
||||
_ol_extent_.extend(extent, originalFeatures[j].getGeometry().getExtent());
|
||||
}
|
||||
maxFeatureCount = Math.max(maxFeatureCount, jj);
|
||||
radius = 0.25 * (ol.extent.getWidth(extent) + ol.extent.getHeight(extent)) /
|
||||
radius = 0.25 * (_ol_extent_.getWidth(extent) + _ol_extent_.getHeight(extent)) /
|
||||
resolution;
|
||||
feature.set('radius', radius);
|
||||
}
|
||||
@@ -85,14 +85,14 @@ function styleFunction(feature, resolution) {
|
||||
var style;
|
||||
var size = feature.get('features').length;
|
||||
if (size > 1) {
|
||||
style = new ol.style.Style({
|
||||
image: new ol.style.Circle({
|
||||
style = new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
radius: feature.get('radius'),
|
||||
fill: new ol.style.Fill({
|
||||
fill: new _ol_style_Fill_({
|
||||
color: [255, 153, 0, Math.min(0.8, 0.4 + (size / maxFeatureCount))]
|
||||
})
|
||||
}),
|
||||
text: new ol.style.Text({
|
||||
text: new _ol_style_Text_({
|
||||
text: size.toString(),
|
||||
fill: textFill,
|
||||
stroke: textStroke
|
||||
@@ -106,8 +106,8 @@ function styleFunction(feature, resolution) {
|
||||
}
|
||||
|
||||
function selectStyleFunction(feature) {
|
||||
var styles = [new ol.style.Style({
|
||||
image: new ol.style.Circle({
|
||||
var styles = [new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
radius: feature.get('radius'),
|
||||
fill: invisibleFill
|
||||
})
|
||||
@@ -121,12 +121,12 @@ function selectStyleFunction(feature) {
|
||||
return styles;
|
||||
}
|
||||
|
||||
vector = new ol.layer.Vector({
|
||||
source: new ol.source.Cluster({
|
||||
vector = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Cluster_({
|
||||
distance: 40,
|
||||
source: new ol.source.Vector({
|
||||
source: new _ol_source_Vector_({
|
||||
url: 'data/kml/2012_Earthquakes_Mag5.kml',
|
||||
format: new ol.format.KML({
|
||||
format: new _ol_format_KML_({
|
||||
extractStyles: false
|
||||
})
|
||||
})
|
||||
@@ -134,15 +134,15 @@ vector = new ol.layer.Vector({
|
||||
style: styleFunction
|
||||
});
|
||||
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.Stamen({
|
||||
var raster = new _ol_layer_Tile_({
|
||||
source: new _ol_source_Stamen_({
|
||||
layer: 'toner'
|
||||
})
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
var map = new _ol_Map_({
|
||||
layers: [raster, vector],
|
||||
interactions: ol.interaction.defaults().extend([new ol.interaction.Select({
|
||||
interactions: _ol_interaction_.defaults().extend([new _ol_interaction_Select_({
|
||||
condition: function(evt) {
|
||||
return evt.type == 'pointermove' ||
|
||||
evt.type == 'singleclick';
|
||||
@@ -150,7 +150,7 @@ var map = new ol.Map({
|
||||
style: selectStyleFunction
|
||||
})]),
|
||||
target: 'map',
|
||||
view: new ol.View({
|
||||
view: new _ol_View_({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user