M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Tim
Contributor
Posts: 24
Registered: ‎11-06-2015
Accepted Solution

Synchronise Analyzer Views

We have an Incident Analyzer app that has two analyzer views and I am trying to synchronize their view extents via custom javascript.  I've been passed an example bit of code and have found the/an Analyzer API PDF somwhere on this site.  Using that information, I've placed the following code in a custom panel:

-----------------------------------

var lhView = "KIC_public";
var rhView = "KIC_transferred";

gsp.m_app.messages.subscribe("Analyzer.onViewUpdated", function (messageParams) {
  switch (messageParams.viewName) {
    case lhView:
      messageParams.targetViewName = rhView;
      gsp.m_app.messages.send("Analyzer.updateView", messageParams );
      break;
    case rhView:
      messageParams.targetViewName = lhView;
      gsp.m_app.messages.send("Analyzer.updateView", messageParams);
      break;
  }
});

-----------------------------------

The idea being that if the user pans/zooms the lefthand view, the righthand view is updated and vice-versa, but the update does not occur.

If I step through the code in debug I can see the function being called and no errors are returned.

Presumably I've missed or misunderstood something, can anyone tell me what?

TIA,

Tim

 

Staff
Posts: 1,051
Registered: ‎10-18-2015

Re: Synchronise Analyzer Views

Hi Tim,

 

you have to provide center and zoom as parameter to the UpdateView method. Please check the doc here:

 

https://hexagongeospatial.fluidtopics.net/reader/Ok2XAxGJ4r411ywdBbu8~w/ZNJVDDlZbtSF6dRn8mzuEw

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Highlighted
Tim
Contributor
Posts: 24
Registered: ‎11-06-2015

Re: Synchronise Analyzer Views

Hi Stefan,

Thanks for the reply.

In the example code above, when my function gets called I am passed information in the messageParams variable which includes the center and zoom parameters and their values.  I've added targetViewName to this to point to the view that I want updating.  This is consistent with the API example "Synchronizing Two Analyzer Views" at the same documentation link you provided. 

 

In case this example is incorrect I have tried the following:

gsp.m_app.messages.send("Analyzer.updateView", rhView, messageParams.center, messageParams.zoom );

and

gsp.m_app.messages.send("Analyzer.updateView", rhView, messageParams.center.lat, messageParams.center.lng, messageParams.zoom );

 

rhView contains the name of the Analyzer view that I want to update, the other values are passed-in and represent those of the view that received the update event.

 

However, this has no effect either as the target view is not updated; no errors are returned either (in the developer tools console at least).

Any other clues?

Thanks,

Tim

Tim
Contributor
Posts: 24
Registered: ‎11-06-2015

Re: Synchronise Analyzer Views

The solution to this was:

1 - Remove the code from the custom panel.

2 - Save the application.

3 - Run the application and verify - views do not synchronize.

4 - Re-place the code in the custom panel.

5 - Save the application.

6 - Run the application and verify - views do synchronize.

 

Believe it, or not

Tim
Contributor
Posts: 24
Registered: ‎11-06-2015

Re: Synchronise Analyzer Views

For the record, it would appear that for certain custom javascript modifications it is necessary to clear your browser's data cache proir to reaccessing your application.  The above workflow must have triggered a change in the cache, but is not reliable, i.e. the synchronize view code stopped working after a minor alteration and that workflow did not resolve that.

 

I've been clearing the cache after each modification as a matter of course to avoid confusion.

Staff
Posts: 1,051
Registered: ‎10-18-2015

Re: Synchronise Analyzer Views

Hi Tim,

 

good to hear you did resolve it.

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial