Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Street geo editor #540

Merged
merged 65 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1c5789d
add street-geo component call to layersFunctions
Algorush May 29, 2024
990f4d6
add react-google-maps/api in package.json
Algorush May 29, 2024
534011f
add geoPanel and GeoModal code from 3DStreet-editor/billing
Algorush May 29, 2024
5e34682
add marker and select coordinates on the map
Algorush May 30, 2024
acc2ef5
save coordinate in metadata and set it to street-geo component
Algorush May 30, 2024
8a9d0b0
fix get attribute data
Algorush May 30, 2024
c2876b8
load Layers map cards with coords from metadata
Algorush May 30, 2024
af003ab
fix access control logic
kfarr May 30, 2024
3f7e49f
simplify geo modal access logic
kfarr May 30, 2024
c35fc54
more geo modal simplification
kfarr May 30, 2024
2c30773
dont save reference-layers children in JSON
Algorush May 31, 2024
ad9725f
fix mapbox2d defaults
kfarr May 31, 2024
d2042ad
add pro badge to new entity panel
kfarr May 31, 2024
48fac1f
new defaults for geo modal
kfarr May 31, 2024
f28ac1f
increase webpack maxAssetSize and maxEntrypointSize options to 1.5 MiB
vincentfretin May 31, 2024
fdbfd27
round coord to 7 for 1cm precision
Algorush May 31, 2024
dc63d86
env.FIREBASE_API_KEY
Algorush May 31, 2024
ae5617b
no need for curly braces
Algorush May 31, 2024
a314cd3
Merge branch 'main' into street-geo-editor
kfarr May 31, 2024
97b02e8
use firebaseConfig object export
Algorush May 31, 2024
b0ad54f
Merge branch 'street-geo-editor' of https://github.com/3DStreet/3dstr…
kfarr May 31, 2024
5606338
The current location of the geospatial long/lat display in the geomod…
Algorush Jun 1, 2024
d88c370
Coordinate field handler to allow user to enter coordinates and chang…
Algorush Jun 1, 2024
031e6ea
Merge branch 'street-geo-editor' of https://github.com/3DStreet/3dstr…
Algorush Jun 1, 2024
69b403d
temporary hack to fix elevation for local testing
kfarr Jun 1, 2024
b307903
use existing Save24Icon
kfarr Jun 1, 2024
2be89c5
add Autocomplete for searching location
Algorush Jun 2, 2024
b1aef0d
Merge branch 'street-geo-editor' of https://github.com/3DStreet/3dstr…
Algorush Jun 2, 2024
c828843
add elevation field
Algorush Jun 3, 2024
8ad1cd3
restyle of footer buttons and title
Algorush Jun 3, 2024
953cac8
make help button transparent
Algorush Jun 3, 2024
663eed2
show lat,long, elevation in location label in geopanel
Algorush Jun 3, 2024
690a5db
'New Scene' default title & simplify title editing
kfarr Jun 3, 2024
f7ea8bf
minor changes to geopanel info
kfarr Jun 3, 2024
c5d52ba
working staging server deploy process
kfarr Jun 3, 2024
1514f38
move cross-env to devDependencies
vincentfretin Jun 3, 2024
73fa969
fix lint:fix command to use the same args as lint command to work on …
vincentfretin Jun 3, 2024
5b9dc54
add webxr settings to a-scene
kfarr Jun 3, 2024
b148095
save/load geoData in JSON file
Algorush Jun 4, 2024
695418a
Merge branch 'street-geo-editor' of https://github.com/3DStreet/3dstr…
Algorush Jun 4, 2024
d15bd99
remove the whole dist folder and add it to gitignore
vincentfretin Jun 4, 2024
abee710
get GOOGLE_API_KEY from firebaseConfig.apiKey
Algorush Jun 4, 2024
43d7714
Merge branch 'street-geo-editor' of https://github.com/3DStreet/3dstr…
Algorush Jun 4, 2024
2a04971
don't store geo coords in metadata. Store it in street-geo
Algorush Jun 5, 2024
c9a1a03
new aframe-loader-3dtiles dist
Algorush Jun 5, 2024
c7a79fe
dynamically load aframe-loader-3dtiles-component, update code for it
Algorush Jun 5, 2024
d1cbe64
remove old line to work 3dtiles with editor
Algorush Jun 5, 2024
ff551ce
update three-loader-3dtiles lib version
Algorush Jun 5, 2024
a4afc3a
Add spring objects (#559)
kfarr Jun 5, 2024
f26ec38
update geopanel coords from entity instead of metadata
kfarr Jun 5, 2024
d71a7b5
move search input below map
kfarr Jun 5, 2024
403f97e
prevent scrolling in geomodal
kfarr Jun 5, 2024
79a9a7d
Merge branch 'main' into street-geo-editor
kfarr Jun 5, 2024
43a122c
request elevation from google.maps in requestAndSetElevation function
Algorush Jun 6, 2024
60f40bb
Merge branch 'street-geo-editor' of https://github.com/3DStreet/3dstr…
Algorush Jun 6, 2024
c6283ef
temporary posthog removal
kfarr Jun 6, 2024
d780b7e
only show geopanel if pro user
kfarr Jun 7, 2024
e27b8cd
wHoops
kfarr Jun 7, 2024
165866a
untitled instead of new scene
kfarr Jun 7, 2024
c1b4c26
pro user required for cloud save with long/lat
kfarr Jun 7, 2024
2ffba44
Ar mode (#552)
kfarr Jun 7, 2024
43f77b2
ignore eslint warning for setMarkerPositionAndElevation missing in de…
vincentfretin Jun 7, 2024
f3539d0
add nayuki's qrcodegen.js library
vincentfretin Jun 7, 2024
2ba2375
show QR code and download it in jpg format
vincentfretin Jun 7, 2024
5205ac3
add production deploy project id
kfarr Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"homepage": "https://github.com/3dstreet/3dstreet/",
"license": "AGPLv3",
"dependencies": {
"@react-google-maps/api": "^2.19.3",
"aframe-atlas-uvs-component": "^3.0.0",
"classnames": "^2.3.2",
"clipboard": "^2.0.11",
Expand Down
3 changes: 3 additions & 0 deletions src/components/street-geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ AFRAME.registerComponent('street-geo', {
pxToWorldRatio: 4
});
mapbox2dElement.classList.add('autocreated');
mapbox2dElement.setAttribute('data-ignore-raycaster', '');
el.appendChild(mapbox2dElement);
return mapbox2dElement;
},
Expand All @@ -75,6 +76,7 @@ AFRAME.registerComponent('street-geo', {
const el = this.el;

const google3dElement = document.createElement('a-entity');
google3dElement.setAttribute('data-no-pause', '');
google3dElement.setAttribute('data-layer-name', 'Google 3D Tiles');
google3dElement.setAttribute('loader-3dtiles', {
url: 'https://tile.googleapis.com/v1/3dtiles/root.json',
Expand All @@ -88,6 +90,7 @@ AFRAME.registerComponent('street-geo', {
cameraEl: '#camera'
});
google3dElement.classList.add('autocreated');
google3dElement.setAttribute('data-ignore-raycaster', '');
el.appendChild(google3dElement);
return google3dElement;
},
Expand Down
23 changes: 21 additions & 2 deletions src/editor/components/Main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, HelpButton, Logo, ZoomButtons } from './components';
import { Button, HelpButton, GeoPanel, Logo, ZoomButtons } from './components';
import { CameraToolbar } from './viewport';
import { Compass32Icon } from '../icons';
import { Component } from 'react';
Expand All @@ -13,6 +13,7 @@ import TransformToolbar from './viewport/TransformToolbar';
import { injectCSS } from '../lib/utils';
import { SignInModal } from './modals/SignInModal';
import { ProfileModal } from './modals/ProfileModal';
import { GeoModal } from './modals/GeoModal';
import { ScenesModal } from './modals/ScenesModal';
import { SceneEditTitle } from './components/SceneEditTitle';
import { AddLayerButton } from './components/AddLayerButton';
Expand All @@ -35,6 +36,7 @@ export default class Main extends Component {
isSignInModalOpened: false,
isProfileModalOpened: false,
isAddLayerPanelOpen: false,
isGeoModalOpened: false,
isScenesModalOpened: !isStreetLoaded,
sceneEl: AFRAME.scenes[0],
visible: {
Expand Down Expand Up @@ -114,6 +116,9 @@ export default class Main extends Component {
Events.on('openprofilemodal', () => {
this.setState({ isProfileModalOpened: true });
});
Events.on('opengeomodal', () => {
this.setState({ isGeoModalOpened: true });
});
}

onCloseHelpModal = (value) => {
Expand Down Expand Up @@ -149,6 +154,10 @@ export default class Main extends Component {
this.setState({ isProfileModalOpened: false });
};

onCloseGeoModal = () => {
this.setState({ isGeoModalOpened: false });
};

toggleEdit = () => {
if (this.state.inspectorEnabled) {
AFRAME.INSPECTOR.close();
Expand Down Expand Up @@ -201,6 +210,7 @@ export default class Main extends Component {
const scene = this.state.sceneEl;
const isEditor = !!this.state.inspectorEnabled;
const sceneData = AFRAME.scenes[0].getAttribute('metadata', 'sceneTitle');
const isProUser = currentUser && currentUser.isBeta;

kfarr marked this conversation as resolved.
Show resolved Hide resolved
return (
<div>
Expand Down Expand Up @@ -248,6 +258,10 @@ export default class Main extends Component {
isOpen={this.state.isProfileModalOpened}
onClose={this.onCloseProfileModal}
/>
<GeoModal
isOpen={this.state.isGeoModalOpened}
onClose={this.onCloseGeoModal}
/>
<ModalTextures
isOpen={this.state.isModalTexturesOpen}
selectedTexture={this.state.selectedTexture}
Expand All @@ -258,6 +272,11 @@ export default class Main extends Component {
<HelpButton />
</div>
)}
{isProUser && this.state.inspectorEnabled && (
<div id="geo">
<GeoPanel />
</div>
)}
{this.state.inspectorEnabled && (
<div id="scene-title">
<SceneEditTitle sceneData={sceneData} />
Expand All @@ -273,7 +292,7 @@ export default class Main extends Component {
<Compass32Icon />
</Button>
)}
{currentUser && currentUser.isBeta && this.state.inspectorEnabled && (
{isProUser && this.state.inspectorEnabled && (
<div id="layerWithCategory">
<AddLayerButton onClick={this.toggleAddLayerPanel} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,24 @@ function createSvgExtrudedEntity() {
function createMapbox() {
// This component accepts a long / lat and renders a plane with dimensions that
// (should be) at a correct scale.
const newEl = document.createElement('a-entity');
newEl.setAttribute('geometry', 'primitive: plane; width: 512; height: 512;');
newEl.setAttribute('rotation', '-90 0 0');
newEl.setAttribute(
'mapbox',
`center: -122.417490, 37.765190;
zoom: 18;
accessToken: pk.eyJ1Ijoia2llcmFuZmFyciIsImEiOiJjazB0NWh2YncwOW9rM25sd2p0YTlxemk2In0.mLl4sNGDFbz_QXk0GIK02Q;
style: mapbox://styles/mapbox/satellite-streets-v11;
pxToWorldRatio: 4;`
const geoLayer = document.getElementById('reference-layers');
let latitude = 0;
let longitude = 0;
// get coordinate data in this format: {latitude: ..., longitude: ...}
const coord = AFRAME.scenes[0].getAttribute('metadata')['coord'];

if (coord) {
latitude = roundToSix(parseFloat(coord.latitude));
longitude = roundToSix(parseFloat(coord.longitude));
}

geoLayer.setAttribute(
'street-geo',
`
latitude: ${latitude}; longitude: ${longitude}; maps: mapbox2d
`
);
newEl.setAttribute('data-layer-name', 'Aerial Imagery • Mapbox Satellite');
const parentEl = document.querySelector('#reference-layers');
parentEl.appendChild(newEl);
// update sceneGraph
Events.emit('entitycreated', newEl);
Events.emit('entitycreated', geoLayer);
}

function createStreetmixStreet() {
Expand Down Expand Up @@ -80,38 +82,42 @@ function loadScript(url, callback) {
document.head.appendChild(script);
}

const roundToSix = (num) => {
return Math.round(num * 1e6) / 1e6;
};

function create3DTiles() {
// This code snippet adds an entity to load and display 3d tiles from
// Google Maps Tiles API 3D Tiles endpoint. This will break your scene
// and you cannot save it yet, so beware before testing.

const create3DtilesElement = () => {
const newEl = document.createElement('a-entity');
newEl.setAttribute('data-no-pause', '');
newEl.setAttribute('id', 'tileset');
newEl.setAttribute('data-layer-name', 'Aerial Imagery • Google 3D Tiles');
newEl.setAttribute(
'loader-3dtiles',
const geoLayer = document.getElementById('reference-layers');
let latitude = 0;
let longitude = 0;
let elevation = 0;
// get coordinate data in this format: {latitude: ..., longitude: ..., elevation: ...}
const coord = AFRAME.scenes[0].getAttribute('metadata')['coord'];

if (coord) {
latitude = roundToSix(parseFloat(coord.latitude));
longitude = roundToSix(parseFloat(coord.longitude));
elevation = parseFloat(coord.elevation) || 0;
}

geoLayer.setAttribute(
'street-geo',
`
lat: 37.77522354250163;
long: -122.41931773049723;
height: -16.5;
url: https://tile.googleapis.com/v1/3dtiles/root.json;
googleApiKey: AIzaSyAQshwLVKTpwTfPJxFEkEzOdP_cgmixTCQ;
geoTransform: WGS84Cartesian;
maximumSSE: 48;
maximumMem: 400;
cameraEl: #camera
`
latitude: ${latitude}; longitude: ${longitude}; elevation: ${elevation}; maps: google3d
`
);
// this line needs to load tiles from the Editor. Need to delete after updating aframe-loaders-3dtiles-component
geoLayer.play();

const refLayers = document.querySelector('#reference-layers');
// remove all reference elements
while (refLayers.firstChild) {
refLayers.removeChild(refLayers.firstChild);
}
refLayers.appendChild(newEl);
document.querySelector('#tileset').play();
// update sceneGraph
Events.emit('entitycreated', newEl);
Events.emit('entitycreated', geoLayer);
};
// This code snippet adds an entity to load and display 3d tiles from Google Maps Tiles API 3D Tiles endpoint. This will break your scene and you cannot save it yet, so beware before testing.

if (AFRAME.components['loader-3dtiles']) {
create3DtilesElement();
} else {
Expand Down
21 changes: 21 additions & 0 deletions src/editor/components/components/GeoPanel/GeoPanel.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import GeoImg from '../../../../../ui_assets/geo.png';
import styles from './GeoPanel.module.scss';
import Events from '../../../lib/Events';

/**
* GeoPanel component.
*
* @author Rostyslav Nahornyi
* @category Components.
*/
const GeoPanel = () => {
const onClick = () => Events.emit('opengeomodal');

return (
<div className={styles.geo}>
<img src={GeoImg} onClick={onClick} alt="geo" />
<p>San Francisco, California at Market and Van Ness Streets</p>
</div>
);
};
export { GeoPanel };
17 changes: 17 additions & 0 deletions src/editor/components/components/GeoPanel/GeoPanel.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@use '../../../style/variables.scss';

.geo {
display: flex;
column-gap: 24px;
position: absolute;
bottom: 32px;
left: 32px;

& > img {
cursor: pointer;
}

& > p {
font-size: 16px !important;
}
}
1 change: 1 addition & 0 deletions src/editor/components/components/GeoPanel/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { GeoPanel } from './GeoPanel.component.jsx';
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
position: absolute;
left: 32px;
border: unset;
bottom: 31px;
bottom: 32px;
border-radius: 50%;
width: 43px;
height: 43px;
Expand Down
1 change: 1 addition & 0 deletions src/editor/components/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export { ScreenshotButton } from './ScreenshotButton';
export { ProfileButton } from './ProfileButton';
export { SceneCard } from './SceneCard';
export { SceneEditTitle } from './SceneEditTitle';
export { GeoPanel } from './GeoPanel';
Loading
Loading