Permalink
Browse files

Going with point, line, and polygon symbolizers

Separate fill and stroke symbolizers make a nicer API, but less efficient rendering
  • Loading branch information...
1 parent fd0a5f3 commit b92fdaf9111f151abd55c756b861a7c6780f0a01 @tschaub tschaub committed Jan 19, 2013
Showing with 94 additions and 69 deletions.
  1. +0 −27 src/ol/style/fill.js
  2. +31 −0 src/ol/style/line.js
  3. +11 −0 src/ol/style/point.js
  4. +35 −0 src/ol/style/polygon.js
  5. +17 −10 src/ol/style/shape.js
  6. +0 −32 src/ol/style/stroke.js
View
@@ -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;
-
-};
View
@@ -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;
+
+};
View
@@ -0,0 +1,11 @@
+goog.provide('ol.style.LiteralPoint');
+
+goog.require('ol.style.LiteralSymbolizer');
+
+
+
+/**
+ * @interface
+ * @implements {ol.style.LiteralSymbolizer}
+ */
+ol.style.LiteralPoint = function() {};
View
@@ -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
@@ -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,16 +15,18 @@ 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;
/**
* @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 {string} */
+ this.strokeStyle = config.strokeStyle;
- /** @type {ol.style.LiteralStroke} */
- this.stroke = config.stroke;
+ /** @type {number} */
+ this.strokeWidth = config.strokeWidth;
+
+ /** @type {number} */
+ this.opacity = config.opacity;
};
View
@@ -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;
-
-};
-

0 comments on commit b92fdaf

Please sign in to comment.