From f38054d7379af07608b98586e3b6abdfb2725f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 20 Nov 2013 14:41:05 +0100 Subject: [PATCH] Add ol.style.Fill constructor --- src/ol/style/fillstyle.js | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/ol/style/fillstyle.js diff --git a/src/ol/style/fillstyle.js b/src/ol/style/fillstyle.js new file mode 100644 index 0000000000..978aa95c2e --- /dev/null +++ b/src/ol/style/fillstyle.js @@ -0,0 +1,46 @@ +goog.provide('ol.style.Fill'); + +goog.require('ol.color'); + + +/** + * @typedef {{color: (ol.Color|string)}} + */ +ol.style.FillOptions; + + + +/** + * @constructor + * @param {ol.style.FillOptions} options Options. + */ +ol.style.Fill = function(options) { + + /** + * @type {ol.Color|string} + */ + this.color = options.color; +}; + + +/** + * @param {ol.style.Fill} fillStyle1 Fill style 1. + * @param {ol.style.Fill} fillStyle2 Fill style 2. + * @return {boolean} Equals. + */ +ol.style.Fill.equals = function(fillStyle1, fillStyle2) { + if (!goog.isNull(fillStyle1)) { + if (!goog.isNull(fillStyle2)) { + return fillStyle1 === fillStyle2 || + ol.color.stringOrColorEquals(fillStyle1.color, fillStyle2.color); + } else { + return false; + } + } else { + if (!goog.isNull(fillStyle2)) { + return false; + } else { + return true; + } + } +};