Esempio n. 1
0
        public static TileSetJson GetTileSet(BoundingBox3D rootBounds, List <TileInfo> tiles, List <double> geometricErrors, string refine)
        {
            var tileset  = GetRootTileSet(rootBounds, geometricErrors, refine);
            var centroid = rootBounds.GetCenter();
            var children = new List <Child>();

            foreach (var tile in tiles)
            {
                var child = new Child();
                child.geometricError = geometricErrors[1];
                child.content        = new Content()
                {
                    uri = tile.Filename
                };
                var tileTransform = tile.GetTransform(centroid);
                child.transform = DoubleArrayRounder.Round(tileTransform, 8);
                var tileBounds = tile.Bounds;
                var bbChild    = new Boundingvolume();
                bbChild.box          = new double[] { 0, 0, 0, tileBounds.ExtentX() / 2, 0.0, 0.0, 0.0, tileBounds.ExtentY() / 2, 0.0, 0.0, 0.0, tileBounds.ExtentZ() / 2 };
                child.boundingVolume = bbChild;
                children.Add(child);
            }

            tileset.root.children = children;
            return(tileset);
        }
Esempio n. 2
0
        public static TileSetJson GetRootTileSet(BoundingBox3D rootBounds, List <double> geometricErrors, string refine)
        {
            var extent_x = rootBounds.ExtentX();
            var extent_y = rootBounds.ExtentY();
            var extent_z = 100;

            var tileset = new TileSetJson
            {
                asset = new Asset()
                {
                    version = "1.0", generator = "i3dm.export"
                }
            };

            var box = new double[] { 0, 0, 0, extent_x / 2, 0.0, 0.0, 0.0, extent_y / 2, 0.0, 0.0, 0.0, extent_z };

            var boundingVolume = new Boundingvolume
            {
                box = box
            };

            var root = new Root
            {
                geometricError = geometricErrors[0],
                refine         = refine,
                transform      = DoubleArrayRounder.Round(GetRootTransform(rootBounds), 8),
                boundingVolume = boundingVolume
            };

            tileset.root = root;
            return(tileset);
        }
Esempio n. 3
0
        public void FirstDoubleArrayRoundTests()
        {
            // arrange
            var arr = new double[2] {
                1.111222, 2.49999
            };
            var expectedResult = new double[2] {
                1.11, 2.50
            };

            // act
            var actualResult = DoubleArrayRounder.Round(arr, 2);

            // assert
            Assert.IsTrue(expectedResult[0].Equals(actualResult[0]));
            Assert.IsTrue(expectedResult[1].Equals(actualResult[1]));
        }