Programmatic Navigation very slow

580
6
06-24-2010 12:45 PM
NevinFry
New Contributor
Hi,
I'm developing an application that uses an external touch sensor (does not go through Windows Mouse event queue) to navigate inside Explorer.
However, it seems as though the Application.ActiveMapDisplay.ZoomTo(Viewpoint) function executes very slowly, sometimes taking > 50-75ms.
Is there a better way to programmatically move the globe? or is there some way to speed this up?

Thanks.
0 Kudos
6 Replies
MichaelBranscomb
Esri Frequent Contributor
You should get equally good performance from using the Mapdisplay.ZoomTo method (with a variety of overloads) to navigating the Globe manually. We use the programmatic navigation in automated tests and see good performance there. Slow navigation is more likely to be a result of the data you are displaying in the Globe - what are the data sources? are the spatial indexes appropriate? are any services cached on the server? is there reprojection on the fly happening for anything not in WGS84?

Regards

Mike
0 Kudos
NevinFry
New Contributor
Hi Mike,
Currently the only data that is loaded is the Bing Maps basemap.
I'll try and do some more tests and post some results to see if I can figure out what the problem might be.
Also, is (or will there be) a way to capture the mouse, other than using a Windows Mouse Hook?

Thanks.
0 Kudos
NevinFry
New Contributor
Mike,
I've attached a source file for a button add-in that will navigate to 20 different places and output the time the ZoomTo() method takes to finish.

Here are the results I get (times in ms):

0 time: 93.75
1 time: 78.125
2 time: 46.875
3 time: 46.875
4 time: 46.875
5 time: 62.5
6 time: 62.5
7 time: 62.5
8 time: 46.875
9 time: 93.75
10 time: 62.5
11 time: 78.125
12 time: 78.125
13 time: 78.125
14 time: 78.125
15 time: 62.5
16 time: 78.125
17 time: 62.5
18 time: 93.75
19 time: 78.125

Here's the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;

using ESRI.ArcGISExplorer;
using ESRI.ArcGISExplorer.Application;
using ESRI.ArcGISExplorer.Mapping;
using ESRI.ArcGISExplorer.Geometry;
using ESRI.ArcGISExplorer.Data;
using ESRI.ArcGISExplorer.Threading;

namespace ZoomPerformanceTest
{
    public class Button : ESRI.ArcGISExplorer.Application.Button
    {
        public override void OnClick()
        {
            Application.ActiveMapDisplay.AnimateMovement = false;
            for (int i = 0; i < 20; i++)
            {
                Viewpoint vp = new Viewpoint(
                    new ESRI.ArcGISExplorer.Geometry.Point(i, 0, 85000),
                    new ESRI.ArcGISExplorer.Geometry.Point(i, 0, 0));
                DateTime d1 = DateTime.Now;
                Application.ActiveMapDisplay.ZoomTo(vp);
                System.Diagnostics.Debug.WriteLine(i + " time: " + (DateTime.Now - d1).TotalMilliseconds);
            }
        }
    }
}


Thanks.

-- James

Hi Mike,
Currently the only data that is loaded is the Bing Maps basemap.
I'll try and do some more tests and post some results to see if I can figure out what the problem might be.
Also, is (or will there be) a way to capture the mouse, other than using a Windows Mouse Hook?

Thanks.
0 Kudos
SimonFisher
Occasional Contributor II
James,

Not sure if this will help, but you may want to try adding this;

//Calling suspend display temporarily suspends updates to the map display
IDisposable suspendedDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.SuspendDisplay();

and once done;

//Calling dispose resumes updates to the map display
suspendedDisplay.Dispose();
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
James,

I'm not sure what level of performance you expect (or require for your application) but your results (40-80 milliseconds) look very good - running your test code I found the human eye (mine at least) is barely able to keep up with display changes at those speeds. You might find you get slightly better performance with the ESRI Imagery basemap due to differences in the way different basemap sources are cached.

As you add in additional layers of data you will find those display times begin to slow down - so the previous advice regarding spatial indexes, etc is still relevant. you seem to be working in 3D which uses a WGS84 geographic coordinate system - for best performance you should consider reprojecting any data you wish to display in Explorer (in 3D) into that coordinate system.

Regards

Mike
0 Kudos
NevinFry
New Contributor
James,

I'm not sure what level of performance you expect (or require for your application) but your results (40-80 milliseconds) look very good - running your test code I found the human eye (mine at least) is barely able to keep up with display changes at those speeds. You might find you get slightly better performance with the ESRI Imagery basemap due to differences in the way different basemap sources are cached.

As you add in additional layers of data you will find those display times begin to slow down - so the previous advice regarding spatial indexes, etc is still relevant. you seem to be working in 3D which uses a WGS84 geographic coordinate system - for best performance you should consider reprojecting any data you wish to display in Explorer (in 3D) into that coordinate system.

Regards

Mike


Hi Mike,
So I think the issue here (and what is different with ArcExplorer than say, 3DAnalyst), is that ZoomTo is a "synchronous" update operation. What I mean by that is that ZoomTo() doesn't return until it has redrawn the scene.
What is also interesting is that movements using the mouse clearly don't have this slowdown, so I assume that the internal mouse navigation is using another path for position updating.

-- James
0 Kudos