268 lines
6.1 KiB
JavaScript
268 lines
6.1 KiB
JavaScript
"use strict"
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true,
|
|
})
|
|
exports.KmlLayer = undefined
|
|
|
|
var _defineProperty2 = require("babel-runtime/helpers/defineProperty")
|
|
|
|
var _defineProperty3 = _interopRequireDefault(_defineProperty2)
|
|
|
|
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of")
|
|
|
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf)
|
|
|
|
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck")
|
|
|
|
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2)
|
|
|
|
var _createClass2 = require("babel-runtime/helpers/createClass")
|
|
|
|
var _createClass3 = _interopRequireDefault(_createClass2)
|
|
|
|
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn")
|
|
|
|
var _possibleConstructorReturn3 = _interopRequireDefault(
|
|
_possibleConstructorReturn2
|
|
)
|
|
|
|
var _inherits2 = require("babel-runtime/helpers/inherits")
|
|
|
|
var _inherits3 = _interopRequireDefault(_inherits2)
|
|
|
|
var _react = require("react")
|
|
|
|
var _react2 = _interopRequireDefault(_react)
|
|
|
|
var _propTypes = require("prop-types")
|
|
|
|
var _propTypes2 = _interopRequireDefault(_propTypes)
|
|
|
|
var _MapChildHelper = require("../utils/MapChildHelper")
|
|
|
|
var _constants = require("../constants")
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj }
|
|
}
|
|
|
|
/**
|
|
* A wrapper around `google.maps.KmlLayer`
|
|
*
|
|
* @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#KmlLayer
|
|
*/
|
|
/*
|
|
* -----------------------------------------------------------------------------
|
|
* This file is auto-generated from the corresponding file at `src/macros/`.
|
|
* Please **DO NOT** edit this file directly when creating PRs.
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
/* global google */
|
|
var KmlLayer = (exports.KmlLayer = (function(_React$PureComponent) {
|
|
;(0, _inherits3.default)(KmlLayer, _React$PureComponent)
|
|
|
|
/*
|
|
* @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#KmlLayer
|
|
*/
|
|
function KmlLayer(props, context) {
|
|
;(0, _classCallCheck3.default)(this, KmlLayer)
|
|
|
|
var _this = (0, _possibleConstructorReturn3.default)(
|
|
this,
|
|
(KmlLayer.__proto__ || (0, _getPrototypeOf2.default)(KmlLayer)).call(
|
|
this,
|
|
props,
|
|
context
|
|
)
|
|
)
|
|
|
|
var kmlLayer = new google.maps.KmlLayer()
|
|
;(0, _MapChildHelper.construct)(
|
|
KmlLayer.propTypes,
|
|
updaterMap,
|
|
_this.props,
|
|
kmlLayer
|
|
)
|
|
kmlLayer.setMap(_this.context[_constants.MAP])
|
|
_this.state = (0, _defineProperty3.default)(
|
|
{},
|
|
_constants.KML_LAYER,
|
|
kmlLayer
|
|
)
|
|
return _this
|
|
}
|
|
|
|
;(0, _createClass3.default)(KmlLayer, [
|
|
{
|
|
key: "componentDidMount",
|
|
value: function componentDidMount() {
|
|
;(0, _MapChildHelper.componentDidMount)(
|
|
this,
|
|
this.state[_constants.KML_LAYER],
|
|
eventMap
|
|
)
|
|
},
|
|
},
|
|
{
|
|
key: "componentDidUpdate",
|
|
value: function componentDidUpdate(prevProps) {
|
|
;(0, _MapChildHelper.componentDidUpdate)(
|
|
this,
|
|
this.state[_constants.KML_LAYER],
|
|
eventMap,
|
|
updaterMap,
|
|
prevProps
|
|
)
|
|
},
|
|
},
|
|
{
|
|
key: "componentWillUnmount",
|
|
value: function componentWillUnmount() {
|
|
;(0, _MapChildHelper.componentWillUnmount)(this)
|
|
var kmlLayer = this.state[_constants.KML_LAYER]
|
|
if (kmlLayer) {
|
|
kmlLayer.setMap(null)
|
|
}
|
|
},
|
|
},
|
|
{
|
|
key: "render",
|
|
value: function render() {
|
|
return false
|
|
},
|
|
|
|
/**
|
|
* Get the default viewport for the layer being displayed.
|
|
* @type LatLngBounds
|
|
* @public
|
|
*/
|
|
},
|
|
{
|
|
key: "getDefaultViewport",
|
|
value: function getDefaultViewport() {
|
|
return this.state[_constants.KML_LAYER].getDefaultViewport()
|
|
},
|
|
|
|
/**
|
|
* Get the metadata associated with this layer, as specified in the layer markup.
|
|
* @type KmlLayerMetadata
|
|
* @public
|
|
*/
|
|
},
|
|
{
|
|
key: "getMetadata",
|
|
value: function getMetadata() {
|
|
return this.state[_constants.KML_LAYER].getMetadata()
|
|
},
|
|
|
|
/**
|
|
* Get the status of the layer, set once the requested document has loaded.
|
|
* @type KmlLayerStatus
|
|
* @public
|
|
*/
|
|
},
|
|
{
|
|
key: "getStatus",
|
|
value: function getStatus() {
|
|
return this.state[_constants.KML_LAYER].getStatus()
|
|
},
|
|
|
|
/**
|
|
* Gets the URL of the KML file being displayed.
|
|
* @type string
|
|
* @public
|
|
*/
|
|
},
|
|
{
|
|
key: "getUrl",
|
|
value: function getUrl() {
|
|
return this.state[_constants.KML_LAYER].getUrl()
|
|
},
|
|
|
|
/**
|
|
* Gets the z-index of the KML Layer.
|
|
* @type number
|
|
* @public
|
|
*/
|
|
},
|
|
{
|
|
key: "getZIndex",
|
|
value: function getZIndex() {
|
|
return this.state[_constants.KML_LAYER].getZIndex()
|
|
},
|
|
},
|
|
])
|
|
return KmlLayer
|
|
})(_react2.default.PureComponent))
|
|
|
|
KmlLayer.propTypes = {
|
|
/**
|
|
* @type KmlLayerOptions
|
|
*/
|
|
defaultOptions: _propTypes2.default.any,
|
|
|
|
/**
|
|
* @type string
|
|
*/
|
|
defaultUrl: _propTypes2.default.string,
|
|
|
|
/**
|
|
* @type number
|
|
*/
|
|
defaultZIndex: _propTypes2.default.number,
|
|
|
|
/**
|
|
* @type KmlLayerOptions
|
|
*/
|
|
options: _propTypes2.default.any,
|
|
|
|
/**
|
|
* @type string
|
|
*/
|
|
url: _propTypes2.default.string,
|
|
|
|
/**
|
|
* @type number
|
|
*/
|
|
zIndex: _propTypes2.default.number,
|
|
|
|
/**
|
|
* function
|
|
*/
|
|
onDefaultViewportChanged: _propTypes2.default.func,
|
|
|
|
/**
|
|
* function
|
|
*/
|
|
onClick: _propTypes2.default.func,
|
|
|
|
/**
|
|
* function
|
|
*/
|
|
onStatusChanged: _propTypes2.default.func,
|
|
}
|
|
KmlLayer.contextTypes = (0, _defineProperty3.default)(
|
|
{},
|
|
_constants.MAP,
|
|
_propTypes2.default.object
|
|
)
|
|
exports.default = KmlLayer
|
|
|
|
var eventMap = {
|
|
onDefaultViewportChanged: "defaultviewport_changed",
|
|
onClick: "click",
|
|
onStatusChanged: "status_changed",
|
|
}
|
|
|
|
var updaterMap = {
|
|
options: function options(instance, _options) {
|
|
instance.setOptions(_options)
|
|
},
|
|
url: function url(instance, _url) {
|
|
instance.setUrl(_url)
|
|
},
|
|
zIndex: function zIndex(instance, _zIndex) {
|
|
instance.setZIndex(_zIndex)
|
|
},
|
|
}
|