potree的API說明文檔


Potree


 

.version

 major: 1,

 minor: 5,

 suffix: "RC"

.pointBudget

 1*1000*1000

.Webgl

 shaders: {},

 vaos: {},

 vbos: {}

.scriptPath

 null

.startQuery(name, gl)

 @return:query

.endQuery (query, gl)

 

.resolveQueries (gl)

 

.loadPointCloud (path, name, callback)

 @return: {type: "pointcloud_loaded", pointcloud: pointcloud}

.updatePointClouds (pointclouds, camera, renderer)

@return:{visibleNodes: visibleNodes,      numVisiblePoints: numVisiblePoints,       lowestSpacing: lowestSpacing };

.updateVisibility (pointclouds, camera, renderer)

@return:{visibleNodes: visibleNodes,      numVisiblePoints: numVisiblePoints,       lowestSpacing: lowestSpacing };

.updateDEMs (renderer, visibleNodes)

 

.Shader(vertexShader, fragmentShader, program, uniforms)

.VBO(name, id, attribute)

.VAO(id, geometry, vbos)

.compileShader(gl, vertexShader, fragmentShader)

@return: Potree.Shader();

.createVAO(gl, geometry)

@return: Potree.VAO();

.renderPointcloud(pointcloud, camera, renderer)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.PointCloudTreeNode


 

getChildren():

getBoundingBox():

isLoaded():

isGeometryNode():

isTreeNode():

getLevel():

getBoundingSphere():

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.PointCloudTree

 


 

extends THREE.Object3D()

 

initialized():

@return this.root !== null;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

/**

 * @class Loads mno files and returns a PointcloudOctree

 * for a description of the mno binary file format, read mnoFileFormat.txt

 *

 * @author Markus Schuetz

 */

.POCLoader


 

load (url, callback):

/**

 * @return a point cloud octree with the root node data loaded.

 * loading of descendants happens asynchronously when they're needed

 *

 * @param url

 * @param loadingFinishedListener executed after loading the binary has been finished

 */

loadPointAttributes(mno):

@return Potree.PointAttributes()

createChildAABB(aabb, childIndex):

@return THREE.Box3()

 

 

 

 

 

 

 

 

 

 

/**

 * A single point attribute such as color/normal/.. and its data format/number of elements/...

 *

 * @class

 * @param name

 * @param type

 * @param size

 * @returns

 */

.PointAttribute


 

POSITION_CARTESIAN:

RGBA_PACKED

COLOR_PACKED

NORMAL_FLOATS

FILLER_1B

INTENSITY

CLASSIFICATION

NORMAL_SPHEREMAPPED

NORMAL_OCT16

NORMAL

 

 

 

 

 

 

 

 

/**

 * Ordered list of PointAttributes used to identify how points are aligned in a buffer.

 *

 * @class

 *

 */

.PointAttributes


 

屬性:

attributes = [];

byteSize = 0;

size = 0;

方法:

add(pointAttribute):

hasColors():

@return: ture/false

hasNormals ():

@return: ture/false

 

 

 

 

 

 

 

 

 /**

  * 加載二進制文件

  *

  * @class

  * @param version

  * @param boundingBox

  * @param scale

  * @returns

 */

.BinaryLoader


 

屬性:

VersionboundingBoxscale

方法:

load(node)

 

parse(node, buffer)

 

 

 

 

 

 

 

 

 

 /**

  * 加載二進制文件(las格式或者laz格式)

  *

  * @class

  * @param version

 * @returns

 */

LasLazLoader

 


 

屬性

Version

方法

load(node)

parse(node, buffer)

 

 

 

 

 

 

 

 

 

 

 

 

 /**

  * 點雲材質

  *

  * @class

  * @param parameters

 * @returns

 */

THREE.Material.call( this );繼承自THREE.Matrial

.PointCloudMaterial 


 

屬性

visibleNodesTexturenew THREE.DataTexture();

pointSizesize || 1.0

minSizeminSize || 1.0;

maxSizemaxSize || 50.0

_pointSizeType  {OCTREE:0,KDTREE:1}

_pointShape {SQUARE: 0,CIRCLE: 1};

_interpolatetrue/false;

_pointColorType {RGB:0, COLOR:1,DEPTH: 2,HEIGHT: 3,ELEVATION: 3,INTENSITY:    4,INTENSITY_GRADIENT:5,LOD: 6,LEVEL_OF_DETAIL:6,POINT_INDEX: 7,CLASSIFICATION: 8,   RETURN_NUMBER: 9,      SOURCE: 10,NORMAL: 11,PHONG: 12,RGB_HEIGHT: 13,      COMPOSITE: 50}

_useClipBoxtrue/false;

numClipBoxes0;

_clipMode{DISABLED: 0,  CLIP_OUTSIDE: 1,HIGHLIGHT_INSIDE: 2}

_weightedtrue/false;

_depthMap null

_gradient{RAINBOW: [[0, new THREE.Color(0.278, 0, 0.714)],[1/6, new THREE.Color(0, 0, 1)],[2/6, new THREE.Color(0, 1, 1)],[3/6, new THREE.Color(0, 1, 0)],[4/6, new THREE.Color(1, 1, 0)],[5/6, new THREE.Color(1, 0.64, 0)],[1, new THREE.Color(1, 0, 0)]  ],

        GRAYSCALE: [ [0, new THREE.Color(0,0,0)],     [1, new THREE.Color(1,1,1)]]

};

_classification{

                 "DEFAULT": {

                              0:                   new THREE.Vector4(0.5, 0.5,0.5, 1.0),

                              1:                   new THREE.Vector4(0.5, 0.5,0.5, 1.0),

                              2:                   new THREE.Vector4(0.63, 0.32, 0.18, 1.0),

                              3:                   new THREE.Vector4(0.0, 1.0, 0.0, 1.0),

                              4:                   new THREE.Vector4(0.0, 0.8, 0.0, 1.0),

                              5:                   new THREE.Vector4(0.0, 0.6, 0.0, 1.0),

                              6:                   new THREE.Vector4(1.0, 0.66, 0.0, 1.0),

                              7:                    new THREE.Vector4(1.0, 0, 1.0, 1.0),

                              8:                   new THREE.Vector4(1.0, 0, 0.0, 1.0),

                              9:                   new THREE.Vector4(0.0, 0.0, 1.0, 1.0),

                              12:                  new THREE.Vector4(1.0, 1.0, 0.0, 1.0),

                              "DEFAULT": new THREE.Vector4(0.3, 0.6, 0.6, 0.5)

                       }

                    };

gradientTexture: new THREE.Texture();

classificationTexture: new THREE.DataTexture( );

lights: true/false;

fog: true/false;

_useEDL: true/false;

attributes:{};

uniforms:{};

vertexShader:

fragmentShader:

vertexColors: THREE.VertexColors;

 

方法

 

PointCloudMaterial.prototype = new THREE.RawShaderMaterial()

updateShaderSource():

getDefines():返回預定義的shader

setClipBoxesclipBoxes):

gradient.get():返回THREE.Texture()

gradient.set (value):

classification.get():返回THREE.Texture()

classification.set(value):

spacing.get():返回uniforms.spacing.value

spacing.set(value):

useClipBox.get():返回_useClipBox

useClipBox.set(value):

weighted.get():返回_weighted

weighted.set(value):

fov.get():返回uniforms.fov.value

fov.set(value):

screenWidth.get():返回uniforms.screenWidth.value

screenWidth.set(value):

screenHeight.get():返回uniforms.screenHeight.value

screenHeight.set(value):

等等。。。

/**

 * Generates a look-up texture for gradient values (height, intensity, ...)

 *

 */

generateGradientTexture(gradient)

/**

 * Generates a look up texture for classification colors

 *

 */

generateClassificationTexture (classification)

 

 

 

 

 

 

 

 

 

 

 

 

 

/**

 *

 * @class A doubly-linked-list of the least recently used elements.

 */

LRU


 

屬性

// the least recently used item

first :葉子節點;

       // the most recently used item

       last 根節點;

       // a list of all items in the lru list

       items  { LRUItem};

       elements : 0;

       numPoints : 0;

方法

          size ()

       @return  this.elements;

            contains (node):

       @return true/false;

            touch(node):

       /**

 * makes node the most recently used item. if the list does not contain node, it will be added.

* @param node

 */

remove(node):

* removes the least recently used item from the list

getLRUItem():

@return this.first.node

freeMemory ():

當點雲數量大於最大加載數量限制時,從最后的葉子節點開始釋放內存

disposeDescendants (node)

刪除當前節點

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.PointCloudOctreeNode

 


 

extends Potree.PointCloudTreeNode

屬性

children:

sceneNode:

octree:

方法

getNumPoints()

   @return numPoints

isLoaded():

   @return true/false

isTreeNode():

@return true/false

isGeometryNode():

   @return true/false

getLevel():

@return level

getBoundingSphere():

   @return boundingSphere

getBoundingBox():

   @return boundingBox

getChildren():

   @return 八個葉子

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.PointCloudOctree


 

extends Potree.PointCloudTree

屬性

pcoGeometry : geometry;

   boundingBox : .pcoGeometry.boundingBox;

   boundingSphere : .boundingBox.getBoundingSphere();

   material : material || new Potree.PointCloudMaterial();

   visiblePointsTarget : 2*1000*1000;

   minimumNodePixelSize : 150;

   level : 0;    

   showBoundingBox : false;

   boundingBoxNodes : [];

   loadQueue : [];

   visibleBounds : new THREE.Box3();   

   visibleNodes : [];

   visibleGeometry : [];

   pickTarget : null;

   generateDEM : false;

   profileRequests : [];

   name : ""; 

   // TODO read projection from file instead

   projection : geometry.projection;

   root : .pcoGeometry.root;

方法

   setName(name)

   getName()

   @return name

   toTreeNode(geometryNode, parent):

   @return PointCloudOctreeNode()

   updateVisibleBounds():

   根據葉子節點的boundingBox,重新計算visibleBounds

   updateMaterial(material, visibleNodes, camera, renderer):

   更新材質

   updateVisibilityTexture(material, visibleNodes):

   更新材質所需的texture

nodeIntersectsProfile(node, profile):

判斷node與輪廓之間的相交關系

nodesOnRay(nodes, ray)

返回被射線穿過的node

updateMatrixWorld( force )

是否強制更新模型坐標系

hideDescendants(object)

隱藏對象的所有子節點

moveToOrigin()

移動至起始點

moveToGroundPlane()

移動至物體表面

getBoundingBoxWorld()

返回包圍盒子

getPointsInProfile(profile, maxDepth, callback)

/**    * returns points inside the profile points

   * maxDepth:           search points up to the given octree depth

   * The return value is an array with all segments of the profile path

   *  var segment = {

   *          start:     THREE.Vector3,

   *          end:      THREE.Vector3,

   *          points: {}

   *          project: function()

   *  };

   * The project() function inside each segment can be used to transform

   * that segments point coordinates to line up along the x-axis.

    */

getProfile(start, end, width, depth, callback)

/**

   * returns points inside the given profile bounds.

   * start:      

   * end:       

   * width:    

   * depth:            search points up to the given octree depth

   * callback: if specified, points are loaded before searching

   */

getVisibleExtent()

可視范圍

pick(renderer, camera, ray, params = {})

/**

   * params.pickWindowSize: Look for points inside a pixel window of this size.

   *                                             Use odd values: 1, 3, 5, ...

    * TODO: only draw pixels that are actually read with readPixels().

   */

 

 

 

 

 

 

 

 

 

 

 

 

.PointCloudOctreeGeometry 


 

屬性

url : null;

  octreeDir : null;

  spacing : 0;

  boundingBox : null;

  root : null;

  numNodesLoading : 0;

  nodes : null;

  pointAttributes : null;

  hierarchyStepSize : -1;

  loader : null;

 

 

 

 

 

 

 

 

 

.PointCloudOctreeGeometryNode


 

@param name

@param pcoGeometry

@param boundingBox

屬性

id :  number;

  name : name;

  index : 索引;

  pcoGeometry : pcoGeometry;

  geometry : null;

  boundingBox : boundingBox;

  boundingSphere : boundingBox.getBoundingSphere();

  children : {};

  numPoints : 0;

  level : null;

  loaded : false;

  oneTimeDisposeHandlers : [];

  IDCount 0

方法

Object.create(Potree.PointCloudTreeNode.prototype)

isGeometryNode():

@return true

getLevel ()

@return level

isTreeNode ()

@return false

isLoaded ()

@return true/false

getBoundingSphere ()

@return boundingSphere

getBoundingBox ()

@return boundingBox

getChildren ()

@return children[8]

getURL ()

@return url

getHierarchyPath ()

@return path

addChild (child)

向該Geometry添加“子Geometry”

load ()

數據加載

loadPoints  ()

if(fMno.pointAttributes === "LAS"){

         pco.loader = new Potree.LasLazLoader(fMno.version);

  }else if(fMno.pointAttributes === "LAZ"){

         pco.loader = new Potree.LasLazLoader(fMno.version);

  }else{

         pco.loader = new Potree.BinaryLoader(fMno.version, boundingBox, fMno.scale);

         pco.pointAttributes = new Potree.PointAttributes(pco.pointAttributes);

  }

loadHierachyThenPoints  ()

先加載hrc文件后加載點數據

getNumPoints ()

@return numPoints

dispose  ()

清空geometry

 

 

 

 

 

 

 

 

 

 

 

 

.utils 


 

方法

toString(value)

 

normalizeURL(url)

標准化url

pathExists(url)

判斷路徑是否正確

computeTransformedBoundingBox(box, transform)

@return boundingBox

addCommas(nStr)

對於較大的數據,添加分離器

createWorker(code)

* create worker from a string

loadSkybox(path)

加載天空盒子

createGrid(width, length, spacing, color)

創建格網,返回line

createBackgroundTexture(width, height)

創建背景圖片,返回texture

getMousePointCloudIntersection(mouse, camera, renderer, pointclouds)

@return  {location: closestIntersection,  distance: closestDistance,    pointcloud: selectedPointcloud}  or  null

pixelsArrayToImage(pixels, width, height)

@return new Image()

projectedRadius(radius, fov, distance, screenHeight)

topView(camera, node)

俯視圖

frontView(camera, node)

前視圖

leftView (camera, node)

左視圖

rightView (camera, node)

右視圖

frustumSphereIntersection(frustum, sphere)

   * 0: no intersection

   * 1: intersection

   * 2: fully inside

generateDataTexture(width, height, color)

生成texture

getParameterByName(name)

setParameter(name, value)

 

 

.View


 

屬性

position  new THREE.Vector3(0, 0, 0);     

  yaw  Math.PI / 4;

  _pitch  -Math.PI / 4;

  radius  1;         

  maxPitch  Math.PI / 2;

  minPitch  -Math.PI / 2;      

  navigationMode  Potree.OrbitControls;

方法

clone()

@return new Potree.View()

Pitch

Direction

lookAt(t)

改變相機觀看方向

getPivot()

getSide()

pan(x, y)

translate(x, y, z)

translateWorld(x, y, z)

 

.Scene

extends THREE.EventDispatcher

屬性

annotations  [];

  scene  new THREE.Scene();

  scenePointCloud  new THREE.Scene();

  sceneBG  new THREE.Scene();

  camera  new THREE.PerspectiveCamera(fov, 1, 0.1, 1000*1000);

  cameraBG  new THREE.Camera();

  pointclouds  [];            

  measurements  [];

  profiles  [];

  volumes  [];     

  view  new Potree.View();

  directionalLight  null;

 

方法

addPointCloud(pointcloud)

  pointclouds.push(pointcloud);scenePointCloud.add(pointcloud);

addVolume(volume)

  volumes.push(volume)

removeVolume(volume)

volumes.splice(index, 1)

   addMeasurement(measurement)

        measurements.push(measurement)

removeMeasurement(measurement)

  measurements.splice(index, 1)

addProfile(profile)

  profiles.push(profile)

removeProfile(profile)

  profiles.splice(index, 1)

removeAllMeasurements()

  移除全部的measurement和profile

initialize()

  初始化scene

addAnnotation(position, args = {})

  annotations.push(annotation)

@return annotation

   getAnnotations()

@return annotations

 

 

 

 

 .Viewer


@param domElement

@param args

屬性

renderArea  domElement;

   fov  60;

   pointSize  1;

   minPointSize  1;

   maxPointSize  50;

   opacity  1;

   sizeType  "Fixed";

   pointSizeType  Potree.PointSizeType.FIXED;

   pointColorType  null;

   clipMode  Potree.ClipMode.HIGHLIGHT_INSIDE;

   quality  "Squares";

   isFlipYZ  false;

   useDEMCollisions  false;

   minNodeSize  100;

   edlStrength  1.0;

   edlRadius  1.4;

   useEDL  false;

   intensityMax  null;

   heightMin  0;

   heightMax  1;

   materialTransition  0.5;

   weightRGB  1.0;

   weightIntensity  0.0;

   weightElevation  0.0;

   weightClassification  0.0;

   weightReturnNumber  0.0;

   weightSourceID  0.0;

   intensityRange  [0, 65000];

   intensityGamma  1;

   intensityContrast  0;

   intensityBrightness  0;

   rgbGamma  1;

   rgbContrast  0;

   rgbBrightness  0;

   moveSpeed  10;

   showDebugInfos  false;

   showStats  false;

   showBoundingBox  false;

   freeze  false;

   progressBar  new ProgressBar();

   stats  new Stats();

   potreeRenderer  null;

   highQualityRenderer  null;

   edlRenderer  null;

   renderer  null;

   scene  null;

   inputHandler  null;

   measuringTool  null;

   profileTool  null;

   volumeTool  null;

   transformationTool  null;

   skybox  null;

   clock  new THREE.Clock();

   background  null;   

   inputHandler  new Potree.InputHandler(this);

measuringTool  new Potree.MeasuringTool(this);

   profileTool  new Potree.ProfileTool(this);

   volumeTool new Potree.VolumeTool(this);

   transformationTool new Potree.TransformationTool(this);

方法

setScene(scene)

  設置scene

getControls(navigationMode)

  return orbitControls / fpControls / earthControls / null;

getMinNodeSize()

@return minNodeSize

setMinNodeSize(value)

設置最小節點值

getBackground()

@return background

setBackground(bg)

設置背景

setDescription(value)

setNavigationMode(value)

設置漫游模式

setShowBoundingBox(value)

設置顯示盒子大小

getShowBoundingBox ()

@return showBoundingBox

setMoveSpeed(value)

設置鼠標控制靈敏度

getMoveSpeed ()

@return moveSpeed

setHeightRange(min, max)

設置高度范圍

getHeightRange ()

@return {min: this.heightMin, max: this.heightMax}

setIntensityRange(min, max)

設置強度范圍

getIntensityRange ()

@return intensityRange

setIntensityGamma (value)

設置強度伽瑪值

getIntensityGamma ()

@return getIntensityGamma

setIntensityContrast (value)

設置強度對比度

getIntensityContrast ()

@return intensityContrast

setIntensityBrightness (value)

設置強度亮度

getIntensityBrightness ()

@return intensityBrightness

setRGBGamma (value)

設置RGB伽瑪值

getRGBGamma ()

@return rgbGamma

setRGBContrast (value)

設置RGB對比度

getRGBContrast ()

@return rgbContrast

setRGBBrightness (value)

設置RGB亮度

getRGBBrightness ()

@return rgbBrightness

setMaterialTransition(t)

設置材質的轉變方式

getMaterialTransition ()

@return materialTransition

setWeightRGB(w)

設置RGB權重

getWeightRGB ()

@return weightRGB

setWeightIntensity(w)

設置Intensity權重

getWeightIntensity ()

@return weightIntensity

setWeightElevation(w)

設置Elevation權重

getWeightElevation ()

@return weightElevation

setWeightClassification(w)

設置Classification權重

getWeightClassification ()

@return weightClassification

setWeightReturnNumber(w)

設置weightReturnNumber權重

getWeightReturnNumber ()

@return weightReturnNumber

setWeightSourceID(w)

設置weightSourceID權重

getWeightSourceID ()

@return weightSourceID

setIntensityMax(max)

設置intensityMax

getIntensityMax ()

@return intensityMax

setFreeze(value)

設置freeze

getFreeze ()

@return freeze

setPointBudget(value)

設置pointBudget

getPointBudget ()

@return pointBudget

setClipMode(clipMode)

設置clipMode

getClipMode ()

@return clipMode

setDEMCollisionsEnabled(value)

設置useDEMCollisions

getDEMCollisionsEnabled ()

@return useDEMCollisions

setEDLEnabled (value)

設置useEDL

getEDLEnabled ()

@return useEDL

setEDLRadius (value)

設置edlRadius

getEDLRadius ()

@return edlRadius

setEDLStrength (value)

設置edlStrength

getEDLStrength ()

@return edlStrength

setPointSize (value)

設置pointSize

getPointSize ()

@return pointSize

setMinPointSize (value)

設置minPointSize

getMinPointSize ()

@return minPointSize

setMaxPointSize (value)

設置maxPointSize

getMaxPointSize ()

@return maxPointSize

setFOV (value)

設置fov

getFOV ()

@return fov

setOpacity (value)

設置opacity

getOpacity ()

@return opacity

setPointSizing (value)

設置sizeType

getPointSizing ()

@return sizeType

setQuality (value)

設置quality

getQuality ()

@return quality

disableAnnotations ()

enableAnnotations() ()

setMaterial (value)

設置maxPointSize

setClassificationVisibility(key, value)

@return maxPointSize

setMaterialID (value)

設置maxPointSize

getMaterial ()

@return pointColorType

toMaterialID(materialName)

toMaterialName(materialID)

zoomTo(node, factor)

getBoundingBox(pointclouds)

@return box

fitToScreen(factor = 1)

setTopView()

setFrontView()

setLeftView()

setRightView()

flipYZ()

updateHeightRange()

loadSettingsFromURL()

createControls()

toggleSidebar()

toggleMap()

loadGUI(callback)

setLanguage(lang)

initThree()

update(delta, timestamp)

loop(timestamp)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PotreeRenderer


 

@param viewer

方法

render()

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM