示例#1
0
        public int AddRay(string Name, Point beginning, Point p2, BrightPoint bp, bool GenNew)
        {
            if (WarnedRays == false && WarnedRaysFinalized == false && rays.Count >= 10)
            {
                DialogResult dr =
                    MessageBox.Show(STranslation.T["WarnRay"] + '\n' + STranslation.T["WantToContinue"],
                                    STranslation.T["Warning"], MessageBoxButtons.OKCancel);
                if (dr == DialogResult.OK)
                {
                    WarnedRays = false;
                }
                else
                {
                    WarnedRays = true;
                }
                WarnedRaysFinalized = true;
            }
            if (WarnedRaysFinalized == false || WarnedRays == false)
            {
                Line l1 = new Line(CoordinateSystem.Instance.Converter(beginning),
                                   CoordinateSystem.Instance.Converter(p2), false);
                l1.BuildAngle();
                Angle a = l1.AngleForOnePointLines;

                return(AddRay(Name, CoordinateSystem.Instance.Converter(beginning), a, bp, GenNew));
            }
            return(-1);
        }
示例#2
0
 public void ChangeBoundPoint(BrightPoint newPoint)
 {
     if (newPoint.Name != bound_point_name)
     {
         BoundPoint.Removal -= PointRemove;
         bound_point_name    = newPoint.Name;
         BoundPoint.Removal += PointRemove;
     }
 }
示例#3
0
 public int AddRay(string Name, SystemCoordinates Beginning, Angle angle, BrightPoint bpoint, bool GenNew)
 {
     if (WarnedRays == false && WarnedRaysFinalized == false && rays.Count >= 10)
     {
         if (MessageBox.Show(STranslation.T["WarnRay"] + '\n' + STranslation.T["WantToContinue"],
                             STranslation.T["Warning"], MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             WarnedRays = false;
         }
         else
         {
             WarnedRays = true;
         }
         WarnedRaysFinalized = true;
     }
     if (WarnedRaysFinalized == false || WarnedRays == false)
     {
         if (GenNew && !ObjectExists(bpoint.Name))
         {
             AddObject(bpoint);
         }
         Ray ToAdd = new Ray(Name, rayMaxID, Beginning, angle, bpoint.Name);
         CheckExistObj = ToAdd;
         ObjectProto Found = Rays.Find(CheckExistance);
         if (Found != null)
         {
             MessageBox.Show(STranslation.T["FoundAnotherRayWithThisName"]);
             return(-1);
         }
         ObjectsChanged += new EventHandler(ToAdd.ObjectsChanged);
         Rays.Add(ToAdd);
         Rays[Rays.Count - 1].ObjectsChanged(this, new EventArgs());
         rayMaxID++;
         if (OnObjectsRaysChange != null)
         {
             OnObjectsRaysChange.Invoke(this, new EventArgs());
         }
         return(rayMaxID - 1);
     }
     return(-1);
 }