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
8cbe2c04
Commit
8cbe2c04
authored
Dec 31, 2019
by
张启明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: 添加可视域分析、剖面分析、地下模式、地形开挖功能的测试
parent
40afa7a5
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
329 additions
and
3 deletions
+329
-3
package.json
package.json
+1
-1
app.component.html
src/app/app.component.html
+4
-0
app.component.ts
src/app/app.component.ts
+1
-1
app.module.ts
src/app/app.module.ts
+11
-1
index.ts
src/app/components/index.ts
+4
-0
index.ts
src/app/components/profile/index.ts
+1
-0
profile.component.css
src/app/components/profile/profile.component.css
+3
-0
profile.component.html
src/app/components/profile/profile.component.html
+5
-0
profile.component.spec.ts
src/app/components/profile/profile.component.spec.ts
+25
-0
profile.component.ts
src/app/components/profile/profile.component.ts
+33
-0
index.ts
src/app/components/soil-excavation/index.ts
+1
-0
soil-excavation.component.css
.../components/soil-excavation/soil-excavation.component.css
+3
-0
soil-excavation.component.html
...components/soil-excavation/soil-excavation.component.html
+6
-0
soil-excavation.component.spec.ts
...ponents/soil-excavation/soil-excavation.component.spec.ts
+25
-0
soil-excavation.component.ts
...p/components/soil-excavation/soil-excavation.component.ts
+31
-0
index.ts
src/app/components/underground/index.ts
+1
-0
underground.component.css
src/app/components/underground/underground.component.css
+4
-0
underground.component.html
src/app/components/underground/underground.component.html
+6
-0
underground.component.spec.ts
src/app/components/underground/underground.component.spec.ts
+25
-0
underground.component.ts
src/app/components/underground/underground.component.ts
+33
-0
index.ts
src/app/components/viewshed/index.ts
+1
-0
viewshed.component.css
src/app/components/viewshed/viewshed.component.css
+7
-0
viewshed.component.html
src/app/components/viewshed/viewshed.component.html
+11
-0
viewshed.component.spec.ts
src/app/components/viewshed/viewshed.component.spec.ts
+25
-0
viewshed.component.ts
src/app/components/viewshed/viewshed.component.ts
+62
-0
No files found.
package.json
View file @
8cbe2c04
...
...
@@ -4,7 +4,7 @@
"scripts"
:
{
"ng"
:
"ng"
,
"start"
:
"ng serve"
,
"build"
:
"ng build"
,
"build"
:
"ng build
--prod --base-href ./
"
,
"test"
:
"ng test"
,
"lint"
:
"ng lint"
,
"e2e"
:
"ng e2e"
...
...
src/app/app.component.html
View file @
8cbe2c04
...
...
@@ -3,6 +3,10 @@
<app-measure-handler></app-measure-handler>
<app-sight-line></app-sight-line>
<app-skyline></app-skyline>
<app-viewshed></app-viewshed>
<app-profile></app-profile>
<app-underground></app-underground>
<app-soil-excavation></app-soil-excavation>
<app-layer-manager></app-layer-manager>
</div>
</div>
src/app/app.component.ts
View file @
8cbe2c04
import
{
Component
,
OnInit
,
ViewChild
,
ElementRef
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ViewerService
}
from
'./services'
;
@
Component
({
...
...
src/app/app.module.ts
View file @
8cbe2c04
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
AppComponent
}
from
'./app.component'
;
import
{
...
...
@@ -7,6 +8,10 @@ import {
SightLineComponent
,
LayerManagerComponent
,
SkylineComponent
,
ViewshedComponent
,
ProfileComponent
,
UndergroundComponent
,
SoilExcavationComponent
,
}
from
'./components'
;
@
NgModule
({
...
...
@@ -16,9 +21,14 @@ import {
SightLineComponent
,
LayerManagerComponent
,
SkylineComponent
,
ViewshedComponent
,
ProfileComponent
,
UndergroundComponent
,
SoilExcavationComponent
,
],
imports
:
[
BrowserModule
BrowserModule
,
FormsModule
,
],
providers
:
[
],
...
...
src/app/components/index.ts
View file @
8cbe2c04
...
...
@@ -2,3 +2,7 @@ export * from './measure-handler';
export
*
from
'./sight-line'
;
export
*
from
'./layer-manager'
;
export
*
from
'./skyline'
;
export
*
from
'./viewshed'
;
export
*
from
'./profile'
;
export
*
from
'./underground'
;
export
*
from
'./soil-excavation'
;
src/app/components/profile/index.ts
0 → 100644
View file @
8cbe2c04
export
*
from
'./profile.component'
;
src/app/components/profile/profile.component.css
0 → 100644
View file @
8cbe2c04
.profile-container
{
color
:
white
;
}
src/app/components/profile/profile.component.html
0 → 100644
View file @
8cbe2c04
<div
class=
"profile-container"
>
<button
(
click
)="
startProfileAnalyze
()"
>
点击开始剖面分析
</button>
剖面分析结果长度:{{ result.length }}
</div>
\ No newline at end of file
src/app/components/profile/profile.component.spec.ts
0 → 100644
View file @
8cbe2c04
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
ProfileComponent
}
from
'./profile.component'
;
describe
(
'ProfileComponent'
,
()
=>
{
let
component
:
ProfileComponent
;
let
fixture
:
ComponentFixture
<
ProfileComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
ProfileComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ProfileComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/profile/profile.component.ts
0 → 100644
View file @
8cbe2c04
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ViewerService
}
from
'src/app/services'
;
@
Component
({
selector
:
'app-profile'
,
templateUrl
:
'./profile.component.html'
,
styleUrls
:
[
'./profile.component.css'
]
})
export
class
ProfileComponent
implements
OnInit
{
private
profile
;
public
result
=
[];
constructor
(
private
viewerService
:
ViewerService
,
)
{
}
ngOnInit
()
{
}
startProfileAnalyze
()
{
const
viewer
=
this
.
viewerService
.
viewer
;
this
.
profile
=
new
smart3d
.
Profile
(
viewer
);
this
.
profile
.
computedEvent
.
addEventListener
(
positions
=>
{
this
.
result
=
positions
;
});
// 需要开启
viewer
.
scene
.
globe
.
depthTestAgainstTerrain
=
true
;
this
.
profile
.
start
();
}
}
src/app/components/soil-excavation/index.ts
0 → 100644
View file @
8cbe2c04
export
*
from
'./soil-excavation.component'
;
src/app/components/soil-excavation/soil-excavation.component.css
0 → 100644
View file @
8cbe2c04
.soil-excavation-container
{
color
:
white
;
}
src/app/components/soil-excavation/soil-excavation.component.html
0 → 100644
View file @
8cbe2c04
<div
class=
"soil-excavation-container"
>
<label
for=
"soil-excavation"
>
开挖深度:
</label>
<input
type=
"number"
id=
"soil-excavation"
min=
"0"
[(
ngModel
)]="
depth
"
(
ngModelChange
)="
changeDepth
($
event
)"
/>
<button
(
click
)="
startExcavation
()"
>
开挖地形
</button>
</div>
\ No newline at end of file
src/app/components/soil-excavation/soil-excavation.component.spec.ts
0 → 100644
View file @
8cbe2c04
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
SoilExcavationComponent
}
from
'./soil-excavation.component'
;
describe
(
'SoilExcavationComponent'
,
()
=>
{
let
component
:
SoilExcavationComponent
;
let
fixture
:
ComponentFixture
<
SoilExcavationComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
SoilExcavationComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
SoilExcavationComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/soil-excavation/soil-excavation.component.ts
0 → 100644
View file @
8cbe2c04
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ViewerService
}
from
'src/app/services'
;
@
Component
({
selector
:
'app-soil-excavation'
,
templateUrl
:
'./soil-excavation.component.html'
,
styleUrls
:
[
'./soil-excavation.component.css'
]
})
export
class
SoilExcavationComponent
implements
OnInit
{
public
depth
=
10
;
private
terrainClip
;
constructor
(
private
viewerService
:
ViewerService
,
)
{
}
ngOnInit
()
{
const
viewer
=
this
.
viewerService
.
viewer
;
this
.
terrainClip
=
new
smart3d
.
TerrainClip
(
viewer
);
this
.
terrainClip
.
updateDepth
(
this
.
depth
);
}
changeDepth
(
depth
:
number
)
{
this
.
terrainClip
.
updateDepth
(
depth
);
}
startExcavation
()
{
this
.
terrainClip
.
start
(
this
.
depth
);
}
}
src/app/components/underground/index.ts
0 → 100644
View file @
8cbe2c04
export
*
from
'./underground.component'
;
src/app/components/underground/underground.component.css
0 → 100644
View file @
8cbe2c04
.underground-container
{
color
:
white
;
}
\ No newline at end of file
src/app/components/underground/underground.component.html
0 → 100644
View file @
8cbe2c04
<div
class=
"underground-container"
>
不透明度:
<input
type=
"number"
id=
""
max=
"1"
min=
"0"
step=
"0.1"
[(
ngModel
)]="
alpha
"
/>
<button
(
click
)="
activateUndergroundMode
()"
>
开启地下模式
</button>
<button
(
click
)="
deactivateUndergroundMode
()"
>
取消地下模式
</button>
</div>
\ No newline at end of file
src/app/components/underground/underground.component.spec.ts
0 → 100644
View file @
8cbe2c04
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
UndergroundComponent
}
from
'./underground.component'
;
describe
(
'UndergroundComponent'
,
()
=>
{
let
component
:
UndergroundComponent
;
let
fixture
:
ComponentFixture
<
UndergroundComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
UndergroundComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
UndergroundComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/underground/underground.component.ts
0 → 100644
View file @
8cbe2c04
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ViewerService
}
from
'src/app/services'
;
@
Component
({
selector
:
'app-underground'
,
templateUrl
:
'./underground.component.html'
,
styleUrls
:
[
'./underground.component.css'
]
})
export
class
UndergroundComponent
implements
OnInit
{
public
alpha
=
0.2
;
private
underground
;
constructor
(
private
viewerService
:
ViewerService
,
)
{
}
ngOnInit
()
{
}
activateUndergroundMode
()
{
if
(
this
.
underground
instanceof
smart3d
.
Underground
)
{
this
.
underground
.
destroy
();
}
const
viewer
=
this
.
viewerService
.
viewer
;
this
.
underground
=
new
smart3d
.
Underground
(
viewer
);
this
.
underground
.
activate
(
this
.
alpha
);
}
deactivateUndergroundMode
()
{
this
.
underground
.
destroy
();
}
}
src/app/components/viewshed/index.ts
0 → 100644
View file @
8cbe2c04
export
*
from
'./viewshed.component'
;
src/app/components/viewshed/viewshed.component.css
0 → 100644
View file @
8cbe2c04
.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
0 → 100644
View file @
8cbe2c04
<div
class=
"form-container"
>
<label
for=
"horizontalAngle"
>
水平张角:
</label>
<input
type=
"number"
id=
"horizontalAngle"
[(
ngModel
)]="
horizontalAngle
"
/>
<label
for=
"verticalAngle"
>
垂直张角:
</label>
<input
type=
"number"
id=
"verticalAngle"
[(
ngModel
)]="
verticalAngle
"
/>
<label
for=
"distance"
>
可视半径:
</label>
<input
type=
"number"
id=
"distance"
[(
ngModel
)]="
distance
"
/>
是否显示视椎体
<input
type=
"checkbox"
id=
""
[(
ngModel
)]="
showFrustum
"
>
是否显示可视域
<input
type=
"checkbox"
id=
""
[(
ngModel
)]="
showViewshed
"
>
<button
(
click
)="
buildViewshed
()"
>
开始画线进行可视域分析
</button>
</div>
src/app/components/viewshed/viewshed.component.spec.ts
0 → 100644
View file @
8cbe2c04
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
ViewshedComponent
}
from
'./viewshed.component'
;
describe
(
'ViewshedComponent'
,
()
=>
{
let
component
:
ViewshedComponent
;
let
fixture
:
ComponentFixture
<
ViewshedComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
ViewshedComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ViewshedComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/viewshed/viewshed.component.ts
0 → 100644
View file @
8cbe2c04
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ViewerService
}
from
'src/app/services'
;
@
Component
({
selector
:
'app-viewshed'
,
templateUrl
:
'./viewshed.component.html'
,
styleUrls
:
[
'./viewshed.component.css'
]
})
export
class
ViewshedComponent
implements
OnInit
{
public
horizontalAngle
=
45
;
public
verticalAngle
=
60
;
public
distance
=
100
;
public
showFrustum
=
true
;
public
showViewshed
=
true
;
private
viewshed
;
constructor
(
private
viewerService
:
ViewerService
,
)
{
}
ngOnInit
()
{
}
buildViewshed
()
{
const
viewer
=
this
.
viewerService
.
viewer
;
const
drawHandler
=
new
smart3d
.
DrawHandler
(
viewer
,
smart3d
.
DrawMode
.
Line
);
const
positions
=
[];
drawHandler
.
anchorEvent
.
addEventListener
(
position
=>
{
if
(
positions
.
push
(
position
)
>=
2
)
{
drawHandler
.
clear
();
const
options
=
{
cameraPosition
:
positions
[
0
],
viewPosition
:
positions
[
1
],
horizontalAngle
:
this
.
horizontalAngle
,
verticalAngle
:
this
.
verticalAngle
,
distance
:
this
.
distance
,
frustum
:
this
.
showFrustum
,
show
:
this
.
showViewshed
,
visibleAreaColor
:
Cesium
.
Color
.
BLUE
,
hiddenAreaColor
:
Cesium
.
Color
.
YELLOW
,
alpha
:
1
,
};
// 需要开启 depthTestAgainstTerrain,可视域才能贴地
if
(
viewer
.
scene
.
globe
.
depthTestAgainstTerrain
!==
true
)
{
viewer
.
scene
.
globe
.
depthTestAgainstTerrain
=
true
;
}
if
(
this
.
viewshed
)
{
this
.
viewshed
.
destroy
();
}
this
.
viewshed
=
new
smart3d
.
ViewShed3D
(
viewer
,
options
);
this
.
viewshed
.
start
();
drawHandler
.
destroy
();
}
});
drawHandler
.
activate
();
}
}
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