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); }
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); }
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); }
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)); }
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); } } }
public void AddLayer(AgsLayer layer) { AddLayer(layer, null); }