FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
potree/examples/annotations.html at develop · i4works/potree · GitHub
i4works
/
potree
Public
forked from
potree/potree
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
potree
/
examples
/
annotations.html
Copy path
More file actions
More file actions
Latest commit
History
History
History
229 lines (192 loc) · 7.96 KB
Breadcrumbs
potree
/
examples
/
annotations.html
Copy path
File metadata and controls
229 lines (192 loc) · 7.96 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<!DOCTYPE html
>
<
html
lang
="
en
"
>
<
head
>
<
meta
charset
="
utf-8
"
>
<
meta
name
="
description
"
content
=""
>
<
meta
name
="
author
"
content
=""
>
<
meta
name
="
viewport
"
content
="
width=device-width, initial-scale=1.0, user-scalable=no
"
>
<
title
>
Potree Viewer
</
title
>
<
link
rel
="
stylesheet
"
type
="
text/css
"
href
="
../build/potree/potree.css
"
>
<
link
rel
="
stylesheet
"
type
="
text/css
"
href
="
../libs/jquery-ui/jquery-ui.min.css
"
>
<
link
rel
="
stylesheet
"
type
="
text/css
"
href
="
../libs/openlayers3/ol.css
"
>
<
link
rel
="
stylesheet
"
type
="
text/css
"
href
="
../libs/spectrum/spectrum.css
"
>
<
link
rel
="
stylesheet
"
type
="
text/css
"
href
="
../libs/jstree/themes/mixed/style.css
"
>
</
head
>
<
body
>
<
script
src
="
../libs/jquery/jquery-3.1.1.min.js
"
>
</
script
>
<
script
src
="
../libs/spectrum/spectrum.js
"
>
</
script
>
<
script
src
="
../libs/jquery-ui/jquery-ui.min.js
"
>
</
script
>
<
script
src
="
../libs/other/BinaryHeap.js
"
>
</
script
>
<
script
src
="
../libs/tween/tween.min.js
"
>
</
script
>
<
script
src
="
../libs/d3/d3.js
"
>
</
script
>
<
script
src
="
../libs/proj4/proj4.js
"
>
</
script
>
<
script
src
="
../libs/openlayers3/ol.js
"
>
</
script
>
<
script
src
="
../libs/i18next/i18next.js
"
>
</
script
>
<
script
src
="
../libs/jstree/jstree.js
"
>
</
script
>
<
script
src
="
../build/potree/potree.js
"
>
</
script
>
<
script
src
="
../libs/plasio/js/laslaz.js
"
>
</
script
>
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
<!-- INCLUDE SETTINGS HERE -->
<
div
class
="
potree_container
"
style
="
position: absolute; width: 100%; height: 100%; left: 0px; top: 0px;
"
>
<
div
id
="
potree_render_area
"
style
="
background-image: url('../build/potree/resources/images/background.jpg');
"
>
</
div
>
<
div
id
="
potree_sidebar_container
"
>
</
div
>
</
div
>
<
script
type
="
module
"
>
import
*
as
THREE
from
"../libs/three.js/build/three.module.js"
;
window
.
viewer
=
new
Potree
.
Viewer
(
document
.
getElementById
(
"potree_render_area"
)
)
;
viewer
.
setEDLEnabled
(
true
)
;
viewer
.
setFOV
(
60
)
;
viewer
.
setPointBudget
(
1_000_000
)
;
viewer
.
loadSettingsFromURL
(
)
;
viewer
.
setBackground
(
"skybox"
)
;
viewer
.
loadGUI
(
(
)
=>
{
viewer
.
setLanguage
(
'en'
)
;
$
(
"#menu_scene"
)
.
next
(
)
.
show
(
)
;
viewer
.
toggleSidebar
(
)
;
}
)
;
viewer
.
setDescription
(
`
This example shows various ways to use annotations.
They can be used to bookmark and describe locations,
move the camera to a predefined point of view on click,
and to provide programmable buttons at specific locations.
`
)
;
let
sceneSG
=
new
Potree
.
Scene
(
)
;
let
sceneLion
=
new
Potree
.
Scene
(
)
;
viewer
.
setScene
(
sceneSG
)
;
// Sorvilier point cloud in scene 1
Potree
.
loadPointCloud
(
"../pointclouds/vol_total/cloud.js"
,
"sigeom.sa"
,
function
(
e
)
{
sceneSG
.
addPointCloud
(
e
.
pointcloud
)
;
sceneSG
.
view
.
position
.
set
(
590030
,
231767
,
1007
)
;
sceneSG
.
view
.
lookAt
(
new
THREE
.
Vector3
(
589844
,
231376
,
710
)
)
;
let
material
=
e
.
pointcloud
.
material
;
material
.
size
=
1
;
material
.
pointSizeType
=
Potree
.
PointSizeType
.
ADAPTIVE
;
{
{
let
elTitle
=
$
(
`
<span>
About Annotations
<img src="
${
Potree
.
resourcePath
}
/icons/goto.svg"
name="action_set_scene"
class="annotation-action-icon"
style="filter: invert(1);" />
</span>
`
)
;
elTitle
.
find
(
"img[name=action_set_scene]"
)
.
click
(
(
event
)
=>
{
event
.
stopPropagation
(
)
;
viewer
.
setScene
(
sceneLion
)
;
}
)
;
elTitle
.
toString
=
(
)
=>
"About Annotations"
;
let
aAbout1
=
new
Potree
.
Annotation
(
{
position
:
[
590043.63
,
231490.79
,
740.78
]
,
title
:
elTitle
,
cameraPosition
:
[
590105.53
,
231541.63
,
782.05
]
,
cameraTarget
:
[
590043.63
,
231488.79
,
740.78
]
,
description
:
`<ul><li>Click on the annotation label to move a predefined view.</li>
<li>Click on the icon to execute the specified action.</li>
In this case, the action will bring you to another scene and point cloud.</ul>`
}
)
;
sceneSG
.
annotations
.
add
(
aAbout1
)
;
}
{
let
aAbout2
=
new
Potree
.
Annotation
(
{
position
:
[
589621
,
231437
,
784
]
,
"cameraPosition"
:
[
589585.81
,
231463.63
,
804.00
]
,
"cameraTarget"
:
[
589625.86
,
231439
,
775.38
]
,
"title"
:
"About Annotations 2"
,
"description"
:
`
Suitable annotation positions and views can be obtained by
looking up the current camera position and target in the "Scene" panel,
or by evaluating following lines in your browser's developer console:<br><br>
<code>viewer.scene.view.position</code><br>
<code>viewer.scene.view.getPivot()</code><br>
`
}
)
;
sceneSG
.
annotations
.
add
(
aAbout2
)
;
}
{
// Annotation with action icons
// Create title element with jquery
let
elTitle
=
$
(
`
<span>
<img name="action_elevation" src="
${
Potree
.
resourcePath
}
/icons/profile.svg" class="annotation-action-icon"/>
<img name="action_rgb" src="
${
Potree
.
resourcePath
}
/icons/rgb.svg" class="annotation-action-icon"/>
</span>`
)
;
elTitle
.
find
(
"img[name=action_elevation]"
)
.
click
(
(
)
=>
{
viewer
.
scene
.
pointclouds
.
forEach
(
pc
=>
pc
.
material
.
activeAttributeName
=
"elevation"
)
;
}
)
;
elTitle
.
find
(
"img[name=action_rgb]"
)
.
click
(
(
)
=>
{
viewer
.
scene
.
pointclouds
.
forEach
(
pc
=>
pc
.
material
.
activeAttributeName
=
"rgba"
)
;
}
)
;
// Give the annotation a meaningful string representation for the sidebar
elTitle
.
toString
=
(
)
=>
"Elevation / RGB Actions"
;
// Same as with other annotations, except title is a jquery object this time.
let
aActions
=
new
Potree
.
Annotation
(
{
position
:
[
590012.986
,
231273.294
,
787.162
]
,
title
:
elTitle
}
)
;
sceneSG
.
annotations
.
add
(
aActions
)
;
}
{
// Annotation with action icons
// Create title element with jquery
let
schemes
=
[
{
name
:
"SPECTRAL"
,
icon
:
`
${
Potree
.
resourcePath
}
/icons/gradients_spectral.png`
}
,
{
name
:
"YELLOW_GREEN"
,
icon
:
`
${
Potree
.
resourcePath
}
/icons/gradients_yellow_green.png`
}
,
{
name
:
"PLASMA"
,
icon
:
`
${
Potree
.
resourcePath
}
/icons/gradients_plasma.png`
}
,
{
name
:
"GRAYSCALE"
,
icon
:
`
${
Potree
.
resourcePath
}
/icons/gradients_grayscale.png`
}
,
{
name
:
"RAINBOW"
,
icon
:
`
${
Potree
.
resourcePath
}
/icons/gradients_rainbow.png`
}
,
]
;
let
elTitle
=
$
(
`<span>Gradient Schemes:</span>`
)
;
for
(
let
scheme
of
schemes
)
{
let
button
=
$
(
`<img src="
${
scheme
.
icon
}
" class="annotation-action-icon" style="width: 2em; height: auto;"/>`
)
;
button
.
click
(
(
)
=>
{
for
(
let
pointcloud
of
viewer
.
scene
.
pointclouds
)
{
pointcloud
.
material
.
activeAttributeName
=
"elevation"
;
pointcloud
.
material
.
gradient
=
Potree
.
Gradients
[
scheme
.
name
]
;
}
}
)
;
elTitle
.
append
(
button
)
;
}
// Give the annotation a meaningful string representation for the sidebar
elTitle
.
toString
=
(
)
=>
"Gradient Color Selection"
;
// Same as with other annotations, except title is a jquery object this time.
let
aActions
=
new
Potree
.
Annotation
(
{
position
:
[
589577.396
,
231267.514
,
807.655
]
,
title
:
elTitle
,
}
)
;
sceneSG
.
annotations
.
add
(
aActions
)
;
}
{
let
aTrees
=
new
Potree
.
Annotation
(
{
position
:
[
589850.15
,
231300.10
,
770.94
]
,
title
:
"Trees"
,
description
:
`Point cloud of a small section in Sorvilier, Switzerland. <br>
Courtesy of sigeom.sa`
,
}
)
;
aTrees
.
domElement
.
off
(
"mouseenter"
)
;
aTrees
.
domElement
.
off
(
"mouseleave"
)
;
aTrees
.
addEventListener
(
"click"
,
(
)
=>
{
aTrees
.
setHighlighted
(
!
aTrees
.
isHighlighted
)
;
}
)
;
sceneSG
.
annotations
.
add
(
aTrees
)
;
}
}
}
)
;
// Lion point cloud in scene 2
Potree
.
loadPointCloud
(
"../pointclouds/lion_takanawa/cloud.js"
,
"lion"
,
function
(
e
)
{
sceneLion
.
addPointCloud
(
e
.
pointcloud
)
;
sceneLion
.
view
.
position
.
set
(
4.15
,
-
6.12
,
8.54
)
;
sceneLion
.
view
.
lookAt
(
new
THREE
.
Vector3
(
0
,
-
0.098
,
4.23
)
)
;
e
.
pointcloud
.
material
.
pointSizeType
=
Potree
.
PointSizeType
.
ADAPTIVE
;
sceneLion
.
addAnnotation
(
[
0.72
,
-
1
,
8
]
,
{
"title"
:
"Chinese Guardian Lion"
,
"actions"
:
[
{
"icon"
:
Potree
.
resourcePath
+
"/icons/goto.svg"
,
"onclick"
:
function
(
)
{
viewer
.
setScene
(
sceneSG
)
;
}
}
]
}
)
;
}
)
;
</
script
>
</
body
>
</
html
>
Back
|
FazBrowse Home
|
New Git URL