Rename _ol_style_RegularShape_ to RegularShape
This commit is contained in:
@@ -11,7 +11,7 @@ import Stamen from '../src/ol/source/Stamen.js';
|
|||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
||||||
import Fill from '../src/ol/style/Fill.js';
|
import Fill from '../src/ol/style/Fill.js';
|
||||||
import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js';
|
import RegularShape from '../src/ol/style/RegularShape.js';
|
||||||
import Stroke from '../src/ol/style/Stroke.js';
|
import Stroke from '../src/ol/style/Stroke.js';
|
||||||
import Style from '../src/ol/style/Style.js';
|
import Style from '../src/ol/style/Style.js';
|
||||||
import Text from '../src/ol/style/Text.js';
|
import Text from '../src/ol/style/Text.js';
|
||||||
@@ -45,7 +45,7 @@ function createEarthquakeStyle(feature) {
|
|||||||
|
|
||||||
return new Style({
|
return new Style({
|
||||||
geometry: feature.getGeometry(),
|
geometry: feature.getGeometry(),
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
radius1: radius,
|
radius1: radius,
|
||||||
radius2: 3,
|
radius2: 3,
|
||||||
points: 5,
|
points: 5,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Point from '../src/ol/geom/Point.js';
|
|||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import Fill from '../src/ol/style/Fill.js';
|
import Fill from '../src/ol/style/Fill.js';
|
||||||
import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js';
|
import RegularShape from '../src/ol/style/RegularShape.js';
|
||||||
import Stroke from '../src/ol/style/Stroke.js';
|
import Stroke from '../src/ol/style/Stroke.js';
|
||||||
import Style from '../src/ol/style/Style.js';
|
import Style from '../src/ol/style/Style.js';
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ var stroke = new Stroke({color: 'black', width: 1});
|
|||||||
|
|
||||||
var styles = {
|
var styles = {
|
||||||
'square': new Style({
|
'square': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: new Fill({color: 'blue'}),
|
fill: new Fill({color: 'blue'}),
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 4,
|
points: 4,
|
||||||
@@ -23,7 +23,7 @@ var styles = {
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
'triangle': new Style({
|
'triangle': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: new Fill({color: 'red'}),
|
fill: new Fill({color: 'red'}),
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 3,
|
points: 3,
|
||||||
@@ -33,7 +33,7 @@ var styles = {
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
'star': new Style({
|
'star': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: new Fill({color: 'green'}),
|
fill: new Fill({color: 'green'}),
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 5,
|
points: 5,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Point from '../src/ol/geom/Point.js';
|
|||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import Fill from '../src/ol/style/Fill.js';
|
import Fill from '../src/ol/style/Fill.js';
|
||||||
import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js';
|
import RegularShape from '../src/ol/style/RegularShape.js';
|
||||||
import Stroke from '../src/ol/style/Stroke.js';
|
import Stroke from '../src/ol/style/Stroke.js';
|
||||||
import Style from '../src/ol/style/Style.js';
|
import Style from '../src/ol/style/Style.js';
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ var fill = new Fill({color: 'red'});
|
|||||||
|
|
||||||
var styles = {
|
var styles = {
|
||||||
'square': new Style({
|
'square': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 4,
|
points: 4,
|
||||||
@@ -24,7 +24,7 @@ var styles = {
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
'triangle': new Style({
|
'triangle': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 3,
|
points: 3,
|
||||||
@@ -34,7 +34,7 @@ var styles = {
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
'star': new Style({
|
'star': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 5,
|
points: 5,
|
||||||
@@ -44,7 +44,7 @@ var styles = {
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
'cross': new Style({
|
'cross': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 4,
|
points: 4,
|
||||||
@@ -54,7 +54,7 @@ var styles = {
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
'x': new Style({
|
'x': new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 4,
|
points: 4,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import VectorSource from '../src/ol/source/Vector.js';
|
|||||||
import AtlasManager from '../src/ol/style/AtlasManager.js';
|
import AtlasManager from '../src/ol/style/AtlasManager.js';
|
||||||
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
||||||
import Fill from '../src/ol/style/Fill.js';
|
import Fill from '../src/ol/style/Fill.js';
|
||||||
import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js';
|
import RegularShape from '../src/ol/style/RegularShape.js';
|
||||||
import Stroke from '../src/ol/style/Stroke.js';
|
import Stroke from '../src/ol/style/Stroke.js';
|
||||||
import Style from '../src/ol/style/Style.js';
|
import Style from '../src/ol/style/Style.js';
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ for (i = 0; i < symbolInfo.length; ++i) {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// star symbol
|
// star symbol
|
||||||
symbols.push(new _ol_style_RegularShape_({
|
symbols.push(new RegularShape({
|
||||||
points: 8,
|
points: 8,
|
||||||
opacity: info.opacity,
|
opacity: info.opacity,
|
||||||
scale: info.scale,
|
scale: info.scale,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/style/Circle
|
* @module ol/style/Circle
|
||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_style_RegularShape_ from '../style/RegularShape.js';
|
import RegularShape from '../style/RegularShape.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
@@ -17,7 +17,7 @@ var _ol_style_Circle_ = function(opt_options) {
|
|||||||
|
|
||||||
var options = opt_options || {};
|
var options = opt_options || {};
|
||||||
|
|
||||||
_ol_style_RegularShape_.call(this, {
|
RegularShape.call(this, {
|
||||||
points: Infinity,
|
points: Infinity,
|
||||||
fill: options.fill,
|
fill: options.fill,
|
||||||
radius: options.radius,
|
radius: options.radius,
|
||||||
@@ -28,7 +28,7 @@ var _ol_style_Circle_ = function(opt_options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_style_Circle_, _ol_style_RegularShape_);
|
inherits(_ol_style_Circle_, RegularShape);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import _ol_style_Image_ from '../style/Image.js';
|
|||||||
* @extends {ol.style.Image}
|
* @extends {ol.style.Image}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_style_RegularShape_ = function(options) {
|
var RegularShape = function(options) {
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<string>}
|
* @type {Array.<string>}
|
||||||
@@ -135,7 +135,7 @@ var _ol_style_RegularShape_ = function(options) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_style_RegularShape_, _ol_style_Image_);
|
inherits(RegularShape, _ol_style_Image_);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,8 +143,8 @@ inherits(_ol_style_RegularShape_, _ol_style_Image_);
|
|||||||
* @return {ol.style.RegularShape} The cloned style.
|
* @return {ol.style.RegularShape} The cloned style.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.clone = function() {
|
RegularShape.prototype.clone = function() {
|
||||||
var style = new _ol_style_RegularShape_({
|
var style = new RegularShape({
|
||||||
fill: this.getFill() ? this.getFill().clone() : undefined,
|
fill: this.getFill() ? this.getFill().clone() : undefined,
|
||||||
points: this.getPoints(),
|
points: this.getPoints(),
|
||||||
radius: this.getRadius(),
|
radius: this.getRadius(),
|
||||||
@@ -166,7 +166,7 @@ _ol_style_RegularShape_.prototype.clone = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getAnchor = function() {
|
RegularShape.prototype.getAnchor = function() {
|
||||||
return this.anchor_;
|
return this.anchor_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ _ol_style_RegularShape_.prototype.getAnchor = function() {
|
|||||||
* @return {number} Shape's rotation in radians.
|
* @return {number} Shape's rotation in radians.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getAngle = function() {
|
RegularShape.prototype.getAngle = function() {
|
||||||
return this.angle_;
|
return this.angle_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ _ol_style_RegularShape_.prototype.getAngle = function() {
|
|||||||
* @return {ol.style.Fill} Fill style.
|
* @return {ol.style.Fill} Fill style.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getFill = function() {
|
RegularShape.prototype.getFill = function() {
|
||||||
return this.fill_;
|
return this.fill_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ _ol_style_RegularShape_.prototype.getFill = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getHitDetectionImage = function(pixelRatio) {
|
RegularShape.prototype.getHitDetectionImage = function(pixelRatio) {
|
||||||
return this.hitDetectionCanvas_;
|
return this.hitDetectionCanvas_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImage = function(pixelRatio) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getImage = function(pixelRatio) {
|
RegularShape.prototype.getImage = function(pixelRatio) {
|
||||||
return this.canvas_;
|
return this.canvas_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ _ol_style_RegularShape_.prototype.getImage = function(pixelRatio) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getImageSize = function() {
|
RegularShape.prototype.getImageSize = function() {
|
||||||
return this.imageSize_;
|
return this.imageSize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ _ol_style_RegularShape_.prototype.getImageSize = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() {
|
RegularShape.prototype.getHitDetectionImageSize = function() {
|
||||||
return this.hitDetectionImageSize_;
|
return this.hitDetectionImageSize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getImageState = function() {
|
RegularShape.prototype.getImageState = function() {
|
||||||
return ImageState.LOADED;
|
return ImageState.LOADED;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ _ol_style_RegularShape_.prototype.getImageState = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getOrigin = function() {
|
RegularShape.prototype.getOrigin = function() {
|
||||||
return this.origin_;
|
return this.origin_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ _ol_style_RegularShape_.prototype.getOrigin = function() {
|
|||||||
* @return {number} Number of points for stars and regular polygons.
|
* @return {number} Number of points for stars and regular polygons.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getPoints = function() {
|
RegularShape.prototype.getPoints = function() {
|
||||||
return this.points_;
|
return this.points_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ _ol_style_RegularShape_.prototype.getPoints = function() {
|
|||||||
* @return {number} Radius.
|
* @return {number} Radius.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getRadius = function() {
|
RegularShape.prototype.getRadius = function() {
|
||||||
return this.radius_;
|
return this.radius_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ _ol_style_RegularShape_.prototype.getRadius = function() {
|
|||||||
* @return {number|undefined} Radius2.
|
* @return {number|undefined} Radius2.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getRadius2 = function() {
|
RegularShape.prototype.getRadius2 = function() {
|
||||||
return this.radius2_;
|
return this.radius2_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ _ol_style_RegularShape_.prototype.getRadius2 = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getSize = function() {
|
RegularShape.prototype.getSize = function() {
|
||||||
return this.size_;
|
return this.size_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ _ol_style_RegularShape_.prototype.getSize = function() {
|
|||||||
* @return {ol.style.Stroke} Stroke style.
|
* @return {ol.style.Stroke} Stroke style.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getStroke = function() {
|
RegularShape.prototype.getStroke = function() {
|
||||||
return this.stroke_;
|
return this.stroke_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -293,26 +293,26 @@ _ol_style_RegularShape_.prototype.getStroke = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.listenImageChange = function(listener, thisArg) {};
|
RegularShape.prototype.listenImageChange = function(listener, thisArg) {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.load = function() {};
|
RegularShape.prototype.load = function() {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.unlistenImageChange = function(listener, thisArg) {};
|
RegularShape.prototype.unlistenImageChange = function(listener, thisArg) {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @param {ol.style.AtlasManager|undefined} atlasManager An atlas manager.
|
* @param {ol.style.AtlasManager|undefined} atlasManager An atlas manager.
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.render_ = function(atlasManager) {
|
RegularShape.prototype.render_ = function(atlasManager) {
|
||||||
var imageSize;
|
var imageSize;
|
||||||
var lineCap = '';
|
var lineCap = '';
|
||||||
var lineJoin = '';
|
var lineJoin = '';
|
||||||
@@ -422,7 +422,7 @@ _ol_style_RegularShape_.prototype.render_ = function(atlasManager) {
|
|||||||
* @param {number} x The origin for the symbol (x).
|
* @param {number} x The origin for the symbol (x).
|
||||||
* @param {number} y The origin for the symbol (y).
|
* @param {number} y The origin for the symbol (y).
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.draw_ = function(renderOptions, context, x, y) {
|
RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
|
||||||
var i, angle0, radiusC;
|
var i, angle0, radiusC;
|
||||||
// reset transform
|
// reset transform
|
||||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
@@ -480,7 +480,7 @@ _ol_style_RegularShape_.prototype.draw_ = function(renderOptions, context, x, y)
|
|||||||
* @private
|
* @private
|
||||||
* @param {ol.RegularShapeRenderOptions} renderOptions Render options.
|
* @param {ol.RegularShapeRenderOptions} renderOptions Render options.
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.createHitDetectionCanvas_ = function(renderOptions) {
|
RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptions) {
|
||||||
this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];
|
this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];
|
||||||
if (this.fill_) {
|
if (this.fill_) {
|
||||||
this.hitDetectionCanvas_ = this.canvas_;
|
this.hitDetectionCanvas_ = this.canvas_;
|
||||||
@@ -503,7 +503,7 @@ _ol_style_RegularShape_.prototype.createHitDetectionCanvas_ = function(renderOpt
|
|||||||
* @param {number} x The origin for the symbol (x).
|
* @param {number} x The origin for the symbol (x).
|
||||||
* @param {number} y The origin for the symbol (y).
|
* @param {number} y The origin for the symbol (y).
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) {
|
RegularShape.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) {
|
||||||
// reset transform
|
// reset transform
|
||||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
|
|
||||||
@@ -550,7 +550,7 @@ _ol_style_RegularShape_.prototype.drawHitDetectionCanvas_ = function(renderOptio
|
|||||||
/**
|
/**
|
||||||
* @return {string} The checksum.
|
* @return {string} The checksum.
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getChecksum = function() {
|
RegularShape.prototype.getChecksum = function() {
|
||||||
var strokeChecksum = this.stroke_ ?
|
var strokeChecksum = this.stroke_ ?
|
||||||
this.stroke_.getChecksum() : '-';
|
this.stroke_.getChecksum() : '-';
|
||||||
var fillChecksum = this.fill_ ?
|
var fillChecksum = this.fill_ ?
|
||||||
@@ -576,4 +576,4 @@ _ol_style_RegularShape_.prototype.getChecksum = function() {
|
|||||||
|
|
||||||
return this.checksums_[0];
|
return this.checksums_[0];
|
||||||
};
|
};
|
||||||
export default _ol_style_RegularShape_;
|
export default RegularShape;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import View from '../../../../src/ol/View.js';
|
|||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
import Fill from '../../../../src/ol/style/Fill.js';
|
import Fill from '../../../../src/ol/style/Fill.js';
|
||||||
import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js';
|
import RegularShape from '../../../../src/ol/style/RegularShape.js';
|
||||||
import Style from '../../../../src/ol/style/Style.js';
|
import Style from '../../../../src/ol/style/Style.js';
|
||||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
// square
|
// square
|
||||||
feature.setStyle(new Style({
|
feature.setStyle(new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 4,
|
points: 4,
|
||||||
@@ -62,7 +62,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
// triangle
|
// triangle
|
||||||
feature.setStyle(new Style({
|
feature.setStyle(new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 3,
|
points: 3,
|
||||||
@@ -78,7 +78,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
// star
|
// star
|
||||||
feature.setStyle(new Style({
|
feature.setStyle(new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 5,
|
points: 5,
|
||||||
@@ -94,7 +94,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
// cross
|
// cross
|
||||||
feature.setStyle(new Style({
|
feature.setStyle(new Style({
|
||||||
image: new _ol_style_RegularShape_({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 4,
|
points: 4,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import AtlasManager from '../../../../src/ol/style/AtlasManager.js';
|
import AtlasManager from '../../../../src/ol/style/AtlasManager.js';
|
||||||
import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js';
|
import RegularShape from '../../../../src/ol/style/RegularShape.js';
|
||||||
import Fill from '../../../../src/ol/style/Fill.js';
|
import Fill from '../../../../src/ol/style/Fill.js';
|
||||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
describe('#constructor', function() {
|
describe('#constructor', function() {
|
||||||
|
|
||||||
it('can use rotateWithView', function() {
|
it('can use rotateWithView', function() {
|
||||||
var style = new _ol_style_RegularShape_({
|
var style = new RegularShape({
|
||||||
rotateWithView: true,
|
rotateWithView: true,
|
||||||
radius: 0
|
radius: 0
|
||||||
});
|
});
|
||||||
@@ -17,7 +17,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can use radius', function() {
|
it('can use radius', function() {
|
||||||
var style = new _ol_style_RegularShape_({
|
var style = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
radius2: 10
|
radius2: 10
|
||||||
});
|
});
|
||||||
@@ -26,7 +26,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can use radius1 as an alias for radius', function() {
|
it('can use radius1 as an alias for radius', function() {
|
||||||
var style = new _ol_style_RegularShape_({
|
var style = new RegularShape({
|
||||||
radius1: 5,
|
radius1: 5,
|
||||||
radius2: 10
|
radius2: 10
|
||||||
});
|
});
|
||||||
@@ -35,7 +35,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('creates a canvas if no atlas is used (no fill-style)', function() {
|
it('creates a canvas if no atlas is used (no fill-style)', function() {
|
||||||
var style = new _ol_style_RegularShape_({radius: 10});
|
var style = new RegularShape({radius: 10});
|
||||||
expect(style.getImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getSize()).to.eql([21, 21]);
|
expect(style.getSize()).to.eql([21, 21]);
|
||||||
expect(style.getImageSize()).to.eql([21, 21]);
|
expect(style.getImageSize()).to.eql([21, 21]);
|
||||||
@@ -48,7 +48,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('creates a canvas if no atlas is used (fill-style)', function() {
|
it('creates a canvas if no atlas is used (fill-style)', function() {
|
||||||
var style = new _ol_style_RegularShape_({
|
var style = new RegularShape({
|
||||||
radius: 10,
|
radius: 10,
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#FFFF00'
|
color: '#FFFF00'
|
||||||
@@ -67,7 +67,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
|
|
||||||
it('adds itself to an atlas manager (no fill-style)', function() {
|
it('adds itself to an atlas manager (no fill-style)', function() {
|
||||||
var atlasManager = new AtlasManager({initialSize: 512});
|
var atlasManager = new AtlasManager({initialSize: 512});
|
||||||
var style = new _ol_style_RegularShape_(
|
var style = new RegularShape(
|
||||||
{radius: 10, atlasManager: atlasManager});
|
{radius: 10, atlasManager: atlasManager});
|
||||||
expect(style.getImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getSize()).to.eql([21, 21]);
|
expect(style.getSize()).to.eql([21, 21]);
|
||||||
@@ -82,7 +82,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
|
|
||||||
it('adds itself to an atlas manager (fill-style)', function() {
|
it('adds itself to an atlas manager (fill-style)', function() {
|
||||||
var atlasManager = new AtlasManager({initialSize: 512});
|
var atlasManager = new AtlasManager({initialSize: 512});
|
||||||
var style = new _ol_style_RegularShape_({
|
var style = new RegularShape({
|
||||||
radius: 10,
|
radius: 10,
|
||||||
atlasManager: atlasManager,
|
atlasManager: atlasManager,
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
@@ -104,16 +104,16 @@ describe('ol.style.RegularShape', function() {
|
|||||||
describe('#clone', function() {
|
describe('#clone', function() {
|
||||||
|
|
||||||
it('creates a new ol.style.RegularShape', function() {
|
it('creates a new ol.style.RegularShape', function() {
|
||||||
var original = new _ol_style_RegularShape_({
|
var original = new RegularShape({
|
||||||
points: 5
|
points: 5
|
||||||
});
|
});
|
||||||
var clone = original.clone();
|
var clone = original.clone();
|
||||||
expect(clone).to.be.an(_ol_style_RegularShape_);
|
expect(clone).to.be.an(RegularShape);
|
||||||
expect(clone).to.not.be(original);
|
expect(clone).to.not.be(original);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('copies all values', function() {
|
it('copies all values', function() {
|
||||||
var original = new _ol_style_RegularShape_({
|
var original = new RegularShape({
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
}),
|
}),
|
||||||
@@ -145,7 +145,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('the clone does not reference the same objects as the original', function() {
|
it('the clone does not reference the same objects as the original', function() {
|
||||||
var original = new _ol_style_RegularShape_({
|
var original = new RegularShape({
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
}),
|
}),
|
||||||
@@ -168,11 +168,11 @@ describe('ol.style.RegularShape', function() {
|
|||||||
describe('#getChecksum', function() {
|
describe('#getChecksum', function() {
|
||||||
|
|
||||||
it('calculates not the same hash code (radius)', function() {
|
it('calculates not the same hash code (radius)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 4,
|
radius: 4,
|
||||||
radius2: 5
|
radius2: 5
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 3,
|
radius: 3,
|
||||||
radius2: 5
|
radius2: 5
|
||||||
});
|
});
|
||||||
@@ -180,11 +180,11 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('calculates not the same hash code (radius2)', function() {
|
it('calculates not the same hash code (radius2)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 4,
|
radius: 4,
|
||||||
radius2: 5
|
radius2: 5
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 4,
|
radius: 4,
|
||||||
radius2: 6
|
radius2: 6
|
||||||
});
|
});
|
||||||
@@ -192,23 +192,23 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('calculates the same hash code (radius)', function() {
|
it('calculates the same hash code (radius)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 5
|
radius: 5
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 5
|
radius: 5
|
||||||
});
|
});
|
||||||
expect(style1.getChecksum()).to.eql(style2.getChecksum());
|
expect(style1.getChecksum()).to.eql(style2.getChecksum());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calculates not the same hash code (color)', function() {
|
it('calculates not the same hash code (color)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
@@ -218,7 +218,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('calculates the same hash code (everything set)', function() {
|
it('calculates the same hash code (everything set)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
radius2: 3,
|
radius2: 3,
|
||||||
angle: 1.41,
|
angle: 1.41,
|
||||||
@@ -235,7 +235,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
width: 2
|
width: 2
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
radius2: 3,
|
radius2: 3,
|
||||||
angle: 1.41,
|
angle: 1.41,
|
||||||
@@ -256,7 +256,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('calculates not the same hash code (stroke width differs)', function() {
|
it('calculates not the same hash code (stroke width differs)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
radius2: 3,
|
radius2: 3,
|
||||||
angle: 1.41,
|
angle: 1.41,
|
||||||
@@ -273,7 +273,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
width: 3
|
width: 3
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
radius2: 3,
|
radius2: 3,
|
||||||
angle: 1.41,
|
angle: 1.41,
|
||||||
@@ -294,7 +294,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('invalidates a cached checksum if values change (fill)', function() {
|
it('invalidates a cached checksum if values change (fill)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
@@ -303,7 +303,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
@@ -319,7 +319,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('invalidates a cached checksum if values change (stroke)', function() {
|
it('invalidates a cached checksum if values change (stroke)', function() {
|
||||||
var style1 = new _ol_style_RegularShape_({
|
var style1 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
@@ -328,7 +328,7 @@ describe('ol.style.RegularShape', function() {
|
|||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
var style2 = new _ol_style_RegularShape_({
|
var style2 = new RegularShape({
|
||||||
radius: 5,
|
radius: 5,
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: '#319FD3'
|
color: '#319FD3'
|
||||||
|
|||||||
Reference in New Issue
Block a user