Exemplo n.º 1
0
        public void PasteFromStreamScaledImageToTile(int zoom, double Lon, double Lat, int xTile, int yTile, double scale, Stream stream)
        {
            using (Bitmap iconImage = new Bitmap(stream, false))
            {
                ImageFormat format = iconImage.GetImageFormat();
                //if (format == null) throw new Exception(string.Format("Формат не опознан, len {0}",stream.Length));
                //else throw new Exception(string.Format("Формат {1}, len {0}", stream.Length, format));
                PasteScaledBitmapImageToTileByLatLon(zoom, Lon, Lat, xTile, yTile, scale, iconImage);

            }
        }
Exemplo n.º 2
0
        private void OpenImage()
        {
            using (OpenFileDialog dlgGetImage = new OpenFileDialog())
            {
                dlgGetImage.InitialDirectory = currentProfile.ImageDirectory;
                dlgGetImage.Filter = "All Files(*.*)|*.*|JPEG Files (*.jpg)|*.jpg|PNG Files (*.png)|*.png";

                if (dlgGetImage.ShowDialog() == DialogResult.OK)
                {
                    Bitmap bitmap = new Bitmap(dlgGetImage.FileName);
                    string imgName = dlgGetImage.SafeFileName;
                    string imgFullPath = dlgGetImage.FileName;
                    currentImage = new EditorImage(bitmap, imgName, imgFullPath, bitmap.GetImageFormat());
                    imgBorderHelper = new BorderHelper(currentImage.GetRectangle(), mouseError);
                    txtCurrentImg.Text = currentImage.ImgName;
                    txtImgHeight.Text = currentImage.StartImg.Height.ToString();
                    txtImgWidth.Text = currentImage.StartImg.Width.ToString();
                    btnSelectBoundary.Enabled = true;
                    nudImageSize.Enabled = true;
                    nudImageSize.Value = 0;
                    pbxImage.Image = currentImage.StartImg;
                }
            }
        }