Exemplo n.º 1
0
        private void UpdateFromState(QueryState state)
        {
            Query = state.Query;

            IsSpatialQuery = state.IsSpatialQuery;
            SpatialQuery.UpdateFromState(state);

            UseTransformer            = state.UseTransformer;
            DefaultOperator           = state.DefaultOperator;
            SelectedTransformer.Value = state.Transformer;
            SkipTransformResults      = state.SkipTransform;
            ShowFields  = state.ShowFields;
            ShowEntries = state.ShowEntries;


            SortBy.Clear();

            foreach (var sortOption in state.SortOptions)
            {
                if (SortByOptions.Contains(sortOption))
                {
                    SortBy.Add(new StringRef()
                    {
                        Value = sortOption
                    });
                }
            }
        }
Exemplo n.º 2
0
 private void ClearCurrentQuery()
 {
     Query = string.Empty;
     SortBy.Clear();
     SpatialQuery.Clear();
     ClearQueryError();
     Suggestions.Clear();
     CollectionSource.Clear();
 }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
 public void UpdateSpatialFields(List <SpatialQueryField> spatialFields)
 {
     IsSpatialQuerySupported = spatialFields.Count > 0;
     SpatialQuery.UpdateFields(spatialFields);
 }
Exemplo n.º 7
0
        public void AddLayer(ArcImsLayer layer, string query, LayerQueryMode queryMode, Renderer renderer)
        {
            int nextLayerNo = 0;

            // layers from other services and data frames are not allowed

            if (layer.DataFrame != DataFrame)
            {
                throw new ArcImsException("The specified ArcImsLayer is not in the same service and dataframe as the ArcImsMap.");
            }

            // queries and renderers are only allow on feature layers

            SpatialQuery spatialQuery = null;

            if (!String.IsNullOrEmpty(query) && queryMode != LayerQueryMode.None)
            {
                if (layer.Type != CommonLayerType.Feature)
                {
                    throw new ArcImsException("Definition and selection queries are only allowed on feature layers");
                }

                spatialQuery = new SpatialQuery(query);
            }

            if (renderer != null && layer.Type != CommonLayerType.Feature)
            {
                throw new ArcImsException("Custom renderers are only allowed on feature layers");
            }

            // add all group layers that contain this layer

            ArcImsLayer parent = layer.Parent as ArcImsLayer;

            while (parent != null)
            {
                AddLayer(new LayerDef(parent.ID));
                parent = parent.Parent as ArcImsLayer;
            }

            // handle queries and renderers

            LayerDef layerDef = new LayerDef(layer.ID);

            if (spatialQuery != null)
            {
                if (queryMode == LayerQueryMode.Definition)
                {
                    layerDef.Query    = spatialQuery;
                    layerDef.Renderer = renderer;
                }

                if (queryMode == LayerQueryMode.Selection)
                {
                    Layer axlLayer = new Layer(String.Format("__{0}", nextLayerNo++));
                    axlLayer.Query   = spatialQuery;
                    axlLayer.Dataset = new Dataset(layer.ID);

                    if (_service.IsArcMap)
                    {
                        layerDef.Renderer = renderer;
                    }
                    else
                    {
                        axlLayer.Renderer = renderer;
                    }

                    AddLayer(axlLayer);
                }
            }
            else
            {
                layerDef.Renderer = renderer;
            }

            AddLayer(layerDef);
        }