internal void SetProperties(PrinterLayer printerLayer) { ImagePrinterLayer imagePrinterLayer = printerLayer as ImagePrinterLayer; if (imagePrinterLayer != null) { viewModel.BackgroundStyle = imagePrinterLayer.BackgroundMask; string imagePrinterLayerPathFilename = imagePrinterLayer.Image.PathFilename; if (File.Exists(imagePrinterLayerPathFilename)) { viewModel.SelectedImage = File.ReadAllBytes(imagePrinterLayerPathFilename); } else if (imagePrinterLayer.Image.GetImageStream() == null) { System.Windows.Forms.MessageBox.Show(string.Format(CultureInfo.InvariantCulture, GisEditor.LanguageManager.GetStringResource("FileNotExistsAlert"), imagePrinterLayerPathFilename), GisEditor.LanguageManager.GetStringResource("DataNotFoundlAlertTitle")); } else { var stream = imagePrinterLayer.Image.GetImageStream(); stream.Seek(0, SeekOrigin.Begin); byte[] bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); viewModel.SelectedImage = bytes; } viewModel.DragMode = imagePrinterLayer.DragMode; viewModel.ResizeMode = imagePrinterLayer.ResizeMode; } }
private void toolBoxItem_Click(object sender, RoutedEventArgs e) { PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"]; PrinterLayer printerLayer = null; if (sender == btnAddLabel) { printerLayer = new LabelPrinterLayer(); printerLayer.SetPosition(2, 1, 0, 0, PrintingUnit.Inch); } else if (sender == btnAddImage) { printerLayer = new ImagePrinterLayer(); } else if (sender == btnAddScaleLine) { MessageBox.Show("NotImplemented"); } else if (sender == btnAddScaleBar) { MessageBox.Show("NotImplemented"); } else if (sender == btnAddDataGrid) { printerLayer = new DataGridPrinterLayer(); printerLayer.SetPosition(1, 1, 0, 0, PrintingUnit.Inch); } //if (ShowPrinterLayerProperties(printerLayer) == DialogResult.OK) if (ShowPrinterLayerProperties(printerLayer) == true) { printerInteractiveOverlay.PrinterLayers.Add(printerLayer); Map1.Refresh(); } }
internal void SetProperties(PrinterLayer printerLayer) { ScaleBarPrinterLayer scaleBarPrinterLayer = printerLayer as ScaleBarPrinterLayer; if (scaleBarPrinterLayer != null) { viewModel.Background = scaleBarPrinterLayer.BackgroundMask; viewModel.Color = scaleBarPrinterLayer.BarBrush; viewModel.AlternatingColor = scaleBarPrinterLayer.AlternateBarBrush; switch (scaleBarPrinterLayer.TextStyle.NumericFormat) { case "C": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.Currency; break; case "D": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.Decimal; break; case "E": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.Scientific; break; case "F": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.FixedPoint; break; case "G": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.General; break; case "N": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.Number; break; case "P": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.Percent; break; case "R": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.RoundTrip; break; case "X": viewModel.SelectedNumericFormatType = ScaleNumericFormatType.Hexadecimal; break; case "": default: viewModel.SelectedNumericFormatType = ScaleNumericFormatType.None; break; } viewModel.SelectedUnitSystem = scaleBarPrinterLayer.UnitFamily; viewModel.DragMode = scaleBarPrinterLayer.DragMode; viewModel.ResizeMode = scaleBarPrinterLayer.ResizeMode; } }
private void EditLayer_Click(object sender, RoutedEventArgs e) { PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"]; PrinterLayer printerLayer = (PrinterLayer)((MenuItem)sender).Tag; ShowPrinterLayerProperties(printerLayer); Map1.Refresh(); }
protected override void LoadFromActiveMapCore(PrinterLayer printerlayer) { LegendPrinterLayer legendPrinterLayer = null; if (legendAdornmentLayer != null && (legendPrinterLayer = printerlayer as LegendPrinterLayer) != null) { SetPropertiesInGeneral(legendAdornmentLayer, legendPrinterLayer); } }
private void RemoveLayer_Click(object sender, RoutedEventArgs e) { PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"]; PrinterLayer printerLayer = (PrinterLayer)((MenuItem)sender).Tag; printerInteractiveOverlay.PrinterLayers.Remove(printerLayer); Map1.Refresh(); }
protected override void LoadFromActiveMapCore(PrinterLayer printerLayer) { LabelPrinterLayer labelPrinterLayer = null; if (titleAdornmentLayer != null && (labelPrinterLayer = printerLayer as LabelPrinterLayer) != null) { labelPrinterLayer.Text = titleAdornmentLayer.Title; labelPrinterLayer.TextBrush = titleAdornmentLayer.FontColor; labelPrinterLayer.Font = titleAdornmentLayer.TitleFont; } }
public GridlinesSettingsViewModel(PrinterLayer printerLayer) { units = new Collection <PrintingUnit>(); units.Add(PrintingUnit.Inch); units.Add(PrintingUnit.Centimeter); dashStyles = new Collection <LineDashStyle>(); foreach (LineDashStyle item in Enum.GetValues(typeof(LineDashStyle))) { dashStyles.Add(item); } showGridlines = true; useCellSize = true; GridlinesPrinterLayer gridlinesPrinterLayer = printerLayer as GridlinesPrinterLayer; if (gridlinesPrinterLayer == null) { selectedBrush = new GeoSolidBrush(GeoColor.StandardColors.Gray); selectedDashStyle = LineDashStyle.Dot; rows = 10; columns = 10; penWidth = 1; selectedUnit = PrintingUnit.Inch; left = 1; top = 1; right = 1; bottom = 1; cellHeight = 1; cellWidth = 1; selectedCellUnit = PrintingUnit.Inch; } else { selectedBrush = gridlinesPrinterLayer.DrawingPen.Brush as GeoSolidBrush; selectedDashStyle = gridlinesPrinterLayer.DrawingPen.DashStyle; rows = gridlinesPrinterLayer.Rows; columns = gridlinesPrinterLayer.Columns; penWidth = gridlinesPrinterLayer.DrawingPen.Width; selectedUnit = gridlinesPrinterLayer.MarginUnit; left = gridlinesPrinterLayer.Left; top = gridlinesPrinterLayer.Top; right = gridlinesPrinterLayer.Right; bottom = gridlinesPrinterLayer.Bottom; cellHeight = gridlinesPrinterLayer.CellHeight; cellWidth = gridlinesPrinterLayer.CellWidth; selectedCellUnit = gridlinesPrinterLayer.CellUnit; useCellSize = gridlinesPrinterLayer.UseCellSize; } }
public GridlinesSettingsWindow(PrinterLayer printerLayer) { InitializeComponent(); viewModel = new GridlinesSettingsViewModel(printerLayer); DataContext = viewModel; if (viewModel.UseCellSize) { gridColumns.IsEnabled = false; gridRows.IsEnabled = false; cellWidth.IsEnabled = true; cellHeight.IsEnabled = true; cellUnit.IsEnabled = true; } }
protected override void LoadFromActiveMapCore(PrinterLayer printerLayer) { ScaleLinePrinterLayer scaleLinePrinterLayer = null; if (scaleLineAdornmentLayer != null && (scaleLinePrinterLayer = printerLayer as ScaleLinePrinterLayer) != null) { scaleLinePrinterLayer.MapPrinterLayer = mapPrinterLayer; scaleLinePrinterLayer.MapUnit = scaleLinePrinterLayer.MapPrinterLayer.MapUnit; var backgroundStyle = scaleLineAdornmentLayer.BackgroundMask.CloneDeep() as AreaStyle; if (backgroundStyle != null) { backgroundStyle.SetDrawingLevel(); scaleLinePrinterLayer.BackgroundMask = backgroundStyle; } } }
protected override void LoadFromActiveMapCore(PrinterLayer printerlayer) { ImagePrinterLayer imagePrinterLayer = null; if ((imagePrinterLayer = printerlayer as ImagePrinterLayer) != null) { var logoTool = GisEditor.ActiveMap.MapTools.OfType <AdornmentLogo>().FirstOrDefault(); var northTool = GisEditor.ActiveMap.MapTools.OfType <NorthArrowMapTool>().FirstOrDefault(); if (northTool != null && !string.IsNullOrEmpty(northTool.ImagePath)) { imagePrinterLayer.Image = GetGeoImage(northTool); } else if (logoTool != null && !string.IsNullOrEmpty(logoTool.LogoPath)) { imagePrinterLayer.Image = GetGeoImage(logoTool); } } }
internal void SetProperties(PrinterLayer printerLayer) { DataGridPrinterLayer dataGridPrinterLayer = printerLayer as DataGridPrinterLayer; if (dataGridPrinterLayer != null) { entity.CurrentDataTable = dataGridPrinterLayer.DataTable; dgv.DataSource = entity.CurrentDataTable; entity.FontName = new FontFamily(dataGridPrinterLayer.TextFont.FontName); entity.FontSize = dataGridPrinterLayer.TextFont.Size; entity.FontColor = dataGridPrinterLayer.TextBrush; entity.IsBold = (dataGridPrinterLayer.TextFont.Style & DrawingFontStyles.Bold) == DrawingFontStyles.Bold; entity.IsItalic = (dataGridPrinterLayer.TextFont.Style & DrawingFontStyles.Italic) == DrawingFontStyles.Italic; entity.IsStrikeout = (dataGridPrinterLayer.TextFont.Style & DrawingFontStyles.Strikeout) == DrawingFontStyles.Strikeout; entity.IsUnderline = (dataGridPrinterLayer.TextFont.Style & DrawingFontStyles.Underline) == DrawingFontStyles.Underline; entity.ResizeMode = dataGridPrinterLayer.ResizeMode; entity.DragMode = dataGridPrinterLayer.DragMode; } }
public static PrinterLayerAdapter Create(PrinterLayer printerLayer, SimplifyMapPrinterLayer mapPrinterLayer) { var imagePrinterLayer = printerLayer as ImagePrinterLayer; if (printerLayer is SimplifyMapPrinterLayer) { return(new MapPrinterLayerAdapter(GisEditor.ActiveMap)); } else if (imagePrinterLayer != null) { var northArrow = GisEditor.ActiveMap.MapTools.OfType <NorthArrowMapTool>().FirstOrDefault(); if (northArrow != null) { return(new ImagePrinterLayerAdapter(northArrow)); } else { return(new ImagePrinterLayerAdapter(GisEditor.ActiveMap.MapTools.OfType <AdornmentLogo>().FirstOrDefault())); } } else if (printerLayer is LabelPrinterLayer) { return(new LabelPrinterLayerAdapter(GisEditor.ActiveMap.FixedAdornmentOverlay.Layers.OfType <TitleAdornmentLayer>().FirstOrDefault())); } else if (printerLayer is LegendPrinterLayer) { var legendLayer = GisEditor.ActiveMap.FixedAdornmentOverlay.Layers.OfType <LegendManagerAdornmentLayer>().SelectMany(l => l.LegendLayers.Select(ll => ll.ToLegendAdornmentLayer())).FirstOrDefault(); return(new LegendPrinterLayerAdapter(legendLayer)); } else if (printerLayer is ScaleBarPrinterLayer) { return(new ScaleBarPrinterLayerAdapter(mapPrinterLayer, GisEditor.ActiveMap.FixedAdornmentOverlay.Layers.OfType <ScaleBarAdornmentLayer>().FirstOrDefault())); } else if (printerLayer is ScaleLinePrinterLayer) { return(new ScaleLinePrinterLayerAdapter(mapPrinterLayer, GisEditor.ActiveMap.FixedAdornmentOverlay.Layers.OfType <ScaleLineAdornmentLayer>().FirstOrDefault())); } else { return(new PrinterLayerAdapter()); } }
internal void SetProperties(PrinterLayer printerLayer) { LabelPrinterLayer labelPrinterLayer = printerLayer as LabelPrinterLayer; if (labelPrinterLayer != null) { textViewModel.WrapText = labelPrinterLayer.PrinterWrapMode == PrinterWrapMode.WrapText; textViewModel.Text = labelPrinterLayer.Text; textViewModel.FontName = new FontFamily(labelPrinterLayer.Font.FontName); textViewModel.FontSize = labelPrinterLayer.Font.Size; textViewModel.IsBold = (labelPrinterLayer.Font.Style & DrawingFontStyles.Bold) == DrawingFontStyles.Bold; textViewModel.IsItalic = (labelPrinterLayer.Font.Style & DrawingFontStyles.Italic) == DrawingFontStyles.Italic; textViewModel.IsStrikeout = (labelPrinterLayer.Font.Style & DrawingFontStyles.Strikeout) == DrawingFontStyles.Strikeout; textViewModel.IsUnderline = (labelPrinterLayer.Font.Style & DrawingFontStyles.Underline) == DrawingFontStyles.Underline; textViewModel.FontColor = labelPrinterLayer.TextBrush; textViewModel.DragMode = labelPrinterLayer.DragMode; textViewModel.ResizeMode = labelPrinterLayer.ResizeMode; } }
protected override void LoadFromActiveMapCore(PrinterLayer printerLayer) { ScaleBarPrinterLayer scaleBarPrinterLayer = null; if (scaleBarAdornmentLayer != null && (scaleBarPrinterLayer = printerLayer as ScaleBarPrinterLayer) != null) { scaleBarPrinterLayer.AlternateBarBrush = scaleBarAdornmentLayer.AlternateBarBrush; var backgroundStyle = scaleBarAdornmentLayer.BackgroundMask.CloneDeep() as AreaStyle; if (backgroundStyle != null) { backgroundStyle.SetDrawingLevel(); scaleBarPrinterLayer.BackgroundMask = backgroundStyle; } scaleBarPrinterLayer.BarBrush = scaleBarAdornmentLayer.BarBrush; scaleBarPrinterLayer.TextStyle.NumericFormat = scaleBarAdornmentLayer.TextStyle.NumericFormat; scaleBarPrinterLayer.UnitFamily = scaleBarAdornmentLayer.UnitFamily; scaleBarPrinterLayer.MapPrinterLayer = mapPrinterLayer; scaleBarPrinterLayer.MapUnit = scaleBarPrinterLayer.MapPrinterLayer.MapUnit; } }
private bool?ShowPrinterLayerProperties(PrinterLayer printerLayer) { bool?dialogResult = false; if (printerLayer != null) { if (printerLayer.GetType() == typeof(LabelPrinterLayer)) { LabelPrinterLayerProperty dialog = new LabelPrinterLayerProperty((LabelPrinterLayer)printerLayer); dialog.Owner = Application.Current.MainWindow; dialogResult = dialog.ShowDialog(); } else if (printerLayer.GetType() == typeof(ScaleBarPrinterLayer)) { MessageBox.Show("Scalebar (Coming Soon)"); } else if (printerLayer.GetType() == typeof(ScaleLinePrinterLayer)) { MessageBox.Show("Scaleline (Coming Soon)"); } else if (printerLayer.GetType() == typeof(ImagePrinterLayer)) { ImagePrinterLayerProperty dialog = new ImagePrinterLayerProperty((ImagePrinterLayer)printerLayer); dialog.Owner = Application.Current.MainWindow; dialogResult = dialog.ShowDialog(); } else if (printerLayer.GetType() == typeof(DataGridPrinterLayer)) { DataGridPrinterLayerProperty dialog = new DataGridPrinterLayerProperty((DataGridPrinterLayer)printerLayer); dialog.Owner = Application.Current.MainWindow; dialogResult = dialog.ShowDialog(); } } return(dialogResult); }
public static void SetPosition(AdornmentLocation location, RectangleShape boudingBox, PrinterLayer printerLayer, double width, double height, double left, double top) { switch (location) { case AdornmentLocation.UseOffsets: printerLayer.SetPosition(width, height, 0, 0, PrintingUnit.Inch); break; case AdornmentLocation.UpperLeft: printerLayer.SetPosition(width, height, boudingBox.UpperLeftPoint.X + width * 0.5 + left, boudingBox.UpperLeftPoint.Y - height * 0.5 - top, PrintingUnit.Inch); break; case AdornmentLocation.UpperCenter: printerLayer.SetPosition(width, height, left, boudingBox.UpperLeftPoint.Y - height * 0.5 - top, PrintingUnit.Inch); break; case AdornmentLocation.UpperRight: printerLayer.SetPosition(width, height, boudingBox.UpperRightPoint.X - width * 0.5 + left, boudingBox.UpperLeftPoint.Y - height * 0.5 - top, PrintingUnit.Inch); break; case AdornmentLocation.CenterLeft: printerLayer.SetPosition(width, height, boudingBox.UpperLeftPoint.X + width * 0.5 + left, -top, PrintingUnit.Inch); break; case AdornmentLocation.Center: printerLayer.SetPosition(width, height, left, -top, PrintingUnit.Inch); break; case AdornmentLocation.CenterRight: printerLayer.SetPosition(width, height, boudingBox.UpperRightPoint.X - width * 0.5 + left, -top, PrintingUnit.Inch); break; case AdornmentLocation.LowerLeft: printerLayer.SetPosition(width, height, boudingBox.UpperLeftPoint.X + width * 0.5 + left, boudingBox.LowerLeftPoint.Y + height * 0.5 - top, PrintingUnit.Inch); break; case AdornmentLocation.LowerCenter: printerLayer.SetPosition(width, height, left, boudingBox.LowerLeftPoint.Y + height * 0.5 - top, PrintingUnit.Inch); break; case AdornmentLocation.LowerRight: printerLayer.SetPosition(width, height, boudingBox.UpperRightPoint.X - width * 0.5 + left, boudingBox.LowerLeftPoint.Y + height * 0.5 - top, PrintingUnit.Inch); break; } }
protected virtual void LoadFromActiveMapCore(PrinterLayer printerLayer) { }
public void LoadFromActiveMap(PrinterLayer printerLayer) { LoadFromActiveMapCore(printerLayer); }
internal void SetProperties(PrinterLayer printerLayer) { viewModel.BackgroundStyle = printerLayer.BackgroundMask; viewModel.DragMode = printerLayer.DragMode; viewModel.SelectedUnitSystem = ((ScaleLinePrinterLayer)printerLayer).UnitSystem; }
protected override void LoadFromActiveMapCore(PrinterLayer printerLayer) { SimplifyMapPrinterLayer mapPrinterLayer = null; if (wpfMap != null && (mapPrinterLayer = printerLayer as SimplifyMapPrinterLayer) != null) { if (DoesLoadLayers) { PrinterLayerHelper.AddBaseOverlays(wpfMap, mapPrinterLayer); var allLayers = wpfMap.Overlays.OfType <LayerOverlay>().SelectMany(layerOverlay => layerOverlay.Layers); var allLayerTypes = GisEditor.LayerManager.GetLayerPlugins().Select(layerPlugin => layerPlugin.GetLayerType()); foreach (var layer in allLayers) { if (allLayerTypes.Contains(layer.GetType())) { mapPrinterLayer.Layers.Add(layer); } } var measureOverlay = wpfMap .InteractiveOverlays.OfType <MeasureTrackInteractiveOverlay>().FirstOrDefault(); if (measureOverlay != null && measureOverlay.ShapeLayer.MapShapes.Count > 0) { mapPrinterLayer.Layers.Add(measureOverlay.ShapeLayer); } var annotationOverlay = wpfMap.InteractiveOverlays.OfType <AnnotationTrackInteractiveOverlay>().FirstOrDefault(); if (annotationOverlay != null && annotationOverlay.TrackShapeLayer.InternalFeatures.Count > 0) { annotationOverlay.TrackShapeLayer.Name = "AnnotationLayer"; mapPrinterLayer.Layers.Add(annotationOverlay.TrackShapeLayer); } if (CurrentOverlays.PopupOverlay != null && CurrentOverlays.PopupOverlay.Popups.Count > 0) { var imageByte = GetCroppedMapPopupOverlayPreviewImage(wpfMap, new System.Windows.Int32Rect(0, 0, (int)GisEditor.ActiveMap.RenderSize.Width, (int)GisEditor.ActiveMap.RenderSize.Height)); MemoryRasterLayer layer = new MemoryRasterLayer(new MemoryStream(imageByte)); mapPrinterLayer.Layers.Add(layer); } } mapPrinterLayer.Name = wpfMap.Name; mapPrinterLayer.MapUnit = wpfMap.MapUnit; mapPrinterLayer.DragMode = PrinterDragMode.Draggable; mapPrinterLayer.ResizeMode = PrinterResizeMode.Resizable; mapPrinterLayer.MapExtent = wpfMap.CurrentExtent; //RectangleShape currentMapExtent = GetFixedScaledExtent(boudingBox, wpfMap.CurrentResolution, wpfMap.CurrentExtent); //ResetFixedExtent(mapPrinterLayer, currentMapExtent); mapPrinterLayer.BackgroundMask.Advanced.FillCustomBrush = null; mapPrinterLayer.BackgroundMask.OutlinePen = new GeoPen(GeoColor.StandardColors.Black); var backgroundBrush = wpfMap.BackgroundOverlay.BackgroundBrush as GeoSolidBrush; if (backgroundBrush != null) { mapPrinterLayer.BackgroundMask.FillSolidBrush = backgroundBrush; } else { mapPrinterLayer.BackgroundMask.FillSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Transparent); } mapPrinterLayer.BackgroundMask.SetDrawingLevel(); } }
private static bool IsSimplifyMapPrinterLayer(PrinterLayer printerLayer) { return(printerLayer.GetType().Equals(typeof(SimplifyMapPrinterLayer))); }