Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions

View File

@@ -1,12 +1,10 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.layer.Tile');
goog.require('ol.source.XYZ');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
import _ol_layer_Tile_ from '../../../../src/ol/layer/Tile.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
describe('layer clipping', function() {
@@ -40,10 +38,10 @@ describe('layer clipping', function() {
var map = null;
beforeEach(function() {
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(256, 256),
view: new ol.View({
view: new _ol_View_({
center: [0, 0],
zoom: 0
})
@@ -57,22 +55,22 @@ describe('layer clipping', function() {
it('clips to all parts of the MultiPolygon', function(done) {
var source = new ol.source.XYZ({
var source = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
var layer = new ol.layer.Tile({
var layer = new _ol_layer_Tile_({
source: source
});
var geometry = new ol.geom.MultiPolygon([
var geometry = new _ol_geom_MultiPolygon_([
[[[-80, -40], [-40, 0], [-80, 40], [-120, 0], [-80, -40]]],
[[[80, -40], [120, 0], [80, 40], [40, 0], [80, -40]]]
]).transform('EPSG:4326', 'EPSG:3857');
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
width: 2,
color: 'blue'
})

View File

@@ -1,12 +1,10 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Image');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.source.ImageStatic');
goog.require('ol.tilegrid');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js';
import _ol_obj_ from '../../../../src/ol/obj.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
describe('ol.rendering.layer.Image', function() {
@@ -14,12 +12,12 @@ describe('ol.rendering.layer.Image', function() {
var map;
function createMap(renderer) {
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(50, 50),
renderer: renderer,
view: new ol.View({
center: ol.proj.transform(
view: new _ol_View_({
center: _ol_proj_.transform(
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
zoom: 5
})
@@ -58,8 +56,8 @@ describe('ol.rendering.layer.Image', function() {
var options = {
source: source
};
ol.obj.assign(options, layerOptions);
map.addLayer(new ol.layer.Image(options));
_ol_obj_.assign(options, layerOptions);
map.addLayer(new _ol_layer_Image_(options));
});
}
@@ -67,11 +65,11 @@ describe('ol.rendering.layer.Image', function() {
var source;
beforeEach(function() {
source = new ol.source.ImageStatic({
source = new _ol_source_ImageStatic_({
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
imageExtent: ol.tilegrid.createXYZ().getTileCoordExtent(
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent(
[5, 5, -12 - 1]),
projection: ol.proj.get('EPSG:3857')
projection: _ol_proj_.get('EPSG:3857')
});
});
@@ -97,9 +95,9 @@ describe('ol.rendering.layer.Image', function() {
var source;
beforeEach(function() {
source = new ol.source.ImageStatic({
source = new _ol_source_ImageStatic_({
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
imageExtent: ol.proj.transformExtent(
imageExtent: _ol_proj_.transformExtent(
[-123, 37, -122, 38], 'EPSG:4326', 'EPSG:3857')
});
});

View File

@@ -1,18 +1,16 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.geom.Point');
goog.require('ol.layer.Tile');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.source.TileImage');
goog.require('ol.source.XYZ');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.tilegrid');
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_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_layer_Tile_ from '../../../../src/ol/layer/Tile.js';
import _ol_obj_ from '../../../../src/ol/obj.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import _ol_source_TileImage_ from '../../../../src/ol/source/TileImage.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
describe('ol.rendering.layer.Tile', function() {
@@ -22,12 +20,12 @@ describe('ol.rendering.layer.Tile', function() {
function createMap(renderer, opt_center, opt_size, opt_pixelRatio, opt_resolutions) {
var size = opt_size !== undefined ? opt_size : [50, 50];
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: opt_pixelRatio || 1,
target: createMapDiv(size[0], size[1]),
renderer: renderer,
view: new ol.View({
center: opt_center !== undefined ? opt_center : ol.proj.transform(
view: new _ol_View_({
center: opt_center !== undefined ? opt_center : _ol_proj_.transform(
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
resolutions: opt_resolutions,
zoom: 5
@@ -67,15 +65,15 @@ describe('ol.rendering.layer.Tile', function() {
var options = {
source: source
};
ol.obj.assign(options, layerOptions[i] || layerOptions);
map.addLayer(new ol.layer.Tile(options));
_ol_obj_.assign(options, layerOptions[i] || layerOptions);
map.addLayer(new _ol_layer_Tile_(options));
});
}
describe('with tile transition', function() {
it('renders correctly after the transition', function(done) {
createMap('canvas');
var source = new ol.source.XYZ({
var source = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png'
});
waitForTiles([source], {}, function() {
@@ -91,7 +89,7 @@ describe('ol.rendering.layer.Tile', function() {
var source;
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
@@ -119,11 +117,11 @@ describe('ol.rendering.layer.Tile', function() {
var source1, source2;
beforeEach(function() {
source1 = new ol.source.XYZ({
source1 = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
source2 = new ol.source.XYZ({
source2 = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/stamen-labels/{z}/{x}/{y}.png',
transition: 0
});
@@ -148,8 +146,8 @@ describe('ol.rendering.layer.Tile', function() {
function centerExtent(map) {
var c = map.getView().calculateExtent(map.getSize());
var qw = ol.extent.getSize(c)[0] / 4;
var qh = ol.extent.getSize(c)[1] / 4;
var qw = _ol_extent_.getSize(c)[0] / 4;
var qh = _ol_extent_.getSize(c)[1] / 4;
return [c[0] + qw, c[1] + qh, c[2] - qw, c[3] - qh];
}
@@ -193,7 +191,7 @@ describe('ol.rendering.layer.Tile', function() {
var source;
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
@@ -220,9 +218,9 @@ describe('ol.rendering.layer.Tile', function() {
describe('tile layer with non-square tiles', function() {
function createSource(tileSize) {
return new ol.source.TileImage({
return new _ol_source_TileImage_({
url: 'rendering/ol/data/tiles/' + tileSize + '/{z}/{x}/{y}.png',
tileGrid: ol.tilegrid.createXYZ({
tileGrid: _ol_tilegrid_.createXYZ({
tileSize: tileSize.split('x')
}),
transition: 0
@@ -274,20 +272,20 @@ describe('ol.rendering.layer.Tile', function() {
var source, onAddLayer;
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
onAddLayer = function(evt) {
evt.element.on('render', function(e) {
e.vectorContext.setImageStyle(new ol.style.Circle({
e.vectorContext.setImageStyle(new _ol_style_Circle_({
radius: 5,
snapToPixel: false,
fill: new ol.style.Fill({color: 'yellow'}),
stroke: new ol.style.Stroke({color: 'red', width: 1})
fill: new _ol_style_Fill_({color: 'yellow'}),
stroke: new _ol_style_Stroke_({color: 'red', width: 1})
}));
e.vectorContext.drawPoint(new ol.geom.Point(
ol.proj.transform([-123, 38], 'EPSG:4326', 'EPSG:3857')));
e.vectorContext.drawPoint(new _ol_geom_Point_(
_ol_proj_.transform([-123, 38], 'EPSG:4326', 'EPSG:3857')));
});
};
});

View File

@@ -1,20 +1,18 @@
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.GeoJSON');
goog.require('ol.geom.Circle');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
goog.require('ol.style.Text');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.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_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';
describe('ol.rendering.layer.Vector', function() {
@@ -23,11 +21,11 @@ describe('ol.rendering.layer.Vector', function() {
var map;
function createMap(renderer) {
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(80, 80),
renderer: renderer,
view: new ol.View({
view: new _ol_View_({
center: center,
zoom: 13
})
@@ -44,11 +42,11 @@ describe('ol.rendering.layer.Vector', function() {
var source;
function addCircle(r) {
source.addFeature(new ol.Feature(new ol.geom.Circle(center, r)));
source.addFeature(new _ol_Feature_(new _ol_geom_Circle_(center, r)));
}
function addPolygon(r) {
source.addFeature(new ol.Feature(new ol.geom.Polygon([
source.addFeature(new _ol_Feature_(new _ol_geom_Polygon_([
[
[center[0] - r, center[1] - r],
[center[0] + r, center[1] - r],
@@ -60,7 +58,7 @@ describe('ol.rendering.layer.Vector', function() {
}
function addLineString(r) {
source.addFeature(new ol.Feature(new ol.geom.LineString([
source.addFeature(new _ol_Feature_(new _ol_geom_LineString_([
[center[0] - r, center[1] - r],
[center[0] + r, center[1] - r],
[center[0] + r, center[1] + r],
@@ -72,18 +70,18 @@ describe('ol.rendering.layer.Vector', function() {
describe('vector layer', function() {
beforeEach(function() {
source = new ol.source.Vector();
source = new _ol_source_Vector_();
});
it('renders opacity correctly with the canvas renderer', function(done) {
createMap('canvas');
var smallLine = new ol.Feature(new ol.geom.LineString([
var smallLine = new _ol_Feature_(new _ol_geom_LineString_([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle(new ol.style.Style({
smallLine.setStyle(new _ol_style_Style_({
zIndex: -99,
stroke: new ol.style.Stroke({width: 75, color: 'red'})
stroke: new _ol_style_Stroke_({width: 75, color: 'red'})
}));
source.addFeature(smallLine);
addPolygon(100);
@@ -92,7 +90,7 @@ describe('ol.rendering.layer.Vector', function() {
addCircle(500);
addPolygon(600);
addPolygon(720);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
source: source
}));
map.once('postrender', function() {
@@ -103,13 +101,13 @@ describe('ol.rendering.layer.Vector', function() {
it('renders opacity correctly with renderMode: \'image\'', function(done) {
createMap('canvas');
var smallLine = new ol.Feature(new ol.geom.LineString([
var smallLine = new _ol_Feature_(new _ol_geom_LineString_([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle(new ol.style.Style({
smallLine.setStyle(new _ol_style_Style_({
zIndex: -99,
stroke: new ol.style.Stroke({width: 75, color: 'red'})
stroke: new _ol_style_Stroke_({width: 75, color: 'red'})
}));
source.addFeature(smallLine);
addPolygon(100);
@@ -118,7 +116,7 @@ describe('ol.rendering.layer.Vector', function() {
addCircle(500);
addPolygon(600);
addPolygon(720);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
renerMode: 'image',
source: source
}));
@@ -130,34 +128,34 @@ describe('ol.rendering.layer.Vector', function() {
it('renders transparent layers correctly with the canvas renderer', function(done) {
createMap('canvas');
var smallLine = new ol.Feature(new ol.geom.LineString([
var smallLine = new _ol_Feature_(new _ol_geom_LineString_([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle([
new ol.style.Style({
stroke: new ol.style.Stroke({width: 75, color: 'red'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 75, color: 'red'})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({width: 45, color: 'white'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 45, color: 'white'})
})
]);
source.addFeature(smallLine);
var smallLine2 = new ol.Feature(new ol.geom.LineString([
var smallLine2 = new _ol_Feature_(new _ol_geom_LineString_([
[center[0], center[1] - 1000],
[center[0], center[1] + 1000]
]));
smallLine2.setStyle([
new ol.style.Style({
stroke: new ol.style.Stroke({width: 35, color: 'blue'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 35, color: 'blue'})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({width: 15, color: 'green'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 15, color: 'green'})
})
]);
source.addFeature(smallLine2);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
source: source,
opacity: 0.5
}));
@@ -169,34 +167,34 @@ describe('ol.rendering.layer.Vector', function() {
it('renders transparent layers correctly with renderMode: \'image\'', function(done) {
createMap('canvas');
var smallLine = new ol.Feature(new ol.geom.LineString([
var smallLine = new _ol_Feature_(new _ol_geom_LineString_([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle([
new ol.style.Style({
stroke: new ol.style.Stroke({width: 75, color: 'red'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 75, color: 'red'})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({width: 45, color: 'white'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 45, color: 'white'})
})
]);
source.addFeature(smallLine);
var smallLine2 = new ol.Feature(new ol.geom.LineString([
var smallLine2 = new _ol_Feature_(new _ol_geom_LineString_([
[center[0], center[1] - 1000],
[center[0], center[1] + 1000]
]));
smallLine2.setStyle([
new ol.style.Style({
stroke: new ol.style.Stroke({width: 35, color: 'blue'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 35, color: 'blue'})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({width: 15, color: 'green'})
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({width: 15, color: 'green'})
})
]);
source.addFeature(smallLine2);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
renderMode: 'image',
source: source,
opacity: 0.5
@@ -212,10 +210,10 @@ describe('ol.rendering.layer.Vector', function() {
map.getView().setRotation(Math.PI + Math.PI / 4);
addPolygon(300);
addCircle(500);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
source: source,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
style: new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
width: 2,
color: 'black'
})
@@ -232,11 +230,11 @@ describe('ol.rendering.layer.Vector', function() {
map.getView().setRotation(Math.PI + Math.PI / 4);
addPolygon(300);
addCircle(500);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
renderMode: 'image',
source: source,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
style: new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
width: 2,
color: 'black'
})
@@ -253,14 +251,14 @@ describe('ol.rendering.layer.Vector', function() {
addCircle(500);
addPolygon(300);
map.skipFeature(source.getFeatures()[1]);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
renderMode: 'image',
source: source,
style: new ol.style.Style({
fill: new ol.style.Fill({
style: new _ol_style_Style_({
fill: new _ol_style_Fill_({
color: 'rgba(255,0,0,0.5)'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
width: 2,
color: 'black'
})
@@ -276,7 +274,7 @@ describe('ol.rendering.layer.Vector', function() {
it('renders fill/stroke batches correctly with the canvas renderer', function(done) {
createMap('canvas');
source = new ol.source.Vector({
source = new _ol_source_Vector_({
overlaps: false
});
addPolygon(100);
@@ -285,10 +283,10 @@ describe('ol.rendering.layer.Vector', function() {
addCircle(500);
addPolygon(600);
addPolygon(720);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
source: source,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
style: new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: '#3399CC',
width: 1.25
})
@@ -302,17 +300,17 @@ describe('ol.rendering.layer.Vector', function() {
it('renders stroke batches correctly with the canvas renderer', function(done) {
createMap('canvas');
source = new ol.source.Vector({
source = new _ol_source_Vector_({
overlaps: false
});
addLineString(100);
addLineString(250);
addLineString(600);
addLineString(720);
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
source: source,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
style: new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: '#3399CC',
width: 1.25
})
@@ -329,7 +327,7 @@ describe('ol.rendering.layer.Vector', function() {
var color;
function createSource(overlaps) {
color = '#3399CC';
source = new ol.source.Vector({
source = new _ol_source_Vector_({
overlaps: overlaps
});
addPolygon(720);
@@ -348,16 +346,16 @@ describe('ol.rendering.layer.Vector', function() {
}
return color;
}
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: createSource(true),
style: function(feature) {
alternateColor();
return new ol.style.Style({
stroke: new ol.style.Stroke({
return new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: alternateColor(),
width: 1.25
}),
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: alternateColor()
})
});
@@ -382,7 +380,7 @@ describe('ol.rendering.layer.Vector', function() {
var color;
function createSource(overlaps) {
color = '#3399CC';
source = new ol.source.Vector({
source = new _ol_source_Vector_({
overlaps: overlaps
});
addLineString(720);
@@ -399,16 +397,16 @@ describe('ol.rendering.layer.Vector', function() {
}
return color;
}
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: createSource(true),
style: function(feature) {
alternateColor();
return new ol.style.Style({
stroke: new ol.style.Stroke({
return new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: alternateColor(),
width: 1.25
}),
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: alternateColor()
})
});
@@ -433,10 +431,10 @@ describe('ol.rendering.layer.Vector', function() {
var map2;
beforeEach(function() {
map2 = new ol.Map({
map2 = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(128, 128),
view: new ol.View({
view: new _ol_View_({
center: [0, 0],
zoom: 0
})
@@ -465,15 +463,15 @@ describe('ol.rendering.layer.Vector', function() {
properties: {}
};
var format = new ol.format.GeoJSON({featureProjection: 'EPSG:3857'});
var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'});
var feature = format.readFeature(json);
var layer = new ol.layer.Vector({
source: new ol.source.Vector({
var layer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({
features: [feature]
}),
style: new ol.style.Style({
fill: new ol.style.Fill({
style: new _ol_style_Style_({
fill: new _ol_style_Fill_({
color: 'blue'
})
})
@@ -494,16 +492,16 @@ describe('ol.rendering.layer.Vector', function() {
var layer, map3;
beforeEach(function() {
var src = new ol.source.Vector({
var src = new _ol_source_Vector_({
features: [
new ol.Feature(new ol.geom.Polygon([[
new _ol_Feature_(new _ol_geom_Polygon_([[
[-22, 58],
[-22, 78],
[-9, 78],
[-9, 58],
[-22, 58]
]])),
new ol.Feature(new ol.geom.Polygon([[
new _ol_Feature_(new _ol_geom_Polygon_([[
[-9, 58],
[-9, 78],
[4, 78],
@@ -512,17 +510,17 @@ describe('ol.rendering.layer.Vector', function() {
]]))
]
});
layer = new ol.layer.Vector({
layer = new _ol_layer_Vector_({
renderBuffer: 0,
source: src
});
var view = new ol.View({
var view = new _ol_View_({
center: [-9.5, 78],
zoom: 2,
projection: 'EPSG:4326'
});
map3 = new ol.Map({
map3 = new _ol_Map_({
pixelRatio: 1,
layers: [layer],
target: createMapDiv(100, 100),
@@ -536,12 +534,12 @@ describe('ol.rendering.layer.Vector', function() {
});
it('renders partially out-of-view polygons with a fill and stroke', function(done) {
layer.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({
layer.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: [0, 0, 0, 1],
width: 2
}),
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: [255, 0, 0, 1]
})
}));
@@ -552,8 +550,8 @@ describe('ol.rendering.layer.Vector', function() {
});
it('renders partially out-of-view polygons with a fill', function(done) {
layer.setStyle(new ol.style.Style({
fill: new ol.style.Fill({
layer.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({
color: [0, 0, 0, 1]
})
}));
@@ -564,8 +562,8 @@ describe('ol.rendering.layer.Vector', function() {
});
it('renders partially out-of-view polygons with a stroke', function(done) {
layer.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({
layer.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: [0, 0, 0, 1],
width: 2
})
@@ -581,34 +579,34 @@ describe('ol.rendering.layer.Vector', function() {
describe('decluttering', function() {
beforeEach(function() {
source = new ol.source.Vector();
source = new _ol_source_Vector_();
});
it('declutters text', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
var centerFeature = new ol.Feature({
geometry: new ol.geom.Point(center),
var centerFeature = new _ol_Feature_({
geometry: new _ol_geom_Point_(center),
text: 'center'
});
source.addFeature(centerFeature);
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] - 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] - 540, center[1]]),
text: 'west'
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] + 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] + 540, center[1]]),
text: 'east'
}));
layer.setDeclutter(true);
layer.setStyle(function(feature) {
return new ol.style.Style({
text: new ol.style.Text({
return new _ol_style_Style_({
text: new _ol_style_Text_({
text: feature.get('text'),
font: '12px sans-serif'
})
@@ -626,30 +624,30 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters text with renderMode: \'image\'', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
renderMode: 'image',
source: source
});
map.addLayer(layer);
var centerFeature = new ol.Feature({
geometry: new ol.geom.Point(center),
var centerFeature = new _ol_Feature_({
geometry: new _ol_geom_Point_(center),
text: 'center'
});
source.addFeature(centerFeature);
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] - 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] - 540, center[1]]),
text: 'west'
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] + 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] + 540, center[1]]),
text: 'east'
}));
layer.setDeclutter(true);
layer.setStyle(function(feature) {
return new ol.style.Style({
text: new ol.style.Text({
return new _ol_style_Style_({
text: new _ol_style_Text_({
text: feature.get('text'),
font: '12px sans-serif'
})
@@ -667,32 +665,32 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters text and respects z-index', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point(center),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_(center),
text: 'center',
zIndex: 2
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] - 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] - 540, center[1]]),
text: 'west',
zIndex: 3
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] + 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] + 540, center[1]]),
text: 'east',
zIndex: 1
}));
layer.setDeclutter(true);
layer.setStyle(function(feature) {
return new ol.style.Style({
return new _ol_style_Style_({
zIndex: feature.get('zIndex'),
text: new ol.style.Text({
text: new _ol_style_Text_({
text: feature.get('text'),
font: '12px sans-serif'
})
@@ -707,28 +705,28 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters images', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
var centerFeature = new ol.Feature({
geometry: new ol.geom.Point(center)
var centerFeature = new _ol_Feature_({
geometry: new _ol_geom_Point_(center)
});
source.addFeature(centerFeature);
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] - 540, center[1]])
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] - 540, center[1]])
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] + 540, center[1]])
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] + 540, center[1]])
}));
layer.setDeclutter(true);
layer.setStyle(function(feature) {
return new ol.style.Style({
image: new ol.style.Circle({
return new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 15,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'blue'
})
})
@@ -746,29 +744,29 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters images with renderMode: \'image\'', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
renderMode: 'image',
source: source
});
map.addLayer(layer);
var centerFeature = new ol.Feature({
geometry: new ol.geom.Point(center)
var centerFeature = new _ol_Feature_({
geometry: new _ol_geom_Point_(center)
});
source.addFeature(centerFeature);
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] - 540, center[1]])
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] - 540, center[1]])
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] + 540, center[1]])
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] + 540, center[1]])
}));
layer.setDeclutter(true);
layer.setStyle(function(feature) {
return new ol.style.Style({
image: new ol.style.Circle({
return new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 15,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'blue'
})
})
@@ -786,31 +784,31 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters images and respects z-index', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point(center),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_(center),
zIndex: 2
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] - 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] - 540, center[1]]),
zIndex: 3
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] + 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] + 540, center[1]]),
zIndex: 1
}));
layer.setDeclutter(true);
layer.setStyle(function(feature) {
return new ol.style.Style({
return new _ol_style_Style_({
zIndex: feature.get('zIndex'),
image: new ol.style.Circle({
image: new _ol_style_Circle_({
radius: 15,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'blue'
})
})
@@ -825,34 +823,34 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters image & text groups', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point(center),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_(center),
text: 'center'
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] - 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] - 540, center[1]]),
text: 'west'
}));
source.addFeature(new ol.Feature({
geometry: new ol.geom.Point([center[0] + 540, center[1]]),
source.addFeature(new _ol_Feature_({
geometry: new _ol_geom_Point_([center[0] + 540, center[1]]),
text: 'east'
}));
layer.setDeclutter(true);
layer.setStyle(function(feature) {
return new ol.style.Style({
image: new ol.style.Circle({
return new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 5,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'blue'
})
}),
text: new ol.style.Text({
text: new _ol_style_Text_({
text: feature.get('text'),
font: '12px sans-serif',
textBaseline: 'bottom',
@@ -869,30 +867,30 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters text along lines and images', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
var point = new ol.Feature(new ol.geom.Point(center));
point.setStyle(new ol.style.Style({
image: new ol.style.Circle({
var point = new _ol_Feature_(new _ol_geom_Point_(center));
point.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 8,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'blue'
})
})
}));
var line = new ol.Feature(new ol.geom.LineString([
var line = new _ol_Feature_(new _ol_geom_LineString_([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({
line.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: '#CCC',
width: 12
}),
text: new ol.style.Text({
text: new _ol_style_Text_({
placement: 'line',
text: 'east-west',
font: '12px sans-serif'
@@ -912,30 +910,30 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters text along lines and images with renderMode: \'image\'', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
var point = new ol.Feature(new ol.geom.Point(center));
point.setStyle(new ol.style.Style({
image: new ol.style.Circle({
var point = new _ol_Feature_(new _ol_geom_Point_(center));
point.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 8,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'blue'
})
})
}));
var line = new ol.Feature(new ol.geom.LineString([
var line = new _ol_Feature_(new _ol_geom_LineString_([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({
line.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: '#CCC',
width: 12
}),
text: new ol.style.Text({
text: new _ol_style_Text_({
placement: 'line',
text: 'east-west',
font: '12px sans-serif'
@@ -955,32 +953,32 @@ describe('ol.rendering.layer.Vector', function() {
it('declutters text along lines and images with z-index', function(done) {
createMap('canvas');
var layer = new ol.layer.Vector({
var layer = new _ol_layer_Vector_({
source: source
});
map.addLayer(layer);
var point = new ol.Feature(new ol.geom.Point(center));
point.setStyle(new ol.style.Style({
var point = new _ol_Feature_(new _ol_geom_Point_(center));
point.setStyle(new _ol_style_Style_({
zIndex: 2,
image: new ol.style.Circle({
image: new _ol_style_Circle_({
radius: 8,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'blue'
})
})
}));
var line = new ol.Feature(new ol.geom.LineString([
var line = new _ol_Feature_(new _ol_geom_LineString_([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new ol.style.Style({
line.setStyle(new _ol_style_Style_({
zIndex: 1,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#CCC',
width: 12
}),
text: new ol.style.Text({
text: new _ol_style_Text_({
placement: 'line',
text: 'east-west',
font: '12px sans-serif'

View File

@@ -1,18 +1,18 @@
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.MVT');
goog.require('ol.geom.Point');
goog.require('ol.layer.Vector');
goog.require('ol.layer.VectorTile');
goog.require('ol.obj');
goog.require('ol.source.Vector');
goog.require('ol.source.VectorTile');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Style');
goog.require('ol.style.Text');
goog.require('ol.tilegrid');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js';
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js';
import _ol_obj_ from '../../../../src/ol/obj.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js';
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Text_ from '../../../../src/ol/style/Text.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
describe('ol.rendering.layer.VectorTile', function() {
@@ -21,11 +21,11 @@ describe('ol.rendering.layer.VectorTile', function() {
function createMap(renderer, opt_pixelRatio, opt_size) {
var size = opt_size || 50;
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: opt_pixelRatio || 1,
target: createMapDiv(size, size),
renderer: renderer,
view: new ol.View({
view: new _ol_View_({
center: [1825927.7316762917, 6143091.089223046],
zoom: 14
})
@@ -61,17 +61,17 @@ describe('ol.rendering.layer.VectorTile', function() {
var options = {
source: source
};
ol.obj.assign(options, layerOptions);
map.addLayer(new ol.layer.VectorTile(options));
_ol_obj_.assign(options, layerOptions);
map.addLayer(new _ol_layer_VectorTile_(options));
}
describe('vector tile layer', function() {
var source;
beforeEach(function() {
source = new ol.source.VectorTile({
format: new ol.format.MVT(),
tileGrid: ol.tilegrid.createXYZ(),
source = new _ol_source_VectorTile_({
format: new _ol_format_MVT_(),
tileGrid: _ol_tilegrid_.createXYZ(),
url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf',
transition: 0
});
@@ -96,18 +96,18 @@ describe('ol.rendering.layer.VectorTile', function() {
it('renders rotated view correctly with vector layer on top', function(done) {
createMap('canvas');
var vectorSource = new ol.source.Vector({
var vectorSource = new _ol_source_Vector_({
features: [
new ol.Feature(new ol.geom.Point([1825727.7316762917, 6143091.089223046]))
new _ol_Feature_(new _ol_geom_Point_([1825727.7316762917, 6143091.089223046]))
]
});
map.addLayer(new ol.layer.Vector({
map.addLayer(new _ol_layer_Vector_({
zIndex: 1,
source: vectorSource,
style: new ol.style.Style({
image: new ol.style.Circle({
style: new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 10,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'red'
})
})
@@ -143,14 +143,14 @@ describe('ol.rendering.layer.VectorTile', function() {
var style = function(feature, resolution) {
var geom = feature.getGeometry();
if (geom.getType() == 'Point') {
return new ol.style.Style({
image: new ol.style.Circle({
return new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 7,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'red'
})
}),
text: new ol.style.Text({
text: new _ol_style_Text_({
text: feature.get('name_en'),
font: '12px sans-serif',
textBaseline: 'bottom',

View File

@@ -1,31 +1,29 @@
goog.require('ol.Feature');
goog.require('ol.geom.Point');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
import _ol_Feature_ from '../../../src/ol/Feature.js';
import _ol_geom_Point_ from '../../../src/ol/geom/Point.js';
import _ol_Map_ from '../../../src/ol/Map.js';
import _ol_View_ from '../../../src/ol/View.js';
import _ol_layer_Vector_ from '../../../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../../../src/ol/source/Vector.js';
describe('ol.rendering.Map', function() {
var map;
function createMap(renderer) {
var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: [new ol.Feature({
geometry: new ol.geom.Point([0, 0])
var vectorLayer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({
features: [new _ol_Feature_({
geometry: new _ol_geom_Point_([0, 0])
})]
})
});
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(50, 50),
renderer: renderer,
layers: [vectorLayer],
view: new ol.View({
view: new _ol_View_({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1

View File

@@ -1,15 +1,13 @@
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.render');
goog.require('ol.render.VectorContext');
goog.require('ol.render.canvas.Immediate');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
import _ol_geom_LineString_ from '../../../src/ol/geom/LineString.js';
import _ol_geom_Point_ from '../../../src/ol/geom/Point.js';
import _ol_geom_Polygon_ from '../../../src/ol/geom/Polygon.js';
import _ol_render_ from '../../../src/ol/render.js';
import _ol_render_VectorContext_ from '../../../src/ol/render/VectorContext.js';
import _ol_render_canvas_Immediate_ from '../../../src/ol/render/canvas/Immediate.js';
import _ol_style_Circle_ from '../../../src/ol/style/Circle.js';
import _ol_style_Fill_ from '../../../src/ol/style/Fill.js';
import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js';
import _ol_style_Style_ from '../../../src/ol/style/Style.js';
function getContext() {
return document.createElement('canvas').getContext('2d');
@@ -20,24 +18,24 @@ describe('ol.render', function() {
describe('ol.render.toContext()', function() {
it('creates a vector context from a Canvas 2d context', function() {
var vectorContext = ol.render.toContext(getContext(), {
var vectorContext = _ol_render_.toContext(getContext(), {
pixelRatio: 1,
size: [100, 100]
});
expect(vectorContext).to.be.a(ol.render.VectorContext);
expect(vectorContext).to.be.a(ol.render.canvas.Immediate);
expect(vectorContext).to.be.a(_ol_render_VectorContext_);
expect(vectorContext).to.be.a(_ol_render_canvas_Immediate_);
});
it('can be used to render a point geometry', function(done) {
var context = getContext();
var vectorContext = ol.render.toContext(context, {
var vectorContext = _ol_render_.toContext(context, {
pixelRatio: 1,
size: [100, 100]
});
var style = new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
var style = new _ol_style_Style_({
image: new _ol_style_Circle_({
fill: new _ol_style_Fill_({
color: 'green'
}),
radius: 10
@@ -45,7 +43,7 @@ describe('ol.render', function() {
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.Point([50, 50]));
vectorContext.drawGeometry(new _ol_geom_Point_([50, 50]));
resembleCanvas(context.canvas,
'rendering/ol/expected/render-point.png', IMAGE_TOLERANCE, done);
@@ -54,20 +52,20 @@ describe('ol.render', function() {
it('can be used to render a linestring geometry', function(done) {
var context = getContext();
var vectorContext = ol.render.toContext(context, {
var vectorContext = _ol_render_.toContext(context, {
pixelRatio: 1,
size: [100, 100]
});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: 'red',
width: 14
})
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.LineString([
vectorContext.drawGeometry(new _ol_geom_LineString_([
[10, 60], [30, 40], [50, 60], [70, 40], [90, 60]
]));
@@ -78,13 +76,13 @@ describe('ol.render', function() {
it('respects lineCap for linestring', function(done) {
var context = getContext();
var vectorContext = ol.render.toContext(context, {
var vectorContext = _ol_render_.toContext(context, {
pixelRatio: 1,
size: [100, 100]
});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
lineCap: 'butt',
color: 'red',
width: 14
@@ -92,7 +90,7 @@ describe('ol.render', function() {
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.LineString([
vectorContext.drawGeometry(new _ol_geom_LineString_([
[10, 60], [30, 40], [50, 60], [70, 40], [90, 60]
]));
@@ -103,13 +101,13 @@ describe('ol.render', function() {
it('respects lineJoin for linestring', function(done) {
var context = getContext();
var vectorContext = ol.render.toContext(context, {
var vectorContext = _ol_render_.toContext(context, {
pixelRatio: 1,
size: [100, 100]
});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
lineJoin: 'bevel',
color: 'red',
width: 14
@@ -117,7 +115,7 @@ describe('ol.render', function() {
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.LineString([
vectorContext.drawGeometry(new _ol_geom_LineString_([
[10, 60], [30, 40], [50, 60], [70, 40], [90, 60]
]));
@@ -128,24 +126,24 @@ describe('ol.render', function() {
it('can be used to render a polygon geometry', function(done) {
var context = getContext();
var vectorContext = ol.render.toContext(context, {
var vectorContext = _ol_render_.toContext(context, {
pixelRatio: 1,
size: [100, 100]
});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: 'blue',
width: 8
}),
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'rgba(0,0,255,0.5)'
})
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.Polygon([
vectorContext.drawGeometry(new _ol_geom_Polygon_([
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
]));
@@ -157,20 +155,20 @@ describe('ol.render', function() {
it('supports lineDash styles', function(done) {
var context = getContext();
var vectorContext = ol.render.toContext(context, {
var vectorContext = _ol_render_.toContext(context, {
pixelRatio: 1,
size: [100, 100]
});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
lineDash: [10, 5]
})
});
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.Polygon([
vectorContext.drawGeometry(new _ol_geom_Polygon_([
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
]));
@@ -182,13 +180,13 @@ describe('ol.render', function() {
it('supports lineDashOffset', function(done) {
var context = getContext();
var vectorContext = ol.render.toContext(context, {
var vectorContext = _ol_render_.toContext(context, {
pixelRatio: 1,
size: [100, 100]
});
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
lineDash: [10, 5],
lineDashOffset: 5
})
@@ -196,7 +194,7 @@ describe('ol.render', function() {
vectorContext.setStyle(style);
vectorContext.drawGeometry(new ol.geom.Polygon([
vectorContext.drawGeometry(new _ol_geom_Polygon_([
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
]));

View File

@@ -1,11 +1,9 @@
goog.require('ol.events');
goog.require('ol.proj');
goog.require('ol.proj.EPSG3857');
goog.require('ol.reproj.Image');
goog.require('ol.source.ImageStatic');
goog.require('ol.tilegrid');
import _ol_events_ from '../../../../src/ol/events.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
import _ol_reproj_Image_ from '../../../../src/ol/reproj/Image.js';
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
describe('ol.rendering.reproj.Image', function() {
@@ -16,14 +14,14 @@ describe('ol.rendering.reproj.Image', function() {
var imagesRequested = 0;
var image = new ol.reproj.Image(sourceProj, ol.proj.get(targetProj),
var image = new _ol_reproj_Image_(sourceProj, _ol_proj_.get(targetProj),
targetExtent, targetResolution, pixelRatio,
function(extent, resolution, pixelRatio) {
imagesRequested++;
return source.getImage(extent, resolution, pixelRatio, sourceProj);
});
if (image.getState() == 0) { // IDLE
ol.events.listen(image, 'change', function(e) {
_ol_events_.listen(image, 'change', function(e) {
if (image.getState() == 2) { // LOADED
expect(imagesRequested).to.be(1);
resembleCanvas(image.getImage(), expectedUrl, IMAGE_TOLERANCE, done);
@@ -37,23 +35,23 @@ describe('ol.rendering.reproj.Image', function() {
describe('image reprojections from EPSG:3857', function() {
beforeEach(function() {
source = new ol.source.ImageStatic({
source = new _ol_source_ImageStatic_({
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
imageExtent: ol.tilegrid.createXYZ().getTileCoordExtent([5, 5, -13]),
projection: ol.proj.get('EPSG:3857')
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
projection: _ol_proj_.get('EPSG:3857')
});
});
it('works for identity reprojection', function(done) {
testSingleImage(source, 'EPSG:3857',
ol.tilegrid.createXYZ().getTileCoordExtent([5, 5, -13]),
2 * ol.proj.EPSG3857.HALF_SIZE / (256 * (1 << 5)), 1,
_ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
2 * _ol_proj_EPSG3857_.HALF_SIZE / (256 * (1 << 5)), 1,
'rendering/ol/data/tiles/osm/5/5/12.png', done);
});
it('to EPSG:4326', function(done) {
testSingleImage(source, 'EPSG:4326',
ol.tilegrid.createForProjection('EPSG:4326').
_ol_tilegrid_.createForProjection('EPSG:4326').
getTileCoordExtent([6, 10, -10]),
360 / (256 * (1 << 4)), 1,
'rendering/ol/reproj/expected/image-3857-to-4326.png', done);

View File

@@ -1,11 +1,9 @@
goog.require('ol.TileState');
goog.require('ol.events');
goog.require('ol.proj');
goog.require('ol.reproj.Tile');
goog.require('ol.source.XYZ');
goog.require('ol.tilegrid');
import _ol_TileState_ from '../../../../src/ol/TileState.js';
import _ol_events_ from '../../../../src/ol/events.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
describe('ol.rendering.reproj.Tile', function() {
@@ -17,16 +15,16 @@ describe('ol.rendering.reproj.Tile', function() {
var tilesRequested = 0;
var tile = new ol.reproj.Tile(sourceProjection, source.getTileGrid(),
ol.proj.get(targetProjection), targetTileGrid,
var tile = new _ol_reproj_Tile_(sourceProjection, source.getTileGrid(),
_ol_proj_.get(targetProjection), targetTileGrid,
[z, x, y], null, pixelRatio, sourceGutter,
function(z, x, y, pixelRatio) {
tilesRequested++;
return source.getTile(z, x, y, pixelRatio, sourceProjection);
});
if (tile.getState() == ol.TileState.IDLE) {
ol.events.listen(tile, 'change', function(e) {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == _ol_TileState_.IDLE) {
_ol_events_.listen(tile, 'change', function(e) {
if (tile.getState() == _ol_TileState_.LOADED) {
expect(tilesRequested).to.be(expectedRequests);
resembleCanvas(tile.getImage(), expectedUrl, 7.5, done);
}
@@ -39,7 +37,7 @@ describe('ol.rendering.reproj.Tile', function() {
describe('single tile reprojections from EPSG:3857', function() {
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
projection: 'EPSG:3857',
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png'
});
@@ -51,7 +49,7 @@ describe('ol.rendering.reproj.Tile', function() {
});
it('to EPSG:4326', function(done) {
var tileGrid = ol.tilegrid.createForProjection('EPSG:4326', 7, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 64]);
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 21, -20, 1,
'rendering/ol/reproj/expected/osm4326.png', 1, done);
});
@@ -60,10 +58,10 @@ describe('ol.rendering.reproj.Tile', function() {
proj4.defs('EPSG:5070',
'+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 ' +
'+y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs');
var proj5070 = ol.proj.get('EPSG:5070');
var proj5070 = _ol_proj_.get('EPSG:5070');
proj5070.setExtent([-6e6, 0, 4e6, 6e6]);
var tileGrid = ol.tilegrid.createForProjection('EPSG:5070', 5, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:5070', 5, [64, 64]);
testSingleTile(source, 'EPSG:5070', tileGrid, 5, 13, -15, 1,
'rendering/ol/reproj/expected/osm5070.png', 1, done);
});
@@ -71,10 +69,10 @@ describe('ol.rendering.reproj.Tile', function() {
it('to ESRI:54009', function(done) {
proj4.defs('ESRI:54009',
'+proj=moll +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');
var proj54009 = ol.proj.get('ESRI:54009');
var proj54009 = _ol_proj_.get('ESRI:54009');
proj54009.setExtent([-18e6, -9e6, 18e6, 9e6]);
var tileGrid = ol.tilegrid.createForProjection('ESRI:54009', 7, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('ESRI:54009', 7, [64, 64]);
testSingleTile(source, 'ESRI:54009', tileGrid, 7, 27, -16, 1,
'rendering/ol/reproj/expected/osm54009.png', 1, done);
});
@@ -82,14 +80,14 @@ describe('ol.rendering.reproj.Tile', function() {
describe('stitching several tiles from EPSG:3857', function() {
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
projection: 'EPSG:3857',
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png'
});
});
it('to EPSG:4326', function(done) {
var tileGrid = ol.tilegrid.createForProjection('EPSG:4326', 7, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 64]);
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 23, -21, 1,
'rendering/ol/reproj/expected/stitch-osm4326.png', 2, done);
});
@@ -98,10 +96,10 @@ describe('ol.rendering.reproj.Tile', function() {
proj4.defs('EPSG:3740',
'+proj=utm +zone=10 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 ' +
'+units=m +no_defs');
var proj3740 = ol.proj.get('EPSG:3740');
var proj3740 = _ol_proj_.get('EPSG:3740');
proj3740.setExtent([318499.05, 2700792.39, 4359164.89, 7149336.98]);
var tileGrid = ol.tilegrid.createForProjection('EPSG:3740', 4, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:3740', 4, [64, 64]);
testSingleTile(source, 'EPSG:3740', tileGrid, 4, 4, -13, 1,
'rendering/ol/reproj/expected/stitch-osm3740.png', 4, done);
});
@@ -109,7 +107,7 @@ describe('ol.rendering.reproj.Tile', function() {
describe('tile projection from EPSG:4326', function() {
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
projection: 'EPSG:4326',
maxZoom: 0,
url: 'rendering/ol/data/tiles/4326/{z}/{x}/{y}.png'
@@ -122,7 +120,7 @@ describe('ol.rendering.reproj.Tile', function() {
});
it('to EPSG:3857', function(done) {
var tileGrid = ol.tilegrid.createForProjection('EPSG:3857', 0, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:3857', 0, [64, 64]);
testSingleTile(source, 'EPSG:3857', tileGrid, 0, 0, -1, 1,
'rendering/ol/reproj/expected/4326-to-3857.png', 1, done);
});
@@ -130,7 +128,7 @@ describe('ol.rendering.reproj.Tile', function() {
describe('non-square source tiles', function() {
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
projection: 'EPSG:3857',
url: 'rendering/ol/data/tiles/osm-512x256/{z}/{x}/{y}.png',
tileSize: [512, 256]
@@ -143,7 +141,7 @@ describe('ol.rendering.reproj.Tile', function() {
});
it('to 64x128 EPSG:4326', function(done) {
var tileGrid = ol.tilegrid.createForProjection('EPSG:4326', 7, [64, 128]);
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 128]);
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 27, -10, 1,
'rendering/ol/reproj/expected/512x256-to-64x128.png', 1, done);
});
@@ -151,7 +149,7 @@ describe('ol.rendering.reproj.Tile', function() {
describe('dateline wrapping', function() {
beforeEach(function() {
source = new ol.source.XYZ({
source = new _ol_source_XYZ_({
projection: 'EPSG:4326',
maxZoom: 0,
url: 'rendering/ol/data/tiles/4326/{z}/{x}/{y}.png'
@@ -160,10 +158,10 @@ describe('ol.rendering.reproj.Tile', function() {
it('wraps X when prime meridian is shifted', function(done) {
proj4.defs('merc_180', '+proj=merc +lon_0=180 +units=m +no_defs');
var proj_ = ol.proj.get('merc_180');
var proj_ = _ol_proj_.get('merc_180');
proj_.setExtent([-20026376.39, -20048966.10, 20026376.39, 20048966.10]);
var tileGrid = ol.tilegrid.createForProjection('merc_180', 0, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('merc_180', 0, [64, 64]);
testSingleTile(source, 'merc_180', tileGrid, 0, 0, -1, 1,
'rendering/ol/reproj/expected/dateline-merc-180.png', 2, done);
});
@@ -171,10 +169,10 @@ describe('ol.rendering.reproj.Tile', function() {
it('displays north pole correctly (EPSG:3413)', function(done) {
proj4.defs('EPSG:3413', '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 ' +
'+k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');
var proj3413 = ol.proj.get('EPSG:3413');
var proj3413 = _ol_proj_.get('EPSG:3413');
proj3413.setExtent([-4194304, -4194304, 4194304, 4194304]);
var tileGrid = ol.tilegrid.createForProjection('EPSG:3413', 0, [64, 64]);
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:3413', 0, [64, 64]);
testSingleTile(source, 'EPSG:3413', tileGrid, 0, 0, -1, 1,
'rendering/ol/reproj/expected/dateline-pole.png', 2, done);
});

View File

@@ -1,8 +1,8 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Image');
goog.require('ol.source.Raster');
goog.require('ol.source.XYZ');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js';
import _ol_source_Raster_ from '../../../../src/ol/source/Raster.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() {
@@ -28,11 +28,11 @@ where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() {
var map;
function createMap(renderer, pixelRatio) {
map = new ol.Map({
map = new _ol_Map_({
target: createMapDiv(200, 200),
pixelRatio: pixelRatio,
renderer: renderer,
view: new ol.View({
view: new _ol_View_({
center: [0, 0],
zoom: 0
})
@@ -50,12 +50,12 @@ where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() {
it('renders the result of an operation', function(done) {
createMap('canvas', 1);
var source = new ol.source.XYZ({
var source = new _ol_source_XYZ_({
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
var raster = new ol.source.Raster({
var raster = new _ol_source_Raster_({
sources: [source],
operation: function(pixels) {
var pixel = pixels[0];
@@ -75,7 +75,7 @@ where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() {
expectResemble(map, 'rendering/ol/source/expected/raster-1.png', IMAGE_TOLERANCE, done);
});
var layer = new ol.layer.Image({source: raster});
var layer = new _ol_layer_Image_({source: raster});
map.addLayer(layer);
});

View File

@@ -1,9 +1,7 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.TileWMS');
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Tile_ from '../../../../src/ol/layer/Tile.js';
import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js';
describe('ol.rendering.source.TileWMS', function() {
@@ -27,11 +25,11 @@ describe('ol.rendering.source.TileWMS', function() {
var map;
function createMap(renderer, pixelRatio) {
map = new ol.Map({
map = new _ol_Map_({
target: createMapDiv(200, 200),
pixelRatio: pixelRatio,
renderer: renderer,
view: new ol.View({
view: new _ol_View_({
center: [0, 0],
zoom: 5
})
@@ -46,7 +44,7 @@ describe('ol.rendering.source.TileWMS', function() {
});
function createSource(gutter) {
return new ol.source.TileWMS({
return new _ol_source_TileWMS_({
params: {
'LAYERS': 'layer'
},
@@ -64,7 +62,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/0_1.canvas.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});
@@ -76,7 +74,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/0_1.webgl.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});
@@ -89,7 +87,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/0_2.canvas.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});
@@ -101,7 +99,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/0_2.webgl.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});
@@ -115,7 +113,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/20_1.canvas.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});
@@ -127,7 +125,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/20_1.webgl.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});
@@ -140,7 +138,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/20_2.canvas.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});
@@ -152,7 +150,7 @@ describe('ol.rendering.source.TileWMS', function() {
tilesLoaded(source, function() {
expectResemble(map, 'rendering/ol/source/expected/20_2.webgl.png', IMAGE_TOLERANCE, done);
});
map.addLayer(new ol.layer.Tile({
map.addLayer(new _ol_layer_Tile_({
source: source
}));
});

View File

@@ -1,16 +1,14 @@
goog.require('ol.Feature');
goog.require('ol.geom.Point');
goog.require('ol.geom.MultiPoint');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Style');
goog.require('ol.style.Stroke');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_geom_MultiPoint_ from '../../../../src/ol/geom/MultiPoint.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.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_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
describe('ol.rendering.style.Circle', function() {
@@ -18,17 +16,17 @@ describe('ol.rendering.style.Circle', function() {
var map, vectorSource;
function createMap(renderer) {
vectorSource = new ol.source.Vector();
var vectorLayer = new ol.layer.Vector({
vectorSource = new _ol_source_Vector_();
var vectorLayer = new _ol_layer_Vector_({
source: vectorSource
});
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(50, 50),
renderer: renderer,
layers: [vectorLayer],
view: new ol.View({
view: new _ol_View_({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
@@ -47,55 +45,55 @@ describe('ol.rendering.style.Circle', function() {
function createFeatures(multi) {
var feature;
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[-20, 18]]) : new ol.geom.Point([-20, 18])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[-20, 18]]) : new _ol_geom_Point_([-20, 18])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 2,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: '#91E339'
})
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[-10, 18]]) : new ol.geom.Point([-10, 18])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[-10, 18]]) : new _ol_geom_Point_([-10, 18])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 4,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: '#5447E6'
})
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[4, 18]]) : new ol.geom.Point([4, 18])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[4, 18]]) : new _ol_geom_Point_([4, 18])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 6,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: '#92A8A6'
})
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[-20, 3]]) : new ol.geom.Point([-20, 3])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[-20, 3]]) : new _ol_geom_Point_([-20, 3])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 2,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: '#91E339'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#000000',
width: 1
})
@@ -103,16 +101,16 @@ describe('ol.rendering.style.Circle', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[-10, 3]]) : new ol.geom.Point([-10, 3])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[-10, 3]]) : new _ol_geom_Point_([-10, 3])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 4,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: '#5447E6'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#000000',
width: 2
})
@@ -120,16 +118,16 @@ describe('ol.rendering.style.Circle', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[4, 3]]) : new ol.geom.Point([4, 3])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[4, 3]]) : new _ol_geom_Point_([4, 3])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 6,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: '#92A8A6'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#000000',
width: 3
})
@@ -137,13 +135,13 @@ describe('ol.rendering.style.Circle', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[-20, -15]]) : new ol.geom.Point([-20, -15])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[-20, -15]]) : new _ol_geom_Point_([-20, -15])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 2,
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#256308',
width: 1
})
@@ -151,16 +149,16 @@ describe('ol.rendering.style.Circle', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[-10, -15]]) : new ol.geom.Point([-10, -15])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[-10, -15]]) : new _ol_geom_Point_([-10, -15])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 4,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'rgba(0, 0, 255, 0.3)'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#256308',
width: 2
})
@@ -168,16 +166,16 @@ describe('ol.rendering.style.Circle', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: multi ? new ol.geom.MultiPoint([[4, -15]]) : new ol.geom.Point([4, -15])
feature = new _ol_Feature_({
geometry: multi ? new _ol_geom_MultiPoint_([[4, -15]]) : new _ol_geom_Point_([4, -15])
});
feature.setStyle(new ol.style.Style({
image: new ol.style.Circle({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: 6,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'rgba(235, 45, 70, 0.6)'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#256308',
width: 3
})

View File

@@ -1,13 +1,11 @@
goog.require('ol.Feature');
goog.require('ol.geom.Point');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Icon');
goog.require('ol.style.Style');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
describe('ol.rendering.style.Icon', function() {
@@ -24,17 +22,17 @@ describe('ol.rendering.style.Icon', function() {
};
function createMap(renderer, width, height) {
vectorSource = new ol.source.Vector();
var vectorLayer = new ol.layer.Vector({
vectorSource = new _ol_source_Vector_();
var vectorLayer = new _ol_layer_Vector_({
source: vectorSource
});
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(width ? width : 50, height ? height : 50),
renderer: renderer,
layers: [vectorLayer],
view: new ol.View({
view: new _ol_View_({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
@@ -53,15 +51,15 @@ describe('ol.rendering.style.Icon', function() {
function createFeatures(src, imgInfo, callback) {
var feature;
feature = new ol.Feature({
geometry: new ol.geom.Point([0, 0])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([0, 0])
});
var img = new Image();
img.onload = function() {
imgInfo.img = img;
feature.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ (imgInfo))
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ (imgInfo))
}));
vectorSource.addFeature(feature);
callback();

View File

@@ -1,13 +1,11 @@
goog.require('ol.Feature');
goog.require('ol.geom.LineString');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Style');
goog.require('ol.style.Stroke');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
describe('ol.rendering.style.LineString', function() {
@@ -15,17 +13,17 @@ describe('ol.rendering.style.LineString', function() {
var map, vectorSource;
function createMap(renderer, opt_pixelRatio) {
vectorSource = new ol.source.Vector();
var vectorLayer = new ol.layer.Vector({
vectorSource = new _ol_source_Vector_();
var vectorLayer = new _ol_layer_Vector_({
source: vectorSource
});
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: opt_pixelRatio || 1,
target: createMapDiv(50, 50),
renderer: renderer,
layers: [vectorLayer],
view: new ol.View({
view: new _ol_View_({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
@@ -45,45 +43,45 @@ describe('ol.rendering.style.LineString', function() {
function createFeatures() {
var feature;
feature = new ol.Feature({
geometry: new ol.geom.LineString(
feature = new _ol_Feature_({
geometry: new _ol_geom_LineString_(
[[-20, 20], [15, 20]]
)
});
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({color: '#DE213A', width: 3})
feature.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.LineString(
feature = new _ol_Feature_({
geometry: new _ol_geom_LineString_(
[[-20, 15], [15, 15]]
)
});
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({color: '#9696EB', width: 1})
feature.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.LineString(
feature = new _ol_Feature_({
geometry: new _ol_geom_LineString_(
[[-20, 10], [15, 10]]
)
});
feature.setStyle([new ol.style.Style({
stroke: new ol.style.Stroke({color: '#F2F211', width: 5})
}), new ol.style.Style({
stroke: new ol.style.Stroke({color: '#292921', width: 1})
feature.setStyle([new _ol_style_Style_({
stroke: new _ol_style_Stroke_({color: '#F2F211', width: 5})
}), new _ol_style_Style_({
stroke: new _ol_style_Stroke_({color: '#292921', width: 1})
})]);
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.LineString(
feature = new _ol_Feature_({
geometry: new _ol_geom_LineString_(
[[-20, -20], [-2, 0], [15, -20]]
)
});
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({
feature.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: '#000000',
width: 2,
lineCap: 'square',
@@ -93,13 +91,13 @@ describe('ol.rendering.style.LineString', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.LineString(
feature = new _ol_Feature_({
geometry: new _ol_geom_LineString_(
[[-20, -15], [-2, 5], [15, -15]]
)
});
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({
feature.setStyle(new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: '#000000',
width: 2,
lineCap: 'square',

View File

@@ -1,14 +1,12 @@
goog.require('ol.Feature');
goog.require('ol.geom.Polygon');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Fill');
goog.require('ol.style.Style');
goog.require('ol.style.Stroke');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
describe('ol.rendering.style.Polygon', function() {
@@ -18,17 +16,17 @@ describe('ol.rendering.style.Polygon', function() {
function createMap(renderer, opt_size) {
var size = opt_size || 50;
vectorSource = new ol.source.Vector();
var vectorLayer = new ol.layer.Vector({
vectorSource = new _ol_source_Vector_();
var vectorLayer = new _ol_layer_Vector_({
source: vectorSource
});
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(size, size),
renderer: renderer,
layers: [vectorLayer],
view: new ol.View({
view: new _ol_View_({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
@@ -46,43 +44,43 @@ describe('ol.rendering.style.Polygon', function() {
describe('different types', function() {
function createFeatures() {
var fill = new ol.style.Fill({color: 'red'});
var fill = new _ol_style_Fill_({color: 'red'});
var feature;
// rectangle
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
])
});
feature.setStyle(new ol.style.Style({
feature.setStyle(new _ol_style_Style_({
fill: fill
}));
vectorSource.addFeature(feature);
// rectangle with 1 hole
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]],
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
])
});
feature.setStyle(new ol.style.Style({
feature.setStyle(new _ol_style_Style_({
fill: fill
}));
vectorSource.addFeature(feature);
// rectangle with 2 holes
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]],
[[-18, -18], [-12, -18], [-12, -12], [-18, -12], [-18, -18]],
[[5, -18], [12, -18], [12, -12], [5, -12], [5, -18]]
])
});
feature.setStyle(new ol.style.Style({
feature.setStyle(new _ol_style_Style_({
fill: fill
}));
vectorSource.addFeature(feature);
@@ -106,7 +104,7 @@ describe('ol.rendering.style.Polygon', function() {
describe('different types with stroke', function() {
function createFeatures() {
var stroke = new ol.style.Stroke({
var stroke = new _ol_style_Stroke_({
width: 10,
color: '#000',
lineJoin: 'round',
@@ -115,39 +113,39 @@ describe('ol.rendering.style.Polygon', function() {
var feature;
// rectangle
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
])
});
feature.setStyle(new ol.style.Style({
feature.setStyle(new _ol_style_Style_({
stroke: stroke
}));
vectorSource.addFeature(feature);
// rectangle with 1 hole
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[0, 10], [0, 20], [20, 20], [20, 10], [0, 10]],
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
])
});
feature.setStyle(new ol.style.Style({
feature.setStyle(new _ol_style_Style_({
stroke: stroke
}));
vectorSource.addFeature(feature);
// rectangle with 2 holes
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, -20], [-20, 5], [20, 5], [20, -20], [-20, -20]],
[[-12, -3], [-12, -12], [-8, -12], [-8, -3], [-12, -3]],
[[0, -12], [13, -12], [13, -3], [0, -3], [0, -12]]
])
});
feature.setStyle(new ol.style.Style({
feature.setStyle(new _ol_style_Style_({
stroke: stroke
}));
vectorSource.addFeature(feature);
@@ -175,37 +173,37 @@ describe('ol.rendering.style.Polygon', function() {
function createFeatures() {
var feature;
// rectangle with z-index 2
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, 10], [-20, 20], [-0, 20], [-0, 10], [-20, 10]]
])
});
feature.setStyle(new ol.style.Style({
fill: new ol.style.Fill({color: '#E31E10'}),
feature.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({color: '#E31E10'}),
zIndex: 2
}));
vectorSource.addFeature(feature);
// rectangle with z-index 3
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-15, 5], [-15, 15], [5, 15], [5, 5], [-15, 5]]
])
});
feature.setStyle(new ol.style.Style({
fill: new ol.style.Fill({color: '#1A5E42'}),
feature.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({color: '#1A5E42'}),
zIndex: 3
}));
vectorSource.addFeature(feature);
// rectangle with z-index 1
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-10, 0], [-10, 10], [10, 10], [10, 0], [-10, 0]]
])
});
feature.setStyle(new ol.style.Style({
fill: new ol.style.Fill({color: '#DEDE21'}),
feature.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({color: '#DEDE21'}),
zIndex: 1
}));
vectorSource.addFeature(feature);
@@ -232,38 +230,38 @@ describe('ol.rendering.style.Polygon', function() {
function createFeatures() {
var feature;
// rectangle
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
])
});
feature.setStyle(new ol.style.Style({
fill: new ol.style.Fill({color: '#9696EB'}),
stroke: new ol.style.Stroke({color: '#9696EB', width: 1})
feature.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({color: '#9696EB'}),
stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1})
}));
vectorSource.addFeature(feature);
// rectangle with 1 hole
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]]
])
});
feature.setStyle(new ol.style.Style({
fill: new ol.style.Fill({color: 'rgba(255, 0, 0, 0.1)'}),
stroke: new ol.style.Stroke({color: '#DE213A', width: 3})
feature.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.1)'}),
stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3})
}));
vectorSource.addFeature(feature);
// rectangle with 2 holes
feature = new ol.Feature({
geometry: new ol.geom.Polygon([
feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]]
])
});
feature.setStyle(new ol.style.Style({
fill: new ol.style.Fill({color: 'rgba(18, 204, 105, 0.3)'}),
stroke: new ol.style.Stroke({color: '#032E17', width: 2})
feature.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({color: 'rgba(18, 204, 105, 0.3)'}),
stroke: new _ol_style_Stroke_({color: '#032E17', width: 2})
}));
vectorSource.addFeature(feature);
}
@@ -318,14 +316,14 @@ describe('ol.rendering.style.Polygon', function() {
}
function createFeatures() {
var feature = new ol.Feature({
geometry: new ol.geom.Polygon([
var feature = new _ol_Feature_({
geometry: new _ol_geom_Polygon_([
[[-20, -20], [-20, 20], [18, 20], [-20, -20]]
])
});
feature.setStyle(new ol.style.Style({
fill: new ol.style.Fill({color: createPattern()}),
stroke: new ol.style.Stroke({color: createRainbowGradient(), width: 3})
feature.setStyle(new _ol_style_Style_({
fill: new _ol_style_Fill_({color: createPattern()}),
stroke: new _ol_style_Stroke_({color: createRainbowGradient(), width: 3})
}));
vectorSource.addFeature(feature);
}

View File

@@ -1,15 +1,13 @@
goog.require('ol.Feature');
goog.require('ol.geom.Point');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Fill');
goog.require('ol.style.RegularShape');
goog.require('ol.style.Style');
goog.require('ol.style.Stroke');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
describe('ol.rendering.style.RegularShape', function() {
@@ -17,17 +15,17 @@ describe('ol.rendering.style.RegularShape', function() {
var map, vectorSource;
function createMap(renderer) {
vectorSource = new ol.source.Vector();
var vectorLayer = new ol.layer.Vector({
vectorSource = new _ol_source_Vector_();
var vectorLayer = new _ol_layer_Vector_({
source: vectorSource
});
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: 1,
target: createMapDiv(50, 50),
renderer: renderer,
layers: [vectorLayer],
view: new ol.View({
view: new _ol_View_({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
@@ -44,12 +42,12 @@ describe('ol.rendering.style.RegularShape', function() {
function createFeatures(stroke, fill) {
var feature;
feature = new ol.Feature({
geometry: new ol.geom.Point([-15, 15])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([-15, 15])
});
// square
feature.setStyle(new ol.style.Style({
image: new ol.style.RegularShape({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_RegularShape_({
fill: fill,
stroke: stroke,
points: 4,
@@ -59,12 +57,12 @@ describe('ol.rendering.style.RegularShape', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.Point([8, 15])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([8, 15])
});
// triangle
feature.setStyle(new ol.style.Style({
image: new ol.style.RegularShape({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_RegularShape_({
fill: fill,
stroke: stroke,
points: 3,
@@ -75,12 +73,12 @@ describe('ol.rendering.style.RegularShape', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.Point([-10, -8])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([-10, -8])
});
// star
feature.setStyle(new ol.style.Style({
image: new ol.style.RegularShape({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_RegularShape_({
fill: fill,
stroke: stroke,
points: 5,
@@ -91,12 +89,12 @@ describe('ol.rendering.style.RegularShape', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.Point([12, -8])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([12, -8])
});
// cross
feature.setStyle(new ol.style.Style({
image: new ol.style.RegularShape({
feature.setStyle(new _ol_style_Style_({
image: new _ol_style_RegularShape_({
fill: fill,
stroke: stroke,
points: 4,
@@ -110,8 +108,8 @@ describe('ol.rendering.style.RegularShape', function() {
describe('#render', function() {
var stroke = new ol.style.Stroke({width: 2});
var fill = new ol.style.Fill({color: 'red'});
var stroke = new _ol_style_Stroke_({width: 2});
var fill = new _ol_style_Fill_({color: 'red'});
it('tests the canvas renderer', function(done) {
createMap('canvas');
@@ -121,7 +119,7 @@ describe('ol.rendering.style.RegularShape', function() {
it('supports lineDash', function(done) {
createMap('canvas');
createFeatures(new ol.style.Stroke({
createFeatures(new _ol_style_Stroke_({
lineDash: [10, 5]
}));
expectResemble(map, 'rendering/ol/style/expected/regularshape-canvas-linedash.png', 5, done);
@@ -129,7 +127,7 @@ describe('ol.rendering.style.RegularShape', function() {
it('supports lineDashOffset', function(done) {
createMap('canvas');
createFeatures(new ol.style.Stroke({
createFeatures(new _ol_style_Stroke_({
lineDash: [10, 5],
lineDashOffset: 5
}));
@@ -145,8 +143,8 @@ describe('ol.rendering.style.RegularShape', function() {
});
describe('uses the default fill and stroke color', function() {
var stroke = new ol.style.Stroke();
var fill = new ol.style.Fill();
var stroke = new _ol_style_Stroke_();
var fill = new _ol_style_Fill_();
it('tests the canvas renderer', function(done) {
createMap('canvas');

View File

@@ -1,17 +1,17 @@
goog.require('ol.Feature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Text');
goog.require('ol.style.Fill');
goog.require('ol.style.Style');
goog.require('ol.style.Stroke');
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
import _ol_geom_MultiLineString_ from '../../../../src/ol/geom/MultiLineString.js';
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
import _ol_style_Text_ from '../../../../src/ol/style/Text.js';
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
describe('ol.rendering.style.Text', function() {
@@ -19,17 +19,17 @@ describe('ol.rendering.style.Text', function() {
function createMap(renderer, opt_pixelRatio) {
var pixelRatio = opt_pixelRatio || 1;
vectorSource = new ol.source.Vector();
var vectorLayer = new ol.layer.Vector({
vectorSource = new _ol_source_Vector_();
var vectorLayer = new _ol_layer_Vector_({
source: vectorSource
});
map = new ol.Map({
map = new _ol_Map_({
pixelRatio: pixelRatio,
target: createMapDiv(200 / pixelRatio, 200 / pixelRatio),
renderer: renderer,
layers: [vectorLayer],
view: new ol.View({
view: new _ol_View_({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
@@ -49,11 +49,11 @@ describe('ol.rendering.style.Text', function() {
function createFeatures(opt_scale) {
var scale = opt_scale || 1;
var feature;
feature = new ol.Feature({
geometry: new ol.geom.Point([-20, 18])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([-20, 18])
});
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
scale: scale,
text: 'hello',
font: '10px sans-serif'
@@ -61,18 +61,18 @@ describe('ol.rendering.style.Text', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.Point([-10, 0])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([-10, 0])
});
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
scale: scale,
text: 'hello',
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'red',
font: '12px sans-serif'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: '#000',
width: 3
})
@@ -80,16 +80,16 @@ describe('ol.rendering.style.Text', function() {
}));
vectorSource.addFeature(feature);
feature = new ol.Feature({
geometry: new ol.geom.Point([20, 10])
feature = new _ol_Feature_({
geometry: new _ol_geom_Point_([20, 10])
});
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
scale: scale,
rotateWithView: true,
text: 'hello',
font: '10px sans-serif',
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: [10, 10, 10, 0.5]
})
})
@@ -105,32 +105,32 @@ describe('ol.rendering.style.Text', function() {
var polygon = [151, 17, 163, 22, 159, 30, 150, 30, 143, 24, 151, 17];
function createLineString(coords, textAlign, maxAngle, strokeColor, strokeWidth, scale) {
var geom = new ol.geom.LineString();
var geom = new _ol_geom_LineString_();
geom.setFlatCoordinates('XY', coords);
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
var style = new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: 'red'
}),
text: new ol.style.Text({
text: new _ol_style_Text_({
text: 'Hello world',
font: 'bold 14px sans-serif',
scale: scale || 1,
textAlign: textAlign,
maxAngle: maxAngle,
placement: 'line',
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: strokeColor || 'white',
width: strokeWidth
})
})
});
var feature = new ol.Feature(geom);
var feature = new _ol_Feature_(geom);
feature.setStyle(style);
vectorSource.addFeature(feature);
geom = geom.clone();
geom.translate(0, 5);
feature = new ol.Feature(geom);
feature = new _ol_Feature_(geom);
style = style.clone();
style.getText().setTextBaseline('top');
feature.setStyle(style);
@@ -138,7 +138,7 @@ describe('ol.rendering.style.Text', function() {
geom = geom.clone();
geom.translate(0, -10);
feature = new ol.Feature(geom);
feature = new _ol_Feature_(geom);
style = style.clone();
style.getText().setTextBaseline('bottom');
feature.setStyle(style);
@@ -175,36 +175,36 @@ describe('ol.rendering.style.Text', function() {
it('renders multiline text with alignment options', function(done) {
createMap('canvas');
var feature;
feature = new ol.Feature(new ol.geom.Point([25, 0]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([25, 0]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world\nleft',
font: 'bold 14px sans-serif',
textAlign: 'left'
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature(new ol.geom.Point([-25, 0]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([-25, 0]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world\nright',
font: 'bold 14px sans-serif',
textAlign: 'right'
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature(new ol.geom.Point([0, 25]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([0, 25]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world\nbottom',
font: 'bold 14px sans-serif',
textBaseline: 'bottom'
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature(new ol.geom.Point([0, -25]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([0, -25]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'top\nHello world',
font: 'bold 14px sans-serif',
textBaseline: 'top'
@@ -217,9 +217,9 @@ describe('ol.rendering.style.Text', function() {
it('renders multiline text with positioning options', function(done) {
createMap('canvas');
var feature;
feature = new ol.Feature(new ol.geom.Point([0, 0]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([0, 0]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world\nleft',
font: 'bold 14px sans-serif',
textAlign: 'left',
@@ -227,9 +227,9 @@ describe('ol.rendering.style.Text', function() {
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature(new ol.geom.Point([0, 0]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([0, 0]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world\nright',
font: 'bold 14px sans-serif',
textAlign: 'right',
@@ -237,9 +237,9 @@ describe('ol.rendering.style.Text', function() {
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature(new ol.geom.Point([0, 0]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([0, 0]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world\nbottom',
font: 'bold 14px sans-serif',
textBaseline: 'bottom',
@@ -247,9 +247,9 @@ describe('ol.rendering.style.Text', function() {
})
}));
vectorSource.addFeature(feature);
feature = new ol.Feature(new ol.geom.Point([0, 0]));
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
feature = new _ol_Feature_(new _ol_geom_Point_([0, 0]));
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'top\nHello world',
font: 'bold 14px sans-serif',
textBaseline: 'top',
@@ -262,9 +262,9 @@ describe('ol.rendering.style.Text', function() {
it('renders text along a MultiLineString', function(done) {
createMap('canvas');
var line = new ol.geom.LineString();
var line = new _ol_geom_LineString_();
line.setFlatCoordinates('XY', nicePath);
var geom = new ol.geom.MultiLineString(null);
var geom = new _ol_geom_MultiLineString_(null);
geom.appendLineString(line);
line = line.clone();
line.translate(0, 50);
@@ -272,9 +272,9 @@ describe('ol.rendering.style.Text', function() {
line = line.clone();
line.translate(0, -100);
geom.appendLineString(line);
var feature = new ol.Feature(geom);
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
var feature = new _ol_Feature_(geom);
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world',
placement: 'line',
font: 'bold 30px sans-serif'
@@ -287,11 +287,11 @@ describe('ol.rendering.style.Text', function() {
it('renders text along a Polygon', function(done) {
createMap('canvas');
var geom = new ol.geom.Polygon(null);
var geom = new _ol_geom_Polygon_(null);
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
var feature = new ol.Feature(geom);
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
var feature = new _ol_Feature_(geom);
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world',
font: 'bold 24px sans-serif',
placement: 'line',
@@ -305,9 +305,9 @@ describe('ol.rendering.style.Text', function() {
it('renders text along a MultiPolygon', function(done) {
createMap('canvas');
var geom = new ol.geom.Polygon(null);
var geom = new _ol_geom_Polygon_(null);
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
var multiPolygon = new ol.geom.MultiPolygon(null);
var multiPolygon = new _ol_geom_MultiPolygon_(null);
multiPolygon.appendPolygon(geom);
geom = geom.clone();
geom.translate(0, 30);
@@ -315,9 +315,9 @@ describe('ol.rendering.style.Text', function() {
geom = geom.clone();
geom.translate(0, -60);
multiPolygon.appendPolygon(geom);
var feature = new ol.Feature(multiPolygon);
feature.setStyle(new ol.style.Style({
text: new ol.style.Text({
var feature = new _ol_Feature_(multiPolygon);
feature.setStyle(new _ol_style_Style_({
text: new _ol_style_Text_({
text: 'Hello world',
font: 'bold 24px sans-serif',
placement: 'line',
@@ -333,20 +333,20 @@ describe('ol.rendering.style.Text', function() {
createMap('canvas');
createFeatures();
var features = vectorSource.getFeatures();
features[0].getStyle().getText().setBackgroundFill(new ol.style.Fill({
features[0].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({
color: 'red'
}));
features[1].getStyle().getText().setBackgroundFill(new ol.style.Fill({
features[1].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({
color: 'red'
}));
features[1].getStyle().getText().setBackgroundStroke(new ol.style.Stroke({
features[1].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({
color: 'blue',
width: 3
}));
features[2].getStyle().getText().setBackgroundFill(new ol.style.Fill({
features[2].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({
color: 'red'
}));
features[2].getStyle().getText().setBackgroundStroke(new ol.style.Stroke({
features[2].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({
color: 'blue',
width: 3
}));