Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Map3D
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
1
Merge Requests
1
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
刘恽伟
Map3D
Commits
d1a66340
Commit
d1a66340
authored
Feb 25, 2019
by
刘恽伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改调整倾斜摄影数据为白模数据
parent
4778be38
Pipeline
#11
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
439 additions
and
51 deletions
+439
-51
config.json
test/Build/Static/config.json
+3
-0
EditorAxis.js
test/Build/Static/js/main/EditorAxis.js
+348
-0
core.js
test/Build/Static/js/main/core.js
+64
-43
ui.js
test/Build/Static/js/main/ui.js
+19
-7
index.html
test/index.html
+5
-1
No files found.
test/Build/Static/config.json
View file @
d1a66340
...
@@ -27,6 +27,9 @@
...
@@ -27,6 +27,9 @@
"index"
:
0
"index"
:
0
},
},
"MainModelData"
:
{
"MainModelData"
:
{
"model"
:
{
"url"
:
"http://172.16.10.132:3333/shaoguan/shaoguantestbaimo/tileset.json"
},
"vector"
:
{
"vector"
:
{
"url"
:
"http://172.16.10.132:3333/shaoguan/shaoguanjianzhu/shaoguanjianzhu/tileset.json"
,
"url"
:
"http://172.16.10.132:3333/shaoguan/shaoguanjianzhu/shaoguanjianzhu/tileset.json"
,
"matrix"
:
[
"matrix"
:
[
...
...
test/Build/Static/js/main/EditorAxis.js
0 → 100644
View file @
d1a66340
function
EditorAxis
(
scene
,
option
)
{
let
_self
=
this
;
let
bound
=
0.005
;
let
editorDis
=
0
;
let
editorScale
=
1
;
let
editorXAngle
=
0
;
let
editorYAngle
=
0
;
let
editorZAngle
=
0
;
let
editorMode
=
null
;
let
editorAxis
=
null
;
let
model
=
option
.
model
;
let
primitives
=
new
Cesium
.
PrimitiveCollection
({
show
:
false
});
let
originMatrix
=
option
.
model
.
modelMatrix
.
clone
();
let
originTrans
=
option
.
model
.
_root
.
transform
.
clone
();
let
originPoint
=
option
.
model
.
boundingSphere
.
center
.
clone
();
_self
.
modelMatrix
=
option
.
model
.
modelMatrix
.
clone
();
_self
.
transform
=
new
Cesium
.
Cartesian3
(
0
,
0
,
0
);
function
initAxis
()
{
let
point
=
Cesium
.
Cartographic
.
fromCartesian
(
originPoint
);
scene
.
primitives
.
add
(
primitives
);
let
sector
=
computeArcCoord
({
point
:
point
,
radius
:
bound
-
0.0005
,
angle1
:
Math
.
PI
/
2
,
angle4
:
0
});
sector
.
unshift
(
Cesium
.
Math
.
toDegrees
(
point
.
longitude
),
Cesium
.
Math
.
toDegrees
(
point
.
latitude
),
point
.
height
);
sector
.
push
(
Cesium
.
Math
.
toDegrees
(
point
.
longitude
),
Cesium
.
Math
.
toDegrees
(
point
.
latitude
),
point
.
height
);
primitives
.
add
(
createAxis
({
point
:
point
,
id
:
"y-pan"
,
lat
:
0.01
*
Math
.
cos
(
point
.
latitude
),}));
primitives
.
add
(
createAxis
({
point
:
point
,
id
:
"x-pan"
,
lon
:
0.01
,}));
primitives
.
add
(
createAxis
({
point
:
point
,
id
:
"z-pan"
,
height
:
800
,}));
primitives
.
add
(
createArc
({
point
:
point
,
id
:
"x-rotate"
,
radius
:
bound
,
angle2
:
0
}));
primitives
.
add
(
createArc
({
point
:
point
,
id
:
"y-rotate"
,
radius
:
bound
,
angle3
:
0
}));
primitives
.
add
(
createArc
({
point
:
point
,
id
:
"z-rotate"
,
radius
:
bound
,
angle1
:
Math
.
PI
/
2
,
angle4
:
0
}));
primitives
.
add
(
new
Cesium
.
Primitive
({
geometryInstances
:
new
Cesium
.
GeometryInstance
({
geometry
:
Cesium
.
PolygonGeometry
.
fromPositions
({
positions
:
Cesium
.
Cartesian3
.
fromDegreesArrayHeights
(
sector
),
vertexFormat
:
Cesium
.
EllipsoidSurfaceAppearance
.
VERTEX_FORMAT
,
height
:
point
.
height
}),
id
:
"surface-scale"
,
attributes
:
{
color
:
Cesium
.
ColorGeometryInstanceAttribute
.
fromColor
(
Cesium
.
Color
.
ORANGE
.
withAlpha
(
0.5
))
}
}),
appearance
:
new
Cesium
.
PolylineColorAppearance
({
translucent
:
false
})
}));
primitives
.
add
(
new
Cesium
.
Primitive
({
geometryInstances
:
new
Cesium
.
GeometryInstance
({
geometry
:
new
Cesium
.
RectangleGeometry
({
rectangle
:
Cesium
.
Rectangle
.
fromDegrees
(
Cesium
.
Math
.
toDegrees
(
point
.
longitude
)
-
bound
/
2
,
Cesium
.
Math
.
toDegrees
(
point
.
latitude
)
-
bound
/
2
*
Math
.
cos
(
point
.
latitude
),
Cesium
.
Math
.
toDegrees
(
point
.
longitude
),
Cesium
.
Math
.
toDegrees
(
point
.
latitude
)),
vertexFormat
:
Cesium
.
PerInstanceColorAppearance
.
VERTEX_FORMAT
,
height
:
point
.
height
}),
id
:
"p-pan"
,
attributes
:
{
color
:
Cesium
.
ColorGeometryInstanceAttribute
.
fromColor
(
Cesium
.
Color
.
MAGENTA
.
withAlpha
(
0.5
))
}
}),
appearance
:
new
Cesium
.
PolylineColorAppearance
({
translucent
:
false
})
}));
handler
=
new
Cesium
.
ScreenSpaceEventHandler
(
scene
.
canvas
);
handler
.
setInputAction
(
function
onClick
(
movement
)
{
let
startPosition
=
scene
.
pickPosition
(
movement
.
startPosition
);
let
endPosition
=
scene
.
pickPosition
(
movement
.
endPosition
);
if
(
startPosition
&&
endPosition
)
{
if
(
editorMode
)
{
if
(
editorMode
===
"pan"
)
{
let
isXY
=
(
editorAxis
!==
"z"
);
let
point
=
_self
.
getPointsByMovement
(
startPosition
,
endPosition
,
isXY
);
if
(
point
)
{
let
translation
=
_self
.
getAxisTrans
(
point
.
start
,
point
.
end
,
editorAxis
);
_self
.
setTranslation
(
translation
);
}
}
else
if
(
editorMode
===
"rotate"
)
{
let
point
=
_self
.
getPointsByMovement
(
startPosition
,
endPosition
,
null
);
if
(
point
)
{
let
p1
=
Cesium
.
Cartesian3
.
ZERO
;
let
p2
=
Cesium
.
Cartesian3
.
subtract
(
point
.
end
,
originPoint
,
new
Cesium
.
Cartesian3
());
let
p3
=
Cesium
.
Cartesian3
.
subtract
(
point
.
start
,
originPoint
,
new
Cesium
.
Cartesian3
());
if
(
editorAxis
===
"z"
)
{
editorZAngle
-=
_self
.
getAxisRotation
(
new
Cesium
.
Cartesian2
(
p1
.
x
,
p1
.
y
),
new
Cesium
.
Cartesian2
(
p2
.
x
,
p2
.
y
),
new
Cesium
.
Cartesian2
(
p3
.
x
,
p3
.
y
));
}
else
if
(
editorAxis
===
"y"
)
{
editorYAngle
-=
_self
.
getAxisRotation
(
new
Cesium
.
Cartesian2
(
p1
.
x
,
p1
.
z
),
new
Cesium
.
Cartesian2
(
p2
.
x
,
p2
.
z
),
new
Cesium
.
Cartesian2
(
p3
.
x
,
p3
.
z
));
}
else
if
(
editorAxis
===
"x"
)
{
editorXAngle
+=
_self
.
getAxisRotation
(
new
Cesium
.
Cartesian2
(
p1
.
y
,
p1
.
z
),
new
Cesium
.
Cartesian2
(
p2
.
y
,
p2
.
z
),
new
Cesium
.
Cartesian2
(
p3
.
y
,
p3
.
z
));
}
_self
.
setRotation
(
_self
.
getModelTransByRotation
(
editorXAngle
,
editorYAngle
,
editorZAngle
));
_self
.
setScale
(
editorScale
);
}
}
else
if
(
editorMode
===
"scale"
)
{
let
point
=
_self
.
getPointsByMovement
(
startPosition
,
endPosition
,
null
);
if
(
point
)
{
let
p1
=
Cesium
.
Cartesian3
.
ZERO
;
let
p2
=
Cesium
.
Cartesian3
.
subtract
(
point
.
end
,
originPoint
,
new
Cesium
.
Cartesian3
());
let
p3
=
Cesium
.
Cartesian3
.
subtract
(
point
.
start
,
originPoint
,
new
Cesium
.
Cartesian3
());
let
startDis
=
Cesium
.
Cartesian2
.
distance
(
Cesium
.
Cartesian2
.
fromCartesian3
(
p2
),
Cesium
.
Cartesian2
.
fromCartesian3
(
p1
));
let
endDis
=
Cesium
.
Cartesian2
.
distance
(
Cesium
.
Cartesian2
.
fromCartesian3
(
p3
),
Cesium
.
Cartesian2
.
fromCartesian3
(
p1
));
editorScale
=
editorScale
*
(
startDis
/
endDis
);
_self
.
setScale
(
startDis
/
endDis
);
}
}
}
}
},
Cesium
.
ScreenSpaceEventType
.
MOUSE_MOVE
);
handler
.
setInputAction
(
function
onClick
(
movement
)
{
setCameraEnable
(
true
);
editorMode
=
null
;
editorDis
=
0
;
},
Cesium
.
ScreenSpaceEventType
.
LEFT_UP
);
handler
.
setInputAction
(
function
onClick
(
movement
)
{
let
obj
=
scene
.
pick
(
movement
.
position
);
let
point
=
scene
.
pickPosition
(
movement
.
position
);
if
(
Cesium
.
defined
(
obj
)
&&
(
typeof
obj
.
id
)
===
"string"
&&
point
)
{
setCameraEnable
(
false
);
editorAxis
=
obj
.
id
.
split
(
"-"
)[
0
];
editorMode
=
obj
.
id
.
slice
(
obj
.
id
.
indexOf
(
"-"
)
+
1
);
editorDis
=
Cesium
.
Cartesian2
.
distance
(
Cesium
.
Cartesian2
.
fromCartesian3
(
point
),
Cesium
.
Cartesian2
.
fromCartesian3
(
originPoint
));
}
},
Cesium
.
ScreenSpaceEventType
.
LEFT_DOWN
);
}
function
createArc
(
option
)
{
return
new
Cesium
.
Primitive
({
geometryInstances
:
new
Cesium
.
GeometryInstance
({
geometry
:
new
Cesium
.
PolylineGeometry
({
positions
:
Cesium
.
Cartesian3
.
fromDegreesArrayHeights
(
computeArcCoord
(
option
)),
//坐标必须两个和两个以上
width
:
4
,
//线宽
vertexFormat
:
Cesium
.
PolylineColorAppearance
.
VERTEX_FORMAT
}),
id
:
option
.
id
,
attributes
:
{
color
:
Cesium
.
ColorGeometryInstanceAttribute
.
fromColor
(
Cesium
.
Color
.
CORNFLOWERBLUE
),
//color 必须设置 不然没有效果
}
}),
appearance
:
new
Cesium
.
PolylineColorAppearance
({
translucent
:
false
})
});
}
function
createAxis
(
option
)
{
let
lon
=
(
option
.
lon
)
?
option
.
lon
:
0
,
lat
=
(
option
.
lat
)
?
option
.
lat
:
0
,
height
=
(
option
.
height
)
?
option
.
height
:
0
;
return
new
Cesium
.
Primitive
({
geometryInstances
:
new
Cesium
.
GeometryInstance
({
geometry
:
new
Cesium
.
PolylineGeometry
({
vertexFormat
:
Cesium
.
PolylineMaterialAppearance
.
VERTEX_FORMAT
,
positions
:
Cesium
.
Cartesian3
.
fromDegreesArrayHeights
([
Cesium
.
Math
.
toDegrees
(
option
.
point
.
longitude
),
Cesium
.
Math
.
toDegrees
(
option
.
point
.
latitude
),
option
.
point
.
height
,
Cesium
.
Math
.
toDegrees
(
option
.
point
.
longitude
)
+
lon
,
Cesium
.
Math
.
toDegrees
(
option
.
point
.
latitude
)
+
lat
,
option
.
point
.
height
+
height
]),
width
:
20
,
height
:
option
.
point
.
height
}),
id
:
option
.
id
,
attributes
:
{
color
:
Cesium
.
ColorGeometryInstanceAttribute
.
fromColor
(
Cesium
.
Color
.
RED
)
}
}),
appearance
:
new
Cesium
.
PolylineMaterialAppearance
({
material
:
new
Cesium
.
Material
({
fabric
:
{
type
:
'PolylineArrow'
,
uniforms
:
{
color
:
Cesium
.
Color
.
fromAlpha
(
Cesium
.
Color
.
YELLOW
,
1
)
}
}
})
})
})
}
function
setCameraEnable
(
isEnable
)
{
scene
.
screenSpaceCameraController
.
enableRotate
=
isEnable
;
scene
.
screenSpaceCameraController
.
enableTranslate
=
isEnable
;
scene
.
screenSpaceCameraController
.
enableZoom
=
isEnable
;
scene
.
screenSpaceCameraController
.
enableTilt
=
isEnable
;
scene
.
screenSpaceCameraController
.
enableLook
=
isEnable
;
}
function
computeArcCoord
(
option
)
{
let
positions
=
[];
let
radius
=
option
.
radius
-
0.0005
,
point
=
option
.
point
,
angle1
=
(
option
.
angle1
)
?
option
.
angle1
:
0
,
angle2
=
(
option
.
angle2
===
undefined
)
?
Math
.
PI
/
2
:
option
.
angle2
,
angle3
=
(
option
.
angle3
===
undefined
)
?
Math
.
PI
/
2
:
option
.
angle3
,
angle4
=
(
option
.
angle4
===
undefined
)
?
Math
.
PI
/
2
:
option
.
angle4
;
for
(
let
i
=
0
;
i
<=
90
;
i
++
)
{
let
radians
=
Cesium
.
Math
.
toRadians
(
i
);
positions
.
push
(
Cesium
.
Math
.
toDegrees
(
point
.
longitude
)
+
radius
*
Math
.
sin
(
radians
+
angle1
)
*
Math
.
sin
(
angle2
));
positions
.
push
(
Cesium
.
Math
.
toDegrees
(
point
.
latitude
)
+
radius
*
Math
.
sin
(
radians
)
*
Math
.
cos
(
point
.
latitude
)
*
Math
.
sin
(
angle3
));
positions
.
push
(
point
.
height
+
550
*
Math
.
cos
(
radians
)
*
Math
.
cos
(
point
.
latitude
)
*
Math
.
sin
(
angle4
));
}
return
positions
;
}
EditorAxis
.
prototype
.
show
=
function
()
{
primitives
.
show
=
true
;
};
EditorAxis
.
prototype
.
close
=
function
()
{
primitives
.
show
=
false
;
};
EditorAxis
.
prototype
.
reset
=
function
()
{
// _self.modelMatrix = originMatrix;
editorScale
=
1
;
editorXAngle
=
0
;
editorYAngle
=
0
;
editorZAngle
=
0
;
model
.
modelMatrix
=
originMatrix
;
model
.
_root
.
transform
=
originTrans
;
_self
.
transform
=
new
Cesium
.
Cartesian3
(
0
,
0
,
0
);
};
EditorAxis
.
prototype
.
setScale
=
function
(
scale
)
{
model
.
_root
.
transform
=
Cesium
.
Matrix4
.
multiplyByScale
(
model
.
_root
.
transform
,
new
Cesium
.
Cartesian3
(
scale
,
scale
,
scale
),
new
Cesium
.
Matrix4
())
};
EditorAxis
.
prototype
.
setRotation
=
function
(
rotation
)
{
model
.
_root
.
transform
=
rotation
;
};
EditorAxis
.
prototype
.
setTranslation
=
function
(
translation
)
{
Cesium
.
Matrix4
.
setTranslation
(
model
.
modelMatrix
,
translation
,
model
.
modelMatrix
);
};
EditorAxis
.
prototype
.
getPanOffset
=
function
(
x
,
y
,
z
)
{
let
cartographic
=
Cesium
.
Cartographic
.
fromCartesian
(
originPoint
.
clone
());
let
surface
=
Cesium
.
Cartesian3
.
fromRadians
(
cartographic
.
longitude
,
cartographic
.
latitude
,
0.0
);
let
offset
=
Cesium
.
Cartesian3
.
fromRadians
((
cartographic
.
longitude
+
x
),
(
cartographic
.
latitude
+
y
),
z
);
let
translation
=
Cesium
.
Cartesian3
.
subtract
(
offset
,
surface
,
new
Cesium
.
Cartesian3
());
Cesium
.
Cartesian3
.
add
(
translation
,
_self
.
transform
,
translation
);
_self
.
transform
=
translation
;
return
translation
;
};
EditorAxis
.
prototype
.
getAxisTrans
=
function
(
startPoint
,
endPoint
,
directorAxis
)
{
let
x
=
0
,
y
=
0
,
z
=
0
;
let
start
=
Cesium
.
Cartographic
.
fromCartesian
(
startPoint
);
let
end
=
Cesium
.
Cartographic
.
fromCartesian
(
endPoint
);
if
(
directorAxis
===
'x'
)
{
x
=
end
.
longitude
-
start
.
longitude
;
}
else
if
(
directorAxis
===
'y'
)
{
y
=
end
.
latitude
-
start
.
latitude
;
}
else
if
(
directorAxis
===
'z'
)
{
z
=
end
.
height
-
start
.
height
;
}
else
if
(
directorAxis
===
'p'
)
{
x
=
end
.
longitude
-
start
.
longitude
;
y
=
end
.
latitude
-
start
.
latitude
;
}
return
_self
.
getPanOffset
(
x
,
y
,
z
);
};
EditorAxis
.
prototype
.
getModelTransByRotation
=
function
(
x
,
y
,
z
)
{
let
m1
=
Cesium
.
Matrix3
.
fromQuaternion
(
Cesium
.
Quaternion
.
fromAxisAngle
(
Cesium
.
Cartesian3
.
UNIT_Z
,
z
));
let
m2
=
Cesium
.
Matrix3
.
fromQuaternion
(
Cesium
.
Quaternion
.
fromAxisAngle
(
Cesium
.
Cartesian3
.
UNIT_X
,
x
));
let
m3
=
Cesium
.
Matrix3
.
fromQuaternion
(
Cesium
.
Quaternion
.
fromAxisAngle
(
Cesium
.
Cartesian3
.
UNIT_Y
,
y
));
let
m4
=
Cesium
.
Matrix3
.
multiply
(
m2
,
m1
,
new
Cesium
.
Matrix3
());
let
m5
=
Cesium
.
Matrix3
.
multiply
(
m3
,
m4
,
new
Cesium
.
Matrix3
());
return
Cesium
.
Matrix4
.
multiplyTransformation
(
Cesium
.
Transforms
.
eastNorthUpToFixedFrame
(
originPoint
),
Cesium
.
Matrix4
.
fromRotationTranslation
(
m5
,
Cesium
.
Cartesian3
.
ZERO
),
new
Cesium
.
Matrix4
());
};
EditorAxis
.
prototype
.
getAxisRotation
=
function
(
p1
,
p2
,
p3
)
{
let
s
=
(
p1
.
x
-
p3
.
x
)
*
(
p2
.
y
-
p3
.
y
)
-
(
p1
.
y
-
p3
.
y
)
*
(
p2
.
x
-
p3
.
x
);
let
angle
=
Cesium
.
Cartesian2
.
angleBetween
(
p2
,
p3
);
if
(
s
<
0
)
{
angle
=
2
*
Math
.
PI
-
angle
;
}
else
if
(
s
===
0
)
{
if
((
p3
.
y
-
p2
.
y
)
/
(
p3
.
x
-
p2
.
x
)
>
0
)
{
angle
=
2
*
Math
.
PI
-
angle
;
}
}
return
angle
;
};
EditorAxis
.
prototype
.
getPointsByMovement
=
function
(
startPosition
,
endPosition
,
isXY
)
{
let
matrix
=
Cesium
.
Matrix4
.
inverseTransformation
(
originMatrix
,
new
Cesium
.
Matrix4
());
// 获取相机坐标
let
camera1
=
scene
.
camera
.
position
;
// 模型坐标
let
camera
=
Cesium
.
Matrix4
.
multiplyByPoint
(
matrix
,
camera1
,
new
Cesium
.
Cartesian3
());
let
startM
=
Cesium
.
Matrix4
.
multiplyByPoint
(
matrix
,
startPosition
,
new
Cesium
.
Cartesian3
());
let
endM
=
Cesium
.
Matrix4
.
multiplyByPoint
(
matrix
,
endPosition
,
new
Cesium
.
Cartesian3
());
// 从相机看模型的方向
let
startDirection
=
Cesium
.
Cartesian3
.
normalize
(
Cesium
.
Cartesian3
.
subtract
(
startM
,
camera
,
new
Cesium
.
Cartesian3
()),
new
Cesium
.
Cartesian3
());
let
endDirection
=
Cesium
.
Cartesian3
.
normalize
(
Cesium
.
Cartesian3
.
subtract
(
endM
,
camera
,
new
Cesium
.
Cartesian3
()),
new
Cesium
.
Cartesian3
());
let
plane
=
null
;
if
(
editorMode
===
"pan"
||
editorMode
===
"scale"
)
{
plane
=
(
isXY
)
?
Cesium
.
Plane
.
fromPointNormal
(
originPoint
,
scene
.
globe
.
ellipsoid
.
geodeticSurfaceNormal
(
originPoint
))
:
Cesium
.
Plane
.
fromPointNormal
(
originPoint
,
scene
.
camera
.
direction
);
}
else
if
(
editorMode
===
"rotate"
)
{
let
cartographic
=
Cesium
.
Cartographic
.
fromCartesian
(
originPoint
.
clone
());
let
lon
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
longitude
),
lat
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
latitude
),
hegith
=
cartographic
.
height
;
let
a
=
Cesium
.
Cartesian3
.
fromDegrees
(
lon
,
lat
,
hegith
),
b
=
null
;
if
(
editorAxis
===
"z"
)
{
b
=
Cesium
.
Cartesian3
.
fromDegrees
(
lon
,
lat
,
hegith
+
0.0005
);
}
else
if
(
editorAxis
===
"y"
)
{
b
=
Cesium
.
Cartesian3
.
fromDegrees
(
lon
,
lat
+
0.0005
,
hegith
);
}
else
if
(
editorAxis
===
"x"
)
{
b
=
Cesium
.
Cartesian3
.
fromDegrees
(
lon
+
0.0005
,
lat
,
hegith
);
}
let
normal
=
Cesium
.
Cartesian3
.
normalize
(
Cesium
.
Cartesian3
.
subtract
(
b
,
a
,
new
Cesium
.
Cartesian3
()),
new
Cesium
.
Cartesian3
());
plane
=
Cesium
.
Plane
.
fromPointNormal
(
originPoint
,
normal
);
}
let
start
=
null
,
end
=
null
;
let
startRay
=
new
Cesium
.
Ray
(
camera
,
startDirection
);
let
endRay
=
new
Cesium
.
Ray
(
camera
,
endDirection
);
if
(
startRay
&&
endRay
&&
plane
)
{
start
=
Cesium
.
IntersectionTests
.
rayPlane
(
startRay
,
plane
);
end
=
Cesium
.
IntersectionTests
.
rayPlane
(
endRay
,
plane
);
}
if
(
!
start
||
!
end
)
{
return
null
;
}
return
{
start
:
start
,
end
:
end
};
};
EditorAxis
.
prototype
.
destroy
=
function
()
{
handler
.
destroy
();
scene
.
primitives
.
remove
(
primitives
);
// primitives.removeAll();
primitives
.
destroy
();
// bound = null;
// editorMode = null;
// editorAxis = null;
// originPoint = null;
// originMatrix = null;
_self
.
transform
=
undefined
;
_self
.
modelMatrix
=
undefined
;
// _self = null;
let
object
=
this
;
for
(
let
key
in
object
)
{
if
(
typeof
object
[
key
]
===
'function'
)
{
object
[
key
]
=
undefined
;
}
else
if
(
typeof
object
[
key
]
===
'object'
)
{
object
[
key
]
=
undefined
;
}
else
if
(
typeof
object
[
key
]
===
"undefined"
)
{
object
[
key
]
=
undefined
;
}
}
_self
=
undefined
;
};
initAxis
();
}
\ No newline at end of file
test/Build/Static/js/main/core.js
View file @
d1a66340
let
config
=
null
,
viewer
=
null
,
vector
=
null
,
piontCloud
=
null
,
east
=
null
,
west
=
null
,
model
=
null
,
let
config
=
null
,
viewer
=
null
,
vector
=
null
,
piontCloud
=
null
,
east
=
null
,
west
=
null
,
model
=
null
,
ESRIImg
=
null
,
TDTVec
=
null
,
points
=
[],
polygon
=
null
,
polyline
=
null
,
handler
=
null
;
ESRIImg
=
null
,
TDTVec
=
null
,
points
=
[],
polygon
=
null
,
polyline
=
null
,
handler
=
null
,
editorAxis
=
null
;
let
isAnalysisMeasure
=
false
,
isAnalysisRoam
=
false
,
isLinkageMap
=
false
,
isPopupAreaSign
=
false
;
let
isAnalysisMeasure
=
false
,
isAnalysisRoam
=
false
,
isLinkageMap
=
false
,
isPopupAreaSign
=
false
;
/**
/**
* 读取配置文件
* 读取配置文件
*/
*/
...
@@ -90,10 +90,19 @@ function initialize() {
...
@@ -90,10 +90,19 @@ function initialize() {
requestWaterMask
:
false
,
requestWaterMask
:
false
,
requestVertexNormals
:
false
requestVertexNormals
:
false
});
});
east
=
add3Dtile
(
config
.
MainModelData
.
east
.
url
,
config
.
MainModelData
.
east
.
matrix
);
//
east = add3Dtile(config.MainModelData.east.url, config.MainModelData.east.matrix);
west
=
add3Dtile
(
config
.
MainModelData
.
west
.
url
,
config
.
MainModelData
.
west
.
matrix
);
//
west = add3Dtile(config.MainModelData.west.url, config.MainModelData.west.matrix);
vector
=
add3Dtile
(
config
.
MainModelData
.
vector
.
url
,
config
.
MainModelData
.
vector
.
matrix
);
vector
=
add3Dtile
(
config
.
MainModelData
.
vector
.
url
,
config
.
MainModelData
.
vector
.
matrix
);
// piontCloud = add3Dtile(config.MainModelData.cloud.url, config.MainModelData.cloud.matrix);
// piontCloud = add3Dtile(config.MainModelData.cloud.url, config.MainModelData.cloud.matrix);
model
=
viewer
.
scene
.
primitives
.
add
(
new
Cesium
.
Cesium3DTileset
({
url
:
config
.
MainModelData
.
model
.
url
,
maximumMemoryUsage
:
300
,
}));
model
.
readyPromise
.
then
(
function
()
{
editorAxis
=
new
EditorAxis
(
viewer
.
scene
,
{
model
:
model
,
})
});
for
(
let
i
=
0
;
i
<
15
;
i
+=
3
)
{
for
(
let
i
=
0
;
i
<
15
;
i
+=
3
)
{
points
.
push
(
viewer
.
entities
.
add
({
points
.
push
(
viewer
.
entities
.
add
({
name
:
"点"
+
(
i
/
3
+
1
),
name
:
"点"
+
(
i
/
3
+
1
),
...
@@ -111,39 +120,40 @@ function initialize() {
...
@@ -111,39 +120,40 @@ function initialize() {
//二维面
//二维面
var
entities
;
var
entities
;
let
houseAreaSign
=
Cesium
.
GeoJsonDataSource
.
load
(
'Build/Data/houseAreaSign.json'
,
{
clampToGround
:
true
});
let
houseAreaSign
=
Cesium
.
GeoJsonDataSource
.
load
(
'Build/Data/houseAreaSign.json'
,
{
clampToGround
:
true
});
houseAreaSign
.
then
(
function
(
dataSource
)
{
houseAreaSign
.
then
(
function
(
dataSource
)
{
entities
=
dataSource
.
entities
;
entities
=
dataSource
.
entities
;
var
areaEntitiesVals
=
entities
.
values
;
var
areaEntitiesVals
=
entities
.
values
;
for
(
let
i
=
0
;
i
<
areaEntitiesVals
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
areaEntitiesVals
.
length
;
i
++
)
{
var
entity
=
areaEntitiesVals
[
i
];
var
entity
=
areaEntitiesVals
[
i
];
if
(
Cesium
.
defined
(
entity
.
polygon
))
{
if
(
Cesium
.
defined
(
entity
.
polygon
))
{
entity
.
GID
=
Number
(
i
+
1
);
//加标识
entity
.
GID
=
Number
(
i
+
1
);
//加标识
}
}
}
}
viewer
.
dataSources
.
add
(
dataSource
);
viewer
.
dataSources
.
add
(
dataSource
);
polygon
=
entities
;
});
});
polygon
=
new
Cesium
.
GroundPrimitive
({
//
polygon = new Cesium.GroundPrimitive({
geometryInstances
:
new
Cesium
.
GeometryInstance
({
//
geometryInstances: new Cesium.GeometryInstance({
geometry
:
new
Cesium
.
CorridorGeometry
({
//
geometry: new Cesium.CorridorGeometry({
vertexFormat
:
Cesium
.
VertexFormat
.
POSITION_ONLY
,
//
vertexFormat: Cesium.VertexFormat.POSITION_ONLY,
positions
:
Cesium
.
Cartesian3
.
fromDegreesArrayHeights
(
bbb
),
//
positions: Cesium.Cartesian3.fromDegreesArrayHeights(bbb),
width
:
20
//
width: 20
}),
//
}),
attributes
:
{
//
attributes: {
color
:
Cesium
.
ColorGeometryInstanceAttribute
.
fromColor
(
Cesium
.
Color
.
fromAlpha
(
Cesium
.
Color
.
YELLOW
,
0.8
))
//
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromAlpha(Cesium.Color.YELLOW, 0.8))
}
//
}
}),
//
}),
appearance
:
new
Cesium
.
PerInstanceColorAppearance
({
//
appearance: new Cesium.PerInstanceColorAppearance({
translucent
:
true
,
//
translucent: true,
closed
:
true
,
//
closed: true,
aboveGround
:
true
//
aboveGround: true
}),
//
}),
classificationType
:
Cesium
.
ClassificationType
.
BOTH
,
//
classificationType: Cesium.ClassificationType.BOTH,
show
:
false
//
show: false
});
//
});
polyline
=
new
Cesium
.
GroundPrimitive
({
polyline
=
new
Cesium
.
GroundPrimitive
({
geometryInstances
:
new
Cesium
.
GeometryInstance
({
geometryInstances
:
new
Cesium
.
GeometryInstance
({
geometry
:
new
Cesium
.
CorridorGeometry
({
geometry
:
new
Cesium
.
CorridorGeometry
({
...
@@ -164,7 +174,7 @@ function initialize() {
...
@@ -164,7 +174,7 @@ function initialize() {
show
:
false
show
:
false
});
});
viewer
.
scene
.
moon
.
show
=
false
;
viewer
.
scene
.
moon
.
show
=
false
;
viewer
.
scene
.
primitives
.
add
(
polygon
);
//
viewer.scene.primitives.add(polygon);
viewer
.
scene
.
primitives
.
add
(
polyline
);
viewer
.
scene
.
primitives
.
add
(
polyline
);
viewer
.
scene
.
globe
.
depthTestAgainstTerrain
=
true
;
viewer
.
scene
.
globe
.
depthTestAgainstTerrain
=
true
;
viewer
.
cesiumWidget
.
creditContainer
.
style
.
display
=
"none"
;
viewer
.
cesiumWidget
.
creditContainer
.
style
.
display
=
"none"
;
...
@@ -188,18 +198,18 @@ function initialize() {
...
@@ -188,18 +198,18 @@ function initialize() {
let
pickedObject
=
viewer
.
scene
.
pick
(
movement
.
position
);
let
pickedObject
=
viewer
.
scene
.
pick
(
movement
.
position
);
if
(
Cesium
.
defined
(
pickedObject
))
{
if
(
Cesium
.
defined
(
pickedObject
))
{
if
(
Cesium
.
defined
(
pickedObject
[
"id"
]))
{
if
(
Cesium
.
defined
(
pickedObject
[
"id"
]))
{
if
(
isPopupAreaSign
)
{
if
(
isPopupAreaSign
)
{
var
url
=
"http://172.16.10.132:8012/geoserver/Map3D-V2.0/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=Map3D-V2.0:house_query&maxFeatures=50&outputFormat=application%2Fjson&viewparams=a:"
var
url
=
"http://172.16.10.132:8012/geoserver/Map3D-V2.0/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=Map3D-V2.0:house_query&maxFeatures=50&outputFormat=application%2Fjson&viewparams=a:"
$
.
ajax
({
$
.
ajax
({
type
:
"GET"
,
type
:
"GET"
,
url
:
url
+
pickedObject
[
"id"
].
GID
,
url
:
url
+
pickedObject
[
"id"
].
GID
,
async
:
false
,
async
:
false
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
var
properties
=
data
.
features
[
0
].
properties
;
var
properties
=
data
.
features
[
0
].
properties
;
viewer
.
popup
.
show
(
cartesian
,
properties
);
viewer
.
popup
.
show
(
cartesian
,
properties
);
}
}
});
});
}
}
}
}
}
}
},
Cesium
.
ScreenSpaceEventType
.
LEFT_DOWN
);
},
Cesium
.
ScreenSpaceEventType
.
LEFT_DOWN
);
...
@@ -301,6 +311,17 @@ function endLinkageMap() {
...
@@ -301,6 +311,17 @@ function endLinkageMap() {
}
}
function
editorShow
()
{
editorAxis
.
show
()
}
function
editorClose
()
{
editorAxis
.
close
()
}
function
editorReset
()
{
editorAxis
.
reset
()
}
function
cartesian2LonLat
(
cartesian
)
{
function
cartesian2LonLat
(
cartesian
)
{
let
cartographic
=
Cesium
.
Cartographic
.
fromCartesian
(
cartesian
);
let
cartographic
=
Cesium
.
Cartographic
.
fromCartesian
(
cartesian
);
...
...
test/Build/Static/js/main/ui.js
View file @
d1a66340
...
@@ -23,8 +23,17 @@ $(document).ready(function () {
...
@@ -23,8 +23,17 @@ $(document).ready(function () {
case
"bar_popup"
:
case
"bar_popup"
:
stopRoams
();
stopRoams
();
break
;
break
;
case
"bar_editorshow"
:
editorShow
();
break
;
case
"bar_editorclose"
:
editorClose
();
break
;
case
"bar_editorreset"
:
editorReset
();
break
;
}
}
if
(
id
===
"bar_layer"
||
id
===
"bar_popup"
)
{
if
(
id
===
"bar_layer"
||
id
===
"bar_popup"
)
{
if
(
$
(
this
).
hasClass
(
'active'
))
{
if
(
$
(
this
).
hasClass
(
'active'
))
{
$
(
'.'
+
id
).
removeClass
(
'show'
);
$
(
'.'
+
id
).
removeClass
(
'show'
);
$
(
this
).
removeClass
(
'active'
);
$
(
this
).
removeClass
(
'active'
);
...
@@ -35,16 +44,19 @@ $(document).ready(function () {
...
@@ -35,16 +44,19 @@ $(document).ready(function () {
switch
(
id
)
{
switch
(
id
)
{
case
"bar_layer"
:
case
"bar_layer"
:
if
(
$
(
".show"
).
attr
(
"id"
)
!==
id
)
{
$
(
".show"
).
removeClass
(
"show"
);}
if
(
$
(
".show"
).
attr
(
"id"
)
!==
id
)
{
$
(
".show"
).
removeClass
(
"show"
);
}
if
(
$
(
'.active'
).
attr
(
"id"
)
!==
$
(
this
).
attr
(
"id"
))
{
if
(
$
(
'.active'
).
attr
(
"id"
)
!==
$
(
this
).
attr
(
"id"
))
{
$
(
".active"
).
removeClass
(
"active"
);
$
(
".active"
).
removeClass
(
"active"
);
};
}
;
break
;
break
;
case
"bar_popup"
:
case
"bar_popup"
:
if
(
$
(
this
).
hasClass
(
'active'
))
{
if
(
$
(
this
).
hasClass
(
'active'
))
{
isPopupAreaSign
=
true
;
isPopupAreaSign
=
true
;
}
else
{
}
else
{
isPopupAreaSign
=
false
;
isPopupAreaSign
=
false
;
}
}
break
;
break
;
}
}
...
@@ -157,13 +169,13 @@ $(document).ready(function () {
...
@@ -157,13 +169,13 @@ $(document).ready(function () {
},
},
{
{
"id"
:
5
,
"id"
:
5
,
"text"
:
"矢量"
,
"text"
:
"矢量
面
"
,
"iconCls"
:
"icon-file"
,
"iconCls"
:
"icon-file"
,
"children"
:
[
"children"
:
[
{
{
"id"
:
51
,
"id"
:
51
,
"text"
:
"测试数据"
,
"text"
:
"测试数据"
,
"checked"
:
fals
e
"checked"
:
tru
e
}
}
]
]
},
{
},
{
...
...
test/index.html
View file @
d1a66340
...
@@ -19,17 +19,21 @@
...
@@ -19,17 +19,21 @@
<script
src=
"Build/Static/js/main/Roam.js"
></script>
<script
src=
"Build/Static/js/main/Roam.js"
></script>
<script
src=
"Build/Static/js/main/Popup.js"
></script>
<script
src=
"Build/Static/js/main/Popup.js"
></script>
<script
src=
"Build/Static/js/main/Linkage.js"
></script>
<script
src=
"Build/Static/js/main/Linkage.js"
></script>
<script
src=
"Build/Static/js/main/EditorAxis.js"
></script>
<body>
<body>
<div
id=
"mainScene"
class=
"fullSize mainScene"
>
<div
id=
"mainScene"
class=
"fullSize mainScene"
>
<div
id=
"toolsbar"
class=
"toolsbar"
>
<div
id=
"toolsbar"
class=
"toolsbar"
>
<div
class=
"tooldrop"
id=
"tool_layer"
><label>
图层控制
</label></div>
<div
class=
"tooldrop"
id=
"tool_layer"
><label>
图层控制
</label></div>
<div
class=
"tooldrop"
id=
"tool_popup"
><label>
气泡信息
</label></div>
<div
class=
"tooldrop"
id=
"tool_start"
><label>
开始飞行
</label></div>
<div
class=
"tooldrop"
id=
"tool_start"
><label>
开始飞行
</label></div>
<div
class=
"tooldrop"
id=
"tool_end"
><label>
停止飞行
</label></div>
<div
class=
"tooldrop"
id=
"tool_end"
><label>
停止飞行
</label></div>
<div
class=
"tooldrop"
id=
"tool_polyline"
><label>
线测量
</label></div>
<div
class=
"tooldrop"
id=
"tool_polyline"
><label>
线测量
</label></div>
<div
class=
"tooldrop"
id=
"tool_polygon"
><label>
面测量
</label></div>
<div
class=
"tooldrop"
id=
"tool_polygon"
><label>
面测量
</label></div>
<div
class=
"tooldrop"
id=
"tool_clean"
><label>
清除
</label></div>
<div
class=
"tooldrop"
id=
"tool_clean"
><label>
清除
</label></div>
<div
class=
"tooldrop"
id=
"tool_popup"
><label>
气泡信息
</label></div>
<div
class=
"tooldrop"
id=
"tool_editorshow"
><label>
编辑
</label></div>
<div
class=
"tooldrop"
id=
"tool_editorclose"
><label>
关闭
</label></div>
<div
class=
"tooldrop"
id=
"tool_editorreset"
><label>
还原
</label></div>
</div>
</div>
<div
id=
"bar_layer"
class=
"bar_layer"
>
<div
id=
"bar_layer"
class=
"bar_layer"
>
<div
id=
"tree"
class=
"tree"
>
<div
id=
"tree"
class=
"tree"
>
...
...
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