Пример #1
0
        protected virtual void OnOnProcessImageHandler(CubeImage cubeimage, string PanoId)
        {
            ProcessImage handler = OnProcessImageHandler;

            if (handler != null)
            {
                handler(cubeimage, PanoId);
            }
        }
Пример #2
0
        public void GenerateFile(SceneItem item, string scenePath, int max, int maxZoom)
        {
            GC.Collect();
            CubeImage cubeImage  = item.CubeImages[maxZoom - 1];
            int       otherWidth = int.Parse(cubeImage.TiledImageWidth) % item.Tilesize;

            for (int d = 0; d < directory.Length; d++)
            {
                if (File.Exists(Path.Combine(scenePath, directory[d] + ".jpg")))
                {
                    continue;
                }
                using (var image = new Bitmap(int.Parse(cubeImage.TiledImageWidth), int.Parse(cubeImage.TiledImageHeight)))
                {
                    using (Graphics g = Graphics.FromImage(image))
                    {
                        g.SmoothingMode = SmoothingMode.AntiAlias;

                        for (int i = 1; i < max; i++)
                        {
                            for (int j = 1; j < max; j++)
                            {
                                using (
                                    var img =
                                        Image.FromFile(Path.Combine(scenePath, cubeImage.Level.ToString(),
                                                                    string.Format("{2}{0}_{1}.jpg", i, j, directory[d]))))
                                {
                                    g.DrawImage(img, item.Tilesize * (j - 1), item.Tilesize * (i - 1),
                                                j != max - 1 ? item.Tilesize : otherWidth,
                                                i != max - 1 ? item.Tilesize : otherWidth);
                                }
                            }
                        }
                    }
                    try
                    {
                        if (directory[d] == 'u')
                        {
                            image.Save(Path.Combine(scenePath, directory[d] + "1.jpg"), ImageFormat.Jpeg);
                            image.RotateFlip(RotateFlipType.Rotate90FlipXY);
                        }
                        if (directory[d] == 'd')
                        {
                            image.Save(Path.Combine(scenePath, directory[d] + "1.jpg"), ImageFormat.Jpeg);
                            image.RotateFlip(RotateFlipType.Rotate270FlipXY);
                        }
                    }
                    catch (Exception e)
                    {
                        OnOnError(e);
                    }
                    image.Save(Path.Combine(scenePath, directory[d] + ".jpg"), ImageFormat.Jpeg);
                }
            }
        }
Пример #3
0
 private void tooYun720_OnProcessImageHandler(CubeImage cubeImage, string panId)
 {
     this.BeginInvoke(
         new MethodInvoker(
             () =>
     {
         if (!this.IsDisposed)
         {
             this.toolStripStatusLabel1.Text = string.Format("正在处理{0}第{1}数据", panId, cubeImage.Level);
         }
     }
             ));
 }