Skip to content

Commit

Permalink
Code cleanup. Resolves #10 and #9
Browse files Browse the repository at this point in the history
Removed WPF controls
  • Loading branch information
xfischer committed Nov 19, 2015
1 parent 7143062 commit 6e92d8e
Show file tree
Hide file tree
Showing 28 changed files with 127 additions and 1,227 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Windows.Media;
using Microsoft.SqlServer.Types;
using Microsoft.VisualStudio.DebuggerVisualizers;
using SqlServerSpatial.Toolkit.Viewers;
using SqlServerSpatial.Toolkit.Debugging;

namespace SqlServerSpatial.Toolkit.Visualizer
{
Expand All @@ -21,7 +21,7 @@ protected override void Show(IDialogVisualizerService windowService, IVisualizer

using (FrmGeometryViewer frmViewer = new FrmGeometryViewer())
{
frmViewer.Viewer.SetGeometry(new SqlGeometryStyled(geometry, null, Color.FromArgb(200, 0, 175, 0), Colors.Black, 1f));
frmViewer.Viewer.SetGeometry(SqlGeomStyledFactory.Create(geometry, null, Color.FromArgb(200, 0, 175, 0), Colors.Black, 1f));

// Show the grid with the list
windowService.ShowDialog(frmViewer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("0.1.2.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="SqlServerSpatial.Toolkit, Version=0.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\Solution.VS2015\packages\SqlServerSpatial.Toolkit.0.1.0.0\lib\net40\SqlServerSpatial.Toolkit.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Binaries\Core\SqlServerSpatial.Toolkit.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -79,16 +79,6 @@
<Link>SqlServerTypes\x86\SqlServerSpatial110.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Solution.VS2015\packages\SqlServerSpatial.Toolkit.0.1.0.0\toolkit\SqlServerSpatial.Toolkit.DebuggerVisualizer.VS2013.dll">
<Link>SqlServerSpatial.Toolkit\SqlServerSpatial.Toolkit.DebuggerVisualizer.VS2013.dll</Link>
</Content>
<Content Include="..\Solution.VS2015\packages\SqlServerSpatial.Toolkit.0.1.0.0\toolkit\SqlServerSpatial.Toolkit.DebuggerVisualizer.VS2015.dll">
<Link>SqlServerSpatial.Toolkit\SqlServerSpatial.Toolkit.DebuggerVisualizer.VS2015.dll</Link>
</Content>
<Content Include="..\Solution.VS2015\packages\SqlServerSpatial.Toolkit.0.1.0.0\toolkit\SqlServerSpatial.Toolkit.Viewer.exe">
<Link>SqlServerSpatial.Toolkit\SqlServerSpatial.Toolkit.Viewer.exe</Link>
</Content>
<Content Include="SqlServerSpatial.Toolkit\readme.htm" />
<Content Include="SqlServerTypes\readme.htm" />
</ItemGroup>
<ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.SqlServer.Types" version="11.0.2" targetFramework="net4" />
<package id="SqlServerSpatial.Toolkit" version="0.1.0.0" targetFramework="net4" />
</packages>
4 changes: 2 additions & 2 deletions SqlServerSpatial.Toolkit.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("0.1.2.0")]
2 changes: 1 addition & 1 deletion SqlServerSpatial.Toolkit.Viewer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private void LaunchTraceViewer(string traceFilePath)
Window wnd = new Window();
wnd.Title = "SqlServer Spatial Trace Viewer";
wnd.Content = ctlTraceViewer;
wnd.Closed += (o, e) => { ctlTraceViewer.Close(); };
wnd.Closed += (o, e) => { ctlTraceViewer.Dispose(); };
wnd.Show();
}

Expand Down
4 changes: 2 additions & 2 deletions SqlServerSpatial.Toolkit.Viewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("0.1.2.0")]
2 changes: 1 addition & 1 deletion SqlServerSpatial.Toolkit/Extensions/ColorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace SqlServerSpatial.Toolkit
{

public static class ColorExtensions
internal static class ColorExtensions
{
/// <summary>
/// Conversion from GDI color to WPF color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static partial class SqlTypesExtensions
/// <param name="strokeThickness"></param>
/// <param name="unitVector"></param>
/// <returns></returns>
public static Path ToShapeWpf(this SqlGeometry geom, Brush fill, Brush stroke, double strokeThickness, Vector unitVector)
internal static Path ToShapeWpf(this SqlGeometry geom, Brush fill, Brush stroke, double strokeThickness, Vector unitVector)
{
Path path = new Path();
path.Stroke = stroke;
Expand Down
72 changes: 26 additions & 46 deletions SqlServerSpatial.Toolkit/Extensions/SqlTypesExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,29 +333,6 @@ public static bool HasInteriorRings(this SqlGeometry geom)

#region Serialization

//private void ToFile(SqlGeometry geom)
//{

// // To serialize the hashtable and its key/value pairs,
// // you must first open a stream for writing.
// // In this case, use a file stream.
// using (FileStream fs = new FileStream("geom.dat", FileMode.Create))
// {

// // Construct a BinaryFormatter and use it to serialize the data to the stream.
// BinaryFormatter formatter = new BinaryFormatter();
// try
// {
// formatter.Serialize(fs, geom.STAsBinary().Value);
// }
// catch (SerializationException e)
// {
// Console.WriteLine("Failed to serialize. Reason: " + e.Message);
// throw;
// }

// }

/// <summary>
/// Reads a serialized SqlGeometry
/// </summary>
Expand Down Expand Up @@ -418,30 +395,33 @@ public static List<SqlGeometry> ReadList(string path)
return geomList;
}

//private void Save(SqlGeometry geom)
//{

// // To serialize the hashtable and its key/value pairs,
// // you must first open a stream for writing.
// // In this case, use a file stream.
// using (FileStream fs = new FileStream("geom.dat", FileMode.Create))
// {

// // Construct a BinaryFormatter and use it to serialize the data to the stream.
// BinaryFormatter formatter = new BinaryFormatter();
// try
// {
// formatter.Serialize(fs, geom.STAsBinary().Value);
// }
// catch (SerializationException e)
// {
// Console.WriteLine("Failed to serialize. Reason: " + e.Message);
// throw;
// }

// }
//}
/// <summary>
/// Serialize and save a SqlGeometry to a file
/// </summary>
/// <param name="geometry">SqlGeometry to save</param>
/// <param name="fileName">Destination file. If file exists it will be replaced.</param>
public static void Save(this SqlGeometry geometry, string fileName)
{
BinaryFormatter formatter = new BinaryFormatter();
using (FileStream dataFile = new FileStream(fileName, FileMode.Create))
{
formatter.Serialize(dataFile, geometry);
}
}

/// <summary>
/// Serialize and save a SqlGeometry list to a file
/// </summary>
/// <param name="geometry">SqlGeometry list to save</param>
/// <param name="fileName">Destination file. If file exists it will be replaced.</param>
public static void Save(this IEnumerable<SqlGeometry> geometryList, string fileName)
{
BinaryFormatter formatter = new BinaryFormatter();
using (FileStream dataFile = new FileStream(fileName, FileMode.Create))
{
formatter.Serialize(dataFile, geometryList.ToList());
}
}

#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions SqlServerSpatial.Toolkit/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("0.1.2.0")]
14 changes: 4 additions & 10 deletions SqlServerSpatial.Toolkit/SpatialTrace/SpatialTrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ internal class SpatialTraceInternal : ISpatialTrace
{
private bool _isInitialized;
private StreamWriter _writer;
private BinaryFormatter _formatter;
private int _identCount;
private int _geomIndex;
private string _outputDirectory;
Expand Down Expand Up @@ -284,7 +283,6 @@ public SpatialTraceInternal()

internal void Init()
{
_formatter = new BinaryFormatter();
_identCount = 0;
_outputDirectoryTitle = SpatialTrace.TraceDataDirectoryName;
_outputDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _outputDirectoryTitle);
Expand Down Expand Up @@ -349,10 +347,8 @@ public void TraceGeometry(SqlGeometry geom, string message, string memberName, s
string fileTitle = string.Format("{0}.dat", ++_geomIndex);
Directory.CreateDirectory(_outputDirectory);
string fileName = Path.Combine(_outputDirectory, fileTitle);
using (FileStream dataFile = new FileStream(fileName, FileMode.CreateNew))
{
_formatter.Serialize(dataFile, geom);
}

geom.Save(fileName);

WriteLine(message, string.Format("{0}\\{1}", _outputDirectoryTitle, fileTitle), memberName, sourceFilePath, sourceLineNumber);
}
Expand All @@ -370,10 +366,8 @@ public void TraceGeometry(IEnumerable<SqlGeometry> geom, string message, string
string fileTitle = string.Format("{0}.list.dat", ++_geomIndex);
Directory.CreateDirectory(_outputDirectory);
string fileName = Path.Combine(_outputDirectory, fileTitle);
using (FileStream dataFile = new FileStream(fileName, FileMode.CreateNew))
{
_formatter.Serialize(dataFile, geom.ToList());
}

geom.Save(fileName);

WriteLine(message, string.Format("{0}\\{1}", _outputDirectoryTitle, fileTitle), memberName, sourceFilePath, sourceLineNumber);
}
Expand Down
5 changes: 0 additions & 5 deletions SqlServerSpatial.Toolkit/SpatialTraceViewerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
Content="Reload file"
Width="75"
Click="btnReload_Click" />
<CheckBox x:Name="chkAutoDraw"
Click="chkAutoDraw_Click"
Margin="3"
VerticalAlignment="Center"
Content="Auto draw on trace change" />
</StackPanel>

<ListView Margin="0" Name="lvTrace" Grid.Row="1" SelectionChanged="lvTrace_SelectionChanged" FontSize="11">
Expand Down
Loading

0 comments on commit 6e92d8e

Please sign in to comment.