Ejemplo n.º 1
0
        static void test()
        {
            var testOfTest = new Coordinate(55.02285, 82.93245);

            Console.WriteLine(testOfTest.UTM);
            var    firstLineFirstPoint   = new Point2(1, 1);
            var    firstLineSecondPoint  = new Point2(5, 5);
            var    secondLineFirstPoint  = new Point2(0, 2);
            var    secondLineSecondPoint = new Point2(0, 5);
            Point2 intersectPoint;

            Line2.LineIntersectWithLine(firstLineFirstPoint, firstLineSecondPoint, secondLineFirstPoint, secondLineSecondPoint, out intersectPoint);

            //GeoPoint[] BiggerPolygonPoints = {new GeoPoint()}
            //var BiggerPolygon = new GeoPolygon()
            var firstGeoPoint  = new GeoPoint(55.02317, 82.9336);
            var secondGeoPoint = new GeoPoint(55.02278, 82.93259);

            var testGeoLine = new GeoLineSegment(firstGeoPoint, secondGeoPoint);
            var result      = testGeoLine.getPerpendicularLine(0.05).resizeFromMiddle(20);

            Console.WriteLine(result.Length());

            // Reproject.ReprojectPoints()
            var test = 0;
        }
        public GeoLineSegment resizeFromMiddle(double toLength)
        {
            var line2            = ToLine2();
            var middlePoint      = Line2.Middle(line2.A, line2.B);
            var geoMiddlePoint   = new GeoPoint(First.LatZone, First.LongZone, middlePoint.X, middlePoint.Y);
            var firstAnchor      = new GeoLineSegment(geoMiddlePoint, First);
            var secondAnchor     = new GeoLineSegment(geoMiddlePoint, Second);
            var firstResSegment  = firstAnchor.resizeFromFirst(toLength / 2);
            var secondResSegment = secondAnchor.resizeFromFirst(toLength / 2);

            return(new GeoLineSegment(firstResSegment.Second, secondResSegment.Second));
        }
        public GeoPoint getIntersectionPoint(GeoLineSegment another)
        {
            Point2 intersectionPoint;
            Point2 a0 = First.toPoint2();
            Point2 b0 = Second.toPoint2();
            Point2 a1 = another.First.toPoint2();
            Point2 b1 = another.Second.toPoint2();

            Line2.LineIntersectWithLine(a0, b0, a1, b1, out intersectionPoint);
            if (intersectionPoint.X == 0 && intersectionPoint.Y == 0)
            {
                return(null);
            }
            return(new GeoPoint(First.LatZone, First.LongZone, intersectionPoint.X, intersectionPoint.Y));
        }
 public bool intersectsWith(GeoLineSegment another)
 {
     return(getIntersectionPoint(another) != null);
 }