コード例 #1
0
        private void CylinderRadius_ValueChanged(object sender, EventArgs e)
        {
            Cylinder cylinder = SelectedFigure as Cylinder;

            cylinder.Radius = (float)CylinderRadius.Value;
            FigureDataGrid.Refresh();
        }
コード例 #2
0
        private void CylinderDiv_ValueChanged(object sender, EventArgs e)
        {
            Cylinder cylinder = SelectedFigure as Cylinder;

            cylinder.Division = (int)CylinderDiv.Value;
            FigureDataGrid.Refresh();
        }
コード例 #3
0
        private void CylinderHeight_ValueChanged(object sender, EventArgs e)
        {
            Cylinder cylinder = SelectedFigure as Cylinder;

            cylinder.Height = (float)CylinderHeight.Value;
            FigureDataGrid.Refresh();
        }
コード例 #4
0
        private void CylinderPosZ_ValueChanged(object sender, EventArgs e)
        {
            Cylinder cylinder = SelectedFigure as Cylinder;

            cylinder.Center.Z = (float)CylinderPosZ.Value;
            FigureDataGrid.Refresh();
        }
コード例 #5
0
        private void ConeDiv_ValueChanged(object sender, EventArgs e)
        {
            Cone cone = SelectedFigure as Cone;

            cone.Division = (int)ConeDiv.Value;
            FigureDataGrid.Refresh();
        }
コード例 #6
0
        private void SphereLon_ValueChanged(object sender, EventArgs e)
        {
            Sphere sphere = SelectedFigure as Sphere;

            sphere.Lon = (int)SphereLon.Value;
            FigureDataGrid.Refresh();
        }
コード例 #7
0
        private void SphereRadius_ValueChanged(object sender, EventArgs e)
        {
            Sphere sphere = SelectedFigure as Sphere;

            sphere.Radius = (float)SphereRadius.Value;
            FigureDataGrid.Refresh();
        }
コード例 #8
0
        private void ConeHeight_ValueChanged(object sender, EventArgs e)
        {
            Cone cone = SelectedFigure as Cone;

            cone.Height = (float)ConeHeight.Value;
            FigureDataGrid.Refresh();
        }
コード例 #9
0
        private void SpherePosZ_ValueChanged(object sender, EventArgs e)
        {
            Sphere sphere = SelectedFigure as Sphere;

            sphere.Center.Z = (float)SpherePosZ.Value;
            FigureDataGrid.Refresh();
        }
コード例 #10
0
        private void CuboidZ_ValueChanged(object sender, EventArgs e)
        {
            Cuboid cube = SelectedFigure as Cuboid;

            cube.Z = (float)CuboidZ.Value;
            FigureDataGrid.Refresh();
        }
コード例 #11
0
        private void ConePosZ_ValueChanged(object sender, EventArgs e)
        {
            Cone cone = SelectedFigure as Cone;

            cone.Center.Z = (float)ConePosZ.Value;
            FigureDataGrid.Refresh();
        }
コード例 #12
0
        private void ConeRadius_ValueChanged(object sender, EventArgs e)
        {
            Cone cone = SelectedFigure as Cone;

            cone.Radius = (float)ConeRadius.Value;
            FigureDataGrid.Refresh();
        }
コード例 #13
0
        private void loadSceneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "xml files (*.xml)|*.xml";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                XmlSerializer ser = new XmlSerializer(typeof(DummyXML));
                FileStream    fs  = new FileStream(dialog.FileName, FileMode.Open);
                DummyXML      xml = (DummyXML)ser.Deserialize(fs);
                RefreshTimer.Stop();
                BindingList <Camera> newCameras = new BindingList <Camera>();
                Lights.Clear();
                Figures.Clear();
                xml.Cameras.ForEach(c => newCameras.Add(new Camera(c)));
                xml.Lights.ForEach(l => Lights.Add(new Light(l)));
                xml.Cuboids.ForEach(f => Figures.Add(new Cuboid(f)));
                xml.Spheres.ForEach(f => Figures.Add(new Sphere(f)));
                xml.Cylinders.ForEach(f => Figures.Add(new Cylinder(f)));
                xml.Cones.ForEach(f => Figures.Add(new Cone(f)));
                Cameras = newCameras;
                CameraListBox.DataSource = Cameras;
                CameraListBox.ClearSelected();
                CameraListBox.SetSelected(0, true);
                SelectedCamera = Cameras.First();
                if (Cameras.Count == 1)
                {
                    RemoveCameraButton.Enabled = false;
                }
                else
                {
                    RemoveCameraButton.Enabled = true;
                }
                if (Lights.Count != 0)
                {
                    LightListBox.ClearSelected();
                    LightListBox.SetSelected(0, true);
                    SelectedLight             = Lights[0];
                    LightGroupBox.Enabled     = true;
                    RemoveLightButton.Enabled = true;
                }
                else
                {
                    SelectedLight = null;
                    LightListBox.ClearSelected();
                    LightGroupBox.Enabled     = false;
                    RemoveLightButton.Enabled = false;
                }
                Lights.ResetBindings();
                CameraListBox.SelectedIndex = 0;
                FigureDataGrid.Refresh();
                RefreshTimer.Start();
            }
        }
コード例 #14
0
        private void CylinderRotZ_ValueChanged(object sender, EventArgs e)
        {
            if (CylinderRotZ.Value < 0)
            {
                CylinderRotZ.Value += 360;
            }
            else if (CylinderRotZ.Value == 360)
            {
                CylinderRotZ.Value = 0;
            }
            Cylinder cylinder = SelectedFigure as Cylinder;

            cylinder.RotZ = (float)CylinderRotZ.Value * (float)Math.PI / 180f;
            FigureDataGrid.Refresh();
        }
コード例 #15
0
        private void CuboidRotZ_ValueChanged(object sender, EventArgs e)
        {
            if (CuboidRotZ.Value < 0)
            {
                CuboidRotZ.Value += 360;
            }
            else if (CuboidRotZ.Value == 360)
            {
                CuboidRotZ.Value = 0;
            }
            Cuboid cube = SelectedFigure as Cuboid;

            cube.RotZ = (float)CuboidRotZ.Value * (float)Math.PI / 180f;
            FigureDataGrid.Refresh();
        }
コード例 #16
0
        private void SphereRotZ_ValueChanged(object sender, EventArgs e)
        {
            if (SphereRotZ.Value < 0)
            {
                SphereRotZ.Value += 360;
            }
            else if (SphereRotZ.Value == 360)
            {
                SphereRotZ.Value = 0;
            }
            Sphere sphere = SelectedFigure as Sphere;

            sphere.RotZ = (float)SphereRotZ.Value * (float)Math.PI / 180f;
            FigureDataGrid.Refresh();
        }
コード例 #17
0
        private void ConeRotZ_ValueChanged(object sender, EventArgs e)
        {
            if (ConeRotZ.Value < 0)
            {
                ConeRotZ.Value += 360;
            }
            else if (ConeRotZ.Value == 360)
            {
                ConeRotZ.Value = 0;
            }
            Cone cone = SelectedFigure as Cone;

            cone.RotZ = (float)ConeRotZ.Value * (float)Math.PI / 180f;
            FigureDataGrid.Refresh();
        }