示例#1
0
        public void AddLayer(AgsLayer layer, string definitionQuery)
        {
            if (!String.IsNullOrEmpty(definitionQuery) && layer.Type != CommonLayerType.Feature)
            {
                throw new AgsException("Definition queries are only allowed on feature layers");
            }

            _layerList.Add(layer);
            _queryList.Add(definitionQuery);
        }
示例#2
0
        public override void AddLayerAndChildren(string layerId)
        {
            AgsLayer layer = DataFrame.Layers.FirstOrDefault(lyr => lyr.ID == layerId) as AgsLayer;

            if (layer == null)
            {
                throw new AgsException(String.Format("No layer with an ID of \"{0}\" exists in the dataFrame of this AgsMap.", layerId));
            }

            AddLayerAndChildren(layer);
        }
示例#3
0
        public override void AddLayer(CommonLayer layer, string definitionQuery)
        {
            AgsLayer agsLayer = layer as AgsLayer;

            if (agsLayer == null)
            {
                throw new AgsException(String.Format("A {0} cannot be added to an AgsMap.", layer.GetType().Name));
            }

            AddLayer(agsLayer, definitionQuery);
        }
示例#4
0
        private MapImage GetMapImage(esriImageReturnType returnType)
        {
            MapDescription mapDescription = ((AgsDataFrame)DataFrame).MapServerInfo.NewMapDescription(Extent);

            mapDescription.SetAllLayersNotVisible();

            for (int i = 0; i < _layerList.Count; ++i)
            {
                AgsLayer layer = _layerList[i];
                string   query = _queryList[i];

                MapLayerInfo mapLayerInfo = layer.MapLayerInfo;

                while (mapLayerInfo != null)
                {
                    LayerDescription layerDescription = mapDescription.LayerDescriptions.First(ld => ld.LayerID == mapLayerInfo.LayerID);
                    layerDescription.Visible = true;

                    if (!String.IsNullOrEmpty(query))
                    {
                        layerDescription.DefinitionExpression = query;
                    }

                    mapLayerInfo = mapLayerInfo.Parent;
                    query        = null;
                }
            }

            ImageDescription imageDescription = new ImageDescription();

            imageDescription.ImageDisplay = new ImageDisplay(Convert.ToInt32(Width * Resolution), Convert.ToInt32(Height * Resolution), DataFrame.Dpi * Resolution);
            imageDescription.ImageType    = new ImageType(returnType);

            switch (ImageType)
            {
            case CommonImageType.Png:
                imageDescription.ImageType.ImageFormat = esriImageFormat.esriImagePNG32;

                if (TransparentBackground)
                {
                    mapDescription.TransparentColor = mapDescription.BackgroundSymbol.Color;
                }
                break;

            default:
                imageDescription.ImageType.ImageFormat = esriImageFormat.esriImageJPG;
                break;
            }

            return(_service.MapServer.ExportMapImage(mapDescription, imageDescription));
        }
示例#5
0
        public override void AddLayerAndChildren(CommonLayer layer)
        {
            AgsLayer agsLayer = layer as AgsLayer;

            if (agsLayer == null)
            {
                throw new AgsException(String.Format("A {0} cannot be added to an AgsMap.", layer.GetType().Name));
            }

            AddLayer(agsLayer);

            if (agsLayer.Children != null && agsLayer.Children.Count > 0)
            {
                foreach (CommonLayer child in agsLayer.Children)
                {
                    AddLayerAndChildren(child);
                }
            }
        }
示例#6
0
 public void AddLayer(AgsLayer layer)
 {
     AddLayer(layer, null);
 }