Exemplo n.º 1
0
        public void TestGdiImageLayer1()
        {
            var imageFile = CreateImage(new Size(512, 256));
            GdiImageLayer l = null;
            
            Assert.DoesNotThrow( () => l = new GdiImageLayer(imageFile));

            Assert.NotNull(l);
            Assert.AreEqual(Path.GetFileName(imageFile), l.LayerName);
            var e = new Envelope(0, 512, 0, 256);
            Assert.AreEqual(e, l.Envelope);
            l.Dispose();

            DeleteTmpFiles(imageFile);
        }
Exemplo n.º 2
0
 public void TestTransparency()
 {
     var tmpFile = GdiImageLayerTest.CreateImage(new Size(300, 300), new Point(10, 10));
     using(var l = new GdiImageLayer(tmpFile))
     using (var pl = new GdiImageLayerProxy<GdiImageLayer>(l, 0.3f))
     using (var m = new Map(new Size(450, 450)))
     {
         m.Layers.Add(pl);
         m.ZoomToExtents();
         using (var img = (Bitmap)m.GetMap())
         {
             var color = img.GetPixel(225, 225);
             Assert.LessOrEqual(Math.Abs((int)Math.Round(0.3f*255, MidpointRounding.AwayFromZero) - color.A),1);
         }
     }
     GdiImageLayerTest.DeleteTmpFiles(tmpFile);
 }
Exemplo n.º 3
0
 public void TestColorMap()
 {
     var tmpFile = GdiImageLayerTest.CreateImage(new Size(300, 300), new Point(10, 10));
     using (var l = new GdiImageLayer(tmpFile))
     using (var pl = new GdiImageLayerProxy<GdiImageLayer>(l, new ColorMap{OldColor = Color.Red, NewColor = Color.MistyRose}))
     using (var m = new Map(new Size(450, 450)))
     {
         m.Layers.Add(pl);
         m.ZoomToExtents();
         using (var img = (Bitmap)m.GetMap())
         {
             var color = img.GetPixel(225, 225);
             Assert.AreEqual(Color.MistyRose.ToArgb(), color.ToArgb());
         }
     }
     GdiImageLayerTest.DeleteTmpFiles(tmpFile);
 }
Exemplo n.º 4
0
        public void TestGdiImageLayer2()
        {
            var imageFile = CreateImage(new Size(512, 256), new Point(10, 10));
            GdiImageLayer l = null;

            Assert.DoesNotThrow(() => l = new GdiImageLayer(imageFile));

            Assert.NotNull(l);
            Assert.AreEqual(Path.GetFileName(imageFile), l.LayerName);
            var e = new Envelope(10, 522, 10, 266);
            Assert.AreEqual(e, l.Envelope);
            Assert.AreEqual(0d, l.Transparency);
            l.Dispose();

            DeleteTmpFiles(imageFile);
        }