Skip to content

Commit

Permalink
Remove JSON mesh format from MeshExplorer.
Browse files Browse the repository at this point in the history
  • Loading branch information
wo80 committed Nov 6, 2023
1 parent 391b9fa commit 813a110
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 1,227 deletions.
26 changes: 21 additions & 5 deletions src/Triangle.Viewer/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using MeshExplorer.IO;
using TriangleNet;
using TriangleNet.Geometry;
using TriangleNet.IO;
using TriangleNet.Meshing;
using TriangleNet.Meshing.Algorithm;
using TriangleNet.Rendering;
Expand Down Expand Up @@ -177,7 +178,7 @@ private void frmDragOver(object sender, DragEventArgs e)
string file = args[0].ToLower();

// Check if file extension is known
if (FileProcessor.CanHandleFile(file))
if (FileProcessor.IsSupported(file))
{
e.Effect = DragDropEffects.Copy;
}
Expand Down Expand Up @@ -347,15 +348,30 @@ private void OpenWithDialog()
}
}

private bool MeshDataExists(string filename)
{
string ext = Path.GetExtension(filename);

if (ext == ".node" || ext == ".poly")
{
if (File.Exists(Path.ChangeExtension(filename, ".ele")))
{
return true;
}
}

return ext == ".ele";
}

private bool Open(string filename)
{
if (!FileProcessor.CanHandleFile(filename))
if (!FileProcessor.IsSupported(filename))
{
// TODO: show message.
}
else
{
if (FileProcessor.ContainsMeshData(filename))
if (MeshDataExists(filename))
{
if (filename.EndsWith(".ele") || DarkMessageBox.Show("Import mesh", Settings.ImportString,
"Do you want to import the mesh?", MessageBoxButtons.YesNo) == DialogResult.OK)
Expand All @@ -364,7 +380,7 @@ private bool Open(string filename)

try
{
mesh = FileProcessor.Import(filename);
mesh = (Mesh)FileProcessor.Import(filename);
}
catch (Exception e)
{
Expand Down Expand Up @@ -414,7 +430,7 @@ private void Save()

if (sfd.ShowDialog() == DialogResult.OK)
{
FileProcessor.Save(sfd.FileName, mesh);
FileProcessor.Write(mesh, sfd.FileName);
}
}

Expand Down
125 changes: 0 additions & 125 deletions src/Triangle.Viewer/IO/FileProcessor.cs

This file was deleted.

Loading

0 comments on commit 813a110

Please sign in to comment.