コード例 #1
0
        public void List()
        {
            using (BillboardCollectionTest billboardGroup = new BillboardCollectionTest())
            {
                IList<Billboard> group = billboardGroup.Group;

                Assert.AreEqual(0, group.Count);
                Assert.IsFalse(group.IsReadOnly);

                Billboard b0 = new Billboard() { Position = new Vector3D(0, 1, 2) };
                Billboard b1 = new Billboard() { Position = new Vector3D(3, 4, 5) };
                Billboard[] billboards = new Billboard[] { b0, b1 };
                group.Add(b0);
                group.Add(b1);

                Assert.AreEqual(billboards.Length, group.Count);
                Assert.AreEqual(b0, group[0]);
                Assert.AreEqual(0, group.IndexOf(b0));
                Assert.AreEqual(b1, group[1]);
                Assert.AreEqual(1, group.IndexOf(b1));

                int i = 0;
                foreach (Billboard b in group)
                {
                    Assert.AreEqual(billboards[i++], b);
                    Assert.AreEqual(group, b.Group);
                }

                Assert.IsTrue(group.Contains(b0));
                group.Clear();
                Assert.AreEqual(0, group.Count);
                Assert.IsFalse(group.Contains(b0));
            }
        }
コード例 #2
0
        public PointShapefile(
            Shapefile shapefile, 
            Context context, 
            Ellipsoid globeShape,
            ShapefileAppearance appearance)
        {
            Verify.ThrowIfNull(shapefile);
            Verify.ThrowIfNull(context);
            Verify.ThrowIfNull(globeShape);
            Verify.ThrowIfNull(appearance);

            _billboards = new BillboardCollection(context);
            _billboards.Texture = Device.CreateTexture2D(appearance.Bitmap, TextureFormat.RedGreenBlueAlpha8, false);
            
            foreach (Shape shape in shapefile)
            {
                if (shape.ShapeType != ShapeType.Point)
                {
                    throw new NotSupportedException("The type of an individual shape does not match the Shapefile type.");
                }

                Vector2D point = ((PointShape)shape).Position;
                Vector3D position = globeShape.ToVector3D(Trig.ToRadians(new Geodetic3D(point.X, point.Y)));

                Billboard billboard = new Billboard();
                billboard.Position = position;
                _billboards.Add(billboard);
            }
        }
コード例 #3
0
 public void Position()
 {
     Billboard b = new Billboard();
     b.Position = new Vector3D(0, 1, 2);
     Assert.AreEqual(new Vector3D(0, 1, 2), b.Position);
     Assert.IsNull(b.Group);
 }
コード例 #4
0
        public PointShapefile(
            Shapefile shapefile,
            Context context,
            Ellipsoid globeShape,
            ShapefileAppearance appearance)
        {
            Verify.ThrowIfNull(shapefile);
            Verify.ThrowIfNull(context);
            Verify.ThrowIfNull(globeShape);
            Verify.ThrowIfNull(appearance);

            _billboards         = new BillboardCollection(context);
            _billboards.Texture = Device.CreateTexture2D(appearance.Bitmap, TextureFormat.RedGreenBlueAlpha8, false);

            foreach (Shape shape in shapefile)
            {
                if (shape.ShapeType != ShapeType.Point)
                {
                    throw new NotSupportedException("The type of an individual shape does not match the Shapefile type.");
                }

                Vector2D point    = ((PointShape)shape).Position;
                Vector3D position = globeShape.ToVector3D(Trig.ToRadians(new Geodetic3D(point.X, point.Y)));

                Billboard billboard = new Billboard();
                billboard.Position = position;
                _billboards.Add(billboard);
            }
        }
コード例 #5
0
        public void Position()
        {
            Billboard b = new Billboard();

            b.Position = new Vector3D(0, 1, 2);
            Assert.AreEqual(new Vector3D(0, 1, 2), b.Position);
            Assert.IsNull(b.Group);
        }
コード例 #6
0
        public void TextureCoordinates()
        {
            Billboard b = new Billboard();
            Assert.AreEqual(new RectangleH(Vector2H.Zero, new Vector2H(1.0, 1.0)), b.TextureCoordinates);

            b.TextureCoordinates = new RectangleH(new Vector2H(2.0, 3.0), new Vector2H(4.0, 5.0));
            Assert.AreEqual(new RectangleH(new Vector2H(2.0, 3.0), new Vector2H(4.0, 5.0)), b.TextureCoordinates);
        }
コード例 #7
0
        public void Color()
        {
            Billboard b = new Billboard();
            Assert.AreEqual(System.Drawing.Color.White, b.Color);

            b.Color = System.Drawing.Color.Green;
            Assert.AreEqual(System.Drawing.Color.Green, b.Color);
        }
コード例 #8
0
        public void PixelOffset()
        {
            Billboard b = new Billboard();

            Assert.AreEqual(new Vector2H(0, 0), b.PixelOffset);

            b.PixelOffset = new Vector2H(1, 2);
            Assert.AreEqual(new Vector2H(1, 2), b.PixelOffset);
        }
コード例 #9
0
        public void Color()
        {
            Billboard b = new Billboard();

            Assert.AreEqual(System.Drawing.Color.White, b.Color);

            b.Color = System.Drawing.Color.Green;
            Assert.AreEqual(System.Drawing.Color.Green, b.Color);
        }
コード例 #10
0
        public void TextureCoordinates()
        {
            Billboard b = new Billboard();

            Assert.AreEqual(new RectangleH(Vector2H.Zero, new Vector2H(1.0, 1.0)), b.TextureCoordinates);

            b.TextureCoordinates = new RectangleH(new Vector2H(2.0, 3.0), new Vector2H(4.0, 5.0));
            Assert.AreEqual(new RectangleH(new Vector2H(2.0, 3.0), new Vector2H(4.0, 5.0)), b.TextureCoordinates);
        }
コード例 #11
0
 public void AddDuplicate()
 {
     using (BillboardCollectionTest billboardGroup = new BillboardCollectionTest())
     {
         Billboard b = new Billboard() { Position = Vector3D.Zero };
         billboardGroup.Group.Add(b);
         billboardGroup.Group.Add(b);
     }
 }
コード例 #12
0
 public void AddDuplicate()
 {
     using (BillboardCollectionTest billboardGroup = new BillboardCollectionTest())
     {
         Billboard b = new Billboard()
         {
             Position = Vector3D.Zero
         };
         billboardGroup.Group.Add(b);
         billboardGroup.Group.Add(b);
     }
 }
コード例 #13
0
        public void Origin()
        {
            Billboard b = new Billboard();

            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Left;
            Assert.AreEqual(HorizontalOrigin.Left, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Center;
            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Right;
            Assert.AreEqual(HorizontalOrigin.Right, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.VerticalOrigin = VerticalOrigin.Bottom;

            b.HorizontalOrigin = HorizontalOrigin.Left;
            Assert.AreEqual(HorizontalOrigin.Left, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Bottom, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Center;
            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Bottom, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Right;
            Assert.AreEqual(HorizontalOrigin.Right, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Bottom, b.VerticalOrigin);

            b.VerticalOrigin = VerticalOrigin.Top;

            b.HorizontalOrigin = HorizontalOrigin.Left;
            Assert.AreEqual(HorizontalOrigin.Left, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Top, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Center;
            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Top, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Right;
            Assert.AreEqual(HorizontalOrigin.Right, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Top, b.VerticalOrigin);
        }
コード例 #14
0
        public void Remove()
        {
            using (BillboardCollectionTest billboardGroup = new BillboardCollectionTest())
            {
                BillboardCollection group = billboardGroup.Group;
                Billboard           b     = new Billboard()
                {
                    Position = Vector3D.Zero
                };

                group.Add(b);
                Assert.AreEqual(group, b.Group);
                b.Position = Vector3D.UnitX;        // Make billboard dirty;
                Assert.IsTrue(group.Remove(b));
                Assert.IsNull(b.Group);
            }
        }
コード例 #15
0
        public void Origin()
        {
            Billboard b = new Billboard();
            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Left;
            Assert.AreEqual(HorizontalOrigin.Left, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Center;
            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Right;
            Assert.AreEqual(HorizontalOrigin.Right, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Center, b.VerticalOrigin);

            b.VerticalOrigin = VerticalOrigin.Bottom;

            b.HorizontalOrigin = HorizontalOrigin.Left;
            Assert.AreEqual(HorizontalOrigin.Left, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Bottom, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Center;
            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Bottom, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Right;
            Assert.AreEqual(HorizontalOrigin.Right, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Bottom, b.VerticalOrigin);

            b.VerticalOrigin = VerticalOrigin.Top;

            b.HorizontalOrigin = HorizontalOrigin.Left;
            Assert.AreEqual(HorizontalOrigin.Left, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Top, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Center;
            Assert.AreEqual(HorizontalOrigin.Center, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Top, b.VerticalOrigin);

            b.HorizontalOrigin = HorizontalOrigin.Right;
            Assert.AreEqual(HorizontalOrigin.Right, b.HorizontalOrigin);
            Assert.AreEqual(VerticalOrigin.Top, b.VerticalOrigin);
        }
コード例 #16
0
        public void List()
        {
            using (BillboardCollectionTest billboardGroup = new BillboardCollectionTest())
            {
                IList <Billboard> group = billboardGroup.Group;

                Assert.AreEqual(0, group.Count);
                Assert.IsFalse(group.IsReadOnly);

                Billboard b0 = new Billboard()
                {
                    Position = new Vector3D(0, 1, 2)
                };
                Billboard b1 = new Billboard()
                {
                    Position = new Vector3D(3, 4, 5)
                };
                Billboard[] billboards = new Billboard[] { b0, b1 };
                group.Add(b0);
                group.Add(b1);

                Assert.AreEqual(billboards.Length, group.Count);
                Assert.AreEqual(b0, group[0]);
                Assert.AreEqual(0, group.IndexOf(b0));
                Assert.AreEqual(b1, group[1]);
                Assert.AreEqual(1, group.IndexOf(b1));

                int i = 0;
                foreach (Billboard b in group)
                {
                    Assert.AreEqual(billboards[i++], b);
                    Assert.AreEqual(group, b.Group);
                }

                Assert.IsTrue(group.Contains(b0));
                group.Clear();
                Assert.AreEqual(0, group.Count);
                Assert.IsFalse(group.Contains(b0));
            }
        }
コード例 #17
0
        public void Remove()
        {
            using (BillboardCollectionTest billboardGroup = new BillboardCollectionTest())
            {
                BillboardCollection group = billboardGroup.Group;
                Billboard b = new Billboard() { Position = Vector3D.Zero };

                group.Add(b);
                Assert.AreEqual(group, b.Group);
                b.Position = Vector3D.UnitX;        // Make billboard dirty;
                Assert.IsTrue(group.Remove(b));
                Assert.IsNull(b.Group);
            }
        }
コード例 #18
0
        public void PixelOffset()
        {
            Billboard b = new Billboard();
            Assert.AreEqual(new Vector2H(0, 0), b.PixelOffset);

            b.PixelOffset = new Vector2H(1, 2);
            Assert.AreEqual(new Vector2H(1, 2), b.PixelOffset);
        }