Javascript

Below is a small example to get you started. For a more in depth example, go to : https://www.cyclomedia.com

Example
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.0/react.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.0/react-dom.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.17.1/ol.js"></script>
<script type="text/javascript" src="http://streetsmart.cyclomedia.com/api/v16.1/Aperture.js"></script>
<script type="text/javascript" src="http://streetsmart.cyclomedia.com/api/v16.1/StreetSmartApi.js"></script>
<script>
   // Here you can now call StreetSmartApi.init(), StreetSmartApi.addPanoramaViewer(),
   // or use event contents like this: StreetSmartApi.Events.panoramaViewer.RECORDING_LOADED
</script>

Api

All StreetSmartApi React components must be rendered within this component.

<Api />

Extends React.Component

Example

React Example:

// In your react components render function
render() {
    return (
        <Api>
            {
                // ...add all your Street Smart Components in here
            }
        </Api>
    );
}

Javascript Example:

//Not Applicable, you must use StreetSmartApi.addPanoramaViewer()

PanoramaViewer

PanoramaViewer React Component.

<PanoramaViewer />

Extends React.Component

Example

React Example:

// In your react components render function
render() {
    // notice that to get the proper instance, you need to use the prop "viewerRef" instead of "ref"
    return (
        <Api>
            <PanoramaViewer viewerRef={(instance) => this.panoramaViewer = instance} />
        </Api>
    );
}

Javascript Example:

//Not applicable, You must use StreetSmartApi.addPanoramaViewer().
Static Members
propTypes
Instance Members
getNavbarExpanded()
getNavbarVisible()
getOrientation()
getRecording()
getRecordingsVisible()
getTimeTravelExpanded()
getTimeTravelVisible()
getViewerColor()
lookAtCoordinate(coordinate, [srs])
off(type, callback)
on(type, callback)
openByAddress(query, [srs])
openByCoordinate(coordinate, [srs])
openByImageId(imageId, [srs])
rotateDown(deltaPitch)
rotateLeft(deltaYaw)
rotateRight(deltaYaw)
rotateUp(deltaPitch)
setOrientation(orientation)
toggleNavbarExpanded([expanded])
toggleNavbarVisible([visible])
toggleRecordingsVisible([visible])
toggleTimeTravelExpanded([expanded])
toggleTimeTravelVisible([visible])
zoomIn()
zoomOut()

addPanoramaViewer

Adds a PanoramaViewer to a specified DOM-element.

Parameters
domElement (element) DOM-element the PanoramaViewer gets rendered to.
panoramaViewerOptions ([Object](default {})) Options to initialize the panorama viewer with
Name Description
panoramaViewerOptions.recordingsVisible Boolean If recordings should be visible
panoramaViewerOptions.timeTravelVisible Boolean If time travel is enabled
panoramaViewerOptions.navbarVisible Boolean If nav bar is enabled
Returns
PanoramaViewer : Returns reference to the PanoramaViewer.
Example

Add a panoramaViewer to a DOM element.

<div id="panoramaTarget"/>

// Add a PanoramaViewer to the above div. Set variable as reference.
let panoramaViewer = StreetSmartApi.addPanoramaViewer(document.getElementById('panoramaTarget'), panoramaViewerId);

destroyPanoramaViewer

Destroys panorama viewer

Parameters
panoramaViewer (Any) instance of the PanoramaViewer you want to destroy.
domElement (Any) Element of the DOM in which the PanoramaViewer was rendered.

getAPIReadyState

Returns the current 'ready'-state of the API.

Returns
Boolean : 'ready'-state.

getAddressSettings

Returns the object containing the address search settings.

Returns
{locale: (string), database: (string)} : Object containing the address settings.

getApplicationName

Returns the application name of the API.

Returns
string : Application name.

getApplicationVersion

Returns the used version of the API.

Returns
string : API version number.

getPermissions

Returns the object containing functionalities that are currently permitted to use by the user.

Returns
Array : Array containing the permissions.

init

Initializes the API using the inserted values. Required to use functional PanoramaViewers.

Parameters
options (Object) Object containing the options used for initializing the API.
Name Description
options.username [string] Username of the user.
options.password [string] Password of the user.
options.tid [string] Password of the user.
options.apiKey string apiKey given to the user.
options.srs string Coordinate system used in the API. E.g. "EPSG:29882".
options.locale [string] (default 'en-US') Language used as default in the API.
options.configurationUrl [string] Alternate configuration url to use for all configuration services
options.addressSettings [{locale: string, database: string}] The address settings to use for address searches.
locale - The locale to use. e.g. 'nl'.
database - The name of the database. e.g. 'CMDatabase'.
Returns
Promise : Returns a new promise for the result that may be used to chain additional functions.
Example

Initializing a StreetSmartApi.

<script type="text/javascript" src="src/StreetSamrtApi.js"></script>

// Set variables for initialisation.
let options = {
     username: "username",
     password: "password",
     srs: "EPSG:29882",
     apiKey: "XXXX-XXXX-XXXX-XXXX",
     locale: "en-US",
     addressSettings: {
         locale: "nl",
         database: "CMDatabase"
     }
};

// Initalize
StreetSmartApi.init(options).then( successCallback, errorCallback);

Events

Object which contains event type constants for all components.

Static Members
panoramaViewer

Coordinate

Coordinate definition

Parameters
$0 (number) X value of the coordinate
$1 (number) Y value of the coordinate
$2 ([number]) Z value of the coordinate

RGBA

Array of length four with four elements. r, g, b, a, respectively.

Properties
$0 (number) : Value of Red in rgba, between 0 and 255
$1 (number) : Value of Green in rgba, between 0 and 255
$2 (number) : Value of Blue in rgba, between 0 and 255
$3 (number) : Value of Alpha in rgba, between 0 and 1

getDebugLogs

Returns all logs, including ones invisible to integrators.

Returns
Array<string> : Array of console logs