@panoramax/web-viewer
Version:
Panoramax web viewer for geolocated pictures
115 lines (80 loc) • 4.85 kB
Markdown
<a name="Panoramax.utils.URLHandler"></a>
## Panoramax.utils.URLHandler
**Kind**: static class of <code>Panoramax.utils</code>
**Emits**: [<code>url-changed</code>](#Panoramax.utils.URLHandler+event_url-changed)
* [.URLHandler](#Panoramax.utils.URLHandler)
* [new URLHandler(parent)](#new_Panoramax.utils.URLHandler_new)
* [.listenToChanges()](#Panoramax.utils.URLHandler+listenToChanges)
* [.destroy()](#Panoramax.utils.URLHandler+destroy)
* [.nextURLParams()](#Panoramax.utils.URLHandler+nextURLParams) ⇒ <code>object</code>
* [.nextURLString()](#Panoramax.utils.URLHandler+nextURLString) ⇒ <code>string</code>
* [.currentURLParams([readFromHash])](#Panoramax.utils.URLHandler+currentURLParams) ⇒ <code>object</code>
* [.currentMapString()](#Panoramax.utils.URLHandler+currentMapString) ⇒ <code>string</code>
* [.currentPSVString()](#Panoramax.utils.URLHandler+currentPSVString) ⇒ <code>string</code>
* [.nextShortLink()](#Panoramax.utils.URLHandler+nextShortLink) ⇒ <code>str</code>
* [.getUnmanagedParameters(prevUrl)](#Panoramax.utils.URLHandler+getUnmanagedParameters)
* ["url-changed"](#Panoramax.utils.URLHandler+event_url-changed)
<a name="new_Panoramax.utils.URLHandler_new"></a>
### new URLHandler(parent)
Updates the URL query part with various parent component information.
Note that you may call `listenToChanges()` for this class to be effective once parent is ready-enough.
| Param | Type | Description |
| --- | --- | --- |
| parent | [<code>Basic</code>](../components/core/Basic.md/#Panoramax.components.core.Basic) | The parent component |
<a name="Panoramax.utils.URLHandler+listenToChanges"></a>
### urlHandler.listenToChanges()
Start listening to URL & parent changes through events.
This leads to parent & URL updates.
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
<a name="Panoramax.utils.URLHandler+destroy"></a>
### urlHandler.destroy()
Call this function to stop listening to global events.
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
<a name="Panoramax.utils.URLHandler+nextURLParams"></a>
### urlHandler.nextURLParams() ⇒ <code>object</code>
Compute next values to insert in URL
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
**Returns**: <code>object</code> - Query parameters
<a name="Panoramax.utils.URLHandler+nextURLString"></a>
### urlHandler.nextURLString() ⇒ <code>string</code>
Compute next URL query string (based on `nextURLParams()`)
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
**Returns**: <code>string</code> - The query string
<a name="Panoramax.utils.URLHandler+currentURLParams"></a>
### urlHandler.currentURLParams([readFromHash]) ⇒ <code>object</code>
Transforms current URL query string into key->value object
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
**Returns**: <code>object</code> - Key-value read from current URL query
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [readFromHash] | <code>boolean</code> | <code>false</code> | Switch to reading from hash URL part (for retro-compatibility) |
<a name="Panoramax.utils.URLHandler+currentMapString"></a>
### urlHandler.currentMapString() ⇒ <code>string</code>
Get string representation of map position
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
**Returns**: <code>string</code> - zoom/lat/lon or zoom/lat/lon/bearing/pitch
<a name="Panoramax.utils.URLHandler+currentPSVString"></a>
### urlHandler.currentPSVString() ⇒ <code>string</code>
Get PSV view position as string
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
**Returns**: <code>string</code> - x/y/z
<a name="Panoramax.utils.URLHandler+nextShortLink"></a>
### urlHandler.nextShortLink() ⇒ <code>str</code>
Get short link URL (query replaced by Base64)
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
**Returns**: <code>str</code> - The short link URL
<a name="Panoramax.utils.URLHandler+getUnmanagedParameters"></a>
### urlHandler.getUnmanagedParameters(prevUrl)
Returns a string containing only parameters out of URLHandler scope
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
| Param | Type | Description |
| --- | --- | --- |
| prevUrl | <code>URL</code> | The previously set URL |
<a name="Panoramax.utils.URLHandler+event_url-changed"></a>
### "url-changed"
URL changed event
**Kind**: event emitted by [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| detail.url | <code>string</code> | The new used URL |