示例#1
0
        /// <summary>
        /// Returns the Serializable GML SF0 Multi Curve Object for the Given MultiCurve
        /// </summary>
        /// <param name="geomertyType"></param>
        /// <returns></returns>
        private static GeospatialServices.Ogc.Wms.GmlSf.MultiCurve GetGmlSfMultiCurve(SqlGeometry geometry)
        {
            GeospatialServices.Ogc.Wms.GmlSf.MultiCurve gmlMultiCurve = new GeospatialServices.Ogc.Wms.GmlSf.MultiCurve();
            GeospatialServices.Ogc.Wms.GmlSf.Curve      gmlCurve      = null;

            for (int i = 1; i <= geometry.STNumGeometries(); i++)
            {
                SqlGeometry smLineString = geometry.STGeometryN(i);
                gmlCurve = GetGmlSfCurve(smLineString);
                gmlMultiCurve.CurveMemberList.Add(new CurveProperty(gmlCurve));
            }
            return(gmlMultiCurve);
        }
示例#2
0
        public static AbstractGML GetFromSqlGeometry(SqlGeometry geometry)
        {
            AbstractGML gmlGeometry = null;
            string      geomType    = (string)geometry.STGeometryType();

            switch (geomType)
            {
            case "Point":
            {
                GeospatialServices.Ogc.Wms.GmlSf.Point gmlPoint = GetGmlSfPoint(geometry);
                gmlGeometry = gmlPoint;
            }
            break;

            case "LineString":
            {
                GeospatialServices.Ogc.Wms.GmlSf.Curve gmlCurve = GetGmlSfCurve(geometry);
                gmlGeometry = gmlCurve;
            }
            break;

            case "Polygon":
            {
                GeospatialServices.Ogc.Wms.GmlSf.Surface gmlSurface = GetGmlSfSurface(geometry);
                gmlGeometry = gmlSurface;
            }
            break;

            case "MultiPoint":
            {
                GeospatialServices.Ogc.Wms.GmlSf.MultiPoint gmlMultiPoint = GetGmlSfMultiPoint(geometry);
                gmlGeometry = gmlMultiPoint;
            }
            break;

            case "MultiLineString":
            {
                GeospatialServices.Ogc.Wms.GmlSf.MultiCurve gmlMultiCurve = GetGmlSfMultiCurve(geometry);
                gmlGeometry = gmlMultiCurve;
            }
            break;

            case "MultiPolygon":
            {
                GeospatialServices.Ogc.Wms.GmlSf.MultiSurface gmlMultiSurface = GetGmlSfMultiSurface(geometry);
                gmlGeometry = gmlMultiSurface;
            }
            break;

            case "GeometryCollection":
            {
                GeospatialServices.Ogc.Wms.GmlSf.MultiGeometry gmlMultiGeometry = new GeospatialServices.Ogc.Wms.GmlSf.MultiGeometry();
                GeospatialServices.Ogc.Wms.GmlSf.MultiSurface  gmlMultiSurface  = null;
                GeospatialServices.Ogc.Wms.GmlSf.MultiPoint    gmlMultiPoint    = null;
                GeospatialServices.Ogc.Wms.GmlSf.MultiCurve    gmlMultiCurve    = null;
                GeospatialServices.Ogc.Wms.GmlSf.Surface       gmlSurface       = null;
                GeospatialServices.Ogc.Wms.GmlSf.Point         gmlPoint         = null;
                GeospatialServices.Ogc.Wms.GmlSf.Curve         gmlCurve         = null;
                GeospatialServices.Ogc.Wms.GmlSf.AbstractGeometricAggregate gmlAbstractGeometricAggregate = null;

                for (int i = 1; i <= geometry.STNumGeometries(); i++)
                {
                    if (geometry.STGeometryN(i).STGeometryType() == "Point")
                    {
                        if (gmlMultiPoint == null)
                        {
                            gmlMultiPoint = new GeospatialServices.Ogc.Wms.GmlSf.MultiPoint();
                            gmlMultiGeometry.MultiGeometryMemberList.Add(new MultiGeometryProperty(gmlMultiPoint));
                        }
                        gmlPoint = GetGmlSfPoint(geometry.STGeometryN(i));
                        gmlMultiPoint.PointMemberList.Add(new PointProperty(gmlPoint));
                    }
                    if (geometry.STGeometryN(i).STGeometryType() == "LineString")
                    {
                        if (gmlMultiCurve == null)
                        {
                            gmlMultiCurve = new GeospatialServices.Ogc.Wms.GmlSf.MultiCurve();
                            gmlMultiGeometry.MultiGeometryMemberList.Add(new MultiGeometryProperty(gmlMultiCurve));
                        }
                        gmlCurve = GetGmlSfCurve(geometry.STGeometryN(i));
                        gmlMultiCurve.CurveMemberList.Add(new CurveProperty(gmlCurve));
                    }
                    else if (geometry.STGeometryN(i).STGeometryType() == "Polygon")
                    {
                        if (gmlMultiSurface == null)
                        {
                            gmlMultiSurface = new GeospatialServices.Ogc.Wms.GmlSf.MultiSurface();
                            gmlMultiGeometry.MultiGeometryMemberList.Add(new MultiGeometryProperty(gmlMultiSurface));
                        }
                        gmlSurface = GetGmlSfSurface(geometry.STGeometryN(i));
                        gmlMultiSurface.SurfaceMemberList.Add(new SurfaceProperty(gmlSurface));
                    }
                    else         // MultiPoint, MultiLineString, Multipolygon, GeometricCollection
                    {
                        gmlAbstractGeometricAggregate = (GeospatialServices.Ogc.Wms.GmlSf.AbstractGeometricAggregate)GetFromSqlGeometry(geometry.STGeometryN(i));
                        gmlMultiGeometry.MultiGeometryMemberList.Add(new MultiGeometryProperty(gmlAbstractGeometricAggregate));
                    }
                }
                gmlGeometry = gmlMultiGeometry;
            }
            break;
            }
            return(gmlGeometry);
        }