Ejemplo n.º 1
0
        private FeatureData GetFeatureData(GetFeatures getFeatures, FieldSelection fieldSelection)
        {
            CheckIsFeatureLayer();

            Features features = (Features)_service.Send(getFeatures);

            FeatureData featureData = fieldSelection.CreateFeatureData();

            featureData.LayerName = Name;
            LoadFeatureData(features, featureData, fieldSelection);

            if (features.FeatureCount.HasMore)
            {
                getFeatures.BeginRecord = 1;

                do
                {
                    getFeatures.BeginRecord += features.FeatureCount.Count;
                    features = (Features)_service.Send(getFeatures);
                    LoadFeatureData(features, featureData, fieldSelection);
                }while (features.FeatureCount.HasMore);
            }

            return(featureData);
        }
Ejemplo n.º 2
0
        private List <String> GetFeatureIDs(GetFeatures getFeatures)
        {
            CheckIsFeatureLayer();
            CheckHasFeatureIDField();

            Features      features = (Features)_service.Send(getFeatures);
            List <String> idList   = GetIDList(features);

            if (features.FeatureCount.HasMore)
            {
                getFeatures.BeginRecord = 1;

                do
                {
                    getFeatures.BeginRecord += features.FeatureCount.Count;
                    features = (Features)_service.Send(getFeatures);
                    idList.AddRange(GetIDList(features));
                }while (features.FeatureCount.HasMore);
            }

            idList.Sort();

            for (int i = idList.Count - 1; i >= 1; --i)
            {
                if (String.Compare(idList[i], idList[i - 1], false) == 0)
                {
                    idList.RemoveAt(i);
                }
            }

            return(idList);
        }
Ejemplo n.º 3
0
        public object Get(GetFeatures request)
        {
            List <WebFeature> result = new List <WebFeature>();

            var context = TepWebContext.GetWebContext(PagePrivileges.EverybodyView);

            try {
                context.Open();
                context.LogInfo(this, string.Format("/feature GET"));
                EntityList <Terradue.Portal.Feature> feats = new EntityList <Terradue.Portal.Feature>(context);
                feats.Load();

                List <Terradue.Portal.Feature> features = feats.GetItemsAsList();
                features.Sort();

                foreach (Terradue.Portal.Feature f in features)
                {
                    result.Add(new WebFeature(f));
                }

                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public override DataTable GetFeatureTable(string fieldNames, string where, IGeometry shape)
        {
            FieldSelection fieldSelection = new FieldSelection(this, fieldNames);
            SpatialQuery   query          = new SpatialQuery(where, shape);

            query.Subfields = fieldSelection.NamesToString(" ");

            GetFeatures getFeatures = new GetFeatures(ID, query);

            getFeatures.DataFrame = DataFrame.Name;
            getFeatures.Geometry  = fieldSelection.Fields.Any(lyr => lyr.Type == CommonFieldType.Geometry);
            return(GetFeatureTable(getFeatures, fieldSelection));
        }
Ejemplo n.º 5
0
        public override List <String> GetFeatureIDs(string where, IGeometry shape)
        {
            SpatialQuery query = new SpatialQuery(where, shape);

            query.Subfields = FeatureIDField.Name;

            GetFeatures getFeatures = new GetFeatures(ID, query);

            getFeatures.Geometry  = false;
            getFeatures.DataFrame = DataFrame.Name;

            return(GetFeatureIDs(getFeatures));
        }
Ejemplo n.º 6
0
        public override Envelope GetFeatureExtent(string where)
        {
            CheckIsFeatureLayer();

            Query query = new Query(where);

            GetFeatures getFeatures = new GetFeatures(ID, query);

            getFeatures.GlobalEnvelope = true;
            getFeatures.Envelope       = false;
            getFeatures.Geometry       = false;
            getFeatures.Attributes     = false;
            getFeatures.DataFrame      = DataFrame.Name;

            Features features = (Features)_service.Send(getFeatures);

            return(features.FeatureCount.Count > 0 ? features.Envelope : new Envelope());
        }
Ejemplo n.º 7
0
        public override int GetFeatureCount(string where, IGeometry shape)
        {
            CheckIsFeatureLayer();

            SpatialQuery query = new SpatialQuery(where);

            query.Subfields = "#ID#";

            GetFeatures getFeatures = new GetFeatures(ID, query);

            getFeatures.Attributes = false;
            getFeatures.Geometry   = false;
            getFeatures.DataFrame  = DataFrame.Name;

            if (shape != null)
            {
                query.SpatialFilter = new SpatialFilter(shape);
            }

            Features features = (Features)_service.Send(getFeatures);

            return(features.FeatureCount.Count);
        }
Ejemplo n.º 8
0
        private DataTable GetFeatureTable(GetFeatures getFeatures, FieldSelection fieldSelection)
        {
            CheckIsFeatureLayer();

            Features features = (Features)_service.Send(getFeatures);

            DataTable table = fieldSelection.CreateTable();

            LoadFeatureTable(features, table, fieldSelection);

            if (features.FeatureCount.HasMore)
            {
                getFeatures.BeginRecord = 1;

                do
                {
                    getFeatures.BeginRecord += features.FeatureCount.Count;
                    features = (Features)_service.Send(getFeatures);
                    LoadFeatureTable(features, table, fieldSelection);
                }while (features.FeatureCount.HasMore);
            }

            return(table);
        }