private void GenerateResultShape(Vertex vertex1, Vertex vertex2, Collection <Vertex> vertices, bool needRemoveVertex = false) { LineShape line = new LineShape(vertices); try { LineShape resultLine = GetLineOnALine(line, vertex1, vertex2, GeographyUnit); if (resultLine != null && resultLine.Vertices.Count > 0) { if (!IsEqual(resultLine.Vertices[0].X, vertex1.X) || !IsEqual(resultLine.Vertices[0].Y, vertex1.Y)) { resultLine.ReversePoints(); } var tempVertex = resultLine.Vertices.ToList(); if (Vertices.Count == 4) { tempVertex.Reverse(); if (needRemoveVertex) { needAddVertex = false; } } foreach (var insertVertex in tempVertex) { int count = Vertices.Count; Vertices.Insert(count - 3, insertVertex); MouseDownCount++; } if (needRemoveVertex) { Vertices.RemoveAt(Vertices.Count - 3); Vertices.RemoveAt(Vertices.Count - 1); MouseDownCount -= 2; } } } catch { } }
private void GenerateResultLine(Vertex vertex1, Vertex vertex2, Collection <Vertex> vertices, bool needRemoveVertex = false) { LineShape line = new LineShape(vertices); try { LineShape resultLine = GetLineOnALine(line, vertex1, vertex2, GeographyUnit); if (resultLine != null && resultLine.Vertices.Count > 0) { if (!IsEqual(resultLine.Vertices[0].X, vertex1.X) || !IsEqual(resultLine.Vertices[0].Y, vertex1.Y)) { resultLine.ReversePoints(); } foreach (var insertVertex in resultLine.Vertices) { int count = Vertices.Count; Vertices.Insert(count - 2, insertVertex); MouseDownCount++; } if (needRemoveVertex) { Vertices.RemoveAt(Vertices.Count - 2); Vertices.RemoveAt(Vertices.Count - 1); MouseDownCount -= 2; boundaryVertices.Clear(); boundaryVertices.Add(Vertices.First()); boundaryVertices.Add(Vertices.Last()); } } } catch { } }