BaseObject β
It is a super base class.
Its subclasses include:
ββ Bar.ts
ββ Bars.ts
ββ Box.ts
ββ Boxs.ts
ββ ExtrudeLine.ts
ββ ExtrudeLines.ts
ββ ExtrudeLineTrail.ts
ββ ExtrudePolygon.ts
ββ ExtrudePolygons.ts
ββ FatLine.ts
ββ FatLines.ts
ββ HeatMap.ts
ββ Line.ts
ββ Lines.ts
ββ Model.ts
ββ Path.ts
ββ Paths.ts
ββ Point.ts
ββ Points.ts
ββ Terrain.tsIts API and maptalks Geometry is very similar
constructor() β
Usually, we directly use its subclasses
js
const baseObject = new BaseObject(id);methods β
_initOptions(options: Record<string, any>) β
init BaseObject inner config for custom
js
this._initOptions(options);_createMesh(geometry, material) β
create inner THREE.Mesh for custom
js
const geometry = new THREE.CircleBufferGeometry(r, 50);
//Initialize internal object3d
// https://github.com/maptalks/maptalks.three/blob/1e45f5238f500225ada1deb09b8bab18c1b52cf2/src/BaseObject.js#L140
this._createMesh(geometry, material);_createGroup() β
create inner THREE.Group for custom
_createLine(geometry, material) β
create inner THREE.Line
_createPoints(geometry, material) β
create inner THREE.Points for custom
_createLineSegments(geometry, material) β
create inner THREE.LineSegments for custom
_createInstancedMesh(geometry, material, count) β
create inner THREE.InstancedMesh for custom
getObject3d() β
get inner THREE.Object3d , THREE.Mesh , THREE.Group etc
getOptions() β
get BaseObject options config
addTo(threeLayer) β
remove() β
getId() β
setId(id:string) β
getProperties() β
setProperties(props: Record<string, any>) β
getLayer(): ThreeLayer β
getMap(): Map β
getCenter(): Coordinate|null β
getAltitude():number β
setAltitude(altitude: number) β
getHeight():number β
setHeight(height: number) β
show() β
hide() β
isVisible():boolean β
setInfoWindow(options) β
js
// //infowindow test
bar.setInfoWindow({
content: 'hello world,height:' + d.height * 400,
title: 'message',
animationDuration: 0
});getInfoWindow() β
openInfoWindow(coordinate) β
closeInfoWindow() β
removeInfoWindow() β
setToolTip(content, options) β
js
// // tooltip test
bar.setToolTip(d.height * 400, {
showTimeout: 0,
eventsPropagation: true,
dx: 10
});getToolTip() β
closeToolTip() β
removeToolTip() β
getMinZoom() β
getMaxZoom() β
isAsynchronous() β
Is it asynchronous, that is, constructing graphic data through workers
on(eventName, handler, context) β
js
const clickHandler = (e) => {
}
bar.on('click', clickHandler);once(eventName, handler, context) β
js
bar.once('click', clickHandler);off(eventName, handler, context) β
js
bar.off('click', clickHandler);events β
js
const clickHandler = (e) => {
}
bar.on('click mousemove', clickHandler);add β
remove β
click β
mousemove β
mouseover β
mouseout β
dblclick β
empty β
idchange β
propertieschange β
show β
hide β
symbolchange β
workerload β
WARNING
This event will only be triggered by constructing graphic data through workers