Permalink
Browse files

Vector related exports

  • Loading branch information...
1 parent 12bee31 commit e1c3faa53ecb34c8d315e8d017f61ef3c4ebbc34 @tschaub tschaub committed Mar 5, 2013
View
@@ -113,6 +113,11 @@
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.url string|undefined
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.version string|undefined
+@exportObjectLiteral ol.source.SourceOptions
+@exportObjectLiteralProperty ol.source.SourceOptions.attributions Array.<ol.Attribution>|undefined
+@exportObjectLiteralProperty ol.source.SourceOptions.extent ol.Extent|undefined
+@exportObjectLiteralProperty ol.source.SourceOptions.projection ol.Projection|undefined
+
@exportObjectLiteral ol.source.StamenOptions
@exportObjectLiteralProperty ol.source.StamenOptions.flavor string|undefined
@exportObjectLiteralProperty ol.source.StamenOptions.provider string
@@ -139,6 +144,32 @@
@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined
@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.<string>|undefined
+@exportObjectLiteral ol.style.LineOptions
+@exportObjectLiteralProperty ol.style.LineOptions.strokeStyle string|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.LineOptions.strokeWidth number|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.LineOptions.opacity number|ol.Expression|undefined
+
+@exportObjectLiteral ol.style.PolygonOptions
+@exportObjectLiteralProperty ol.style.PolygonOptions.fillStyle string|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.PolygonOptions.strokeStyle string|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.PolygonOptions.strokeWidth number|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.PolygonOptions.opacity number|ol.Expression|undefined
+
+@exportObjectLiteral ol.style.RuleOptions
+@exportObjectLiteralProperty ol.style.RuleOptions.filter ol.filter.Filter|undefined
+@exportObjectLiteralProperty ol.style.RuleOptions.symbolizers Array.<ol.style.Symbolizer>|undefined
+
+@exportObjectLiteral ol.style.ShapeOptions
+@exportObjectLiteralProperty ol.style.ShapeOptions.type ol.style.ShapeType|undefined
+@exportObjectLiteralProperty ol.style.ShapeOptions.size number|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.ShapeOptions.fillStyle string|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.ShapeOptions.strokeStyle string|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.ShapeOptions.strokeWidth number|ol.Expression|undefined
+@exportObjectLiteralProperty ol.style.ShapeOptions.opacity number|ol.Expression|undefined
+
+@exportObjectLiteral ol.style.StyleOptions
+@exportObjectLiteralProperty ol.style.StyleOptions.rules Array.<ol.style.Rule>
+
@exportObjectLiteral ol.tilegrid.TileGridOptions
@exportObjectLiteralProperty ol.tilegrid.TileGridOptions.origin ol.Coordinate|undefined
@exportObjectLiteralProperty ol.tilegrid.TileGridOptions.origins Array.<ol.Coordinate>|undefined
View
@@ -0,0 +1,6 @@
+@exportSymbol ol.Feature
+@exportProperty ol.Feature.prototype.get
+@exportProperty ol.Feature.prototype.getAttributes
+@exportProperty ol.Feature.prototype.getGeometry
+@exportProperty ol.Feature.prototype.set
+@exportProperty ol.Feature.prototype.setGeometry
@@ -0,0 +1,7 @@
+@exportSymbol ol.filter.Filter
+@exportSymbol ol.filter.Geometry
+@exportSymbol ol.filter.Logical
+
+@exportSymbol ol.filter.LogicalOperator
+@exportProperty ol.filter.LogicalOperator.AND
+@exportProperty ol.filter.LogicalOperator.OR
@@ -0,0 +1 @@
+@exportSymbol ol.Expression
@@ -0,0 +1,6 @@
+@exportSymbol ol.geom.Point
+@exportSymbol ol.geom.LineString
+@exportSymbol ol.geom.Polygon
+@exportSymbol ol.geom.MultiPoint
+@exportSymbol ol.geom.MultiLineString
+@exportSymbol ol.geom.MultiPolygon
@@ -0,0 +1,3 @@
+@exportClass ol.layer.Vector ol.layer.LayerOptions
+
+@exportProperty ol.layer.Vector.prototype.addFeatures
@@ -0,0 +1 @@
+@exportClass ol.source.Vector ol.source.SourceOptions
@@ -13,27 +13,13 @@ goog.require('ol.geom.GeometryType');
goog.require('ol.source.Source');
-/**
- * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
- * extent: (ol.Extent|undefined),
- * projection: (ol.Projection|undefined)}}
- */
-ol.source.VectorOptions;
-
-
/**
* @constructor
* @extends {ol.source.Source}
- * @param {ol.source.VectorOptions} options Source options.
+ * @param {ol.source.SourceOptions} options Source options.
*/
ol.source.Vector = function(options) {
-
- goog.base(this, {
- attributions: options.attributions,
- extent: options.extent,
- projection: options.projection
- });
-
+ goog.base(this, options);
};
goog.inherits(ol.source.Vector, ol.source.Source);
View
@@ -0,0 +1,7 @@
+@exportClass ol.style.Line ol.style.LineOptions
+@exportClass ol.style.Polygon ol.style.PolygonOptions
+@exportClass ol.style.Rule ol.style.RuleOptions
+@exportClass ol.style.Shape ol.style.ShapeOptions
+@exportClass ol.style.Style ol.style.StyleOptions
+@exportSymbol ol.style.ShapeType
+@exportProperty ol.style.ShapeType.CIRCLE
View
@@ -24,12 +24,15 @@ ol.style.LineLiteralOptions;
ol.style.LineLiteral = function(config) {
goog.base(this);
+ goog.asserts.assertString(config.strokeStyle, 'strokeStyle must be a string');
/** @type {string} */
this.strokeStyle = config.strokeStyle;
+ goog.asserts.assertNumber(config.strokeWidth, 'strokeWidth must be a number');
/** @type {number} */
this.strokeWidth = config.strokeWidth;
+ goog.asserts.assertNumber(config.opacity, 'opacity must be a number');
/** @type {number} */
this.opacity = config.opacity;
@@ -47,14 +50,6 @@ ol.style.LineLiteral.prototype.equals = function(lineLiteral) {
};
-/**
- * @typedef {{strokeStyle: (string|ol.Expression|undefined),
- * strokeWidth: (number|ol.Expression|undefined),
- * opacity: (number|ol.Expression|undefined)}}
- */
-ol.style.LineOptions;
-
-
/**
* @constructor
View
@@ -25,15 +25,19 @@ ol.style.PolygonLiteralOptions;
ol.style.PolygonLiteral = function(config) {
goog.base(this);
+ goog.asserts.assertString(config.fillStyle, 'fillStyle must be a string');
/** @type {string} */
this.fillStyle = config.fillStyle;
+ goog.asserts.assertString(config.strokeStyle, 'strokeStyle must be a string');
/** @type {string} */
this.strokeStyle = config.strokeStyle;
+ goog.asserts.assertNumber(config.strokeWidth, 'strokeWidth must be a number');
/** @type {number} */
this.strokeWidth = config.strokeWidth;
+ goog.asserts.assertNumber(config.opacity, 'opacity must be a number');
/** @type {number} */
this.opacity = config.opacity;
@@ -52,15 +56,6 @@ ol.style.PolygonLiteral.prototype.equals = function(polygonLiteral) {
};
-/**
- * @typedef {{fillStyle: (string|ol.Expression|undefined),
- * strokeStyle: (string|ol.Expression|undefined),
- * strokeWidth: (number|ol.Expression|undefined),
- * opacity: (number|ol.Expression|undefined)}}
- */
-ol.style.PolygonOptions;
-
-
/**
* @constructor
View
@@ -5,13 +5,6 @@ goog.require('ol.filter.Filter');
goog.require('ol.style.Symbolizer');
-/**
- * @typedef {{filter: (ol.filter.Filter),
- * symbolizers: (Array.<ol.style.Symbolizer>)}}
- */
-ol.style.RuleOptions;
-
-
/**
* @constructor
View
@@ -35,21 +35,27 @@ ol.style.ShapeLiteralOptions;
*/
ol.style.ShapeLiteral = function(config) {
- /** @type {string} */
+ goog.asserts.assertString(config.type, 'type must be a string');
+ /** @type {ol.style.ShapeType} */
this.type = config.type;
+ goog.asserts.assertNumber(config.size, 'size must be a number');
/** @type {number} */
this.size = config.size;
+ goog.asserts.assertString(config.fillStyle, 'fillStyle must be a string');
/** @type {string} */
this.fillStyle = config.fillStyle;
+ goog.asserts.assertString(config.strokeStyle, 'strokeStyle must be a string');
/** @type {string} */
this.strokeStyle = config.strokeStyle;
+ goog.asserts.assertNumber(config.strokeWidth, 'strokeWidth must be a number');
/** @type {number} */
this.strokeWidth = config.strokeWidth;
+ goog.asserts.assertNumber(config.opacity, 'opacity must be a number');
/** @type {number} */
this.opacity = config.opacity;
@@ -70,17 +76,6 @@ ol.style.ShapeLiteral.prototype.equals = function(shapeLiteral) {
};
-/**
- * @typedef {{type: (ol.style.ShapeType|undefined),
- * size: (number|ol.Expression|undefined),
- * fillStyle: (string|ol.Expression|undefined),
- * strokeStyle: (string|ol.Expression|undefined),
- * strokeWidth: (number|ol.Expression|undefined),
- * opacity: (number|ol.Expression|undefined)}}
- */
-ol.style.ShapeOptions;
-
-
/**
* @constructor
View
@@ -6,12 +6,6 @@ goog.require('ol.style.Rule');
goog.require('ol.style.SymbolizerLiteral');
-/**
- * @typedef {{rules: (Array.<ol.style.Rule>)}}
- */
-ol.style.StyleOptions;
-
-
/**
* @constructor
@@ -6,7 +6,7 @@ describe('ol.layer.Vector', function() {
it('allows adding features', function() {
var layer = new ol.layer.Vector({
- new ol.source.Vector({})
+ source: new ol.source.Vector({})
});
layer.addFeatures([new ol.Feature(), new ol.Feature()]);
expect(layer.getFeatures().length).toEqual(2);
@@ -7,15 +7,18 @@ describe('ol.style.LineLiteral', function() {
it('identifies equal literals', function() {
var literal = new ol.style.LineLiteral({
strokeWidth: 3,
- strokeStyle: '#BADA55'
+ strokeStyle: '#BADA55',
+ opacity: 1
});
var equalLiteral = new ol.style.LineLiteral({
strokeStyle: '#BADA55',
- strokeWidth: 3
+ strokeWidth: 3,
+ opacity: 1
});
var differentLiteral = new ol.style.LineLiteral({
strokeStyle: '#013',
- strokeWidth: 3
+ strokeWidth: 3,
+ opacity: 1
});
expect(literal.equals(equalLiteral)).toBe(true);
expect(literal.equals(differentLiteral)).toBe(false);
@@ -7,15 +7,21 @@ describe('ol.style.PolygonLiteral', function() {
it('identifies equal literals', function() {
var literal = new ol.style.PolygonLiteral({
strokeWidth: 3,
- fillStyle: '#BADA55'
+ strokeStyle: '#013',
+ fillStyle: '#BADA55',
+ opacity: 1
});
var equalLiteral = new ol.style.PolygonLiteral({
fillStyle: '#BADA55',
- strokeWidth: 3
+ strokeStyle: '#013',
+ strokeWidth: 3,
+ opacity: 1
});
var differentLiteral = new ol.style.PolygonLiteral({
fillStyle: '#013',
- strokeWidth: 3
+ strokeStyle: '#013',
+ strokeWidth: 3,
+ opacity: 1
});
expect(literal.equals(equalLiteral)).toBe(true);
expect(literal.equals(differentLiteral)).toBe(false);
@@ -6,16 +6,28 @@ describe('ol.style.ShapeLiteral', function() {
it('identifies equal literals', function() {
var literal = new ol.style.ShapeLiteral({
+ type: ol.style.ShapeType.CIRCLE,
size: 4,
- fillStyle: '#BADA55'
+ fillStyle: '#BADA55',
+ strokeStyle: '#013',
+ strokeWidth: 3,
+ opacity: 1
});
var equalLiteral = new ol.style.ShapeLiteral({
+ type: ol.style.ShapeType.CIRCLE,
+ size: 4,
fillStyle: '#BADA55',
- size: 4
+ strokeStyle: '#013',
+ strokeWidth: 3,
+ opacity: 1
});
var differentLiteral = new ol.style.ShapeLiteral({
+ type: ol.style.ShapeType.CIRCLE,
+ size: 4,
fillStyle: '#013',
- size: 4
+ strokeStyle: '#013',
+ strokeWidth: 3,
+ opacity: 1
});
expect(literal.equals(equalLiteral)).toBe(true);
expect(literal.equals(differentLiteral)).toBe(false);
@@ -74,3 +86,4 @@ goog.require('ol.Expression');
goog.require('ol.Feature');
goog.require('ol.style.Shape');
goog.require('ol.style.ShapeLiteral');
+goog.require('ol.style.ShapeType');
@@ -5,6 +5,7 @@ describe('ol.style.Style', function() {
describe('#apply()', function() {
it('applies a style to a feature', function() {
+
var style = new ol.style.Style({
rules: [
new ol.style.Rule({
@@ -39,8 +40,10 @@ describe('ol.style.Style', function() {
it('returns an array with the Shape default for points', function() {
feature.setGeometry(new ol.geom.Point([0, 0]));
- expect(ol.style.Style.applyDefaultStyle(feature)[0]
- .equals(ol.style.ShapeDefaults)).toBe(true);
+ var symbolizers = ol.style.Style.applyDefaultStyle(feature);
+ expect(symbolizers.length).toBe(1);
+ expect(symbolizers[0]).toBeA(ol.style.ShapeLiteral);
+ expect(symbolizers[0].equals(ol.style.ShapeDefaults)).toBe(true);
});
it('returns an array with the Line default for lines', function() {
@@ -66,4 +69,5 @@ goog.require('ol.geom.Polygon');
goog.require('ol.filter.Filter');
goog.require('ol.style.Rule');
goog.require('ol.style.Shape');
+goog.require('ol.style.ShapeLiteral');
goog.require('ol.style.Style');

0 comments on commit e1c3faa

Please sign in to comment.