private List <Bitmap> GetTileImages(bool overlay) { List <Bitmap> tileImages = new List <Bitmap>(); StringCollection visibleTiles = _appState.VisibleTiles[_appState.MapTab]; double pixelSize = _appState.Extent.Width / _width; int level = Convert.ToInt32(Math.Log(Constants.BasePixelSize / pixelSize, 2)); if (visibleTiles.Count > 0) { Configuration.MapTabRow mapTab = AppContext.GetConfiguration().MapTab.FindByMapTabID(_appState.MapTab); foreach (Configuration.MapTabTileGroupRow mapTabTileGroup in mapTab.GetMapTabTileGroupRows().Where(o => visibleTiles.Contains(o.TileGroupID))) { double opacity = mapTabTileGroup.IsOpacityNull() ? 1 : mapTabTileGroup.Opacity; foreach (Configuration.TileLayerRow tileLayer in mapTabTileGroup.TileGroupRow.GetTileLayerRows()) { bool isOverlay = !tileLayer.IsOverlayNull() && tileLayer.Overlay == 1; if (isOverlay == overlay) { Bitmap tileImage = TileAggregator.GetImage(tileLayer.URL, _appState.Extent, level, opacity); tileImages.Add(tileImage); } } } } return(tileImages); }
private void AddTiles(Configuration.MapTabRow mapTabRow, AppState appState) { StringCollection visibleTiles = appState.VisibleTiles[mapTabRow.MapTabID]; // create the top level legend control for this map tab HtmlGenericControl parentLegend = new HtmlGenericControl("div"); pnlTileScroll.Controls.Add(parentLegend); parentLegend.Attributes["data-maptab"] = mapTabRow.MapTabID; parentLegend.Attributes["class"] = "LegendTop"; parentLegend.Style["display"] = mapTabRow.MapTabID == appState.MapTab ? "block" : "none"; foreach (Configuration.MapTabTileGroupRow mapTabTileGroupRow in mapTabRow.GetMapTabTileGroupRows()) { Configuration.TileGroupRow tileGroupRow = mapTabTileGroupRow.TileGroupRow; HtmlGenericControl legendEntry = new HtmlGenericControl("div"); parentLegend.Controls.Add(legendEntry); legendEntry.Attributes["class"] = "LegendEntry"; HtmlGenericControl legendHeader = new HtmlGenericControl("div"); legendEntry.Controls.Add(legendHeader); legendHeader.Attributes["class"] = "LegendHeader"; HtmlGenericControl visibility = new HtmlGenericControl("span"); legendHeader.Controls.Add(visibility); visibility.Attributes["class"] = "LegendVisibility"; HtmlInputCheckBox checkBox = new HtmlInputCheckBox(); visibility.Controls.Add(checkBox); checkBox.Checked = visibleTiles.Contains(tileGroupRow.TileGroupID); checkBox.Attributes["class"] = "LegendCheck"; checkBox.Attributes["data-tilegroup"] = tileGroupRow.TileGroupID; HtmlGenericControl name = new HtmlGenericControl("span"); legendHeader.Controls.Add(name); name.Attributes["class"] = "LegendName"; name.InnerText = tileGroupRow.DisplayName; } }
private void CreatePdfTiles(PdfContentByte content, Configuration.PrintTemplateContentRow row, bool overlay) { int pixelWidth = Convert.ToInt32(row.Width * PixelsPerInch); int pixelHeight = Convert.ToInt32(row.Height * PixelsPerInch); float originX = Convert.ToSingle(row.OriginX) * PointsPerInch; float originY = Convert.ToSingle(row.OriginY) * PointsPerInch; float width = Convert.ToSingle(row.Width) * PointsPerInch; float height = Convert.ToSingle(row.Height) * PointsPerInch; StringCollection visibleTiles = _appState.VisibleTiles[_appState.MapTab]; int level = Convert.ToInt32(Math.Log(Constants.BasePixelSize / _pixelSize, 2)); if (visibleTiles.Count > 0) { Configuration.MapTabRow mapTab = AppContext.GetConfiguration().MapTab.FindByMapTabID(_appState.MapTab); foreach (Configuration.MapTabTileGroupRow mapTabTileGroup in mapTab.GetMapTabTileGroupRows().Where(o => visibleTiles.Contains(o.TileGroupID))) { double opacity = mapTabTileGroup.IsOpacityNull() ? 1 : mapTabTileGroup.Opacity; foreach (Configuration.TileLayerRow tileLayer in mapTabTileGroup.TileGroupRow.GetTileLayerRows()) { bool isOverlay = !tileLayer.IsOverlayNull() && tileLayer.Overlay == 1; if (isOverlay == overlay) { byte[] tileImage = TileAggregator.GetImageBytes(tileLayer.URL, _appState.Extent, level, opacity); iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(tileImage); image.SetAbsolutePosition(originX, originY); image.ScaleAbsolute(width, height); content.AddImage(image); } } } } }
private void AddTileGroupsForMapTab(Configuration.MapTabRow mapTabRow, AppState appState, int m, bool asBaseMap) { StringCollection visibleTiles = appState.VisibleTiles[mapTabRow.MapTabID]; // create the top level legend control for this map tab HtmlGenericControl parentLegend = new HtmlGenericControl("div"); pnlBaseMapScroll.Controls.Add(parentLegend); parentLegend.Attributes["data-maptab"] = mapTabRow.MapTabID; parentLegend.Attributes["class"] = "LegendTop"; parentLegend.Style["display"] = mapTabRow.MapTabID == appState.MapTab ? "block" : "none"; HtmlGenericControl typeEntry = new HtmlGenericControl("div"); parentLegend.Controls.Add(typeEntry); typeEntry.Attributes["class"] = "LegendEntry"; HtmlGenericControl typeHeader = new HtmlGenericControl("div"); typeEntry.Controls.Add(typeHeader); typeHeader.Attributes["class"] = "LegendHeader"; HtmlGenericControl typeName = new HtmlGenericControl("span"); typeHeader.Controls.Add(typeName); typeName.Attributes["class"] = "LegendName"; typeName.InnerText = asBaseMap ? "BaseMaps" : "Overlays"; int g = 0; foreach (Configuration.MapTabTileGroupRow mapTabTileGroupRow in mapTabRow.GetMapTabTileGroupRows()) { Configuration.TileGroupRow tileGroupRow = mapTabTileGroupRow.TileGroupRow; bool isBaseMap = tileGroupRow.GetTileLayerRows().Any(t => t.IsOverlayNull() || t.Overlay == 0); if (isBaseMap == asBaseMap) { HtmlGenericControl legendEntry = new HtmlGenericControl("div"); parentLegend.Controls.Add(legendEntry); legendEntry.Attributes["class"] = "LegendEntry"; HtmlGenericControl legendHeader = new HtmlGenericControl("div"); legendEntry.Controls.Add(legendHeader); legendHeader.Attributes["class"] = "LegendHeader"; HtmlGenericControl visibility = new HtmlGenericControl("span"); legendHeader.Controls.Add(visibility); visibility.Attributes["class"] = "LegendVisibility"; HtmlControl onOffControl; if (isBaseMap) { HtmlInputRadioButton radio = new HtmlInputRadioButton(); radio.Attributes["id"] = string.Format("baseTile{0}-{1}", m, g); radio.Checked = visibleTiles.Contains(tileGroupRow.TileGroupID); radio.Attributes["class"] = "LegendCheck RadioCheck"; onOffControl = radio; } else { HtmlInputCheckBox checkBox = new HtmlInputCheckBox(); checkBox.Attributes["id"] = string.Format("overlayTile{0}-{1}", m, g); checkBox.Checked = visibleTiles.Contains(tileGroupRow.TileGroupID); checkBox.Attributes["class"] = "LegendCheck OverlaysCheck"; onOffControl = checkBox; } visibility.Controls.Add(onOffControl); onOffControl.Attributes["group"] = mapTabRow.MapTabID; onOffControl.Attributes["name"] = mapTabRow.MapTabID; onOffControl.Attributes["data-tilegroup"] = tileGroupRow.TileGroupID; HtmlGenericControl label = new HtmlGenericControl("label"); legendHeader.Controls.Add(label); label.Attributes["for"] = onOffControl.Attributes["id"]; HtmlGenericControl name = new HtmlGenericControl("span"); label.Controls.Add(name); name.Attributes["class"] = "LegendName"; name.InnerText = tileGroupRow.DisplayName; g += 1; } } if (g == 0) { parentLegend.Controls.Remove(typeEntry); } else if (asBaseMap) { AddNoneOption(mapTabRow, parentLegend); } }