ESRI.ArcGIS.ADF.Local
Extent Property
See Also  Send Feedback
ESRI.ArcGIS.ADF.BaseClasses Namespace > BaseCustomLayer Class : Extent Property




The layers geodataset extent which is a union of the extents of all the items of the layer

Syntax

Visual Basic (Declaration) 
Public Overridable ReadOnly Property Extent As ESRI.ArcGIS.Geometry.IEnvelope
Visual Basic (Usage)Copy Code
Dim instance As BaseCustomLayer
Dim value As ESRI.ArcGIS.Geometry.IEnvelope
 
value = instance.Extent
C# 
public virtual ESRI.ArcGIS.Geometry.IEnvelope Extent {get;}

Remarks

In your inheriting class, consider the following code to calculate the layer's extent:
             public override IEnvelope Extent
            {
              get
              {
                m_extent  = GetLayerExtent();
                if (null == m_extent )
                  return null;
            
                IEnvelope env = ((IClone)m_extent ).Clone() as IEnvelope;
                if(null != m_layerSpatialRef)
                   env.Project(m_layerSpatialRef);
             
                return env;
              }
            }
                private IEnvelope GetLayerExtent()
            {
              if (null == base.m_spRef)
              {
                base.m_spRef = CreateGeographicSpatialReference();
              }
            
              IEnvelope env = new EnvelopeClass();
              env.SpatialReference = base.m_spRef;
              IPoint point = new PointClass();
              point.SpatialReference = m_spRef;
              foreach (DataRow r in m_table.Rows)
              {
                point.Y = Convert.ToDouble(r["Y"]);
                point.X = Convert.ToDouble(r["X"]);
            
                env.Union(point.Envelope);
              }
             
              return env;
            } 
             

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2011 All Rights Reserved.