Skip to content

Commit

Permalink
Remove dead code: no need to send placement parameters to the workers…
Browse files Browse the repository at this point in the history
… anymore.
  • Loading branch information
ChrisLoer committed Sep 19, 2017
1 parent 78a68c4 commit 6f53fe5
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 46 deletions.
15 changes: 0 additions & 15 deletions src/geo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,21 +409,6 @@ class Transform {
return new Float32Array(posMatrix);
}

/**
* Calculate the distance from the center of a tile to the camera
* These distances are in view-space dimensions derived from the size of the
* viewport, similar to this.cameraToCenterDistance
* If the tile is dead-center in the viewport, then cameraToTileDistance == cameraToCenterDistance
*
* @param {Tile} tile
*/
cameraToTileDistance(tile: Object) {
const posMatrix = this.calculatePosMatrix(tile.coord, tile.sourceMaxZoom);
const tileCenter = [tile.tileSize / 2, tile.tileSize / 2, 0, 1];
vec4.transformMat4(tileCenter, tileCenter, posMatrix);
return tileCenter[3];
}

_constrain() {
if (!this.center || !this.width || !this.height || this._constraining) return;

Expand Down
4 changes: 0 additions & 4 deletions src/source/geojson_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ class GeoJSONSource extends Evented implements Source {
source: this.id,
pixelRatio: browser.devicePixelRatio,
overscaling: tile.coord.z > this.maxzoom ? Math.pow(2, tile.coord.z - this.maxzoom) : 1,
angle: this.map.transform.angle,
pitch: this.map.transform.pitch,
cameraToCenterDistance: this.map.transform.cameraToCenterDistance,
cameraToTileDistance: this.map.transform.cameraToTileDistance(tile),
showCollisionBoxes: this.map.showCollisionBoxes
};

Expand Down
4 changes: 0 additions & 4 deletions src/source/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ class Tile {
collisionIndex: ?CollisionIndex;
featureIndex: ?FeatureIndex;
redoWhenDone: boolean;
angle: number;
pitch: number;
cameraToCenterDistance: number;
cameraToTileDistance: number;
showCollisionBoxes: boolean;
placementSource: any;
workerID: number;
Expand Down
4 changes: 0 additions & 4 deletions src/source/vector_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ class VectorTileSource extends Evented implements Source {
source: this.id,
pixelRatio: browser.devicePixelRatio,
overscaling: overscaling,
angle: this.map.transform.angle,
pitch: this.map.transform.pitch,
cameraToCenterDistance: this.map.transform.cameraToCenterDistance,
cameraToTileDistance: this.map.transform.cameraToTileDistance(tile),
showCollisionBoxes: this.map.showCollisionBoxes
};

Expand Down
11 changes: 2 additions & 9 deletions src/source/worker_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ export type TileParameters = {
uid: string,
};

export type PlacementConfig = {
angle: number,
pitch: number,
cameraToCenterDistance: number,
cameraToTileDistance: number,
showCollisionBoxes: boolean,
};

export type WorkerTileParameters = TileParameters & {
coord: TileCoord,
request: RequestParameters,
Expand All @@ -30,7 +22,8 @@ export type WorkerTileParameters = TileParameters & {
tileSize: number,
pixelRatio: number,
overscaling: number,
} & PlacementConfig;
showCollisionBoxes: boolean
};

export type WorkerTileResult = {
buckets: Array<SerializedBucket>,
Expand Down
8 changes: 0 additions & 8 deletions src/source/worker_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class WorkerTile {
tileSize: number;
source: string;
overscaling: number;
angle: number;
pitch: number;
cameraToCenterDistance: number;
cameraToTileDistance: number;
showCollisionBoxes: boolean;

status: 'parsing' | 'done';
Expand All @@ -52,10 +48,6 @@ class WorkerTile {
this.tileSize = params.tileSize;
this.source = params.source;
this.overscaling = params.overscaling;
this.angle = params.angle;
this.pitch = params.pitch;
this.cameraToCenterDistance = params.cameraToCenterDistance;
this.cameraToTileDistance = params.cameraToTileDistance;
this.showCollisionBoxes = params.showCollisionBoxes;
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/source/geojson_source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ test('GeoJSONSource#update', (t) => {

const source = new GeoJSONSource('id', {data: {}}, mockDispatcher);
source.map = {
transform: { cameraToCenterDistance: 1, cameraToTileDistance: () => { return 1; } }
transform: {}
};

source.on('data', (e) => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/source/vector_tile_source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Evented = require('../../../src/util/evented');
function createSource(options, transformCallback) {
const source = new VectorTileSource('id', options, { send: function() {} }, options.eventedParent);
source.onAdd({
transform: { angle: 0, pitch: 0, cameraToCenterDistance: 1, cameraToTileDistance: () => { return 1; }, showCollisionBoxes: false },
transform: { showCollisionBoxes: false },
_transformRequest: transformCallback ? transformCallback : (url) => { return { url }; }
});

Expand Down

0 comments on commit 6f53fe5

Please sign in to comment.