示例#1
0
        private void AddTile(TileViewModel aTile)
        {
            GeometryModel3D _tileGeometry = new GeometryModel3D();

            _tileGeometry.Geometry     = new MeshGeometry3D();
            _tileGeometry.Material     = this.FTileMaterial;
            _tileGeometry.BackMaterial = this.FBackTileMaterial;

            TileGeometry _tile = new TileGeometry(
                aTile,
                _tileGeometry,
                null,
                this.ViewModel.Structure.IsHighDefenition,
                this.ViewModel.Center);

            this.FTiles.Add(_tile);

            int _tileSize   = JsdTile.GetProfileXSize(aTile.IsHighDefenition);
            int _tileBottom = aTile.TileIsOnRoof ? JsdTile.GetProfileZSize(aTile.IsHighDefenition) : 0;

            foreach (LayerCellViewModel _cell in aTile.ShapeViewModel.Cells)
            {
                if (_cell.LayerCellValue)
                {
                    _tile.AttachCube(_cell.X, _cell.Y, _cell.Z * 2, false, _tileSize, _tileBottom, false);
                }
            }

            //_tile.JoinCubeSides();

            _tile.UpdateTileGeometry();

            this.mgShape.Children.Add(_tileGeometry);
        }
示例#2
0
        private void AddTile(TileViewModel aTile)
        {
            GeometryModel3D _tileGeometry = new GeometryModel3D();

            _tileGeometry.Geometry = new MeshGeometry3D();

            GeometryModel3D _altTileGeometry = new GeometryModel3D();

            _altTileGeometry.Geometry = new MeshGeometry3D();

            if (aTile.IsSelected)
            {
                _tileGeometry.Material        = this.FSelectedTileMaterial;
                _tileGeometry.BackMaterial    = this.FSelectedBackTileMaterial;
                _altTileGeometry.Material     = this.FAltSelectedTileMaterial;
                _altTileGeometry.BackMaterial = this.FAltSelectedTileMaterial;
            }
            else
            {
                _tileGeometry.Material        = this.FTileMaterial;
                _tileGeometry.BackMaterial    = this.FBackTileMaterial;
                _altTileGeometry.Material     = this.FAltTileMaterial;
                _altTileGeometry.BackMaterial = this.FAltTileMaterial;
            }

            TileGeometry _tile = new TileGeometry(
                aTile,
                _tileGeometry,
                _altTileGeometry,
                this.ViewModel.Structure.IsHighDefenition,
                this.ViewModel.Center);

            this.FTiles.Add(_tile);

            int _tileSize   = JsdTile.GetProfileXSize(aTile.IsHighDefenition);
            int _tileBottom = aTile.TileIsOnRoof ? JsdTile.GetProfileZSize(aTile.IsHighDefenition) : 0;

            foreach (LayerCellViewModel _cell in aTile.ShapeViewModel.Cells)
            {
                if (_cell.LayerCellValue)
                {
                    _tile.AddCube(_cell.X, _cell.Y, _cell.Z, _tileSize, _tileBottom);
                    this.ViewModel.FilledPositionCount++;
                }
                _cell.AttachHandler(this, Cell_PropertyChanged);
            }

            _tile.UpdateTileGeometry();

            this.mgShape.Children.Add(_tileGeometry);
            this.mgShape.Children.Add(_altTileGeometry);
        }
示例#3
0
        private void ProcessCell(LayerCellViewModel aCell, TileViewModel aTile)
        {
            TileGeometry _tile       = this.FTiles.Where(x => x.Tile == aTile).SingleOrDefault();
            int          _tileSize   = JsdTile.GetProfileXSize(aTile.IsHighDefenition);
            int          _tileBottom = aTile.TileIsOnRoof ? JsdTile.GetProfileZSize(aTile.IsHighDefenition) : 0;

            if (aCell.LayerCellValue)
            {
                _tile.AddCube(aCell.X, aCell.Y, aCell.Z, _tileSize, _tileBottom);
                this.ViewModel.FilledPositionCount++;
            }
            else
            {
                _tile.RemoveCube(aCell.X, aCell.Y, aCell.Z, _tileSize, _tileBottom);
                this.ViewModel.FilledPositionCount--;
            }

            _tile.UpdateTileGeometry();
        }
示例#4
0
        private void ChangeSelection()
        {
            if (this.ViewModel.ShowSelectedTileOnly)
            {
                ShowSelectedTile();
            }
            else
            {
                if (this.FTiles == null)
                {
                    return;
                }

                TileGeometry _tile = this.FTiles
                                     .Where(x => x.IsSelected)
                                     .SingleOrDefault();

                if (this.FSelectedTile != null)
                {
                    this.FSelectedTile.Geometry.Material        = this.FTileMaterial;
                    this.FSelectedTile.Geometry.BackMaterial    = this.FBackTileMaterial;
                    this.FSelectedTile.AltGeometry.Material     = this.FAltTileMaterial;
                    this.FSelectedTile.AltGeometry.BackMaterial = this.FAltTileMaterial;
                }

                if (_tile != null)
                {
                    _tile.Geometry.Material        = this.FSelectedTileMaterial;
                    _tile.Geometry.BackMaterial    = this.FSelectedBackTileMaterial;
                    _tile.AltGeometry.Material     = this.FAltSelectedTileMaterial;
                    _tile.AltGeometry.BackMaterial = this.FAltSelectedTileMaterial;

                    this.FSelectedTile = _tile;
                }
            }
        }