Skip to content

tagipedia/tmaps-web-sample

Repository files navigation

tmaps-web-sample

Usage

  1. if you need to put indoor map in your website
  2. if you need to assign tenants to map drawn features in website adminstration portal and save feature_id to tenant in your database so later you can send tenants json to mobile SDKs (https://github.com/tagipedia/tmaps-ios-sample#set-tenant-data) or (https://github.com/tagipedia/tmaps-android-sample#set-tenant-data)

Installation

To integrate TMaps into your Web project, add it to your project:

  1. Add <script src="CONTACT_US_FOR_SCRIPT"></script> to your project (Request script and map id from Tagipedia Team)
  2. Read our sample for examples

How it works

it works using dispatch actions between your APP and TMaps. So your APP dispatch actions to TMaps and TMaps dispatch actions to your APP.

Usage

TMaps actions dispatched to Your APP

dispatched when TMaps ready to receive dispatches from Your APP. in order to make easy integration with Web only we will not execute your dispatches until map get ready so feel free to dispatch any action before map get ready.

{
   "type": "READY"
};

dispatched when map loaded and visible to user.

{
   "type": "MAP_LOADED"
};

Features tapped

dispatched when features in map tapped.

{
   "type": "FEATURES_TAPPED",
   "features": features
};

    features
    Required Array with Object, each Object with id, properties keys


Associated feature tapped

dispatched when features in map tapped with the top feature visible to user.

{
   "type": "ASSOCIATED_FEATURE_TAPPED",
   "feature_id": feature_id,
   "feature": feature
};

    feature_id
    Required String with valid feature id

    feature
    Required Object with id, properties keys


Category marked

dispatched when select category in map

{
   "type": "CATEGORY_MARKED",
   "category": category
};

    category
    Required valid String category


Error

dispatched when error happened in TMaps

{
   "type": "ERROR",
   "error": error
};

    error
    Required Object with stack key and String value


Feature marked

dispatched after MARK_FEATURE ended

{
   "type": "FEATURE_MARKED",
   "feature_id": feature_id
};

    feature_id
    Required String with valid feature id


dispatched after HIGHLIGHT_FEATURE ended

{
   "type": "FEATURE_HIGHLIGHTED",
   "feature_id": feature_id
};

    feature_id
    Required String with valid feature id


dispatched after SET_ZOOM ended

{
   "type": "ZOOM_ENDED"
};

dispatched after SET_CENTER ended

{
   "type": "CENTER_ENDED"
};

dispatch it to set tenants of map.

{
   "type": "SET_TENANT_DATA",
   "payload": tenants_json
};

    payload
    Required Array with Object, each Object with id, feature_id, name, booth_id, icon, CUSTOM_KEYS_YOU_NEED keys


dispatch it to change default feature popup template.

{
   "type": "SET_DEFAULT_FEATURE_POPUP_TEMPLATE",
   "template": template,
   "template_custom_data": templateCustomData,
};

    template
    Required valid String angular template with PopupScope

    template_custom_data
    Optional Object with CUSTOM_KEYS_YOU_NEED keys and String, Number, Array, Object values
template custom data of keys that you want to use from customData in PopupScope


Set theme

dispatch it to change theme of map.

{
   "primary": primary_color,
   "accent": accent_color
};

    primary
    Optional valid String color

    accent
    Optional valid String color


Load map

dispatch it to load map.

{
   "type": "LOAD_MAP",
   "map_id": map_id,
   "theme": {
      "primary": primary_color,
      "accent": accent_color
   },
   "center": [lng, lat],
   "zoom": zoom
};

    map_id
    Required String

    theme
    Optional Object with primary, accent keys and valid String color values theme used for colors such as buttons and loading

    center
    Optional Array of Numbers Default map center in longitude and latitude

    zoom
    Optional Number Default zoom level


Change render mode

dispatch it to change render mode.

{
   "type": "CHANGE_RENDER_MODE",
   "modeToRender": modeToRender
}

    modeToRender     Required String with 2D, 3D


Set zoom

dispatch it to change zoom of map.

{
   "type": "SET_ZOOM",
   "zoom": zoom,
   "zoom_type": zoom_type,
}

    zoom     Required Number

    zoom_type     Optional String with FLY_TO


Set center

dispatch it to change center of map.

{
   "type": "SET_CENTER",
   "center": [lng, lat],
}

    center     Required Array of Numbers Default map center in longitude and latitude


dispatch it to highlight feature.

{
   "type": "HIGHLIGHT_FEATURE",
   "feature_id": feature_id
}

    feature_id     Required String with valid feature id


Mark feature

dispatch it to mark feature.

{
   "type": "MARK_FEATURE",
   "feature_id": feature_id
}

    feature_id     Required String with valid feature id

Types

poi

current feature

poi

    poi     Required poi


enableRouting

Boolean to check if routing is enabled

enableRouting

showRoutingDialog

method to show routing dialog.

showRoutingDialog($event, data)

    $event     Required $event

    data     Optional Object with from, to keys and poi value


applyIfneeded

method to call Angular $apply

applyIfneeded(callback)

    callback     Required Function


custom data object that have all keys of template_custom_data

customData[key]

    key     Required with valid key from template_custom_data


dispatch

method to dispatch action from your APP to TMaps.

dispatch(action)

    action     Required Object with valid action


method to dispatch action from TMaps to your APP.

dispatchToContainer(action)

    action     Required Object with type, CUSTOM_KEYS_YOU_NEED keys.
type is String value.
CUSTOM_KEYS_YOU_NEED is any of String, Number, Array, Object values.


closeInfo

method to close feature popup

closeInfo()

id

id of feature

poi.id

category

category of feature

poi.category

tags

tags of feature

poi.tags

getTenant

tenant of feature you set in SET_TENANT_DATA

poi.getTenant()

tenant name of feature you set in SET_TENANT_DATA

poi.getTenantName()

tenant icon of feature you set in SET_TENANT_DATA

poi.getTenantIcon()

tenant booth_id of feature you set in SET_TENANT_DATA

poi.getTenantBoothId()

getDisplayName

getTenantName or feature name

poi.getDisplayName()

hasName

check if tenant or feature have name.

poi.hasName()

isBuilding

check if feature is building.

poi.isBuilding()

getIcon

getTenantIcon or feature icon

poi.getIcon()

getBoothId

getTenantBoothId or feature booth id

poi.getBoothId()

Advanced Scenrios (Look at sample for implementation of scenrios)

Highlight initial feature

if you dispatch SET_ZOOM/SET_CENTER

you should dispatch HIGHLIGHT_FEATURE for initial feature after ZOOM_ENDED/CENTER_ENDED

if you don't dispatch SET_ZOOM/SET_CENTER

you should dispatch HIGHLIGHT_FEATURE for initial feature after MAP_LOADED

Add custom buttons inside feature popup template

you should dispatch SET_DEFAULT_FEATURE_POPUP_TEMPLATE for your customized template and add your custom buttons and use dispatchToContainer when button clicked to handle the click action in your APP.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published