예제 #1
0
        public Form1()
        {
            #region SplashScreen
            #endregion

            #region Initialization
            Config.StdConfigPattern = Resources.Configuration;
            CodeFunctions.Init();
            X = ObjectCollection.Instance;
            saveBeforeClosing = new SaveBeforeClosing();
            #endregion
            #region Event Signatures
            this.KeyDown += new KeyEventHandler(OpticalBuilderLib.SaveFiles.SaveLoad.Instance.HookManager_KeyDown);
            this.KeyUp   += new KeyEventHandler(OpticalBuilderLib.SaveFiles.SaveLoad.Instance.HookManager_KeyUp);
            ObjectCollection.Instance.OnSelectedChange += new EventHandler <SelectedChangeArgs>(Instance_OnSelectedChange);
            Config.NewConfig           += new EventHandler <ConfigurationChangeArgs>(Translation.ConfigChangeHandle);
            Config.NewConfig           += new EventHandler <ConfigurationChangeArgs>(NewConfiguration);
            Translation.LanguageChange += new EventHandler <LanguageChangeArgs>(Translation_LanguageChange);
            #endregion
            InitializeComponent();

            CreateInstruments();
            simpleGL1.InitializeContexts();
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            simpleGL1.Size     = new Size(this.Size.Width - PictureSizeDiferenceFromFormX, this.Size.Height - pictureSizeDiferenceFromFormY);
            groupBox1.Location = new Point(this.Size.Width - PictureSizeDiferenceFromFormX + DistFromGroupBoxToPic, groupBox1.Location.Y);
            groupBox1.Height   = simpleGL1.Height;
            groupBox1.HookEvents();
            form = this;
        }
예제 #2
0
 public override void Action(System.Drawing.Point cursorCoordinates)
 {
     p1 = cursorCoordinates;
     counter++;
     CodeFunctions.AddBrightPoint(ObjectCollection.SysInstance.Converter(p1));
     Deactivate();
 }
예제 #3
0
 public override void Action(Point cursorCoordinates)
 {
     if (counter == 0)
     {
         p1 = cursorCoordinates;
         var a = ObjectCollection.Instance.objects;
         foreach (var b in a)
         {
             if (b is BrightPoint)
             {
                 if (b.DistanceToPointS(p1) <= 6)
                 {
                     bound = (BrightPoint)b;
                 }
             }
         }
         if (bound == null)
         {
             GenNew = true;
             bound  = new BrightPoint(ObjectProto.GenName(ObjectProto.GetSpec(ObjectTypes.BrightPoint)), p1);
         }
         else
         {
             p1 = bound.Coordinates;
         }
         counter++;
     }
     else
     {
         p2      = cursorCoordinates;
         counter = 2;
         CodeFunctions.CreateRay(p1, p2, bound, GenNew);
         Deactivate();
     }
 }
예제 #4
0
        public override void Action(Point cursorCoordinates)
        {
            if (ring.Count == 0)
            {
                ring.Add(cursorCoordinates);
            }
            else if (ring.Count == 1 && ring[0].ToScreen() != cursorCoordinates)
            {
                ring.Add(cursorCoordinates);
            }
            else
            {
                bool isect, eq;
                if ((ring[0].Distance(cursorCoordinates) * CoordinateSystem.Instance.Scale) < 5)
                {
                    cursorCoordinates = ring[0].ToScreen();
                }
                Line chk = new Line(ring[ring.Count - 1], cursorCoordinates, false);
                if (cursorCoordinates != (Point)ring[0])
                {
                    for (int i = 0; i < ring.Count - 1; i++)
                    {
                        Line z = new Line(ring[i], ring[i + 1], false);
                        z.IntersectWithLine(chk, out isect, out eq);
                        if (isect)
                        {
                            return;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < ring.Count - 2; i++)
                    {
                        Line z = new Line(ring[i], ring[i + 1], false);
                        z.IntersectWithLine(chk, out isect, out eq);
                        if (isect)
                        {
                            return;
                        }
                    }
                }

                if (cursorCoordinates != ring[0].ToScreen())
                {
                    ring.Add(cursorCoordinates);
                }
                else
                {
                    SystemCoordinates[] zz = ring.ToArray();
                    ring.Add(cursorCoordinates);
                    CodeFunctions.AddPoly(zz);
                    Deactivate();
                }
            }
        }
예제 #5
0
 public override void Action(Point cursorCoordinates)
 {
     if (counter == 0)
     {
         p1 = cursorCoordinates;
         counter++;
     }
     else
     {
         if (p1 != cursorCoordinates)
         {
             p2 = cursorCoordinates;
             if (alt_modifier == false)
             {
                 if (control_modifier)
                 {
                     Point p = p1;
                     p1 = cursorCoordinates;
                     cursorCoordinates = p;
                     p2 = p;
                 }
             }
             else
             {
                 SystemCoordinates pp1, pp2;
                 pp1 = CoordinateSystem.Instance.Converter(p1);
                 pp2 = CoordinateSystem.Instance.Converter(cursorCoordinates);
                 pp1 = pp1.BuildPointReflection(pp2);
                 p1  = pp1.ToScreen();
                 p2  = pp2.ToScreen();
                 cursorCoordinates = pp2.ToScreen();
                 if (control_modifier)
                 {
                     Point p = p1;
                     p1 = cursorCoordinates;
                     cursorCoordinates = p;
                     p2 = p;
                 }
             }
             x = new Line(CoordinateSystem.Instance.Converter(p1),
                          CoordinateSystem.Instance.Converter(cursorCoordinates), false);
             x.BuildAngle();
             counter = 2;
             if (p1 != p2)
             {
                 CodeFunctions.AddMirror(x.Center, x.AngleForOnePointLines, x.FirstEnd.Distance(x.SecondEnd));
             }
             Deactivate();
         }
     }
 }
예제 #6
0
        public override void Action(System.Drawing.Point cursorCoordinates)
        {
            if (counter == 1)
            {
                radius = center.Distance(CoordinateSystem.Instance.Converter(cursorCoordinates));
                counter++;
            }
            if (counter == 2)
            {
                CodeFunctions.AddSphere(center, radius);
                Deactivate();
                return;
            }

            if (counter == 0)
            {
                center = CoordinateSystem.Instance.Converter(cursorCoordinates);
                counter++;
            }
        }