public void Write(XmlWriter writer, GuidanceGroup guidanceGroup)
        {
            if (guidanceGroup == null)
                return;

            WriteGuidacenGroup(writer, guidanceGroup);
        }
        public void GivenInputNodeWithAttributeAWhenLoadThenGuidanceGroupIdIsMapped()
        {
            _a.Value = "GGP1";

            var guidanceGroup = new GuidanceGroup();
            var guidanceGroupDescriptor = new GuidanceGroupDescriptor(guidanceGroup, null);

            _taskDataDocument.GuidanceGroups.Add(_a.Value, guidanceGroupDescriptor);

            var result = GuidanceShiftLoader.Load(_xmlDoc.GetElementsByTagName("GST"), _taskDataDocument);

            Assert.AreEqual(guidanceGroupDescriptor.Group.Id.ReferenceId, result.GuidanceGroupId);
        }
Beispiel #3
0
        public void ProcessGuidance(GuidanceGroup guidanceGroup, List<GuidancePattern> guidancePatterns)
        {
            using (var graphics = _spatialViewer.CreateGraphics())
            {
                _drawingUtil = new DrawingUtil(_spatialViewer.Width, _spatialViewer.Height, graphics);

                SetMinMax(guidancePatterns, guidanceGroup.GuidancePatternIds);

                foreach (var id in guidanceGroup.GuidancePatternIds)
                {
                    ProcessGuidancePattern(guidancePatterns, id);
                }
            }
        }
        private void WriteGuidacenGroup(XmlWriter writer, GuidanceGroup guidanceGroup)
        {
            writer.WriteStartElement(XmlPrefix);
            var guidanceGroupId = guidanceGroup.Id.FindIsoId() ?? GenerateId();
            TaskWriter.Ids.Add(guidanceGroupId, guidanceGroup.Id);

            writer.WriteAttributeString("A", guidanceGroupId);
            writer.WriteXmlAttribute("B", guidanceGroup.Description);

            WriteGuidancePatterns(writer, guidanceGroup.GuidancePatternIds);
            WriteBoundary(writer, guidanceGroup.BoundingPolygon);

            writer.WriteEndElement();
        }
        private static GuidanceGroupDescriptor LoadGuidanceGroup(XmlNode inputNode, out string groupId)
        {
            groupId = inputNode.GetXmlNodeValue("@A");
            if (string.IsNullOrEmpty(groupId))
                return null;

            var group = new GuidanceGroup();
            group.Description = inputNode.GetXmlNodeValue(@"B");

            group.BoundingPolygon = ShapeLoader.LoadPolygon(inputNode.SelectNodes("PLN[0]"));

            var patterns = GuidancePatternLoader.LoadGuidancePatterns(inputNode.SelectNodes("GPN"));
            group.GuidancePatternIds = patterns.Values.Select(x => x.Id.ReferenceId).ToList();

            return new GuidanceGroupDescriptor(group, patterns);
        }
        public void GivenInputNodeWithAttributeBWhenLoadThenGuidancePatternIdIsMapped()
        {
            _b.Value = "GPN2";

            var guidancePatterns = new Dictionary<string, GuidancePattern>
            {
                {"GPN2", new AbLine()}
            };

            var guidanceGroup = new GuidanceGroup();
            var guidanceGroupDescriptor = new GuidanceGroupDescriptor(guidanceGroup, guidancePatterns);
            _taskDataDocument.GuidanceGroups.Add(_a.Value, guidanceGroupDescriptor);

            var result = GuidanceShiftLoader.Load(_xmlDoc.GetElementsByTagName("GST"), _taskDataDocument);

            Assert.AreEqual(guidancePatterns.First().Value.Id.ReferenceId, result.GuidancePatterId);
        }
 public GuidanceGroupDescriptor(GuidanceGroup group, Dictionary<string, GuidancePattern> patterns)
 {
     Group = group;
     Patterns = patterns;
 }