コード例 #1
0
        protected override SLExpression VisitDefinedByTwoPointsPoint(DefinedByTwoPointsPointExpression definedByTwoPointsPointExpression)
        {
            var point1 = (CoordinatesPointExpression)Visit(definedByTwoPointsPointExpression.Point1);
            var point2 = (CoordinatesPointExpression)Visit(definedByTwoPointsPointExpression.Point2);

            if (point1.X != point2.X || point1.Y != point2.Y)
            {
                throw new InvalidOperationException("Points should have the same coordinates.");
            }

            return(point1);
        }
コード例 #2
0
        protected virtual SLExpression VisitDefinedByTwoPointsPoint(DefinedByTwoPointsPointExpression definedByTwoPointsPointExpression)
        {
            var point1 = Visit(definedByTwoPointsPointExpression.Point1);
            var point2 = Visit(definedByTwoPointsPointExpression.Point2);

            if (point1 != definedByTwoPointsPointExpression.Point1 || point2 != definedByTwoPointsPointExpression.Point2)
            {
                return(new DefinedByTwoPointsPointExpression
                {
                    Point1 = (PointExpression)point1,
                    Point2 = (PointExpression)point2
                });
            }
            return(definedByTwoPointsPointExpression);
        }