コード例 #1
0
ファイル: FeatureClass.cs プロジェクト: jugstalt/gViewGisOS
        public IFeatureCursor GetFeatures(IQueryFilter filter)
        {
            if (filter is ISpatialFilter)
            {
                filter = SpatialFilter.Project(filter as ISpatialFilter, this.SpatialReference);
            }

            return(new FeatureCursor(_etcon, filter));
        }
コード例 #2
0
ファイル: FeatureClass.cs プロジェクト: jugstalt/gview5
        async public Task <IFeatureCursor> GetFeatures(IQueryFilter filter)
        {
            if (filter is ISpatialFilter)
            {
                filter = SpatialFilter.Project(filter as ISpatialFilter, this.SpatialReference);
            }

            return(await FeatureCursor.Create(_etcon, filter, this));
        }
コード例 #3
0
ファイル: WFSFeatureClass.cs プロジェクト: jugstalt/gview5
        async protected override Task <IFeatureCursor> FeatureCursor(IQueryFilter filter)
        {
            string response = "";

            string srsName = _sRef != null ? _sRef.Name : String.Empty;

            if (filter is ISpatialFilter)
            {
                filter = SpatialFilter.Project(filter as ISpatialFilter, this.SpatialReference);
                ((ISpatialFilter)filter).FilterSpatialReference = this.SpatialReference;
            }

            if (_dataset._getCapabilities.Post_OnlineResource == String.Empty &&
                _dataset._getCapabilities.Get_OnlineResource != String.Empty)
            {
                string param = "VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=" + this.Name + "&MAXFEATURES=10&FILTER=";
                if (_dataset._getCapabilities.Get_OnlineResource.IndexOf("&SERVICE=") == -1 &&
                    _dataset._getCapabilities.Get_OnlineResource.IndexOf("?SERVICE=") == -1)
                {
                    param = "SERVICE=WFS&" + param;
                }

                string wfsFilter = await Filter.ToWFS(this, filter, _dataset._filter_capabilites, _dataset._gmlVersion);

                string url = _dataset._getFeature.Get_OnlineResource;

                response = WebFunctions.HttpSendRequest(url, "GET", null);
            }
            else if (_dataset._getCapabilities.Post_OnlineResource != String.Empty)
            {
                string url = _dataset._getFeature.Post_OnlineResource;
                if (_dataset._getCapabilities.Get_OnlineResource.IndexOf("&SERVICE=") == -1 &&
                    _dataset._getCapabilities.Get_OnlineResource.IndexOf("?SERVICE=") == -1)
                {
                    url = WMSDataset.Append2Url(url, "SERVICE=WFS");
                }

                string wfsFilter = GetFeatureRequest.Create(this, this.Name, filter, srsName, _dataset._filter_capabilites, _dataset._gmlVersion);

                response = WebFunctions.HttpSendRequest(url, "POST",
                                                        Encoding.UTF8.GetBytes(wfsFilter));
            }
            if (response == String.Empty)
            {
                return(null);
            }

            try
            {
                StringReader  stringReader = new StringReader(response);
                XmlTextReader xmlReader    = new XmlTextReader(stringReader);

                XmlDocument doc = new XmlDocument();
                //doc.LoadXml(response);
                XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
                ns.AddNamespace("GML", "http://www.opengis.net/gml");
                ns.AddNamespace("WFS", "http://www.opengis.net/wfs");
                ns.AddNamespace("OGC", "http://www.opengis.net/ogc");
                ns.AddNamespace("myns", _targetNamespace);

                //XmlNode featureCollection = doc.SelectSingleNode("WFS:FeatureCollection", ns);
                //if (featureCollection == null)
                //    featureCollection = doc.SelectSingleNode("GML:FeatureCollection", ns);
                //if (featureCollection == null) return null;

                return(new gView.Framework.OGC.GML.FeatureCursor2(this, xmlReader, ns, filter, _dataset._gmlVersion, _dataset._filter_capabilites));
            }
            catch { }
            return(null);
        }