示例#1
0
        // Do Listu prida Elipsu
        public void AddElipse(int x, int y, int x1, int y1, Color penC, Color fillC, float penW, bool colorFilled, bool textureFilled, TextureBrush textura)
        {
            if (x1 - minDim <= x)
            {
                x1 = x + minDim;
            }
            if (y1 - minDim <= y)
            {
                y1 = y + minDim;
            }

            DeSelect();
            Ellipse r = new Ellipse(x, y, x1, y1);

            r.Pero_barva    = penC;
            r.Pero_šířka    = penW;
            r.FillColor     = fillC;
            r.ColorFilled   = colorFilled;
            r.TextureFilled = textureFilled;
            r.FillTexture   = textura;

            List.Add(r);

            StoreDo("I", r);

            sRec   = new SelRect(r);
            selEle = r;
            selEle.Select();
        }
示例#2
0
        // Do Listu prida Jednoduchy text
        public void AddSimpleTextBox(int x, int y, int x1, int y1, RichTextBox t, Color penC, Color fillC, float penW, bool filled, bool textureFilled, TextureBrush textura)
        {
            if (x1 - minDim <= x)
            {
                x1 = x + minDim;
            }
            if (y1 - minDim <= y)
            {
                y1 = y + minDim;
            }

            DeSelect();
            Stext r = new Stext(x, y, x1, y1);

            r.Text     = t.Text;
            r.CharFont = t.SelectionFont;              //t.Font;


            r.Pero_barva    = penC;
            r.Pero_šířka    = penW;
            r.FillColor     = fillC;
            r.ColorFilled   = filled;
            r.TextureFilled = textureFilled;
            r.FillTexture   = textura;

            List.Add(r);

            StoreDo("I", r);

            sRec   = new SelRect(r);
            selEle = r;
            selEle.Select();
        }
示例#3
0
        // Do Listu prida Polygon - vseobecny
        public void AddPoly(int x, int y, int x1, int y1, Color penC, Color fillC, float penW, bool filled, ArrayList aa, bool curv, bool closed, bool textureFilled, TextureBrush textura)
        {
            /*if (x1 - minDim <= x)
             *      x1 = x + minDim;
             * if (y1 - minDim <= y)
             *      y1 = y + minDim;*/

            DeSelect();
            PointSet r = new PointSet(x, y, x1, y1, aa);

            r.Closed        = closed;
            r.Pero_barva    = penC;
            r.Pero_šířka    = penW;
            r.FillColor     = fillC;
            r.ColorFilled   = filled;
            r.Zakřivení     = curv;
            r.TextureFilled = textureFilled;
            r.FillTexture   = textura;

            List.Add(r);
            StoreDo("I", r);             // uloz do undo/redo bufferu

            sRec   = new SelPoly(r);
            selEle = r;
            selEle.Select();
        }
示例#4
0
 // Vybere posledni shape obsahujici souradnice x,y
 public void ClickOnShape(int x, int y, RichTextBox r)
 {
     sRec   = null;
     selEle = null;
     foreach (Ele obj in this.List)
     {
         obj.selected = false;
         obj.DeSelect();
         if (obj.Contains(x, y))
         {
             selEle = obj;                     // ulozi referenci nalezeneho objektu
             // break;
             // nedelej break - pro prekryvajici se objekty beru posledni pridany objekt
         }
     }
     if (selEle != null)
     {
         selEle.selected = true;
         selEle.Select();
         selEle.Select(r);
         // nyni vytvorim uchopovy objekt
         if (selEle is PointSet)
         {
             sRec = new SelPoly(selEle);                     //vytvori uchopovy obdelnik typu polygonovy vyber
         }
         else
         {
             sRec = new SelRect(selEle);                     //vytvori uchopovy obdelnik typu obdelnikovy vyber
         }
     }
 }
示例#5
0
        // Seskupi oznacene objekty
        public void GroupSelected()
        {
            ArrayList tmpList = new ArrayList();

            foreach (Ele elem in List)
            {
                if (elem.selected)
                {
                    tmpList.Add(elem);
                }
            }

            if (selEle != null)
            {
                selEle = null;
                sRec   = null;
            }

            foreach (Ele tmpElem in tmpList)
            {
                List.Remove(tmpElem);
            }

            Group g = new Group(tmpList);

            List.Add(g);

            sRec   = new SelRect(g);
            selEle = g;
            selEle.Select();

            // kdyz seskupuji/rusim seskupeni musim resetovat UndoBuffer
            undoB = new UndoBuffer(20);
        }
示例#6
0
        public void CopyMultiSelected(int dx, int dy)
        {
            ArrayList tmpList = new ArrayList();

            foreach (Ele elem in List)
            {
                if (elem.selected)
                {
                    Ele eL = elem.Copy();
                    elem.selected = false;
                    eL.Move(dx, dy);
                    tmpList.Add(eL);
                    //
                    sRec   = new SelRect(eL);
                    selEle = eL;
                    selEle.EndMoveRedim();
                }
            }
            foreach (Ele tmpElem in tmpList)
            {
                List.Add(tmpElem);
                // Uloz operaci do undo/redo bufferu
                StoreDo("I", tmpElem);
            }
        }
示例#7
0
 // Zrus vyber vsech elementu
 public void DeSelect()
 {
     foreach (Ele obj in List)
     {
         obj.selected = false;
     }
     selEle = null;
     sRec   = null;
 }
示例#8
0
 public void AddPoint()
 {
     if (sRec is SelPoly)
     {
         PointWrapper p = ((SelPoly)sRec).GetNewPoint();
         int          i = ((SelPoly)this.sRec).GetIndex();
         if (i > 0)
         {
             ((PointSet)this.selEle).points.Insert(i - 1, p);
             sRec = new SelPoly(selEle);                    // vytvori uchopovy obdelnik
         }
     }
 }
示例#9
0
        // Do Listu prida Caru
        public void AddLine(int x, int y, int x1, int y1, Color penC, float penW)
        {
            DeSelect();
            Line r = new Line(x, y, x1, y1);

            r.Pero_barva = penC;
            r.Pero_šířka = penW;

            List.Add(r);
            StoreDo("I", r);
            sRec = new SelRect(r);

            selEle = r;
            selEle.Select();
        }
示例#10
0
 // Vybere vsechny elementy (objekty) ve Vyberovem obdelniku
 public void MultiSelect(int startX, int startY, int endX, int endY, RichTextBox r)
 {
     sRec   = null;
     selEle = null;
     foreach (Ele obj in List)
     {
         obj.selected = false;
         obj.DeSelect();                  // pouziti pro deselekci bodu v polygonech
         int x  = obj.GetX;
         int x1 = obj.GetX1;
         int y  = obj.GetY;
         int y1 = obj.GetY1;
         int c  = 0;
         if (x > x1)
         {
             c  = x;
             x  = x1;
             x1 = c;
         }
         if (y > y1)
         {
             c  = y;
             y  = y1;
             y1 = c;
         }
         if (x <= endX & x1 >= startX & y <= endY & y1 >= startY)
         {
             selEle       = obj;               //ulozi referenci nalezeneho objektu
             obj.selected = true;              //oznaci objekt jako vybrany
             obj.Select();
             obj.Select(r);
             obj.Select(startX, startY, endX, endY);
         }
     }
     if (selEle != null)
     {
         if (selEle is PointSet)
         {
             sRec = new SelPoly(selEle);                    //vytvori uchopovy obdelnik typu polygonovy vyber
         }
         else
         {
             sRec = new SelRect(selEle);                    //vytvori uchopovy obdelnik typu obdlenikovy vyber
         }
     }
 }
示例#11
0
        // Kopiruje oznaceny objekt, oznaci ho jako vybrany
        public void CopySelected(int dx, int dy)
        {
            if (selEle != null)
            {
                Ele L = CpSelected();
                L.Move(dx, dy);
                DeSelect();
                List.Add(L);

                // uklada operaci do undo/redo bufferu
                StoreDo("I", L);

                sRec = new SelRect(L);
                //sRec.sonoUnaLinea = L.sonoUnaLinea;
                selEle = L;
                selEle.EndMoveRedim();
            }
        }
示例#12
0
        // Rozlozi skupinu elementu
        public void DeGroupSelected()
        {
            ArrayList tmpList = new ArrayList();

            foreach (Ele elem in List)
            {
                if (elem.selected)
                {
                    tmpList.Add(elem);
                }
            }

            if (selEle != null)
            {
                selEle = null;
                sRec   = null;
            }
            bool found = false;

            foreach (Ele tmpElem in tmpList)
            {
                ArrayList tmpL = tmpElem.DeGroup();

                if (tmpL != null)
                {
                    foreach (Ele e1 in tmpL)
                    {
                        List.Add(e1);
                    }
                    List.Remove(tmpElem);
                    found = true;
                }
            }
            if (found)
            {
                // kdyyz seskupuji / rozkladam Group musim resetovat UndoBuffer
                undoB = new UndoBuffer(20);
            }
        }
示例#13
0
        // Do Listu prida ImageBox - obrazek = zahradni prvek
        public void AddImageBox(int x, int y, int x1, int y1, string st, Color penC, float penW)
        {
            if (x1 - (minDim * 10) <= x)
            {
                x1 = x + (minDim * 10);
            }
            if (y1 - (minDim + 10) <= y)
            {
                y1 = y + (minDim * 10);
            }

            DeSelect();
            ImageBox r = new ImageBox(x, y, x1, y1);

            r.Pero_barva = penC;
            r.Pero_šířka = penW;

            List.Add(r);

            StoreDo("I", r);

            if (!(st == null))
            {
                try
                {
                    Bitmap loadTexture = new Bitmap(st);
                    r.Prvek = loadTexture;
                }
                catch { }
            }


            sRec   = new SelRect(r);
            selEle = r;
            selEle.Select();
        }
示例#14
0
        // Smaze vybrany objekt
        public void RmSelected()
        {
            ArrayList tmpList = new ArrayList();

            foreach (Ele elem in List)
            {
                if (elem.selected)
                {
                    tmpList.Add(elem);
                }
            }

            if (selEle != null)
            {
                selEle = null;
                sRec   = null;
            }

            foreach (Ele tmpElem in tmpList)
            {
                List.Remove(tmpElem);
                StoreDo("D", tmpElem);
            }
        }