Updating Envelope in IMapDocument Context

375
1
06-02-2011 06:02 AM
AdamDavis
Occasional Contributor
Hi,

I am trying to change the Real-World Location of a MapFrame whilst in an IMapDocument.Open context.

The normal code of using the ActiveView's Envelope doesn't seem to work in this case as I guess the document isn't actually open in the ArcGIS window. MapFrame.MapBounds doesn't seem to work either.

Still it seems perfectly sensible that if copy layers over and do all kinds of other great stuff in the IMapDocument context that a simple change in Envelope should be simple!
Having said that; the idea that a MapFrame/Map doesn't have centre and rotation properties anyway is pretty laughable....

Does anyone know how this might be done?

Thanks,

Adam
0 Kudos
1 Reply
AdamDavis
Occasional Contributor
Hi,

Fortunately found the answer on another forum thread - thanks Neil Clemmens and Simon Earnshaw.

Essentially you have to activate the Activeview - so ESRI.
A bit like setting the defaults on a Coordinate System - if they are defaults why the ?!?! do you have to set them?

I have to say the ArcObjects API is the worst API I have ever worked with. More complicated than it needs to be; mind numbingly obtuse with it's all the direct casts and often a single line of code will set off all kinds of random consequences. I spend my days writing a couple of lines of code and then testing to see if what I think the API might be doing is actually what the API is doing.... repeat ad infinitum.

Cheers All,

Adam


Hi,

I am trying to change the Real-World Location of a MapFrame whilst in an IMapDocument.Open context.

The normal code of using the ActiveView's Envelope doesn't seem to work in this case as I guess the document isn't actually open in the ArcGIS window. MapFrame.MapBounds doesn't seem to work either.

Still it seems perfectly sensible that if copy layers over and do all kinds of other great stuff in the IMapDocument context that a simple change in Envelope should be simple!
Having said that; the idea that a MapFrame/Map doesn't have centre and rotation properties anyway is pretty laughable....

Does anyone know how this might be done?

Thanks,

Adam
0 Kudos