Rename _ol_source_Cluster_ to Cluster

This commit is contained in:
Tim Schaub
2018-01-08 13:57:30 -07:00
parent 8c0a06b56a
commit 1bb20f8231
4 changed files with 21 additions and 21 deletions

View File

@@ -4,7 +4,7 @@ import View from '../src/ol/View.js';
import Point from '../src/ol/geom/Point.js';
import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import _ol_source_Cluster_ from '../src/ol/source/Cluster.js';
import Cluster from '../src/ol/source/Cluster.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
import VectorSource from '../src/ol/source/Vector.js';
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
@@ -28,7 +28,7 @@ var source = new VectorSource({
features: features
});
var clusterSource = new _ol_source_Cluster_({
var clusterSource = new Cluster({
distance: parseInt(distance.value, 10),
source: source
});

View File

@@ -6,7 +6,7 @@ import {defaults as defaultInteractions} from '../src/ol/interaction.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import _ol_source_Cluster_ from '../src/ol/source/Cluster.js';
import Cluster from '../src/ol/source/Cluster.js';
import _ol_source_Stamen_ from '../src/ol/source/Stamen.js';
import VectorSource from '../src/ol/source/Vector.js';
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
@@ -122,7 +122,7 @@ function selectStyleFunction(feature) {
}
vector = new VectorLayer({
source: new _ol_source_Cluster_({
source: new Cluster({
distance: 40,
source: new VectorSource({
url: 'data/kml/2012_Earthquakes_Mag5.kml',

View File

@@ -22,7 +22,7 @@ import VectorSource from '../source/Vector.js';
* @extends {ol.source.Vector}
* @api
*/
var _ol_source_Cluster_ = function(options) {
var Cluster = function(options) {
VectorSource.call(this, {
attributions: options.attributions,
extent: options.extent,
@@ -67,10 +67,10 @@ var _ol_source_Cluster_ = function(options) {
this.source = options.source;
this.source.on(EventType.CHANGE,
_ol_source_Cluster_.prototype.refresh, this);
Cluster.prototype.refresh, this);
};
inherits(_ol_source_Cluster_, VectorSource);
inherits(Cluster, VectorSource);
/**
@@ -78,7 +78,7 @@ inherits(_ol_source_Cluster_, VectorSource);
* @return {number} Distance.
* @api
*/
_ol_source_Cluster_.prototype.getDistance = function() {
Cluster.prototype.getDistance = function() {
return this.distance;
};
@@ -88,7 +88,7 @@ _ol_source_Cluster_.prototype.getDistance = function() {
* @return {ol.source.Vector} Source.
* @api
*/
_ol_source_Cluster_.prototype.getSource = function() {
Cluster.prototype.getSource = function() {
return this.source;
};
@@ -96,7 +96,7 @@ _ol_source_Cluster_.prototype.getSource = function() {
/**
* @inheritDoc
*/
_ol_source_Cluster_.prototype.loadFeatures = function(extent, resolution,
Cluster.prototype.loadFeatures = function(extent, resolution,
projection) {
this.source.loadFeatures(extent, resolution, projection);
if (resolution !== this.resolution) {
@@ -113,7 +113,7 @@ _ol_source_Cluster_.prototype.loadFeatures = function(extent, resolution,
* @param {number} distance The distance in pixels.
* @api
*/
_ol_source_Cluster_.prototype.setDistance = function(distance) {
Cluster.prototype.setDistance = function(distance) {
this.distance = distance;
this.refresh();
};
@@ -123,7 +123,7 @@ _ol_source_Cluster_.prototype.setDistance = function(distance) {
* handle the source changing
* @override
*/
_ol_source_Cluster_.prototype.refresh = function() {
Cluster.prototype.refresh = function() {
this.clear();
this.cluster();
this.addFeatures(this.features);
@@ -134,7 +134,7 @@ _ol_source_Cluster_.prototype.refresh = function() {
/**
* @protected
*/
_ol_source_Cluster_.prototype.cluster = function() {
Cluster.prototype.cluster = function() {
if (this.resolution === undefined) {
return;
}
@@ -179,7 +179,7 @@ _ol_source_Cluster_.prototype.cluster = function() {
* @return {ol.Feature} The cluster feature.
* @protected
*/
_ol_source_Cluster_.prototype.createCluster = function(features) {
Cluster.prototype.createCluster = function(features) {
var centroid = [0, 0];
for (var i = features.length - 1; i >= 0; --i) {
var geometry = this.geometryFunction(features[i]);
@@ -195,4 +195,4 @@ _ol_source_Cluster_.prototype.createCluster = function(features) {
cluster.set('features', features);
return cluster;
};
export default _ol_source_Cluster_;
export default Cluster;

View File

@@ -3,7 +3,7 @@ import LineString from '../../../../src/ol/geom/LineString.js';
import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_Cluster_ from '../../../../src/ol/source/Cluster.js';
import Cluster from '../../../../src/ol/source/Cluster.js';
import Source from '../../../../src/ol/source/Source.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
@@ -11,12 +11,12 @@ describe('ol.source.Cluster', function() {
describe('constructor', function() {
it('returns a cluster source', function() {
var source = new _ol_source_Cluster_({
var source = new Cluster({
projection: getProjection('EPSG:4326'),
source: new VectorSource()
});
expect(source).to.be.a(Source);
expect(source).to.be.a(_ol_source_Cluster_);
expect(source).to.be.a(Cluster);
expect(source.getDistance()).to.be(20);
});
});
@@ -25,7 +25,7 @@ describe('ol.source.Cluster', function() {
var extent = [-1, -1, 1, 1];
var projection = getProjection('EPSG:3857');
it('clusters a source with point features', function() {
var source = new _ol_source_Cluster_({
var source = new Cluster({
source: new VectorSource({
features: [
new Feature(new Point([0, 0])),
@@ -38,7 +38,7 @@ describe('ol.source.Cluster', function() {
expect(source.getFeatures()[0].get('features').length).to.be(2);
});
it('clusters with a custom geometryFunction', function() {
var source = new _ol_source_Cluster_({
var source = new Cluster({
geometryFunction: function(feature) {
var geom = feature.getGeometry();
if (geom.getType() == 'Point') {
@@ -65,7 +65,7 @@ describe('ol.source.Cluster', function() {
describe('#setDistance', function() {
it('changes the distance value', function() {
var source = new _ol_source_Cluster_({
var source = new Cluster({
distance: 100,
source: new VectorSource()
});