Skip to content

Commit

Permalink
various deprecations from core
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed Nov 21, 2019
1 parent f96204e commit 5ca4add
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 74 deletions.
1 change: 1 addition & 0 deletions docs/upgrade-guide.md
Expand Up @@ -28,6 +28,7 @@
+ `setLayerNeedsUpdate`: use `setNeedsUpdate`
+ `setUniforms`: use `model.setUniforms`
+ `use64bitProjection`
+ `projectFlat`: use `projectPosition`

##### Standalone bundle

Expand Down
6 changes: 0 additions & 6 deletions modules/core/src/controllers/controller.js
Expand Up @@ -214,12 +214,6 @@ export default class Controller {
}
}

// DEPRECATED

setOptions(props) {
return this.setProps(props);
}

// Private Methods

/* Callback util */
Expand Down
55 changes: 1 addition & 54 deletions modules/core/src/lib/layer.js
Expand Up @@ -58,7 +58,6 @@ const defaultProps = {
compare: false
},
updateTriggers: {}, // Update triggers: a core change detection mechanism in deck.gl
numInstances: undefined,

visible: true,
pickable: false,
Expand All @@ -80,9 +79,6 @@ const defaultProps = {
parameters: {},
uniforms: {},
extensions: [],
framebuffer: null,

animation: null, // Passed prop animation functions to evaluate props

// Offset depth based on layer index to avoid z-fighting.
// Negative values pull layer towards the camera
Expand Down Expand Up @@ -157,11 +153,6 @@ export default class Layer extends Component {
return this.state && (this.state.models || (this.state.model ? [this.state.model] : []));
}

// TODO - Gradually phase out, does not support multi model layers
getSingleModel() {
return this.state && this.state.model;
}

getAttributeManager() {
return this.internalState && this.internalState.attributeManager;
}
Expand All @@ -177,16 +168,6 @@ export default class Layer extends Component {
return this.props.loadOptions;
}

// Use iteration (the only required capability on data) to get first element
// deprecated since we are effectively only supporting Arrays
getFirstObject() {
const {data} = this.props;
for (const object of data) {
return object;
}
return null;
}

// PROJECTION METHODS

// Projects a point with current map state (lat, lon, zoom, pitch, bearing)
Expand Down Expand Up @@ -222,22 +203,6 @@ export default class Layer extends Component {
});
}

// DEPRECATE: This does not handle offset modes
projectFlat(lngLat) {
log.deprecated('layer.projectFlat', 'layer.projectPosition')();
const {viewport} = this.context;
assert(Array.isArray(lngLat));
return viewport.projectFlat(lngLat);
}

// DEPRECATE: This is not meaningful in offset modes
unprojectFlat(xy) {
log.deprecated('layer.unprojectFlat')();
const {viewport} = this.context;
assert(Array.isArray(xy));
return viewport.unprojectFlat(xy);
}

use64bitPositions() {
return (
this.props.coordinateSystem === COORDINATE_SYSTEM.LNGLAT ||
Expand Down Expand Up @@ -546,8 +511,7 @@ export default class Layer extends Component {
}

// Use container library to get a count for any ES6 container or object
const {data} = this.props;
return count(data);
return count(props.data);
}

// Buffer layout describes how many attribute values are packed for each data object
Expand Down Expand Up @@ -586,10 +550,6 @@ export default class Layer extends Component {
}
// End subclass lifecycle methods

// TODO deprecated, for backwards compatibility with older layers
// in case layer resets state
this.state.attributeManager = this.getAttributeManager();

// initializeState callback tends to clear state
this.setChangeFlags({
dataChanged: true,
Expand All @@ -599,12 +559,6 @@ export default class Layer extends Component {
});

this._updateState();

const model = this.getSingleModel();
if (model) {
model.id = this.props.id;
model.program.id = `${this.props.id}-program`;
}
}

// Called by layer manager
Expand Down Expand Up @@ -713,13 +667,6 @@ export default class Layer extends Component {
this.props = currentProps;
}

// {uniforms = {}, ...opts}
pickLayer(opts) {
// Call subclass lifecycle method
return this.getPickingInfo(opts);
// End lifecycle method
}

// Helper methods
getChangeFlags() {
return this.internalState.changeFlags;
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/lib/picking/pick-info.js
Expand Up @@ -134,7 +134,7 @@ export function getLayerPickingInfo({layer, info, mode}) {
// layer.pickLayer() function requires a non-null ```layer.state```
// object to function properly. So the layer referenced here
// must be the "current" layer, not an "out-dated" / "invalidated" layer
info = layer.pickLayer({info, mode, sourceLayer});
info = layer.getPickingInfo({info, mode, sourceLayer});
layer = layer.parent;
}
return info;
Expand Down
7 changes: 1 addition & 6 deletions modules/core/src/lib/view-manager.js
Expand Up @@ -20,8 +20,6 @@

import assert from '../utils/assert';
import {deepEqual} from '../utils/deep-equal';
import View from '../views/view';
import Viewport from '../viewports/viewport';
import log from '../utils/log';
import {flatten} from '../utils/flatten';

Expand Down Expand Up @@ -211,10 +209,7 @@ export default class ViewManager {
// Update the view descriptor list and set change flag if needed
// Does not actually rebuild the `Viewport`s until `getViewports` is called
_setViews(views) {
// DEPRECATED: Ensure any "naked" Viewports are wrapped in View instances
views = flatten(views, {filter: Boolean}).map(
view => (view instanceof Viewport ? new View({viewportInstance: view}) : view)
);
views = flatten(views, {filter: Boolean});

const viewsChanged = this._diffViews(views, this.views);
if (viewsChanged) {
Expand Down
7 changes: 3 additions & 4 deletions modules/core/src/views/perspective-view.js
Expand Up @@ -25,10 +25,9 @@ export default class PerspectiveView extends View {
} = viewState;

// Projection matrix arguments
// TODO - Extracting from viewState is deprecated
const fovy = props.fovy || viewState.fovy || 75; // Field of view covered by camera
const near = props.near || viewState.near || 1; // Distance of near clipping plane
const far = props.far || viewState.far || 100; // Distance of far clipping plane
const fovy = props.fovy || 75; // Field of view covered by camera
const near = props.near || 1; // Distance of near clipping plane
const far = props.far || 100; // Distance of far clipping plane
const aspect = Number.isFinite(viewState.aspect) ? viewState.aspect : width / height;

const fovyRadians = fovy * DEGREES_TO_RADIANS;
Expand Down
3 changes: 0 additions & 3 deletions modules/json/src/index.js
Expand Up @@ -8,6 +8,3 @@ export {default as JSONConfiguration} from './json-configuration';
export {default as _convertFunctions} from './helpers/convert-functions';
export {default as _parseExpressionString} from './helpers/parse-expression-string';
export {shallowEqualObjects as _shallowEqualObjects} from './utils/shallow-equal-objects';

// DEPRECATED
export {default as _JSONConverter} from './json-converter';

0 comments on commit 5ca4add

Please sign in to comment.