コード例 #1
0
        private void SetLayerProperties()
        {
            GeoImage image = new GeoImage(txtPath.Text);

            imagePrinterLayer.Image = image;

            imagePrinterLayer.Open();
            PointShape centerPoint = imagePrinterLayer.GetPosition().GetCenterPoint();

            imagePrinterLayer.SetPosition(image.Width, image.Height, centerPoint, PrintingUnit.Point);
        }
コード例 #2
0
        protected override PrinterLayer GetPrinterLayerFromActiveMapCore(RectangleShape boudingBox)
        {
            if ((northArrowMapTool != null && !string.IsNullOrEmpty(northArrowMapTool.ImagePath)) ||
                (adornmentLogo != null && !string.IsNullOrEmpty(adornmentLogo.LogoPath)))
            {
                GeoImage geoImage = null;

                double widthInPixel = 0, heightInPixel = 0;

                if (northArrowMapTool != null && !string.IsNullOrEmpty(northArrowMapTool.ImagePath))
                {
                    geoImage      = GetGeoImage(northArrowMapTool);
                    widthInPixel  = (int)northArrowMapTool.Width;
                    heightInPixel = (int)northArrowMapTool.Height;
                }
                else if (adornmentLogo != null && !string.IsNullOrEmpty(adornmentLogo.LogoPath))
                {
                    geoImage      = GetGeoImage(adornmentLogo);
                    widthInPixel  = (int)adornmentLogo.Width;
                    heightInPixel = (int)adornmentLogo.Height;
                }

                ImagePrinterLayer imagePrinterLayer = new ImagePrinterLayer(geoImage, 0, 0, PrintingUnit.Inch)
                {
                    DrawingExceptionMode = DrawingExceptionMode.DrawException
                };
                imagePrinterLayer.Open();
                AdornmentLocation location          = GetLocation();
                double            width             = PrinterHelper.ConvertLength((double)widthInPixel, PrintingUnit.Point, PrintingUnit.Inch);
                double            height            = PrinterHelper.ConvertLength((double)heightInPixel, PrintingUnit.Point, PrintingUnit.Inch);
                double            left              = 0;
                double            top               = 0;
                if (northArrowMapTool != null)
                {
                    left = PrinterHelper.ConvertLength(northArrowMapTool.Margin.Left, PrintingUnit.Point, PrintingUnit.Inch);
                    top  = PrinterHelper.ConvertLength(northArrowMapTool.Margin.Top, PrintingUnit.Point, PrintingUnit.Inch);
                }
                if (adornmentLogo != null)
                {
                    left = PrinterHelper.ConvertLength(adornmentLogo.Left, PrintingUnit.Point, PrintingUnit.Inch);
                    top  = PrinterHelper.ConvertLength(adornmentLogo.Top, PrintingUnit.Point, PrintingUnit.Inch);
                }
                SetPosition(location, boudingBox, imagePrinterLayer, width, height, left, top);
                return(imagePrinterLayer);
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
        internal static PrinterLayer GetImagePrinterLayer(double width, double height, double centerX, double centerY)
        {
            ImageElementViewModel imageEntity = new ImageElementViewModel();
            GeoImage geoImage = null;

            geoImage = new GeoImage(new MemoryStream(imageEntity.SelectedImage));
            ImagePrinterLayer imagePrinterLayer = new ImagePrinterLayer(geoImage, 0, 0, PrintingUnit.Inch)
            {
                DrawingExceptionMode = DrawingExceptionMode.DrawException
            };

            imagePrinterLayer.LoadFromViewModel(imageEntity);
            var imgWidth  = imagePrinterLayer.Image.Width;
            var imgHeight = imagePrinterLayer.Image.Height;

            imagePrinterLayer.Open();
            imagePrinterLayer.SetPosition(width, height, centerX, centerY, PrintingUnit.Inch);
            return(imagePrinterLayer);
        }