private void ProcessReportSolution(reportSolution rSol)
        {
            // create document
            Document doc = new Document(rSol.reportParameters.name, rSol.reportParameters.description, rSol.reportParameters.author, DateTime.Now, null);
            // load analysis
            CasePalletAnalysis analysis = LoadPalletAnalysis(doc, rSol.solutionRef.analysisId);

            if (null == analysis)
            {
                return;
            }
            // compute solutions
            TreeDim.StackBuilder.Engine.CasePalletSolver solver = new TreeDim.StackBuilder.Engine.CasePalletSolver();
            solver.ProcessAnalysis(analysis);
            // retrieve wanted solution
            List <Basics.CasePalletSolution> solutions = analysis.Solutions;

            if (rSol.solutionRef.index >= solutions.Count)
            {
                throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, rSol.solutionRef.index));
            }
            Basics.CasePalletSolution sol = solutions[(int)rSol.solutionRef.index];
            // selected solution
            SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, sol);
            // generate report
            ReporterMSWord reporter = new ReporterMSWord(new ReportData(analysis, selSolution)
                                                         , rSol.reportParameters.templateFilePath, rSol.reportParameters.outputPath, new Margins());
        }
        private void ProcessAnalysisSolutionList(analysisSolutionList solutionList)
        {
            // load analysis
            CasePalletAnalysis analysis = LoadPalletAnalysis(null, solutionList.analysisId);

            if (solutionList.maxNumberOfSolutionsSpecified)
            {
                analysis.ConstraintSet.NumberOfSolutionsKept = (int)solutionList.maxNumberOfSolutions;
            }
            // compute solutions
            TreeDim.StackBuilder.Engine.CasePalletSolver solver = new TreeDim.StackBuilder.Engine.CasePalletSolver();
            solver.ProcessAnalysis(analysis);
            // instantiate pallet solution list
            PALLETSOLUTIONLIST palletSolutionList = new PALLETSOLUTIONLIST();

            // saves solutions to list
            foreach (CasePalletSolution sol in analysis.Solutions)
            {
                palletSolution xmlPalletSol = new palletSolution();
                xmlPalletSol.title      = sol.Title;
                xmlPalletSol.caseCount  = sol.CaseCount;
                xmlPalletSol.efficiency = sol.VolumeEfficiencyCases;
                xmlPalletSol.weight     = sol.PalletWeight;
                xmlPalletSol.palletDimensions.Add(sol.PalletLength);
                xmlPalletSol.palletDimensions.Add(sol.PalletWidth);
                xmlPalletSol.palletDimensions.Add(sol.PalletHeight);
                xmlPalletSol.homogeneousLayer = sol.HasHomogeneousLayers;

                palletSolutionList.palletSolution.Add(xmlPalletSol);
            }

            palletSolutionList.SaveToFile(solutionList.path);
        }
        private void ProcessViewSolution(viewSolution vSol)
        {
            // instantiate graphics
            Graphics3DImage graphics = InitializeImageFromViewParameters(vSol.viewParameters);
            // load analysis
            CasePalletAnalysis analysis = LoadPalletAnalysis(null, vSol.solutionRef.analysisId);

            // compute solutions
            TreeDim.StackBuilder.Engine.CasePalletSolver solver = new TreeDim.StackBuilder.Engine.CasePalletSolver();
            solver.ProcessAnalysis(analysis);
            // retrieve wanted solution
            List <Basics.CasePalletSolution> solutions = analysis.Solutions;

            if (vSol.solutionRef.index >= solutions.Count)
            {
                throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, vSol.solutionRef.index));
            }
            Basics.CasePalletSolution sol = solutions[(int)vSol.solutionRef.index];
            // display solution
            CasePalletSolutionViewer solViewer = new CasePalletSolutionViewer(sol);

            solViewer.Draw(graphics);
            FinalizeImageFromViewParameters(vSol.viewParameters, graphics);
        }
 private void ProcessViewSolution(viewSolution vSol)
 {
     // instantiate graphics
     Graphics3DImage graphics = InitializeImageFromViewParameters(vSol.viewParameters);
     // load analysis
     CasePalletAnalysis analysis = LoadPalletAnalysis(null, vSol.solutionRef.analysisId);
     // compute solutions
     TreeDim.StackBuilder.Engine.CasePalletSolver solver = new TreeDim.StackBuilder.Engine.CasePalletSolver();
     solver.ProcessAnalysis(analysis);
     // retrieve wanted solution
     List<Basics.CasePalletSolution> solutions = analysis.Solutions;
     if (vSol.solutionRef.index >= solutions.Count)
         throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, vSol.solutionRef.index));
     Basics.CasePalletSolution sol = solutions[(int)vSol.solutionRef.index];
     // display solution
     CasePalletSolutionViewer solViewer = new CasePalletSolutionViewer(sol);
     solViewer.Draw(graphics);
     FinalizeImageFromViewParameters(vSol.viewParameters, graphics);
 }
 private void ProcessReportSolution(reportSolution rSol)
 {
     // create document
     Document doc = new Document(rSol.reportParameters.name, rSol.reportParameters.description, rSol.reportParameters.author, DateTime.Now, null);
     // load analysis
     CasePalletAnalysis analysis = LoadPalletAnalysis(doc, rSol.solutionRef.analysisId);
     if (null == analysis)
         return;
     // compute solutions
     TreeDim.StackBuilder.Engine.CasePalletSolver solver = new TreeDim.StackBuilder.Engine.CasePalletSolver();
     solver.ProcessAnalysis(analysis);
     // retrieve wanted solution
     List<Basics.CasePalletSolution> solutions = analysis.Solutions;
     if (rSol.solutionRef.index >= solutions.Count)
         throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, rSol.solutionRef.index));
     Basics.CasePalletSolution sol = solutions[(int)rSol.solutionRef.index];
     // selected solution
     SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, sol);
     // generate report
     ReporterMSWord reporter = new ReporterMSWord(new ReportData(analysis, selSolution)
         , rSol.reportParameters.templateFilePath, rSol.reportParameters.outputPath, new Margins());
 }
        private void ProcessAnalysisSolutionList(analysisSolutionList solutionList)
        {
            // load analysis
            CasePalletAnalysis analysis = LoadPalletAnalysis(null, solutionList.analysisId);
            if (solutionList.maxNumberOfSolutionsSpecified)
                analysis.ConstraintSet.NumberOfSolutionsKept = (int)solutionList.maxNumberOfSolutions;
            // compute solutions
            TreeDim.StackBuilder.Engine.CasePalletSolver solver = new TreeDim.StackBuilder.Engine.CasePalletSolver();
            solver.ProcessAnalysis(analysis);
            // instantiate pallet solution list
            PALLETSOLUTIONLIST palletSolutionList = new PALLETSOLUTIONLIST();
            // saves solutions to list
            foreach (CasePalletSolution sol in analysis.Solutions)
            {
                palletSolution xmlPalletSol = new palletSolution();
                xmlPalletSol.title = sol.Title;
                xmlPalletSol.caseCount = sol.CaseCount;
                xmlPalletSol.efficiency = sol.VolumeEfficiencyCases;
                xmlPalletSol.weight = sol.PalletWeight;
                xmlPalletSol.palletDimensions.Add(sol.PalletLength);
                xmlPalletSol.palletDimensions.Add(sol.PalletWidth);
                xmlPalletSol.palletDimensions.Add(sol.PalletHeight);
                xmlPalletSol.homogeneousLayer = sol.HasHomogeneousLayers;

                palletSolutionList.palletSolution.Add(xmlPalletSol);
            }

            palletSolutionList.SaveToFile(solutionList.path);
        }