Exemplo n.º 1
0
 private void MainForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         if (ol.Selected != null && ol.Selected != ol.Collection[0])
         {
             ol.Remove(ol.Selected);
             ol.Selected = null;
             redraw();
             e.Handled = true;
         }
     }
     if (e.Control && e.KeyCode == Keys.C)
     {
         if (ol.Selected != ol.Items[0])
         {
             copy = ol.Selected.Clone() as AObjects;
         }
         e.Handled = true;
     }
     if (e.Control && e.KeyCode == Keys.V)
     {
         if (copy != null)
         {
             var cpy = copy.Copy();
             cpy.Refresh();
             ol.Add(cpy);
             ol.Selected = cpy;
             e.Handled   = true;
         }
     }
 }
Exemplo n.º 2
0
        protected AObjects(AObjects o)
        {
            Color   = new MyColor(0, 0, 0);
            matrixX = new MatrixX(0);
            matrixY = new MatrixY(0);
            matrixZ = new MatrixZ(0);

            this.centerPoint  = new Points();
            this.Color        = o.Color;
            this.Id           = o.Id;
            this.Name         = o.Name;
            this.Radius       = o.Radius;
            this.RotX         = o.RotX;
            this.RotY         = o.RotY;
            this.RotZ         = o.RotZ;
            this.UUID         = o.UUID;
            this.X            = o.X;
            this.Y            = o.Y;
            this.Z            = o.Z;
            this.Transparency = o.Transparency;
            this.Reflection   = o.Reflection;
            this.Brightness   = o.Brightness;

            this.LimXMax = o.LimXMax;
            this.LimYMax = o.LimYMax;
            this.LimZMax = o.LimZMax;
            this.LimXMin = o.LimXMin;
            this.LimYMin = o.LimYMin;
            this.LimZMin = o.LimZMin;
        }
Exemplo n.º 3
0
        public AObjects Copy()
        {
            AObjects n = this.Clone() as AObjects;

            n.Name = "Copy of " + this.Name;
            n.AddOneToCount(n.GetType());
            n.Register(true);
            return(n);
        }
Exemplo n.º 4
0
        private void view_z_MouseUp(object sender, MouseEventArgs e)
        {
            if (this.drawMode == eDrawMode.NONE || p1 == null)
            {
                return;
            }
            _tmpObject = null;

            p2 = new Points();

            p2.X = e.X;
            p2.Y = e.Y;
            p2.Z = 0;

            Util.convertToMy(p2, vp, view_z.Image, Util.eView.z);

            AObjects s = null;

            switch (this.drawMode)
            {
            case eDrawMode.SPHERE:
                s = Sphere.create_z((Points)p1.Clone(), (Points)p2.Clone(), vp);
                break;

            case eDrawMode.CYLINDER:
                s = Cylinder.create_z((Points)p1.Clone(), (Points)p2.Clone(), vp);
                break;

            case eDrawMode.LIGHT:
                s = Light.create_z((Points)p1.Clone(), (Points)p2.Clone(), vp);
                break;

            case eDrawMode.CONE:
                s = Cone.create_z((Points)p1.Clone(), (Points)p2.Clone(), vp);
                break;

            case eDrawMode.PLAN:
                s = Plan.create_z((Points)p1.Clone(), (Points)p2.Clone(), vp);
                break;
            }
            if (s != null)
            {
                ol.Add(s);
                ol.Selected = s;
            }

            redraw();
            propertyGrid.Refresh();
        }
Exemplo n.º 5
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var x = new XmlSerializer(ol.GetType());

            var f = new OpenFileDialog();

            f.Filter           = "DRT Save file|*.drt";
            f.InitialDirectory = Environment.CurrentDirectory;
            f.CustomPlaces.Add(new FileDialogCustomPlace(Environment.CurrentDirectory));
            if (f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                AObjects.Reinit();

                try
                {
                    TextReader tr = new StreamReader(f.FileName);
                    ol = x.Deserialize(tr) as ObjectsList;
                    tr.Close();

                    currentfile.Nlong = f.FileName;
                    FileInfo ff = new FileInfo(currentfile.Nlong);
                    currentfile.Nshort = ff.Name;
                    this.Text          = currentfile.Nshort;

                    saveAsToolStripMenuItem.Enabled = true;

                    ol.Collection.form   = this;
                    comboBox1.DataSource = ol.Collection;

                    redraw();
                }
                catch (System.InvalidOperationException)
                {
                    MessageBox.Show("Error, the file you specified is invalid");
                }
            }
        }
Exemplo n.º 6
0
 public void Remove(AObjects o)
 {
     collection.Remove(o);
 }
Exemplo n.º 7
0
 public void Add(AObjects o)
 {
     collection.Add(o);
 }
Exemplo n.º 8
0
 public SceneItem(AObjects o)
 {
     Items          = new List <SceneItem>();
     Header         = new List <byte>();
     this.refObject = o;
 }