Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
ng-smart3d
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张启明
ng-smart3d
Commits
0bfc17a3
You need to sign in or sign up before continuing.
Commit
0bfc17a3
authored
Jan 07, 2020
by
张启明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: 添加粒子特效、模型剖切
parent
8cbe2c04
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
263 additions
and
26 deletions
+263
-26
app.component.html
src/app/app.component.html
+3
-1
app.module.ts
src/app/app.module.ts
+4
-0
index.ts
src/app/components/index.ts
+2
-0
measure-hander.component.ts
...pp/components/measure-handler/measure-hander.component.ts
+1
-1
index.ts
src/app/components/particle-effect/index.ts
+1
-0
particle-effect.component.css
.../components/particle-effect/particle-effect.component.css
+0
-0
particle-effect.component.html
...components/particle-effect/particle-effect.component.html
+11
-0
particle-effect.component.spec.ts
...ponents/particle-effect/particle-effect.component.spec.ts
+25
-0
particle-effect.component.ts
...p/components/particle-effect/particle-effect.component.ts
+106
-0
profile.component.css
src/app/components/profile/profile.component.css
+0
-3
profile.component.html
src/app/components/profile/profile.component.html
+2
-1
soil-excavation.component.css
.../components/soil-excavation/soil-excavation.component.css
+0
-3
soil-excavation.component.html
...components/soil-excavation/soil-excavation.component.html
+3
-3
soil-excavation.component.ts
...p/components/soil-excavation/soil-excavation.component.ts
+2
-5
index.ts
src/app/components/tileset-clipping/index.ts
+1
-0
tileset-clipping.component.css
...omponents/tileset-clipping/tileset-clipping.component.css
+0
-0
tileset-clipping.component.html
...mponents/tileset-clipping/tileset-clipping.component.html
+8
-0
tileset-clipping.component.spec.ts
...nents/tileset-clipping/tileset-clipping.component.spec.ts
+25
-0
tileset-clipping.component.ts
...components/tileset-clipping/tileset-clipping.component.ts
+63
-0
underground.component.html
src/app/components/underground/underground.component.html
+1
-1
viewshed.component.css
src/app/components/viewshed/viewshed.component.css
+0
-7
viewshed.component.html
src/app/components/viewshed/viewshed.component.html
+1
-1
styles.css
src/styles.css
+4
-0
No files found.
src/app/app.component.html
View file @
0bfc17a3
<div
id=
"container"
>
<div
class=
"widgets"
>
<div
class=
"widgets
text-white
"
>
<app-measure-handler></app-measure-handler>
<app-sight-line></app-sight-line>
<app-skyline></app-skyline>
...
...
@@ -7,6 +7,8 @@
<app-profile></app-profile>
<app-underground></app-underground>
<app-soil-excavation></app-soil-excavation>
<app-particle-effect></app-particle-effect>
<app-tileset-clipping></app-tileset-clipping>
<app-layer-manager></app-layer-manager>
</div>
</div>
src/app/app.module.ts
View file @
0bfc17a3
...
...
@@ -12,6 +12,8 @@ import {
ProfileComponent
,
UndergroundComponent
,
SoilExcavationComponent
,
ParticleEffectComponent
,
TilesetClippingComponent
,
}
from
'./components'
;
@
NgModule
({
...
...
@@ -25,6 +27,8 @@ import {
ProfileComponent
,
UndergroundComponent
,
SoilExcavationComponent
,
ParticleEffectComponent
,
TilesetClippingComponent
,
],
imports
:
[
BrowserModule
,
...
...
src/app/components/index.ts
View file @
0bfc17a3
...
...
@@ -6,3 +6,5 @@ export * from './viewshed';
export
*
from
'./profile'
;
export
*
from
'./underground'
;
export
*
from
'./soil-excavation'
;
export
*
from
'./particle-effect'
;
export
*
from
'./tileset-clipping'
;
src/app/components/measure-handler/measure-hander.component.ts
View file @
0bfc17a3
...
...
@@ -8,7 +8,7 @@ import { ViewerService } from 'src/app/services';
})
export
class
MeasureHandlerComponent
implements
OnInit
{
public
handleMeasure
:
(
measureMode
:
number
,
isGround
:
boolean
,
showLabel
:
boolean
)
=>
any
;
public
handleMeasure
:
(
measureMode
:
number
,
isGround
?:
boolean
,
showLabel
?
:
boolean
)
=>
any
;
public
measureMode
=
smart3d
.
MeasureMode
;
constructor
(
...
...
src/app/components/particle-effect/index.ts
0 → 100644
View file @
0bfc17a3
export
*
from
'./particle-effect.component'
;
src/app/components/particle-effect/particle-effect.component.css
0 → 100644
View file @
0bfc17a3
src/app/components/particle-effect/particle-effect.component.html
0 → 100644
View file @
0bfc17a3
<div>
<button
(
click
)="
enableParticleEffect
('
rain
')"
>
开启雨
</button>
<input
type=
"range"
(
change
)="
handleChangeRange
('
rain
',
$
event
)"
max=
"1"
min=
"0"
step=
"0.1"
[
disabled
]="
rainEffect =
==
undefined
"
>
<button
(
click
)="
enableParticleEffect
('
snow
')"
>
开启雪
</button>
<input
type=
"range"
(
change
)="
handleChangeRange
('
snow
',
$
event
)"
max=
"1"
min=
"0"
step=
"0.1"
[
disabled
]="
snowEffect =
==
undefined
"
>
<button
(
click
)="
enableParticleEffect
('
fog
')"
>
开启雾
</button>
<input
type=
"range"
(
change
)="
handleChangeRange
('
fog
',
$
event
)"
max=
"1"
min=
"0"
step=
"0.1"
[
disabled
]="
fogEffect =
==
undefined
"
>
<button
(
click
)="
enableParticleEffect
('
smoke
')"
>
添加烟
</button>
<button
(
click
)="
enableParticleEffect
('
fire
')"
>
添加火
</button>
</div>
\ No newline at end of file
src/app/components/particle-effect/particle-effect.component.spec.ts
0 → 100644
View file @
0bfc17a3
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
ParticleEffectComponent
}
from
'./particle-effect.component'
;
describe
(
'ParticleEffectComponent'
,
()
=>
{
let
component
:
ParticleEffectComponent
;
let
fixture
:
ComponentFixture
<
ParticleEffectComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
ParticleEffectComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ParticleEffectComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/particle-effect/particle-effect.component.ts
0 → 100644
View file @
0bfc17a3
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ViewerService
}
from
'src/app/services'
;
@
Component
({
selector
:
'app-particle-effect'
,
templateUrl
:
'./particle-effect.component.html'
,
styleUrls
:
[
'./particle-effect.component.css'
]
})
export
class
ParticleEffectComponent
implements
OnInit
{
private
particleEffect
;
public
rainEffect
;
public
snowEffect
;
public
fogEffect
;
constructor
(
private
viewerService
:
ViewerService
,
)
{
}
ngOnInit
(
)
{
const
viewer
=
this
.
viewerService
.
viewer
;
this
.
particleEffect
=
new
smart3d
.
ParticleEffect
(
viewer
);
}
enableParticleEffect
(
type
:
string
)
{
const
viewer
=
this
.
viewerService
.
viewer
;
const
cartesian
=
Cesium
.
Cartesian3
.
fromDegrees
(
115
,
24
,
250
);
let
options
;
switch
(
type
)
{
case
'rain'
:
if
(
undefined
===
this
.
rainEffect
)
{
this
.
rainEffect
=
new
smart3d
.
RainEffect
(
viewer
.
scene
);
this
.
rainEffect
.
add
();
}
break
;
case
'snow'
:
if
(
undefined
===
this
.
snowEffect
)
{
this
.
snowEffect
=
new
smart3d
.
SnowEffect
(
viewer
.
scene
);
this
.
snowEffect
.
add
();
}
break
;
case
'fog'
:
if
(
undefined
===
this
.
fogEffect
)
{
this
.
fogEffect
=
new
smart3d
.
FogEffect
(
viewer
.
scene
);
this
.
fogEffect
.
add
();
}
break
;
case
'smoke'
:
const
entity
=
viewer
.
entities
.
add
({
position
:
cartesian
});
options
=
{
particleMode
:
smart3d
.
ParticleMode
.
SMOKE
,
entity
,
minimumSpeed
:
1
,
maximumSpeed
:
5
,
minimumParticleLife
:
1
,
maximumParticleLife
:
4
,
startScale
:
1
,
endScale
:
5
,
emissionRate
:
5
,
imageSize
:
25
};
this
.
particleEffect
.
add
(
options
);
viewer
.
camera
.
lookAt
(
cartesian
,
new
Cesium
.
Cartesian3
(
-
100
,
0
,
100
));
viewer
.
camera
.
_setTransform
(
Cesium
.
Matrix4
.
IDENTITY
);
break
;
case
'fire'
:
const
fireEntity
=
viewer
.
entities
.
add
({
position
:
cartesian
});
options
=
{
particleMode
:
smart3d
.
ParticleMode
.
FIRE
,
entity
:
fireEntity
,
minimumSpeed
:
1
,
maximumSpeed
:
5
,
minimumParticleLife
:
1
,
maximumParticleLife
:
20
,
startScale
:
0
,
endScale
:
10
,
emissionRate
:
14
,
imageSize
:
10
};
this
.
particleEffect
.
add
(
options
);
viewer
.
camera
.
lookAt
(
cartesian
,
new
Cesium
.
Cartesian3
(
-
100
,
0
,
100
));
viewer
.
camera
.
_setTransform
(
Cesium
.
Matrix4
.
IDENTITY
);
break
;
}
}
handleChangeRange
(
type
:
string
,
e
):
void
{
const
value
:
number
=
Cesium
.
Math
.
clamp
(
e
.
target
.
value
,
0.0
,
1.0
);
switch
(
type
)
{
case
'rain'
:
break
;
case
'snow'
:
this
.
snowEffect
.
update
(
value
);
break
;
case
'fog'
:
this
.
fogEffect
.
update
(
value
);
break
;
}
}
}
src/app/components/profile/profile.component.css
View file @
0bfc17a3
.profile-container
{
color
:
white
;
}
src/app/components/profile/profile.component.html
View file @
0bfc17a3
<div
class=
"profile-container"
>
<div>
<button
(
click
)="
startProfileAnalyze
()"
>
点击开始剖面分析
</button>
剖面分析结果长度:{{ result.length }}
</div>
\ No newline at end of file
src/app/components/soil-excavation/soil-excavation.component.css
View file @
0bfc17a3
.soil-excavation-container
{
color
:
white
;
}
src/app/components/soil-excavation/soil-excavation.component.html
View file @
0bfc17a3
<div
class=
"soil-excavation-container"
>
<div>
<label
for=
"soil-excavation"
>
开挖深度:
</label>
<input
type=
"number"
id=
"soil-excavation"
min=
"0"
[(
ngModel
)]="
depth
"
(
ngModelChange
)="
changeDepth
($
event
)"
/>
<button
(
click
)="
start
Excavation
()"
>
开挖地形
</button>
<input
type=
"number"
id=
"soil-excavation"
min=
"0"
[(
ngModel
)]="
depth
"
/>
<button
(
click
)="
handleSoil
Excavation
()"
>
开挖地形
</button>
</div>
src/app/components/soil-excavation/soil-excavation.component.ts
View file @
0bfc17a3
...
...
@@ -20,11 +20,8 @@ export class SoilExcavationComponent implements OnInit {
this
.
terrainClip
.
updateDepth
(
this
.
depth
);
}
changeDepth
(
depth
:
number
)
{
this
.
terrainClip
.
updateDepth
(
depth
);
}
startExcavation
()
{
handleSoilExcavation
()
{
this
.
terrainClip
.
updateDepth
(
this
.
depth
);
this
.
terrainClip
.
start
(
this
.
depth
);
}
...
...
src/app/components/tileset-clipping/index.ts
0 → 100644
View file @
0bfc17a3
export
*
from
'./tileset-clipping.component'
;
src/app/components/tileset-clipping/tileset-clipping.component.css
0 → 100644
View file @
0bfc17a3
src/app/components/tileset-clipping/tileset-clipping.component.html
0 → 100644
View file @
0bfc17a3
<select
[(
ngModel
)]="
clippingPlane
"
>
<option
value=
"Z"
>
Z
</option>
<option
value=
"Y"
>
Y
</option>
<option
value=
"X"
>
X
</option>
</select>
<button
(
click
)="
enableClipping
()"
>
开启模型剖切
</button>
<button
(
click
)="
enableClipping
(
false
)"
>
关闭模型剖切
</button>
\ No newline at end of file
src/app/components/tileset-clipping/tileset-clipping.component.spec.ts
0 → 100644
View file @
0bfc17a3
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
TilesetClippingComponent
}
from
'./tileset-clipping.component'
;
describe
(
'TilesetClippingComponent'
,
()
=>
{
let
component
:
TilesetClippingComponent
;
let
fixture
:
ComponentFixture
<
TilesetClippingComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
TilesetClippingComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
TilesetClippingComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/tileset-clipping/tileset-clipping.component.ts
0 → 100644
View file @
0bfc17a3
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ViewerService
}
from
'src/app/services'
;
const
tilesetUrl
=
'https://www.south-smart.com/cesium/modeldata/nanfangcehuiBIM/NFCH0911/CHDLFC/tileset.json'
;
@
Component
({
selector
:
'app-tileset-clipping'
,
templateUrl
:
'./tileset-clipping.component.html'
,
styleUrls
:
[
'./tileset-clipping.component.css'
]
})
export
class
TilesetClippingComponent
implements
OnInit
{
public
clippingPlane
:
'X'
|
'Y'
|
'Z'
=
'Z'
;
private
tileset
;
private
clipping
;
constructor
(
private
viewerService
:
ViewerService
,
)
{
}
ngOnInit
()
{
}
enableClipping
(
enable
?:
boolean
)
{
const
viewer
=
this
.
viewerService
.
viewer
;
if
(
this
.
clipping
)
{
this
.
clipping
.
destroy
();
}
if
(
false
===
enable
)
{
return
;
}
const
clippingOptions
=
{
dimensions
:
2
,
material
:
Cesium
.
Color
.
BLUE
.
withAlpha
(
0.2
),
outline
:
true
,
outlineColor
:
Cesium
.
Color
.
RED
,
edgeStylingEnabled
:
true
,
debugBoundingVolumesEnabled
:
true
,
};
const
that
=
this
;
function
createAndStartClipping
()
{
that
.
clipping
=
new
smart3d
.
Clipping
(
viewer
,
clippingOptions
);
that
.
clipping
.
start
(
that
.
tileset
,
smart3d
.
ClippingMode
[
that
.
clippingPlane
]);
}
if
(
undefined
===
this
.
tileset
)
{
this
.
tileset
=
viewer
.
scene
.
primitives
.
add
(
new
Cesium
.
Cesium3DTileset
({
url
:
tilesetUrl
,
}));
this
.
tileset
.
readyPromise
.
then
(
tileset
=>
{
createAndStartClipping
();
viewer
.
flyTo
(
tileset
);
});
}
else
{
createAndStartClipping
();
viewer
.
flyTo
(
this
.
tileset
);
}
}
}
src/app/components/underground/underground.component.html
View file @
0bfc17a3
<div
class=
"underground-container"
>
<div>
不透明度:
<input
type=
"number"
id=
""
max=
"1"
min=
"0"
step=
"0.1"
[(
ngModel
)]="
alpha
"
/>
<button
(
click
)="
activateUndergroundMode
()"
>
开启地下模式
</button>
<button
(
click
)="
deactivateUndergroundMode
()"
>
取消地下模式
</button>
...
...
src/app/components/viewshed/viewshed.component.css
View file @
0bfc17a3
.form-container
{
/* display: flex; */
/* flex-direction: column; */
/* flex-grow: 0; */
color
:
white
;
}
\ No newline at end of file
src/app/components/viewshed/viewshed.component.html
View file @
0bfc17a3
<div
class=
"form-container"
>
<div>
<label
for=
"horizontalAngle"
>
水平张角:
</label>
<input
type=
"number"
id=
"horizontalAngle"
[(
ngModel
)]="
horizontalAngle
"
/>
<label
for=
"verticalAngle"
>
垂直张角:
</label>
...
...
src/styles.css
View file @
0bfc17a3
...
...
@@ -2,3 +2,7 @@
body
{
margin
:
0
;
}
.text-white
{
color
:
white
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment