Cave View - Reference - v2 API
The following objects and methods are stable. Any other functions may change without warning.
The v2 API allows muliple independent viewers to be created and destroyed dynamically at run time.
CaveView Object
Constructor
CV2.CaveViewer( <id>, <configuration Object> )
Initialise CaveView with no user interface other than mouse controls - a blank screen is displayed.
Parameters
- id
- stringThe id property of the HTML element where the model will be displayed.
- configuration Object
- ObjectAn Javascript object defined below.
Methods
addOverlay( <id>, <overlay provider> )
Parameters
loadCave( <filename>, <section> )
Load a single model.
Parameters
- filename
- stringThe filename of the model to be loaded from the survey directory (specified by the configuration object).
- section
- stringThe section name of the survey to be displayed (optional).
loadCaves( <array> )
Display multiple models together. All files must be of the same type and CRS.
Parameters
- array
- Arrayan array of filenames of models to be displayed.
dispose()
Free used memory including GPU and Javascript heap allocations.
CaveViewUI Object
Contructor
CV2.CaveViewUI( <viewer> )
Create a new viewer - a blank screen is displayed.
Parameters
- viewer
- ObjectA CaveViewer object.
Methods
loadCave( <filename>, <section> )
Load a single model.
Parameters
- filename
- stringThe filename of the model to be loaded from the survey directory (specified by the configuration object).
- section
- stringThe section name of the survey to be displayed (optional).
loadCaveList( <array> )
The user interface displays a list of models to display, the first model is by default.
Parameters
- array
- Arrayan array of filenames of models to be displayed. The first file specified will be displayed initially.
loadCaves( <array> )
Display multiple models together. All files must be of the same type and CRS.
Parameters
- array
- Arrayan array of filenames of models to be displayed.
.clearView()
Clear the view.
dispose()
Free used memory including GPU and Javascript heap allocations.
API Objects
configuration Object
The configuration object defines the location of the resources required to display models and the initial view.
Properties
- avenControls
- booleanUse Aven style mouse and keyboard controls (true) or original mode default: true. (optional).
- cesiumAccessToken
- stringCesium access token required to use Cesium terrain mesh tiles
- home
- string The path to the installtion of the CaveView package.
- language
- string The suffix of a UI translation file to load (CaveView/lib/lang-language.json).
- loadMetadata
- booleanAttempt to load optional JSON metadata file default: false. (optional).
- showEditPage
- booleanDisplay the metadata edit page default: false]. (optional).
- surveyDirectory
- stringThe path of the directory containing the survey model(s) to be displayed.
- terrainDirectory
- stringThe path of the directory containing terrain tiles (optional).
- theme
- ObjectAn object, that allows the display colour scheme to be changed. See annotated default setttings here.
- useGPS
- booleanExperimental feature to provide an AR style view default: false. (optional).
- view
- ObjectAn object, the properties of which determine the view settings applied to all models when loaded (optional).
view Object
Properties
- autoRotate
- booleanauto rotation of model default: false
- box
- booleanvisibility of model bounding box default: true
- cameraType
- enummerationThe projection type for the display:
- CV2.CAMERA_ORTHOGRAPHIC
- Orthographic projection of model.
- CV2.CAMERA_PERSPECTIVE
- Perspective projection of model.
- CV2.CAMERA_ANAGLYPH
- Anaglyph (red/cyan) display of model.
- entrances
- booleanvisibility of entrance names default: true
- HUD
- booleanvisibility of head up display (HUD) indicatiors default: true
- scraps
- booleanvisibility of scrap modeled passages (.lox models only) default: false
- shadingMode
- enummerationshading of underground model components:
- CV2.SHADING_HEIGHT
- shading by height above dataum
- CV2.SHADING_INCLINATION
- shading by leg inclination
- CV2.SHADING_LENGTH
- shading by leg length
- CV2.SHADING_SURVEY
- shading by section of survey
- CV2.SHADING_SINGLE
- all components shown as white
- CV2.SHADING_DEPTH
- shading by depth below surface (requires terrain)
- splays
- booleanvisibility of splay legs default: false
- stations
- booleanvisibility of station markers default: false
- stationLabels
- booleanvisibility of station names default: false
- surface
- booleanvisibility of surface legs default: false
- terrain
- booleanvisibility of terrain (if available) default: false
- terrainOpacity
- floatThe opacity of the terrain between 0 (fully transparent) and 1 (opaque) default: 0.5
- terrainShading
- enummeration or stringshading appplied to the terrain surface:
- CV2.SHADING_RELIEF
- Hypsometric shading (default).
- CV2.SHADING_CONTOURS
- The terrain is contoured in 10m intervals (interval and colours are themable).
- CV2.SHADING_OVERLAY
- Overlay provided in a .lox model*.
- overlay name
- string identifying an overlay by name (Survex only).
*Therion .lox models may contain an overlay image. If a external terrain is provided for a Survex .3d model, image tiles from a 'slippy map' tile server may be used.
- terrainDirectionalLighting
- booleanApply directional lighting default: true
- view
- enummerationthe initial viewpoint:
- CV2.VIEW_PLAN
- A plan view of the complete model. The default view.
- CV2.VIEW_ELEVATION_N
- An elevation view from the North*.
- CV2.VIEW_ELEVATION_S
- An elevation from the South*.
- CV2.VIEW_ELEVATION_E
- An elevation from the East*.
- CV2.VIEW_ELEVATION_W
- An elevation from the West*.
* Assuming the positive y axis is North and the positive x axis is East.
- walls
- booleanvisibility of basic cross section messurement (LRUD) based passage walls default: false