示例#1
0
 public MRecipeDeviceLayer()
     : base()
 {
     Tag              = "Layer";
     TileSettings     = new MTileSettings();
     TileDescriptions = new ObservableCollection <MTileDescription>();
 }
示例#2
0
 /// <summary>
 ///		The copy constructor.
 /// </summary>
 private MTileSettings(MTileSettings tileSettingsIn)
     : this()
 {
     XSize     = tileSettingsIn.XSize;
     YSize     = tileSettingsIn.YSize;
     XOffset   = tileSettingsIn.XOffset;
     YOffset   = tileSettingsIn.YOffset;
     XPadding  = tileSettingsIn.XPadding;
     YPadding  = tileSettingsIn.YPadding;
     Extension = tileSettingsIn.Extension;
     Style     = tileSettingsIn.Style;
 }
示例#3
0
        public void GenerateTileDescriptionsFromSettings(GeometryExtents <double> extentsIn)
        {
            TileDescriptions.Clear();

            if (!File.Exists(PatternFilePath))
            {
                return;
            }

            // generate tile
            TileDescriptions = new ObservableCollection <MTileDescription>(
                MTileSettings.ToTiles(TileSettings, extentsIn)
                );
        }
示例#4
0
        /// <summary>
        ///     The copy constructor.
        /// </summary>
        /// <param name="layer"></param>
        private MRecipeDeviceLayer(MRecipeDeviceLayer layer)
            : base(layer)
        {
            PatternFilePath           = string.IsNullOrWhiteSpace(layer.PatternFilePath) ? "" : (string)layer.PatternFilePath.Clone();
            ProcessParametersFilePath = string.IsNullOrWhiteSpace(layer.ProcessParametersFilePath) ? "" : (string)layer.ProcessParametersFilePath.Clone();
            TargetProcessMode         = string.IsNullOrWhiteSpace(layer.TargetProcessMode) ? "" : (string)layer.TargetProcessMode.Clone();
            TileSettings = (MTileSettings)layer.TileSettings.Clone();

            // clone tiles info
            TileDescriptions = new ObservableCollection <MTileDescription>();
            foreach (var tile in layer.TileDescriptions)
            {
                TileDescriptions.Add((MTileDescription)tile.Clone());
            }
        }
示例#5
0
        public static List <MTileDescription> ToTiles(MTileSettings tileSettings, GeometryExtents <double> extents)
        {
            var tiles = new List <MTileDescription>();

            double refWidth  = extents.Width + tileSettings.XPadding;
            double refHeight = extents.Height + tileSettings.YPadding;

            int nRows    = (int)Math.Ceiling(refHeight / tileSettings.YSize);
            int nColumns = (int)Math.Ceiling(refWidth / tileSettings.XSize);

            var _halfTileWidth  = 0.5 * tileSettings.XSize;
            var _halfTileHeight = 0.5 * tileSettings.YSize;
            var _centre         = extents.Centre - new MarkGeometryPoint(0.5 * (nColumns * tileSettings.XSize), 0.5 * (nRows * tileSettings.YSize));

            int counter = 0;

            for (int row = 0; row < nRows; row++)
            {
                for (int col = 0; col < nColumns; col++)
                {
                    var centrePoint = new MarkGeometryPoint(
                        (col * tileSettings.XSize) + _halfTileWidth,
                        (row * tileSettings.YSize) + _halfTileHeight
                        );

                    GeometricArithmeticModule.Translate(centrePoint, _centre.X + tileSettings.XOffset, _centre.Y + tileSettings.YOffset);

                    tiles.Add(
                        new MTileDescription(
                            counter++, centrePoint.X, centrePoint.Y, tileSettings.XSize, tileSettings.YSize
                            )
                        );
                }
            }

            return(tiles);
        }