十字


        private void DrawMeasure(CGContext context, Coordinate coordinate, IList<Line2dObj> lines, Point2d point)
        {
            var top = coordinate.DeviceToLogical (new CGPoint(0, 0));
            var bottom = coordinate.DeviceToLogical (new CGPoint(View.Bounds.Right, View.Bounds.Bottom));

            Line2d xLine = new Line2d (new Point2d(top.X, point.Y), new Point2d(bottom.X, point.Y));
            Line2d yLine = new Line2d (new Point2d(point.X, top.Y), new Point2d(point.X, bottom.Y));

            CrossPoint2d cross = new CrossPoint2d();
            List<CrossPoint2d> crosss = new List<CrossPoint2d>();
            foreach(var line in lines) {
                var iscross = GeoApiLine.Line_Crosses(line.From, line.To, xLine.From, xLine.To,ref cross, 
                    LinePart.InLine,
                    LinePart.InLine);
                if (iscross) 
                    crosss.Add (cross);
                iscross = GeoApiLine.Line_Crosses(line.From, line.To, yLine.From, yLine.To,ref cross, 
                    LinePart.InLine,
                    LinePart.InLine);
                if (iscross) 
                    crosss.Add (cross);
            }
            var arrowLength = coordinate.DeviceToLogical(8);

            foreach (var c in crosss) {
                context.DrawDotLineWithBothArrow (c.point, _currentPoint.Value, arrowLength, coordinate, UIColor.DarkGray.CGColor, 1, new nfloat[] {4,2});
                context.DrawDimension(coordinate,c.point, _currentPoint.Value,Fonts.SystemFont, UIColor.DarkGray.CGColor);
            }            
        }

posted @ 2015-03-19 16:08  cxzhe  阅读(114)  评论(0编辑  收藏  举报