Exemple #1
0
 public void SelectMore(BaseRailEle obj)
 {
     if (obj != null)
     {
         selectedDrawObjectList.Add(obj);
     }
 }
Exemple #2
0
 public void SelectOne(BaseRailEle obj)
 {
     selectedDrawObjectList.Clear();
     if (obj != null)
     {
         selectedDrawObjectList.Add(obj);
     }
 }
Exemple #3
0
 public void Paste(string str)
 {
     if (CutAndCopyObjectList.Count > 0)
     {
         if (_CutOrCopy == CutOrCopy.CutOp)
         {
             int n = selectedDrawObjectList.Count;
             foreach (BaseRailEle obj in selectedDrawObjectList)
             {
                 drawObjectList.Remove(obj);
             }
         }
         else if (_CutOrCopy == CutOrCopy.CopyOp)
         {
             BaseRailEle o = CutAndCopyObjectList[0];
             if (1 == o.GraphType)
             {
                 StraightRailEle cl = (StraightRailEle)o;
                 StraightRailEle n  = (StraightRailEle)cl.Clone(str);
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             else if (2 == o.GraphType)
             {
                 CurvedRailEle cl = (CurvedRailEle)o;
                 CurvedRailEle n  = (CurvedRailEle)cl.Clone(str);
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             else if (3 == o.GraphType)
             {
                 CrossEle cl = (CrossEle)o;
                 CrossEle n  = (CrossEle)cl.Clone(str);
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             else if (4 == o.GraphType)
             {
                 RailLabal cl = (RailLabal)o;
                 RailLabal n  = (RailLabal)cl.Clone();
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             CutAndCopyObjectList.RemoveAt(0);
         }
     }
 }
Exemple #4
0
        public override int HitTest(Point point, bool isSelected)
        {
            int n   = 0;
            int hit = -1;

            n = selectedDrawObjectList.Count;
            for (int i = 0; i < n; i++)
            {
                hit = selectedDrawObjectList[i].HitTest(point, true);
                if (hit >= 0)
                {
                    lastHitedObject = selectedDrawObjectList[i];
                    return(hit);
                }
            }

            n = drawObjectList.Count;
            for (int i = n - 1; i >= 0; i--)
            {
                hit = drawObjectList[i].HitTest(point, false);
                if (hit >= 0)
                {
                    lastHitedObject = drawObjectList[i];

                    if (drawObjectList[i].Selectable)
                    {
                        SelectOne(drawObjectList[i]);
                        return(hit);
                    }
                    break;
                }
            }
            if (hit == -1)
            {
                lastHitedObject = null;
            }
            selectedDrawObjectList.Clear();
            return(-1);
        }
Exemple #5
0
 private void AddElement(BaseRailEle baseRailEle)
 {
     string str = baseRailEle.railText;
     int lenght = str.IndexOf('_');
     if (-1!=lenght)
     {
         str = str.Substring(0,lenght);
     }
     switch(str)
     {
         case "Line":
             BaseRailElement.StraightRailEle strRailEle = (BaseRailElement.StraightRailEle)baseRailEle;
             drawDoc.DrawObjectList.Add(strRailEle);
             proRegion.AddElementNode(this.workRegion.Text, strRailEle.railText);
             break;
         case "Curve":
             BaseRailElement.CurvedRailEle curRailEle = (BaseRailElement.CurvedRailEle)baseRailEle;
             drawDoc.DrawObjectList.Add(curRailEle);
             proRegion.AddElementNode(this.workRegion.Text, curRailEle.railText);
             break;
         case "Cross":
             BaseRailElement.CrossEle croRailEle = (BaseRailElement.CrossEle)baseRailEle;
             drawDoc.DrawObjectList.Add(croRailEle);
             proRegion.AddElementNode(this.workRegion.Text, croRailEle.railText);
             break;
     }
 }
Exemple #6
0
 public void SelectOne(BaseRailEle obj)
 {
     selectedDrawObjectList.Clear();
     if (obj != null)
         selectedDrawObjectList.Add(obj);
 }
Exemple #7
0
 public void SelectMore(BaseRailEle obj)
 {
     if (obj != null)
         selectedDrawObjectList.Add(obj);
 }
Exemple #8
0
        public override int HitTest(Point point, bool isSelected)
        {
            int n = 0;
            int hit = -1;
            n = selectedDrawObjectList.Count;
            for (int i = 0; i < n; i++)
            {
                hit = selectedDrawObjectList[i].HitTest(point, true);
                if (hit >= 0)
                {
                    lastHitedObject = selectedDrawObjectList[i];
                    return hit;
                }
            }

            n = drawObjectList.Count;
            for (int i = n - 1; i >= 0; i--)
            {
                hit = drawObjectList[i].HitTest(point, false);
                if (hit >= 0)
                {
                    lastHitedObject = drawObjectList[i];

                    if (drawObjectList[i].Selectable)
                    {
                        SelectOne(drawObjectList[i]);
                        return hit;
                    }
                    break;
                }
            }
            if (hit == -1)
                lastHitedObject = null;
            selectedDrawObjectList.Clear();
            return -1;
        }