Skip to content

YY. BaseObject

BaseObject 为所有图形组件的基类,Bar, Box, ExtrudePolygon 等都是基于他,你可以基于他自定义自己需要的组件, 其具有的方法为他们都拥有的方法, 类似于 YY. Overlay 为所有覆盖物的基类, 它的子类有:

BaseObject
│   ExtrudePolygon
│   ExtrudePolygons
│   Bar
│   Bars
│   Line
│   Lines
│   ExtrudeLine
│   ExtrudeLins
│   Model
│   ExtrudeLineTrail
│   TripControl
│   Truck
│   Point
│   Points
│   Terrain
│   HeatMap
│   FatLine
│   FatLines
│   Box
│   Boxs
│   Water
│   TripLine
│   Pipe
│   Pipe
│   TrialLine
│   ArcLine
│   TripArcLine
│   TrialArcLine
│   ......

creation

  • constructor(id)

properties

TIP

如果你对 threejs 熟悉的话,那么你应该非常数熟悉下面的属性代表着是么

geometry

  • 几何体 THREE. BufferGeometry

material

  • 材质,注意这个值可能为空,当 object3d 为 group 时,这个值为空

position

  • 模型的位置,THREE. Vector3

scale

  • 模型的缩放属性

rotation

  • 模型的旋转属性

layers

  • 模型的 layers 属性

children

  • 模型的 children 属性

method

addTo(threeScene)

  • 将自身添加到场景上
  • 参数
    • {ThreeScene} threeScene : 场景
  • 返回值: this

remove()

  • 从场景上移除
  • 返回值: this

getObject3d()

  • 获取 THREE. Ojbect3d
  • 返回值: THREE.Ojbect3d

getId()

  • 获取 id
  • 返回值: string

setId(id)

  • 设置 id
  • 参数
    • {string} id
  • 返回值: this

getType()

  • 获取其类型
  • 返回值: string

getOptions()

  • 获取其配置信息
  • 返回值: Object

getProperties()

  • 获取额外的属性值
  • 返回值: Object

setProperties(properties)

  • 设置其额外的属性信息
  • 参数
    • {Object} properties
  • 返回值: this

getMap()

  • 获取地图对象
  • 返回值: YY.Map

getCenter()

  • 获取中心点
  • 返回值: YY.LngLat|Array

getAltitude()

  • 获取其自身的海拔高度
  • 返回值: number

setAltitude(altitude)

  • 设置其自身的海拔高度
  • 参数
    • {number} altitude 海拔
  • 返回值: this

show()

  • 显示
  • 返回值: this

hide()

  • 隐藏
  • 返回值: this

isVisible()

  • 是否可见
  • 返回值: boolean

animateShow(options,cb)

  • 动画显示
  • 参数
    • options
      • {number} duration 动画时间
    • {Function} cb 动画回调函数
  • 返回值: this

getMinZoom()

  • 获取其最小的 zoom
  • 返回值: number

getMaxZoom()

  • 获取其最大的 zoom
  • 返回值: number

isAsynchronous()

  • 是否是异步的,一般指的是在 worker 里执行
  • 返回值: boolean

bindTooltip(content, [options])

  • 绑定 tooltip
  • 参数
    • {string} content :tooltip 的内容
    • {Object} options :tooltip 其他的额外参数
  • 返回值: this

removeTooltip()

  • 移除 tooltip
  • 返回值: this

bindPopup(content, [options])

  • 绑定 popup
  • 参数
    • {string} content :popup 的内容
    • {Object} options :popup 其他的额外参数
  • 返回值: this

removePopup()

  • 移除 popup
  • 返回值: this

getPopup()

  • 获取 popup
  • 返回值: YY.Popup

openPopup(lnglat)

  • 打开气泡窗口
  • 参数
    • {YY. LngLat} lnglat :lnglat
  • 返回值: this

closePopup()

  • 关闭气泡窗口
  • 返回值: this

on(eventtype, callback)

  • 绑定事件
  • 参数
    • {string} eventtype : 事件类型 mousemove click dbclick
    • {function} callback : 回调函数
  • 返回值: this

off(eventtype, callback)

  • 移除事件
  • 参数
    • {string} eventtype : 事件类型 mousemove click dbclick
    • {function} callback : 回调函数
  • 返回值: this

fire(eventtype, params)

  • 触发事件
  • 参数
    • {string} eventtype : 事件类型 mousemove click dbclick
    • {Object} params : 任意参数值
  • 返回值: this

_initOptions(opionts)

  • 初始化内部 options,一般在开发自定义图形组件时使用
  • 参数
    • {Object} opionts
  • 返回值: this

_createMesh(geometry,material)

  • 创建 mesh,一般在开发自定义图形组件时使用
  • 参数
    • {THREE. BufferGeometry} geometry
    • {THREE. Material} material
  • 返回值: this

_createGroup()

  • 创建 group,一般在开发自定义图形组件时使用
  • 返回值: this

_createLine(geometry,material)

  • 创建 line,一般在开发自定义图形组件时使用
  • 参数
    • {THREE. BufferGeometry} geometry
    • {THREE. LineBasicMaterial|THREE. LineDashedMaterial} material
  • 返回值: this

_createLine2(geometry,material)

  • 创建 fatline,一般在开发自定义图形组件时使用
  • 参数
    • {THREE. BufferGeometry} geometry
    • {THREE. LineMaterial} material
  • 返回值: this

_createPoints(geometry,material)

  • 创建 points,一般在开发自定义图形组件时使用
  • 参数
    • {THREE. BufferGeometry} geometry
    • {THREE. PointsMaterial} material
  • 返回值: this

_createLineSegments(geometry,material)

  • 创建 LineSegments,一般在开发自定义图形组件时使用
  • 参数
    • {THREE. BufferGeometry} geometry
    • {THREE. LineBasicMaterial | THREE. LineDashedMaterial} material
  • 返回值: this

This document is generated by vitepress and Edit by deyihu