Changes between Version 1 and Version 2 of CodeSnippets/GetStaticExtents


Ignore:
Timestamp:
10/15/08 20:38:35 (16 years ago)
Author:
ShaikEsu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodeSnippets/GetStaticExtents

    v1 v2  
    3333#!cpp
    3434
    35   public IPolygon GetExtents()
    36   {
    37     IPolygon retpolygon;
    38     ISelectAggregates pselagree = (ISelectAggregates)FDOConnection.CreateCommand(CommandType.CommandType_SelectAggregates);
    39  
    40     pselagree.SetFeatureClassName(System.IO.Path.GetFileNameWithoutExtension(OpenedFile));
    41     IFeatureReader FDOReader = pselagree.Execute();
    42     FgfGeometryFactory GeoFac = new FgfGeometryFactory();
     35    public IPolygon GetExtents()
     36        {
     37            IPolygon retpolygon;
     38            ISelectAggregates pselagree = (ISelectAggregates)FDOConnection.CreateCommand(CommandType.CommandType_SelectAggregates);
     39            pselagree.SetFeatureClassName(System.IO.Path.GetFileNameWithoutExtension(OpenedFile));
     40           
     41            IdentifierCollection props = pselagree.PropertyNames;
     42            Expression exp = Expression.Parse("SpatialExtents(Geometry)");
     43            ComputedIdentifier se = new ComputedIdentifier("Extents", exp);
    4344
    44     Byte[] Tmppts = FDOReader.GetGeometry("Geometry");
     45            props.Add(se);
    4546
    46     IGeometry Geo = GeoFac.CreateGeometryFromFgf(Tmppts);
     47            IDataReader FDOReader = pselagree.Execute();
     48            FgfGeometryFactory GeoFac = new FgfGeometryFactory();
    4749
    48     retpolygon = (IPolygon)Geo;
     50            FDOReader.ReadNext();
     51            Byte[] Tmppts = FDOReader.GetGeometry("Extents");
    4952
    50     return retpolygon;
     53            IGeometry Geo = GeoFac.CreateGeometryFromFgf(Tmppts);
    5154
    52   }
     55            retpolygon = (IPolygon)Geo;
     56
     57            return retpolygon;
     58
     59        }
    5360
    5461}}}