new DitchMarker(markerOptions)
创建DitchMarker的一个实例。
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
markerOptions |
object |
Properties
|
Examples
let pts = [
new altizure.LngLatAlt(113.93868723125762, 22.536830165346906, 0),
new altizure.LngLatAlt(113.93867780368912, 22.53715382208763, 0),
new altizure.LngLatAlt(113.93945433925597, 22.53718272790738, 0),
new altizure.LngLatAlt(113.93945744949984, 22.536853133662152, 0),
new altizure.LngLatAlt(113.93868723125762, 22.536830165346906, 0)
// the first and last point should be the same
] // length 5
// the tops can be automatically obtained through pickDepthMap(LngLat[], number) using AltizureProjectMarker
let tops = [
50, 45, 67, 33.4
] // length pts.length - 1 = 4
// as the first and the last point in pts is the same
let volume = {
points: pts,
color: 0xffffff,
opacity: 0.3,
top: tops, // top can be an array or a number. When it is an array, its length should be points.length - 1
bottom: 0.2 // bottom must be a number for DitchMarker
}
let ditchMarker = new altizure.DitchMarker({
volume: volume,
sandbox: sandbox
})
let outpts = [
new altizure.LngLatAlt(113.93868723125762, 22.536830165346906, 0),
new altizure.LngLatAlt(113.93867780368912, 22.53715382208763, 0),
new altizure.LngLatAlt(113.93945433925597, 22.53718272790738, 0),
new altizure.LngLatAlt(113.93945744949984, 22.536853133662152, 0),
new altizure.LngLatAlt(113.93868723125762, 22.536830165346906, 0)
// the first and last point should be the same
] // length 5
let holepts = [
new altizure.LngLatAlt(113.93889136065118, 22.536930209186917, 0),
new altizure.LngLatAlt(113.93888975348045, 22.537047514032043, 0),
new altizure.LngLatAlt(113.93909509788641, 22.537064284308517, 0),
new altizure.LngLatAlt(113.93912719845262, 22.536941793866472, 0),
new altizure.LngLatAlt(113.9390056396585, 22.536923522386015, 0),
new altizure.LngLatAlt(113.93889136065118, 22.536930209186917, 0)
] // length 6
let pts = [
{array: outpts, hole: false}, // length 5
{array: holepts, hole: true} // length 6
]
// the tops can be automatically obtained through pickDepthMap(LngLat[], number) using AltizureProjectMarker
let tops = [
[50, 45, 67, 33.4], // length (5 - 1) = 4 as the first and the last point in outpts is the same
[45, 50, 77, 45, 65] // length (6 - 1) = 5 as the first and the last point in holepts is the same
]
let volume = {
points: pts,
color: 0xffffff,
opacity: 0.3,
top: tops,
bottom: 0.2 // bottom must be a number for DitchMarker
}
let ditchMarker = new altizure.DitchMarker({
volume: volume,
sandbox: sandbox
})
Extends
Members
-
bottom
-
改变底部的高度。
- Overrides:
Example
ditchMarker.bottom = 0.4 // bottom must be a number for DitchMarker
-
color
-
基本颜色。任何可以解析为THREE.Color的东西,建议使用十六进制数字。
- Overrides:
Example
polygonBaseMarker.color = 0xff0000 // red
-
depthTest
-
是否进行深度测试。如果错误,应该在前面。
- Overrides:
Example
polygonBaseMarker.depthTest = true // do depth test polygonBaseMarker.depthTest = !polygonBaseMarker.depthTest // flip the depth test status
-
euler :object
-
Eular角度表示中的方向。 {x:绕X轴以弧度为单位的旋转角度, y:弧度, z:弧度, 顺序:旋转顺序,默认'XYZ'}。 用这个代替
方向
如果你不熟悉数学。- Inherited From:
- See:
Example
marker.euler = {x: Math.PI/6, y: Math.PI/4, z: Math.PI/3} // rotate around X-axis for 30 degree; Y for 45 degree; Z for 60 degree, in that order. marker.euler = {y: Math.PI/2} // rotate around Y-axis for 90 degree.
-
hasBottomCover
-
沟渠总是有一个底部。
- Overrides:
-
hasTopCover
-
沟渠总是没有顶部。
- Overrides:
-
readonly ID :string
-
获取唯一的ID。
- Inherited From:
-
interactable :bool
-
如果标记是可交互的,则设置。设置为true以响应鼠标事件。
- Overrides:
Example
marker.interactable = true // make this marker interactable marker.interactable = !marker.interactable // flip interactable status
-
name :string
-
一串名字。
- Inherited From:
Example
marker.name = 'this marker' // set name as 'this marker' marker.name = marker.name + ' suffix' // extend the name
-
opacity
-
沟渠总是不透明的。
- Overrides:
-
orientation :object
-
通过均匀四元数{x,y,z,w}设置旋转。 使用
EULAR
相反,如果你不知道如何使用这个。- Inherited From:
- See:
Example
marker.orientation = {x: 0, y: 0, z: 0, w: 1}
-
position :LngLatAlt
-
改变当前位置{lng,lat,alt}。
- Inherited From:
Example
marker.position = { lng: 113.93977612840078, lat: 22.5364271949327, alt: 12.3 }
-
scale :number
-
设置标记的比例。
- Inherited From:
Example
marker.scale = 2.0 // set scale to 2.0 marker.scale = marker.scale * 2.0 // make it two times bigger
-
texture
-
沟的条纹纹理。一组颜色,每个元素应该能够被THREE.Color分析。示例:['#343434',0x645242,0,THREE.Color(0xffffff)]
Example
ditchMarker.texture = [ 0xff0000, '#00FF00', THREE.Color(0, 0, 1), 'rgb(0.4, 0.5, 1.0)' ] // array of anything that can be parsed by THREE.Color
-
top
-
顶部的高度。当它是一个数组时,其长度必须等于volume.points.length-1。
- Overrides:
Example
// set top of every side edge to be the same polygonBaseMarker.top = 100 // specify different values for different side edges // the order of the input array should be the same as the points // when the points is // [ // {array: length 5, hole: false}, {array: length 6, hole: true} // ] polygonBaseMarker.top = [ [110, 140, 180, 133], [100, 200, 150, 115, 175] // length (5 - 1) = 4 and length (6 - 1) = 5, corrosponding to the points ] // special case: // when the points is [ // {array: length 7, hole: false} // ] polygonBaseMarker.top = [ [120, 150, 180, 133, 165, 147] // length (7 - 1) = 6 ] // or: polygonBaseMarker.top = [ 120, 150, 180, 133, 165, 147 ] // this will be automatically converted into the input above
-
visible :bool
-
设置标记的可见性。
- Inherited From:
Example
marker.visible = false // make this marker invisible marker.visible = !marker.visible // flip visible status
-
x :number
-
在x方向上设置标记的比例。
- Inherited From:
Example
marker.x = 2.0 // set scale x to 2.0 marker.x = marker.x * 2.0 // make it two times bigger in x direction
-
y :number
-
在y方向上设置标记的比例。
- Inherited From:
Example
marker.y = 2.0 // set scale y to 2.0 marker.y = marker.y * 2.0 // make it two times bigger in y direction
-
z :number
-
在z方向上设置标记的比例。
- Inherited From:
Example
marker.z = 2.0 // set scale z to 2.0 marker.z = marker.z * 2.0 // make it two times bigger in z direction
Methods
-
abstract animate(options)
-
传播的事件,正在渲染的新帧。
Parameters:
Name Type Description options
object - Inherited From:
-
detachControl()
-
分离并隐藏标记的控件小控件
- Inherited From:
Example
marker.detachControl()
-
dim()
-
Un-highlight the marker. (hide the blue fence of the marker)
- Inherited From:
Example
marker.dim()
-
light()
-
Highlight the marker. (show the blue fence of the marker)
- Inherited From:
Example
marker.light()
-
off(eventType, handler)
-
从事件中取消注册处理程序。
Parameters:
Name Type Description eventType
string handler
function - Inherited From:
Example
marker.off('click') marker.off('mouseover') marker.off('mouseenter') marker.off('mouseleave')
-
on(eventType, handler)
-
用处理程序注册一个事件。 注意:一个事件只能有一个处理程序。
Parameters:
Name Type Description eventType
string 'click','mouseover','mouseenter','mouseleave'
handler
function 事件处理器
- Inherited From:
Example
marker.on('click', function (event) { console.log('click on marker ', marker, event) }) marker.on('mouseover', function (event) { console.log('mouse over marker ', marker, event) }) marker.on('mouseenter', function (event) { console.log('mouse enter marker ', marker, event) }) marker.on('mouseleave', function (event) { console.log('mouse leave marker ', marker, event) }) marker.interactable = true // the marker must be interactable for events to take effects
-
orientationByHorizontalPoints(pts, flip) → {Quaternion}
-
从水平点得到重新定位的方向
Parameters:
Name Type Default Description pts
Array.<LngLatAlt> flip
bool false Returns:
Quaternion- Inherited From:
-
abstract sceneUpdated(options)
-
传播的定期事件处理程序。当场景内容更新时触发。
Parameters:
Name Type Description options
object - Inherited From:
-
setControlMode(mode)
-
设置控件Gizmo的模式
Parameters:
Name Type Description mode
string 控件gizmo'translate','rotate'的模式
- Inherited From:
Example
marker.setControlMode('translate') marker.setControlMode('rotate')
-
shapeToEarth() → {Matrix4}
-
从shapeHolder-space到地球空间的变换矩阵
Returns:
Matrix4- Inherited From:
-
shapeToScene() → {Matrix4}
-
从shapeHolder-space到scene-root的变换矩阵
Returns:
Matrix4- Inherited From:
-
showControl(mode)
-
播放标记的{index}巡视路线
Parameters:
Name Type Description mode
string 控件gizmo的模式:'translate','rotate'
- Inherited From:
Example
marker.showControl('translate') // show control used for translate marker.showControl('rotate') // show control used for rotate
-
abstract updateVisibility(options)
-
传播事件,屏幕可见性正在更新。
Parameters:
Name Type Description options
object - Inherited From: