-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathBuidLRSMultiLineSink.cs
More file actions
83 lines (73 loc) · 2.29 KB
/
BuidLRSMultiLineSink.cs
File metadata and controls
83 lines (73 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) Microsoft Corporation. All rights reserved.
using Microsoft.SqlServer.Types;
using SQLSpatialTools.Utility;
using System;
using System.Text;
namespace SQLSpatialTools
{
/// <summary>
/// This class implements a geometry sink that builds LRS multiline.
/// Second segment measure is updated with offset difference.
/// </summary>
class BuildLRSMultiLineSink : IGeometrySink110
{
private LRSLine CurrentLine;
public LRSMultiLine MultiLine;
private int Srid;
public void ScaleMeasure(double offsetMeasure)
{
MultiLine.ScaleMeasure(offsetMeasure);
}
public void TranslateMeasure(double offsetMeasure)
{
MultiLine.TranslateMeasure(offsetMeasure);
}
/// <summary>
/// Initializes a new instance of the <see cref="MultiLineMergeGeometrySink"/> class.
/// </summary>
public BuildLRSMultiLineSink()
{
MultiLine = new LRSMultiLine();
}
public void SetSrid(int srid)
{
Srid = srid;
}
// Start the geometry.
public void BeginGeometry(OpenGisGeometryType type)
{
if (type == OpenGisGeometryType.LineString)
{
CurrentLine = new LRSLine();
CurrentLine.SetSrid(Srid);
}
}
// Start the figure.
public void BeginFigure(double x, double y, double? z, double? m)
{
CurrentLine.AddPoint(new LRSPoint(x, y, z, m));
}
// This is where the real work is done.
public void AddLine(double x, double y, double? z, double? m)
{
CurrentLine.AddPoint(new LRSPoint(x, y, z, m));
}
public void AddCircularArc(double x1, double y1, double? z1, double? m1, double x2, double y2, double? z2, double? m2)
{
throw new Exception("AddCircularArc is not implemented yet in this class");
}
// This is a NO-OP
public void EndFigure()
{
MultiLine.AddLine(CurrentLine);
}
// This is a NO-OP
public void EndGeometry()
{
}
public SqlGeometry ToSqlGeometry()
{
return MultiLine.ToSqlGeometry();
}
}
}