How to Fly To?

719
2
10-26-2010 11:31 AM
MatsKarlsson
New Contributor III
I am a beginner using ArcGISExplorer SDK, and are trying to create a simple plugin that, when, a button is pressed 'flys to' another location, specified by x and y.

I believe I have to use ActiveMapDisplay somehow. The ZoomTo function will allow me to 'fly' to another location, but it seems I will have to specify the extent of the view as well (which I don't want to change).

Is there a simple function like FlyTo(x,y); somewhere? Or center the map?

Regards,
Totte
0 Kudos
2 Replies
MatsKarlsson
New Contributor III
Seems as this code is doing the job:
   

  private void button1_Click_1(object sender, EventArgs e)
  {
   Target target = TargetTracker.GetFirstTarget();


   Geometry geom = target.MapGraphic.Geometry;

   double cAltitude = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Altitude;

   ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.ZoomTo(geom, cAltitude);

  }


where Target is my class having a Graphic member.

Totte
I am a beginner using ArcGISExplorer SDK, and are trying to create a simple plugin that, when, a button is pressed 'flys to' another location, specified by x and y.

I believe I have to use ActiveMapDisplay somehow. The ZoomTo function will allow me to 'fly' to another location, but it seems I will have to specify the extent of the view as well (which I don't want to change).

Is there a simple function like FlyTo(x,y); somewhere? Or center the map?

Regards,
Totte
0 Kudos
MatsKarlsson
New Contributor III
Seems as this code is doing the job:
   

  private void button1_Click_1(object sender, EventArgs e)
  {
   Target target = TargetTracker.GetFirstTarget();


   Geometry geom = target.MapGraphic.Geometry;

   double cAltitude = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Altitude;

   ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.ZoomTo(geom, cAltitude);

  }


The above works, but for each button click it does zoom in a little. Consecutive clicks changes the altitude continuously (small, but noticeable changes). May this be a bug in the ZoomTo function?

totte
0 Kudos