当前位置: 首页>>代码示例>>C#>>正文


C# SqlGeometry.STIsEmpty方法代码示例

本文整理汇总了C#中SqlGeometry.STIsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# SqlGeometry.STIsEmpty方法的具体用法?C# SqlGeometry.STIsEmpty怎么用?C# SqlGeometry.STIsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SqlGeometry的用法示例。


在下文中一共展示了SqlGeometry.STIsEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SqlGeometryToGeometry

        public static IGeometry SqlGeometryToGeometry(SqlGeometry geom, GeometryFactory factory)
        {
            if (geom.STIsEmpty())
                return factory.CreateGeometryCollection(null);

            OpenGisGeometryType geometryType = (OpenGisGeometryType)Enum.Parse(typeof(OpenGisGeometryType), geom.STGeometryType().Value);
            switch (geometryType)
            {
                case OpenGisGeometryType.Point:
                    return SqlGeometryToGeometryPoint(geom, factory);
                case OpenGisGeometryType.LineString:
                    return SqlGeometryToGeometryLineString(geom, factory);
                case OpenGisGeometryType.Polygon:
                    return SqlGeometryToGeometryPolygon(geom, factory);
                case OpenGisGeometryType.MultiPoint:
                    return SqlGeometryToGeometryMultiPoint(geom, factory);
                case OpenGisGeometryType.MultiLineString:
                    return SqlGeometryToGeometryMultiLineString(geom, factory);
                case OpenGisGeometryType.MultiPolygon:
                    return SqlGeometryToGeometryMultiPolygon(geom, factory);
                case OpenGisGeometryType.GeometryCollection:
                    return SqlGeometryToGeometryGeometryCollection(geom, factory);
            }

            throw new ArgumentException(string.Format("Cannot convert SqlServer '{0}' to Geometry", geom.STGeometryType()), "geom");
        }
开发者ID:interworks,项目名称:FastShapefile,代码行数:26,代码来源:ConvertToGeometry.cs

示例2: ToSharpMapGeometry

        public static SMGeometry ToSharpMapGeometry(SqlGeometry geometry, Factory factory)
        {
            if (geometry == null) return null;
            var fact = factory ?? Services.CreateGeometryFactory((int) geometry.STSrid);

            if (geometry.STIsEmpty())
                return fact.CreateGeometryCollection(null);

            if (!geometry.STIsValid())
                geometry.MakeValid();

            OpenGisGeometryType geometryType = (OpenGisGeometryType)Enum.Parse(typeof(OpenGisGeometryType), (string)geometry.STGeometryType());
            switch (geometryType)
            {
                case OpenGisGeometryType.Point:
                    return SqlGeometryToSharpMapPoint(geometry, fact);
                case OpenGisGeometryType.LineString:
                    return SqlGeometryToSharpMapLineString(geometry, fact);
                case OpenGisGeometryType.Polygon:
                    return SqlGeometryToSharpMapPolygon(geometry, fact);
                case OpenGisGeometryType.MultiPoint:
                    return SqlGeometryToSharpMapMultiPoint(geometry, fact);
                case OpenGisGeometryType.MultiLineString:
                    return SqlGeometryToSharpMapMultiLineString(geometry, fact);
                case OpenGisGeometryType.MultiPolygon:
                    return SqlGeometryToSharpMapMultiPolygon(geometry, fact);
                case OpenGisGeometryType.GeometryCollection:
                    return SqlGeometryToSharpMapGeometryCollection(geometry, fact);
            }
            throw new ArgumentException(string.Format("Cannot convert SqlServer '{0}' to Sharpmap.Geometry", geometry.STGeometryType()), "geometry");
        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:31,代码来源:SqlGeometryConverter.cs

示例3: ReprojectGeometry

 private void ReprojectGeometry(SqlGeometry geom, SqlGeometryBuilder bldr)
 {
     if (geom.STIsEmpty())
     {
         bldr.BeginGeometry(OpenGisGeometryType.GeometryCollection);
         bldr.EndGeometry();
     }
     else
     {
         OpenGisGeometryType geometryType = (OpenGisGeometryType)Enum.Parse(typeof(OpenGisGeometryType), geom.STGeometryType().Value);
         switch (geometryType)
         {
             case OpenGisGeometryType.Point:
                 ReprojectPoint(geom, bldr);
                 break;
             case OpenGisGeometryType.LineString:
                 ReprojectLineString(geom, bldr);
                 break;
             case OpenGisGeometryType.Polygon:
                 ReprojectPolygon(geom, bldr);
                 break;
             case OpenGisGeometryType.MultiPoint:
                 ReprojectMultiPoint(geom, bldr);
                 break;
             case OpenGisGeometryType.MultiLineString:
                 ReprojectMultiLineString(geom, bldr);
                 break;
             case OpenGisGeometryType.MultiPolygon:
                 ReprojectMultiPolygon(geom, bldr);
                 break;
             case OpenGisGeometryType.GeometryCollection:
                 ReprojectGeometryCollection(geom, bldr);
                 break;
             default:
                 throw new ArgumentException(string.Format("Cannot reproject SqlServer Type '{0}'", geom.STGeometryType()), "geom");
         }
     }
 }
开发者ID:interworks,项目名称:FastShapefile,代码行数:38,代码来源:ReprojectSqlServer.cs


注:本文中的SqlGeometry.STIsEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。