예제 #1
0
        private IEnumerable <ControlPointId> GetLineAnchorPoints(Shape lineShape)
        {
            if (lineShape == null)
            {
                throw new ArgumentNullException("lineShape");
            }
            if (!(lineShape is ILinearShape))
            {
                throw new ArgumentException("Shape does not implement ILinearShape");
            }
            // Return end points first
            yield return(ControlPointId.FirstVertex);

            yield return(ControlPointId.LastVertex);

            // We don't need the reference point for lines
            ILinearShape   linearShape      = (ILinearShape)lineShape;
            ControlPointId lastResizeVertex = linearShape.GetPreviousVertexId(ControlPointId.LastVertex);
            ControlPointId id = ControlPointId.FirstVertex;

            while (id != lastResizeVertex)
            {
                id = linearShape.GetNextVertexId(id);
                yield return(id);
            }
        }
예제 #2
0
 private static void Compare(ILinearShape savedShape, ILinearShape loadedShape, int version)
 {
     Assert.AreEqual <bool>(savedShape != null, loadedShape != null);
     if (savedShape != null && loadedShape != null)
     {
         Assert.AreEqual <bool>(savedShape.IsDirected, loadedShape.IsDirected);
         Assert.AreEqual <int>(savedShape.MaxVertexCount, loadedShape.MaxVertexCount);
         Assert.AreEqual <int>(savedShape.MinVertexCount, loadedShape.MinVertexCount);
         Assert.AreEqual <int>(savedShape.VertexCount, loadedShape.VertexCount);
     }
 }
예제 #3
0
 private static void Compare(ILinearShape shapeA, ILinearShape shapeB, int version)
 {
     Assert.AreEqual <bool>(shapeA != null, shapeB != null);
     if (shapeA != null && shapeB != null)
     {
         Assert.AreEqual <bool>(shapeA.IsDirected, shapeB.IsDirected);
         Assert.AreEqual <int>(shapeA.MaxVertexCount, shapeB.MaxVertexCount);
         Assert.AreEqual <int>(shapeA.MinVertexCount, shapeB.MinVertexCount);
         Assert.AreEqual <int>(shapeA.VertexCount, shapeB.VertexCount);
     }
 }
예제 #4
0
파일: Tool.cs 프로젝트: jestonitiro/nshape
		private ControlPointId GetNextResizePointId(ILinearShape lineShape, ControlPointId currentPointId, bool firstToLast) {
			if (firstToLast) return lineShape.GetNextVertexId(currentPointId);
			else return lineShape.GetPreviousVertexId(currentPointId);
		}