Beispiel #1
0
        private static ResultData DoesCurrentListFitPreDefFigs2(List <int> figInd, List <double> scaleCoefs, List <int> w, List <int> h)
        {
            if (IsPosBad(figInd))
            {
                return(null);
            }

            if (IsPosGood(figInd))
            {
                return(new ResultData());
            }

            ResultData res = PrologServer.GetAnyResult(w, h, scaleCoefs, figInd);

            if (res == null)
            {
                AddBadPos(figInd);
                return(null);
            }

            AddGoodPos(figInd);
            Console.WriteLine(res);
            //res.SetLstInfo(w.FindLast(), newH, scaleCoefs[0]);

            return(res);
        }
Beispiel #2
0
        private static ResultData DoesCurrentListFitPreDefFigs2(List <int> figInd, List <double> scaleCoefs, int w, int h)
        {
            int        newW = (int)(w * scaleCoefs[0]);
            int        newH = (int)(h * scaleCoefs[0]);
            ResultData res  = PrologServer.GetAnyResult(newW, newH, scaleCoefs[0], figInd);

            if (res == null)
            {
                return(null);
            }
            Console.WriteLine(res);
            res.SetLstInfo(newW, newH, scaleCoefs[0]);
            for (int i = 1; i < scaleCoefs.Count; i++)
            {
                newW = (int)(w * scaleCoefs[i]);
                newH = (int)(h * scaleCoefs[i]);
                res  = PrologServer.GetAnyResult(newW, newH, scaleCoefs[i], res, figInd);
                if (res == null)
                {
                    return(null);
                }
                Console.WriteLine(res);
                res.SetLstInfo(newW, newH, scaleCoefs[i]);
            }

            return(res);
        }
Beispiel #3
0
        public static List <ResultData> PlacePreDefinedArrangement(List <List <int> > arrangement, int w, int h, double scale)
        {
            List <ResultData> results = new List <ResultData>();

            foreach (List <int> figInd in arrangement)
            {
                var res = PrologServer.GetAnyResult(w, h, scale, figInd);//GetAnyResult(curLst, w, h);
                if (res == null)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error: can't fit figures with given arrangement");
                    Console.ResetColor();
                    return(null);
                }
                else
                {
                    results.Add(res);
                }
            }
            return(results);
        }