potree
repository·develop·Indexed 26 days ago
https://github.com/potree/potreeA WebGL point cloud viewer, version 1.8.0.
What's inside potree
- Cesium is a cross-platform, cross-browser JavaScript library for creating 3D globes and 2D maps without requiring plugins. It leverages WebGL for high-performance, hardware-accelerated graphics, making it suitable for visualizing static and time-dynamic content.
Overview of jsTree
developjsTree is an open-source jQuery plugin that provides interactive trees. It is highly configurable, themable, and extendable. Key features include:
- Support for HTML and JSON data sources.
- AJAX and asynchronous callback loading.
- Drag & drop support.
- Keyboard navigation.
- Inline editing (create and delete nodes).
- Tri-state checkboxes.
- Fuzzy searching.
- Customizable node types.
- Built-in mobile theme for responsive design.
- Compatibility with both
content-boxandborder-boxCSS box models.
Install and include three.js
developYou can use three.js in your project by either downloading the minified library and including it via a
<script>tag, or by installing it as a module.To include the minified version directly in your HTML:
<script src="js/three.min.js"></script><script src="js/three.min.js"></script>Use GeoPackage JS in Node.js
developIn Node.js, GeoPackage JS uses
node-sqlite3for reading GeoPackages andPureImagefor tile rendering. You can open a GeoPackage file usingGeoPackageAPI.open(filename, callback)and then interact with tile and feature tables.var GeoPackageAPI = require('@ngageoint/geopackage') , GeoPackageManager = GeoPackageAPI.GeoPackageManager , GeoPackageConnection = GeoPackageAPI.GeoPackageConnection , GeoPackageTileRetriever = GeoPackageAPI.GeoPackageTileRetriever; GeoPackageAPI.open(filename, function(err, geoPackage) { // Now you can operate on the GeoPackage // get the tile table names geoPackage.getTileTables(function(err, tileTableNames) { // tileTableNames is an array of all tile table names // get the info for the first table geoPackage.getTileDaoWithTableName(tileTableNames[0], function(err, tileDao) { geoPackage.getInfoForTable(tileDao, function(err, info) { // do something with the tile table info }); // draw a tile into a canvas for an XYZ tile var canvas = canvasFromSomewhere; var gpr = new GeoPackageTileRetriever(tileDao, 256, 256); var x = 0; var y = 0; var zoom = 0; console.time('Draw tile ' + x + ', ' + y + ' zoom: ' + zoom); gpr.drawTileIn(x, y, zoom, canvas, function() { console.timeEnd('Draw tile ' + x + ', ' + y + ' zoom: ' + zoom); }); // or get a tile base64 data URL for an XYZ tile gpr.getTile(x, y, zoom, function(err, tileBase64DataURL) { console.log('got the base64 data url'); }); // or get a tile from a GeoPackage tile column and tile row tileDao.queryForTile(tileColumn, tileRow, zoom, function(err, tile) { var tileData = tile.getTileData(); // the raw bytes from the GeoPackage }); }); }); // get the feature table names geoPackage.getFeatureTables(function(err, featureTableNames) { // featureTableNames is an array of all feature table names // get the info for the first table geoPackage.getFeatureDaoWithTableName(featureTableNames[0], function(err, featureDao) { geoPackage.getInfoForTable(featureDao, function(err, info) { // do something with the feature table info }); // query for all features featureDao.queryForEach(function(err, row, rowDone) { var feature = featureDao.getFeatureRow(row); var geometry = currentRow.getGeometry(); if (geometry) { var geom = geometry.geometry; var geoJson = geometry.geometry.toGeoJSON(); geoJson.properties = {}; for (var key in feature.values) { if(feature.values.hasOwnProperty(key) && key != feature.getGeometryColumn().name) { var column = info.columnMap[key]; geoJson.properties[column.displayName] = currentRow.values[key]; } } } rowDone(); }); }); }); });Initialize sql.js in the browser
developIn the browser,
sql.jsmust be loaded asynchronously. You must include the.jsloader and provide alocateFileconfiguration if the.wasmfile is not in the same directory as your HTML file. TheinitSqlJsfunction is globally provided by the main distribution files.<script src='/dist/sql-wasm.js'></script> <script> const config = { locateFile: filename => `/dist/${filename}` }; initSqlJs(config).then(function(SQL) { // SQL is now available var db = new SQL.Database(); }); </script>Use GeoPackage JS in the Browser
developIn the browser, GeoPackage JS uses
sql.jsto read GeoPackages and HTML5 Canvas for tile rendering. To load a GeoPackage from a file input, read the file as anArrayBuffer, convert it to aUint8Array, and useGeoPackageConnection.connectWithDatabaseto initialize the connection.// attach this method to a file input onchange event window.loadGeoPackage = function(files) { var f = files[0]; var r = new FileReader(); r.onload = function() { var array = new Uint8Array(r.result); loadByteArray(array); } r.readAsArrayBuffer(f); } function loadByteArray(array, callback) { var db = new SQL.Database(array); GeoPackageConnection.connectWithDatabase(db, function(err, connection) { var geoPackage = new GeoPackage('', '', connection); // Now you can operate on the GeoPackage // get the tile table names geoPackage.getTileTables(function(err, tileTableNames) { // tileTableNames is an array of all tile table names // get the info for the first table geoPackage.getTileDaoWithTableName(tileTableNames[0], function(err, tileDao) { geoPackage.getInfoForTable(tileDao, function(err, info) { // do something with the tile table info }); // draw a tile into a canvas for an XYZ tile var canvas = canvasFromSomewhere; var gpr = new GeoPackageTileRetriever(tileDao, 256, 256); var x = 0; var y = 0; var zoom = 0; console.time('Draw tile ' + x + ', ' + y + ' zoom: ' + zoom); gpr.drawTileIn(x, y, zoom, canvas, function() { console.timeEnd('Draw tile ' + x + ', ' + y + ' zoom: ' + zoom); }); // or get a tile base64 data URL for an XYZ tile gpr.getTile(x, y, zoom, function(err, tileBase64DataURL) { console.log('got the base64 data url'); }); // or get a tile from a GeoPackage tile column and tile row tileDao.queryForTile(tileColumn, tileRow, zoom, function(err, tile) { var tileData = tile.getTileData(); // the raw bytes from the GeoPackage }); }); }); // get the feature table names geoPackage.getFeatureTables(function(err, featureTableNames) { // featureTableNames is an array of all feature table names // get the info for the first table geoPackage.getFeatureDaoWithTableName(featureTableNames[0], function(err, featureDao) { geoPackage.getInfoForTable(featureDao, function(err, info) { // do something with the feature table info }); // query for all features featureDao.queryForEach(function(err, row, rowDone) { var feature = featureDao.getFeatureRow(row); var geometry = currentRow.getGeometry(); if (geometry) { var geom = geometry.geometry; var geoJson = geometry.geometry.toGeoJSON(); geoJson.properties = {}; for (var key in feature.values) { if(feature.values.hasOwnProperty(key) && key != feature.getGeometryColumn().name) { var column = info.columnMap[key]; geoJson.properties[column.displayName] = currentRow.values[key]; } } } rowDone(); }); }); }); }); }Populate a tree using HTML
developThe simplest way to create a tree is by using existing inline HTML. Select the container element using a jQuery selector and invoke the
.jstree()function. You can also use$.jstree.create(element).You can pass configuration options to specific nodes using the
data-jstreeattribute.<div id="container"> <ul> <li>Root node <ul> <li>Child node 1</li> <li>Child node 2</li> </ul> </li> </ul> </div> <script> $(function() { $('#container').jstree(); }); </script>Install Spectrum via Bower
developYou can pull down Spectrum using Bower.
bower install spectrumLoad JSON5 files using Node.js require()
developYou can enable nativerequire()support for.json5files in Node.js by registering the library first.Use sql.js in a Web Worker
developTo avoid blocking the main thread during intensive queries, use the Web Worker API. You must use the specific worker distribution files:dist/worker.sql-wasm.jsanddist/worker.sql-wasm.wasm. The Web Worker API is more limited than the main API.Build Spectrum Locally
developTo run the development version, use Grunt to automate testing, linting, and building.
- Install the Grunt CLI globally:
npm install -g grunt-cli - Install project dependencies:
npm install - Run tests and linting:
grunt - Run tests, linting, and build a minified version:
grunt build
npm install -g grunt-cli npm install # runs jshint and the unit test suite grant # runs jshint, the unit test suite, and builds a minified version of the file. grant build- Install the Grunt CLI globally:
Implement a custom Ticker for TweenJS
developBy default, TweenJS uses theTickerclass from EaselJS. If you want to avoid including the minified EaselJS provided in thelibs/tweendirectory, you must implement your own ticking mechanism to drive the animations.