Skip to content

Commit

Permalink
add(worldview) text montage debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgervang committed Oct 13, 2021
1 parent 4cbd790 commit 8f1e183
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
8 changes: 4 additions & 4 deletions examples/worldview/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ const WindowSize = styled.div`

const KEPLER_MAP_ID = 'map';
const selectMapStyle = createSelectMapStyle(KEPLER_MAP_ID);
const sceneLayers = [];
let sceneLayers = [];
const App = ({}) => {
useScene();
sceneLayers = useScene();
const keplerDeckLayers = useKeplerDeckLayers(KEPLER_MAP_ID);
const deckProps = useMemo(() => {
return {
// layers: [...keplerDeckLayers, ...sceneLayers]
layers: [...sceneLayers, ...keplerDeckLayers]
layers: [...keplerDeckLayers, ...sceneLayers]
// layers: [...sceneLayers, ...keplerDeckLayers]
// layers: []
// layers: keplerDeckLayers
};
Expand Down
2 changes: 1 addition & 1 deletion examples/worldview/src/features/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Map extends Component {

_resizeVideo() {
const {previewSize, resolution} = this.props;
this._setDevicePixelRatio(nearestEven(resolution.width / previewSize.width));
this._setDevicePixelRatio(nearestEven(resolution.width / previewSize.width, 9));
if (this.mapRef.current) {
const map = this.mapRef.current.getMap();
map.resize();
Expand Down
41 changes: 36 additions & 5 deletions examples/worldview/src/scenes/montage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@ import {useKepler, loadKeplerJson} from '../../features/kepler';
import {updateViewState} from '../../features/map';
import {useEffect} from 'react';
import {WebMercatorViewport} from '@deck.gl/core';
import {TextLayer} from '@deck.gl/layers';
import {hold} from 'hubble.gl';

const CENTER = {
latitude: 40.76150677393161,
longitude: -73.97924658159985,
zoom: 17.531339846811306,
latitude: 40.76944617081325,
longitude: -73.98095085938715,
zoom: 17.88047290176511,
bearing: 0,
pitch: 0
};

// const CENTER = {
// latitude: 40.76150677393161,
// longitude: -73.97924658159985,
// zoom: 17.531339846811306,
// bearing: 0,
// pitch: 0
// };

function ajacentTile({centerViewState, canvasWidth, canvasHeight, xOffsetScalar, yOffsetScalar}) {
const viewport = new WebMercatorViewport({
...centerViewState,
Expand All @@ -41,7 +50,8 @@ function ajacentTile({centerViewState, canvasWidth, canvasHeight, xOffsetScalar,
const ajacentViewState = {
...CENTER,
longitude: ajacent[0],
latitude: ajacent[1]
latitude: ajacent[1],
label: `${xOffsetScalar}_${yOffsetScalar}`
};
return ajacentViewState;
}
Expand Down Expand Up @@ -165,5 +175,26 @@ export const useScene = () => {
dispatch(formatChange('png'));
}, []);

return [];
return [
new TextLayer({
id: 'montage',
data: [
TOP_LEFT,
TOP_MIDDLE,
TOP_RIGHT,
CENTER_LEFT,
CENTER_MIDDLE,
CENTER_RIGHT,
BOTTOM_LEFT,
BOTTOM_MIDDLE,
BOTTOM_RIGHT
],
getPosition: d => [d.longitude, d.latitude],
getText: d => d.label,
getColor: d => [255, 255, 255, 255],
getSize: 32,
getTextAnchor: 'middle',
getAlignmentBaseline: 'center'
})
];
};

0 comments on commit 8f1e183

Please sign in to comment.