var beansUrlParameter = function(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } } var getBaseConfig = function(urlFromRequest) { return { address: '', useGroundElevation: false, elevation: 0, canonicalUrl: urlFromRequest }; } var convertUnitsArr2 = function(address, unitsArr, hideMarkers) { var convertedArr = []; for (var i = 0; i < unitsArr.length; i++) { var bedText = unitsArr[i].bed ? (unitsArr[i].bed + ' Bed') : 'Studio'; var td = new Date().toISOString().substring(0, 10); var as = (unitsArr[i].availability ? ('on ' + unitsArr[i].availability) : 'Now'); if (unitsArr[i].availability && unitsArr[i].availability <= td) { as = 'Now'; } var onPreviewData; if (unitsArr.floorplanImg) { onPreviewData = [ { value: bedText + ' / ' + unitsArr[i].bath + ' Bath / ' + (unitsArr[i].sqft ? unitsArr[i].sqft.toLocaleString() : '0') + ' sq. ft.' }, { value: 'img:' + unitsArr[i].floorplanImg }, { value: '$' + (unitsArr[i].rent ? unitsArr[i].rent.toLocaleString() : '0') + '/ mo' }, { value: 'Available ' + as } ]; } else { onPreviewData = [ { value: bedText + ' / ' + unitsArr[i].bath + ' Bath / ' + (unitsArr[i].sqft ? unitsArr[i].sqft.toLocaleString() : '0') + ' sq. ft.' }, { value: '$' + (unitsArr[i].rent ? unitsArr[i].rent.toLocaleString() : '0') + '/ mo' }, { value: 'Available ' + as } ]; } convertedArr.push({ address: address, unit: unitsArr[i].unit, options: { markers: { display: hideMarkers ? false : true }, poi: [ { name: "ALL", display: false }, { name: "CLUBHOUSE", display: true }, { name: "SWIMMINGPOOL", display: true }, { name: "OFFICE", display: true }, { name: "GYM", display: true }, { name: "MAILROOM", display: true }, { name: "LAUNDRY", display: true }, { name: "PLAYGROUND", display: true } ], onPreviewData: onPreviewData, onClickData: { name: unitsArr[i].unit ? unitsArr[i].unit.replaceAll('||', ' - ') : '', bed: unitsArr[i].bed, bath: unitsArr[i].bath, sqft: unitsArr[i].sqft, rent: unitsArr[i].rent, floorplanImg: unitsArr[i].floorplanImg, availability: unitsArr[i].availability, link: unitsArr[i].link ? unitsArr[i].link.replaceAll('&', '&') : '' } } }); } return convertedArr; } var convertUnitsArr = function(config, unitsArr, hideMarkers) { var addressAndUnitWithOptions; if (unitsArr.length === 0) { unitsArr.push({ unit: '' }); addressAndUnitWithOptions = convertUnitsArr2(config.address, unitsArr, hideMarkers); addressAndUnitWithOptions[0].isPlaceHolder = true; } else { unitsArr.sort((a, b) => { var aa = a.unit ? a.unit : ''; var bb = b.unit ? b.unit : ''; return aa.localeCompare(bb); }); addressAndUnitWithOptions = convertUnitsArr2(config.address, unitsArr, hideMarkers); } if (config.unitShapeConfig) { for (var i = 0; i < addressAndUnitWithOptions.length; i++) { addressAndUnitWithOptions[i].options.unitShape = config.unitShapeConfig(addressAndUnitWithOptions[i]); } } if (config.poi) { for (var i = 0; i < addressAndUnitWithOptions.length; i++) { for (var j = 0; j < config.poi.length; j++) { addressAndUnitWithOptions[i].options.poi.push(config.poi[j]); } } } return addressAndUnitWithOptions; } var commonImmersives = [ { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/0", elevationInfo: { mode: "absolute-height", offset: 0.5, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Apricot", symbol: { type: "web-style", name: "Prunus", styleName: "EsriRealisticTreesStyle" } }, { value: "Mountain Mahogany", symbol: { type: "web-style", name: "Cercocarpus", styleName: "EsriRealisticTreesStyle" } }, { value: "Rose", symbol: { type: "web-style", name: "Rosa", styleName: "EsriRealisticTreesStyle" } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/1", elevationInfo: { mode: "absolute-height", offset: 0.5, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Walkway", symbol: { type: "simple-line", width: 4, color: "#fcf5de" } }, { value: "Road", symbol: { type: "simple-line", width: 16, color: "#eeeeee" } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/2", elevationInfo: { mode: "absolute-height", offset: 0.5, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Lawn", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#b2c388" } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/2", elevationInfo: { mode: "absolute-height", offset: 1.0, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Water", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#a5c2d1" } } ] }, isFeature: true }, ]; var getDisplayOptions = function( config, unitShape_, // Default shape selectedUnitShape_, // Selected shape selectableUnitShape_, // Selectable shape hoverUnitShape_ ) { return { propertyAddress: config.address, offsetGroundElevation: config.elevation, useGroundElevation: config.useGroundElevation, showUnitList: true, showUnitShape: true, showDirections: false, showPath: false, camera: config.camera, mobileCamera: config.mobileCamera, renameAmenities: config.renameAmenities ? config.renameAmenities : null, shadowModeUnitShape: config.shadowModeUnitShape ? config.shadowModeUnitShape : { fillColor: '#ffffff', fillOpacity: 1.0, }, neighborModeUnitShape: config.neighborModeUnitShape ? config.neighborModeUnitShape : { fillColor: '#D8D7D4', fillOpacity: 1.0, }, unitShape: config.unitShape ? config.unitShape : { fillColor: '#DDE3E0', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 0.5, strokeColor: '#000000', ...unitShape_ }, selectedUnitShape: config.selectedUnitShape ? config.selectedUnitShape : { fillColor: '#A6671D', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 1.0, strokeColor: '#ffffff', ...selectedUnitShape_ }, selectableUnitShape: config.selectableUnitShape ? config.selectableUnitShape : { fillColor: '#24453E', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 1.0, strokeColor: '#ffffff', ...selectableUnitShape_ }, satelliteModeUnitShape: config.satelliteModeUnitShape ? config.satelliteModeUnitShape : { fillColor: '#ffffff', fillOpacity: 1.0, }, neighborShape: config.neighborShape, immersiveModeUnitShape: config.immersiveModeUnitShape, poiShape: config.poiShape, hoverUnitShape: hoverUnitShape_ ? hoverUnitShape_ : null, // mobileUnitShape: { // fillColor: '#ffffff', // fillOpacity: 0.2, // strokeWeight: 0.5, // strokeOpacity: 0.2, // strokeColor: '#000000', // } }; } var BeansMFPro2D = function() { }; function beansUrlParameter(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } } BeansMFPro2D.prototype.getConfigFromUrl = function(urlFromRequest) { var canonicalUrl = urlFromRequest ? urlFromRequest : window.location.hostname; if (beansUrlParameter('canonicalUrl')) { canonicalUrl = beansUrlParameter('canonicalUrl'); } var baseConfig = getBaseConfig(canonicalUrl); var config = {}; config["www.apartmentsdowntownknoxville.com"] = { camera: {tilt: 62.2047593533014, heading: 276.4372990663152, position: {x: -83.91083167479113, y: 35.972078026492476, z: 147.89846203755587}}, address: "215 Florida St, Knoxville, TN", showImmersive: true, showImmersiveLight: true, showImmersiveOnLoad: true, addressList: { '215 Florida St, Knoxville, TN': true, '311 Florida St, Knoxville, TN': true }, immersiveConfig: [ ...commonImmersives, { url: "https://tiles.arcgis.com/tiles/ob6JNU9Q3wDJysjr/arcgis/rest/services/215_Florida_Street_Stadium/SceneServer/layers/0", elevationInfo: { mode: "absolute-height", offset: 4.5, }, immersiveType: 'units' }, // { // url: "https://tiles.arcgis.com/tiles/ob6JNU9Q3wDJysjr/arcgis/rest/services/215_Florida_St_Knoxville_TN_Units/SceneServer", // elevationInfo: { // mode: "absolute-height", // offset: 4.5, // }, // immersiveType: 'units' // } ], numbersConfig: { size: 18, xOffset: 9, // xOffsetFn: (a, raw, whatIsItFor) => { // if (a && a.startsWith('AMEN')) { // return -8; // } // if (a && a.startsWith('POOL')) { // return -45; // } // if (a.indexOf('SWIMMINGPOOL') !== -1) { // return -20; // } // return -8; // }, // yOffsetFn: (a, raw, whatIsItFor) => { // if (a && a.startsWith('AMEN')) { // return 25; // } // if (a && a.startsWith('POOL')) { // return 15; // } // return -8; // }, rotateFn: (a, raw, whatIsItFor) => { if (a && a.startsWith('AMEN')) { return -127; } if (a && a.startsWith('POOL')) { return -82; } return -38; }, colorFn: (a, raw, whatIsItFor) => { if (whatIsItFor !== 0) { return '#ffffff'; } return '#000000'; }, convert: (a) => { if (!a) { return a; } if (a && a.startsWith('POOL')) { return 'POOL DECK'; } if (a.indexOf('SWIMMINGPOOL') !== -1) { return 'POOL'; } if (a.indexOf('TRASH') !== -1) { return ''; } if (a.indexOf('AMENITY') !== -1) { return 'AMENITY'; } return a; } }, backgroundImage: { src: '/mapswidget/prettymaps/215florida.png', width: '3224px', height: '2568px', position: { lat: 35.97365898864503, lng: -83.91660359407762, lat2: 35.970859278425835, lng2: -83.91227153254786 } }, initialPosition: { lat: 35.9724669738736, lng: -83.9135662529013 }, zoom: 19, }; config["www.apartmentsinlebanonin.com"] = { camera: {tilt: 66.59519617928288, heading: 238.71725482164936, position: {x: -86.465507678286, y: 40.02832195145298, z: 239.8634699927643}}, address: "901 Kelly Green Ln, Lebanon, IN", skipBuildingNumberinSearch: true, showImmersive: true, showImmersiveLight: true, showImmersiveOnLoad: true, addressList: { '901 Kelly Green Ln, Lebanon, IN': true, '275 Quinn Ln, Lebanon, IN': true, '325 Quinn Ln, Lebanon, IN': true, '375 Quinn Ln, Lebanon, IN': true, '475 Quinn Ln, Lebanon, IN': true, '525 Quinn Ln, Lebanon, IN': true, '575 Quinn Ln, Lebanon, IN': true, '1141 Champion Way, Lebanon, IN': true, '1041 Champion Way, Lebanon, IN': true, '941 Champion Way, Lebanon, IN': true, '841 Champion Way, Lebanon, IN': true, '570 Arsdale Ave, Lebanon, IN': true, '520 Arsdale Ave, Lebanon, IN': true, '470 Arsdale Ave, Lebanon, IN': true, '370 Arsdale Ave, Lebanon, IN': true, '320 Arsdale Ave, Lebanon, IN': true, '270 Arsdale Ave, Lebanon, IN': true, '625 Victory Ln, Lebanon, IN': true, '620 Victory Ln, Lebanon, IN': true, '675 Victory Ln, Lebanon, IN': true, '670 Victory Ln, Lebanon, IN': true, '725 Victory Ln, Lebanon, IN': true, '720 Victory Ln, Lebanon, IN': true, '775 Victory Ln, Lebanon, IN': true, '770 Victory Ln, Lebanon, IN': true, '1020 Kelly Green Ln, Lebanon, IN': true, '940 Kelly Green Ln, Lebanon, IN': true, '920 Kelly Green Ln, Lebanon, IN': true, '901 Kelly Green Ln, Lebanon, IN': true, '820 Wooden Way, Lebanon, IN': true, '920 Wooden Way, Lebanon, IN': true }, immersiveConfig: [ ...commonImmersives, { url: "https://tiles.arcgis.com/tiles/ob6JNU9Q3wDJysjr/arcgis/rest/services/901_Units/SceneServer", elevationInfo: { mode: "absolute-height", offset: 0.5, }, immersiveType: 'units' } ], numbersConfig: { sizeFn: (a) => { if (a && (a.startsWith('BOCCE') || a.startsWith('CORN'))) { return 3.5; } return 5; }, yOffset: -5, // xOffsetFn: (a) => { // if (a && a.startsWith('SWIMMING')) { // return -18; // } // return -6; // }, // yOffsetFn: (a) => { // if (a && a.startsWith('SWIMMING')) { // return -2; // } // if (a && (a.startsWith('BOCCE') || a.startsWith('CORN'))) { // return -3; // } // var b = Number(a); // if (Number.isNaN(b)) { // return -6; // } // if (b % 2 == 0) { // if((b > 7000 && b < 8000) || (b > 9000 && b < 10000) || (b > 11000 && b < 12000) || (b > 13000 && b < 15000) // || (b > 16000 && b < 22000) || (b > 23000 && b < 24000) || (b > 25000 && b < 26000)) { // return -5; // } // return 0; // } // if((b > 7000 && b < 8000) || (b > 9000 && b < 10000) || (b > 11000 && b < 12000) || (b > 13000 && b < 15000) // || (b > 16000 && b < 22000) || (b > 23000 && b < 24000) || (b > 25000 && b < 26000)) { // return 0; // } // return -5; // }, rotateFn: (a, raw, whatIsItFor) => { if (a && (a.startsWith('SWIMMING') || a.startsWith('BOCCE') || a.startsWith('CORN'))) { return -27; } return 0; }, colorFn: (a, raw, whatIsItFor) => { if (whatIsItFor !== 0) { return '#ffffff'; } return '#000000'; }, convert: (a) => { if (!a) { return a; } if (a.indexOf('SWIMMINGPOOL') !== -1) { return 'SWIMMING POOL'; } if (a.indexOf('AMENITY') !== -1) { return 'AMENITY'; } return a; } }, backgroundImage: { src: '/mapswidget/prettymaps/901kelly.png', width: '1292px', height: '509px', position: { lat: 40.026655766412194, lng: -86.47535596303809, lat2: 40.02456096603873, lng2: -86.46845506298042 } }, initialPosition: { lat: 40.02568905068165, lng: -86.4721172890965, mobile: { lat: 40.02568905068165, lng: -86.4721172890965, } }, }; if (config[canonicalUrl]) { return {...baseConfig, ...config[canonicalUrl]}; } return baseConfig; } BeansMFPro2D.prototype.render = function(be1, urlFromRequest) { var so = this; var config = so.getConfigFromUrl(urlFromRequest); var address = config.address; fetch('https://gis-server.beans.ai/arcgis/rest/services/Hosted/Multifamily_pro/FeatureServer/0/query?where=1%3D1&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&defaultSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnCentroid=false&timeReferenceUnknownClient=false&maxRecordCountFactor=&sqlFormat=none&resultType=&datumTransformation=&lodType=geohash&lod=&lodSR=&f=pjson') .then(response => response.json()) .then(json => { var unitsArr = []; if (json.features) { for (var i = 0; i < json.features.length; i++) { if (!config.addressList[json.features[i].attributes.address]) { continue; } if (json.features[i].attributes.availability !== 'Available') { continue; } var type = json.features[i].attributes.type ? json.features[i].attributes.type : ''; var bedrooms = 0; var bathrooms = 0; if (type === 'Studio') { bathrooms = 1; } else { var y = /.*([0-9+]) Bed.*/.exec(type); if (y) { bedrooms = Number(y[1]); } var z = /.*([0-9+]) Bath.*/.exec(type); if (z) { bathrooms = Number(z[1]); } } var unit = '' + json.features[i].attributes.unit; var bldg = '' + json.features[i].attributes.address.substring(0, json.features[i].attributes.address.indexOf(' ')); if (!config.skipBuildingNumberinSearch) { unit = bldg + '-' + unit; } var floorplan = json.features[i].attributes.floor_plan_name ? json.features[i].attributes.floor_plan_name : ''; floorplan = floorplan.trim(); var floorplanImg = ''; if (floorplan) { if (floorplan.toLowerCase() === 'ace' || floorplan.toLowerCase() === 'aviator' || floorplan.toLowerCase() === 'bandit' || floorplan.toLowerCase() === 'baron' || floorplan.toLowerCase() === 'captain' || floorplan.toLowerCase() === 'clipper' || floorplan.toLowerCase() === 'curve' || floorplan.toLowerCase() === 'lookout' || floorplan.toLowerCase() === 'traveler' || floorplan.toLowerCase() === 'surge' || floorplan.toLowerCase() === 'alley-oop' || floorplan.toLowerCase() === 'assist' || floorplan.toLowerCase() === 'baseline' || floorplan.toLowerCase() === 'fast break' || floorplan.toLowerCase() === 'free throw' || floorplan.toLowerCase() === 'shot clock' || floorplan.toLowerCase() === 'slam dunk' || floorplan.toLowerCase() === 'swish' || floorplan.toLowerCase() === 'tip off') { floorplanImg = 'https://www.beans.ai/mapswidget/client/mfpro-images/' + floorplan.toLowerCase() + '.png'; } } var link = json.features[i].attributes.learn_more__url ? json.features[i].attributes.learn_more__url : ''; // if (floorplan) { // if (floorplan.toLowerCase() === 'aviator' // || floorplan.toLowerCase() === 'bandit' // || floorplan.toLowerCase() === 'baron' // || floorplan.toLowerCase() === 'captain' // || floorplan.toLowerCase() === 'clipper' // || floorplan.toLowerCase() === 'curve') { // link = 'https://apartmentsdowntownknoxville.com/apartments/one-bedroom-apartments/#for-rent-' + floorplan; // } // } unitsArr.push({ unit: unit, bed: bedrooms, bath: bathrooms ? bathrooms : 1, sqft: json.features[i].attributes.sqft ? json.features[i].attributes.sqft : 0, rent: json.features[i].attributes.price ? json.features[i].attributes.price : 0, floorplan: floorplan, floorplanImg: floorplanImg, link: link }); } } var addressAndUnitWithOptions = convertUnitsArr(config, unitsArr, true); var displayOptions = getDisplayOptions( config, { fillColor: '#FFFFFF', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 1.0, strokeColor: '#000000', }, // Default color { fillColor: '#CDA349', }, // Selected color { fillColor: '#3F1F08', } // Selectable color ); be1.render( "body-inner-2", "0b4b892684bd453:3233393738313435333931333464653438363730", addressAndUnitWithOptions, { hideNavigateButton: true, hideMyLocationButton: true }, { beansMapType: 'BANVAS', initialMap: "STREET", prettyLayer: config.prettyLayer, applyStr: 'Learn More', hideFloorSelector: false, hideSatelliteButton: true, hideShadow: true, hideRotateControl: true, inlineClickData: true, modernBeansCard: true, modernButtons: true, outsideButtons: true, showNeighbors: false, showPOIButton: false, showSeparateFacilitiesCard: true, showAllBuildingShapes: true, showBuildingShape: true, show3DButton: true, event3D: () => { document.getElementById('body-inner-2').style.visibility = 'hidden'; document.getElementById('body-inner-1').style.visibility = 'visible'; }, showNumbers: true, showFancyNumbers: true, numbersConfig: config.numbersConfig, backgroundImage: config.backgroundImage, initialZoom: config.zoom, initialPosition: config.initialPosition, buildingShape: config.buildingShape ? config.buildingShape : { fillColor: '#D8D8D8', fillOpacity: 1.0, strokeColor: '#fff', strokeWeight: 0.01, strokeOpacity: 0.0 }, ...displayOptions } ); }); }