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

streetplan building support wip #1036

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 139 files
6 changes: 6 additions & 0 deletions src/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,12 @@
"name": "Arched Building 4",
"img": "https://assets.3dstreet.app/thumbnails/arched-building-04.jpg"
},
{
"id": "sp-building-08",
"name": "Mixed Use Building, Victorian Style",
"src": "/assets/sets/buildings/gltf-exports/draco/sp-building-08.glb",
"category": "buildings"
},
{
"id": "ElectricScooter_1",
"name": "Electric Scooter",
Expand Down
189 changes: 131 additions & 58 deletions src/components/managed-street.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ const STREETPLAN_MATERIAL_MAPPING = {
};

const STREETPLAN_OBJECT_MAPPING = {
'away, left park, head in': '',
'away, left park, head in': null,
'barrier 1-ft': 'temporary-jersey-barrier-concrete',
'barrier 2-ft': 'temporary-jersey-barrier-concrete',
'bike food cart': '',
'bikelane sharecar': '',
'bikerack bollard': '',
'blank pedrefuge (8ft)': '',
'barrier 2-ft': {
modelsArray:
'temporary-jersey-barrier-concrete, temporary-jersey-barrier-plastic',
mode: 'fixed',
spacing: 2
},
'bike food cart': null,
'bikelane sharecar': null,
'bikerack bollard': null,
'blank pedrefuge (8ft)': null,
'blue car': 'sedan-rig',
'blue mailbox': 'usps-mailbox',
'bollard plastic yellow': 'bollard',
Expand All @@ -64,14 +69,14 @@ const STREETPLAN_OBJECT_MAPPING = {
'cactus median (4ft)': 'dividers-bush',
'cactus median (6ft)': 'dividers-bush',
'cactus median (8ft)': 'dividers-bush',
'casual woman': '',
'casual woman': null,
couple: '',
'couple biking': '',
'couple biking': null,
'desertwillow texas': 'tree3',
'dog walker': '',
'empty place holder': '',
'dog walker': null,
'empty place holder': null,
'english oak': 'tree3',
'fleamarket stuff': '',
'fleamarket stuff': null,
'flower median (10ft)': 'dividers-flowers',
'flower median (12ft)': 'dividers-flowers',
'flower median (4ft)': 'dividers-flowers',
Expand All @@ -82,16 +87,16 @@ const STREETPLAN_OBJECT_MAPPING = {
'flowers pedrefuge (8ft)': 'dividers-flowers',
goldenraintree: 'tree3',
'golfcart red 4ft back': 'tuk-tuk',
'grassmound (10ft)': '',
'grassmound (12ft)': '',
'grassmound (4ft)': '',
'grassmound (6ft)': '',
'grassmound (8ft)': '',
'grassy median (10ft)': '',
'grassy median (12ft)': '',
'grassy median (4ft)': '',
'grassy median (6ft)': '',
'grassy median (8ft)': '',
'grassmound (10ft)': null,
'grassmound (12ft)': null,
'grassmound (4ft)': null,
'grassmound (6ft)': null,
'grassmound (8ft)': null,
'grassy median (10ft)': null,
'grassy median (12ft)': null,
'grassy median (4ft)': null,
'grassy median (6ft)': null,
'grassy median (8ft)': null,
'green car': 'sedan-rig',
'heavy rail': 'tram',
'heavy rail rev': 'tram',
Expand All @@ -105,11 +110,11 @@ const STREETPLAN_OBJECT_MAPPING = {
'japanese zelkova': 'tree3',
'jerusalem thorn': 'tree3',
'kentucky coffeetree': 'tree3',
'large food cart': '',
'large food cart': null,
'large oak': 'tree3',
'light rail poles': '',
'light rail poles': null,
'moto highway rider': 'motorbike',
'mountable barrier 1-ft': '',
'mountable barrier 1-ft': null,
'nev shuttle back': 'minibus',
'nev shuttle front': 'minibus',
'nyc bike rack': 'bikerack',
Expand All @@ -122,32 +127,32 @@ const STREETPLAN_OBJECT_MAPPING = {
'planter flowers': 'dividers-flowers',
'planter with bench': 'bench',
'polaris gem e4': 'tuk-tuk',
'power tower 30ft': '',
'purpendicular right side, blue': '',
'purpendicular right side, red': '',
'power tower 30ft': null,
'purpendicular right side, blue': null,
'purpendicular right side, red': null,
'purpleleaf plum': 'tree3',
'random trashcan': 'trash-bin',
'red berries 14ft': 'tree3',
'red car': 'sedan-rig',
'red jeep': 'suv-rig',
'rock median (10ft)': '',
'rock median (12ft)': '',
'rock median (4ft)': '',
'rock median (6ft)': '',
'rock median (8ft)': '',
'rock median (10ft)': null,
'rock median (12ft)': null,
'rock median (4ft)': null,
'rock median (6ft)': null,
'rock median (8ft)': null,
'semi truck': 'box-truck-rig',
'serious man': '',
'serious man': null,
shelter: 'bus-stop',
'shelter roundroof': 'bus-stop',
'sign directory': 'wayfinding',
'silver suv': 'suv-rig',
'small tree': 'tree3',
smallnev: 'minibus',
'smartcar 5ft': 'self-driving-cruise-car-rig',
'soundwall (12ft)': '',
'soundwall (8ft)': '',
'soundwall plants (12ft)': '',
'soundwall plants (8ft)': '',
'soundwall (12ft)': null,
'soundwall (8ft)': null,
'soundwall plants (12ft)': null,
'soundwall plants (8ft)': null,
'street light': 'lamp-modern',
'streetcar blue': 'trolley',
'streetcar red 1': 'trolley',
Expand All @@ -157,34 +162,99 @@ const STREETPLAN_OBJECT_MAPPING = {
'streetlight solar banners 1': 'lamp-modern',
'streetlight solar banners 2': 'lamp-modern',
tallgrass: '',
'tallplantbox (10ft)': '',
'tallplantbox (10ft)': null,
'tallplantbox (12ft)': 'dividers-bush',
'tallplantbox (4ft)': '',
'tallplantbox (6ft)': '',
'tallplantbox (8ft)': '',
'tallplantbox pedref (10ft)': '',
'tallplantbox pedref (12ft)': '',
'tallplantbox pedref (6ft)': '',
'tallplantbox pedref (8ft)': '',
'tallplantbox (4ft)': null,
'tallplantbox (6ft)': null,
'tallplantbox (8ft)': null,
'tallplantbox pedref (10ft)': null,
'tallplantbox pedref (12ft)': null,
'tallplantbox pedref (6ft)': null,
'tallplantbox pedref (8ft)': null,
'telephone pole': 'utility_pole',
'tent bluewhite': '',
'tent veggie': '',
'toward, right park, head in': '',
'tent bluewhite': null,
'tent veggie': null,
'toward, right park, head in': null,
trashcan: 'trash-bin',
'tropical median (4ft)': 'palm-tree',
'two bikes back': '',
'two bikes back': null,
'uta bus': 'bus',
'uta lightrail': 'tram',
'uta lightrail rev': 'tram',
'weeds median (4ft)': '',
'weeds median (6ft)': '',
'weeds median (8ft)': '',
'weeds median (4ft)': null,
'weeds median (6ft)': null,
'weeds median (8ft)': null,
'white coup': 'sedan-rig',
'white sedan': 'sedan-rig',
'white truck': 'box-truck-rig',
'yellow sedan': 'sedan-rig'
};

const STREETPLAN_BUILDING_MAPPING = {
'single family': null,
'single family back': null,
'house newurbanist': null,
'house newurbanist red': null,
'mart chilis': null,
'gas station': null,
'home depot': null,
walmart: null,
'stripmall oneroparking': null,
'stripmall1 tworowsparking': null,
'stripmall2 tworowsparking': null,
'stripmall1, oneroparking': null,
'shop 1floor': null,
'brick apartment 1floor': null,
'red mixed use 1floor': null,
'building blue 1floor': null,
'building yellow 1floor': null,
'house 1floor': null,
'shop 2floors': null,
'live work': 'sp-building-08', // 'sp-structure-building-08'
narrow: null,
'mikedesign midvale 2story': null,
'mixed use 2floors': null,
'red mixed use 2floors': null,
'brick apartment 2floors': null,
'building blue 2floors': null,
'building yellow 2floors': null,
'house 2floors': null,
'mixed use 3floors': null,
'red mixed use 3floors': null,
'shop 3floors': null,
'brick apartment 3floors': null,
'nice apartment 3story': null,
'mikedesign midvale 3story': null,
'mikedesign midvale3 3story': null,
'townhouse row 3story': null,
'building blue 3floors': null,
'building yellow 3floors': null,
'house 3floors': null,
'mixed use 4floors': null,
'red mixed use 4floors': null,
'shop 4floors': null,
'nice apartment 4story': null,
'brick apartment 4floors': null,
'building blue 4floors': null,
'building yellow 4floors': null,
'house 4floors': null,
'mixed use 5floors': null,
'red mixed use 5floors': null,
'nice apartment 5story': null,
'brick apartment 5floors': null,
'nice apartment 6story': null,
'building blue 5floors': null,
'building blue 6floors': null,
'building blue 7floors': null,
'building yellow 5floors': null,
'house 5floors': null,
'building yellow 6floors': null,
'building yellow 7floors': null,
fence: null,
'buildings falltrees (30ft)': null,
'buildings pinetrees (30ft)': null
};

// Streetplan Helper function to parse O-Tags string into array
function parseOTags(tags) {
if (!tags || tags === '-') return [];
Expand All @@ -195,9 +265,12 @@ function parseOTags(tags) {
function createCloneConfig(name, tags) {
if (!name || name === '-') return null;

const model = STREETPLAN_OBJECT_MAPPING[name.toLowerCase()];
if (!model) return null;

let model = STREETPLAN_OBJECT_MAPPING[name.toLowerCase()];
if (!model) {
// if no model found, then see if a building matches
model = STREETPLAN_BUILDING_MAPPING[name.toLowerCase()];
// TODO: if building left vs. right
}
return {
mode: 'fixed', // default to fixed mode
model: model,
Expand Down Expand Up @@ -540,9 +613,9 @@ AFRAME.registerComponent('managed-street', {
const segment = segments[segmentKey];

// Skip Buildings and Setback segments
if (segment.Type === 'Buildings' || segment.Type === 'Setback') {
continue;
}
// if (segment.Type === 'Buildings' || segment.Type === 'Setback') {
// continue;
// }

const segmentWidth = parseFloat(segment.width) * 0.3048; // Convert feet to meters
streetObject.width += segmentWidth;
Expand Down
Loading