예제 #1
0
        public void Remove(T data)
        {
            IEnumerator enumerator = this.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Prvek item = enumerator.Current as Prvek;
                if (item.data.CompareTo(data) == 0)
                {
                    if (item == prvni && prvni.dalsi != null)
                    {
                        item.dalsi.predchozi = null;
                        prvni = item.dalsi;
                        Count--;
                    }
                    else if (item == prvni && prvni.dalsi == null)
                    {
                        prvni = null;
                    }
                    else if (item == posledni)
                    {
                        item.predchozi.dalsi = null;
                        posledni             = item.predchozi;
                        Count--;
                    }
                    else
                    {
                        item.predchozi.dalsi = item.dalsi;
                        item.dalsi.predchozi = item.predchozi;
                        Count--;
                    }
                }
            }
        }
예제 #2
0
        public override void Draw(Graphics g, int dx, int dy, float zoom)
        {
            Pen myPen = new Pen(Pero_barva, ScaledPenWidth(zoom));

            myPen.DashStyle = DashStyleMy;

            if (selected)
            {
                myPen.Color = Color.Red;
                myPen.Color = Transparency(myPen.Color, 120);
                myPen.Width = myPen.Width + 1;
            }

            if (Prvek != null)
            {
                Color backColor = Prvek.GetPixel(0, 0); //Vezme barvu pozadi z prvniho pixelu obrazku (horni-levy roh)
                //Vytvori tmp Bitmapu a tim i Graphics object
                //Rozmer tmp Bitmapy musi dovolit rotaci obrazku
                int dim = (int)Math.Sqrt(Prvek.Width * Prvek.Width + Prvek.Height * Prvek.Height);

                Bitmap curBitmap = new Bitmap(dim, dim);
                //Bitmap curBitmap = new Bitmap(Img.Width, Img.Height);

                Graphics curG = Graphics.FromImage(curBitmap);

                if (Rotace > 0)
                {
                    // aktivuje rotaci na grafickem objektu
                    Matrix mX = new Matrix();

                    mX.RotateAt(Rotace, new PointF(curBitmap.Width / 2, curBitmap.Height / 2));

                    //mX.RotateAt(Rotation, new PointF(((X1-X)*zoom)/2, ((Y1-Y)*zoom/2)));
                    curG.Transform = mX;
                    mX.Dispose();
                }


                // Kreslim img pres tmp Bitmapu
                curG.DrawImage(Prvek, (dim - Prvek.Width) / 2, (dim - Prvek.Height) / 2, Prvek.Width, Prvek.Height);

                // Zmena pruhllednosti obrazku .....
                curBitmap = ChangeOpacity(curBitmap, (Průhlednost / 100));

                curG.Save();
                // zde kreslim tmp Bitmapu na platno - to je to this
                g.DrawImage(curBitmap, (this.X + dx) * zoom, (Y + dy) * zoom, (X1 - this.X) * zoom, (Y1 - Y) * zoom);
                curG.Dispose();
                curBitmap.Dispose();
            }

            if (Ohraničení)
            {
                g.DrawRectangle(myPen, (this.X + dx) * zoom, (Y + dy) * zoom, (X1 - this.X) * zoom, (Y1 - Y) * zoom);
            }

            myPen.Dispose();
        }
예제 #3
0
 public void Add(T data, LinkedList <T> list)
 {
     if (dalsi == null)
     {
         dalsi = new Prvek(data)
         {
             predchozi = this
         };
         list.posledni = dalsi;
         list.Count++;
     }
     else
     {
         dalsi.Add(data, list);
     }
 }
예제 #4
0
 public void Add(T data)
 {
     if (prvni == null)
     {
         prvni = new Prvek(data)
         {
             predchozi = null
         };
         posledni = prvni;
         Count++;
     }
     else
     {
         prvni.Add(data, this);
     }
 }
예제 #5
0
 public bool MoveNext()
 {
     if (prvek == null && list.prvni != null)
     {
         prvek = list.prvni;
         return(true);
     }
     else if (list.prvni == null)
     {
         return(false);
     }
     else
     {
         if (prvek.dalsi != null)
         {
             prvek = prvek.dalsi;
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #6
0
 public Prvek(T data)
 {
     this.data = data;
     dalsi     = null;
 }
예제 #7
0
 public LinkedList()
 {
     prvni    = null;
     posledni = null;
 }
예제 #8
0
 public Enumerator(LinkedList <T> list)
 {
     this.list = list;
     prvek     = null;
 }