private void UpdateInit()
        {
            Circle3D circle3d = generalFiguresList[iterator] as Circle3D;

            if (circle3d != null)
            {
                figureName = "circle";
            }

            Rectangle3D rectangle3d = generalFiguresList[iterator] as Rectangle3D;

            if (rectangle3d != null)
            {
                if (rectangle3d.figureType == 3)
                {
                    figureName = "triang";
                }
                else
                {
                    figureName = "rectan";
                }
            }

            Custom3D custom3d = generalFiguresList[iterator] as Custom3D;

            if (custom3d != null)
            {
                figureName = "custom";
            }

            switch (figureName)
            {
            case "circle":
                Circle3D      circle3D      = (Circle3D)generalFiguresList[iterator];
                CircleUpdater circleUpdater = new CircleUpdater(circle3D, model3DGroup, generalFiguresList);
                break;

            case "rectan":
                Rectangle3D      rectangle3D      = (Rectangle3D)generalFiguresList[iterator];
                RectangleUpdater rectangleUpdater = new RectangleUpdater(rectangle3D, model3DGroup, generalFiguresList);
                break;

            case "triang":
                Rectangle3D     triangle3D      = (Rectangle3D)generalFiguresList[iterator];
                TriangleUpdater triangleUpdater = new TriangleUpdater(triangle3D, model3DGroup, generalFiguresList);
                break;

            case "custom":
                Custom3D      custom3D      = (Custom3D)generalFiguresList[iterator];
                CustomUpdater customUpdater = new CustomUpdater(custom3D, model3DGroup, generalFiguresList);
                break;
            }
        }
Esempio n. 2
0
        private void UpdateInit()
        {
            Circle3D circle3d = generalFiguresList[iterator] as Circle3D;

            if (circle3d != null)
            {
                figureName = "circle";
            }

            Rectangle3D rectangle3d = generalFiguresList[iterator] as Rectangle3D;

            if (rectangle3d != null)
            {
                if (rectangle3d.figureType == 3)
                {
                    figureName = "triang";
                }
                else
                {
                    figureName = "rectan";
                }
            }

            Custom3D custom3d = generalFiguresList[iterator] as Custom3D;

            if (custom3d != null)
            {
                figureName = "custom";
            }

            string modelName = string.Concat(comboBox.SelectedItem.ToString(), figureName);

            int it = 0;
            Model3DCollection model3Ds = model3DGroup.Children;

            foreach (Model3D t in model3Ds)
            {
                if (t.GetValue(FrameworkElement.NameProperty).ToString() == modelName)
                {
                    model3Ds.RemoveAt(it);
                    break;
                }
                it++;
            }

            generalFiguresList.RemoveAt(iterator);

            MainWindow.FiguresListChanges();
        }
Esempio n. 3
0
        private void InitRect()
        {
            Model3DCollection model3Ds = model3DGroup.Children;

            int index = 0;

            foreach (GeometryModel3D model in model3Ds)
            {
                if (model.GetValue(FrameworkElement.NameProperty).ToString() == name)
                {
                    model3Ds.RemoveAt(index);
                    break;
                }
                index++;
            }

            Int32Collection triangles = new Int32Collection();

            foreach (Point3D t in triangles3Ds)
            {
                triangles.Add(Convert.ToInt32(t.X));
                triangles.Add(Convert.ToInt32(t.Y));
                triangles.Add(Convert.ToInt32(t.Z));
            }

            MeshGeometry3D meshGeometry3D = new MeshGeometry3D();

            meshGeometry3D.Positions       = point3Ds;
            meshGeometry3D.TriangleIndices = triangles;

            GeometryModel3D geometry = new GeometryModel3D(meshGeometry3D, new DiffuseMaterial(new SolidColorBrush(color)));

            geometry.SetValue(FrameworkElement.NameProperty, name);

            model3DGroup.Children.Add(geometry);
            Custom3D custom3D = new Custom3D(model3DGroup, point3Ds, triangles3Ds, name, color, generalFiguresList, false);

            generalFiguresList.Add(custom3D);

            MainWindow.FiguresListChanges();
        }