Example #1
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);
            }
        }
Example #2
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);
            }
        }