コード例 #1
0
        public static LensWarpCorrectionItems FromPrinterSettings(DAL.Hardware.AtumPrinter selectedPrinter)
        {
            if (selectedPrinter.LensWarpingCorrection.HorizontalValues == null)
            {
                selectedPrinter.LensWarpingCorrection.CreateDefaultValues();
            }

            var lensWarpCorrectionItems = new LensWarpCorrectionItems();

            if (selectedPrinter.LensWarpingCorrection != null && selectedPrinter.LensWarpingCorrection.HorizontalValues != null)
            {
                for (var itemRowIndex = 0; itemRowIndex < 8; itemRowIndex++)
                {
                    for (var itemColumnIndex = 0; itemColumnIndex < 8; itemColumnIndex++)
                    {
                        lensWarpCorrectionItems.Add(new LensWarpCorrectionItem()
                        {
                            Number     = (itemRowIndex * 8) + itemColumnIndex + 1,
                            Horizontal = selectedPrinter.LensWarpingCorrection.HorizontalValues[itemRowIndex][itemColumnIndex],
                            Vertical   = selectedPrinter.LensWarpingCorrection.VerticalValues[itemRowIndex][itemColumnIndex],
                        });
                    }
                }
            }

            return(lensWarpCorrectionItems);
        }
コード例 #2
0
        public static void ToPrinterSettings(LensWarpCorrectionItems lensWarpCorrectionItems, DAL.Hardware.AtumPrinter selectedPrinter)
        {
            selectedPrinter.LensWarpingCorrection.HorizontalValues = new List <List <float> >();
            selectedPrinter.LensWarpingCorrection.VerticalValues   = new List <List <float> >();

            for (var itemRowIndex = 0; itemRowIndex < 8; itemRowIndex++)
            {
                var horizontalValues = new List <float>();
                var verticalValues   = new List <float>();

                for (var itemColumnIndex = 0; itemColumnIndex < 8; itemColumnIndex++)
                {
                    var rowIndex = (itemRowIndex * 8) + itemColumnIndex;
                    horizontalValues.Add(lensWarpCorrectionItems[rowIndex].Horizontal);
                    verticalValues.Add(lensWarpCorrectionItems[rowIndex].Vertical);
                }

                selectedPrinter.LensWarpingCorrection.HorizontalValues.Add(horizontalValues);
                selectedPrinter.LensWarpingCorrection.VerticalValues.Add(verticalValues);
            }
        }