Esempio n. 1
0
        private bool CreateVoronoi()
        {
            if (mesh == null)
            {
                return false;
            }

            if (mesh.IsPolygon)
            {
                try
                {
                    this.voronoi = new BoundedVoronoi(mesh);
                }
                catch (Exception ex)
                {
                    if (!meshControlView.ParamConformDelChecked)
                    {
                        DarkMessageBox.Show("Exception - Bounded Voronoi", Settings.VoronoiString, MessageBoxButtons.OK);
                    }
                    else
                    {
                        DarkMessageBox.Show("Exception - Bounded Voronoi", ex.Message, MessageBoxButtons.OK);
                    }

                    return false;
                }
            }
            else
            {
                this.voronoi = new StandardVoronoi(mesh);
            }

            // HACK: List<Vertex> -> ICollection<Point> ? Nope, no way.
            //           Vertex[] -> ICollection<Point> ? Well, ok.
            renderManager.Set(voronoi.Vertices.ToArray(), voronoi.Edges, false);

            return true;
        }
Esempio n. 2
0
        private void HandleMeshImport()
        {
            voronoi = null;

            // Render mesh
            renderManager.Set(mesh, true);

            // Update window caption
            this.Text = "Triangle.NET - Mesh Explorer - " + settings.CurrentFile;

            // Update Statistic view
            statisticView.HandleMeshImport(input, mesh);

            // Set refine mode
            btnMesh.Enabled = true;
            btnMesh.Text = "Refine";

            settings.RefineMode = true;

            HandleMeshChange();
        }
Esempio n. 3
0
        private void HandleMeshChange()
        {
            // Update Statistic view
            statisticView.HandleMeshChange(mesh);

            // TODO: Should the Voronoi diagram automatically update?
            voronoi = null;
            menuViewVoronoi.Checked = false;

            // Enable menu items
            menuFileSave.Enabled = true;
            menuFileExport.Enabled = true;
            menuViewVoronoi.Enabled = true;
            menuToolsCheck.Enabled = true;
            menuToolsRcm.Enabled = true;
        }
Esempio n. 4
0
        private void HandleNewInput()
        {
            // Reset mesh
            mesh = null;
            voronoi = null;

            // Reset state
            settings.RefineMode = false;
            settings.ExceptionThrown = false;

            // Reset buttons
            btnMesh.Enabled = true;
            btnMesh.Text = "Triangulate";
            btnSmooth.Enabled = false;

            // Update Statistic view
            statisticView.HandleNewInput(input);

            // Clear voronoi
            menuViewVoronoi.Checked = false;

            // Disable menu items
            menuFileSave.Enabled = false;
            menuFileExport.Enabled = false;
            menuViewVoronoi.Enabled = false;
            menuToolsCheck.Enabled = false;
            menuToolsRcm.Enabled = false;

            // Render input
            renderManager.Set(input);

            // Update window caption
            this.Text = "Triangle.NET - Mesh Explorer - " + settings.CurrentFile;
        }