本文整理汇总了C#中System.Line.Read方法的典型用法代码示例。如果您正苦于以下问题:C# Line.Read方法的具体用法?C# Line.Read怎么用?C# Line.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Line
的用法示例。
在下文中一共展示了Line.Read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
public void Convert(ICollection<CuttingScheme> output, StreamReader tr)
{
// сканирование dxf, загрузка линий и текстов
int typeCode;
string data;
while (true)
{
typeCode = int.Parse(tr.ReadLine());
data = tr.ReadLine();
if (typeCode == 0 && data == "SECTION")
{
typeCode = int.Parse(tr.ReadLine());
data = tr.ReadLine();
if (typeCode == 2 && data == "ENTITIES")
{
break;
}
}
}
List<Line> lines = new List<Line>();
_texts = new LinkedList<Text>();
while (!tr.EndOfStream)
{
typeCode = int.Parse(tr.ReadLine());
data = tr.ReadLine();
if (typeCode == 0 && data == "LINE")
{
Line line = new Line();
line.Read(tr);
lines.Add(line);
}
else if (typeCode == 0 && data == "TEXT")
{
Text text = new Text();
text.Read(tr);
_texts.AddLast(text);
}
}
// составляем список резов, выбирая линии со стилем HIDDEN
LinkedList<Line> buffer = new LinkedList<Line>(lines);
_cuts = new LinkedList<Line>();
BazUtils.TakeFrom(buffer, _cuts, BazUtils.CutsPredicate);
// составляем список прямоугольноков, собирая их из линий
List<Line> otherLines = new List<Line>();
LinkedList<Rectangle> rects = new LinkedList<Rectangle>();
while (buffer.Count > 0)
{
Line line1 = buffer.First.Value;
buffer.RemoveFirst();
Line line2 = BazUtils.FindContLine(line1, buffer);
if (line2 == null)
{
otherLines.Add(line1);
continue;
}
buffer.Remove(line2);
Line line3 = BazUtils.FindContLine(line2, buffer);
if (line3 == null)
{
otherLines.Add(line1);
otherLines.Add(line2);
continue;
}
buffer.Remove(line3);
Line line4 = BazUtils.FindContLine(line2, buffer);
if (line4 != null)
{
otherLines.Add(line1);
otherLines.Add(line2);
otherLines.Add(line3);
continue;
}
buffer.Remove(line4);
Rectangle rect = new Rectangle();
rect.LeftBottom.X = Math.Min(line1.P1.X, line2.P2.X);
rect.LeftBottom.Y = Math.Min(line1.P1.Y, line2.P2.Y);
rect.RightTop.X = Math.Max(line1.P1.X, line2.P2.X);
rect.RightTop.Y = Math.Max(line1.P1.Y, line2.P2.Y);
rects.AddLast(rect);
}
BazUtils.BubbleSort<Rectangle>(rects, Rectangle.SquareDescending);
while (rects.Count > 0)
{
// находим прямоугольники листа и его обрезанной части
Rectangle sheetRect = rects.First.Value;
rects.RemoveFirst();
List<Rectangle> internals = new List<Rectangle>();
BazUtils.TakeFrom<Rectangle>(rects, internals, sheetRect.IsContains);
if (internals.Count == 0)
{
break;
}
Rectangle cutoffRect = internals[0];
//.........这里部分代码省略.........