diff --git a/examples/examples.json b/examples/examples.json new file mode 100644 index 00000000..4cf80c21 --- /dev/null +++ b/examples/examples.json @@ -0,0 +1,24 @@ +{ + "examples": [ + {"thumb": "thumbnails/animation_paths.png", "label": "Animations", "url": "animation_paths.html"}, + {"thumb": "thumbnails/annotation_hierarchy.png", "label": "Hierarchical Annotations", "url": "annotation_hierarchy.html"}, + {"thumb": "thumbnails/annotations.png", "label": "Annotations", "url": "annotations.html"}, + {"thumb": "thumbnails/cesium_ca13.png", "label": "Cesium CA13", "url": "cesium_ca13.html"}, + {"thumb": "thumbnails/cesium_sorvilier.png", "label": "Cesium Sorvilier", "url": "cesium_sorvilier.html"}, + {"thumb": "thumbnails/clipping_volume.png", "label": "Clipping Volume", "url": "clipping_volume.html"}, + {"thumb": "thumbnails/custom_sidebar_section.png", "label": "Custom Sidebar Section", "url": "custom_sidebar_section.html"}, + {"thumb": "thumbnails/elevation_profile.png", "label": "Elevation Profile", "url": "elevation_profile.html"}, + {"thumb": "thumbnails/embedded_iframe.png", "label": "Embedded Iframe", "url": "embedded_iframe.html"}, + {"thumb": "thumbnails/gradient_colors.png", "label": "Gradient Colors", "url": "gradient_colors.html"}, + {"thumb": "thumbnails/heidentor.png", "label": "Heidentor", "url": "heidentor.html"}, + {"thumb": "thumbnails/light_animated.png", "label": "Animated Light", "url": "light_animated.html"}, + {"thumb": "thumbnails/light_ca13.png", "label": "Light CA13", "url": "light_ca13.html"}, + {"thumb": "thumbnails/lines.png", "label": "Lines", "url": "lines.html"}, + {"thumb": "thumbnails/lion.png", "label": "Lion", "url": "lion.html"}, + {"thumb": "thumbnails/lion_las.png", "label": "Lion LAS", "url": "lion_las.html"}, + {"thumb": "thumbnails/lion_las.png", "label": "Lion LAZ", "url": "lion_las.html"}, + {"thumb": "thumbnails/measurements.png", "label": "Measurements", "url": "measurements.html"}, + {"thumb": "thumbnails/multiple_point_clouds.png", "label": "Multiple Point Clouds", "url": "multiple_point_clouds.html"}, + {"thumb": "thumbnails/shapefiles.png", "label": "Shapefiles", "url": "shapefiles.html"}, + {"thumb": "thumbnails/viewer.png", "label": "Basic Viewer", "url": "viewer.html"} +]} \ No newline at end of file diff --git a/examples/light_ca13.html b/examples/light_ca13.html index c32cabd2..56452340 100644 --- a/examples/light_ca13.html +++ b/examples/light_ca13.html @@ -153,6 +153,8 @@ { viewer.onGUILoaded(() => { + console.log("adding to gui"); + // Add entries to object list in sidebar let tree = $(`#jstree_scene`); let parentNode = "other"; diff --git a/examples/page.html b/examples/page.html new file mode 100644 index 00000000..3c2c8cde --- /dev/null +++ b/examples/page.html @@ -0,0 +1,75 @@ + + + + + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/examples/pagetest.html b/examples/pagetest.html new file mode 100644 index 00000000..385395b3 --- /dev/null +++ b/examples/pagetest.html @@ -0,0 +1,170 @@ + + + + + + +
+ +
+
Animations
+
+
+ +
+
Hierarchical Annotations
+
+
+ +
+
Annotations
+
+
+ +
+
Cesium CA13
+
+
+ +
+
Cesium Sorvilier
+
+
+ +
+
Clipping Volume
+
+
+ +
+
Custom Sidebar Section
+
+
+ +
+
Elevation Profile
+
+
+ +
+
Embedded Iframe
+
+
+ +
+
Gradient Colors
+
+
+ +
+
Heidentor
+
+
+ +
+
Animated Light
+
+
+ +
+
Light CA13
+
+
+ +
+
Lines
+
+
+ +
+
Lion
+
+
+ +
+
Lion LAS
+
+
+ +
+
Lion LAZ
+
+
+ +
+
Measurements
+
+
+ +
+
Multiple Point Clouds
+
+
+ +
+
Shapefiles
+
+
+ +
+
Basic Viewer
+
+
+ +
+
+ + arena4d.html
+ + ca13.html
+ + ca13_feature_test.html
+ + entwine_greyhound.html
+ + examples.json
+ + lasmap.html
+ + light.html
+ + lion_laz.html
+ + meshes.html
+ + morro_bay_shp
+ + multiple_pointclouds.html
+ + page.html
+ + pagetest.html
+ + sorvilier_feature_test.html
+ + thumbnails
+ +
+ + + \ No newline at end of file diff --git a/examples/thumbnails/animation_paths.png b/examples/thumbnails/animation_paths.png new file mode 100644 index 00000000..6faa89dc Binary files /dev/null and b/examples/thumbnails/animation_paths.png differ diff --git a/examples/thumbnails/annotation_hierarchy.png b/examples/thumbnails/annotation_hierarchy.png new file mode 100644 index 00000000..018f98aa Binary files /dev/null and b/examples/thumbnails/annotation_hierarchy.png differ diff --git a/examples/thumbnails/annotations.png b/examples/thumbnails/annotations.png new file mode 100644 index 00000000..8a3b7a66 Binary files /dev/null and b/examples/thumbnails/annotations.png differ diff --git a/examples/thumbnails/cesium_ca13.png b/examples/thumbnails/cesium_ca13.png new file mode 100644 index 00000000..93d70afc Binary files /dev/null and b/examples/thumbnails/cesium_ca13.png differ diff --git a/examples/thumbnails/cesium_sorvilier.png b/examples/thumbnails/cesium_sorvilier.png new file mode 100644 index 00000000..bd94aef7 Binary files /dev/null and b/examples/thumbnails/cesium_sorvilier.png differ diff --git a/examples/thumbnails/clipping_volume.png b/examples/thumbnails/clipping_volume.png new file mode 100644 index 00000000..0afe1488 Binary files /dev/null and b/examples/thumbnails/clipping_volume.png differ diff --git a/examples/thumbnails/custom_sidebar_section.png b/examples/thumbnails/custom_sidebar_section.png new file mode 100644 index 00000000..bfb3df93 Binary files /dev/null and b/examples/thumbnails/custom_sidebar_section.png differ diff --git a/examples/thumbnails/elevation_profile.png b/examples/thumbnails/elevation_profile.png new file mode 100644 index 00000000..8f55c59a Binary files /dev/null and b/examples/thumbnails/elevation_profile.png differ diff --git a/examples/thumbnails/embedded_iframe.png b/examples/thumbnails/embedded_iframe.png new file mode 100644 index 00000000..8558c40d Binary files /dev/null and b/examples/thumbnails/embedded_iframe.png differ diff --git a/examples/thumbnails/gradient_colors.png b/examples/thumbnails/gradient_colors.png new file mode 100644 index 00000000..255713af Binary files /dev/null and b/examples/thumbnails/gradient_colors.png differ diff --git a/examples/thumbnails/heidentor.png b/examples/thumbnails/heidentor.png new file mode 100644 index 00000000..288d7f4f Binary files /dev/null and b/examples/thumbnails/heidentor.png differ diff --git a/examples/thumbnails/light_animated.png b/examples/thumbnails/light_animated.png new file mode 100644 index 00000000..30582160 Binary files /dev/null and b/examples/thumbnails/light_animated.png differ diff --git a/examples/thumbnails/light_ca13.png b/examples/thumbnails/light_ca13.png new file mode 100644 index 00000000..8536160f Binary files /dev/null and b/examples/thumbnails/light_ca13.png differ diff --git a/examples/thumbnails/lines.png b/examples/thumbnails/lines.png new file mode 100644 index 00000000..37223e32 Binary files /dev/null and b/examples/thumbnails/lines.png differ diff --git a/examples/thumbnails/lion.png b/examples/thumbnails/lion.png new file mode 100644 index 00000000..9ea60a07 Binary files /dev/null and b/examples/thumbnails/lion.png differ diff --git a/examples/thumbnails/lion_las.png b/examples/thumbnails/lion_las.png new file mode 100644 index 00000000..0820cbed Binary files /dev/null and b/examples/thumbnails/lion_las.png differ diff --git a/examples/thumbnails/measurements.png b/examples/thumbnails/measurements.png new file mode 100644 index 00000000..04833317 Binary files /dev/null and b/examples/thumbnails/measurements.png differ diff --git a/examples/thumbnails/meshes.png b/examples/thumbnails/meshes.png new file mode 100644 index 00000000..b47262b9 Binary files /dev/null and b/examples/thumbnails/meshes.png differ diff --git a/examples/thumbnails/multiple_point_clouds.png b/examples/thumbnails/multiple_point_clouds.png new file mode 100644 index 00000000..2337b24f Binary files /dev/null and b/examples/thumbnails/multiple_point_clouds.png differ diff --git a/examples/thumbnails/shapefiles.png b/examples/thumbnails/shapefiles.png new file mode 100644 index 00000000..5a7f8d23 Binary files /dev/null and b/examples/thumbnails/shapefiles.png differ diff --git a/examples/thumbnails/viewer.png b/examples/thumbnails/viewer.png new file mode 100644 index 00000000..8c03c8ed Binary files /dev/null and b/examples/thumbnails/viewer.png differ diff --git a/gulpfile.js b/gulpfile.js index 65e8d8db..9b4193dc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -169,7 +169,7 @@ gulp.task("shaders", function(){ .pipe(gulp.dest('build/shaders')); }); -gulp.task("scripts", ['workers','shaders', "icons_viewer"], function(){ +gulp.task("scripts", ['workers','shaders', "icons_viewer", "examples_page"], function(){ gulp.src(paths.potree) .pipe(concat('potree.js')) .pipe(size({showFiles: true})) @@ -200,6 +200,93 @@ gulp.task('webserver', function() { server = connect.server({port: 1234}); }); +gulp.task('examples_page', function() { + + let settings = JSON.parse(fs.readFileSync("examples/examples.json", 'utf8')); + let files = fs.readdirSync("./examples"); + + let thumbCode = ``; + + let urls = settings.examples.map(e => e.url); + let unhandled = []; + for(let file of files){ + let isHandled = false; + for(let url of urls){ + + if(file.indexOf(url) !== -1){ + isHandled = true; + } + } + + if(!isHandled){ + unhandled.push(file); + } + } + + for(let example of settings.examples){ + thumbCode += ` +
+
${example.label}
+
+
+ `; + } + + let unhandledCode = ``; + for(let file of unhandled){ + unhandledCode += ` + ${file}
+ `; + } + + let page = ` + + + + + +
+ ${thumbCode} +
+
+ ${unhandledCode} +
+ + + `; + + fs.writeFile(`examples/pagetest.html`, page, (err) => { + if(err){ + console.log(err); + }else{ + console.log(`examples/pagetest.html`); + } + }); + + + +}); + gulp.task('icons_viewer', function() { let iconsPath = "resources/icons"; @@ -255,7 +342,6 @@ gulp.task('icons_viewer', function() { }else{ console.log(`created ${iconsPath}/index.html`); } - }); }); diff --git a/src/viewer/sidebar.js b/src/viewer/sidebar.js index ba922219..e04c6c68 100644 --- a/src/viewer/sidebar.js +++ b/src/viewer/sidebar.js @@ -241,6 +241,8 @@ initSidebar = (viewer) => { }else{ tree.jstree('uncheck_node', nodeID); } + + console.log("create node"); return nodeID; } diff --git a/src/viewer/viewer.js b/src/viewer/viewer.js index 43d7c1ec..bc189e25 100644 --- a/src/viewer/viewer.js +++ b/src/viewer/viewer.js @@ -897,32 +897,38 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{ $(() => { initSidebar(this); - }); - - let elProfile = $('
').load(new URL(Potree.scriptPath + '/profile.html').href, () => { - $(document.body).append(elProfile.children()); - this.profileWindow = new Potree.ProfileWindow(this); - this.profileWindowController = new Potree.ProfileWindowController(this); - - $('#profile_window').draggable({ - handle: $('#profile_titlebar'), - containment: $(document.body) - }); - $('#profile_window').resizable({ - containment: $(document.body), - handles: 'n, e, s, w' - }); if (callback) { $(callback); } - this.guiLoaded = true; + let elProfile = $('
').load(new URL(Potree.scriptPath + '/profile.html').href, () => { + $(document.body).append(elProfile.children()); + this.profileWindow = new Potree.ProfileWindow(this); + this.profileWindowController = new Potree.ProfileWindowController(this); + + $('#profile_window').draggable({ + handle: $('#profile_titlebar'), + containment: $(document.body) + }); + $('#profile_window').resizable({ + containment: $(document.body), + handles: 'n, e, s, w' + }); + }); + + $(() => { + this.guiLoaded = true; + console.log("gui loaded"); + for(let task of this.guiLoadTasks){ + task(); + } + + }); - for(let task of this.guiLoadTasks){ - task(); - } }); + + }); }