示例#1
0
        private IEnumerable <GeoModel> createBlock(GeoBlock block)
        {
            float ox, oy, oz;

            if (block.getType() == GEO.GEO_BLOCK_TYPE_FLAT)
            {
                GeoCell cell = block.nGetCell(0, 0, 0);
                //
                float xx = GEO.getWorldX(cell.getGeoX());
                float yy = GEO.getWorldY(cell.getGeoY());
                float zz = GEO.getHeight(cell.getHeight());
                yield return(appendModel(xx, zz, yy, true));
            }
            else if (block.getType() == GEO.GEO_BLOCK_TYPE_COMPLEX)
            {
                GeoModel  m;
                GeoCell   cell;
                GeoCell[] cells = block.getCells();
                int       c     = cells.Length;
                for (int i = 0; i < c; i++)
                {
                    cell = cells[i];
                    ox   = GEO.getWorldX(cell.getGeoX());
                    oz   = GEO.getWorldY(cell.getGeoY());
                    oy   = GEO.getHeight(cell.getHeight());
                    m    = appendModel(ox, oy, oz, false);
                    updateMask(m, cell);
                    yield return(m);
                }
            }
            else if (block.getType() == GEO.GEO_BLOCK_TYPE_MULTILAYER)
            {
                int c = block.getMaxLayerCount();
                //
                GeoModel m;
                int      x, y;
                int      min_x = block.getGeoX();
                int      max_x = block.getMaxGeoX();
                int      min_y = block.getGeoY();
                int      max_y = block.getMaxGeoY();
                for (y = min_y; y <= max_y; y++)
                {
                    for (x = min_x; x <= max_x; x++)
                    {
                        GeoCell[] cells = block.nGetLayers(x, y);
                        foreach (GeoCell cell in cells)
                        {
                            ox = GEO.getWorldX(cell.getGeoX());
                            oz = GEO.getWorldY(cell.getGeoY());
                            oy = GEO.getHeight(cell.getHeight());
                            m  = appendModel(ox, oy, oz, false);
                            updateMask(m, cell);
                            yield return(m);
                        }
                    }
                }
            }
        }