Rename ol.style.IconAnchorUnits and ol.style.IconOrigin

This commit is contained in:
Andreas Hocevar
2016-08-28 19:24:29 +02:00
committed by Tim Schaub
parent 1beddcd99a
commit a8d8942fba
5 changed files with 78 additions and 75 deletions

View File

@@ -27,8 +27,6 @@ goog.require('ol.math');
goog.require('ol.proj');
goog.require('ol.style.Fill');
goog.require('ol.style.Icon');
goog.require('ol.style.IconAnchorUnits');
goog.require('ol.style.IconOrigin');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
goog.require('ol.style.Text');
@@ -168,19 +166,19 @@ ol.format.KML.createStyleDefaults_ = function() {
/**
* @const
* @type {ol.style.IconAnchorUnits}
* @type {ol.style.Icon.AnchorUnits}
* @private
*/
ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ =
ol.style.IconAnchorUnits.PIXELS;
ol.style.Icon.AnchorUnits.PIXELS;
/**
* @const
* @type {ol.style.IconAnchorUnits}
* @type {ol.style.Icon.AnchorUnits}
* @private
*/
ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ =
ol.style.IconAnchorUnits.PIXELS;
ol.style.Icon.AnchorUnits.PIXELS;
/**
* @const
@@ -211,7 +209,7 @@ ol.format.KML.createStyleDefaults_ = function() {
*/
ol.format.KML.DEFAULT_IMAGE_STYLE_ = new ol.style.Icon({
anchor: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
anchorOrigin: ol.style.Icon.Origin.BOTTOM_LEFT,
anchorXUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_,
anchorYUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_,
crossOrigin: 'anonymous',
@@ -286,12 +284,12 @@ ol.format.KML.createStyleDefaults_ = function() {
/**
* @const
* @type {Object.<string, ol.style.IconAnchorUnits>}
* @type {Object.<string, ol.style.Icon.AnchorUnits>}
* @private
*/
ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = {
'fraction': ol.style.IconAnchorUnits.FRACTION,
'pixels': ol.style.IconAnchorUnits.PIXELS
'fraction': ol.style.Icon.AnchorUnits.FRACTION,
'pixels': ol.style.Icon.AnchorUnits.PIXELS
};
@@ -598,8 +596,8 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
anchorYUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
anchor = [0.5, 0];
anchorXUnits = ol.style.IconAnchorUnits.FRACTION;
anchorYUnits = ol.style.IconAnchorUnits.FRACTION;
anchorXUnits = ol.style.Icon.AnchorUnits.FRACTION;
anchorYUnits = ol.style.Icon.AnchorUnits.FRACTION;
}
var offset;
@@ -645,12 +643,12 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
var imageStyle = new ol.style.Icon({
anchor: anchor,
anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
anchorOrigin: ol.style.Icon.Origin.BOTTOM_LEFT,
anchorXUnits: anchorXUnits,
anchorYUnits: anchorYUnits,
crossOrigin: 'anonymous', // FIXME should this be configurable?
offset: offset,
offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
offsetOrigin: ol.style.Icon.Origin.BOTTOM_LEFT,
rotation: rotation,
scale: scale,
size: size,
@@ -2190,9 +2188,9 @@ ol.format.KML.writeIconStyle_ = function(node, style, objectStack) {
if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) {
var /** @type {ol.KMLVec2_} */ hotSpot = {
x: anchor[0],
xunits: ol.style.IconAnchorUnits.PIXELS,
xunits: ol.style.Icon.AnchorUnits.PIXELS,
y: size[1] - anchor[1],
yunits: ol.style.IconAnchorUnits.PIXELS
yunits: ol.style.Icon.AnchorUnits.PIXELS
};
properties['hotSpot'] = hotSpot;
}