Пример #1
0
        public void AddThumbnail(Tile tile)
        {
            if (this.maps.Count == 0 || this.Last.Full)
            {
                bool colour = false;

                if (tile.FreeImageType == FREE_IMAGE_TYPE.FIT_BITMAP && tile.ColorDepth >= 24)
                {
                    colour = true;
                }

                if (this.maps.Count != 0)
                {
                    OnMapFilled(new ThumbnailMapCollectionEventArgs(this.Last));
                }

                // Create a new Map Image and add it to the list
                ThumbnailMap map = new ThumbnailMap(this.thumbnailWidth, this.thumbnailHeight, colour);
                this.maps.Add(map);
                OnMapCreated(new ThumbnailMapCollectionEventArgs(map));
            }

            // Add the thumbnail to the MapImage
            if (tile.Thumbnail != null)
            {
                this.Last.AddImage(tile.Thumbnail);
            }
        }
Пример #2
0
        internal override void ReadThumbnails(TileLoadInfo info)
        {
            this.ThreadController.ReportThreadStarted(this, "Loading files");

            ZipEntry zipEntry;

            int totalCount = 0;
            int count = 0;

            ThumbnailMapCollection mapCollection =
                new ThumbnailMapCollection(this.thumbnailWidth, this.thumbnailHeight);

            this.s.Close();
            this.s = new ZipInputStream(File.OpenRead(this.FilePath));

            totalCount = 0;

            try
            {

                // First go through the zip file and get the image maps
                while ((zipEntry = this.s.GetNextEntry()) != null)
                {
                    if (zipEntry.Name.StartsWith("Thumbnail"))
                    {
                        if (this.ThreadController.ThreadAborted)
                            return;

                        count = 0;

                        ThumbnailMap map = new ThumbnailMap(this.thumbnailWidth, this.thumbnailHeight, this.s);

                        Tile tile = null;

                        for (int i = 0; i < map.MapSizeInTiles && totalCount < MosaicWindow.MosaicInfo.Items.Count; i++)
                        {
                            tile = MosaicWindow.MosaicInfo.Items[totalCount];

                            FreeImageAlgorithmsBitmap fib = map.GetImage(count);
                            tile.Thumbnail = fib;

                            if (tile.Thumbnail == null)
                            {
                                throw new Exception("Failed to retrive tumbnail from map");
                            }

                            this.ThreadController.ReportThreadPercentage(this, "Creating Thumbnails",
                                totalCount++, MosaicWindow.MosaicInfo.Items.Count);

                            count++;
                        }

                        map.Dispose();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                FailedToReadFormat = true;
                this.ThreadController.ReportThreadCompleted(this, "Loaded file", false);
                return;
            }

            this.s.Close();
            this.sr.Close();

            info.FreeImageType = MosaicWindow.MosaicInfo.Items[0].FreeImageType;
            info.ColorDepth = MosaicWindow.MosaicInfo.Items[0].ColorDepth;

            this.ThreadController.ReportThreadCompleted(this, "Loaded file", false);
        }
Пример #3
0
        internal override void ReadThumbnails(TileLoadInfo info)
        {
            this.ThreadController.ReportThreadStarted(this, "Loading files");

            ZipEntry zipEntry;

            int totalCount = 0;
            int count      = 0;

            ThumbnailMapCollection mapCollection =
                new ThumbnailMapCollection(this.thumbnailWidth, this.thumbnailHeight);

            this.s.Close();
            this.s = new ZipInputStream(File.OpenRead(this.FilePath));

            totalCount = 0;

            try
            {
                // First go through the zip file and get the image maps
                while ((zipEntry = this.s.GetNextEntry()) != null)
                {
                    if (zipEntry.Name.StartsWith("Thumbnail"))
                    {
                        if (this.ThreadController.ThreadAborted)
                        {
                            return;
                        }

                        count = 0;

                        ThumbnailMap map = new ThumbnailMap(this.thumbnailWidth, this.thumbnailHeight, this.s);

                        Tile tile = null;

                        for (int i = 0; i < map.MapSizeInTiles && totalCount < MosaicWindow.MosaicInfo.Items.Count; i++)
                        {
                            tile = MosaicWindow.MosaicInfo.Items[totalCount];

                            FreeImageAlgorithmsBitmap fib = map.GetImage(count);
                            tile.Thumbnail = fib;

                            if (tile.Thumbnail == null)
                            {
                                throw new Exception("Failed to retrive tumbnail from map");
                            }

                            this.ThreadController.ReportThreadPercentage(this, "Creating Thumbnails",
                                                                         totalCount++, MosaicWindow.MosaicInfo.Items.Count);

                            count++;
                        }

                        map.Dispose();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                FailedToReadFormat = true;
                this.ThreadController.ReportThreadCompleted(this, "Loaded file", false);
                return;
            }

            this.s.Close();
            this.sr.Close();

            info.FreeImageType = MosaicWindow.MosaicInfo.Items[0].FreeImageType;
            info.ColorDepth    = MosaicWindow.MosaicInfo.Items[0].ColorDepth;

            this.ThreadController.ReportThreadCompleted(this, "Loaded file", false);
        }
Пример #4
0
 public void AddMap(ThumbnailMap map)
 {
     this.maps.Add(map);
 }
Пример #5
0
 public ThumbnailMapCollectionEventArgs(ThumbnailMap map)
 {
     this.map = map;
 }
Пример #6
0
 public ThumbnailMapCollectionEventArgs(ThumbnailMap map)
 {
     this.map = map;
 }
Пример #7
0
        public void AddThumbnail(Tile tile)
        {
            if (this.maps.Count == 0 || this.Last.Full)
            {
                bool colour = false;

                if (tile.FreeImageType == FREE_IMAGE_TYPE.FIT_BITMAP && tile.ColorDepth >= 24)
                    colour = true;

                if (this.maps.Count != 0)
                    OnMapFilled(new ThumbnailMapCollectionEventArgs(this.Last));

                // Create a new Map Image and add it to the list
                ThumbnailMap map = new ThumbnailMap(this.thumbnailWidth, this.thumbnailHeight, colour);
                this.maps.Add(map);
                OnMapCreated(new ThumbnailMapCollectionEventArgs(map));
            }

            // Add the thumbnail to the MapImage
            if(tile.Thumbnail != null)
                this.Last.AddImage(tile.Thumbnail);
        }
Пример #8
0
 public void AddMap(ThumbnailMap map)
 {
     this.maps.Add(map);
 }