AnsweredAssumed Answered

ZoomToLayer does not work as expected

Question asked by geonetadmin on Mar 27, 2012
Latest reply on Sep 23, 2015 by YLiu-esristaff
Original User: Kaspatoo

Hello,

I implemented a ZoomToLayer method.
I did like this:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//00480000016r000000

There its done this way:
      activeView.Extent = layer.AreaOfInterest;
      activeView.Refresh();

The layer is from the selectedItem in TOC.
In my case I still have Layer throuh a search.
Imap.get_Layers()

using
layer.AreaOfInterest
ArcMap.Document.ActiveView

Later my implementation:
        public static void zoomTo(IEnvelope extent, IActiveView activeView)
        {
            activeView.Extent = extent;
            activeView.Refresh();
        }


Well theres is some kind of "zoom" but not the right one. Because it doesnt matter how many features are in this layer, the zoom is always done to the same scale.
After I did my zoom and then clickling right in TOC on this layer and chose "ZoomToLayer" ArcMap zooms perfectly.
I guess the problem is ILayer.AreaOfInterest. Because its describbed as "The default area of interest for the layer.". Well if the featureClass changes, this layer is pointing to and now there are less features and the overall area is much smaller than before in my mind the area of Interest shrinked. But I could imagine that ArcMap is not thinking this way and is still holding the maximum are it ever had for ever.
But then I wonder why the arcMap function ZoomToLayer is able to handle this.

Maybe an additional information. I am adding features to the specific fetatureclass but only the new added ones will be shown by the layer due to a definition query. thats why I am thinking of the max area ever because the features still exists in featureclass but not in the layer.

Hope someone can help me. Thanks.

my zoom:
[ATTACH=CONFIG]13022[/ATTACH]
ArcMaps zoom:
[ATTACH=CONFIG]13024[/ATTACH]

Attachments

Outcomes