new AltizureProjectMarker(APMOptions)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
APMOptions |
object | options for initialization Properties
|
Example
construction
let altizureProjectMarkerOptions1 = {
pid: '5a07f43f5d1dfe17d0c66bb7', // a project id
// you can also specify the pose of the AltizureProjectMarker
// position, orientation, scale
pose: {
position: {
lng: ...,
lat: ...,
alt: ...
},
orientation: {x: ..., y: ..., z: ..., w: ...},
// the expected orientation
scale: {x: ..., y: ..., z: ...}
// scale in x, y and z directions
}
}
let altizureProjectMarkerOptions2 = {
pid: '5a07f43f5d1dfe17d0c66bb7', // a project id
// you can also specify the pose of the AltizureProjectMarker
// position, orientation, scale
position: {
lng: ...,
lat: ...,
alt: ...
},
orientation: {x: ..., y: ..., z: ..., w: ...},
// the expected orientation
scale: {x: ..., y: ..., z: ...}
// scale in x, y and z directions
}
// the pose defined in markerOptions.pose has higher priority
let altizureProjectMarkerOptions3 = {
pid: '5a07f43f5d1dfe17d0c66bb7', // a project id
// you can also specify the pose of the AltizureProjectMarker
// position, orientation, scale
pose: {
position: { // this position will be used
lng: ...,
lat: ...,
alt: ...
},
orientation: {x: ..., y: ..., z: ..., w: ...}, // this orientation will be used
// the expected orientation
}
// position, orientation, scale
position: {
lng: ...,
lat: ...,
alt: ...
},
orientation: {x: ..., y: ..., z: ..., w: ...},
// the expected orientation
scale: {x: ..., y: ..., z: ...} // this scale will be used
// scale in x, y and z directions
}
// all three markerOptions are valid
// use first markerOptions
let altizureProjectMarkerOptions = altizureProjectMarkerOptions1
altizureProjectMarkerOptions.autoScale = true // true means the max length of the base of bbox is 50 meters
// altizureProjectMarkerOptions.autoScale = 200 // max length of the base of bbox is 200 meters
sandbox.add('AltizureProjectMarker', altizureProjectMarkerOptions)
Extends
Members
-
autoScale
-
Change the scale with the length of largest base edge equals to input autoScale if input is true, it means 50.
Example
Set autoScale
altizureProjectMarker.autoScale = true // the same as 50 altizureProjectMarker.autoScale = 50 // the same as the line above // or other number altizureProjectMarker.autoScale = 1000
-
euler :object
-
The orientation in Eular angle representation. { x: rotation angle around X axis in radian, y: radian, z: radian, order: rotation order, default 'XYZ'}. Use this instead of
orientation
if you are not familar with the math.- Overrides:
- See:
Example
Set orientation by Eular angles
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.
-
readonly geoCoverage
-
Project boundary
-
readonly ID :string
-
Get the unique id.
- Inherited From:
-
interactable :bool
-
Set if the marker is interactable. Set to true to respond to mouse events.
- Overrides:
Example
Set interactable
marker.interactable = true // make this marker interactable marker.interactable = !marker.interactable // flip interactable status
-
name :string
-
A string of name.
- Overrides:
Example
Set name
marker.name = 'this marker' // set name as 'this marker' marker.name = marker.name + ' suffix' // extend the name
-
orientation :object
-
Set the rotation by an uniform quaternion {x, y, z, w}. Use
eular
instead if you are not sure how to use this.- Overrides:
- See:
Example
Set orientation
marker.orientation = {x: 0, y: 0, z: 0, w: 1}
-
readonly photos
-
Photo operations.
-
position :LngLatAlt
-
Change the current position {lng, lat, alt}.
- Overrides:
Example
Set position
marker.position = { lng: 113.93977612840078, lat: 22.5364271949327, alt: 12.3 }
-
readonly projInfo
-
Project information.
-
scale :number
-
Set the scale of the marker.
- Overrides:
Example
Set scale
marker.scale = 2.0 // set scale to 2.0 marker.scale = marker.scale * 2.0 // make it two times bigger
-
visible :bool
-
Set the visibility of the marker.
- Overrides:
Example
Set visible
marker.visible = false // make this marker invisible marker.visible = !marker.visible // flip visible status
-
readonly water
-
Water operations.
-
x :number
-
Set the scale of the marker in x direction.
- Overrides:
Example
Set scale x
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
-
Set the scale of the marker in y direction.
- Overrides:
Example
Set scale y
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
-
Set the scale of the marker in z direction.
- Overrides:
Example
Set scale z
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
-
_detectOffset(srcImg, dstImg, options) → {promise}
-
detect the offset from srcImg to dstImg by search for their best matching
Parameters:
Name Type Description srcImg
Object depth map of this AltizureProjectMarker
dstImg
Object mask Image
options
Object other options
Returns:
promise -
_generateImages(options) → {object}
-
generate images for offset detection, to be used in method _detectOffset
Parameters:
Name Type Description options
object Returns:
object -
abstract animate(options)
-
Propagated event, new frame being rendered.
Parameters:
Name Type Description options
object - Overrides:
-
autoAdjustPolygons(boundaryPts, polygonMarkers, bufferMaxSize)
-
Automatically adjust polygonMarkers by obtaining their top and bottom from the depth map. The polygonMarkers must be ready
Parameters:
Name Type Default Description boundaryPts
Array.<LngLat> the lnglat points represent boundary
polygonMarkers
Array.<PolygonMarker> polygons to be adjust
bufferMaxSize
number 512 depthmap and mask resolution
-
deport() → {bool}
-
Destruct tree, and release all memory resources. But keep the marker data structure.
Returns:
bool -
deportPhotos() → {bool}
-
Deport photos.
Returns:
bool -
deportWater()
-
Release memory occupied by water.
-
destruct()
-
Destructor.
- Overrides:
-
detachControl()
-
Detach and hide the control gizmo of the marker
- Inherited From:
Example
Detach control
marker.detachControl()
-
dim()
-
Un-highlight the marker. (hide the blue fence of the marker)
- Inherited From:
Example
Un-highlight
marker.dim()
-
disposeCurrentDisplay()
-
Fade out the current photo display.
-
earthToObj() → {Matrix4}
-
From abstract earth-space to Obj space.
Returns:
Matrix4 -
earthToProject() → {Matrix4}
-
From abstract? earth-space to project holder.
Returns:
Matrix4 -
getRegionVolume(polygonMarker) → {object|undefined}
-
Get the {cut, fill, area, surface, refAltitude, highest, lowest} of a region marked by polygon. The polygon must be ready
Parameters:
Name Type Description polygonMarker
PolygonMarker polygon marker indicating the region of interest
Returns:
object | undefinedExample
get the measurement inside a polygon
altizureProjectMarker.getRegoinVolume(polygonMarker, 0) // reference altitude is 0 // input a polygonMarker and the reference altitude to // get the measured information, including // cut: how much is the volume we should dig to make the area flat at refAltitude // fill: how much is the volume we should fill to make the area flat at refAltitude // area: the area inside the boundary of polygonMarker // surface: the area of the surface inside the boundary of the polygonMarker // refAltitude: the cut and fill are calculated based on this altitude // highest: highest altitude in the region // lowest: lowest altitude in the region
-
importPhotos() → {promise}
-
Import photos of the altizure project. put them into this.photoHolder
Returns:
promise -
importWater() → {promise}
-
import water of the altizure project. put it into this.waterHolder
Returns:
promise -
light()
-
Highlight the marker. (show the blue fence of the marker)
- Inherited From:
Example
Highlight
marker.light()
-
measureByPolygon(polygonMarker, refAltitude) → {Promise}
-
Get the {cut, fill, area, refAltitude, highest, lowest} of a region marked by polygon. The polygon maybe just constructed one.
Parameters:
Name Type Description polygonMarker
PolygonMarker refAltitude
number Returns:
PromiseExample
get the measurement inside a polygon
altizureProjectMarker.measureByPolygon(polygonMarker, 0) .then((result) => { // result: {cut, fill, area, refAltitude, highest, lowest} let measureInfo = result })
-
objToEarth() → {Matrix4}
-
From altizure obj space to earth-space (abstract, not in meter)
Returns:
Matrix4 -
objToScene() → {Matrix4}
-
From obj space to scene-root.
Returns:
Matrix4 -
off(eventType, handler)
-
Un-register the handler from an event.
Parameters:
Name Type Description eventType
string handler
function - Inherited From:
Example
Un-register interaction events
marker.off('click') marker.off('mouseover') marker.off('mouseenter') marker.off('mouseleave')
-
on(eventType, handler)
-
Register an event with a handler. Note: an event can only has one handler.
Parameters:
Name Type Description eventType
string 'click', 'mouseover', 'mouseenter', 'mouseleave'
handler
function event handler
- Inherited From:
Example
Register interaction events
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
-
onContentInitialized()
-
EventHandler when 3d model has been downloaded and added into the scene. Use marker.initialized.then(function(){}) to handle this event.
-
orientationByHorizontalPoints(pts, flip) → {Quaternion}
-
get the realigned orientation from horizontal points
Parameters:
Name Type Default Description pts
Array.<LngLatAlt> flip
bool false Returns:
Quaternion- Inherited From:
-
pickDepthMap(lngLatArray) → {Array.<nubmer>}
-
Get the altitude value of an array of points on this project marker.
Parameters:
Name Type Description lngLatArray
Array.<LngLatAlt> array of {lng, lat} object
Returns:
Array.<nubmer>Example
Pick the depth from lng and lat
let positions = [ {lng: 107.30426318131709, lat: 35.65218367804628}, {lng: 107.30425715131709, lat: 35.65218477804628}, {lng: 107.30424679131709, lat: 35.65218677604628}, {lng: 107.30423743131709, lat: 35.65218777304628} ] let heightsArray = altizureProjectMarker.pickDepthMap(positions)
-
sceneToObj() → {Matrix4}
-
From scene-root to obj space.
Returns:
Matrix4 -
sceneUpdated(options)
-
Triggered when scene is updated. Will propagate to
Parameters:
Name Type Description options
any - Overrides:
-
setControlMode(mode)
-
Set the mode of control gizmo
Parameters:
Name Type Description mode
string the mode of the control gizmo 'translate', 'rotate'
- Inherited From:
Example
Set the mode of the control
marker.setControlMode('translate') marker.setControlMode('rotate')
-
shapeToEarth() → {Matrix4}
-
Transformation matrix from shapeHolder-space to earth-space
Returns:
Matrix4- Inherited From:
-
shapeToScene() → {Matrix4}
-
Transformation matrix from shapeHolder-space to scene-root
Returns:
Matrix4- Inherited From:
-
showControl(mode)
-
Play the {index} patrol route of the marker
Parameters:
Name Type Description mode
string the mode of the control gizmo: 'translate', 'rotate'
- Inherited From:
Example
Show control
marker.showControl('translate') // show control used for translate marker.showControl('rotate') // show control used for rotate
-
updateVisibility(options)
-
Triggered when visibility is being updated. Will propagate the event to smart-tree.
Parameters:
Name Type Description options
object - Overrides: