JSTransparency
API for setting up excavation analysis features.
Creates with the Module.getTransparency API.
var transparency = Module.getTransparency();clear()
Deletes all created excavations.
Module.getTransparency().clear();create(coordinates) → number
Creates an excavation object with the given coordinates.
The coordinates input is a list of area coordinates (JSVector3D, JSVector3D, ...).
- Return - Success (returns the size of the coordinate list) or failure (-1) 
 
- Sample - Refer to function createTransparency. 
 
var AreaVertices = Module.getMap().getInputPoints();
var nIndex = Module.getTransparency().create(AreaVertices);setAutoMove(coordinates, frame) → boolean
Sets the path and speed for an automatically moving circular excavation.
The coordinates input is a list of path coordinates (JSVector2D, JSVector2D, ...).
frame
number
Frame count for updating the excavation position.
- Return - true : Setting successful. 
- false : Setting failed. 
 
- Sample - Refer to function setTransparencyAutoMove. 
 
var movePositionList = new Module.JSVec2Array();
movePositionList.push(new Module.JSVector2D(127.03691229708741, 37.509635136930626));
movePositionList.push(new Module.JSVector2D(127.03987097629198, 37.50932526196098));
movePositionList.push(new Module.JSVector2D(127.03695802409491, 37.50865005215346));
movePositionList.push(new Module.JSVector2D(127.03985503640686, 37.50816724210336));
movePositionList.push(new Module.JSVector2D(127.03711645791172, 37.50779863443866));
movePositionList.push(new Module.JSVector2D(127.03978095384555, 37.50738212410067));
// Set auto-move for excavation
Module.getTransparency().setAutoMove(movePositionList, 5);setDepth(depth)
Sets the depth of the excavation.
depth
number
Depth of the excavation from the ground surface (in meters).
- Sample - Refer to function createTransparency. 
 
Module.getTransparency().setDepth(5.5);setRadius(radius)
Sets the radius of the circular excavation.
radius
number
Radius of the circular excavation (in meters).
- Sample - Refer to function setTransparencyRadius. 
 
Module.getTransparency().setRadius(500.0);setTexture(data, width, height, type) → boolean
Sets the texture image for the excavation surface.
The data variable is a binary array data based on Uint8Array.
data
object
Image Byte Array
width
number
Image width
height
number
Image height
type
boolean
true for side texture. false for bottom texture.
- Return - true : Setting successful. 
- false : Setting failed. 
 
- Sample - Refer to function setTransparencyTexture. 
 
var img = new Image();
// Load texture image
img.onload = function () {
    var canvas = document.createElement("canvas");
    canvas.width = img.width;
    canvas.height = img.height;
    var ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0);
    var imageSize = new Module.JSSize2D(img.width, img.height);
    var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
    // Set excavation texture
    var transparency = Module.getTransparency();
    transparency.setTexture(imageData, canvas.width, canvas.height, true); // floor texture
    transparency.setTexture(imageData, canvas.width, canvas.height, false); // wall texture
};
img.src = "./image/FaceImage.jpg";startAutoMove() → boolean
Starts the automatic movement of the excavation along a predefined path.
- Return - true : Movement start successful. 
- false : Movement start failed. 
 
- Sample - Refer to function startTransparencyAutoMove. 
 
Module.getTransparency().startAutoMove();stopAutoMove()
Stops the automatic movement of the excavation along a predefined path.
- Sample - Refer to function stopTransparencyAutoMove. 
 
Module.getTransparency().stopAutoMove();Last updated
