Multiviewer API
General information
Hexagon Multiviewer is the general technology platform and a basis to serve Hexagon specific solutions such as Panoramic Viewer (PV), Oblique Viewer (OV), Virtual Inspection (VI), Thermal Inspection (TI) and Site Inspection (SI)
Hexagon Multiviewer (MV) supports several ways of interaction and stage initialization:
- URL parameters
- MV Message hub which is available by a HTTPS end-point
The main idea is – that you can open MV with URL parameters for stage initializing and configuration:
https://mv.services.hxgncontent.com?u=***&p=***&project=***
and continue using the app. If you want to interact with instances of MV, that is already running in your web browser, you can open MV with parameter msid:
https://mv.services.hxgncontent.com?msid=GUID&u=***&p=***&project=***
and use the GUID as a token for interaction with running instances of MV through the “message hub”.
URL parameters
* - You must handle spaces in name (white space, '+' or '%20') – see example 1.
** - For the moment following SRDI are supported: 4326, 3857, 25832, 3009
Examples:
Example 1: Open the project 'MVDEMO DDG Multiple years', enter URL:
https://mv.services.hxgncontent.com?u=cmvdemo&p=cmvdemo&origin=desktop&project=CMVDEMO DDG Multiple years
or
https://mv.services.hxgncontent.com?u=cmvdemo&p=cmvdemo&origin=desktop&project=CMVDEMO+DDG+Multiple+years
or
https://mv.services.hxgncontent.com?u=cmvdemo&p=cmvdemo&origin=desktop&project=CMVDEMO%20DDG%20Multiple%20years
Example 2: The project 'CMVDEMO DDG Multiple years' includes four different covermaps and DDG 2015 and DDG 2016 for Ballerup Kommune. To open nearest image to x=711050,y=6181170 and centered in the position with covermap DDO 2014 overlayed by image point for DDG 2016, enter URL:
https://mv.services.hxgncontent.com?u=cmvdemo&p=cmvdemo&origin=desktop&project=CMVDEMO+DDG+Multiple+years&vLayers=DDG2016+Ballerup+Kommune;DDO2014&hLayers=DDG2015+Ballerup&x=711050&y=6181170&srid=25832&assLayers=DDG2016+Ballerup+Kommune&dssLayers=DDG2015+Ballerup&maximize=DDG2016+Ballerup+Kommune
Integration with CAD/GIS
For integration with CAD/GIS system, you can use a combination of the URL parameters + “message hub”
Step #1 - unique ID generation
C#:
string msid = Guid.NewGuid().ToString();
Step #2 - put msid into url-parameters and run new instance of MV in browser
C#:
string msid = Guid.NewGuid().ToString(); string initUrlDemo = String.Format( @"https://mv.services.hxgncontent.com/?msid={0}&u={1}&p={2}&origin=desktop&cmd=state&project={3}&vlayers={4} &x={5}&y={6}&srid={7}&maximize={8}&hlayers={9}&dssLayers={10}&assLayers={11}&ssTrigger={12}", msid, UserName, Password, Project, vLayers, X, Y, Srid, Maximize, hLayers, dssLayers, assLayers, ssTrigger ); System.Diagnostics.Process.Start("chrome", initUrlDemo);
Step #3 - push message to the “message hub”
C#:
JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); string messageStr = jsSerializer.Serialize( new { Cmd = "state", Project, vLayers, hLayers, Maximize, X, Y, Srid, dssLayers, assLayers, ssTrigger } ); string data = String.Format(@"token={0}&origin=desktop&isjson=true&messageText={1}", msid, messageStr); string uri = String.Format(@"https://mv.services.hxgncontent.com/Messageshab/PutMessage", cmvUrl); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.KeepAlive = false; request.ProtocolVersion = HttpVersion.Version10; request.Method = "POST"; byte[] postBytes = Encoding.ASCII.GetBytes(data); request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postBytes.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(postBytes, 0, postBytes.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // inform somehow user
Step #4 - in 1-2 seconds, MV instance, that was started with msid, pulled messages out of the hub and updated the viewer's stage
How to integrate MV in third-party web-site
IFRAME
Using <IFRAME> tags is one of the possible ways to integrate the MV into a third-party web-site. There are two ways how allow third-party web-site to show the MV through <IFRAME>:
- Add rights for a specific account by using rule Services:MV.IFRAME.ALLOW.https://thirdparty.com (requires agreement with Hexagon)
- Add third-party web-site to MV web.config file in variable IframeAllowedHosts (use ';' as delimiter between ones)
There are two pages which can be specify in attribute “srs” of the <IFRAME> tag:
- https://mv.services.hxgncontent.com?u=USERNAME&p=PASSWORD… (user management rule or web.config )
- https://mv.services.hxgncontent.com/Login (only web.config)
To integrate MV into third-party web-site you should put this:
<iframe width="500" height="500" src="https://mv.services.hxgncontent.com/?u=cmvdemo&p=cmvdemo&origin=desktop&project=CMVDEMO+DDG+Multiple+years"></iframe>
or this:
<iframe width="500" height="500" src="https://mv.services.hxgncontent.com/Login></iframe>