Class: Venue

H.venues.Venue

new H.venues.Venue (venueModel)

The Venue class provides access to the venue information, including venue's drawings (buildings), levels, geometries and other data. It provides access and control of the information.

Name Type Description
venueModel Object

Venue model is wrapper for all venue related row data loaded from Venues API.

Extends

Members

H.venues.Venue.EVENTS string static

Venue events available on venue object

Properties:
Name Description
ACTIVE_VENUE_CHANGE

The event is triggered on venue change

DRAWING_CHANGE

The event is triggered on drawing change

LEVEL_CHANGE

The event is triggered on level interaction

GEOMETRY_HIGHLIGHT

The event is triggered on geometry highlight

Example
const venue = venuesProvider.getActiveVenue();

venue.addEventListener(H.venues.Venue.EVENTS.LEVEL_CHANGE, (event) => {
  console.log(event);
});

Methods

addEventListener (type, handler, opt_capture, opt_scope) inherited overrides

This method adds a listener for a specific event.

Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it.

Name Type Description
type string

The name of the event

handler function

An event handler function

opt_capture boolean optional

true indicates that the method should listen in the capture phase (bubble otherwise)

opt_scope Object optional

An object defining the scope for the handler function

addOnDisposeCallback (callback, opt_scope) inherited

This method adds a callback which is triggered when the EventTarget object is being disposed.

Name Type Description
callback function

The callback function.

opt_scope Object optional

An optional scope for the callback function

dispatchEvent (evt) inherited

This method dispatches an event on the EventTarget object.

Name Type Description
evt H.util.Event | string

An object representing the event or a string with the event name

dispose () inherited

This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

getActiveDrawing ()H.venues.Drawing

Get active Drawing object

Returns:
Type Description
H.venues.Drawing The active drawing object.

getActiveLevelIndex ()number

Get currently active level index of the venue

Returns:
Type Description
number The active level index of the venue.

getActiveLevels ()Array.<H.venues.Level>

Get array of active level objects

Returns:
Type Description
Array.<H.venues.Level> Array of active level objects.

getBoundingBox ()H.geo.Rect

Get bounding box of the venue

Returns:
Type Description
H.geo.Rect The venue bounds.

getCenter ()H.geo.Point

Get center point of the venue

Returns:
Type Description
H.geo.Point The venue center.

getData ()Object

Get the raw data model for the Venue

Returns:
Type Description
Object The row venue data model.

getDrawing (id)H.venues.Drawing

Get a drawing by id

Name Type Description
id number | string

The drawing id

Returns:
Type Description
H.venues.Drawing The corresponding drawing object.

getDrawings ()Array.<H.venues.Drawing>

Get all venue drawings

Returns:
Type Description
Array.<H.venues.Drawing> Array of venue's drawing objects.

getGeometries ()Array.<H.venues.Geometry>

Get all venue geometries from all venue levels

Returns:
Type Description
Array.<H.venues.Geometry> Array of venue's geometry objects.

getGeometry (id)H.venues.Geometry

Get a venue geometry by its. Will search through all venue geometries

Name Type Description
id number | string

The geometry id

Returns:
Type Description
H.venues.Geometry The corresponding geometry object.

getHighlightedGeometries ()Array.<H.venues.Geometry>

Get currently highlighted geometries

Returns:
Type Description
Array.<H.venues.Geometry> Array of currently highlighted geometries.

getId ()number Deprecated : since 3.1.34.2

Get id of the venue

Returns:
Type Description
number The venue id.

getIdentifier ()string

Get id of the venue in string format

Returns:
Type Description
string The venue id.

getLevel (id)H.venues.Level Deprecated : since 3.1.34.2

Get a venue level by its id. Will search through all venue drawings

Name Type Description
id number | string

The level id

Returns:
Type Description
H.venues.Level The corresponding level object.

getLevels ()Array.<H.venues.Level>

Get all venue levels across all drawings

Returns:
Type Description
Array.<H.venues.Level> Array of venue's level objects.

getMapObjects (levelIndex, drawing)Array.<H.map.Object>

Get map objects associated with the venue

Name Type Description
levelIndex number

The level index of the objects

drawing H.venues.Drawing

The drawing of the objects

Returns:
Type Description
Array.<H.map.Object> The associated map objects.

getName ()string

Get name of the venue

Returns:
Type Description
string The venue name.

isActive ()boolean

The method indicates whether the venue is currently active.

Returns:
Type Description
boolean The active state of the venue

removeEventListener (type, handler, opt_capture, opt_scope) inherited overrides

This method removes a previously added listener from the EventTarget instance.

Name Type Description
type string

The name of the event

handler function

A previously added event handler

opt_capture boolean optional

true indicates that the method should listen in the capture phase (bubble otherwise)

opt_scope Object optional

An object defining the scope for the handler function

This method performs a search within venue data which is already loaded. The search will be performed on geometry data where names and address are taken into account

Name Type Description
query string

Value to search for

Returns:
Type Description
Array.<H.venues.Geometry> Array of resulting geometry objects
Example
const venue = venuesProvider.getActiveVenue();
venue.search('Bathroom');

setActiveDrawing (drawingId)

Set the active drawing. Will also dispatch DRAWING_CHANGE event

Name Type Description
drawingId number

The drawing id

setActiveLevelIndex (levelIndex)

Set active level index for the venue. It will also dispatch LEVEL_CHANGE event

Name Type Description
levelIndex number

The level index

setHighlightedGeometries (highlight, geometries, opt_style, opt_exclusive)

Set geometry highlight state and style to apply

Name Type Default Description
highlight boolean true

The highlight state. If true geometry will be highlighted

geometries Array.<H.venues.Geometry>

Array of geometries to highlight

opt_style Object

The style to apply

Name Type Description
fillColor string

The fill color

outlineColor string

The outline color

outlineWidth number

The outline width

opt_exclusive boolean

A flag indicating whether the highlighting must be mutual exclusive or not. Default is false.

setMapObjects (mapObjects, levelIndex, drawing)

Associate map objects with a venue level & drawing. Visibility of the objects will update automatically based on active level & drawing. Previously associated objects need to be changed manually.

Name Type Description
mapObjects Array.<H.map.Object>

The map objects to associate

levelIndex number

The level to associate the objects with

drawing H.venues.Drawing

The drawing to associate the objects with