Transformed
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user