Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        private static TileSetJson GetTileSet(BoundingBox3D rootBounds, List <TileInfo> tiles, List <double> geometricErrors)
        {
            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         = "REPLACE",
                transform      = MathUtils.Round(GetRootTransform(rootBounds), 8),
                boundingVolume = boundingVolume
            };

            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 = MathUtils.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);
            }

            root.children = children;
            tileset.root  = root;
            return(tileset);
        }