示例#1
0
        public void ProcessBoundary(FieldBoundary fieldBoundary)
        {
            using (var graphics = _spatialViewer.CreateGraphics())
            {
                _drawingUtil = new DrawingUtil(_spatialViewer.Width, _spatialViewer.Height, graphics);
                foreach (var polygon in fieldBoundary.SpatialData.Polygons)
                {
                    var projectedPoints = polygon.ExteriorRing.Points.Select(point => point.ToUtm()).ToList();
                    _drawingUtil.SetMinMax(projectedPoints);
                    
                    var screenPolygon = projectedPoints.Select(point => point.ToXy(_drawingUtil.MinX, _drawingUtil.MinY, _drawingUtil.GetDelta())).ToArray();

                    graphics.DrawPolygon(DrawingUtil.Pen, screenPolygon);
                }
            }
        }
示例#2
0
        private void LoadFieldBoundary(XmlNode inputNode, Field field)
        {
            var polygon = ShapeLoader.LoadPolygon(inputNode.SelectNodes("PLN"));
            if (polygon != null)
            {
                var fieldBoundary = new FieldBoundary
                {
                    FieldId = field.Id.ReferenceId,
                    SpatialData = polygon,
                };

                _taskDocument.FieldBoundaries.Add(fieldBoundary);

                field.ActiveBoundaryId = fieldBoundary.Id.ReferenceId;
            }
        }