(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define("olStyleFactory", [], factory);
	else if(typeof exports === 'object')
		exports["olStyleFactory"] = factory();
	else
		root["olStyleFactory"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// identity function for calling harmony imports with the correct context
/******/ 	__webpack_require__.i = function(value) { return value; };
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "../";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 24);
/******/ })
/************************************************************************/
/******/ ({

/***/ 24:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

ol.style.Factory = function (options) {
  var option = options && (typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object' ? options : {};
  var style = new ol.style.Style({});
  if (option['geometry'] && option['geometry'] instanceof ol.geom.Geometry) {
    style.setGeometry(option['geometry']);
  }
  if (option['zIndex'] && typeof option['zIndex'] === 'number') {
    style.setZIndex(option['zIndex']);
  }
  if (option['fill'] && _typeof(option['fill']) === 'object') {
    style.setFill(this._getFill(option['fill']));
  }
  if (option['image'] && _typeof(option['image']) === 'object') {
    style.setImage(this._getImage(option['image']));
  }
  if (option['stroke'] && _typeof(option['stroke']) === 'object') {
    style.setStroke(this._getStroke(option['stroke']));
  }
  if (option['text'] && _typeof(option['text']) === 'object') {
    style.setText(this._getText(option['text']));
  }
  return style;
};

ol.style.Factory.prototype._getRegularShape = function (options) {
  try {
    var regularShape = new ol.style.RegularShape({
      fill: this._getFill(options['fill']) || undefined,
      points: typeof options['points'] === 'number' ? options['points'] : 1,
      radius: typeof options['radius'] === 'number' ? options['radius'] : undefined,
      radius1: typeof options['radius1'] === 'number' ? options['radius1'] : undefined,
      radius2: typeof options['radius2'] === 'number' ? options['radius2'] : undefined,
      angle: typeof options['angle'] === 'number' ? options['angle'] : 0,
      snapToPixel: typeof options['snapToPixel'] === 'boolean' ? options['snapToPixel'] : true,
      stroke: this._getStroke(options['stroke']) || undefined,
      rotation: typeof options['rotation'] === 'number' ? options['rotation'] : 0,
      rotateWithView: typeof options['rotateWithView'] === 'boolean' ? options['rotateWithView'] : false,
      atlasManager: options['atlasManager'] ? options['atlasManager'] : undefined
    });
    return regularShape;
  } catch (e) {
    console.log(e);
  }
};

ol.style.Factory.prototype._getImage = function (options) {
  try {
    var image = void 0;
    options = options || {};
    if (options['type'] === 'icon') {
      image = this._getIcon(options['image']);
    } else {
      image = this._getRegularShape(options['image']);
    }
    return image;
  } catch (e) {
    console.log(e);
  }
};

ol.style.Factory.prototype._getIcon = function (options) {
  try {
    options = options || {};
    var icon = new ol.style.Icon({
      anchor: options['imageAnchor'] ? options['imageAnchor'] : [0.5, 0.5],
      anchorXUnits: options['imageAnchorXUnits'] ? options['imageAnchorXUnits'] : 'fraction',
      anchorYUnits: options['imageAnchorYUnits'] ? options['imageAnchorYUnits'] : 'fraction',
      anchorOrigin: options['imageAnchorOrigin'] ? options['imageAnchorYUnits'] : 'top-left',
      color: options['imageColor'] ? options['imageColor'] : undefined,
      crossOrigin: options['crossOrigin'] ? options['crossOrigin'] : undefined,
      img: options['img'] ? options['img'] : undefined,
      offset: options['offset'] && Array.isArray(options['offset']) && options['offset'].length === 2 ? options['offset'] : [0, 0],
      offsetOrigin: options['offsetOrigin'] ? options['offsetOrigin'] : 'top-left',
      scale: typeof options['scale'] === 'number' ? options['scale'] : 1,
      snapToPixel: typeof options['snapToPixel'] === 'boolean' ? options['snapToPixel'] : true,
      rotateWithView: typeof options['rotateWithView'] === 'boolean' ? options['rotateWithView'] : false,
      opacity: typeof options['imageOpacity'] === 'number' ? options['imageOpacity'] : 1,
      rotation: typeof options['imageRotation'] === 'number' ? options['imageRotation'] : 0,
      size: options['size'] && Array.isArray(options['size']) && options['size'].length === 2 ? options['size'] : undefined,
      imgSize: options['imgSize'] && Array.isArray(options['imgSize']) && options['imgSize'].length === 2 ? options['imgSize'] : undefined,
      src: options['imageSrc'] ? options['imageSrc'] : undefined
    });
    return icon;
  } catch (error) {
    console.log(error);
  }
};

ol.style.Factory.prototype._getStroke = function (options) {
  try {
    options = options || {};
    var stroke = new ol.style.Stroke({
      color: options['strokeColor'] ? options['strokeColor'] : undefined,
      lineCap: options['strokeLineCap'] && typeof options['strokeLineCap'] === 'string' ? options['strokeLineCap'] : 'round',
      lineJoin: options['strokeLineJoin'] && typeof options['strokeLineJoin'] === 'string' ? options['strokeLineJoin'] : 'round',
      lineDash: options['strokeLineDash'] ? options['strokeLineDash'] : undefined,
      lineDashOffset: typeof options['strokeLineDashOffset'] === 'number' ? options['strokeLineDashOffset'] : '0',
      miterLimit: typeof options['strokeMiterLimit'] === 'number' ? options['strokeMiterLimit'] : 10,
      width: typeof options['strokeWidth'] === 'number' ? options['strokeWidth'] : undefined
    });
    return stroke;
  } catch (error) {
    console.log(error);
  }
};

ol.style.Factory.prototype._getText = function (options) {
  try {
    var text = new ol.style.Text({
      font: options['textFont'] && typeof options['textFont'] === 'string' ? options['textFont'] : '10px sans-serif',
      offsetX: typeof options['textOffsetX'] === 'number' ? options['textOffsetX'] : 0,
      offsetY: typeof options['textOffsetY'] === 'number' ? options['textOffsetY'] : 0,
      scale: typeof options['textScale'] === 'number' ? options['textScale'] : undefined,
      rotation: typeof options['textRotation'] === 'number' ? options['textRotation'] : 0,
      text: options['text'] && typeof options['text'] === 'string' ? options['text'] : undefined,
      textAlign: options['textAlign'] && typeof options['textAlign'] === 'string' ? options['textAlign'] : 'start',
      textBaseline: options['textBaseline'] && typeof options['textBaseline'] === 'string' ? options['textBaseline'] : 'alphabetic',
      rotateWithView: typeof options['rotateWithView'] === 'boolean' ? options['rotateWithView'] : false,
      fill: this._getFill(options['textFill']),
      stroke: this._getStroke(options['textStroke'])
    });
    return text;
  } catch (error) {
    console.log(error);
  }
};

ol.style.Factory.prototype._getFill = function (options) {
  try {
    options = options || {};
    var fill = new ol.style.Fill({
      color: options['fillColor'] ? options['fillColor'] : undefined
    });
    return fill;
  } catch (error) {
    console.log(error);
  }
};

var olStyleFactory = ol.style.Factory;
exports.default = olStyleFactory;
module.exports = exports['default'];

/***/ })

/******/ });
});
//# sourceMappingURL=olStyleFactory.js.map