From 1d06cee93d391f41724fba2040bc128ff80575bf Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Thu, 7 Nov 2013 15:43:31 +0100 Subject: [PATCH] Add ol.style.stroke.equals --- src/ol/style.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ol/style.js b/src/ol/style.js index d683df5c76..97ed81deb3 100644 --- a/src/ol/style.js +++ b/src/ol/style.js @@ -1,6 +1,7 @@ goog.provide('ol.style.DefaultStyleFunction'); goog.provide('ol.style.Style'); goog.provide('ol.style.StyleFunction'); +goog.provide('ol.style.stroke'); goog.require('goog.functions'); @@ -28,6 +29,18 @@ ol.style.Image; ol.style.Stroke; +/** + * @param {ol.style.Stroke} strokeStyle1 Stroke style 1. + * @param {ol.style.Stroke} strokeStyle2 Stroke style 2. + * @return {boolean} Equals. + */ +ol.style.stroke.equals = function(strokeStyle1, strokeStyle2) { + return strokeStyle1 === strokeStyle2 || ( + strokeStyle1.color == strokeStyle2.color && + strokeStyle1.width == strokeStyle2.width); +}; + + /** * @typedef {{fill: ol.style.Fill, * image: ol.style.Image,