公共函数
Methods
(static) createClampPolygonWithOutline(viewer, outsidePtArray, insidePtArrayopt, faceColoropt, outlineColoropt, outlineWidthopt) → {Array}
创建贴地并且显示轮廓的面皮筋儿 调用方式为zz3d.util.createClampPolygonWithOutline()
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
viewer |
Viewer | 场景对象 |
||
outsidePtArray |
Array | 外轮廓点组,点类型Cartesian3 |
||
insidePtArray |
Array |
<optional> |
[]
|
内轮廓点组,点类型Cartesian3,内轮廓可以有多个,因此该参数是Cartesian3的二维数组 |
faceColor |
Array |
<optional> |
[1,0,0,0.5]
|
面颜色rgba eg:[1,0,0,1] |
outlineColor |
Array |
<optional> |
[0,0,1,1]
|
轮廓颜色rgba eg:[0,1,0,1] |
outlineWidth |
Number |
<optional> |
1
|
轮廓线宽 |
Returns:
entArray 返回生成的实体数组 可通过viewer.entities.remove来移除
- Type
- Array
(static) createGeometryByPtArray(ptArray, coloropt) → {Primitive}
用提供的顶点创建面 调用方式为zz3d.util.createGeometryWithPtArray()
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ptArray |
Array | 面点组,点类型Cartesian3 |
||
color |
Array |
<optional> |
[1,0,0,0.5]
|
轮廓颜色rgba eg:[0,1,0,1] |
Returns:
prim 返回生成的实体 可通过viewer.scene.primitives.add()来添加
- Type
- Primitive
(static) createPipelineTracker(ptArray, color, widthOrRadius, heightopt, cornerTypeopt, hdopt) → {Entity}
创建方管或圆管 仅创建不添加 调用方式为zz3d.util.createPipelineTracker() 注意:该函数只能创建水平管道,垂直管道会出错
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ptArray |
Array | 中心线点组,点类型Cartesian3 |
||
color |
Array | 管道颜色rgba 范围0~1 eg:[1,0,0,1] |
||
widthOrRadius |
Number | 管道宽度或半径 若height参数有效则该值作为宽度,若height无效则该值作为半径 |
||
height |
Number |
<optional> |
0
|
方管高度 |
cornerType |
Number |
<optional> |
0
|
管道拐角形状 0为圆形拐角 1为方形拐角 2为斜角 默认值0 |
hd |
Number |
<optional> |
0
|
管壁厚度 默认值0 即没有厚度只是单面 |
Returns:
ent 返回生成的实体 可通过viewer.entities.add来添加
- Type
- Entity
(static) createPipelineTrackerPrimitive(ptStart, ptEnd, color, widthOrRadius, heightopt) → {Primitive}
根据起始点创建管线皮筋儿 仅创建不添加 调用方式为zz3d.util.createPipelineTrackerPrimitive()
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ptStart |
Cartesian3 | 起点坐标 |
||
ptEnd |
Cartesian3 | 终点坐标 |
||
color |
Array | 管道颜色rgba 范围0~1 eg:[1,0,0,1] |
||
widthOrRadius |
Number | 管道宽度或半径 若height参数有效则该值作为宽度,若height无效则该值作为半径 |
||
height |
Number |
<optional> |
0
|
方管高度 |
Returns:
返回生成的实体 可通过viewer.scene.primitives.add来添加
- Type
- Primitive
(static) isLineSegmentIntersectionXOY(p1, p2, p3, p4) → {Boolean}
判断两个线段XOY面上是否相交 四个参数分表代表两条线段的起点和终点 调用方式为zz3d.util.isLineSegmentIntersectionXOY()
Parameters:
Name | Type | Description |
---|---|---|
p1 |
Array | 起点1 eg:[100,200] 表示在XOY面上该点的x值是100 y值是200 |
p2 |
Array | 终点1 |
p3 |
Array | 起点2 |
p4 |
Array | 终点2 |
Returns:
在XOY面上是否相交
- Type
- Boolean
(static) isPolygonClockwise(ptArray) → {Boolean}
判断多边形在XOY面上是否为顺时针 调用方式为zz3d.util.isPolygonClockwise()
Parameters:
Name | Type | Description |
---|---|---|
ptArray |
Array | 点组 点类型为Cart3 |
Returns:
返回true表示为顺时针 返回false表示逆时针
- Type
- Boolean
(static) isSelfIntersectXOY(ptArray) → {Boolean}
判断多边形点组在XOY面上是否自交 ptArray为非闭合点组 调用方式为zz3d.util.isSelfIntersectXOY()
Parameters:
Name | Type | Description |
---|---|---|
ptArray |
Array | 点组 点类型为 eg:[100,200] 表示在XOY面上该点的x值是100 y值是200 |
Returns:
在XOY面上是否自交
- Type
- Boolean
(static) Lines2Plane(lineArr, width, height) → {Object}
线拓展成面
Parameters:
Name | Type | Description |
---|---|---|
lineArr |
Array | 中心线点组,点类型Cartesian3 |
width |
Number | 面宽 |
height |
Number | 线的高度抬升 |
Returns:
obj 生成面的各种信息
- Type
- Object
(static) transformPtByZprj(curPt, zprj) → {Cartesian3}
用提供的zprj来变换顶点,此时顶点为投影点,目标是通过zprj得到变换后的地球点 调用方式为zz3d.util.transformPtByZprj()
Parameters:
Name | Type | Description |
---|---|---|
curPt |
Cartesian3 | 投影坐标系下的顶点,点类型Cartesian3 |
zprj |
Object | 描述变换信息的对象 必须包含x/y/longitudeDegree/latitudeDegree |
Returns:
返回变换后的地球点
- Type
- Cartesian3