Exemple #1
0
 /// <summary>
 /// Idraw objects status has changed, info graphics create new
 /// </summary>
 private void Reorganize()
 {
     if (__selectedObject != null)
     {
         __selectedObject.isSelected = false;
     }
     __selectedObject = null;
     StatusChange?.Invoke(this, EventArgs.Empty);
 }
Exemple #2
0
 public void HandleMouseDown(object sender, MouseEventArgs e)
 {
     mouseLocation.down = e.Location;
     if (__taskType == TaskType.Select)
     {
         if (__selectedObject != null)
         {
             __selectedObject.isSelected = false;
         }
         __selectedObject = DataModel.GetHitObject(e.Location);
         DoInvalid(this, EventArgs.Empty);
     }
 }
 public Idraw GetHitObject(Point hit)
 {
     foreach (Layer la in LayerCollection)
     {
         if (!la.visible)
         {
             continue;
         }
         Idraw obj = la.GetHitObject(hit);
         if (obj != null)
         {
             return(obj);
         }
     }
     return(null);
 }
        public void Add(Idraw obj)
        {
            drawObjects.Add(obj);

            PointF       intersection;
            List <Idraw> needAdd = new List <Idraw>();

            foreach (Idraw shape in drawObjects)
            {
                if ((intersection = Utils.GetIntersectPoint(obj, shape)) != PointF.Empty)
                {
                    Idraw isp = new InterSectPoint(intersection, obj, shape);
                    needAdd.Add(isp);
                }
            }

            drawObjects.AddRange(needAdd);
        }
Exemple #5
0
        public static PointF GetIntersectPoint(Idraw shape1, Idraw shape2)
        {
            Type type1 = shape1.GetType();
            Type type2 = shape2.GetType();

            if (type1.IsSubclassOf(typeof(LineBase)) && type2.IsSubclassOf(typeof(LineBase)))
            {
                LineBase line1 = shape1 as LineBase;
                LineBase line2 = shape2 as LineBase;


                PointF p1 = line1.__start.Location;
                PointF p2 = line1.__end.Location;
                PointF p3 = line2.__start.Location;
                PointF p4 = line2.__end.Location;


                return(LinesIntersect(p1, p2, p3, p4, false, false));
            }

            return(PointF.Empty);
        }
 public InterSectPoint(PointF location, Idraw owner1, Idraw owner2) : base(location, PointType.intersection)
 {
     this.owner1 = owner1;
     this.owner2 = owner2;
 }
 public void RemoveObject(Idraw obj)
 {
 }
 public void AddObject(Idraw obj)
 {
     CreateNewLayer();
 }