Skip to content

Commit

Permalink
Merge branch 'street-geo-editor' of https://github.com/3DStreet/3dstreet
Browse files Browse the repository at this point in the history
 into street-geo-editor
  • Loading branch information
Algorush committed Jun 6, 2024
2 parents 43a122c + 79a9a7d commit 60f40bb
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 22 deletions.
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html>
<html>

<html>
<head>
<!-- aframe -->
<script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script>
Expand All @@ -15,6 +14,13 @@
<!-- viewer controls - vr teleport -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/aframe-blink-controls.min.js"></script>

<!-- posthog -->
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('phc_Yclai3qykyFi8AEFOrZsh6aS78SSooLzpDz9wQ9YAH9',{api_host:'https://us.i.posthog.com', person_profiles: 'identified_only' // or 'always' to create profiles for anonymous users as well
})
</script>

<script>
// TODO: This should be inside of Viewer Wrapper component logic
// this makes the same camera rig setup work in VR and desktop modes
Expand Down
12 changes: 10 additions & 2 deletions src/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ function buildAssetHTML(assetUrl, categories) {
<a-mixin shadow id="food-trailer-rig" gltf-model="url(${assetUrl}sets/vehicles-rig/gltf-exports/draco/food-trailer-rig.glb)"></a-mixin>
<a-mixin shadow id="fire-truck-rig" gltf-model="url(${assetUrl}sets/vehicles-rig/gltf-exports/draco/fire-truck-pumper-rig.glb)"></a-mixin>
<a-mixin shadow id="fire-ladder-rig" gltf-model="url(${assetUrl}sets/vehicles/gltf-exports/draco/fire_truck_ladder.glb)"></a-mixin>
<a-mixin shadow id="trash-truck-side-loading" gltf-model="url(${assetUrl}sets/vehicles/gltf-exports/draco/trash-truck-side-loading.glb)"></a-mixin>
<a-mixin shadow id="self-driving-cruise-car-rig" gltf-model="url(${assetUrl}sets/vehicles-rig/gltf-exports/draco/self-driving-cruise-car-rig.glb)"></a-mixin>
<a-mixin shadow id="self-driving-waymo-car" gltf-model="url(${assetUrl}sets/vehicles/gltf-exports/draco/waymo-self-driving-car.glb)"></a-mixin>
`,
buildings: `
<!-- blocks -->
Expand Down Expand Up @@ -188,11 +190,11 @@ function buildAssetHTML(assetUrl, categories) {
'vehicles-transit': `
<!-- vehicles-transit -->
<a-mixin shadow id="bus" anisotropy gltf-model="url(${assetUrl}sets/flyer-bus/gltf-exports/draco/new-flyer-bus.glb)"></a-mixin>
<a-mixin shadow id="tram" anisotropy gltf-model="url(${assetUrl}sets/light-rail-vehicle/gltf-exports/draco/light-rail-vehicle-v02.glb)"></a-mixin>
<a-mixin shadow id="tram" anisotropy gltf-model="url(${assetUrl}sets/light-rail-vehicle/gltf-exports/draco/light_rail_vehicle.glb)"></a-mixin>
<a-mixin shadow id="trolley" gltf-model="url(${assetUrl}sets/sanfrancisco-cablecar/gltf-exports/draco/sanfrancisco-cablecar_v01.glb)"></a-mixin>
`,
dividers: `
<!-- dividers -->
<!-- dividers - aka street design elements -->
<a-asset-item id="dividers" src="${assetUrl}sets/dividers/gltf-exports/draco/dividers.glb"></a-asset-item>
<a-mixin shadow id="dividers-flowers" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: flowers"></a-mixin>
<a-mixin shadow id="dividers-planting-strip" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: planting-strip"></a-mixin>
Expand All @@ -204,6 +206,12 @@ function buildAssetHTML(assetUrl, categories) {
<a-mixin shadow id="temporary-traffic-cone" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: traffic-cone"></a-mixin>
<a-mixin shadow id="temporary-jersey-barrier-plastic" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: jersey-barrier-plastic"></a-mixin>
<a-mixin shadow id="temporary-jersey-barrier-concrete" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: jersey-barrier-concrete"></a-mixin>
<a-mixin shadow id="street-element-crosswalk-raised" scale="1 1 1" rotation="0 0 0" gltf-model="url(${assetUrl}sets/uoregon/gltf-exports/draco/crosswalk-raised.glb)"></a-mixin>
<a-mixin shadow id="street-element-traffic-island-end-rounded" scale="1.5 1.5 1.5" rotation="0 0 0" gltf-model="url(${assetUrl}sets/uoregon/gltf-exports/draco/curb-island-end-rounded.glb)"></a-mixin>
<a-mixin shadow id="street-element-sign-warning-ped-rrfb" scale="1.5 1.5 1.5" rotation="0 0 0" gltf-model="url(${assetUrl}sets/uoregon/gltf-exports/draco/sign-warning-ped-rrfb.glb)"></a-mixin>
<a-mixin shadow id="street-element-traffic-post-k71" scale="1 1 1" rotation="0 0 0" gltf-model="url(${assetUrl}sets/uoregon/gltf-exports/draco/traffic-post-k71.glb)"></a-mixin>
<a-mixin shadow id="street-element-traffic-island" scale="1.5 1.5 1.5" rotation="0 0 0" gltf-model="url(${assetUrl}sets/uoregon/gltf-exports/draco/curb-traffic-island.glb)"></a-mixin>
<a-mixin shadow id="street-element-speed-hump" scale="1.5 1.5 1.5" rotation="0 0 0" gltf-model="url(${assetUrl}sets/uoregon/gltf-exports/draco/speed-hump.glb)"></a-mixin>
`,
sky: `
<!-- sky -->
Expand Down
20 changes: 15 additions & 5 deletions src/editor/components/components/GeoPanel/GeoPanel.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ import Events from '../../../lib/Events';
*/
const GeoPanel = () => {
const onClick = () => Events.emit('opengeomodal');
const metadata = AFRAME.scenes[0].getAttribute('metadata');
let coordinateInfo;
if (metadata && metadata['coord']) {
const coord = metadata['coord'];
coordinateInfo = `Latitude: ${coord.latitude}, Longitude: ${coord.longitude}, Elevation: ${coord.elevation}m`;

let latitude = 0;
let longitude = 0;
let elevation = 0;
let coordinateInfo = null;

const streetGeo = document
.getElementById('reference-layers')
?.getAttribute('street-geo');

if (streetGeo && streetGeo['latitude'] && streetGeo['longitude']) {
latitude = streetGeo['latitude'];
longitude = streetGeo['longitude'];
elevation = streetGeo['elevation'] || 0;
coordinateInfo = `Latitude: ${latitude}, Longitude: ${longitude}, Elevation: ${elevation}m`;
}

return (
Expand Down
23 changes: 11 additions & 12 deletions src/editor/components/modals/GeoModal/GeoModal.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,10 @@ const GeoModal = ({ isOpen, onClose }) => {
</div>
{isLoaded && (
<>
<Autocomplete
onLoad={onAutocompleteLoad}
onPlaceChanged={onPlaceChanged}
>
<Input
leadingIcon={<Mangnifier20Icon />}
placeholder="Search for a location"
onChange={(value) => {}}
/>
</Autocomplete>
<GoogleMap
mapContainerStyle={{
width: '100%',
minHeight: '350px',
minHeight: '200px',
borderRadius: 4,
border: '1px solid #8965EF'
}}
Expand All @@ -171,7 +161,16 @@ const GeoModal = ({ isOpen, onClose }) => {
</GoogleMap>
</>
)}

<Autocomplete
onLoad={onAutocompleteLoad}
onPlaceChanged={onPlaceChanged}
>
<Input
leadingIcon={<Mangnifier20Icon />}
placeholder="Search for a location"
onChange={(value) => {}}
/>
</Autocomplete>
<div className={styles.sceneGeo}>
<div>
<p>Centerpoint</p>
Expand Down
1 change: 1 addition & 0 deletions src/editor/lib/cameras.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,5 @@ function setOrthoCamera(camera, dir, ratio) {
camera.bottom = info.bottom || -40;
camera.position.copy(info.position);
camera.rotation.copy(info.rotation);
camera.updateProjectionMatrix();
}

0 comments on commit 60f40bb

Please sign in to comment.