<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do I obtain the envelope of a data frame in Layout? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-do-i-obtain-the-envelope-of-a-data-frame-in/m-p/30262#M805</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How can I programatically obtain the corner coordinates (in page units) or the envelope of the data frame in layout view?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I don't seem to be able to do this with iActiveView:Extent as it is&amp;nbsp; returning the extent of the data view in page units. The below screen&amp;nbsp; capture shows what I would like to get. The coordinates are roughly;&amp;nbsp; upper left 0.9,10 and lower right 8, 0.9. Even in page layout&amp;nbsp; iActive:extent returns: upper left -3.4, 12 and lower right 14,-3 which&amp;nbsp; is the extent of the entire application window not the data frame as it&amp;nbsp; appears in layout. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]15823[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jul 2012 14:35:30 GMT</pubDate>
    <dc:creator>JakubSisak</dc:creator>
    <dc:date>2012-07-06T14:35:30Z</dc:date>
    <item>
      <title>How do I obtain the envelope of a data frame in Layout?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-do-i-obtain-the-envelope-of-a-data-frame-in/m-p/30262#M805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How can I programatically obtain the corner coordinates (in page units) or the envelope of the data frame in layout view?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I don't seem to be able to do this with iActiveView:Extent as it is&amp;nbsp; returning the extent of the data view in page units. The below screen&amp;nbsp; capture shows what I would like to get. The coordinates are roughly;&amp;nbsp; upper left 0.9,10 and lower right 8, 0.9. Even in page layout&amp;nbsp; iActive:extent returns: upper left -3.4, 12 and lower right 14,-3 which&amp;nbsp; is the extent of the entire application window not the data frame as it&amp;nbsp; appears in layout. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]15823[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2012 14:35:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-do-i-obtain-the-envelope-of-a-data-frame-in/m-p/30262#M805</guid>
      <dc:creator>JakubSisak</dc:creator>
      <dc:date>2012-07-06T14:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I obtain the envelope of a data frame in Layout?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-do-i-obtain-the-envelope-of-a-data-frame-in/m-p/30263#M806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jakub,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I believe the general approach in the Page Layout is to obtain a reference to the page element of interest (such as the MapFrame), get its geometry, and then retrieve the Envelope for that particular geometry.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As an example, I have included a Visual C++ code fragment below extracted from one of the methods we use in our ArcGIS Engine application when interacting with the PageLayoutControl (with all error checking removed).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
IMapFramePtr&amp;nbsp;&amp;nbsp; pMapFrame = NULL;
IElementPtr&amp;nbsp;&amp;nbsp;&amp;nbsp; pElement = NULL;

IGeometryPtr&amp;nbsp;&amp;nbsp; pMapFrameGeometry = NULL;
IEnvelopePtr&amp;nbsp;&amp;nbsp; pMapFrameEnvelope = NULL;

HRESULT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hr = S_OK;

double&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dXMin = 0.0;
double&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dYMin = 0.0;
double&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dXMax = 0.0;
double&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dYMax = 0.0;

// QI to get the IElement interface
pElement = pMapFrame;

// Obtain the extent of the MapFrame geometry 
hr = pElement-&amp;gt;get_Geometry(&amp;amp;pMapFrameGeometry);
hr = pMapFrameGeometry-&amp;gt;get_Envelope(&amp;amp;pMapFrameEnvelope);

// Note that the min/max X,Y values are in page units (such as inches, cm, etc.)
hr = pMapFrameEnvelope-&amp;gt;QueryCoords(&amp;amp;dXMin, &amp;amp;dYMin, &amp;amp;dXMax, &amp;amp;dYMax);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; As another brief example, below is a Visual C++ code fragment that demonstrates one approach for obtaining a reference to the MapFrame element (within the overall Page Layout's graphics container).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
IGraphicsContainerPtr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pGraphicsContainer = NULL;
IElementPtr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pElement = NULL;
IMapFramePtr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMapFrame = NULL;

// Iterate across all the elements in the PageLayoutControl graphics container
pGraphicsContainer = m_pPageLayoutControl-&amp;gt;GetGraphicsContainer();
ASSERT(pGraphicsContainer != NULL);

if (pGraphicsContainer != NULL)
{
&amp;nbsp; hr = pGraphicsContainer-&amp;gt;Reset();
&amp;nbsp; hr = pGraphicsContainer-&amp;gt;Next(&amp;amp;pElement);

&amp;nbsp; // Examine the next page element, only being interested in MapFrame elements for this method
&amp;nbsp; while (pElement != NULL)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // QI to determine if this graphic element is the MapFrame
&amp;nbsp;&amp;nbsp;&amp;nbsp; pMapFrame = pElement;

&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pMapFrame != NULL)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ... processing for the MapFrame element
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; hr = pGraphicsContainer-&amp;gt;Next(&amp;amp;pElement);
&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:12:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-do-i-obtain-the-envelope-of-a-data-frame-in/m-p/30263#M806</guid>
      <dc:creator>ScottKutz</dc:creator>
      <dc:date>2021-12-10T21:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I obtain the envelope of a data frame in Layout?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-do-i-obtain-the-envelope-of-a-data-frame-in/m-p/30264#M807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Figured it out with the help of the good folks on GIS SE.&amp;nbsp; The finished tool can be downloaded here: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.arcgis.com/home/item.html?id=a9b032f739254ebeb6221c9294ebc886" rel="nofollow" target="_blank"&gt;http://www.arcgis.com/home/item.html?id=a9b032f739254ebeb6221c9294ebc886&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2012 13:08:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-do-i-obtain-the-envelope-of-a-data-frame-in/m-p/30264#M807</guid>
      <dc:creator>JakubSisak</dc:creator>
      <dc:date>2012-07-09T13:08:33Z</dc:date>
    </item>
  </channel>
</rss>

