Skip to content
This repository was archived by the owner on Jan 27, 2019. It is now read-only.

Commit 6aafdae

Browse files
author
Adam Renaud
committed
Worked a lot on the Geometric Entities
1 parent 7963d23 commit 6aafdae

17 files changed

+1473
-410
lines changed

Dxflib.Tests/Entities/VertexTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Diagnostics;
34
using Dxflib.Geometry;
45
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -20,15 +21,15 @@ public void TestingDefaultValueForZ()
2021
public void TestingRaisedEventForXYZ_GeometryChanged()
2122
{
2223
var testVertex = new Vertex(1, 2, 3);
23-
testVertex.GeometryChanged += TestVertexOnGeometryChanged;
24+
testVertex.PropertyChanged += TestVertexOnPropertyChanged;
2425
testVertex.X = 2;
2526
Assert.IsTrue(_eventWorked);
2627
}
2728

28-
private static void TestVertexOnGeometryChanged(object sender, GeometryChangedHandlerArgs args)
29+
private static void TestVertexOnPropertyChanged(object sender, PropertyChangedEventArgs e)
2930
{
30-
Debug.WriteLine(args.Name);
3131
_eventWorked = true;
32+
Debug.WriteLine(e.PropertyName);
3233
}
3334
}
3435
}

Dxflib.Tests/Geometry/GeoArcTests.cs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,6 @@ public void Area_VertexVertexBulge()
9999
Assert.IsTrue(Math.Abs(testArc.Area - 0.6989) < GeoMath.Tolerance);
100100
}
101101

102-
[TestMethod]
103-
public void Angle_VertexVertexBulge_Changing()
104-
{
105-
var vertex0 = new Vertex(0, 2);
106-
var vertex1 = new Vertex(2, 2);
107-
const double bulgeValue = -0.5;
108-
var testArc = new GeoArc(vertex0, vertex1, bulgeValue);
109-
110-
testArc.Angle = GeoMath.DegToRad(130);
111-
Assert.IsTrue(Math.Abs(testArc.Angle - GeoMath.DegToRad(130)) < GeoMath.Tolerance);
112-
Assert.IsTrue(Math.Abs(testArc.Area - 1.1741) < GeoMath.Tolerance);
113-
}
114-
115102
[TestMethod]
116103
public void MiddleVertexTest()
117104
{
@@ -162,6 +149,7 @@ public void Length_CaarTest()
162149
var centerVertex = new Vertex(1.0, 1.25);
163150
var startAngle = GeoMath.DegToRad(36.8699);
164151
var endAngle = GeoMath.DegToRad(143.1301);
152+
165153
var radius = 1.25;
166154
var testArc = new GeoArc(centerVertex, startAngle, endAngle, radius);
167155

@@ -210,20 +198,6 @@ public void EndAngle_CaarTest_Changing()
210198
Assert.IsTrue(Math.Abs(testArc.Vertex1.Y - 0.8225) < GeoMath.Tolerance);
211199
}
212200

213-
[TestMethod]
214-
public void Angle_CaarTest_Changing()
215-
{
216-
var centerVertex = new Vertex(1.0, 1.25);
217-
var startAngle = GeoMath.DegToRad(36.8699);
218-
var endAngle = GeoMath.DegToRad(143.1301);
219-
var radius = 1.25;
220-
var testArc = new GeoArc(centerVertex, startAngle, endAngle, radius);
221-
222-
testArc.Angle = GeoMath.DegToRad(138.1301);
223-
Assert.IsTrue(Math.Abs(testArc.Vertex1.X - -0.2452) < GeoMath.Tolerance);
224-
Assert.IsTrue(Math.Abs(testArc.Vertex1.Y - 1.3589) < GeoMath.Tolerance);
225-
}
226-
227201
[TestMethod]
228202
public void Radius_CaarTest_Changing()
229203
{

Dxflib.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Dxflib_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
23

34
<s:Boolean x:Key="/Default/UserDictionary/Words/=Dxflib/@EntryIndexedValue">True</s:Boolean>
45
<s:Boolean x:Key="/Default/UserDictionary/Words/=geoline/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Dxflib/Entities/Line.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
// ============================================================
1111

1212
using Dxflib.Geometry;
13+
using Dxflib.LinAlg;
1314

1415
namespace Dxflib.Entities
1516
{
16-
/// <inheritdoc />
17+
/// <inheritdoc cref="Entity" />
18+
/// <inheritdoc cref="IGeoLinear" />
1719
/// <summary>
1820
/// The Line Entity Class
1921
/// </summary>
20-
public class Line : Entity
22+
public class Line : Entity, IGeoLinear
2123
{
24+
/// <inheritdoc />
2225
/// <summary>
23-
/// Extraction Constructor, requires filling out of an <see cref="EntityBuffer" />
26+
/// Extraction Constructor, requires filling out of an <see cref="T:Dxflib.Entities.EntityBuffer" />
2427
/// </summary>
2528
/// <param name="lineBuffer">
2629
/// The Line Buffer that was filled
@@ -40,11 +43,25 @@ public Line(LineBuffer lineBuffer) : base(lineBuffer)
4043
/// </summary>
4144
public GeoLine GLine { get; }
4245

46+
/// <inheritdoc />
4347
/// <summary>
4448
/// The Length of the Line
4549
/// </summary>
4650
public double Length => GLine.Length;
4751

52+
/// <inheritdoc />
53+
/// <summary>
54+
/// The Area of the Line
55+
/// </summary>
56+
public double Area => GLine.Area;
57+
58+
/// <inheritdoc />
59+
/// <summary>
60+
/// Convert this Line to a Vector
61+
/// </summary>
62+
/// <returns></returns>
63+
public Vector ToVector() => GLine.ToVector();
64+
4865
/// <summary>
4966
/// The Thickness of the line
5067
/// </summary>

0 commit comments

Comments
 (0)