Going with point, line, and polygon symbolizers

Separate fill and stroke symbolizers make a nicer API, but less efficient rendering
This commit is contained in:
Tim Schaub
2013-01-18 17:20:10 -07:00
parent fd0a5f3622
commit b92fdaf911
6 changed files with 94 additions and 69 deletions

View File

@@ -1,27 +0,0 @@
goog.provide('ol.style.LiteralFill');
goog.require('ol.style.LiteralSymbolizer');
/**
* @typedef {{color: (string),
* opacity: (number)}}
*/
ol.style.LiteralFillConfig;
/**
* @constructor
* @implements {ol.style.LiteralSymbolizer}
* @param {ol.style.LiteralFillConfig} config Symbolizer properties.
*/
ol.style.LiteralFill = function(config) {
/** @type {string} */
this.color = config.color;
/** @type {number} */
this.opacity = config.opacity;
};

31
src/ol/style/line.js Normal file
View File

@@ -0,0 +1,31 @@
goog.provide('ol.style.LiteralLine');
goog.require('ol.style.LiteralSymbolizer');
/**
* @typedef {{strokeStyle: (string),
* strokeWidth: (number),
* opacity: (number)}}
*/
ol.style.LiteralLineConfig;
/**
* @constructor
* @implements {ol.style.LiteralSymbolizer}
* @param {ol.style.LiteralLineConfig} config Symbolizer properties.
*/
ol.style.LiteralLine = function(config) {
/** @type {string} */
this.strokeStyle = config.strokeStyle;
/** @type {number} */
this.strokeWidth = config.strokeWidth;
/** @type {number} */
this.opacity = config.opacity;
};

11
src/ol/style/point.js Normal file
View File

@@ -0,0 +1,11 @@
goog.provide('ol.style.LiteralPoint');
goog.require('ol.style.LiteralSymbolizer');
/**
* @interface
* @implements {ol.style.LiteralSymbolizer}
*/
ol.style.LiteralPoint = function() {};

35
src/ol/style/polygon.js Normal file
View File

@@ -0,0 +1,35 @@
goog.provide('ol.style.LiteralPolygon');
goog.require('ol.style.LiteralSymbolizer');
/**
* @typedef {{fillStyle: (string),
* strokeStyle: (string),
* strokeWidth: (number),
* opacity: (number)}}
*/
ol.style.LiteralPolygonConfig;
/**
* @constructor
* @implements {ol.style.LiteralSymbolizer}
* @param {ol.style.LiteralPolygonConfig} config Symbolizer properties.
*/
ol.style.LiteralPolygon = function(config) {
/** @type {string} */
this.fillStyle = config.fillStyle;
/** @type {string} */
this.strokeStyle = config.strokeStyle;
/** @type {number} */
this.strokeWidth = config.strokeWidth;
/** @type {number} */
this.opacity = config.opacity;
};

View File

@@ -1,8 +1,7 @@
goog.provide('ol.style.LiteralShape');
goog.provide('ol.style.ShapeType');
goog.require('ol.style.LiteralFill');
goog.require('ol.style.LiteralStroke');
goog.require('ol.style.LiteralSymbolizer');
goog.require('ol.style.LiteralPoint');
/**
@@ -16,8 +15,10 @@ ol.style.ShapeType = {
/**
* @typedef {{type: (ol.style.ShapeType),
* size: (number),
* fill: (ol.style.LiteralFill),
* stroke: (ol.style.LiteralStroke)}}
* fillStyle: (string),
* strokeStyle: (string),
* strokeWidth: (number),
* opacity: (number)}}
*/
ol.style.LiteralShapeConfig;
@@ -25,7 +26,7 @@ ol.style.LiteralShapeConfig;
/**
* @constructor
* @implements {ol.style.LiteralSymbolizer}
* @implements {ol.style.LiteralPoint}
* @param {ol.style.LiteralShapeConfig} config Symbolizer properties.
*/
ol.style.LiteralShape = function(config) {
@@ -36,10 +37,16 @@ ol.style.LiteralShape = function(config) {
/** @type {number} */
this.size = config.size;
/** @type {ol.style.LiteralFill} */
this.fill = config.fill;
/** @type {string} */
this.fillStyle = config.fillStyle;
/** @type {ol.style.LiteralStroke} */
this.stroke = config.stroke;
/** @type {string} */
this.strokeStyle = config.strokeStyle;
/** @type {number} */
this.strokeWidth = config.strokeWidth;
/** @type {number} */
this.opacity = config.opacity;
};

View File

@@ -1,32 +0,0 @@
goog.provide('ol.style.LiteralStroke');
goog.require('ol.style.LiteralSymbolizer');
/**
* @typedef {{width: (number),
* color: (string),
* opacity: (number)}}
*/
ol.style.LiteralStrokeConfig;
/**
* @constructor
* @implements {ol.style.LiteralSymbolizer}
* @param {ol.style.LiteralStrokeConfig} config Symbolizer properties.
*/
ol.style.LiteralStroke = function(config) {
/** @type {string} */
this.color = config.color;
/** @type {number} */
this.opacity = config.opacity;
/** @type {number} */
this.width = config.width;
};