{"version":3,"sources":["viewer/js/file-system-loader.ts","redux/assets-slice.ts","redux/project-slice.ts","projections/projections.tsx","redux/projections-slice.ts","dialogs.tsx","redux/folders-slice.ts","executable.ts","viewer/js/misc.ts","viewer/js/projections.ts","asset-utils.ts","dense-icon.tsx","tooltips.tsx","folder/asset.tsx","folder/folder.tsx","toolbar.tsx","folder/folder-list.tsx","tabs.tsx","viewer/js/utilities/polygon.ts","viewer/js/measurements/measurement.ts","viewer/js/controls/orbit-controls.ts","viewer/textures/colormaps/classifications.png","viewer/js/classifications.ts","viewer/js/shaders/index.ts","viewer/js/shaders/pointcloud_v.ts","viewer/js/shaders/pointcloud_f.ts","viewer/js/shaders/edl_v.ts","viewer/js/shaders/edl_f.ts","viewer/js/shaders/opacity_v.ts","viewer/js/shaders/opacity_f.ts","viewer/js/shaders/image_v.ts","viewer/js/shaders/image_f.ts","viewer/js/shaders/markers_v.ts","viewer/js/shaders/markers_f.ts","viewer/js/shaders/utilities_v.ts","viewer/js/shaders/gpu_picker_f.ts","viewer/textures/colormaps/index.ts","viewer/textures/colormaps/heat-map.png","viewer/textures/colormaps/awesome-green.png","viewer/textures/colormaps/pastel-shades.png","viewer/textures/colormaps/blue-orange.png","viewer/textures/colormaps/black-orange.png","viewer/textures/colormaps/blue-hue.png","viewer/textures/colormaps/blue-red.png","viewer/textures/colormaps/jet.png","viewer/textures/colormaps/grayscale.png","classifications.ts","viewer/js/materials.ts","viewer/js/pointcloud/cloud-node.ts","viewer/js/pointcloud/raw-pointcloud-node.ts","viewer/js/pointcloud/point-cloud.ts","viewer/js/pointcloud/raw-pointcloud.ts","viewer/js/pointcloud/encompass-pointcloud-node.ts","viewer/js/worker.ts","viewer/js/pointcloud/encompass-pointcloud.ts","viewer/js/binary-heap.ts","redux/settings-slice.ts","viewer/js/utilities/index.ts","viewer/js/cameras/cameras.ts","viewer/js/aerial/orthos.ts","redux/camera-slice.ts","viewer/js/aerial/map.ts","viewer/js/pointcloud/point-loader.ts","viewer/textures/arrow.png","viewer/textures/arrow-shadow.png","viewer/js/markers/markers.ts","viewer/events.ts","viewer/js/utilities/change-detection.ts","viewer/js/gpu-picker.ts","viewer/js/labelling/categories.ts","viewer/js/labelling/image-label.ts","viewer/js/labelling/ortho-label.ts","viewer/js/labelling/scene-label.ts","viewer/js/utilities/unit-converter.ts","viewer/js/measurements/measurement-aerial-view.ts","viewer/js/measurements/measurement-constructor.ts","viewer/js/measurements/measurement-formatter.ts","viewer/js/measurements/measurement-group.ts","viewer/js/measurements/measurement-group-exporter.ts","viewer/js/measurements/measurement-scene-view.ts","viewer/js/measurements/measurement-controller.ts","stats.module.js","viewer/js/main.ts","viewer/js/image-aligner/image-aligner.ts","viewer/js/controls/controls.ts","postprocessing/shaders/CopyShader.js","postprocessing/Pass.js","postprocessing/ShaderPass.js","postprocessing/MaskPass.js","postprocessing/EffectComposer.js","postprocessing/SSAARenderPass.js","viewer/js/controls/compass.ts","viewer/js/measurements/image-only.ts","measurements/measurements.tsx","asset-drawer.tsx","camera-utils.ts","app-bar.tsx","settings-drawer.tsx","enhanced-table.tsx","projections/manager.tsx","redux/store.ts","project-utils.tsx","alignment/aligner-advanced.tsx","alignment/aligner-basic.tsx","progress.tsx","buttons.tsx","labelling/image-labelling.tsx","viewer/context-menu.tsx","viewer/textures/map-preview/index.ts","viewer/textures/map-preview/open-street-maps.png","viewer/textures/map-preview/arcgis-world.png","viewer/textures/map-preview/arcgis-street.png","viewer/layer-switcher.tsx","viewer/viewer.tsx","static-export.tsx","app.tsx","index.tsx","electron-modules.ts"],"names":["readFileJSON","path","staticFile","Promise","resolve","reject","readJsonFromURL","readJsonElectron","readFileBuffer","readFileBufferFromURL","readFileBufferElectron","fetch","headers","then","res","json","data","catch","fs","readFile","err","JSON","parse","status","Error","arrayBuffer","byteLength","buffer","AssetType","defaultProjectTitle","currentConfigVersion","projectSlice","createSlice","name","initialState","newProject","modified","Date","toISOString","configVersion","reducers","refreshModified","state","action","changeName","payload","changePath","actions","selectName","project","selectProjectModified","unknownTextMeters","unknownTextFeet","unknownProjectionMeters","type","string","unknownProjectionFeet","defaultProjection","defaultTransform","origin","Array","fill","translation","rotation","scale","generateID","text","replace","projections","this","load","id","map","x","indexOf","isDuplicate","push","storage","set","result","get","obj","stringify","index","splice","projectionsSlice","view","measureUnits","changeData","changeView","changeMeasureUnits","selectView","selectData","selectMeasureUnits","useStyles","makeStyles","theme","createStyles","draggableTitleClose","color","palette","grey","marginRight","spacing","draggableTitleMinimize","draggableContent","padding","paddingTop","height","width","maxWidth","marginTop","headerHeight","draggableContentSlim","draggableContentLeft","marginLeft","draggableTopDiv","display","alignItems","draggableBackdropPaper","draggableBackdropRounded","borderRadius","draggableRoundCorner","backgroundColor","draggableTitle","userSelect","cursor","flex","draggableTitleDown","progressContent","progressNoTransition","transition","PromptDialog","props","open","title","prompt","button","onCancel","onSubmit","Dialog","onClose","aria-labelledby","aria-describedby","DialogTitle","DialogContent","DialogContentText","DialogActions","Button","onClick","AlertDialog","handleClose","children","TextDialog","useState","default","setText","disabled","setDisabled","useEffect","trim","handleSubmit","trimmedText","clear","TextField","onChange","event","target","value","onKeyDown","key","autoFocus","placeholder","margin","label","fullWidth","DraggableDialog","narrow","onMinimize","classes","mouseDown","setMouseDown","handle","fullScreen","className","clsx","paperFullScreen","scrollPaper","BackdropProps","onMouseDown","onMouseUp","IconButton","aria-label","fontSize","ProgressDialog","percent","noTransition","toFixed","LinearProgress","variant","bar","getAssetPayload","folderID","assetPath","slash","assetData","ext","extension","extname","slice","encompassFileFormat","dirname","nanoid","basename","date","lasFileFormat","LAS","Encompass","imageListFormats","Panoramic","planarListFormats","Planar","orthoFormats","OrthoMosaic","Unknown","visible","fromJSON","assetsSlice","addAsset","reducer","prepare","addAssets","forEach","assetsList","assetItem","changeFolder","assetID","asset","find","toggleVisibility","deleteAsset","filter","deleteAssets","selectAllAssets","assets","getPointCloudAssets","getCameraFileAssets","getOrthoAssets","foldersSlice","isDefault","addFolder","deleteFolder","folder","renameFolder","selectDefaultFolder","folders","engineMessageTypeJSON","Executable","exePath","exeName","running","child","developerKey","spawnDetached","logText","showStatus","message","console","log","pid","commands","i","length","join","opts","defaults","parseLineData","parseJSON","saveLogs","command","onData","onLine","options","parseCommandsList","executablePath","cwd","spawn","env","process","PYTHONUNBUFFERED","NODEJS","detached","error","copyPasteCommands","copyableCommands","statusMessage","on","commandIndex","commandName","stderr","stdout","parseLines","callback","toString","split","line","messageType","messageData","jsonData","startsWith","kill","lines","execSync","subprocessToKill","rootProcessID","parentProcessID","parseInt","processID","cmdPath","engineSubprocess","engineExecutable","subprocessID","basePath","appPath","app","getAppPath","isDevMode","contents","readFileSync","PythonExecutable","window","onbeforeunload","destroy","stdin","write","WorkflowExecutable","logPrefix","a","maxLogFiles","promises","mkdir","logDirectoryPath","dateString","replaceAll","logPath","logs","writeFile","readdir","filenames","oldest","filename","filePath","stat","stats","birthtime","oldestFilePath","unlink","TouchEventFirstTouch","TouchEventTouching","TouchEventPinchStart","isMobile","test","navigator","userAgent","toLowerCase","randomHexColor","Math","random","closestPowerOfTwo","power","ceil","pow","roundDigit","num","digits","multiplyFactor","round","Number","EPSILON","windowSafeDateISO","chunkedArray","array","size","tmp","results","coordinatesToArray","points","numPoints","newPoints","y","interp1D","start","end","steps","linspace","unitsToValue","lonLatProjection","verifyProjection","info","transform","projection","isLonLatProjection","toUpperCase","verifyProj4String","hasOwnProperty","origin_east","origin_north","origin_elevation","translation_east","translation_north","translation_elevation","scale_factor_h","Object","assign","verifyTransformObject","ScenePointConverter","_sceneShift","_sceneScale","_dataProjection","_viewProjection","proj4String","scale_factor_v","resetSceneShift","Vector3","offset","clone","isLonLatProject","dx","haversineDistance","dy","checkForOffset","add","sub","ProjectedCoordinate","toLonLat","positionLonLat","_dataToLonLat","position","copy","divide","divideScalar","dataToMeters","multiplyScalar","multiply","SceneCoordinate","dataProjection","_sceneToData","dataLonLat","_sceneToLonLat","GeocentricCoordinate","fromLonLat","pointData","toProjection","_dataToScene","infoToMeters","projectionUnits","Coordinate","z","isVector3","LocalScene","_dataToAerial","_sceneToGeocentric","lon","PI","lat","alt","b","e","sqrt","N","sin","cos","viewProjection","_geocentricToScene","ep","p","th","atan2","abs","vector","_proj4Transform","trans","scaleVector","angle","axis","applyAxisAngle","lonlat","isLonLat1","isLonLat2","distanceTo","DataProjectionCoordinate","SphericalPosition","radius","_theta","_phi","limits","precision","divisor","pivot","orbit","theta","MathUtils","radToDeg","dist2d","phi","max","min","degToRad","isValidProjection","projectionString","proj4","getInvertedEuler","euler","inverseQuaternion","Quaternion","setFromEuler","inverse","Euler","setFromQuaternion","calculatePointsPCA","vertices","returnFlat","mean","vertex","toArray","eigen","logger","response","executeWithoutLogging","PCA","getEigenVectors","matrix","Matrix4","makeBasis","fromArray","transpose","point","applyMatrix4","pointsFlat","units","proj","Proj","convert","sphereRaycast","raycaster","intersects","geometry","matrixWorld","testSphere","Sphere","boundingSphere","ray","intersectsSphere","distance","object","position1","position2","diffLat","diffLng","arc","distance2d","proj1","proj2","projToMeters1","proj2m","reprojected","forward","pointCloudFileFormats","pointCloudFilter","extensions","imageOrthoFilter","imageCSVFilter","imagePlanarFilter","isPanoramicFile","isPlanarFile","isPointCloudFile","isOrthomosaicFile","addAssetFolder","showMessage","dispatch","paths","cloudPaths","file","panoramicPaths","orthoPaths","planarPaths","numClouds","numImageFiles","addPlanarFiles","planarFilesAdded","addCameraFiles","panoramicFilesAdded","pointsAdded","addPointCloudFiles","addOrthoFiles","orthosAdded","totalAdded","addedPlural","assetPaths","assetList","pointPath","showBackdrop","addOrthoBatch","numAdded","hideBackdrop","addCameraFile","autoHideDuration","addPlanarFile","exe","run","geotiff","file_path","corners","base64","scale_x","scale_y","imageBounds","imageData","imageSize","imageSizeOriginal","width_original","height_original","imagePath","scaleX","scaleY","fsPromises","encoding","decoded","config","cameras","numCameras","firstCameraName","detectImagePath","pathFound","imageExt","hasImageExt","cameraData","camera","buildFilePath","roll","pitch","yaw","userPath","getPath","engineStyleProjection","firstImageName","openDialogMulti","dialog","showOpenDialog","filters","properties","canceled","filePaths","showErrorBox","openDialogFile","parseDirectory","directoryPath","withFileTypes","entries","files","entry","isFile","directories","isDirectory","directory","checkImagePath","suffix","depth","success","duplicate","dirSeperator","globPath","glob","sync","root","testImagePath","testImageExt","includes","showOpenDialogSync","manual","icon","minWidth","paddingRight","centered","DenseIcon","other","ListItemIcon","hidden","opacity","ArrowTooltip","Tooltip","arrow","CursorTooltip","React","undefined","setPosition","dangerouslySetInnerHTML","__html","placement","popper","onMouseMove","pageX","pageY","PopperProps","anchorEl","clientHeight","clientWidth","getBoundingClientRect","top","left","right","bottom","mouseX","mouseY","itemList","paddingLeft","itemText","wordBreak","overflow","cloudMargins","assetError","main","fontWeight","assetWarning","warning","assetInfo","assetCheckbox","checkboxParent","percentLabel","textAlign","LinearProgressWithLabel","Fragment","Box","mr","Typography","AssetItem","viewer","useDispatch","useSelector","renameOpen","setRenameOpen","deleteOpen","setDeleteOpen","menuState","setMenuState","isPanoramic","isPlanar","isEncompassCloud","isRawPointcloud","isOrtho","isCamera","isPointCloud","handleAssetExport","outputName","showSaveDialog","defaultPath","csvPath","csvOut","getCamerasForCSV","eulerDegrees","csv","writeToPath","menuOpen","isStaticSite","anchorPosition","canExportCSV","cloudPercent","getCloudPercent","cloudMissing","getCloudMissing","cloudLoading","showLargeWarning","getCloudIsLarge","ListItem","onContextMenu","preventDefault","clientX","clientY","draggable","onDragStart","dataTransfer","setData","snapToOrtho","snapToPointCloud","snapToImages","ListItemText","primary","ListItemSecondaryAction","Checkbox","edge","checked","keepMounted","anchorReference","MenuItem","AssetFolder","handleAssetMove","setOpen","dragDropHover","setDragDropHover","onDragOver","onDragLeave","onDrop","getData","selected","Collapse","in","timeout","unmountOnExit","List","component","disablePadding","dense","verticalDivider","icons","iconButton","iconSize","DenseDivider","Divider","style","marginBottom","IconToolBar","ToolBarDivider","ToolBarButton","isVisible","tooltipText","colorFin","Icon","colorPrimary","addItem","paddingBottom","folderList","FolderList","useSnackbar","enqueueSnackbar","defaultFolder","defaultFolderHasAssets","dialogOpen","setDialogOpen","contextState","setContextState","secondary","folderName","TabPanel","panel","box","role","TabProps","PanelProps","simplepolygon","require","pointInPolygon","numberOfVertices","insidePolygon","j","verti","vertj","dy1","dy2","cond1","cond2","planeFromVectors","directions","normal","setLength","Plane","checkValidPolygon","coordinates","shifted","features","Measurement","controller","dbType","databaseID","displayType","timeCreated","startClick","cancelClick","finishClick","tooltipStatic","more","floor","getTime","isoTime","formatter","Measurement3D","maxVertexLength","minVertexRequired","finished","addedPoint","fromScene","oldVertex","added","valid","MeasurementArea","ignoreHeight","vertexA","vertexB","toScene","getLineDistance","lastIndex","firstPoint","lastPoint","NaN","atan","rise","distance2D","MeasurementLine","moreTooltip","MeasurementPoint","surfaceGenerator","areaInvalidMessage","SurfaceGenerator","generate","indices","area","MeasurementVolume","volumeHelper","invalidVolumeMessage","calculate","stopCalculation","pointCloud","pointclouds","VolumeHelper","init","setVolume","destroyWorker","calculated","calculatingVolume","SnapMeasurement","parent","snapResult","snap","finalHeight","validHeights","pos","heights","pointsInRadius","SnapDownMeasurement","reduce","acc","curr","SnapUpMeasurement","AerialMeasurement","polygon","flatCoordinates","totalPoints","ecef","geometryToArray","getCoordinates","AerialLengthMeasurement","getLength","LineString","AerialAreaMeasurement","getArea","Polygon","measurement","sigma","minNeighbours","maxNeighbours","neighbourPercent","maxHeightDelta","worker","bounds","groundHeight","pointcloudmesh","pointswireframe","updateValue","localVertices3D","getCalculatedBounds","sum","calculateVolume","arr","xMin","xMax","yMin","yMax","zMin","zMax","center","Worker","onmessage","postMessage","terminate","positions","Float32Array","BufferGeometry","setAttribute","BufferAttribute","material","PointsMaterial","Points","scene","triangles","Geometry","MeshBasicMaterial","side","DoubleSide","tri","faces","Face3","mesh","Mesh","geo","EdgesGeometry","mat","LineBasicMaterial","wireframe","LineSegments","volume","p1","p2","p3","signedTetrahedronVolume","dot","cross","reverse","from","v1","v","v2","v3","final","validTriangles","triangle","Triangle","getMidpoint","reverseWinding","delaunay","Delaunator","generateTriangleArray","removeInvalidTriangles","refreshMeasurementList","denseBounds","getDensePolygon","filterByHeight","pointsInPolygon","getSampledPoints","gridX","gridY","removeOutliersAsync","asyncFinished","webWorkerFinished","pointsArray","concat","trianglesUpper","getDenaunayTriangles","trianglesLower","trianglesCombined","drawMesh","getVolume","updateAreaShaders","remove","changeRequired","renderInScene","meshes","removeMeshesFromScene","hexColor","geom","getNormal","c","triangleIndices","verticesModified","numIndices","triIndexA","triA","triB","triIndexB","vertSet","Set","allVerts","sharedVerts","uniqueVerts","modTriA","modTriB","t1","t2","oldArea","t3","t4","newArea","optimize","numVertices","earcut","deviation","numTriangles","triVertices","generateMesh","addMeshesToScene","densePolygonTemp","nextIndex","direction","vectorLength","increment","directionIncrement","densePolygon","old","CustomOrbitControls","domElement","document","flyMode","flyForcedRadius","flyPreviousRadius","flyPreviousDampening","flyPreviousRotateSpeed","flySpeed","flyRatio","minFlySpeed","maxFlySpeed","saveSpeedTimeout","tick","enabled","focused","minDistance","maxDistance","Infinity","minZoom","maxZoom","minPolarAngle","maxPolarAngle","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","enableZoom","zoomSpeed","enableRotate","rotateSpeed","flyModeOffset","enablePan","panSpeed","panningMode","keyPanSpeed","autoRotate","autoRotateSpeed","enableKeys","keys","LEFT","UP","RIGHT","BOTTOM","SPACE","PLUS","MINUS","NUMPAD_PLUS","NUMPAD_MINUS","mouseButtons","ORBIT","MOUSE","ZOOM","MIDDLE","PAN","target0","position0","zoom0","zoom","isMoving","panOffset","sphericalDelta","setFlySpeed","increaseFlySpeed","scope","decreaseFlySpeed","toggleFlyMode","showToast","clearSphericalDelta","clearPanOffset","getPolarAngle","spherical","getAzimuthalAngle","saveState","reset","updateProjectionMatrix","dispatchEvent","changeEvent","update","STATE","NONE","quat","setFromUnitVectors","up","quatInverse","lastPosition","lastQuaternion","millisecondsElapsed","distancePerFrame","applyQuaternion","setFromVector3","rotateLeft","makeSafe","setFromSpherical","lookAt","zoomChanged","distanceToSquared","EPS","quaternion","dispose","removeEventListener","onMouseWheel","onTouchStart","onTouchEnd","onTouchMove","onMouseFocus","startEvent","endEvent","ROTATE","DOLLY","TOUCH_ROTATE","TOUCH_DOLLY","TOUCH_PAN","Spherical","rotateStart","Vector2","rotateEnd","rotateDelta","panStart","panEnd","panDelta","dollyStart","dollyEnd","dollyDelta","getZoomScale","rotateUp","panLeft","objectMatrix","setFromMatrixColumn","panUp","crossVectors","pan","deltaX","deltaY","element","body","isPerspectiveCamera","targetDistance","tan","fov","isOrthographicCamera","warn","dollyIn","dollyScale","dollyOut","handleMouseDownRotate","handleMouseDownDolly","handleMouseDownPan","addEventListener","subVectors","handleMouseMoveRotate","handleMouseMoveDolly","handleMouseMovePan","stopPropagation","handleMouseWheel","keyCode","handleKeyDown","touches","handleTouchStartRotate","handleTouchStartDolly","handleTouchStartPan","handleTouchMoveRotate","handleTouchMoveDolly","handleTouchMovePan","prototype","create","EventDispatcher","constructor","classificationTexture","TextureLoader","classifications","shaders","pointcloud","vert","frag","edl","image","markers","utilities","gpu_picker","colorMaps","numberOfClassifications","BaseMaterial","uniforms","defineProperty","ShaderMaterial","PointCloudMaterial","params","gpuPicker","color_map","color_type","dynamic_size","circularPoints","visibleNodesTexture","dynamic_cloud","screenHeight","screenwidth","octree_spacing","octree_size","octree_corner","intensity_range","rgb_max","height_range","channels","Color","Uint8Array","r","g","format","RGBFormat","RGBAFormat","texture","DataTexture","minFilter","NearestFilter","magFilter","needsUpdate","generateDataTexture","colorMapTexture","colorMap","classificationVisible","areaClipData","maxAreaTriangles","volumeStatus","Uniform","minSize","maxSize","colorType","heightClamp","intensityClamp","dynamicSize","defines","maxTriangles","fragmentShader","vertexShader","setValues","vertexColors","transparent","depthWrite","initProperties","EDLMaterial","screenWidth","edlStrength","neighbours","neighbourCount","lightDir","normalize","uniform","WIDTH","HEIGHT","near","far","expScale","tDepth","OpacityMaterial","ImageMaterial","MarkerMaterial","orbitMode","camera_position","mtrx_x","mtrx_y","mtrx_z","marker_size","currentIndex","CloudNode","cloud","pointsScene","pointsPicker","boundingBox","loaded","loading","sizeTight","_center","_sphere","tightBoundingBox","item","removeFromScene","disposeGeometry","picker","boundingBoxVisibility","intensity","classification","colors","gpu_index","computeBoundingBox","shift","RawPointCloudNode","xyz_min","xyz_max","addChildNode","offsetToScene","updateBoundingBox","updateRootNode","setGeometry","updateClassifications","updateColorLimits","updateIntensityRange","intensity_min","intensity_max","materialScene","materialPicker","generateEdgeMesh","addCloudData","getGeometry","RawPointCloudRootNode","node","PointCloud","uniqueClassifications","rgbArray","maxColor","intensityRange","identifier","empty","fileMissing","materials","_tightBoundingBox","debugBoxColor","sizeX","sizeY","sizeZ","vertexArray","edgeVertices","boxGeometry","boxMaterial","materialDefaults","changed","updateMinimapExtent","nodes","getVisibleNodes","setState","nodeCondition","visibleNodes","stack","combined","mergeBoundingBoxes","intensityMin","intensityMax","rgbMax","closestValue","sort","arrMax","midpoint","gpuPickers","current","RawPointCloud","workerExe","header","loadStart","timeEnd","byteCutoffSize","pointsDataParsed","pointsDataArray","numSampledPoints","minNumNodes","minPointSize","generatingChunks","canReadData","updatePercent","performance","now","elapsed","maxDataChunks","number_of_chunks","updateSizeInfo","addPointCloud","setIdentifier","setVisibility","fileLoadStart","fileLoadFinish","fileLoadCancel","lasFilePath","projectionsUnits","dataProjectionUnits","isValid","keyword","pushToWorkerQueue","parseHeaderResponse","parsePointsResponse","fileLoadFinished","isLargeFile","isLastChunk","fileLoadProgress","addNodeFromData","bbox","estimatedBoundingBox","zoomToExtent","Int32Array","loadFromData","apply","maxs","mins","remote","number_of_bytes","EncompassPointCloudNode","level","_children","dataPath","getDataPath","isRemoteFile","sendToWorker","removeChildNode","workerPool","getWorker","returnWorker","sendMessage","childName","getChildNameAtIndex","childSize","childLevel","childCenter","clearChildNodes","getBinaryData","getChildAtIndex","WorkerPool","workerPath","numDefaultWorkers","workers","createDefaultWorkers","transferables","pop","newWorkers","WorkerQueue","workerURL","numWorkers","waitForExit","pool","maxAsyncWorkers","numRunning","queue","workerData","workerCallback","workerFinished","finish","EncompassPointCloud","structure","nodeCacheSize","cloudInfo","numberOfPoints","_shift","terminateWorkers","dataDir","folderDepth","dirs","match","RegExp","setName","decodeIndexData","hierarchy_step_size","point_offset","point_scale","availableNodes","node_structure","total_points","tight_bounding_box","nodeSize","parseFloat","nodeCenter","buildTreeLegacy","setBoundingBox","BinaryHeap","scoreFunction","content","bubbleUp","sinkDown","peek","n","score","parentN","elemScore","child2N","child1N","swap","child1","child1Score","child2","ColorType","MarkerNavType","getProjFactor","projFactor","setPointScale","computeBoundingSphere","eventToPixel","uv","offsetX","offsetY","layerX","layerY","ImagePosition","_value","setFromMatrixPosition","_euler","applyEuler","eulerCSV","toAerial","ImageRotation","angles","adjustment","rotationWithTransform","multiplyRotations","rotationWithAdjustment","setFromRotationMatrix","degrees","ImageFace","flipY","CameraImage","cameraList","img","ctx","canvas","generatePreview","directionToCameraAngle","positionToCameraAngle","cameraPos","sphere","fromVectors","pixel","u","controls","Image","arrayBufferView","blob","Blob","mimeType","src","URL","createObjectURL","setNormalCamera","setCameraParameters","minimap","setActiveCamera","onLoaded","generateObject","grabImageFromPath","generatePreviewImage","clearImages","setCameraPosition","generateFullImage","setOrbitCamera","finally","updateArrowNavigation","angleEuler","tempRotation","PanoramicImage","destroyWorkers","imageDataWorker","imageFaceWorker","imageWidth","imageHeight","imageDirection","planarSize","plane","planar","projectPoint","allX","allY","interpolated","xyz","xyzTemp","xyz1","xyz2","_x","_y","_z","interpTemp","xyzNoDups","previous","preview","canvasWidth","canvasHeight","imageToData","processFaces","determineCanvasSize","createElement","context","getContext","drawImage","getImageData","offScreenCanvas","transferControlToOffscreen","spawnImageDataWorker","url","face","BoxBufferGeometry","interpolation","spawnImageimageFaceWorker","bufferLength","copyOfData","generateFaceData","newImageData","setMaterialTexture","PlanarImage","fx","fy","centerOffset","outOfBounds","imageTexture","Texture","PlaneGeometry","objectOffset","Object3D","fovY","cy","fovX","cx","CameraList","adjustments","aligned","initScene","initEvents","Scene","softlight","AmbientLight","incrementCamera","setOrbitState","addedIndex","newCameras","cameraConfig","assetType","cameraInfo","newCamera","getNewCamera","toRemove","remaining","has","removeCameraMarkers","cameraID","getByID","cameraName","loadCamera","currentCamera","count","nextCamera","loadImage","recalculateAllMarkers","elements","newMatrix","equals","applyMatrixToCameras","extentFromPoints","rotationA","rotationB","matrixA","makeRotationFromEuler","matrixB","multiplyMatrices","OrthoImageLayer","ImageLayer","orthosList","layer","imageBase64","extent","pixelMaxSpread","pixelMaxValue","calculateExtent","addMapLayer","aerialMap","setMapExtent","transformExtent","coordinatesTransformed","coordinate","coordTransformed","addLayer","onload","parseImageData","base","putImageData","source","Static","toDataURL","imageExtent","imageSmoothing","setSource","setOpacity","setVisible","removeLayer","dataProjectionName","getVisible","x_scale","y_scale","x_offset","y_offset","x_skew","y_skew","OrthoMosaicList","orthos","orthoID","ortho","initialAerialState","resolution","basemap","initialSceneState","isValidAerialState","cameraStateSlice","aerialState","sceneState","changeCameraTransform","changeCameraState","changeCameraHeight","changeBasicAdjustments","changeSavedAerialState","selectCameraHeight","selectActiveCamera","selectCameraState","selectCameraTransform","selectBasicAdjustments","selectSavedAerialState","BasemapLayer","Tile","BaseCameraFeature","Feature","PanoramicFeature","PlanarFeature","ViewTriangle","aerial","feature","generateSource","VectorSource","wrapX","noWrap","addFeature","VectorLayer","Style","stroke","Stroke","Fill","setZIndex","lookat","ring","generateMarkerCoordinates","getTargetElement","coneAngle","coneLength","getView","getResolution","v0","changeDetector","initialized","rotateViewMarker","AerialMap","container","containerElement","orthoList","maxLayerZoom","maxMapZoomLevel","styleCache","pointsSource","boundsSource","activeCamera","activeCameraLayer","clusterDistance","clusterCircleSize","camerasToIterate","camerasCalculated","chunkedArraySize","calculating","setAerialState","mapSystem","initMap","initDataLayers","resetView","validExtent","fit","setResolution","setRotation","setVisibleBasemap","setCenter","setZoom","defaultID","basemapLayers","attribution","Attribution","collapsible","Map","layers","defaultLayers","fractionalZoom","defaultControls","rotate","extend","View","forEachFeatureAtPixel","getZoom","boundingExtent","mapSize","getSize","nearest","duration","updateSavedState","clusterSource","Cluster","clusterLayer","clusterStyle","boundsLayer","Point","styleGenerator","interactions","interaction","DragPan","setActive","getRotation","toDataProjection","cornersAerial","calculatingSceneMarkers","cameraIndex","addFeatures","centerOnImages","remainingCameras","remainingFeatures","addCameraMarkers","active","square","strokeColor","textColor","fillColor","circleImage","CircleStyle","squareImage","RegularShapeStyle","Text","numSquares","numCircles","styleKey","basemapID","mapPosition","getSource","getFeatures","setStyle","setTarget","calculateCameras","orbitState","hasPoints","cameraSelected","arcGISBase","OSM","XYZ","attributions","scrollWidth","scrollHeight","getLayers","array_","reproject","xPositions","yPositions","PointCloudManager","clouds","workerQueue","visiblePointsTarget","maxloadedToGPUPerFrame","maxNodeAsyncLoad","maxRawAsyncLoad","maxDecodeWorkers","exeLaunchTimeout","lastExeLaunched","numLoadedPoints","numVisiblePoints","numSceneNodesVisible","fovDifferencePercent","minPixelPercent","loadedOnce","transparency","rawJsonResponse","setLoadedOnce","updateMeasureList","delete","measurements","defaultKey","materialKey","classification_visible","smooth","boxSize","boxMean","boundSize","maxHeight","orbitWithAngle","fromValues","toVector3","combinedBoundingBox","updateCloudExtent","ignoreConditions","camerasExist","newPosition","orbitPositionFromBounds","frustum","priorityQueue","weight","MAX_VALUE","unloadedGeometry","loadedToGPUThisFrame","maxNodeDistance","measurePoint","getCameraTarget","isRawPointCloud","newPointsTarget","bounds2d","camera2d","isGeometryNode","isTreeNode","isLoaded","addToScene","cameraPosition","childDistance","childRadius","maxFov","maxFOV","screenPixelRadius","insideSphere","maxLoad","subScalar","maxValue","sampledPoints","setDrawRange","attributes","numVisible","drawRange","totalVisibleNodes","unusedNodes","totalUnusedNodes","totalNumberNodes","maxNodesAllowed","numberToDelete","nodeIndex","childIndex","substr","vArrayIndex","areaGeometry","areaMeasureData","area_measure_data","volume_status","max_triangles","triangleNumber","triangleIndex","vertexIndex","vIndex","updateShaderVertex","numLoading","cloudsToParse","cloudsToExecute","rawPointClouds","timeNow","launchExecutable","parseAvailableChunks","getX","getY","getZ","highest","keyfunc","samples","dtmPoints","Frustum","cameraViewProjectionMatrix","updateMatrixWorld","matrixWorldInverse","getInverse","projectionMatrix","setFromProjectionMatrix","loadAvailableLasData","hideDescendants","updateVisibility","manageNodeCache","updateMaterialDefaults","updateVisibilityTexture","updateCloudSampling","calculatePointsVisible","defaultClassifications","available","settingsSlice","Height","arrowMarkers","Arrows","activeTab","cloudMaxPoints","cloudDistance","cloudSize","switched","drawerOpen","heightClip","intensityClip","orthoOpacity","changeOpacity","changeOrthoOpacity","changeCloudDistance","changeCloudMaxPoints","changeCloudSize","changeHeightClip","changeIntensityClip","changeColorMap","changeColorType","changeDynamicSize","changeCircularPoints","changeAvailableClassifications","availableClassifications","changeClassificationVisibility","changeAllClassificationVisibility","changeSwitched","changeSelectedTab","changeDrawerOpen","changeArrowMarkers","selectOpacity","settings","selectOrthoOpacity","selectCloudDistance","selectCloudMaxPoints","selectCloudSize","selectHeightClip","selectIntensityClip","selectColorMap","selectColorType","selectDynamicSize","selectCircularPoints","selectViewerSwitched","selectSelectedTab","selectDrawerOpen","selectArrowMarkers","selectAvailableClassifications","selectClassificationVisibilities","CameraMarkers","arrowNavigation","markerNavigation","navigationType","modifier","initKeyDown","MarkerNavigation","ArrowNavigation","onKeyUp","bind","drawCameraMarkers","updatePicker","updateNavigation","clearNavigation","markerID","mouseClick","mouse","movement","which","isArrows","isOrbitMode","isHidden","isMarkers","setEnabled","None","Markers","markerMesh","pickingMesh","standardMaterial","pickingMaterial","verticesPerCamera","uvs","selectedID","markerPositions","initGeometry","markerShape","cameraIndices","cameraShape","numUvs","uvIndex","updateGeometry","camera_index","marker","numCorners","corner","cornerIndex","updatePickers","arrIndex","cameraPickerID","markCameraSelected","mtrx4","makeRotationFromQuaternion","mtrx3","Matrix3","setFromMatrix4","shader","ArrowMarker","textures","section","addMesh","geometryStandard","materialStandard","alphaTest","userData","numSections","sections","defaultScale","zoomedScale","loadTextures","initMeshObject","sectionToAngle","loader","arrowPathStandard","arrowPathShadow","validCameras","markerPos","tooClose","tooFar","angleToSection","setCamera","setScale","getIntersect","targets","RayCaster","intersectObjects","sectionID","binds","ChangeDetector","previousFov","previousZoom","previousLookat","previousCamera","previousHeight","previousOrbit","lookatChanged","fovChanged","cameraChanged","heightChanged","orbitChanged","newLookat","newFov","newZoom","newHeight","newOrbit","GPUPicker","debug","_needsUpdate","WebGLRenderTarget","LinearEncoding","generateMipmaps","clearSections","tX","tY","sectionWidth","sectionHeight","sectionX","sectionY","sectionIndex","pixelIndex","timeStart","startX","startY","pixelBuffer","renderer","readRenderTargetPixels","time","mouseResult","pickerID","updateBaseIDs","oldRenderTarget","getRenderTarget","oldClearColor","getClearColor","oldClearAlpha","getClearAlpha","newClearColor","setRenderTarget","setClearColor","render","setClearAlpha","currentBaseID","setSize","getSelectedObject","getObjectPosition","minIndex","maxIndex","parseHex","textToColor","textToColorArray","colorHash","createHash","hash","digest","h","s","l","ImageLabel","category","completed","editing","drawable","highlighted","complete","draw","highlight","LabelCategory","labels","labelID","drawLabel","getLabelByID","labelIDs","setHighlighted","hasEnoughPoints","unSelectAll","unSelect","select","ImageLabelTools","orthoLabels","sceneLabels","activeLabeler","categories","setCategoryList","currentCategory","hotkeyEnabled","contextMenuOpen","AerialLabelTools","SceneLabelTools","setCategories","activeLabel","completeLabel","deletePoint","addLabel","deleteAllCategories","setDragState","activeImagePaths","loadedImagePaths","updateCategories","getNewCategory","categoryID","getCategoryByID","updateName","updateColor","drawAll","deleteCategory","addNewLabel","unSelectLabels","selectLabel","deleteLabel","resetToolTipText","pointID","deleteSpecificPoint","unHighlightAll","zoomToLabel","unHighlight","deleteLabels","resetTemporaryPoint","tolerance","highQuality","newPointsPolygon","turfPolygon","simplified","turfSimplify","simplePolygon","matches","index1","index2","numLabels","numIterations","labelMerged","isPlanarImage","isPanoramicImage","mergeLabel","k","points1","coords","points2","point1","matchFound","point2","nextIndexValid","polygonPoints1","polygonPoints2","union","turfUnion","areaUnion","areaFromPolygon","coord","addPoint","newNumLabels","simplifyPolygon","images","progressData","image_id","segmentation","skippedLabels","pointsToAerial","getByName","file_name","pointsToPixels","newLabel","setKnownImageSize","labelTotal","labelIndex","progress","setTimeout","importLabelData","progressCallback","annotations","numLabelsTotal","newLabels","category_id","newCategory","addCategory","addCategoryLabels","mergeAndSimplifyLabels","setDrawable","supercategory","jsonImageObj","jsonLabelsObj","sectionsFromIntersection","intersection","intersectPoints","annotationFromPolygon","imageID","segment","flat","iscrowd","contour","ShapeUtils","LabelPoint","LabelPolygon","OrthoLabel","polygonLayer","pointLayer","minCoordinates","minPixelDistance","pointColor","categoryColor","checkDuplicate","newPoint","oldPoint","pixelNew","getPixelFromCoordinate","pixelOld","dU","dV","temporaryPoint","pointSource","pointStyle","pointStyler","feat","updateWhileInteracting","updateWhileAnimating","polySource","polygonPointsOnly","oldState","darkenedColor","lineDash","drawPoints","drawPolygon","dark","OrthoCategory","aerialTools","setPointDelete","setPointAdd","setAerialTooltipText","dragObject","contextMenuClick","startTooltip","dragTooltip","highlightTooltip","polygonInImage","polygonPoints","imageList","imagesWithPolygon","imageIds","polyPointRing","imageId","pointsOriginalProj","polygonInPixels","calculatePolygonPixels","metadata","imageInPixels","originalSize","turfIntersect","pixelPolygon","pixelPoint","markLastPointDraggable","setDragObject","setPointGrabTooltip","setHighlightTooltip","setToolTipText","drawActiveLabel","dragging","updatePoint","getFeaturesAtPixel","featuresPoly","featuresPoint","hoveringPoint","hoveringPoly","isRightClick","noneHighlighted","numHighlighted","oneHighlighted","ctrlKey","highlightLabel","highlightedFeature","isPoint","highlightedLabel","helpMsg","invalidTooltip","removePoint","removeSpecificPoint","visibleOrthos","imageIndex","orthoName","polygonsInside","annotation","pointCount","_direction","_position","updateValues","pixelToDirection","SceneLabel","_imageWidth","_imageHeight","standardMeshes","opacityMeshes","pointGeometry","pointMaterial","lineGeometry","lineMaterial","lineDashedMaterial","polygonMaterial","minPoleAngle","SphereGeometry","updateMaterials","standardColor","LineDashedMaterial","dashSize","gapSize","standardScene","setFromPoints","Line","computeLineDistances","pixels","coordinates3d","directionsToPlanar","coordinates2d","polygonAtPoles","coordinatesFlat","opacityScene","drawLines","drawPolygons","pointsAtPole","acos","minAngle","maxAngle","booleanContains","turfPoint","average","fovRequired","angleTo","setCameraVisible","getCameraBestFit","SceneCategory","numberOfLabels","setViewerTooltipText","polygonHover","movingEndpoint","vectorFromEvent","getClickedDirection","directionToPixel","drawing","intersectedTargets","getImagePixel","labelPoints","targetPoly","objects","polygons","setPolygonHover","hovering","labelHighlighted","mouseMoved","down","isLeftClick","checkPointSelected","updateDraggablePoint","setPolygonHoverTooltip","imageBorders","horizontalShift","getHorizontalShift","interpolatePixels","imageBordersLeft","intersectionLeft","imageBordersRight","intersectionRight","minSpread","spread","calculatePlanarSections","calculatePanoramicSections","visibleCameras","getCameraSize","deleteUnfinishedLabel","visited","metresToSurveyFeetRatio","metresToFeetRatio","allowedUnits","fromUnits","toUnits","isNaN","convertedValue","MinimapMeasure","sourceStandard","vectorStandard","sourceHover","vectorHover","pointerMoveHandler","measurementType","sketch","measureTooltipElement","measureTooltip","setAsLength","setAsArea","setAsNull","reloadInteraction","removeInteraction","setTooltipText","addInteraction","mapElement","innerHTML","setOffset","$","createMeasureTooltip","listener","editable","Draw","condition","originalEvent","getTooltipValues","output","tooltipCoord","setMeasureTooltipInfo","unByKey","addAerialMeasurement","measureParent","parentNode","removeChild","Overlay","positioning","addOverlay","hover","measurementID","formatArea","getInteriorPoint","formatLength","getLastCoordinate","canFinish","MeasurementConstructor","MeasurementClass","isFinished","builderType","setController","finishedMeasurement","MeasurementFormatter","emptyValue","nullValue","metersCutoff","squareMetersCutoff","formatterPrecision","vectorPrecisionLonLat","vectorPrecisionStandard","TypeError","setUnits","finalValue","metresToFeet","isSurveyFeet","feet","inches","metresToMiles","metresToKiloMetres","volumeValue","cubicMetresToCubicYards","squareMetresToSquareMiles","squareMetresToSquareFeet","squareMetresToSquareKilometres","maxGrade","isFinite","precisionX","precisionY","precisionZ","isMetric","isSurveryFeet","metres","squareMetres","val","cubicMetres","metresToYards","MeasurementGroup","collectionID","save","updateMeasurements","removeFromArray","removeAll","measure3D","measurements3D","newMeasurement","timestamp","time_created","generateSurface","loadExistingVolume","measure2D","measurements2D","loadFromCoordinates","renderMeasurement","resetDragObject","names","getProjectedVertices","getAreaMeasurements","measureGeometry","getMeasurementByType","measureClass","MeasurementGroupExporter","lineDelimiter","columnDelimiter","measureExportFormat","csvExportFilter","dataExportFilter","measurementGroup","version","ordering","getVectorPrecision","export3D","export2D","created","projectName","downloadDataExport","mapProjection","getHeaderValues2D","row","convertUnits","getValue","toGeocentric","toViewProjection","downloadCSVFile","getHeaderValues3D","areaValue","area3D","distance3D","formatGrade","grade","formatAngle","downloadFileBrowser","downloadFileElectron","savePath","writeFileSync","contentType","encodeURIComponent","appendChild","click","measurementVertices","areaUnits","volumeUnits","MeasureEndpoint","measurementVertex","TemporaryEndpoint","MeasurementSceneView","sphereBuffer","sphereRadius","sphereGeometry","sphereMaterialStandard","sphereMaterialHover","lineMaterialStandard","lineMaterialHover","temporaryEndpoints","temporaryLines","hoveredPoint","dragValid","stopVolumeCalculation","removeByID","measurementBuilder","activeMeasurement","sortByRay","restrictOrbitMovement","morepoints","endTooltipCount","endTooltip","createTempEndpoint","temporaryLine","createLine","raycast","createEndpoint","temporaryEndpoint","MeasurementController","imageOnlyType","measureType","measureSceneView","measurementAerialView","measurementGroupExporter","setMeasurements","createNewMeasurementGroup","stopDrawingItems","hideTooltip","disable","light","currentProjection","loadMeasurements","$maxMeasureDistance","isImageOnly","GroundPlaneMeasurement","maxDistance2D","maxMeasureDistance","unitConverter","getPosition","getPlanePosition","getPickerResults","getCoordinate","addTemporaryPoint","updateMeasureText","finishMeasurement","cancelMeasurement","checkEndpointSelected","measuring","addActiveEndpoint","updateMeasureEndpoint","getMeasurement","removeTemporaryObjects","measureEndpoints","redrawAerialGeometry","measureGrabFinished","getAreaGeometry","updateAreaVertices","checkMorePoints","setMeasurementType","setBuilder","getMeasurements2D","measurement_","loadGeometry","clearViews","exportCSV","exportDAT","exportLinework","updateMaxMeasureDistance","reload","updateMaterial","Boolean","Stats","mode","addPanel","dom","showPanel","cssText","beginTime","prevTime","frames","fpsPanel","Panel","msPanel","self","memory","memPanel","REVISION","begin","usedJSHeapSize","jsHeapSizeLimit","setMode","fg","bg","PR","devicePixelRatio","TEXT_X","TEXT_Y","GRAPH_X","GRAPH_Y","GRAPH_WIDTH","GRAPH_HEIGHT","font","textBaseline","fillStyle","fillRect","fillText","globalAlpha","Viewer","viewContainer","mapContainer","defaultFarPlane","defaultNearPlane","screenPass","imageMaterial","texture2DDepth","opacityMaterial","texture2DImage","texture2DOpacity","imageLabels","compass","setCameraState","drawPickerScene","timingDebug","labelObject","anyLabelSelected","checkIfSelected","getByCSV","createScene","initGpuPickers","initResize","initMaterials","initViewEvents","CompassControls","PanoControls","StatsPanel","addContainerElements","debounce","calculateUpdatedValues","handleWindowResize","animate","setClassification","clamp","updateClamping","colorMapKey","textureData","setNavigationType","off","removeContainerElements","destroyViewEvents","newProjection","setDataProjection","enable","setViewProjection","orbitDefaultApplied","cameraAlignerAdv","updateRenderColor","setTitle","export","measureExportType","loadMeasurementData","loadImageLabelData","setActiveLabelType","checkIfActive","deleteHighlighted","editCategoryName","currentCategoryName","categoryName","checkUniqueName","addRow","errors","setErrors","getError","deleteRow","getImageObs","getPointObs","getCamPose","numEntries","getCamId","cameraAlignerBasic","values","getCamName","setObservationType","rowNum","setCurrentRow","flashObservations","hideCurrentObservation","getObservationPosition","setAllObservationsVisible","updateOffset","cloudList","camerasFiles","cameraHeight","cameraAdjustments","savedCameraState","existingCameras","allCameras","cameraFile","currentCameras","camerasToLoad","camerasToDelete","numRemoved","numChanged","deleteCameras","addCameras","clearArrowNavigation","setOrbitDefault","cameraLoaded","pointClouds","currentPointClouds","newPointClouds","pointCloudsToLoad","pointCloudsToDelete","deletePointCloud","cloudDetails","loadFile","loadNodes","currentOrthos","newOrthos","orthosToLoad","deleteOrtho","orthoInfo","addNewOrtho","setCameraHeights","setCameraAdjustments","setCameraMatrix","redrawImageObsMarkers","resetCameraMatrix","updateSize","PerspectiveCamera","WebGLRenderer","antialias","alpha","logarithmicDepthBuffer","powerPreference","isWebGL2","autoClear","RenderPass","stencilBuffer","LinearFilter","EDLSupport","depthBuffer","texturePrecision","FloatType","UnsignedIntType","depthTexture","DepthTexture","resizeCanvas","aspect","w","resizeTarget","scenes","renderTarget","renderMaterial","renderTargetAttrs","clearDepth","renderWithTransparency","renderInFront","alignerScene","getPositionValues","resizeRenderTargets","updateSceneElements","renderPickerScene","renderPanoramic","renderSceneObjects","showCompassElement","requestAnimationFrame","offsetWidth","offsetHeight","isEmpty","hasCameras","capabilities","maxVaryings","floatFragmentTextures","show","isPointsOnly","screenScene","screenQuad","PlaneBufferGeometry","depthTest","Camera","nodesVisible","pointsVisible","expanded","getElementsByClassName","classList","drawExpandedState","getElementById","indexToShow","onclick","numberNodes","visiblePoints","maxPoints","childCount","ImageObservation","PointObservation","pointObsColor","imageObsColor","CameraAlignerAdv","setAddObservations","resetObservationType","currentRow","observationType","sceneObs","enabled3dMode","pointIdxAdd","imageIdxAdd","emptyObservation","imageObs","pointObs","imageMesh","pointMesh","imageIdentifier","pose","pointIdx","imageIdx","observation","imageName","getMeshName","pointName","removeMarker","idx","getImageIdx","imageDir","addImageObservationMesh","getPointIdx","addPointObservationMesh","observationToAdd","clickScene","clickImage","unhideObservations","sphereMaterial","colorImage","colorPoint","flashObservation","colorObject","originalColor","getHex","numberOfFlashes","interval","setInterval","setHex","clearInterval","rotations","meshPos","eulerCsvInvert","update3dMode","currentID","CameraAlignerBasic","cameraAngles","setSingleAlignment","updateAlignment","code","applyTempRotation","minFOV","flyControls","wheelDelta","phiDelta","thetaDelta","assetSelected","moveEvent","zooming","OrbitController","FlyMoveControls","MouseConfig","touchHandler","addEventListeners","onMouseDoubleClick","toggleMouseMove","alignerLight","setUpVector","pivotLocation","smoothTransition","rotateLength","setPositionValues","setMeshVisible","updatePickerCamera","upEnabled","getClosestCoordinate","newEvent","MouseEvent","bubbles","cancelable","detail","screenX","changedPointers","screenY","altKey","shiftKey","metaKey","pointer","moveEnabled","aligner","moveEnd","mouseMoveDistance","moveStart","moveDistance","moveDelta","updateSelectionText","toggle","finishMouseUp","cancelLabel","highlightOnClick","selecting","cancelAlignment","scrolling","clearTimeout","wheelTimeout","wheelDelay","delta","flyModeEnabled","removeMouseUp","orbitObject","pivotLength","approxDistance","getCameraDistance","mouseEvent","changedTouches","first","eventType","dist","pinchMove","sign","touchToMouse","adjustLookat","timeElapsed","withPerformanceMeasure","checkMovement","move","updateView","moveTolerance","endTimeout","endDelay","rotating","moveTick","moveInterval","panoControls","maxSteps","heightAbove","step","initial","addHeight","totalIntervals","sphereStart","sphereFinish","dRadius","dPhi","dTheta","upVector","orbitMovement","defaultRaycaster","threshold","intersectObject","distanceToRay","raycastDirection","vec","unproject","Raycaster","CopyShader","Pass","needsSwap","renderToScreen","FullScreenQuad","OrthographicCamera","_mesh","ShaderPass","textureID","call","UniformsUtils","fsQuad","writeBuffer","readBuffer","autoClearColor","autoClearDepth","autoClearStencil","MaskPass","writeValue","clearValue","buffers","setMask","setLocked","stencil","setTest","setOp","REPLACE","setFunc","ALWAYS","setClear","EQUAL","KEEP","ClearMaskPass","EffectComposer","parameters","_pixelRatio","getPixelRatio","_width","_height","renderTarget1","renderTarget2","passes","copyPass","clock","Clock","swapBuffers","addPass","pass","insertPass","isLastEnabledPass","passIndex","deltaTime","getDelta","currentRenderTarget","maskActive","il","NOTEQUAL","effectiveWidth","effectiveHeight","setPixelRatio","pixelRatio","SSAARenderPass","clearColor","clearAlpha","sampleLevel","unbiased","copyShader","copyUniforms","copyMaterial","premultipliedAlpha","blending","AdditiveBlending","sampleRenderTarget","jitterOffsets","JitterVectors","baseSampleWeight","jitterOffset","setViewOffset","sampleWeight","clearViewOffset","TextMaterial","MeshPhongMaterial","composer","sizeRatioLarge","sizeRatioSmall","lightPosition","cube","cubeSize","cubeColorStandard","cubeColorHover","cubeEdgeColor","cubeTextColor","cubeMaterials","donutSize","donutColor","donutTextColor","north","west","east","south","initAntiAliasing","setCanvasStyle","addObjects","addLights","cameraDistance","ssaaRenderPass","Group","addRotationCube","addCompassRing","addCompassLetters","ambientLight","spotLight","SpotLight","castShadow","cubeGeometry","getTextMaterial","donutGeometry","donutMaterial","getCircleMaterial","getDirectionMesh","canvasSize","border","outlineSize","cubeColor","translate","lineWidth","strokeStyle","strokeText","letter","beginPath","textHeight","geometryUpper","materialUpper","getLetterMaterial","FrontSide","meshUpper","geometryLower","materialLower","BackSide","meshLower","checkMouseHover","resetCamera","getSelectedSide","togglePointer","offsetLeft","offsetTop","setFromCamera","intersect","materialIndex","faceIndex","setCubeMaterials","hoverIndex","pointA","pointB","zenith","startLat","destLat","startLng","destLng","brng","ratio","setContainerCursor","lookatLocal","lookatLonLat","yPosLocal","yPosLonLat","cameraLocal","cameraLatLon","groupYaw","bearing","groupPitch","rotateLetters","cubeYaw","calculateRotations","lineStart","lineEnd","Line3","setFromNormalAndCoplanarPoint","intersectLine","copyTextToClipboard","vertexWrapped","float","textField","userWarning","cardButtons","alignSelf","card","cardHovered","transitions","shortest","footerDiv","boxShadow","zIndex","measurementUnitsParent","justifyContent","measurementUnitsFlex","measurementUnitsRadio","imageOnlyInfoButton","marginside","expandText","bold","tableContent","cardHeader","cell","headerTitle","calculateButton","recalculate","flexDirection","recalculateButton","copyClipboard","measureList","lastTableRow","borderBottom","ExportDialog","exportType","setExportType","setOrdering","InputLabel","Select","exportMeasurements","MeasureTypeIcon","setMeasureType","m","ImportExportIcon","MeasurementCard","setExpanded","setHover","updateMeasureHover","rows","formatVolume","getVolumeResults","verticesReprojected","generateVertexPositions","generateMeasurementRows","Card","onMouseOver","onMouseLeave","raised","CardHeader","titleTypographyProps","subheader","subheaderTypographyProps","CardContent","TableContainer","Table","TableBody","isLastRow","TableRow","TableCell","align","deleteMeasurement","renameMeasurement","Measurements","useTheme","measurementUnits","exportModalOpen","setExportModalOpen","setMeasureUnits","loadImportData","encoded","decodeURIComponent","closeExportMenu","toggleMeasurements","updateMeasureType","setMeasurementUnits","reversed","iconProps","imageOnlyWarningOpen","setImageOnlyWarningOpen","exportDisabled","importDisabled","imageDistanceText","RadioGroup","FormControlLabel","control","Radio","fileType","getMeasureExportType","fileDialog","accept","reader","FileReader","readAsText","openImportBrowser","fileFilter","openImportElectron","assetDrawerWidth","backdrop","inside","drawer","drawerPaper","modal","tab","tabGrow","AssetDrawer","assetDrawerState","setTabValue","tabsEnabled","setDefaultTab","setAssetDrawerState","activeMeasurePrompt","setActiveMeasurePrompt","newTabValue","setNewTabValue","closeDrawer","setCloseDrawer","measurementsOpen","hasMeasurements","Drawer","anchor","transitionDuration","paper","AppBar","indicatorColor","Tab","readTransformFile","errorResponse","cols","col","menuButton","flexGrow","mixins","toolbar","projectionText","transformMatrix","matrixColumn","buttonDiv","dropdown","matrixAndButtons","verticalButtons","MatrixTextField","inputProps","number","multiplier","trunc","truncate","MatrixRepresentation","cameraTransform","ProjectDetails","warnOpen","setWarnOpen","setHeight","setProj","imported","setImported","setCameraTransform","correction","projectHeight","cameraTransformPath","basicAdjustments","handleWarnClose","toMeters","existing","handleCollisions","name1","name2","matchingProjection","selectedProjection","getNewProjection","hasBasicAlignment","FormControl","FormHelperText","InputLabelProps","shrink","ListSubheader","conflict","resetBasicAlignerCamera","trimmedName","emptyName","emptyHeight","emptyProjection","heightInMeters","projName","MainAppBar","handleAssetDrawerOpen","handleSettingsDrawerOpen","Toolbar","drawerWidth","asterisk","drawerHeader","list","background","listItem","formControl","switch","colorPreview","objectFit","classificationPreview","borderColor","borderStyle","borderWidth","switchLabel","switchElement","boldTypography","SettingsDrawer","classificationVisibilities","classificationColors","setClassificationColors","orthoFiles","dispatchInterval","opacitySliderValue","setOpacitySlider","saveOpacity","useCallback","orthoOpacitySliderValue","setOrthoOpacitySlider","saveOrthoOpacity","distanceSliderValue","setDistanceSlider","saveCloudDistance","maxPointsSlider","setMaxPointsSlider","saveCloudMaxPoints","cloudSizeSlider","setCloudSizeSlider","saveCloudSize","heightClipSlider","setHeightClipSlider","saveHeightClip","intensityClipSlider","setIntensityClipSlider","saveIntensityClip","updateOpacity","setPointCloudOpacity","updateOrthoOpacity","setOrthoOpacity","updateDistance","setPointCloudDistance","updateMaxPoints","setPointCloudMaxPoints","updateCloudSize","setPointCloudSize","updateHeightClip","setPointCloudHeightClip","updateIntensityClip","setPointCloudIntensityClip","setVisibleClassifications","setPointCloudColorMap","setPointCloudColorType","setPointCloudDynamicSize","setPointCloudCircularPoints","red","green","blue","padStart","classificationsShader","isIntensity","isHeightmap","colorMapRequired","gutterBottom","renderValue","Avatar","Slider","valueLabelDisplay","_","subtitle2","Switch","togglePickerDebug","every","denseCell","footerDense","minHeight","hiddenSort","clip","noSelect","rowDisabled","break","rowHover","EnhancedTableHead","order","orderBy","onRequestSort","columns","deletable","isDense","isSortable","cellClassName","TableHead","column","sortDirection","TableSortLabel","property","EnhancedTable","rowType","onRowClick","onDeleteClick","pageSize","defaultSort","sortable","numRowsPerPage","setOrder","setOrderBy","selectedRow","setSelectedRow","page","setPage","rowsPerPage","setRowsPerPage","descendingComparator","compA","compB","maxPage","getComparator","sliced","footerClassName","cellContent","Paper","isItemSelected","tabIndex","numeric","showHover","TablePagination","rowsPerPageOptions","onChangePage","newPage","onChangeRowsPerPage","titleClose","adornedEnd","utmButton","selectMargin","UserProjectionPanel","loadProjectionToEdit","setActiveTab","option","custom","user","EditPanel","customProjection","updateEditableValues","transformCheckbox","setTransformCheckbox","clearProjectionValues","existingName","projString","updateString","updateOrigin","updateTranslation","labelId","String","multiline","InputProps","startAdornment","InputAdornment","Grid","xs","nameTrim","stringTrim","nameError","stringError","SearchPanel","setType","searchTerm","setSearchTerm","hemisphere","setHemisphere","searching","setSearching","searchResults","setSearchResults","handleString","getProjections","searchText","pageNumber","previousResults","maxPageNumber","parsed","epsg","ProjectionsManager","projectionsOpen","setProjectionsOpen","setExistingName","setNewProjection","setCustomProjection","clearAllErrors","projectionData","dataCopy","hasTransform","transformCopy","ipcRenderer","tabLabel","scroll","dividers","newactiveTab","newValues","appReducer","combineReducers","projectReducer","cameraReducer","foldersReducer","projectionsReducer","settingsReducer","assetsReducer","store","configureStore","loadConfig","middleware","thunk","projectFileType","filterFilter","saveProjectAs","getState","fileName","nameWithoutExt","writeProject","saveProject","allowSaveAs","loadProjectJSON","projectJSON","loadProjectFile","jsonConfigVersion","versionOld","alert","projectString","saved","exit","hasChanged","isEqual","send","minHeightContent","toggleOptionParent","toggleOptionCheckbox","toggleOptionFlex","imageObservationSuccess","pointObservationSuccess","errorLow","errorMedium","errorHigh","checkboxPadding","PointObservationIcon","ObservationIcon","ImageObservationIcon","colorSecondary","colorInherit","ResidualError","ImageAlignerAdvanced","addObservations","setTabsEnabled","alignerAdvOpen","alignerBasicOpen","setAlignerAdvOpen","setRows","setCsvPath","encompassCsvPath","setEncompassCsvPath","setAligned","alignmentConfirm","setAlignmentConfirm","alignerMatrixPath","setAlignerMatrixPath","setValid","tableNonEmpty","setTableNonEmpty","closePrompt","setClosePrompt","isAligned","setIsAligned","alertOpen","setAlertOpen","askRemoveOpen","setAskRemoveOpen","alignPosition","setAlignPosition","alignRotation","setAlignRotation","handleOpen","resetRowsAndMesh","generateRows","parseResiduals","resArray","rounded","obs_num","img_obs","pc_obs","resetCameraAligner","rowsTemp","addRowCameraAligner","updateRows","tempRows","getErrorCameraAligner","resetRowIcons","hasImageObs","getImageObsCameraAligner","hasPointObs","getPointObsCameraAligner","cancelCurrentAlignment","checkRowsValid","getNumEntriesCameraAligner","validCheck","nonEmpty","imgCheck","pointCheck","removeAllListeners","removed","noCameras","setObservationTypeCameraAligner","toggleCameraAligner","csvEncompassPath","csvEncompassOut","getCamPoseCameraAligner","checkIfAligned","setCurrentRowCameraAligner","camID","getCamIdFromAligner","deleteRowCameraAligner","rowAdd","addRows","isConverted","camPoseEntry","largeResiduals","initialPath","correctionName","correctionPath","residualsTemp","setErrorsCameraAligner","titleTop","AlignerShortcuts","ImageAlignerBasic","singleAlignment","setAlignerBasicOpen","setHasTransform","hasActiveCamera","setBasicAlignerState","savedAngle","activeCameraName","getCurrentCameraName","alignment","isModified","epsilon","dz","checkDataModified","updated","EnhancedIconButton","labelFilter","modelFilter","dxfFilter","titleInfo","titleMin","labelFixedHeight","labelTitle","labelTitleWarning","labelTitleError","progressToolbar","toolbarLinear","toolbarProgressCenter","downloadMargin","Label","isScrolling","Category","isValidCategory","editPrompt","setEditPrompt","deletePrompt","setDeletePrompt","addNewLabelDisabled","addNewlabelTooltip","scrollingDivLength","useScrollingDiv","scrollingDivHeight","disableTypography","useIsScrolling","itemCount","itemSize","ImageLabelling","categoryList","imageLabelOpen","setImageLabelOpen","labelType","setLabelType","minimized","setMinimized","setAddCategory","importData","setImportData","modalName","setModalName","labelLoadProgress","setLabelLoadProgress","trainClassifyProgress","setTrainClassifyProgress","trainClassifyExe","setTrainClassifyExe","predOrTrain","setPredOrTrain","training","setTraining","trainingURL","setTrainingURL","downloadingResources","setDownloadingResources","trainingPrompt","setTrainingPrompt","classificationPrompt","setClassificationPrompt","isOrthoLabel","isSceneLabel","importPrompt","importCategories","numImportLabels","resetExecutableValues","handleCancelProgress","handleImport","checkCategoryUniqueness","handleCategoryChange","handleViewTraining","forceInitialProgress","updateDownloadingResources","downloading_resources","runClassification","modelPath","loadedImageLabelPaths","runTraining","cocoPath","outputPath","modelName","activeImageLabelPaths","gpu_memory_error","model_file_path","HTMLInputElement","labelHotkey","isTraining","labelDisabled","trainingLinkDisabled","noAnnotations","noImages","canRunTraining","exportJSON","canExportDXF","tempCocoPath","runExportDXF","CircularProgress","iterations","validChar","iterNumber","validIterations","scoreNumber","validScore","menuItem","ContextMenu","labelActive","toggleCamera","getMenuItems","onEnter","buttonParent","heading","LayerSwitcher","setAnchorEl","clearTooltipText","basemapIds","activeBasemap","previews","currentTarget","Popover","anchorOrigin","vertical","horizontal","transformOrigin","layerID","large","small","offsetSmall","borderTop","offsetLarge","gradient","ViewSwitcher","handleSwitched","SceneViewer","setViewer","orthoLabelOpen","setOrthoLabelOpen","closeAllTools","projectModifiedDate","viewerSwitched","savedAerialState","divRef","useRef","mapRef","viewerTooltipText","updateViewerTooltipText","aerialTooltipText","updateAerialTooltipText","customAlertHTML","setCustomAlertHTML","cameraState","throttle","triggerWindowResize","Event","addAllAssets","checkShiftReset","reconcileCameras","reconcilePointClouds","reconcileOrthos","resetDefaultAerialState","resetDefaultOrbitState","validOrbit","validCamera","isValidCameraState","setProjectName","removeInteractions","getAvailableClassifications","viewerProps","viewerRef","THREE","defs","register","resetLoadedOnce","viewProjectionUnits","mapClasses","viewerClasses","classLarge","classSmall","getClasses","ref","processTimeout","dataPathName","pointsFolder","imagesFolder","dialogTitle","exportText","contentCenter","cancelProgress","cancelContent","rootOutputPath","webOutputPath","numAssets","StaticExporter","exportName","setExportName","dataExportOpen","setDataExportOpen","runnable","setRunnable","successOpen","setSuccessOpen","cancelOpen","setCancelOpen","cancelling","setCancelling","finishing","setFinishing","runningExe","setRunningExe","exportTopMessage","setExportTopMessage","exportBottomMessage","setExportBottomMessage","exportPercent","setExportPercent","exportAssets","setExportAssets","numOrthos","canExport","numRawPointcloud","setNewRunningExe","setExportMessage","getAssetIndex","createNewFolder","folderPath","existsSync","rmdir","recursive","moveCameraData","imagesPath","imagesData","newImagePath","copyFile","moveEncompassData","inputPath","copydir","moveRawPointcloud","updateCameraDataState","assetIndex","finalPath","moveAssetData","finishExport","updateEncompassDataState","updateRawPointcloudDataState","matrixPath","updateCameraTransformPath","projectJson","projectPath","miniViewerPath","getMiniViewerPath","exeOutputPath","copyFileSync","exportToHtml","buildPath","getBuildPath","outputFolder","sanitize","toProcess","processNextAsset","pointListItem","cameraListItem","orthoListItem","createMuiTheme","appBar","snackbar","tooltip","overrides","MuiPopover","MuiTooltip","backdropText","DragDropLoader","addFilePathsFunc","handleDrop","BackdropToggle","backdropOpen","setBackdropOpen","Backdrop","App","projectDrawerState","projectActiveTab","setDrawerState","settingsDrawerState","setSettingsDrawerState","setSelectedTab","addFilePaths","configs","loadFromCompiledExe","rawArgs","argv","arg","getAllFileArgs","showMessageBox","buttons","noLink","selection","quit","oncontextmenu","cache","loadFromStaticSite","updateCompassOffset","ThemeProvider","sendToMainWindow","mainWindow","getCurrentWindow","webContents","fileMenu","submenu","helpMenu","shell","openPath","toolsMenu","debugMenu","setToolAvailability","toolName","Menu","getApplicationMenu","items","checkAllowedMenuItems","template","generateTemplateList","menu","buildFromTemplate","setApplicationMenu","MessageProvider","messageRef","onMessageClose","closeSnackbar","maxSnack","TransitionComponent","Zoom","ReactDOM","electron","isPackaged"],"mappings":"uHAAA,2FAgGaA,GAhGb,MAGsB,SAAG,KAAM,GA6FH,SAACC,GAAkD,IAApCC,EAAmC,wDAC5E,OAAO,IAAIC,SAAQ,SAACC,EAASC,GACvBH,EACFI,EAAgBF,EAASC,EAAQJ,GAEjCM,EAAiBH,EAASC,EAAQJ,QAK3BO,EAAiB,SAACP,GAAkD,IAApCC,EAAmC,wDAC9E,OAAO,IAAIC,SAAS,SAACC,EAASC,GACxBH,EACFO,EAAsBL,EAASC,EAAQJ,GAEvCS,EAAuBN,EAASC,EAAQJ,OAYxCK,EAAkB,SAACF,EAASC,EAAQJ,GACxCU,MAAMV,EAAM,CACVW,QAAS,CAAC,eAAgB,sBAEzBC,MAAK,SAAAC,GAAG,OAAIA,EAAIC,UAChBF,MAAK,SAAAG,GACJZ,EAAQY,MAETC,OAAM,WACLZ,EAAO,kCAIPE,EAAmB,SAACH,EAASC,EAAQJ,GACzCiB,IAAGC,SAASlB,EAAM,SAAS,SAACmB,EAAKJ,GAC3BI,EACFf,EAAO,8BAITD,EAAQiB,KAAKC,MAAMN,QAIjBP,EAAwB,SAACL,EAASC,EAAQJ,GAC9CU,M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AOugB,QAAQ,YAAc,KAEzD8nB,EAAS2tF,EAAWA,EAAS3tF,OAAS,KAEtCosF,EAAQuB,EAAWA,EAASvB,MAAQ,KAEpC9c,EAAcqe,EAAWA,EAASre,YAAc,KAEhDh8G,EAAQq6H,EAAWh2H,OAAOugB,QAAQ,iBAAmB,KAErDjjB,EAAU04H,EAAWh2H,OAAOugB,QAAQ,WAAa,KAEjD1M,EAASw0B,EAASA,EAAOx0B,OAAS,KAElCnU,EAAM2oC,EAASA,EAAO3oC,IAAM,KAE5B00H,EAAmB4B,EAAWA,EAAS3tF,OAAO+rF,iBAAmB,KAEjEW,EAAO1sF,EAASA,EAAO0sF,KAAO,KAE9BvoI,EAAK67C,EAASA,EAAO9nB,QAAQ,MAAQ,KAErChO,EAAa/lB,EAAKA,EAAGiU,SAAW,KAEhCqa,EAAMutB,EAASA,EAAO9nB,QAAQ,YAAc,KAE5CyvG,EAAU3nF,EAASA,EAAO9nB,QAAQ,YAAc,KAEhDjL,EAAO+yB,EAASA,EAAO9nB,QAAQ,QAAU,KAEzC3gB,IAAYyoC,IAA6B,IAAnB3oC,EAAIu2H,WAE1Bh7G,GAAe+6G,EAEfr1H,EAAmBjB,EAC5BnU,IAAKgR,KAAKmD,EAAI+T,QAAQ,YAAa,QACnC,KAEStjB,EAAUk4C,EAASA,EAAO9nB,QAAQ,8BAAgC,CAC7EjwB,IAAK,WACH,MAAO,CAACzD,QAAQ,IAElBuD,IAAK,gB","file":"static/js/main.5f855edf.chunk.js","sourcesContent":["import {fs} from '../../electron-modules';\nimport path from 'path';\n\nconst bytesPerMegabyte = 1024**2;\nconst byteReadSize = 5 * bytesPerMegabyte;\n\nexport const readBufferChunks = (filePath, byteStart, chunkSize, maxChunks): Promise => {\n return new Promise((resolve, reject) => {\n const debugMessages = false;\n const timeStart = performance.now();\n\n const stats = fs.statSync(filePath);\n const fileSizeInBytes = stats.size;\n\n // No more data can be found\n if (byteStart >= fileSizeInBytes) {\n resolve({buffers: []});\n return;\n }\n\n if (debugMessages) {\n console.log(`[BufferReader]: byte start: ${byteStart}`);\n }\n\n // Initialize our results buffer (slightly larger than required)\n let bytesRead = 0;\n let size = (maxChunks + 1) * chunkSize;\n let data = Buffer.alloc(size);\n\n /** Append file chunks to our data buffer when new data is received */\n const onDataEvent = chunk => {\n let buffer = chunk.slice(0, chunk.length);\n data.set(buffer, bytesRead);\n bytesRead += chunk.length;\n };\n\n /** Send our data to our viewer after finishing reading */\n const onEndEvent = () => {\n let response = {\n file: baseFileEvent(filePath),\n buffers: chunksFromBuffer(),\n bufferChunkSize: chunkSize,\n numBytes: fileSizeInBytes,\n maxchunks: maxChunks\n };\n\n if (debugMessages) {\n let timeEnd = performance.now();\n let timeElapsed = timeEnd - timeStart;\n timeElapsed = Math.round(timeElapsed * 100) / 100;\n console.log(`[BufferReader]: read file buffer: ${timeElapsed}ms`);\n console.log(response.buffers);\n }\n\n resolve(response);\n };\n\n /** Convert full buffer to arraybuffer chunks */\n const chunksFromBuffer = () => {\n let chunks = [];\n let buffer = data.slice(0, bytesRead).buffer;\n\n for (let i = 0; i < maxChunks; i++) {\n let start = i * chunkSize;\n if (start >= bytesRead) {\n break;\n }\n\n let finish = start + chunkSize;\n finish = Math.min(bytesRead, finish);\n let chunk = buffer.slice(start, finish);\n chunks.push(chunk);\n }\n\n return chunks;\n };\n\n const initReader = () => {\n const bytesToRead = maxChunks * chunkSize;\n const safeReadSize = Math.min(byteReadSize * 0.5, bytesToRead);\n\n fs.createReadStream(filePath, {\n highWaterMark: safeReadSize,\n start: byteStart,\n end: byteStart + bytesToRead\n }).on(\"end\", () => {\n onEndEvent();\n }).on(\"data\", chunk => {\n onDataEvent(chunk);\n });\n };\n\n initReader();\n });\n};\n\nexport const readFileJSON = (path: string, staticFile=false): Promise => {\n return new Promise((resolve, reject) => {\n if (staticFile) {\n readJsonFromURL(resolve, reject, path);\n } else {\n readJsonElectron(resolve, reject, path);\n }\n });\n};\n\nexport const readFileBuffer = (path: string, staticFile=false): Promise => {\n return new Promise(((resolve, reject) => {\n if (staticFile) {\n readFileBufferFromURL(resolve, reject, path);\n } else {\n readFileBufferElectron(resolve, reject, path);\n }\n }));\n};\n\nexport const baseFileEvent = filePath => ({\n name: path.basename(filePath),\n path: filePath,\n visible: true,\n local: false\n});\n\nconst readJsonFromURL = (resolve, reject, path) => {\n fetch(path, {\n headers: {'Content-Type': 'application/json'}\n })\n .then(res => res.json())\n .then(data => {\n resolve(data);\n })\n .catch(() => {\n reject('Error reading file as json');\n });\n};\n\nconst readJsonElectron = (resolve, reject, path) => {\n fs.readFile(path, 'utf-8', (err, data) => {\n if (err) {\n reject('Error reading file as json');\n return;\n }\n\n resolve(JSON.parse(data));\n });\n};\n\nconst readFileBufferFromURL = (resolve, reject, path) => {\n fetch(path)\n .then(res => {\n if (res.status === 404) {\n throw new Error(\"File Not Found\");\n }\n return res.arrayBuffer();\n })\n .then(data => {\n if (data.byteLength === 0) {\n throw new Error(\"File Not Found\");\n }\n resolve(data);\n })\n .catch(() => {\n reject('Error reading file as arraybuffer');\n });\n};\n\nconst readFileBufferElectron = (resolve, reject, path) => {\n fs.readFile(path, (err, data) => {\n if (err) {\n reject('Error reading file as arraybuffer');\n return;\n }\n\n resolve(data.buffer);\n });\n};\n","import {createSlice, nanoid, PayloadAction} from '@reduxjs/toolkit';\nimport path from 'path';\nimport slash from 'slash';\nimport {\n encompassFileFormat,\n imageListFormats,\n lasFileFormat,\n orthoFormats,\n planarListFormats\n} from '../asset-utils';\n\nexport interface CameraData {\n x: number;\n y: number;\n z: number;\n roll: number;\n pitch: number;\n yaw: number;\n path: string;\n name: string;\n config?: object\n}\n\ninterface PointCloudData {\n path: string;\n}\n\nexport interface OrthoData {\n imageBounds: [];\n imageData: string;\n imageSize: [number, number];\n imageSizeOriginal: [number, number];\n imagePath: string;\n scaleX: number,\n scaleY: number,\n}\n\nexport interface Asset {\n id: string;\n name: string;\n fromJSON: boolean;\n date: string;\n visible: boolean;\n folderID: string;\n type: AssetType;\n data: PointCloudData | CameraData[] | OrthoData;\n}\n\nexport interface AssetListItem {\n folderID: string,\n assetPath: string\n data?: CameraData[] | OrthoData;\n}\n\n// NOTE: Always add new asset types to bottom of list\nexport enum AssetType {\n LAS,\n Encompass,\n Panoramic,\n Unknown,\n OrthoMosaic,\n Planar\n}\n\nexport const assetTypeFromExtension = (ext: string): AssetType => {\n if (ext === lasFileFormat) {\n return AssetType.LAS;\n }\n\n if (ext === encompassFileFormat) {\n return AssetType.Encompass;\n }\n\n if (imageListFormats.indexOf(ext) !== -1) {\n return AssetType.Panoramic;\n }\n\n if (planarListFormats.indexOf(ext) !== -1) {\n return AssetType.Planar;\n }\n\n if (orthoFormats.indexOf(ext) !== -1) {\n return AssetType.OrthoMosaic;\n }\n\n return AssetType.Unknown;\n};\n\nconst getAssetPayload = (folderID: string, assetPath: string, data?: CameraData[] | OrthoData): Asset => {\n assetPath = slash(assetPath);\n const extension = path.extname(assetPath).slice(1);\n\n let assetData;\n\n if (data) {\n assetData = data;\n } else {\n assetData = {\n path: extension === encompassFileFormat\n ? path.dirname(assetPath)\n : assetPath\n };\n }\n\n const payload = {\n id: nanoid(),\n name: path.basename(assetPath),\n date: new Date().toISOString(),\n type: assetTypeFromExtension(extension),\n folderID,\n visible: true,\n fromJSON: false,\n data: assetData\n } as Asset;\n\n return payload;\n};\n\nexport const assetsSlice = createSlice({\n name: 'assets',\n initialState: [] as Asset[],\n reducers: {\n addAsset: {\n reducer: (state, action: PayloadAction) => {\n state.push(action.payload);\n },\n prepare: (folderID: string, assetPath: string, data?: CameraData[] | OrthoData): {payload: Asset} => {\n const payload = getAssetPayload(folderID, assetPath, data);\n return {payload};\n }\n },\n addAssets: {\n /** Add multiple assets at once. Much faster than adding single assets */\n reducer: (state, action: PayloadAction) => {\n action.payload.forEach(payload => {\n state.push(payload);\n });\n },\n prepare: (assetsList: AssetListItem[]): {payload: Asset[]} => {\n const payload = assetsList.map(assetItem => {\n const {folderID, assetPath, data} = assetItem;\n return getAssetPayload(folderID, assetPath, data);\n });\n\n return {payload};\n }\n },\n changeFolder: (state, action: PayloadAction<{folderID: string, assetID: string}>) => {\n const {assetID, folderID} = action.payload;\n const asset = state.find(asset => asset.id === assetID);\n\n if (asset) {\n asset.folderID = folderID;\n }\n },\n changeName: (state, action) => {\n const {assetID, name} = action.payload;\n const asset = state.find(asset => asset.id === assetID);\n\n if (asset) {\n asset.name = name;\n }\n },\n toggleVisibility: (state, action) => {\n const assetID = action.payload;\n const asset = state.find(asset => asset.id === assetID);\n\n if (asset) {\n asset.visible = !asset.visible;\n }\n },\n deleteAsset: (state, action) =>\n state.filter(asset => asset.id !== action.payload),\n deleteAssets: (state, action) =>\n state.filter(asset => asset.folderID !== action.payload)\n }\n});\n\nexport default assetsSlice.reducer;\n\nexport const {\n addAsset,\n addAssets,\n changeFolder,\n toggleVisibility,\n changeName,\n deleteAsset,\n deleteAssets,\n} = assetsSlice.actions;\n\nexport const selectAllAssets = state =>\n state.assets;\n\nexport const getPointCloudAssets = assets =>\n assets.filter(asset => asset.type === AssetType.Encompass || asset.type === AssetType.LAS);\n\nexport const getCameraFileAssets = assets =>\n assets.filter(asset => asset.type === AssetType.Panoramic || asset.type === AssetType.Planar);\n\nexport const getOrthoAssets = assets =>\n assets.filter(asset => asset.type === AssetType.OrthoMosaic);\n\nexport const selectAssetsByFolderID = folderID => state =>\n state.assets.filter(asset => asset.folderID === folderID);\n\nexport const selectAssetByID = assetID => state =>\n state.assets.find(asset => asset.id === assetID);","import {createSlice} from '@reduxjs/toolkit';\n\nexport const defaultProjectTitle = 'Untitled Project';\ninterface ProjectState {\n name: string;\n modified: string;\n path: string;\n newProject: boolean;\n configVersion: number;\n}\n\nexport const currentConfigVersion = 3.4;\n\nexport const projectSlice = createSlice({\n name: 'project',\n initialState: {\n path: '',\n newProject: true,\n name: defaultProjectTitle,\n modified: new Date().toISOString(),\n configVersion: currentConfigVersion\n } as ProjectState,\n reducers: {\n refreshModified: (state, action) => {\n state.modified = new Date().toISOString();\n },\n changeName: (state, action) => {\n state.name = action.payload;\n },\n changePath: (state, action) => {\n state.path = action.payload;\n }\n }\n});\n\nexport const {\n refreshModified,\n changeName,\n changePath\n} = projectSlice.actions;\n\nexport default projectSlice.reducer;\n\nexport const selectName = state => state.project.name;\nexport const selectProjectModified = state => state.project.modified;","import {Projection, Transform} from '../redux/projections-slice';\nimport {storage} from \"../electron-modules\";\n\nexport const unknownTextMeters = \"Unknown Projection (m)\";\nexport const unknownTextFeet = \"Unknown Projection (ft)\";\n\nexport const unknownProjectionMeters = {\n type: 'proj4',\n name: unknownTextMeters,\n string: '+proj=utm +zone=10 +ellps=WGS84 +datum=WGS84 +units=m'\n} as Projection;\n\nexport const unknownProjectionFeet = {\n type: 'proj4',\n name: unknownTextFeet,\n string: '+proj=utm +zone=10 +ellps=WGS84 +datum=WGS84 +units=ft'\n} as Projection;\n\nexport const defaultProjection = {\n type: 'proj4',\n name: '',\n string: ''\n} as Projection;\n\nexport const defaultTransform = {\n origin: Array(3).fill(0),\n translation: Array(3).fill(0),\n rotation: 0,\n scale: 1\n} as Transform;\n\nexport const generateID = (text) => {\n return text.replace(/\\s/g, '.');\n};\n\nclass Projections {\n public data: Projection[] = [];\n\n constructor() {\n this.load();\n }\n\n isDuplicate(data) {\n const id = data.name;\n const ids = this.data.map(x => x.name);\n return ids.indexOf(id) !== -1;\n }\n\n save(data) {\n if (this.isDuplicate(data)) {\n return false;\n }\n\n this.data.push(data);\n const result = storage.set('projection', this.data);\n if (result.status) {\n this.load();\n return true;\n }\n\n return false;\n }\n\n load() {\n const result = storage.get(\"projection\");\n if (result.status === false) {\n return;\n }\n\n // Data has get/set methods instead of raw values\n // so we dump and load json values to get raw data\n this.data = result.data.map(obj => {\n return JSON.parse(JSON.stringify(obj));\n });\n }\n\n delete(id) {\n const rows = this.data.map(x => x.name);\n const index = rows.indexOf(id);\n this.data.splice(index, 1);\n const result = storage.set('projection', this.data);\n if (result.status) {\n this.load();\n }\n }\n}\n\nconst projections = new Projections();\nexport default projections;\n","import {createSlice, PayloadAction} from '@reduxjs/toolkit';\nimport {unknownProjectionMeters} from '../projections/projections';\n\nexport interface Projection {\n type: string,\n name?: string,\n string: string,\n imported?: boolean,\n transform?: Transform\n}\n\nexport interface Transform {\n origin: number[];\n translation: number[];\n rotation: number;\n scale: number;\n}\n\ninterface ProjectionData {\n data: Projection;\n view: Projection;\n measureUnits: string\n}\n\nexport const projectionsSlice = createSlice({\n name: 'projections',\n initialState: {\n data: unknownProjectionMeters,\n view: unknownProjectionMeters,\n measureUnits: \"m\"\n } as ProjectionData,\n reducers: {\n changeData: (state, action: PayloadAction) => {\n state.data = action.payload;\n },\n changeView: (state, action: PayloadAction) => {\n state.view = action.payload;\n },\n changeMeasureUnits: (state, action: PayloadAction) => {\n state.measureUnits = action.payload;\n },\n }\n});\n\nexport const {\n changeData,\n changeView,\n changeMeasureUnits\n} = projectionsSlice.actions;\n\nexport default projectionsSlice.reducer;\n\nexport const selectView = state => state.projections.view;\nexport const selectData = state => state.projections.data;\nexport const selectMeasureUnits = state => state.projections.measureUnits;","import {\n Button,\n createStyles,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n IconButton,\n LinearProgress,\n makeStyles,\n TextField,\n Theme\n} from \"@material-ui/core\";\nimport clsx from 'clsx';\nimport React, {useEffect, useState} from \"react\";\nimport CloseIcon from '@material-ui/icons/Close';\nimport RemoveIcon from '@material-ui/icons/Remove';\nimport Draggable from \"react-draggable\";\nimport { headerHeight } from \"./app\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n draggableTitleClose: {\n color: theme.palette.grey[500],\n marginRight: theme.spacing(1)\n },\n draggableTitleMinimize: {\n color: theme.palette.grey[500],\n },\n draggableContent: {\n padding: theme.spacing(0),\n paddingTop: \"0px !important\",\n height: \"fit-content\",\n width: \"500px\",\n maxWidth: \"500px\",\n marginTop: `${headerHeight + theme.spacing(1)}px`\n },\n draggableContentSlim: {\n height: \"min(75vh, 600px)\",\n width: \"400px\",\n maxWidth: \"400px\"\n },\n draggableContentLeft: {\n marginLeft: theme.spacing(1)\n },\n draggableTopDiv: {\n display: \"flex\",\n alignItems: \"center\"\n },\n draggableBackdropPaper: {\n height: \"inherit\"\n },\n draggableBackdropRounded: {\n borderRadius: theme.spacing(0.5),\n height: \"inherit\"\n },\n draggableRoundCorner: {\n backgroundColor: \"transparent\"\n },\n draggableTitle: {\n userSelect: \"none\",\n cursor: \"grab\",\n flex: 1\n },\n draggableTitleDown: {\n cursor: \"grabbing\"\n },\n progressContent: {\n padding: `${theme.spacing(3)}px !important`,\n },\n progressNoTransition: {\n transition: \"none\"\n }\n }),\n);\n\nexport const PromptDialog = props => {\n const {open, title, prompt, button, onCancel, onSubmit} = props;\n\n return (\n \n \n {title}\n \n\n \n \n {prompt}\n \n \n\n \n \n \n {button}\n \n \n \n );\n};\n\nexport const AlertDialog = props => {\n const {open, title, handleClose} = props;\n\n return (\n \n \n {title}\n \n \n {props.children}\n \n \n \n \n \n );\n};\n\nexport const TextDialog = props => {\n const [text, setText] = useState(props.default);\n const [disabled, setDisabled] = useState(true);\n\n const handleTextChange = (event) => {\n setText(event.target.value);\n };\n\n useEffect(() => {\n if (text.trim() !== '') {\n setDisabled(false);\n } else {\n setDisabled(true);\n }\n }, [text]);\n\n const handleCancel = () => {\n props.onCancel();\n setText(props.default);\n };\n\n const handleSubmit = () => {\n const trimmedText = text.trim();\n\n props.onSubmit(trimmedText);\n\n if (props.clear) {\n setText('');\n } else {\n setText(trimmedText);\n }\n };\n\n const handleKeyDown = (event) => {\n if (event.key === 'Enter') {\n if (text === '') {\n return;\n }\n\n handleSubmit();\n }\n };\n\n return (\n \n {props.title}\n \n \n {props.prompt}\n \n \n \n \n \n \n \n \n );\n};\n\nexport const DraggableDialog = props => {\n const {open, title, narrow, onClose, onMinimize} = props;\n const classes = useStyles();\n\n const [mouseDown, setMouseDown] = useState(false);\n\n const onDragMouseDown = () => {\n setMouseDown(true);\n };\n\n const onDragMouseUp = () => {\n setMouseDown(false);\n };\n\n return (\n \n \n \n {/* Draggable title */}\n \n {title}\n \n\n {/* Optional minimize button */}\n {onMinimize && (\n \n )}\n\n {/* Close button */}\n \n \n \n \n\n {props.children}\n \n \n );\n};\n\nexport const ProgressDialog = props => {\n const {open, text, percent, noTransition} = props;\n const classes = useStyles();\n\n return (\n \n \n \n {text} {percent.toFixed(2)}%\n \n \n \n \n );\n};\n","import {createSlice, nanoid, PayloadAction} from '@reduxjs/toolkit';\n\ninterface Folder {\n name: string;\n id: string;\n date: string;\n isDefault: boolean;\n}\n\nexport const foldersSlice = createSlice({\n name: 'folders',\n initialState: [\n {\n name: 'Default',\n id: nanoid(),\n date: new Date().toISOString(),\n isDefault: true\n } as Folder\n ],\n reducers: {\n addFolder: {\n reducer: (state, action: PayloadAction) => {\n state.push(action.payload);\n },\n prepare: (name: string) => {\n const id = nanoid();\n const date = new Date().toISOString();\n return {payload: {id, name, date, isDefault: false}};\n }\n },\n deleteFolder: (state, action) =>\n state.filter(folder => folder.id !== action.payload || folder.isDefault),\n renameFolder: (state, action) => {\n const folder = state.find(folder => folder.id === action.payload.id);\n\n if (folder) {\n folder.name = action.payload.name;\n }\n }\n }\n});\n\nexport const {\n addFolder,\n deleteFolder,\n renameFolder\n} = foldersSlice.actions;\nexport default foldersSlice.reducer;\n\nexport const selectDefaultFolder = state => state.folders.find(folder => folder.isDefault);","import {\n isDevMode,\n app,\n fs,\n child,\n process,\n logDirectoryPath\n} from \"./electron-modules\";\nimport path from \"path\";\nimport slash from \"slash\";\n\nconst engineMessageTypeJSON = \"NODEJSJSONDATA\";\n\nclass Executable {\n public exePath: string;\n public exeName: string;\n public running: boolean;\n public child;\n public developerKey: string;\n public spawnDetached: boolean;\n private logText = [];\n private showStatus = true;\n\n constructor(exePath, exeName) {\n this.exePath = exePath;\n this.exeName = exeName;\n this.running = false;\n this.child = null;\n this.spawnDetached = false;\n }\n\n get path() {\n let basePath;\n let appPath = slash(app.getAppPath());\n let executablePath;\n if (!isDevMode) {\n // calculate path using root + folder and name\n basePath = path.dirname(appPath);\n basePath = path.dirname(basePath);\n basePath = path.dirname(basePath);\n executablePath = path.join(basePath, this.exePath, this.exeName);\n } else {\n // grab full path from config file\n const contents = fs.readFileSync(`${appPath}/develop.env`);\n const env = JSON.parse(contents);\n executablePath = env[this.developerKey];\n }\n\n return executablePath;\n }\n\n statusMessage(message) {\n if (!this.showStatus) {\n return;\n }\n\n console.log(`[pid = ${this.child.pid}]: ${message}`);\n }\n\n parseCommandsList(commands) {\n // Convert objects to modified json\n for (let i=0;i {\n return ((index % 2) === 0)\n ? text\n : `\"${text}\"`;\n }).join(\" \");\n }\n\n run(opts = {}) {\n if (this.running) {\n console.log(\"Cannot launch multiple instances\");\n return;\n }\n\n const defaults = {\n parseLineData: true,\n parseJSON: true,\n showStatus: true,\n saveLogs: false,\n command: null,\n onClose: null,\n onData: null,\n onLine: null\n };\n\n let options = {...defaults, ...opts};\n\n this.running = true;\n this.showStatus = options.showStatus;\n\n let commands = this.parseCommandsList(options.command);\n let executablePath = this.path;\n\n let cwd = path.dirname(executablePath);\n this.child = child.spawn(executablePath, commands, {\n cwd: cwd,\n env: {\n ...process.env,\n PYTHONUNBUFFERED: true,\n NODEJS: true\n },\n detached: this.spawnDetached\n });\n\n if (!this.child.pid) {\n console.error(`Error launching ${this.exeName} exe`);\n if (options.onClose) {\n options.onClose();\n }\n\n return;\n }\n\n let copyPasteCommands = this.copyableCommands(commands);\n this.statusMessage(`${this.path} ${copyPasteCommands}`);\n\n this.child.on('close', () => {\n this.statusMessage(`close`);\n\n if (options.saveLogs) {\n let commandIndex = commands.indexOf(\"-p\") + 1;\n if (commandIndex > 0) {\n let commandName = commands[commandIndex];\n saveLogs(commandName, this.logText);\n }\n }\n this.running = false;\n this.child = null;\n\n if (options.onClose) {\n options.onClose();\n }\n });\n\n if (options.onData) {\n this.child.stderr.on('data', (data) => {\n options.onData(data, engineMessageTypeJSON);\n });\n\n this.child.stdout.on('data', (data) => {\n options.onData(data, engineMessageTypeJSON);\n });\n }\n\n if (options.onLine || options.saveLogs) {\n this.child.stderr.on('data', (data) => {\n this.parseLines(data, options);\n });\n\n this.child.stdout.on('data', (data) => {\n this.parseLines(data, options);\n });\n }\n\n return this.child;\n }\n\n /** @private */\n parseLines(data, opts) {\n let callback = opts.onLine ? opts.onLine : () => {};\n let parseLineData = opts.parseLineData;\n\n let dataString = data.toString();\n let lines = dataString.split(\"\\n\");\n\n lines.forEach(line => {\n line = line.trim();\n if (line === \"\") {\n return;\n }\n\n if (!parseLineData) {\n // Execute callback with raw line response\n callback(line);\n }\n\n // Parse our response and only keep engine json response\n let split = line.split(\":\");\n let messageType = split[0].trim();\n let messageData = split.slice(1).join(\":\").trim();\n\n if (messageType === engineMessageTypeJSON) {\n try {\n if (opts.parseJSON) {\n let jsonData = JSON.parse(messageData);\n callback(jsonData);\n } else {\n callback(messageData);\n }\n } catch {\n callback(null);\n }\n } else {\n // NOTE: can be removed once everything uses engineMessageTypeJSON\n if (!messageType.startsWith(\"NODEJS\")) {\n this.logText.push(line);\n }\n }\n });\n }\n\n destroy() {\n if (this.running === false) {\n return;\n }\n\n this.running = false;\n\n // Kill original process id\n this.statusMessage(`force kill process`);\n process.kill(this.child.pid);\n\n try {\n let text = `wmic process get processid,parentprocessid,executablepath|find \"${this.child.pid}\"`;\n let stdout = child.execSync(text);\n let lines = stdout.toString().split(\"\\n\");\n\n let subprocessToKill = [];\n lines.forEach(line => {\n line = line.replace(/\\s\\s+/g, ' ');\n line = line.replace(\"\\n\", \"\");\n if (line.length === 0) {\n return;\n }\n\n line = line.split(\" \");\n\n let rootProcessID = this.child.pid;\n let parentProcessID = parseInt(line.slice(-3)[0]);\n let processID = parseInt(line.slice(-2)[0]);\n line.splice(-3);\n\n // Wrong process (wrong parent id)\n if (parentProcessID !== rootProcessID) {\n return;\n }\n\n // Wrong process (processID == rootProcessID)\n if (processID === rootProcessID) {\n return;\n }\n\n // Check launch path (engine.exe and known executables)\n let cmdPath = slash(line.join(\" \"));\n let engineSubprocess = cmdPath.indexOf(this.exeName) !== -1;\n let engineExecutable = cmdPath.indexOf(\"engine/executables\") !== -1;\n\n if (engineSubprocess || engineExecutable) {\n // Add our sub-process to the list of ones to stop\n subprocessToKill.push(processID);\n }\n });\n\n // Kill all of the child processes that may have spawned\n subprocessToKill.forEach(subprocessID => {\n this.statusMessage(`kill sub-process ${subprocessID}`);\n process.kill(subprocessID);\n });\n } catch (err) {\n // Do nothing\n }\n }\n}\n\nexport class PythonExecutable extends Executable {\n constructor() {\n super(\"exe-engine\", \"engine.exe\");\n this.developerKey = \"exe-python\";\n window.onbeforeunload = () => {\n this.destroy();\n };\n }\n\n write(text) {\n if (!this.running) {\n return;\n }\n\n this.child.stdin.write(text);\n }\n}\n\nexport class WorkflowExecutable extends Executable {\n constructor() {\n super(\"../\", \"SOLV3D engine.exe\");\n this.developerKey = \"exe-main\";\n this.spawnDetached = true;\n }\n}\n\nconst saveLogs = async (logPrefix, logText) => {\n const maxLogFiles = 50;\n\n fs.promises.mkdir(logDirectoryPath)\n .catch(() => {});\n\n const dateString = new Date()\n .toISOString()\n .replaceAll(\":\", \"-\");\n\n const logPath = path.join(\n logDirectoryPath,\n `${logPrefix} ${dateString}.txt`\n );\n\n const logs = logText.join(\"\\n\");\n fs.promises.writeFile(logPath, logs);\n\n const filenames = await fs.promises.readdir(logDirectoryPath);\n if (filenames.length <= maxLogFiles) {\n return;\n }\n\n let oldest = new Date();\n let oldestFilePath;\n\n for (let filename of filenames) {\n const filePath = path.join(logDirectoryPath, filename);\n const stats = await fs.promises.stat(filePath);\n\n if (stats.birthtime < oldest) {\n oldest = stats.birthtime;\n oldestFilePath = filePath;\n }\n }\n\n await fs.promises.unlink(oldestFilePath)\n .catch(() => {});\n};\n","import linspace from \"exact-linspace\";\nimport * as shuffleArray from \"shuffle-array\";\n\nlet TouchEventFirstTouch = false;\nlet TouchEventTouching = 0;\nlet TouchEventPinchStart = null;\nlet TouchEventPinchEnd = null;\n\nexport const isMobile = () => {\n return (/android|webos|iphone|ipad|ipod|blackberry|playbook|BB10|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));\n};\n\nexport const touchToMouse = (controls, event, type: any = 'move') => {\n let touches = event.changedTouches;\n\n // The only event allowed during 3d mode is touchend (mouseup). Since we only allow this\n // event to be passed along we need to pretend that we pressed down first\n if (controls.orbit.status) {\n if (event.type !== \"touchend\") {\n return;\n }\n controls.mouse.upEnabled = true;\n }\n\n if (type === \"move\") {\n // touchstart will increment TouchEventTouching\n if (event.type === \"touchstart\") {\n if (TouchEventTouching === 0) {\n TouchEventFirstTouch = true;\n TouchEventTouching = TouchEventTouching + 1;\n } else {\n TouchEventFirstTouch = false;\n }\n }\n\n // touchend will decrement TouchEventTouching\n if (event.type === \"touchend\") {\n TouchEventTouching = Math.max(0, TouchEventTouching - 1);\n }\n }\n\n // Single touch, so create a fake mouse event instead\n if (touches.length === 1) {\n // we dont want to move after a pinch effect (it will be super glitchy)\n if (type === \"move\") {\n if (event.type === \"touchmove\") {\n if (!TouchEventFirstTouch) {\n return null;\n }\n }\n }\n\n let first = touches[0];\n let eventType: any = \"\";\n\n switch (event.type) {\n case \"touchstart\":\n eventType = \"mousedown\";\n break;\n case \"touchmove\":\n eventType = \"mousemove\";\n break;\n case \"touchend\":\n eventType = \"mouseup\";\n break;\n default:\n return null;\n }\n\n event = new MouseEvent(eventType, {\n bubbles: true,\n cancelable: true,\n view: window,\n detail: 1,\n screenX: first.screenX,\n screenY: first.screenY,\n clientX: first.clientX,\n clientY: first.clientY,\n ctrlKey: false,\n altKey: false,\n shiftKey: false,\n metaKey: false,\n button: 0\n });\n return event;\n }\n\n // 2 finger touch (zoom in or out)\n if (touches.length === 2) {\n if (event.type === \"touchmove\") {\n let dist = Math.sqrt(\n (touches[0].clientX - touches[1].clientX) * (touches[0].clientX - touches[1].clientX) +\n (touches[0].clientY - touches[1].clientY) * (touches[0].clientY - touches[1].clientY)\n );\n\n if (TouchEventPinchStart === null) {\n TouchEventPinchStart = dist;\n } else {\n TouchEventPinchEnd = dist;\n let pinchMove = TouchEventPinchStart - TouchEventPinchEnd;\n let sign = pinchMove / (Math.abs(pinchMove));\n event = new MouseEvent('wheel', {\n bubbles: true,\n cancelable: true,\n view: window,\n screenX: 0,\n screenY: 0,\n clientX: 0,\n clientY: 0,\n detail: sign,\n ctrlKey: false,\n altKey: false,\n shiftKey: false,\n metaKey: false,\n button: 0\n });\n event.deltaY = sign;\n TouchEventPinchStart = null;\n return event;\n }\n }\n }\n\n return null;\n};\n\nexport const randomHexColor = () => {\n return \"#000000\".replace(/0/g, function() {\n return (~~(Math.random() * 16)).toString(16);\n });\n};\n\nexport const closestPowerOfTwo = value => {\n if (value === 0) {\n return 0;\n }\n\n let power = Math.ceil(Math.log(value) / Math.log(2));\n let result = Math.pow(2, power) - 1;\n return result;\n};\n\nexport const mergeTypedArray = (first, second) => {\n let firstLength = first.length;\n let secondLength = second.length;\n let arrayConstructor = first.constructor;\n let result = new arrayConstructor(firstLength + secondLength);\n result.set(first);\n result.set(second, firstLength);\n return result;\n};\n\nexport const roundDigit = (num, digits) => {\n let multiplyFactor = Math.pow(10, digits);\n return Math.round( num * multiplyFactor + Number.EPSILON ) / multiplyFactor;\n};\n\nexport const executeWithoutLogging = callback => {\n const logger = console.log;\n console.log = function() {};\n let response = callback();\n console.log = logger;\n return response;\n};\n\nexport const windowSafeDateISO = () => {\n const date = new Date();\n return date.toISOString()\n .slice(0, 19)\n .replace('T', ' ')\n .replace(/:/g, \"-\");\n};\n\nexport const chunkedArray = (array, size) => {\n let tmp = [...array];\n let results = [];\n while (tmp.length) {\n results.push(tmp.splice(0, size));\n }\n return results;\n};\n\nexport const coordinatesToArray = (points) => {\n let numPoints = points.length / 2;\n let newPoints = [];\n for (let i=0;i {\n let range = new Array(numPoints);\n for (let i=0;i {\n if (start === end) {\n return new Array(steps).fill(start);\n }\n\n return linspace(start, end, steps);\n};\n","import proj4 from \"proj4\";\nimport {transform} from 'ol/proj';\nimport {Projection, Transform} from '../../redux/projections-slice';\nimport PCA from 'pca-js';\nimport { executeWithoutLogging } from './misc';\nimport {\n Euler,\n MathUtils,\n Matrix4,\n Quaternion,\n Sphere,\n Vector3\n} from 'three';\n\nconst unitsToValue = {\n \"m\": 1.0,\n \"ft\": 0.3048,\n \"us-ft\": 1200.0 / 3937.0\n};\n\nconst lonLatProjection = {\n type: \"proj4\",\n name: \"latlong\",\n string: \"+proj=longlat +ellps=WGS84 +datum=NAD83 +no_defs\"\n} as Projection;\n\nconst verifyProjection = (info) => {\n const data = {\n type: info.type,\n name: info.name,\n string: info.string,\n transform: info.transform\n } as Projection;\n\n if (data.type === \"proj4\") {\n data.string = verifyProj4String(data);\n }\n\n data.transform = verifyTransformObject(data);\n\n return data;\n};\n\n/* Mostly used indirectly inside other coordinate type */\nclass ScenePointConverter {\n protected _sceneShift;\n protected _sceneScale;\n protected _dataProjection: Projection;\n protected _viewProjection: Projection;\n\n get origin() {\n return this._sceneShift;\n }\n\n get initialized() {\n return this._sceneShift !== null;\n }\n\n /** Scale from data projection to meters (local scene coordinates) */\n get dataToMeters() {\n return infoToMeters(this._dataProjection);\n }\n\n get dataProjection() {\n return this._dataProjection;\n }\n\n get viewProjection() {\n return this._viewProjection;\n }\n\n get dataProjectionName() {\n return this._dataProjection.name;\n }\n\n get dataProjectionUnits() {\n return projectionUnits(this._dataProjection);\n }\n\n get viewProjectionUnits() {\n return projectionUnits(this._viewProjection);\n }\n\n get isLonLatProject() {\n return isLonLatProjection(this._dataProjection);\n }\n\n engineStyleProjection(projection: Projection) {\n const proj4String = projection.string;\n const hasTransform = projection.transform ? true : false;\n\n let results;\n if (hasTransform === false) {\n // Standard projection\n results = proj4String;\n } else {\n // Projection with transform (engine style projections are saved differently)\n const data = projection.transform;\n const origin = data.origin;\n const translation = data.translation;\n const rotation = data.rotation;\n const scale = data.scale;\n\n const transform = {\n origin_east: origin[0],\n origin_north: origin[1],\n origin_elevation: origin[2],\n translation_east: translation[0],\n translation_north: translation[1],\n translation_elevation: translation[2],\n rotation: rotation,\n scale_factor_h: scale,\n scale_factor_v: 1.0,\n };\n\n results = [proj4String, transform];\n }\n\n const projectionString = JSON.stringify(results);\n return projectionString;\n }\n\n currentProjection(name) {\n return (this._dataProjection.name === name) ||\n (this._viewProjection.name === name);\n }\n\n setDataProjection(info) {\n this._dataProjection = verifyProjection(info);\n this.resetSceneShift();\n }\n\n setViewProjection(info) {\n this._viewProjection = verifyProjection(info);\n }\n\n resetSceneShift() {\n this._sceneShift = null;\n this._sceneScale = new Vector3(1.0, 1.0, 1.0);\n }\n\n checkForOffset(offset) {\n if (this._sceneShift === null) {\n this._sceneShift = offset.clone();\n\n if (this.isLonLatProject) {\n // Create an approximate latlon --> meters mapping based on the\n // offset point. Be aware that the accuracy is worse the further\n // away from the central point that you go\n\n let dx = haversineDistance(\n new Vector3(offset.x, offset.y, 0),\n new Vector3(offset.x + 1, offset.y, 0)\n );\n\n let dy = haversineDistance(\n new Vector3(offset.x, offset.y, 0),\n new Vector3(offset.x, offset.y + 1, 0)\n );\n\n this._sceneScale = new Vector3(dx, dy, 1.0);\n } else {\n this._sceneScale = new Vector3(1.0, 1.0, 1.0);\n }\n }\n }\n\n offsetToScene(offset) {\n this.checkForOffset(offset);\n let difference = new Vector3()\n .add(offset)\n .sub(this._sceneShift);\n\n return difference;\n }\n\n /** @private Convert from data projection to lonlat */\n _dataToLonLat(value) {\n return new ProjectedCoordinate(value, this._dataProjection).toLonLat();\n }\n\n /** @private Convert from data projection to aerial coordinates */\n _dataToAerial(value) {\n let positionLonLat = this._dataToLonLat(value);\n return transform([positionLonLat.x, positionLonLat.y],\n 'EPSG:4326', 'EPSG:3857');\n }\n\n /** @private Convert from scene coordinates (meters) to data projection */\n _sceneToData(value) {\n let position = new Vector3().copy(value);\n\n if (this.isLonLatProject) {\n position.divide(this._sceneScale);\n }\n\n position.add(this.origin)\n .divideScalar(this.dataToMeters);\n\n return position;\n }\n\n /** @private Convert from data projection to scene coordinates (meters) */\n _dataToScene(value) {\n let position = new Vector3()\n .copy(value)\n .multiplyScalar(this.dataToMeters);\n\n this.checkForOffset(position);\n position.sub(this.origin);\n\n if (this.isLonLatProject) {\n position.multiply(this._sceneScale);\n }\n\n return new SceneCoordinate(position);\n }\n\n /** @private Convert from scene coordinates (meters) to lonlat */\n _sceneToLonLat(value) {\n let dataProjection = this._sceneToData(value);\n return this._dataToLonLat(dataProjection);\n }\n\n /** @private */\n _sceneToGeocentric(value) {\n let dataLonLat = this._sceneToLonLat(value);\n return new GeocentricCoordinate().fromLonLat(dataLonLat);\n }\n\n /** @private */\n _geocentricToScene(value) {\n let pointData = new GeocentricCoordinate(value).toProjection(this._dataProjection);\n return this._dataToScene(pointData);\n }\n}\n\n/** Base Coordinate class is Vector3 with a few extras */\nclass Coordinate extends Vector3 {\n constructor(value = null) {\n let x = 0;\n let y = 0;\n let z = 0;\n\n if (value !== null) {\n if (value.isVector3 || (value instanceof Coordinate)) {\n x = value.x;\n y = value.y;\n z = value.z;\n } else {\n x = value[0];\n y = value[1];\n z = value[2];\n }\n }\n\n super(x,y,z);\n }\n\n clone() {\n return new Vector3().copy(this);\n }\n}\n\n/** Coordinate in scene coordinates */\nexport class SceneCoordinate extends Coordinate {\n constructor(value = null) {\n super(value);\n }\n\n toAerial() {\n return LocalScene._dataToAerial(this);\n }\n\n toLonLat() {\n return LocalScene._sceneToLonLat(this);\n }\n\n toDataProjection() {\n return LocalScene._sceneToData(this);\n }\n}\n\n/** Coordinate in geocentric */\nexport class GeocentricCoordinate extends Coordinate {\n constructor(value = null) {\n super(value);\n }\n\n fromScene(value) {\n return LocalScene._sceneToGeocentric(value);\n }\n\n fromLonLat(value) {\n if (!value.isVector3) {\n value = new Vector3(...value);\n }\n\n let lon = value.x * Math.PI / 180.0;\n let lat = value.y * Math.PI / 180.0;\n let alt = value.z; // must be in meters!\n\n let a = 6378137; // wgs84\n let f = 1 / 298.257223563; // wgs84\n\n let b = a * (1 - f);\n let e = Math.sqrt((Math.pow(a, 2) - Math.pow(b, 2)) / Math.pow(a, 2));\n\n let N = a / Math.sqrt(1 - Math.pow(e, 2) * Math.pow(Math.sin(lat), 2));\n let x = (N + alt) * Math.cos(lat) * Math.cos(lon);\n let y = (N + alt) * Math.cos(lat) * Math.sin(lon);\n let z = (N * (Math.pow(b, 2) / Math.pow(a, 2)) + alt) * Math.sin(lat);\n\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n toGeocentric() {\n return this;\n }\n\n toDataProjection() {\n return this.toProjection(LocalScene.dataProjection);\n }\n\n toViewProjection() {\n return this.toProjection(LocalScene.viewProjection);\n }\n\n toScene() {\n return LocalScene._geocentricToScene(this);\n }\n\n toLonLat() {\n let x = this.x * 1.0;\n let y = this.y * 1.0;\n let z = this.z * 1.0;\n\n let a = 6378137; // wgs84\n let f = 1 / 298.257223563; // wgs84\n\n let b = a * (1 - f);\n let e = Math.sqrt((Math.pow(a, 2) - Math.pow(b, 2)) / Math.pow(a, 2));\n b = Math.sqrt(Math.pow(a, 2) * (1 - Math.pow(e, 2)));\n\n let ep = Math.sqrt((Math.pow(a, 2) - Math.pow(b, 2)) / Math.pow(b, 2));\n let p = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n let th = Math.atan2(a * z, b * p);\n let lon = Math.atan2(y, x);\n let lat = Math.atan2((z + Math.pow(ep, 2) * b * Math.pow(Math.sin(th), 3)),\n (p - Math.pow(e, 2) * a * Math.pow(Math.cos(th), 3)));\n let N = a / (Math.sqrt(1 - Math.pow(e, 2) * Math.pow(Math.sin(lat), 2)));\n let alt = p / Math.cos(lat) - N;\n lon = lon % (2 * Math.PI);\n\n if (Math.abs(x) < 1.0 && Math.abs(y) < 1.0) {\n alt = Math.abs(z) - b;\n }\n\n lon = lon * 180.0 / Math.PI;\n lat = lat * 180.0 / Math.PI;\n\n return new Vector3(lon, lat, alt);\n }\n\n toProjection(projection:Projection) {\n let lonlat = this.toLonLat();\n let vector = _proj4Transform(lonlat, lonLatProjection, projection);\n\n if (projection.transform) {\n var origin = new Vector3(...projection.transform.origin);\n var trans = new Vector3(...projection.transform.translation);\n var scale = projection.transform.scale;\n var scaleVector = new Vector3(scale, scale, 1.0);\n var angle = projection.transform.rotation * Math.PI / 180.0;\n let axis = new Vector3(0, 0, 1);\n\n vector = vector.sub(origin)\n .multiply(scaleVector)\n .applyAxisAngle(axis, angle)\n .add(trans);\n }\n\n return new ProjectedCoordinate(vector, projection);\n }\n\n get closestUtmZone() {\n let lonlat = this.toLonLat();\n return Math.ceil((180 + lonlat.x) / 6);\n }\n}\n\n/** Coordinate in generic projection */\nexport class ProjectedCoordinate extends Coordinate {\n public projection: Projection;\n\n constructor(value, projection) {\n super(value);\n this.projection = projection;\n }\n\n toGeocentric() {\n return new GeocentricCoordinate()\n .fromLonLat(this.toLonLat());\n }\n\n toLonLat() {\n const transform = this.projection.transform;\n\n let vector;\n if (transform) {\n let origin = new Vector3(...transform.origin);\n let trans = new Vector3(...transform.translation);\n let scale = transform.scale;\n let scaleVector = new Vector3(scale, scale, 1.0);\n let angle = transform.rotation * Math.PI / 180.0;\n let axis = new Vector3(0, 0, 1);\n\n vector = new Vector3()\n .add(this)\n .sub(trans)\n .applyAxisAngle(axis, -1 * angle)\n .divide(scaleVector)\n .add(origin);\n } else {\n vector = this;\n }\n\n let lonlat = _proj4Transform(vector, this.projection, lonLatProjection);\n return lonlat;\n }\n\n toScene() {\n let value = this.projection.name !== LocalScene.dataProjection.name\n ? this.toProjection(LocalScene.dataProjection)\n : this;\n\n return LocalScene._dataToScene(value);\n }\n\n toProjection(projection) {\n let vector = _proj4Transform(this, this.projection, projection);\n return new ProjectedCoordinate(vector, projection);\n }\n\n distanceTo(value) {\n if (value instanceof ProjectedCoordinate) {\n let isLonLat1 = isLonLatProjection(this.projection);\n let isLonLat2 = isLonLatProjection(value.projection);\n if (isLonLat1 && isLonLat2) {\n return haversineDistance(this, value);\n }\n\n return this.distanceTo(value);\n }\n\n return this.distanceTo(value);\n }\n}\n\n/** Coordinate in project data projection */\nexport class DataProjectionCoordinate extends ProjectedCoordinate {\n constructor(value = null) {\n super(value, LocalScene.dataProjection);\n }\n}\n\n/** Coordinate in project view projection */\nexport class ViewProjectionCoordinate extends ProjectedCoordinate {\n constructor(value = null) {\n super(value, LocalScene.viewProjection);\n }\n}\n\n/** Spherical position, with theta/phi in degrees */\nexport class SphericalPosition {\n public radius: any;\n private _theta: any;\n private _phi: any;\n private limits: any;\n\n constructor() {\n this.radius = 0;\n this._theta = 0;\n this._phi = 0;\n this.limits = [0.01, 179.9];\n }\n\n get theta() {\n return (this._theta + 360) % 360;\n }\n\n get phi() {\n return (this._phi + 360) % 360;\n }\n\n round(value, precision) {\n let divisor = Math.pow(10, precision);\n return Math.round(value * divisor) / divisor;\n }\n\n fromVectors(pivot, orbit) {\n let offset = new Vector3().add(orbit).sub(pivot);\n let radius = offset.length();\n\n let theta = Math.atan2(offset.y, offset.x);\n theta = MathUtils.radToDeg(theta);\n\n let dist2d = Math.sqrt(Math.pow(offset.x, 2) + Math.pow(offset.y, 2));\n let phi = Math.atan2(dist2d, offset.z);\n phi = MathUtils.radToDeg(phi);\n phi = Math.max(this.limits[0], phi);\n phi = Math.min(this.limits[1], phi);\n\n this._theta = this.round(theta, 3);\n this._phi = this.round(phi, 3);\n this.radius = this.round(radius, 3);\n\n return this;\n }\n\n fromValues(radius, theta, phi) {\n this.radius = radius;\n this._theta = theta;\n this._phi = phi;\n\n return this;\n }\n\n toVector3() {\n let theta = MathUtils.degToRad(this.theta);\n let phi = MathUtils.degToRad(this.phi);\n\n let x = this.radius * Math.cos(theta) * Math.sin(phi);\n let y = this.radius * Math.sin(theta) * Math.sin(phi);\n let z = this.radius * Math.cos(phi);\n\n return new Vector3(x, y, z);\n }\n}\n\n/* Utility functions */\nexport const isValidProjection = (projectionString) => {\n // Check for valid projection string\n try {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let valid = proj4(projectionString);\n return true;\n } catch {\n return false;\n }\n};\n\nexport const getInvertedEuler = (euler) => {\n let inverseQuaternion = new Quaternion()\n .setFromEuler(euler)\n .inverse();\n\n let eulerOriginalInverse = new Euler()\n .setFromQuaternion(inverseQuaternion);\n\n return eulerOriginalInverse;\n};\n\nexport const geometryToArray = (geometry, projection = null) => {\n let polygon = [];\n let coordinates = geometry.flatCoordinates;\n let totalPoints = coordinates.length / 2.0;\n\n for (var i = 0; i < totalPoints; i++) {\n let x = coordinates[2 * i + 0];\n let y = coordinates[2 * i + 1];\n let lonlat = transform([x, y, 0], 'EPSG:3857', 'EPSG:4326');\n let ecef = new GeocentricCoordinate().fromLonLat(lonlat);\n if (projection) {\n let point = ecef.toProjection(projection);\n polygon.push(point.toArray());\n } else {\n polygon.push(ecef.toArray());\n }\n }\n\n return polygon;\n};\n\nexport const calculatePointsPCA = (vertices, returnFlat) => {\n let mean = new Vector3();\n vertices.forEach(vertex => {\n mean.add(vertex);\n });\n mean.divideScalar(vertices.length);\n\n let points = vertices.map(vertex => {\n return new Vector3()\n .add(vertex)\n .sub(mean)\n .toArray();\n });\n\n let eigen = executeWithoutLogging(() => {\n return PCA.getEigenVectors(points);\n });\n\n let matrix = new Matrix4();\n matrix.makeBasis(\n new Vector3().fromArray(eigen[0].vector),\n new Vector3().fromArray(eigen[1].vector),\n new Vector3().fromArray(eigen[2].vector)\n );\n matrix.transpose();\n\n points = points.map(point => {\n return new Vector3()\n .fromArray(point).applyMatrix4(matrix);\n });\n\n if (returnFlat) {\n let pointsFlat = [];\n points.forEach(point => {\n pointsFlat = [...pointsFlat, ...point.toArray()];\n });\n points = pointsFlat;\n }\n\n return points;\n};\n\nexport const projectionUnits = (projection: Projection) => {\n const unitLength = infoToMeters(projection);\n\n let units;\n switch (unitLength) {\n case unitsToValue['m']:\n units = \"m\";\n break;\n case unitsToValue['ft']:\n units = \"ft\";\n break;\n case unitsToValue['us-ft']:\n units = \"sft\";\n break;\n default:\n units = \"m\";\n break;\n }\n\n return units;\n};\n\nexport const infoToMeters = (projection: Projection) => {\n if (!projection) {\n return 1.0;\n }\n\n const proj = proj4.Proj(projection.string);\n\n if (projection.type === \"wkt\") {\n return proj['UNIT'].convert;\n }\n\n if (\"to_meter\" in proj) {\n return proj['to_meter'];\n }\n\n if (\"units\" in proj) {\n const units = proj['units'];\n return unitsToValue[units];\n }\n\n return 1.0;\n};\n\n// NOTE: Will fail if converted to an es6 function\nexport function sphereRaycast(raycaster, intersects) {\n let geometry = this.geometry;\n let matrixWorld = this.matrixWorld;\n\n let testSphere = new Sphere();\n testSphere.copy(geometry.boundingSphere);\n testSphere.applyMatrix4(matrixWorld);\n\n if (raycaster.ray.intersectsSphere(testSphere) === false) {\n return;\n }\n\n let origin = raycaster.ray.origin;\n let distance = origin.distanceTo(this.position);\n\n intersects.push({\n distance: distance,\n point: null,\n object: this\n });\n}\n\nexport function isLonLatProjection(projection) {\n const proj = proj4.Proj(projection.string);\n return proj['projName'] === \"longlat\";\n}\n\nfunction haversineDistance(position1, position2) {\n let earthRadius = 6371000;\n\n let diffLat = (position2.y - position1.y) * Math.PI / 180;\n let diffLng = (position2.x - position1.x) * Math.PI / 180;\n\n let arc = Math.cos(position1.y * Math.PI / 180)\n * Math.cos(position2.y * Math.PI / 180)\n * Math.sin(diffLng / 2) * Math.sin(diffLng / 2)\n + Math.sin(diffLat / 2) * Math.sin(diffLat / 2);\n let line = 2 * Math.atan2(Math.sqrt(arc), Math.sqrt(1 - arc));\n\n let distance2d = earthRadius * line;\n let height = position2.z - position1.z;\n\n let distance = Math.pow(distance2d, 2) + Math.pow(height, 2);\n distance = Math.sqrt(distance);\n\n return distance;\n}\n\nfunction verifyTransformObject(data) {\n let transform = data.transform;\n if (!transform) {\n return null;\n }\n\n if (transform.hasOwnProperty('translation_north')) {\n return {\n origin: [\n transform.origin_east,\n transform.origin_north,\n transform.origin_elevation ? transform.origin_elevation : 0\n ],\n translation: [\n transform.translation_east,\n transform.translation_north,\n transform.translation_elevation\n ],\n scale: transform.scale_factor_h,\n rotation: transform.rotation\n } as Transform;\n }\n\n return Object.assign({}, transform);\n}\n\nfunction verifyProj4String(projection) {\n let string = projection.string;\n\n // longlat projection is returned directly\n if (isLonLatProjection(projection)) {\n return string;\n }\n\n // Return EPSG codes directly\n if (string.toUpperCase().indexOf(\"EPSG\") === 0) {\n return string;\n }\n\n // Add missing fields\n if (string.indexOf(\"y_0\") === -1) {\n string = string + \" +y_0=0\";\n }\n\n if (string.indexOf(\"x_0\") === -1) {\n string = string + \" +x_0=0\";\n }\n\n if (string.indexOf(\"lon_0\") === -1) {\n string = string + \" +lon_0=0\";\n }\n\n if (string.indexOf(\"lat_0\") === -1) {\n string = string + \" +lat_0=0\";\n }\n\n string = string.split(\" +\").join(\" \");\n string = string.split(\" \").join(\" +\");\n if (string[0] !== \"+\") {\n string = \"+\" + string;\n }\n\n return string;\n}\n\n/** @private */\nfunction _proj4Transform(data, proj1, proj2) {\n if (data.isVector3) {\n data = data.toArray();\n }\n\n if (proj1 === proj2) {\n return new Vector3(...data);\n }\n\n let projToMeters1 = infoToMeters(proj1);\n let projToMeters2 = infoToMeters(proj2);\n let proj2m = projToMeters2 / projToMeters1;\n\n let transform = proj4(proj1.string, proj2.string);\n let reprojected = transform.forward(data);\n reprojected = new Vector3(...reprojected);\n\n // Height scaling is not applied by library\n reprojected.z /= proj2m;\n\n return reprojected;\n}\n\n\nconst LocalScene = new ScenePointConverter();\nexport default LocalScene;\n","import {addAsset, addAssets, CameraData, OrthoData} from \"./redux/assets-slice\";\nimport {addFolder} from './redux/folders-slice';\nimport {app, dialog, fsPromises, glob} from \"./electron-modules\";\nimport path from 'path';\nimport slash from 'slash';\nimport {hideBackdrop, showBackdrop} from \"./app\";\nimport {PythonExecutable} from \"./executable\";\nimport LocalScene from \"./viewer/js/projections\";\n\nexport const lasFileFormat = \"las\";\nexport const encompassFileFormat = \"idx\";\nexport const imageListFormats = ['csv', 'txt'];\nexport const planarListFormats = ['plnr'];\nexport const orthoFormats = ['tif', 'tiff'];\n\nconst pointCloudFileFormats = [lasFileFormat, encompassFileFormat];\n\nexport const pointCloudFilter = [{name: 'Point Clouds', extensions: pointCloudFileFormats}];\nexport const imageOrthoFilter = [{name: 'Orthomosaic File', extensions: orthoFormats}];\nexport const imageCSVFilter = [{name: 'Image CSV', extensions: imageListFormats}];\nexport const imagePlanarFilter = [{name: 'Planar Image File', extensions: planarListFormats}];\n\ninterface ImageDetectResults {\n readonly pathFound: boolean;\n readonly imagePath: string;\n readonly imageExt: string;\n readonly hasImageExt: boolean;\n}\n\nexport const isAssetFile = (filename) => {\n return isPanoramicFile(filename)\n || isPlanarFile(filename)\n || isPointCloudFile(filename)\n || isOrthomosaicFile(filename);\n};\n\nexport const isPanoramicFile = (filename) => {\n const extension = path.extname(filename).slice(1);\n return imageListFormats.indexOf(extension) !== -1;\n};\n\nexport const isPlanarFile = (filename) => {\n const extension = path.extname(filename).slice(1);\n return planarListFormats.indexOf(extension) !== -1;\n};\n\nexport const isPointCloudFile = (filename) => {\n const extension = path.extname(filename).slice(1);\n return pointCloudFileFormats.indexOf(extension) !== -1;\n};\n\nexport const isOrthomosaicFile = (filename) => {\n const extension = path.extname(filename).slice(1);\n return orthoFormats.indexOf(extension) !== -1;\n};\n\nexport const addAssetFolder = async (showMessage, dispatch, paths, folderID = null) => {\n const cloudPaths = paths.filter(file => isPointCloudFile(file));\n const panoramicPaths = paths.filter(file => isPanoramicFile(file));\n const orthoPaths = paths.filter(file => isOrthomosaicFile(file));\n const planarPaths = paths.filter(file => isPlanarFile(file));\n\n const numClouds = cloudPaths.length;\n const numImageFiles = panoramicPaths.length\n + orthoPaths.length\n + planarPaths.length;\n\n // Nothing to add, exit early\n if (numClouds === 0 && numImageFiles === 0) {\n return;\n }\n\n if (!folderID) {\n // No folder has been provided, so a new folder is created instead\n const action = dispatch(addFolder(\"New Folder\"));\n folderID = action.payload.id;\n }\n\n // Add all panoramic data\n const planarFilesAdded = await addPlanarFiles(showMessage,\n dispatch, planarPaths, folderID);\n\n // Add all planar data\n const panoramicFilesAdded = await addCameraFiles(showMessage,\n dispatch, panoramicPaths, folderID);\n\n // Add all pointclouds\n const pointsAdded = addPointCloudFiles(dispatch, cloudPaths, folderID);\n\n // Add orthomosaic data\n const orthosAdded = await addOrthoFiles(showMessage, dispatch,\n orthoPaths, folderID);\n\n const totalAdded = pointsAdded\n + panoramicFilesAdded\n + planarFilesAdded\n + orthosAdded;\n\n if (totalAdded === 0) {\n return;\n }\n\n let addedPlural = totalAdded === 1 ? \"\" : \"s\";\n showMessage(`Added [${totalAdded}] file${addedPlural} to project`, {\n variant: \"success\"\n });\n};\n\nexport const addPointCloudFiles = (dispatch, assetPaths, folderID) => {\n let assetList = assetPaths.map(pointPath => {\n return {folderID, assetPath: pointPath};\n });\n\n dispatch(addAssets(assetList));\n return assetPaths.length;\n};\n\nexport const addOrthoFiles = async (showMessage, dispatch, assetPaths, folderID) => {\n showBackdrop();\n\n let numAdded = await addOrthoBatch(showMessage, dispatch, assetPaths, folderID);\n\n hideBackdrop();\n\n return numAdded;\n};\n\nexport const addCameraFiles = async (showMessage, dispatch, assetPaths, folderID) => {\n showBackdrop();\n\n let numAdded = 0;\n\n for (const assetPath of assetPaths) {\n const added = await addCameraFile(dispatch, assetPath, folderID);\n\n if (added) {\n numAdded += 1;\n } else {\n showMessage(`Unable to parse ${path.basename(assetPath)}. Please ensure that the CSV matches one of the supported formats listed in the user guide, or that it contains the following columns: Filename, X, Y, Z, Roll, Pitch, Yaw.`, {\n variant: \"error\",\n autoHideDuration: 10000,\n });\n }\n }\n\n hideBackdrop();\n\n return numAdded;\n};\n\nexport const addPlanarFiles = async (showMessage, dispatch, assetPaths, folderID) => {\n showBackdrop();\n\n let numAdded = 0;\n for (const assetPath of assetPaths) {\n const added = await addPlanarFile(dispatch, assetPath, folderID);\n if (added) {\n numAdded += 1;\n } else {\n showMessage(`Error loading planar camera file: ${path.basename(assetPath)}`, {\n variant: \"error\"\n });\n }\n }\n\n hideBackdrop();\n\n return numAdded;\n};\n\nexport const addOrthoBatch = async (showMessage, dispatch, assetPaths, folderID): Promise => {\n if (assetPaths.length === 0) {\n return 0;\n }\n\n return new Promise(async resolve => {\n const exe = new PythonExecutable();\n\n let response;\n let commands = [\n \"-p\", \"convert_geotiff\",\n \"--image_paths\", assetPaths,\n ];\n\n let numAdded = 0;\n\n exe.run({\n command: commands,\n onLine: jsonData => {\n if (jsonData) {\n response = jsonData;\n }\n },\n onClose: () => {\n if (!response) {\n response = [];\n }\n\n let assetsList = [];\n response.forEach(geotiff => {\n const assetPath = slash(geotiff.file_path);\n\n if (geotiff.error) {\n showMessage(`${geotiff.error}: ${path.basename(assetPath)}`, {\n variant: \"error\"\n });\n return;\n }\n\n const {corners, base64, width, height,\n scale_x, scale_y, width_original, height_original} = geotiff;\n\n const data = {\n imageBounds: corners,\n imageData: base64,\n imageSize: [width, height],\n imageSizeOriginal: [width_original, height_original],\n imagePath: assetPath,\n scaleX: scale_x,\n scaleY: scale_y,\n } as OrthoData;\n\n assetsList.push({folderID, assetPath, data});\n numAdded += 1;\n });\n\n dispatch(addAssets(assetsList));\n resolve(numAdded);\n }\n });\n });\n};\n\nconst addPlanarFile = (dispatch, assetPath, folderID): Promise => {\n return new Promise(async resolve => {\n const text = await fsPromises.readFile(assetPath, {encoding: 'utf8'});\n\n let config;\n let cameras;\n\n try {\n let decoded = JSON.parse(text);\n config = decoded.config;\n cameras = decoded.data;\n } catch {\n resolve(false);\n return;\n }\n\n const numCameras = cameras.length;\n if (numCameras === 0) {\n resolve(false);\n return;\n }\n\n let firstCameraName = cameras[0][0];\n let {pathFound, imagePath, imageExt, hasImageExt}\n = await detectImagePath(assetPath, firstCameraName);\n\n if (!pathFound) {\n resolve([]);\n return;\n }\n\n let cameraData: CameraData[] = [];\n\n for (let i=0;i => {\n return new Promise(resolve => {\n const userPath = app.getPath('userData');\n const exe = new PythonExecutable();\n\n let cameraData;\n const inputPath = assetPath;\n const outputPath = path.join(userPath, \"inputCsvTemp.csv\");\n const projection = LocalScene.engineStyleProjection(LocalScene.dataProjection);\n\n let commands = [\n \"-p\", \"convert_encompass_csv\",\n \"--input_file\", inputPath,\n \"--output_file\", outputPath,\n \"--projection\", projection\n ];\n\n exe.run({\n command: commands,\n onLine: jsonData => {\n cameraData = jsonData;\n },\n onClose: async () => {\n if (!cameraData) {\n resolve(false);\n return;\n }\n\n const numCameras = cameraData.length;\n if (numCameras === 0) {\n resolve(false);\n return;\n }\n\n let firstImageName = cameraData[0].name;\n let {pathFound, imagePath, imageExt, hasImageExt}\n = await detectImagePath(assetPath, firstImageName);\n\n if (!pathFound) {\n resolve(false);\n return;\n }\n\n // Update final camera data path / filenames\n for (let i=0;i => {\n return dialog.showOpenDialog( {\n filters: filter,\n properties: ['openFile', 'multiSelections']\n }).then(result => {\n if (result.canceled) {\n return [];\n }\n\n const filePaths = result.filePaths.map(path => slash(path));\n return filePaths;\n }).catch(() => {\n dialog.showErrorBox('Error', 'An error occurred while loading the specified file.');\n return [];\n });\n};\n\nexport const openDialogFile = (filter): Promise => {\n return dialog.showOpenDialog( {\n filters: filter,\n properties: ['openFile']\n }).then(result => {\n if (result.canceled) {\n return null;\n }\n\n const filePath = slash(result.filePaths[0]);\n return filePath;\n }).catch(() => {\n dialog.showErrorBox('Error', 'An error occurred while loading the specified file.');\n return null;\n });\n};\n\nexport const openDialogFolder = () => {\n return dialog.showOpenDialog({\n properties: ['openDirectory']\n }).then(result => {\n if (result.canceled) {\n return {\n directoryPath: '',\n assetPaths: Promise.resolve([])\n };\n }\n\n const filePath = slash(result.filePaths[0]);\n\n return {\n directoryPath: filePath,\n assetPaths: parseDirectory(filePath)\n };\n }).catch(() => {\n dialog.showErrorBox('Error', 'An error occurred while loading the specified file.');\n return null;\n });\n};\n\nexport const exportDialogCSV = (filename): Promise => {\n return dialog.showSaveDialog( {\n defaultPath: `${filename}.csv`,\n filters: imageCSVFilter\n }).then(result => {\n if (result.canceled) {\n return;\n }\n\n const savePath = slash(result.filePath);\n return savePath;\n }).catch(() => {\n dialog.showErrorBox('Error', 'An error occurred while exporting the specified file.');\n return null;\n });\n};\n\nexport const openDirectory = (): Promise => {\n return dialog.showOpenDialog({\n properties: [\"openDirectory\"]\n }).then(result => {\n if (result.canceled) {\n return null;\n }\n if (result.filePaths) {\n const outputFolder = slash(result.filePaths[0]);\n return outputFolder;\n }\n\n return null;\n });\n};\n\nconst parseDirectory = async (directoryPath: string): Promise => {\n const entries = await fsPromises.readdir(directoryPath, {withFileTypes: true});\n\n const files = entries\n .filter(entry => entry.isFile())\n .map(file => path.join(directoryPath, file.name));\n\n const directories = entries\n .filter(entry => entry.isDirectory())\n .map(directory => path.join(directoryPath, directory.name));\n\n for (let folder of directories) {\n files.push(...await parseDirectory(folder));\n }\n\n return files;\n};\n\nconst checkImagePath = (directory, filename, suffix, depth = 3) => {\n const results = {\n success: false,\n duplicate: false,\n imagePath: null,\n imageExt: null\n };\n\n let dirSeperator = \"\";\n for (var i = 0; i < depth; i++) {\n if (i > 0) {\n dirSeperator += \"/*\";\n }\n\n const globPath = `${dirSeperator}/${filename}${suffix}`;\n const paths = glob.sync(globPath, {\n cwd: directory,\n root: directory\n });\n\n if (paths.length === 1) {\n results.success = true;\n results.imagePath = path.dirname(paths[0]);\n results.imageExt = path.extname(paths[0]);\n return results;\n } else if (paths.length >= 2) {\n results.duplicate = true;\n }\n }\n\n return results;\n};\n\nexport const buildFilePath = (imagePath, filename, imageExt, hasImageExt) => {\n let filePath = hasImageExt ?\n path.join(imagePath, filename) :\n path.join(imagePath, `${filename}${imageExt}`);\n\n // Fix for windows UNC paths\n const isNetworkPath = imagePath.indexOf(\"//\") === 0;\n if (isNetworkPath) {\n filePath = `/${filePath}`;\n }\n\n return filePath;\n};\n\nexport const detectImagePath = async (assetPath: string, testImagePath: string): Promise => {\n const directory = path.dirname(assetPath);\n const testImageExt = path.extname(testImagePath).toLowerCase();\n const hasImageExt = [\".jpg\", \".png\", \".jpeg\"].includes(testImageExt);\n const suffix = hasImageExt ? \"\" : \".{png,jpg,jpeg}\";\n\n let response = {\n pathFound: false,\n imagePath: null,\n imageExt: null,\n hasImageExt\n };\n\n // Search for image directory using csv path\n let {success, duplicate, imagePath, imageExt}\n = checkImagePath(directory, testImagePath, suffix);\n\n // Update response values\n response.pathFound = success;\n response.imagePath = imagePath;\n response.imageExt = imageExt;\n\n console.log(\"Detected image path: \", imagePath);\n\n if (!response.pathFound) {\n if (duplicate) {\n dialog.showErrorBox(assetPath, \"Multiple image paths found. Image directory must be selected manually\");\n } else {\n dialog.showErrorBox(assetPath, \"Image path not found. Image directory must be selected manually\");\n }\n\n const results = dialog.showOpenDialogSync({\n title: \"Select Image Path\",\n properties: ['openDirectory']\n });\n\n if (results) {\n // Search for image directory using selected folder\n imagePath = slash(results[0]);\n let manual = checkImagePath(imagePath, testImagePath, suffix, 1);\n\n // Update response values\n response.pathFound = manual.success;\n response.imagePath = imagePath;\n response.imageExt = manual.imageExt;\n }\n }\n\n return response;\n};\n","import {createStyles, ListItemIcon, makeStyles, Theme} from \"@material-ui/core\";\nimport React from \"react\";\nimport clsx from 'clsx';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n icon: {\n minWidth: theme.spacing(0),\n paddingRight: \"10px\"\n },\n centered: {\n alignItems: \"center\"\n }\n })\n);\n\nexport const DenseIcon = (props) => {\n const classes = useStyles();\n const {children, centered, ...other} = props;\n\n return (\n \n {children}\n \n );\n};","import {createStyles, makeStyles, Theme, Tooltip} from \"@material-ui/core\";\nimport React from \"react\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n hidden: {\n opacity: 0\n }\n }),\n);\n\nexport const ArrowTooltip = (props) => {\n return (\n \n {props.children}\n \n );\n};\n\nexport const CursorTooltip = (props) => {\n const classes = useStyles();\n\n const {text} = props;\n const [position, setPosition] = React.useState({\n x: undefined,\n y: undefined\n });\n\n const createMarkup = () => {\n return text ?\n (
) :\n \"\";\n };\n\n const hidden = text === \"\";\n\n return (\n
\n );\n};\n\nexport const TabProps = (index) => {\n return {\n id: `tab-${index}`,\n 'aria-controls': `tabpanel-${index}`,\n };\n};\n\nexport const PanelProps = (value, index) => {\n return {\n value: value,\n index: index\n };\n};\n","import { Plane, Vector3 } from \"three\";\n\nconst simplepolygon = require('simplepolygon');\n\nexport const pointInPolygon = (point, vertices) => {\n let numberOfVertices = vertices.length;\n let insidePolygon = false;\n\n let j = numberOfVertices - 1;\n for (var i = 0; i < numberOfVertices; i++) {\n let verti = vertices[i];\n let vertj = vertices[j];\n\n let dx = vertj.x - verti.x;\n let dy1 = point.y - verti.y;\n let dy2 = vertj.y - verti.y;\n\n let cond1 = (verti.y > point.y) !== (vertj.y > point.y);\n let cond2 = point.x < (dx * dy1 / dy2 + verti.x);\n\n // currently checks [boundMin, boundMax)\n\n if (cond1 && cond2) {\n insidePolygon = !insidePolygon;\n }\n j = i;\n }\n return insidePolygon;\n};\n\nexport const planeFromVectors = (directions) => {\n let normal = new Vector3();\n directions.forEach(vertex => {\n normal.add(vertex);\n });\n\n normal.divideScalar(directions.length);\n normal.setLength(1.0);\n\n return new Plane(normal);\n};\n\nexport const checkValidPolygon = (coordinates) => {\n try {\n // Unshifted points give false positives sometimes\n let origin = coordinates[0];\n let shifted = coordinates.map(x => {\n return [x[0]-origin[0], x[1]-origin[1]];\n });\n\n let poly = {\n type: \"Feature\",\n geometry: {\n type: \"Polygon\",\n coordinates: [shifted]\n }\n };\n\n let result = simplepolygon(poly);\n return result.features.length === 1;\n } catch {\n return false;\n }\n};\n","import {\n calculatePointsPCA,\n GeocentricCoordinate,\n geometryToArray,\n} from '../projections';\nimport MeasurementController from './measurement-controller';\nimport {getArea, getLength} from 'ol/sphere';\nimport {LineString, Polygon} from 'ol/geom';\nimport Delaunator from 'delaunator';\nimport earcut from 'earcut';\nimport {isMobile, randomHexColor} from '../misc';\nimport {nanoid} from '@reduxjs/toolkit';\nimport { pointInPolygon } from '../utilities/polygon';\nimport {\n Vector3,\n BufferGeometry,\n BufferAttribute,\n PointsMaterial,\n Points,\n Geometry,\n MeshBasicMaterial,\n Face3,\n Mesh,\n EdgesGeometry,\n LineBasicMaterial,\n LineSegments,\n Triangle,\n DoubleSide,\n MathUtils\n} from 'three';\n\nexport class Measurement {\n public controller: MeasurementController;\n public id = nanoid();\n public dbType = null;\n public databaseID = null;\n public displayType = 'Measurement';\n public title = 'Measurement';\n public timeCreated = new Date();\n public startClick = isMobile() ? \"Tap\" : \"Click\";\n public cancelClick = isMobile() ? \"Long-press\" : \"Right-click\";\n public finishClick = isMobile() ? \"Double-tap\" : \"Double-click\";\n public tooltipStatic = {\n start: null,\n end: null,\n more: null\n };\n\n setController(controller) {\n this.controller = controller;\n }\n\n get timestamp() {\n return Math.floor(this.timeCreated.getTime() / 1000);\n }\n\n set timestamp(isoTime) {\n this.timeCreated = new Date(isoTime);\n }\n\n get startTooltip() {\n return this.tooltipStatic.start;\n }\n\n get moreTooltip() {\n return this.tooltipStatic.more;\n }\n\n get endTooltip() {\n return this.tooltipStatic.end;\n }\n\n get viewer() {\n return this.controller.viewer;\n }\n\n get valid() {\n return true;\n }\n\n get formatter() {\n return this.controller.formatter;\n }\n\n clear() {}\n}\n\nexport class Measurement3D extends Measurement {\n public vertices:Array = [];\n public maxVertexLength = 2;\n public minVertexRequired = 2;\n\n constructor() {\n super();\n\n this.displayType = '3D Measurement';\n this.title = '3D Measurement';\n this.dbType = \"length\";\n\n this.tooltipStatic.start =`${this.startClick} to start line`;\n }\n\n get numVertices() {\n return this.coordinates.length;\n }\n\n /** Return 3d distance in meters, based on scene view coordinates */\n get distance3D() {\n return this.getLineDistance(false);\n }\n\n /** Return 2d distance in meters, based on scene view coordinates */\n get distance2D() {\n return this.getLineDistance(true);\n }\n\n /** Get measurement height difference in meters, based on scene view coordinates */\n get rise() {\n // Currently uses the first + last point\n let lastIndex = this.vertices.length - 1;\n let firstPoint = this.vertices[0].toScene();\n let lastPoint = this.vertices[lastIndex].toScene();\n let height = Math.abs(lastPoint.z - firstPoint.z);\n\n return height;\n }\n\n get angle() {\n let numberOfPoints = this.vertices.length;\n if (numberOfPoints !== 2) {\n return NaN;\n }\n\n let angle = Math.atan(this.rise / this.distance2D);\n return MathUtils.radToDeg(angle);\n }\n\n get grade() {\n let numberOfPoints = this.vertices.length;\n if (numberOfPoints !== 2) {\n return NaN;\n }\n\n return 100 * (this.rise / this.distance2D);\n }\n\n get coordinates() {\n return this.vertices.map(vertex => {\n return vertex.toArray();\n });\n }\n\n get sceneVertices() {\n return this.vertices.map(vertex => {\n return vertex.toScene().toArray();\n });\n }\n\n add(vertex, parent=null) {\n let finished = false;\n let addedPoint = false;\n vertex = new GeocentricCoordinate().fromScene(vertex);\n\n if (this.vertices.length === 0) {\n this.vertices.push(vertex);\n addedPoint = true;\n } else {\n // We only add a new point if the distance travelled is large enough\n let oldVertex = this.vertices[this.vertices.length - 1];\n if (oldVertex.distanceTo(vertex) > 0.10) {\n // New point is far enough away from previous point\n this.vertices.push(vertex);\n addedPoint = true;\n } else {\n // Clicked the same point twice, so we finish the measurement\n // if we have gathered enough points\n if (this.vertices.length >= this.minVertexRequired) {\n finished = true;\n }\n }\n }\n\n // For types with a fixed number of points, set finished to\n // true if we have reached the max number of points\n if (!finished) {\n finished = this.vertices.length === this.maxVertexLength;\n }\n\n return {\n finished: finished,\n added: addedPoint,\n valid: true\n };\n }\n\n getProjectedVertices(projection) {\n let vertices = this.vertices.map(vertex => {\n return vertex.toProjection(projection).toArray();\n });\n\n if (this instanceof MeasurementArea) {\n vertices.push(vertices[0]);\n }\n\n return vertices;\n }\n\n /** Private */\n getLineDistance(ignoreHeight) {\n let vertexA;\n let vertexB;\n\n let distance = 0;\n let vertices = this.vertices;\n\n for (var i = 1; i < vertices.length; i++) {\n let prevIndex = i - 1;\n vertexA = vertices[prevIndex].toScene();\n vertexB = vertices[i].toScene();\n\n if (ignoreHeight) {\n vertexA.z = 0;\n vertexB.z = 0;\n }\n\n distance += vertexA.distanceTo(vertexB);\n }\n\n return distance;\n }\n}\n\nexport class MeasurementLine extends Measurement3D {\n constructor() {\n super();\n\n this.maxVertexLength = 16;\n }\n\n get moreTooltip() {\n return `\n ${this.startClick} to add more points (${this.vertices.length})\n
${this.finishClick} to finish\n
${this.cancelClick} to cancel\n `;\n }\n\n get endTooltip() {\n return this.moreTooltip;\n }\n}\n\nexport class MeasurementPoint extends Measurement3D {\n constructor() {\n super();\n\n this.displayType = '3D Point';\n this.title = '3D Point';\n this.dbType = 'point';\n this.maxVertexLength = 1;\n this.minVertexRequired = 1;\n\n this.tooltipStatic.start = 'Click for single point';\n }\n}\n\nexport class MeasurementArea extends Measurement3D {\n public surfaceGenerator;\n public areaInvalidMessage;\n\n constructor() {\n super();\n\n this.displayType = '3D Area';\n this.title = '3D Area';\n this.dbType = 'area';\n this.maxVertexLength = 16;\n this.minVertexRequired = 3;\n this.areaInvalidMessage = \"Invalid Area\";\n\n this.tooltipStatic.start = `${this.startClick} to start area`;\n }\n\n get moreTooltip() {\n return `\n ${this.startClick} to add more points (${this.vertices.length})\n
${this.cancelClick} to cancel\n `;\n }\n\n get endTooltip() {\n return `\n ${this.startClick} to add more points (${this.vertices.length})\n
${this.finishClick} to finish\n
${this.cancelClick} to cancel\n `;\n }\n\n get localVertices3D() {\n return this.vertices.map(vertex => {\n let vertexLocal = vertex.toScene();\n return vertexLocal;\n });\n }\n\n get indices() {\n return this.surfaceGenerator.indices;\n }\n\n get area3D() {\n return this.surfaceGenerator.area;\n }\n\n get valid() {\n return this.surfaceGenerator.valid;\n }\n\n setController(controller) {\n this.controller = controller;\n this.surfaceGenerator = new SurfaceGenerator(this);\n }\n\n generateSurface() {\n this.surfaceGenerator.clear();\n this.surfaceGenerator.generate();\n }\n\n clear() {\n this.surfaceGenerator.clear();\n }\n}\n\nexport class MeasurementVolume extends MeasurementArea {\n public volumeHelper;\n public invalidVolumeMessage;\n\n constructor() {\n super();\n\n this.displayType = '3D Volume';\n this.title = '3D Volume';\n this.dbType = 'volume';\n this.invalidVolumeMessage = \"Invalid Volume\";\n\n this.tooltipStatic.start = `${this.startClick} to start volume`;\n }\n\n get calculated() {\n return this.volumeHelper.calculated;\n }\n\n get calculating() {\n return this.volumeHelper.calculatingVolume;\n }\n\n get volumeValue() {\n return this.volumeHelper.value;\n }\n\n calculate() {\n this.volumeHelper.calculate();\n }\n\n recalculate() {\n this.volumeHelper.clear();\n this.volumeHelper.calculate();\n }\n\n /** Cancel webworker and pass empty array as results */\n stopVolumeCalculation() {\n this.volumeHelper.stopCalculation();\n }\n\n setController(controller) {\n this.controller = controller;\n\n let pointCloud = controller.pointclouds;\n this.volumeHelper = new VolumeHelper(this);\n this.volumeHelper.init(pointCloud);\n this.surfaceGenerator = new SurfaceGenerator(this);\n }\n\n loadExistingVolume(value) {\n this.volumeHelper.setVolume(value);\n }\n\n clear() {\n this.volumeHelper.destroyWorker();\n this.volumeHelper.clear();\n this.surfaceGenerator.clear();\n }\n}\n\nexport class SnapMeasurement extends Measurement3D {\n constructor() {\n super();\n }\n\n add(vertex, parent) {\n let valid = false;\n let added = false;\n let pointCloud = parent.pointCloud;\n let snapResult = this.snap(vertex, pointCloud);\n this.vertices.push(new GeocentricCoordinate().fromScene(vertex));\n\n if (snapResult) {\n valid = true;\n added = true;\n this.vertices.push(new GeocentricCoordinate().fromScene(snapResult));\n }\n\n return {\n finished: true,\n added: added,\n valid: valid\n };\n }\n\n snap(vertex, pointCloud) {\n let verticalTolerance = 0.30;\n let finalHeight;\n let validHeights;\n\n let pos = new Vector3().copy(vertex);\n let points = pointCloud.pointsInRadius(pos, 0.15);\n let heights = points.map(point => point.z);\n\n if (this instanceof SnapDownMeasurement) {\n validHeights = heights.filter(height => vertex.z - height > verticalTolerance);\n } else {\n validHeights = heights.filter(height => height - vertex.z > verticalTolerance);\n }\n\n if (validHeights.length === 0) {\n return undefined;\n }\n\n if (this instanceof SnapDownMeasurement) {\n finalHeight = validHeights.reduce((acc, curr) => Math.max(acc, curr));\n } else {\n finalHeight = validHeights.reduce((acc, curr) => Math.min(acc, curr));\n }\n\n return new Vector3(vertex.x, vertex.y, finalHeight);\n }\n}\n\nexport class SnapUpMeasurement extends SnapMeasurement {\n constructor() {\n super();\n\n this.tooltipStatic.start = `${this.startClick} to snap up`;\n }\n}\n\nexport class SnapDownMeasurement extends SnapMeasurement {\n constructor() {\n super();\n\n this.tooltipStatic.start = `${this.startClick} to snap down`;\n }\n}\n\nexport class AerialMeasurement extends Measurement {\n public geometry;\n\n constructor(geometry = null) {\n super();\n\n this.geometry = geometry;\n this.title = null;\n this.displayType = '2D Measurement';\n }\n\n get coordinates() {\n return this.geometry.getCoordinates();\n }\n\n get numVertices() {\n return this.coordinates[0].length;\n }\n\n getGeometry() {\n return this.geometry;\n }\n\n getProjectedVertices(projection) {\n return geometryToArray(this.geometry, projection);\n }\n\n getValue() {}\n\n loadFromCoordinates(coordinates) {}\n}\n\nexport class AerialLengthMeasurement extends AerialMeasurement {\n constructor(geometry = null) {\n super(geometry);\n this.title = '2D Length';\n this.displayType = 'Length';\n this.dbType = \"length\";\n }\n\n getValue() {\n return getLength(this.geometry);\n }\n\n loadFromCoordinates(coordinates) {\n this.geometry = new LineString(coordinates);\n }\n}\n\nexport class AerialAreaMeasurement extends AerialMeasurement {\n constructor(geometry = null) {\n super(geometry);\n this.title = '2D Area';\n this.displayType = 'Area';\n this.dbType = \"area\";\n }\n\n getValue() {\n return getArea(this.geometry);\n }\n\n loadFromCoordinates(coordinates) {\n this.geometry = new Polygon(coordinates);\n }\n}\n\nclass VolumeHelper {\n private calculatingVolume = false;\n private calculated = false;\n private measurement: MeasurementVolume;\n private spacing = 0.5;\n private sigma = 1.0;\n private minNeighbours = 20;\n private maxNeighbours = 100;\n private neighbourPercent = 0.05;\n private maxHeightDelta = 999.0;\n private worker;\n private vertices;\n private bounds;\n private groundHeight;\n private pointCloud;\n private pointcloudmesh;\n private pointswireframe;\n private value;\n\n constructor(measurement) {\n this.measurement = measurement;\n this.clear();\n }\n\n get scene() {\n let measurement = this.measurement;\n return measurement.controller.scene;\n //return measurement.viewer.pointclouds.scene;\n }\n\n calculate(updateValue = true) {\n if (this.calculatingVolume) {\n return;\n }\n\n this.vertices = this.measurement.localVertices3D;\n this.bounds = this.getCalculatedBounds();\n\n // Calculate average ground height\n const heights = this.vertices.map(vertex => vertex.z);\n const sum = heights.reduce((a, b) => a + b, 0);\n this.groundHeight = (sum / heights.length) || 0;\n\n this.calculateVolume(updateValue);\n }\n\n init(pointCloud) {\n this.pointCloud = pointCloud;\n this.clear();\n }\n\n getCalculatedBounds() {\n let arr = this.vertices;\n\n let x = arr.map(vertex => vertex.x);\n let xMin = Math.min(...x);\n let xMax = Math.max(...x);\n\n let y = arr.map(vertex => vertex.y);\n let yMin = Math.min(...y);\n let yMax = Math.max(...y);\n\n let z = arr.map(vertex => vertex.z);\n let zMin = Math.min(...z);\n let zMax = Math.max(...z);\n\n let center = new Vector3(\n xMin + (xMax - xMin) / 2.0,\n yMin + (yMax - yMin) / 2.0,\n zMin + (zMax - zMin) / 2.0\n );\n\n let size = Math.max(xMax - xMin, yMax - yMin);\n\n return {\n center: center,\n size: size\n };\n }\n\n filterByHeight(points) {\n return points.filter(point => {\n let height = Math.abs(point.z - this.groundHeight);\n return height < this.maxHeightDelta;\n });\n }\n\n removeOutliersAsync(points, callback) {\n const workerURL = \"workers/sparse-outliers.js\";\n let worker = new Worker(`${process.env.PUBLIC_URL}/${workerURL}`);\n\n worker.onmessage = event => {\n callback(event.data);\n };\n\n // Remove any sparse outliers\n worker.postMessage({\n points: points,\n sigma: this.sigma,\n minNeighbours: this.minNeighbours,\n maxNeighbours: this.maxNeighbours,\n neighbourPercent: this.neighbourPercent\n });\n\n this.worker = worker;\n }\n\n destroyWorker() {\n if (this.worker) {\n this.worker.terminate();\n this.worker = undefined;\n }\n }\n\n drawDebugPoints(points) {\n let positions = new Float32Array(points.length * 3);\n for (var i = 0; i < points.length; i++) {\n positions[3 * i + 0] = points[i].x;\n positions[3 * i + 1] = points[i].y;\n positions[3 * i + 2] = points[i].z;\n }\n let geometry = new BufferGeometry();\n geometry.setAttribute('position', new BufferAttribute(positions, 3));\n let material = new PointsMaterial({\n color: 0x00ff00,\n size: 0.1\n });\n this.pointcloudmesh = new Points( geometry, material );\n this.scene.add(this.pointcloudmesh);\n }\n\n drawMesh(points, triangles) {\n // mesh\n let vertices = points;\n let geometry = new Geometry();\n let material = new MeshBasicMaterial({\n color: 0xffffff,\n side: DoubleSide\n });\n geometry.vertices = vertices;\n triangles.forEach(tri => {\n geometry.faces.push(new Face3(\n tri[0], tri[1], tri[2]\n ));\n });\n let mesh = new Mesh( geometry, material );\n\n // wireframe\n let geo = new EdgesGeometry(mesh.geometry);\n let mat = new LineBasicMaterial({\n color: 0xf2f2f2,\n });\n let wireframe = new LineSegments(geo, mat);\n mesh.add(wireframe);\n\n this.pointswireframe = mesh;\n this.scene.add(this.pointswireframe);\n }\n\n setVolume(value) {\n this.calculated = true;\n this.value = value;\n //this.calculate(false);\n }\n\n getVolume(points, triangles) {\n let volume = 0;\n triangles.forEach(tri => {\n let p1 = points[tri[0]].clone();\n let p2 = points[tri[1]].clone();\n let p3 = points[tri[2]].clone();\n let signedTetrahedronVolume = p1.dot(p2.cross(p3)) / 6.0;\n volume += signedTetrahedronVolume;\n });\n\n return volume;\n }\n\n generateTriangleArray(buffer, reverse = false) {\n let arr = Array.from(buffer);\n let v1 = arr.filter((v, index) => index % 3 === 0);\n let v2 = arr.filter((v, index) => index % 3 === 1);\n let v3 = arr.filter((v, index) => index % 3 === 2);\n let final = [];\n for (var i = 0; i < arr.length / 3; i++) {\n let vertices = [v1[i], v2[i], v3[i]];\n if (reverse) {\n vertices = [v1[i], v3[i], v2[i]];\n }\n final.push(vertices);\n }\n\n return final;\n }\n\n removeInvalidTriangles(points, triangles) {\n let validTriangles = [];\n triangles.forEach(triangle => {\n let p1 = points[triangle[0]];\n let p2 = points[triangle[1]];\n let p3 = points[triangle[2]];\n\n let tri = new Triangle(p1, p2, p3);\n let center = new Vector3();\n tri.getMidpoint(center);\n let valid = pointInPolygon(center, this.vertices);\n\n if (valid) {\n validTriangles.push(triangle);\n }\n });\n\n return validTriangles;\n }\n\n getDenaunayTriangles(points, reverseWinding) {\n let xFunc = point => {\n return point.x;\n };\n\n let yFunc = point => {\n return point.y;\n };\n\n let delaunay = Delaunator.from(points, xFunc, yFunc);\n\n let triangles = this.generateTriangleArray(delaunay.triangles, reverseWinding);\n triangles = this.removeInvalidTriangles(points, triangles);\n\n return triangles;\n }\n\n calculateVolume(updateValue) {\n this.calculatingVolume = true;\n this.measurement.controller.refreshMeasurementList();\n\n // Create a more dense version of our boundary polygon\n let denseBounds = getDensePolygon(this.vertices, this.spacing);\n\n // Query points for this bounding box\n let points = this.pointCloud.pointsInRadius(this.bounds.center,\n this.bounds.size / 2.0);\n\n // Quick filter by heights\n points = this.filterByHeight(points);\n\n // Get the points inside a polygon only\n points = this.pointCloud.pointsInPolygon(points, this.vertices);\n\n // Calculate DTM for points, in a 2d grid\n points = this.pointCloud.getSampledPoints(points, true, point => {\n let gridX = Math.floor(point.x / this.spacing);\n let gridY = Math.floor(point.y / this.spacing);\n let key = `${gridX}-${gridY}`;\n return key;\n });\n\n // Remove sparse outliers and continue\n this.removeOutliersAsync(points, points => {\n this.asyncFinished(points, denseBounds, updateValue);\n });\n }\n\n asyncFinished(points, denseBounds = [], updateValue = true) {\n this.destroyWorker();\n\n if (points.length !== 0) {\n this.webWorkerFinished(points, denseBounds, updateValue);\n }\n\n this.calculatingVolume = false;\n this.measurement.controller.refreshMeasurementList();\n }\n\n /** @private */\n webWorkerFinished(pointsArray, denseBounds, updateValue) {\n let points = [];\n pointsArray.forEach(point => {\n points.push(new Vector3().copy(point));\n });\n\n // Combine highest points + dense boundary\n points = denseBounds.concat(points);\n\n // Calculate upper mesh with reverse winding order\n let trianglesUpper = this.getDenaunayTriangles(points, true);\n\n // Calculate lower mesh\n let trianglesLower = this.getDenaunayTriangles(denseBounds, false);\n\n // Combine upper and lower triangles\n let trianglesCombined = [];\n trianglesCombined = trianglesCombined.concat(trianglesLower);\n trianglesCombined = trianglesCombined.concat(trianglesUpper);\n\n // this.drawDebugPoints(points);\n this.drawMesh(points, trianglesUpper);\n\n this.calculated = true;\n\n if (updateValue) {\n let volume = this.getVolume(points, trianglesCombined);\n this.value = volume;\n }\n\n // Update shaders (hide area highlight)\n this.measurement.controller.updateAreaShaders();\n }\n\n /** @private */\n stopCalculation() {\n if (this.calculatingVolume) {\n this.asyncFinished([]);\n }\n }\n\n clear() {\n this.scene.remove(this.pointswireframe);\n this.scene.remove(this.pointcloudmesh);\n this.pointswireframe = null;\n this.pointcloudmesh = null;\n this.value = null;\n this.calculatingVolume = false;\n this.calculated = false;\n }\n}\n\nclass SurfaceGenerator {\n private measurement: MeasurementArea;\n private changeRequired = 0.01;\n private renderInScene = false;\n private indices = [];\n private meshes = [];\n\n constructor(measurement) {\n this.measurement = measurement;\n this.clear();\n }\n\n get scene() {\n let measurement = this.measurement;\n return measurement.controller.scene;\n }\n\n get area() {\n let area = 0;\n let vertices = this.measurement.localVertices3D;\n\n this.indices.forEach(indices => {\n let triangle = new Triangle(\n vertices[indices[0]],\n vertices[indices[1]],\n vertices[indices[2]]\n );\n area += triangle.getArea();\n });\n\n return area;\n }\n\n get valid() {\n return this.indices.length > 0;\n }\n\n clear() {\n this.removeMeshesFromScene();\n this.indices = [];\n this.meshes = [];\n }\n\n addMeshesToScene() {\n if (!this.meshes || !this.renderInScene) {\n return;\n }\n\n this.meshes.forEach(mesh => {\n this.scene.add(mesh);\n });\n }\n\n removeMeshesFromScene() {\n if (!this.meshes || !this.renderInScene) {\n return;\n }\n\n this.meshes.forEach(mesh => {\n this.scene.remove(mesh);\n });\n }\n\n generateMesh(triangle) {\n let hexColor = randomHexColor(); // TODO: remove random coloring later\n\n var geom = new Geometry();\n var normal = new Vector3();\n triangle.getNormal(normal);\n geom.vertices.push(triangle.a);\n geom.vertices.push(triangle.b);\n geom.vertices.push(triangle.c);\n geom.faces.push(new Face3(0, 1, 2, normal));\n var mesh = new Mesh(\n geom, new MeshBasicMaterial({\n color: hexColor,\n side: DoubleSide\n })\n );\n\n return mesh;\n }\n\n optimize(vertices, triangleIndices) {\n let verticesModified = false;\n let numIndices = triangleIndices.length;\n\n for (var triIndexA = 0; triIndexA < numIndices; triIndexA++) {\n for (var triIndexB = 0; triIndexB < numIndices; triIndexB++) {\n if (verticesModified) {\n continue;\n }\n\n let triA = triangleIndices[triIndexA];\n let triB = triangleIndices[triIndexB];\n\n let vertSet = new Set([...triA, ...triB]);\n let allVerts = Array.from(vertSet);\n if (allVerts.length !== 4) {\n continue;\n }\n\n let sharedVerts = triA.filter(x => triB.includes(x));\n let uniqueVerts = allVerts.filter(x => !sharedVerts.includes(x));\n\n let modTriA = [...uniqueVerts, sharedVerts[0]];\n let modTriB = [...uniqueVerts, sharedVerts[1]];\n\n let t1 = new Triangle(vertices[triA[0]],\n vertices[triA[1]], vertices[triA[2]]);\n let t2 = new Triangle(vertices[triB[0]],\n vertices[triB[1]], vertices[triB[2]]);\n let oldArea = t1.getArea() + t2.getArea();\n\n let t3 = new Triangle(vertices[modTriA[0]],\n vertices[modTriA[1]], vertices[modTriA[2]]);\n let t4 = new Triangle(vertices[modTriB[0]],\n vertices[modTriB[1]], vertices[modTriB[2]]);\n let newArea = t3.getArea() + t4.getArea();\n\n // New area must be smaller\n if (newArea > oldArea) {\n continue;\n }\n\n // Difference between areas must be non-trivial\n let diff = (oldArea - newArea) / oldArea;\n if (diff < this.changeRequired) {\n continue;\n }\n\n triangleIndices[triIndexA] = modTriA;\n triangleIndices[triIndexB] = modTriB;\n verticesModified = true;\n }\n }\n\n if (verticesModified) {\n return this.optimize(vertices, triangleIndices);\n }\n\n return triangleIndices;\n }\n\n generate() {\n let vertices = this.measurement.localVertices3D;\n let numVertices = vertices.length;\n let triangles = [];\n\n if (numVertices === 3) {\n triangles.push([0, 1, 2]);\n } else if (numVertices > 3) {\n let points = calculatePointsPCA(vertices, true);\n let indices = earcut(points, null, 3);\n let deviation = earcut.deviation(points, null, 3, indices);\n\n // Deviation must be nearly zero to be valid\n if (deviation > 1E-6) {\n return;\n }\n\n let triangleIndices = [];\n let numTriangles = indices.length / 3;\n for (var i = 0; i < numTriangles; i++) {\n triangleIndices.push([\n indices[3 * i],\n indices[3 * i + 1],\n indices[3 * i + 2]\n ]);\n }\n\n // Optimized surface meshes\n triangleIndices = this.optimize(vertices, triangleIndices);\n\n triangleIndices.forEach(triVertices => {\n triangles.push(triVertices);\n });\n }\n\n let meshes = [];\n triangles.forEach(indices => {\n let triangle = new Triangle(\n vertices[indices[0]],\n vertices[indices[1]],\n vertices[indices[2]]\n );\n let mesh = this.generateMesh(triangle);\n meshes.push(mesh);\n });\n\n this.indices = triangles;\n this.meshes = meshes;\n\n this.addMeshesToScene();\n }\n}\n\nconst getDensePolygon = (vertices, spacing) => {\n let densePolygonTemp = [];\n\n vertices.forEach((start, index) => {\n let nextIndex = (index + 1) % vertices.length;\n\n let end = vertices[nextIndex];\n let direction = new Vector3().add(end).sub(start);\n let vectorLength = direction.length();\n let steps = Math.floor(vectorLength / spacing);\n let increment = vectorLength / steps;\n direction.setLength(1.0);\n\n if (steps === 0) {\n densePolygonTemp.push(start);\n return;\n }\n\n for (var i = 0; i <= steps; i++) {\n let directionIncrement = new Vector3().add(direction)\n .multiplyScalar(increment * i);\n let final = new Vector3().add(start).add(directionIncrement);\n densePolygonTemp.push(final);\n }\n });\n\n let densePolygon = [];\n densePolygonTemp.forEach((point, index) => {\n if (index === 0) {\n densePolygon.push(point);\n } else {\n let old = densePolygonTemp[index - 1];\n let distance = point.distanceTo(old);\n if (distance > 0) {\n densePolygon.push(point);\n }\n }\n });\n\n return densePolygonTemp;\n};\n","/**\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author erich666 / http://erichaines.com\n */\n\nimport {\n EventDispatcher,\n MOUSE,\n Quaternion,\n Spherical,\n Vector2,\n Vector3\n} from \"three\";\n\nconst screenSpacePanning = 0;\nconst horizontalPanning = 1;\n\nconst CustomOrbitControls = function(object, domElement ) {\n this.object = object;\n\n // Persistent toast that we update while loading\n //this.toast = new PersistentToast();\n\n this.domElement = ( domElement !== undefined ) ? domElement : document;\n\n // Fly mode variables\n this.flyMode = false;\n this.flyForcedRadius = 0.005;\n this.flyPreviousRadius = null;\n this.flyPreviousDampening = false;\n this.flyPreviousRotateSpeed = 0.0;\n this.flySpeed = 50.0;\n this.flyRatio = 1.10;\n this.minFlySpeed = 0.10;\n this.maxFlySpeed = 1000;\n this.saveSpeedTimeout = null;\n this.tick = 0;\n\n // Set to false to disable this control\n this.enabled = true;\n\n this.focused = false;\n\n // \"target\" sets the location of focus, where the object orbits around\n this.target = new Vector3();\n\n // How far you can dolly in and out ( PerspectiveCamera only )\n this.minDistance = 0.05;\n this.maxDistance = Infinity;\n\n // How far you can zoom in and out ( OrthographicCamera only )\n this.minZoom = 0;\n this.maxZoom = Infinity;\n\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n this.minPolarAngle = 0; // radians\n this.maxPolarAngle = Math.PI; // radians\n\n // How far you can orbit horizontally, upper and lower limits.\n // If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n this.minAzimuthAngle = -Infinity; // radians\n this.maxAzimuthAngle = Infinity; // radians\n\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n this.enableDamping = false;\n this.dampingFactor = 0.25;\n\n // This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n // Set to false to disable zooming\n this.enableZoom = true;\n this.zoomSpeed = 1.0;\n\n // Set to false to disable rotating\n this.enableRotate = true;\n this.rotateSpeed = 1.0;\n\n this.flyModeOffset = 0.05;\n\n // Set to false to disable panning\n this.enablePan = true;\n this.panSpeed = 1.0;\n this.panningMode = screenSpacePanning; // alternate horizontalPanning\n this.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n this.autoRotate = false;\n this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n // Set to false to disable use of the keys\n this.enableKeys = true;\n\n // The four arrow keys\n this.keys = {\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n BOTTOM: 40,\n SPACE: 32,\n PLUS: 187,\n MINUS: 189,\n NUMPAD_PLUS: 107,\n NUMPAD_MINUS: 109\n };\n\n // Mouse buttons\n this.mouseButtons = { ORBIT: MOUSE.LEFT, ZOOM: MOUSE.MIDDLE, PAN: MOUSE.RIGHT };\n\n // for reset\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.zoom0 = this.object.zoom;\n\n //\n // public methods\n //\n\n\n this.isMoving = function() {\n if (this.flyMode) {\n return true;\n } else if (panOffset.length() > 0) {\n return true;\n } else if ((sphericalDelta.theta !== 0) || (sphericalDelta.phi !== 0)) {\n return true;\n }\n\n return false;\n };\n\n this.setFlySpeed = function (value) {\n this.flySpeed = Math.min(this.maxFlySpeed, Math.max(this.minFlySpeed, value));\n };\n\n this.increaseFlySpeed = function () {\n this.setFlySpeed(scope.flySpeed * this.flyRatio);\n /*let speedFormatted = scope.flySpeed.toFixed(2);\n scope.toast.show(\"Fly Mode Speed Increased:\", speedFormatted);*/\n };\n\n this.decreaseFlySpeed = function () {\n this.setFlySpeed(scope.flySpeed / this.flyRatio);\n /*let speedFormatted = scope.flySpeed.toFixed(2);\n scope.toast.show(\"Fly Mode Speed Decreased\", speedFormatted);*/\n };\n\n this.toggleFlyMode = function (state, showToast) {\n this.flyMode = state;\n\n var position = this.object.position;\n var offset = new Vector3().copy(position).sub(scope.target);\n\n if (state === false) {\n offset.setLength(this.flyPreviousRadius);\n this.clearSphericalDelta();\n this.clearPanOffset();\n } else {\n this.flyPreviousRadius = offset.length();\n offset.setLength(this.flyModeOffset);\n }\n\n if (showToast) {\n //this.toast.show(\"Fly Mode\", state ? \"Enabled\" : \"Disabled\");\n }\n\n offset.multiplyScalar(-1);\n this.target.copy(position).add(offset);\n };\n\n this.getPolarAngle = function () {\n return spherical.phi;\n };\n\n this.getAzimuthalAngle = function () {\n return spherical.theta;\n };\n\n this.clearSphericalDelta = function () {\n sphericalDelta.set(0, 0, 0);\n };\n\n this.clearPanOffset = function() {\n panOffset.set(0, 0, 0);\n };\n\n this.saveState = function () {\n scope.target0.copy( scope.target );\n scope.position0.copy( scope.object.position );\n scope.zoom0 = scope.object.zoom;\n };\n\n this.reset = function () {\n scope.target.copy( scope.target0 );\n scope.object.position.copy( scope.position0 );\n scope.object.zoom = scope.zoom0;\n\n scope.object.updateProjectionMatrix();\n scope.dispatchEvent( changeEvent );\n\n scope.update();\n\n state = STATE.NONE;\n };\n\n // this method is exposed, but perhaps it would be better if we can make it private...\n this.update = (function () {\n var offset = new Vector3();\n\n // so camera.up is the orbit axis\n var quat = new Quaternion().setFromUnitVectors( object.up, new Vector3( 0, 1, 0 ) );\n var quatInverse = quat.clone().inverse();\n\n var lastPosition = new Vector3();\n var lastQuaternion = new Quaternion();\n\n return function update() {\n var position = scope.object.position;\n\n offset.copy( position ).sub( scope.target );\n\n if (scope.flyMode) {\n let millisecondsElapsed = this.tick;\n let distancePerFrame = scope.flySpeed * millisecondsElapsed / 1000;\n let direction = new Vector3().copy(offset)\n .multiplyScalar(-1.0).setLength(distancePerFrame);\n scope.target.add(direction);\n position.add(direction);\n }\n\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion( quat );\n\n // angle from z-axis around y-axis\n spherical.setFromVector3( offset );\n\n if ( scope.autoRotate && state === STATE.NONE ) {\n rotateLeft( getAutoRotationAngle() );\n }\n\n spherical.theta += sphericalDelta.theta;\n spherical.phi += sphericalDelta.phi;\n\n // restrict theta to be between desired limits\n spherical.theta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, spherical.theta ) );\n\n // restrict phi to be between desired limits\n spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );\n\n spherical.makeSafe();\n\n if (scope.flyMode) {\n spherical.radius = scope.flyForcedRadius;\n } else {\n spherical.radius *= scale;\n spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));\n }\n\n // move target to panned location\n scope.target.add( panOffset );\n\n offset.setFromSpherical( spherical );\n\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion( quatInverse );\n\n position.copy( scope.target ).add( offset );\n\n scope.object.lookAt( scope.target );\n\n if ( scope.enableDamping === true ) {\n sphericalDelta.theta *= ( 1 - scope.dampingFactor );\n sphericalDelta.phi *= ( 1 - scope.dampingFactor );\n if ((Math.abs(sphericalDelta.phi) < 1E-3) && (Math.abs(sphericalDelta.theta) < 1E-3)) {\n scope.clearSphericalDelta();\n }\n\n panOffset.multiplyScalar( 1 - scope.dampingFactor );\n if (panOffset.length() < 1E-3) {\n scope.clearPanOffset();\n }\n } else {\n scope.clearSphericalDelta();\n scope.clearPanOffset();\n }\n\n scale = 1;\n\n // update condition is:\n // min(camera displacement, camera rotation in radians)^2 > EPS\n // using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n if ( zoomChanged ||\n\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n scope.dispatchEvent( changeEvent );\n\n lastPosition.copy( scope.object.position );\n lastQuaternion.copy( scope.object.quaternion );\n zoomChanged = false;\n\n return true;\n }\n\n return false;\n };\n }());\n\n this.dispose = function () {\n scope.domElement.removeEventListener( 'mousedown', onMouseDown, false );\n scope.domElement.removeEventListener( 'wheel', onMouseWheel, false );\n scope.domElement.removeEventListener( 'touchstart', onTouchStart, false );\n scope.domElement.removeEventListener( 'touchend', onTouchEnd, false );\n scope.domElement.removeEventListener( 'touchmove', onTouchMove, false );\n scope.domElement.removeEventListener( 'mouseover', onMouseFocus, false );\n scope.domElement.removeEventListener( 'mouseout', onMouseFocus, false );\n document.removeEventListener( 'mousemove', onMouseMove, false );\n document.removeEventListener( 'mouseup', onMouseUp, false );\n window.removeEventListener( 'keydown', onKeyDown, false );\n };\n\n //\n // internals\n //\n\n var scope = this;\n\n var changeEvent = { type: 'change' };\n var startEvent = { type: 'start' };\n var endEvent = { type: 'end' };\n\n var STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };\n\n var state = STATE.NONE;\n\n var EPS = 0.000001;\n\n // current position in spherical coordinates\n var spherical = new Spherical();\n var sphericalDelta = new Spherical();\n\n var scale = 1;\n var panOffset = new Vector3();\n var zoomChanged = false;\n\n var rotateStart = new Vector2();\n var rotateEnd = new Vector2();\n var rotateDelta = new Vector2();\n\n var panStart = new Vector2();\n var panEnd = new Vector2();\n var panDelta = new Vector2();\n\n var dollyStart = new Vector2();\n var dollyEnd = new Vector2();\n var dollyDelta = new Vector2();\n\n function getAutoRotationAngle() {\n return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n }\n\n function getZoomScale() {\n return Math.pow( 0.95, scope.zoomSpeed );\n }\n\n function rotateLeft( angle ) {\n sphericalDelta.theta -= angle;\n }\n\n function rotateUp( angle ) {\n sphericalDelta.phi -= angle;\n }\n\n var panLeft = (function () {\n var v = new Vector3();\n\n return function panLeft( distance, objectMatrix ) {\n v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix\n v.multiplyScalar( -distance );\n\n panOffset.add( v );\n };\n }());\n\n var panUp = (function () {\n var v = new Vector3();\n\n return function panUp( distance, objectMatrix ) {\n switch ( scope.panningMode ) {\n case screenSpacePanning:\n\n v.setFromMatrixColumn( objectMatrix, 1 );\n break;\n\n case horizontalPanning:\n\n v.setFromMatrixColumn( objectMatrix, 0 );\n v.crossVectors( scope.object.up, v );\n break;\n }\n\n v.multiplyScalar( distance );\n\n panOffset.add( v );\n };\n }());\n\n // deltaX and deltaY are in pixels; right and down are positive\n var pan = (function () {\n var offset = new Vector3();\n\n return function pan( deltaX, deltaY ) {\n var element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n if ( scope.object.isPerspectiveCamera ) {\n // perspective\n var position = scope.object.position;\n offset.copy( position ).sub( scope.target );\n var targetDistance = offset.length();\n\n // half of the fov is center to top of screen\n targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n // we actually don't use screenWidth, since perspective camera is fixed to screen height\n panLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n panUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n } else if ( scope.object.isOrthographicCamera ) {\n // orthographic\n panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );\n panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );\n } else {\n // camera neither orthographic nor perspective\n console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n scope.enablePan = false;\n }\n };\n }());\n\n function dollyIn( dollyScale ) {\n if ( scope.object.isPerspectiveCamera ) {\n scale /= dollyScale;\n } else if ( scope.object.isOrthographicCamera ) {\n scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n } else {\n console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n scope.enableZoom = false;\n }\n }\n\n function dollyOut( dollyScale ) {\n if ( scope.object.isPerspectiveCamera ) {\n scale *= dollyScale;\n } else if ( scope.object.isOrthographicCamera ) {\n scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n } else {\n console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n scope.enableZoom = false;\n }\n }\n\n //\n // event callbacks - update the object state\n //\n\n function handleMouseDownRotate( event ) {\n // console.log( 'handleMouseDownRotate' );\n\n rotateStart.set( event.clientX, event.clientY );\n }\n\n function handleMouseDownDolly( event ) {\n // console.log( 'handleMouseDownDolly' );\n\n dollyStart.set( event.clientX, event.clientY );\n }\n\n function handleMouseDownPan( event ) {\n // console.log( 'handleMouseDownPan' );\n\n panStart.set( event.clientX, event.clientY );\n }\n\n function handleMouseMoveRotate( event ) {\n // console.log( 'handleMouseMoveRotate' );\n\n rotateEnd.set( event.clientX, event.clientY );\n\n rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n var element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n // rotating across whole screen goes 360 degrees around\n rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth );\n\n // rotating up and down along whole screen attempts to go 360, but limited to 180\n rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n rotateStart.copy( rotateEnd );\n\n scope.update();\n }\n\n function handleMouseMoveDolly( event ) {\n // console.log( 'handleMouseMoveDolly' );\n\n dollyEnd.set( event.clientX, event.clientY );\n\n dollyDelta.subVectors( dollyEnd, dollyStart );\n\n if ( dollyDelta.y > 0 ) {\n dollyIn( getZoomScale() );\n } else if ( dollyDelta.y < 0 ) {\n dollyOut( getZoomScale() );\n }\n\n dollyStart.copy( dollyEnd );\n\n scope.update();\n }\n\n function handleMouseMovePan( event ) {\n // console.log( 'handleMouseMovePan' );\n\n panEnd.set( event.clientX, event.clientY );\n\n panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n pan( panDelta.x, panDelta.y );\n\n panStart.copy( panEnd );\n\n scope.update();\n }\n\n function handleMouseUp( event ) {\n\n // console.log( 'handleMouseUp' );\n\n }\n\n function handleMouseWheel( event ) {\n // console.log( 'handleMouseWheel' );\n\n if (scope.flyMode) {\n if ( event.deltaY < 0 ) {\n scope.increaseFlySpeed(scope.flySpeed);\n } else if ( event.deltaY > 0 ) {\n scope.decreaseFlySpeed(scope.flySpeed);\n }\n } else {\n if ( event.deltaY < 0 ) {\n dollyOut( getZoomScale() );\n } else if ( event.deltaY > 0 ) {\n dollyIn( getZoomScale() );\n }\n scope.update();\n }\n }\n\n function handleKeyDown( event ) {\n switch ( event.keyCode ) {\n case scope.keys.UP:\n pan( 0, scope.keyPanSpeed );\n scope.update();\n break;\n\n case scope.keys.BOTTOM:\n pan( 0, -scope.keyPanSpeed );\n scope.update();\n break;\n\n case scope.keys.LEFT:\n pan( scope.keyPanSpeed, 0 );\n scope.update();\n break;\n\n case scope.keys.RIGHT:\n pan( -scope.keyPanSpeed, 0 );\n scope.update();\n break;\n\n case scope.keys.SPACE:\n event.preventDefault();\n scope.toggleFlyMode(!scope.flyMode, true);\n break;\n\n case scope.keys.PLUS:\n scope.increaseFlySpeed();\n break;\n\n case scope.keys.NUMPAD_PLUS:\n scope.increaseFlySpeed();\n break;\n\n case scope.keys.MINUS:\n scope.decreaseFlySpeed();\n break;\n\n case scope.keys.NUMPAD_MINUS:\n scope.decreaseFlySpeed();\n break;\n }\n }\n\n function handleTouchStartRotate( event ) {\n // console.log( 'handleTouchStartRotate' );\n\n rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n }\n\n function handleTouchStartDolly( event ) {\n // console.log( 'handleTouchStartDolly' );\n\n var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;\n var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;\n\n var distance = Math.sqrt( dx * dx + dy * dy );\n\n dollyStart.set( 0, distance );\n }\n\n function handleTouchStartPan( event ) {\n // console.log( 'handleTouchStartPan' );\n\n panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n }\n\n function handleTouchMoveRotate( event ) {\n // console.log( 'handleTouchMoveRotate' );\n\n rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n\n rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n var element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n // rotating across whole screen goes 360 degrees around\n rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth );\n\n // rotating up and down along whole screen attempts to go 360, but limited to 180\n rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n rotateStart.copy( rotateEnd );\n\n scope.update();\n }\n\n function handleTouchMoveDolly( event ) {\n // console.log( 'handleTouchMoveDolly' );\n\n var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;\n var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;\n\n var distance = Math.sqrt( dx * dx + dy * dy );\n\n dollyEnd.set( 0, distance );\n\n dollyDelta.subVectors( dollyEnd, dollyStart );\n\n if ( dollyDelta.y > 0 ) {\n dollyOut( getZoomScale() );\n } else if ( dollyDelta.y < 0 ) {\n dollyIn( getZoomScale() );\n }\n\n dollyStart.copy( dollyEnd );\n\n scope.update();\n }\n\n function handleTouchMovePan( event ) {\n // console.log( 'handleTouchMovePan' );\n\n panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n\n panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n pan( panDelta.x, panDelta.y );\n\n panStart.copy( panEnd );\n\n scope.update();\n }\n\n function handleTouchEnd( event ) {\n\n // console.log( 'handleTouchEnd' );\n\n }\n\n //\n // event handlers - FSM: listen for events and reset state\n //\n\n function onMouseDown( event ) {\n if ( scope.enabled === false ) return;\n\n event.preventDefault();\n\n switch ( event.button ) {\n case scope.mouseButtons.ORBIT:\n\n if ( scope.enableRotate === false ) return;\n\n handleMouseDownRotate( event );\n\n state = STATE.ROTATE;\n\n break;\n\n case scope.mouseButtons.ZOOM:\n\n if ( scope.enableZoom === false ) return;\n\n handleMouseDownDolly( event );\n\n state = STATE.DOLLY;\n\n break;\n\n case scope.mouseButtons.PAN:\n\n if ( scope.enablePan === false ) return;\n\n handleMouseDownPan( event );\n\n state = STATE.PAN;\n\n break;\n }\n\n if ( state !== STATE.NONE ) {\n document.addEventListener( 'mousemove', onMouseMove, false );\n document.addEventListener( 'mouseup', onMouseUp, false );\n\n scope.dispatchEvent( startEvent );\n }\n }\n\n function onMouseMove( event ) {\n if ( scope.enabled === false ) return;\n\n event.preventDefault();\n\n switch ( state ) {\n case STATE.ROTATE:\n\n if ( scope.enableRotate === false ) return;\n\n handleMouseMoveRotate( event );\n\n break;\n\n case STATE.DOLLY:\n if (scope.flyMode) return;\n if (scope.enableZoom === false) return;\n\n handleMouseMoveDolly( event );\n\n break;\n\n case STATE.PAN:\n if (scope.flyMode) return;\n if (scope.enablePan === false) return;\n\n handleMouseMovePan( event );\n\n break;\n }\n }\n\n function onMouseUp( event ) {\n if ( scope.enabled === false ) return;\n\n handleMouseUp( event );\n\n document.removeEventListener( 'mousemove', onMouseMove, false );\n document.removeEventListener( 'mouseup', onMouseUp, false );\n\n scope.dispatchEvent( endEvent );\n\n state = STATE.NONE;\n }\n\n function onMouseWheel( event ) {\n if ( scope.enabled === false || scope.enableZoom === false || ( state !== STATE.NONE && state !== STATE.ROTATE ) ) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n scope.dispatchEvent( startEvent );\n\n handleMouseWheel( event );\n\n scope.dispatchEvent( endEvent );\n }\n\n function onKeyDown( event ) {\n if (!scope.enabled || !scope.focused || !scope.enableKeys || !scope.enablePan) {\n return;\n }\n\n handleKeyDown( event );\n }\n\n function onTouchStart( event ) {\n if ( scope.enabled === false ) return;\n\n switch ( event.touches.length ) {\n case 1:\t// one-fingered touch: rotate\n\n if ( scope.enableRotate === false ) return;\n\n handleTouchStartRotate( event );\n\n state = STATE.TOUCH_ROTATE;\n\n break;\n\n case 2:\t// two-fingered touch: dolly\n\n if ( scope.enableZoom === false ) return;\n\n handleTouchStartDolly( event );\n\n state = STATE.TOUCH_DOLLY;\n\n break;\n\n case 3: // three-fingered touch: pan\n\n if ( scope.enablePan === false ) return;\n\n handleTouchStartPan( event );\n\n state = STATE.TOUCH_PAN;\n\n break;\n\n default:\n\n state = STATE.NONE;\n }\n\n if ( state !== STATE.NONE ) {\n scope.dispatchEvent( startEvent );\n }\n }\n\n function onTouchMove( event ) {\n if ( scope.enabled === false ) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n switch ( event.touches.length ) {\n case 1: // one-fingered touch: rotate\n\n if ( scope.enableRotate === false ) return;\n if ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n handleTouchMoveRotate( event );\n\n break;\n\n case 2: // two-fingered touch: dolly\n\n if ( scope.enableZoom === false ) return;\n if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n handleTouchMoveDolly( event );\n\n break;\n\n case 3: // three-fingered touch: pan\n\n if ( scope.enablePan === false ) return;\n if ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n handleTouchMovePan( event );\n\n break;\n\n default:\n\n state = STATE.NONE;\n }\n }\n\n function onTouchEnd( event ) {\n if ( scope.enabled === false ) return;\n\n handleTouchEnd( event );\n\n scope.dispatchEvent( endEvent );\n\n state = STATE.NONE;\n }\n\n function onMouseFocus( event ) {\n if (event.type === 'mouseover') {\n scope.focused = true;\n } else if (event.type === 'mouseout') {\n scope.focused = false;\n }\n }\n\n // Bind all events to dom element\n scope.domElement.addEventListener( 'mousedown', onMouseDown, false );\n scope.domElement.addEventListener( 'wheel', onMouseWheel, false );\n scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\n // Keep track of our canvas focus\n scope.domElement.addEventListener( 'mouseover', onMouseFocus, false );\n scope.domElement.addEventListener( 'mouseout', onMouseFocus, false );\n\n // Keydown doesnt work on canvas\n window.addEventListener( 'keydown', onKeyDown, false) ;\n\n // Start our update loop\n this.update();\n};\n\nCustomOrbitControls.prototype = Object.create( EventDispatcher.prototype );\nCustomOrbitControls.prototype.constructor = CustomOrbitControls;\n\nexport {CustomOrbitControls};\n","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAABCAIAAAC+O+cgAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwAAADsABataJCQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMK0KCsAAAAA0SURBVDhPY/gPBvXGDAz1bgxnChj+9zQ0NHz7z/D/BgPDlP+bGEDoPwMDhDGKRtGwQgz/AdMXsIuNsuecAAAAAElFTkSuQmCC\"","import { TextureLoader } from 'three';\nimport classifications from '../textures/colormaps/classifications.png';\n\n// Load classification texture\nconst loader = new TextureLoader();\nexport const classificationTexture = loader.load(classifications);\n","import edlFragmentShader from \"./edl_f\";\nimport edlVertexShader from \"./edl_v\";\nimport opacityFragmentShader from \"./opacity_f\";\nimport opacityVertexShader from \"./opacity_v\";\nimport pointCloudFragmentShader from \"./pointcloud_f\";\nimport pointCloudVertexShader from \"./pointcloud_v\";\nimport imageFragmentShader from \"./image_f\";\nimport imageVertexShader from './image_v';\nimport markersFragmentShader from \"./markers_f\";\nimport markersVertexShader from './markers_v';\nimport utilitiesVertexShader from './utilities_v';\nimport gpuPickerFragmentShader from './gpu_picker_f';\n\nconst shaders = {\n pointcloud: {\n vert: pointCloudVertexShader,\n frag: pointCloudFragmentShader\n },\n edl: {\n vert: edlVertexShader,\n frag: edlFragmentShader\n },\n opacity: {\n vert: opacityVertexShader,\n frag: opacityFragmentShader\n },\n image: {\n vert: imageVertexShader,\n frag: imageFragmentShader\n },\n markers: {\n vert: markersVertexShader,\n frag: markersFragmentShader\n },\n utilities: {\n vert: utilitiesVertexShader\n },\n gpu_picker: {\n frag: gpuPickerFragmentShader\n }\n};\n\nexport default shaders;","const shader = `\n#define PRECISION 0.0001\n#define DISTANCE_FROM_PLANE 0.5\n\nattribute float intensity;\nattribute float classification;\nattribute int gpu_index;\nattribute vec3 rgb;\n\nuniform bool gpuPicker;\nuniform float pratio;\nuniform float size;\nuniform float alpha;\nuniform float distance;\nuniform vec3 origin;\nuniform float screenHeight;\nuniform float fov;\nuniform float size_min;\nuniform float size_max;\nuniform float octree_size;\nuniform vec3 octree_corner;\nuniform float octree_spacing;\n\nuniform sampler2D color_map;\nuniform float color_type;\nuniform bool dynamic_size;\nuniform bool dynamic_cloud;\nuniform vec2 height_range;\nuniform vec2 height_clamp;\nuniform vec2 intensity_range;\nuniform vec2 intensity_clamp;\nuniform float rgb_max;\n\nuniform sampler2D visible_nodes;\nuniform sampler2D classification_data;\nuniform bool classification_visible[NUMBER_OF_CLASSIFICATIONS];\n\nuniform vec3 area_measure_data[AREA_VERTICES_TOTAL];\nuniform float volume_status[AREA_TRIANGLES_TOTAL];\n\nvarying vec4 vGPUColor;\nvarying vec3 vColor;\nvarying vec2 vUv;\nvarying float vAlpha;\nvarying vec3 vViewPosition;\n\nfloat sign (vec3 p1, vec3 p2, vec3 p3) {\n return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);\n}\n\nbool compareFloat(float floatOne, float floatTwo) {\n return abs(floatOne - floatTwo) < PRECISION;\n}\n\nvec3 pointOnPlane(vec3 origin, vec3 point, vec3 normal) {\n return point - dot(point - origin, normal) * normal;\n}\n\nfloat distanceFromPlane(vec3 origin, vec3 point, vec3 normal) {\n return abs(dot(origin - point, normal));\n}\n\nint checkPointInTriangle(vec3 point) {\n // Return values:\n // 0: not in polygon\n // 1: in polygon, volume not enabled\n // 2: in polygon, volume enabled\n\n for (int i=0;i 0.5;\n bool volumeActive = compareFloat(volumeStatus, 2.0);\n\n vec3 v1 = area_measure_data[baseIndex];\n vec3 v2 = area_measure_data[baseIndex + 1];\n vec3 v3 = area_measure_data[baseIndex + 2];\n\n // Empty set of vertices\n if (length(v1 - v2) < PRECISION) {\n if (length(v3 - v1) < PRECISION) {\n break;\n }\n }\n\n vec3 N = cross(v2 - v1, v3 - v1);\n N = N / length(N);\n\n\n vec3 v1_p, v2_p, v3_p, point_p;\n\n if (isVolume == false) {\n // Check distance from plane\n float pointHeight = distanceFromPlane(v1, point, N);\n if (pointHeight > DISTANCE_FROM_PLANE) {\n continue;\n }\n\n // Project point to plane\n v1_p = pointOnPlane(v1, v1, N);\n v2_p = pointOnPlane(v1, v2, N);\n v3_p = pointOnPlane(v1, v3, N);\n point_p = pointOnPlane(v1, point, N);\n } else {\n // Dont reproject our points\n v1_p = v1;\n v2_p = v2;\n v3_p = v3;\n point_p = point;\n }\n\n float d1 = sign(point_p, v1_p, v2_p);\n float d2 = sign(point_p, v2_p, v3_p);\n float d3 = sign(point_p, v3_p, v1_p);\n bool isNegative = (d1 < 0.0) || (d2 < 0.0) || (d3 < 0.0);\n bool isPositive = (d1 > 0.0) || (d2 > 0.0) || (d3 > 0.0);\n bool insideTriangle = !(isNegative && isPositive);\n\n if (insideTriangle) {\n if (volumeActive) {\n return 2;\n } else {\n return 1;\n }\n }\n }\n\n return 0;\n}\n\nbool classificationIsHidden(float classification) {\n return classification_visible[int(classification)] == false;\n}\n\nvec3 classificationColor(float classification) {\n float x = (classification + 0.1) / float(NUMBER_OF_CLASSIFICATIONS);\n vec4 value = texture2D(classification_data, vec2(x, 0.5));\n return value.rgb;\n}\n\nfloat clampedValue(float data, vec2 data_range, vec2 data_clamp) {\n float scaled = (data - data_range.x) / (data_range.y - data_range.x);\n float clamped = (scaled - data_clamp.x) / (data_clamp.y - data_clamp.x);\n return clamped;\n}\n\nvec3 calculateOppositeColor(float color_type, vec3 color_value){\n vec3 result;\n vec3 opp = vec3(1.0, 1.0, 1.0);\n opp = opp - color_value;\n\n bool isIntensity = compareFloat(color_type, 0.0);\n bool isRGB = compareFloat(color_type, 1.0);\n bool isHeight = compareFloat(color_type, 2.0);\n bool isClassification = compareFloat(color_type, 3.0);\n\n if (isHeight) {\n result = opp;\n } else if (isIntensity) {\n result = vec3(1.0, 0.0, 0.0);\n } else if (isClassification) {\n result = vec3(1.0, 0.0, 0.0);\n } else if (isRGB) {\n result = vec3(1.0, 0.0, 0.0);\n } else {\n result = opp;\n }\n\n return result;\n}\n\nvec3 getCloudColor(float color_type, vec3 pos_world) {\n // Default color for invalid color types\n vec3 color = vec3(0.0, 0.0, 0.0);\n\n bool isIntensity = compareFloat(color_type, 0.0);\n bool isRGB = compareFloat(color_type, 1.0);\n bool isHeight = compareFloat(color_type, 2.0);\n bool isClassification = compareFloat(color_type, 3.0);\n\n if (isRGB) {\n // Color by RGB values\n color = rgb / rgb_max;\n } else if (isIntensity) {\n // Intensity colors with clamping\n float pc_intens = clampedValue(intensity, intensity_range, intensity_clamp);\n color = texture2D(color_map, vec2(pc_intens, 0.5)).rgb;\n } else if (isHeight) {\n // Height based coloring with clamping\n float height = pos_world.z;\n float pc_height = clampedValue(height, height_range, height_clamp);\n color = texture2D(color_map, vec2(pc_height, 0.5)).rgb;\n } else if (isClassification) {\n color = classificationColor(classification);\n }\n\n return color;\n}\n\nfloat round(float number){\n\treturn floor(number + 0.5);\n}\n\nbool isBitSet(int number, int index){\n int powi = int(round(pow(2.0, float(index))));\n\tint ndp = number / powi;\n float mod_remainder = mod(float(ndp), 2.0);\n\treturn !compareFloat(mod_remainder, 0.0);\n}\n\nint numberOfOnes(int number, int index){\n\tint numOnes = 0;\n\tint tmp = 128;\n\tfor(int i = 7; i >= 0; i--){\n\t\tif(number >= tmp){\n\t\t\tnumber = number - tmp;\n\t\t\tif(i <= index){\n\t\t\t\tnumOnes++;\n\t\t\t}\n\t\t}\n\t\ttmp = tmp / 2;\n\t}\n\treturn numOnes;\n}\n\nfloat getLocalTreeDepth(vec3 positionOctree){\n int iOffset = 0;\n\tfloat depth = 0.0;\n vec3 offset = vec3(0.0, 0.0, 0.0);\n\n\tfor(float i = 0.0; i <= 30.0; i++) {\n\t\tfloat nodeSizeAtLevel = octree_size / pow(2.0, i);\n\n // Find the child index that we would belong to. We will test if it\n // actually exists w/ isBitSet(childrenNodes, index).\n vec3 index3d = (positionOctree - offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n int index = int(round(index3d.x + 2.0 * index3d.y + 4.0 * index3d.z));\n\n // Grab our values\n\t\tvec4 value = texture2D(visible_nodes, vec2(float(iOffset) / 2048.0, 0.0));\n\n // Offet from our current node to its first child node\n int firstChildOffset = int(round(value.g * 255.0));\n\n // Bit representation of existing children\n // ex: child nodes: [0,1,4,7], childrenNodes = [10010011]\n int childrenNodes = int(round(value.r * 255.0));\n\n // Offset from the child node to the one we belong to\n // ex: child nodes: [0,1,4,7], index = 7 --> offsetToChildIndex = 3\n int offsetToChildIndex = numberOfOnes(childrenNodes, index - 1);\n\n // True if our suspected child exists\n bool childExists = isBitSet(childrenNodes, index);\n\n\t\tif (childExists) {\n\t\t\t// there are more visible child nodes at this position\n\t\t\tiOffset = iOffset + firstChildOffset + offsetToChildIndex;\n depth++;\n\t\t} else {\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn depth;\n\t\t}\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\n\treturn depth;\n}\n\nfloat getPointSizeAttenuation(vec3 pos_world){\n vec3 positionOctree = pos_world - octree_corner;\n\treturn pow(1.9, getLocalTreeDepth(positionOctree));\n}\n\nvoid main() {\n vUv = uv;\n vAlpha = 1.0;\n vGPUColor = makeColor(gpu_index);\n\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n vViewPosition = -mvPosition.xyz;\n gl_Position = projectionMatrix * mvPosition;\n\n // Position in viewer coordinates (including offset)\n\tvec3 pos_world = (modelMatrix * vec4( position, 1.0 )).xyz;\n float x = pos_world.x - origin.x;\n float y = pos_world.y - origin.y;\n float distance2D = sqrt(x * x + y * y);\n\n // Hide based on distance\n if (distance2D > distance) {\n vAlpha = 0.0;\n }\n\n // Check if classification is hidden\n if (classificationIsHidden(classification)) {\n vAlpha = 0.0;\n }\n\n // ---------------------\n\t// POINT SIZE\n\t// ---------------------\n float pointSize = 1.0;\n float projFactor = getProjFactor(fov, screenHeight, vViewPosition.z);\n\n if (dynamic_size && dynamic_cloud){\n // Dynamic sizing (based on node density)\n \tfloat r = octree_spacing * 1.5;\n float pointAttenuation = getPointSizeAttenuation(pos_world);\n \tfloat worldSpaceSize = 0.7 * size * r / pointAttenuation;\n \tpointSize = 0.50 * worldSpaceSize * projFactor;\n } else {\n // Static point size\n pointSize = 0.05 * size * projFactor;\n }\n\n pointSize = max(size_min, pointSize);\n pointSize = min(size_max, pointSize);\n\n // ---------------------\n\t// POINT COLOR\n\t// ---------------------\n vColor = getCloudColor(color_type, pos_world);\n\n // ---------------------\n // CROSS SECTION\n // ---------------------\n bool inCrossSection = false; //checkForCrossSection(pos_world.xyz);\n\n // ---------------------\n // POINT IN POLYGON (MEASUREMENT AREA/VOLUME)\n // ---------------------\n int returnValue = checkPointInTriangle(pos_world.xyz);\n bool insidePolygon = returnValue > 0;\n bool volumeEnabled = returnValue == 2;\n\n if (inCrossSection || insidePolygon) {\n vColor = calculateOppositeColor(color_type, vColor);\n }\n\n if (volumeEnabled) {\n pointSize = pointSize * 0.5;\n // vAlpha = 0.0;\n }\n\n if (gpuPicker) {\n // gpu picker points are 10% larger than normal\n pointSize = pointSize * 1.10;\n }\n\n // Set OpenGL parameters\n gl_PointSize = pointSize;\n}\n`;\n\nexport default shader;","const shader = `\n#define PRECISION 0.0001\n\nuniform bool gpuPicker;\nuniform bool circularPoints;\n\nvarying vec3 vColor;\nvarying float vAlpha;\nvarying vec2 vUv;\nvarying vec4 vGPUColor;\n\nvoid main(void) {\n vec4 point_color = vec4(vColor, vAlpha);\n vec4 color = point_color;\n\n // Discard if not visible\n if (color.a < PRECISION) {\n discard;\n }\n\n // Circular points\n if (circularPoints) {\n float u = 2.0 * gl_PointCoord.x - 1.0;\n float v = 2.0 * gl_PointCoord.y - 1.0;\n float cc = u*u + v*v;\n if(cc > 1.0){\n discard;\n }\n }\n\n vec4 final;\n if (gpuPicker) {\n final = vGPUColor;\n } else {\n final = color;\n }\n\n gl_FragColor = final;\n}\n`;\n\nexport default shader;","const shader = `\nvarying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n`;\n\nexport default shader;","const shader = `\n#include \n#define NEIGHBOUR_COUNT 4\n#define PRECISION 0.0001\n\nuniform sampler2D colorMap;\nuniform sampler2D tDepth;\n\nuniform float opacity;\nuniform float screenWidth;\nuniform float screenHeight;\nuniform float near;\nuniform float far;\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform vec3 lightDir;\nuniform float expScale;\nuniform float edlStrength;\nuniform float radius;\n\nvarying vec2 vUv;\n\nfloat readDepth(sampler2D depthSampler, vec2 coord) {\n float fragCoordZ = texture2D(depthSampler, coord).x;\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, near, far);\n return far * viewZToOrthographicDepth(viewZ, near, far);\n}\n\nfloat ztransform(float linearDepth) {\n return 1.0 - (linearDepth - near) / (far - near);\n}\n\nfloat obscurance(float z, float dist) {\n float value = max(0.0, z) / dist;\n return 0.5 * value;\n}\n\nfloat computeObscurance(float linearDepth) {\n vec4 P = vec4(0, 0, 1, -ztransform(linearDepth));\n vec2 uvRadius = radius / vec2(screenWidth, screenHeight);\n\n float sum = 0.0;\n for (int c = 0; c < NEIGHBOUR_COUNT; c++) {\n vec2 N_rel_pos = uvRadius * neighbours[c];\n vec2 N_abs_pos = vUv + N_rel_pos;\n\n float neighbourDepth = readDepth(tDepth, N_abs_pos);\n if (neighbourDepth != 0.0) {\n float Zn = ztransform(neighbourDepth);\n float Znp = dot(vec4(N_rel_pos, Zn, 1.0), P);\n sum += obscurance(Znp, 0.05 * linearDepth);\n }\n }\n return sum;\n}\n\nvoid main() {\n vec4 color = texture2D(colorMap, vUv);\n float linearDepth = readDepth(tDepth, vUv);\n float f = computeObscurance(linearDepth);\n\n if (color.a <= PRECISION && f <= PRECISION) {\n discard;\n }\n\n f = exp(-expScale * f * edlStrength);\n gl_FragColor = vec4(color.rgb * f, opacity);\n}\n`;\n\nexport default shader;","const shader = `\nvarying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n`;\n\nexport default shader;","const shader = `\nuniform sampler2D colorMap;\nuniform float opacity;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 color = texture2D( colorMap, vUv );\n float new_alpha = min(color.a, opacity);\n gl_FragColor = vec4(color.rgb,new_alpha);\n}\n`;\n\nexport default shader;","const shader = `\nvarying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n`;\n\nexport default shader;","const shader = `\nuniform sampler2D colorMap;\nuniform float brightness;\nuniform float contrast;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tgl_FragColor = texture2D( colorMap, vUv );\n\n\tgl_FragColor.rgb += brightness;\n\n\tif (contrast > 0.0) {\n\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;\n\t}\n\telse {\n\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;\n\t}\n\n}\n`;\n\nexport default shader;","const shader = `\n#define PRECISION 0.0001\n#define MIN_CAMERA_DIST 0.5\n\nattribute float selected;\nattribute int gpu_index;\nattribute int camera_index;\nattribute float visible;\nattribute float marker_shape;\n\nuniform float marker_size;\nuniform vec3 camera_position;\nuniform bool orbitMode;\nuniform vec3 mtrx_x;\nuniform vec3 mtrx_y;\nuniform vec3 mtrx_z;\nuniform float screenHeight;\nuniform int currentIndex;\nuniform float fov;\n\nvarying vec2 vUv;\nvarying float vSelected;\nvarying vec4 vGPUColor;\nvarying float vHidden;\nvarying float vVisible;\nvarying float vMarkerShape;\n\nbool compareFloat(float floatOne, float floatTwo) {\n return abs(floatOne - floatTwo) < PRECISION;\n}\n\nmat3 scaleMatrix(float scale_x,float scale_y,float scale_z){\n return mat3(\n vec3(scale_x, 0.0, 0.0),\n vec3(0.0, scale_y, 0.0),\n vec3(0.0, 0.0, scale_z)\n );\n}\n\nfloat getDistance3D(vec3 offset) {\n float cam_x = offset.x - camera_position.x;\n float cam_y = offset.y - camera_position.y;\n float cam_z = offset.z - camera_position.z;\n float camera_distance_3d = sqrt(cam_x*cam_x + cam_y*cam_y + cam_z*cam_z);\n return camera_distance_3d;\n}\n\nfloat getDistance2D(vec3 offset) {\n float cam_x = offset.x - camera_position.x;\n float cam_y = offset.y - camera_position.y;\n float camera_distance_2d = sqrt(cam_x*cam_x + cam_y*cam_y);\n return camera_distance_2d;\n}\n\nvoid main() {\n vUv = uv;\n vSelected = selected;\n vGPUColor = makeColor(gpu_index);\n vVisible = visible;\n vMarkerShape = marker_shape;\n\n float hidden = 0.0;\n bool isSelected = compareFloat(vSelected, 1.0);\n\n float selected_scale = 0.8;\n if (isSelected) {\n selected_scale = 1.0;\n }\n\n // Global scaling for smaller markers\n selected_scale = 0.5 * selected_scale;\n\n float x = position.x - (uv.x-0.5);\n float y = position.y - (uv.y-0.5);\n float z = position.z;\n vec3 offset = vec3(x,y,z);\n\n float distance3D = getDistance3D(offset);\n float distance2D = getDistance2D(offset);\n float height = abs(offset.z - camera_position.z);\n\n float projFactor = getProjFactor(fov, screenHeight, height);\n float markerSize = 30.0 / projFactor;\n markerSize = max(1.0, markerSize);\n markerSize = min(10.0, markerSize);\n\n float scale_x = markerSize*selected_scale;\n float scale_y = markerSize*selected_scale;\n float scale_z = markerSize*selected_scale;\n\n // Hide marker based on distance\n if (distance3D < MIN_CAMERA_DIST) {\n hidden = 1.0;\n }\n\n // Hide the current camera if we arent in orbit mode\n bool currentCamera = currentIndex == camera_index;\n if ((orbitMode == false) && currentCamera) {\n hidden = 1.0;\n }\n\n // Move position to center of marker\n vec3 pos_offset = position - offset;\n\n // Rotate using camera quaternion matrix\n mat3 rot = mat3(mtrx_x, mtrx_y, mtrx_z);\n vec3 pos_rotated = pos_offset * rot;\n\n // Apply scaling based on selected or not\n mat3 scale_matrix = scaleMatrix(scale_x, scale_y, scale_z);\n vec3 pos_scaled = pos_rotated * scale_matrix;\n\n // Add back our offset values\n vec3 pos_real = pos_scaled + offset;\n\n // Apply final position\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos_real, 1.0);\n\n // We hide the marker for various reasons\n vHidden = hidden;\n}\n`;\n\nexport default shader;","const shader = `\n#define PRECISION 0.0001\n\nuniform bool gpuPicker;\n\nvarying vec2 vUv;\nvarying float vSelected;\nvarying vec4 vGPUColor;\nvarying float vHidden;\nvarying float vVisible;\nvarying float vMarkerShape;\n\nbool compareFloat(float floatOne, float floatTwo) {\n return abs(floatOne - floatTwo) < PRECISION;\n}\n\nvoid main() {\n vec2 uv = vUv;\n uv = 2.0 * uv - 1.0;\n\n bool isHidden = compareFloat(vHidden, 1.0);\n bool isSelected = compareFloat(vSelected, 1.0);\n bool isVisible = compareFloat(vVisible, 1.0);\n bool isCircle = compareFloat(vMarkerShape, 0.0);\n bool isSquare = compareFloat(vMarkerShape, 1.0);\n\n if (isHidden) {\n discard;\n }\n\n if (!isVisible) {\n discard;\n }\n\n // All markers are gray-ish\n vec4 colorStandard = vec4(255, 255, 255, 255) / 255.0;\n vec4 colorSelected = vec4(255, 195, 0, 255) / 255.0;\n float border_thickness = 0.1;\n\n vec4 final;\n if (gpuPicker) {\n final = vGPUColor;\n } else {\n if (isSelected) {\n final = colorSelected;\n }\n else {\n final = colorStandard;\n }\n }\n\n // Circular markers\n if (isCircle) {\n // Circle shape\n float circle = sqrt(uv.x * uv.x + uv.y * uv.y);\n float circle_bounds = 1.0;\n if (circle > circle_bounds){\n discard;\n }\n\n if (!gpuPicker) {\n // Black outline\n float edge = circle_bounds - border_thickness;\n if ((circle <= circle_bounds) && (circle > edge)){\n final.rgb = vec3(0.0, 0.0, 0.0);\n }\n }\n }\n\n // Square with rounded corners\n if (isSquare) {\n float circle = sqrt(uv.x * uv.x + uv.y * uv.y);\n float circle_bounds = sqrt(2.0) * 0.95;\n if (circle > circle_bounds){\n discard;\n }\n\n if (!gpuPicker) {\n // Black outline\n float edge1 = circle_bounds - border_thickness;\n float edge2 = 1.0 - border_thickness;\n if ((circle > edge1) || (abs(uv.x) > edge2) || (abs(uv.y) > edge2)) {\n final.rgb = vec3(0.0, 0.0, 0.0);\n }\n }\n }\n\n if (!gpuPicker) {\n if (final.a < PRECISION) {\n discard;\n }\n final.a = 1.0;\n }\n\n gl_FragColor = final;\n}\n`;\n\nexport default shader;","const shader = `\nfloat getProjFactor(float fov, float screenHeight, float distance) {\n float projFactor = 1.0 / tan(fov / 2.0);\n projFactor /= distance;\n projFactor *= screenHeight / 2.0;\n return projFactor;\n}\n`;\n\nexport default shader;","const shader = `\n#define FLOAT_OFFSET 0.25\n\nvec4 makeColor(int index) {\n vec4 color = vec4(\n float(index >> 24 & 255),\n float(index >> 16 & 255),\n float(index >> 8 & 255),\n float(index & 255)\n );\n\n return (color + FLOAT_OFFSET) / 255.0;\n}\n`;\n\nexport default shader;","import awesomeGreen from './awesome-green.png';\nimport blackOrange from './black-orange.png';\nimport blueHue from './blue-hue.png';\nimport blueOrange from './blue-orange.png';\nimport blueRed from './blue-red.png';\nimport grayScale from './grayscale.png';\nimport heatMap from './heat-map.png';\nimport jet from './jet.png';\nimport pastelShades from './pastel-shades.png';\nimport {ColorMapKey} from \"../../../redux/settings-slice\";\n\ninterface ColorMap {\n id: ColorMapKey;\n name: string;\n image: string;\n}\n\nexport const colorMaps: ColorMap[] = [\n {\n id: 'heat-map',\n name: 'Heat Map',\n image: heatMap\n },\n {\n id: 'awesome-green',\n name: 'Green',\n image: awesomeGreen\n },\n {\n id: 'pastel-shades',\n name: 'Pastel',\n image: pastelShades\n },\n {\n id: 'blue-orange',\n name: 'Blue/Orange',\n image: blueOrange\n },\n {\n id: 'black-orange',\n name: 'Black/Orange',\n image: blackOrange\n },\n {\n id: 'blue-hue',\n name: 'Blue',\n image: blueHue\n },\n {\n id: 'blue-red',\n name: 'Blue/Red',\n image: blueRed\n },\n {\n id: 'jet',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UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MUNCMUMxNzg5QTY2MTFFM0E4RjRGOTk3QjEzNDczRDkiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5cZSRIAAAARElEQVR42mJkYPjPyPCfgYEBK4mLi8zAw8bk4hGkOmJi+Ee8OJog2VzS2UDyH1WMopBLRqBRHRGTWggmPPxJF40ECDAA7VjoAcudFgkAAAAASUVORK5CYII=\"","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAABCAIAAAC+O+cgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACpSURBVDhPfY0JDoMwEAPdcj28r+YIdMCwCqGpZFmDYy8v6SN1UiO1DxHyZED9BWZyv4bIi6TVu3JjOPze3UVY9J9hbRsq+v4pn3ENp2AoRBjbDlsaJTRobA/uNBtw2FAorwFRy7eh2pEYol6TwfnPPqHvo7O/rUrSpN1zWKT5gkKE41Vz3yF9A17bxhAVP+UV/3MkajFMWtOJruPw84YXsbvfuOX5dpf0BQz6ooH2nDFQAAAAAElFTkSuQmCC\"","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAABCAYAAAAxWXB3AAAAMElEQVQ4T2NkYGD4z8TExAACo/TAhAMjIyMDCMPCf6jwYe6khIalO5gZQ5U/VPMPAPmjA/6Q8LQDAAAAAElFTkSuQmCC\"","import classificationsShader from \"./viewer/textures/colormaps/classifications.png\";\n\nexport interface Classification {\n id: number;\n name: string;\n}\n\nconst numberOfDefinedClassifications = 19;\nexport const numberOfClassifications = 256;\n\nexport const classifications = [\n {\n id: 0,\n name: \"Never Classified\"\n },\n {\n id: 1,\n name: \"Unassigned\"\n },\n {\n id: 2,\n name: \"Ground\"\n },\n {\n id: 3,\n name: \"Low Vegetation\"\n },\n {\n id: 4,\n name: \"Medium Vegetation\"\n },\n {\n id: 5,\n name: \"High Vegetation\"\n },\n {\n id: 6,\n name: \"Building\"\n },\n {\n id: 7,\n name: \"Noise\"\n },\n {\n id: 8,\n name: 'Model Key/Reserved'\n },\n {\n id: 9,\n name: \"Water\"\n },\n {\n id: 10,\n name: \"Rail\"\n },\n {\n id: 11,\n name: \"Road Surface\"\n },\n {\n id: 12,\n name: 'Overlap/Reserved'\n },\n {\n id: 13,\n name: \"Wire - Guard\"\n },\n {\n id: 14,\n name: \"Wire - Conductor\"\n },\n {\n id: 15,\n name: \"Transmission Tower\"\n },\n {\n id: 16,\n name: \"Wire - Connector\"\n },\n {\n id: 17,\n name: \"Bridge Deck\"\n },\n {\n id: 18,\n name: \"High Noise\"\n },\n ...Array.from(Array(numberOfClassifications - numberOfDefinedClassifications).keys()).map(key => ({id: key + numberOfDefinedClassifications, name: 'Reserved'}))\n];\n\nexport const getClassificationColors = (): Promise => {\n return new Promise(resolve => {\n const image = new Image();\n\n image.onload = () => {\n const canvas = document.createElement('canvas');\n canvas.width = image.width;\n canvas.height = image.height;\n\n const context = canvas.getContext('2d');\n context.drawImage(image, 0, 0);\n\n const imageData = context.getImageData(0, 0, canvas.width, canvas.height);\n let colors = [];\n\n for (let i = 0; i < classifications.length; i++) {\n let index = i * 4;\n\n let red = imageData.data[index] << 16;\n let green = imageData.data[index + 1] << 8;\n let blue = imageData.data[index + 2];\n\n const hexColor = `#${(red + blue + green).toString(16).padStart(6, '0')}`;\n colors.push(hexColor);\n }\n\n resolve(colors);\n };\n\n image.src = classificationsShader;\n });\n};","import {classificationTexture} from './classifications';\nimport shaders from './shaders';\nimport {colorMaps} from '../textures/colormaps';\nimport {Viewer} from \"./main\";\nimport {\n Color, DataTexture, NearestFilter, DoubleSide,\n RGBAFormat, RGBFormat, ShaderMaterial,\n Uniform, Vector2, Vector3, TextureLoader\n} from \"three\";\nimport {numberOfClassifications} from \"../../classifications\";\n\nexport class BaseMaterial extends ShaderMaterial {\n initProperties() {\n let keys = Object.keys(this.uniforms);\n keys.forEach(key => {\n this.defineProperty(key);\n });\n }\n\n defineProperty(key) {\n Object.defineProperty(this, key, {\n get: () => {\n return (this.uniforms[key].value);\n },\n set: value => {\n this.uniforms[key].value = value;\n }\n });\n }\n}\n\nconst generateDataTexture = (width: number, height: number, channels, color: Color = new Color(0xffffff)) => {\n let size = width * height;\n let data = new Uint8Array(channels * width * height);\n\n let r = Math.floor(color.r * 255);\n let g = Math.floor(color.g * 255);\n let b = Math.floor(color.b * 255);\n\n for (let i = 0; i < size; i++) {\n data[i * channels] = r;\n data[i * channels + 1] = g;\n data[i * channels + 2] = b;\n\n if (channels === 4) {\n data[i * channels + 3] = 255;\n }\n }\n\n let format = channels === 3 ? RGBFormat : RGBAFormat;\n let texture = new DataTexture(data, width, height, format);\n texture.minFilter = NearestFilter;\n texture.magFilter = NearestFilter;\n texture.needsUpdate = true;\n\n return texture;\n};\n\nexport interface PointCloudMaterialParams {\n minSize: number\n maxSize: number\n heightClamp: Vector2\n intensityClamp: Vector2\n dynamicSize: boolean\n circularPoints: boolean\n colorType: number\n distance: any\n size: number\n colorMap: string\n classification: object\n}\n\nexport class PointCloudMaterial extends BaseMaterial {\n public size;\n public distance;\n public color_map;\n public color_type;\n public dynamic_size;\n public circularPoints;\n public visibleNodesTexture: any;\n public dynamic_cloud: boolean;\n public origin: any;\n public screenHeight: number;\n public screenwidth: number;\n public fov: number;\n public octree_spacing: any;\n public octree_size: number;\n public octree_corner: Vector3;\n public intensity_range: Vector2;\n public rgb_max: number;\n public height_range: Vector2;\n\n constructor(viewer: Viewer, params: PointCloudMaterialParams, gpuPicker) {\n super();\n\n // Node depth texture for dynamic sizing\n this.visibleNodesTexture = generateDataTexture(2048, 1, 3);\n\n // Load colormap texture\n const loader = new TextureLoader();\n const colorMapTexture = loader.load(colorMaps.find(colorMap => colorMap.id === params.colorMap).image);\n\n // Generate classification visibility array\n const classificationVisible = new Array(numberOfClassifications).fill(true);\n classificationTexture.minFilter = NearestFilter;\n classificationTexture.magFilter = NearestFilter;\n\n // Initialize area data\n const maxTriangles = 256;\n let maxAreaTriangles = maxTriangles;\n let maxAreaVertices = maxTriangles * 3;\n let areaClipData = new Float32Array(maxAreaTriangles * 3 * 3).fill(0.0);\n let volumeStatus = new Float32Array(maxAreaTriangles).fill(0.0);\n\n let uniforms = {\n gpuPicker: new Uniform(gpuPicker),\n circularPoints: new Uniform(params.circularPoints),\n \"depth\": new Uniform(1.0),\n \"sphere\": new Uniform(viewer.camera.position),\n \"origin\": new Uniform(viewer.camera.position),\n \"size\": new Uniform(params.size),\n \"size_min\": new Uniform(params.minSize),\n \"size_max\": new Uniform(params.maxSize),\n \"fov\": new Uniform(viewer.camera.fov * Math.PI / 180.0),\n \"screenHeight\": new Uniform(viewer.height),\n \"screenwidth\": new Uniform(viewer.width),\n \"distance\": new Uniform(params.distance),\n \"octree_size\": new Uniform(0.0),\n \"octree_spacing\": new Uniform(0.0),\n \"octree_corner\": new Uniform(viewer.camera.position),\n \"color_type\": new Uniform(params.colorType),\n \"height_range\": new Uniform(new Vector2(0, 1)),\n \"height_clamp\": new Uniform(params.heightClamp),\n \"intensity_range\": new Uniform(new Vector2(0, 1)),\n \"intensity_clamp\": new Uniform(params.intensityClamp),\n \"rgb_max\": new Uniform(0),\n \"color_map\": new Uniform(colorMapTexture),\n \"dynamic_size\": new Uniform(params.dynamicSize),\n \"dynamic_cloud\": new Uniform(false),\n \"classification_data\": new Uniform(classificationTexture),\n \"classification_visible\": new Uniform(classificationVisible),\n \"visible_nodes\": new Uniform(this.visibleNodesTexture),\n \"volume_status\": new Uniform(volumeStatus),\n \"max_triangles\": new Uniform(maxTriangles),\n \"area_measure_data\": new Uniform(areaClipData)\n };\n\n let defines = [\n `#define NUMBER_OF_CLASSIFICATIONS ${numberOfClassifications}`,\n `#define AREA_TRIANGLES_TOTAL ${maxAreaTriangles}`,\n `#define AREA_VERTICES_TOTAL ${maxAreaVertices}`\n ].join(\"\\n\");\n\n let fragmentShader = shaders.pointcloud.frag;\n\n let vertexShader = [\n defines,\n shaders.gpu_picker.frag,\n shaders.utilities.vert,\n shaders.pointcloud.vert\n ].join(\"\\n\");\n\n this.setValues({\n uniforms: uniforms,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n vertexColors: true,\n transparent: true,\n depthWrite: true\n });\n\n this.initProperties();\n }\n}\n\nexport class EDLMaterial extends BaseMaterial {\n public screenWidth: any;\n public screenHeight: any;\n public edlStrength: any;\n\n constructor(parent) {\n super();\n\n let vertexShader = shaders.edl.vert;\n let fragmentShader = shaders.edl.frag;\n\n let neighbourCount = 4;\n let neighbours = new Float32Array(neighbourCount * 2);\n for (let c = 0; c < neighbourCount; c++) {\n neighbours[2 * c] = Math.cos(2 * c * Math.PI / neighbourCount);\n neighbours[2 * c + 1] = Math.sin(2 * c * Math.PI / neighbourCount);\n }\n\n let lightDir = new Vector3(0.0, 0.0, 1.0).normalize();\n let uniform = {\n screenWidth: {type: \"f\", value: parent.WIDTH},\n screenHeight: {type: \"f\", value: parent.HEIGHT},\n near: {type: \"f\", value: parent.camera.near},\n far: {type: \"f\", value: parent.camera.far},\n opacity: {type: \"f\", value: 1.0},\n expScale: {type: \"f\", value: parent.camera.far},\n edlStrength: {type: \"f\", value: 1.0},\n radius: {type: \"f\", value: 1.0},\n lightDir: {type: \"v3\", value: lightDir},\n neighbours: {type: \"2fv\", value: neighbours},\n colorMap: {type: \"t\", value: null},\n tDepth: {type: \"t\", value: null}\n };\n\n this.setValues({\n uniforms: uniform,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n transparent: true\n });\n\n this.initProperties();\n }\n}\n\nexport class OpacityMaterial extends BaseMaterial {\n constructor() {\n super();\n\n let vertexShader = shaders.opacity.vert;\n let fragmentShader = shaders.opacity.frag;\n\n let uniform = {\n \"colorMap\": {type: \"t\", value: null},\n \"opacity\": {type: \"f\", value: 1.0}\n };\n\n this.setValues({\n uniforms: uniform,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n transparent: true\n });\n\n this.initProperties();\n }\n}\n\nexport class ImageMaterial extends BaseMaterial {\n constructor() {\n super();\n\n let vertexShader = shaders.image.vert;\n let fragmentShader = shaders.image.frag;\n\n let uniform = {\n \"colorMap\": {\n type: \"t\",\n value: null\n },\n \"brightness\": {\n type: \"f\",\n value: 0\n },\n \"contrast\": {\n type: \"f\",\n value: 0\n }\n };\n\n this.setValues({\n uniforms: uniform,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n side: DoubleSide\n });\n\n this.initProperties();\n }\n}\n\nexport class MarkerMaterial extends BaseMaterial {\n constructor(viewer: Viewer, gpuPicker) {\n super();\n\n let fragmentShader = shaders.markers.frag;\n\n let vertexShader = [\n shaders.gpu_picker.frag,\n shaders.utilities.vert,\n shaders.markers.vert\n ].join(\"\\n\");\n\n let uniform = {\n gpuPicker: new Uniform(gpuPicker),\n orbitMode: new Uniform(false),\n camera_position: new Uniform(new Vector3(0, 1, 0)),\n mtrx_x: new Uniform(new Vector3(1, 0, 0)),\n mtrx_y: new Uniform(new Vector3(0, 1, 0)),\n mtrx_z: new Uniform(new Vector3(0, 0, 1)),\n marker_size: new Uniform(1.0),\n fov: new Uniform(viewer.camera.fov * Math.PI / 180.0),\n screenHeight: new Uniform(viewer.height),\n currentIndex: new Uniform(0)\n };\n\n this.setValues({\n uniforms: uniform,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n side: DoubleSide\n });\n\n this.initProperties();\n }\n}","import { PointCloud } from \"./point-cloud\";\nimport {\n BufferAttribute,\n BufferGeometry,\n LineSegments,\n Points,\n Sphere,\n Vector3\n} from \"three\";\n\nexport class CloudNode {\n protected cloud: PointCloud;\n public name = null;\n public parent: CloudNode;\n public pointsScene: Points = null;\n public pointsPicker: Points = null;\n protected boundingBox: LineSegments = null;\n protected loaded: boolean;\n protected loading: boolean;\n protected size: any;\n protected sizeTight = new Vector3();\n protected data = null;\n protected _center = null;\n protected _sphere = null;\n public visible = false;\n protected numPoints = null;\n protected geometry = null;\n protected tightBoundingBox = null;\n\n constructor() {\n this.loaded = false;\n this.loading = false;\n }\n\n /** Return bounding sphere in viewer coordinates */\n get boundingSphere() {\n if (this._sphere === null) {\n this._sphere = new Sphere(this.center, this.radius);\n }\n\n return this._sphere;\n }\n\n get shift() {\n return new Vector3();\n }\n\n /** Return node center in viewer coordinates */\n get center() {\n return new Vector3().add(this._center).add(this.shift);\n }\n\n /** Return bounding sphere radius */\n get radius() {\n return Math.sqrt(3) * this.size / 2.0;\n }\n\n isLoaded() {\n return this.loaded;\n }\n\n isGeometryNode() {\n return this.pointsScene === null;\n }\n\n isTreeNode() {\n return this.pointsScene !== null;\n }\n\n removeFromScene(item) {\n if (!item) {\n return;\n }\n\n let index = this.cloud.scene.children.indexOf(item);\n let loaded = index !== -1;\n if (loaded) {\n this.cloud.scene.remove(item);\n }\n }\n\n disposeGeometry(item) {\n if (!item) {\n return;\n }\n\n item.geometry.dispose();\n item.material.dispose();\n }\n\n dispose() {\n this.removeFromScene(this.pointsScene);\n this.disposeGeometry(this.pointsScene);\n this.pointsScene = null;\n\n this.cloud.picker.remove(this.pointsPicker);\n this.disposeGeometry(this.pointsPicker);\n this.pointsPicker = null;\n\n if (this.boundingBox) {\n this.removeFromScene(this.boundingBox);\n this.disposeGeometry(this.boundingBox);\n this.boundingBox = null;\n }\n\n if (this.geometry) {\n this.geometry.dispose();\n }\n this.geometry = null;\n\n this.loaded = false;\n this.loading = false;\n\n // console.log(`Dispose node: ${this.name}`);\n }\n\n setVisibility(visible, boundingBoxVisibility) {\n if (this.pointsPicker) {\n this.pointsPicker.visible = visible;\n }\n\n if (this.pointsScene) {\n this.pointsScene.visible = visible;\n }\n\n if (this.boundingBox) {\n this.boundingBox.visible = boundingBoxVisibility;\n }\n\n this.visible = visible;\n }\n\n setGeometry(data) {\n let geometry = new BufferGeometry();\n geometry.setAttribute('position', new BufferAttribute(data.positions, 3));\n geometry.setAttribute('intensity', new BufferAttribute(data.intensity, 1));\n geometry.setAttribute('classification', new BufferAttribute(data.classification, 1));\n geometry.setAttribute('rgb', new BufferAttribute(data.colors, 3));\n geometry.setAttribute('gpu_index', new BufferAttribute(data.gpu_index, 1));\n geometry.computeBoundingBox();\n this.geometry = geometry;\n }\n\n addCloudData(pointsPicker, pointsScene, boundingBox) {\n // Add our global shift to line up with previous data\n pointsScene.position.copy(this.shift);\n pointsPicker.position.copy(this.shift);\n\n // Add our new objects\n this.pointsPicker = pointsPicker;\n this.pointsScene = pointsScene;\n\n this.cloud.scene.add(this.pointsScene);\n this.cloud.picker.add(this.pointsPicker);\n\n if (boundingBox) {\n // Bounding box is for dev mode only\n boundingBox.position.copy(this.center);\n this.boundingBox = boundingBox;\n this.cloud.scene.add(this.boundingBox);\n }\n }\n}","import {CloudNode} from \"./cloud-node\";\nimport LocalScene from '../projections';\nimport { RawPointCloud } from '.';\nimport {\n LineSegments,\n Points,\n Vector3\n} from 'three';\n\nexport class RawPointCloudNode extends CloudNode {\n protected cloud: RawPointCloud;\n public parent: RawPointCloudRootNode;\n protected children = [];\n\n constructor(cloud: RawPointCloud, parent = null) {\n super();\n\n this.cloud = cloud;\n this.parent = parent;\n }\n\n loadFromData(data) {\n this.data = data;\n\n this.numPoints = data.numPoints;\n this.tightBoundingBox = {\n min: data.xyz_min,\n max: data.xyz_max\n };\n\n // Calculate bounding box size\n let size: any = new Vector3()\n .add(data.xyz_max)\n .sub(data.xyz_min);\n\n // Calculate bounding box center\n let center = new Vector3()\n .add(data.xyz_min)\n .add(data.xyz_max)\n .divideScalar(2.0)\n .sub(data.offset);\n\n this.sizeTight.copy(size);\n this.size = Math.max(size.x, size.y, size.z);\n this._center = center;\n\n // Safe to add to parent's child list now\n this.parent.addChildNode(this);\n\n // Update root node info\n LocalScene.offsetToScene(this.data.offset);\n this.cloud.updateBoundingBox(this.tightBoundingBox);\n this.cloud.updateRootNode();\n }\n\n get shift() {\n return LocalScene.offsetToScene(this.data.offset);\n }\n\n getGeometry(data) {\n this.setGeometry(data);\n\n // Update unique values and min/max values\n this.cloud.updateClassifications(data.classification);\n this.cloud.updateColorLimits(data.rgb_max);\n this.cloud.updateIntensityRange(data.intensity_min, data.intensity_max);\n }\n\n addToScene() {\n // Create the pointcloud\n let pointsScene = new Points(this.geometry,\n this.cloud.materialScene);\n let pointsPicker = new Points(this.geometry,\n this.cloud.materialPicker);\n\n // Create bounding box object;\n let boundingBox = this.cloud.generateEdgeMesh(\n this.sizeTight.x, this.sizeTight.y, this.sizeTight.z);\n\n this.addCloudData(pointsPicker, pointsScene, boundingBox);\n }\n\n load() {\n if ((this.loaded) || (this.loading)) {\n return;\n }\n\n this.getGeometry(this.data);\n this.loaded = true;\n this.loading = false;\n }\n}\n\n/* Placeholder root node to handle our required format */\nexport class RawPointCloudRootNode extends RawPointCloudNode {\n constructor(cloud) {\n super(cloud);\n\n this.numPoints = 0;\n this.boundingBox = new LineSegments();\n this._center = new Vector3();\n this.size = 0;\n }\n\n get center() {\n return this._center;\n }\n\n /** Function override */\n dispose() {\n this.pointsScene = null;\n this.pointsPicker = null;\n this.boundingBox = null;\n }\n\n updateSizeInfo(data) {\n // Calculate bounding box size\n let size: any = new Vector3()\n .add(data.max)\n .sub(data.min);\n this.size = Math.max(size.x, size.y, size.z);\n\n // Calculate bounding box center\n let center = new Vector3()\n .add(data.min)\n .add(data.max)\n .divideScalar(2.0);\n\n this._center = center;\n\n // Reset our sphere to null (so we re-calculate next time)\n this._sphere = null;\n }\n\n getGeometry() {\n return;\n }\n\n addChildNode(node) {\n this.children.push(node);\n }\n\n addToScene() {\n this.pointsScene = new Points();\n this.pointsPicker = new Points();\n }\n}\n","import {BufferAttribute, BufferGeometry, LineBasicMaterial, LineSegments, Vector3} from 'three';\nimport { isDevMode } from '../../../electron-modules';\nimport { PointCloudMaterial } from '../materials';\nimport {closestPowerOfTwo, randomHexColor} from \"../misc\";\nimport { CloudNode } from './cloud-node';\nimport {PointCloudManager} from \"./point-loader\";\nimport { RawPointCloudRootNode } from './raw-pointcloud-node';\n\nexport class PointCloud {\n public uniqueClassifications: Set;\n private readonly rgbArray: any = [];\n public maxColor: any = null;\n public intensityRange: any = null;\n private name: any = null;\n public identifier: any = null;\n private empty: boolean = false;\n public fileMissing: boolean = false;\n protected enabled: boolean = true;\n public visible: boolean = true;\n public materialScene: PointCloudMaterial = null;\n public materialPicker: PointCloudMaterial = null;\n public materials: PointCloudMaterial[];\n public root: any = null;\n protected pointclouds: PointCloudManager;\n protected _tightBoundingBox: any = null;\n public debugBoxColor = randomHexColor();\n\n constructor(pointclouds) {\n this.pointclouds = pointclouds;\n this.uniqueClassifications = new Set();\n\n this.materialScene = new PointCloudMaterial(this.viewer,\n this.pointclouds.materialDefaults, false);\n\n this.materialPicker = new PointCloudMaterial(this.viewer,\n this.pointclouds.materialDefaults, true);\n\n this.materials = [\n this.materialScene,\n this.materialPicker\n ];\n }\n\n get shift() {\n return new Vector3();\n }\n\n get size() {\n return 0;\n }\n\n get viewer() {\n return this.pointclouds.viewer;\n }\n\n get scene() {\n return this.pointclouds.scene;\n }\n\n get picker() {\n return this.viewer.gpuPickers.points;\n }\n\n /** Get bounding box with global shift applied */\n get tightBoundingBox() {\n if (this._tightBoundingBox === null) {\n return this._tightBoundingBox;\n }\n\n let boundingBox = {\n min: new Vector3().add(this._tightBoundingBox.min).add(this.shift),\n max: new Vector3().add(this._tightBoundingBox.max).add(this.shift)\n };\n\n return boundingBox;\n }\n\n setName(name) {\n this.name = name;\n }\n\n setState(state) {\n this.enabled = state;\n }\n\n setVisibility(visible) {\n const changed = this.visible !== visible;\n this.visible = visible;\n if (changed) {\n this.pointclouds.updateMinimapExtent();\n }\n }\n\n setEmpty(state) {\n this.empty = state;\n }\n\n setIdentifier(identifier) {\n // console.log(`Added pointcloud [id = ${identifier}]`);\n identifier = identifier === undefined ? null : identifier;\n this.identifier = identifier;\n }\n\n /** @private */\n destroyWorker() {\n console.warn(\"Not implemented\");\n }\n\n dispose() {\n let nodes = this.getVisibleNodes();\n this.setState(false);\n nodes.forEach(node => {\n node.visible = false;\n node.dispose();\n });\n\n this.destroyWorker();\n }\n\n getVisibleNodes(nodeCondition = null) : CloudNode[] {\n let visibleNodes = [];\n if (!this.root) {\n return visibleNodes;\n }\n\n let stack = [this.root];\n while (stack.length > 0) {\n let object = stack.shift();\n if (!object.visible) {\n continue;\n }\n\n if (nodeCondition) {\n if (nodeCondition(object) === false) {\n continue;\n }\n }\n\n if ((object instanceof RawPointCloudRootNode) === false) {\n visibleNodes.push(object);\n }\n\n object.children.forEach(child => {\n stack.push(child);\n });\n }\n\n return visibleNodes;\n }\n\n updateBoundingBox(boundingBox) {\n let combined = mergeBoundingBoxes(this._tightBoundingBox, boundingBox);\n this._tightBoundingBox = combined;\n }\n\n updateIntensityRange(intensityMin, intensityMax) {\n if (this.intensityRange === null) {\n this.intensityRange = {\n min: intensityMin,\n max: intensityMax\n };\n }\n\n this.intensityRange.min = Math.min(intensityMin, this.intensityRange.min);\n this.intensityRange.max = Math.max(intensityMax, this.intensityRange.max);\n }\n\n updateColorLimits(rgbMax) {\n let closestValue = closestPowerOfTwo(rgbMax);\n this.rgbArray.push(closestValue);\n this.rgbArray.sort();\n\n let arrMax = Math.max(...this.rgbArray);\n let arrMin = Math.min(...this.rgbArray);\n let diff = arrMax - arrMin;\n if (diff === 0) {\n this.maxColor = arrMax;\n return;\n }\n\n // Grab the middle value instead\n let midpoint = this.rgbArray.length / 2.0;\n midpoint = Math.ceil(midpoint);\n this.maxColor = this.rgbArray[midpoint];\n }\n\n updateClassifications(classification) {\n classification = new Set(classification);\n classification.forEach(item => {\n this.uniqueClassifications.add(item);\n });\n }\n\n generateEdgeMesh = (sizeX, sizeY, sizeZ) => {\n if (!isDevMode) {\n // Only generated in developer mode\n return null;\n }\n\n let vertexArray = [\n -0.5, 0.5, -0.5,\n -0.5, 0.5, 0.5,\n 0.5, 0.5, 0.5,\n 0.5, 0.5, -0.5,\n -0.5, -0.5, 0.5,\n -0.5, -0.5, -0.5,\n 0.5, -0.5, -0.5,\n 0.5, -0.5, 0.5,\n -0.5, 0.5, 0.5,\n -0.5, -0.5, 0.5,\n 0.5, 0.5, 0.5,\n -0.5, 0.5, 0.5,\n -0.5, -0.5, 0.5,\n 0.5, -0.5, 0.5,\n 0.5, -0.5, 0.5,\n 0.5, 0.5, 0.5,\n 0.5, 0.5, -0.5,\n 0.5, -0.5, -0.5,\n -0.5, 0.5, -0.5,\n 0.5, 0.5, -0.5,\n 0.5, -0.5, -0.5,\n -0.5, -0.5, -0.5,\n -0.5, -0.5, -0.5,\n -0.5, 0.5, -0.5\n ];\n\n const edgeVertices = new Float32Array(vertexArray.length);\n vertexArray.forEach((v,index) => {\n let scale;\n switch(index % 3) {\n case 0:\n scale = sizeX;\n break;\n case 1:\n scale = sizeY;\n break;\n case 2:\n scale = sizeZ;\n break;\n default:\n scale = 1.0;\n }\n\n edgeVertices[index] = v * scale;\n });\n\n const boxGeometry = new BufferGeometry();\n boxGeometry.setAttribute('position',\n new BufferAttribute(edgeVertices, 3));\n boxGeometry.center();\n\n let boxMaterial = new LineBasicMaterial({color: this.debugBoxColor});\n let boundingBox = new LineSegments(boxGeometry, boxMaterial);\n\n boundingBox.visible = false;\n\n return boundingBox;\n }\n}\n\nexport const mergeBoundingBoxes = (combined, current) => {\n if (!current) {\n return combined;\n }\n\n if (combined === null) {\n combined = {\n min: current.min.clone(),\n max: current.max.clone()\n };\n } else {\n combined = {\n min: new Vector3(\n Math.min(combined.min.x, current.min.x),\n Math.min(combined.min.y, current.min.y),\n Math.min(combined.min.z, current.min.z)\n ),\n max: new Vector3(\n Math.max(combined.max.x, current.max.x),\n Math.max(combined.max.y, current.max.y),\n Math.max(combined.max.z, current.max.z)\n )\n };\n }\n\n return combined;\n};","import {PointCloud} from './point-cloud';\nimport {RawPointCloudRootNode, RawPointCloudNode} from './raw-pointcloud-node';\nimport LocalScene from '../projections';\nimport { PythonExecutable } from '../../../executable';\nimport { Vector3 } from 'three';\n\nexport class RawPointCloud extends PointCloud {\n private workerExe: PythonExecutable;\n\n private file: any = null;\n private header: any = null;\n public loaded: any = false;\n private loading: boolean;\n private loadStart: any;\n private timeEnd: any;\n private byteCutoffSize = 10 * 1024**3;\n private pointsDataParsed = 0;\n private pointsDataArray = [];\n private numSampledPoints = 5 * 1000000;\n private minNumNodes = 100;\n private minPointSize;\n public generatingChunks: Boolean = false;\n public canReadData: Boolean = false;\n public percent;\n\n constructor(pointclouds) {\n super(pointclouds);\n\n this.minPointSize = Math.floor(this.numSampledPoints/this.minNumNodes);\n this.workerExe = new PythonExecutable();\n }\n\n get shift() {\n return LocalScene.origin;\n }\n\n get size() {\n return Math.max.apply(null, this.header.size);\n }\n\n /** Get bounding box with global shift applied */\n get tightBoundingBox() {\n let box = this._tightBoundingBox;\n if (box === null) {\n return box;\n }\n\n let boundingBox = {\n min: new Vector3().add(box.min).sub(this.shift),\n max: new Vector3().add(box.max).sub(this.shift)\n };\n\n return boundingBox;\n }\n\n /** Get estimated bounding box using header information */\n get estimatedBoundingBox() {\n return {\n max: new Vector3(...this.header.maxs).sub(this.shift),\n min: new Vector3(...this.header.mins).sub(this.shift)\n };\n }\n\n get isRemoteFile() {\n return this.file.remote;\n }\n\n get fromJSON() {\n return this.file.fromJSON;\n }\n\n get isLargeFile() {\n let isLargeFile = this.header\n ? this.header.number_of_bytes > this.byteCutoffSize\n : false;\n\n return isLargeFile;\n }\n\n /** @private */\n destroyWorker() {\n this.workerExe.destroy();\n }\n\n fileLoadStart() {\n this.loading = true;\n this.loaded = false;\n this.updatePercent(0);\n }\n\n fileLoadFinish() {\n this.loading = false;\n this.loaded = true;\n this.timeEnd = performance.now();\n this.updatePercent(100);\n const elapsed = (this.timeEnd - this.loadStart) / 1000;\n console.log(`Point cloud loaded: ${this.file.name}. ${elapsed.toFixed(2)}s`);\n }\n\n fileLoadCancel() {\n this.loading = false;\n this.loaded = false;\n }\n\n fileLoadProgress() {\n let maxDataChunks = this.header.number_of_chunks;\n let percent = this.pointsDataParsed / maxDataChunks;\n percent = Math.round(percent * 1000) / 10.0;\n percent = Math.min(100, percent);\n this.updatePercent(percent);\n }\n\n updatePercent(percent) {\n this.percent = percent;\n }\n\n updateRootNode() {\n this.root.updateSizeInfo(this.tightBoundingBox);\n }\n\n loadFile(file) {\n this.file = file;\n\n this.pointsDataParsed = 0;\n this.pointsDataArray = [];\n this.canReadData = true;\n\n // Add pointcloud and set parameters\n this.pointclouds.addPointCloud(this);\n this.setIdentifier(file.identifier);\n this.setVisibility(file.visible);\n\n this.fileLoadStart();\n }\n\n fileLoadFinished(success) {\n if (success) {\n this.fileLoadFinish();\n } else {\n this.fileLoadCancel();\n }\n }\n\n launchExecutable() {\n this.loadStart = performance.now();\n this.generatingChunks = true;\n\n const lasFilePath = this.file.path;\n const projectionsUnits = LocalScene.dataProjectionUnits;\n\n let isValid = false;\n let commands = [\n \"-p\", \"convert_engine_las\",\n \"--input_file\", lasFilePath,\n \"--units\", projectionsUnits,\n \"--min_chunk_size\", this.minPointSize,\n \"--max_points\", this.numSampledPoints\n ];\n\n this.workerExe.run({\n command: commands,\n parseJSON: false,\n onData: (buffer, keyword) => {\n const callback = response => {\n let {type, data} = response;\n if (type === \"header\") {\n this.parseHeaderResponse(data);\n } else if (type === \"points\") {\n this.parsePointsResponse(data);\n }\n };\n\n // Decode buffer data asynchronously\n let payload = {buffer: buffer.buffer, keyword};\n this.pointclouds.pushToWorkerQueue(payload, callback);\n\n isValid = true;\n },\n onClose: () => {\n if (isValid) {\n return;\n }\n\n console.error(`Error loading point cloud: ${this.file.path}`);\n this.viewer.showMessage(`Error loading point cloud: ${this.file.name}`, {\n variant: \"error\"\n });\n this.fileMissing = true;\n this.fileLoadFinished(true);\n }\n });\n }\n\n parseHeaderResponse(data) {\n this.header = data;\n this.root = new RawPointCloudRootNode(this);\n\n if (!this.isLargeFile) {\n return;\n }\n\n console.warn(`Loading large point cloud: ${this.file.path}`);\n this.viewer.showMessage(`Large point cloud file detected: ${this.file.name}`, {\n variant: \"warning\"\n });\n }\n\n parsePointsResponse(data) {\n this.pointsDataArray.push(data);\n }\n\n parseAvailableChunks() {\n if (!this.enabled) {\n return;\n }\n\n if (this.pointsDataArray.length === 0) {\n return;\n }\n\n const maxDataChunks = this.header?.number_of_chunks;\n const isLastChunk = (this.pointsDataParsed + 1) === maxDataChunks;\n const data = this.pointsDataArray.shift();\n this.pointsDataParsed += 1;\n\n // Update loaded percent\n this.fileLoadProgress();\n\n // Add new node from json response\n this.addNodeFromData(data);\n\n if (!this.enabled) {\n return;\n }\n\n this.pointclouds.updateMinimapExtent();\n\n if (!this.fromJSON) {\n let bbox = this.estimatedBoundingBox;\n this.pointclouds.zoomToExtent(bbox, false, false);\n }\n\n if (isLastChunk) {\n this.fileLoadFinished(true);\n }\n }\n\n addNodeFromData(data) {\n // Convert array to vector\n data.offset = new Vector3(...data.offset);\n data.xyz_min = new Vector3(...data.xyz_min);\n data.xyz_max = new Vector3(...data.xyz_max);\n\n // Convert raw buffer to float array\n data.positions = new Float32Array(data.positions);\n data.intensity = new Float32Array(data.intensity);\n data.classification = new Float32Array(data.classification);\n data.colors = new Float32Array(data.colors);\n data.gpu_index = new Int32Array(data.numPoints);\n\n if (this.enabled) {\n // Add new node to pointcloud\n let node = new RawPointCloudNode(this, this.root);\n node.loadFromData(data);\n }\n }\n}\n","import {CloudNode} from \"./cloud-node\";\nimport {readFileBuffer} from \"../file-system-loader\";\nimport { EncompassPointCloud } from '.';\nimport {\n Points,\n Vector3\n} from 'three';\n\nexport class EncompassPointCloudNode extends CloudNode {\n protected cloud: EncompassPointCloud;\n public parent: EncompassPointCloudNode;\n private level: any;\n private _children = null;\n\n constructor(cloud: EncompassPointCloud, parent, name, level, center, size) {\n super();\n\n this.cloud = cloud;\n this.parent = parent;\n this.name = name;\n this.level = level;\n this.size = size;\n this._center = center;\n }\n\n /** Get children nodes if they exist, or assume all 8 children exist */\n get children() {\n if (this._children === null) {\n this.clearChildNodes();\n\n for (var i = 0; i < 8; i++) {\n let child = this.getChildAtIndex(i);\n this.addChildNode(child);\n }\n }\n\n return this._children;\n }\n\n get shift() {\n return this.cloud.shift;\n }\n\n get precision() {\n return this.cloud.precision;\n }\n\n addToScene() {\n // Create pointcloud object\n let pointsScene = new Points(this.geometry,\n this.cloud.materialScene);\n let pointsPicker = new Points(this.geometry,\n this.cloud.materialPicker);\n\n pointsScene.visible = false;\n pointsPicker.visible = false;\n\n // Create bounding box object;\n let boundingBox = this.cloud.generateEdgeMesh(\n this.size, this.size, this.size);\n\n this.addCloudData(pointsPicker, pointsScene, boundingBox);\n }\n\n getGeometry(data) {\n this.setGeometry(data);\n\n this.numPoints = data.numPoints;\n this.tightBoundingBox = {\n min: data.xyz_min,\n max: data.xyz_max\n };\n\n // Update unique values and min/max values\n this.cloud.updateClassifications(data.classification);\n this.cloud.updateColorLimits(data.rgb_max);\n this.cloud.updateIntensityRange(data.intensity_min, data.intensity_max);\n this.cloud.updateBoundingBox(this.tightBoundingBox);\n\n this.loaded = true;\n this.loading = false;\n\n // console.log(`Loaded geometry [${this.name}]`);\n }\n\n getBinaryData() {\n let dataPath = this.cloud.getDataPath(this.name);\n\n let onSuccess = (data: Buffer) => {\n this.sendToWorker({\n buffer: data,\n precision: this.precision,\n shift: this.shift\n });\n };\n\n let onError = () => {\n if (this.level === 1) {\n return;\n }\n\n this.parent.removeChildNode(this);\n };\n\n let path = `${dataPath}/${this.name}`;\n\n // Read node data\n readFileBuffer(path, this.cloud.isRemoteFile)\n .then(onSuccess)\n .catch(onError);\n }\n\n sendToWorker(data) {\n let workerPool = this.cloud.workerPool;\n\n let worker = workerPool.getWorker();\n\n worker.onmessage = event => {\n const data = event.data;\n\n // Convert array to vector\n data.xyz_min = new Vector3(...data.xyz_min);\n data.xyz_max = new Vector3(...data.xyz_max);\n\n // Convert raw buffer to float array\n data.positions = new Float32Array(data.positions);\n data.intensity = new Float32Array(data.intensity);\n data.classification = new Float32Array(data.classification);\n data.colors = new Float32Array(data.colors);\n\n this.getGeometry(data);\n workerPool.returnWorker(worker);\n };\n\n workerPool.sendMessage(worker, data, [data.buffer]);\n }\n\n getChildNameAtIndex(index) {\n return `${this.name}${index}`;\n }\n\n getChildAtIndex(index) {\n let childName = this.getChildNameAtIndex(index);\n let childSize = this.size / 2.0;\n let childLevel = this.level + 1;\n\n let z = Math.floor(index / 4);\n let y = Math.floor((index - (4 * z)) / 2);\n let x = Math.floor(index % 2);\n\n let childCenter = new Vector3(\n this._center.x + (x - 0.5) * childSize,\n this._center.y + (y - 0.5) * childSize,\n this._center.z + (z - 0.5) * childSize\n );\n\n return new EncompassPointCloudNode(this.cloud, this, childName,\n childLevel, childCenter, childSize);\n }\n\n addChildNode(node) {\n this._children.push(node);\n }\n\n clearChildNodes() {\n if (this._children) {\n this._children.forEach(child => {\n child = null;\n });\n }\n this._children = [];\n }\n\n removeChildNode(node) {\n let index = this._children.indexOf(node);\n if (index !== -1) {\n this._children.splice(index, 1);\n }\n\n node.clearChildNodes();\n node = null;\n }\n\n load() {\n if ((this.loaded) || (this.loading)) {\n return;\n }\n\n this.loading = true;\n this.getBinaryData();\n }\n}\n","import { isDevMode } from \"../../electron-modules\";\n\nexport class WorkerPool {\n private path;\n private workers = [];\n\n constructor(workerPath, numDefaultWorkers=1) {\n this.path = workerPath;\n this.createDefaultWorkers(numDefaultWorkers);\n }\n\n sendMessage(worker, data, transferables=null) {\n worker.postMessage(data, transferables);\n }\n\n getWorker() {\n if (this.workers.length === 0) {\n let worker = new Worker(this.path);\n this.returnWorker(worker);\n }\n\n let worker = this.workers.pop();\n\n return worker;\n }\n\n returnWorker(worker) {\n try {\n this.workers.push(worker);\n } catch (error) {\n return;\n }\n }\n\n\n createDefaultWorkers(numDefaultWorkers) {\n let newWorkers = [];\n for (let i=0; i {\n this.returnWorker(worker);\n });\n }\n\n terminateWorkers() {\n this.workers.forEach(worker => {\n worker.terminate();\n });\n\n this.workers = [];\n }\n}\n\nexport class WorkerQueue {\n private pool: WorkerPool;\n private maxAsyncWorkers;\n private waitForExit = false;\n public numRunning = 0;\n private queue = [];\n\n constructor(workerURL, numWorkers, waitForExit=false) {\n let workerPath = `${process.env.PUBLIC_URL}/${workerURL}`;\n this.pool = new WorkerPool(workerPath, numWorkers);\n this.maxAsyncWorkers = numWorkers;\n this.waitForExit = waitForExit;\n\n if (waitForExit && isDevMode) {\n console.warn(\"WorkerQueue requires {workerFinished: true} message to stop\");\n }\n }\n\n get running() {\n return this.numRunning > 0;\n }\n\n push(data, callback, transferables=[]) {\n this.queue.push([data, callback, transferables]);\n }\n\n /** @private */\n finish(worker) {\n this.numRunning = this.numRunning - 1;\n this.pool.returnWorker(worker);\n }\n\n process() {\n if (this.numRunning >= this.maxAsyncWorkers) {\n return;\n }\n\n if (this.queue.length === 0) {\n return;\n }\n\n this.numRunning = this.numRunning + 1;\n\n // Grab queue values\n let [workerData, workerCallback, transferables] = this.queue.shift();\n\n // Grab next available worker\n let worker = this.pool.getWorker();\n\n worker.onmessage = event => {\n let data = event.data;\n\n if (this.waitForExit) {\n if (data.workerFinished) {\n // Return worker to queue\n this.finish(worker);\n return;\n } else {\n // Execute callback\n workerCallback(event.data);\n }\n } else {\n // Execute callback\n workerCallback(event.data);\n\n // Return worker to queue\n this.finish(worker);\n }\n };\n\n // Submit data to webworker\n this.pool.sendMessage(worker, workerData, transferables);\n }\n}\n","import {PointCloud} from './point-cloud';\nimport {EncompassPointCloudNode} from \"./encompass-pointcloud-node\";\nimport {readFileJSON} from \"../file-system-loader\";\nimport LocalScene from '../projections';\nimport { Vector3 } from 'three';\nimport { WorkerPool } from '../worker';\n\nexport class EncompassPointCloud extends PointCloud {\n public workerPool: WorkerPool;\n private structure = null;\n public nodeCacheSize = 200;\n private cloudInfo: any;\n private numberOfPoints: any;\n private _shift: any;\n\n constructor(parent) {\n super(parent);\n\n const workerURL = \"workers/pointcloud-decoder-node.js\";\n let workerPath = `${process.env.PUBLIC_URL}/${workerURL}`;\n this.workerPool = new WorkerPool(workerPath);\n }\n\n get dataDir() {\n return this.structure.path;\n }\n\n get precision() {\n return this.cloudInfo.precision;\n }\n\n get folderDepth() {\n return this.cloudInfo.folderDepth;\n }\n\n get spacing() {\n return this.cloudInfo.spacing;\n }\n\n get isRemoteFile() {\n return this.structure.remote;\n }\n\n get fromJSON() {\n return this.structure.fromJSON;\n }\n\n get size() {\n return this.root.size;\n }\n\n get shift() {\n return this._shift;\n }\n\n set shift(value) {\n this._shift = value;\n }\n\n /** @private */\n destroyWorker() {\n this.workerPool.terminateWorkers();\n }\n\n getDataPath(node) {\n let dataDir = this.dataDir;\n let folderDepth = this.folderDepth;\n\n if (node === \"r\") {\n return dataDir;\n }\n\n let name = node.slice(1);\n if ((folderDepth) && (name.length >= folderDepth)) {\n let dirs = name.match(new RegExp('.{' + folderDepth + '}', 'g'));\n dataDir = `${dataDir}/${dirs.join(\"/\")}`;\n }\n\n return dataDir;\n }\n\n setBoundingBox(boundingBox) {\n if (!boundingBox) {\n return;\n }\n\n this._tightBoundingBox = boundingBox;\n }\n\n loadNodes(structure) {\n this.structure = structure;\n\n // Add pointcloud and set parameters\n this.pointclouds.addPointCloud(this);\n this.setName(structure.name);\n this.setVisibility(structure.visible);\n this.setIdentifier(structure.identifier);\n\n let path = `${structure.path}/r.idx`;\n\n // Read index data\n readFileJSON(path, this.isRemoteFile)\n .then(data => {\n // Decode our root info\n this.decodeIndexData(data);\n })\n .catch(() => {\n this.fileMissing = true;\n console.error(`Error loading point cloud: ${structure.path}`);\n this.viewer.showMessage(`Error loading point cloud: ${structure.name}`, {\n variant: \"error\"\n });\n });\n }\n\n decodeIndexData(data) {\n // Decode our root index file and store info about our local projection\n let cloudInfo = {\n spacing: data.hasOwnProperty('spacing') ? data.spacing : Math.sqrt(2) * data.size / 250.0,\n folderDepth: data.hasOwnProperty('hierarchy_step_size') ? data.hierarchy_step_size : null,\n precision: data.hasOwnProperty('precision') ? data.precision : 0.005,\n offset: new Vector3(...data.point_offset),\n scale: data.point_scale\n };\n\n let offset = cloudInfo.offset;\n let availableNodes = data.hasOwnProperty('node_structure') ? data.node_structure : null;\n let numberOfPoints = data.hasOwnProperty('total_points') ? data.total_points : null;\n\n // Get our tight bounding box if available\n let tightBoundingBox = null;\n if (\"tight_bounding_box\" in data) {\n let box = data.tight_bounding_box;\n tightBoundingBox = {\n min: new Vector3(...box.min).sub(offset),\n max: new Vector3(...box.max).sub(offset)\n };\n }\n\n // Setting some cloud metadata\n this.numberOfPoints = numberOfPoints;\n this.cloudInfo = cloudInfo;\n\n // Generate cloud root node\n let nodeSize = parseFloat(data.size);\n let nodeCenter = new Vector3(...data.center)\n .sub(offset);\n\n this.shift = LocalScene.offsetToScene(offset);\n this.root = new EncompassPointCloudNode(this, null, \"r\", 1,\n nodeCenter, nodeSize);\n\n this.buildTreeLegacy(availableNodes);\n this.setBoundingBox(tightBoundingBox);\n this.pointclouds.updateMinimapExtent();\n\n if (!this.fromJSON) {\n let bbox = this.tightBoundingBox;\n this.pointclouds.zoomToExtent(bbox, false, false);\n }\n }\n\n /** Legacy code for older pointclouds. Should be removed eventually */\n buildTreeLegacy(availableNodes) {\n // Old file format. Fallback method will add child nodes as needed\n if (!availableNodes) {\n return;\n }\n\n // Too slow, dont bother.\n // NOTE: remove completely soon. very slow past this cutoff, but\n // causes weird artifacts if removed completely\n let keys = Object.keys(availableNodes);\n let cutoff = 50000;\n if (keys.length > cutoff) {\n return;\n }\n\n // Make sure our root node was passed in\n let rootNodeExists = \"r\" in availableNodes;\n if (!rootNodeExists) {\n return;\n }\n\n let totalAdded = 1;\n let stack = [this.root];\n\n while (stack.length > 0) {\n let object = stack.shift();\n object.clearChildNodes();\n object.numPoints = availableNodes[object.name];\n\n for (var i = 0; i < 8; i++) {\n let childName = object.getChildNameAtIndex(i);\n let childExists = childName in availableNodes;\n\n if (childExists) {\n // This node exists in our structure, so we push to the child array\n // of the parent node, and append to our stack\n let child = object.getChildAtIndex(i);\n object.addChildNode(child);\n stack.push(child);\n totalAdded++;\n }\n }\n }\n\n console.log(`Point cloud hierarchy loaded. ${totalAdded} nodes found`);\n }\n}\n","// Binary heap implementation from:\n// http://eloquentjavascript.net/appendix2.html\n\nexport function BinaryHeap(scoreFunction) {\n this.content = [];\n this.scoreFunction = scoreFunction;\n}\n\nBinaryHeap.prototype = {\n push: function (element) {\n // Add the new element to the end of the array.\n this.content.push(element);\n // Allow it to bubble up.\n this.bubbleUp(this.content.length - 1);\n },\n\n pop: function () {\n // Store the first element so we can return it later.\n var result = this.content[0];\n // Get the element at the end of the array.\n var end = this.content.pop();\n // If there are any elements left, put the end element at the\n // start, and let it sink down.\n if (this.content.length > 0) {\n this.content[0] = end;\n this.sinkDown(0);\n }\n return result;\n },\n\n peek: function() {\n return this.content[0];\n },\n\n remove: function (node) {\n var length = this.content.length;\n // To remove a value, we must search through the array to find\n // it.\n for (var i = 0; i < length; i++) {\n if (this.content[i] !== node) continue;\n // When it is found, the process seen in 'pop' is repeated\n // to fill up the hole.\n var end = this.content.pop();\n // If the element we popped was the one we needed to remove,\n // we're done.\n if (i === length - 1) break;\n // Otherwise, we replace the removed element with the popped\n // one, and allow it to float up or sink down as appropriate.\n this.content[i] = end;\n this.bubbleUp(i);\n this.sinkDown(i);\n break;\n }\n },\n\n size: function () {\n return this.content.length;\n },\n\n bubbleUp: function (n) {\n // Fetch the element that has to be moved.\n var element = this.content[n];\n var score = this.scoreFunction(element);\n // When at 0, an element can not go up any further.\n while (n > 0) {\n // Compute the parent element's index, and fetch it.\n var parentN = Math.floor((n + 1) / 2) - 1;\n var parent = this.content[parentN];\n // If the parent has a lesser score, things are in order and we\n // are done.\n if (score >= this.scoreFunction(parent)) {\n break;\n }\n\n // Otherwise, swap the parent with the current element and\n // continue.\n this.content[parentN] = element;\n this.content[n] = parent;\n n = parentN;\n }\n },\n\n sinkDown: function (n) {\n // Look up the target element and its score.\n var length = this.content.length;\n var element = this.content[n];\n var elemScore = this.scoreFunction(element);\n\n while (true) {\n // Compute the indices of the child elements.\n var child2N = (n + 1) * 2;\n var child1N = child2N - 1;\n // This is used to store the new position of the element,\n // if any.\n var swap = null;\n // If the first child exists (is inside the array)...\n if (child1N < length) {\n // Look it up and compute its score.\n var child1 = this.content[child1N];\n var child1Score = this.scoreFunction(child1);\n // If the score is less than our element's, we need to swap.\n if (child1Score < elemScore) {\n swap = child1N;\n }\n }\n // Do the same checks for the other child.\n if (child2N < length) {\n var child2 = this.content[child2N];\n var child2Score = this.scoreFunction(child2);\n if (child2Score < (swap == null ? elemScore : child1Score)) {\n swap = child2N;\n }\n }\n\n // No need to swap further, we are done.\n if (swap == null) break;\n\n // Otherwise, swap and continue.\n this.content[n] = this.content[swap];\n this.content[swap] = element;\n n = swap;\n }\n }\n};\n","import {createSlice, PayloadAction} from '@reduxjs/toolkit';\nimport {Classification, classifications} from \"../classifications\";\n\nexport interface Clamp {\n min: number;\n max: number;\n}\n\nexport type ColorMapKey = 'heat-map' | 'awesome-green' | 'pastel-shades' | 'blue-orange' |\n 'black-orange' | 'blue-hue' | 'blue-red' | 'jet' | 'grayscale';\n\nexport enum ColorType {\n Intensity,\n RGB,\n Height,\n Classification\n}\n\nexport enum MarkerNavType {\n Arrows,\n Markers,\n None\n}\n\nexport interface ClassificationSetting extends Classification {\n visible: boolean;\n available: boolean;\n}\n\nexport interface Settings {\n colorMap: ColorMapKey;\n colorType: ColorType;\n dynamicSize: boolean;\n circularPoints: boolean;\n arrowMarkers: MarkerNavType;\n drawerOpen: boolean;\n activeTab: number;\n opacity: number;\n heightClip: Clamp;\n intensityClip: Clamp;\n cloudSize: number;\n cloudMaxPoints: number;\n cloudDistance: number;\n classifications: ClassificationSetting[];\n switched: boolean;\n orthoOpacity: number;\n}\n\nconst defaultIntensityClip = {min: 0, max: 1};\n\nconst defaultHeightClip = {min: 0, max: 1};\n\nconst defaultClassifications = classifications.map(classification => ({\n visible: true,\n available: false,\n ...classification\n}));\n\nexport const settingsSlice = createSlice({\n name: 'settings',\n initialState: {\n colorMap: 'heat-map',\n colorType: ColorType.Height,\n dynamicSize: true,\n circularPoints: true,\n arrowMarkers: MarkerNavType.Arrows,\n activeTab: 0,\n opacity: 1.0,\n cloudMaxPoints: 5000000,\n cloudDistance: 100,\n cloudSize: 2.5,\n switched: false,\n drawerOpen: true,\n heightClip: defaultHeightClip,\n intensityClip: defaultIntensityClip,\n classifications: defaultClassifications,\n orthoOpacity: 1.0\n } as Settings,\n reducers: {\n changeOpacity: (state, action: PayloadAction) => {\n state.opacity = action.payload;\n },\n changeOrthoOpacity: (state, action: PayloadAction) => {\n state.orthoOpacity = action.payload;\n },\n changeCloudDistance: (state, action: PayloadAction) => {\n state.cloudDistance = action.payload;\n },\n changeCloudMaxPoints: (state, action: PayloadAction) => {\n state.cloudMaxPoints = action.payload;\n },\n changeCloudSize: (state, action: PayloadAction) => {\n state.cloudSize = action.payload;\n },\n changeHeightClip: (state, action: PayloadAction) => {\n state.heightClip = action.payload;\n },\n changeIntensityClip: (state, action: PayloadAction) => {\n state.intensityClip = action.payload;\n },\n changeColorMap: (state, action: PayloadAction) => {\n state.colorMap = action.payload;\n },\n changeColorType: (state, action: PayloadAction) => {\n state.colorType = action.payload;\n },\n changeDynamicSize: (state, action: PayloadAction) => {\n state.dynamicSize = action.payload;\n },\n changeCircularPoints: (state, action: PayloadAction) => {\n state.circularPoints = action.payload;\n },\n changeAvailableClassifications: (state, action: PayloadAction) => {\n const availableClassifications = new Set(action.payload);\n state.classifications = state.classifications\n .map(classification => ({...classification, available: availableClassifications.has(classification.id)}));\n },\n changeClassificationVisibility: (state, action) => {\n const classification = state.classifications.find(classification => classification.id === action.payload);\n\n if (classification) {\n classification.visible = !classification.visible;\n }\n },\n changeAllClassificationVisibility: (state, action) => {\n state.classifications = state.classifications.map(classification => ({...classification, visible: action.payload}));\n },\n changeSwitched: (state, action: PayloadAction) => {\n state.switched = action.payload;\n },\n changeSelectedTab: (state, action: PayloadAction) => {\n state.activeTab = action.payload;\n },\n changeDrawerOpen: (state, action: PayloadAction) => {\n state.drawerOpen = action.payload;\n },\n changeArrowMarkers: (state, action: PayloadAction) => {\n state.arrowMarkers = action.payload;\n },\n }\n});\n\nexport const {\n changeOpacity,\n changeOrthoOpacity,\n changeCloudDistance,\n changeCloudMaxPoints,\n changeCloudSize,\n changeHeightClip,\n changeIntensityClip,\n changeColorMap,\n changeColorType,\n changeDynamicSize,\n changeCircularPoints,\n changeAvailableClassifications,\n changeClassificationVisibility,\n changeAllClassificationVisibility,\n changeSwitched,\n changeSelectedTab,\n changeDrawerOpen,\n changeArrowMarkers\n} = settingsSlice.actions;\n\nexport default settingsSlice.reducer;\n\nexport const selectOpacity = state => state.settings.opacity;\nexport const selectOrthoOpacity = state => state.settings.orthoOpacity;\nexport const selectCloudDistance = state => state.settings.cloudDistance;\nexport const selectCloudMaxPoints = state => state.settings.cloudMaxPoints;\nexport const selectCloudSize = state => state.settings.cloudSize;\nexport const selectHeightClip = state => state.settings.heightClip;\nexport const selectIntensityClip = state => state.settings.intensityClip;\nexport const selectColorMap = state => state.settings.colorMap;\nexport const selectColorType = state => state.settings.colorType;\nexport const selectDynamicSize = state => state.settings.dynamicSize;\nexport const selectCircularPoints = state => state.settings.circularPoints;\nexport const selectViewerSwitched = state => state.settings.switched;\nexport const selectSelectedTab = state => state.settings.activeTab;\nexport const selectDrawerOpen = state => state.settings.drawerOpen;\nexport const selectArrowMarkers = state => state.settings.arrowMarkers;\nexport const selectAvailableClassifications = state => state.settings.classifications\n .filter(classification => classification.available);\nexport const selectClassificationVisibilities = state => state.settings.classifications\n .map(classification => ({\n visible: classification.visible,\n id: classification.id\n }));\n\n","import { MathUtils } from \"three/src/math/MathUtils\";\nimport { Vector3 } from \"three/src/math/Vector3\";\n\nexport const getProjFactor = (fov, distance, screenHeight) => {\n let projFactor = 1.0 / Math.tan(fov / 2);\n projFactor /= distance;\n projFactor *= screenHeight / 2;\n return projFactor;\n};\n\nexport const setPointScale = (viewer, mesh, buffer = 1.0) => {\n if (!mesh) {\n return;\n }\n\n const fov = MathUtils.degToRad(Math.max(60, viewer.camera.fov));\n const screenHeight = viewer.height;\n\n const distance = Math.max(1.0, mesh.position.distanceTo(viewer.camera.position));\n const projFactor = getProjFactor(fov, distance, screenHeight);\n const scale = 50 / projFactor;\n\n mesh.scale.set(scale, scale, scale);\n mesh.geometry.computeBoundingSphere();\n mesh.geometry.boundingSphere.radius *= buffer;\n};\n\nexport const toScreenPosition = (viewer, position) => {\n var vector = new Vector3();\n vector.set(position.x, position.y, position.z);\n vector.project(viewer.camera);\n\n vector.x = Math.round((vector.x + 1) * viewer.width / 2);\n vector.y = Math.round((-vector.y + 1) * viewer.height / 2);\n vector.z = 0;\n\n return vector;\n};\n\nexport const eventToPixel = (event) => {\n let uv = new Vector3();\n if (event.offsetX) {\n // chrome,ie,safari\n uv.x = event.offsetX;\n uv.y = event.offsetY;\n } else {\n // firefox\n uv.x = event.layerX;\n uv.y = event.layerY;\n }\n return uv;\n};\n","import { readFileBuffer } from \"../file-system-loader\";\nimport {\n DataProjectionCoordinate,\n getInvertedEuler,\n SceneCoordinate,\n SphericalPosition\n} from '../projections';\nimport { Viewer } from '../main';\nimport { isStaticSite } from '../../../electron-modules';\nimport { AssetType } from '../../../redux/assets-slice';\nimport { extentFromPoints } from '../aerial/map';\nimport slash from 'slash';\nimport {\n AmbientLight,\n BoxBufferGeometry,\n DataTexture,\n DoubleSide,\n Euler,\n MathUtils,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n PlaneGeometry,\n RGBAFormat,\n Scene,\n Texture,\n Vector2,\n Vector3\n} from 'three';\nimport { interp1D, roundDigit } from \"../misc\";\nimport { planeFromVectors } from \"../utilities/polygon\";\n\nexport interface ImagePixel {\n u: number,\n v: number\n}\n\nexport interface CameraLoadOptions {\n onLoaded?: Function\n fov?: number\n angles?: [number, number]\n position?: SceneCoordinate\n direction?: Vector3\n}\n\nclass ImagePosition {\n private _value;\n private image: CameraImage;\n\n constructor(image: CameraImage, position) {\n this.image = image;\n this._value = new Vector3(...position);\n }\n\n get offset() {\n let matrix = new Matrix4()\n .copy(this.image.matrix)\n .transpose();\n\n return new Vector3()\n .setFromMatrixPosition(matrix);\n }\n\n get height() {\n return this.image.height;\n }\n\n get uncorrectedEuler() {\n return this.image.rotation._euler;\n }\n\n get value() {\n let offset = new Vector3()\n .copy(this.offset)\n .applyEuler(this.image.rotation.eulerCSV);\n\n let position = new Vector3()\n .copy(this._value)\n .add(offset);\n\n return position;\n }\n\n get viewer() {\n return new DataProjectionCoordinate(this.value).toScene();\n }\n\n get marker() {\n const offset = new Vector3(0, 0, this.height);\n return this.viewer.sub(offset);\n }\n\n get aerial() {\n return new SceneCoordinate(this.value).toAerial();\n }\n}\n\nclass ImageRotation {\n private array: [];\n public _euler: THREE.Euler;\n private image: CameraImage;\n\n constructor(image: CameraImage, rotation) {\n this.image = image;\n this.array = rotation;\n this._euler = new Euler(\n -1 * MathUtils.degToRad(rotation[0]),\n -1 * MathUtils.degToRad(rotation[1]),\n -1 * MathUtils.degToRad(rotation[2])\n );\n }\n\n get matrix() {\n return new Matrix4()\n .copy(this.image.matrix)\n .setPosition(0,0,0);\n }\n\n get adjustment() {\n const angles = this.image.adjustment;\n return new Euler(\n -1 * MathUtils.degToRad(angles[0]),\n -1 * MathUtils.degToRad(angles[1]),\n -1 * MathUtils.degToRad(angles[2])\n );\n }\n\n get euler() {\n let rotationWithTransform = multiplyRotations(this._euler, this.matrix);\n let rotationWithAdjustment = multiplyRotations(rotationWithTransform, this.adjustment);\n\n let euler = new Euler()\n .setFromRotationMatrix(rotationWithAdjustment);\n\n return euler;\n }\n\n get viewer() {\n return new Euler().copy(this.euler);\n }\n\n get eulerCSV() {\n return this._euler;\n }\n\n get eulerDegrees() {\n let degrees = new Euler();\n degrees.x = -1 * MathUtils.radToDeg(this.euler.x);\n degrees.y = -1 * MathUtils.radToDeg(this.euler.y);\n degrees.z = -1 * MathUtils.radToDeg(this.euler.z);\n return degrees;\n }\n\n get eulerCsvInvert() {\n return getInvertedEuler(this.eulerCSV);\n }\n}\n\nclass ImageFace {\n private material;\n public name;\n private rotation;\n\n constructor(material, name, rotation) {\n this.material = material;\n this.name = name;\n this.rotation = rotation;\n }\n\n /** @private */\n setMaterialTexture(imageData) {\n let texture = new DataTexture(\n imageData.data,\n imageData.width,\n imageData.height,\n RGBAFormat\n );\n\n texture.needsUpdate = true;\n texture.flipY = true;\n texture.rotation = MathUtils.degToRad(this.rotation);\n texture.center = new Vector2(0.5, 0.5);\n\n this.material.map = texture;\n this.material.color = null;\n this.material.map.needsUpdate = true;\n this.material.visible = true;\n this.material.needsUpdate = true;\n }\n}\n\nexport class CameraImage {\n public id;\n public csv;\n public name;\n public path;\n public height;\n public config;\n public adjustment;\n public isRemoteFile;\n public object;\n public enabled;\n public loaded = false;\n public img;\n public ctx;\n public canvas;\n public materials;\n public faces: ImageFace[];\n public geometry;\n public fromJSON: boolean;\n\n public generatePreview = false;\n public cameraList: CameraList;\n public position: ImagePosition;\n public rotation: ImageRotation;\n\n constructor(cameraList, data) {\n this.cameraList = cameraList;\n\n this.id = data.id;\n this.csv = data.csv;\n this.name = data.name;\n this.path = data.path;\n this.height = data.height;\n this.adjustment = data.adjustment;\n this.isRemoteFile = data.remote;\n this.config = data.config;\n this.fromJSON = data.fromJSON;\n\n this.position = new ImagePosition(this, data.position);\n this.rotation = new ImageRotation(this, data.rotation);\n\n this.reset();\n }\n\n get scene() {\n return this.cameraList.scene;\n }\n\n get camera() {\n return this.cameraList.camera;\n }\n\n get matrix() {\n return this.cameraList.matrix;\n }\n\n get minimap() {\n return this.cameraList.minimap;\n }\n\n get mimeType() {\n let extension = this.name.split(\".\").slice(-1)[0].toLowerCase();\n let imageTypes = {\n \"jpg\": \"image/jpeg\",\n \"jpeg\": \"image/jpeg\",\n \"png\": \"image/png\"\n };\n\n return imageTypes[extension] || null;\n }\n\n get viewer() {\n return this.cameraList.viewer;\n }\n\n get controls() {\n return this.cameraList.controls;\n }\n\n get imageWidth() {\n return this.img ? this.img.width : 0;\n }\n\n get imageHeight() {\n return this.img ? this.img.height : 0;\n }\n\n pixelToDirection(pixel: ImagePixel) : Vector3 {\n console.warn(\"Not implemented\");\n return new Vector3();\n }\n\n directionToPixel(direction: Vector3) : [boolean, ImagePixel] {\n console.warn(\"Not implemented\");\n return [true, {u: 0, v: 0}];\n }\n\n /** @private */\n setCameraPosition() {\n this.camera.position.copy(this.position.viewer);\n this.object.position.copy(this.position.viewer);\n this.object.rotation.copy(this.rotation.viewer);\n }\n\n /** @private */\n setCameraParameters(opts: CameraLoadOptions) {\n if (opts.fov) {\n this.controls.fov = opts.fov;\n }\n\n if (opts.angles) {\n this.controls.angles = opts.angles;\n } else if (opts.direction) {\n this.controls.angles = this.directionToCameraAngle(\n opts.direction);\n } else if (opts.position) {\n this.controls.angles = this.positionToCameraAngle(\n this.object.position, opts.position);\n }\n }\n\n /** @private */\n directionToCameraAngle = (direction) : [number, number] => {\n return this.positionToCameraAngle(new Vector3(), direction);\n };\n\n /** @private */\n positionToCameraAngle = (cameraPos, position) : [number, number] => {\n let sphere = new SphericalPosition()\n .fromVectors(cameraPos, position);\n\n return [\n MathUtils.degToRad(sphere.theta),\n MathUtils.degToRad(90 - sphere.phi),\n ] as [number, number];\n };\n\n\n /** @private */\n grabImageFromPath() {\n return new Promise((resolve, reject) => {\n this.img = new Image();\n\n this.img.addEventListener('load', () => {\n resolve(true);\n });\n\n let onSuccess = buffer => {\n // Load image source from buffer\n let arrayBufferView = new Uint8Array(buffer);\n let blob = new Blob([arrayBufferView], {\n type: this.mimeType\n });\n this.img.src = URL.createObjectURL(blob);\n };\n\n let onError = () => {\n reject();\n };\n\n readFileBuffer(this.path, this.isRemoteFile)\n .then(onSuccess)\n .catch(onError);\n });\n }\n\n loadCamera(opts: CameraLoadOptions) {\n if (this.enabled) {\n this.cameraList.setNormalCamera();\n this.setCameraParameters(opts);\n this.minimap.setActiveCamera(this.id);\n\n if (opts.onLoaded) {\n opts.onLoaded();\n }\n\n return;\n }\n\n this.enabled = true;\n this.loaded = false;\n this.generateObject();\n this.object.visible = false;\n\n this.grabImageFromPath()\n .then(async () => {\n // Process image preview (if required)\n if (this.generatePreview) {\n await this.generatePreviewImage();\n }\n\n // Clear current camera, move to new position\n this.cameraList.clearImages(this);\n this.cameraList.setNormalCamera();\n this.setCameraPosition();\n this.setCameraParameters(opts);\n this.minimap.setActiveCamera(this.id);\n this.object.visible = true;\n this.loaded = true;\n\n if (opts.onLoaded) {\n opts.onLoaded();\n }\n\n // Process full image data\n this.generateFullImage();\n })\n .catch(() => {\n this.reset();\n\n console.error(`Error loading image: ${this.path}`);\n this.viewer.showMessage(`Error loading image: ${this.name}`, {\n variant: \"error\"\n });\n\n if (!this.cameraList.current) {\n // Nothing to fall back to, so just go to orbit\n this.cameraList.setOrbitCamera();\n }\n })\n .finally(() => {\n this.cameraList.updateArrowNavigation();\n });\n }\n\n applyTempRotation(angles) {\n const angleEuler = new Euler(\n -1 * MathUtils.degToRad(angles[0]),\n -1 * MathUtils.degToRad(angles[1]),\n -1 * MathUtils.degToRad(angles[2])\n );\n\n const tempRotation = multiplyRotations(\n this.rotation.eulerCSV, angleEuler);\n const euler = new Euler()\n .setFromRotationMatrix(tempRotation);\n\n this.object.rotation.copy(euler);\n }\n\n /** @private */\n generateObject() {\n console.warn(\"Not implemented\");\n }\n\n /** @private */\n async generatePreviewImage() {\n console.warn(\"Not implemented\");\n }\n\n /** @private */\n async generateFullImage() {\n console.warn(\"Not implemented\");\n }\n\n destroy() {\n if (!this.enabled) {\n return;\n }\n\n if (this.object) {\n this.scene.remove(this.object);\n }\n\n this.materials.forEach(material => {\n if (material.map) {\n material.map.dispose();\n }\n material.dispose();\n });\n\n if (this.geometry) {\n this.geometry.dispose();\n }\n\n if (this instanceof PanoramicImage) {\n this.destroyWorkers();\n }\n\n this.reset();\n }\n\n reset() {\n this.object = null;\n this.enabled = false;\n this.materials = [];\n this.faces = [];\n this.geometry = null;\n }\n}\n\nexport class PanoramicImage extends CameraImage {\n public generatePreview = true;\n private imageDataWorker: Worker;\n private imageFaceWorker: Worker;\n\n constructor(cameraList, data) {\n super(cameraList, data);\n }\n\n pixelToDirection(pixel: ImagePixel) : Vector3 {\n let width = this.imageWidth;\n let height = this.imageHeight;\n\n let theta = -1*MathUtils.degToRad(360 * (pixel.u / width) - 180);\n let phi = MathUtils.degToRad(180 * (pixel.v / height));\n\n let imageDirection = new Vector3(\n Math.cos(theta) * Math.sin(phi),\n Math.sin(theta) * Math.sin(phi),\n Math.cos(phi)\n );\n\n let direction = imageDirection.clone()\n .applyEuler(this.rotation.euler);\n\n return direction;\n }\n\n directionToPixel(direction: Vector3) : [boolean, ImagePixel] {\n const inverse = getInvertedEuler(this.rotation.euler);\n const imageDirection = direction.clone()\n .applyEuler(inverse);\n\n let sphere = new SphericalPosition()\n .fromVectors(new Vector3(0,0,0), imageDirection);\n\n let width = this.imageWidth;\n let height = this.imageHeight;\n\n let u = (width*(-sphere.theta + 180)/360);\n let v = (height*(sphere.phi)/180);\n\n u = (u + width) % width;\n v = (v + height) % height;\n\n return [true, {u, v}];\n }\n\n directionsToPlanar(directions, planarSize=100) {\n // Convert directons to a flat plane based on average normal\n const plane = planeFromVectors(directions);\n let planar = directions.map(x => {\n let target = new Vector3();\n plane.projectPoint(x, target);\n return target;\n });\n\n let allX = planar.map(x => x.x);\n let allY = planar.map(x => x.y);\n\n let xMin = Math.min(...allX);\n let xMax = Math.max(...allX);\n let yMin = Math.min(...allY);\n let yMax = Math.max(...allY);\n\n planar = planar.map(point => {\n point.x = planarSize * (point.x - xMin) / (xMax-xMin);\n point.y = planarSize * (point.y - yMin) / (yMax-yMin);\n point.z = 0.0;\n return point;\n });\n\n return planar;\n }\n\n interpolatePixels(points, width, height) {\n let interpolated = [];\n\n // Convert pixels to angles\n let theta = points.map(x => MathUtils.degToRad((360 * x[0] / width) - 180));\n let phi = points.map(x => MathUtils.degToRad(180 * x[1] / height));\n\n // Convert angles to xyz\n let xyz = [];\n for (var i=0;i {\n let nextIndex = (index+1) % xyz.length;\n let xyz2 = xyz[nextIndex];\n let distance = new Vector3(...xyz1)\n .distanceTo(new Vector3(...xyz2));\n\n if (distance === 0) {\n return;\n }\n\n let steps = Math.ceil(distance/stepSize) + 1;\n let _x = interp1D(xyz1[0], xyz2[0], steps);\n let _y = interp1D(xyz1[1], xyz2[1], steps);\n let _z = interp1D(xyz1[2], xyz2[2], steps);\n\n let interpTemp = [];\n for (var i=0;i {\n if (index === 0) {\n xyzNoDups.push(current);\n return;\n }\n\n let previous = xyz[index - 1];\n let distance = new Vector3(...current)\n .distanceTo(new Vector3(...previous));\n\n if (distance !== 0) {\n xyzNoDups.push(current);\n };\n });\n xyz = [...xyzNoDups];\n\n // Convert xyz back to pixels\n xyz.forEach(current => {\n let r = new Vector2(...current).length();\n let _theta = MathUtils.radToDeg(Math.atan2(current[1], current[0]));\n let _phi = MathUtils.radToDeg(Math.atan2(r, current[2]));\n\n interpolated.push([\n roundDigit(width * ((_theta + 180) / 360), 4),\n roundDigit(height * (_phi / 180), 4)\n ]);\n });\n\n return interpolated;\n };\n\n spawnImageDataWorker() {\n this.destroyWorkers();\n const workerURL = \"workers/panoramic-to-data.js\";\n this.imageDataWorker = new Worker(`${process.env.PUBLIC_URL}/${workerURL}`);\n }\n\n spawnImageimageFaceWorker() {\n this.destroyWorkers();\n const workerURL = \"workers/panoramic-to-face.js\";\n this.imageFaceWorker = new Worker(`${process.env.PUBLIC_URL}/${workerURL}`);\n }\n\n destroyWorkers() {\n if (this.imageDataWorker) {\n this.imageDataWorker.terminate();\n this.imageDataWorker = null;\n }\n\n if (this.imageFaceWorker) {\n this.imageFaceWorker.terminate();\n this.imageFaceWorker = null;\n }\n }\n\n /** @private */\n determineCanvasSize(preview) {\n let width;\n let minWidth = 2048;\n let maxWidth = 8192;\n\n if (preview) {\n width = minWidth;\n } else {\n width = this.img.width;\n width = Math.min(width, maxWidth);\n width = Math.max(width, minWidth);\n }\n\n let height = width / 2.0;\n\n return {\n canvasWidth: width,\n canvasHeight: height\n };\n }\n\n /** @private */\n async generatePreviewImage() {\n const data = await this.imageToData(true);\n await this.processFaces(data, \"nearest\", 16);\n }\n\n /** @private */\n async generateFullImage() {\n const data = await this.imageToData(false);\n\n // Generate medium quality image faces\n await this.processFaces(data, \"nearest\", 8);\n\n // Generate high quality image faces\n await this.processFaces(data, \"bilinear\", 4);\n }\n\n /** @private */\n async imageToData(preview) {\n // Draw image on canvas, using forced size for good quality\n const {canvasWidth, canvasHeight} = this.determineCanvasSize(preview);\n\n // Create new canvas and transfer to offscreen canvas\n const canvas = document.createElement(\"canvas\");\n canvas.width = canvasWidth;\n canvas.height = canvasHeight;\n\n if (preview) {\n // Preview is returned immediately\n let context = canvas.getContext(\"2d\");\n context.drawImage(this.img, 0, 0, canvasWidth, canvasHeight);\n const data = context.getImageData(0, 0, canvasWidth, canvasHeight);\n return data;\n }\n\n return new Promise(resolve => {\n // Full image is returned as a promise\n const offScreenCanvas = canvas.transferControlToOffscreen();\n\n this.spawnImageDataWorker();\n\n this.imageDataWorker.onmessage = event => {\n resolve(event.data);\n };\n\n this.imageDataWorker.postMessage({\n url: this.img.src,\n canvas: offScreenCanvas\n }, [offScreenCanvas]);\n });\n }\n\n /** @private */\n generateObject() {\n let directions = [\n {direction: 'front', rotation: -90},\n {direction: 'back', rotation: 90},\n {direction: 'left', rotation: 0},\n {direction: 'right', rotation: 180},\n {direction: 'bottom', rotation: -90},\n {direction: 'top', rotation: -90}\n ];\n\n directions.forEach(({direction, rotation}, index) => {\n let material = new MeshBasicMaterial({\n side: DoubleSide,\n visible: false\n });\n this.materials.push(material);\n\n let face = new ImageFace(material, direction, rotation);\n this.faces.push(face);\n });\n\n this.geometry = new BoxBufferGeometry(10, 10, 10);\n this.object = new Mesh(this.geometry, this.materials);\n this.object.geometry.scale(1, 1, -1);\n this.scene.add(this.object);\n }\n\n /** @private */\n async processFaces(imageData, interpolation, divisor) {\n this.spawnImageimageFaceWorker();\n\n for (let face of this.faces) {\n const bufferLength = imageData.data.length;\n const copyOfData = {\n data: imageData.data.slice(0, bufferLength),\n width: imageData.width,\n height: imageData.height\n };\n\n const newImageData = await this.generateFaceData(\n copyOfData, interpolation, divisor, face.name);\n face.setMaterialTexture(newImageData);\n };\n }\n\n /** @private */\n async generateFaceData(imageData, interpolation, divisor, face) {\n return new Promise(resolve => {\n this.imageFaceWorker.onmessage = event => {\n resolve(event.data);\n };\n\n this.imageFaceWorker.postMessage({interpolation, divisor,\n imageData, face}, [imageData.data.buffer]);\n });\n }\n}\n\nexport class PlanarImage extends CameraImage {\n constructor(cameraList, data) {\n super(cameraList, data);\n }\n\n get fovX() {\n return 2.0 * Math.atan((this.config.width / 2) / this.config.fx);\n }\n\n get fovY() {\n return 2.0 * Math.atan((this.config.height / 2) / this.config.fy);\n }\n\n get centerOffset() : Euler {\n /** Calculate the rotation causes by non-centered planars */\n let x = this.fovY * (this.config.cy - this.config.height / 2)\n / this.config.height;\n\n let y = this.fovX * (this.config.cx - this.config.width / 2)\n / this.config.width;\n\n return new Euler(x, y, 0);\n }\n\n pixelToDirection(pixel: ImagePixel) : Vector3 {\n let x = -1 * (pixel.u - this.config.width/2) / this.config.fx;\n let y = (pixel.v - this.config.height/2) / this.config.fy;\n let xyz = new Vector3(x, y, 1.0)\n .normalize()\n .multiplyScalar(-1.0);\n\n let direction = xyz.clone()\n .applyEuler(this.centerOffset)\n .applyEuler(this.rotation.euler);\n\n return direction;\n }\n\n directionToPixel(direction: Vector3, margin=50) : [boolean, ImagePixel] {\n const offset = getInvertedEuler(this.centerOffset);\n const inverse = getInvertedEuler(this.rotation.euler);\n\n const imageDirection = direction.clone()\n .applyEuler(inverse)\n .applyEuler(offset);\n\n let xyz = new Vector3()\n .copy(imageDirection)\n .divideScalar(imageDirection.z);\n\n let u = -xyz.x * this.config.fx + this.config.width/2;\n let v = xyz.y * this.config.fy + this.config.height/2;\n\n let outOfBounds = (u < -margin)\n || (v < -margin)\n || (u > (this.config.width + margin))\n || (v > (this.config.height + margin));\n\n if (outOfBounds) {\n return [false, {u: 0, v: 0}];\n }\n\n return [true, {u, v}];\n }\n\n async generateFullImage() {\n let imageTexture = new Texture();\n imageTexture.image = this.img;\n imageTexture.flipY = true;\n imageTexture.needsUpdate = true;\n\n this.materials[0].map = imageTexture;\n this.materials[0].map.needsUpdate = true;\n this.materials[0].needsUpdate = true;\n }\n\n /** @private */\n generateObject() {\n const sizeX = this.config.width / this.config.fx;\n const sizeY = this.config.height / this.config.fy;\n\n this.geometry = new PlaneGeometry(sizeX, sizeY, 1, 1);\n this.geometry.vertices.forEach(vertex => {\n vertex.z = -1;\n });\n\n this.materials = [new MeshBasicMaterial({side: DoubleSide})];\n const image = new Mesh(this.geometry, this.materials);\n\n // Apply the corrective rotation to our object\n const objectOffset = new Object3D();\n objectOffset.rotation.copy(this.centerOffset);\n objectOffset.add(image);\n\n // Final object that will have full rotation\n // and position applied to it\n this.object = new Object3D();\n this.object.add(objectOffset);\n\n this.scene.add(this.object);\n }\n}\n\nexport class CameraList {\n public viewer: Viewer;\n public scene: any;\n public props;\n public cameras: CameraImage[] = [];\n public matrix = new Matrix4();\n public adjustments = {};\n public aligned = false;\n\n constructor(viewer) {\n this.viewer = viewer;\n\n this.initScene();\n this.initEvents();\n }\n\n get count() {\n return this.cameras.length;\n }\n\n get camera() {\n return this.viewer.camera;\n }\n\n get controls() {\n return this.viewer.controls;\n }\n\n get pointclouds() {\n return this.viewer.pointclouds;\n }\n\n get minimap() {\n return this.viewer.minimap;\n }\n\n get markers() {\n return this.viewer.markers;\n }\n\n get current() {\n let cameras = this.cameras.filter(camera => camera.enabled);\n return cameras.length > 0 ? cameras[0] : null;\n }\n\n get currentIndex() {\n return this.cameras.indexOf(this.current);\n }\n\n get cameraLoaded() {\n return this.current !== null;\n }\n\n get imageExtent() {\n let positions = this.cameras.map(camera => {\n return camera.position.value;\n });\n\n return extentFromPoints(positions);\n }\n\n get isEmpty() {\n return this.cameras.length === 0;\n }\n\n initEvents() {\n return;\n }\n\n initScene() {\n const scene = new Scene();\n const softlight = new AmbientLight(0xFFFFFF);\n scene.add(softlight);\n this.scene = scene;\n }\n\n onKeyDown(event) {\n if (event.key === \"ArrowUp\") {\n this.incrementCamera(1);\n } else if (event.key === \"ArrowDown\") {\n this.incrementCamera(-1);\n }\n }\n\n /** @private */\n setNormalCamera() {\n let controls = this.controls;\n controls.setOrbitState(false);\n }\n\n /** @private */\n setOrbitCamera() {\n let controls = this.controls;\n controls.setOrbitState(true);\n }\n\n addCameras(cameras, adjustments, height) {\n if (cameras.length === 0) {\n return;\n }\n\n // Get a list of new cameras\n let addedIndex = 0;\n let newCameras = new Array(cameras.length);\n\n cameras.forEach(camera => {\n const rotation = [\n camera.roll,\n camera.pitch,\n camera.yaw\n ];\n\n const position = [\n camera.x,\n camera.y,\n camera.z\n ];\n\n const adjustment = camera.id in adjustments\n ? adjustments[camera.id]\n : [0, 0, 0];\n\n const cameraConfig = camera.config\n ? camera.config\n : {};\n\n const assetType = camera.assetType;\n\n const cameraInfo = {\n id: camera.id,\n csv: camera.csv,\n name: camera.name,\n path: slash(camera.path),\n rotation: rotation,\n position: position,\n height: height,\n adjustment: adjustment,\n config: cameraConfig,\n remote: isStaticSite,\n fromJSON: camera.fromJSON\n };\n\n // Add new camera from info\n let newCamera = this.getNewCamera(cameraInfo, assetType);\n if (camera) {\n newCameras[addedIndex] = newCamera;\n addedIndex += 1;\n }\n });\n\n if (addedIndex === 0) {\n return;\n }\n\n this.cameras = [...this.cameras, ...newCameras.slice(0, addedIndex)];\n }\n\n deleteCameras(cameras) {\n if (cameras.length === 0) {\n return;\n }\n\n cameras.forEach(camera => {\n camera.destroy();\n });\n\n // Update camera array\n const toRemove = new Set(cameras.map(x => x.id));\n const remaining = this.cameras.filter(x => !toRemove.has(x.id));\n this.cameras = [...remaining];\n\n // Update camera markers\n this.minimap.removeCameraMarkers(cameras);\n this.markers.removeCameraMarkers(cameras);\n }\n\n /** @private */\n getNewCamera(data, assetType) {\n let cameraID = data.id;\n if (this.getByID(cameraID)) {\n // Camera already exists\n return;\n }\n\n let camera;\n if (assetType === AssetType.Panoramic) {\n camera = new PanoramicImage(this, data);\n } else if (assetType === AssetType.Planar) {\n camera = new PlanarImage(this, data);\n } else {\n return; // Unknown camera type\n }\n\n return camera;\n }\n\n getByID(cameraID) {\n let cameras = this.cameras.filter(camera => camera.id === cameraID);\n return cameras.length === 1 ? cameras[0] : null;\n }\n\n getByName(cameraName) {\n let cameras = this.cameras.filter(camera => camera.name === cameraName);\n return cameras.length === 1 ? cameras[0] : null;\n }\n\n getByCSV(id) {\n return this.cameras.filter(camera => camera.csv === id);\n }\n\n loadImage(cameraID, opts:CameraLoadOptions = {}) {\n let camera = this.getByID(cameraID);\n if (!camera) {\n return;\n }\n\n //console.log(`Load camera: ${camera.name}`);\n camera.loadCamera(opts);\n }\n\n updateArrowNavigation() {\n this.viewer.markers.updateArrowNavigation();\n }\n\n clearImages(currentCamera: CameraImage) {\n /** Destroy all images except the current one */\n this.cameras.forEach(camera => {\n if (camera.id === currentCamera.id) {\n return;\n }\n camera.destroy();\n });\n }\n\n setMeshVisible(state) {\n this.cameras.forEach(camera => {\n if (state && !camera.enabled) {\n return;\n }\n\n if (camera.object) {\n camera.object.visible = state;\n }\n });\n }\n\n incrementCamera(increment) {\n if (!this.current) {\n return;\n }\n\n let cameraIndex = this.currentIndex;\n let nextIndex = cameraIndex + increment;\n nextIndex = (nextIndex + this.count) % this.count ;\n let nextCamera = this.cameras[nextIndex];\n this.loadImage(nextCamera.id);\n }\n\n setCameraHeights(height) {\n this.cameras.forEach(camera => {\n camera.height = height;\n });\n this.markers.recalculateAllMarkers();\n }\n\n setCameraAdjustments(adjustments) {\n this.cameras.forEach(camera => {\n const adjustment = camera.id in adjustments\n ? adjustments[camera.id]\n : [0, 0, 0];\n camera.adjustment = adjustment;\n });\n }\n\n setCameraMatrix(elements) {\n const newMatrix = new Matrix4().fromArray(elements);\n if (!this.matrix.equals(newMatrix)) {\n this.matrix = newMatrix;\n this.applyMatrixToCameras();\n this.aligned = true;\n }\n }\n\n /** Reset to identity matrix */\n resetCameraMatrix() {\n this.matrix = new Matrix4();\n this.applyMatrixToCameras();\n this.aligned = false;\n }\n\n applyMatrixToCameras() {\n this.minimap.recalculateAllMarkers();\n this.markers.recalculateAllMarkers();\n\n if (this.current) {\n this.setNormalCamera();\n this.current.setCameraPosition();\n }\n\n this.markers.updateArrowNavigation();\n }\n\n update() {\n return;\n }\n}\n\nconst multiplyRotations = (rotationA, rotationB) => {\n let matrixA = rotationA instanceof Euler\n ? new Matrix4().makeRotationFromEuler(rotationA)\n : rotationA;\n\n let matrixB = rotationB instanceof Euler\n ? new Matrix4().makeRotationFromEuler(rotationB)\n : rotationB;\n\n return new Matrix4().multiplyMatrices(matrixA, matrixB);\n};\n","import 'ol/ol.css';\nimport Map from 'ol/Map';\nimport Static from 'ol/source/ImageStatic';\nimport {Image as ImageLayer} from 'ol/layer';\nimport {transformExtent, transform} from 'ol/proj';\nimport LocalScene from '../projections';\nimport { AerialMap } from './map';\n\nclass OrthoImageLayer extends ImageLayer {\n constructor(opts) {\n super(opts);\n }\n}\n\nclass OrthoMosaic {\n public id;\n private layer: ImageLayer;\n private corners = [];\n private scaleX: number;\n private scaleY: number;\n private imageBase64: string;\n private name: string;\n private imageSize: [Number, Number];\n private imageSizeOriginal: [Number, Number];\n private imagePath: string;\n private fromJSON: boolean;\n private extent = [];\n private orthosList: OrthoMosaicList;\n private pixelMaxSpread = 10;\n private pixelMaxValue = 245;\n\n\n constructor(orthosList: OrthoMosaicList, data) {\n this.orthosList = orthosList;\n this.id = data.id;\n this.name = data.name;\n this.corners = data.corners;\n this.imageBase64 = data.base64;\n this.imageSize = data.imageSize;\n this.imageSizeOriginal = data.imageSizeOriginal;\n this.fromJSON = data.fromJSON;\n this.imagePath = data.imagePath;\n this.scaleX = data.scaleX;\n this.scaleY = data.scaleY;\n\n this.calculateExtent();\n this.addMapLayer();\n }\n\n get opacity() {\n return this.orthosList.opacity;\n }\n\n get aerialMap() {\n return this.orthosList.aerialMap;\n }\n\n get map() {\n return this.orthosList.map;\n }\n\n get projection() {\n return LocalScene.dataProjectionName;\n }\n\n get visible() {\n return this.layer.getVisible();\n }\n\n get path() {\n return this.imagePath;\n }\n\n get cornerCoordinates() {\n return this.corners;\n }\n\n get scale() {\n return [this.scaleX, this.scaleY];\n }\n\n get originalSize() {\n return this.imageSizeOriginal;\n }\n\n get orthoName() {\n return this.name;\n }\n\n get metadata() {\n return {\n x_scale: this.scaleX,\n y_scale: this.scaleY,\n x_offset: this.corners[0],\n y_offset: this.corners[3],\n x_skew: 0.0,\n y_skew: 0.0\n };\n }\n\n zoomToExtent() {\n this.aerialMap.setMapExtent(this.extent);\n }\n\n calculateExtent() {\n const extent = transformExtent(this.corners,\n this.projection, 'EPSG:3857');\n this.extent = extent;\n }\n\n transform(coordinates) {\n let coordinatesTransformed = [];\n coordinates.forEach(coordinate =>{\n let coordTransformed = transform(coordinate, 'EPSG:3857', this.projection);\n coordinatesTransformed.push(coordTransformed);\n });\n return coordinatesTransformed;\n }\n\n reverseTransform(coordinates) {\n let coordinatesTransformed = [];\n coordinates.forEach(coordinate =>{\n let coordTransformed = transform(coordinate, this.projection, 'EPSG:3857');\n coordinatesTransformed.push(coordTransformed);\n });\n return coordinatesTransformed;\n }\n\n addMapLayer() {\n // Add layer immediately to map\n this.layer = new OrthoImageLayer({opacity: this.opacity});\n this.map.addLayer(this.layer);\n\n let image = new Image();\n image.onload = () => {\n this.parseImageData(image);\n };\n image.src = this.imageBase64;\n }\n\n /** @private */\n parseImageData(image) {\n // Grab pixel data from image canvas\n const canvas = document.createElement('canvas');\n canvas.width = image.width;\n canvas.height = image.height;\n\n const context = canvas.getContext('2d');\n context.drawImage(image, 0, 0);\n\n const imageData = context.getImageData(0, 0, canvas.width, canvas.height);\n const data = imageData.data;\n\n // Set white-ish pixels to transparent\n for (var i=0; i this.pixelMaxSpread) {\n continue;\n }\n\n // Make sure the mean is within a certain range\n let pixel_mean = (r + g + b) / 3;\n let visible = pixel_mean < this.pixelMaxValue;\n data[base + 3] = visible ? 255 : 0;\n }\n\n context.putImageData(imageData, 0, 0);\n\n let source = new Static({\n url: canvas.toDataURL(\"image/png\"),\n imageExtent: this.corners,\n projection: this.projection,\n imageSmoothing: true\n });\n\n this.layer.setSource(source);\n\n if (!this.fromJSON) {\n this.zoomToExtent();\n }\n }\n\n setOpacity() {\n this.layer.setOpacity(this.opacity);\n }\n\n setVisibility(visible) {\n this.layer.setVisible(visible);\n }\n\n destroy() {\n if (!this.layer) {\n return;\n }\n\n this.map.removeLayer(this.layer);\n this.imageBase64 = null;\n }\n}\n\nexport class OrthoMosaicList {\n public orthos: OrthoMosaic[] = [];\n public opacity = 0.8;\n public aerialMap: AerialMap;\n\n constructor(aerialMap: AerialMap) {\n this.aerialMap = aerialMap;\n }\n\n get map(): Map {\n return this.aerialMap.map;\n }\n\n addNewOrtho(data) {\n let cameraID = data.id;\n if (this.getByID(cameraID)) {\n // Ortho already exists\n return false;\n }\n\n let ortho = new OrthoMosaic(this, data);\n this.orthos.push(ortho);\n }\n\n deleteOrtho(orthoID) {\n let ortho = this.getByID(orthoID);\n if (!ortho) {\n return;\n }\n\n ortho.destroy();\n const index = this.orthos.indexOf(ortho);\n this.orthos.splice(index, 1);\n }\n\n getByID(orthoID) {\n let orthos = this.orthos.filter(ortho => ortho.id === orthoID);\n return orthos.length === 1 ? orthos[0] : null;\n }\n\n toggleVisibility = (orthoID, visible) => {\n let ortho = this.getByID(orthoID);\n if (!ortho) {\n return;\n }\n\n ortho.setVisibility(visible);\n }\n\n setOpacity = (value) => {\n if ((value < 0.0) || (value > 1.0)) {\n return;\n }\n\n this.opacity = value;\n this.orthos.forEach(ortho => ortho.setOpacity());\n }\n}\n","import {createSlice} from '@reduxjs/toolkit';\n\nexport interface AerialViewState {\n extent: object;\n resolution: number;\n rotation: number;\n basemap: string;\n}\n\nexport interface SceneCameraState {\n camera: string;\n fov: number;\n angles: [number, number];\n orbit: number[];\n pivot: number[];\n}\n\ninterface CameraState {\n transform: string;\n adjustments: object,\n height: number;\n aerialState: AerialViewState;\n sceneState: SceneCameraState;\n}\n\nexport const initialAerialState = {\n extent: null,\n resolution: null,\n rotation: null,\n basemap: null\n} as AerialViewState;\n\nexport const initialSceneState = {\n camera: null,\n fov: null,\n angles: null,\n orbit: null,\n pivot: null\n} as SceneCameraState;\n\nexport const isValidCameraState = (state) => {\n let validOrbit = (state.orbit !== null) && (state.pivot !== null);\n let validCamera = state.camera !== null;\n let validState = validOrbit || validCamera;\n return validState;\n};\n\nexport const isValidAerialState = (state) => {\n return state.extent !== null\n && state.resolution !== null\n && state.rotation !== null\n && state.basemap !== null;\n};\n\nexport const cameraStateSlice = createSlice({\n name: 'camera',\n initialState: {\n transform: null,\n adjustments: {},\n height: 3.0,\n aerialState: initialAerialState,\n sceneState: initialSceneState\n } as CameraState,\n reducers: {\n changeCameraTransform: (state, action) => {\n state.transform = action.payload;\n },\n changeCameraState: (state, action) => {\n state.sceneState = action.payload;\n },\n changeCameraHeight: (state, action) => {\n state.height = action.payload;\n },\n changeBasicAdjustments: (state, action) => {\n state.adjustments = action.payload;\n },\n changeSavedAerialState: (state, action) => {\n state.aerialState = action.payload;\n },\n }\n});\n\nexport const {\n changeCameraState,\n changeCameraTransform,\n changeCameraHeight,\n changeBasicAdjustments,\n changeSavedAerialState\n} = cameraStateSlice.actions;\n\nexport default cameraStateSlice.reducer;\n\nexport const selectCameraHeight = state => state.camera.height;\nexport const selectActiveCamera = state => state.camera.sceneState.camera;\nexport const selectCameraState = state => state.camera.sceneState;\nexport const selectCameraTransform = state => state.camera.transform;\nexport const selectBasicAdjustments = state => state.camera.adjustments;\nexport const selectSavedAerialState = state => state.camera.aerialState;","import 'ol/ol.css';\n\nimport Map from 'ol/Map';\nimport Tile from 'ol/layer/Tile';\nimport View from 'ol/View';\nimport {Attribution, defaults as defaultControls} from 'ol/control';\nimport {DragPan} from 'ol/interaction';\nimport {Viewer} from \"../main\";\nimport {OSM, XYZ} from \"ol/source\";\nimport {transform} from 'ol/proj';\nimport {PanoramicImage, PlanarImage} from '../cameras';\nimport {Cluster, Vector as VectorSource} from \"ol/source\";\nimport {Vector as VectorLayer} from \"ol/layer\";\nimport {\n Circle as CircleStyle,\n RegularShape as RegularShapeStyle,\n Fill, Stroke, Style, Text\n} from \"ol/style\";\nimport {Point, Polygon} from \"ol/geom\";\nimport {Feature} from \"ol\";\nimport {boundingExtent} from 'ol/extent';\nimport LocalScene, { DataProjectionCoordinate, SceneCoordinate } from '../projections';\nimport {Vector3} from 'three';\nimport { Projection } from '../../../redux/projections-slice';\nimport { OrthoMosaicList } from './orthos';\nimport { CameraImage } from '../cameras/cameras';\nimport { AerialViewState, isValidAerialState } from '../../../redux/camera-slice';\nimport { chunkedArray } from '../misc';\nexport type Basemap = 'open-street-maps' | 'arcgis-world' | 'arcgis-street';\n\n\nconst BasemapLayer = (id: Basemap, text, source) => {\n return new Tile({\n id: id,\n text: text,\n type: 'basemap',\n source: source\n });\n};\n\nclass BaseCameraFeature extends Feature {\n public cameraID;\n public fromJSON;\n\n constructor(opts) {\n super(opts);\n this.cameraID = opts.cameraID;\n this.fromJSON = opts.fromJSON;\n }\n}\n\nclass PanoramicFeature extends BaseCameraFeature {\n constructor(opts) {\n super(opts);\n }\n}\n\nclass PlanarFeature extends BaseCameraFeature {\n constructor(opts) {\n super(opts);\n }\n}\n\nclass ViewTriangle {\n private aerial: AerialMap;\n private viewer: Viewer;\n private map: Map;\n private feature;\n private layer;\n\n constructor(parent, map, viewer) {\n this.aerial = parent;\n this.viewer = viewer;\n this.map = map;\n\n this.generateSource();\n }\n\n get camera() {\n return this.viewer.camera;\n }\n\n generateSource() {\n // Adding our view triangle source\n const source = new VectorSource({\n wrapX: false,\n noWrap: true\n });\n const polygon = new Polygon([[0,0], [0,0]]);\n const feature = new Feature(polygon);\n source.addFeature(feature);\n\n const layer = new VectorLayer({\n type: \"triangle\",\n source: source,\n style: new Style({\n stroke: new Stroke({\n color: \"rgba(0,0,0,0.5)\",\n width: 1.0\n }),\n fill: new Fill({\n color: \"rgba(64,244,155,0.5)\"\n })\n })\n });\n\n layer.setZIndex(1);\n layer.setVisible(false);\n\n this.map.addLayer(layer);\n this.feature = feature;\n this.layer = layer;\n }\n\n rotateViewMarker(lookat) {\n // Updating feature geometry\n let ring = this.generateMarkerCoordinates(lookat);\n let polygon = new Polygon([ring]);\n polygon.transform('EPSG:4326', 'EPSG:3857');\n this.feature.setGeometry(polygon);\n }\n\n generateMarkerCoordinates(lookat) {\n // Set up additional constants\n let height = this.map.getTargetElement().clientHeight;\n let coneAngle = 0.8 * 0.5 * (this.camera.fov * Math.PI / 180);\n let axis = new Vector3(0, 0, 1);\n\n // Cone length is measured in meters based on aerial height\n let meterPerPixel = this.map.getView().getResolution();\n let coneLength = height * 0.10 * meterPerPixel;\n let maxConeLength = 1000000;\n if (coneLength > maxConeLength) {\n coneLength = 0;\n }\n\n // Center position\n let v0 = this.camera.position;\n\n // Set triangle size\n let vector = new Vector3(lookat.x, lookat.y, 0);\n vector.setLength(coneLength);\n\n // First triangle corner\n let v1 = vector.clone()\n .applyAxisAngle(axis, coneAngle)\n .add(v0);\n\n // Second triangle corner\n let v2 = vector.clone()\n .applyAxisAngle(axis, -coneAngle)\n .add(v0);\n\n v0 = new SceneCoordinate(v0).toLonLat();\n v1 = new SceneCoordinate(v1).toLonLat();\n v2 = new SceneCoordinate(v2).toLonLat();\n\n let ring = [\n [v1.x, v1.y],\n [v2.x, v2.y],\n [v0.x, v0.y],\n [v1.x, v1.y]\n ];\n\n return ring;\n }\n\n clear() {\n this.layer.setVisible(false);\n }\n\n update(changeDetector) {\n if (!LocalScene.initialized) {\n return;\n }\n\n const update = changeDetector.changed;\n if (!update) {\n return;\n }\n\n // Update view marker geometry\n this.rotateViewMarker(this.viewer.lookat);\n this.layer.setVisible(true);\n }\n}\n\nexport class AerialMap {\n private viewer: Viewer;\n public containerElement;\n public map: Map;\n public orthoList: OrthoMosaicList;\n private triangle;\n private maxLayerZoom = 20;\n private maxMapZoomLevel = 23;\n private styleCache = {};\n private pointsSource;\n private boundsSource;\n public activeCamera: PanoramicImage;\n private activeCameraLayer;\n private clusterDistance = 10;\n private clusterCircleSize = 5.0;\n private camerasToIterate = [];\n private camerasCalculated = [];\n private chunkedArraySize = 500;\n public calculating = false;\n private features = [];\n private cameras = [];\n private setAerialState;\n\n public mapSystem = {\n string: \"EPSG:3857\",\n transform: null\n } as Projection;\n\n constructor(viewer: Viewer, container, props) {\n const {setAerialState} = props;\n\n this.viewer = viewer;\n this.containerElement = container;\n this.setAerialState = setAerialState;\n\n this.initMap();\n this.initEvents();\n this.initDataLayers();\n\n this.orthoList = new OrthoMosaicList(this);\n }\n\n get defaultLayers() {\n const arcGISBase = \"https://services.arcgisonline.com/ArcGIS/rest/services\";\n\n const layers = [\n BasemapLayer(\"open-street-maps\", \"OpenStreetMaps\", new OSM({\n maxZoom: this.maxLayerZoom\n })),\n\n BasemapLayer(\"arcgis-world\", \"ArcGIS World\", new XYZ({\n url: `${arcGISBase}/World_Imagery/MapServer/tile/{z}/{y}/{x}.png`,\n maxZoom: this.maxLayerZoom\n })),\n\n BasemapLayer(\"arcgis-world\", \"ArcGIS World\", new XYZ({\n attributions: 'Powered by Esri',\n url: `${arcGISBase}/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}.png`,\n maxZoom: this.maxLayerZoom\n })),\n\n BasemapLayer(\"arcgis-street\", \"ArcGIS Street\", new XYZ({\n attributions: 'Powered by Esri',\n url: `${arcGISBase}/World_Street_Map/MapServer/tile/{z}/{y}/{x}.png`,\n maxZoom: this.maxLayerZoom\n })),\n ];\n\n return layers;\n }\n\n get cameraList() {\n return this.viewer.cameraList;\n }\n\n get width() {\n return this.containerElement.scrollWidth;\n }\n\n get height() {\n return this.containerElement.scrollHeight;\n }\n\n get basemapIds() {\n let layers = [];\n this.basemapLayers.forEach(layer => {\n let id = layer.get(\"id\");\n let text = layer.get(\"text\");\n let ids = layers.map(x => x.id);\n if (ids.indexOf(id) !== -1) {\n return;\n }\n layers.push({id, text});\n });\n\n return layers;\n }\n\n get basemapLayers() {\n let layers = this.map.getLayers();\n return layers.array_.filter(layer => layer.get(\"type\") === \"basemap\");\n }\n\n get activeBasemap() {\n let basemapID = null;\n this.basemapLayers.forEach(layer => {\n let isVisible = layer.getVisible();\n if (isVisible) {\n basemapID = layer.get(\"id\");\n }\n });\n\n return basemapID;\n }\n\n reset(state = null) {\n this.resetView(state);\n }\n\n resetView(state = null) {\n const view = this.map.getView();\n const validExtent = state && isValidAerialState(state);\n\n if (validExtent) {\n view.fit(state.extent);\n view.setResolution(state.resolution);\n view.setRotation(state.rotation);\n this.setVisibleBasemap(state.basemap);\n } else {\n const center = transform([0, 0], 'EPSG:4326', 'EPSG:3857');\n view.setCenter(center);\n view.setZoom(0);\n view.setRotation(0);\n\n let defaultID = this.basemapLayers[0].get(\"id\");\n this.setVisibleBasemap(defaultID);\n }\n\n this.setActiveCamera();\n }\n\n initMap() {\n const attribution = new Attribution({\n collapsible: true,\n });\n\n this.map = new Map({\n layers: this.defaultLayers,\n target: this.containerElement,\n fractionalZoom: false,\n controls: defaultControls({\n zoom: false,\n attribution: false,\n rotate: true\n }).extend([attribution]),\n view: new View({\n maxZoom: this.maxMapZoomLevel\n })\n });\n\n this.triangle = new ViewTriangle(this, this.map, this.viewer);\n this.resetView();\n }\n\n initEvents() {\n this.map.on('click', event => {\n this.map.forEachFeatureAtPixel(event.pixel, (feature, layer) => {\n let features = feature.get('features');\n if ((feature.length === 0) || (!features)) {\n return;\n }\n\n if (features.length === 1) {\n // Load specific image\n let cameraID = features[0].cameraID;\n this.cameraList.loadImage(cameraID);\n return;\n }\n\n // Multiple projects. Zoom in further\n let coordinates = [];\n features.forEach(feature => {\n let position = feature.get(\"position\");\n coordinates.push(position);\n });\n\n // Max zoom already reached, load the first camera\n // in our cluster of cameras\n let currentZoom = Math.ceil(this.map.getView().getZoom());\n if (currentZoom === this.maxMapZoomLevel) {\n let cameraID = features[0].get(\"cameraID\");\n this.cameraList.loadImage(cameraID);\n return;\n }\n\n // Zoom to our extent with 50% boundary\n let ext = boundingExtent(coordinates);\n let mapSize = this.map.getSize();\n this.map.getView().fit(ext, {\n size: [mapSize[0] * 0.5, mapSize[1] * 0.5],\n nearest: false,\n duration: 250,\n });\n });\n });\n\n this.map.on('moveend', () => {\n this.updateSavedState();\n });\n }\n\n initDataLayers() {\n // Create cluster layer for images\n this.pointsSource = new VectorSource({\n wrapX: false,\n noWrap: true\n });\n\n let clusterSource = new Cluster({\n distance: this.clusterDistance,\n source: this.pointsSource,\n });\n\n let clusterLayer = new VectorLayer({\n source: clusterSource,\n style: feature => {\n return this.clusterStyle(feature);\n },\n });\n\n this.map.addLayer(clusterLayer);\n\n // Create geometry layer for pointcloud bounds\n this.boundsSource = new VectorSource({\n wrapX: false,\n noWrap: true\n });\n\n let boundsLayer = new VectorLayer({\n source: this.boundsSource,\n style: new Style({\n fill: new Fill({\n color: 'rgba(51, 153, 204, 0.1)'\n }),\n stroke: new Stroke({\n color: 'rgba(0, 0, 0, 0.5)',\n width: 2\n }),\n })\n });\n\n this.map.addLayer(boundsLayer);\n\n // Activate camera source\n this.activeCameraLayer = new VectorLayer({\n visible: false,\n source: new VectorSource({\n wrapX: false,\n noWrap: true,\n features: [new Feature({\n geometry: new Point([0,0])\n })]\n }),\n style: this.styleGenerator(1, true)\n });\n\n this.map.addLayer(this.activeCameraLayer);\n }\n\n setDragState(state) {\n this.map.interactions.forEach(interaction => {\n if (interaction instanceof DragPan) {\n interaction.setActive(state);\n }\n });\n }\n\n centerOnImages() {\n if (this.cameraList.count === 0) {\n return;\n }\n\n this.setMapExtent(this.cameraList.imageExtent);\n }\n\n updateSavedState() {\n let view = this.map.getView();\n let rotation = view.getRotation();\n let resolution = view.getResolution();\n let extent = view.calculateExtent();\n let basemap = this.basemapLayers\n .find(x => x.getVisible())\n .get(\"id\");\n\n this.setAerialState({\n extent: extent,\n resolution: resolution,\n rotation: rotation,\n basemap: basemap\n } as AerialViewState);\n }\n\n updateCloudExtent(boundingBox=null) {\n if (!boundingBox) {\n this.boundsSource.clear();\n return;\n }\n\n let min = new SceneCoordinate(boundingBox.min).toDataProjection();\n let max = new SceneCoordinate(boundingBox.max).toDataProjection();\n\n let corners = [\n [min.x, min.y],\n [max.x, min.y],\n [max.x, max.y],\n [min.x, max.y]\n ];\n\n let cornersAerial = corners.map(value => {\n return new SceneCoordinate(value).toAerial();\n });\n\n let feature = new Feature({\n geometry: new Polygon([cornersAerial])\n });\n\n this.boundsSource.clear();\n this.boundsSource.addFeature(feature);\n }\n\n addCameraMarkers(cameras: Array) {\n let newCameras = cameras.filter(x => !this.cameras.includes(x));\n this.cameras = [...this.cameras, ...newCameras];\n\n // Clear previous data\n this.features = [];\n this.pointsSource.clear();\n\n // Reset chunked arrays\n this.camerasToIterate = chunkedArray(this.cameras, this.chunkedArraySize);\n this.camerasCalculated = [];\n this.calculating = this.cameras.length > 0;\n }\n\n calculateCameras() {\n if (this.viewer.calculatingSceneMarkers) {\n return;\n }\n\n if (this.camerasToIterate.length === 0) {\n return;\n }\n\n // Get next set of cameras in chunked array\n const cameras = this.camerasToIterate.shift();\n\n // Calculate position data\n this.camerasCalculated = [\n ...this.camerasCalculated,\n ...cameras.map(x => {\n let position = x.position.aerial;\n let point = new Point([position[0], position[1]]);\n return [position, point];\n })\n ];\n\n // If we have more data to parse exit early\n // and wait until next iteration\n if (this.camerasToIterate.length !== 0) {\n return;\n }\n\n let features = new Array(this.cameras.length);\n this.camerasCalculated.forEach((data, cameraIndex) => {\n let [position, point] = data;\n let camera = this.cameras[cameraIndex];\n\n const opts = {\n geometry: point,\n cameraID: camera.id,\n position: position,\n fromJSON: camera.fromJSON\n };\n\n let feature;\n if (camera instanceof PanoramicImage) {\n feature = new PanoramicFeature(opts);\n } else if (camera instanceof PlanarImage) {\n feature = new PlanarFeature(opts);\n }\n\n features[cameraIndex] = feature;\n });\n\n this.features = features;\n this.pointsSource.clear();\n this.pointsSource.addFeatures(this.features);\n this.calculating = false;\n\n const updateExtent = this.features\n .filter(x => x.fromJSON).length === 0;\n\n if (!updateExtent) {\n return;\n }\n\n this.centerOnImages();\n }\n\n removeCameraMarkers(cameras: CameraImage[]) {\n const toRemove = new Set(cameras.map(x => x.id));\n\n const remainingCameras = this.cameras.filter(x => !toRemove.has(x.id));\n this.cameras = [...remainingCameras];\n\n const remainingFeatures = this.features.filter(x => !toRemove.has(x.cameraID));\n this.features = [...remainingFeatures];\n }\n\n recalculateAllMarkers() {\n const cameras = [...this.cameras];\n this.removeCameraMarkers(cameras);\n this.addCameraMarkers(cameras);\n }\n\n styleGenerator(size, active, square = false) {\n const strokeColor = 'rgba(0, 0, 0, 1.0)';\n const textColor = 'rgba(0, 0, 0, 1.0)';\n const fillColor = active\n ? 'rgba(255, 195, 0, 0.8)'\n : 'rgba(255, 255, 255, 0.8)';\n\n const scale = (1 + 0.25 * Math.log(size));\n const radius = this.clusterCircleSize * scale;\n\n const circleImage = new CircleStyle({\n radius: radius,\n stroke: new Stroke({\n color: strokeColor\n }),\n fill: new Fill({\n color: fillColor\n }),\n });\n\n const squareImage = new RegularShapeStyle({\n radius: radius * 1.3,\n stroke: new Stroke({\n color: strokeColor,\n width: Math.sqrt(2.0) * 0.95\n }),\n fill: new Fill({\n color: fillColor\n }),\n angle: Math.PI / 4,\n points: 4\n });\n\n return new Style({\n image: square ? squareImage : circleImage,\n text: new Text({\n text: size > 1 ? size.toString() : \"\",\n fill: new Fill({color: textColor}),\n }),\n });\n }\n\n clusterStyle(feature) {\n let features = feature.get('features');\n\n let numSquares = 0;\n let numCircles = 0;\n features.forEach(feature => {\n numSquares += (feature instanceof PlanarFeature) ? 1 : 0;\n numCircles += (feature instanceof PanoramicFeature) ? 1 : 0;\n });\n\n let square = (numSquares > 0) && (numCircles === 0);\n\n let size = features.length;\n let styleKey = `${features.length}-${square ? \"square\" : \"circle\"}`;\n let style = this.styleCache[styleKey];\n\n if (!style) {\n style = this.styleGenerator(size, false, square);\n this.styleCache[styleKey] = style;\n }\n return style;\n }\n\n setVisibleBasemap(basemapID) {\n this.basemapLayers.forEach(layer => {\n let id = layer.get(\"id\");\n layer.setVisible(id === basemapID);\n });\n\n this.updateSavedState();\n }\n\n setActiveCamera(cameraID = null) {\n let camera = this.cameras.find(x => x.id === cameraID);\n if (!camera) {\n this.activeCamera = null;\n this.activeCameraLayer?.setVisible(false);\n return;\n }\n\n const mapPosition = camera.position.aerial;\n const point = new Point([mapPosition[0], mapPosition[1]]);\n let feature = this.activeCameraLayer.getSource().getFeatures()[0];\n feature.setGeometry(point);\n this.activeCamera = camera;\n\n if (camera instanceof PanoramicImage) {\n // Force circle style\n feature.setStyle(this.styleGenerator(1, true, false));\n } else if (camera instanceof PlanarImage) {\n // Force square style\n feature.setStyle(this.styleGenerator(1, true, true));\n }\n\n this.activeCameraLayer.setVisible(true);\n }\n\n setMapExtent(extent) {\n const view = this.map.getView();\n\n view.setRotation(0);\n view.fit(extent, this.map.getSize());\n view.setZoom(view.getZoom() - 1.0);\n }\n\n destroy() {\n this.map.setTarget(null);\n }\n\n update(changeDetector) {\n this.calculateCameras();\n\n if (this.viewer.orbitState) {\n this.triangle.clear();\n return;\n }\n\n if (this.viewer.hasPoints || this.viewer.cameraSelected) {\n this.triangle.update(changeDetector);\n }\n }\n}\n\nexport const extentFromPoints = (positions, reproject=true) => {\n let xPositions = [];\n let yPositions = [];\n\n if (reproject) {\n positions = positions.map(position => {\n let lonlat = new DataProjectionCoordinate(position).toLonLat();\n let mapPos = transform([lonlat.x, lonlat.y], 'EPSG:4326', 'EPSG:3857');\n return mapPos;\n });\n }\n\n positions.forEach(position => {\n xPositions.push(position[0]);\n yPositions.push(position[1]);\n });\n\n let extent = [\n Math.min(...xPositions),\n Math.min(...yPositions),\n Math.max(...xPositions),\n Math.max(...yPositions)\n ];\n\n return extent;\n};\n","import {BinaryHeap} from \"../binary-heap\";\nimport {RawPointCloudNode} from \"./raw-pointcloud-node\";\nimport {RawPointCloud} from \"./raw-pointcloud\";\nimport {closestPowerOfTwo} from \"../misc\";\nimport { mergeBoundingBoxes, PointCloud } from \"./point-cloud\";\nimport {PointCloudMaterialParams} from \"../materials\";\nimport {Viewer} from \"../main\";\nimport { getProjFactor } from \"../utilities\";\nimport { EncompassPointCloud } from \"./encompass-pointcloud\";\nimport { SceneCoordinate, SphericalPosition } from \"../projections\";\nimport { extentFromPoints } from \"../aerial/map\";\nimport { pointInPolygon } from \"../utilities/polygon\";\nimport {\n BufferGeometry,\n Frustum,\n MathUtils,\n Matrix4,\n Points,\n Scene,\n Vector2,\n Vector3\n} from \"three\";\nimport { WorkerQueue } from \"../worker\";\n\nexport class PointCloudManager {\n public viewer: Viewer;\n public scene: Scene;\n public materialDefaults: PointCloudMaterialParams;\n public clouds: (RawPointCloud | EncompassPointCloud)[] = [];\n public workerQueue: WorkerQueue;\n public visiblePointsTarget = 0;\n private maxloadedToGPUPerFrame = 3;\n private maxNodeAsyncLoad = 4;\n private maxRawAsyncLoad = 2;\n private maxDecodeWorkers = 6;\n private exeLaunchTimeout = 1000;\n private lastExeLaunched = performance.now();\n public numLoadedPoints = 0;\n public numVisiblePoints = 0;\n public numSceneNodesVisible = 0;\n private fovDifferencePercent = 0.5;\n private minPixelPercent = 0.20;\n private boundingBoxVisibility = false;\n private loadedOnce = false;\n public transparency = 1.0;\n public rawJsonResponse = [];\n\n constructor(parent: Viewer) {\n this.viewer = parent;\n\n // Material defaults\n this.materialDefaults = {\n minSize: 1.0,\n maxSize: 50.0,\n colorMap: \"heat-map\",\n colorType: 2,\n distance: this.viewer.far,\n size: 1.0,\n dynamicSize: true,\n circularPoints: true,\n classification: {},\n heightClamp: new Vector2(0, 1),\n intensityClamp: new Vector2(0, 1),\n };\n\n this.scene = new Scene();\n this.setLoadedOnce(false);\n\n const workerURL = \"workers/pointcloud-decoder-buffer.js\";\n this.workerQueue = new WorkerQueue(workerURL,\n this.maxDecodeWorkers, true);\n }\n\n get cameraList() {\n return this.viewer.cameraList;\n }\n\n get minimap() {\n return this.viewer.minimap;\n }\n\n get controls() {\n return this.viewer.controls;\n }\n\n get uniqueClassifications(): number[] {\n let uniqueClassifications = new Set();\n this.clouds.forEach(cloud => {\n cloud.uniqueClassifications.forEach((item: number) => {\n uniqueClassifications.add(item);\n });\n });\n return Array.from(uniqueClassifications) as number[];\n }\n\n get combinedBoundingBox() {\n let boundingBox = null;\n this.clouds.forEach(cloud => {\n if (!cloud.visible) {\n return;\n }\n\n boundingBox = mergeBoundingBoxes(boundingBox,\n cloud.tightBoundingBox);\n });\n return boundingBox;\n }\n\n get isEmpty() {\n return this.clouds.length === 0;\n }\n\n get rawPointClouds() : Array {\n let clouds = this.clouds.filter(x => x instanceof RawPointCloud);\n return clouds as Array;\n }\n\n getByID(id){\n const pointCloud = this.clouds.filter(pointCloud => pointCloud.identifier === id);\n return pointCloud.length === 1 ? pointCloud[0] : null;\n }\n\n doesCloudExist(identifier: string): boolean {\n return this.clouds.filter(cloud => cloud.identifier === identifier).length > 0;\n }\n\n addPointCloud(cloud: RawPointCloud | EncompassPointCloud) {\n this.clouds.push(cloud);\n this.updateMeasureList();\n }\n\n deletePointCloud(identifier) {\n const clouds = new Set(this.clouds);\n const toRemove = this.clouds.filter(cloud => cloud.identifier === identifier);\n\n toRemove.forEach(cloud => {\n // console.log(`Remove pointcloud [id = ${cloud.identifier}]`);\n cloud.dispose();\n clouds.delete(cloud);\n });\n\n this.clouds = [...clouds];\n this.updateMinimapExtent();\n this.updateMeasureList();\n }\n\n updateMeasureList() {\n const measurements = this.controls.measurements;\n measurements.refreshMeasurementList();\n }\n\n toggleVisibility(identifier, state) {\n this.clouds\n .filter(cloud => cloud.identifier === identifier)\n .forEach(cloud => {\n cloud.setVisibility(state);\n });\n }\n\n toggleBoundingBox() {\n this.boundingBoxVisibility = !this.boundingBoxVisibility;\n console.log(\"Bounding box visible: \", this.boundingBoxVisibility);\n }\n\n hideDescendants(cloud) {\n if (!cloud.root) {\n return;\n }\n\n let stack = [cloud.root];\n\n while (stack.length > 0) {\n let object = stack.shift();\n if (!object.visible) {\n continue;\n }\n\n object.setVisibility(false, false);\n\n object.children.forEach(child => {\n stack.push(child);\n });\n }\n }\n\n updateClamping(defaultKey, materialKey, data) {\n if (data.max <= data.min) {\n return;\n }\n\n let value = new Vector2(data.min, data.max);\n this.materialDefaults[defaultKey] = value;\n this.clouds.forEach(cloud => {\n cloud.materials.forEach(material => {\n material[materialKey] = value;\n });\n });\n }\n\n setClassification(classification, visible) {\n this.materialDefaults.classification[classification] = visible;\n\n this.clouds.forEach(cloud => {\n cloud.materials.forEach(material => {\n let uniforms = material.uniforms;\n let visibilityArray = uniforms.classification_visible.value;\n visibilityArray[classification] = visible;\n });\n });\n }\n\n orbitPositionFromBounds(bbox, side, smooth) {\n let boxSize = new Vector3()\n .add(bbox.max)\n .sub(bbox.min);\n\n let boxMean = new Vector3()\n .add(boxSize)\n .divideScalar(2.0)\n .add(bbox.min);\n\n boxSize.multiplyScalar(1.25);\n\n let boundSize = Math.max(boxSize.x, boxSize.y, boxSize.z);\n let height = bbox.min.z + boxSize.z*0.25;\n let pivot = new Vector3(boxMean.x, boxMean.y, height);\n\n // Make sure our initial height doesnt exceed the far plane\n let maxHeight = this.viewer.camera.far * 0.75;\n let radius = Math.min(maxHeight, boundSize / 2.0);\n\n let position = this.orbitWithAngle(pivot, radius, side);\n\n return {position, pivot, smooth};\n }\n\n orbitWithAngle(pivot, radius, side) {\n let theta;\n let phi;\n\n side = side.toLowerCase();\n switch (side) {\n case \"top\":\n theta = 270;\n phi = 0.01;\n break;\n case \"bottom\":\n theta = 270;\n phi = 179.99;\n break;\n case \"right\":\n theta = 0.0;\n phi = 90;\n break;\n case \"left\":\n theta = 180;\n phi = 90;\n break;\n case \"front\":\n theta = 270;\n phi = 90;\n break;\n case \"back\":\n theta = 90;\n phi = 90;\n break;\n default:\n theta = 0.0;\n phi = 0.0;\n }\n\n let orbit = new SphericalPosition()\n .fromValues(radius, theta, phi)\n .toVector3()\n .add(pivot);\n\n return orbit;\n }\n\n updateMinimapExtent() {\n let boundingBox = this.combinedBoundingBox;\n this.minimap.updateCloudExtent(boundingBox);\n }\n\n setLoadedOnce(state) {\n this.loadedOnce = state;\n }\n\n zoomToExtent(boundingBox, ignoreConditions, smooth) {\n let camerasExist = this.cameraList.current !== null;\n\n if (!ignoreConditions) {\n if (camerasExist) {\n return;\n }\n\n if (this.loadedOnce) {\n return;\n }\n }\n\n // Zoom to 3d mode extent\n this.setLoadedOnce(true);\n let newPosition = this.orbitPositionFromBounds(\n boundingBox, \"top\", smooth);\n this.controls.setOrbitState(true, newPosition);\n\n // Zoom to map extent\n let positions = [boundingBox.min, boundingBox.max].map(position => {\n return new SceneCoordinate(position).toDataProjection();\n });\n\n let extent = extentFromPoints(positions);\n this.minimap.setMapExtent(extent);\n }\n\n updateVisibility(frustum, cloud: PointCloud) {\n if (!cloud.root) {\n return;\n }\n\n let priorityQueue = new BinaryHeap(function (x) {\n return 1 / x.weight;\n });\n priorityQueue.push({\n node: cloud.root,\n weight: Number.MAX_VALUE\n });\n\n let unloadedGeometry = [];\n let numLoadedPoints = 0;\n let loadedToGPUThisFrame = 0;\n\n let maxNodeDistance = cloud.materialScene.distance;\n let controls = this.viewer.controls;\n let measurePoint = controls.getCameraTarget();\n\n while (priorityQueue.size() > 0) {\n let element = priorityQueue.pop();\n let node = element.node;\n\n // Raw pointclouds dont require certain steps\n let isRawPointCloud = node instanceof RawPointCloudNode;\n\n let newPointsTarget = numLoadedPoints;\n if (node.numPoints !== null) {\n newPointsTarget += node.numPoints;\n }\n\n // Ignore nodes based on our view frustrum\n let visible = frustum.intersectsSphere(node.boundingSphere);\n\n if (!isRawPointCloud) {\n // Make sure we dont exceeed our points limit\n visible = visible && (newPointsTarget < this.visiblePointsTarget);\n }\n\n if (!visible) {\n continue;\n }\n\n // Ignore nodes based on distance slider\n let bounds2d = new Vector2().copy(node.center);\n let camera2d = new Vector2().copy(measurePoint);\n let nodeDistance = bounds2d.distanceTo(camera2d);\n if (nodeDistance > (node.radius + maxNodeDistance)) {\n continue;\n }\n\n if (node.isGeometryNode() && (!node.parent || node.parent.isTreeNode())) {\n if (node.isLoaded() && loadedToGPUThisFrame < this.maxloadedToGPUPerFrame) {\n node.addToScene(node);\n loadedToGPUThisFrame++;\n } else {\n unloadedGeometry.push(node);\n }\n }\n\n if (node.isTreeNode()) {\n node.setVisibility(true, this.boundingBoxVisibility);\n numLoadedPoints += node.numPoints;\n }\n\n let cameraPosition = this.viewer.camera.position;\n node.children.forEach(child => {\n let childDistance = child.center.distanceTo(cameraPosition);\n let childRadius = child.radius;\n\n // Modify the fov range so we dont load too many points while zooming\n let maxFov = this.viewer.controls.maxFOV;\n let fov = this.viewer.camera.fov;\n fov = maxFov - (maxFov - fov) * this.fovDifferencePercent;\n fov = MathUtils.degToRad(fov);\n\n const screenHeight = this.viewer.height;\n let projFactor = getProjFactor(fov, childDistance, screenHeight);\n let screenPixelRadius = childRadius * projFactor;\n\n let insideSphere = childDistance < childRadius;\n\n if (!isRawPointCloud) {\n // Pixel size based filtering\n let minPixelSize = this.viewer.height * this.minPixelPercent;\n let validPixelSize = screenPixelRadius >= minPixelSize;\n if (!validPixelSize) {\n return;\n }\n }\n\n let weight = screenPixelRadius;\n if (insideSphere) {\n weight = Number.MAX_VALUE;\n }\n\n priorityQueue.push({\n node: child,\n weight: weight\n });\n });\n }\n\n let maxLoad = Math.min(this.maxNodeAsyncLoad, unloadedGeometry.length);\n for (let i = 0; i < maxLoad; i++) {\n unloadedGeometry[i].load();\n }\n\n this.numLoadedPoints += numLoadedPoints;\n }\n\n updateMaterialDefaults(cloud: PointCloud, camera) {\n if (!cloud.root) {\n return;\n }\n\n cloud.materials.forEach(material => {\n\n if (!material) {\n return;\n }\n\n let controls = this.viewer.controls;\n let cameraPosition = controls.getCameraTarget();\n\n material.dynamic_cloud = !(cloud instanceof RawPointCloud);\n material.origin = cameraPosition;\n material.screenHeight = this.viewer.height;\n material.screenwidth = this.viewer.width;\n material.fov = camera.fov * Math.PI / 180.0;\n\n if (cloud instanceof EncompassPointCloud) {\n material.octree_spacing = cloud.spacing;\n material.octree_size = parseFloat(cloud.root.size);\n material.octree_corner = new Vector3()\n .add(cloud.root.center)\n .subScalar(cloud.root.size / 2.0);\n }\n\n let intensityRange = cloud.intensityRange;\n if (intensityRange) {\n let intensity = new Vector2(intensityRange.min,\n intensityRange.max);\n material.intensity_range = intensity;\n }\n\n let maxColor = cloud.maxColor;\n if (maxColor) {\n let maxValue = closestPowerOfTwo(maxColor);\n material.rgb_max = maxValue;\n }\n\n let tightBoundingBox = this.combinedBoundingBox;\n if (tightBoundingBox) {\n let height = new Vector2(tightBoundingBox.min.z,\n tightBoundingBox.max.z);\n material.height_range = height;\n }\n });\n }\n\n updateCloudSampling() {\n let percent = this.visiblePointsTarget/this.numLoadedPoints;\n percent = Math.min(1.0, percent);\n\n this.clouds.forEach(cloud => {\n if (!(cloud instanceof RawPointCloud)) {\n // Only applicable to raw pointclouds\n return;\n }\n\n if (!cloud.visible) {\n return;\n }\n\n if (!cloud.root) {\n return;\n }\n\n cloud.root.children.forEach(child => {\n if (!child.geometry) {\n return;\n }\n\n let numPoints = child.numPoints;\n let sampledPoints = Math.floor(numPoints*percent);\n child.geometry.setDrawRange(0, sampledPoints);\n });\n });\n }\n\n calculatePointsVisible() {\n let visibleNodes = this.scene.children\n .filter(x => x instanceof Points)\n .filter(x => x.visible) as Points[];\n\n this.numVisiblePoints = 0;\n this.numSceneNodesVisible = visibleNodes.length;\n\n visibleNodes.forEach(node => {\n let geometry = node.geometry as BufferGeometry;\n let numPoints = geometry.attributes.position.count;\n let numVisible = Math.min(numPoints, geometry.drawRange.count);\n this.numVisiblePoints += numVisible;\n });\n }\n\n manageNodeCache(cloud: EncompassPointCloud) {\n if (!cloud.root) {\n return;\n }\n\n let stack = [cloud.root];\n\n let totalVisibleNodes = 0;\n let unusedNodes = [];\n\n while (stack.length > 0) {\n let object = stack.shift();\n\n if (object.visible) {\n totalVisibleNodes++;\n } else if (object.loaded) {\n unusedNodes.push(object);\n } else {\n continue;\n }\n\n object.children.forEach(child => {\n stack.push(child);\n });\n }\n\n let totalUnusedNodes = unusedNodes.length;\n let totalNumberNodes = totalVisibleNodes + totalUnusedNodes;\n let maxNodesAllowed = cloud.nodeCacheSize;\n\n if (totalNumberNodes < maxNodesAllowed) {\n return;\n }\n\n // console.log(`${totalNumberNodes}/${maxNodesAllowed} Nodes loaded. Visible: ${totalVisibleNodes}, Cached: ${totalUnusedNodes}`);\n\n // We delete from our list of unused nodes plus an extra percentage of the total\n let numberToDelete = totalNumberNodes - maxNodesAllowed + maxNodesAllowed * 0.20;\n numberToDelete = Math.min(numberToDelete, totalUnusedNodes);\n if (numberToDelete === 0) {\n return;\n }\n\n // console.log(`Dispose ${numberToDelete} cached nodes`);\n\n // Delete unused nodes, starting at the highest detail level we have\n unusedNodes.reverse();\n unusedNodes.forEach((node, index) => {\n if (index >= numberToDelete) {\n return;\n }\n\n node.dispose();\n });\n }\n\n updateVisibilityTexture(cloud: EncompassPointCloud) {\n // Material not created yet\n cloud.materials.forEach(material => {\n if (!material) {\n return;\n }\n\n // Static sizing, exit the function\n if (!material.dynamic_size) {\n return;\n }\n\n let visibleNodes = cloud.getVisibleNodes();\n let texture = material.visibleNodesTexture;\n let data = texture.image.data;\n\n visibleNodes.forEach((node, nodeIndex) => {\n data[nodeIndex * 3 + 0] = 0; // indicate which of the 8 children are visible\n data[nodeIndex * 3 + 1] = 0; // relative offset to the node’s first child.\n data[nodeIndex * 3 + 2] = 0; // empty\n\n // The children nodes that are visible from our original array\n let children = visibleNodes.filter(child => {\n return child.parent === node;\n });\n\n children.forEach((child, childIndex) => {\n let index = parseInt(child.name.substr(-1));\n\n // Set the bit that represents this node to true\n data[nodeIndex * 3 + 0] += Math.pow(2, index);\n\n if (childIndex === 0) {\n // Save the offset to our first child node\n let vArrayIndex = visibleNodes.indexOf(child);\n data[nodeIndex * 3 + 1] = vArrayIndex - nodeIndex;\n }\n });\n });\n\n texture.needsUpdate = true;\n });\n }\n\n updateShaderVertex(array, index, vertex) {\n array.value[index] = vertex.x;\n array.value[index + 1] = vertex.y;\n array.value[index + 2] = vertex.z;\n }\n\n updateAreaVertices(areaGeometry) {\n this.clouds.forEach(cloud => {\n cloud.materials.forEach(material => {\n let areaMeasureData = material.uniforms.area_measure_data;\n let volumeStatus = material.uniforms.volume_status;\n let maxTriangles = material.uniforms.max_triangles.value;\n\n areaMeasureData.value.fill(0.0);\n volumeStatus.value.fill(0.0);\n\n let triangleNumber = 0;\n areaGeometry.forEach(data => {\n data.indices.forEach(triangleIndex => {\n if (triangleNumber >= maxTriangles) {\n return;\n }\n\n let base = triangleNumber * 9;\n volumeStatus.value[triangleNumber] = data.volumeStatus;\n\n triangleIndex.forEach((vertexIndex, index) => {\n let vertex = data.vertices[vertexIndex];\n let vIndex = base + index * 3;\n this.updateShaderVertex(areaMeasureData, vIndex, vertex);\n });\n\n triangleNumber = triangleNumber + 1;\n });\n });\n\n material.needsUpdate = true;\n });\n });\n }\n\n pushToWorkerQueue(data, callback) {\n this.workerQueue.push(data, callback, [data.buffer]);\n }\n\n loadAvailableLasData() {\n let numLoading = 0;\n let cloudsToParse = [];\n let cloudsToExecute = [];\n\n // Execute next available in worker queue\n this.workerQueue.process();\n\n this.rawPointClouds.forEach(cloud => {\n if ((!cloud.canReadData) || (!cloud.visible) || (cloud.loaded)) {\n return;\n }\n\n if (numLoading >= this.maxRawAsyncLoad) {\n return;\n }\n\n if (cloud.generatingChunks) {\n cloudsToParse.push(cloud);\n } else {\n let timeNow = performance.now();\n let timeSinceLaunch = timeNow - this.lastExeLaunched;\n if (timeSinceLaunch > this.exeLaunchTimeout) {\n this.lastExeLaunched = timeNow;\n cloudsToExecute.push(cloud);\n }\n }\n\n numLoading += 1;\n });\n\n if (cloudsToExecute.length > 0) {\n let cloud = cloudsToExecute.shift();\n cloud.launchExecutable();\n return;\n }\n\n for (let cloud of cloudsToParse) {\n cloud.parseAvailableChunks();\n }\n }\n\n pointsInRadius(position, size) {\n var points = [];\n\n this.clouds.forEach(cloud => {\n // Grab valid nodes\n let nodes = cloud.getVisibleNodes(node => {\n let dx = Math.abs(node.center.x - position.x);\n let dy = Math.abs(node.center.y - position.y);\n\n return !((dx > node.size) || (dy > node.size));\n });\n\n // Grab valid points\n nodes.forEach(node => {\n let geometry = node.pointsScene.geometry as BufferGeometry;\n let positions = geometry.attributes.position;\n\n for (var i = 0; i < positions.count; i++) {\n let x = positions.getX(i) + node.pointsScene.position.x;\n let y = positions.getY(i) + node.pointsScene.position.y;\n let z = positions.getZ(i) + node.pointsScene.position.z;\n\n let dx = Math.abs(x - position.x);\n let dy = Math.abs(y - position.y);\n\n if ((dx > size) || (dy > size)) {\n continue;\n }\n\n let point = new Vector3(x, y, z);\n points.push(point);\n }\n });\n });\n\n return points;\n }\n\n pointsInPolygon(points, vertices) {\n let pointsInPolygon = [];\n\n points.forEach(point => {\n if (pointInPolygon(point, vertices)) {\n pointsInPolygon.push(point);\n }\n });\n\n return pointsInPolygon;\n }\n\n getSampledPoints(points, highest, keyfunc) {\n let samples = {};\n points.forEach(point => {\n let key = keyfunc(point);\n if (!(key in samples)) {\n samples[key] = [];\n }\n\n samples[key].push(point);\n });\n\n let dtmPoints = [];\n let keys = Object.keys(samples);\n keys.forEach(key => {\n let data = samples[key];\n data.sort((a, b) => (a.z > b.z) ? 1 : -1);\n if (highest) {\n data.reverse();\n }\n dtmPoints.push(data[0]);\n });\n\n console.log(`Sampled points: ${points.length} => ${dtmPoints.length}`);\n return dtmPoints;\n }\n\n update() {\n // Set up our frustum\n let frustum = new Frustum();\n let cameraViewProjectionMatrix = new Matrix4();\n this.viewer.camera.updateProjectionMatrix();\n this.viewer.camera.updateMatrixWorld(true);\n this.viewer.camera.matrixWorldInverse.getInverse(this.viewer.camera.matrixWorld);\n cameraViewProjectionMatrix.multiplyMatrices(\n this.viewer.camera.projectionMatrix,\n this.viewer.camera.matrixWorldInverse\n );\n frustum.setFromProjectionMatrix(cameraViewProjectionMatrix);\n\n this.numLoadedPoints = 0;\n\n // Keep loading raw pointcloud data\n this.loadAvailableLasData();\n\n // Iterate each pointcloud and figure out what to show\n this.clouds.forEach(cloud => {\n this.hideDescendants(cloud);\n if (!cloud.visible) {\n return;\n }\n\n this.updateVisibility(frustum, cloud);\n\n if (cloud instanceof EncompassPointCloud) {\n this.manageNodeCache(cloud);\n }\n\n this.updateMaterialDefaults(cloud, this.viewer.camera);\n\n if (cloud instanceof EncompassPointCloud) {\n this.updateVisibilityTexture(cloud);\n }\n\n });\n\n // Sample raw pointclouds based on total points loaded\n this.updateCloudSampling();\n\n this.calculatePointsVisible();\n }\n}","export default __webpack_public_path__ + \"static/media/arrow.81f0ce35.png\";","export default __webpack_public_path__ + \"static/media/arrow-shadow.7243bcb0.png\";","import {\n BufferGeometry,\n BufferAttribute,\n Vector3,\n Mesh,\n Matrix4,\n Matrix3,\n Scene,\n Object3D,\n Texture,\n TextureLoader,\n PlaneGeometry,\n MeshBasicMaterial,\n DoubleSide,\n MathUtils\n} from \"three\";\nimport {Viewer} from '../main';\nimport {MarkerMaterial} from \"../materials\";\nimport { CameraImage, PlanarImage } from \"../cameras/cameras\";\nimport arrowPathStandard from '../../textures/arrow.png';\nimport arrowPathShadow from '../../textures/arrow-shadow.png';\nimport { RayCaster } from \"../controls\";\nimport { chunkedArray } from \"../misc\";\nimport { MarkerNavType } from \"../../../redux/settings-slice\";\n\nexport class CameraMarkers {\n private viewer: Viewer;\n private arrowNavigation: ArrowNavigation;\n public markerNavigation: MarkerNavigation;\n private navigationType: MarkerNavType;\n public cameras = [];\n public modifier = false;\n public scene: Scene = null;\n\n constructor(viewer) {\n this.viewer = viewer;\n this.initScene();\n this.initKeyDown();\n\n this.markerNavigation = new MarkerNavigation(viewer, this);\n this.arrowNavigation = new ArrowNavigation(viewer, this);\n }\n\n get controls() {\n return this.viewer.controls;\n }\n\n get cameraList() {\n return this.viewer.cameraList;\n }\n\n get renderInFront() {\n return this.viewer.orbitState || this.arrowNavigation.visible;\n }\n\n get opacity() {\n return this.arrowNavigation.visible ? 1.0 : 0.5;\n }\n\n get calculating() {\n return this.markerNavigation.calculating;\n }\n\n get isHidden() {\n return this.navigationType === MarkerNavType.None;\n }\n\n get isArrows() {\n return this.navigationType === MarkerNavType.Arrows;\n }\n\n get isMarkers() {\n return this.navigationType === MarkerNavType.Markers;\n }\n\n initScene() {\n this.scene = new Scene();\n }\n\n initKeyDown() {\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n\n window.addEventListener( 'keydown', this.onKeyDown, false);\n window.addEventListener( 'keyup', this.onKeyUp, false);\n }\n\n addCameraMarkers(cameras: Array) {\n // Add new cameras to array\n let newCameras = cameras.filter(x => !this.cameras.includes(x));\n this.cameras = [...this.cameras, ...newCameras];\n\n // Draw markers for marker navigation\n this.markerNavigation.drawCameraMarkers(this.cameras);\n }\n\n setNavigationType(state) {\n this.navigationType = state;\n this.markerNavigation.updatePicker();\n }\n\n removeCameraMarkers(cameras: CameraImage[]) {\n // Remove cameras from array\n const toRemove = new Set(cameras.map(x => x.id));\n const remaining = this.cameras.filter(x => !toRemove.has(x.id));\n this.cameras = [...remaining];\n }\n\n recalculateAllMarkers() {\n const cameras = [...this.cameras];\n this.removeCameraMarkers(cameras);\n this.addCameraMarkers(cameras);\n }\n\n updateArrowNavigation() {\n this.arrowNavigation.updateNavigation();\n }\n\n clearArrowNavigation() {\n this.arrowNavigation.clearNavigation();\n }\n\n mouseClick(event) {\n let markerID = this.markerNavigation.mouseClick(event);\n if (markerID !== null) {\n let camera = this.cameras[markerID];\n this.cameraList.loadImage(camera.id);\n return true;\n }\n\n let cameraID = this.arrowNavigation.mouseClick(event);\n if (cameraID !== null) {\n this.cameraList.loadImage(cameraID);\n return true;\n }\n\n return false;\n }\n\n onMouseMove(event, mouse) {\n if (mouse.movement) {\n return;\n }\n\n // Mouse move for arrow navigation\n this.arrowNavigation.onMouseMove(event);\n\n // Moues move for standard navigation\n this.markerNavigation.onMouseMove(event);\n }\n\n\n onKeyUp(event) {\n if (event.which !== 17) {\n return;\n }\n\n this.modifier = false;\n }\n\n onKeyDown(event) {\n if (event.which !== 17) {\n return;\n }\n\n if (!this.modifier && this.isArrows) {\n this.markerNavigation.updatePicker();\n }\n\n this.modifier = true;\n }\n\n update() {\n let isOrbitMode = this.viewer.orbitState;\n\n if (this.isHidden) {\n this.markerNavigation.setVisible(false);\n this.arrowNavigation.setVisible(false);\n } else {\n if (this.isMarkers) {\n this.markerNavigation.setVisible(true);\n this.arrowNavigation.setVisible(false);\n } else if (this.isArrows) {\n if (isOrbitMode) {\n this.markerNavigation.setVisible(true);\n this.arrowNavigation.setVisible(false);\n } else {\n this.markerNavigation.setVisible(this.modifier);\n this.arrowNavigation.setVisible(!this.modifier);\n }\n }\n }\n\n this.markerNavigation.setEnabled(this.isArrows || this.isMarkers);\n this.arrowNavigation.setEnabled(this.isArrows);\n\n this.markerNavigation.update();\n this.arrowNavigation.update();\n }\n}\n\nclass MarkerNavigation {\n private viewer: Viewer;\n private markers: CameraMarkers;\n private markerMesh: any = null;\n private pickingMesh: any = null;\n private standardMaterial: MarkerMaterial = null;\n private pickingMaterial: MarkerMaterial = null;\n public enabled = false;\n public visible = false;\n private geometry;\n private verticesPerCamera = 6;\n private uvs: number[] = [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1];\n private corners: number[] = [0, 2, 1, 2, 3, 1];\n private camerasToIterate = [];\n private camerasCalculated = [];\n private selectedID = null;\n private chunkedArraySize = 500;\n public markerPositions = [];\n public calculating = false;\n private vertices: Vector3[] = [\n new Vector3(-0.5, 0.5, 0),\n new Vector3(0.5, 0.5, 0),\n new Vector3(-0.5, -0.5, 0),\n new Vector3(0.5, -0.5, 0)\n ]\n\n constructor(viewer: Viewer, markers: CameraMarkers) {\n this.markers = markers;\n this.viewer = viewer;\n\n this.initGeometry();\n }\n\n get scene() {\n return this.markers.scene;\n }\n\n get meshes() {\n return [this.markerMesh, this.pickingMesh];\n }\n\n get materials() {\n return [this.standardMaterial, this.pickingMaterial];\n }\n\n get picker() {\n return this.viewer.gpuPickers.markers;\n }\n\n initGeometry() {\n if (this.markerMesh) {\n this.scene.remove(this.markerMesh);\n }\n\n if (this.pickingMesh) {\n this.picker.remove(this.pickingMesh);\n }\n\n let geometry = new BufferGeometry();\n geometry.setAttribute('selected', new BufferAttribute(new Float32Array(0), 1));\n geometry.setAttribute('visible', new BufferAttribute(new Float32Array(0), 1));\n geometry.setAttribute('gpu_index', new BufferAttribute(new Int32Array(0), 1));\n geometry.setAttribute('camera_index', new BufferAttribute(new Int32Array(0), 1));\n geometry.setAttribute('position', new BufferAttribute(new Float32Array(0), 3));\n geometry.setAttribute('uv', new BufferAttribute(new Float32Array(0), 2));\n\n this.standardMaterial = new MarkerMaterial(this.viewer, false);\n this.markerMesh = new Mesh(geometry, this.standardMaterial);\n this.scene.add(this.markerMesh);\n\n this.pickingMaterial = new MarkerMaterial(this.viewer, true);\n this.pickingMesh = new Mesh(geometry, this.pickingMaterial);\n this.picker.add(this.pickingMesh);\n }\n\n setEnabled(state) {\n this.enabled = state;\n }\n\n setVisible(state) {\n this.visible = state;\n }\n\n updatePicker() {\n this.picker.needsUpdate = true;\n }\n\n drawCameraMarkers(cameras) {\n let numCameras = cameras.length;\n let selected = new Float32Array(numCameras * this.verticesPerCamera);\n let visible = new Float32Array(numCameras * this.verticesPerCamera);\n let markerShape = new Float32Array(numCameras * this.verticesPerCamera);\n let positions = new Float32Array(numCameras * this.verticesPerCamera * 3);\n let uvs = new Float32Array(numCameras * this.verticesPerCamera * 2);\n let indices = new Int32Array(numCameras * this.verticesPerCamera);\n let cameraIndices = new Int32Array(numCameras * this.verticesPerCamera);\n\n cameras.forEach((camera, cameraIndex) => {\n // Set the marker shape. Default is circlular\n let cameraShape = camera instanceof PlanarImage ? 1.0 : 0.0;\n\n // Assign our uv values\n const numUvs = this.uvs.length;\n this.uvs.forEach((uv, uvIndex) => {\n let index = (numUvs * cameraIndex) + uvIndex;\n uvs[index] = uv;\n });\n\n // Create attribute arrays for each vertex in each cam.\n const numVertices = this.verticesPerCamera;\n for (var i = 0; i < this.verticesPerCamera; i++) {\n let index = (numVertices * cameraIndex) + i;\n selected[index] = 0.0;\n visible[index] = 1.0;\n indices[index] = 0.0;\n markerShape[index] = cameraShape;\n cameraIndices[index] = cameraIndex;\n }\n });\n\n let geometry = new BufferGeometry();\n geometry.setAttribute('selected', new BufferAttribute(selected, 1));\n geometry.setAttribute('visible', new BufferAttribute(visible, 1));\n geometry.setAttribute('marker_shape', new BufferAttribute(markerShape, 1));\n geometry.setAttribute('gpu_index', new BufferAttribute(indices, 1));\n geometry.setAttribute('camera_index', new BufferAttribute(cameraIndices, 1));\n geometry.setAttribute('position', new BufferAttribute(positions, 3));\n geometry.setAttribute('uv', new BufferAttribute(uvs, 2));\n this.geometry = geometry;\n\n // Reset chunked arrays\n this.camerasToIterate = chunkedArray(cameras, this.chunkedArraySize);\n this.camerasCalculated = [];\n this.calculating = cameras.length > 0;\n\n if (numCameras === 0) {\n this.updateGeometry();\n }\n }\n\n markCameraSelected(markerID) {\n this.meshes.forEach(mesh => {\n let attributes = mesh.geometry.attributes;\n attributes.selected.array.fill(0.0);\n\n let index = attributes.camera_index.array.indexOf(markerID);\n if (index !== -1) {\n for (var i = 0; i < this.verticesPerCamera; i++) {\n attributes.selected.array[index + i] = 1.00;\n }\n }\n\n attributes.selected.needsUpdate = true;\n });\n\n if (this.selectedID !== markerID) {\n // Update picker if selected marker changed\n this.updatePicker();\n }\n\n this.selectedID = markerID;\n }\n\n calculateCameras() {\n if (this.camerasToIterate.length === 0) {\n return;\n }\n\n // Get next set of cameras in chunked array\n const cameras = this.camerasToIterate.shift();\n\n // Calculate position data\n this.camerasCalculated = [\n ...this.camerasCalculated,\n ...cameras.map(x => x.position.marker)\n ];\n\n // If we have more data to parse exit early\n // and wait until next iteration\n if (this.camerasToIterate.length !== 0) {\n return;\n }\n\n let numCameras = this.camerasCalculated.length;\n let positions = new Float32Array(numCameras * this.verticesPerCamera * 3);\n\n this.markerPositions = new Array(numCameras);\n this.camerasCalculated.forEach((position, cameraIndex) => {\n // Setting our positions array\n const numCorners = this.corners.length;\n this.markerPositions[cameraIndex] = position;\n this.corners.forEach((corner, cornerIndex) => {\n let index = (numCorners * cameraIndex) + cornerIndex;\n var points = this.vertices[corner];\n positions[(index * 3)] = points.x + position.x;\n positions[(index * 3) + 1] = points.y + position.y;\n positions[(index * 3) + 2] = points.z + position.z;\n });\n });\n\n this.geometry.setAttribute('position', new BufferAttribute(positions, 3));\n this.geometry.attributes.position.needsUpdate = true;\n\n this.calculating = false;\n this.updateGeometry();\n }\n\n updateGeometry() {\n this.meshes.forEach(mesh => {\n mesh.geometry.dispose();\n mesh.geometry.copy(this.geometry);\n mesh.geometry.needsUpdate = true;\n });\n\n this.viewer.updatePickers();\n }\n\n cameraPickerID(event) {\n try {\n // Update gpu picker if required\n this.picker.update();\n\n // Grab our index and marker id\n const index = this.picker.value(event);\n\n if (index === null) {\n return null;\n }\n\n const attributes = this.pickingMesh.geometry.attributes;\n const arrIndex = attributes.gpu_index.array.indexOf(index);\n const markerID = attributes.camera_index.array[arrIndex];\n\n return markerID;\n }\n catch (e) {\n console.log(\"Prevented framebuffer exception: \");\n console.log(e);\n\n return null;\n }\n }\n\n onMouseMove(event) {\n let markerID = this.cameraPickerID(event);\n this.markCameraSelected(markerID);\n }\n\n mouseClick(event) {\n let markerID = this.cameraPickerID(event);\n return markerID;\n }\n\n update() {\n let position = this.viewer.camera.position;\n let quat = this.viewer.camera.quaternion;\n let mtrx4 = new Matrix4().makeRotationFromQuaternion(quat);\n let mtrx3 = new Matrix3().setFromMatrix4(mtrx4);\n mtrx3.getInverse(mtrx3);\n let elements = mtrx3.elements;\n\n // Set meshes visibility\n this.meshes.forEach(mesh => {\n mesh.visible = this.visible;\n });\n\n // Update shader parameters\n this.materials.forEach(shader => {\n let uniforms = shader.uniforms;\n uniforms.mtrx_x.value = new Vector3(elements[0], elements[1], elements[2]);\n uniforms.mtrx_y.value = new Vector3(elements[3], elements[4], elements[5]);\n uniforms.mtrx_z.value = new Vector3(elements[6], elements[7], elements[8]);\n uniforms.camera_position.value = position;\n uniforms.screenHeight.value = this.viewer.height;\n uniforms.currentIndex.value = this.viewer.cameraList.currentIndex;\n uniforms.orbitMode.value = this.viewer.orbitState;\n uniforms.fov.value = this.viewer.camera.fov * Math.PI / 180.0;\n shader.needsUpdate = true;\n });\n\n this.calculateCameras();\n }\n}\n\nclass ArrowMarker {\n public camera: CameraImage;\n private radius = 1.5\n private height = -1.0;\n private size = 0.5;\n public object: Object3D;\n\n constructor(textures, section, angle) {\n this.object = new Object3D();\n this.object.rotation.z = 1 * MathUtils.degToRad(angle);\n this.addMesh(section, textures[0], this.height);\n this.addMesh(section, textures[1], this.height * 1.03);\n }\n\n get visible() {\n return this.object.visible;\n }\n\n get enabled() {\n return this.camera !== null;\n }\n\n clear() {\n this.camera = null;\n this.setVisible(false);\n }\n\n setVisible(state) {\n this.object.visible = state;\n }\n\n setCamera(camera: CameraImage) {\n this.camera = camera;\n }\n\n setScale(scale) {\n this.object.children.forEach(x => {\n x.scale.copy(scale);\n });\n }\n\n addMesh(section, texture, height) {\n // Add standard marker mesh\n const geometryStandard = new PlaneGeometry(this.size * 0.75, this.size);\n const materialStandard = new MeshBasicMaterial({\n map: texture,\n side: DoubleSide,\n transparent: true,\n alphaTest: 0.5\n });\n\n const mesh = new Mesh(geometryStandard, materialStandard);\n mesh.userData = {section};\n mesh.position.x = this.radius;\n mesh.position.z = height;\n mesh.rotation.z = -1 * MathUtils.degToRad(90);\n this.object.add(mesh);\n }\n}\n\nclass ArrowNavigation {\n private viewer: Viewer;\n private markers: CameraMarkers;\n private object: Object3D;\n private textures: Texture[] = [];\n public enabled = false;\n public visible = false;\n private minDistance = 5.0;\n private maxDistance = 40.0;\n private numSections = 8;\n private needsUpdate;\n private sections: ArrowMarker[] = [];\n private defaultScale = new Vector3(1.0, 1.0, 1.0);\n private zoomedScale = new Vector3(1.2, 1.2, 1.2);\n\n constructor(viewer: Viewer, markers: CameraMarkers) {\n this.markers = markers;\n this.viewer = viewer;\n\n this.loadTextures();\n this.initMeshObject();\n this.clearNavigation();\n }\n\n get scene() {\n return this.markers.scene;\n }\n\n initMeshObject() {\n this.object = new Object3D();\n\n for (let section=0;section {\n arrow.clear();\n });\n }\n\n calculateCameras() {\n const calculating = this.viewer.calculatingSceneMarkers;\n if (calculating || !this.visible || !this.needsUpdate) {\n return;\n }\n\n this.needsUpdate = false;\n\n // Positions are precalculated when adding scene view markers\n let positions = this.markers.markerNavigation.markerPositions;\n\n this.clearNavigation();\n\n const cameraPos = this.viewer.camera.position;\n\n const validCameras = [];\n positions.forEach((markerPos, cameraIndex) => {\n let x = markerPos.x - cameraPos.x;\n let y = markerPos.y - cameraPos.y;\n\n const distance = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n\n // Calculate min and max distance from camera;\n let tooClose = distance < this.minDistance;\n let tooFar = distance > this.maxDistance;\n if (tooClose || tooFar) {\n return;\n }\n\n // Calculate section\n let angle = Math.atan2(y, x) * 180 / Math.PI;\n let section = this.angleToSection(angle);\n\n let camera = this.markers.cameras[cameraIndex];\n validCameras.push({camera, distance, section});\n });\n\n // Sort by distance\n validCameras.sort((a, b) => {\n return a.distance - b.distance;\n });\n\n validCameras.forEach(({camera, section}) => {\n if (this.sections[section].enabled) {\n return;\n }\n\n this.sections[section].setCamera(camera);\n this.sections[section].setVisible(true);\n });\n\n // Update mesh position\n this.object.position.copy(cameraPos);\n }\n\n onMouseMove(event) {\n this.sections.forEach(arrow => {\n arrow.setScale(this.defaultScale);\n });\n\n let object = this.getIntersect(event);\n if (!object) {\n return;\n }\n\n object.setScale(this.zoomedScale);\n }\n\n mouseClick(event) {\n let object = this.getIntersect(event);\n if (!object || !object.camera) {\n return null;\n }\n\n this.sections.forEach(arrow => {\n arrow.setVisible(false);\n });\n\n return object.camera.id;\n }\n\n /** @private */\n getIntersect(event) : ArrowMarker {\n if (!this.visible) {\n return;\n }\n\n let targets = this.sections.map(arrow => {\n return arrow.object.children[0];\n });\n\n let raycaster = new RayCaster(this.viewer, event);\n let intersects = raycaster.intersectObjects(targets);\n if (intersects.length === 0) {\n return;\n }\n\n const intersect = intersects[0].object;\n const sectionID = intersect.userData.section;\n const object = this.sections[sectionID];\n\n return object;\n }\n\n update() {\n if (!this.object) {\n return;\n }\n\n this.calculateCameras();\n this.object.visible = this.visible;\n }\n}\n","import $ from 'jquery';\n\nlet binds = [];\n\nexport const bindWindowEvent = (name, callback) => {\n $(window).off(name);\n $(window).on(name, callback);\n binds.push(name);\n};\n\nexport const destroyWindowEvents = () => {\n binds.forEach(bind => {\n $(window).off(bind);\n });\n binds = [];\n};\n\n","import {Vector3} from \"three\";\nimport { CameraImage } from \"../cameras/cameras\";\nimport {Viewer} from \"../main\";\n\nclass ChangeDetector {\n private viewer;\n private previousFov = 0;\n private previousZoom = 0;\n private previousLookat = new Vector3();\n private previousCamera: CameraImage;\n private previousHeight = 0;\n private previousOrbit = false;\n public lookatChanged = false;\n public fovChanged = false;\n public zoomChanged = false;\n public cameraChanged = false;\n public heightChanged = false;\n public orbitChanged = false;\n public enabled = false;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n }\n\n get changed() {\n return this.lookatChanged\n || this.fovChanged\n || this.zoomChanged\n || this.cameraChanged\n || this.heightChanged\n || this.orbitChanged;\n }\n\n get map() {\n return this.viewer.minimap.map;\n }\n\n get camera() {\n return this.viewer.camera;\n }\n\n get newFov() {\n return this.camera.fov;\n }\n\n get newZoom() {\n return this.map.getView().getZoom();\n }\n\n get newLookat() {\n return this.viewer.lookat;\n }\n\n get newCamera() {\n return this.viewer.minimap.activeCamera;\n }\n\n get newHeight() {\n return this.viewer.height;\n }\n\n get newOrbit() {\n return this.viewer.orbitState;\n }\n\n update() {\n try {\n this.lookatChanged = !this.previousLookat.equals(this.newLookat);\n this.fovChanged = this.newFov !== this.previousFov;\n this.zoomChanged = this.newZoom !== this.previousZoom;\n this.cameraChanged = this.previousCamera !== this.newCamera;\n this.heightChanged = this.previousHeight !== this.newHeight;\n this.orbitChanged = this.previousOrbit !== this.newOrbit;\n\n this.previousZoom = this.newZoom;\n this.previousFov = this.newFov;\n this.previousLookat = this.newLookat;\n this.previousCamera = this.newCamera;\n this.previousHeight = this.newHeight;\n this.previousOrbit = this.newOrbit;\n } catch {\n // Nothing\n }\n };\n}\n\nexport default ChangeDetector;","import { BufferGeometry, Color, Points, Vector3 } from \"three\";\nimport { Camera } from \"three/src/cameras/Camera\";\nimport { LinearEncoding, NearestFilter, RGBAFormat } from \"three/src/constants\";\nimport { WebGLRenderer } from \"three/src/renderers/WebGLRenderer\";\nimport { WebGLRenderTarget } from \"three/src/renderers/WebGLRenderTarget\";\nimport { Scene } from \"three/src/scenes/Scene\";\nimport { Viewer } from \"./main\";\nimport { eventToPixel } from \"./utilities\";\n\nexport default class GPUPicker {\n private name\n public debug = false\n public scene : Scene\n private viewer: Viewer\n private camera: Camera\n private numSections = 3;\n private sections;\n public target : WebGLRenderTarget\n private _needsUpdate = false;\n public result;\n\n constructor(viewer: Viewer, name, debug=false) {\n this.name = name;\n this.debug = debug;\n\n this.viewer = viewer;\n this.scene = new Scene();\n this.target = new WebGLRenderTarget(0, 0, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n format: RGBAFormat,\n encoding: LinearEncoding,\n generateMipmaps: false\n });\n\n this.clearSections();\n }\n\n get height() {\n return this.target.height;\n }\n\n get width() {\n return this.target.width;\n }\n\n get renderer(): WebGLRenderer {\n return this.viewer.renderer;\n }\n\n get needsUpdate() {\n return this._needsUpdate;\n }\n\n set needsUpdate(value) {\n if (this.debug) {\n console.log(`Update ${this.name} picker state`, value);\n }\n\n this._needsUpdate = value;\n }\n\n remove(mesh) {\n this.scene.remove(mesh);\n this.needsUpdate = true;\n }\n\n add(mesh) {\n this.scene.add(mesh);\n mesh.material.transparent = false;\n this.needsUpdate = true;\n }\n\n value(event) {\n let uv = eventToPixel(event);\n let tX = uv.x;\n let tY = this.height - uv.y;\n\n let sectionWidth = Math.floor(this.width/this.numSections);\n let sectionHeight = Math.floor(this.height/this.numSections);\n let sectionX = Math.floor(tX/sectionWidth);\n let sectionY = Math.floor(tY/sectionHeight);\n let sectionIndex = sectionX + (sectionY * this.numSections);\n\n tX = tX % sectionWidth;\n tY = tY % sectionHeight;\n let pixelIndex = 4 * (tX + tY * sectionWidth);\n\n if (this.sections[sectionIndex] === null) {\n const timeStart = performance.now();\n\n let startX = sectionX*sectionWidth;\n let startY = sectionY*sectionHeight;\n\n let pixelBuffer = new Uint8Array(4 * sectionWidth * sectionHeight);\n this.renderer.readRenderTargetPixels(this.target, startX, startY,\n sectionWidth, sectionHeight, pixelBuffer);\n\n // Update section results\n this.sections[sectionIndex] = pixelBuffer;\n\n const timeEnd = performance.now();\n let time = (timeEnd - timeStart).toFixed(1);\n\n if (this.debug) {\n console.log(`Render ${this.name} picker: ${time}ms`);\n }\n }\n\n let result = this.sections[sectionIndex];\n if (!result) {\n return null;\n }\n\n let mouseResult = new Uint8Array([\n result[pixelIndex + 0],\n result[pixelIndex + 1],\n result[pixelIndex + 2],\n result[pixelIndex + 3]\n ]);\n\n let pickerID = (mouseResult[0] << 24)\n + (mouseResult[1] << 16)\n + (mouseResult[2] << 8)\n + mouseResult[3];\n\n return (pickerID >= 0) ? pickerID : null;\n }\n\n update() {\n if (!this.needsUpdate) {\n return;\n }\n\n this.clearSections();\n this.updateBaseIDs();\n\n this.needsUpdate = false;\n\n let oldRenderTarget = this.renderer.getRenderTarget();\n let oldClearColor = this.renderer.getClearColor();\n let oldClearAlpha = this.renderer.getClearAlpha();\n let newClearColor = new Color(0xffffff);\n\n this.renderer.setRenderTarget(this.target);\n this.renderer.setClearColor(newClearColor);\n this.renderer.clear();\n this.renderer.render(this.scene, this.camera);\n this.renderer.setRenderTarget(oldRenderTarget);\n this.renderer.setClearColor(oldClearColor);\n this.renderer.setClearAlpha(oldClearAlpha);\n }\n\n clearSections() {\n this.sections = new Array(this.numSections**2).fill(null);\n }\n\n updateBaseIDs() {\n let currentBaseID = 0;\n this.scene.children.forEach((child: any) => {\n let geometry = child.geometry as BufferGeometry;\n let indices = geometry.attributes.gpu_index.array as any;\n\n for (var i=0;i {\n if (object !== null) {\n return;\n }\n\n if (child instanceof Points) {\n let geometry = child.geometry as BufferGeometry;\n let indices = geometry.attributes.gpu_index.array as Array;\n\n // Determine if the index exists inside this object\n let minIndex = indices[0];\n let maxIndex = indices[indices.length - 1];\n if ((index < minIndex) || (index > maxIndex)) {\n return;\n }\n\n // Use the returned index to get the xyz location\n let arrIndex = indices.indexOf(index);\n if (arrIndex === -1) {\n return;\n }\n\n object = child;\n }\n });\n\n return object;\n }\n\n getObjectPosition(mesh, index) {\n let coordinate = null;\n\n if (mesh instanceof Points) {\n let geometry = mesh.geometry as BufferGeometry;\n let indices = geometry.attributes.gpu_index.array as Array;\n let arrIndex = indices.indexOf(index);\n let positions = geometry.attributes.position;\n\n coordinate = new Vector3(\n positions.getX(arrIndex) + mesh.position.x,\n positions.getY(arrIndex) + mesh.position.y,\n positions.getZ(arrIndex) + mesh.position.z\n );\n }\n\n return coordinate;\n }\n}\n","import { createHash } from \"crypto\";\nimport { Color } from \"three\";\n\nconst parseHex = (text, min, max) => {\n return parseInt(text.slice(min, max), 16);\n};\n\nexport const textToColor = (text, opacity=1.0) => {\n let [r,g,b,a] = textToColorArray(text, opacity);\n return `rgba(${Math.ceil(r)}, ${Math.ceil(g)}, ${Math.ceil(b)}, ${a})`;\n};\n\nexport const textToColorArray = (text, opacity=1.0) => {\n const colorHash = createHash('md5');\n const hash = colorHash.update(text).digest('hex');\n const h = (parseHex(hash, 0, 8) + parseHex(hash, 8, 16)) % 360;\n const s = 50 + (parseHex(hash, 16, 24) % 50);\n const l = 25 + (parseHex(hash, 24, 32) % 50);\n\n const color = new Color(`hsl(${h}, ${s}%, ${l}%)`);\n const {r,g,b} = color.multiplyScalar(255);\n\n return [Math.ceil(r), Math.ceil(g), Math.ceil(b), opacity];\n};\n","import { Viewer } from \"../main\";\nimport { SceneLabelTools, AerialLabelTools } from \".\";\nimport { nanoid } from \"@reduxjs/toolkit\";\nimport LocalScene, { isValidProjection } from \"../projections\";\nimport { textToColorArray } from \"./categories\";\nimport { ShapeUtils, Vector2 } from \"three\";\nimport {\n polygon as turfPolygon,\n simplify as turfSimplify,\n union as turfUnion\n} from '@turf/turf';\nimport { coordinatesToArray } from \"../misc\";\nimport { PanoramicImage, PlanarImage } from \"../cameras\";\n\nexport interface CocoCategory {\n supercategory: string,\n id: number,\n name: string,\n color: [number, number, number]\n}\n\nexport interface CocoImage {\n height: number,\n width: number,\n id: number,\n file_name: string,\n metadata?: {\n x_skew: number,\n y_skew: number,\n x_scale: number,\n y_scale: number,\n x_offset: number,\n y_offset: number\n }\n}\n\nexport interface CocoAnnotation {\n segmentation: Array<[]>,\n iscrowd: number,\n image_id: number,\n bbox: [number, number, number, number],\n category_id: number,\n id: number,\n area: number\n}\n\nexport class ImageLabel {\n public id;\n public category;\n public selected = false;\n public completed = false;\n public editing = false;\n public valid = true;\n public drawable = true;\n public highlighted = false;\n\n constructor(category) {\n this.id = nanoid();\n this.category = category;\n }\n\n get hasEnoughPoints() {\n console.warn(\"Not Implemented\");\n return false;\n }\n\n select() {\n this.selected = true;\n this.highlighted = false;\n this.completed = false;\n }\n\n unSelect() {\n this.selected = false;\n this.complete();\n }\n\n complete() {\n this.completed = true;\n this.draw();\n }\n\n setDrawable(state) {\n this.drawable = state;\n }\n\n zoom() {\n console.warn(\"Not Implemented\");\n }\n\n unHighlight() {\n console.warn(\"Not Implemented\");\n }\n\n setHighlighted(highlight) {\n console.warn(\"Not Implemented\");\n }\n\n clear() {\n console.warn(\"Not Implemented\");\n }\n\n draw() {\n console.warn(\"Not Implemented\");\n }\n}\n\nexport class LabelCategory {\n public id;\n public name;\n public labels: ImageLabel[] = [];\n\n constructor(name) {\n this.id = nanoid();\n this.name = name;\n }\n\n getLabelByID(labelID) {\n return this.labels.find(label => label.id === labelID);\n }\n\n addNewLabel(drawLabel) {\n console.warn(\"Not implemented\");\n return null;\n }\n\n deleteLabel(labelID) {\n const label = this.getLabelByID(labelID);\n if (!label) {\n return;\n }\n\n label.clear();\n const index = this.labels.indexOf(label);\n this.labels.splice(index, 1);\n }\n\n deleteLabels(labelIDs) {\n labelIDs.forEach(labelID => {\n const label = this.getLabelByID(labelID);\n if (!label) {\n return;\n }\n\n label.clear();\n const index = this.labels.indexOf(label);\n this.labels.splice(index, 1);\n });\n }\n\n zoomToLabel(labelID) {\n const label = this.getLabelByID(labelID);\n if (!label) {\n return;\n }\n\n label.setHighlighted(true);\n label.zoom();\n }\n\n unHighlight(labelID) {\n const label = this.getLabelByID(labelID);\n if (!label) {\n return;\n }\n\n label.setHighlighted(false);\n }\n\n updateName(name) {\n this.name = name;\n }\n\n completeLabel(labelID) {\n const label = this.getLabelByID(labelID);\n if (!label) {\n return;\n }\n\n if (!label.hasEnoughPoints) {\n return false;\n }\n\n this.unSelectAll();\n label.complete();\n\n return true;\n }\n\n unSelectAll() {\n this.labels.forEach(label =>\n label.unSelect()\n );\n }\n\n selectLabel(labelID) {\n const label = this.getLabelByID(labelID);\n if (!label) {\n return;\n }\n\n label.select();\n }\n}\n\nexport class ImageLabelTools {\n viewer: Viewer;\n public orthoLabels: AerialLabelTools;\n public sceneLabels: SceneLabelTools;\n private activeLabeler: AerialLabelTools | SceneLabelTools;\n public categories: LabelCategory[] = [];\n private setCategoryList: Function;\n private currentCategory;\n private hotkeyEnabled = true;\n public contextMenuOpen = false;\n\n constructor(viewer: Viewer, props) {\n const {setCategoryList} = props;\n\n this.viewer = viewer;\n this.orthoLabels = new AerialLabelTools(this, props);\n this.sceneLabels = new SceneLabelTools(this, props);\n this.setCategoryList = setCategoryList;\n\n this.setCategories();\n }\n\n get currentCategoryName() {\n return this.currentCategory.name;\n }\n\n onKeyDown(event) {\n if (this.activeLabeler instanceof AerialLabelTools) {\n this.contextMenuOpen=false;\n }\n\n let label = this.activeLabeler.activeLabel;\n\n if (label) {\n // Check for completion hotkey -> Enter\n if (event.which === 13) {\n if (label.selected){\n this.completeLabel(label.id);\n }\n }\n\n // Check for deletion hotkey -> Delete\n if (event.which === 46) {\n this.activeLabeler.deletePoint();\n }\n\n }\n else {\n // Check add new label in current category hotkey -> space\n if (event.which === 32 && (this.currentCategory)) {\n this.addLabel(this.currentCategory.id);\n return;\n }\n }\n\n }\n\n numHighlighted() {\n let count = 0;\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n if (label.highlighted) {\n count++;\n }\n });\n });\n return count;\n }\n\n setActiveLabelType(type) {\n this.deleteAllCategories();\n this.orthoLabels.setState(false);\n this.sceneLabels.setState(false);\n this.viewer.minimap.setDragState(true);\n\n if (type === \"ortho\") {\n this.activeLabeler = this.orthoLabels;\n } else if (type === \"scene\") {\n this.activeLabeler = this.sceneLabels;\n } else {\n this.activeLabeler = null;\n return;\n }\n\n this.activeLabeler.setState(true);\n }\n\n activeImagePaths() {\n if (!this.activeLabeler) {\n return [];\n }\n\n return this.activeLabeler.activeImagePaths;\n }\n\n loadedImagePaths() {\n if (!this.activeLabeler) {\n return [];\n }\n\n return this.activeLabeler.loadedImagePaths;\n }\n\n checkIfSelected() {\n if (!this.activeLabeler) {\n return false;\n }\n\n return this.activeLabeler.activeLabel\n ? true\n : false;\n }\n\n checkIfActive() {\n if (!this.activeLabeler) {\n return false;\n }\n return true;\n }\n\n checkUniqueName(name) {\n const categoriesWithName = this.categories.filter(category => {\n return category.name.toUpperCase() === name.toUpperCase();\n });\n\n return (categoriesWithName.length === 0);\n }\n\n getCategoryByID(id) {\n return this.categories.find(x => x.id === id);\n }\n\n setCategories() {\n this.setCategoryList([...this.categories]);\n }\n\n addCategory(name, updateCategories=true) {\n if (!this.activeLabeler) {\n return;\n }\n\n let category = this.activeLabeler.getNewCategory(name);\n this.categories.push(category);\n\n if (this.categories.length === 1) {\n this.currentCategory = category;\n }\n\n if (updateCategories) {\n this.setCategories();\n }\n return category;\n }\n\n deleteCategory(categoryID) {\n const category = this.getCategoryByID(categoryID);\n if (!category) {\n return;\n }\n\n category.labels.forEach(label => {\n label.clear();\n });\n\n const index = this.categories.indexOf(category);\n this.categories.splice(index, 1);\n\n if (this.currentCategory === category) {\n this.currentCategory = this.categories[0];\n } else if (this.categories.length === 0) {\n this.currentCategory = null;\n }\n\n this.setCategories();\n }\n\n editCategoryName(categoryID, name) {\n const category = this.getCategoryByID(categoryID);\n if (!category) {\n return;\n }\n\n category.updateName(name);\n\n if (this.activeLabeler instanceof SceneLabelTools) {\n this.activeLabeler.updateColor();\n }\n\n this.setCategories();\n this.activeLabeler.drawAll();\n }\n\n deleteAllCategories() {\n let categories = [...this.categories];\n categories.forEach(category => {\n this.deleteCategory(category.id);\n });\n }\n\n addLabel(categoryID, drawLabel=true, updateCategories=true) {\n const category = this.getCategoryByID(categoryID);\n if (!category) {\n return;\n }\n this.currentCategory = category;\n\n let label = category.addNewLabel(drawLabel);\n this.unSelectLabels();\n category.selectLabel(label.id);\n\n if (updateCategories) {\n this.setCategories();\n }\n\n return label;\n }\n\n deleteLabel(labelID) {\n this.categories.forEach(category => {\n category.deleteLabel(labelID);\n });\n\n this.setCategories();\n this.activeLabeler.resetToolTipText();\n }\n\n deletePoint(pointID) {\n this.activeLabeler.deleteSpecificPoint(pointID);\n this.activeLabeler.contextMenuOpen = false;\n }\n\n zoomToLabel(labelID) {\n this.unHighlightAll();\n this.categories.forEach(category => {\n category.zoomToLabel(labelID);\n });\n }\n\n unHighlight(labelID) {\n this.categories.forEach(category => {\n category.unHighlight(labelID);\n });\n this.setCategories();\n this.activeLabeler.contextMenuOpen = false;\n }\n\n unHighlightAll() {\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n if (label.highlighted) {\n category.unHighlight(label.id);\n }\n });\n });\n this.setCategories();\n this.activeLabeler.contextMenuOpen = false;\n }\n\n deleteHighlighted() {\n this.categories.forEach(category => {\n let labelIDs = [];\n category.labels.forEach(label => {\n if (label.highlighted) {\n labelIDs.push(label.id);\n }\n });\n category.deleteLabels(labelIDs);\n });\n this.setCategories();\n this.activeLabeler.contextMenuOpen = false;\n }\n\n completeLabel(labelID) {\n let success = false;\n this.categories.forEach(category => {\n success = success || category.completeLabel(labelID);\n });\n\n this.setCategories();\n if (!success) {\n return;\n }\n\n this.activeLabeler.resetToolTipText();\n this.viewer.showMessage(\"Added label\", {\n variant: \"success\"\n });\n\n }\n\n selectLabel(labelID) {\n this.unSelectLabels();\n this.categories.forEach(category => {\n category.unHighlight(labelID);\n category.selectLabel(labelID);\n });\n\n this.activeLabeler.resetTemporaryPoint();\n this.activeLabeler.drawAll();\n this.setCategories();\n this.activeLabeler.contextMenuOpen = false;\n }\n\n unSelectLabels() {\n this.categories.forEach(category => {\n category.unSelectAll();\n });\n }\n\n simplifyPolygon(points, tolerance=2, highQuality=false) {\n let newPoints = [...points, points[0]];\n\n let newPointsPolygon = turfPolygon([newPoints]);\n let options = {tolerance: tolerance, highQuality: highQuality};\n\n let simplified = turfSimplify(newPointsPolygon, options);\n let simplePolygon = simplified.geometry.coordinates[0];\n\n // console.log(`Simplify geometry: ${newPoints.length} => ${simplePolygon.length}`);\n\n simplePolygon.pop(); // remove duplicate point\n\n return simplePolygon;\n }\n\n /** @private */\n nextIndexValid(matches, index, length) {\n let index1 = matches[0][index];\n let index2 = matches[1][index];\n\n let validNextIndex = [\n (index1 + 1 + length) % length,\n (index1 - 1 + length) % length\n ];\n\n return validNextIndex.indexOf(index2) !== -1;\n }\n\n mergeAndSimplifyLabels(category, maxDistance=0.5) {\n // Merge geometry (panoramic / aerial)\n let numLabels = category.labels.length;\n let numIterations = numLabels;\n for (var j=0;j [(x[0]+(width/2)) % width, x[1]]);\n points2 = points2.map(x => [(x[0]+(width/2)) % width, x[1]]);\n }\n\n let matches = [];\n points1.forEach((point1, index1) => {\n let matchFound = false;\n points2.forEach((point2, index2) => {\n if (matchFound) {\n return;\n }\n\n let d = new Vector2(...point1)\n .distanceTo(new Vector2(...point2));\n\n if (d < maxDistance) {\n matchFound = true;\n points1[index1] = point2;\n matches.push([point1, index1, index2]);\n }\n });\n });\n\n if (matches.length !== 2) {\n continue;\n }\n\n // Make sure the matched indices are both sequential\n let valid = this.nextIndexValid(matches, 1, points1.length)\n && this.nextIndexValid(matches, 2, points2.length);\n\n if (!valid) {\n continue;\n }\n\n let polygonPoints1 = [...points1, points1[0]];\n let polygonPoints2 = [...points2, points2[0]];\n\n let union = turfUnion(\n turfPolygon([polygonPoints1]),\n turfPolygon([polygonPoints2])\n );\n\n if (!union) {\n continue;\n }\n\n // Union must have a single geometry\n if (union.geometry.type !== \"Polygon\") {\n continue;\n }\n\n let coordinates = union.geometry.coordinates[0] as any;\n coordinates.pop(0);\n\n // Combined area must match exactly\n let areaUnion = areaFromPolygon(coordinates);\n let areaCombined = areaFromPolygon(points1)\n + areaFromPolygon(points2);\n\n if (areaCombined !== areaUnion) {\n return;\n }\n\n // Combined labels must be valid\n labelMerged = true;\n\n // Remove any duplicates from merged result\n coordinates = coordinates.filter(point1 => {\n let duplicate = false;\n matches.forEach(match => {\n let point2 = match[0];\n let d = new Vector2(...point1)\n .distanceTo(new Vector2(...point2));\n\n if (d < maxDistance) {\n duplicate = true;\n }\n });\n\n return !duplicate;\n });\n\n if (isPanoramicImage) {\n // Subtract image offset and convert to pixel\n let width = label.imageWidth;\n coordinates = coordinates.map(coord => {\n return {\n u: (coord[0] - (width/2)) % width,\n v: coord[1]\n };\n });\n }\n\n // Delete second label\n category.deleteLabel(mergeLabel.id);\n\n // Add points to first label\n label.coordinates = [];\n coordinates.forEach(coord => {\n label.addPoint(coord, false);\n });\n category.completeLabel(label.id);\n break;\n }\n }\n\n if (!labelMerged) {\n break;\n }\n }\n\n let newNumLabels = category.labels.length;\n if (newNumLabels !== numLabels) {\n console.log(`Merge geometry: ${numLabels} => ${newNumLabels}`);\n }\n\n // Simplify new labels (panoramic)\n category.labels.forEach(label => {\n const isPanoramicImage = label.camera instanceof PanoramicImage;\n if (!isPanoramicImage) {\n return;\n }\n\n let coordinates = [...label.coords];\n coordinates = this.simplifyPolygon(coordinates);\n\n // Subtract image offset and convert to pixel\n let width = label.imageWidth;\n coordinates = coordinates.map(coord => {\n return {\n u: (coord[0] + width) % width,\n v: coord[1]\n };\n });\n\n label.coordinates = [];\n coordinates.forEach(coord => {\n label.addPoint(coord, false);\n });\n label.complete();\n });\n }\n\n /** @private */\n importLabelData(label, category, images, projection, progressData): Promise {\n let labelAddTimeout = 5;\n\n return new Promise(async resolve => {\n let cameras = this.viewer.cameraList;\n\n // Add new label\n let imageData = images[label.image_id];\n label.segmentation.forEach(points => {\n // Convert points to 2d array and simplify geometry\n points = coordinatesToArray(points);\n\n // Make sure enough points exist\n if (points.length < 3) {\n progressData.skippedLabels += 1;\n return;\n }\n\n if (this.activeLabeler instanceof AerialLabelTools) {\n // Simplify pixels and convert from image space to map coordinates\n points = this.simplifyPolygon(points);\n points = this.activeLabeler.pointsToAerial(\n points, imageData, projection);\n } else if (this.activeLabeler instanceof SceneLabelTools) {\n // Planar images cant be immediately simplified\n let camera = cameras.getByName(imageData.file_name);\n if (camera && (camera instanceof PlanarImage)) {\n points = this.simplifyPolygon(points);\n }\n\n points = this.activeLabeler.pointsToPixels(points);\n }\n\n // Make sure enough points exist after simplification / pixel function\n if (points.length < 3) {\n progressData.skippedLabels += 1;\n return;\n }\n\n // Create label\n let newLabel = this.addLabel(category.id, false, false);\n\n if (this.activeLabeler instanceof SceneLabelTools) {\n // Camera is required for scene tools\n\n let camera = cameras.getByName(imageData.file_name);\n\n if (camera) {\n // Set camera label\n newLabel.setCamera(camera);\n newLabel.setKnownImageSize(\n imageData.width,\n imageData.height\n );\n } else {\n // Delete label and continue\n progressData.skippedLabels += 1;\n this.deleteLabel(newLabel.id);\n return;\n }\n }\n\n // Add points to new label\n points.forEach(point => {\n newLabel.addPoint(point, false);\n });\n\n newLabel.complete();\n });\n\n // Update loading progress\n const {labelTotal, labelIndex} = progressData;\n progressData.progress = Math.min(100, (labelIndex+1)/labelTotal * 100);\n progressData.callback(progressData.progress);\n progressData.labelIndex += 1;\n\n setTimeout(() => {\n resolve();\n }, labelAddTimeout);\n });\n }\n\n addCategoryLabels(labels, category, images, projection, progressData): Promise {\n return new Promise(async resolve => {\n // Add all new labels\n for (let label of labels) {\n await this.importLabelData(label, category, images,\n projection, progressData);\n }\n\n resolve();\n });\n }\n\n async loadImageLabelData(data, progressCallback) {\n this.deleteAllCategories();\n\n let projection = data.projection;\n let categories = data.categories;\n let labels = data.annotations;\n\n // Check for valid projection string\n let validProjection = isValidProjection(projection.string);\n if (!validProjection) {\n this.viewer.showMessage(\"Invalid projection string\", {\n variant: \"error\"\n });\n return;\n }\n\n let images = {};\n data.images.forEach(image => {\n images[image.id] = image;\n });\n\n // Calculate total combined labels\n let numLabelsTotal = 0;\n data.annotations.forEach(label => {\n numLabelsTotal += label.segmentation.length;\n });\n\n let progressData = {\n progress: 0,\n labelTotal: numLabelsTotal,\n labelIndex: 0,\n skippedLabels: 0,\n callback: progressCallback\n };\n\n for (let category of categories) {\n let newLabels = labels.filter(x => x.category_id === category.id);\n\n // Add new category\n let newCategory = this.addCategory(category.name, false);\n\n await this.addCategoryLabels(newLabels, newCategory,\n images, projection, progressData);\n\n console.log(`Import labels for category ${newCategory.name}`);\n\n // Merge at image seams and simplify if required\n this.mergeAndSimplifyLabels(newCategory);\n\n // Remove any labels that are invalid now\n [...newCategory.labels].forEach(label => {\n if (!label.hasEnoughPoints) {\n progressData.skippedLabels += 1;\n newCategory.deleteLabel(label.id);\n };\n });\n\n // Complete all labels\n newCategory.labels.forEach(label => {\n newCategory.completeLabel(label.id);\n });\n };\n\n // Set labels to drawable\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n label.setDrawable(true);\n });\n });\n\n // Draw all new labels\n this.activeLabeler.drawAll();\n\n if (progressData.skippedLabels > 0) {\n this.viewer.showMessage(`Skipped ${progressData.skippedLabels} labels`, {\n variant: \"error\"\n });\n }\n\n setTimeout(() => {\n this.setCategories();\n progressCallback(0);\n this.activeLabeler.resetToolTipText();\n }, 500);\n }\n\n update(changeDetector) {\n this.sceneLabels.update(changeDetector);\n }\n\n labelObject() {\n let categories = this.categories.map((category, categoryID) => {\n let [r, g, b] = textToColorArray(category.name, 0);\n let color = [r, g, b];\n\n return {\n supercategory: category.name,\n id: categoryID,\n name: category.name,\n color: color\n } as CocoCategory;\n });\n\n let jsonObj = {\n type: this.activeLabeler.type,\n categories: categories,\n projection: LocalScene.dataProjection,\n images: this.activeLabeler.jsonImageObj(),\n annotations: this.activeLabeler.jsonLabelsObj()\n };\n\n return jsonObj;\n }\n}\n\nexport const sectionsFromIntersection = (intersection) => {\n let sections = [];\n\n if (!intersection) {\n return sections;\n }\n\n let geometry = intersection.geometry;\n geometry.coordinates.forEach(intersectPoints => {\n if (geometry.type === \"MultiPolygon\") {\n intersectPoints = intersectPoints[0];\n }\n\n intersectPoints.pop(0); // remove duplicate point\n sections.push(intersectPoints);\n });\n\n return sections;\n};\n\nexport const annotationFromPolygon = (polygon, labelIndex, categoryID, imageID) => {\n let segment = [...polygon].flat();\n let allX = polygon.map(x => x[0]);\n let allY = polygon.map(x => x[1]);\n\n let boundBox = [\n Math.min(...allX),\n Math.min(...allY),\n Math.max(...allX) - Math.min(...allX),\n Math.max(...allY) - Math.min(...allY)\n ].map(x => Math.round(x));\n\n let area = areaFromPolygon(polygon);\n\n let annotation = {\n segmentation: [segment],\n iscrowd: 0,\n image_id: imageID,\n bbox: boundBox,\n category_id: categoryID,\n id: labelIndex,\n area: area\n } as CocoAnnotation;\n\n return annotation;\n};\n\nexport const areaFromPolygon = (polygon) => {\n let contour = polygon.map(x => new Vector2(...x));\n return Math.abs(ShapeUtils.area(contour));\n};\n","import 'ol/ol.css';\nimport {Vector as VectorSource} from \"ol/source\";\nimport {Vector as VectorLayer} from \"ol/layer\";\nimport {Point, Polygon} from \"ol/geom\";\nimport { ProjectedCoordinate } from '../projections';\nimport {Feature} from \"ol\";\nimport {\n Circle as CircleStyle,\n Fill, Stroke, Style\n} from \"ol/style\";\nimport { AerialMap, extentFromPoints } from '../aerial/map';\nimport { textToColor } from './categories';\nimport { checkValidPolygon } from \"../utilities/polygon\";\nimport { transform } from 'ol/proj';\nimport { ImageLabelTools } from '.';\nimport {\n annotationFromPolygon,\n CocoImage,\n ImageLabel,\n LabelCategory,\n sectionsFromIntersection\n} from './image-label';\nimport { Color } from 'three';\nimport {polygon as turfPolygon, intersect as turfIntersect}from '@turf/turf';\n\nclass LabelPoint extends Feature {\n public label: OrthoLabel;\n public index;\n\n constructor(opts, label, index) {\n super(opts);\n this.label = label;\n this.index = index;\n }\n}\n\nclass LabelPolygon extends Feature {\n public label: OrthoLabel;\n\n constructor(opts, label) {\n super(opts);\n this.label = label;\n }\n}\n\nclass Coordinate {\n private array = [];\n\n constructor(coordinates) {\n this.array = coordinates;\n }\n\n get x() {\n return this.array[0];\n }\n\n get y() {\n return this.array[1];\n }\n\n get point() {\n return this.array;\n }\n\n update(point) {\n if (point.length === 2) {\n this.array = point;\n }\n }\n}\n\nclass OrthoLabel extends ImageLabel {\n private coordinates: Coordinate[] = [];\n public aerialMap: AerialMap;\n public polygonLayer: VectorLayer;\n public pointLayer: VectorLayer;\n private minCoordinates = 3;\n private minPixelDistance = 5;\n\n constructor(category: OrthoCategory, aerialMap: AerialMap) {\n super(category);\n this.aerialMap = aerialMap;\n }\n\n get hasEnoughPoints() {\n return this.numPoints >= this.minCoordinates;\n }\n\n get numPoints() {\n return this.coordinates.length;\n }\n\n get coords() {\n /** Used for polygon simplification */\n return this.coordinates.map(x => x.point);\n }\n\n get polygonPointsOnly() {\n return this.coordinates.map(x => x.point);\n }\n\n get map() {\n return this.aerialMap.map;\n }\n\n get darkenedColor() {\n let pointColor = this.categoryColor(1.0);\n let dark = new Color(pointColor)\n .multiplyScalar(0.75);\n\n return `rgb(${dark.r*256}, ${dark.g*256}, ${dark.b*256})`;\n }\n\n categoryColor(opacity=0.2) {\n if (this.highlighted) {\n return `rgba(${Math.ceil(255)}, ${Math.ceil(255)}, ${Math.ceil(255)}, ${opacity})`;\n } else {\n return textToColor(this.category.name, opacity);\n }\n }\n\n pointStyler(opacity=0.8) {\n let pointColor = this.categoryColor(opacity);\n const strokeColor = 'rgba(0, 0, 0, 1.0)';\n let style = new Style({\n image: new CircleStyle({\n radius: 5,\n stroke: new Stroke({\n color: strokeColor\n }),\n fill: new Fill({\n color: pointColor\n }),\n })\n });\n\n return style;\n }\n\n updatePoint(point, index) {\n this.coordinates[index].update(point);\n }\n\n removePoint() {\n this.coordinates.pop();\n }\n\n removeSpecificPoint(index) {\n this.coordinates.splice(index, 1);\n this.draw();\n }\n\n addPoint(point, checkDuplicate=true) {\n const newPoint = new Coordinate(point);\n const oldPoint = this.coordinates[this.coordinates.length - 1];\n\n if (checkDuplicate && oldPoint) {\n // Check for distance from previous point\n let pixelNew = this.map.getPixelFromCoordinate(newPoint.point);\n let pixelOld = this.map.getPixelFromCoordinate(oldPoint.point);\n\n let dU = pixelNew[0] - pixelOld[0];\n let dV = pixelNew[1] - pixelOld[1];\n let distance = Math.sqrt(dU**2 + dV**2);\n\n if (distance < this.minPixelDistance) {\n return true;\n }\n }\n\n this.coordinates.push(newPoint);\n return false;\n }\n\n drawPoints(temporaryPoint) {\n this.map.removeLayer(this.pointLayer);\n\n const pointSource = new VectorSource({\n wrapX: false,\n noWrap: true\n });\n\n const pointStyle = this.pointStyler();\n\n let positions = this.coordinates;\n if (temporaryPoint && !this.completed) {\n positions = [...positions, temporaryPoint];\n }\n\n positions.forEach((point, index) => {\n const feat = new LabelPoint({\n geometry: new Point([point.x, point.y])\n }, this, index);\n pointSource.addFeature(feat);\n });\n\n this.pointLayer = new VectorLayer({\n source: pointSource,\n style: pointStyle,\n updateWhileInteracting: false,\n updateWhileAnimating: false\n });\n\n this.pointLayer.setZIndex(1);\n this.map.addLayer(this.pointLayer);\n }\n\n drawPolygon(temporaryPoint) {\n this.map.removeLayer(this.polygonLayer);\n\n const polySource = new VectorSource({\n wrapX: false,\n noWrap: true\n });\n\n let positions = this.polygonPointsOnly;\n if (temporaryPoint && !this.completed) {\n positions = [...positions, temporaryPoint.point];\n }\n\n let oldState = this.valid;\n\n if (this.hasEnoughPoints){\n this.valid = checkValidPolygon(positions);\n\n if (this.valid !== oldState) {\n this.category.setCategories();\n }\n }\n\n let feature = new LabelPolygon({\n geometry: new Polygon([positions])\n }, this);\n\n polySource.addFeature(feature);\n\n let opacity = this.valid ? 0.2 : 0.0;\n\n this.polygonLayer = new VectorLayer({\n source: polySource,\n style: new Style({\n fill: new Fill({\n color: this.categoryColor(opacity)\n }),\n stroke: new Stroke({\n color: this.darkenedColor,\n lineDash: this.completed ? undefined : [10, 10],\n width: 2\n }),\n }),\n updateWhileInteracting: false,\n updateWhileAnimating: false\n });\n\n this.polygonLayer.setZIndex(1);\n this.map.addLayer(this.polygonLayer);\n }\n\n draw(temporaryPoint=null) {\n if (!this.drawable) {\n return;\n }\n\n this.drawPoints(temporaryPoint);\n this.drawPolygon(temporaryPoint);\n }\n\n clear() {\n this.map.removeLayer(this.polygonLayer);\n this.map.removeLayer(this.pointLayer);\n }\n\n zoom() {\n let positions = [...this.polygonPointsOnly];\n let extent = extentFromPoints(positions, false);\n this.aerialMap.setMapExtent(extent);\n }\n\n setHighlighted(highlight) {\n this.highlighted = highlight;\n this.draw();\n }\n}\n\nclass OrthoCategory extends LabelCategory {\n private aerialTools: AerialLabelTools;\n public labels: OrthoLabel[] = [];\n\n constructor(aerialTools: AerialLabelTools, name) {\n super(name);\n this.aerialTools = aerialTools;\n }\n\n get aerialMap() {\n return this.aerialTools.aerialMap;\n }\n\n setCategories() {\n this.aerialTools.parent.setCategories();\n }\n\n addNewLabel(drawLabel) {\n let label = new OrthoLabel(this, this.aerialMap);\n label.setDrawable(drawLabel);\n this.labels.push(label);\n\n return label;\n }\n}\n\nexport class AerialLabelTools {\n public type = \"ortho\";\n public enabled = false;\n public parent: ImageLabelTools;\n public setPointDelete;\n public setPointAdd;\n public setCategoryList;\n public setAerialTooltipText;\n public contextMenuOpen = false;\n private dragObject: LabelPoint;\n private temporaryPoint: Coordinate;\n private contextMenuClick;\n\n\n private startTooltip = \"Click to start drawing polygon\";\n\n private dragTooltip = `Click and hold to move vertex\n
Right Click to delete point`;\n\n private highlightTooltip = `Right Click to select label\n
CTRL + Right Click to select multiple labels`;\n\n constructor(parent: ImageLabelTools, props) {\n const {setCategoryList, setAerialTooltipText, contextMenuClick} = props;\n\n this.parent = parent;\n this.setCategoryList = setCategoryList;\n this.setAerialTooltipText = setAerialTooltipText;\n this.contextMenuClick = contextMenuClick;\n\n this.init();\n }\n\n get categories() {\n return this.parent.categories\n .filter(x => x instanceof OrthoCategory) as OrthoCategory[];\n }\n\n get viewer() {\n return this.parent.viewer;\n }\n\n get aerialMap() {\n return this.viewer.minimap;\n }\n\n get map() {\n return this.aerialMap.map;\n }\n\n get activeLabel() {\n let selected = null;\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n if (label.selected) {\n selected = label;\n }\n });\n });\n\n return selected;\n }\n\n get numberLabels() {\n let count = 0;\n this.categories.forEach(category =>\n category.labels.forEach(label => count++));\n return count;\n }\n\n get moreTooltip() {\n return `\n Click to add more points (${this.numPoints})\n
Delete Key to remove last point\n ${(this.numPoints > 1) ? \"
Double-click to finish\" : \"\"}\n
Right-click to remove label\n `;\n }\n\n get invalidTooltip() {\n return `\n Polygon is invalid due to self-intersection\n
Click to add more points (${this.numPoints})\n
Delete Key to remove last point\n ${(this.numPoints > 1) ? \"
Double-click to finish\" : \"\"}\n
Right-click to remove label\n `;\n }\n\n get numPoints() {\n let pointCount = 0;\n this.categories.forEach(category =>\n category.labels.forEach(label => {\n if (label.selected) {\n pointCount = label.numPoints;\n }\n })\n );\n return pointCount;\n }\n\n get selected() {\n let selected = false;\n this.categories.forEach(category =>\n category.labels.forEach(label =>\n selected = (selected || label.selected)\n )\n );\n\n return selected;\n }\n\n get visibleOrthos() {\n let orthoList = this.viewer.orthoList;\n return orthoList.orthos.filter(x => x.visible);\n }\n\n get activeImagePaths() {\n return this.visibleOrthos.map(ortho => ortho.path);\n }\n\n get loadedImagePaths() {\n let orthoList = this.viewer.orthoList;\n return orthoList.orthos.map(ortho => ortho.path);\n }\n\n init() {\n this.map.on('click', event => {\n this.mouseClick(event);\n });\n\n this.map.on('dblclick', event => {\n if (!this.enabled) {\n return;\n }\n\n event.preventDefault();\n });\n\n // Check for mouse move\n this.map.on('pointermove', event => {\n this.onMouseMove(event);\n });\n\n // Check for right click\n window.addEventListener('mouseup', event => {\n this.onMouseUp(event);\n }, false);\n }\n\n completeLabel(label) {\n this.resetTemporaryPoint();\n this.parent.completeLabel(label.id);\n this.markLastPointDraggable(label);\n }\n\n markLastPointDraggable(label) {\n let features = label.pointLayer.getSource().getFeatures();\n let lastPoint = features[features.length - 1];\n this.setDragObject(lastPoint);\n }\n\n setState(state) {\n this.enabled = state;\n this.resetToolTipText();\n }\n\n setDragObject(object) {\n if (object instanceof LabelPoint) {\n this.dragObject = object;\n this.aerialMap.setDragState(false);\n this.setPointGrabTooltip();\n } else if (object instanceof LabelPolygon) {\n this.setHighlightTooltip();\n } else {\n this.dragObject = object;\n this.aerialMap.setDragState(true);\n this.resetToolTipText();\n }\n }\n\n mouseClick(event) {\n if (!this.enabled) {\n return;\n }\n\n if (!this.selected) {\n return;\n }\n\n let label = this.activeLabel;\n if (!label) {\n return;\n }\n\n let duplicatePoint = label.addPoint(event.coordinate);\n if (duplicatePoint && label.hasEnoughPoints) {\n this.completeLabel(label);\n return;\n }\n\n this.setToolTipText();\n this.resetTemporaryPoint();\n this.drawActiveLabel();\n }\n\n onMouseMove(event) {\n if (!this.enabled) {\n return;\n }\n\n this.resetTemporaryPoint();\n\n // Drawing new points\n if (this.selected) {\n this.temporaryPoint = new Coordinate(event.coordinate);\n this.setToolTipText();\n this.drawActiveLabel();\n return;\n }\n\n // Dragging existing point\n if (event.dragging) {\n if (this.dragObject) {\n let {label, index} = this.dragObject;\n label.updatePoint(event.coordinate, index);\n label.draw();\n }\n\n return;\n }\n\n // Hovering over label\n const features = this.map.getFeaturesAtPixel(event.pixel);\n let featuresPoly = features.filter(x => x instanceof LabelPolygon);\n let featuresPoint = features.filter(x => x instanceof LabelPoint);\n const hoveringPoint = featuresPoint.length > 0;\n const hoveringPoly = featuresPoly.length > 0;\n\n if (hoveringPoint) {\n this.setDragObject(featuresPoint[0]);\n } else if (hoveringPoly) {\n this.setDragObject(featuresPoly[0]);\n } else {\n this.setDragObject(null);\n }\n }\n\n onMouseUp(event) {\n if (!this.enabled) {\n return;\n }\n\n if (event.button === 0) {\n this.contextMenuOpen = false;\n }\n\n let label = this.activeLabel;\n const isRightClick = (event.button === 2);\n const noneHighlighted = (this.parent.numHighlighted() === 0);\n const oneHighlighted = (this.parent.numHighlighted() === 1);\n\n if (!label && !this.selected && isRightClick) {\n if (noneHighlighted && !event.ctrlKey && !this.contextMenuOpen) {\n let highlightedFeature = this.highlightLabel(event);\n\n if (highlightedFeature) {\n let isPoint = (highlightedFeature instanceof LabelPoint) ? highlightedFeature.index : null;\n let highlightedLabel = highlightedFeature.label;\n this.contextMenuClick(event, isPoint, highlightedLabel.id);\n this.contextMenuOpen = true;\n }\n }\n\n else if (oneHighlighted && !event.ctrlKey && !this.contextMenuOpen) {\n this.parent.unHighlightAll();\n let highlightedFeature = this.highlightLabel(event);\n\n if (highlightedFeature) {\n let isPoint = (highlightedFeature instanceof LabelPoint) ? highlightedFeature.index : null;\n let highlightedLabel = highlightedFeature.label;\n this.contextMenuClick(event, isPoint, highlightedLabel.id);\n this.contextMenuOpen = true;\n }\n }\n\n else if (event.ctrlKey && !this.contextMenuOpen) {\n this.highlightLabel(event);\n }\n\n else {\n this.contextMenuClick(event);\n this.contextMenuOpen = true;\n }\n\n }\n\n else if (isRightClick && (this.selected)) {\n this.parent.deleteLabel(label.id);\n }\n\n else {\n return;\n }\n }\n\n setToolTipText() {\n const started = (this.numPoints === 0);\n let helpMsg = started ? this.startTooltip : this.moreTooltip;\n helpMsg = this.activeLabel.valid ? helpMsg : this.invalidTooltip;\n this.setAerialTooltipText(helpMsg);\n }\n\n highlightLabel(event) {\n let pixel = [event.offsetX, event.offsetY];\n let features = this.map.getFeaturesAtPixel(pixel).filter(x => {\n return (x instanceof LabelPoint) || (x instanceof LabelPolygon);\n });\n\n if (features.length === 0) {\n return;\n }\n\n let label = features[0].label;\n label.setHighlighted(!label.highlighted);\n this.parent.setCategories();\n\n return features[0];\n }\n\n resetToolTipText() {\n this.setAerialTooltipText(\"\");\n }\n\n setPointGrabTooltip() {\n this.setAerialTooltipText(this.dragTooltip);\n }\n\n setHighlightTooltip() {\n this.setAerialTooltipText(this.highlightTooltip);\n }\n\n drawAll() {\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n label.draw(this.temporaryPoint);\n });\n });\n }\n\n drawActiveLabel() {\n if (!this.activeLabel) {\n return;\n }\n\n this.activeLabel.draw(this.temporaryPoint);\n }\n\n getNewCategory(name) {\n return new OrthoCategory(this, name);\n }\n\n deletePoint() {\n this.categories.forEach(category =>\n category.labels.forEach(label => {\n if (label.selected) {\n label.removePoint();\n this.setToolTipText();\n this.drawActiveLabel();\n }\n })\n );\n\n this.parent.setCategories();\n }\n\n deleteSpecificPoint(id) {\n this.categories.forEach(category =>\n category.labels.forEach(label => {\n\n if (label.highlighted && label.hasEnoughPoints) {\n label.removeSpecificPoint(id);\n this.parent.unHighlight(label.id);\n }\n })\n );\n\n this.parent.setCategories();\n }\n\n resetTemporaryPoint() {\n this.temporaryPoint = null;\n }\n\n polygonInImage = (polygonPoints, imageList) => {\n let imagesWithPolygon = [];\n let imageIds = [];\n let polyPointRing = [...polygonPoints, polygonPoints[0]];\n\n imageList.forEach((image, imageId) => {\n let pointsOriginalProj = image.transform(polyPointRing);\n const polygonInPixels = this.calculatePolygonPixels(\n pointsOriginalProj, image.metadata);\n\n let imageInPixels = [\n [0, 0],\n [0, image.originalSize[1]],\n [image.originalSize[0], image.originalSize[1]],\n [image.originalSize[0], 0],\n [0, 0]\n ];\n\n let intersection = turfIntersect(\n turfPolygon([polygonInPixels]),\n turfPolygon([imageInPixels])\n );\n\n let intersectionData = sectionsFromIntersection(intersection);\n intersectionData.forEach((arr) => {\n imagesWithPolygon.push(arr);\n imageIds.push(imageId);\n });\n });\n\n return [imagesWithPolygon, imageIds];\n }\n\n calculatePolygonPixels = (polygonPoints, metadata) => {\n let pixelPolygon = [];\n\n polygonPoints.forEach(point => {\n let pixelPoint = [((point[0] - metadata.x_offset)/metadata.x_scale),\n ((point[1] - metadata.y_offset)/metadata.y_scale)];\n pixelPolygon.push(pixelPoint);\n });\n return pixelPolygon;\n }\n\n pointsToAerial(points, image, projection): Array<[number, number]> {\n let newPoints = [];\n\n try {\n let metadata = image.metadata;\n newPoints = points.map(point => {\n let x = point[0]*metadata.x_scale + metadata.x_offset;\n let y = point[1]*metadata.y_scale + metadata.y_offset;\n let lonlat = new ProjectedCoordinate([x,y,0], projection).toLonLat();\n return transform([lonlat.x, lonlat.y], 'EPSG:4326', 'EPSG:3857');\n });\n } catch {\n // Do Nothing\n }\n\n return newPoints;\n }\n\n jsonImageObj() {\n let images = this.visibleOrthos.map((ortho, imageIndex) => {\n return {\n height: ortho.originalSize[1],\n width: ortho.originalSize[0],\n id: imageIndex,\n file_name: ortho.orthoName,\n metadata: ortho.metadata\n } as CocoImage;\n });\n\n return images;\n }\n\n jsonLabelsObj() {\n let labelIndex = 1;\n let annotations = [];\n\n this.categories.forEach((category, categoryID) => {\n category.labels.forEach(label => {\n if (!label.valid) {\n return;\n }\n\n const [polygonsInside, imageIds] = this.polygonInImage(\n label.polygonPointsOnly, this.visibleOrthos);\n\n polygonsInside.forEach((polygon, index) => {\n let annotation = annotationFromPolygon(polygon,\n labelIndex, categoryID, imageIds[index]);\n annotations.push(annotation);\n labelIndex++;\n });\n });\n });\n\n return annotations;\n };\n}\n","import { RayCaster } from \"../controls\";\nimport { setPointScale } from '../utilities';\nimport earcut from 'earcut';\nimport {\n BufferGeometry,\n Color,\n DoubleSide,\n Face3,\n Geometry,\n Line,\n LineBasicMaterial,\n LineDashedMaterial,\n MathUtils,\n Mesh,\n MeshBasicMaterial,\n Scene,\n SphereGeometry,\n Triangle,\n Vector3\n} from \"three\";\nimport {\n pointInPolygon,\n checkValidPolygon\n} from \"../utilities/polygon\";\nimport { textToColor } from \"./categories\";\nimport {\n CameraImage,\n CameraLoadOptions,\n ImagePixel,\n PanoramicImage,\n PlanarImage\n} from \"../cameras/cameras\";\nimport { ImageLabelTools } from \".\";\nimport {\n annotationFromPolygon,\n CocoImage,\n ImageLabel,\n LabelCategory,\n sectionsFromIntersection\n} from \"./image-label\";\nimport {\n booleanContains,\n intersect as turfIntersect,\n point as turfPoint,\n polygon as turfPolygon\n} from \"@turf/turf\";\nimport { Viewer } from \"../main\";\n\nclass LabelPoint extends Mesh {\n public coordinate: Coordinate;\n public label: SceneLabel;\n public index;\n\n constructor(geometry, material, coordinate, label, index) {\n super(geometry, material);\n this.coordinate = coordinate;\n this.label = label;\n this.index = index;\n }\n}\n\nclass LabelPolygon extends Mesh {\n public label: SceneLabel;\n\n constructor(geometry, material, label) {\n super(geometry, material);\n this.label = label;\n }\n}\n\n\n\nclass Coordinate {\n private camera: CameraImage;\n public pixel: ImagePixel;\n public _direction: Vector3;\n public _position: Vector3;\n\n constructor(pixel, camera) {\n this.camera = camera;\n this.updateValues(pixel);\n }\n\n updateValues(pixel) {\n this.pixel = pixel;\n\n // Reset direction/position values\n this._direction = null;\n this._position = null;\n }\n\n get direction() {\n if (this._direction === null) {\n this._direction = this.camera\n .pixelToDirection(this.pixel);\n }\n\n return this._direction;\n }\n\n get position() {\n if (this._position === null) {\n let cameraPos = this.camera.position.viewer;\n this._position = new Vector3()\n .copy(this.direction)\n .multiplyScalar(100)\n .add(cameraPos);\n }\n\n return this._position;\n }\n}\n\nclass SceneLabel extends ImageLabel {\n public camera: CameraImage;\n public _imageWidth = null;\n public _imageHeight = null;\n public coordinates: Coordinate[] = [];\n public minCoordinates = 3;\n private standardMeshes = [];\n private opacityMeshes = [];\n private pointGeometry: SphereGeometry;\n private pointMaterial: MeshBasicMaterial;\n private lineGeometry: BufferGeometry;\n private lineMaterial: LineBasicMaterial;\n private lineDashedMaterial: LineDashedMaterial;\n private polygonMaterial: MeshBasicMaterial;\n private minPixelDistance = 5;\n private minPoleAngle = 25;\n\n constructor(category, camera: CameraImage) {\n super(category);\n this.pointGeometry = new SphereGeometry(0.05, 20, 20);\n this.lineGeometry = new BufferGeometry();\n this.updateMaterials();\n this.setCamera(camera);\n }\n\n get hasEnoughPoints() {\n return this.numPoints >= this.minCoordinates;\n }\n\n get numPoints() {\n return this.coordinates.length;\n }\n\n get coords() {\n /** Used for polygon simplification */\n return this.coordinates.map(x => [x.pixel.u, x.pixel.v]);\n }\n\n get positions() {\n return this.coordinates.map(x => x.position);\n }\n\n get directions() {\n return this.coordinates.map(x => x.direction);\n }\n\n get pixels() {\n return this.coordinates.map(x => x.pixel);\n }\n\n get viewer() : Viewer {\n return this.category.sceneLabels.viewer;\n }\n\n get standardScene() {\n return this.category.sceneLabels.standardScene;\n }\n\n get opacityScene() {\n return this.category.sceneLabels.opacityScene;\n }\n\n get standardColor() {\n return this.category.color(this.highlighted);\n }\n\n get darkenedColor() {\n let dark = new Color()\n .copy(this.category.color(this.highlighted))\n .multiplyScalar(0.75);\n\n return dark;\n }\n\n get imageWidth() {\n return this._imageWidth\n ? this._imageWidth\n : this.camera.imageWidth;\n }\n\n get imageHeight() {\n return this._imageHeight\n ? this._imageHeight\n : this.camera.imageHeight;\n }\n\n setCamera(camera) {\n this.camera = camera;\n }\n\n setKnownImageSize(width, height) {\n this._imageWidth = width;\n this._imageHeight = height;\n }\n\n updateMaterials() {\n this.pointMaterial = new MeshBasicMaterial({\n color: this.standardColor\n });\n\n this.lineMaterial = new LineBasicMaterial({\n color: this.darkenedColor\n });\n\n this.lineDashedMaterial = new LineDashedMaterial({\n color: this.darkenedColor,\n dashSize: 1.5,\n gapSize: 2.5,\n });\n\n this.polygonMaterial = new MeshBasicMaterial({\n color: this.standardColor,\n side: DoubleSide\n });\n }\n\n removePoint() {\n this.coordinates.pop();\n }\n\n removeSpecificPoint(index) {\n this.coordinates.splice(index, 1);\n this.highlighted = false;\n this.updateMaterials();\n this.draw();\n }\n\n /** @private */\n drawPoints(temporaryPoint) {\n let positions = this.positions;\n\n if (temporaryPoint && !this.completed) {\n positions = [...positions, temporaryPoint.position];\n }\n\n positions.forEach((position, index) => {\n const coordinate = this.coordinates[index];\n const mesh = new LabelPoint(this.pointGeometry,\n this.pointMaterial, coordinate, this, index);\n\n mesh.position.copy(position);\n\n this.standardScene.add(mesh);\n this.standardMeshes.push(mesh);\n setPointScale(this.viewer, mesh);\n });\n }\n\n /** @private */\n drawLines(temporaryPoint) {\n let positions = this.positions;\n if (positions.length === 0) {\n return;\n }\n\n if (temporaryPoint && !this.completed) {\n positions = [...positions, temporaryPoint.position];\n }\n\n let corners = [...positions, positions[0]];\n this.lineGeometry.setFromPoints(corners);\n this.lineGeometry.computeBoundingSphere();\n\n let material = this.completed\n ? this.lineMaterial\n : this.lineDashedMaterial;\n\n const line = new Line(this.lineGeometry, material);\n\n if (!this.completed) {\n line.computeLineDistances();\n }\n\n this.standardMeshes.push(line);\n this.standardScene.add(line);\n }\n\n /** @private */\n drawPolygons(temporaryPoint: Coordinate) {\n let positions = this.positions;\n let directions = this.directions;\n let pixels = this.pixels;\n\n if (temporaryPoint && !this.completed) {\n pixels = [...pixels, temporaryPoint.pixel];\n positions = [...positions, temporaryPoint.position];\n directions = [...directions, temporaryPoint.direction];\n }\n\n if (positions.length < this.minCoordinates) {\n return;\n }\n\n let coordinates3d = this.camera instanceof PanoramicImage\n ? this.camera.directionsToPlanar(directions)\n : pixels.map(x => new Vector3(x.u, x.v, 0.0));\n\n let oldState = this.valid;\n\n // Check for valid polygon\n let coordinates2d = coordinates3d.map(x => [x.x, x.y]);\n this.valid = checkValidPolygon(coordinates2d);\n\n // Panoramic images arent valid at the poles\n if (this.camera instanceof PanoramicImage) {\n this.valid = this.valid && !this.polygonAtPoles(directions);\n }\n\n if (this.valid !== oldState) {\n this.category.setCategories();\n }\n\n if (!this.valid) {\n return;\n }\n\n // Calculate triangle mesh indices\n let coordinatesFlat = coordinates2d.flat();\n let indices = earcut(coordinatesFlat, null, 2);\n\n // Deviation must be nearly zero to be valid\n let deviation = earcut.deviation(coordinatesFlat, null, 2, indices);\n if (deviation > 1E-6) {\n return;\n }\n\n let numTriangles = indices.length / 3;\n for (var i = 0; i < numTriangles; i++) {\n let geom = new Geometry();\n\n let triangle = new Triangle(\n coordinates3d[indices[3 * i]],\n coordinates3d[indices[3 * i + 1]],\n coordinates3d[indices[3 * i + 2]]\n );\n\n // Remove invalid triangles\n let center = new Vector3();\n triangle.getMidpoint(center);\n let valid = pointInPolygon(center, coordinates3d);\n if (!valid) {\n continue;\n }\n\n geom.vertices.push(\n positions[indices[3 * i]],\n positions[indices[3 * i + 1]],\n positions[indices[3 * i + 2]]\n );\n let face = new Face3(0, 1, 2);\n geom.faces.push(face);\n\n let mesh = new LabelPolygon(geom, this.polygonMaterial, this);\n this.opacityMeshes.push(mesh);\n this.opacityScene.add(mesh);\n }\n }\n\n draw(temporaryPoint=null) {\n this.clear();\n\n if (!this.drawable) {\n return;\n }\n\n if (this.category.currentCamera !== this.camera) {\n return;\n }\n\n this.drawPoints(temporaryPoint);\n this.drawLines(temporaryPoint);\n this.drawPolygons(temporaryPoint);\n }\n\n addPoint(pixel: ImagePixel | [], checkDuplicate=true) {\n const newPoint = new Coordinate(pixel, this.camera);\n const oldPoint = this.coordinates[this.coordinates.length - 1];\n\n if (checkDuplicate && oldPoint) {\n // Check for distance from previous point\n let dU = newPoint.pixel.u - oldPoint.pixel.u;\n let dV = newPoint.pixel.v - oldPoint.pixel.v;\n let distance = Math.sqrt(dU**2 + dV**2);\n\n if (distance < this.minPixelDistance) {\n return true;\n }\n }\n\n this.coordinates.push(newPoint);\n return false;\n }\n\n polygonAtPoles(coordinates): boolean {\n // Check each point to make sure the phi angle is safe\n let pointsAtPole = false;\n coordinates.forEach(x => {\n let phi = MathUtils.radToDeg(Math.acos(x.z));\n let minAngle = phi < this.minPoleAngle;\n let maxAngle = phi > (180 - this.minPoleAngle);\n\n pointsAtPole = pointsAtPole || minAngle;\n pointsAtPole = pointsAtPole || maxAngle;\n });\n\n if (pointsAtPole) {\n return true;\n }\n\n // Check to see if the polygon surrounds the pole\n coordinates = coordinates.map(x => [x.x, x.y]);\n let polyPointRing = [...coordinates, coordinates[0]];\n\n return booleanContains(\n turfPolygon([polyPointRing]),\n turfPoint([0, 0])\n );\n }\n\n getCameraBestFit(): CameraLoadOptions {\n // Calculate average direction vector\n let average = new Vector3();\n this.directions.forEach(x => average.add(x));\n average.divideScalar(this.directions.length);\n\n let fovRequired = this.directions.map(direction => {\n let angle = direction.angleTo(average);\n return MathUtils.radToDeg(angle) * 2.0;\n });\n\n // Best fit field of view has as small buffer added\n let fov = Math.max(...fovRequired) * 1.10;\n\n return {fov, direction: average};\n }\n\n clear() {\n this.standardMeshes.forEach(mesh => {\n this.standardScene.remove(mesh);\n mesh.geometry.dispose();\n mesh.material.dispose();\n });\n\n this.opacityMeshes.forEach(mesh => {\n this.opacityScene.remove(mesh);\n mesh.geometry.dispose();\n mesh.material.dispose();\n });\n\n this.standardMeshes = [];\n this.opacityMeshes = [];\n }\n\n zoom() {\n // The camera must be loaded before we are able to\n // calculate the best fit position, so we calculate\n // these values in the loaded callback\n const cameraID = this.camera.id;\n\n // Load camera and set position in callback\n this.viewer.setCameraVisible(cameraID, {\n onLoaded: () => {\n let opts = this.getCameraBestFit();\n this.viewer.setCameraVisible(cameraID, opts);\n }\n });\n }\n\n setHighlighted(highlight) {\n this.highlighted = highlight;\n this.updateMaterials();\n this.draw();\n }\n}\n\nclass SceneCategory extends LabelCategory {\n public sceneLabels: SceneLabelTools;\n public labels: SceneLabel[] = [];\n\n constructor(sceneLabels, name) {\n super(name);\n this.sceneLabels = sceneLabels;\n }\n\n get currentCamera() {\n return this.sceneLabels.currentCamera;\n }\n\n color(highlight=false) : Color {\n let color = `rgba(${Math.ceil(255)}, ${Math.ceil(255)}, ${Math.ceil(255)})`;\n if (!highlight) {\n color = textToColor(this.name);\n }\n return new Color(color);\n }\n\n setCategories() {\n this.sceneLabels.parent.setCategories();\n }\n\n addNewLabel(drawLabel) {\n let label = new SceneLabel(this, this.currentCamera);\n label.setDrawable(drawLabel);\n this.labels.push(label);\n\n return label;\n }\n\n deleteUnfinishedLabel() {\n let numberOfLabels = this.labels.length;\n if (numberOfLabels === 0) {\n return;\n }\n\n if (!this.labels[numberOfLabels - 1].completed) {\n this.labels.pop();\n }\n }\n}\n\nexport class SceneLabelTools {\n public type = \"scene\";\n public parent: ImageLabelTools;\n public standardScene: Scene;\n public opacityScene: Scene;\n private setViewerTooltipText;\n public enabled = false;\n public opacity = 0.2;\n public contextMenuOpen = false;\n private contextMenuClick;\n private polygonHover = false;\n\n private temporaryPoint: Coordinate;\n public movingEndpoint = false;\n public draggable = false;\n private dragObject: LabelPoint = null;\n\n private startTooltip = \"Click to start drawing polygon\";\n\n private dragTooltip = `Click and hold to move vertex\n
Right Click to select point`;\n\n private highlightTooltip = `Right Click to select label\n
CTRL + Right Click to select multiple labels`;\n\n constructor(parent: ImageLabelTools, props) {\n const {setViewerTooltipText, contextMenuClick} = props;\n\n this.parent = parent;\n this.standardScene = new Scene();\n this.opacityScene = new Scene();\n this.setViewerTooltipText = setViewerTooltipText;\n this.contextMenuClick = contextMenuClick;\n\n window.addEventListener('keydown', event => {\n this.onKeyDown(event);\n }, false);\n }\n\n get categories() {\n return this.parent.categories\n .filter(x => x instanceof SceneCategory) as SceneCategory[];\n }\n\n get viewer() {\n return this.parent.viewer;\n }\n\n get cameraList() {\n return this.viewer.cameraList;\n }\n\n get currentCamera() {\n let current = this.cameraList.current;\n if (this.viewer.orbitState || !current) {\n return null;\n }\n\n return current;\n }\n\n get drawing() {\n let label = this.activeLabel;\n if (!label || label.completed) {\n return false;\n }\n\n if (label.coordinates.length === 0) {\n return false;\n }\n\n return true;\n }\n\n get activeLabel() {\n let selected = null;\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n if (label.selected) {\n selected = label;\n }\n });\n });\n\n return selected;\n }\n\n get moreTooltip() {\n return `\n Click to add more points (${this.activeLabel.numPoints})\n
Delete Key to remove last point\n ${(this.activeLabel.numPoints > 1) ? \"
Double-click to finish\" : \"\"}\n
Right-click to remove label\n `;\n }\n\n get invalidTooltip() {\n let isPanoramic = this.activeLabel.camera instanceof PanoramicImage;\n let extraText = isPanoramic ? \"or closeness to poles\" : \"\";\n\n return `\n Polygon is invalid due to self-intersection ${extraText}\n
Click to add more points (${this.activeLabel.numPoints})\n ${(this.activeLabel.numPoints > 1) ? \"
Double-click to finish\" : \"\"}\n
Right-click to remove label\n `;\n }\n\n get visibleCameras() {\n let visited = new Set();\n let cameras = [];\n\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n if (!label.valid) {\n return;\n }\n\n let camera = label.camera;\n let cameraID = camera.id;\n\n if (visited.has(cameraID)) {\n return;\n }\n\n visited.add(cameraID);\n cameras.push(camera);\n });\n });\n\n return cameras;\n }\n\n get activeImagePaths() {\n return this.visibleCameras.map(image => image.path);\n }\n\n get loadedImagePaths() {\n let imageList = this.viewer.cameraList;\n return imageList.cameras.map(image => image.path);\n }\n\n setState(state) {\n this.enabled = state;\n this.resetToolTipText();\n }\n\n getNewCategory(name) {\n return new SceneCategory(this, name);\n }\n\n getClickedDirection(event) {\n const raycaster = new RayCaster(this.viewer, event);\n const direction = raycaster.vectorFromEvent(event);\n return direction;\n }\n\n getImagePixel(event): [boolean, ImagePixel] {\n const direction = this.getClickedDirection(event);\n const [valid, pixel] = this.currentCamera\n .directionToPixel(direction);\n\n return [valid, pixel];\n }\n\n deletePoint() {\n this.categories.forEach(category =>\n category.labels.forEach(label => {\n if (label.selected) {\n label.removePoint();\n this.setToolTipText();\n }\n })\n );\n\n this.parent.setCategories();\n }\n\n deleteSpecificPoint(id) {\n this.categories.forEach(category =>\n category.labels.forEach(label => {\n\n if (label.highlighted && label.hasEnoughPoints) {\n label.removeSpecificPoint(id);\n this.parent.unHighlight(label.id);\n }\n })\n );\n this.contextMenuOpen = false;\n this.parent.setCategories();\n }\n\n highlightLabel(event) {\n if (this.drawing) {\n return;\n }\n\n let targets = [\n ...this.standardScene.children.filter(x => (x instanceof LabelPoint)),\n ...this.opacityScene.children.filter(x => (x instanceof LabelPolygon))\n ];\n\n if (targets.length === 0) {\n return;\n }\n\n let raycaster = new RayCaster(this.viewer, event);\n let intersectedTargets = raycaster.intersectObjects(targets);\n if (intersectedTargets.length === 0) {\n return;\n }\n\n let selected = intersectedTargets[0].object;\n let label = selected.label;\n label.setHighlighted(!label.highlighted);\n this.parent.setCategories();\n\n return selected;\n }\n\n mouseClick(event) {\n\n if (!this.currentCamera) {\n return;\n }\n\n let label = this.activeLabel;\n if (!label) {\n return;\n }\n\n let [valid, point] = this.getImagePixel(event);\n if (!valid) {\n return;\n }\n\n let duplicatePoint = label.addPoint(point);\n if (duplicatePoint && label.hasEnoughPoints) {\n this.completeLabel(label);\n return;\n }\n\n this.setToolTipText();\n this.resetTemporaryPoint();\n this.drawAll();\n }\n\n completeLabel(label) {\n this.resetTemporaryPoint();\n this.parent.completeLabel(label.id);\n this.markLastPointDraggable(label);\n }\n\n markLastPointDraggable(label) {\n let labelPoints = label.standardMeshes\n .filter(x => x instanceof LabelPoint);\n\n let lastPoint = labelPoints[labelPoints.length - 1];\n this.setDragObject(lastPoint);\n }\n\n cancelLabel() {\n let label = this.activeLabel;\n if (!label) {\n return;\n }\n\n this.parent.deleteLabel(label.id);\n this.setToolTipText();\n this.drawAll();\n }\n\n checkPointSelected(event) {\n if (this.drawing) {\n return;\n }\n\n let targetPoly = this.opacityScene.children\n .filter(x => (x instanceof LabelPolygon));\n\n let targets = this.standardScene.children\n .filter(x => x instanceof LabelPoint);\n\n targets = targets.concat(targetPoly);\n\n let dragObject = null;\n let polygonHover = false;\n\n if (targets.length > 0) {\n let raycaster = new RayCaster(this.viewer, event);\n let objects = raycaster.intersectObjects(targets);\n objects = objects.map(x => x.object);\n\n let polygons = objects\n .filter(x => x instanceof LabelPolygon);\n\n let points = objects\n .filter(x => x instanceof LabelPoint);\n\n let draggable = points.length > 0;\n dragObject = draggable ? points[0] : null;\n\n polygonHover = (polygons.length > 0);\n }\n\n this.setPolygonHover(polygonHover);\n this.setDragObject(dragObject);\n }\n\n updateDraggablePoint(event) {\n let coordinate = this.dragObject.coordinate;\n let [valid, point] = this.getImagePixel(event);\n if (!valid) {\n return;\n }\n\n coordinate.updateValues(point);\n this.drawAll();\n }\n\n setDragObject(dragObject) {\n this.dragObject = dragObject;\n\n if (dragObject) {\n this.setPointGrabTooltip();\n }\n }\n\n setPolygonHover(hovering) {\n this.polygonHover = hovering;\n }\n\n setToolTipText() {\n if (!this.activeLabel) {\n this.resetToolTipText();\n return;\n }\n\n let text = \"\";\n if (this.drawing) {\n text = this.activeLabel.valid\n ? this.moreTooltip\n : this.invalidTooltip;\n } else {\n if (this.currentCamera) {\n text = this.startTooltip;\n }\n }\n\n this.setViewerTooltipText(text);\n }\n\n resetToolTipText() {\n this.setViewerTooltipText(\"\");\n }\n\n setPointGrabTooltip() {\n this.setViewerTooltipText(this.dragTooltip);\n }\n\n setPolygonHoverTooltip() {\n this.setViewerTooltipText(this.highlightTooltip);\n }\n\n resetTemporaryPoint() {\n this.temporaryPoint = null;\n }\n\n highlightOnClick(event) {\n\n let labelHighlighted = false;\n const noneHighlighted = (this.parent.numHighlighted() === 0);\n const oneHighlighted = (this.parent.numHighlighted() === 1);\n\n if (noneHighlighted && !event.ctrlKey && !this.contextMenuOpen) {\n let highlightedFeature = this.highlightLabel(event);\n\n if (highlightedFeature) {\n labelHighlighted = true;\n let isPoint = (highlightedFeature instanceof LabelPoint) ? highlightedFeature.index : null;\n let highlightedLabel = highlightedFeature.label;\n this.contextMenuClick(event, isPoint, highlightedLabel.id);\n this.contextMenuOpen = true;\n }\n }\n\n else if (oneHighlighted && !event.ctrlKey && !this.contextMenuOpen) {\n this.parent.unHighlightAll();\n let highlightedFeature = this.highlightLabel(event);\n\n if (highlightedFeature) {\n labelHighlighted = true;\n let isPoint = (highlightedFeature instanceof LabelPoint) ? highlightedFeature.index : null;\n let highlightedLabel = highlightedFeature.label;\n this.contextMenuClick(event, isPoint, highlightedLabel.id);\n this.contextMenuOpen = true;\n }\n }\n\n else if (event.ctrlKey && !this.contextMenuOpen) {\n let highlightedFeature = this.highlightLabel(event);\n\n if (highlightedFeature) {\n labelHighlighted = true;\n }\n }\n\n return labelHighlighted;\n }\n\n onMouseMove(event, mouse = null) {\n const mouseMoved = mouse ? mouse.movement : false;\n const mouseDown = mouse ? mouse.down : false;\n const isLeftClick = mouse ? mouse.button === 0 : false;\n\n this.resetTemporaryPoint();\n this.movingEndpoint = false;\n\n if (!this.enabled) {\n return;\n }\n\n if (!mouseMoved && !mouseDown) {\n this.checkPointSelected(event);\n }\n\n if (mouse === null) {\n return;\n }\n\n if (this.drawing) {\n let [valid, point] = this.getImagePixel(event);\n if (!valid) {\n return;\n }\n\n this.temporaryPoint = new Coordinate(point,\n this.currentCamera);\n\n this.drawAll();\n }\n\n if (this.dragObject) {\n this.setPointGrabTooltip();\n if (mouseDown) {\n if (isLeftClick) {\n this.updateDraggablePoint(event);\n }\n this.movingEndpoint = true;\n return;\n }\n }\n else if (this.polygonHover) {\n this.setPolygonHoverTooltip();\n }\n else {\n this.setToolTipText();\n }\n }\n\n onKeyDown(event) {\n if (event.which === 13) {\n let label = this.activeLabel;\n if (!label) {\n return;\n }\n\n if (label.selected){\n this.parent.completeLabel(label.id);\n }\n }\n }\n\n drawAll() {\n this.standardScene.clear();\n this.opacityScene.clear();\n\n if (this.viewer.orbitState) {\n return;\n }\n\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n label.draw(this.temporaryPoint);\n });\n });\n }\n\n updateColor() {\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n label.updateMaterials();\n });\n });\n }\n\n /** @private */\n calculatePlanarSections(polyPointRing, imageWidth, imageHeight) {\n let sections = [];\n\n let imageBorders = [\n [0, 0],\n [0, imageHeight-1],\n [imageWidth-1, imageHeight-1],\n [imageWidth-1, 0],\n [0, 0]\n ];\n\n let intersection = turfIntersect(\n turfPolygon([polyPointRing]),\n turfPolygon([imageBorders]),\n );\n\n let intersectionData = sectionsFromIntersection(intersection);\n intersectionData.forEach((arr) => {\n sections.push(arr);\n });\n\n return sections;\n }\n\n /** @private */\n calculatePanoramicSections(polyPointRing, image: PanoramicImage, imageWidth, imageHeight) {\n let sections = [];\n let horizontalShift = this.getHorizontalShift(\n polyPointRing, imageWidth);\n\n // Add horizontal shift\n polyPointRing = polyPointRing.map(x=> {\n return [(x[0] + horizontalShift) % imageWidth, x[1]];\n });\n\n // Interpolate pixels for smooth curve in pixel space\n polyPointRing = image.interpolatePixels(\n polyPointRing, imageWidth, imageHeight);\n\n // Compute sections for left polygon\n let imageBordersLeft = [\n [-9999, 0],\n [-9999, imageHeight],\n [horizontalShift-0.001, imageHeight],\n [horizontalShift-0.001, 0],\n [-9999, 0]\n ];\n\n let intersectionLeft = turfIntersect(\n turfPolygon([polyPointRing]),\n turfPolygon([imageBordersLeft]),\n );\n\n let intersectionDataLeft = sectionsFromIntersection(intersectionLeft);\n intersectionDataLeft.forEach((arr) => {\n sections.push(arr);\n });\n\n // Compute sections for right polygon\n let imageBordersRight = [\n [horizontalShift, 0],\n [horizontalShift, imageHeight],\n [9999, imageHeight],\n [9999, 0],\n [horizontalShift, 0]\n ];\n\n let intersectionRight = turfIntersect(\n turfPolygon([polyPointRing]),\n turfPolygon([imageBordersRight]),\n );\n\n let intersectionDataRight = sectionsFromIntersection(intersectionRight);\n intersectionDataRight.forEach((arr) => {\n sections.push(arr);\n });\n\n // Subtract shift from sections\n sections = sections.map(points => {\n return points.map(point => {\n let y = point[1];\n let x = point[0] - horizontalShift;\n x = (x + imageWidth) % imageWidth;\n\n return [x, y];\n });\n });\n\n return sections;\n }\n\n /** @private */\n getHorizontalShift(polyPointRing, imageWidth) {\n let minSpread = Infinity;\n let horizontalShift = 0;\n\n for (var i=0;i {\n return (x[0] + i) % imageWidth;\n });\n\n let spread = Math.max(...x) - Math.min(...x);\n if (spread < minSpread) {\n horizontalShift = i;\n minSpread = spread;\n }\n }\n\n return horizontalShift;\n }\n\n polygonInImage(label: SceneLabel) {\n let sections = [];\n\n let pixels = label.pixels;\n let image = label.camera;\n\n let imageWidth = label.imageWidth;\n let imageHeight = label.imageHeight;\n\n let coordinates = pixels.map(x => [x.u, x.v]);\n let polyPointRing = [...coordinates, coordinates[0]];\n\n if (image instanceof PlanarImage) {\n sections = this.calculatePlanarSections(\n polyPointRing, imageWidth, imageHeight);\n } else if (image instanceof PanoramicImage) {\n sections = this.calculatePanoramicSections(\n polyPointRing, image, imageWidth, imageHeight);\n } else {\n return sections;\n }\n\n return sections;\n }\n\n pointsToPixels(points): ImagePixel[] {\n return points.map(x => {\n return {u: x[0], v: x[1]} as ImagePixel;\n });\n }\n\n getCameraSize(image) {\n let width = 0;\n let height = 0;\n\n this.categories.forEach(category => {\n category.labels.forEach(label => {\n if (label.camera === image) {\n width = label.imageWidth;\n height = label.imageHeight;\n }\n });\n });\n\n return {width, height};\n }\n\n jsonImageObj() {\n let images = this.visibleCameras.map((image, imageIndex) => {\n const {width, height} = this.getCameraSize(image);\n return {\n height: height,\n width: width,\n id: imageIndex,\n file_name: image.name,\n } as CocoImage;\n });\n\n return images;\n }\n\n jsonLabelsObj() {\n let labelIndex = 1;\n let annotations = [];\n\n this.categories.forEach((category, categoryID) => {\n category.labels.forEach(label => {\n if (!label.valid) {\n return;\n }\n\n const imageID = this.visibleCameras.indexOf(label.camera);\n const polygonsInside = this.polygonInImage(label);\n\n polygonsInside.forEach(polygon => {\n let annotation = annotationFromPolygon(polygon,\n labelIndex, categoryID, imageID);\n annotations.push(annotation);\n labelIndex++;\n });\n });\n });\n\n return annotations;\n }\n\n update(changeDetector) {\n const update = changeDetector.changed;\n if (!update) {\n return;\n }\n\n if (changeDetector.cameraChanged || changeDetector.orbitChanged) {\n this.categories.forEach(category => {\n // Remove incomplete observation if camera changed\n category.deleteUnfinishedLabel();\n this.resetTemporaryPoint();\n });\n\n this.drawAll();\n return;\n }\n\n this.standardScene.children.forEach(mesh => {\n if (mesh instanceof LabelPoint) {\n setPointScale(this.viewer, mesh);\n }\n });\n }\n}\n\n","class UnitConverter {\n private metresToSurveyFeetRatio = 1200 / 3937;\n private metresToFeetRatio = 0.3048;\n private allowedUnits = new Set(['ft', 'sft', 'm']);\n\n public convert(value, fromUnits, toUnits) {\n if (!this.allowedUnits.has(fromUnits) || !this.allowedUnits.has(toUnits)) {\n throw new Error('Units must either be \"m\", \"sft\", or \"ft\"');\n }\n\n if (isNaN(value)) {\n throw new Error('Value must be a number');\n }\n\n if (fromUnits === toUnits) {\n return value;\n }\n\n let convertedValue = value;\n\n if (fromUnits === 'ft' || fromUnits === 'sft') {\n convertedValue *= (fromUnits === 'ft' ? this.metresToFeetRatio : this.metresToSurveyFeetRatio);\n }\n\n if (toUnits === 'ft' || toUnits === 'sft') {\n convertedValue /= (toUnits === 'ft' ? this.metresToFeetRatio : this.metresToSurveyFeetRatio);\n }\n\n return convertedValue;\n }\n}\n\nexport default new UnitConverter();\n","import $ from 'jquery';\nimport MeasurementController from \"./measurement-controller\";\nimport {Circle as CircleStyle, Fill, Stroke, Style} from \"ol/style\";\nimport {Vector as VectorSource} from \"ol/source\";\nimport {Vector as VectorLayer} from \"ol/layer\";\nimport {Draw} from \"ol/interaction\";\nimport {getArea, getLength} from 'ol/sphere';\nimport Overlay from 'ol/Overlay';\nimport {unByKey} from 'ol/Observable';\nimport Feature from 'ol/Feature';\nimport Polygon from 'ol/geom/Polygon';\nimport './aerial-tooltip.css';\n\nexport default class MinimapMeasure {\n private controller: MeasurementController;\n private sourceStandard: VectorSource;\n private vectorStandard: VectorLayer;\n private sourceHover: VectorSource\n private vectorHover: VectorLayer\n\n private pointerMoveHandler;\n public enabled = false;\n public measurementType = null;\n public sketch = null;\n private measureTooltipElement = null;\n private measureTooltip = null;\n private draw = null;\n private initialized = false;\n\n constructor(controller) {\n this.controller = controller;\n }\n\n get map() {\n return this.controller.viewer.minimap.map;\n }\n\n get mapElement() {\n return this.controller.viewer.minimap.containerElement;\n }\n\n get moreTooltip() {\n let coordinates = this.sketch.getGeometry().flatCoordinates;\n let numPoints = (coordinates.length / 2.0) - 1;\n\n let canFinish = (this.measurementType === \"Polygon\")\n ? numPoints > 2\n : true;\n\n return `\n Click to add more points (${numPoints})\n ${canFinish ? \"
Double-click to finish\" : \"\"}\n
Right-click to cancel\n `;\n }\n\n get startTooltip() {\n if (this.measurementType === \"LineString\") {\n return \"Click to start drawing line\";\n }\n\n if (this.measurementType === \"Polygon\") {\n return \"Click to start drawing polygon\";\n }\n\n return \"Invalid measure type\";\n }\n\n setMeasurementType(measurementType) {\n // Only standard and area and valid for aerial\n if (measurementType === 'standard') {\n this.setAsLength();\n } else if (measurementType === 'area') {\n this.setAsArea();\n } else {\n this.setAsNull();\n }\n }\n\n setAsLength() {\n this.measurementType = \"LineString\";\n this.reloadInteraction();\n }\n\n setAsArea() {\n this.measurementType = \"Polygon\";\n this.reloadInteraction();\n }\n\n setAsNull() {\n this.measurementType = null;\n this.reloadInteraction();\n this.removeInteraction();\n }\n\n init() {\n if (this.initialized) {\n return;\n }\n\n let fill = new Fill({\n color: 'rgba(255, 255, 255, 0.2)'\n });\n\n let image = new CircleStyle({\n radius: 7,\n fill: new Fill({\n color: '#008B8B'\n })\n });\n\n this.sourceStandard = new VectorSource({\n wrapX: false,\n noWrap: true\n });\n\n this.vectorStandard = new VectorLayer({\n type: 'measure',\n source: this.sourceStandard,\n style: new Style({\n fill: fill,\n image: image,\n stroke: new Stroke({\n color: '#008B8B',\n width: 2\n })\n })\n });\n\n this.sourceHover = new VectorSource({\n wrapX: false,\n noWrap: true\n });\n\n this.vectorHover = new VectorLayer({\n type: 'measure',\n source: this.sourceHover,\n style: new Style({\n fill: fill,\n image: image,\n stroke: new Stroke({\n color: '#ffcc33',\n width: 2\n })\n })\n });\n\n this.vectorStandard.setZIndex(1);\n this.vectorHover.setZIndex(1);\n\n this.pointerMoveHandler = event => {\n if (event.dragging || !this.controller.enabled) {\n return;\n }\n\n let helpMsg = this.sketch ? this.moreTooltip : this.startTooltip;\n this.setTooltipText(helpMsg);\n };\n\n this.map.addLayer(this.vectorStandard);\n this.map.addLayer(this.vectorHover);\n\n this.map.on('pointermove', this.pointerMoveHandler);\n this.addInteraction();\n\n this.mapElement.addEventListener('mouseenter', () => {\n if (this.controller.enabled) {\n this.addInteraction();\n }\n });\n\n this.mapElement.addEventListener('mouseleave', () => {\n if (this.controller.enabled) {\n this.removeInteraction();\n }\n });\n\n this.initialized = true;\n }\n\n setTooltipText(message) {\n this.controller.setAerialTooltipText(message);\n }\n\n setMeasureTooltipInfo(message, coordinates, offset = null) {\n this.measureTooltipElement.innerHTML = message;\n this.measureTooltip.setPosition(coordinates);\n if (offset) {\n this.measureTooltip.setOffset(offset);\n }\n }\n\n hideTooltip() {\n this.controller.setAerialTooltipText(\"\");\n }\n\n reloadInteraction() {\n if (this.map) {\n if (this.draw) {\n this.map.removeInteraction(this.draw);\n }\n\n this.sketch = null;\n this.addInteraction();\n }\n }\n\n clear() {\n if (!this.initialized) {\n return;\n }\n\n $('.tooltip-minimap').remove();\n\n if (this.sourceStandard) {\n this.sourceStandard.clear();\n }\n\n if (this.sourceHover) {\n this.sourceHover.clear();\n }\n\n this.removeInteraction();\n\n this.sketch = null;\n\n this.createMeasureTooltip();\n this.addInteraction();\n }\n\n removeInteraction() {\n if (this.draw) {\n this.map.removeInteraction(this.draw);\n }\n }\n\n addInteraction() {\n if (this.measurementType === null || this.map === null) {\n return;\n }\n\n if (!this.controller.editable) {\n return;\n }\n\n this.removeInteraction();\n\n this.draw = new Draw({\n source: this.sourceStandard,\n type: this.measurementType,\n condition: event => {\n if (event.originalEvent.button === 0) {\n return true;\n }\n\n if (event.originalEvent.button === 2) {\n if (this.controller.enabled) {\n this.reloadInteraction();\n this.setTooltipText(this.startTooltip);\n }\n }\n\n return false;\n },\n style: new Style({\n fill: new Fill({\n color: 'rgba(255, 255, 255, 0.2)'\n }),\n stroke: new Stroke({\n color: 'rgba(0, 0, 0, 0.5)',\n lineDash: [10, 10],\n width: 2\n }),\n image: new CircleStyle({\n radius: 5,\n stroke: new Stroke({\n color: 'rgba(0, 0, 0, 0.7)'\n }),\n fill: new Fill({\n color: 'rgba(255, 255, 255, 0.2)'\n })\n })\n })\n });\n this.map.addInteraction(this.draw);\n this.createMeasureTooltip();\n\n let listener;\n\n this.draw.on('drawstart', event => {\n this.sketch = event.feature;\n\n listener = this.sketch.getGeometry().on('change', event => {\n let geometry = event.target;\n let [output, tooltipCoord] = this.getTooltipValues(geometry);\n this.setMeasureTooltipInfo(output, tooltipCoord);\n });\n }, this);\n\n this.draw.on('drawend', (event) => {\n this.measureTooltipElement.className = 'tooltip tooltip-minimap tooltip-static';\n this.measureTooltip.setOffset([0, -7]);\n this.sketch = null;\n this.measureTooltipElement = null;\n this.createMeasureTooltip();\n unByKey(listener);\n\n this.controller.addAerialMeasurement(event.feature.getGeometry());\n this.setTooltipText(this.startTooltip);\n }, this);\n }\n\n createMeasureTooltip() {\n if (this.measureTooltipElement) {\n let measureParent = this.measureTooltipElement.parentNode;\n if (measureParent) {\n measureParent.removeChild(this.measureTooltipElement);\n }\n }\n\n this.measureTooltipElement = document.createElement('div');\n this.measureTooltipElement.className = 'tooltip tooltip-minimap tooltip-measure';\n this.measureTooltip = new Overlay({\n element: this.measureTooltipElement,\n offset: [0, -15],\n positioning: 'bottom-center'\n });\n this.map.addOverlay(this.measureTooltip);\n }\n\n loadGeometry(measurement, hover = false) {\n let geometry = measurement.geometry;\n let feature = new Feature(geometry);\n feature.measurementID = measurement.id;\n\n if (hover) {\n this.sourceHover.addFeature(feature);\n } else {\n this.sourceStandard.addFeature(feature);\n }\n\n let [output, tooltipCoord] = this.getTooltipValues(geometry);\n\n this.createMeasureTooltip();\n this.measureTooltipElement.className = 'tooltip tooltip-minimap tooltip-static';\n this.setMeasureTooltipInfo(output, tooltipCoord, [0, -7]);\n this.measureTooltipElement = null;\n\n this.createMeasureTooltip();\n }\n\n getTooltipValues(geometry) {\n let output;\n let tooltipCoord;\n\n let formatter = this.controller.formatter;\n\n if (geometry instanceof Polygon) {\n let area = getArea(geometry);\n output = formatter.formatArea(area);\n tooltipCoord = geometry.getInteriorPoint().getCoordinates();\n } else {\n let length = getLength(geometry);\n output = formatter.formatLength(length);\n tooltipCoord = geometry.getLastCoordinate();\n }\n return [output, tooltipCoord];\n }\n}\n","import {PointCloudManager} from \"../pointcloud\";\nimport MeasurementController from \"./measurement-controller\";\nimport {\n MeasurementArea,\n MeasurementLine,\n MeasurementPoint,\n MeasurementVolume,\n SnapDownMeasurement,\n SnapUpMeasurement,\n} from \"./measurement\";\n\nexport default class MeasurementConstructor {\n private controller: MeasurementController;\n private pointCloud: PointCloudManager;\n private MeasurementClass\n public measurement;\n private type = null;\n public isFinished = false;\n\n constructor(controller, pointCloud) {\n this.controller = controller;\n this.pointCloud = pointCloud;\n\n this.MeasurementClass = MeasurementLine;\n this.measurement = new this.MeasurementClass();\n }\n\n get activeMeasurement() {\n return this.measurement.vertices.length > 0;\n }\n\n setBuilder(builderType) {\n this.type = builderType;\n\n if (builderType === 'snap-up') {\n this.MeasurementClass = SnapUpMeasurement;\n } else if (builderType === 'snap-down') {\n this.MeasurementClass = SnapDownMeasurement;\n } else if (builderType === 'single-point') {\n this.MeasurementClass = MeasurementPoint;\n } else if (builderType === 'area') {\n this.MeasurementClass = MeasurementArea;\n } else if (builderType === 'volume') {\n this.MeasurementClass = MeasurementVolume;\n } else {\n this.MeasurementClass = MeasurementLine;\n }\n\n this.measurement = new this.MeasurementClass();\n this.measurement.setController(this.controller);\n }\n\n getMeasurement() {\n if (this.isFinished) {\n let finishedMeasurement = this.measurement;\n\n this.measurement = new this.MeasurementClass();\n this.measurement.setController(this.controller);\n\n this.isFinished = false;\n\n return finishedMeasurement;\n }\n\n return this.measurement;\n }\n\n reset() {\n this.isFinished = false;\n this.measurement.vertices = [];\n }\n\n add(vertex) {\n if (!this.isFinished) {\n let result = this.measurement.add(vertex, this);\n this.isFinished = result.finished;\n return result;\n }\n return {\n added: false,\n valid: false\n };\n }\n}\n","import { isLonLatProjection } from \"../projections\";\n\nexport default class MeasurementFormatter {\n public units;\n public emptyValue = \"\";\n public nullValue = \"N/A\";\n private metersCutoff = 500;\n private squareMetersCutoff = 250000;\n private formatterPrecision = 1;\n private vectorPrecisionLonLat = 6; // ~0.1m\n private vectorPrecisionStandard = 1; // 0.1m\n\n constructor(units) {\n if (units !== 'ft' && units !== 'm' && units !== \"sft\") {\n throw TypeError('units must be \"ft\", \"sft\" or \"m\"');\n }\n\n this.setUnits(units);\n }\n\n get isMetric() {\n return this.units === \"m\";\n }\n\n get isSurveyFeet() {\n return this.units === \"sft\";\n }\n\n get areaUnits() {\n return `${this.isMetric ? \"m\" : \"ft\"}^2`;\n }\n\n get volumeUnits() {\n return `${this.isMetric ? \"m\" : \"yd\"}^3`;\n }\n\n setUnits(units) {\n this.units = units;\n }\n\n formatLength(value) {\n let units;\n let finalValue = value;\n\n if ((this.units === 'ft') || (this.units === \"sft\")) {\n if (value > this.metersCutoff) {\n units = \"mi\";\n finalValue = MeasurementFormatter.metresToMiles(finalValue, this.isSurveyFeet);\n } else {\n // Round the meters units first for feet + inches\n if (this.formatterPrecision) {\n finalValue = finalValue.toFixed(this.formatterPrecision);\n }\n\n finalValue = parseFloat(finalValue);\n finalValue = MeasurementFormatter.metresToFeet(finalValue, this.isSurveyFeet);\n let feet = Math.floor(finalValue);\n let inches = Math.round((finalValue - feet) * 12.0);\n return `${feet} ft ${inches} in `;\n }\n } else {\n if (value > this.metersCutoff) {\n units = \"km\";\n finalValue = MeasurementFormatter.metresToKiloMetres(finalValue);\n } else {\n units = \"m\";\n }\n }\n\n if (this.formatterPrecision) {\n finalValue = finalValue.toFixed(this.formatterPrecision);\n }\n\n return `${finalValue} ${units}`;\n }\n\n formatVolume(measurement) {\n let units;\n let finalValue = measurement.volumeValue;\n\n if ((this.units === 'ft') || (this.units === \"sft\")) {\n units = \"yd3\";\n finalValue = MeasurementFormatter.cubicMetresToCubicYards(finalValue);\n } else {\n units = \"m3\";\n }\n\n if (this.formatterPrecision) {\n finalValue = finalValue.toFixed(this.formatterPrecision);\n }\n\n return `${finalValue} ${units}`;\n }\n\n formatArea(value) {\n let units;\n let finalValue = value;\n\n if ((this.units === 'ft') || (this.units === \"sft\")) {\n if (value > this.squareMetersCutoff) {\n units = \"mi2\";\n finalValue = MeasurementFormatter.squareMetresToSquareMiles(finalValue, this.isSurveyFeet);\n } else {\n units = \"ft2\";\n finalValue = MeasurementFormatter.squareMetresToSquareFeet(finalValue, this.isSurveyFeet);\n }\n } else {\n if (value > this.squareMetersCutoff) {\n units = \"km2\";\n finalValue = MeasurementFormatter.squareMetresToSquareKilometres(finalValue);\n } else {\n units = \"m2\";\n }\n }\n\n if (this.formatterPrecision) {\n finalValue = finalValue.toFixed(this.formatterPrecision);\n }\n\n return `${finalValue} ${units}`;\n }\n\n formatAngle(value, format = true) {\n if (!isNaN(value)) {\n if (format) {\n return `${value.toFixed(this.formatterPrecision)}°`;\n }\n return value.toFixed(this.formatterPrecision);\n }\n return this.nullValue;\n }\n\n formatGrade(value, format = true) {\n let maxGrade = 1000000;\n if (isFinite(value) && (value < maxGrade)) {\n if (format) {\n return `${value.toFixed(this.formatterPrecision)}%`;\n }\n return value.toFixed(this.formatterPrecision);\n }\n return this.nullValue;\n }\n\n convertUnits(value, type = \"\") {\n if ((this.units === 'ft') || (this.units === \"sft\")) {\n if (type === \"area\") {\n value = MeasurementFormatter.squareMetresToSquareFeet(value, this.isSurveyFeet);\n } else if (type === \"volume\") {\n value = MeasurementFormatter.cubicMetresToCubicYards(value);\n } else {\n value = MeasurementFormatter.metresToFeet(value, this.isSurveyFeet);\n }\n }\n if (this.formatterPrecision) {\n value = value.toFixed(this.formatterPrecision);\n }\n return value;\n }\n\n getVectorPrecision(projection = null) {\n let precisionX = this.vectorPrecisionStandard;\n let precisionY = this.vectorPrecisionStandard;\n let precisionZ = this.vectorPrecisionStandard;\n\n if (projection && isLonLatProjection(projection)) {\n precisionX = this.vectorPrecisionLonLat;\n precisionY = this.vectorPrecisionLonLat;\n }\n\n return {\n x: precisionX,\n y: precisionY,\n z: precisionZ\n };\n }\n\n static metresToYards(value) {\n /** International units and US units are the same for yards */\n return value * (1 / 0.9144);\n }\n\n static metresToFeet(value, isSurveryFeet=false) {\n if (isSurveryFeet) {\n return value * (3937.0 / 1200.0);\n }\n\n return value * (1 / 0.3048);\n }\n\n static metresToMiles(value, isSurveryFeet=false) {\n return value * this.metresToFeet(1.0, isSurveryFeet) / 5280;\n }\n\n static metresToKiloMetres(metres) {\n return metres * 0.001;\n }\n\n static squareMetresToSquareKilometres(squareMetres) {\n return squareMetres * 0.000001;\n }\n\n static squareMetresToSquareFeet(squareMetres, isSurveryFeet=false) {\n let val = Math.pow(this.metresToFeet(1.0, isSurveryFeet), 2);\n return squareMetres * val;\n }\n\n static squareMetresToSquareMiles(squareMetres, isSurveryFeet=false) {\n let val = Math.pow(this.metresToMiles(1.0, isSurveryFeet), 2);\n return squareMetres * val;\n }\n\n static cubicMetresToCubicYards(cubicMetres) {\n let val = Math.pow(this.metresToYards(1.0), 3);\n return cubicMetres * val;\n }\n}\n\n\n","import { GeocentricCoordinate } from '../projections';\nimport {\n AerialLengthMeasurement,\n AerialMeasurement,\n Measurement3D,\n MeasurementArea,\n MeasurementLine,\n MeasurementPoint,\n MeasurementVolume,\n} from './measurement';\nimport {Vector3} from \"three\";\nimport MeasurementController from './measurement-controller';\n\nexport default class MeasurementGroup {\n public controller: MeasurementController;\n public name = 'Untitled Measurement Group';\n public measurements = [];\n public databaseID = null;\n public collectionID = null;\n\n get viewer() {\n return this.controller.viewer;\n }\n\n constructor(controller) {\n this.controller = controller;\n }\n\n add(measurement) {\n this.measurements.push(measurement);\n\n if (this.databaseID) {\n measurement.save(this.databaseID);\n }\n\n this.updateMeasurements();\n }\n\n removeByID(id) {\n if (this.databaseID) {\n this.measurements.find(measurement => measurement.id === id).delete();\n }\n\n this.removeFromArray(id);\n this.updateMeasurements();\n }\n\n removeFromArray(id) {\n this.measurements = this.measurements.filter(measurement => measurement.id !== id);\n }\n\n reset() {\n this.databaseID = null;\n this.collectionID = null;\n this.removeAll();\n }\n\n removeAll() {\n this.measurements.forEach(measurement => {\n measurement.clear();\n });\n this.measurements = [];\n this.updateMeasurements();\n }\n\n updateMeasurements() {\n this.controller.refreshMeasurementList();\n }\n\n loadMeasurements(result) {\n // Add 3d measurements\n let measure3D = result.measurements3D.map(measurement => {\n let newMeasurement;\n\n if (measurement.type === 'point') {\n newMeasurement = new MeasurementPoint();\n } else if (measurement.type === 'area') {\n newMeasurement = new MeasurementArea();\n } else if (measurement.type === 'volume') {\n newMeasurement = new MeasurementVolume();\n } else {\n newMeasurement = new MeasurementLine();\n }\n\n newMeasurement.setController(this.controller);\n newMeasurement.title = measurement.title;\n newMeasurement.databaseID = measurement.id;\n newMeasurement.timestamp = measurement.time_created;\n\n measurement.coordinates.forEach(vertex => {\n vertex = new Vector3().fromArray(vertex);\n if (vertex.length() === 0) {\n return;\n }\n newMeasurement.vertices.push(new GeocentricCoordinate(vertex));\n });\n\n if (newMeasurement instanceof MeasurementArea) {\n newMeasurement.generateSurface();\n }\n\n if (measurement.volume) {\n newMeasurement.loadExistingVolume(measurement.volume);\n }\n\n return newMeasurement;\n });\n\n // Add 2d measurements\n let measure2D = result.measurements2D.map(measurement => {\n let newMeasurement;\n\n if (measurement.type === 'length') {\n newMeasurement = new AerialLengthMeasurement();\n } else {\n newMeasurement = new AerialLengthMeasurement();\n }\n\n newMeasurement.loadFromCoordinates(measurement.coordinates);\n newMeasurement.setController(this.controller);\n newMeasurement.title = measurement.title;\n newMeasurement.databaseID = measurement.id;\n newMeasurement.timestamp = measurement.time_created;\n\n return newMeasurement;\n });\n\n this.measurements = [...measure3D, ...measure2D];\n\n // Sort by reverse timestamp ordering\n this.measurements = this.measurements.sort((a, b) =>\n a.timestamp < b.timestamp ? 1 : b.timestamp < a.timestamp ? -1 : 0\n );\n this.measurements.reverse();\n\n // Display the measurements\n this.measurements.forEach(measurement => {\n this.controller.renderMeasurement(measurement);\n });\n\n // Make sure drag object is false\n this.controller.resetDragObject();\n }\n\n getLineCoordinates(projection) {\n let lines = [];\n let names = [];\n let measurements = this.measurements;\n\n measurements.forEach(measurement => {\n if (measurement instanceof MeasurementPoint) {\n return;\n }\n\n let isAerial = measurement instanceof AerialMeasurement;\n let isLine = measurement instanceof Measurement3D;\n if (isAerial || isLine) {\n let line = measurement.getProjectedVertices(projection);\n lines.push(line);\n names.push(measurement.title);\n }\n });\n\n return {\n data: lines,\n names: names\n };\n }\n\n getPointCoordinates(projection) {\n let points = [];\n let names = [];\n let measurements = this.measurements;\n\n measurements.forEach(measurement => {\n if (measurement instanceof MeasurementPoint) {\n let point = measurement.getProjectedVertices(projection);\n points.push(point[0]);\n names.push(measurement.title);\n }\n });\n\n return {\n data: points,\n names: names\n };\n }\n\n getAreaGeometry() {\n let measurements = this.getAreaMeasurements();\n let measureGeometry = [];\n measurements.forEach(measurement => {\n if (measurement.valid === false) {\n return;\n }\n\n let volumeStatus = 0;\n if (measurement instanceof MeasurementVolume) {\n volumeStatus = measurement.calculated ? 2 : 1;\n }\n\n measureGeometry.push({\n vertices: measurement.localVertices3D,\n indices: measurement.indices,\n volumeStatus: volumeStatus\n });\n });\n\n measureGeometry.sort((a, b) => {\n return a.volumeStatus - b.volumeStatus;\n });\n measureGeometry.reverse();\n\n return measureGeometry;\n }\n\n getAreaMeasurements() {\n return this.getMeasurementByType(MeasurementArea);\n }\n\n getMeasurements2D() {\n return this.getMeasurementByType(AerialMeasurement);\n }\n\n getMeasurementByType(measureClass) {\n return this.measurements.filter(measurement => {\n return measurement instanceof measureClass;\n });\n }\n}\n","import LocalScene, {\n GeocentricCoordinate,\n ProjectedCoordinate,\n} from '../projections';\nimport {\n AerialAreaMeasurement,\n AerialMeasurement,\n Measurement3D,\n MeasurementArea,\n MeasurementPoint,\n MeasurementVolume\n} from './measurement';\nimport MeasurementController from './measurement-controller';\nimport {dialog, fs, isStaticSite} from \"../../../electron-modules\";\nimport slash from 'slash';\nimport { windowSafeDateISO } from '../misc';\nimport { Vector3 } from 'three';\n\nexport default class MeasurementGroupExporter {\n private controller: MeasurementController;\n private lineDelimiter = \"\\n\";\n private columnDelimiter = ',';\n private measureExportFormat = \"3dm\";\n private csvExportFilter = [{name: 'Measurement CSV', extensions: ['csv']}];\n public dataExportFilter = [{name: 'Measurement Data', extensions: [this.measureExportFormat]}];\n\n constructor(controller) {\n this.controller = controller;\n }\n\n get viewer() {\n return this.controller.viewer;\n }\n\n get formatter() {\n return this.controller.formatter;\n }\n\n exportLinework(measurementGroup, type, version) {\n //let lines = measurementGroup.getLineCoordinates();\n //let points = measurementGroup.getPointCoordinates();\n //let name = `${measurementGroup.name} (${type}).zip`;\n\n // Need to implement dxf/shp javascript write\n }\n\n exportCSV(measurementGroup, ordering) {\n const precision = this.formatter.getVectorPrecision(LocalScene.viewProjection);\n this.export3D(measurementGroup, this.formatter, ordering, precision);\n this.export2D(measurementGroup, this.formatter, ordering, precision);\n }\n\n exportDAT(measurementGroup) {\n let data = {\n count: 0,\n name: measurementGroup.name,\n projection: LocalScene.dataProjection,\n measurements: {\n measurements2D: [],\n measurements3D: []\n }\n };\n\n let measurements = measurementGroup.measurements;\n measurements.forEach(measurement => {\n let created = measurement.timeCreated.toISOString().split('.')[0];\n let title = measurement.title;\n let type = measurement.dbType;\n let coordinates = measurement.coordinates;\n\n let info = {\n id: null,\n coordinates: coordinates,\n time_created: created,\n title: title,\n type: type,\n volume: null,\n };\n\n if (measurement instanceof AerialMeasurement) {\n data.measurements.measurements2D.push(info);\n } else {\n if (measurement instanceof MeasurementVolume) {\n info.volume = measurement.volumeHelper.value;\n }\n\n data.measurements.measurements3D.push(info);\n }\n\n data.count += 1;\n });\n\n // Download data export file\n const name = this.viewer.projectName;\n this.downloadDataExport(name, data);\n }\n\n export2D(measurementGroup, formatter, ordering, precision) {\n let measurements = measurementGroup.measurements.filter(measurement =>\n measurement instanceof AerialMeasurement\n );\n\n if (measurements.length === 0) {\n return;\n }\n\n let mapProjection = this.viewer.minimap.mapSystem;\n\n let header = this.getHeaderValues2D(measurements, ordering, formatter);\n let nullValue = formatter.nullValue;\n\n let csv = [\n header.join(this.columnDelimiter)\n ];\n\n // Load measurements in reverse order\n measurements.reverse();\n measurements.forEach(measurement => {\n let row;\n let value;\n\n if (measurement instanceof AerialAreaMeasurement) {\n value = formatter.convertUnits(measurement.getValue(), measurement.dbType);\n row = [measurement.title, \"Area\", nullValue, value];\n } else {\n value = formatter.convertUnits(measurement.getValue(), measurement.dbType);\n row = [measurement.title, \"Length\", value, nullValue];\n }\n\n let vertices = [];\n let coordinates = measurement.geometry.flatCoordinates;\n for (var i = 0; i < (coordinates.length / 2.0); i++) {\n let x = coordinates[2 * i];\n let y = coordinates[(2 * i) + 1];\n\n let coord = new Vector3(x, y, 0.0);\n let ecef = new ProjectedCoordinate(coord, mapProjection).toGeocentric();\n let proj = new GeocentricCoordinate(ecef).toViewProjection();\n vertices.push(proj);\n }\n\n vertices.forEach(vertex => {\n // Export with x and y values swapped\n if (ordering === \"yxz\") {\n vertex = new Vector3(vertex.y, vertex.x, vertex.z);\n }\n\n row = row.concat([\n vertex.x.toFixed(precision.x),\n vertex.y.toFixed(precision.y),\n ]);\n });\n\n csv.push(row.join(this.columnDelimiter));\n });\n\n const name = this.viewer.projectName;\n this.downloadCSVFile(`${name} measurements (2D) ${windowSafeDateISO()}`, csv);\n }\n\n export3D(measurementGroup, formatter, ordering, precision) {\n let measurements = measurementGroup.measurements.filter(measurement =>\n measurement instanceof Measurement3D\n );\n\n if (measurements.length === 0) {\n return;\n }\n\n let header = this.getHeaderValues3D(measurements, ordering, formatter);\n let nullValue = formatter.nullValue;\n\n let csv = [\n header.join(this.columnDelimiter)\n ];\n\n // Load measurements in reverse order\n measurements.reverse();\n measurements.forEach(measurement => {\n let row;\n\n if (measurement instanceof MeasurementPoint) {\n // Most data will be blank for a single point\n row = [\n measurement.title,\n nullValue,\n nullValue,\n nullValue,\n nullValue,\n nullValue,\n nullValue\n ];\n } else if (measurement instanceof MeasurementArea) {\n let areaValue;\n let volumeValue = nullValue;\n\n if (measurement.valid) {\n areaValue = formatter.convertUnits(measurement.area3D, measurement.dbType);\n } else {\n areaValue = measurement.areaInvalidMessage;\n }\n\n if (measurement instanceof MeasurementVolume) {\n volumeValue = measurement.invalidVolumeMessage;\n if (measurement.valid && measurement.calculated) {\n volumeValue = formatter.convertUnits(measurement.volumeValue, measurement.dbType);\n }\n }\n\n row = [\n measurement.title,\n nullValue,\n nullValue,\n areaValue,\n volumeValue,\n nullValue,\n nullValue\n ];\n } else {\n row = [\n measurement.title,\n formatter.convertUnits(measurement.distance2D, measurement.dbType),\n formatter.convertUnits(measurement.distance3D, measurement.dbType),\n nullValue,\n nullValue,\n formatter.formatGrade(measurement.grade, false),\n formatter.formatAngle(measurement.angle, false)\n ];\n }\n\n let verticesReprojected = measurement.vertices.map(vertex => {\n return vertex.toViewProjection();\n });\n\n verticesReprojected.forEach(vertex => {\n // Export with x and y values swapped\n if (ordering === \"yxz\") {\n vertex = new Vector3(vertex.y, vertex.x, vertex.z);\n }\n\n row = row.concat([\n vertex.x.toFixed(precision.x),\n vertex.y.toFixed(precision.y),\n vertex.z.toFixed(precision.z)\n ]);\n });\n\n csv.push(row.join(this.columnDelimiter));\n });\n\n const name = this.viewer.projectName;\n this.downloadCSVFile(`${name} measurements (3D) ${windowSafeDateISO()}`, csv);\n }\n\n downloadDataExport(filename, data) {\n let name = `${filename}.${this.measureExportFormat}`;\n let string = JSON.stringify(data, null, 2);\n\n if (isStaticSite) {\n this.downloadFileBrowser(name, string, \"plain\");\n } else {\n this.downloadFileElectron(name, string, this.dataExportFilter);\n }\n }\n\n downloadCSVFile(filename, data) {\n let name = `${filename}.csv`;\n let string = data.join(this.lineDelimiter);\n\n if (isStaticSite) {\n this.downloadFileBrowser(name, string, \"csv\");\n } else {\n this.downloadFileElectron(name, string, this.csvExportFilter);\n }\n }\n\n downloadFileElectron(name, data, filter) {\n console.log(\"Download file (electron)\") ;\n\n dialog.showSaveDialog({\n title: 'Save Project',\n defaultPath: name,\n filters: filter,\n }).then(result => {\n if (result.canceled) {\n return;\n }\n if (result.filePath) {\n const savePath = slash(result.filePath);\n fs.writeFileSync(savePath, data);\n }\n });\n }\n\n downloadFileBrowser(name, data, type) {\n console.log(\"Download file (browser\");\n let contentType = `data:text/${type};charset=utf-8`;\n let content = `${contentType},${encodeURIComponent(data)}`;\n console.log(\"Download file (browser)\") ;\n let element = document.createElement('a');\n element.setAttribute('href', content);\n if (name) {\n element.setAttribute('download', name);\n }\n element.style.display = 'none';\n document.body.appendChild(element);\n element.target = \"_blank\";\n element.click();\n document.body.removeChild(element);\n }\n\n getHeaderValues2D(measurements, ordering, formatter) {\n let header = [\n \"Notes\", \"Measure Type\",\n `Length (${formatter.units})`,\n `Area (${formatter.units}^2)`\n ];\n\n let numVertices = 0;\n measurements.forEach(measurement => {\n let measurementVertices = measurement.geometry.flatCoordinates.length / 2.0;\n numVertices = Math.max(numVertices, measurementVertices);\n });\n\n for (var i = 0; i < numVertices; i++) {\n if (ordering === \"yxz\") {\n header = header.concat([`Y_${i + 1}`, `X_${i + 1}`]);\n } else {\n header = header.concat([`X_${i + 1}`, `Y_${i + 1}`]);\n }\n }\n\n return header;\n }\n\n getHeaderValues3D(measurements, ordering, formatter) {\n let header = [\n \"Notes\",\n `Distance 2D (${formatter.units})`,\n `Distance 3D (${formatter.units})`,\n `Area 3D (${formatter.areaUnits})`,\n `Volume 3D (${formatter.volumeUnits})`,\n \"Grade (%)\",\n \"Angle (Deg)\",\n ];\n\n // Determine the max number of vertices\n let numVertices = 0;\n measurements.forEach(measurement => {\n let measurementVertices = measurement.vertices.length;\n numVertices = Math.max(numVertices, measurementVertices);\n });\n\n for (var i = 0; i < numVertices; i++) {\n if (ordering === \"yxz\") {\n header = header.concat([`Y_${i + 1}`, `X_${i + 1}`, `Z_${i + 1}`]);\n } else {\n header = header.concat([`X_${i + 1}`, `Y_${i + 1}`, `Z_${i + 1}`]);\n }\n }\n\n return header;\n }\n}\n","import { RayCaster } from '../controls';\nimport { GeocentricCoordinate, sphereRaycast } from '../projections';\nimport { setPointScale } from '../utilities';\nimport { MeasurementArea, MeasurementVolume } from './measurement';\nimport MeasurementController from './measurement-controller';\nimport {\n Mesh,\n Scene,\n SphereGeometry,\n MeshBasicMaterial,\n LineBasicMaterial,\n Geometry,\n Line\n} from 'three';\n\nexport class MeasureEndpoint extends Mesh {\n public measurementVertex;\n public measurementID;\n\n constructor(geometry, material, index, id) {\n super(geometry, material);\n this.measurementVertex = index;\n this.measurementID = id;\n }\n}\n\nexport class TemporaryEndpoint extends Mesh {\n constructor(geometry, material) {\n super(geometry, material);\n }\n}\n\nexport default class MeasurementSceneView {\n private controller: MeasurementController;\n private scene: Scene;\n\n private sphereBuffer = 1.2;\n private sphereRadius = 0.05;\n private sphereGeometry = new SphereGeometry(this.sphereRadius, 20, 20);\n private sphereMaterialStandard = new MeshBasicMaterial({color: 0xffffff});\n private sphereMaterialHover = new MeshBasicMaterial({color: 0xffcc33});\n private lineMaterialStandard = new LineBasicMaterial({color: 0x008B8B});\n private lineMaterialHover = new LineBasicMaterial({color: 0xffcc33});\n\n private measurements = [];\n private temporaryEndpoints = [];\n private temporaryLines = [];\n public hoveredPoint = null;\n public dragObject: MeasureEndpoint = null;\n private dragValid = false;\n\n constructor(controller, scene) {\n this.controller = controller;\n this.scene = scene;\n }\n\n get viewer() {\n return this.controller.viewer;\n }\n\n updateMeasureEndpoint(coordinate) {\n if (!this.dragObject) {\n return;\n }\n\n if (!coordinate) {\n return;\n }\n\n let id = this.dragObject.measurementID;\n let vertexIndex = this.dragObject.measurementVertex;\n let measurement = this.controller.measurementGroup.measurements.find(\n measurement => measurement.id === id\n );\n\n if (!measurement) {\n return;\n }\n\n if (measurement instanceof MeasurementVolume) {\n measurement.stopVolumeCalculation();\n }\n\n this.dragValid = true;\n\n // Update our measurement vertex value\n let vertex = new GeocentricCoordinate().fromScene(coordinate);\n measurement.vertices[vertexIndex] = vertex;\n\n // Remove + redraw the line\n this.removeByID(id);\n this.draw(measurement);\n }\n\n measureGrabFinished() {\n if ((!this.dragObject) || (!this.dragValid)) {\n return;\n }\n\n this.controller.refreshMeasurementList();\n }\n\n checkEndpointSelected(event) {\n let controller = this.controller;\n if (!controller.editable) {\n return;\n }\n\n if (controller.measurementBuilder.activeMeasurement) {\n return;\n }\n\n let targets = this.scene.children\n .filter(x => x instanceof MeasureEndpoint);\n\n let raycaster = new RayCaster(this.viewer, event);\n let objects = raycaster.intersectObjects(targets, {\n minDistance: 0.10,\n sortByRay: true\n });\n\n let draggable = objects.length > 0;\n let dragObject = draggable ? objects[0].object : null;\n this.setDragObject(dragObject);\n }\n\n setDragObject(dragObject) {\n this.dragObject = dragObject;\n\n let draggable = dragObject ? true : false;\n let controls = this.controller.controls;\n controls.restrictOrbitMovement(!draggable);\n\n if (dragObject) {\n this.setPointGrabTooltip();\n }\n }\n\n hideTooltip() {\n this.controller.setViewerTooltipText(\"\");\n }\n\n setPointGrabTooltip() {\n this.controller.setViewerTooltipText(\"Click and hold to move vertex\");\n }\n\n setRestrictedPointTooltip() {\n this.controller.setViewerTooltipText(\"Unable to move this measurement type\");\n }\n\n setTooltipText(measurement, morepoints = false) {\n let text = \"\";\n\n if (morepoints) {\n let endTooltipCount = measurement.minVertexRequired - 1;\n endTooltipCount = Math.max(2, endTooltipCount);\n\n if (measurement.vertices.length < endTooltipCount) {\n text = measurement.moreTooltip;\n } else {\n text = measurement.endTooltip;\n }\n } else {\n text = measurement.startTooltip;\n }\n\n this.controller.setViewerTooltipText(text);\n }\n\n setPointScale(mesh) {\n setPointScale(this.viewer, mesh, this.sphereBuffer);\n }\n\n addTemporaryPoint(coordinate) {\n let sphere = this.createTempEndpoint(coordinate);\n this.scene.add(sphere);\n this.temporaryEndpoints.push(sphere);\n }\n\n addActiveEndpoint(coordinate) {\n if (coordinate === null) {\n return;\n }\n\n if (this.hoveredPoint) {\n this.scene.remove(this.hoveredPoint);\n }\n\n let sphere = this.createTempEndpoint(coordinate);\n this.scene.add(sphere);\n this.hoveredPoint = sphere;\n\n // Remove all previous lines\n for (let temporaryLine of this.temporaryLines) {\n this.scene.remove(temporaryLine);\n }\n this.temporaryLines = [];\n\n // Re-draw the entire temporary line\n let points = [...this.temporaryEndpoints, this.hoveredPoint];\n for (var i=1;i measurement.id === id);\n if (measurement) {\n for (let object of measurement.lines) {\n material = hover ? this.lineMaterialHover : this.lineMaterialStandard;\n object.material = material;\n object.material.needsUpdate = true;\n }\n for (let object of measurement.points) {\n material = hover ? this.sphereMaterialHover : this.sphereMaterialStandard;\n object.material = material;\n object.material.needsUpdate = true;\n }\n }\n }\n\n draw(measurement) {\n let lines = [];\n let points = [];\n let point;\n let line;\n let vertices = measurement.vertices;\n\n for (var i = 0; i < vertices.length; i++) {\n let vertexA = measurement.vertices[i].toScene();\n point = this.createEndpoint(vertexA, i, measurement.id);\n this.scene.add(point);\n points.push(point);\n\n if (i >= 1) {\n let vertexB = measurement.vertices[i - 1].toScene();\n line = this.createLine(vertexA, vertexB);\n this.scene.add(line);\n lines.push(line);\n }\n }\n\n // Extra steps for area (close polygon + calculate surface)\n if (measurement instanceof MeasurementArea) {\n let vertexA = measurement.vertices[vertices.length - 1].toScene();\n let vertexB = measurement.vertices[0].toScene();\n line = this.createLine(vertexA, vertexB);\n this.scene.add(line);\n lines.push(line);\n\n measurement.generateSurface();\n }\n\n this.measurements.push({\n id: measurement.id,\n lines: lines,\n points: points\n });\n\n // Update area measurement shader\n this.controller.updateAreaShaders();\n }\n\n removeTemporaryObjects() {\n for (let temporaryEndpoint of this.temporaryEndpoints) {\n this.scene.remove(temporaryEndpoint);\n }\n\n for (let temporaryLine of this.temporaryLines) {\n this.scene.remove(temporaryLine);\n }\n\n if (this.hoveredPoint) {\n this.scene.remove(this.hoveredPoint);\n }\n\n this.temporaryEndpoints = [];\n this.temporaryLines = [];\n this.hoveredPoint = null;\n\n }\n\n removeByID(id) {\n let measurement = this.measurements.find(measurement => measurement.id === id);\n if (measurement) {\n for (let object of measurement.lines) {\n this.scene.remove(object);\n }\n for (let object of measurement.points) {\n this.scene.remove(object);\n }\n this.measurements = this.measurements.filter(measurement => measurement.id !== id);\n }\n\n let measurementGroup = this.controller.measurementGroup;\n let measurementObject = measurementGroup.measurements.find(\n measurement => measurement.id === id\n );\n\n measurementObject.clear();\n }\n\n removeAll() {\n for (let measurement of this.measurements) {\n for (let object of measurement.lines) {\n this.scene.remove(object);\n }\n for (let object of measurement.points) {\n this.scene.remove(object);\n }\n }\n this.measurements = [];\n }\n\n update(changeDetector) {\n if (changeDetector === null) {\n return;\n }\n\n const update = changeDetector.changed;\n if (!update) {\n return;\n }\n\n this.temporaryEndpoints.forEach(mesh => {\n this.setPointScale(mesh);\n });\n\n this.measurements.forEach(measurement => {\n measurement.points.forEach(mesh => {\n this.setPointScale(mesh);\n });\n });\n }\n}\n","import $ from 'jquery';\nimport { AmbientLight, Scene } from 'three';\nimport { Viewer } from '../main';\nimport { roundDigit } from '../misc';\nimport LocalScene from '../projections';\nimport unitConverter from '../utilities/unit-converter';\nimport { GroundPlaneMeasurement } from './image-only';\nimport { AerialAreaMeasurement, AerialLengthMeasurement, Measurement3D, MeasurementArea} from './measurement';\nimport MinimapMeasure from './measurement-aerial-view';\nimport MeasurementConstructor from './measurement-constructor';\nimport MeasurementFormatter from './measurement-formatter';\nimport MeasurementGroup from './measurement-group';\nimport MeasurementGroupExporter from './measurement-group-exporter';\nimport MeasurementSceneView, { MeasureEndpoint } from './measurement-scene-view';\n\nexport default class MeasurementController {\n public viewer: Viewer;\n public enabled = false;\n private imageOnlyType = \"plane\";\n public measureType = \"standard\";\n public movingEndpoint = false;\n\n public formatter: MeasurementFormatter;\n public measureSceneView: MeasurementSceneView;\n public measurementAerialView: MinimapMeasure;\n public measurementBuilder: MeasurementConstructor;\n public measurementGroupExporter: MeasurementGroupExporter;\n public measurementGroup: MeasurementGroup;\n public setViewerTooltipText;\n public setAerialTooltipText;\n public setMeasurements;\n public scene: Scene;\n\n constructor(viewer: Viewer, props) {\n const {setViewerTooltipText, setAerialTooltipText, setMeasurements} = props;\n\n this.viewer = viewer;\n this.setViewerTooltipText = setViewerTooltipText;\n this.setAerialTooltipText = setAerialTooltipText;\n this.setMeasurements = setMeasurements;\n\n this.initScene();\n\n this.formatter = new MeasurementFormatter(\"m\");\n this.measureSceneView = new MeasurementSceneView(this, this.scene);\n this.measurementAerialView = new MinimapMeasure(this);\n this.measurementBuilder = new MeasurementConstructor(this, this.pointclouds);\n this.measurementGroupExporter = new MeasurementGroupExporter(this);\n this.measurementGroup = new MeasurementGroup(this);\n }\n\n get pointclouds() {\n return this.viewer.pointclouds;\n }\n\n get controls() {\n return this.viewer.controls;\n }\n\n get isImageOnly() {\n return this.viewer.isImageOnly;\n }\n\n get measuring() {\n return this.measurementBuilder.activeMeasurement;\n }\n\n get drawing() {\n return this.measurementBuilder.activeMeasurement;\n }\n\n get notEmpty() {\n return this.measurementGroup.measurements.length > 0;\n }\n\n get saved() {\n return Boolean(this.measurementGroup.databaseID);\n }\n\n get dragObject() {\n return this.measureSceneView.dragObject;\n }\n\n get editable() {\n // Always true since view-only mode doesnt exist\n return true;\n }\n\n get measureExportType() {\n return this.measurementGroupExporter.dataExportFilter;\n }\n\n get hoveredPoint() {\n return this.measureSceneView.hoveredPoint;\n }\n\n enable() {\n this.enabled = true;\n this.createNewMeasurementGroup();\n this.measurementAerialView.enabled = true;\n this.measurementAerialView.init();\n }\n\n clear() {\n this.measureSceneView.removeAll();\n this.measurementAerialView.clear();\n }\n\n disable() {\n this.enabled = false;\n this.stopDrawingItems();\n this.measurementGroup.reset();\n this.measurementAerialView.enabled = false;\n this.measurementAerialView.removeInteraction();\n this.measurementAerialView.hideTooltip();\n this.measureSceneView.hideTooltip();\n\n this.updateAreaShaders();\n }\n\n reset() {\n this.clear();\n this.disable();\n }\n\n initScene() {\n const scene = new Scene();\n const light = new AmbientLight(0xFFFFFF);\n scene.add(light);\n this.scene = scene;\n }\n\n loadMeasurementData(data) {\n try {\n const projection = data.projection;\n const sameProjection = LocalScene.currentProjection(projection.name);\n\n if (!sameProjection) {\n return {\n success: false,\n message: `Projection mismatch. Projection used was '${projection.name}'`\n };\n };\n\n // Clear data and create new group\n this.createNewMeasurementGroup();\n\n // Load measurements into new group\n let measurements = data.measurements;\n this.measurementGroup.loadMeasurements(measurements);\n this.refreshMeasurementList();\n\n return {\n success: true,\n message: `Loaded ${data.count} measurements`\n };\n } catch {\n this.createNewMeasurementGroup();\n\n return {\n success: false,\n message: \"Error loading measurement group\"\n };\n }\n }\n\n updateMaxMeasureDistance(units) {\n let $maxMeasureDistance = $(\"#max-measure-distance\");\n\n if (!this.isImageOnly) {\n $maxMeasureDistance.text('');\n return;\n }\n\n let distance = new GroundPlaneMeasurement(this.viewer).maxDistance2D;\n let maxMeasureDistance = unitConverter.convert(distance, 'm', units);\n maxMeasureDistance = roundDigit(maxMeasureDistance, 2).toFixed(2);\n let message = `Maximum Measure Distance from Position: ${maxMeasureDistance} ${units}`;\n\n $maxMeasureDistance.text(message);\n }\n\n cancelMeasurement(event) {\n this.stopDrawingItems();\n }\n\n returnCoordinate(obj) {\n return false;\n /*\n return isLineworkObject(obj)\n || isFeatureServerObject(obj)\n || obj instanceof TexturedSprite;\n */\n }\n\n getPlanePosition(event) {\n let groundPlane = new GroundPlaneMeasurement(this.viewer);\n let coordinate = groundPlane.getPosition(event);\n return coordinate;\n }\n\n getCoordinate(event) {\n let coordinate = null;\n\n if (this.isImageOnly) {\n if (this.imageOnlyType === \"plane\") {\n coordinate = this.getPlanePosition(event);\n }\n } else {\n // Check for collection data (esri features)\n coordinate = this.controls.getPickerResults(event);\n }\n\n return coordinate;\n }\n\n mouseClick(event) {\n if (!this.editable) {\n return;\n }\n\n // Send position to measurements\n let coordinate = this.hoveredPoint\n ? this.hoveredPoint.position\n : this.getCoordinate(event);\n\n if (!coordinate) {\n return;\n }\n\n let result = this.measurementBuilder.add(coordinate);\n\n if (!result.valid) {\n this.cancelMeasurement(event);\n return;\n }\n\n if (result.added) {\n this.measureSceneView.addTemporaryPoint(coordinate);\n this.updateMeasureText();\n }\n\n if (this.measurementBuilder.isFinished) {\n this.finishMeasurement();\n }\n }\n\n onMouseMove(event, mouse = null) {\n const mouseMoved = mouse ? mouse.movement : false;\n const mouseDown = mouse ? mouse.down : false;\n const isLeftClick = mouse ? mouse.button === 0 : false;\n\n this.movingEndpoint = false;\n\n if (!mouseMoved && !mouseDown) {\n this.measureSceneView.checkEndpointSelected(event);\n }\n\n if (mouse === null) {\n return;\n }\n\n if (this.enabled) {\n if (this.measuring) {\n let coordinate = this.getCoordinate(event);\n this.measureSceneView.addActiveEndpoint(coordinate);\n }\n\n if (this.dragObject) {\n this.setPointGrabTooltip();\n\n if (mouseDown) {\n if (isLeftClick) {\n let coordinate = this.getCoordinate(event);\n this.measureSceneView.updateMeasureEndpoint(coordinate);\n }\n this.movingEndpoint = true;\n\n return;\n }\n } else {\n this.updateMeasureText();\n }\n }\n\n return false;\n }\n\n resetDragObject() {\n this.measureSceneView.setDragObject(null);\n }\n\n finishMeasurement() {\n this.updateMeasureText();\n let measurement = this.measurementBuilder.getMeasurement();\n\n if (measurement instanceof MeasurementArea) {\n measurement.generateSurface();\n }\n\n this.measureSceneView.removeTemporaryObjects();\n this.measurementGroup.add(measurement);\n this.renderMeasurement(measurement);\n this.markLastPointDraggable(measurement);\n }\n\n markLastPointDraggable(measurement) {\n let sceneEndpoints = this.scene.children\n .filter(x => x instanceof MeasureEndpoint) as MeasureEndpoint[];\n\n let measureEndpoints = sceneEndpoints\n .filter(x => x.measurementID === measurement.id);\n\n let lastPoint = measureEndpoints[measureEndpoints.length - 1];\n this.measureSceneView.setDragObject(lastPoint);\n }\n\n stopDrawingItems() {\n this.measurementBuilder.reset();\n this.measureSceneView.removeTemporaryObjects();\n\n if (this.measurementAerialView.sketch !== null) {\n this.measurementAerialView.clear();\n this.redrawAerialGeometry();\n }\n\n this.updateMeasureText(false);\n }\n\n setPointGrabTooltip() {\n this.measureSceneView.setPointGrabTooltip();\n }\n\n measureGrabFinished() {\n this.measureSceneView.measureGrabFinished();\n }\n\n updateAreaShaders() {\n let areaGeometry = this.measurementGroup.getAreaGeometry();\n let pointcloud = this.viewer.pointclouds;\n pointcloud.updateAreaVertices(areaGeometry);\n }\n\n refreshMeasurementList() {\n this.setMeasurements([...this.measurementGroup.measurements]);\n }\n\n updateMeasureText(checkMorePoints = true) {\n let morepoints = false;\n let measurement = this.measurementBuilder.measurement;\n\n if (checkMorePoints) {\n morepoints = !this.measurementBuilder.isFinished;\n if (measurement.vertices.length === 0) {\n morepoints = false;\n }\n }\n\n this.measureSceneView.setTooltipText(measurement, morepoints);\n }\n\n addAerialMeasurement(geometry) {\n let measurement;\n\n if (this.measurementAerialView.measurementType === 'LineString') {\n measurement = new AerialLengthMeasurement(geometry);\n } else {\n measurement = new AerialAreaMeasurement(geometry);\n }\n\n measurement.setController(this);\n this.measurementGroup.add(measurement);\n }\n\n createNewMeasurementGroup() {\n this.measurementAerialView.clear();\n this.measureSceneView.removeAll();\n this.measurementGroup = new MeasurementGroup(this);\n this.setMeasurementType(this.measureType);\n this.updateAreaShaders();\n }\n\n setMeasurementType(measurementType) {\n if (!this.enabled) {\n return;\n }\n\n this.measureType = measurementType;\n this.measurementBuilder.setBuilder(measurementType);\n this.measureSceneView.removeTemporaryObjects();\n\n let measurement = this.measurementBuilder.measurement;\n this.measureSceneView.setTooltipText(measurement);\n\n this.stopDrawingItems();\n this.measurementAerialView.setMeasurementType(measurementType);\n }\n\n removeByID(id) {\n this.measureSceneView.removeByID(id);\n this.measurementGroup.removeByID(id);\n\n this.measurementAerialView.clear();\n this.redrawAerialGeometry();\n\n // Update area measurement shader\n this.updateAreaShaders();\n\n this.measureSceneView.hideTooltip();\n }\n\n setTitle(id, title) {\n const measurements = this.measurementGroup.measurements;\n const measurement = measurements.find(measurement => measurement.id === id);\n if (measurement) {\n measurement.title = title;\n this.refreshMeasurementList();\n }\n\n this.measureSceneView.hideTooltip();\n }\n\n redrawAerialGeometry(measurement = null, hover = false) {\n if (measurement) {\n this.measurementGroup.getMeasurements2D().forEach(measurement_ => {\n if (measurement_.id === measurement.id) {\n this.measurementAerialView.loadGeometry(measurement_, hover);\n } else {\n this.measurementAerialView.loadGeometry(measurement_);\n }\n });\n } else {\n this.measurementGroup.getMeasurements2D().forEach(measurement => {\n this.measurementAerialView.loadGeometry(measurement);\n });\n }\n }\n\n clearByID(id) {\n this.measureSceneView.removeByID(id);\n }\n\n removeAll() {\n this.measurementGroup.removeAll();\n this.clearViews();\n }\n\n clearViews() {\n this.measureSceneView.removeAll();\n this.measurementAerialView.clear();\n }\n\n export(type, ordering) {\n if (type === \"csv\") {\n this.exportCSV(ordering);\n } else if (type === \"dat\") {\n this.exportDAT();\n }\n }\n\n exportDAT() {\n this.measurementGroupExporter\n .exportDAT(this.measurementGroup);\n }\n\n exportCSV(ordering) {\n this.measurementGroupExporter.exportCSV(\n this.measurementGroup, ordering);\n }\n\n /* Not implemented */\n exportLinework(type, projection, version) {\n this.measurementGroupExporter\n .exportLinework(this.measurementGroup, type, version);\n }\n\n setUnits(units) {\n this.formatter.setUnits(units);\n this.updateMaxMeasureDistance(units);\n\n if (this.measurementGroup) {\n this.reload();\n }\n }\n\n reload() {\n this.clearViews();\n this.measurementGroup.measurements.forEach(measurement => {\n this.renderMeasurement(measurement);\n });\n this.refreshMeasurementList();\n }\n\n updateRenderColor(measurement, hover = false) {\n if (measurement instanceof Measurement3D) {\n this.measureSceneView.updateMaterial(measurement.id, hover);\n } else {\n this.measurementAerialView.clear();\n this.redrawAerialGeometry(measurement, hover);\n }\n }\n\n renderMeasurement(measurement) {\n if (measurement instanceof Measurement3D) {\n this.measureSceneView.draw(measurement);\n } else {\n this.measurementAerialView.loadGeometry(measurement);\n }\n }\n\n update(changeDetector) {\n this.measureSceneView.update(changeDetector);\n }\n}\n","var Stats = function () {\n\n var mode = 0;\n\n var container = document.createElement( 'div' );\n container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';\n container.addEventListener( 'click', function ( event ) {\n\n event.preventDefault();\n showPanel( ++ mode % container.children.length );\n\n }, false );\n\n //\n\n function addPanel( panel ) {\n\n container.appendChild( panel.dom );\n return panel;\n\n }\n\n function showPanel( id ) {\n\n for ( var i = 0; i < container.children.length; i ++ ) {\n\n container.children[ i ].style.display = i === id ? 'block' : 'none';\n\n }\n\n mode = id;\n\n }\n\n //\n\n var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;\n\n var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );\n var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );\n\n if ( window.self.performance && window.self.performance.memory ) {\n\n var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );\n\n }\n\n showPanel( 0 );\n\n return {\n\n REVISION: 16,\n\n dom: container,\n\n addPanel: addPanel,\n showPanel: showPanel,\n\n begin: function () {\n\n beginTime = ( performance || Date ).now();\n\n },\n\n end: function () {\n\n frames ++;\n\n var time = ( performance || Date ).now();\n\n msPanel.update( time - beginTime, 200 );\n\n if ( time >= prevTime + 1000 ) {\n\n fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );\n\n prevTime = time;\n frames = 0;\n\n if ( memPanel ) {\n\n var memory = performance.memory;\n memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );\n\n }\n\n }\n\n return time;\n\n },\n\n update: function () {\n\n beginTime = this.end();\n\n },\n\n // Backwards Compatibility\n\n domElement: container,\n setMode: showPanel\n\n };\n\n};\n\nStats.Panel = function ( name, fg, bg ) {\n\n var min = Infinity, max = 0, round = Math.round;\n var PR = round( window.devicePixelRatio || 1 );\n\n var WIDTH = 80 * PR, HEIGHT = 48 * PR,\n TEXT_X = 3 * PR, TEXT_Y = 2 * PR,\n GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,\n GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;\n\n var canvas = document.createElement( 'canvas' );\n canvas.width = WIDTH;\n canvas.height = HEIGHT;\n canvas.style.cssText = 'width:80px;height:48px';\n\n var context = canvas.getContext( '2d' );\n context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';\n context.textBaseline = 'top';\n\n context.fillStyle = bg;\n context.fillRect( 0, 0, WIDTH, HEIGHT );\n\n context.fillStyle = fg;\n context.fillText( name, TEXT_X, TEXT_Y );\n context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n context.fillStyle = bg;\n context.globalAlpha = 0.9;\n context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n return {\n\n dom: canvas,\n\n update: function ( value, maxValue ) {\n\n min = Math.min( min, value );\n max = Math.max( max, value );\n\n context.fillStyle = bg;\n context.globalAlpha = 1;\n context.fillRect( 0, 0, WIDTH, GRAPH_Y );\n context.fillStyle = fg;\n context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );\n\n context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );\n\n context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );\n\n context.fillStyle = bg;\n context.globalAlpha = 0.9;\n context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );\n\n }\n\n };\n\n};\n\nexport default Stats;\n","import {OpacityMaterial, EDLMaterial, ImageMaterial} from './materials';\nimport {EncompassPointCloud, PointCloudManager, RawPointCloud} from './pointcloud';\nimport {CompassControls, PanoControls} from './controls';\nimport {CameraList} from './cameras';\nimport {CameraMarkers} from './markers';\nimport {destroyWindowEvents, bindWindowEvent} from \"../events\";\nimport {AerialMap} from './aerial';\nimport {AssetType} from \"../../redux/assets-slice\";\nimport {Clamp, ColorMapKey, ColorType, MarkerNavType} from '../../redux/settings-slice';\nimport LocalScene, { DataProjectionCoordinate } from './projections';\nimport {nanoid} from '@reduxjs/toolkit';\nimport {colorMaps} from \"../textures/colormaps\";\nimport { Measurement } from './measurements/measurement';\nimport ChangeDetector from './utilities/change-detection';\nimport { isDevMode, isStaticSite } from '../../electron-modules';\nimport slash from 'slash';\nimport GPUPicker from './gpu-picker';\nimport { extentFromPoints } from './aerial/map';\nimport { debounce } from 'throttle-debounce';\nimport { SceneCameraState } from '../../redux/camera-slice';\nimport { ImageLabelTools } from './labelling';\nimport {\n AmbientLight,\n Camera,\n DepthTexture,\n FloatType,\n Vector3,\n Mesh,\n MeshBasicMaterial,\n NearestFilter,\n LinearFilter,\n PerspectiveCamera,\n PlaneBufferGeometry,\n RGBAFormat,\n Scene,\n UnsignedIntType,\n WebGLRenderer,\n WebGLRenderTarget,\n TextureLoader\n} from \"three\";\nimport MeasurementController from './measurements/measurement-controller';\nimport { CameraLoadOptions } from './cameras/cameras';\nimport Stats from '../../stats.module.js';\n\nexport class Viewer {\n public readonly containerElement: HTMLElement;\n public defaultFarPlane: number = 10000;\n private defaultNearPlane: number = 0.1;\n private id = nanoid();\n public camera: PerspectiveCamera;\n private light: AmbientLight;\n public renderer: WebGLRenderer;\n private screenPass: RenderPass;\n private imageMaterial: ImageMaterial;\n private texture2DDepth: WebGLRenderTarget;\n private opacityMaterial: OpacityMaterial;\n private texture2DImage: any;\n private texture2DOpacity: WebGLRenderTarget;\n public gpuPickers: {\n markers: GPUPicker,\n points: GPUPicker\n };\n public imageLabels: ImageLabelTools;\n private EDLMaterial: EDLMaterial;\n private canvas: any;\n private changeDetector: ChangeDetector;\n public compass: CompassControls;\n public controls: PanoControls;\n public pointclouds: PointCloudManager;\n public cameraList: CameraList;\n public minimap: AerialMap;\n public markers: CameraMarkers;\n public measurements: MeasurementController;\n private stats: StatsPanel;\n private updateSavedState: Function;\n public showMessage: Function;\n private setCameraState: Function;\n private enabled = true;\n private focused = false;\n private drawPickerScene = false;\n public projectName;\n\n public timingDebug = {\n \"markers\": false,\n \"scene\": false\n };\n\n constructor(viewContainer, mapContainer, props) {\n const {showMessage, setCameraState} = props;\n\n this.containerElement = viewContainer;\n\n this.createScene();\n this.initGpuPickers();\n this.initResize();\n this.initMaterials();\n this.initViewEvents();\n\n this.showMessage = showMessage;\n this.setCameraState = setCameraState;\n\n this.compass = new CompassControls(this, props);\n this.pointclouds = new PointCloudManager(this);\n this.controls = new PanoControls(this, this.camera,\n this.renderer.domElement, props);\n this.measurements = new MeasurementController(this, props);\n this.cameraList = new CameraList(this);\n this.minimap = new AerialMap(this, mapContainer, props);\n this.imageLabels = new ImageLabelTools(this, props);\n this.markers = new CameraMarkers(this);\n this.changeDetector = new ChangeDetector(this);\n this.stats = new StatsPanel(this);\n\n // Add canvas elements to container\n this.addContainerElements();\n\n // Need to debounce to update ui smoothly\n this.updateSavedState = debounce(100, () => {\n this.calculateUpdatedValues();\n });\n\n // Force initial resize event\n this.handleWindowResize();\n\n // Start our animation loop\n this.animate();\n }\n\n get width(): number {\n return this.containerElement.offsetWidth;\n }\n\n get height(): number {\n return this.containerElement.offsetHeight;\n }\n\n get near() {\n return this.camera.near;\n }\n\n get far() {\n return this.camera.far;\n }\n\n get orthoList() {\n return this.minimap.orthoList;\n }\n\n get lookat() {\n let lookat = new Vector3(0,0, -1);\n let quat = this.camera.quaternion;\n lookat.applyQuaternion(quat);\n return lookat;\n }\n\n get renderTargetAttrs() {\n return {\n tDepth: this.renderTarget.depthTexture,\n colorMap: this.renderTarget.texture,\n };\n }\n\n get renderTarget() {\n return this.EDLSupport ? this.texture2DDepth : this.texture2DOpacity;\n }\n\n get renderMaterial() {\n return this.EDLSupport ? this.EDLMaterial : this.opacityMaterial;\n }\n\n get orbitState() {\n return this.controls.orbit.state;\n }\n\n get cameraSelected() {\n return this.cameraList.cameraLoaded;\n }\n\n get hasPoints() {\n return !this.pointclouds.isEmpty;\n }\n\n get hasCameras() {\n return !this.cameraList.isEmpty;\n }\n\n get isImageOnly() {\n return this.hasCameras && !this.hasPoints;\n }\n\n get isPointsOnly() {\n return !this.hasCameras && this.hasPoints;\n }\n\n get EDLSupport() : boolean {\n let capabilities = this.renderer.capabilities;\n let supported = (capabilities.maxVaryings > 8)\n && capabilities.floatFragmentTextures;\n\n return supported;\n }\n\n get isWebGL2(): boolean {\n let capabilities = this.renderer.capabilities;\n return capabilities.isWebGL2;\n }\n\n get expanded(): boolean {\n return this.width > this.minimap.width;\n }\n\n get calculatingSceneMarkers() {\n return this.markers.calculating;\n }\n\n get calculatingAerialMarkers() {\n return this.minimap.calculating;\n }\n\n get showCompassElement() {\n if (!LocalScene.initialized) {\n return false;\n }\n\n let show;\n\n if (this.isPointsOnly) {\n // Points only dataset. Always okay to show\n show = true;\n } else if (this.hasCameras) {\n // Current camera is done loading (or there is no\n // camera selected)\n let currentCamera = this.cameraList.current;\n show = currentCamera\n ? currentCamera.loaded\n : true;\n } else {\n // Conditions not met, hide navigation\n show = false;\n }\n\n return show;\n }\n\n /** Exposed Global Methods */\n setContainerCursor(cursor) {\n this.containerElement.style.cursor = cursor;\n }\n\n addContainerElements() {\n this.containerElement.appendChild(this.renderer.domElement);\n this.containerElement.appendChild(this.compass.domElement);\n }\n\n removeContainerElements() {\n this.containerElement.removeChild(this.renderer.domElement);\n this.containerElement.removeChild(this.compass.domElement);\n }\n\n setProjectName(name) {\n this.projectName = name;\n }\n\n togglePickerDebug(value) {\n this.drawPickerScene = value;\n }\n\n getAvailableClassifications(): number[] {\n return this.pointclouds.uniqueClassifications;\n }\n\n setVisibleClassifications(classifications) {\n classifications.forEach(classification => {\n this.pointclouds.setClassification(classification.id, classification.visible);\n });\n }\n\n setPointCloudOpacity(opacity: number) {\n this.pointclouds.transparency = opacity;\n }\n\n setPointCloudSize(size: number) {\n this.pointclouds.materialDefaults.size = size;\n this.pointclouds.clouds.forEach(pointCloud => {\n pointCloud.materials.forEach(material => {\n material.size = size;\n });\n });\n }\n\n setPointCloudMaxPoints(points: number) {\n this.pointclouds.visiblePointsTarget = points;\n }\n\n setPointCloudDistance(distance: number) {\n let value = (distance === 100) ? this.far : distance * 10;\n this.pointclouds.materialDefaults.distance = value;\n this.pointclouds.clouds.forEach(pointCloud => {\n pointCloud.materials.forEach(material => {\n material.distance = value;\n });\n });\n }\n\n setPointCloudHeightClip(clamp: Clamp) {\n this.pointclouds.updateClamping('heightClamp', 'height_clamp', clamp);\n }\n\n setPointCloudIntensityClip(clamp: Clamp) {\n this.pointclouds.updateClamping('intensityClamp', 'intensity_clamp', clamp);\n }\n\n setPointCloudColorMap(colorMapKey: ColorMapKey) {\n const textureData = colorMaps.find(colorMap => colorMap.id === colorMapKey).image;\n\n const loader = new TextureLoader();\n loader.load(textureData, texture => {\n this.pointclouds.materialDefaults.colorMap = colorMapKey;\n this.pointclouds.clouds.forEach(pointCloud => {\n pointCloud.materials.forEach(material => {\n material.color_map = texture;\n material.color_map.needsUpdate = true;\n });\n });\n });\n }\n\n setPointCloudColorType(colorType: ColorType) {\n this.pointclouds.materialDefaults.colorType = colorType;\n this.pointclouds.clouds.forEach(pointCloud => {\n pointCloud.materials.forEach(material => {\n material.color_type = colorType;\n });\n });\n }\n\n setPointCloudDynamicSize(state: boolean) {\n this.pointclouds.materialDefaults.dynamicSize = state;\n this.pointclouds.clouds.forEach(pointCloud => {\n pointCloud.materials.forEach(material => {\n material.dynamic_size = state;\n });\n });\n }\n\n setPointCloudCircularPoints(state: boolean) {\n this.pointclouds.materialDefaults.circularPoints = state;\n this.pointclouds.clouds.forEach(pointCloud => {\n pointCloud.materials.forEach(material => {\n material.circularPoints = state;\n });\n });\n }\n\n setNavigationType(state: MarkerNavType) {\n this.markers.setNavigationType(state);\n }\n\n /** NOTE: Temporary(?) solution for the viewer being created over and over again */\n destroy() {\n destroyWindowEvents();\n\n // Destroy viewer elements\n this.enabled = false;\n this.camera = null;\n this.removeContainerElements();\n this.destroyViewEvents();\n\n // Destroy minimap dom element\n this.minimap.destroy();\n\n // TODO: destroy other things\n }\n\n setDataProjection(newProjection) {\n LocalScene.setDataProjection(newProjection);\n\n // Reset all measurements (not able to convert easily. would be easier if we changed\n // the encompass style data to be written in its original units, and converted on the fly\n if (this.controls.measurements.enabled) {\n this.controls.measurements.reset();\n this.controls.measurements.enable();\n }\n }\n\n setViewProjection(newProjection) {\n LocalScene.setViewProjection(newProjection);\n }\n\n setMeasurementUnits(units) {\n this.controls.measurements.setUnits(units);\n }\n\n setCameraVisible(cameraID, opts:CameraLoadOptions = {}) {\n this.cameraList.loadImage(cameraID, opts);\n }\n\n resetDefaultOrbitState() {\n this.controls.orbitDefaultApplied = false;\n }\n\n setOrbitDefault(numAdded, state: SceneCameraState) {\n if ((numAdded === 0) || this.controls.orbitDefaultApplied) {\n // Orbit state not applicable\n return false;\n }\n\n this.controls.orbitDefaultApplied = true;\n\n // Missing orbit rotation values\n if ((state.orbit === null) || (state.pivot === null)) {\n return false;\n }\n\n let orbit = new DataProjectionCoordinate(state.orbit)\n .toScene();\n\n let pivot = new DataProjectionCoordinate(state.pivot)\n .toScene();\n\n this.controls.setOrbitState(true, {\n position: orbit,\n pivot: pivot\n });\n\n return true;\n }\n\n toggleMeasurements(state) {\n if (state) {\n this.controls.measurements.enable();\n } else {\n this.controls.measurements.clear();\n this.controls.measurements.disable();\n }\n }\n\n toggleCameraAligner(state) {\n this.controls.cameraAlignerAdv.setState(state);\n }\n\n updateMeasureType(measureType) {\n this.controls.measurements.setMeasurementType(measureType);\n }\n\n updateMeasureHover(measurement: Measurement, state) {\n this.controls.measurements.updateRenderColor(measurement, state);\n }\n\n deleteMeasurement(measurement: Measurement) {\n this.controls.measurements.removeByID(measurement.id);\n }\n\n renameMeasurement(measurement: Measurement, title) {\n this.controls.measurements.setTitle(measurement.id, title);\n }\n\n exportMeasurements(type, ordering) {\n this.controls.measurements.export(type, ordering);\n }\n\n getMeasureExportType() {\n return this.controls.measurements.measureExportType;\n }\n\n loadMeasurementData(data) {\n return this.controls.measurements.loadMeasurementData(data);\n }\n\n /* Ortho Viewer Function Calls */\n setOrthoOpacity(value) {\n this.orthoList.setOpacity(value);\n }\n\n /* Labelling/Annotation function calls */\n activeImageLabelPaths() {\n return this.imageLabels.activeImagePaths();\n }\n\n loadedImageLabelPaths() {\n return this.imageLabels.loadedImagePaths();\n }\n\n async loadImageLabelData(data, progressCallback) {\n await this.imageLabels.loadImageLabelData(data, progressCallback);\n }\n\n setActiveLabelType(state) {\n this.imageLabels.setActiveLabelType(state);\n }\n\n checkIfActive() {\n return this.imageLabels.checkIfActive();\n }\n\n checkIfSelected() {\n return this.imageLabels.checkIfSelected();\n }\n\n labelHotkey(event) {\n this.imageLabels.onKeyDown(event);\n }\n\n addCategory(category) {\n this.imageLabels.addCategory(category);\n }\n\n deleteCategory(id) {\n this.imageLabels.deleteCategory(id);\n }\n\n deleteHighlighted() {\n this.imageLabels.deleteHighlighted();\n }\n\n /*addPolygon(polygon) {\n this.imageLabels.orthoLabels.drawPoly(polygon);\n }*/\n\n editCategoryName(id, name) {\n this.imageLabels.editCategoryName(id, name);\n }\n\n deleteAllCategories() {\n this.imageLabels.deleteAllCategories();\n }\n\n deleteLabel(id) {\n this.imageLabels.deleteLabel(id);\n }\n\n deletePoint(id) {\n this.imageLabels.deletePoint(id);\n }\n\n zoomToLabel(id) {\n this.imageLabels.zoomToLabel(id);\n }\n\n addLabel(id) {\n this.imageLabels.addLabel(id);\n }\n\n currentCategory() {\n return this.imageLabels.currentCategoryName;\n }\n\n selectLabel(id) {\n this.imageLabels.selectLabel(id);\n }\n\n completeLabel(label) {\n this.imageLabels.completeLabel(label);\n }\n\n unHighlight(id) {\n this.imageLabels.unHighlight(id);\n }\n\n unHighlightAll() {\n this.imageLabels.unHighlightAll();\n }\n\n numHighlighted() {\n return this.imageLabels.numHighlighted();\n }\n\n checkCategoryUniqueness(categoryName) {\n return this.imageLabels.checkUniqueName(categoryName);\n }\n\n labelObject = () => {\n return this.imageLabels.labelObject();\n }\n\n anyLabelSelected = () => {\n return this.imageLabels.checkIfSelected();\n }\n\n /* Asset Click functions */\n snapToOrtho(id) {\n const ortho = this.minimap.orthoList.getByID(id);\n if (!ortho) {\n return;\n }\n\n ortho.zoomToExtent();\n }\n\n snapToPointCloud(id) {\n const pointCloud = this.pointclouds.getByID(id);\n if (!pointCloud) {\n return;\n }\n\n let tightBoundingBox = pointCloud.tightBoundingBox;\n if (!tightBoundingBox) {\n return;\n }\n\n this.pointclouds.setLoadedOnce(false);\n this.pointclouds.zoomToExtent(tightBoundingBox, true, true);\n }\n\n snapToImages(id) {\n const cameras = this.cameraList.getByCSV(id);\n if (cameras.length === 0) {\n return;\n }\n\n let positions = cameras.map(camera => {\n return camera.position.value;\n });\n\n let extent = extentFromPoints(positions);\n this.minimap.setMapExtent(extent);\n }\n\n /* Camera Aligner Function Calls */\n resetCameraAligner() {\n this.controls.cameraAlignerAdv.reset();\n }\n\n checkIfAligned() {\n return this.cameraList.aligned;\n }\n\n addRowCameraAligner() {\n this.controls.cameraAlignerAdv.addRow();\n }\n\n setErrorsCameraAligner(errors) {\n this.controls.cameraAlignerAdv.setErrors(errors);\n }\n\n getErrorCameraAligner(i) {\n return this.controls.cameraAlignerAdv.getError(i);\n }\n\n deleteRowCameraAligner(i) {\n this.controls.cameraAlignerAdv.deleteRow(i);\n }\n\n getImageObsCameraAligner(i) {\n return this.controls.cameraAlignerAdv.getImageObs(i);\n }\n\n getPointObsCameraAligner(i) {\n return this.controls.cameraAlignerAdv.getPointObs(i);\n }\n\n getCamPoseCameraAligner(i) {\n return this.controls.cameraAlignerAdv.getCamPose(i);\n }\n\n getNumEntriesCameraAligner() {\n return this.controls.cameraAlignerAdv.numEntries;\n }\n\n getCamIdFromAligner(i) {\n return this.controls.cameraAlignerAdv.getCamId(i);\n }\n\n setBasicAlignerState(state) {\n this.controls.cameraAlignerBasic.setState(state);\n }\n\n resetBasicAlignerCamera(values = [0,0,0]) {\n this.controls.cameraAlignerBasic.reset(values);\n }\n\n getCamName(i) {\n return this.controls.cameraAlignerAdv.getCamName(i);\n }\n\n getCurrentCameraName() {\n return this.cameraList.current?.name;\n }\n\n setObservationTypeCameraAligner(type) {\n this.controls.cameraAlignerAdv.setObservationType(type);\n }\n\n setCurrentRowCameraAligner(rowNum) {\n this.controls.cameraAlignerAdv.setCurrentRow(rowNum);\n }\n\n flashObservations(rowNum) {\n this.controls.cameraAlignerAdv.flashObservations(rowNum);\n }\n\n hideCurrentObservation(type, rowNum) {\n this.controls.cameraAlignerAdv.hideCurrentObservation(type, rowNum);\n }\n\n getObservationPosition(rowNum) {\n return this.controls.cameraAlignerAdv.getObservationPosition(rowNum);\n }\n\n setAllObservationsVisible() {\n return this.controls.cameraAlignerAdv.setAllObservationsVisible();\n }\n\n\n /* End - Camera Aligner Function Calls */\n\n updateCompassOffset(offset) {\n this.compass.updateOffset(offset);\n }\n\n getCamerasForCSV = (assetID) => {\n return this.cameraList.getByCSV(assetID);\n }\n\n getCloudPercent(identifier) {\n let cloud = this.pointclouds.getByID(identifier);\n if (cloud && cloud instanceof RawPointCloud) {\n return cloud.percent;\n }\n\n return 0.0;\n }\n\n getCloudMissing(identifier) {\n let cloud = this.pointclouds.getByID(identifier);\n if (cloud) {\n return cloud.fileMissing;\n }\n\n return true;\n }\n\n getCloudIsLarge(identifier) {\n let cloud = this.pointclouds.getByID(identifier);\n if (cloud && cloud instanceof RawPointCloud) {\n return cloud.isLargeFile;\n }\n\n return false;\n }\n\n checkShiftReset() {\n const cameraList = this.cameraList.cameras;\n const cloudList = this.pointclouds.clouds;\n\n if ((cameraList.length === 0) && (cloudList.length === 0)) {\n LocalScene.resetSceneShift();\n }\n }\n\n reconcileCameras(camerasFiles, cameraHeight, cameraAdjustments, savedCameraState: SceneCameraState) {\n const existingCameras = this.cameraList.cameras;\n\n const allCameras = camerasFiles.map(cameraFile => {\n return cameraFile.data.map(camera => {\n return {\n ...camera,\n id: `${cameraFile.id}-${camera.name}`,\n csv: cameraFile.id,\n assetType: cameraFile.type,\n fromJSON: cameraFile.fromJSON\n };\n });\n }).flat();\n\n const activeCamera = savedCameraState.camera;\n const newCameras = new Set(allCameras.map(camera => camera.id));\n const currentCameras = new Set(existingCameras.map(camera => camera.id));\n const camerasToLoad = allCameras.filter(camera => !currentCameras.has(camera.id));\n const camerasToDelete = existingCameras.filter(camera => !newCameras.has(camera.id));\n\n const numRemoved = camerasToDelete.length;\n const numAdded = camerasToLoad.length;\n const numChanged = numRemoved + numAdded;\n\n // Delete existing cameras\n this.cameraList.deleteCameras(camerasToDelete);\n\n // Add all new cameras\n this.cameraList.addCameras(camerasToLoad,\n cameraAdjustments, cameraHeight);\n\n // Load saved camera from cameras state\n if (camerasToLoad.find(x => x.id === activeCamera)) {\n this.setCameraVisible(activeCamera, savedCameraState);\n }\n\n const cameraList = this.cameraList.cameras;\n const numCameras = cameraList.length;\n\n // Redraw cameras in scene and aerial view after changes\n if ((numRemoved > 0) || (numAdded > 0)) {\n this.minimap.addCameraMarkers(cameraList);\n this.markers.addCameraMarkers(cameraList);\n this.controls.measurements.refreshMeasurementList();\n }\n\n // Update arrow marker navigation\n if ((numRemoved > 0) || ((numAdded > 0) && (numAdded < numCameras))) {\n this.markers.updateArrowNavigation();\n }\n\n // All cameras have been removed\n if ((numCameras === 0) && (numRemoved > 0)) {\n this.cameraList.setOrbitCamera();\n this.minimap.setActiveCamera();\n this.markers.clearArrowNavigation();\n return;\n }\n\n // Apply default orbit position if possible\n let applied = this.setOrbitDefault(numAdded, savedCameraState);\n if (applied) {\n return;\n }\n\n // Camera changed (added or removed) and nothing visible.\n // Switch to the first camera in our new camera list instead\n if ((numChanged > 0) && (!this.cameraList.cameraLoaded)) {\n if (cameraList.length > 0) {\n this.setCameraVisible(cameraList[0].id);\n }\n }\n }\n\n reconcilePointClouds(pointClouds, savedCameraState: SceneCameraState) {\n const cloudList = this.pointclouds.clouds;\n const currentPointClouds = new Set(cloudList.map(cloud => cloud.identifier));\n const newPointClouds = new Set(pointClouds.map(cloud => cloud.id));\n\n const pointCloudsToLoad = pointClouds.filter(cloud => !currentPointClouds.has(cloud.id));\n const pointCloudsToDelete = cloudList.filter(cloud => !newPointClouds.has(cloud.identifier));\n\n const numRemoved = pointCloudsToDelete.length;\n const numAdded = pointCloudsToLoad.length;\n\n // Delete clouds that need to be removed\n pointCloudsToDelete.forEach(pointCloud => {\n this.pointclouds.deletePointCloud(pointCloud.identifier);\n });\n\n // Add new pointclouds\n pointCloudsToLoad.forEach(pointCloud => {\n const cloudDetails = {\n name: pointCloud.name,\n identifier: pointCloud.id,\n path: slash(pointCloud.data.path),\n visible: pointCloud.visible,\n remote: isStaticSite,\n fromJSON: pointCloud.fromJSON\n };\n\n if (pointCloud.type === AssetType.LAS) {\n let pointCloud = new RawPointCloud(this.pointclouds);\n pointCloud.loadFile(cloudDetails);\n } else if (pointCloud.type === AssetType.Encompass) {\n let pointCloud = new EncompassPointCloud(this.pointclouds);\n pointCloud.loadNodes(cloudDetails);\n }\n });\n\n // Toggle proper visibility for each cloud\n pointClouds.forEach(pointCloud => {\n this.pointclouds.toggleVisibility(pointCloud.id, pointCloud.visible);\n });\n\n const numClouds = this.pointclouds.clouds.length;\n const numCameras = this.cameraList.cameras.length;\n\n // Apply default orbit position if possible\n let applied = this.setOrbitDefault(numAdded, savedCameraState);\n if (applied) {\n return;\n }\n\n // No cloud remain. Exit 3d mode if cameras exist\n if ((numClouds === 0) && (numRemoved > 0) && (numCameras > 0)) {\n this.controls.setOrbitState(false);\n }\n }\n\n reconcileOrthos(orthos) {\n const orthosList = this.orthoList.orthos;\n const currentOrthos = new Set(orthosList.map(ortho => ortho.id));\n const newOrthos = new Set(orthos.map(ortho => ortho.id));\n\n const orthosToLoad = orthos.filter(ortho => !currentOrthos.has(ortho.id));\n const orthosToDelete = orthosList.filter(ortho => !newOrthos.has(ortho.id));\n\n // Delete orthos that need to be removed\n orthosToDelete.forEach(ortho => {\n this.orthoList.deleteOrtho(ortho.id);\n });\n\n // Add new orthos\n orthosToLoad.forEach(ortho => {\n const {imageBounds, imageData, imageSize, imageSizeOriginal, imagePath,\n scaleX, scaleY} = ortho.data;\n\n const orthoInfo = {\n id: ortho.id,\n name: ortho.name,\n corners: imageBounds,\n base64: imageData,\n imageSize: imageSize,\n imageSizeOriginal: imageSizeOriginal,\n fromJSON: ortho.fromJSON,\n imagePath: imagePath,\n scaleX: scaleX,\n scaleY: scaleY\n };\n\n this.orthoList.addNewOrtho(orthoInfo);\n });\n\n // Toggle proper visibility for each ortho\n orthos.forEach(ortho => {\n this.orthoList.toggleVisibility(ortho.id, ortho.visible);\n });\n }\n\n setCameraHeights(height) {\n this.cameraList.setCameraHeights(height);\n }\n\n setCameraAdjustments(adjustments) {\n this.cameraList.setCameraAdjustments(adjustments);\n }\n\n setCameraMatrix(matrix) {\n this.cameraList.setCameraMatrix(matrix);\n if (this.controls.cameraAlignerAdv.enabled){\n this.controls.cameraAlignerAdv.redrawImageObsMarkers();\n }\n }\n\n resetCameraMatrix() {\n this.cameraList.resetCameraMatrix();\n if (this.controls.cameraAlignerAdv.enabled){\n this.controls.cameraAlignerAdv.redrawImageObsMarkers();\n }\n }\n\n resetLoadedOnce() {\n this.pointclouds.setLoadedOnce(false);\n }\n\n resetDefaultAerialState(state) {\n this.minimap.map.updateSize();\n this.minimap.reset(state);\n }\n\n removeInteractions() {\n const measurements = this.controls.measurements;\n if (measurements.enabled) {\n measurements.measurementAerialView.removeInteraction();\n }\n }\n\n /** Private Methods */\n onKeyDown(event) {\n if (!this.focused) {\n return;\n }\n\n event.preventDefault();\n this.cameraList.onKeyDown(event);\n this.controls.cameraAlignerBasic.onKeyDown(event);\n }\n\n onMouseFocus(event) {\n if (event.type === 'mouseover') {\n this.focused = true;\n } else if (event.type === 'mouseout') {\n this.focused = false;\n }\n }\n\n initViewEvents() {\n this.onMouseFocus = this.onMouseFocus.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n\n // Keep track of our canvas focus\n this.containerElement.addEventListener( 'mouseover', this.onMouseFocus, false );\n this.containerElement.addEventListener( 'mouseout', this.onMouseFocus, false );\n\n // Keydown doesnt work on canvas\n window.addEventListener( 'keydown', this.onKeyDown, false) ;\n }\n\n destroyViewEvents() {\n this.containerElement.removeEventListener( 'mouseover', this.onMouseFocus, false );\n this.containerElement.removeEventListener( 'mouseout', this.onMouseFocus, false );\n window.removeEventListener( 'keydown', this.onKeyDown, false) ;\n }\n\n updatePickers() {\n Object.keys(this.gpuPickers).forEach(name => {\n this.updatePicker(name);\n });\n }\n\n updatePicker(name) {\n this.gpuPickers[name].needsUpdate = true;\n }\n\n updatePickerCamera() {\n const pickers = Object.values(this.gpuPickers);\n pickers.forEach(picker => {\n picker.setCamera(this.camera);\n });\n }\n\n createScene() {\n this.camera = new PerspectiveCamera(90, 1.0,\n this.defaultNearPlane, this.defaultFarPlane);\n\n this.renderer = new WebGLRenderer({\n antialias: false,\n alpha: true,\n logarithmicDepthBuffer: false,\n powerPreference: \"high-performance\"\n });\n\n if (this.isWebGL2) {\n console.log(\"WebGL2 Detected\");\n }\n\n this.renderer.autoClear = false;\n }\n\n initGpuPickers() {\n this.gpuPickers = {\n markers: new GPUPicker(this, \"markers\", false),\n points: new GPUPicker(this, \"points\", false)\n };\n\n for (const picker of Object.values(this.gpuPickers)) {\n picker.setCamera(this.camera);\n }\n }\n\n initMaterials() {\n // Create our render pass\n this.screenPass = new RenderPass();\n\n // Default render target / material\n this.opacityMaterial = new OpacityMaterial();\n this.texture2DOpacity = new WebGLRenderTarget(\n this.width, this.height, {\n format: RGBAFormat,\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n stencilBuffer: false\n }\n );\n\n // Material for rendering panoramic as background\n this.imageMaterial = new ImageMaterial();\n this.texture2DImage = new WebGLRenderTarget(\n this.width, this.height, {\n minFilter: LinearFilter,\n magFilter: LinearFilter,\n format: RGBAFormat,\n stencilBuffer: false\n }\n );\n\n if (!this.EDLSupport) {\n console.log(\"EDL Not Supported\");\n return;\n }\n\n // EDL render target / material\n console.log(\"EDL Supported\");\n this.EDLMaterial = new EDLMaterial(this);\n this.texture2DDepth = new WebGLRenderTarget(\n this.width, this.height, {\n format: RGBAFormat,\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n generateMipmaps: false,\n stencilBuffer: false,\n depthBuffer: true\n }\n );\n\n let texturePrecision = this.isWebGL2 ? FloatType : UnsignedIntType;\n this.texture2DDepth.depthTexture = new DepthTexture(0, 0);\n this.texture2DDepth.depthTexture.type = texturePrecision;\n }\n\n initResize() {\n bindWindowEvent('resize', () => {\n this.handleWindowResize();\n });\n }\n\n handleWindowResize() {\n let width = this.containerElement.clientWidth;\n let height = this.containerElement.clientHeight;\n this.resizeCanvas(width, height);\n this.updatePickers();\n }\n\n resizeCanvas(width, height) {\n let aspect = width / height;\n\n this.camera.aspect = aspect;\n this.camera.updateProjectionMatrix();\n this.renderer.setSize(width, height);\n this.compass.setSize(width, height);\n\n if (this.EDLSupport) {\n this.EDLMaterial.screenWidth = width;\n this.EDLMaterial.screenHeight = height;\n }\n }\n\n resizeRenderTargets() {\n let width = this.width;\n let height = this.height;\n\n\n // Resize render targets\n let canvas = [\n this.texture2DDepth,\n this.texture2DOpacity,\n ];\n\n canvas.forEach(c => {\n if (!c) {\n return;\n }\n\n let w = c.width;\n let h = c.height;\n if ((w !== width) || (h !== height)) {\n c.dispose();\n c.setSize(width, height);\n }\n });\n\n // Resize gpu picker targets\n const pickers = Object.values(this.gpuPickers);\n pickers.forEach(picker => {\n picker.resizeTarget(width, height);\n });\n }\n\n updateMaterial(material, values) {\n let keys = Object.keys(values);\n keys.forEach(key => {\n material[key] = values[key];\n });\n }\n\n setRenderTarget(target, clear = false) {\n this.renderer.setRenderTarget(target);\n if (clear) {\n this.renderer.clear();\n }\n }\n\n renderWithTransparency(scenes, opacity, clear=true) {\n this.setRenderTarget(this.renderTarget, clear);\n scenes.forEach(scene => {\n if (!scene) {\n return;\n }\n\n this.renderer.render(scene, this.camera);\n });\n\n this.updateMaterial(this.renderMaterial, {\n ...this.renderTargetAttrs, opacity: opacity\n });\n this.screenPass.render(this.renderer, this.renderMaterial);\n }\n\n renderPanoramic() {\n // Render panoramic image\n this.setRenderTarget(this.texture2DImage, true);\n this.renderer.render(this.cameraList.scene, this.camera);\n\n // Update material texture with results\n this.updateMaterial(this.imageMaterial, {\n colorMap: this.texture2DImage.texture\n });\n\n // Render to screen and clear depth\n this.screenPass.render(this.renderer, this.imageMaterial);\n this.renderer.clearDepth();\n }\n\n renderSceneObjects() {\n // Render objects at full opacity\n this.renderWithTransparency([\n this.markers.renderInFront ? null : this.markers.scene\n ], 1.0);\n\n // Render pointcloud with transparency\n this.renderWithTransparency([this.pointclouds.scene],\n this.pointclouds.transparency, false);\n\n // Render scene labels (mixed opacity)\n let sceneLabels = this.imageLabels.sceneLabels;\n this.renderWithTransparency([sceneLabels.opacityScene],\n sceneLabels.opacity);\n this.renderWithTransparency([sceneLabels.standardScene], 1.0);\n\n // Semi-transparent markers sometimes rendered on top of everything\n if (this.markers.renderInFront) {\n this.renderWithTransparency([this.markers.scene],\n this.markers.opacity);\n }\n\n // Items here are rendered on top of everything, so they can always be seen\n this.renderWithTransparency([\n this.measurements.scene,\n this.controls.alignerScene\n ], 1.0);\n }\n\n renderPickerScene() {\n this.gpuPickers.points.needsUpdate = true;\n this.gpuPickers.points.update();\n this.setRenderTarget(null, true);\n this.renderer.render(this.gpuPickers.points.scene, this.camera);\n }\n\n updateSceneElements() {\n this.changeDetector.update();\n this.pointclouds.update();\n this.measurements.update(this.changeDetector);\n this.controls.update(this.changeDetector);\n this.cameraList.update();\n this.minimap.update(this.changeDetector);\n this.markers.update();\n this.imageLabels.update(this.changeDetector);\n }\n\n calculateUpdatedValues() {\n let state = {\n camera: null,\n fov: null,\n angles: null,\n orbit: null,\n pivot: null\n } as SceneCameraState;\n\n if (this.orbitState) {\n // Update for orbit camera\n let {orbit, pivot} = this.controls.orbit\n .getPositionValues();\n\n state = {\n ...state,\n orbit: orbit,\n pivot: pivot\n };\n } else if (this.cameraList.current) {\n // Update for standard camera\n state = {\n ...state,\n camera: this.cameraList.current.id,\n fov: this.controls.fov,\n angles: this.controls.angles\n };\n }\n\n this.setCameraState(state);\n }\n\n animate() {\n if (!this.enabled) {\n return;\n }\n\n this.stats.begin();\n\n this.resizeRenderTargets();\n this.updateSceneElements();\n\n if (this.changeDetector.changed) {\n this.updateSavedState();\n }\n\n if (this.drawPickerScene) {\n this.renderPickerScene();\n } else {\n this.renderPanoramic();\n this.renderSceneObjects();\n }\n\n // Render compass element\n this.compass.render(this.showCompassElement,\n this.camera, this.orbitState);\n\n this.stats.end();\n\n requestAnimationFrame(() => {\n this.animate();\n });\n }\n}\n\nclass RenderPass {\n private readonly screenScene: Scene;\n private readonly screenQuad: Mesh;\n private readonly camera: Camera;\n\n constructor() {\n const geometry = new PlaneBufferGeometry(2, 2, 0);\n const material = new MeshBasicMaterial({\n depthTest: true,\n depthWrite: true,\n transparent: true\n });\n\n this.screenScene = new Scene();\n this.screenQuad = new Mesh(geometry, material);\n this.screenScene.add(this.screenQuad);\n this.camera = new Camera();\n }\n\n /** Render to screen. Note that our render target is changed after using this function */\n render(renderer, material, target = null) {\n this.screenQuad.material = material;\n renderer.setRenderTarget(target);\n renderer.render(this.screenScene, this.camera);\n }\n}\n\nclass StatsPanel {\n private stats: Stats;\n private viewer: Viewer;\n private nodesVisible;\n private pointsVisible;\n private enabled = isDevMode;\n private expanded = false;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n this.clear();\n this.init();\n }\n\n get indexToShow() {\n let childCount = this.stats.dom.children.length;\n return [0, childCount-1, childCount-2];\n }\n\n clear() {\n // Remove old stats panels\n [...document.getElementsByClassName(\"stats\")].forEach(element => {\n element.remove();\n });\n }\n\n init() {\n if (!this.enabled) {\n return;\n }\n\n this.stats = new Stats();\n this.stats.dom.classList.add(\"stats\");\n this.setStyle();\n\n this.pointsVisible = this.stats.addPanel(\n new Stats.Panel('', '#ff8', '#221'));\n\n this.nodesVisible = this.stats.addPanel(\n new Stats.Panel('NODE', '#f8f', '#212'));\n\n [...this.stats.dom.children].forEach(element => {\n element.style.display = 'none';\n element.style.padding = '2px';\n });\n\n this.drawExpandedState();\n\n document.getElementById(\"debug-placeholder\")\n .appendChild(this.stats.dom);\n\n this.initEvents();\n }\n\n drawExpandedState() {\n // Hide all elements\n [...this.stats.dom.children].forEach(element => {\n element.style.display = 'none';\n });\n\n this.indexToShow.forEach(index => {\n this.stats.dom.children[index].style.display = 'inline-block';\n });\n\n if (this.expanded) {\n [...this.stats.dom.children].forEach(element => {\n element.style.display = 'inline-block';\n });\n }\n }\n\n initEvents() {\n this.stats.dom.onclick = (event) => {\n event.preventDefault();\n this.expanded = !this.expanded;\n this.drawExpandedState();\n };\n }\n\n setStyle() {\n this.stats.dom.style.position = \"\";\n this.stats.dom.style.top = \"\";\n this.stats.dom.style.left = \"\";\n this.stats.dom.style.bottom = \"0px\";\n this.stats.dom.style['z-index'] = \"\";\n }\n\n begin() {\n if (!this.enabled) {\n return;\n }\n\n this.stats.begin();\n }\n\n end() {\n if (!this.enabled) {\n return;\n }\n\n let pointCloud = this.viewer.pointclouds;\n let numberNodes = pointCloud.numSceneNodesVisible;\n let visiblePoints = pointCloud.numVisiblePoints;\n let maxPoints = pointCloud.visiblePointsTarget;\n\n this.pointsVisible.update(\n visiblePoints / 1000,\n maxPoints / 1000\n );\n\n this.nodesVisible.update(numberNodes, 500);\n\n this.stats.end();\n }\n}\n\n\nexport const withPerformanceMeasure = (name, callback) => {\n let response;\n\n if (isDevMode) {\n let timeStart = performance.now();\n\n response = callback();\n\n let timeFinish = performance.now();\n let timeElapsed = timeFinish - timeStart;\n let timeUntilWarning = 10;\n if (timeElapsed > timeUntilWarning) {\n console.warn(`Slow rendering detected: ${name} took ${timeElapsed}ms`);\n }\n } else {\n response = callback();\n }\n\n return response;\n};\n","import { PanoControls, RayCaster } from '../controls';\nimport { SceneCoordinate } from '../projections';\nimport { setPointScale } from '../utilities';\nimport { debounce } from 'throttle-debounce';\nimport { CameraImage } from '../cameras/cameras';\nimport {\n Mesh,\n Scene,\n SphereGeometry,\n MeshBasicMaterial,\n Vector3\n} from 'three';\n\nclass ImageObservation extends Mesh {\n\n constructor(geometry, material, row) {\n super(geometry, material);\n this.name = \"image_\" + row.toString();\n }\n}\n\nclass PointObservation extends Mesh {\n\n constructor(geometry, material, row) {\n super(geometry, material);\n this.name = \"point_\" + row.toString();\n }\n}\n\nexport const pointObsColor = 0xe6e600;\nexport const imageObsColor = 0x9900cc; \n\nexport class CameraAlignerAdv {\n private controls;\n private setAddObservations;\n private setViewerTooltipText;\n private resetObservationType;\n private currentRow=-1;\n private observationType=\"none\";\n public enabled = false;\n public scene: Scene;\n private sceneObs=[];\n private enabled3dMode=false;\n private pointIdxAdd = 0;\n private imageIdxAdd = 0;\n\n private sphereGeometry = new SphereGeometry(0.05, 20, 20);\n\n constructor(controls, scene, props) {\n const {setAddObservations, setViewerTooltipText, resetObservationType} = props;\n\n this.scene = scene;\n this.controls = controls;\n this.setAddObservations = setAddObservations;\n this.setViewerTooltipText = setViewerTooltipText;\n this.resetObservationType = resetObservationType;\n this.enabled3dMode = this.controls.orbit.status;\n }\n\n get numEntries() {\n return this.sceneObs.length;\n }\n\n get viewer() {\n return this.controls.viewer;\n }\n\n get selecting() {\n const type = this.observationType;\n return ((type === \"point\") || (type === \"image\"));\n }\n\n setState(state) {\n this.enabled = state;\n }\n\n update3dMode() {\n this.enabled3dMode = this.controls.orbit.status;\n }\n\n reset() {\n for (let observation of this.sceneObs) {\n this.scene.remove(observation.imageMesh);\n this.scene.remove(observation.pointMesh);\n }\n this.sceneObs = [];\n this.pointIdxAdd = 0;\n this.imageIdxAdd = 0;\n }\n\n addRow() {\n this.sceneObs.push(this.emptyObservation());\n }\n\n setErrors(errors) {\n for (let i = 0; iRight-click to cancel`;\n this.setViewerTooltipText(text);\n } else {\n this.setViewerTooltipText(\"\");\n }\n }\n\n addPointObservationMesh(position) {\n // if mesh doesnt exist (check whatever array you add this to)\n\n let sphereMaterial = new MeshBasicMaterial({color: pointObsColor});\n let mesh = new PointObservation(this.sphereGeometry, sphereMaterial,\n this.sceneObs[this.currentRow].pointIdx);\n \n this.scene.add(mesh);\n this.sceneObs[this.currentRow].pointMesh = mesh;\n\n // update position (new or existing mesh)\n mesh.position.copy(position);\n this.setPointScale(mesh);\n }\n\n addImageObservationMesh(position) {\n // if mesh doesnt exist (check whatever array you add this to)\n let sphereMaterial = new MeshBasicMaterial({color: imageObsColor});\n let mesh = new ImageObservation(this.sphereGeometry, sphereMaterial,\n this.sceneObs[this.currentRow].imageIdx);\n \n this.scene.add(mesh);\n this.sceneObs[this.currentRow].imageMesh = mesh;\n\n // update position (new or existing mesh)\n mesh.position.copy(position);\n this.setPointScale(mesh);\n }\n\n flashObservations(rowNum) {\n const colorImage = this.sceneObs[rowNum].imageMesh?.material.color;\n const colorPoint = this.sceneObs[rowNum].pointMesh?.material.color;\n const flashObservation = (colorObject) => {\n const originalColor = colorObject.getHex();\n const flashColor = 0xffffff;\n\n let numberOfFlashes = 0;\n const maxNumberOfFlashes = 6;\n const timerDelay = 500;\n\n const interval = setInterval(() => {\n if (colorObject.getHex() === originalColor) {\n colorObject.setHex(flashColor);\n } else {\n colorObject.setHex(originalColor);\n }\n\n numberOfFlashes++;\n\n if (numberOfFlashes === maxNumberOfFlashes) {\n clearInterval(interval);\n }\n }, timerDelay);\n };\n\n if (colorImage) {\n flashObservation(colorImage);\n }\n\n if (colorPoint) {\n flashObservation(colorPoint);\n }\n };\n\n hideCurrentObservation(type, rowNum) {\n const mesh = type === 'image' ? this.sceneObs[rowNum].imageMesh : this.sceneObs[rowNum].pointMesh;\n\n if (mesh) {\n mesh.visible = false;\n } \n }\n\n setAllObservationsVisible() {\n for (const element of this.sceneObs) {\n const imageMesh = element.imageMesh;\n const pointMesh = element.pointMesh;\n\n if (imageMesh) {\n imageMesh.visible = true;\n }\n\n if (pointMesh) {\n pointMesh.visible = true;\n }\n }\n }\n\n getObservationPosition(rowNum) {\n return this.sceneObs[rowNum].imageObs;\n }\n\n unhideObservations() {\n const imageMesh = this.sceneObs[this.currentRow].imageMesh;\n const pointMesh = this.sceneObs[this.currentRow].pointMesh;\n\n if (imageMesh) {\n imageMesh.visible = true;\n }\n\n if (pointMesh) {\n pointMesh.visible = true;\n }\n }\n\n emptyObservation = () => {\n return {\n imageObs: null,\n pointObs: null,\n imageMesh: null,\n pointMesh: null,\n imageIdentifier: \"\",\n name: \"No File\",\n pose: [],\n error: 0,\n pointIdx: -1,\n imageIdx: -1\n };\n }\n\n removeMarker(name) {\n this.scene.children.forEach(child => {\n if (child.name === name){\n this.scene.remove(child);\n }\n });\n }\n\n redrawImageObsMarkers() {\n if (this.sceneObs === null || this.sceneObs.length === 0) {\n return;\n }\n\n for (let i=0; i {\n // Don't run if data aligner isn't open\n if (!this.enabled){\n return;\n }\n\n // Resize point observations\n if (observation.pointMesh != null) {\n this.setPointScale(observation.pointMesh);\n }\n\n // Don't continue if no cameras are loaded\n if (!this.viewer.cameraList.current){\n return;\n }\n\n if (observation.imageMesh != null){\n const currentID = this.viewer.cameraList.current.id;\n if ((observation.imageIdentifier === currentID) && !this.enabled3dMode) {\n observation.imageMesh.visible = true;\n this.setPointScale(observation.imageMesh);\n } else {\n observation.imageMesh.visible = false;\n }\n }\n });\n }\n}\n\nexport class CameraAlignerBasic {\n public enabled = false;\n private increment = 0.10;\n private cameraAngles = [0, 0, 0];\n private controls: PanoControls\n private setSingleAlignment;\n\n constructor(controls: PanoControls, props) {\n const {setSingleAlignment} = props;\n\n this.controls = controls;\n\n // Need to debounce to update ui smoothly\n this.setSingleAlignment = debounce(10, (value) => {\n setSingleAlignment(value);\n });\n\n this.reset();\n }\n\n get currentCamera() : CameraImage {\n return this.controls.cameraList?.current;\n }\n\n setState(state) {\n this.enabled = state;\n }\n\n reset(values = [0,0,0]) {\n this.cameraAngles = [...values];\n this.updateAlignment();\n }\n\n onKeyDown(event) {\n if (!this.enabled) {\n return;\n }\n\n if (event.code === \"Numpad7\") {\n this.cameraAngles[0] -= this.increment;\n } else if (event.code === \"Numpad9\") {\n this.cameraAngles[0] += this.increment;\n } else if (event.code === \"Numpad4\") {\n this.cameraAngles[1] -= this.increment;\n } else if (event.code === \"Numpad6\") {\n this.cameraAngles[1] += this.increment;\n } else if (event.code === \"Numpad1\") {\n this.cameraAngles[2] -= this.increment;\n } else if (event.code === \"Numpad3\") {\n this.cameraAngles[2] += this.increment;\n }\n\n this.updateAlignment();\n }\n\n updateAlignment() {\n this.setSingleAlignment([...this.cameraAngles]);\n this.currentCamera?.applyTempRotation(this.cameraAngles);\n }\n}","import {touchToMouse} from \"../misc\";\nimport {CustomOrbitControls} from \"./orbit-controls\";\nimport {Viewer, withPerformanceMeasure} from '../main';\nimport { CameraAlignerAdv, CameraAlignerBasic } from '../image-aligner/image-aligner';\nimport { eventToPixel } from '../utilities';\nimport { SceneCoordinate, SphericalPosition } from '../projections';\nimport {\n AmbientLight,\n MathUtils,\n Raycaster,\n Scene,\n Vector2,\n Vector3,\n} from 'three';\n\nexport class PanoControls {\n public viewer: Viewer;\n public object: any;\n public domElement: any;\n public cameraAlignerAdv: CameraAlignerAdv;\n public cameraAlignerBasic: CameraAlignerBasic;\n private minFOV = 10;\n public maxFOV = 90;\n public orbitDefaultApplied = false;\n private time: any;\n private enabled: any;\n private rotateSpeed: any;\n public direction: Vector3;\n private up: any;\n public orbit: any;\n public flyControls: any;\n private mouse: any;\n private wheelDelta: any;\n private phiDelta: any;\n private thetaDelta: any;\n private assetSelected: any;\n private moveEvent: any;\n private zooming: any;\n private contextMenuClick;\n public alignerScene: THREE.Scene\n\n constructor(viewer, object, domElement, props) {\n const {contextMenuClick} = props;\n\n this.viewer = viewer;\n this.object = object;\n this.domElement = (domElement !== undefined) ? domElement : document;\n this.contextMenuClick = contextMenuClick;\n\n this.time = performance.now();\n\n this.enabled = true;\n this.rotateSpeed = 1.0;\n this.direction = new Vector3(0, 0, 0);\n this.up = new Vector3(0, 0, 1);\n\n this.orbit = new OrbitController(this, this.up);\n this.flyControls = new FlyMoveControls(this);\n this.mouse = new MouseConfig();\n\n // Used for touch controls\n this.touchHandler = this.touchHandler.bind(this);\n\n this.initScene();\n\n this.cameraAlignerAdv = new CameraAlignerAdv(this, this.alignerScene, props);\n this.cameraAlignerBasic = new CameraAlignerBasic(this, props);\n\n // Rotation/wheel movement\n this.wheelDelta = 0.0;\n this.phiDelta = 0;\n this.thetaDelta = 0;\n this.addEventListeners();\n\n this.update(null);\n }\n\n get mobile() {\n return (/android|webos|iphone|ipad|ipod|blackberry|playbook|BB10|iemobile|opera mini/i\n .test(navigator.userAgent.toLowerCase()));\n }\n\n get cameraList() {\n return this.viewer.cameraList;\n }\n\n get sceneLabels() {\n return this.viewer.imageLabels.sceneLabels;\n }\n\n get markers() {\n return this.viewer.markers;\n }\n\n get measurements() {\n return this.viewer.measurements;\n }\n\n get pointclouds() {\n return this.viewer.pointclouds;\n }\n\n get picker() {\n return this.viewer.gpuPickers.points;\n }\n\n get fov(): number {\n return this.object.fov;\n }\n\n set fov(value) {\n let fov = Math.max(this.minFOV,\n Math.min(this.maxFOV, value));\n\n this.object.fov = fov;\n }\n\n get angles(): [number, number] {\n return [this.thetaDelta, this.phiDelta];\n }\n\n set angles(values) {\n const [theta, phi] = values;\n\n if (theta != null) {\n this.thetaDelta = theta;\n }\n\n if (phi != null) {\n this.phiDelta = phi;\n }\n }\n\n addEventListeners() {\n let dom = this.domElement;\n\n // Add all event listeners\n dom.addEventListener('mousedown', this.onMouseDown.bind(this), false);\n dom.addEventListener('mouseup', this.onMouseUp.bind(this), false);\n dom.addEventListener('wheel', this.onMouseWheel.bind(this), false);\n dom.addEventListener('dblclick', this.onMouseDoubleClick.bind(this), false);\n dom.addEventListener('mousemove', this.toggleMouseMove.bind(this), false);\n\n // All touchevents get turned into mouse events\n dom.addEventListener('touchstart', this.touchHandler, true);\n dom.addEventListener('touchmove', this.touchHandler, true);\n dom.addEventListener('touchend', this.touchHandler, true);\n dom.addEventListener('touchcancel', this.touchHandler, true);\n }\n\n initEvents() {\n }\n\n initScene() {\n // Scene for aligner\n const alignerScene = new Scene();\n const alignerLight = new AmbientLight(0xFFFFFF);\n alignerScene.add(alignerLight);\n this.alignerScene = alignerScene;\n }\n\n rotateLeft(angle) {\n this.thetaDelta += angle;\n }\n\n rotateUp(angle) {\n this.phiDelta += angle;\n this.phiDelta = Math.min(this.phiDelta, MathUtils.degToRad(89));\n this.phiDelta = Math.max(this.phiDelta, MathUtils.degToRad(-89));\n }\n\n resetData() {\n this.orbit.controls.enabled = false;\n this.thetaDelta = 0;\n this.phiDelta = 0;\n this.orbit.state = false;\n this.direction = new Vector3(0, 0, 0);\n this.orbit.setUpVector(this.up);\n this.assetSelected = false;\n }\n\n updateFarPlane(far) {\n this.object.far = far;\n this.orbit.camera.far = far;\n }\n\n getCameraTarget() {\n let cameraPosition;\n if (this.orbit.controls.enabled) {\n cameraPosition = this.orbit.controls.target;\n } else {\n cameraPosition = this.object.position;\n }\n return cameraPosition;\n }\n\n setOrbitState(state, position = null) {\n this.viewer.updatePickers();\n\n if (!position) {\n // Value is somehow forced to become what it already is...\n if ((this.orbit.state) && (state)) {\n return;\n }\n if ((!this.orbit.state) && (!state)) {\n return;\n }\n }\n\n let newPosition;\n let pivotLocation;\n let smoothTransition = false;\n\n this.enabled = false;\n if (state) {\n // Set our orbit controls position and target\n if (!position) {\n newPosition = this.object.position;\n pivotLocation = new Vector3(0, 0, -1 * this.orbit.rotateLength);\n pivotLocation.applyQuaternion(this.object.quaternion);\n pivotLocation.add(newPosition);\n } else {\n newPosition = position.position;\n pivotLocation = position.pivot;\n smoothTransition = position.smooth;\n }\n\n this.orbit.setPositionValues(newPosition, pivotLocation,\n state, smoothTransition);\n\n this.viewer.camera = this.orbit.camera;\n\n if (!smoothTransition) {\n this.flyControls.disable();\n }\n } else {\n this.orbit.controls.toggleFlyMode(false, false);\n this.orbit.controls.enabled = state;\n this.viewer.camera = this.object;\n }\n\n this.orbit.state = state;\n this.enabled = true;\n\n // Set panoramic visibility\n if (this.cameraList) {\n this.cameraList.setMeshVisible(!state);\n }\n\n this.viewer.handleWindowResize();\n this.viewer.updatePickerCamera();\n }\n\n // Only ever called from other functions\n removeMouseUp() {\n this.mouse.upEnabled = false;\n }\n\n getPickerResults(event) {\n // Update gpu picker if required\n this.picker.update();\n\n // Grab our geometry index\n const index = this.picker.value(event);\n if (index === null) {\n return null;\n }\n\n // Convert index to closest coordinate\n const coordinate = this.picker.getClosestCoordinate(index);\n\n return coordinate;\n }\n\n onLongPress(event) {\n let newEvent = new MouseEvent('mouseup', {\n bubbles: true,\n cancelable: true,\n view: window,\n detail: 1,\n screenX: event.changedPointers[0].screenX, // event.screenX,\n screenY: event.changedPointers[0].screenY, // event.screenY,\n clientX: event.changedPointers[0].clientX, // event.clientX,\n clientY: event.changedPointers[0].clientY, // event.clientY,\n ctrlKey: false,\n altKey: false,\n shiftKey: false,\n metaKey: false,\n button: 2\n });\n this.domElement.dispatchEvent(newEvent);\n }\n\n onDoubleTap(event) {\n let pointer = event.changedPointers[0];\n let newEvent = new MouseEvent('dblclick', {\n bubbles: true,\n cancelable: true,\n view: window,\n detail: 1,\n screenX: pointer.screenX,\n screenY: pointer.screenY,\n clientX: pointer.clientX,\n clientY: pointer.clientY,\n ctrlKey: false,\n altKey: false,\n shiftKey: false,\n metaKey: false,\n button: 0\n });\n this.domElement.dispatchEvent(newEvent);\n }\n\n resetCamera(side=\"top\") {\n let clouds = this.pointclouds;\n let bbox = clouds.combinedBoundingBox;\n if (!bbox) {\n return;\n }\n\n let newPosition = clouds.orbitPositionFromBounds(bbox, side, true);\n this.setOrbitState(true, newPosition);\n }\n\n toggleCamera() {\n let checked = this.orbit.status;\n this.setOrbitState(!checked);\n }\n\n toggleMouseMove(event) {\n this.mouse.moveEnabled = true;\n this.moveEvent = event;\n }\n\n onMouseMove(event) {\n if (!this.mouse.moveEnabled) {\n return;\n }\n\n const markers = this.markers;\n const sceneLabels = this.sceneLabels;\n const measurements = this.measurements;\n const aligner = this.cameraAlignerAdv;\n const compass = this.viewer.compass;\n\n let element = this.domElement === document ? this.domElement.body : this.domElement;\n this.mouse.moveEnabled = false;\n\n if (this.mouse.down) {\n this.mouse.moveEnd.set(event.clientX, event.clientY);\n let mouseMoveDistance = this.mouse.moveStart.distanceTo(this.mouse.moveEnd);\n this.mouse.moveDistance += mouseMoveDistance;\n this.mouse.moveDelta.subVectors(this.mouse.moveEnd, this.mouse.moveStart);\n this.mouse.moveStart.copy(this.mouse.moveEnd);\n this.mouse.movement = this.mouse.moveDistance > 0;\n }\n\n // Compass mousemove\n let hovering = compass.onMouseMove(event);\n if (hovering) {\n return;\n }\n\n // Marker mousemove\n markers.onMouseMove(event, this.mouse);\n\n // Measurements mousemove\n measurements.onMouseMove(event, this.mouse);\n if (measurements.movingEndpoint) {\n return;\n }\n\n // Scene labels mousemove\n sceneLabels.onMouseMove(event, this.mouse);\n if (sceneLabels.movingEndpoint) {\n return;\n }\n\n if (aligner.enabled) {\n aligner.updateSelectionText();\n }\n\n if (!this.mouse.movement) {\n return;\n }\n\n // Exit here if we are in 3d mode (or measurements are disabled somehow)\n if (!this.enabled || this.orbit.state) {\n return;\n }\n\n event.preventDefault();\n\n // Set the rotation\n let rotateDelta = new Vector2().copy(this.mouse.moveDelta);\n\n // Lessen the rotation when zoomed in\n rotateDelta.multiplyScalar(this.object.fov / 90);\n\n // Rotating across whole screen goes 360 degrees around\n this.rotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * this.rotateSpeed);\n\n // Rotating up and down along whole screen attempts to go 360, but limited to 180\n this.rotateUp(Math.PI * rotateDelta.y / element.clientHeight * this.rotateSpeed);\n }\n\n onMouseDown(event) {\n event.preventDefault();\n this.mouse.down = true;\n this.mouse.button = event.button;\n\n // We always want the mouseup event to happen\n this.mouse.upEnabled = true;\n\n // Start rotation and listen to mousemove events\n this.mouse.moveStart.set(event.clientX, event.clientY);\n this.mouse.moveDistance = 0;\n }\n\n onMouseUp(event) {\n const measurements = this.measurements;\n const sceneLabels = this.sceneLabels;\n const aligner = this.cameraAlignerAdv;\n const compass = this.viewer.compass;\n\n this.mouse.down = false;\n\n // We are no longer grabbing measurement endpoints\n measurements.measureGrabFinished();\n\n // Might have been turned off while adjusting measurements\n this.orbit.toggle(true);\n\n if (!this.mouse.upEnabled || !this.enabled) {\n return;\n }\n\n let isRightClick = event.button === 2;\n let isLeftClick = event.button === 0;\n\n if (this.mouse.movement) {\n this.finishMouseUp();\n return;\n }\n\n if (isLeftClick) {\n let markerClicked = this.markers.mouseClick(event);\n if (markerClicked) {\n this.finishMouseUp();\n return;\n }\n\n let compassClicked = compass.mouseClick(event);\n if (compassClicked) {\n this.finishMouseUp();\n return;\n }\n }\n\n if (sceneLabels.enabled) {\n sceneLabels.contextMenuOpen = false;\n if (isLeftClick) {\n sceneLabels.mouseClick(event);\n } else if (isRightClick) {\n if (sceneLabels.drawing) {\n // Cancel scene labels\n sceneLabels.cancelLabel();\n } else {\n // Check if highlighting should happen\n const highlightSuccess = sceneLabels.highlightOnClick(event);\n if (!highlightSuccess) {\n // If not open contextMenu normally.\n this.contextMenuClick(event);\n sceneLabels.contextMenuOpen = true;\n }\n }\n }\n } else if (measurements.enabled) {\n if (isLeftClick) {\n measurements.mouseClick(event);\n } else if (isRightClick) {\n if (measurements.measuring) {\n // Cancel measurement\n measurements.cancelMeasurement(event);\n } else {\n // Show context menu\n this.contextMenuClick(event);\n }\n }\n } else {\n if (isLeftClick) {\n // Get direction vector\n if (aligner.enabled) {\n aligner.mouseClick(event);\n }\n } else if (isRightClick) {\n if (aligner.selecting) {\n // Cancel observation selection\n aligner.cancelAlignment();\n } else {\n // Show context menu\n this.contextMenuClick(event);\n }\n }\n }\n\n this.finishMouseUp();\n }\n\n onMouseWheel(event) {\n this.zooming = true;\n this.viewer.updatePickers();\n\n // Remember if we are scrolling (to stop updating pointcloud)\n this.mouse.scrolling = true;\n clearTimeout(this.mouse.wheelTimeout);\n this.mouse.wheelTimeout = setTimeout(() => {\n this.mouse.scrolling = false;\n }, this.mouse.wheelDelay);\n\n if (this.enabled === false) {\n return;\n }\n\n if (this.orbit.state) {\n return;\n }\n\n event.preventDefault();\n\n let delta = 0;\n if (event.deltaY > 0) {\n delta = -5;\n } else if (event.deltaY < 0) {\n delta = 5;\n }\n\n this.wheelDelta = delta;\n }\n\n onMouseDoubleClick(event) {\n if ((!this.enabled) || (this.measurements.enabled)) {\n return;\n }\n\n let coordinate = this.getPickerResults(event);\n if (coordinate === null) {\n return;\n }\n\n if (this.orbit.status && !this.orbit.flyModeEnabled) {\n // Move to new pointcloud location\n this.flyControls.start(coordinate, true);\n }\n }\n\n restrictOrbitMovement(value) {\n let orbit = this.orbit.controls;\n orbit.enableRotate = value;\n orbit.enablePan = value;\n }\n\n finishMouseUp() {\n let callback = () => {\n if (this.mouse.movement) {\n this.viewer.updatePickers();\n }\n\n this.mouse.movement = false;\n this.orbit.movement = false;\n };\n\n if (this.orbit.controls.enabled) {\n // Function will be called when orbit controls stop rotating/panning\n this.orbit.movement = true;\n this.orbit.callback = callback;\n } else {\n // Call our function immediately\n callback();\n }\n\n this.removeMouseUp();\n }\n\n getCameraDistance() {\n let minDistance = 1.0;\n let distance = minDistance;\n\n if (this.orbit.state) {\n let orbitObject = this.orbit.controls;\n let cameraPosition = orbitObject.object.position;\n let cameraPivot = orbitObject.target;\n let pivotLength = cameraPivot.distanceTo(cameraPosition);\n distance = Math.max(minDistance, pivotLength);\n }\n\n return distance;\n }\n\n getPrecision(precision) {\n let approxDistance = this.getCameraDistance();\n\n if (precision === null) {\n precision = Math.abs((1 - (100 - approxDistance) / 100.0) * (0.95) + 0.05);\n precision = Math.min(precision, 100.00);\n precision = Math.max(precision, 0.05);\n }\n\n let multiplier = this.viewer.far / this.viewer.defaultFarPlane;\n precision = precision * multiplier;\n\n return precision;\n }\n\n touchHandler(event) {\n let mouseEvent = touchToMouse(this, event);\n if (!mouseEvent) {\n return;\n }\n\n event.preventDefault();\n event.changedTouches[0].target.dispatchEvent(mouseEvent);\n }\n\n rotateSynchronous(angle) {\n this.thetaDelta += angle;\n this.adjustLookat();\n }\n\n adjustLookat() {\n this.object.up = this.up;\n let phiDelta = this.phiDelta + MathUtils.degToRad(90);\n this.direction.x = Math.cos(this.thetaDelta) * Math.sin(phiDelta);\n this.direction.y = Math.sin(this.thetaDelta) * Math.sin(phiDelta);\n this.direction.z = -1 * Math.cos(phiDelta);\n this.direction.add(this.object.position);\n this.object.lookAt(this.direction);\n this.object.updateProjectionMatrix();\n\n let maxAngle = 360 * Math.PI / 180;\n this.thetaDelta = this.thetaDelta % maxAngle;\n this.phiDelta = this.phiDelta % maxAngle;\n }\n\n updateView() {\n if (this.wheelDelta !== 0) { // controls mouse wheel zoom\n let fov = this.object.fov - this.wheelDelta;\n this.fov = fov;\n }\n\n // Rotate our lookat vector\n this.adjustLookat();\n\n // Reset\n this.wheelDelta = 0;\n this.zooming = false;\n }\n\n update(changeDetector) {\n withPerformanceMeasure(\"controls.ts\", () => {\n this.cameraAlignerAdv.update(changeDetector);\n this.onMouseMove(this.moveEvent);\n\n if (this.orbit.movement) {\n this.orbit.checkMovement();\n }\n\n // Update orbit performance tick\n let timeEnd = performance.now();\n let tick = timeEnd - this.time;\n this.time = timeEnd;\n this.orbit.controls.tick = tick;\n\n if (this.flyControls.enabled) {\n this.flyControls.move();\n }\n\n if (!this.enabled) {\n return;\n }\n\n this.orbit.update();\n this.updateView();\n });\n }\n}\n\nclass MouseConfig {\n private down: any;\n private button: any;\n private moveTolerance: any;\n private wheelTimeout: any;\n private wheelDelay: any;\n private endTimeout: any;\n private endDelay: any;\n private rotating: any;\n private zooming: any;\n private scrolling: any;\n private moveTick: any;\n private moveInterval: any;\n private moveEvent: any;\n private moveEnabled: any;\n private moveStart: any;\n private moveEnd: any;\n private moveDelta: any;\n private moveDistance: any;\n private upEnabled: any;\n\n constructor() {\n this.down = false;\n this.button = 0;\n this.moveTolerance = 10;\n\n this.wheelTimeout = null;\n this.wheelDelay = 150;\n\n this.endTimeout = 50;\n this.endDelay = 500;\n\n // Detect movement\n this.rotating = false;\n this.zooming = false;\n this.scrolling = false;\n\n this.moveTick = 100;\n this.moveInterval = null;\n this.moveEvent = null;\n this.moveEnabled = false;\n\n this.moveStart = new Vector2();\n this.moveEnd = new Vector2();\n this.moveDelta = new Vector2();\n this.moveDistance = 0;\n\n this.upEnabled = false;\n }\n}\n\nclass FlyMoveControls {\n private panoControls: PanoControls;\n private maxSteps: any;\n private rotateLength: any;\n private heightAbove: any;\n private enabled: any;\n private step: any;\n private initial: SphericalPosition;\n private increment: SphericalPosition;\n private pivot: Vector3;\n\n constructor(parent) {\n this.panoControls = parent;\n\n this.maxSteps = 10;\n this.rotateLength = 2.0;\n this.heightAbove = 0.0;\n\n this.disable();\n }\n\n get viewer() {\n return this.panoControls.viewer;\n }\n\n enable(pivot, initial, increment) {\n this.enabled = true;\n this.step = 0;\n this.pivot = pivot;\n this.initial = initial;\n this.increment = increment;\n }\n\n disable() {\n this.enabled = false;\n this.step = null;\n this.initial = null;\n this.increment = null;\n }\n\n start(pivot, addHeight, final = null) {\n let orbit = this.panoControls.orbit;\n let current = this.viewer.camera.position;\n let totalIntervals = this.maxSteps;\n\n if (addHeight) {\n // We actually move above our clicked point, so we cant move around\n // easier after getting to this location;\n pivot.z += this.heightAbove;\n }\n\n if (final === null) {\n // Final position is our clicked values minus the rotate length\n let vector = new Vector3()\n .add(pivot)\n .sub(current)\n .setLength(this.rotateLength);\n\n // Calculate final position based on rotate length\n final = new Vector3().add(pivot).sub(vector);\n }\n\n let sphereStart = new SphericalPosition()\n .fromVectors(pivot, current);\n\n let sphereFinish = new SphericalPosition()\n .fromVectors(pivot, final);\n\n let dRadius = sphereFinish.radius - sphereStart.radius;\n let dPhi = sphereFinish.phi - sphereStart.phi;\n\n // Make sure the rotation stays between [-180, 180]\n let dTheta = sphereFinish.theta - sphereStart.theta;\n if (dTheta > 180) {\n dTheta = -1 * (360 - dTheta);\n } else if (dTheta < -180) {\n dTheta = dTheta + 360;\n }\n\n let increment = new SphericalPosition().fromValues(\n dRadius / totalIntervals,\n dTheta / totalIntervals,\n dPhi / totalIntervals,\n );\n\n // Initial starting point (current position, looking at final pivot)\n orbit.setPositionValues(current, pivot, true);\n\n this.enable(pivot, sphereStart, increment);\n }\n\n move() {\n let orbit = this.panoControls.orbit;\n let theta = this.initial.theta + this.increment.theta * this.step;\n let radius = this.initial.radius + this.increment.radius * this.step;\n let phi = this.initial.phi + this.increment.phi * this.step;\n\n let pos = new SphericalPosition()\n .fromValues(radius, theta, phi)\n .toVector3()\n .add(this.pivot);\n\n // Travelled our max distance\n if (this.step === this.maxSteps) {\n // Set the final position and pivot\n orbit.setPositionValues(pos, this.pivot, true);\n this.disable();\n return;\n }\n\n // Set position only. Increment step counter\n this.viewer.camera.position.set(pos.x, pos.y, pos.z);\n //this.pos.add(increment);\n this.step += 1;\n }\n}\n\nclass OrbitController {\n private panoControls: PanoControls;\n private up: any;\n private rotateLength: any;\n private state: any;\n private movement: any;\n private camera: any;\n private controls: any;\n private orbit: any;\n private mouse: any;\n private flyControls: any;\n private callback: any;\n\n constructor(panoControls, up) {\n this.panoControls = panoControls;\n this.up = up;\n\n this.rotateLength = 10.0;\n this.state = false;\n this.movement = false;\n\n this.camera = this.panoControls.object.clone();\n this.camera.isPerspectiveCamera = true;\n this.camera.up.copy(this.up);\n\n this.controls = new CustomOrbitControls(this.camera,\n this.panoControls.domElement);\n this.controls.enableDamping = true;\n this.controls.dampingFactor = 0.15;\n this.controls.rotateSpeed = 0.50;\n this.controls.panSpeed = 0.50;\n this.controls.enabled = false;\n }\n\n get status() {\n return this.state;\n }\n\n get flyModeEnabled() {\n return this.controls.flyMode;\n }\n\n get loadingRestricted() {\n let orbit = this.orbit;\n let orbitMovement = (orbit.movement) && (orbit.status);\n\n if (this.mouse.scrolling) {\n return true;\n } else if (this.flyControls.enabled) {\n return true;\n } else if (orbitMovement) {\n return true;\n } else if (this.mouse.down) {\n return true;\n }\n\n return false;\n }\n\n set flyModeSpeed(value) {\n this.controls.setFlySpeed(value);\n }\n\n getPositionValues() {\n let pivot = null;\n let orbit = null;\n\n try {\n orbit = new SceneCoordinate(this.camera.position)\n .toDataProjection()\n .toArray();\n\n pivot = new SceneCoordinate(this.controls.target)\n .toDataProjection()\n .toArray();\n } catch {\n // Nothing\n }\n\n return {orbit, pivot};\n }\n\n setPositionValues(pos, pivot, enabled, smooth=false) {\n if (smooth) {\n this.panoControls.flyControls.start(pivot, false, pos);\n } else {\n this.controls.position0.set(pos.x, pos.y, pos.z);\n this.controls.target0.set(pivot.x, pivot.y, pivot.z);\n this.controls.reset();\n }\n\n this.controls.enabled = enabled;\n }\n\n setUpVector(upVector) {\n this.up = upVector;\n this.camera.up.copy(this.up);\n }\n\n update() {\n if (!this.state) {\n return;\n }\n\n this.controls.update();\n }\n\n object() {\n return this.controls;\n }\n\n toggle(value) {\n if (this.state) {\n this.controls.enabled = value;\n }\n }\n\n // Our orbit controls keep spinning/panning for a while after you release the\n // mouse button, so we need to find out when they are actually done rotating\n checkMovement() {\n let camera = this.controls;\n if (camera.isMoving() === false) {\n this.callback();\n }\n }\n}\n\nexport class RayCaster {\n private debug: any;\n private initialized: any;\n private width: any;\n private height: any;\n private event: any;\n private camera: any;\n private raycaster: any;\n\n constructor(viewer: Viewer, event) {\n this.debug = false;\n this.initialized = false;\n this.width = viewer.width;\n this.height = viewer.height;\n this.event = event;\n this.camera = viewer.camera;\n\n this.init();\n }\n\n init() {\n let direction = this.vectorFromEvent(this.event);\n let raycaster = this.defaultRaycaster(direction);\n this.raycaster = raycaster;\n }\n\n setPrecision(precision) {\n if (!this.initialized) {\n return;\n }\n\n this.raycaster.params = {\n 'Points': {threshold: precision},\n 'Line': {threshold: precision}\n };\n }\n\n intersectObject(target) {\n return this.raycaster.intersectObject(target);\n }\n\n intersectObjects(targets, opts={}) {\n if (!this.initialized) {\n return [];\n }\n\n let defaults = {\n minDistance: null,\n sortByRay: false\n };\n\n let options = {...defaults, ...opts};\n\n let objects = this.raycaster.intersectObjects(targets);\n\n if (options.minDistance !== null) {\n objects = objects.filter(item => item.distance > 0.10);\n }\n\n if (options.sortByRay) {\n objects.sort(function(a, b) {\n return a.distanceToRay - b.distanceToRay;\n });\n }\n\n return objects;\n }\n\n vectorFromEvent(event) {\n let uv = eventToPixel(event);\n uv.x = 2 * (uv.x / this.width) - 1;\n uv.y = 1 - 2 * (uv.y / this.height);\n uv.z = 0.5;\n\n let direction = this.raycastDirection(uv);\n return direction;\n }\n\n raycastDirection(vec) {\n vec.unproject(this.camera);\n vec.sub(this.camera.position).normalize();\n return vec;\n }\n\n defaultRaycaster(direction) {\n if (!direction) {\n return false;\n }\n\n let raycaster = new Raycaster();\n let origin = this.camera.position;\n raycaster.set(origin, direction);\n this.initialized = true;\n return raycaster;\n }\n}\n","/**\n * Full-screen textured quad shader\n */\n\nvar CopyShader = {\n\n uniforms: {\n\n \"tDiffuse\": { value: null },\n \"opacity\": { value: 1.0 }\n\n },\n\n vertexShader: [\n\n \"varying vec2 vUv;\",\n\n \"void main() {\",\n\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n \"}\"\n\n ].join( \"\\n\" ),\n\n fragmentShader: [\n\n \"uniform float opacity;\",\n\n \"uniform sampler2D tDiffuse;\",\n\n \"varying vec2 vUv;\",\n\n \"void main() {\",\n\n \"\tvec4 texel = texture2D( tDiffuse, vUv );\",\n \"\tgl_FragColor = opacity * texel;\",\n\n \"}\"\n\n ].join( \"\\n\" )\n\n};\n\nexport { CopyShader };\n","import {\n OrthographicCamera,\n PlaneBufferGeometry,\n Mesh\n} from \"three\";\n\nfunction Pass() {\n\n // if set to true, the pass is processed by the composer\n this.enabled = true;\n\n // if set to true, the pass indicates to swap read and write buffer after rendering\n this.needsSwap = true;\n\n // if set to true, the pass clears its buffer before rendering\n this.clear = false;\n\n // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.\n this.renderToScreen = false;\n\n}\n\nObject.assign( Pass.prototype, {\n\n setSize: function ( /* width, height */ ) {},\n\n render: function ( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n console.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n }\n\n} );\n\n// Helper for passes that need to fill the viewport with a single quad.\n\n// Important: It's actually a hack to put FullScreenQuad into the Pass namespace. This is only\n// done to make examples/js code work. Normally, FullScreenQuad should be exported\n// from this module like Pass.\n\nPass.FullScreenQuad = ( function () {\n\n var camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n var geometry = new PlaneBufferGeometry( 2, 2 );\n\n var FullScreenQuad = function ( material ) {\n\n this._mesh = new Mesh( geometry, material );\n\n };\n\n Object.defineProperty( FullScreenQuad.prototype, 'material', {\n\n get: function () {\n\n return this._mesh.material;\n\n },\n\n set: function ( value ) {\n\n this._mesh.material = value;\n\n }\n\n } );\n\n Object.assign( FullScreenQuad.prototype, {\n\n dispose: function () {\n\n this._mesh.geometry.dispose();\n\n },\n\n render: function ( renderer ) {\n\n renderer.render( this._mesh, camera );\n\n }\n\n } );\n\n return FullScreenQuad;\n\n} )();\n\nexport { Pass };\n","import {\n ShaderMaterial,\n UniformsUtils\n} from \"three\";\nimport { Pass } from './Pass';\n\nvar ShaderPass = function ( shader, textureID ) {\n\n Pass.call( this );\n\n this.textureID = ( textureID !== undefined ) ? textureID : \"tDiffuse\";\n\n if ( shader instanceof ShaderMaterial ) {\n\n this.uniforms = shader.uniforms;\n\n this.material = shader;\n\n } else if ( shader ) {\n\n this.uniforms = UniformsUtils.clone( shader.uniforms );\n\n this.material = new ShaderMaterial( {\n\n defines: Object.assign( {}, shader.defines ),\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader\n\n } );\n\n }\n\n this.fsQuad = new Pass.FullScreenQuad( this.material );\n\n};\n\nShaderPass.prototype = Object.assign( Object.create( Pass.prototype ), {\n\n constructor: ShaderPass,\n\n render: function ( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {\n\n if ( this.uniforms[ this.textureID ] ) {\n\n this.uniforms[ this.textureID ].value = readBuffer.texture;\n\n }\n\n this.fsQuad.material = this.material;\n\n if ( this.renderToScreen ) {\n\n renderer.setRenderTarget( null );\n this.fsQuad.render( renderer );\n\n } else {\n\n renderer.setRenderTarget( writeBuffer );\n // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600\n if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n this.fsQuad.render( renderer );\n\n }\n\n }\n\n} );\n\nexport { ShaderPass };\n","import { Pass } from './Pass';\n\nvar MaskPass = function ( scene, camera ) {\n\n Pass.call( this );\n\n this.scene = scene;\n this.camera = camera;\n\n this.clear = true;\n this.needsSwap = false;\n\n this.inverse = false;\n\n};\n\nMaskPass.prototype = Object.assign( Object.create( Pass.prototype ), {\n\n constructor: MaskPass,\n\n render: function ( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {\n\n var context = renderer.getContext();\n var state = renderer.state;\n\n // don't update color or depth\n\n state.buffers.color.setMask( false );\n state.buffers.depth.setMask( false );\n\n // lock buffers\n\n state.buffers.color.setLocked( true );\n state.buffers.depth.setLocked( true );\n\n // set up stencil\n\n var writeValue, clearValue;\n\n if ( this.inverse ) {\n\n writeValue = 0;\n clearValue = 1;\n\n } else {\n\n writeValue = 1;\n clearValue = 0;\n\n }\n\n state.buffers.stencil.setTest( true );\n state.buffers.stencil.setOp( context.REPLACE, context.REPLACE, context.REPLACE );\n state.buffers.stencil.setFunc( context.ALWAYS, writeValue, 0xffffffff );\n state.buffers.stencil.setClear( clearValue );\n state.buffers.stencil.setLocked( true );\n\n // draw into the stencil buffer\n\n renderer.setRenderTarget( readBuffer );\n if ( this.clear ) renderer.clear();\n renderer.render( this.scene, this.camera );\n\n renderer.setRenderTarget( writeBuffer );\n if ( this.clear ) renderer.clear();\n renderer.render( this.scene, this.camera );\n\n // unlock color and depth buffer for subsequent rendering\n\n state.buffers.color.setLocked( false );\n state.buffers.depth.setLocked( false );\n\n // only render where stencil is set to 1\n\n state.buffers.stencil.setLocked( false );\n state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1\n state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP );\n state.buffers.stencil.setLocked( true );\n\n }\n\n} );\n\n\nvar ClearMaskPass = function () {\n\n Pass.call( this );\n\n this.needsSwap = false;\n\n};\n\nClearMaskPass.prototype = Object.create( Pass.prototype );\n\nObject.assign( ClearMaskPass.prototype, {\n\n render: function ( renderer /*, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n renderer.state.buffers.stencil.setLocked( false );\n renderer.state.buffers.stencil.setTest( false );\n\n }\n\n} );\n\nexport { MaskPass, ClearMaskPass };\n","import {\n Clock,\n LinearFilter,\n Mesh,\n OrthographicCamera,\n PlaneBufferGeometry,\n RGBAFormat,\n Vector2,\n WebGLRenderTarget\n} from \"three\";\nimport { CopyShader } from \"./shaders/CopyShader.js\";\nimport { ShaderPass } from \"../postprocessing/ShaderPass.js\";\nimport { MaskPass } from \"../postprocessing/MaskPass.js\";\nimport { ClearMaskPass } from \"../postprocessing/MaskPass.js\";\n\nvar EffectComposer = function ( renderer, renderTarget ) {\n\n this.renderer = renderer;\n\n if ( renderTarget === undefined ) {\n\n var parameters = {\n minFilter: LinearFilter,\n magFilter: LinearFilter,\n format: RGBAFormat\n };\n\n var size = renderer.getSize( new Vector2() );\n this._pixelRatio = renderer.getPixelRatio();\n this._width = size.width;\n this._height = size.height;\n\n renderTarget = new WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, parameters );\n renderTarget.texture.name = 'EffectComposer.rt1';\n\n } else {\n\n this._pixelRatio = 1;\n this._width = renderTarget.width;\n this._height = renderTarget.height;\n\n }\n\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n this.renderTarget2.texture.name = 'EffectComposer.rt2';\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n\n this.renderToScreen = true;\n\n this.passes = [];\n\n // dependencies\n\n if ( CopyShader === undefined ) {\n\n console.error( 'THREE.EffectComposer relies on CopyShader' );\n\n }\n\n if ( ShaderPass === undefined ) {\n\n console.error( 'THREE.EffectComposer relies on ShaderPass' );\n\n }\n\n this.copyPass = new ShaderPass( CopyShader );\n\n this.clock = new Clock();\n\n};\n\nObject.assign( EffectComposer.prototype, {\n\n swapBuffers: function () {\n\n var tmp = this.readBuffer;\n this.readBuffer = this.writeBuffer;\n this.writeBuffer = tmp;\n\n },\n\n addPass: function ( pass ) {\n\n this.passes.push( pass );\n pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );\n\n },\n\n insertPass: function ( pass, index ) {\n\n this.passes.splice( index, 0, pass );\n pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );\n\n },\n\n isLastEnabledPass: function ( passIndex ) {\n\n for ( var i = passIndex + 1; i < this.passes.length; i ++ ) {\n\n if ( this.passes[ i ].enabled ) {\n\n return false;\n\n }\n\n }\n\n return true;\n\n },\n\n render: function ( deltaTime ) {\n\n // deltaTime value is in seconds\n\n if ( deltaTime === undefined ) {\n\n deltaTime = this.clock.getDelta();\n\n }\n\n var currentRenderTarget = this.renderer.getRenderTarget();\n\n var maskActive = false;\n\n var pass, i, il = this.passes.length;\n\n for ( i = 0; i < il; i ++ ) {\n\n pass = this.passes[ i ];\n\n if ( pass.enabled === false ) continue;\n\n pass.renderToScreen = ( this.renderToScreen && this.isLastEnabledPass( i ) );\n pass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive );\n\n if ( pass.needsSwap ) {\n\n if ( maskActive ) {\n\n var context = this.renderer.getContext();\n var stencil = this.renderer.state.buffers.stencil;\n\n //context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );\n stencil.setFunc( context.NOTEQUAL, 1, 0xffffffff );\n\n this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime );\n\n //context.stencilFunc( context.EQUAL, 1, 0xffffffff );\n stencil.setFunc( context.EQUAL, 1, 0xffffffff );\n\n }\n\n this.swapBuffers();\n\n }\n\n if ( MaskPass !== undefined ) {\n\n if ( pass instanceof MaskPass ) {\n\n maskActive = true;\n\n } else if ( pass instanceof ClearMaskPass ) {\n\n maskActive = false;\n\n }\n\n }\n\n }\n\n this.renderer.setRenderTarget( currentRenderTarget );\n\n },\n\n reset: function ( renderTarget ) {\n\n if ( renderTarget === undefined ) {\n\n var size = this.renderer.getSize( new Vector2() );\n this._pixelRatio = this.renderer.getPixelRatio();\n this._width = size.width;\n this._height = size.height;\n\n renderTarget = this.renderTarget1.clone();\n renderTarget.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );\n\n }\n\n this.renderTarget1.dispose();\n this.renderTarget2.dispose();\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n\n },\n\n setSize: function ( width, height ) {\n\n this._width = width;\n this._height = height;\n\n var effectiveWidth = this._width * this._pixelRatio;\n var effectiveHeight = this._height * this._pixelRatio;\n\n this.renderTarget1.setSize( effectiveWidth, effectiveHeight );\n this.renderTarget2.setSize( effectiveWidth, effectiveHeight );\n\n for ( var i = 0; i < this.passes.length; i ++ ) {\n\n this.passes[ i ].setSize( effectiveWidth, effectiveHeight );\n\n }\n\n },\n\n setPixelRatio: function ( pixelRatio ) {\n\n this._pixelRatio = pixelRatio;\n\n this.setSize( this._width, this._height );\n\n }\n\n} );\n\n\nvar Pass = function () {\n\n // if set to true, the pass is processed by the composer\n this.enabled = true;\n\n // if set to true, the pass indicates to swap read and write buffer after rendering\n this.needsSwap = true;\n\n // if set to true, the pass clears its buffer before rendering\n this.clear = false;\n\n // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.\n this.renderToScreen = false;\n\n};\n\nObject.assign( Pass.prototype, {\n\n setSize: function ( /* width, height */ ) {},\n\n render: function ( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n console.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n }\n\n} );\n\n// Helper for passes that need to fill the viewport with a single quad.\nPass.FullScreenQuad = ( function () {\n\n var camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n var geometry = new PlaneBufferGeometry( 2, 2 );\n\n var FullScreenQuad = function ( material ) {\n\n this._mesh = new Mesh( geometry, material );\n\n };\n\n Object.defineProperty( FullScreenQuad.prototype, 'material', {\n\n get: function () {\n\n return this._mesh.material;\n\n },\n\n set: function ( value ) {\n\n this._mesh.material = value;\n\n }\n\n } );\n\n Object.assign( FullScreenQuad.prototype, {\n\n dispose: function () {\n\n this._mesh.geometry.dispose();\n\n },\n\n render: function ( renderer ) {\n\n renderer.render( this._mesh, camera );\n\n }\n\n } );\n\n return FullScreenQuad;\n\n} )();\n\nexport { EffectComposer, Pass };\n","import {\n AdditiveBlending,\n LinearFilter,\n RGBAFormat,\n ShaderMaterial,\n UniformsUtils,\n WebGLRenderTarget\n} from \"three\";\nimport { Pass } from \"../postprocessing/Pass.js\";\nimport { CopyShader } from \"./shaders/CopyShader.js\";\n\n/**\n*\n* Supersample Anti-Aliasing Render Pass\n*\n* This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results.\n*\n* References: https://en.wikipedia.org/wiki/Supersampling\n*\n*/\n\nvar SSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) {\n\n Pass.call( this );\n\n this.scene = scene;\n this.camera = camera;\n\n this.sampleLevel = 4; // specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16.\n this.unbiased = true;\n\n // as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black.\n this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;\n this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;\n\n if ( CopyShader === undefined ) console.error( \"SSAARenderPass relies on CopyShader\" );\n\n var copyShader = CopyShader;\n this.copyUniforms = UniformsUtils.clone( copyShader.uniforms );\n\n this.copyMaterial = new ShaderMaterial(\t{\n uniforms: this.copyUniforms,\n vertexShader: copyShader.vertexShader,\n fragmentShader: copyShader.fragmentShader,\n premultipliedAlpha: true,\n transparent: true,\n blending: AdditiveBlending,\n depthTest: false,\n depthWrite: false\n } );\n\n this.fsQuad = new Pass.FullScreenQuad( this.copyMaterial );\n\n};\n\nSSAARenderPass.prototype = Object.assign( Object.create( Pass.prototype ), {\n\n constructor: SSAARenderPass,\n\n dispose: function () {\n\n if ( this.sampleRenderTarget ) {\n\n this.sampleRenderTarget.dispose();\n this.sampleRenderTarget = null;\n\n }\n\n },\n\n setSize: function ( width, height ) {\n\n if ( this.sampleRenderTarget )\tthis.sampleRenderTarget.setSize( width, height );\n\n },\n\n render: function ( renderer, writeBuffer, readBuffer ) {\n\n if ( ! this.sampleRenderTarget ) {\n\n this.sampleRenderTarget = new WebGLRenderTarget( readBuffer.width, readBuffer.height, { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat } );\n this.sampleRenderTarget.texture.name = \"SSAARenderPass.sample\";\n\n }\n\n var jitterOffsets = SSAARenderPass.JitterVectors[ Math.max( 0, Math.min( this.sampleLevel, 5 ) ) ];\n\n var autoClear = renderer.autoClear;\n renderer.autoClear = false;\n\n var oldClearColor = renderer.getClearColor().getHex();\n var oldClearAlpha = renderer.getClearAlpha();\n\n var baseSampleWeight = 1.0 / jitterOffsets.length;\n var roundingRange = 1 / 32;\n this.copyUniforms[ \"tDiffuse\" ].value = this.sampleRenderTarget.texture;\n\n var width = readBuffer.width, height = readBuffer.height;\n\n // render the scene multiple times, each slightly jitter offset from the last and accumulate the results.\n for ( var i = 0; i < jitterOffsets.length; i ++ ) {\n\n var jitterOffset = jitterOffsets[ i ];\n\n if ( this.camera.setViewOffset ) {\n\n this.camera.setViewOffset( width, height,\n jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625, // 0.0625 = 1 / 16\n width, height );\n\n }\n\n var sampleWeight = baseSampleWeight;\n\n if ( this.unbiased ) {\n\n // the theory is that equal weights for each sample lead to an accumulation of rounding errors.\n // The following equation varies the sampleWeight per sample so that it is uniformly distributed\n // across a range of values whose rounding errors cancel each other out.\n\n var uniformCenteredDistribution = ( - 0.5 + ( i + 0.5 ) / jitterOffsets.length );\n sampleWeight += roundingRange * uniformCenteredDistribution;\n\n }\n\n this.copyUniforms[ \"opacity\" ].value = sampleWeight;\n renderer.setClearColor( this.clearColor, this.clearAlpha );\n renderer.setRenderTarget( this.sampleRenderTarget );\n renderer.clear();\n renderer.render( this.scene, this.camera );\n\n renderer.setRenderTarget( this.renderToScreen ? null : writeBuffer );\n\n if ( i === 0 ) {\n\n renderer.setClearColor( 0x000000, 0.0 );\n renderer.clear();\n\n }\n\n this.fsQuad.render( renderer );\n\n }\n\n if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();\n\n renderer.autoClear = autoClear;\n renderer.setClearColor( oldClearColor, oldClearAlpha );\n\n }\n\n} );\n\n\n// These jitter vectors are specified in integers because it is easier.\n// I am assuming a [-8,8) integer grid, but it needs to be mapped onto [-0.5,0.5)\n// before being used, thus these integers need to be scaled by 1/16.\n//\n// Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396\nSSAARenderPass.JitterVectors = [\n [\n [ 0, 0 ]\n ],\n [\n [ 4, 4 ], [ - 4, - 4 ]\n ],\n [\n [ - 2, - 6 ], [ 6, - 2 ], [ - 6, 2 ], [ 2, 6 ]\n ],\n [\n [ 1, - 3 ], [ - 1, 3 ], [ 5, 1 ], [ - 3, - 5 ],\n [ - 5, 5 ], [ - 7, - 1 ], [ 3, 7 ], [ 7, - 7 ]\n ],\n [\n [ 1, 1 ], [ - 1, - 3 ], [ - 3, 2 ], [ 4, - 1 ],\n [ - 5, - 2 ], [ 2, 5 ], [ 5, 3 ], [ 3, - 5 ],\n [ - 2, 6 ], [ 0, - 7 ], [ - 4, - 6 ], [ - 6, 4 ],\n [ - 8, 0 ], [ 7, - 4 ], [ 6, 7 ], [ - 7, - 8 ]\n ],\n [\n [ - 4, - 7 ], [ - 7, - 5 ], [ - 3, - 5 ], [ - 5, - 4 ],\n [ - 1, - 4 ], [ - 2, - 2 ], [ - 6, - 1 ], [ - 4, 0 ],\n [ - 7, 1 ], [ - 1, 2 ], [ - 6, 3 ], [ - 3, 3 ],\n [ - 7, 6 ], [ - 3, 6 ], [ - 5, 7 ], [ - 1, 7 ],\n [ 5, - 7 ], [ 1, - 6 ], [ 6, - 5 ], [ 4, - 4 ],\n [ 2, - 3 ], [ 7, - 2 ], [ 1, - 1 ], [ 4, - 1 ],\n [ 2, 1 ], [ 6, 2 ], [ 0, 4 ], [ 4, 4 ],\n [ 2, 5 ], [ 7, 5 ], [ 5, 6 ], [ 3, 7 ]\n ]\n];\n\nexport { SSAARenderPass };\n","import { Viewer } from \"../main\";\nimport {\n AmbientLight,\n BackSide,\n BoxBufferGeometry,\n DoubleSide,\n FrontSide,\n Group,\n Mesh,\n MeshPhongMaterial,\n PerspectiveCamera,\n PlaneBufferGeometry,\n Raycaster,\n Scene,\n SpotLight,\n Texture,\n Vector2,\n Vector3,\n WebGLRenderer\n} from \"three\";\nimport { eventToPixel } from \"../utilities\";\nimport { SceneCoordinate } from \"../projections\";\nimport { EffectComposer } from \"../../../postprocessing/EffectComposer\";\nimport { ShaderPass } from \"../../../postprocessing/ShaderPass\";\nimport { CopyShader } from \"../../../postprocessing/shaders/CopyShader\";\nimport { SSAARenderPass } from \"../../../postprocessing/SSAARenderPass\";\n\nclass TextMaterial extends MeshPhongMaterial {\n public textures;\n public text;\n\n constructor(opts, textures, text) {\n super(opts);\n\n this.textures = textures;\n this.text = text;\n }\n}\n\nexport class CompassControls {\n private viewer: Viewer;\n private scene: Scene;\n private renderer: WebGLRenderer;\n private composer: EffectComposer\n private camera: PerspectiveCamera;\n private raycaster = new Raycaster();\n private setViewerTooltipText;\n private pixelRatio = 2;\n private antialias = true;\n\n private sizeRatioLarge = 0.20;\n private sizeRatioSmall = 0.40;\n private alphaTest = 0.25;\n private lightPosition = new Vector3(3, 3, 3);\n private pivot: Group;\n\n private cube: Mesh;\n private cubeSize = 0.4;\n private cubeColorStandard = \"#dddddd\";\n private cubeColorHover = \"#aaaaaa\";\n private cubeEdgeColor = \"#444444\";\n private cubeTextColor = \"#000000\";\n private cubeMaterials: TextMaterial[] = [];\n\n private donutSize = 0.80;\n private donutColor = \"#444444\";\n private donutTextColor = \"#ffffff\";\n\n private north: Group;\n private west: Group;\n private east: Group;\n private south: Group;\n\n constructor(viewer: Viewer, props) {\n const {setViewerTooltipText} = props;\n\n this.viewer = viewer;\n this.setViewerTooltipText = setViewerTooltipText;\n\n this.initScene();\n this.initAntiAliasing();\n this.setCanvasStyle();\n this.addObjects();\n this.addLights();\n }\n\n get width() {\n return this.domElement.width;\n }\n\n get height() {\n return this.domElement.height;\n }\n\n get domElement() {\n return this.renderer.domElement;\n }\n\n get cameraDistance() {\n return this.donutSize * 2.0;\n }\n\n initScene() {\n this.renderer = new WebGLRenderer({\n alpha: true,\n });\n\n this.renderer.setPixelRatio(this.pixelRatio);\n this.renderer.domElement.id = \"compass-canvas\";\n\n this.camera = new PerspectiveCamera(40, 1.0, 1, 10);\n this.camera.position.z = this.cameraDistance;\n this.camera.up = new Vector3(0, 1, 0);\n this.camera.lookAt(new Vector3(0, 0, 0));\n this.scene = new Scene();\n }\n\n initAntiAliasing() {\n this.composer = new EffectComposer(this.renderer);\n\n let ssaaRenderPass = new SSAARenderPass(this.scene,\n this.camera, \"white\", 0.0);\n\n ssaaRenderPass.unbiased = true;\n ssaaRenderPass.sampleLevel = 3;\n this.composer.addPass(ssaaRenderPass);\n\n let copyPass = new ShaderPass(CopyShader);\n this.composer.addPass(copyPass);\n }\n\n addObjects() {\n this.pivot = new Group();\n this.pivot.position.set(0, 0, 0);\n this.pivot.visible = false;\n\n this.addRotationCube();\n this.addCompassRing();\n this.addCompassLetters();\n\n // Add all items to scene\n this.scene.add(this.pivot);\n }\n\n addLights() {\n let ambientLight = new AmbientLight(0xffffff, 0.9);\n this.scene.add(ambientLight);\n\n let spotLight = new SpotLight(0xffffff, 0.5);\n spotLight.castShadow = true;\n spotLight.position.copy(this.lightPosition);\n this.scene.add(spotLight);\n }\n\n addRotationCube() {\n const cubeGeometry = new BoxBufferGeometry(this.cubeSize,\n this.cubeSize, this.cubeSize);\n\n this.cubeMaterials = [\n this.getTextMaterial(\"RIGHT\", {rotation: 270}),\n this.getTextMaterial(\"LEFT\", {rotation: 90}),\n this.getTextMaterial(\"BACK\", {rotation: 180}),\n this.getTextMaterial(\"FRONT\"),\n this.getTextMaterial(\"TOP\"),\n this.getTextMaterial(\"BOTTOM\", {rotation: 180, scale: 0.85}),\n ];\n\n this.cube = new Mesh(cubeGeometry, this.cubeMaterials);\n this.pivot.add(this.cube);\n }\n\n addCompassRing() {\n let donutGeometry = new PlaneBufferGeometry(\n this.donutSize, this.donutSize\n );\n\n let donutMaterial = this.getCircleMaterial();\n donutMaterial.alphaTest = this.alphaTest;\n donutMaterial.side = DoubleSide;\n\n const mesh = new Mesh(donutGeometry, donutMaterial);\n mesh.position.z = -this.cubeSize / 2.0;\n this.pivot.add(mesh);\n }\n\n addCompassLetters() {\n this.east = this.getDirectionMesh(\"E\");\n this.pivot.add(this.east);\n\n this.west = this.getDirectionMesh(\"W\");\n this.pivot.add(this.west);\n\n this.north = this.getDirectionMesh(\"N\");\n this.pivot.add(this.north);\n\n this.south = this.getDirectionMesh(\"S\");\n this.pivot.add(this.south);\n }\n\n getTextMaterial(text, opts = {}): TextMaterial {\n let defaults = {\n rotation: 0,\n scale: 1.0\n };\n\n let options = {...defaults, ...opts};\n\n let canvasSize = 1024;\n let fontSize = 200;\n let border = 32;\n let outlineSize = 5;\n\n // Might require font scaling\n fontSize = fontSize * options.scale;\n\n let textures = [];\n\n [this.cubeColorStandard, this.cubeColorHover].forEach(cubeColor => {\n let canvas = document.createElement(\"canvas\");\n canvas.width = canvasSize;\n canvas.height = canvasSize;\n let context = canvas.getContext(\"2d\");\n\n // Rotate from center point\n context.translate( canvasSize / 2, canvasSize / 2 );\n context.rotate(options.rotation * Math.PI / 180);\n context.translate( -canvasSize / 2, -canvasSize / 2 );\n\n // Fill background (border + color)\n context.fillStyle = this.cubeEdgeColor;\n context.fillRect(0, 0, canvasSize, canvasSize);\n context.fillStyle = cubeColor;\n context.fillRect(border, border, canvasSize - 2 * border,\n canvasSize - 2 * border);\n\n // Write text\n let x = canvasSize / 2.0;\n let y = canvasSize / 2.0 + fontSize / 2.0;\n context.textAlign = \"center\";\n context.font = `bold ${fontSize}px Verdana`;\n context.fillStyle = this.cubeTextColor;\n context.fillText(text, x, y);\n\n // Black outline\n context.lineWidth = outlineSize;\n context.strokeStyle = \"#000000\";\n context.strokeText(text, x, y);\n\n let texture = new Texture(canvas);\n texture.needsUpdate = true;\n textures.push(texture);\n });\n\n let material = new TextMaterial({\n map: textures[0],\n }, textures, text);\n\n return material;\n }\n\n getLetterMaterial(letter): MeshPhongMaterial {\n let canvasSize = 256;\n let fontSize = 230;\n let outlineSize = 5;\n\n let canvas = document.createElement(\"canvas\");\n canvas.width = canvasSize;\n canvas.height = canvasSize;\n let context = canvas.getContext(\"2d\");\n\n let x = canvasSize / 2.0;\n let y = canvasSize / 2.0 + fontSize / 2.0 - fontSize * 0.1;\n context.textAlign = \"center\";\n context.font = `bold ${fontSize}px Verdana`;\n\n // Colored text\n context.fillStyle = this.donutTextColor;\n context.fillText(letter, x, y);\n\n // Black outline\n context.lineWidth = outlineSize;\n context.strokeStyle = \"#000000\";\n context.strokeText(letter, x, y);\n\n let texture = new Texture(canvas);\n texture.needsUpdate = true;\n\n return new MeshPhongMaterial({\n map: texture\n });\n }\n\n getCircleMaterial(): MeshPhongMaterial {\n let canvasSize = 256;\n\n let canvas = document.createElement(\"canvas\");\n canvas.width = canvasSize;\n canvas.height = canvasSize;\n let context = canvas.getContext(\"2d\");\n\n context.fillStyle = this.donutColor;\n\n let x = canvasSize / 2.0;\n let y = canvasSize / 2.0;\n\n context.beginPath();\n context.arc(x, y, canvasSize * 0.5 * 1.00, 0, Math.PI * 2, false);\n context.arc(x, y, canvasSize * 0.5 * 0.75, 0, Math.PI * 2, true);\n context.fill();\n\n let texture = new Texture(canvas);\n texture.needsUpdate = true;\n\n return new MeshPhongMaterial({\n map: texture\n });\n }\n\n getDirectionMesh(letter): Group {\n let pivot = new Group();\n\n // Set the height just barely above the circle texture\n let textHeight = this.cubeSize * 0.005;\n\n if (letter === \"E\") {\n pivot.position.x = this.cubeSize;\n } else if (letter === \"W\") {\n pivot.position.x = -1 * this.cubeSize;\n } else if (letter === \"N\") {\n pivot.position.y = this.cubeSize;\n } else if (letter === \"S\") {\n pivot.position.y = -1 * this.cubeSize;\n }\n\n pivot.position.z = -this.cubeSize / 2.0;\n\n let geometryUpper = new PlaneBufferGeometry(this.donutSize * 0.25,\n this.donutSize * 0.25);\n let materialUpper = this.getLetterMaterial(letter);\n materialUpper.alphaTest = this.alphaTest;\n materialUpper.side = FrontSide;\n let meshUpper = new Mesh(geometryUpper, materialUpper);\n meshUpper.position.z = textHeight;\n pivot.add(meshUpper);\n\n let geometryLower = new PlaneBufferGeometry(this.donutSize * 0.25,\n this.donutSize * 0.25);\n let materialLower = this.getLetterMaterial(letter);\n materialLower.alphaTest = this.alphaTest;\n materialLower.side = BackSide;\n let meshLower = new Mesh(geometryLower, materialLower);\n meshLower.scale.y = -1;\n meshLower.position.z = -1 * textHeight;\n pivot.add(meshLower);\n\n return pivot;\n }\n\n onMouseMove(event) {\n let {hovering} = this.checkMouseHover(event);\n\n return hovering;\n }\n\n mouseClick(event): boolean {\n let controls = this.viewer.controls;\n let {hovering, side} = this.checkMouseHover(event);\n\n if (side) {\n controls.resetCamera(side);\n }\n\n return hovering;\n }\n\n checkMouseHover(event) {\n let side = this.getSelectedSide(event);\n let hovering = side ? true : false;\n this.togglePointer(hovering);\n\n return {hovering, side};\n }\n\n getSelectedSide(event) {\n if (!this.cube.visible) {\n return;\n }\n\n let offset = new Vector3(\n this.domElement.offsetLeft,\n this.domElement.offsetTop,\n 0\n );\n\n let {x, y} = eventToPixel(event).sub(offset);\n\n let mouse = new Vector2();\n mouse.x = (x / this.width) * this.pixelRatio * 2 - 1;\n mouse.y = -1 * (y / this.height) * this.pixelRatio * 2 + 1;\n\n if ((mouse.x < -1) || (mouse.x > 1)) {\n return;\n }\n\n if ((mouse.y < -1) || (mouse.y > 1)) {\n return;\n }\n\n this.raycaster.setFromCamera(mouse, this.camera);\n\n let intersect = this.raycaster\n .intersectObject(this.cube);\n\n if (intersect.length === 0) {\n this.setCubeMaterials();\n return;\n }\n\n let materialIndex = Math.floor(intersect[0].faceIndex / 2);\n let material = this.cubeMaterials[materialIndex];\n this.setCubeMaterials(materialIndex);\n\n return material.text;\n }\n\n setCubeMaterials(hoverIndex = null) {\n let materials = this.cube.material as TextMaterial[];\n\n for (var i = 0; i < materials.length; i++) {\n if (hoverIndex === i) {\n this.cube.material[i].map = materials[i].textures[1];\n } else {\n this.cube.material[i].map = materials[i].textures[0];\n }\n\n this.cube.material[i].needsUpdate = true;\n }\n }\n\n setCanvasStyle() {\n this.domElement.style[\"pointer-events\"] = \"none\";\n this.domElement.style.position = \"absolute\";\n this.domElement.style.top = \"0px\";\n this.domElement.style.right = \"0px\";\n }\n\n rotateLetters(yaw) {\n this.east.rotation.z = yaw;\n this.west.rotation.z = yaw;\n this.north.rotation.z = yaw;\n this.south.rotation.z = yaw;\n }\n\n zenith(pointA, pointB) {\n let height = pointA.z - pointB.z;\n let distance = pointA.distanceTo(pointB);\n let zenith = Math.acos(height / distance);\n return -1 * zenith;\n }\n\n bearing(pointA, pointB) {\n let startLat = pointA.y * Math.PI / 180;\n let destLat = pointB.y * Math.PI / 180;\n\n let startLng = pointA.x * Math.PI / 180;\n let destLng = pointB.x * Math.PI / 180;\n\n let y = Math.sin(destLng - startLng) * Math.cos(destLat);\n let x = Math.cos(startLat) * Math.sin(destLat) -\n Math.sin(startLat) * Math.cos(destLat) * Math.cos(destLng - startLng);\n let brng = Math.atan2(y, x);\n brng = brng * 180 / Math.PI;\n brng = (brng + 360.0) % 360;\n return brng * Math.PI / 180;\n }\n\n updateOffset(offset) {\n let shift = this.viewer.expanded\n ? offset\n : 0;\n\n this.domElement.style.right = `${shift}px`;\n }\n\n setSize(width, height) {\n const ratio = this.viewer.expanded\n ? this.sizeRatioLarge\n : this.sizeRatioSmall;\n\n const size = Math.min(width, height) * ratio;\n this.renderer.setSize(size, size);\n this.composer.setSize(size, size);\n }\n\n togglePointer(state) {\n if (state) {\n this.setViewerTooltipText(\"\");\n }\n\n const cursor = state ? \"pointer\" : \"\";\n this.viewer.setContainerCursor(cursor);\n }\n\n calculateRotations(loaded, camera, orbitMode) {\n if (!loaded) {\n return;\n }\n\n let quaternion = camera.quaternion;\n this.cube.visible = orbitMode;\n\n let lookatLocal = new Vector3(0, 0, -1)\n .applyQuaternion(quaternion)\n .add(camera.position);\n\n let lookatLonLat = new SceneCoordinate(lookatLocal)\n .toLonLat();\n\n let yPosLocal = new Vector3(0, 1, 0)\n .add(camera.position);\n\n let yPosLonLat = new SceneCoordinate(yPosLocal)\n .toLonLat();\n\n // Center point\n let cameraLocal = camera.position.clone();\n let cameraLatLon = new SceneCoordinate(cameraLocal)\n .toLonLat();\n\n let groupYaw = this.bearing(cameraLatLon, lookatLonLat);\n let groupPitch = orbitMode ? this.zenith(cameraLocal, lookatLocal) : 0;\n\n // Rotate our direction textures\n this.rotateLetters(-1 * groupYaw);\n\n // Pivot our geometry group\n this.pivot.rotation.z = groupYaw;\n this.pivot.rotation.x = groupPitch;\n\n // North wont equal our y-axis, so the cube is rotated independantly\n let cubeYaw = this.bearing(cameraLatLon, yPosLonLat);\n this.cube.rotation.z = -1 * cubeYaw;\n }\n\n render(loaded, camera, orbitMode) {\n this.calculateRotations(loaded, camera, orbitMode);\n this.pivot.visible = loaded;\n\n if (this.antialias) {\n this.composer.render();\n } else {\n this.renderer.render(this.scene, this.camera);\n }\n }\n}\n","import {Viewer} from '../main';\nimport {RayCaster} from \"../controls\";\nimport MeasurementController from './measurement-controller';\nimport {\n BufferGeometry,\n LineBasicMaterial,\n Line,\n SphereGeometry,\n MeshBasicMaterial,\n Mesh,\n Line3,\n Vector3,\n Plane\n} from 'three';\n\nexport const imageOnlyDistance = 20;\n\nexport class MultipleCameraMeasurement {\n private viewer: Viewer;\n private controller: MeasurementController;\n private coordinates = [];\n private maxSeperation = 1.0;\n private maxDistance = 100.0;\n private sceneItems = [];\n\n constructor(controller, viewer) {\n this.viewer = viewer;\n this.controller = controller;\n }\n\n getEndpoint(origin, direction) {\n return direction.clone().setLength(100.0).add(origin);\n }\n\n drawLine(start, end, color) {\n let geometry = new BufferGeometry().setFromPoints([start, end]);\n let material = new LineBasicMaterial({color: color});\n let line = new Line(geometry, material);\n this.controller.scene.add(line);\n this.sceneItems.push(line);\n }\n\n drawSphere(position) {\n let geometry = new SphereGeometry( 0.05, 32, 32 );\n let material = new MeshBasicMaterial( {color: 0xffff00} );\n let sphere = new Mesh( geometry, material );\n sphere.position.copy(position);\n this.controller.scene.add(sphere);\n this.sceneItems.push(sphere);\n }\n\n mouseClick(event) {\n if (this.coordinates.length === 2) {\n this.sceneItems.forEach(item => {\n this.controller.scene.remove(item);\n });\n this.coordinates = [];\n }\n\n let raycaster = new RayCaster(this.viewer, event);\n let direction = raycaster.vectorFromEvent(event);\n let origin = this.viewer.camera.position.clone();\n\n // Clicked line\n let endPoint = this.getEndpoint(origin, direction);\n this.drawLine(origin, endPoint, 0xffff00);\n\n this.coordinates.push({\n \"origin\": origin,\n \"direction\": direction\n });\n\n console.log(`Image-only measure click #${this.coordinates.length}`);\n\n if (this.coordinates.length === 2) {\n this.finish();\n }\n }\n\n finish() {\n let rayA = this.coordinates[0];\n let rayB = this.coordinates[1];\n let result = this.getIntersection(rayA, rayB);\n console.log(result);\n }\n\n /** Get closest possible midpoint for two line segments */\n getIntersection(rayA, rayB) {\n let p1 = rayA.origin;\n let d1 = rayA.direction;\n let p2 = rayB.origin;\n let d2 = rayB.direction;\n\n let n = d1.clone().cross(d2);\n let n1 = d1.clone().cross(n);\n let n2 = d2.clone().cross(n);\n\n let t1 = p2.clone().sub(p1).dot(n2);\n let b1 = d1.clone().dot(n2);\n let v1 = d1.clone().multiplyScalar(b1 !== 0 ? t1 / b1 : 0);\n let c1 = p1.clone().add(v1);\n\n let t2 = p1.clone().sub(p2).dot(n1);\n let b2 = d2.clone().dot(n1);\n let v2 = d2.clone().multiplyScalar(b2 !== 0 ? t2 / b2 : 0);\n let c2 = p2.clone().add(v2);\n\n // Make sure our result is in front of us\n let d1n = c1.clone().sub(p1).setLength(1.0);\n let d2n = c2.clone().sub(p2).setLength(1.0);\n let inFront = (d1.angleTo(d1n) === 0) && (d2.angleTo(d2n) === 0);\n\n // Make sure both lines are a valid length\n let distances = [c1.distanceTo(p1), c2.distanceTo(p2)];\n let maxDistance = Math.max(...distances);\n let minDistance = Math.min(...distances);\n let validDistance = (maxDistance < this.maxDistance)\n && (minDistance > 0);\n\n // Get our midpoint and segment length\n let lineSegment = new Line3(c1, c2);\n let segmentLength = lineSegment.distance();\n let midPoint = new Vector3();\n lineSegment.getCenter(midPoint);\n let validSeperation = segmentLength < this.maxSeperation;\n\n console.log(`Intersection in front: ${inFront}`);\n console.log(`Segment Distance: [${c1.distanceTo(p1)}, ${c2.distanceTo(p2)}]`);\n console.log(`Segment Distance Valid: ${validDistance}`);\n console.log(`Seperation Distance: ${segmentLength}`);\n console.log(`Seperation Distance Valid: ${validSeperation}`);\n\n // Midpoint sphere\n this.drawSphere(midPoint);\n\n // Segment line\n this.drawLine(c1, c2, 0xff00ff);\n\n // All conditions must be valid\n let valid = inFront && validDistance && validSeperation;\n\n return {\n \"point\": midPoint,\n \"valid\": valid\n };\n }\n}\n\nexport class GroundPlaneMeasurement {\n private viewer: Viewer;\n public maxDistance2D = imageOnlyDistance;\n\n constructor(viewer) {\n this.viewer = viewer;\n }\n\n getPosition(event) {\n let cameras = this.viewer.cameraList;\n\n let raycaster = new RayCaster(this.viewer, event);\n let direction = raycaster.vectorFromEvent(event);\n direction.setLength(this.maxDistance2D);\n\n let normal = new Vector3(0, 0, 1);\n let point = cameras.current.position.viewer;\n\n let lineStart = point.clone();\n let lineEnd = point.clone().add(direction);\n let line = new Line3(lineStart, lineEnd);\n\n point.z = point.z - cameras.current.height;\n let plane = new Plane().setFromNormalAndCoplanarPoint(\n normal, point);\n\n let intersect = new Vector3();\n let intersected = plane.intersectLine(line, intersect);\n if (!intersected) {\n return null;\n }\n\n return intersect;\n }\n}","import {\n Button,\n Card,\n CardContent,\n CardHeader,\n Collapse,\n createStyles,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n FormControlLabel,\n IconButton,\n InputLabel,\n List,\n makeStyles,\n Menu,\n MenuItem,\n Radio,\n RadioGroup,\n Select,\n Table,\n TableBody,\n TableCell,\n TableContainer,\n TableRow,\n Theme,\n Typography,\n useTheme\n} from '@material-ui/core';\nimport clsx from 'clsx';\nimport React, {useEffect, useState} from 'react';\nimport RotateRightIcon from '@material-ui/icons/RotateRight';\nimport {AerialAreaMeasurement, AerialMeasurement,\n Measurement3D, MeasurementArea, MeasurementPoint,\n MeasurementVolume} from '../viewer/js/measurements/measurement';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport InfoIcon from '@material-ui/icons/Info';\nimport EditIcon from '@material-ui/icons/Edit';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport ExpandLessIcon from '@material-ui/icons/ExpandLess';\nimport 'font-awesome/css/font-awesome.css';\nimport { nanoid } from '@reduxjs/toolkit';\nimport { AlertDialog, PromptDialog, TextDialog } from '../dialogs';\nimport { imageOnlyDistance } from '../viewer/js/measurements/image-only';\nimport unitConverter from '../viewer/js/utilities/unit-converter';\nimport { dialog, fs, isStaticSite } from \"../electron-modules\";\nimport { useSnackbar } from 'notistack';\nimport slash from 'slash';\nimport fileDialog from 'file-dialog';\nimport { useSelector, useDispatch } from 'react-redux';\nimport { selectMeasureUnits, changeMeasureUnits } from '../redux/projections-slice';\nimport LocalScene from '../viewer/js/projections';\nimport { ArrowTooltip } from '../tooltips';\nimport { DenseDivider, IconToolBar, ToolBarButton, ToolBarDivider } from '../toolbar';\nimport { Viewer } from '../viewer/js/main';\n\nconst copyTextToClipboard = require('copy-to-clipboard');\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n vertexWrapped: {\n float: \"right\"\n },\n textField: {\n marginBottom: theme.spacing(3)\n },\n userWarning: {\n padding: theme.spacing(2)\n },\n cardButtons: {\n marginTop: 0,\n alignSelf: \"center\"\n },\n card: {\n margin: '10px',\n userSelect: \"none\"\n },\n cardHovered: {\n transform: \"scale3d(1.01, 1.01, 1)\",\n transition: theme.transitions.create('transform', {\n duration: theme.transitions.duration.shortest,\n }),\n },\n footerDiv: {\n width: \"100%\",\n boxShadow: \"0px 10px 10px 2px\",\n zIndex: 1,\n textAlign: \"center\"\n },\n measurementUnitsParent: {\n justifyContent: \"center\"\n },\n measurementUnitsFlex: {\n flex: 1,\n justifyContent: \"center\"\n },\n measurementUnitsRadio: {\n paddingTop: theme.spacing(0.5),\n paddingBottom: theme.spacing(0.5)\n },\n imageOnlyInfoButton: {\n marginLeft: theme.spacing(1)\n },\n marginside: {\n margin: 0,\n padding: \"10px\"\n },\n actions: {\n padding: \"5px\"\n },\n expandText: {\n width: \"100%\",\n display: \"block\",\n textAlign: \"center\",\n cursor: \"pointer\",\n userSelect: \"none\",\n paddingBottom: \"5px\",\n paddingTop: \"5px\"\n },\n bold: {\n fontWeight: \"bold\"\n },\n tableContent: {\n backgroundColor: \"white\",\n padding: \"0px !important\",\n },\n cardHeader: {\n padding: \"10px\"\n },\n cell: {\n fontSize: \"0.75em\",\n padding: \"6px 10px\"\n },\n headerTitle: {\n fontWeight: \"bold\",\n cursor: \"pointer\"\n },\n calculateButton: {\n padding: \"2px 4px\",\n fontSize: \"0.7rem\"\n },\n recalculate: {\n display: \"flex\",\n flexDirection: \"row-reverse\",\n alignItems: \"center\"\n },\n recalculateButton: {\n padding: \"5px !important\"\n },\n copyClipboard: {\n cursor: \"pointer\"\n },\n measureList: {\n padding: \"0px\",\n overflow: \"auto\",\n flex: 1\n },\n lastTableRow: {\n borderBottom: \"0px\"\n },\n })\n);\n\nconst ExportDialog = (props) => {\n const viewer = props.viewer as Viewer;\n const {open, classes, onClose} = props;\n const [exportType, setExportType] = useState(\"csv\");\n const [ordering, setOrdering] = useState(\"xyz\");\n\n const onSubmit = () => {\n viewer?.exportMeasurements(exportType, ordering);\n onClose();\n };\n\n return (\n \n \n Measurements Export\n \n\n \n {/* Export type */}\n Export Type\n {\n setExportType(event.target.value as string);\n }}\n >\n CSV File\n Measure Data\n \n\n {exportType === \"csv\" && (\n \n {/* Ordering */}\n Ordering\n {\n setOrdering(event.target.value as string);\n }}\n >\n Easting, Northing, Elevation\n Northing, Easting, Elevation\n \n \n )}\n\n {exportType !== \"csv\" && (\n The file generated using \"Measure Data\" options can be\n re-imported as a new measurement group in any project\n )}\n \n\n \n \n \n Export\n \n \n \n );\n};\n\nconst MeasureTypeIcon = (props) => {\n const {type, icon, measureType, setMeasureType} = props;\n\n // Remove hyphen and capitalize each word\n const title = type\n .replace(\"-\", \" \")\n .replace(/(^\\w|\\s\\w)/g, m => m.toUpperCase());\n\n const onClick = () => {\n setMeasureType(type);\n };\n\n return (\n \n );\n};\n\nconst ImportExportIcon = (props) => {\n const {icon, onClick} = props;\n\n return (\n \n );\n};\n\nconst MeasurementCard = (props) => {\n const viewer = props.viewer as Viewer;\n const {measurement, classes, first} = props;\n\n const showMessage = useSnackbar().enqueueSnackbar;\n const [expanded, setExpanded] = useState(false);\n const [hover, setHover] = useState(false);\n const [renameOpen, setRenameOpen] = useState(false);\n const [deleteOpen, setDeleteOpen] = useState(false);\n\n const formatter = measurement.formatter;\n\n const onMouseOver = () => {\n setHover(true);\n };\n\n const onMouseLeave = () => {\n setHover(false);\n };\n\n const generateVertexPositions = () => {\n let rows = [];\n\n const precision = formatter.getVectorPrecision(LocalScene.viewProjection);\n const verticesReprojected = measurement.vertices.map(vertex => {\n return vertex.toViewProjection();\n });\n\n verticesReprojected.forEach((vertex, index) => {\n const x = vertex.x.toFixed(precision.x);\n const y = vertex.y.toFixed(precision.y);\n const z = vertex.z.toFixed(precision.z);\n\n let type = verticesReprojected.length > 1 ?\n `Vertex ${index + 1}` : \"Position\";\n\n rows.push({\n type: type,\n value: (\n {\n event.stopPropagation();\n let x = vertex.x.toFixed(precision.x);\n let y = vertex.y.toFixed(precision.y);\n let z = vertex.z.toFixed(precision.z);\n let text = `(${x}, ${y}, ${z})`;\n copyTextToClipboard(text);\n showMessage(\"Copied to clipboard\", {\n variant: \"success\"\n });\n }}\n >\n \n
\n X: {x}
\n Y: {y}
\n Z: {z}
\n
\n
\n \n )\n });\n });\n\n return rows;\n };\n\n const getVolumeResults = () => {\n let volumeValue = measurement.invalidVolumeMessage;\n\n if (measurement.valid) {\n if (measurement.calculating) {\n volumeValue = (\n \n Calculating...\n \n );\n } else if (measurement.calculated) {\n const value = formatter.formatVolume(measurement);\n volumeValue = (\n
\n
\n \n {\n event.stopPropagation();\n measurement.recalculate();\n }}\n >\n \n \n \n
\n );\n } else {\n volumeValue = (\n \n {\n event.stopPropagation();\n measurement.calculate();\n }}\n >\n Calculate\n \n \n );\n }\n }\n\n return volumeValue;\n };\n\n const generateMeasurementRows = () => {\n let rows = [];\n\n if (measurement instanceof MeasurementArea) {\n let areaValue = measurement.valid ?\n formatter.formatArea(measurement.area3D) :\n measurement.areaInvalidMessage;\n rows.push({type: \"Area\", value: areaValue});\n\n if (measurement instanceof MeasurementVolume) {\n let volumeValue = getVolumeResults();\n rows.push({type: \"Volume\", value: volumeValue});\n }\n } else if (measurement instanceof MeasurementPoint) {\n // Do nothing for points\n } else if (measurement instanceof Measurement3D) {\n rows.push({type: \"Distance (2D)\", value: formatter.formatLength(measurement.distance2D)});\n rows.push({type: \"Distance (3D)\", value: formatter.formatLength(measurement.distance3D)});\n rows.push({type: \"Grade\", value: formatter.formatGrade(measurement.grade)});\n rows.push({type: \"Angle\", value: formatter.formatAngle(measurement.angle)});\n } else if (measurement instanceof AerialMeasurement) {\n if (measurement instanceof AerialAreaMeasurement) {\n rows.push({\n type: measurement.displayType,\n value: formatter.formatArea(measurement.getValue())\n });\n } else {\n rows.push({\n type: measurement.displayType,\n value: formatter.formatLength(measurement.getValue())\n });\n }\n }\n\n if (measurement instanceof Measurement3D) {\n rows.push(...generateVertexPositions());\n }\n\n return rows;\n };\n\n const createMarkup = (content) => {\n if (typeof(content) === \"string\") {\n return content ?\n (
) :\n \"\";\n }\n\n return content;\n };\n\n const handleRenameSubmit = name => {\n setRenameOpen(false);\n viewer?.renameMeasurement(measurement, name);\n };\n\n const handleDeleteSubmit = () => {\n setDeleteOpen(false);\n viewer?.deleteMeasurement(measurement);\n };\n\n useEffect(() => {\n viewer?.updateMeasureHover(measurement, hover);\n }, [viewer, hover]);\n\n useEffect(() => {\n setExpanded(first);\n }, [first]);\n\n let rows = generateMeasurementRows();\n\n return (\n \n \n {/* Header */}\n \n {/* Expand/collapse measurement */}\n \n {\n event.stopPropagation();\n setExpanded(!expanded);\n }}\n >\n {expanded && }\n {!expanded && }\n \n \n\n {/* Rename measurement */}\n \n {\n event.stopPropagation();\n setRenameOpen(true);\n }}\n >\n \n \n \n\n {/* Delete measurement */}\n \n {\n event.stopPropagation();\n setDeleteOpen(true);\n }}\n >\n \n \n \n\n \n }\n title={measurement.title}\n titleTypographyProps={{\n variant: \"body2\",\n className: classes.headerTitle\n }}\n subheader={`Total Vertices: ${measurement.numVertices}`}\n subheaderTypographyProps={{\n variant: \"caption\"\n }}\n />\n\n {/* Expandable content */}\n \n \n\n {/* Measurement values table */}\n \n \n \n {rows.map((row, index) => {\n const isLastRow = index === (rows.length - 1);\n\n return (\n \n \n {row.type}\n \n\n \n {createMarkup(row.value)}\n \n\n \n );\n })}\n \n
\n
\n\n
\n
\n \n\n {/* Delete Dialog */}\n {\n setDeleteOpen(false);\n }}\n title=\"Delete entry?\"\n prompt=\"Do you want to delete this measurement?\"\n button=\"Delete\"\n />\n\n {/* Rename Dialog */}\n {\n setRenameOpen(false);\n }}\n title=\"Rename Measurement\"\n prompt=\"Enter new name\"\n default={measurement.title}\n label=\"Measurement Name\"\n />\n \n );\n};\n\nexport const Measurements = (props) => {\n const theme = useTheme();\n const classes = useStyles(theme);\n const dispatch = useDispatch();\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const viewer = props.viewer as Viewer;\n const {active, measurements} = props;\n\n const measurementUnits = useSelector(selectMeasureUnits);\n const [exportModalOpen, setExportModalOpen] = useState(false);\n const [measureType, setMeasureType] = useState(\"standard\");\n const [measureUnits, setMeasureUnits] = useState('m');\n const [contextState, setContextState] = useState({\n mouseX: null,\n mouseY: null,\n });\n\n const loadImportData = (text) => {\n let encoded = decodeURIComponent(text);\n let data = JSON.parse(encoded);\n let response = viewer.loadMeasurementData(data);\n\n if (response.success) {\n showMessage(response.message, {\n variant: \"success\"\n });\n } else {\n showMessage(response.message, {\n variant: \"error\"\n });\n }\n };\n\n const openImportElectron = () => {\n const fileFilter = viewer?.getMeasureExportType();\n\n dialog.showOpenDialog( {\n filters: fileFilter,\n properties: ['openFile']\n }).then(result => {\n if (result.canceled) {\n return;\n }\n\n if (result.filePaths) {\n const filePath = slash(result.filePaths[0]);\n fs.readFile(filePath, 'utf-8', (err, text) => {\n if (err) {\n dialog.showErrorBox('Error loading measurement data', 'An error occurred while loading the measurement file.');\n }\n\n loadImportData(text);\n });\n }\n }).catch(() => {\n dialog.showErrorBox('Error', 'An error occurred while loading the specified file.');\n });\n };\n\n const openImportBrowser = () => {\n const fileFilter = viewer?.getMeasureExportType();\n const fileType = fileFilter[0].extensions[0];\n\n fileDialog({accept: `.${fileType}`})\n .then(files => {\n if (files.length === 0) {\n return;\n }\n\n let reader = new FileReader();\n reader.onload = event => {\n let text = event.target.result;\n loadImportData(text);\n };\n reader.readAsText(files[0]);\n });\n };\n\n const openExportMenu = (event) => {\n setContextState({\n mouseX: event.clientX - 2,\n mouseY: event.clientY - 4,\n });\n };\n\n const closeExportMenu = () => {\n setContextState({\n mouseX: null,\n mouseY: null,\n });\n };\n\n const onExport = () => {\n closeExportMenu();\n setExportModalOpen(true);\n };\n\n const onImport = () => {\n closeExportMenu();\n\n if (isStaticSite) {\n openImportBrowser();\n } else {\n openImportElectron();\n }\n };\n\n const handleUnitsChange = (event) => {\n const value = event.target.value;\n dispatch(changeMeasureUnits(value));\n };\n\n useEffect(() => {\n viewer?.toggleMeasurements(active);\n viewer?.updateMeasureType(measureType);\n }, [viewer, active]);\n\n useEffect(() => {\n viewer?.updateMeasureType(measureType);\n }, [viewer, measureType]);\n\n useEffect(() => {\n setMeasureUnits(measurementUnits);\n viewer?.setMeasurementUnits(measurementUnits);\n }, [viewer, measurementUnits]);\n\n const reversed = [...measurements].reverse();\n const iconProps = {classes, measureType, setMeasureType};\n const menuOpen = contextState.mouseY !== null;\n const [imageOnlyWarningOpen, setImageOnlyWarningOpen] = useState(false);\n const anchorPosition = contextState.mouseY !== null && contextState.mouseX !== null\n ? { top: contextState.mouseY, left: contextState.mouseX }\n : undefined;\n\n const exportDisabled = measurements.length === 0;\n const importDisabled = viewer?.hasCameras || viewer?.hasPoints;\n const isImageOnly = viewer?.isImageOnly;\n\n const imageDistanceText = unitConverter.convert(imageOnlyDistance,\n 'm', measurementUnits).toFixed(2);\n\n return (\n \n {/* Measurement icons */}\n \n \n \n {(isImageOnly === false) && ()}\n {(isImageOnly === false) && ()}\n \n {(isImageOnly === false) && ()}\n \n \n \n\n \n\n {/* Measurement list */}\n \n {measurements.length === 0 && (\n No measurements have been added.\n )}\n\n {reversed.map((measurement, index) => {\n return (\n \n );\n })}\n \n\n {/* Measurement footer */}\n
\n\n {/* Measurement units */}\n
\n \n }\n label={Metric}\n />\n\n }\n label={Imperial}\n />\n \n
\n\n {/* Image only warning */}\n {isImageOnly && (
\n Image-only measurements enabled\n {\n setImageOnlyWarningOpen(true);\n }}\n >\n \n \n
)}\n\n
\n\n {/* Import/Export menu */}\n \n \n Export Measurements\n \n \n Import Measurements\n \n \n\n {/* Export Measurements */}\n {\n setExportModalOpen(false);\n }}\n />\n\n {/* Image only warning */}\n {\n setImageOnlyWarningOpen(false);\n }}\n >\n \n Image-only measurements are calculated by intersecting a flat plane at the approximate\n ground height, based on the provided \"sensor height\" project configuration value.\n \n
\n \n Due to the lowered accuracy further away from the camera position, the measurements\n clicks are restricted to {imageDistanceText}{measurementUnits} from the current\n camera position`\n \n \n
\n );\n};\n","import IconButton from \"@material-ui/core/IconButton\";\nimport ChevronLeftIcon from \"@material-ui/icons/ChevronLeft\";\nimport ChevronRightIcon from \"@material-ui/icons/ChevronRight\";\nimport {FolderList} from \"./folder/folder-list\";\nimport Drawer from \"@material-ui/core/Drawer\";\nimport React, { useState } from \"react\";\nimport {createStyles, makeStyles, Theme, useTheme} from \"@material-ui/core/styles\";\nimport { AppBar, Box, Tab } from \"@material-ui/core\";\nimport { PanelProps, TabPanel, TabProps } from \"./tabs\";\nimport Tabs from \"@material-ui/core/Tabs/Tabs\";\nimport { Measurements } from \"./measurements/measurements\";\nimport { PromptDialog } from \"./dialogs\";\nimport { Viewer } from \"./viewer/js/main\";\n\nexport const assetDrawerWidth = 280;\nexport const assetDrawerHeight = 75;\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n backdrop: {\n display: \"none\"\n },\n inside: {\n height: `${assetDrawerHeight}%`,\n display: \"flex\",\n overflow: \"hidden\",\n flexDirection: \"column\"\n },\n drawer: {\n width: 0,\n },\n drawerPaper: {\n width: assetDrawerWidth,\n },\n root: {\n \"z-index\": `${theme.zIndex.modal - 1} !important`\n },\n tab: {\n \"min-width\": \"0px !important\"\n },\n box: {\n padding: \"10px 0px 0px 0px !important\",\n height: \"calc(100% - 10px)\",\n overflow: \"auto\",\n display: \"flex\",\n flexDirection: \"column\"\n },\n tabGrow: {\n \"flex-grow\": 1\n },\n panel: {\n flex: 1,\n overflow: \"hidden\"\n }\n }),\n);\n\nexport const AssetDrawer = (props) => {\n const theme = useTheme();\n const classes = useStyles(theme);\n\n const viewer = props.viewer as Viewer;\n const {assetDrawerState, measurements, activeTab, setTabValue,\n tabsEnabled, setDefaultTab, setAssetDrawerState} = props;\n\n const [activeMeasurePrompt, setActiveMeasurePrompt] = useState(false);\n const [newTabValue, setNewTabValue] = useState(null);\n const [closeDrawer, setCloseDrawer] = useState(false);\n\n const measurementsOpen = activeTab === 1;\n const hasMeasurements = measurements.length > 0;\n\n const setActiveTab = (event, value) => {\n // Tab navigation disabled\n if (tabsEnabled === false) {\n return;\n }\n\n if (measurementsOpen && hasMeasurements) {\n setCloseDrawer(false);\n setNewTabValue(value);\n setActiveMeasurePrompt(true);\n return;\n }\n\n setTabValue(value);\n };\n\n const handleDrawerClose = () => {\n if (measurementsOpen && hasMeasurements) {\n setCloseDrawer(true);\n setNewTabValue(0);\n setActiveMeasurePrompt(true);\n return;\n }\n\n setDefaultTab();\n setAssetDrawerState(false);\n };\n\n const onModalClose = () => {\n setTabValue(newTabValue);\n\n if (closeDrawer) {\n setAssetDrawerState(false);\n }\n };\n\n const handleClose = () => {\n setActiveMeasurePrompt(false);\n };\n\n return (\n \n \n
\n \n \n \n \n \n \n \n {theme.direction === 'ltr' ? : }\n \n \n \n\n {/* Assets */}\n \n \n \n\n {/* Measurements */}\n \n \n \n\n
\n \n\n {/* Discard measurements dialog */}\n {\n onModalClose();\n handleClose();\n }}\n title=\"Discard measurements?\"\n prompt=\"Active measurements found, do you want to discard measurements?\"\n button=\"Discard\"\n />\n\n
\n );\n};","import {fsPromises, isStaticSite} from \"./electron-modules\";\n\ninterface TransformResponse {\n success: Boolean,\n content: any\n}\n\nexport const readTransformFile = (path: string): Promise => {\n return new Promise(async resolve => {\n const errorResponse = {\n success: false,\n content: 'Error reading camera correction .4x4 file'\n };\n\n if (!path) {\n resolve(errorResponse);\n return;\n }\n\n try {\n let data = isStaticSite ?\n await fetch(path).then(res => res.text()) :\n await fsPromises.readFile(path, {encoding: 'utf8'});\n\n let arr = [];\n let valid = true;\n let rows = data.split(\"\\n\");\n\n rows.forEach(row => {\n row = row.trim();\n if (row.length === 0) {\n return;\n }\n\n let cols = row.split(\" \");\n if (cols.length !== 4) {\n valid = false;\n }\n\n cols.forEach(col => {\n if (isNaN(col)) {\n valid = false;\n }\n arr.push(parseFloat(col));\n });\n });\n\n if (arr.length !== 16) {\n valid = false;\n }\n\n if (valid === false) {\n resolve(errorResponse);\n return;\n }\n\n const successResponse = {\n success: true,\n content: arr\n };\n\n resolve(successResponse);\n return;\n } catch {\n resolve(errorResponse);\n return;\n }\n });\n};","import React, {useEffect, useState} from 'react';\nimport {makeStyles, Theme, createStyles} from '@material-ui/core/styles';\nimport AppBar from '@material-ui/core/AppBar';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport Typography from '@material-ui/core/Typography';\nimport IconButton from '@material-ui/core/IconButton';\nimport MenuIcon from '@material-ui/icons/Menu';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport EditIcon from '@material-ui/icons/Edit';\nimport {\n changeName,\n selectName\n} from \"./redux/project-slice\";\nimport {useSelector, useDispatch} from 'react-redux';\nimport {Projection, changeData, changeView, selectData} from './redux/projections-slice';\nimport projections, {\n generateID,\n unknownProjectionFeet,\n unknownProjectionMeters,\n unknownTextFeet,\n unknownTextMeters\n} from './projections/projections';\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n FormControl,\n FormHelperText,\n InputLabel,\n ListSubheader,\n MenuItem,\n TextField\n} from '@material-ui/core';\nimport {assetDrawerWidth} from './asset-drawer';\nimport LocalScene, { infoToMeters, projectionUnits } from './viewer/js/projections';\nimport {dialog, isStaticSite} from \"./electron-modules\";\nimport { useSnackbar } from 'notistack';\nimport slash from 'slash';\nimport {\n changeBasicAdjustments,\n changeCameraHeight,\n changeCameraTransform,\n selectBasicAdjustments,\n selectCameraHeight,\n selectCameraTransform\n} from './redux/camera-slice';\nimport { readTransformFile } from './camera-utils';\nimport { ArrowTooltip } from './tooltips';\nimport { Viewer } from './viewer/js/main';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n warning: {\n color: theme.palette.warning.main\n },\n menuButton: {\n marginRight: theme.spacing(2),\n },\n title: {\n flexGrow: 1,\n },\n projectName: {\n display: 'flex',\n alignItems: 'center',\n padding: theme.spacing(0, 1),\n // necessary for content to be below app bar\n ...theme.mixins.toolbar,\n justifyContent: 'flex-start',\n flexGrow: 1\n },\n projectionText: {\n paddingTop: theme.spacing(0),\n marginTop: \"-5px\",\n color: \"white\"\n },\n transformMatrix: {\n maxWidth: \"60px\",\n paddingRight: \"10px\"\n },\n matrixColumn: {\n display: \"flex\",\n flexDirection: \"column\"\n },\n matrix: {\n display: \"flex\"\n },\n marginTop: {\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(1)\n },\n buttonDiv: {\n textAlign: \"right\"\n },\n button: {\n marginTop: theme.spacing(2),\n marginLeft: theme.spacing(1)\n },\n dropdown: {\n minWidth: 200,\n },\n offset: {\n marginLeft: assetDrawerWidth - 60\n },\n textField: {\n paddingBottom: theme.spacing(3)\n },\n matrixAndButtons: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n verticalButtons: {\n display: \"flex\",\n flexDirection: \"column\"\n }\n }),\n);\n\nconst openDialogMatrix = (): Promise => {\n return dialog.showOpenDialog( {\n filters: [\n {name: 'Camera Correction Matrix', extensions: [\"4x4\"]},\n ],\n properties: ['openFile']\n }).then(result => {\n if (result.canceled) {\n return null;\n }\n\n const filePath = slash(result.filePaths[0]);\n return filePath;\n }).catch(() => {\n dialog.showErrorBox('Error', 'An error occurred while loading the specified file.');\n return [];\n });\n};\n\nconst MatrixTextField = (props) => {\n const {value, classes} = props;\n\n /** Truncate and set fixed number of digits */\n const truncate = (number, digits=3) => {\n const multiplier = Math.pow(10, digits);\n return (Math.trunc(number * multiplier) / multiplier)\n .toFixed(digits);\n };\n\n return (\n \n \n \n );\n};\n\nconst MatrixRepresentation = (props) => {\n const {classes, cameraTransform} = props;\n const matrix = cameraTransform.matrix;\n\n return (\n
\n
\n \n \n \n \n
\n\n
\n \n \n \n \n
\n\n
\n \n \n \n \n
\n\n
\n \n \n \n \n
\n
\n );\n};\n\nconst ProjectDetails = (props) => { const dispatch = useDispatch();\n const classes = useStyles();\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const viewer = props.viewer as Viewer;\n const {assetDrawerState} = props;\n\n const [open, setOpen] = useState(false);\n const [warnOpen, setWarnOpen] = useState(false);\n const [name, setName] = useState(\"\");\n const [height, setHeight] = useState(0);\n const [proj, setProj] = useState(\"\");\n const [imported, setImported] = useState(null);\n const [cameraTransform, setCameraTransform] = useState({\n matrix: null,\n path: null\n });\n const [errors, setErrors] = useState({\n name: false,\n height: false,\n projection: false,\n correction: false\n });\n\n const projectName = useSelector(selectName);\n const projectHeight = useSelector(selectCameraHeight);\n const cameraTransformPath = useSelector(selectCameraTransform);\n const dataProjection = useSelector(selectData);\n const basicAdjustments = useSelector(selectBasicAdjustments);\n\n const getNewProjection = () => {\n let newProjection = null;\n if (proj === unknownTextMeters) {\n newProjection = unknownProjectionMeters;\n } else if (proj === unknownTextFeet) {\n newProjection = unknownProjectionFeet;\n } else {\n const results = data.filter(x => x.name === proj);\n if (results.length !== 1) {\n return;\n }\n newProjection = results[0];\n }\n return newProjection;\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n const handleWarnClose = () => {\n setWarnOpen(false);\n };\n\n const updateName = (event) => {\n const value = event.target.value;\n setErrors({...errors, name: false});\n setName(value);\n };\n\n const updateHeight = (event) => {\n const value = event.target.value;\n setErrors({...errors, height: false});\n setHeight(value);\n };\n\n const updateProj = (event) => {\n const value = event.target.value;\n setErrors({...errors, projection: false});\n setProj(value);\n };\n\n const onSubmit = () => {\n const trimmedName = name.trim();\n const emptyName = trimmedName === \"\";\n const emptyHeight = (height as any) === \"\";\n const emptyProjection = proj === \"\";\n\n setErrors({\n name: emptyName,\n height: emptyHeight,\n projection: emptyProjection,\n correction: false\n });\n\n if (emptyName || emptyProjection || emptyHeight) {\n return;\n }\n\n const heightInMeters = height * toMeters;\n\n setOpen(false);\n showMessage(\"Project details updated\", {\n variant: \"success\"\n });\n\n setTimeout(() => {\n dispatch(changeName(trimmedName));\n dispatch(changeCameraHeight(heightInMeters));\n dispatch(changeCameraTransform(cameraTransform.path));\n\n // Projection change requires a more strict check before dispatch\n const projName = selectedProjection.name;\n const projChanged = !LocalScene.currentProjection(projName);\n\n if (projChanged) {\n dispatch(changeData(selectedProjection));\n dispatch(changeView(selectedProjection));\n }\n }, 50);\n };\n\n const handleCollisions = () => {\n const name = dataProjection.name;\n if ((name === unknownTextFeet) || (name === unknownTextMeters)) {\n return;\n }\n\n if (imported?.name === name) {\n return;\n }\n\n const results = projections.data.filter(x => x.name === name);\n\n if (results.length > 0) {\n // Compare projection with existing projections\n const existing = results[0];\n const importedProjection = JSON.stringify(dataProjection, Object.keys(dataProjection).sort());\n const userProjection = JSON.stringify(existing, Object.keys(existing).sort());\n\n if (importedProjection === userProjection) {\n // Projections are the same, do nothing\n return;\n } else {\n // Projections are different, so we warn the user\n setWarnOpen(true);\n }\n }\n\n setImported({...dataProjection, imported: true});\n };\n\n const onCorrectionSelect = () => {\n openDialogMatrix().then(filePath => {\n if (!filePath) {\n return;\n }\n\n readTransformFile(filePath)\n .then(data => {\n const {success, content} = data;\n\n if (success) {\n setCameraTransform({\n path: filePath,\n matrix: content\n });\n } else {\n showMessage(content, {\n variant: \"error\"\n });\n }\n });\n });\n };\n\n const onCorrectionRemove = () => {\n setCameraTransform({\n path: null,\n matrix: null\n });\n };\n\n const updateTitle = (title) => {\n document.title = \"SOLV3D engine viewer - \" + title;\n };\n\n const clearBasicAlignment = () => {\n dispatch(changeBasicAdjustments({}));\n viewer?.resetBasicAlignerCamera();\n };\n\n useEffect(() => {\n setProj(dataProjection.name);\n }, [dataProjection]);\n\n useEffect(() => {\n setName(projectName);\n updateTitle(projectName);\n }, [projectName]);\n\n useEffect(() => {\n readTransformFile(cameraTransformPath)\n .then(data => {\n const {success, content} = data;\n\n if (success) {\n setCameraTransform({\n path: cameraTransformPath,\n matrix: content\n });\n } else {\n setCameraTransform({\n path: null,\n matrix: null\n });\n }\n });\n }, [cameraTransformPath]);\n\n useEffect(() => {\n const height = projectHeight / toMeters;\n setHeight(height);\n }, [open]);\n\n handleCollisions();\n\n const data = projections.data;\n data.sort((a, b) => {\n const name1 = a.name.toLowerCase();\n const name2 = b.name.toLowerCase();\n return (name1 < name2) ? -1 : ((name2 > name1) ? 1 : 0);\n });\n\n const matchingProjection = projections.data?.filter(\n x => x.name === dataProjection.name)[0];\n\n const defaultProjection = (dataProjection.name === unknownTextMeters)\n || (dataProjection.name === unknownTextFeet);\n\n const selectedProjection = getNewProjection();\n const units = projectionUnits(selectedProjection);\n const toMeters = infoToMeters(selectedProjection);\n const hasBasicAlignment = Object.keys(basicAdjustments).length !== 0;\n\n return (\n
\n \n \n {projectName}\n \n \n {dataProjection.name}\n \n \n\n {(!isStaticSite) && ( {\n setOpen(true);\n }}\n color={\"inherit\"}\n >\n \n )}\n\n \n Project Information\n \n {/* Project display title */}\n Title\n \n The display name of the project that is shown when users export/share the project data.\n \n \n\n {/* Camera height */}\n Camera Height ({units})\n \n The height of the camera from the ground. Used when displaying markers and for image-only measurements.\n \n \n\n {/* Projection dropdown */}\n Data Projection\n \n The projection that describes your input data (point cloud and images). Note that\n changing the projection will force a reload of data, and remove all active measurements.\n \n \n {imported && (Imported Projections)}\n\n {imported && ({imported.name})}\n\n Generic Projections\n\n {unknownTextMeters}\n\n {unknownTextFeet}\n\n User Projections\n\n {data.map(row => {\n const conflict = imported ? imported.name === row.name : false;\n const suffix = conflict ? \"__conflict\" : \"\";\n return ({row.name});\n })}\n \n\n {/* Camera Correction Matrix */}\n
\n Camera Correction File (Optional)\n\n {(!hasBasicAlignment) && (\n An optional camera correction matrix for misaligned cameras. This is only required if\n post-capture data alignment was done using the Data Alignment module.\n )}\n\n {(hasBasicAlignment) && (
\n \n Image and Point Cloud data currently have a basic alignment applied. Current Alignment\n must be cleared before applying correction matrix\n \n
)}\n\n
\n {cameraTransform.path && ()}\n\n
\n {cameraTransform.path && (\n Remove File\n )}\n\n {(!hasBasicAlignment) && (\n Upload File\n )}\n\n {(hasBasicAlignment) && (\n Clear Alignment\n )}\n
\n
\n\n
\n\n
\n {\n setOpen(false);\n }}\n className={classes.button}\n >\n Cancel\n \n\n \n Update Project\n \n
\n
\n \n\n {/* Warning message for projection mismatch */}\n \n {\"Projection Mismatch\"}\n \n \n The projection ({dataProjection.name}) imported from the project file does not match the\n user projection of the same name. To ensure compatability, the user projection will be disabled\n in the project edit screen.\n \n\n \n Imported Projection{dataProjection.transform ? \" (+ Custom Transform)\" : \"\"}\n

\n \"{dataProjection.string}\"\n
\n\n \n Existing Projection{matchingProjection?.transform ? \" (+ Custom Transform)\" : \"\"}\n

\n \"{matchingProjection?.string}\"\n
\n
\n \n \n \n \n
\n );\n};\n\nexport const MainAppBar = (props) => {\n const classes = useStyles();\n\n const viewer = props.viewer as Viewer;\n const {handleAssetDrawerOpen, handleSettingsDrawerOpen, assetDrawerState} = props;\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n );\n};","import React, {useCallback, useEffect, useState} from 'react';\nimport {createStyles, makeStyles, Theme, useTheme} from '@material-ui/core/styles';\nimport Drawer from '@material-ui/core/Drawer';\nimport { debounce } from 'throttle-debounce';\nimport {\n Avatar,\n FormControl,\n List,\n ListItem,\n MenuItem,\n Select,\n Switch,\n} from \"@material-ui/core\";\nimport IconButton from \"@material-ui/core/IconButton\";\nimport ChevronLeftIcon from \"@material-ui/icons/ChevronLeft\";\nimport ChevronRightIcon from \"@material-ui/icons/ChevronRight\";\nimport Divider from \"@material-ui/core/Divider\";\nimport Typography from \"@material-ui/core/Typography\";\nimport Slider from \"@material-ui/core/Slider\";\nimport {useSelector, useDispatch} from 'react-redux';\nimport {\n ColorMapKey, ColorType,\n selectCloudDistance, changeCloudDistance,\n selectOpacity, changeOpacity,\n selectOrthoOpacity, changeOrthoOpacity,\n selectCloudSize, changeCloudSize,\n selectHeightClip, changeHeightClip,\n selectIntensityClip, changeIntensityClip,\n selectColorMap, changeColorMap,\n selectColorType, changeColorType,\n selectDynamicSize, changeDynamicSize,\n selectAvailableClassifications, changeClassificationVisibility,\n selectClassificationVisibilities, changeAllClassificationVisibility,\n changeCircularPoints, selectCircularPoints,\n changeArrowMarkers, selectArrowMarkers, MarkerNavType,\n selectCloudMaxPoints, changeCloudMaxPoints\n} from './redux/settings-slice';\nimport {colorMaps} from \"./viewer/textures/colormaps\";\nimport { getClassificationColors } from \"./classifications\";\nimport { isDevMode } from './electron-modules';\nimport { selectAllAssets, getOrthoAssets } from './redux/assets-slice';\nimport { drawerWidth } from './app';\nimport { ArrowTooltip } from './tooltips';\nimport { Viewer } from './viewer/js/main';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n backdrop: {\n display: \"none\"\n },\n drawer: {\n width: 0,\n },\n drawerPaper: {\n width: drawerWidth,\n },\n asterisk: {\n \"&:after\": {\n content:'\"*\"',\n color: \"red\"\n }\n },\n drawerHeader: {\n display: 'flex',\n alignItems: 'center',\n padding: theme.spacing(0, 1),\n // necessary for content to be below app bar\n ...theme.mixins.toolbar,\n justifyContent: 'flex-start',\n },\n list: {\n width: '100%',\n maxWidth: 360,\n backgroundColor: theme.palette.background.paper,\n },\n listItem: {\n width: '100%',\n paddingRight: '5px',\n marginBottom: theme.spacing(0.5)\n },\n formControl: {\n width: '100%',\n marginBottom: theme.spacing(1)\n },\n switch: {\n marginLeft: 0\n },\n colorPreview: {\n height: theme.spacing(3),\n width: theme.spacing(3),\n marginRight: theme.spacing(1),\n },\n img: {\n objectFit: 'fill',\n transform: 'rotate(-90deg)'\n },\n classificationPreview: {\n height: theme.spacing(1.25),\n width: theme.spacing(1.25),\n backgroundColor: '#bbb',\n borderRadius: '50%',\n borderColor: '#000000',\n borderStyle: 'solid',\n borderWidth: '1px',\n marginRight: theme.spacing(1),\n display: 'inline-block'\n },\n switchLabel: {\n display: \"inline-block\"\n },\n switchElement: {\n float: \"right\"\n },\n boldTypography: {\n fontWeight: 'bold',\n display: \"inline-block\",\n fontSize: '1em'\n }\n }),\n);\n\nexport const SettingsDrawer = (props) => {\n const viewer = props.viewer as Viewer;\n\n const dispatch = useDispatch();\n const theme = useTheme();\n const classes = useStyles();\n const colorMap = useSelector(selectColorMap);\n const colorType = useSelector(selectColorType);\n const dynamicSize = useSelector(selectDynamicSize);\n const circularPoints = useSelector(selectCircularPoints);\n const arrowMarkers = useSelector(selectArrowMarkers);\n const availableClassifications = useSelector(selectAvailableClassifications);\n const classificationVisibilities = useSelector(selectClassificationVisibilities);\n const [classificationColors, setClassificationColors] = useState(Array(256).fill('#ffffff'));\n const assets = useSelector(selectAllAssets);\n const orthoFiles = getOrthoAssets(assets);\n\n const getClassifications = (classifications) => {\n if (classifications.length === 0) {\n return
\n \n \n No points loaded\n \n \n
;\n }\n\n return classifications.map(classification => (\n \n
\n
\n \n\n \n {`${classification.name} (${classification.id})`}\n \n\n {\n dispatch(changeClassificationVisibility(classification.id));\n }}\n />\n
\n
\n
\n ));\n };\n\n const dispatchInterval = 1000;\n\n /** Cloud Opacity */\n const opacity = useSelector(selectOpacity);\n const [opacitySliderValue, setOpacitySlider] = useState(0);\n const saveOpacity = useCallback(\n debounce(dispatchInterval, (value) => {\n dispatch(changeOpacity(value));\n }), []);\n\n /** Ortho Opacity */\n const orthoOpacity = useSelector(selectOrthoOpacity);\n const [orthoOpacitySliderValue, setOrthoOpacitySlider] = useState(0);\n const saveOrthoOpacity = useCallback(\n debounce(dispatchInterval, (value) => {\n dispatch(changeOrthoOpacity(value));\n }), []);\n\n /** Cloud Distance */\n const cloudDistance = useSelector(selectCloudDistance);\n const [distanceSliderValue, setDistanceSlider] = useState(0);\n const saveCloudDistance = useCallback(\n debounce(dispatchInterval, (value) => {\n dispatch(changeCloudDistance(value));\n }), []);\n\n /** Cloud Max Points */\n const cloudMaxPoints = useSelector(selectCloudMaxPoints);\n const [maxPointsSlider, setMaxPointsSlider] = useState(0);\n const saveCloudMaxPoints = useCallback(\n debounce(dispatchInterval, (value) => {\n dispatch(changeCloudMaxPoints(value));\n }), []);\n\n /** Cloud Size */\n const cloudSize = useSelector(selectCloudSize);\n const [cloudSizeSlider, setCloudSizeSlider] = useState(0);\n const saveCloudSize = useCallback(\n debounce(dispatchInterval, (value) => {\n dispatch(changeCloudSize(value));\n }), []);\n\n /** Height Range */\n const heightClip = useSelector(selectHeightClip);\n const [heightClipSlider, setHeightClipSlider] = useState({min: 0,max: 0});\n const saveHeightClip = useCallback(\n debounce(dispatchInterval, (value) => {\n dispatch(changeHeightClip(value));\n }), []);\n\n /** Intensity Range */\n const intensityClip = useSelector(selectIntensityClip);\n const [intensityClipSlider, setIntensityClipSlider] = useState({min: 0,max: 0});\n const saveIntensityClip = useCallback(\n debounce(dispatchInterval, (value) => {\n dispatch(changeIntensityClip(value));\n }), []);\n\n const updateOpacity = (value) => {\n setOpacitySlider(value);\n viewer?.setPointCloudOpacity(value);\n };\n\n const updateOrthoOpacity = (value) => {\n setOrthoOpacitySlider(value);\n viewer?.setOrthoOpacity(value);\n };\n\n const updateDistance = (value) => {\n setDistanceSlider(value);\n viewer?.setPointCloudDistance(value);\n };\n\n const updateMaxPoints = (value) => {\n setMaxPointsSlider(value);\n viewer?.setPointCloudMaxPoints(value);\n };\n\n const updateCloudSize = (value) => {\n setCloudSizeSlider(value);\n viewer?.setPointCloudSize(value);\n };\n\n const updateHeightClip = (value) => {\n setHeightClipSlider(value);\n viewer?.setPointCloudHeightClip(value);\n };\n\n const updateIntensityClip = (value) => {\n setIntensityClipSlider(value);\n viewer?.setPointCloudIntensityClip(value);\n };\n\n useEffect(() => {\n updateOpacity(opacity);\n }, [viewer, opacity]);\n\n useEffect(() => {\n updateOrthoOpacity(orthoOpacity);\n }, [viewer, orthoOpacity]);\n\n useEffect(() => {\n updateDistance(cloudDistance);\n }, [viewer, cloudDistance]);\n\n useEffect(() => {\n updateMaxPoints(cloudMaxPoints);\n }, [viewer, cloudDistance]);\n\n useEffect(() => {\n updateCloudSize(cloudSize);\n }, [viewer, cloudSize]);\n\n useEffect(() => {\n updateHeightClip(heightClip);\n }, [viewer, heightClip]);\n\n useEffect(() => {\n updateIntensityClip(intensityClip);\n }, [viewer, intensityClip]);\n\n useEffect(() => {\n viewer?.setVisibleClassifications(classificationVisibilities);\n }, [viewer, classificationVisibilities]);\n\n useEffect(() => {\n viewer?.setPointCloudColorMap(colorMap);\n }, [viewer, colorMap]);\n\n useEffect(() => {\n viewer?.setPointCloudColorType(colorType);\n }, [viewer, colorType]);\n\n useEffect(() => {\n viewer?.setPointCloudDynamicSize(dynamicSize);\n }, [viewer, dynamicSize]);\n\n useEffect(() => {\n viewer?.setPointCloudCircularPoints(circularPoints);\n }, [viewer, circularPoints]);\n\n useEffect(() => {\n viewer?.setNavigationType(arrowMarkers);\n }, [viewer, arrowMarkers]);\n\n useEffect(() => {\n getClassificationColors().then(result => {\n setClassificationColors(result);\n });\n }, []);\n\n const isIntensity = colorType === 0;\n const isHeightmap = colorType === 2;\n const colorMapRequired = isIntensity || isHeightmap;\n\n return (\n \n
\n \n {theme.direction === \"rtl\" ? (\n \n ) : (\n \n )}\n \n
\n\n \n\n {/* Point Cloud Controls */}\n \n \n \n Point Cloud Controls\n \n \n\n {/* Color type */}\n \n
\n \n Color Type\n \n \n {\n const value = event.target.value as ColorType;\n dispatch(changeColorType(value));\n }}\n >\n \n Intensity\n \n \n Color\n \n \n Height\n \n \n Classification\n \n \n \n
\n
\n\n {/* Color maps */}\n {colorMapRequired && (\n \n
\n \n Color Map\n \n \n \n colorMaps.find((colorMap) => colorMap.id === value).name\n }\n onChange={(event) => {\n const value = event.target.value as ColorMapKey;\n dispatch(changeColorMap(value));\n }}\n >\n {colorMaps.map((colorMap) => (\n \n \n {colorMap.name}\n \n ))}\n \n \n
\n
\n )}\n\n {/* Arrow Markers */}\n \n
\n \n Navigation\n \n \n {\n let value = event.target.value as MarkerNavType;\n dispatch(changeArrowMarkers(value));\n }}\n >\n \n Arrows\n \n \n Markers\n \n \n None\n \n \n \n
\n
\n\n {/* Cloud Opacity */}\n \n
\n \n Point Visibility\n \n {\n updateOpacity(value);\n saveOpacity(value);\n }}\n />\n
\n
\n\n {/* Cloud Max Points */}\n \n
\n \n \n Max Visible Points\n \n \n\n {\n updateMaxPoints(value);\n saveCloudMaxPoints(value);\n }}\n />\n
\n
\n\n {/* Cloud Distance */}\n \n
\n \n Distance\n \n {\n updateDistance(value);\n saveCloudDistance(value);\n }}\n />\n
\n
\n\n {/* Cloud Size */}\n \n
\n \n Size\n \n {\n updateCloudSize(value);\n saveCloudSize(value);\n }}\n />\n
\n
\n\n {/* Height range */}\n {isHeightmap && (\n \n
\n \n Height Range\n \n {\n let height = { min: value[0], max: value[1] };\n updateHeightClip(height);\n saveHeightClip(height);\n }}\n />\n
\n
\n )}\n\n {/* Intensity range */}\n {isIntensity && (\n \n
\n \n Intensity Range\n \n {\n let height = { min: value[0], max: value[1] };\n updateIntensityClip(height);\n saveIntensityClip(height);\n }}\n />\n
\n
\n )}\n\n {/* Dynamic size */}\n \n
\n \n \n Dynamic Point Sizing\n \n \n\n {\n dispatch(changeDynamicSize(checked));\n }}\n />\n
\n
\n\n {/* Circular Points */}\n \n
\n \n Circular Points\n \n\n {\n dispatch(changeCircularPoints(checked));\n }}\n />\n
\n
\n\n {/* Picker Debug */}\n {isDevMode && (\n \n
\n \n Picker Debug\n \n\n {\n viewer?.togglePickerDebug(checked);\n }}\n />\n
\n
\n )}\n \n\n {orthoFiles.length > 0 && (\n \n \n\n {/* Ortho Settings */}\n \n \n \n Orthomosaic Settings\n \n \n\n {/* Ortho opacity */}\n \n
\n \n Opacity\n \n {\n updateOrthoOpacity(value);\n saveOrthoOpacity(value);\n }}\n />\n
\n
\n \n
\n )}\n\n \n\n {/* Classifications */}\n\n \n \n
\n \n Classifications\n \n\n {availableClassifications.length > 0 && (\n \n classification.visible\n )}\n className={classes.switchElement}\n size=\"small\"\n color=\"secondary\"\n onChange={(_, checked) => {\n dispatch(changeAllClassificationVisibility(checked));\n }}\n />\n \n )}\n
\n
\n {getClassifications(availableClassifications)}\n
\n \n );\n};\n","import React from 'react';\nimport {\n createStyles,\n IconButton,\n makeStyles,\n Paper,\n Table,\n TableBody,\n TableCell,\n TableContainer,\n TableHead,\n TablePagination,\n TableRow,\n TableSortLabel,\n Theme\n} from '@material-ui/core';\nimport DeleteForeverIcon from '@material-ui/icons/DeleteForever';\nimport {useState} from 'react';\nimport clsx from 'clsx';\nimport { PromptDialog } from './dialogs';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n header: {\n fontWeight: \"bold\"\n },\n denseCell: {\n padding: \"4px 12px !important\",\n },\n footerDense: {\n height: theme.spacing(4),\n minHeight: \"0px\",\n overflow: \"hidden\"\n },\n hiddenSort: {\n border: 0,\n clip: 'rect(0 0 0 0)',\n height: 1,\n margin: -1,\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n top: 20,\n width: 1,\n },\n noSelect: {\n userSelect: \"none\"\n },\n rowDisabled: {\n \"& th\": {\n color: \"lightgray\"\n },\n \"& td\": {\n color: \"lightgray\"\n }\n },\n break: {\n wordBreak: \"break-word\"\n },\n rowHover: {\n cursor: \"pointer\"\n }\n }),\n);\n\nconst EnhancedTableHead = (props) => {\n const {classes, order, orderBy, onRequestSort, columns,\n deletable, isDense, isSortable} = props;\n\n const createSortHandler = (property) => (event) => {\n onRequestSort(event, property);\n };\n\n const cellClassName = isDense ? classes.denseCell : \"\";\n\n return (\n \n \n {columns.map((column, index) => (\n \n {/* Non-sortable column header */}\n {(isSortable === false) && (column.label)}\n\n {/* Sortable column header */}\n {(isSortable === true) && (\n {column.label}\n {orderBy === column.id ? (\n \n {order === 'desc' ? 'sorted descending' : 'sorted ascending'}\n \n ) : null}\n )}\n \n ))}\n {deletable && ()}\n \n \n );\n};\n\nconst EnhancedTable = (props) => {\n const {columns, rows, rowType, onRowClick, deletable,\n onDeleteClick, dense, pageSize, defaultSort, sortable,\n wordBreak, ...other} = props;\n\n const classes = useStyles();\n\n const numRowsPerPage = pageSize !== undefined ? pageSize : 5;\n const isSortable = sortable !== undefined ? sortable : true;\n\n const [open, setOpen] = useState(false);\n const [order, setOrder] = useState('asc');\n const [orderBy, setOrderBy] = useState(defaultSort);\n const [selectedRow, setSelectedRow] = useState();\n const [page, setPage] = useState(0);\n const [rowsPerPage, setRowsPerPage] = useState(numRowsPerPage);\n\n const handleClose = () => {\n setOpen(false);\n setSelectedRow(null);\n };\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeRowsPerPage = (event) => {\n setRowsPerPage(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleRequestSort = (event, property) => {\n const isAsc = orderBy === property && order === 'asc';\n setOrder(isAsc ? 'desc' : 'asc');\n setOrderBy(property);\n };\n\n const descendingComparator = (a, b, orderBy) => {\n let compA = a[orderBy];\n let compB = b[orderBy];\n\n if (typeof compA === \"string\") {\n compA = compA.toLowerCase();\n }\n\n if (typeof compB === \"string\") {\n compB = compB.toLowerCase();\n }\n\n if (compB < compA) {\n return -1;\n } else if (compB > compA) {\n return 1;\n } else {\n return 0;\n }\n };\n\n const getComparator = (order, orderBy) => {\n return order === 'desc'\n ? (a, b) => descendingComparator(a, b, orderBy)\n : (a, b) => -descendingComparator(a, b, orderBy);\n };\n\n // Make sure our max page is valid\n const maxPage = Math.max(0, Math.ceil(rows.length / rowsPerPage) - 1);\n if (page > maxPage) {\n setPage(maxPage);\n }\n\n if (isSortable) {\n // Sort based on sort criteria\n rows.sort(getComparator(order, orderBy));\n }\n\n let sliced = rows.slice(\n page * rowsPerPage,\n page * rowsPerPage + rowsPerPage\n );\n\n const isDense = dense === true;\n const cellClassName = isDense ? classes.denseCell : \"\";\n const footerClassName = isDense ? classes.footerDense : \"\";\n\n const cellContent = (content, condition) => {\n if (typeof(content) === \"string\") {\n content = condition ? content : `${content.slice(0,100)}...`;\n }\n return content;\n };\n\n const cellTitle = (content) => {\n return (typeof(content) === \"string\") ? content : \"\";\n };\n\n return (\n
\n \n \n \n \n \n {sliced.map((row, index) => {\n const isItemSelected = selectedRow === row;\n const disabled = row.disabled === true;\n\n return (\n \n {columns.map((column, index) => {\n const key = `${row.id}${column.id}`;\n const first = index === 0;\n const text = row[column.id];\n const condition = (column.numeric || text.length <= 100);\n const showHover = index === 1 && text !== 'No File'; \n \n return ( {\n if (disabled) {\n return;\n }\n onRowClick(row, index);\n }}\n className={clsx(cellClassName, {\n [classes.break]: wordBreak, \n [classes.rowHover]: showHover\n })}\n title={cellTitle(showHover ? 'Jump to image' : text)}\n >\n {cellContent(text, condition)}\n );\n })}\n\n {deletable && disabled && (\n \n )}\n\n {/* Delete button */}\n {deletable && (disabled===false) && (\n \n {\n setOpen(true);\n setSelectedRow(row);\n }}\n >\n \n \n \n )}\n\n \n );\n })}\n \n \n \n \n \n\n {/* Delete Dialog */}\n {\n onDeleteClick(selectedRow);\n handleClose();\n }}\n title=\"Delete entry?\"\n prompt={`Do you want to delete this ${rowType}?`}\n button=\"Delete\"\n />\n
\n );\n};\n\nexport default EnhancedTable;","import React, {useEffect} from 'react';\nimport clsx from 'clsx';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport MuiDialogContent from '@material-ui/core/DialogContent';\nimport IconButton from '@material-ui/core/IconButton';\nimport CloseIcon from '@material-ui/icons/Close';\nimport {createStyles, makeStyles, Theme} from \"@material-ui/core/styles\";\nimport projections, {defaultProjection, defaultTransform, generateID} from './projections';\nimport EnhancedTable from '../enhanced-table';\nimport {useState} from 'react';\nimport {\n AppBar,\n Checkbox,\n Divider,\n FormControlLabel,\n Grid,\n InputAdornment,\n InputLabel,\n MenuItem,\n Select,\n Tab,\n Tabs,\n TextField,\n Typography\n} from '@material-ui/core';\nimport LocalScene, { isValidProjection } from '../viewer/js/projections';\nimport { PanelProps, TabPanel, TabProps } from '../tabs';\nimport { useSnackbar } from 'notistack';\nimport { ipcRenderer } from '../electron-modules';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n title: {\n margin: 0,\n padding: theme.spacing(1,2,1,2),\n },\n content: {\n padding: theme.spacing(0),\n paddingTop: \"0px !important\"\n },\n titleClose: {\n position: 'absolute',\n right: theme.spacing(0),\n color: theme.palette.grey[500],\n },\n userWarning: {\n padding: theme.spacing(3)\n },\n marginTop: {\n marginTop: theme.spacing(2)\n },\n marginBottom: {\n marginBottom: theme.spacing(2)\n },\n adornedEnd: {\n paddingRight: theme.spacing(0)\n },\n utmButton: {\n marginLeft: theme.spacing(1)\n },\n selectMargin: {\n margin: theme.spacing(1),\n },\n button: {\n marginTop: theme.spacing(2),\n marginLeft: theme.spacing(1)\n },\n dropdown: {\n minWidth: 200,\n },\n formControl: {\n width: '100%'\n },\n buttonDiv: {\n textAlign: \"right\"\n },\n panel: {\n background: \"rgba(200,200,200,0.1)\"\n }\n }),\n);\n\nconst UserProjectionPanel = (props) => {\n const {classes, loadProjectionToEdit, setActiveTab, showMessage} = props;\n\n // Table headers\n const columns = [\n {id: 'name', numeric: false, label: 'Projection Name'},\n {id: 'type', numeric: false, label: 'Type'},\n {id: 'custom', numeric: false, label: 'Custom'},\n ];\n\n // Convert projections to data row\n const data = projections.data;\n const rows = data.map(option => {\n return {\n id: generateID(option.name),\n name: option.name,\n custom: option.transform ? \"Yes\" : \"No\",\n type: option.type,\n disabled: LocalScene.currentProjection(option.name)\n };\n });\n\n const onRowClick = (row) => {\n const results = data.filter(x => x.name === row.name);\n if (results.length !== 1) {\n return;\n }\n\n const projection = results[0];\n loadProjectionToEdit(projection, false);\n setActiveTab(1);\n };\n\n const onDeleteClick = (row) => {\n const results = data.filter(x => x.name === row.name);\n if (results.length !== 1) {\n return;\n }\n\n // Delete projection + force reload\n const projection = results[0];\n projections.delete(projection.name);\n showMessage(\"Projection deleted\", {\n variant: \"error\"\n });\n\n // Force projection list refresh\n setActiveTab(0);\n };\n\n return (\n
\n {rows.length === 0 && (\n No user projections have been added. Click on \"Add New\" to add a custom\n projection or \"Search Online\" to look up common results\n )}\n\n {rows.length > 0 && ()}\n
\n );\n};\n\nconst EditPanel = (props) => {\n const {classes, customProjection, updateEditableValues,\n transformCheckbox, setTransformCheckbox, clearProjectionValues,\n newProjection, setActiveTab, existingName, showMessage, errors,\n setErrors} = props;\n\n const name = customProjection.name;\n const type = customProjection.type;\n const projString = customProjection.string;\n\n const transform = customProjection.transform;\n const origin = transform.origin;\n const translate = transform.translation;\n const rotation = transform.rotation;\n const scale = transform.scale;\n\n const handleChecked = (event) => {\n setTransformCheckbox(event.target.checked);\n };\n\n const saveProjection = () => {\n // Remove excess whitespace from name and string\n let nameTrim = name.trim();\n let stringTrim = projString.trim();\n\n let nameError = nameTrim === \"\";\n let stringError = stringTrim === \"\";\n setErrors({\n name: nameError,\n string: stringError\n });\n\n if (nameError || stringError) {\n return;\n }\n\n // Create copy of our data\n let data = JSON.parse(JSON.stringify(customProjection));\n\n // Use trimmed versions of name and string\n data.name = nameTrim;\n data.string = stringTrim;\n\n if (!transformCheckbox) {\n delete data.transform;\n }\n\n const nameChanged = data.name !== existingName;\n\n // Check for duplicates if our name has changed\n if (nameChanged) {\n if (projections.isDuplicate(data)) {\n setErrors({...errors, name: true});\n showMessage(\"Duplicate projection (name already exists)\", {\n variant: \"error\"\n });\n return;\n }\n }\n\n // Check for valid projection string\n let validProjection = isValidProjection(projString);\n if (!validProjection) {\n setErrors({...errors, string: true});\n showMessage(\"Invalid projection string\", {\n variant: \"error\"\n });\n return;\n }\n\n // Delete existing projection\n if (!newProjection) {\n projections.delete(existingName);\n }\n\n // Save new projection\n const success = projections.save(data);\n if (!success) {\n return;\n }\n\n showMessage(`Projection ${newProjection ? \"added\" : \"updated\"}`, {\n variant: \"success\"\n });\n\n if (newProjection) {\n clearProjectionValues();\n } else {\n setActiveTab(0);\n }\n };\n\n const updateType = (event) => {\n // Update projection type and clear projection string\n updateEditableValues({\n 'type': String(event.target.value),\n 'string': \"\"\n });\n };\n\n const updateName = (event) => {\n setErrors({...errors, name: false});\n updateEditableValues({\n \"name\": event.target.value\n });\n };\n\n const updateString = (event) => {\n let string = event.target.value;\n if (customProjection['type'] === \"epsg\") {\n string = `EPSG:${string}`;\n }\n setErrors({...errors, string: false});\n updateEditableValues({\n \"string\": string\n });\n };\n\n const updateOrigin = (event, index) => {\n const value = parseFloat(event.target.value);\n let transform = customProjection.transform;\n transform['origin'][index] = value;\n updateEditableValues({\n \"transform\":transform\n });\n };\n\n const updateTranslation = (event, index) => {\n const value = parseFloat(event.target.value);\n let transform = customProjection.transform;\n transform['translation'][index] = value;\n updateEditableValues({\n \"transform\":transform\n });\n };\n\n const updateScale = (event) => {\n let transform = customProjection.transform;\n transform['scale'] = parseFloat(event.target.value);\n updateEditableValues({\n \"transform\":transform\n });\n };\n\n const updateRotation = (event) => {\n let transform = customProjection.transform;\n transform['rotation'] = parseFloat(event.target.value);\n updateEditableValues({\n \"transform\":transform\n });\n };\n\n return (\n
\n {/* Projection Name */}\n \n\n {/* Projection Type */}\n
\n \n Projection Type\n \n \n Projection String (Proj4)\n Well Known Text (WKT)\n {/*EPSG Code*/}\n \n
\n\n {/* Projection string (proj4) */}\n {type===\"proj4\" && ()}\n\n {/* Projection string (WKT) */}\n {type===\"wkt\" && ()}\n\n {/* EPSG Code */}\n {type===\"epsg\" && (EPSG:,\n }}\n className={classes.marginTop}\n />)}\n\n \n }\n label=\"Additional Parameters\"\n />\n\n {transformCheckbox && (\n {/* Origin */}\n \n \n {\n updateOrigin(e, 0);\n }}\n InputLabelProps={{\n shrink: true,\n }}\n />\n \n \n {\n updateOrigin(e, 1);\n }}\n InputLabelProps={{\n shrink: true,\n }}\n />\n \n \n {\n updateOrigin(e, 2);\n }}\n InputLabelProps={{\n shrink: true,\n }}\n />\n \n \n\n {/* Translation */}\n \n \n {\n updateTranslation(e, 0);\n }}\n InputLabelProps={{\n shrink: true,\n }}\n />\n \n \n {\n updateTranslation(e, 1);\n }}\n InputLabelProps={{\n shrink: true,\n }}\n />\n \n \n {\n updateTranslation(e, 2);\n }}\n InputLabelProps={{\n shrink: true,\n }}\n />\n \n \n\n {/* Rotation and scaling */}\n \n \n \n \n\n \n \n \n \n )}\n\n
\n {!newProjection && ( {\n setActiveTab(0);\n }}\n className={classes.button}\n >\n Cancel\n )}\n\n \n {newProjection ? \"Add Projection\" : \"Save Changes\"}\n \n
\n
\n );\n};\n\nconst SearchPanel = (props) => {\n const {classes, setActiveTab, loadProjectionToEdit} = props;\n\n const [type, setType] = useState(\"text\");\n const [searchTerm, setSearchTerm] = useState(\"\");\n const [hemisphere, setHemisphere] = useState(\"N\");\n const [searching, setSearching] = useState(false);\n const [searchResults, setSearchResults] = useState([]);\n\n const handleChange = (event) => {\n setType(event.target.value);\n };\n\n const handleHemisphere = (event) => {\n setHemisphere(event.target.value);\n };\n\n const handleString = (event) => {\n setSearchTerm(event.target.value);\n };\n\n const searchOnline = () => {\n if (searchTerm === \"\") {\n return;\n }\n\n let value = searchTerm;\n if (type === \"utm\") {\n value = `utm ${value}${hemisphere}`;\n }\n\n\n getProjections(value);\n };\n\n const getProjections = (searchText, pageNumber = 1, previousResults = [], maxPageNumber = 10) => {\n if (pageNumber === 1) {\n setSearchResults([]);\n setSearching(true);\n }\n\n const text = type !== \"epsg\" ?\n `${searchText} kind:PROJCRS` :\n searchText;\n\n const url = \"https://epsg.io/?q=\" + text + \"&format=json&page=\" + pageNumber;\n\n fetch(url)\n .then(response => response.json())\n .then(data => {\n const results = data.results;\n const parsed = [];\n\n results.forEach(result => {\n if (type === \"epsg\") {\n if (result.code !== searchText) {\n return;\n }\n }\n\n if (result.proj4 === \"\") {\n return;\n }\n\n parsed.push(result);\n });\n\n const combined = [...previousResults, ...parsed];\n setSearchResults(combined);\n\n if ((results.length > 0) && (pageNumber < maxPageNumber)) {\n setTimeout(() =>{\n getProjections(searchText, pageNumber + 1, combined);\n }, 250);\n } else {\n setSearching(false);\n }\n });\n };\n\n const onRowClick = (row) => {\n loadProjectionToEdit({\n type: \"proj4\",\n name: row.name,\n string: row.proj4\n }, true);\n setActiveTab(1);\n };\n\n // Table headers\n const columns = [\n {id: 'name', numeric: false, label: 'Name'},\n {id: 'epsg', numeric: true, label: 'EPSG'},\n {id: 'proj4', numeric: false, label: 'Proj4 String'},\n ];\n\n // Convert projections to data row\n const data = searchResults;\n const rows = data.map(projection => {\n return {\n id: generateID(projection.name),\n name: projection.name,\n epsg: parseInt(projection.code),\n proj4: projection.proj4,\n };\n });\n\n return (\n
\n {/* Search Type */}\n
\n \n Search Type\n \n \n Text\n UTM Zone\n EPSG Code\n \n
\n\n {/* UTM Zone */}\n {type===\"utm\" && (
\n UTM Zone,\n\n classes: {\n adornedEnd: classes.adornedEnd\n }\n }}\n className={classes.marginTop}\n />\n\n \n North\n South\n \n\n
)}\n\n {/* EPSG Code */}\n {type===\"epsg\" && (EPSG:,\n }}\n className={classes.marginTop}\n />)}\n\n {/* Projection string (proj4) */}\n {type===\"text\" && ()}\n\n {/* Search button */}\n
\n \n {searching ? \"Searching EPSG.io...\" : \"Search Online\"}\n \n
\n\n {/* Results table */}\n
\n
\n );\n};\n\nexport const ProjectionsManager = (props) => {\n const {projectionsOpen, setProjectionsOpen} = props;\n\n const classes = useStyles();\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const [existingName, setExistingName] = useState(\"\");\n const [newProjection, setNewProjection] = useState(false);\n const [activeTab, setTabValue] = useState(0);\n const [customProjection, setCustomProjection] = useState({});\n const [transformCheckbox, setTransformCheckbox] = useState(false);\n const [errors, setErrors] = useState({});\n\n const setActiveTab = (value) => {\n if (value === 0) {\n clearProjectionValues();\n }\n\n setTabValue(value);\n };\n\n const clearAllErrors = () => {\n setErrors({\n name: false,\n string: false\n });\n };\n\n const updateEditableValues = (newValues) => {\n const combined = {...customProjection, ...newValues};\n setCustomProjection(combined);\n };\n\n const clearProjectionValues = () => {\n loadProjectionToEdit(defaultProjection, true);\n };\n\n const loadProjectionToEdit = (projectionData, newProjection) => {\n const dataCopy = JSON.parse(JSON.stringify(projectionData));\n const hasTransform = dataCopy.hasOwnProperty(\"transform\");\n if (!hasTransform) {\n const transformCopy = JSON.parse(JSON.stringify(defaultTransform));\n dataCopy.transform = transformCopy;\n }\n\n clearAllErrors();\n setTransformCheckbox(hasTransform);\n setCustomProjection({...dataCopy});\n setExistingName(dataCopy.name);\n setNewProjection(newProjection);\n };\n\n const handleOpen = () => {\n setProjectionsOpen(true);\n };\n\n const handleClose = () => {\n setProjectionsOpen(false);\n };\n\n const handleChange = (event, newactiveTab) => {\n setActiveTab(newactiveTab);\n };\n\n useEffect(() => {\n ipcRenderer?.on(\"open-projection-manager\", () => {\n handleOpen();\n });\n }, []);\n\n useEffect(() => {\n // Load default projection for debug purposes\n clearProjectionValues();\n clearAllErrors();\n }, []);\n\n const tabLabel = newProjection ? \"Add New\" : \"Edit Existing\";\n\n return (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n\n {/* Existing projections */}\n \n \n \n\n {/* Custom projections */}\n \n \n \n\n {/* Online projection search */}\n \n \n \n\n \n \n
\n );\n};\n","import {configureStore, combineReducers} from '@reduxjs/toolkit';\nimport thunk from 'redux-thunk';\nimport projectReducer from './project-slice';\nimport foldersReducer from './folders-slice';\nimport assetsReducer from './assets-slice';\nimport projectionsReducer from './projections-slice';\nimport settingsReducer from './settings-slice';\nimport cameraReducer from './camera-slice';\n\nconst appReducer = combineReducers({\n project: projectReducer,\n camera: cameraReducer,\n folders: foldersReducer,\n projections: projectionsReducer,\n settings: settingsReducer,\n assets: assetsReducer\n});\n\nconst rootReducer = (state, action) => {\n const newProject = action.type === 'NEW';\n const loadConfig = action.type === 'LOAD';\n\n if (loadConfig) {\n state = action.payload;\n }\n\n if (newProject) {\n state = undefined;\n }\n\n let modified = appReducer(state, action);\n\n if (newProject || loadConfig) {\n modified = appReducer(state, {\n type: \"project/refreshModified\",\n payload: null\n });\n }\n\n return modified;\n};\n\nexport const store = configureStore({\n reducer: rootReducer,\n middleware: [thunk],\n});","import {store} from './redux/store';\nimport {defaultProjectTitle, changeName, changePath, currentConfigVersion} from './redux/project-slice';\nimport {dialog, fs, app, isStaticSite, ipcRenderer} from './electron-modules';\nimport slash from 'slash';\nimport path from 'path';\nimport {isEqual} from 'lodash';\n\nexport const projectFileType = \"json\";\nconst filterFilter = [{name: 'Engine Viewer Projects', extensions: [projectFileType]}];\n\nexport const saveProjectAs = () => {\n return dialog.showSaveDialog({\n title: \"Save Project\",\n defaultPath: `${store.getState().project.name}.json`,\n filters: filterFilter,\n }).then((result) => {\n if (result.canceled) {\n return false;\n }\n\n const savePath = slash(result.filePath);\n store.dispatch(changePath(savePath));\n // update the title of the project to the filename\n if (store.getState().project.name === defaultProjectTitle) {\n // get filename from path\n const fileName = path.basename(savePath);\n const extension = path.extname(savePath);\n const nameWithoutExt = path.basename(fileName, extension);\n store.dispatch(changeName(nameWithoutExt));\n }\n\n const state = store.getState();\n writeProject(state);\n return true;\n }).catch(() => {\n dialog.showErrorBox('Error saving project', 'An error occurred while saving the project.');\n return false;\n });\n};\n\nexport const saveProject = (allowSaveAs = true) => {\n return new Promise(resolve => {\n const state = store.getState();\n\n if (state.project.path === '') {\n if (allowSaveAs) {\n saveProjectAs().then(result => {\n resolve(result);\n });\n }\n return;\n } else {\n writeProject(state);\n resolve(true);\n }\n });\n};\n\nexport const loadProjectJSON = (data) => {\n const projectJSON = JSON.parse(data);\n\n store.dispatch({\n type: 'LOAD',\n payload: projectJSON\n });\n};\n\nexport const loadProjectFile = (filePath) => {\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n\n // Update json path based on where the json was loaded from\n let projectJSON = JSON.parse(data);\n projectJSON.project.path = filePath;\n\n const jsonConfigVersion = projectJSON.project.configVersion;\n\n // Update the loadJSON state\n projectJSON.assets.forEach((asset, index) => {\n projectJSON.assets[index].fromJSON = true;\n });\n\n if (jsonConfigVersion !== currentConfigVersion) {\n const versionOld = (jsonConfigVersion % 1.0 === 0.0)\n ? jsonConfigVersion.toFixed(1)\n : jsonConfigVersion;\n\n const versionNew = (currentConfigVersion % 1.0 === 0.0)\n ? currentConfigVersion.toFixed(1)\n : currentConfigVersion;\n\n alert(`Invalid config version (${versionOld}). Latest version is ${versionNew}`);\n return false;\n }\n\n const projectString = JSON.stringify(projectJSON);\n loadProjectJSON(projectString);\n return true;\n } catch (err) {\n alert('Error loading project');\n return false;\n }\n};\n\nexport const loadProject = () => {\n dialog.showOpenDialog({\n properties: ['openFile'],\n filters: filterFilter\n }).then(result => {\n if (result.canceled) {\n return;\n }\n\n const filePath = slash(result.filePaths[0]);\n loadProjectFile(filePath);\n }).catch(error => {\n console.log(error);\n });\n};\n\nexport const newProject = () => {\n dialog.showMessageBox({\n type: 'question',\n title: 'Create new project?',\n message: 'Any unsaved changes to your current project will be lost.',\n buttons: ['Cancel', 'Create new project'],\n noLink: true\n }).then(result => {\n if (result.response === 0) {\n return;\n }\n\n store.dispatch({type: 'NEW'});\n });\n};\n\nconst writeProject = (state) => {\n const name = state.project.path;\n const string = JSON.stringify(state, null, 2);\n\n fs.writeFile(name, string, (err) => {\n if (err) {\n throw Error('an error occurred while saving the project');\n }\n });\n};\n\nif (!isStaticSite) {\n ipcRenderer.on(\"save-project\", () => {\n const state = store.getState();\n\n if (state.project.path !== \"\") {\n const data = fs.readFileSync(state.project.path, \"utf8\");\n let projectJSON = JSON.parse(data);\n projectJSON.project.modified = state.project.modified;\n }\n\n saveProject().then((saved) => {\n\n if (saved) {\n app.exit();\n }\n });\n });\n\n ipcRenderer.on(\"project-changed\", () => {\n const state = store.getState();\n let hasChanged = true;\n\n if (state.project.path !== \"\") {\n const data = fs.readFileSync(state.project.path, \"utf8\");\n let projectJSON = JSON.parse(data);\n projectJSON.project.modified = state.project.modified;\n hasChanged = !isEqual(state, projectJSON);\n } else if (!state.assets.length) {\n app.exit();\n };\n\n ipcRenderer.send('should-save', hasChanged );\n });\n}\n","import React, {useEffect, useState} from 'react';\nimport Button from '@material-ui/core/Button';\nimport IconButton from '@material-ui/core/IconButton';\nimport {createStyles, makeStyles, Theme} from \"@material-ui/core/styles\";\nimport {Checkbox} from \"@material-ui/core\";\nimport ControlPointIcon from '@material-ui/icons/ControlPoint';\nimport EnhancedTable from '../enhanced-table';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport Typography from '@material-ui/core/Typography';\nimport { useSelector, useDispatch } from 'react-redux';\nimport { AlertDialog, DraggableDialog, PromptDialog } from '../dialogs';\nimport { PythonExecutable } from '../executable';\nimport { app, csv, ipcRenderer } from '../electron-modules';\nimport { useSnackbar } from 'notistack';\nimport { Box, DialogContentText } from '@material-ui/core';\nimport clsx from 'clsx';\nimport path from 'path';\nimport {\n changeBasicAdjustments,\n changeCameraTransform,\n selectBasicAdjustments,\n selectCameraTransform,\n selectActiveCamera\n} from '../redux/camera-slice';\nimport { saveProject } from '../project-utils';\nimport { selectAllAssets, getCameraFileAssets } from '../redux/assets-slice';\nimport { Viewer } from '../viewer/js/main';\nimport { pointObsColor, imageObsColor } from '../viewer/js/image-aligner/image-aligner';\n\nconst highCutoff = 1.0;\nconst lowCutoff = 0.5;\nconst requiredRows = 5;\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n minHeightContent: {\n minHeight: \"100px\"\n },\n toggleOptionParent: {\n margin: theme.spacing(0),\n padding: theme.spacing(0),\n boxShadow: \"0px 10px 10px 2px\",\n justifyContent: \"center\"\n },\n toggleOptionCheckbox: {\n paddingTop: theme.spacing(0.5),\n paddingBottom: theme.spacing(0.5)\n },\n toggleOptionFlex: {\n flex: 1,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n userWarning: {\n padding: theme.spacing(3)\n },\n box: {\n padding: theme.spacing(4)\n },\n marginTop: {\n marginTop: theme.spacing(2)\n },\n marginBottom: {\n marginBottom: theme.spacing(2)\n },\n adornedEnd: {\n paddingRight: theme.spacing(0)\n },\n utmButton: {\n marginLeft: theme.spacing(1)\n },\n selectMargin: {\n margin: theme.spacing(1),\n },\n button: {\n marginTop: theme.spacing(2),\n marginLeft: theme.spacing(1)\n },\n dropdown: {\n minWidth: 200,\n },\n formControl: {\n width: '100%'\n },\n buttonDiv: {\n textAlign: \"right\"\n },\n panel: {\n background: \"rgba(200,200,200,0.1)\"\n },\n success: {\n color: theme.palette.success.main\n },\n imageObservationSuccess: {\n color: `#${imageObsColor.toString(16)}`\n },\n pointObservationSuccess: {\n color: `#${pointObsColor.toString(16)}`\n },\n warning: {\n color: theme.palette.warning.main\n },\n error: {\n color: theme.palette.error.main\n },\n info: {\n color: theme.palette.info.main\n },\n errorLow: {\n color: theme.palette.success.main\n },\n errorMedium: {\n color: theme.palette.warning.main\n },\n errorHigh: {\n color: theme.palette.error.main\n },\n assetCheckbox: {\n position: \"relative\",\n transform: \"translateY(0%)\"\n },\n checkboxPadding: {\n padding: \"0px\"\n }\n }),\n);\n\nconst PointObservationIcon = (props) => {\n return ObservationIcon(props, 'point');\n};\n\nconst ImageObservationIcon = (props) => {\n return ObservationIcon(props, 'image');\n};\n\n\nconst ObservationIcon = (props, type) => {\n const {color} = props;\n const classes = useStyles();\n \n return (\n \n \n \n );\n};\n\nconst ResidualError = (props) => {\n const {value} = props;\n const classes = useStyles();\n return (\n = lowCutoff),\n [classes.errorHigh]: (value >= highCutoff)\n })}>\n {value}\n \n );\n};\n\nexport const ImageAlignerAdvanced = (props) => {\n const viewer = props.viewer as Viewer;\n const {addObservations, setDefaultTab, setTabsEnabled,\n observationType, setObservationType, alignerAdvOpen,\n alignerBasicOpen, setAlignerAdvOpen} = props;\n\n const classes = useStyles();\n const dispatch = useDispatch();\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const [rows, setRows] = useState([]);\n const [csvPath, setCsvPath] = useState(\"\");\n const [encompassCsvPath, setEncompassCsvPath] = useState(\"\");\n const [aligned, setAligned] = useState(false);\n const [alignmentConfirm, setAlignmentConfirm] = useState(false);\n const [alignerMatrixPath, setAlignerMatrixPath] = useState(null);\n const [valid, setValid] = useState(false);\n const [tableNonEmpty, setTableNonEmpty] = useState(false);\n const [closePrompt, setClosePrompt] = useState(false);\n const [isAligned, setIsAligned] = useState(false);\n const [alertOpen, setAlertOpen] = useState(false);\n const [askRemoveOpen, setAskRemoveOpen] = useState(false);\n const [alignPosition, setAlignPosition] = useState(true);\n const [alignRotation, setAlignRotation] = useState(true);\n\n const cameraTransformPath = useSelector(selectCameraTransform);\n const currentCamera = useSelector(selectActiveCamera);\n const basicAdjustments = useSelector(selectBasicAdjustments);\n\n const assets = useSelector(selectAllAssets);\n const camerasFiles = getCameraFileAssets(assets);\n\n const columns = [\n {id: 'obs_num', numeric: true, label: '#'},\n {id: 'name', numeric: false, label: 'Filename'},\n {id: 'img_obs', numeric: false, label: 'Image Control'},\n {id: 'pc_obs', numeric: false, label: 'Point Control'},\n {id: 'error', numeric: true, label: 'Error(\\u00B0)'},\n ];\n\n const handleOpen = () => {\n if (alignerBasicOpen) {\n setAlertOpen(true);\n return;\n }\n\n setAlignerAdvOpen(true);\n setDefaultTab();\n };\n\n const handleClose = () => {\n setAlignerAdvOpen(false);\n };\n\n const handleAlertClose = () => {\n setAlertOpen(false);\n };\n\n const resetRowsAndMesh = () => {\n setRows([]);\n generateRows(requiredRows);\n };\n\n const exportCSV = () => {\n let appPath = app.getPath('userData');\n let csvPath = appPath + '/alignTemp.csv';\n let csvOut = [];\n csvOut.push(['filename',\n 'x_img', 'y_img', 'z_img',\n 'x_ground', 'y_ground', 'z_ground']);\n for (let i=0; i console.error(err))\n .on('finish', () => console.log('Done writing.'));\n setCsvPath(csvPath);\n\n let csvEncompassPath = appPath + '/encompassTemp.csv';\n let csvEncompassOut = [];\n csvEncompassOut.push(['filename',\n 'X', 'Y', 'Z',\n 'Roll', 'Pitch', 'Yaw']);\n for (let i=0; i< viewer.getNumEntriesCameraAligner(); i++) {\n csvEncompassOut.push(viewer.getCamPoseCameraAligner(i));\n }\n csv.writeToPath(csvEncompassPath, csvEncompassOut)\n .on('error', err => console.error(err))\n .on('finish', () => console.log('Done writing.'));\n setEncompassCsvPath(csvEncompassPath);\n };\n\n const runAlignerPython =() => {\n let exe = new PythonExecutable();\n let commands = [\n \"-p\", \"camera_aligner_advanced\",\n \"--csv_obs\", csvPath,\n \"--csv_encompass\", encompassCsvPath,\n \"--sulphur\", \"True\",\n \"--align_position\", alignPosition ? \"True\" : \"False\",\n \"--align_rotation\", alignRotation ? \"True\" : \"False\"\n ];\n\n let isConverted = false;\n let camPoseEntry = viewer.getCamPoseCameraAligner(0);\n let largeResiduals = false;\n\n let initialPath = path.dirname(camPoseEntry[0]);\n let nameCorrection = path.basename(initialPath);\n let correctionName = nameCorrection + \"_correction_matrix.4x4\";\n let correctionPath = path.join(initialPath, correctionName);\n\n (async () => {\n new PythonExecutable().run({\n command: ['--check-tool', 'aligner-advanced']\n });\n })();\n\n exe.run({\n command: commands,\n saveLogs: true,\n onLine: jsonData => {\n let residualsTemp = parseResiduals(jsonData);\n if (residualsTemp.length !== 0) {\n viewer?.setErrorsCameraAligner(residualsTemp);\n isConverted = true;\n }\n residualsTemp.forEach(res => {\n if (res >= highCutoff) {\n largeResiduals = true;\n }\n });\n },\n onClose: () => {\n try {\n if (isConverted) {\n showMessage(\"Alignment Adjustment Complete!\", {\n variant: \"success\"\n });\n setAlignerMatrixPath(correctionPath);\n setAligned(true);\n updateRows(resetRowIcons());\n if (largeResiduals) {\n showMessage(\"Large errors in alignment correction\", {\n variant: \"warning\"\n });\n }\n } else {\n showMessage(\"Alignment Correction experienced a problem and did not apply a correction\", {\n variant: \"error\"\n });\n }\n }\n catch (err) {\n showMessage(\"Alignment Correction experienced a problem and did not apply a correction\", {\n variant: \"error\"\n });\n }\n }\n });\n };\n\n const parseResiduals = (jsonData) => {\n let resArray = [];\n\n if (jsonData) {\n jsonData.forEach(res => {\n let rounded = Math.round(parseFloat(res) * 100) / 100;\n resArray.push(rounded);\n });\n }\n\n return resArray;\n };\n\n const emptyObservation = (index) => {\n return {\n id: index,\n obs_num: index+1,\n name: \"No File\",\n img_obs: ,\n pc_obs: ,\n error: 0\n };\n };\n\n const generateRows = (rowNum) => {\n viewer?.resetCameraAligner();\n\n let rowsTemp = [];\n for (let i=0; i {\n let tempRows = [...rows];\n\n for (let i=0; i {\n if (tempRows.length === 0) {\n return;\n }\n\n for (let i=0; i;\n }\n\n setRows(tempRows);\n };\n\n const onDeleteClick = (row) => {\n if (rows.length === 1) {\n resetRowsAndMesh();\n return;\n }\n let tempRows = resetRowIcons();\n viewer.deleteRowCameraAligner(row.id);\n tempRows.splice(row.id, 1);\n updateRows(tempRows);\n setObservationType(\"none\");\n showMessage(\"Aligner Entry Deleted\", {\n variant: \"error\"\n });\n setAlignmentConfirm(false);\n if (aligned) {\n cancelCurrentAlignment();\n setValid(false);\n }\n };\n\n const resetRowIcons = () => {\n let tempRows = [...rows];\n\n for (let i=0; i;\n \n const hasPointObs = viewer.getPointObsCameraAligner(i) != null;\n tempRows[i].pc_obs = ;\n }\n\n return tempRows;\n };\n\n const onRowClick = (row, index) => {\n if (index > 3 || index < 2){\n setObservationType(\"none\");\n viewer.setCurrentRowCameraAligner(-1);\n let camID = viewer.getCamIdFromAligner(row.id);\n const direction = viewer.getObservationPosition(row.id);\n viewer.setCameraVisible(camID, {direction});\n viewer.flashObservations(row.id);\n } else if (index === 2){\n if (aligned || viewer?.checkIfAligned()) {\n cancelCurrentAlignment();\n setValid(false);\n }\n\n let tempRows = resetRowIcons();\n tempRows[row.id].img_obs = ;\n\n updateRows(tempRows);\n\n setObservationType(\"image\");\n viewer.setCurrentRowCameraAligner(row.id);\n viewer.setAllObservationsVisible(); \n viewer.hideCurrentObservation('image', row.id);\n setAlignmentConfirm(false);\n } else if (index === 3){\n if (aligned || viewer?.checkIfAligned()) {\n cancelCurrentAlignment();\n setValid(false);\n }\n\n let tempRows = resetRowIcons();\n \n tempRows[row.id].pc_obs = ;\n updateRows(tempRows);\n\n setObservationType(\"point\");\n viewer.setCurrentRowCameraAligner(row.id);\n viewer.hideCurrentObservation('point', row.id);\n setAlignmentConfirm(false);\n }\n };\n\n const cancelCurrentAlignment = () => {\n setAligned(false);\n setIsAligned(false);\n setAlignmentConfirm(false);\n setAlignerMatrixPath(null);\n dispatch(changeCameraTransform(null));\n showMessage(`Alignment Cleared`, {\n variant: \"success\"\n });\n };\n\n const onClearAlignments = () => {\n dispatch(changeBasicAdjustments({}));\n viewer?.resetBasicAlignerCamera();\n saveProject(false);\n cancelCurrentAlignment();\n };\n\n const confirmAlignment = () => {\n dispatch(changeCameraTransform(alignerMatrixPath));\n setAlignmentConfirm(true);\n };\n\n const handleAlignPositionCheck = () => {\n setAlignPosition(!alignPosition);\n };\n\n const handleAlignRotationCheck = () => {\n setAlignRotation(!alignRotation);\n };\n\n const checkRowsValid = () => {\n if (rows.length < requiredRows) {\n setValid(false);\n setTableNonEmpty(false);\n return false;\n }\n\n if (!viewer.getNumEntriesCameraAligner()){\n setValid(false);\n return false;\n }\n\n if (viewer === null) {\n setValid(false);\n setTableNonEmpty(false);\n return false;\n }\n\n let validCheck = true;\n let nonEmpty = false;\n for (let i=0; i < rows.length; i++) {\n let imgCheck = (viewer?.getImageObsCameraAligner(i) != null);\n let pointCheck = (viewer?.getPointObsCameraAligner(i) != null);\n let validTemp = (imgCheck && pointCheck);\n validCheck = (validCheck && validTemp);\n nonEmpty = (imgCheck || pointCheck || nonEmpty);\n }\n setValid(validCheck);\n setTableNonEmpty(nonEmpty);\n return validCheck;\n };\n\n const checkClose = () => {\n if (tableNonEmpty) {\n setClosePrompt(true);\n } else {\n handleClose();\n }\n };\n\n useEffect(() => {\n ipcRenderer?.removeAllListeners(\"open-image-aligner-adv\");\n ipcRenderer?.on(\"open-image-aligner-adv\", handleOpen);\n }, [alignerBasicOpen]);\n\n useEffect(() => {\n if (viewer) {\n generateRows(requiredRows);\n }\n }, [viewer]);\n\n useEffect(() => {\n const aligned = cameraTransformPath !== null;\n const removed = currentCamera === null;\n const noCameras = camerasFiles.length === 0;\n\n if (aligned && removed && noCameras) {\n setAskRemoveOpen(true);\n }\n }, [currentCamera]);\n\n useEffect(() => {\n if (addObservations) {\n showMessage(`New ${observationType} observation added`, {\n variant: \"success\"\n });\n updateRows(resetRowIcons());\n setObservationType(\"none\");\n checkRowsValid();\n }\n }, [addObservations]);\n\n useEffect(() => {\n if (!viewer) {\n return;\n }\n\n viewer?.setObservationTypeCameraAligner(observationType);\n if (observationType===\"none\") {\n updateRows(resetRowIcons());\n }\n }, [viewer, observationType]);\n\n useEffect(() => {\n if (!alignerAdvOpen) {\n resetRowsAndMesh();\n }\n\n setTabsEnabled(!alignerAdvOpen);\n viewer?.toggleCameraAligner(alignerAdvOpen);\n }, [viewer, alignerAdvOpen]);\n\n useEffect(() => {\n let validCheck = checkRowsValid();\n if (validCheck) {\n exportCSV();\n }\n }, [rows]);\n\n useEffect(() => {\n setIsAligned(viewer?.checkIfAligned() || hasBasicAlignment);\n }, [viewer, alignerAdvOpen, aligned, isAligned]);\n\n useEffect(() => {\n if (alignerAdvOpen && !alignRotation && !alignPosition) {\n showMessage(\"At least one of Align Position and Align Rotation must be enabled\", {\n variant: \"warning\"\n });\n setAlignPosition(true);\n setAlignRotation(true);\n }\n\n }, [alignPosition, alignRotation]);\n\n const hasBasicAlignment = Object.keys(basicAdjustments).length !== 0;\n\n return (\n \n\n \n \n\n {(!isAligned) && (\n Select at least ({requiredRows}) corresponding points in both image and point cloud to align data.\n More observations may help give a better final result.\n )}\n\n {(isAligned) && (\n Image and Point Cloud data currently have a set alignment. Current Alignment must be cleared\n before adding observations.\n )}\n\n {(!isAligned) && }\n \n\n \n {rows.length === 0 && (\n \n )}\n\n {(!isAligned) && (rows.length >= 1) &&\n ((alignmentConfirm === false)) && (\n \n )}\n\n {(valid === true) && (aligned === false) && (\n \n )}\n\n {(aligned === true) && (\n \n )}\n\n {(aligned === false) && (isAligned === true) && (\n \n )}\n\n {(aligned === true) && (alignmentConfirm === false) && (\n \n )}\n\n \n\n {!isAligned && (\n\n {/* Calculate lever arm */}\n
\n \n Align Position\n \n \n
\n\n {/* Calculate rotation */}\n
\n \n Align Rotation\n \n \n
\n\n
)}\n \n\n setClosePrompt(false)}\n onSubmit={() => {\n handleClose();\n setClosePrompt(false);\n }}\n title=\"Close Aligner?\"\n prompt={`Do you want to close the Data Aligner? All observations will be lost.`}\n button=\"Close\"\n />\n\n setAskRemoveOpen(false)}\n onSubmit={() => {\n dispatch(changeCameraTransform(null));\n setAskRemoveOpen(false);\n }}\n title=\"Remove Alignment Matrix?\"\n prompt={`All cameras have been removed. Do you want to remove the current camera\n correction matrix? If the existing matrix is not removed it will automatically\n be applied to all new CSVs.`}\n button=\"Remove Matrix\"\n />\n\n \n \n Unable to open advanced data aligner if basic mode is open\n \n \n
\n );\n};\n","import React, {useEffect, useState} from 'react';\nimport { createStyles, makeStyles, Theme } from \"@material-ui/core/styles\";\nimport { useSnackbar } from 'notistack';\nimport {\n Box,\n Button,\n DialogActions,\n DialogContent,\n DialogContentText,\n Grid,\n Typography\n} from '@material-ui/core';\nimport { AlertDialog, DraggableDialog, PromptDialog } from '../dialogs';\nimport { ipcRenderer } from '../electron-modules';\nimport clsx from 'clsx';\nimport {\n changeBasicAdjustments,\n changeCameraTransform,\n selectBasicAdjustments,\n selectCameraTransform,\n selectActiveCamera\n} from '../redux/camera-slice';\nimport { useSelector, useDispatch } from 'react-redux';\nimport { saveProject } from '../project-utils';\nimport { PythonExecutable } from \"../executable\";\nimport { Viewer } from '../viewer/js/main';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n minHeightContent: {\n minHeight: \"100px\"\n },\n titleTop: {\n marginTop: theme.spacing(2.0)\n },\n warning: {\n color: theme.palette.warning.main\n },\n success: {\n color: theme.palette.success.main\n }\n }),\n);\n\nconst AlignerShortcuts = () => {\n return (\n \n \n \n \n Adjust Roll (-): Keypad 7\n \n \n\n \n \n Adjust Roll (+): Keypad 9\n \n \n \n\n \n \n \n Adjust Pitch (-): Keypad 4\n \n \n\n \n \n Adjust Pitch (+): Keypad 6\n \n \n \n\n \n \n \n Adjust Yaw (-): Keypad 1\n \n \n\n \n \n Adjust Yaw (+): Keypad 3\n \n \n \n \n );\n};\n\nexport const ImageAlignerBasic = (props) => {\n const viewer = props.viewer as Viewer;\n const {setDefaultTab, setTabsEnabled, singleAlignment,\n alignerBasicOpen, alignerAdvOpen, setAlignerBasicOpen} = props;\n\n const classes = useStyles();\n const dispatch = useDispatch();\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const [alertOpen, setAlertOpen] = useState(false);\n const [closePrompt, setClosePrompt] = useState(false);\n const [hasTransform, setHasTransform] = useState(false);\n const currentCamera = useSelector(selectActiveCamera);\n const basicAdjustments = useSelector(selectBasicAdjustments);\n const cameraTransformPath = useSelector(selectCameraTransform);\n\n const handleOpen = () => {\n if (alignerAdvOpen) {\n setAlertOpen(true);\n return;\n }\n\n setAlignerBasicOpen(true);\n setDefaultTab();\n };\n\n const handleClose = () => {\n setAlignerBasicOpen(false);\n setClosePrompt(false);\n };\n\n const handleAlertClose = () => {\n setAlertOpen(false);\n };\n\n const checkClose = () => {\n if (isModified) {\n setClosePrompt(true);\n } else {\n handleClose();\n }\n };\n\n const resetAligner = () => {\n viewer?.resetBasicAlignerCamera(savedAngle);\n\n showMessage(`Alignment Reset`, {\n variant: \"success\"\n });\n };\n\n const saveAdjustment = () => {\n const updated = {...basicAdjustments};\n updated[currentCamera] = alignment;\n dispatch(changeBasicAdjustments(updated));\n viewer?.resetBasicAlignerCamera(alignment);\n saveProject(false);\n\n (async () => {\n new PythonExecutable().run({\n command: ['--check-tool', 'aligner-basic']\n });\n })();\n\n showMessage(`Alignment Saved`, {\n variant: \"success\"\n });\n };\n\n const cancelAdvancedAlignment = () => {\n dispatch(changeCameraTransform(null));\n saveProject(false);\n };\n\n const checkDataModified = () => {\n if (!hasActiveCamera) {\n return false;\n }\n\n const epsilon = 1e-10;\n const dx = (savedAngle[0] - singleAlignment[0]) < epsilon;\n const dy = (savedAngle[1] - singleAlignment[1]) < epsilon;\n const dz = (savedAngle[2] - singleAlignment[2]) < epsilon;\n\n return !(dx && dy && dz);\n };\n\n useEffect(() => {\n ipcRenderer?.removeAllListeners(\"open-image-aligner-basic\");\n ipcRenderer?.on(\"open-image-aligner-basic\", handleOpen);\n }, [alignerAdvOpen]);\n\n useEffect(() => {\n setHasTransform(cameraTransformPath !== null);\n }, [viewer, cameraTransformPath]);\n\n useEffect(() => {\n setTabsEnabled(!alignerBasicOpen);\n const enabled = hasActiveCamera && alignerBasicOpen;\n viewer?.setBasicAlignerState(enabled);\n }, [viewer, alignerBasicOpen, currentCamera]);\n\n useEffect(() => {\n // Not applicable if transform matrix is applied\n if (hasTransform) {\n return;\n }\n\n viewer?.resetBasicAlignerCamera(savedAngle);\n }, [viewer, currentCamera]);\n\n const hasActiveCamera = currentCamera !== null;\n const activeCameraName = hasActiveCamera ?\n viewer?.getCurrentCameraName() : null;\n\n const alignment = hasActiveCamera\n ? singleAlignment.map(x => parseFloat(x.toFixed(2)))\n : [0,0,0];\n\n const savedAngle = currentCamera in basicAdjustments\n ? basicAdjustments[currentCamera]\n : [0, 0, 0];\n\n const isModified = checkDataModified();\n\n return (\n \n \n \n\n {(hasTransform) && (\n A global transformation is currently applied. Current alignment must be cleared\n before adding per-camera corrections\n )}\n\n {(hasTransform === false) && (\n {/* Current camera section */}\n \n \n Current Camera:\n \n\n \n {hasActiveCamera ? activeCameraName : \"No Camera Selected\"}\n \n \n\n {/* Current adjustment section */}\n \n \n Current Adjustment:\n \n\n \n {hasActiveCamera ? `[${alignment[0]}, ${alignment[1]}, ${alignment[2]}]` : \"N/A\"}\n \n \n\n {/* Current adjustment section */}\n \n \n Alignment Status:\n \n\n \n {isModified ? \"Modified\" : \"Saved\"}\n \n \n\n {/* Alignment shortcut keys */}\n \n \n Alignment Shortcuts:\n \n\n \n \n )}\n\n \n\n \n {(hasTransform) && ()}\n\n {(hasTransform === false) && (\n \n Reset Values\n \n\n \n Save Adjustment\n \n )}\n \n \n\n setClosePrompt(false)}\n onSubmit={() => {\n viewer?.resetBasicAlignerCamera(savedAngle);\n handleClose();\n }}\n title=\"Close Aligner?\"\n prompt={`Do you want to close the data aligner? Current modifications will not be saved.`}\n button=\"Close\"\n />\n\n \n \n Unable to open basic data aligner if advanced mode is open\n \n \n \n );\n};","import React from 'react';\nimport {\n Box,\n LinearProgress,\n LinearProgressProps,\n Typography\n} from '@material-ui/core';\nimport { roundDigit } from './viewer/js/misc';\n\n// TODO: replace other linear progress with label with this (might need extra customization)\n\nexport const LinearProgressWithLabel = (props: LinearProgressProps & { value: number }) => {\n return (\n \n \n \n \n \n \n {`${roundDigit(props.value, 2)}%`}\n \n \n \n );\n};\n","import {\n createStyles,\n IconButton,\n makeStyles,\n Theme\n} from \"@material-ui/core\";\nimport clsx from 'clsx';\nimport React from \"react\";\nimport { ArrowTooltip } from \"./tooltips\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n disabled: {\n opacity: 0.3\n }\n })\n);\n\nexport const EnhancedIconButton = (props) => {\n const classes = useStyles();\n const {title, visible, onClick, disabled, children} = props;\n\n const isVisible = visible !== undefined ? visible : true;\n const tooltipText = disabled ? `${title} (Disabled)` : title;\n\n const createMarkup = () => {\n return tooltipText ?\n (
) :\n \"\";\n };\n\n return (\n \n {isVisible && (\n \n {children}\n \n )}\n \n );\n};\n","import React, {useEffect, useState} from 'react';\nimport {useDispatch} from 'react-redux';\nimport {ProgressDialog, TextDialog} from \"../dialogs\";\nimport CloseIcon from '@material-ui/icons/Close';\nimport CheckIcon from '@material-ui/icons/Check';\nimport EditIcon from '@material-ui/icons/Edit';\nimport WarningIcon from '@material-ui/icons/Warning';\nimport PriorityHighIcon from '@material-ui/icons/PriorityHigh';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport ExpandLessIcon from '@material-ui/icons/ExpandLess';\nimport AddToPhotosIcon from '@material-ui/icons/AddToPhotos';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport ZoomInIcon from '@material-ui/icons/ZoomIn';\nimport {\n Card,\n CardHeader,\n CircularProgress,\n Collapse,\n DialogContent,\n List,\n ListItem,\n Typography\n} from '@material-ui/core';\nimport { DraggableDialog, PromptDialog } from '../dialogs';\nimport { createStyles, makeStyles, Theme } from \"@material-ui/core/styles\";\nimport { app, dialog, ipcRenderer, fs } from '../electron-modules';\nimport { useSnackbar } from 'notistack';\nimport {changeSwitched} from \"../redux/settings-slice\";\nimport { textToColor } from '../viewer/js/labelling/categories';\nimport { ArrowTooltip } from '../tooltips';\nimport { DenseDivider, IconToolBar, ToolBarButton } from '../toolbar';\nimport slash from 'slash';\nimport { PythonExecutable } from '../executable';\nimport { Viewer } from '../viewer/js/main';\nimport LocalScene from '../viewer/js/projections';\nimport { FixedSizeList as DynamicList } from \"react-window\";\nimport { LinearProgressWithLabel } from '../progress';\nimport path from 'path';\nimport { EnhancedIconButton } from '../buttons';\n\nconst labelExtension = \"3dl\";\nconst modelExtension = \"pth\";\nconst dxfExtension = \"dxf\";\nconst labelFilter = [{name: 'Engine Label File', extensions: [labelExtension]}];\nconst modelFilter = [{name: 'Engine Trained Model File', extensions: [modelExtension]}];\nconst dxfFilter = [{name: 'DXF File', extensions: [dxfExtension]}];\nconst labelHeight = 46;\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n titleClose: {\n position: 'absolute',\n right: theme.spacing(0),\n color: theme.palette.grey[500],\n },\n titleInfo: {\n position: 'absolute',\n right: theme.spacing(4),\n marginTop: theme.spacing(0),\n color: theme.palette.grey[500],\n },\n titleMin: {\n position: 'absolute',\n right: theme.spacing(4),\n marginTop: theme.spacing(-1),\n color: theme.palette.grey[500],\n },\n userWarning: {\n padding: theme.spacing(3)\n },\n box: {\n padding: theme.spacing(4)\n },\n formControl: {\n width: '100%'\n },\n categoryName: {\n flex: 1\n },\n success: {\n color: theme.palette.success.main\n },\n warning: {\n color: theme.palette.warning.main\n },\n error: {\n color: theme.palette.error.main\n },\n info: {\n color: theme.palette.info.main\n },\n folderList: {\n padding: \"0px\",\n overflow: \"auto\",\n flex: 1,\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n headerTitle: {\n fontWeight: \"bold\",\n cursor: \"pointer\"\n },\n cardHeader: {\n padding: \"10px\"\n },\n cardButtons: {\n marginTop: 0,\n alignSelf: \"center\"\n },\n labelFixedHeight: {\n height: `${labelHeight}px`\n },\n labelTitle: {\n flex: 1,\n userSelect: \"none\"\n },\n labelTitleWarning: {\n flex: 1,\n userSelect: \"none\",\n color: theme.palette.warning.main\n },\n labelTitleError: {\n flex: 1,\n userSelect: \"none\",\n color: theme.palette.error.main\n },\n card: {\n margin: '10px',\n userSelect: \"none\"\n },\n progressToolbar: {\n display: \"flex\",\n marginLeft: \"12px\",\n marginRight: \"12px\"\n },\n toolbarLinear: {\n margin: \"auto 12px\"\n },\n toolbarProgressCenter: {\n top: \"50%\",\n height: \"6px\",\n marginTop: \"-3px\"\n },\n downloadMargin: {\n marginTop: theme.spacing(1)\n }\n }),\n);\n\nconst Label = (props) => {\n const viewer = props.viewer as Viewer;\n const {label, index, isScrolling, style} = props;\n\n const classes = useStyles();\n const selected = label.selected;\n const completed = label.completed;\n const hasEnoughPoints = label.hasEnoughPoints;\n\n let labelTitle = label.highlighted ? classes.labelTitleWarning : classes.labelTitle;\n\n const selectLabel = (id) => {\n viewer?.selectLabel(id);\n };\n\n const completeLabel = (id) => {\n viewer?.completeLabel(id);\n };\n\n const deleteLabel = (id) => {\n viewer?.deleteLabel(id);\n };\n\n const zoomToLabel = (id) => {\n viewer?.zoomToLabel(id);\n };\n\n const unHighlight = (id) => {\n viewer?.unHighlight(id);\n };\n\n return (\n \n \n {`Label #${index + 1} (${label.numPoints})`}\n \n\n {isScrolling && (\n \n Loading...\n \n )}\n\n {!isScrolling && (\n\n {/* Complete Label */}\n {\n completeLabel(label.id);\n }}\n >\n \n \n\n {/* Warning on Label */}\n {\n completeLabel(label.id);\n }}\n >\n \n \n\n {/* Highlighted Label */}\n {\n unHighlight(label.id);\n }}\n >\n \n \n\n {/* Edit Label */}\n {\n selectLabel(label.id);\n }}\n >\n \n \n\n {/* Zoom to extent */}\n {\n zoomToLabel(label.id);\n }}\n >\n \n \n\n {/* Delete Label */}\n {\n deleteLabel(label.id);\n }}\n >\n \n \n\n )}\n\n \n );\n};\n\nconst Category = (props) => {\n const viewer = props.viewer as Viewer;\n const {category, isValidCategory} = props;\n\n const classes = useStyles();\n const [expanded, setExpanded] = useState(false);\n const [editPrompt, setEditPrompt] = useState(false);\n const [deletePrompt, setDeletePrompt] = useState(false);\n\n const formatName = (name) => {\n return (name.length > 12) ? name.substr(0,11) + \"...\" : name;\n };\n\n const addThenExpand = (categoryID) => {\n addLabel(categoryID);\n setExpanded(true);\n };\n\n const addLabel = (id) => {\n viewer?.addLabel(id);\n };\n\n const handleDeleteCategory = () => {\n viewer?.deleteCategory(category.id);\n setDeletePrompt(false);\n };\n\n const handleEditCategory = (name) => {\n if (!isValidCategory(name)) {\n return;\n }\n\n viewer?.editCategoryName(category.id, name);\n setEditPrompt(false);\n };\n\n const activeLabel = () => {\n return viewer?.checkIfSelected();\n };\n\n const addNewLabelDisabled = activeLabel();\n const addNewlabelTooltip = `\n Add new label\n
Press space to add new\n
label to ${viewer.currentCategory()} category\n `;\n\n const color = textToColor(category.name);\n const scrollingDivLength = category.labels.length;\n const useScrollingDiv = scrollingDivLength > 100;\n const scrollingDivHeight = Math.min(scrollingDivLength*labelHeight, 250);\n\n return (\n \n \n {/* Header */}\n \n {/* Expand/collapse measurement */}\n {\n event.stopPropagation();\n setExpanded(!expanded);\n }}\n >\n {expanded && }\n {!expanded && }\n \n\n {/* Edit category name */}\n {\n setEditPrompt(true);\n }}\n >\n \n \n\n {/* Add new label */}\n {\n addThenExpand(category.id);\n }}\n >\n \n \n\n {/* Delete category */}\n {\n setDeletePrompt(true);\n }}\n >\n \n \n\n \n }\n disableTypography={true}\n title={\n \n {formatName(category.name)}\n \n }\n subheader={\n \n {`Total Labels: ${category.labels.length}`}\n \n }\n />\n\n {/* Expandable content */}\n \n {/* Use normal list for small labels list */}\n {!useScrollingDiv && (\n \n {category.labels.map((label, index) =>\n \n )}\n \n )}\n\n {/* Use scrolling list for large amounts of labels */}\n {expanded && useScrollingDiv && (\n \n {({index, isScrolling, style}) => (\n \n )}\n \n )}\n \n\n \n\n setEditPrompt(false)}\n onSubmit={handleEditCategory}\n title=\"Edit Class\"\n prompt=\"Enter new class name\"\n default={category.name}\n label=\"Class Name\"\n clear={true}\n />\n\n setDeletePrompt(false)}\n onSubmit={handleDeleteCategory}\n title=\"Delete Class?\"\n prompt={`Do you want to delete this class (${category.name})? All labels will be removed`}\n button=\"Delete\"\n />\n \n );\n};\n\nexport const ImageLabelling = (props) => {\n const viewer = props.viewer as Viewer;\n const {setDefaultTab, setTabsEnabled, categoryList,\n imageLabelOpen, setImageLabelOpen} = props;\n\n const classes = useStyles();\n const showMessage = useSnackbar().enqueueSnackbar;\n const dispatch = useDispatch();\n\n const [labelType, setLabelType] = useState(null);\n const [minimized, setMinimized] = useState(null);\n const [addCategory, setAddCategory] = useState(false);\n const [closePrompt, setClosePrompt] = useState(false);\n const [importData, setImportData] = useState(null);\n const [modalName, setModalName] = useState(\"\");\n const [labelLoadProgress, setLabelLoadProgress] = useState(0);\n const [trainClassifyProgress, setTrainClassifyProgress] = useState(0);\n const [trainClassifyExe, setTrainClassifyExe] = useState(null);\n const [predOrTrain, setPredOrTrain] = useState(\"\");\n const [classification, setClassification] = useState(false);\n const [training, setTraining] = useState(false);\n const [trainingURL, setTrainingURL] = useState(null);\n const [downloadingResources, setDownloadingResources] = useState(false);\n const [trainingPrompt, setTrainingPrompt] = useState(false);\n const [classificationPrompt, setClassificationPrompt] = useState(false);\n\n const isOrthoLabel = labelType === \"ortho\";\n const isSceneLabel = labelType === \"scene\";\n const importPrompt = importData !== null;\n const importCategories = importData?.categories.map(x => x.name);\n\n let numImportLabels = 0;\n importData?.annotations.forEach(label => {\n numImportLabels += label.segmentation.length;\n });\n\n const resetExecutableValues = () => {\n setTrainClassifyProgress(0);\n setTrainingURL(null);\n setDownloadingResources(false);\n setTraining(false);\n setClassification(false);\n };\n\n const handleOpen = (type) => {\n setImageLabelOpen(true);\n setLabelType(type);\n };\n\n const handleClose = () => {\n setImageLabelOpen(false);\n handleCancelProgress();\n };\n\n const handleImport = async () => {\n await viewer.loadImageLabelData(importData, setLabelLoadProgress);\n showMessage(`Labels Loaded Successfully...`, {\n variant: \"success\"\n });\n\n setImportData(null);\n };\n\n const handleMinimize = () => {\n setMinimized(true);\n };\n\n const checkClose = () => {\n if (isModified) {\n setClosePrompt(true);\n } else {\n handleClose();\n }\n };\n\n const isValidCategory = (name) => {\n // Uniqueness check\n const isUnique = viewer?.checkCategoryUniqueness(name);\n if (!isUnique) {\n showMessage(`Class already exists`, {\n variant: \"error\"\n });\n return false;\n }\n\n // Alphanumeric, dash and underscore\n const alphanumeric = /^[a-zA-Z0-9-_]+$/;\n if (!alphanumeric.test(name)) {\n showMessage(`Invalid class name. Allowed characters are: [a-z, 0-9, _, -]`, {\n variant: \"error\"\n });\n return false;\n }\n\n return true;\n };\n\n const validIterations = (iterations) => {\n const numeric = /^[0-9]+$/;\n let validChar = numeric.test(iterations);\n let iterNumber = parseInt(iterations);\n\n let minIterations = 10;\n let maxIterations = 8192;\n let validNumber = (iterNumber >= minIterations)\n && (iterNumber <= maxIterations);\n\n if (!validChar || ! validNumber) {\n showMessage(`Invalid iterations. Allowed characters are: [0-9], must be between ${minIterations}-${maxIterations}`, {\n variant: \"error\"\n });\n return false;\n }\n\n return true;\n };\n\n const validScore = (score) => {\n const numeric = /^[0-9-.]+$/;\n let validChar = numeric.test(score);\n let scoreNumber = parseFloat(score);\n let validNumber = (scoreNumber >= 0.0 && scoreNumber <= 1.0);\n\n if (!validChar || ! validNumber) {\n showMessage(`Invalid score. Allowed characters are: [0-9], must be between 0.0-1.0`, {\n variant: \"error\"\n });\n return false;\n }\n\n return true;\n };\n\n const handleCategoryChange = (state) => {\n setAddCategory(state);\n };\n\n const handleCancel = () => {\n handleCategoryChange(false);\n };\n\n const handleAddCategory = (name) => {\n if (!isValidCategory(name)) {\n return;\n }\n\n viewer?.addCategory(name);\n handleCategoryChange(false);\n };\n\n const handleTrainingPrompt = (iterations) => {\n let iterValid = validIterations(iterations);\n if (!iterValid){\n return;\n }\n\n runTraining(parseInt(iterations));\n setTrainingPrompt(false);\n };\n\n const handleClassificationPrompt = (score) => {\n let scoreValid = validScore(score);\n if (!scoreValid){\n return;\n }\n\n runClassification(parseFloat(score));\n setClassificationPrompt(false);\n };\n\n const handleCancelProgress = () => {\n trainClassifyExe?.destroy();\n resetExecutableValues();\n };\n\n const handleViewTraining = (url) => {\n ipcRenderer?.send(\"show-training-window\", url);\n };\n\n const exportJSON = (categoryList) => {\n // No labels\n if (categoryList.length === 0) {\n showMessage(`No labels created to export`, {\n variant: \"warning\"\n });\n return;\n }\n\n const name = `${viewer.projectName}.${labelExtension}`;\n\n dialog.showSaveDialog({\n defaultPath: name,\n filters: labelFilter,\n }).then(result => {\n if (result.canceled) {\n return;\n }\n if (result.filePath) {\n let savePath = slash(result.filePath);\n let json = viewer?.labelObject();\n let text = JSON.stringify(json, null, 2);\n\n fs.writeFile(savePath, text, 'utf8', (err) => {\n if (err) {\n console.log(err);\n showMessage(`Failed to export labels`, {\n variant: \"error\"\n });\n }\n else {\n showMessage(`Image labels saved to ${path.basename(savePath)}`, {\n variant: \"success\"\n });\n console.log(`File written successfully to ${savePath}`);\n }\n });\n }\n });\n };\n\n const importImageLabels = () => {\n dialog.showOpenDialog({\n properties: ['openFile'],\n filters: labelFilter\n }).then(result => {\n if (result.canceled) {\n return;\n }\n\n try {\n const filePath = slash(result.filePaths[0]);\n const text = fs.readFileSync(filePath, 'utf8');\n const data = JSON.parse(text);\n\n if (data.type !== labelType) {\n showMessage(`Label type mismatch: \"${data.type}\"`, {\n variant: \"error\"\n });\n return;\n }\n\n setImportData(data);\n } catch {\n showMessage(`Error reading image labels file`, {\n variant: \"error\"\n });\n }\n }).catch(error => {\n console.log(error);\n });\n };\n\n const forceInitialProgress = () => {\n setTrainClassifyProgress(0.001);\n };\n\n const updateDownloadingResources = (jsonData) => {\n if (jsonData.downloading_resources) {\n setDownloadingResources(true);\n } else {\n setDownloadingResources(false);\n }\n };\n\n const canExportDXF = () => {\n let jsonData = viewer?.labelObject();\n\n const noAnnotations = jsonData.annotations.length === 0;\n const noImages = jsonData.images.length === 0;\n if (noAnnotations || noImages) {\n showMessage(`No exportable labels found. Active images are required`, {\n variant: \"warning\"\n });\n return false;\n }\n\n return true;\n };\n\n const runExportDXF = () => {\n // No labels\n if (categoryList.length === 0) {\n showMessage(`No labels created to export`, {\n variant: \"warning\"\n });\n return;\n }\n\n const name = `${viewer.projectName}.${dxfExtension}`;\n\n dialog.showSaveDialog({\n defaultPath: name,\n filters: dxfFilter,\n }).then(result => {\n if (result.canceled) {\n return;\n }\n if (result.filePath) {\n let savePath = slash(result.filePath);\n let jsonData = viewer?.labelObject();\n let text = JSON.stringify(jsonData, null, 2);\n let tempCocoPath = path.join(app.getPath('userData'), \"tempLabels.3dl\");\n\n fs.writeFile(tempCocoPath, text, 'utf8', (err) => {\n if (err) {\n console.log(err);\n showMessage(`Failed to export labels to DXF file`, {\n variant: \"error\"\n });\n }\n });\n\n let exe = new PythonExecutable();\n let pythonName = \"coco_to_dxf\";\n let commands = [\n \"-p\", pythonName,\n \"--coco_path\", tempCocoPath,\n \"--dxf_path\", savePath\n ];\n\n exe.run({\n command: commands,\n saveLogs: true,\n onClose: () => {\n try {\n showMessage(`DXF file saved to ${savePath}`, {\n variant: \"success\"\n });\n }\n catch (err) {\n console.log(err);\n showMessage(\"DXF file failed to save\", {\n variant: \"error\"\n });\n }\n }\n });\n }\n }).catch(error => {\n console.log(error);\n });\n };\n\n const canRunClassification = () => {\n const imagePaths = viewer.loadedImageLabelPaths();\n if (imagePaths.length === 0) {\n showMessage(`No images found for classification`, {\n variant: \"warning\"\n });\n return false;\n }\n\n return true;\n };\n\n const runClassification = (score) => {\n if (training) {\n showMessage(`Cannot run Classification until training is complete`, {\n variant: \"warning\"\n });\n return;\n }\n\n resetExecutableValues();\n setClassification(true);\n\n dialog.showOpenDialog({\n properties: ['openFile'],\n filters: modelFilter\n }).then(result => {\n if (result.canceled) {\n setClassification(false);\n return;\n }\n\n try {\n let modelPath = slash(result.filePaths[0]);\n\n if (result.canceled) {\n setClassification(false);\n return;\n }\n\n try {\n let pythonName = \"aerial_image_classification\";\n let appPath = app.getPath('userData');\n let commands = [\n \"-p\", pythonName,\n \"--image_paths\", viewer.loadedImageLabelPaths(),\n \"--output_folder\", appPath,\n \"--prediction_model\", modelPath,\n \"--proj_string\", LocalScene.dataProjection,\n \"--prediction_score_threshold\", score,\n ];\n\n forceInitialProgress();\n\n let importData;\n\n let exe = new PythonExecutable();\n setTrainClassifyExe(exe);\n\n exe.run({\n command: commands,\n saveLogs: true,\n onLine: jsonData => {\n updateDownloadingResources(jsonData);\n\n if (jsonData.progress) {\n setTrainClassifyProgress(jsonData.progress);\n } else {\n importData = jsonData;\n showMessage(`Classification complete, loading detected labels...`, {\n variant: \"success\"\n });\n }\n },\n onClose: async () => {\n try {\n await viewer.loadImageLabelData(importData, setLabelLoadProgress);\n showMessage(`Labels Loaded Successfully...`, {\n variant: \"success\"\n });\n }\n catch (err) {\n showMessage(\"Classification Process not completed\", {\n variant: \"warning\"\n });\n }\n finally {\n resetExecutableValues();\n }\n }\n });\n } catch {\n setClassification(false);\n showMessage(`Error running Classification_model`, {\n variant: \"error\"\n });\n }\n } catch {\n setClassification(false);\n showMessage(`Error finding trained model file`, {\n variant: \"error\"\n });\n }\n }).catch(error => {\n console.log(error);\n setClassification(false);\n });\n };\n\n const canRunTraining = () => {\n let jsonData = viewer?.labelObject();\n const noAnnotations = jsonData.annotations.length === 0;\n const noImages = jsonData.images.length === 0;\n if (noAnnotations || noImages) {\n showMessage(`No training labels found. Active images are required`, {\n variant: \"warning\"\n });\n return false;\n }\n\n return true;\n };\n\n const runTraining = (numIterations) => {\n if (training) {\n showMessage(`Cannot run training last process complete is complete`, {\n variant: \"warning\"\n });\n return;\n }\n\n resetExecutableValues();\n setTraining(true);\n\n let modelPath;\n let cocoPath;\n let outputPath;\n\n dialog.showOpenDialog({\n properties: ['openDirectory']\n }).then(result => {\n if (result.canceled) {\n setTraining(false);\n return;\n }\n\n try {\n outputPath = slash(result.filePaths[0]);\n cocoPath = path.join(outputPath, \"labels_for_training.3dl\");\n let jsonData = viewer?.labelObject();\n let text = JSON.stringify(jsonData, null, 4);\n\n fs.writeFile(cocoPath, text, 'utf8', (err) => {\n if (err) {\n console.log(err);\n showMessage(`Failed to export labels for training`, {\n variant: \"error\"\n });\n }\n });\n\n forceInitialProgress();\n\n let exe = new PythonExecutable();\n setTrainClassifyExe(exe);\n\n let pythonName = \"aerial_image_training\";\n let modelName = path.basename(outputPath);\n let commands = [\n \"-p\", pythonName,\n \"--image_paths\", viewer.activeImageLabelPaths(),\n \"--output_folder\", outputPath,\n \"--coco_data_file\", cocoPath,\n \"--solver_max_iterations\", numIterations,\n '--model_title', modelName,\n '--batch_size_per_image', 256,\n \"--tiled_image_mode\", isOrthoLabel\n ];\n\n exe.run({\n command: commands,\n saveLogs: true,\n onLine: jsonData => {\n updateDownloadingResources(jsonData);\n\n if (jsonData.gpu_memory_error) {\n showMessage(`GPU has insufficient memory. Switching to CPU based training`, {\n variant: \"warning\"\n });\n } else if (jsonData.progress) {\n setTrainClassifyProgress(jsonData.progress);\n } else if (jsonData.model_file_path) {\n modelPath = jsonData.model_file_path;\n } else if (jsonData.url) {\n setTrainingURL(jsonData.url);\n handleViewTraining(jsonData.url);\n }\n },\n onClose: () => {\n try {\n if (modelPath) {\n showMessage(`Training complete, model saved to ${modelPath}`, {\n variant: \"success\"\n });\n } else {\n showMessage(`Training incomplete, model may not have saved correctly.`, {\n variant: \"warning\"\n });\n }\n }\n catch (err) {\n console.log(err);\n showMessage(\"Training process not completed\", {\n variant: \"warning\"\n });\n }\n finally {\n resetExecutableValues();\n }\n }\n });\n }\n catch (err ){\n console.log(err);\n setTraining(false);\n showMessage(\"Error in training\", {\n variant: \"error\"\n });\n }\n }).catch(error => {\n console.log(error);\n setTraining(false);\n });\n };\n\n useEffect(() => {\n if (!imageLabelOpen) {\n return;\n }\n\n const onKeyDown = event => {\n if (event.target instanceof HTMLInputElement) {\n return;\n }\n\n viewer?.labelHotkey(event);\n };\n\n window.addEventListener('keydown', onKeyDown, false);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown, false);\n };\n }, [imageLabelOpen]);\n\n useEffect(() => {\n ipcRenderer?.removeAllListeners(\"open-label-ortho\");\n ipcRenderer?.on(\"open-label-ortho\", () => {\n handleOpen(\"ortho\");\n });\n\n ipcRenderer?.removeAllListeners(\"open-label-scene\");\n ipcRenderer?.on(\"open-label-scene\", () => {\n handleOpen(\"scene\");\n });\n }, [viewer, imageLabelOpen, labelType]);\n\n useEffect(() => {\n viewer?.setActiveLabelType(labelType);\n\n if (isOrthoLabel) {\n dispatch(changeSwitched(true));\n setModalName(\"Aerial Classification\");\n } else if (isSceneLabel) {\n dispatch(changeSwitched(false));\n setModalName(\"Scene View Classification\");\n }\n }, [labelType]);\n\n useEffect(() => {\n if (imageLabelOpen) {\n setDefaultTab();\n } else {\n if (!minimized) {\n setLabelType(null);\n }\n setMinimized(false);\n }\n\n setTabsEnabled(!imageLabelOpen);\n }, [viewer, imageLabelOpen]);\n\n useEffect(() => {\n if (minimized) {\n setImageLabelOpen(false);\n }\n }, [minimized]);\n\n useEffect(() => {\n if (classification) {\n setPredOrTrain(\"Classification\");\n } else if (training) {\n setPredOrTrain(\"Training\");\n }\n\n if (trainClassifyProgress === 100) {\n setTrainClassifyProgress(0);\n }\n }, [trainClassifyProgress, classification, training]);\n\n const isTraining = predOrTrain === \"Training\";\n const isModified = categoryList.length !== 0;\n const exportDisabled = viewer?.anyLabelSelected();\n const labelDisabled = classification || training || (labelLoadProgress > 0);\n const trainingLinkDisabled = trainingURL === null;\n\n return (\n \n \n\n {/* Label toolbar icons */}\n \n\n {/* Add category */}\n handleCategoryChange(true)}\n success\n />\n\n {/* Run Training */}\n {\n if (!canRunTraining()) {\n return;\n }\n\n setTrainingPrompt(true);\n }}\n disabled={labelDisabled}\n />\n\n {/* Run Classification */}\n {\n if (!canRunClassification()) {\n return;\n }\n\n setClassificationPrompt(true);\n }}\n disabled={labelDisabled}\n />\n\n {/* Import label file */}\n \n\n {/* Export Label file */}\n exportJSON(categoryList)}\n disabled={exportDisabled}\n />\n\n {/* Export to DXF */}\n {\n if (!canExportDXF()) {\n return;\n }\n\n runExportDXF();\n }}\n />\n\n \n\n \n\n {(trainClassifyProgress > 0) && (\n\n
\n\n \n\n {/** Training/Classification progress */}\n
\n \n
\n\n
\n\n {/** Training/Classification cancel button */}\n {isTraining && (\n {\n handleViewTraining(trainingURL);\n }}\n />\n )}\n\n {/** Training/Classification cancel button */}\n \n
\n\n\n
)}\n\n {downloadingResources && (\n \n Downloading Resources... \n \n\n )}\n\n \n \n {categoryList.map(category =>\n )}\n \n \n\n \n\n \n\n {/* Close modal */}\n setClosePrompt(false)}\n onSubmit={() => {\n handleClose();\n setClosePrompt(false);\n }}\n title=\"Close Classification Window?\"\n prompt={`Do you want to close the ${modalName} window? All created labels will be lost.`}\n button=\"Close\"\n />\n\n setImportData(null)}\n onSubmit={() => handleImport()}\n title=\"Import Image Labels\"\n prompt={`Do you want to import ${importCategories?.length} ${labelType} classes\n (${importCategories?.join(\", \")}) and ${numImportLabels} labels?. Connected labels\n will be merged together`}\n button=\"Import Labels\"\n />\n\n {/* Set training parameters */}\n setTrainingPrompt(false)}\n onSubmit={handleTrainingPrompt}\n title=\"Select training model parameters\"\n prompt=\"Select the number of iterations for training your model file.\"\n default='250'\n label=\"Training Iterations\"\n />\n\n {/* Set classification parameters */}\n setClassificationPrompt(false)}\n onSubmit={handleClassificationPrompt}\n title=\"Select classification parameters\"\n prompt=\"Select the classification score, as a decimal between 0 - 1.\"\n default='0.5'\n label=\"Classification Score\"\n />\n\n {/* Image label import percent dialog */}\n 0}\n text={\"Importing Image Labels...\"}\n percent={labelLoadProgress}\n noTransition\n />\n\n
\n );\n};","import * as React from \"react\";\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport {createStyles, makeStyles, Theme} from \"@material-ui/core\";\nimport { Viewer } from \"./js/main\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n menuItem: {\n fontSize: \"0.875em\",\n }\n }),\n);\n\nexport const ContextMenu = (props) => {\n const classes = useStyles();\n const viewer = props.viewer as Viewer;\n const {state, setContextState, setViewerTooltipText} = props;\n\n const onClose = () => {\n setContextState({\n mouseX: null,\n mouseY: null,\n id: null,\n isPoint: null\n });\n };\n\n const onEnter = () => {\n setViewerTooltipText(\"\");\n };\n\n const getMenuItems = () => {\n let numHighlighted = viewer.numHighlighted();\n let labelActive = viewer.checkIfActive();\n // No labelling\n if (numHighlighted === 0 || !labelActive) {\n return [\n {\n text: `${viewer.orbitState ? \"Disable\" : \"Enable\"} 3D Mode`,\n disabled: !(viewer.hasPoints && viewer.cameraSelected),\n callback: () => {\n viewer.controls.toggleCamera();\n }\n },\n {\n text: \"Reset 3D Mode\",\n disabled: !viewer.orbitState,\n callback: () => {\n viewer.controls.resetCamera();\n }\n }\n ];\n }\n // With Labelling\n else if (numHighlighted > 0) {\n return [\n {\n text: `Delete Selected Labels (${numHighlighted})`,\n disabled: (viewer.anyLabelSelected()),\n callback: () => {\n viewer.deleteHighlighted();\n }\n },\n {\n text: `Delete Selected Point`,\n disabled: (viewer.anyLabelSelected() || !state.isPoint),\n callback: () => {\n viewer.imageLabels.deletePoint(state.isPoint);\n }\n },\n {\n text: `Unselect All Labels`,\n disabled: viewer.anyLabelSelected(),\n callback: () => {\n viewer.unHighlightAll();\n }\n },\n {\n text: \"Edit Label\",\n disabled: (viewer.anyLabelSelected() || numHighlighted > 1),\n callback: () => {\n viewer.selectLabel(state.id);\n }\n }\n ];\n }\n\n return [];\n };\n\n const options = viewer ? getMenuItems() : [];\n const anchorPosition = state.mouseY !== null && state.mouseX !== null\n ? { top: state.mouseY, left: state.mouseX }\n : undefined;\n\n const open = state.mouseY !== null;\n\n return (\n \n {options.map(option => {\n return (\n {\n onClose();\n option.callback();\n }}\n >\n {option.text}\n \n );\n })}\n \n );\n};","import openStreetMaps from './open-street-maps.png';\nimport arcgisWorld from './arcgis-world.png';\nimport arcgisStreet from './arcgis-street.png';\n\nconst textures = {\n 'open-street-maps': openStreetMaps,\n 'arcgis-world': arcgisWorld,\n 'arcgis-street': arcgisStreet,\n};\n\nexport default textures;\n","export default __webpack_public_path__ + \"static/media/open-street-maps.45e253e7.png\";","export default __webpack_public_path__ + \"static/media/arcgis-world.f700fb3f.png\";","export default __webpack_public_path__ + \"static/media/arcgis-street.d6a677f8.png\";","import * as React from \"react\";\nimport {createStyles, makeStyles, useTheme, Theme} from \"@material-ui/core/styles\";\nimport Popover from '@material-ui/core/Popover';\nimport Button from '@material-ui/core/Button';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted';\nimport {Avatar} from \"@material-ui/core\";\nimport previews from './textures/map-preview';\nimport {useState} from \"react\";\nimport { Viewer } from \"./js/main\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n buttonParent: {\n padding: \"3px\",\n background: \"rgba(255,255,255,0.4)\",\n position: 'absolute',\n bottom: \"0.5em\",\n left: \"0.5em\",\n zIndex: 10,\n borderRadius: \"5px\"\n },\n button: {\n padding: \"0px\",\n background: \"rgba(0,60,136,0.5)\",\n color: \"white\",\n minWidth: theme.spacing(3),\n \"&:hover\": {\n background: \"rgba(0,60,136,0.7)\"\n }\n },\n heading: {\n padding: theme.spacing(2),\n },\n icon: {\n width: \"22px\",\n height: \"22px\"\n },\n menuItem: {\n fontSize: \"0.9em\",\n },\n preview: {\n width: theme.spacing(4),\n height: theme.spacing(4),\n marginRight: theme.spacing(2),\n borderRadius: theme.spacing(1)\n }\n }),\n);\n\nexport const LayerSwitcher = (props) => {\n const theme = useTheme();\n const classes = useStyles(theme);\n const [anchorEl, setAnchorEl] = useState(null);\n\n const viewer = props.viewer as Viewer;\n const {clearTooltipText} = props;\n\n const handleClick = (event: React.MouseEvent) => {\n setAnchorEl(event.currentTarget);\n clearTooltipText();\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const handleSelect = (layerID) => {\n const minimap = viewer.minimap;\n minimap.setVisibleBasemap(layerID);\n };\n\n const getMenuItems = () => {\n const minimap = viewer.minimap;\n const layers = minimap.basemapIds;\n const selected = minimap.activeBasemap;\n\n return layers.map(layer => {\n return {\n id: layer.id,\n text: layer.text,\n icon: previews[layer.id],\n selected: layer.id === selected\n };\n });\n };\n\n const open = Boolean(anchorEl);\n const id = open ? 'simple-popover' : undefined;\n const options = viewer ? getMenuItems() : [];\n\n return (\n
\n \n \n \n \n {options.map(option => {\n return (\n {\n handleSelect(option.id);\n handleClose();\n }}\n >\n \n {option.text}\n \n );\n })}\n \n
\n );\n};","import * as React from \"react\";\nimport * as THREE from \"three\";\nimport {Viewer} from './js/main';\nimport {ContextMenu} from \"./context-menu\";\nimport {LayerSwitcher} from \"./layer-switcher\";\nimport {useCallback, useEffect, useRef, useState} from \"react\";\nimport {createStyles, makeStyles, Theme, useTheme} from \"@material-ui/core/styles\";\nimport {changeMeasureUnits, selectData, selectView} from '../redux/projections-slice';\nimport {useSelector, useDispatch} from 'react-redux';\nimport {\n getCameraFileAssets,\n getPointCloudAssets,\n getOrthoAssets,\n selectAllAssets\n} from \"../redux/assets-slice\";\nimport {headerHeight} from \"../app\";\nimport LocalScene from \"./js/projections\";\nimport {\n selectName,\n selectProjectModified\n} from \"../redux/project-slice\";\nimport {assetDrawerWidth, assetDrawerHeight} from \"../asset-drawer\";\nimport {Button} from \"@material-ui/core\";\nimport RotateLeftIcon from '@material-ui/icons/RotateLeft';\nimport {changeAvailableClassifications, changeSwitched,\n selectViewerSwitched} from \"../redux/settings-slice\";\nimport { CursorTooltip } from \"../tooltips\";\nimport { AlertDialog } from \"../dialogs\";\nimport {isDevMode} from '../electron-modules';\nimport { useSnackbar } from 'notistack';\nimport {\n changeCameraState,\n changeSavedAerialState,\n initialAerialState,\n initialSceneState,\n isValidAerialState,\n isValidCameraState,\n selectBasicAdjustments,\n selectCameraHeight,\n selectCameraState,\n selectCameraTransform,\n selectSavedAerialState\n} from \"../redux/camera-slice\";\nimport { readTransformFile } from \"../camera-utils\";\nimport proj4 from 'proj4';\nimport {register} from 'ol/proj/proj4';\nimport { throttle } from 'throttle-debounce';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n parent: {\n flex: 1\n },\n large: {\n width: '100%',\n height: `calc(100% - ${headerHeight}px)`,\n position: 'fixed'\n },\n small: {\n width: `${assetDrawerWidth}px`,\n height: `${100-assetDrawerHeight}%`,\n position: 'absolute',\n background: 'white',\n margin: '0.5em',\n border: '1px solid',\n zIndex: 1\n },\n offsetSmall: {\n bottom: theme.spacing(0),\n margin: theme.spacing(0),\n borderTop: \"1px solid black\",\n zIndex: theme.zIndex.modal,\n border: \"none\"\n },\n offsetLarge: {\n marginLeft: assetDrawerWidth,\n width: `calc(100% - ${assetDrawerWidth}px)`,\n },\n gradient: {\n 'background-image': 'linear-gradient(45deg, #fdfcfb 0%, #e2d1c3 100%);'\n },\n buttonParent: {\n padding: \"3px\",\n background: \"rgba(255,255,255,0.4)\",\n position: 'absolute',\n top: \"0.5em\",\n left: \"0.5em\",\n \"z-index\": \"10\",\n \"border-radius\": \"5px\",\n \"-webkit-transition\": \"-webkit-transform .3s ease-in-out\",\n \"transition\": \"transform .3s ease-in-out\",\n \"&:hover\": {\n \"-webkit-transform\": \"rotate(-180deg)\",\n transform: \"rotate(-180deg)\"\n }\n },\n button: {\n padding: \"0px\",\n background: \"rgba(0,60,136,0.5)\",\n color: \"white\",\n \"min-width\": \"24px\",\n \"&:hover\": {\n background: \"rgba(0,60,136,0.7)\",\n }\n }\n }),\n);\n\nconst ViewSwitcher = props => {\n const {classes, visible, handleSwitched} = props;\n\n return (\n \n {visible && (
\n \n \n \n
)}\n
\n );\n};\n\nexport const SceneViewer = (props) => {\n const viewer = props.viewer as Viewer;\n const {setViewer, assetDrawerState, setAddObservations,\n setMeasurements, resetObservationType, setSingleAlignment,\n orthoLabelOpen, setOrthoLabelOpen, setCategoryList,\n closeAllTools} = props;\n\n const theme = useTheme();\n const classes = useStyles(theme);\n const dispatch = useDispatch();\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const assets = useSelector(selectAllAssets);\n\n const dataProjection = useSelector(selectData);\n const viewProjection = useSelector(selectView);\n const cameraTransformPath = useSelector(selectCameraTransform);\n const projectModifiedDate = useSelector(selectProjectModified);\n const projectName = useSelector(selectName);\n const viewerSwitched = useSelector(selectViewerSwitched);\n const cameraHeight = useSelector(selectCameraHeight);\n const basicAdjustments = useSelector(selectBasicAdjustments);\n const savedAerialState = useSelector(selectSavedAerialState);\n const savedCameraState = useSelector(selectCameraState);\n\n const divRef = useRef(null);\n const mapRef = useRef(null);\n\n const [viewerTooltipText, updateViewerTooltipText] = useState(\"\");\n const [aerialTooltipText, updateAerialTooltipText] = useState(\"\");\n const [customAlertHTML, setCustomAlertHTML] = useState(null);\n const [aerialState, setAerialState] = useState({\n ...initialAerialState\n });\n const [cameraState, setCameraState] = useState({\n ...initialSceneState\n });\n const [contextState, setContextState] = useState({\n mouseX: null,\n mouseY: null,\n isPoint: null,\n id: null\n });\n\n const tooltipThrottleMilliseconds = 10;\n\n const setViewerTooltipText = useCallback(throttle(\n tooltipThrottleMilliseconds, (value) => {\n updateViewerTooltipText(value);\n }), []);\n\n const setAerialTooltipText = useCallback(throttle(\n tooltipThrottleMilliseconds, (value) => {\n updateAerialTooltipText(value);\n }), []);\n\n const clearTooltipText = () => {\n setViewerTooltipText(\"\");\n setAerialTooltipText(\"\");\n };\n\n const contextMenuClick = (event, isPoint=null, id=null) => {\n event.preventDefault();\n setContextState({\n mouseX: event.clientX - 2,\n mouseY: event.clientY - 4,\n isPoint: isPoint,\n id: id\n });\n };\n\n const getClasses = (switched) => {\n let mapClasses = [];\n let viewerClasses = [classes.gradient];\n\n const classLarge = [\n classes.large,\n assetDrawerState ? classes.offsetLarge : \"\"\n ];\n const classSmall = [\n classes.small,\n assetDrawerState ? classes.offsetSmall : \"\"\n ];\n\n if (switched) {\n mapClasses = [...mapClasses, ...classLarge];\n viewerClasses = [...viewerClasses, ...classSmall];\n } else {\n mapClasses = [...mapClasses, ...classSmall];\n viewerClasses = [...viewerClasses, ...classLarge];\n }\n\n return {\n viewerClasses: viewerClasses.join(\" \"),\n mapClasses: mapClasses.join(\" \")\n };\n };\n\n const handleSwitched = () => {\n dispatch(changeSwitched(!viewerSwitched));\n };\n\n const triggerWindowResize = () => {\n window.dispatchEvent(new Event('resize'));\n };\n\n const clearAllAssets = () => {\n // Adding an empty array will clear everything\n addAllAssets([]);\n };\n\n const addAllAssets = (assetList) => {\n viewer?.checkShiftReset();\n\n // Add/remove images\n const camerasFiles = getCameraFileAssets(assetList);\n viewer?.reconcileCameras(camerasFiles, cameraHeight,\n basicAdjustments, savedCameraState);\n\n // Add/remove pointclouds\n const pointClouds = getPointCloudAssets(assetList);\n viewer?.reconcilePointClouds(pointClouds, savedCameraState);\n\n // Add/remove orthomosiacs\n const orthoFiles = getOrthoAssets(assetList);\n viewer?.reconcileOrthos(orthoFiles);\n };\n\n useEffect(() => {\n /** Ran after new project is created or project is loaded */\n closeAllTools();\n viewer?.resetDefaultAerialState(savedAerialState);\n viewer?.resetDefaultOrbitState();\n }, [projectModifiedDate]);\n\n useEffect(() => {\n let validState = isValidCameraState(cameraState);\n if (!validState) {\n return;\n }\n\n dispatch(changeCameraState(cameraState));\n }, [cameraState]);\n\n useEffect(() => {\n let validState = isValidAerialState(aerialState);\n if (!validState) {\n return;\n }\n\n dispatch(changeSavedAerialState(aerialState));\n }, [aerialState]);\n\n useEffect(() => {\n viewer?.setProjectName(projectName);\n }, [viewer, projectName]);\n\n useEffect(() => {\n clearTooltipText();\n triggerWindowResize();\n if (viewerSwitched) {\n viewer?.removeInteractions();\n }\n }, [viewerSwitched]);\n\n useEffect(() => {\n triggerWindowResize();\n }, [assetDrawerState]);\n\n useEffect(() => {\n const interval = setInterval(() => {\n if (viewer) {\n const classifications = viewer.getAvailableClassifications();\n dispatch(changeAvailableClassifications(classifications));\n }\n }, 1000);\n\n return () => {\n clearInterval(interval);\n };\n }, [viewer, dispatch]);\n\n useEffect(() => {\n const viewerProps = {\n contextMenuClick,\n setMeasurements,\n setAerialState,\n setSingleAlignment,\n setViewerTooltipText,\n setAerialTooltipText,\n setAddObservations,\n resetObservationType,\n showMessage,\n setCameraState,\n orthoLabelOpen,\n setOrthoLabelOpen,\n setCategoryList\n };\n\n let viewerRef = new Viewer(divRef.current, mapRef.current, viewerProps);\n setViewer(viewerRef);\n\n if (isDevMode) {\n // Temporary global for easy access\n window['viewer'] = viewerRef;\n window['local'] = LocalScene;\n window['THREE'] = THREE;\n }\n\n return () => {\n console.log(\"Destroy viewer\");\n viewerRef.destroy();\n };\n }, []);\n\n useEffect(() => {\n // Register current projection for openlayers to use\n proj4.defs(dataProjection.name, dataProjection.string);\n register(proj4);\n\n // Clear previous asset data\n clearAllAssets();\n viewer?.resetLoadedOnce();\n\n // Update projection\n viewer?.setDataProjection(dataProjection);\n\n // Force assets to reload\n addAllAssets(assets);\n }, [viewer, dataProjection]);\n\n useEffect(() => {\n viewer?.setViewProjection(viewProjection);\n\n const units = LocalScene.viewProjectionUnits;\n dispatch(changeMeasureUnits(units));\n }, [viewer, viewProjection]);\n\n useEffect(() => {\n if (cameraTransformPath === null) {\n viewer?.resetCameraMatrix();\n return;\n }\n\n readTransformFile(cameraTransformPath)\n .then(data => {\n const {success, content} = data;\n\n if (success) {\n viewer?.setCameraMatrix(content);\n } else {\n showMessage(content, {\n variant: \"error\"\n });\n }\n });\n }, [viewer, cameraTransformPath]);\n\n useEffect(() => {\n viewer?.setCameraHeights(cameraHeight);\n }, [viewer, cameraHeight]);\n\n useEffect(() => {\n viewer?.setCameraAdjustments(basicAdjustments);\n }, [viewer, basicAdjustments]);\n\n useEffect(() => {\n addAllAssets(assets);\n }, [viewer, assets]);\n\n let {viewerClasses, mapClasses} = getClasses(viewerSwitched);\n\n return (\n \n
\n {/* Viewer div */}\n \n {\n setViewerTooltipText(\"\");\n }}\n >\n \n \n
\n \n\n {/* Map div */}\n \n {\n setAerialTooltipText(\"\");\n }}\n >\n \n \n
\n \n
\n\n {/* Viewer alert dialog */}\n {\n setCustomAlertHTML(null);\n }}\n >\n
\n \n \n );\n};","import React, {useEffect, useState} from 'react';\nimport {app, dialog, copydir, fs, fsPromises, ipcRenderer, isDevMode} from './electron-modules';\nimport {store} from './redux/store';\nimport slash from 'slash';\nimport path from 'path';\nimport { AssetType, selectAllAssets, getCameraFileAssets, getOrthoAssets, getPointCloudAssets } from './redux/assets-slice';\nimport LocalScene from './viewer/js/projections';\nimport {PythonExecutable} from './executable';\nimport {useSelector} from 'react-redux';\nimport {\n Box,\n Button,\n CircularProgress,\n createStyles,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n LinearProgress,\n LinearProgressProps,\n makeStyles,\n Theme,\n Typography,\n useTheme\n} from '@material-ui/core';\nimport { AlertDialog } from './dialogs';\nimport { openDirectory } from './asset-utils';\nimport {Asset} from './redux/assets-slice';\nimport sanitize from \"sanitize-filename\";\nimport { selectName } from './redux/project-slice';\nimport { useSnackbar } from 'notistack';\n\nconst processTimeout = 1000;\nconst dataPathName = \"asset-data\";\nconst pointsFolder = \"points\";\nconst imagesFolder = \"images\";\nconst dialogTitle = \"Data Export\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n warning: {\n color: theme.palette.warning.main\n },\n exportText: {\n padding: theme.spacing(1)\n },\n contentCenter: {\n textAlign: \"center\"\n },\n cancelProgress: {\n marginRight: theme.spacing(1)\n },\n cancelContent: {\n paddingBottom: theme.spacing(3)\n }\n }),\n);\n\nconst LinearProgressWithLabel = (props: LinearProgressProps & { value: number }) => {\n return (\n \n \n \n \n \n {`${Math.round(\n props.value,\n )}%`}\n \n \n );\n};\n\nconst initialState = {\n rootOutputPath: null,\n webOutputPath: null,\n assets: [] as Asset[],\n numAssets: 0,\n currentIndex: 0\n};\n\nexport const StaticExporter = (props) => {\n const {exportModalOpen, setExportModalOpen} = props;\n\n const theme = useTheme();\n const classes = useStyles(theme);\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const assets = useSelector(selectAllAssets);\n const orthoFiles = getOrthoAssets(assets);\n const pointClouds = getPointCloudAssets(assets);\n const camerasFiles = getCameraFileAssets(assets);\n\n const projectName = useSelector(selectName);\n\n const [exportName, setExportName] = useState(\"\");\n const [dataExportOpen, setDataExportOpen] = useState(false);\n const [runnable, setRunnable] = useState(false);\n const [successOpen, setSuccessOpen] = useState(false);\n const [cancelOpen, setCancelOpen] = useState(false);\n const [cancelling, setCancelling] = useState(false);\n const [finishing, setFinishing] = useState(false);\n const [runningExe, setRunningExe] = useState(null);\n const [exportTopMessage, setExportTopMessage] = useState(\"\");\n const [exportBottomMessage, setExportBottomMessage] = useState(\"\");\n const [exportPercent, setExportPercent] = useState(0);\n const [exportAssets, setExportAssets] = useState<{\n rootOutputPath: string | null,\n webOutputPath: string | null\n assets: Asset[]\n numAssets: number\n currentIndex: number\n }>(initialState);\n\n const numClouds = pointClouds.length;\n const numCameras = camerasFiles.length;\n const numOrthos = orthoFiles.length;\n const canExport = (numClouds > 0) || (numCameras > 0) || (numOrthos > 0);\n const numRawPointcloud = pointClouds.filter(x => x.type === AssetType.LAS).length;\n\n const handleOpen = () => {\n setExportModalOpen(true);\n };\n\n const handleClose = () => {\n setExportModalOpen(false);\n };\n\n const onExportFinished = () => {\n setRunnable(false);\n setDataExportOpen(false);\n };\n\n const handleExportCancel = () => {\n onExportFinished();\n setCancelling(true);\n setNewRunningExe(null);\n };\n\n const setNewRunningExe = (exe) => {\n runningExe?.destroy();\n setRunningExe(exe);\n };\n\n const handleExport = () => {\n handleClose();\n exportToHtml(pointClouds, camerasFiles);\n };\n\n const setExportMessage = (top = \"\", bottom = \"\") => {\n setExportTopMessage(top);\n setExportBottomMessage(bottom);\n };\n\n const getAssetIndex = (state, asset) => {\n const assetIds = state.assets.map(x => x.id);\n const index = assetIds.indexOf(asset.id);\n return index;\n };\n\n const createNewFolder = async (folderPath) => {\n await deleteFolder(folderPath);\n await fsPromises.mkdir(folderPath);\n };\n\n const deleteFolder = async (folderPath) => {\n const folderExists = fs.existsSync(folderPath);\n if (folderExists) {\n await fsPromises.rmdir(folderPath, {recursive: true});\n }\n };\n\n const moveCameraData = async (asset, dataPath) => {\n const output = `${imagesFolder}-${asset.id}`;\n const imagesPath = path.join(dataPath, output);\n\n await createNewFolder(imagesPath);\n\n return new Promise(async (resolve) => {\n const imagesData = asset.data;\n for (let i=0;i {\n resolve(true);\n }, processTimeout);\n });\n };\n\n const moveEncompassData = async (asset, dataPath) => {\n const inputPath = asset.data.path;\n const output = `${pointsFolder}-${asset.id}`;\n const pointPath = path.join(dataPath, output);\n\n return new Promise((resolve) => {\n copydir(inputPath, pointPath, {}, err => {\n if (err) {\n dialog.showErrorBox('Error', `An error occurred while exporting ${asset.name}`);\n return;\n }\n\n setTimeout(() => {\n resolve(true);\n }, processTimeout);\n });\n });\n };\n\n const moveRawPointcloud = async (asset, dataPath) => {\n const units = LocalScene.dataProjectionUnits;\n const inputPath = asset.data.path;\n const output = `${pointsFolder}-${asset.id}`;\n const pointPath = path.join(dataPath, output);\n\n return new Promise((resolve) => {\n let commands = [\n \"-p\", \"process_las\",\n \"--input_path\", inputPath,\n \"--output_folder\", pointPath,\n \"--units\", units\n ];\n\n const exe = new PythonExecutable();\n setNewRunningExe(exe);\n\n exe.run({\n command: commands,\n parseLineData: false,\n onLine: text => {\n setExportBottomMessage(text);\n },\n onClose: () => {\n setTimeout(() => {\n resolve(true);\n }, processTimeout);\n }\n });\n });\n };\n\n const updateCameraDataState = (asset, state) => {\n const assetIndex = getAssetIndex(state, asset);\n const output = `${imagesFolder}-${asset.id}`;\n\n const imagesData = asset.data;\n imagesData.forEach((imageData, imageIndex) => {\n const imageName = path.basename(imageData.path);\n const finalPath = path.join(dataPathName, output, imageName);\n state.assets[assetIndex].data[imageIndex].path = `./${finalPath}`;\n });\n };\n\n const updateEncompassDataState = (asset, state) => {\n const assetIndex = getAssetIndex(state, asset);\n const output = `${pointsFolder}-${asset.id}`;\n const finalPath = path.join(dataPathName, output);\n state.assets[assetIndex].data.path = `./${finalPath}`;\n };\n\n const updateRawPointcloudDataState = (asset, state) => {\n const assetIndex = getAssetIndex(state, asset);\n const output = `${pointsFolder}-${asset.id}`;\n const finalPath = path.join(dataPathName, output, \"points\");\n state.assets[assetIndex].data.path = `./${finalPath}`;\n state.assets[assetIndex].type = AssetType.Encompass;\n };\n\n const updateCameraTransformPath = (state, outputPath) => {\n const dataPath = path.join(outputPath, dataPathName);\n\n const outputName = \"camera.4x4\";\n const matrixPath = state.camera.transform;\n const newImagePath = path.join(dataPath, outputName);\n\n if (matrixPath) {\n fsPromises.copyFile(matrixPath, newImagePath);\n const finalPath = path.join(dataPathName, outputName);\n state.camera.transform = `./${finalPath}`;\n }\n };\n\n const moveAssetData = async (asset, outputPath) => {\n const dataPath = path.join(outputPath, dataPathName);\n\n if (asset.type === AssetType.Encompass) {\n await moveEncompassData(asset, dataPath);\n } else if (asset.type === AssetType.LAS) {\n await moveRawPointcloud(asset, dataPath);\n } else if (asset.type === AssetType.Panoramic) {\n await moveCameraData(asset, dataPath);\n } else if (asset.type === AssetType.Planar) {\n await moveCameraData(asset, dataPath);\n }\n };\n\n const finishExport = (webOutputPath, rootOutputPath) => {\n setExportMessage(\"Export project state\");\n\n const state = JSON.parse(JSON.stringify(store.getState()));\n const assets = exportAssets.assets;\n\n assets.forEach(asset => {\n if (asset.type === AssetType.Encompass) {\n updateEncompassDataState(asset, state);\n } else if (asset.type === AssetType.LAS) {\n updateRawPointcloudDataState(asset, state);\n } else if (asset.type === AssetType.Panoramic) {\n updateCameraDataState(asset, state);\n } else if (asset.type === AssetType.Planar) {\n updateCameraDataState(asset, state);\n }\n });\n\n // Update camera transform path\n updateCameraTransformPath(state, webOutputPath);\n\n setExportPercent(100);\n\n const projectJson = JSON.stringify(state, null, 2);\n const projectPath = path.join(webOutputPath, \"static.json\");\n\n const miniViewerPath = getMiniViewerPath();\n const exeOutputPath = path.join(rootOutputPath, path.basename(miniViewerPath));\n fs.copyFileSync(miniViewerPath, exeOutputPath);\n\n fs.writeFile(projectPath, projectJson, (err) => {\n if (err) {\n dialog.showErrorBox('Error', 'An error occurred while exporting static html');\n }\n\n setTimeout(() => {\n setDataExportOpen(false);\n setNewRunningExe(null);\n setSuccessOpen(true);\n }, processTimeout);\n });\n };\n\n const exportToHtml = (pointClouds, cameras) => {\n const buildPath = getBuildPath();\n\n (async () => {\n new PythonExecutable().run({\n command: ['--check-tool', 'exporter']\n });\n })();\n\n openDirectory().then(async outputFolder => {\n if (!outputFolder) {\n return;\n }\n\n setExportPercent(0);\n setDataExportOpen(true);\n setExportMessage(\"Creating output folder\");\n\n // Create final output folder\n const rootOutputPath = path.join(outputFolder, exportName);\n await createNewFolder(rootOutputPath);\n\n // Create final output folder\n const webOutputPath = path.join(rootOutputPath, \"web\");\n await createNewFolder(webOutputPath);\n\n setExportMessage(\"Copy html files output folder\");\n\n copydir(buildPath, webOutputPath, {}, err => {\n if (err) {\n dialog.showErrorBox('Error', 'An error occurred while exporting static html');\n return;\n }\n\n setExportMessage(\"Preparing data to export\");\n\n setTimeout(async () => {\n const dataPath = path.join(webOutputPath, dataPathName);\n await createNewFolder(dataPath);\n\n const assets = [...cameras, ...pointClouds];\n\n if (assets.length === 0) {\n // Skip directly to final step\n finishExport(webOutputPath, rootOutputPath);\n return;\n }\n\n setExportAssets({\n webOutputPath: webOutputPath,\n rootOutputPath: rootOutputPath,\n assets: assets,\n numAssets: assets.length,\n currentIndex: 0\n });\n setRunnable(true);\n }, processTimeout);\n });\n });\n };\n\n const getBuildPath= () => {\n const appPath = slash(app.getAppPath());\n const buildPath = isDevMode\n ? path.join(appPath, \"build\")\n : path.join(path.dirname(appPath), \"app.asar.unpacked\", \"build\");\n\n return buildPath;\n };\n\n const getMiniViewerPath= () => {\n const appPath = slash(app.getAppPath());\n const buildPath = isDevMode\n ? path.join(appPath, \"miniviewer.exe\")\n : path.join(path.dirname(appPath), \"app.asar.unpacked\", \"miniviewer.exe\");\n\n return buildPath;\n };\n\n useEffect(() => {\n ipcRenderer?.removeAllListeners(\"open-static-export\");\n ipcRenderer?.on(\"open-static-export\", () => {\n if (canExport) {\n handleOpen();\n return;\n }\n\n showMessage(\"No data loaded\", {\n variant: \"error\"\n });\n });\n }, [ipcRenderer, canExport]);\n\n useEffect(() => {\n setExportName(`export [${sanitize(projectName)}]`);\n }, [projectName]);\n\n useEffect(() => {\n const currentIndex = exportAssets.currentIndex;\n const numAssets = exportAssets.numAssets;\n const webOutputPath = exportAssets.webOutputPath;\n const assets = exportAssets.assets;\n const toProcess = assets[currentIndex];\n\n if (!toProcess) {\n return;\n }\n\n if (!runnable) {\n return;\n }\n\n // Process one asset from the list\n const processNextAsset = async () => {\n setExportTopMessage(`Processing data: ${toProcess.name}`);\n await moveAssetData(toProcess, webOutputPath);\n\n const nextIndex = currentIndex + 1;\n const percent = 100.0 * nextIndex / numAssets;\n setExportPercent(percent);\n setExportAssets({\n ...exportAssets,\n currentIndex: nextIndex\n });\n\n if (nextIndex === numAssets) {\n setFinishing(true);\n } else {\n setCancelling(false);\n }\n };\n processNextAsset();\n }, [exportAssets, runnable]);\n\n useEffect(() => {\n if (cancelling) {\n setCancelOpen(true);\n } else {\n setTimeout(async () => {\n // Delete output folder and close modal\n const webOutputPath = exportAssets.webOutputPath;\n await deleteFolder(webOutputPath);\n setCancelOpen(false);\n }, processTimeout);\n }\n }, [cancelling]);\n\n useEffect(() => {\n if (!finishing) {\n return;\n }\n\n if (!cancelling) {\n // Reached the end and not cancelling export\n const webOutputPath = exportAssets.webOutputPath;\n const rootOutputPath = exportAssets.rootOutputPath;\n finishExport(webOutputPath, rootOutputPath);\n }\n\n setCancelling(false);\n setFinishing(false);\n }, [finishing]);\n\n const pointListItem = numClouds > 0 ?\n `
  • Point Cloud${numClouds !== 1 ? \"s\" : \"\"} (${numClouds})
  • `\n : \"\";\n\n const cameraListItem = numCameras > 0\n ? `
  • Camera File${numCameras !== 1 ? \"s\" : \"\"} (${numCameras})
  • `\n : \"\";\n\n const orthoListItem = numOrthos > 0\n ? `
  • Orthomosaic${numOrthos !== 1 ? \"s\" : \"\"} (${numOrthos})
  • `\n : \"\";\n\n return (\n \n {/* Exporting dialog */}\n \n {\"Exporting HTML\"}\n\n \n \n {exportTopMessage}\n \n\n \n {exportBottomMessage}\n \n\n \n \n\n \n \n Cancel Export\n \n \n \n\n {/* Main dialog */}\n \n {dialogTitle}\n\n \n ${exportName} will be created.\n

    \n Export data includes:\n
      \n ${pointListItem}\n ${cameraListItem}\n ${orthoListItem}\n
    \n `\n }}/>\n\n {(numRawPointcloud > 0) && (\n This process may take some time due to the conversion process.\n )}\n
    \n\n \n \n\n \n Export\n \n \n \n\n {/* Cancelling dialog */}\n \n {dialogTitle}\n \n \n \n Cancelling export\n \n \n \n\n {/* Success dialog */}\n {\n setSuccessOpen(false);\n }}\n >\n \n Successfully exported data to static HTML\n \n \n
    \n );\n};\n","import {MainAppBar} from \"./app-bar\";\nimport React, {useEffect, useState} from \"react\";\nimport {createMuiTheme} from \"@material-ui/core/styles\";\nimport {ThemeProvider} from '@material-ui/styles';\nimport {SettingsDrawer} from \"./settings-drawer\";\nimport {AssetDrawer} from \"./asset-drawer\";\nimport {ProjectionsManager} from \"./projections/manager\";\nimport {ImageAlignerAdvanced, ImageAlignerBasic} from \"./alignment\";\nimport {ImageLabelling} from \"./labelling/image-labelling\";\nimport {SceneViewer} from \"./viewer/viewer\";\nimport {Backdrop, Box, CircularProgress, createStyles, makeStyles, Theme} from \"@material-ui/core\";\nimport {useDispatch, useSelector} from 'react-redux';\nimport {addAssetFolder, isAssetFile} from './asset-utils';\nimport {changeDrawerOpen, changeSelectedTab, selectDrawerOpen, selectSelectedTab} from \"./redux/settings-slice\";\nimport {useSnackbar} from 'notistack';\nimport {app, dialog, isDevMode, isStaticSite, remote} from \"./electron-modules\";\nimport path from 'path';\nimport slash from \"slash\";\nimport {loadProjectFile, loadProjectJSON, projectFileType} from \"./project-utils\";\nimport {StaticExporter} from \"./static-export\";\nimport {PythonExecutable, WorkflowExecutable} from \"./executable\";\n\nexport const headerHeight = 48;\nexport const drawerWidth = 280;\n\n// NOTE: Custom theme colors work but need to be manually added\ndeclare module \"@material-ui/core/styles/createPalette\" {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface Palette {\n custom: Palette['primary'];\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface PaletteOptions {\n custom: PaletteOptions['primary'];\n }\n}\n\nconst theme = createMuiTheme({\n zIndex: {\n appBar: 1100,\n modal: 1250,\n drawer: 1200,\n snackbar: 1400,\n tooltip: 1500\n },\n overrides: {\n MuiPopover: {\n root: {\n \"z-index\": \"1300 !important\"\n }\n },\n MuiTooltip: {\n tooltip: {\n backgroundColor: \"rgba(0, 0, 0, 0.5)\",\n },\n arrow: {\n \"&::before\": {\n backgroundColor: \"rgba(0, 0, 0, 0.5)\",\n border: \"0px\"\n }\n },\n }\n },\n palette: {\n primary: {\n main: '#162031'\n },\n secondary: {\n main: '#dd0c29'\n },\n custom: {\n main: '#5c6ac4',\n },\n },\n mixins: {\n toolbar: {\n // override default\n }\n }\n});\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n backdrop: {\n color: '#fff',\n zIndex: theme.zIndex.snackbar + 1,\n flexDirection: \"column\",\n },\n backdropText: {\n padding: theme.spacing(1)\n }\n }),\n);\n\nconst DragDropLoader = (props) => {\n const {setAssetDrawerState, assetDrawerState, addFilePathsFunc} = props;\n\n const handleDrop = async event => {\n if (isStaticSite) {\n return;\n }\n\n const files = [...event.dataTransfer.files]\n .map(file => slash(file.path));\n\n addFilePathsFunc(files);\n };\n\n const handleDragOver = event => {\n if (isStaticSite) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n\n if (!assetDrawerState) {\n // Only trigger change if the draw was closed. This will avoid\n // performance issues due to calling the dispatch function too often\n setAssetDrawerState(true);\n }\n };\n\n return (\n \n {props.children}\n
    \n );\n};\n\nconst BackdropToggle = () => {\n const classes = useStyles(theme);\n const [backdropOpen, setBackdropOpen] = useState(false);\n\n const handleClose = () => {\n setBackdropOpen(false);\n };\n\n const handleOpen = () => {\n setBackdropOpen(true);\n };\n\n return (\n \n \n\n \n\n \n \n \n \n );\n};\n\nexport const App = () => {\n const dispatch = useDispatch();\n\n const projectDrawerState = useSelector(selectDrawerOpen);\n const projectActiveTab = useSelector(selectSelectedTab);\n const showMessage = useSnackbar().enqueueSnackbar;\n\n const [viewer, setViewer] = useState(null);\n const [assetDrawerState, setDrawerState] = useState(false);\n const [settingsDrawerState, setSettingsDrawerState] = useState(false);\n const [measurements, setMeasurements] = useState([]);\n const [singleAlignment, setSingleAlignment] = useState([0, 0, 0]);\n const [activeTab, setSelectedTab] = useState(0);\n const [tabsEnabled, setTabsEnabled] = useState(true);\n const [addObservations, setAddObservations] = useState(false);\n const [observationType, setObservationType] = useState(\"none\");\n const [categoryList, setCategoryList] = useState([]);\n const [alignerAdvOpen, setAlignerAdvOpen] = useState(false);\n const [alignerBasicOpen, setAlignerBasicOpen] = useState(false);\n const [imageLabelOpen, setImageLabelOpen] = useState(false);\n const [projectionsOpen, setProjectionsOpen] = useState(false);\n const [exportModalOpen, setExportModalOpen] = useState(false);\n\n const setDefaultTab = () => {\n setTabValue(0);\n };\n\n const setTabValue = (value) => {\n dispatch(changeSelectedTab(value));\n };\n\n const setAssetDrawerState = (state) => {\n dispatch(changeDrawerOpen(state));\n };\n\n const resetObservationType = () => {\n setObservationType(\"none\");\n };\n\n\n\n const getAllFileArgs = () => {\n try {\n\n let rawArgs = remote.process.argv;\n let fileArgs = rawArgs.slice(1, rawArgs.length);\n let args = fileArgs.map((arg) => slash(arg.toString()));\n return args;\n } catch {\n return null;\n }\n };\n\n const addFilePaths = files => {\n if (!files || files.length === 0) {\n return;\n }\n\n const configs = files.filter(x => {\n return path.extname(x) === `.${projectFileType}`;\n });\n\n const assets = files.filter(x => isAssetFile(x));\n\n if (configs.length > 0) {\n // Load first config file (ignore other files)\n const success = loadProjectFile(configs[0]);\n if (success) {\n showMessage(\"Load project config file\", {\n variant: \"success\"\n });\n }\n return;\n }\n\n if (assets.length > 0) {\n // Add new assets\n addAssetFolder(showMessage, dispatch, assets);\n }\n };\n\n /** Load geospatial file from launch arguments */\n const loadFromCompiledExe = () => {\n let paths = getAllFileArgs();\n\n // Load files from command line. addFilePaths\n // makes sure that invalid files will be ignored\n addFilePaths(paths);\n };\n\n /** Load project json from relative location */\n const loadFromStaticSite = () => {\n console.log(\"Load static site project config file\");\n\n const cache = Date.now();\n fetch(`./static.json?cache=${cache}`)\n .then(res => res.text())\n .then(response => {\n loadProjectJSON(response);\n })\n .catch(() => {\n console.error(\"Error reading static website config\");\n });\n };\n\n /** Close all active tool modals */\n const closeAllTools = () => {\n setAlignerAdvOpen(false);\n setAlignerBasicOpen(false);\n setImageLabelOpen(false);\n setProjectionsOpen(false);\n setExportModalOpen(false);\n };\n\n useEffect(() => {\n if (isDevMode || isStaticSite) {\n return;\n }\n\n new PythonExecutable().run({\n command: ['--check-tool', 'viewer'],\n onLine: jsonData => {\n if (!jsonData.available) {\n dialog.showMessageBox({\n title: 'Invalid License',\n message: 'This product is not licensed. If you have a valid license key, please open SOLV3D Engine and activate your license using the License Manager.',\n buttons: ['Exit', 'Open Engine'],\n type: 'error',\n noLink: true\n }).then(selection => {\n if (selection.response === 1) {\n new WorkflowExecutable().run({command: []});\n }\n\n app.quit();\n });\n }\n },\n });\n }, []);\n\n useEffect(() => {\n if (isStaticSite) {\n // Block browser context menu\n window.oncontextmenu = event => {\n event.preventDefault();\n };\n\n loadFromStaticSite();\n } else {\n loadFromCompiledExe();\n }\n }, []);\n\n useEffect(() => {\n setDrawerState(projectDrawerState);\n }, [projectDrawerState]);\n\n useEffect(() => {\n setSelectedTab(projectActiveTab);\n }, [projectActiveTab]);\n\n useEffect(() => {\n let width = settingsDrawerState ? drawerWidth : 0;\n viewer?.updateCompassOffset(width);\n }, [viewer, settingsDrawerState]);\n\n return (\n \n \n {(!isStaticSite) && ()}\n\n \n\n \n\n {\n setSettingsDrawerState(false);\n }}\n />\n\n \n\n \n\n \n\n \n\n \n {\n setAssetDrawerState(true);\n }}\n handleSettingsDrawerOpen={() => {\n setSettingsDrawerState(true);\n }}\n assetDrawerState={assetDrawerState}\n />\n\n \n\n {/* Debug stats panel */}\n
    \n\n \n \n
    \n );\n};\n\nexport const showBackdrop = () => {\n const button = document.getElementById(\"backdrop-show\");\n button.click();\n};\n\nexport const hideBackdrop = () => {\n const button = document.getElementById(\"backdrop-hide\");\n button.click();\n};","import React, { useRef } from 'react';\nimport ReactDOM from 'react-dom';\nimport {App} from \"./app\";\nimport {\n saveProjectAs,\n loadProject,\n saveProject,\n newProject\n} from \"./project-utils\";\nimport {Provider} from 'react-redux';\nimport {store} from './redux/store';\nimport {\n getCurrentWindow,\n Menu,\n isDevMode,\n remote,\n fs,\n shell,\n logDirectoryPath\n} from './electron-modules';\nimport {\n WorkflowExecutable,\n PythonExecutable\n} from \"./executable\";\nimport { SnackbarProvider } from 'notistack';\nimport { Button } from '@material-ui/core';\nimport Zoom from '@material-ui/core/Zoom';\n\nconst sendToMainWindow = (message, payload=null) => {\n const mainWindow = remote.getCurrentWindow();\n mainWindow.webContents.send(message, payload);\n};\n\nconst loadLogDirectory = () => {\n fs.promises.mkdir(logDirectoryPath).catch(() => {});\n shell.openPath(logDirectoryPath);\n};\n\nconst generateTemplateList = () => {\n // Generate menu from templates\n let template = [fileMenu, toolsMenu, helpMenu] as any[];\n\n if (isDevMode) {\n template.push(debugMenu);\n }\n\n return template;\n};\n\nconst fileMenu = {\n label: 'File',\n submenu: [\n {\n label: 'Open Engine Workflow',\n click: async () => {\n new WorkflowExecutable().run({command: []});\n }\n },\n {type: 'separator'},\n {\n label: 'New Project',\n click: async () => {\n newProject();\n }\n },\n {\n label: 'Open Project',\n click: async () => {\n loadProject();\n }\n },\n {\n label: 'Save Project',\n click: async () => {\n saveProject();\n }\n },\n {\n label: 'Save Project as...',\n click: async () => {\n saveProjectAs();\n }\n },\n {type: 'separator'},\n {role: 'quit'}\n ]\n};\n\nconst helpMenu = {\n label: 'Help',\n submenu: [\n {\n label: 'Open Log Directory',\n click: loadLogDirectory\n }\n ]\n};\n\nconst toolsMenu = {\n label: 'Tools',\n id: 'tools',\n submenu: [\n {\n id: 'projections',\n label: 'Projection Manager',\n click: async () => {\n sendToMainWindow(\"open-projection-manager\");\n }\n },\n {\n id: 'aligner-advanced-menu',\n label: 'Data Aligner (Advanced)',\n enabled: false,\n click: async () => {\n sendToMainWindow(\"open-image-aligner-adv\");\n }\n },\n {\n id: 'aligner-basic-menu',\n label: 'Data Aligner (Basic)',\n enabled: false,\n click: async () => {\n sendToMainWindow(\"open-image-aligner-basic\");\n }\n },\n {\n id: 'label-ortho-menu',\n label: 'Aerial Classification',\n enabled: false,\n click: async () => {\n sendToMainWindow(\"open-label-ortho\");\n }\n },\n {\n id: 'label-scene-menu',\n label: 'Scene View Classification',\n enabled: false,\n visible: false, // Disabled until we make more progress on the export side\n click: async () => {\n sendToMainWindow(\"open-label-scene\");\n }\n },\n {\n id: 'exporter-menu',\n label: 'Export',\n enabled: false,\n click: async () => {\n sendToMainWindow(\"open-static-export\");\n }\n }\n ]\n};\n\nconst debugMenu = {\n label: 'Refresh',\n click: () => {\n getCurrentWindow().reload();\n }\n};\n\nconst setToolAvailability = async toolName => {\n const exe = new PythonExecutable();\n exe.run({\n command: ['--check-tool', toolName],\n showStatus: false,\n onLine: jsonData => {\n Menu.getApplicationMenu().items\n .find(item => item.id === 'tools').submenu.items\n .find(item => item.id === toolName).enabled = jsonData.available;\n }\n });\n};\n\nconst checkAllowedMenuItems = async () => {\n // TODO: check all tools at once\n setToolAvailability('aligner-advanced-menu');\n setToolAvailability('aligner-basic-menu');\n setToolAvailability('exporter-menu');\n setToolAvailability('label-ortho-menu');\n setToolAvailability('label-scene-menu');\n};\n\nif (Menu) {\n const template = generateTemplateList();\n const menu = Menu.buildFromTemplate(template);\n Menu.setApplicationMenu(menu);\n checkAllowedMenuItems();\n}\n\nconst MessageProvider = (props) => {\n const messageRef = useRef(null);\n\n const onMessageClose = key => () => {\n messageRef.current.closeSnackbar(key);\n };\n\n return (\n (\n \n )}\n >\n {props.children}\n \n );\n};\n\nReactDOM.render(\n \n \n \n \n ,\n document.getElementById('root')\n);","import path from \"path\";\n\n/** Electron specific modules that will fail for static html site */\n\nexport const electron = window.require ? window.require(\"electron\") : null;\n\nexport const remote = electron ? electron.remote : null;\n\nexport const shell = electron ? electron.shell : null;\n\nexport const ipcRenderer = electron ? electron.ipcRenderer : null;\n\nexport const child = electron ? window.require(\"child_process\") : null;\n\nexport const process = electron ? window.require(\"process\") : null;\n\nexport const dialog = remote ? remote.dialog : null;\n\nexport const app = remote ? remote.app : null;\n\nexport const getCurrentWindow = electron ? electron.remote.getCurrentWindow : null;\n\nexport const Menu = remote ? remote.Menu : null;\n\nexport const fs = remote ? remote.require('fs') : null;\n\nexport const fsPromises = fs ? fs.promises : null;\n\nexport const csv = remote ? remote.require('fast-csv') : null;\n\nexport const copydir = remote ? remote.require('copy-dir') : null;\n\nexport const glob = remote ? remote.require('glob') : null;\n\nexport const isDevMode = remote ? (app.isPackaged === false) : false;\n\nexport const isStaticSite = electron ? false : true;\n\nexport const logDirectoryPath = app\n ? path.join(app.getPath('userData'), \"logs\")\n : null;\n\nexport const storage = remote ? remote.require('electron-json-storage-sync') : {\n get: () => {\n return {status: false};\n },\n set: () => {}\n};\n"],"sourceRoot":""}