示例#1
0
 public lisc(int D, int T, punkt p)
 {
     d       = D;
     typ     = T;
     punkcik = p;
     lewy    = null;
     prawy   = null;
 }
示例#2
0
        static void Main(string[] args)
        {
            var    s  = new FileInfo(Directory.GetCurrentDirectory());
            var    s2 = s.Directory.Parent.Parent;
            String s3 = s2.ToString() + "\\dane.csv";

            List <punkt> punktyX = new List <punkt>();
            List <punkt> punktyY = new List <punkt>();
            punkt        dodawany;

            using (var reader = new StreamReader(s3))
            {
                while (!reader.EndOfStream)
                {
                    var line   = reader.ReadLine();
                    var values = line.Split(',');

                    dodawany = new punkt(Convert.ToInt32(values[0]), Convert.ToInt32(values[1]));
                    punktyX.Add(dodawany);
                    punktyY.Add(dodawany);
                }
            }

            foreach (punkt p in punktyX)
            {
                p.napisz();
            }

            punktyX.Sort((a, b) => (a.porownajX(b)));
            punktyY.Sort((a, b) => (a.porownajY(b)));
            lisc kozen = buduj(punktyX, punktyY, 0);
            //kozen.napisz();

            int x1;
            int x2;
            int y1;
            int y2;

            Console.WriteLine("Podaj dolną granicę zakresu na osi X");
            x1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Podaj górną granicę zakresu na osi X");
            x2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Podaj dolną granicę zakresu na osi Y");
            y1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Podaj górną granicę zakresu na osi Y");
            y2 = Convert.ToInt32(Console.ReadLine());

            zapytanie(kozen, x1, x2, y1, y2);

            Console.ReadKey();
        }
示例#3
0
 public int porownajY(punkt a)
 {
     if (y < a.dajY())
     {
         return(-1);
     }
     else if (y > a.dajY())
     {
         return(1);
     }
     else if (x > a.dajX())
     {
         return(1);
     }
     else
     {
         return(-1);
     }
 }