GuidedTour

GuidedTour Widget class

Constructor

new GuidedTour(itownsView, tourConfig, mediaConfig)

It initializes the widget.

Parameters:
NameTypeDescription
itownsViewitowns.PlanarView

The itowns view.

tourConfigobject

The configuration of the widget

Properties
NameTypeDescription
namestring

Name of the GuidedTour

descriptionstring

Description of the GuidedTour

startIndexnumber

Index of the first step of the tour

endIndexnumber

Index of the last step of the tour

stepsArray.<Step>

Array of steps

mediaConfigArray.<Media>

All media of the tour

Example
Config Example
{
  "steps": [
    {
      "previous": 0,
      "next": 1,
      "layers": ["layer_1", "layer_2"],
      "media": [],
      "position": {"x": 10, "y": 20, "z": 30},
      "rotation": {"x": 0.5, "y": 0, "z": 0.24, "w": 0}
    },
    {
      "previous": 0,
      "next": 1,
      "layers": ["layer_3"],
      "media": ["media_1", "media_2"]
    }
  ],
 "name": "Example",
 "description": "This is an example of GuidedTour config",
 "startIndex": 0,
 "endIndex": 1
}

Classes

GuidedTour

Members

currentIndex :number

Index of the current step

Type:
  • number

description :string

Description of the GuidedTour

Type:
  • string

domElement :HTMLElement

Root html of GuidedTour view

Type:
  • HTMLElement

endIndex :number

Index of the last step of the GuidedTour

Type:
  • number

itownsView :module:itowns~PlanarView

Type:
  • module:itowns~PlanarView

mediaConfig :Array.<object>

Config of all media of the tour

Type:
  • Array.<object>

mediaContainer :HTMLElement

Html div containing media of the step

Type:
  • HTMLElement

name :string

Name of the GuidedTour

Type:
  • string

nextButton :HTMLElement

Button to go to next step

Type:
  • HTMLElement

previousButton :HTMLElement

Button to go to previous step

Type:
  • HTMLElement

startIndex :number

Index of the first step of the GuidedTour

Type:
  • number

steps :Array.<object>

Array of steps

Type:
  • Array.<object>

Methods

addMedia(mediaIds)

Add media in the media container

Parameters:
NameTypeDescription
mediaIdsArray.<string>

The list of media IDs

createMediaDiv(media) → {HTMLElement}

Creates a HTML element from a media config

Parameters:
NameTypeDescription
mediaMedia

The media config

Returns:

The media as a HTML element

Type: 
HTMLElement

dispose()

Dispose the DOM element

filterLayers(layerIds)

Filters layers, displaying only those whose ID appears in the list

Parameters:
NameTypeDescription
layerIdsArray.<string>

Array of layer IDs

getCurrentStep() → {Step}

Returns the current step of the tour

Returns:

The current step of the tour

Type: 
Step

getMediaById(mediaId) → {Media|null}

Returns the media config with the matching ID

Parameters:
NameTypeDescription
mediaIdstring

The ID of the media

Returns:

The media config

Type: 
Media | null

goToStep(index)

Go to the step corresponding to the index

Parameters:
NameTypeDescription
indexnumber

Index of the step

initHtml()

Creates the HTML of the GuidedTour

travelToPosition(position, rotation)

Travel to the targeted position and rotation

Parameters:
NameTypeDescription
positionobject

Target postion

rotationobject

Target rotation