Add ol.style

This commit is contained in:
Tom Payne
2013-11-07 15:04:24 +01:00
parent f445a7230b
commit 30311f0b65

101
src/ol/style.js Normal file
View File

@@ -0,0 +1,101 @@
goog.provide('ol.style.DefaultStyleFunction');
goog.provide('ol.style.Style');
goog.provide('ol.style.StyleFunction');
goog.require('goog.functions');
/**
* @typedef {{color: string,
* opacity: number}}
*/
ol.style.Fill;
/**
* @typedef {{anchor: Array.<number>,
* image: (HTMLCanvasElement|HTMLVideoElement|Image),
* rotation: number,
* subtractViewRotation: boolean}}
*/
ol.style.Image;
/**
* @typedef {{color: string,
* width: number}}
*/
ol.style.Stroke;
/**
* @typedef {{fill: ol.style.Fill,
* image: ol.style.Image,
* stroke: ol.style.Stroke,
* zIndex: number}}
*/
ol.style.Style;
/**
* @typedef {function(ol.Feature): ol.style.Style}
*/
ol.style.StyleFunction;
/**
* @const
* @type {ol.style.Fill}
*/
ol.style.DEFAULT_FILL_STYLE = {
color: 'red',
opacity: 0.1
};
/**
* @const
* @type {ol.style.Image}
*/
ol.style.DEFAULT_IMAGE_STYLE = {
anchor: [0, 0],
image: null, // FIXME
rotation: 0.0,
subtractViewRotation: false
};
/**
* @const
* @type {ol.style.Stroke}
*/
ol.style.DEFAULT_STROKE_STYLE = {
color: 'red',
width: 3
};
/**
* @const
* @type {number}
*/
ol.style.DEFAULT_Z_INDEX = 0;
/**
* @const
* @type {ol.style.Style}
*/
ol.style.DEFAULT_STYLE = {
fill: ol.style.DEFAULT_FILL_STYLE,
image: ol.style.DEFAULT_IMAGE_STYLE,
stroke: ol.style.DEFAULT_STROKE_STYLE,
zIndex: ol.style.DEFAULT_Z_INDEX
};
/**
* @param {ol.Feature} feature Feature.
* @return {ol.style.Style} Style.
*/
ol.style.DefaultStyleFunction = goog.functions.constant(ol.style.DEFAULT_STYLE);