rlayers
Version:
React Components for OpenLayers
71 lines • 2.96 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var layer_1 = require("ol/layer");
var source_1 = require("ol/source");
var RLayerBaseVector_1 = __importDefault(require("./RLayerBaseVector"));
/** A vector layer that renders its RFeatures as a heatmap
*
* Compatible with RLayerVector
*
* Requires an `RMap` context
*
* Provides a vector layer for JSX-declared RFeatures
*/
var RLayerHeatmap = /** @class */ (function (_super) {
__extends(RLayerHeatmap, _super);
function RLayerHeatmap() {
return _super !== null && _super.apply(this, arguments) || this;
}
RLayerHeatmap.prototype.createSource = function (props) {
this.source = new source_1.Vector({
features: this.props.features,
url: this.props.url,
format: this.props.format,
loader: this.props.loader,
wrapX: this.props.wrapX,
strategy: this.props.strategy,
attributions: this.props.attributions
});
this.ol = new layer_1.Heatmap(__assign(__assign({}, props), { source: this.source }));
return [this.ol, this.source];
};
RLayerHeatmap.prototype.refresh = function (prev) {
_super.prototype.refresh.call(this, prev);
if ((prev === null || prev === void 0 ? void 0 : prev.blur) !== this.props.blur)
this.ol.setBlur(this.props.blur);
if ((prev === null || prev === void 0 ? void 0 : prev.radius) !== this.props.radius)
this.ol.setRadius(this.props.radius);
};
return RLayerHeatmap;
}(RLayerBaseVector_1.default));
exports.default = RLayerHeatmap;
//# sourceMappingURL=RLayerHeatmap.js.map
;