PanoramaViewer

PanoramaViewer

longdo.PanoramaViewer

Constructor

new PanoramaViewer(option)

API main class to control behavior and appearance of panorama view.
Parameters:
Name Type Description
option Object Panorama view options.

Methods

blue(Blue) → {float|self}

Adjust blue tone of an image
Parameters:
Name Type Description
Blue float value (default: 1)
Returns:
  • Type:
    float
    Current blue tone value if a parameter is not set.
  • Type:
    self

brightness(brightness) → {self}

Adjust brightness of panorama images
Parameters:
Name Type Description
brightness float 1 = default, >1 higher brightness
Returns:
Type:
self

buildPopup(buildPopupFn) → {self}

When a user right-click on panorama view, by default API will create a popup which show basic information about a current scene. These popup can be customized by providing a function that return HTML element that will replace API default HTML element. Parameter for the function are {mouse x, mouse y}, {lat, lon}, azimuth, tilt, u and v.
Parameters:
Name Type Description
buildPopupFn function Function that return HTML element which will be used as a popup when a user right-click on panorama view.
Returns:
  • Current popup creation function if a parameter is not set.
  • Type:
    self

clear()

Remove a panorama image from a scene.

clearMeasurement() → {self}

Remove all measurement related pin (points, lines and polygons) from panorama view.
Returns:
Type:
self

color(color) → {self}

Colorize panorama images
Parameters:
Name Type Description
color Array.<float> Array of float represent each color red, green and blue respectively. (default [1.0, 1.0, 1.0])
Returns:
Type:
self

continueSeek(cSeek) → {boolean|self}

By default, API will not allow moving forward or backward across paths. Seeking operation will stop at start point or end point. A user has to manually jump to new location by clicking at specific location or using a human dropping tool. This method will override this behavior and allow jumping from current path to another path.
Parameters:
Name Type Description
cSeek boolean Whether to allow jumping across paths.
Returns:
  • Type:
    boolean
    Current status if a parameter is not set.
  • Type:
    self

currentLocationMarker() → {Object}

Change a current location marker on Longdo Map. A default current location marker is an orange circle with direction indicator which will be added to the map automatically if the map is present.
Returns:
Type:
Object

destroy()

Destroy panorama scene. This will remove all overlay from a map (if exist) and remove itself from DOM.

downloadScreenshot()

Download a screenshot as aPNG file.

drawDirectionArrow(isDraw) → {boolean|self}

By default, API will draw two arrows on the scene to indicate front and back direction from origin shooting point.
Parameters:
Name Type Description
isDraw boolean Whether to draw direction indicators on panorama scene.
Returns:
  • Type:
    boolean
    Current status if a parameter is not set.
  • Type:
    self

elementToWKT(element) → {String}

Convert element of API (Pin, Line and Shape) to Well Known Text (KWT)
Parameters:
Name Type Description
element Object Pin, Line or Shape that will be converted to WKT
Returns:
Type:
String
WKT

filter(_filter) → {boolean|self}

A panorama API can force an image server to return only images from specific road names that matches with this filter string.
Parameters:
Name Type Description
_filter string String filter, for example given filter 'Longdo'. All road that meet the condition '*Longdo*' will be possible search space.
Returns:
  • Type:
    boolean
    Current filter string if a parameter is not set.
  • Type:
    self

fullscreen(fullscreen) → {boolean|self}

Enter/leave fullscreen mode
Parameters:
Name Type Description
fullscreen boolean Show panorama view in fullscreen.
Returns:
  • Type:
    boolean
    Current status if a parameter is not set.
  • Type:
    self

getAllLine() → {Array.<longdo.PanoramaViewer.Line>}

Get all lines inside panorama view. (longdo.PanoramaViewer.Line)
Returns:
Type:
Array.<longdo.PanoramaViewer.Line>
All pins inside panorama view.

getAllPin() → {Array.<longdo.PanoramaViewer.Pin>}

Get all pins inside panorama view. (longdo.PanoramaViewer.Pin)
Returns:
Type:
Array.<longdo.PanoramaViewer.Pin>
All pins inside panorama view.

getAllShape()

Return all shapes.

getCameraRotation() → {Object}

Return camera yaw, pitch, roll
Returns:
Type:
Object
Return yaw, pitch and roll of a camera at current position.

getFrameNo() → {string}

Return current frame number
Returns:
Type:
string
Current frame number

getRelativeHead() → {float}

Get current relative head value. Not to be confused with head() which return absolute head (Azimuth).
Returns:
Type:
float
Current relative head.

getRoadCode() → {string}

Return current road code
Returns:
Type:
string
Current road code

getScreenshot(isDownload)

Get a screenshot image data URL or download it as an PNG file.
Parameters:
Name Type Description
isDownload boolean set this to true to download an image file, otherwise image data URL will be via API callback's onScreenshot(). Setting this to true is identical with calling downloadScreenshot()

getServerRoadLayer() → {Object}

In panorama view option, there is an option to add a road path layer. This method will return that layer if it was set.
Returns:
Type:
Object
Longao Map layer

getTotalLength() → {Number}

Get total length of all panorama image paths.
Returns:
Type:
Number
Total length

green(Green) → {float|self}

Adjust green tone of an image
Parameters:
Name Type Description
Green float value (default: 1)
Returns:
  • Type:
    float
    Current green tone value if a parameter is not set.
  • Type:
    self

hasCameraParameter() → {boolean}

Return whether the scene has proper camera parameters (yaw, pitch, row).
Returns:
Type:
boolean
Camera has all necessary parameter to render components accurately.

hd(_hd) → {self}

Enable/disable HD mode, HD mode will force client API to request for HD images from a server.
Parameters:
Name Type Description
_hd boolean Whether API should request for HD images from a server.
Returns:
  • Current status if a parameter is not set.
  • Type:
    self
Adjust camera view point along horizontal line.
Parameters:
Name Type Description
degree float An angle in degree, 0 degree = front, 90 = right, -90 = left.
Returns:
  • Type:
    float
    Current absolute head (Azimuth) in degree if a parameter is not set.
  • Type:
    self

headToLeft(degree) → {self}

Move camera view point to the left along with horizontal line. This is identical with calling head().
Parameters:
Name Type Description
degree float An angle in degree, 10 degree = look more to the left by 10 degree.
Returns:
Type:
self

headToRight(degree) → {self}

Move camera view point to the right along with horizontal line. This is identical with calling head().
Parameters:
Name Type Description
degree float An angle in degree, 10 degree = look more to the right by 10 degree.
Returns:
Type:
self

hidePath() → {self}

Remove all panorama related markers (Marker and Line) from Longdo Map.
Returns:
Type:
self

hidePopup() → {self}

Remove right-click popup from screen
Returns:
Type:
self

imageHDURL(url) → {String|self}

Get/set web service url for downloading panorama HD images.
Parameters:
Name Type Description
url String URL of web service for downloading panorama HD images.
Returns:
  • Type:
    String
    Current url of web service for downloading panorama HD images if a parameter is not set.
  • Type:
    self

imageURL(url) → {String|self}

Get/set web service url for downloading panorama images.
Parameters:
Name Type Description
url String URL of web service for downloading panorama images.
Returns:
  • Type:
    String
    Current url of web service for downloading panorama images if a parameter is not set.
  • Type:
    self

isSphere()

Return whether client is in Sphere image mode or cube image mode.

isStarted() → {boolean}

When initialize API with option 'autoStart' = false, API will not start rendering automatically. This method will tell whether API has already started.
Returns:
Type:
boolean
True if API has already started rendering, False otherwise.

keepRender(render) → {boolean|self}

Force API to keep rendering the scene. (NOT RECOMMEND! Forcing API to render all the time will consume a lot of resource and power)
Parameters:
Name Type Description
render boolean Whether API should be rendering all the time.
Returns:
  • Type:
    boolean
    Current status if a parameter is not set.
  • Type:
    self

laser(isSupportLaser) → {boolean|self}

Enable/disable working with laser point cloud data. In order to work with laser data, image server must also support laser as well. Usually, this option should not be set manually. If image server support laser, it will communicate and config setting of client API automatically.
Parameters:
Name Type Description
isSupportLaser boolean Whether to work with laser data
Returns:
  • Type:
    boolean
    Current status if a parameter is not set.
  • Type:
    self

location(location, limit) → {Object|self}

Move panorama view to specific location
Parameters:
Name Type Description
location Object The target location to move to.
limit float A Limit range of expansion from given location if there is no panorama image available at the exact location.
Returns:
  • Type:
    Object
    Current location of panorama view if a parameter is not set.
  • Type:
    self

lockView(degree) → {self}

Lock view point to cube face (6 faces FRONT, BACK, LEFT, RIGHT, TOP and BOTTOM). After calling this method, view point will be set to the closest face from cube faces.
Parameters:
Name Type Description
degree float An angle in degree, 10 degree = look more toward the sky by 10 degree
Returns:
Type:
self

lookAt(location) → {self}

Change panorama view point to (look at) a specific location.
Parameters:
Name Type Description
location Object Location object.
Returns:
Type:
self

measureLineVerticalAngle(isEnable) → {self}

Whether to show an aiming line during line measurement with z angle displayed on scene.
Parameters:
Name Type Description
isEnable boolean
Returns:
Type:
self

measurementVersion(version) → {number|self}

Get or set measurement algorithm version.
Parameters:
Name Type Description
version number New measurement version.
Returns:
  • Type:
    number
    Current status if a parameter is not set.
  • Type:
    self

mode(mode) → {integer|self}

Change mode, panorama view working mode should be one of these longdo.PanoramaViewer.MODE_XXX
Parameters:
Name Type Description
mode integer A new mode
Returns:
  • Type:
    integer
    Current mode if a parameter is not set.
  • Type:
    self

moveMap(moveMapAlong) → {boolean|self}

Set whether to move a map along with panorama view.
Parameters:
Name Type Description
moveMapAlong boolean Move a map in-sync with panorama view.
Returns:
  • Type:
    boolean
    Current status if a parameter is not set.
  • Type:
    self

noCache(_noCache) → {boolean|self}

By default, API will cache images from server. All image with the same road code and frame number will only be download once. This method can disable this behavior. (NOT RECOMMEND, unless you know what you are doing)
Parameters:
Name Type Description
_noCache boolean Whether API should cache images from a server.
Returns:
  • Type:
    boolean
    Current status if a parameter is not set.
  • Type:
    self

paths()

Panorama image paths

placeholder() → {DOM}

Get current placeholder.
Returns:
Type:
DOM
Current placeholder.

play(play) → {boolean|self}

Play/Pause video
Parameters:
Name Type Description
play boolean True to play, false to pause
Returns:
  • Type:
    boolean
    Current playing status if a parameter is not set
  • Type:
    self

playSpeed(speed) → {boolean|self}

Set video playing speed
Parameters:
Name Type Description
speed integer Frame per second of video (fps). Minimum 1 fps and maximum 10 fps.
Returns:
  • Type:
    boolean
    Current playing speed if a parameter is not set
  • Type:
    self

pushLine(line) → {self}

Add a new line to panorama view.
Parameters:
Name Type Description
line longdo.PanoramaViewer.Line A new line to be added. Only a valid line can be added to panorama view (longdo.PanoramaViewer.Line)
Returns:
Type:
self

pushPin(pin) → {self}

Add a new pin to panorama view.
Parameters:
Name Type Description
pin longdo.PanoramaViewer.Pin A new pin to be added. Only a valid pin can be added to panorama view (longdo.PanoramaViewer.Pin)
Returns:
Type:
self

pushShape(line) → {self}

Add a new shape (polygon) to panorama view.
Parameters:
Name Type Description
line longdo.PanoramaViewer.Shape A new shape to be added. Only a valid shape can be added to panorama view (longdo.PanoramaViewer.Shape)
Returns:
Type:
self

red(Red) → {float|self}

Adjust red tone of an image
Parameters:
Name Type Description
Red float value (default: 1)
Returns:
  • Type:
    float
    Current red tone value if a parameter is not set.
  • Type:
    self

removeLine(line) → {self}

Remove a given line from panorama view.
Parameters:
Name Type Description
line longdo.PanoramaViewer.Line A target line to be removed from panorama view.
Returns:
Type:
self

removePin(pin) → {self}

Remove a given pin from panorama view.
Parameters:
Name Type Description
pin longdo.PanoramaViewer.Pin A target pin to be removed from panorama view.
Returns:
Type:
self

removeShape(pin) → {self}

Remove a given shape (polygon) from panorama view.
Parameters:
Name Type Description
pin longdo.PanoramaViewer.Shape A target shape to be removed from panorama view.
Returns:
Type:
self

render() → {self}

Force API to render the scene for 1.5 second
Returns:
Type:
self

resetZoom() → {self}

Reset zoom level to default level. This is identical with zoom(60)
Returns:
Type:
self

resize() → {self}

This function should be called whenever size of panorama view is changed, for example user resize browser window size.
Returns:
Type:
self

roadPathURL(url) → {String|self}

Get/set web service url for downloading road paths data.
Parameters:
Name Type Description
url String URL of web service for fetching road paths information
Returns:
  • Type:
    String
    Current url of web service for fetching road path if a parameter is not set.
  • Type:
    self

seek(meter, allowSeekFromPoint) → {self}

Move forward or backward from current location by given meter
Parameters:
Name Type Description
meter float Meter(s) from current location to move to
allowSeekFromPoint boolean Enable/disable seeking if user is at a point not a line
Returns:
Type:
self

seekByFrame(roadCode, frameno) → {self}

Move to specific road and frame no
Parameters:
Name Type Description
roadCode string Target rode code
frameno int Target frame no
Returns:
Type:
self

setImage(imageObject)

Manually set image on panorama scene. The image will be applied only in client side. After seeking or refreshing, it will be remove from panorama scene. This method is suppose to be used for testing purpose.
Parameters:
Name Type Description
imageObject Image

setMessage(message)

Set message on panorama message box, set empty string to hide.
Parameters:
Name Type Description
message String

showCrosshair(show) → {self}

Show/hide red crosshair at the middle of screen
Parameters:
Name Type Description
show boolean Whether to show crosshair or not.
Returns:
Type:
self

showPath() → {Array.<Longdo.Marker>|boolean}

Redraw panorama image paths on Longdo Map.
Returns:

start(Location) → {Object}

Start rendering panorama image. This option should only be called when 'autoStart' option is set to false. Otherwise it will not have any effect.
Parameters:
Name Type Description
Location Object object pointing to start point
Returns:
Type:
Object
self

tilt(degree) → {float|self}

Adjust camera view point along vertical line.
Parameters:
Name Type Description
degree float An angle in degree, 0 degree = straight front, 90 = look at the ground, -90 = look at the sky.
Returns:
  • Type:
    float
    degree Current tilt level if a parameter is not set.
  • Type:
    self

tiltToBottom(degree) → {float|self}

Adjust camera view point along vertical line. This is identical with calling tilt().
Parameters:
Name Type Description
degree float An angle in degree, 10 degree = look more toward the sky by 10 degree
Returns:
  • Type:
    float
    degree Current tilt level if a parameter is not set.
  • Type:
    self

tiltToTop(degree) → {float|self}

Adjust camera view point along vertical line. This is identical with calling tilt().
Parameters:
Name Type Description
degree float An angle in degree, 10 degree = look more toward the ground by 10 degree.
Returns:
  • Type:
    float
    degree Current tilt level if a parameter is not set.
  • Type:
    self

translate()

Apply translation to a sphere object. In normal usage, this method is unlikely to be used.

viewDistance(newViewDistance) → {Object|self}

Adjust view distance, all pins inside view distance (circle radius) will be rendered and visible to a user. all pins outside view distance will not be rendered thus invisible to a user.
Parameters:
Name Type Description
newViewDistance float Target view distance (meter).
Returns:
  • Type:
    Object
    Current view distance if a parameter is not set.
  • Type:
    self

zoom(zoom) → {float|self}

Zoom in or out
Parameters:
Name Type Description
zoom float human natural perspective = 60, max zoom out = 90, max zoom in = 20
Returns:
  • Type:
    float
    Zoom level if a parameter is not set.
  • Type:
    self

zoomIn() → {self}

Zoom in by 5 degree.
Returns:
Type:
self

zoomOut() → {self}

Zoom out by 5 degree.
Returns:
Type:
self