public void TestExportJpegAutoDpi1()
        {
            MapDisplay mapDisplay       = new MapDisplay();
            string     filename         = TestUtil.GetTestFile(@"routegadget\exportjpeg2.jpg");
            string     filenameBaseline = TestUtil.GetTestFile(@"routegadget\exportjpeg2_baseline.png");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\SampleEvent.ocd"));
            mapDisplay.AntiAlias    = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());

            exporter.CreateBitmapAutoDpi(filename, RectangleF.FromLTRB(0F, 70F, 300F, 200F), ImageFormat.Jpeg, 1700, 100, 200);

            Assert.IsFalse(mapDisplay.AntiAlias);
            Assert.AreEqual(0.3F, mapDisplay.MapIntensity);

            Bitmap bmLoaded = (Bitmap)Image.FromFile(filename);

            Assert.AreEqual(140F, bmLoaded.VerticalResolution);
            Assert.AreEqual(140F, bmLoaded.HorizontalResolution);

            TestUtil.CompareBitmapBaseline(bmLoaded, filenameBaseline);
            bmLoaded.Dispose();
            File.Delete(filename);
        }
        public void TestExportWorldFile()
        {
            MapDisplay mapDisplay        = new MapDisplay();
            string     filename          = TestUtil.GetTestFile(@"routegadget\exportgif2.gif");
            string     worldfile         = TestUtil.GetTestFile(@"routegadget\exportgif2.gfw");
            string     filenameBaseline  = TestUtil.GetTestFile(@"routegadget\exportgif2_baseline.png");
            string     worldfileBaseline = TestUtil.GetTestFile(@"routegadget\exportgif2.gfw.expected");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\GRC-Jan2017.ocd"));
            mapDisplay.AntiAlias    = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());

            exporter.CreateBitmap(filename, RectangleF.FromLTRB(-43.78F, 201.04F, 168.46F, 418.32F), ImageFormat.Gif, 200F, mapDisplay.CoordinateMapper);

            Assert.IsFalse(mapDisplay.AntiAlias);
            Assert.AreEqual(0.3F, mapDisplay.MapIntensity);

            Bitmap bmLoaded = (Bitmap)Image.FromFile(filename);

            TestUtil.CompareBitmapBaseline(bmLoaded, filenameBaseline);
            bmLoaded.Dispose();

            TestUtil.CompareTextFileBaseline(worldfile, worldfileBaseline);

            File.Delete(filename);
            File.Delete(worldfile);
        }
        // This is just to compare file sizes/quality of GIF vs. JPG.
        // [TestMethod]
        public void CompareFiles()
        {
            MapDisplay mapDisplay = new MapDisplay();
            string filenameJpeg = TestUtil.GetTestFile(@"routegadget\exporttest.jpg");
            string filenameGif = TestUtil.GetTestFile(@"routegadget\exporttest.gif");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\salmon_la_sac-20090625.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());
            exporter.CreateBitmap(filenameJpeg, RectangleF.FromLTRB(-90F, 10F, 60F, 105F), ImageFormat.Jpeg, 200F);
            exporter.CreateBitmap(filenameGif, RectangleF.FromLTRB(-90F, 10F, 60F, 105F), ImageFormat.Gif, 200F);
        }
        // This is just to compare file sizes/quality of GIF vs. JPG.
        // [TestMethod]
        public void CompareFiles()
        {
            MapDisplay mapDisplay   = new MapDisplay();
            string     filenameJpeg = TestUtil.GetTestFile(@"routegadget\exporttest.jpg");
            string     filenameGif  = TestUtil.GetTestFile(@"routegadget\exporttest.gif");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\salmon_la_sac-20090625.ocd"));
            mapDisplay.AntiAlias    = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());

            exporter.CreateBitmap(filenameJpeg, RectangleF.FromLTRB(-90F, 10F, 60F, 105F), ImageFormat.Jpeg, 200F, null);
            exporter.CreateBitmap(filenameGif, RectangleF.FromLTRB(-90F, 10F, 60F, 105F), ImageFormat.Gif, 200F, null);
        }
        public void TestExportGif()
        {
            MapDisplay mapDisplay       = new MapDisplay();
            string     filename         = TestUtil.GetTestFile(@"routegadget\exportgif1.gif");
            string     filenameBaseline = TestUtil.GetTestFile(@"routegadget\exportgif1_baseline.png");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\SampleEvent.ocd"));
            mapDisplay.AntiAlias    = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());

            exporter.CreateBitmap(filename, RectangleF.FromLTRB(0F, 70F, 300F, 400F), ImageFormat.Gif, 200F, null);

            Assert.IsFalse(mapDisplay.AntiAlias);
            Assert.AreEqual(0.3F, mapDisplay.MapIntensity);

            Bitmap bmLoaded = (Bitmap)Image.FromFile(filename);

            TestUtil.CompareBitmapBaseline(bmLoaded, filenameBaseline);
            bmLoaded.Dispose();
            File.Delete(filename);
        }
        public void TestExportJpegAutoDpi3()
        {
            MapDisplay mapDisplay = new MapDisplay();
            string filename = TestUtil.GetTestFile(@"routegadget\exportjpeg4.jpg");
            string filenameBaseline = TestUtil.GetTestFile(@"routegadget\exportjpeg4_baseline.png");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\SampleEvent.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());
            exporter.CreateBitmapAutoDpi(filename, RectangleF.FromLTRB(0F, 70F, 600F, 600F), ImageFormat.Jpeg, 1700, 100, 200);

            Assert.IsFalse(mapDisplay.AntiAlias);
            Assert.AreEqual(0.3F, mapDisplay.MapIntensity);

            Bitmap bmLoaded = (Bitmap)Image.FromFile(filename);
            Assert.AreEqual(100F, bmLoaded.VerticalResolution);
            Assert.AreEqual(100F, bmLoaded.HorizontalResolution);

            TestUtil.CompareBitmapBaseline(bmLoaded, filenameBaseline);
            bmLoaded.Dispose();
            File.Delete(filename);
        }
        public void TestExportGif()
        {
            MapDisplay mapDisplay = new MapDisplay();
            string filename = TestUtil.GetTestFile(@"routegadget\exportgif1.gif");
            string filenameBaseline = TestUtil.GetTestFile(@"routegadget\exportgif1_baseline.png");

            mapDisplay.SetMapFile(MapType.OCAD, TestUtil.GetTestFile(@"routegadget\SampleEvent.ocd"));
            mapDisplay.AntiAlias = false;
            mapDisplay.MapIntensity = 0.3F;

            ExportBitmap exporter = new ExportBitmap(mapDisplay.Clone());
            exporter.CreateBitmap(filename, RectangleF.FromLTRB(0F, 70F, 300F, 400F), ImageFormat.Gif, 200F);

            Assert.IsFalse(mapDisplay.AntiAlias);
            Assert.AreEqual(0.3F, mapDisplay.MapIntensity);

            Bitmap bmLoaded = (Bitmap) Image.FromFile(filename);

            TestUtil.CompareBitmapBaseline(bmLoaded, filenameBaseline);
            bmLoaded.Dispose();
            File.Delete(filename);
        }