Ejemplo n.º 1
0
        public PlaceXmlModel.Item Generate(IEnumerable <Point> originalPoints)
        {
            if (!CheckPointCount(originalPoints.Count()))
            {
                return(null);
            }

            firstSideOriginalPoints  = originalPoints.Take(originalPoints.Count() / 2).ToList();
            secondSideOriginalPoints = originalPoints.Skip(originalPoints.Count() / 2).ToList();

            PlaceXmlModel.Item examItem = new PlaceXmlModel.Item();
            examItem.SubAreas       = new PlaceXmlModel.SunArea();
            examItem.SubAreas.Areas = new List <PlaceXmlModel.Area>();

            examItem.SubAreas.Areas.Add(GenerateArea0(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea1(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea2(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea3(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea4(originalPoints));
            examItem.Area = GenerateMainArea();

            examItem.Name       = "曲线行驶";
            examItem.Flag       = "20601";
            examItem.PlaceFlag  = "206";
            examItem.Index      = "001";
            examItem.Cls        = "QX";
            examItem.HaveSensor = "false";
            //examItem.StartArea = "2060103";
            examItem.StartMode = "0";

            return(examItem);
        }
Ejemplo n.º 2
0
 public void GenerateItem(IExamItemGenerator itemGenerator)
 {
     examItem = itemGenerator.Generate(OriginalPoints.Select(mp => new Point(mp.X, mp.Y)));
     DrawItem(examItem);
     //foreach (var area in examItem.SubAreas.Areas)
     //{
     //    DrawArea(Plot1,Brushes.Blue, ConvertPointsCollection(area.Points));
     //}
     //DrawArea(Plot1, Brushes.Blue, ConvertPointsCollection(examItem.Area.Points));
 }
Ejemplo n.º 3
0
        private void DrawItem(PlaceXmlModel.Item examItem)
        {
            var polygonMainArea = DrawArea(Plot1, Brushes.Blue, ConvertPointsCollection(examItem.Area.Points));

            DrawText(Plot1, examItem.Flag, double.Parse(examItem.Area.Points[examItem.Area.Points.Count - 1].X), double.Parse(examItem.Area.Points[examItem.Area.Points.Count - 1].Y));
            polygonMainArea.Tag = examItem.Area;
            foreach (var area in examItem.SubAreas.Areas)
            {
                var polygonArea = DrawArea(Plot1, Brushes.Blue, ConvertPointsCollection(area.Points));
                polygonArea.Tag = area;
            }
        }
Ejemplo n.º 4
0
        public PlaceXmlModel.Item Generate(IEnumerable <Point> originalPoints)
        {
            if (!CheckPointCount(originalPoints.Count()))
            {
                return(null);
            }
            PlaceXmlModel.Item examItem = new PlaceXmlModel.Item();
            examItem.SubAreas       = new PlaceXmlModel.SunArea();
            examItem.SubAreas.Areas = new List <PlaceXmlModel.Area>();

            double offsetDis = 0.3;//4,5,6号区偏移距离

            area456belowOffsetPoints = MathEx.TranslatePoints(new List <Point> {
                originalPoints.ElementAt(2), originalPoints.ElementAt(3),
                originalPoints.ElementAt(4), originalPoints.ElementAt(5), originalPoints.ElementAt(6), originalPoints.ElementAt(7),
            }, offsetDis);

            examItem.SubAreas.Areas.Add(GenerateArea0(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea1(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea2(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea3(originalPoints));
            examItem.SubAreas.Areas.Add(GenerateArea4(originalPoints, area456belowOffsetPoints));
            examItem.SubAreas.Areas.Add(GenerateArea5(originalPoints, area456belowOffsetPoints));
            examItem.SubAreas.Areas.Add(GenerateArea6(originalPoints, area456belowOffsetPoints));
            examItem.SubAreas.Areas.Add(GenerateArea7(originalPoints));
            examItem.Area = GenerateMainArea();

            examItem.Name       = "倒车入库";
            examItem.Flag       = "20101";
            examItem.PlaceFlag  = "201";
            examItem.Index      = "001";
            examItem.Cls        = "DK";
            examItem.HaveSensor = "false";
            examItem.StartArea  = "2010103";
            examItem.StartMode  = "0";

            return(examItem);
        }
Ejemplo n.º 5
0
        public PlaceXmlModel.Item Generate(IEnumerable <Point> originalPoints)
        {
            if (!CheckPointCount(originalPoints.Count()))
            {
                return(null);
            }
            PlaceXmlModel.Item examItem = new PlaceXmlModel.Item();
            examItem.SubAreas       = new PlaceXmlModel.SunArea();
            examItem.SubAreas.Areas = new List <PlaceXmlModel.Area>();

            //0号区
            List <Point> offsetPointsTmp = MathEx.TranslatePoints(new List <Point> {
                originalPoints.ElementAt(5), originalPoints.ElementAt(0)
            }, area0OffsetDis);

            areasPoints[0] = new List <Point> {
                originalPoints.ElementAt(0), originalPoints.ElementAt(5), offsetPointsTmp[0], offsetPointsTmp[1]
            };

            //1号区
            areasPoints[1] = new List <Point>();
            foreach (var p in originalPoints)
            {
                areasPoints[1].Add(p);
            }

            //2号区
            offsetPointsTmp = MathEx.TranslatePoints(new List <Point> {
                originalPoints.ElementAt(2), originalPoints.ElementAt(3)
            }, area2OffsetDis);
            areasPoints[2] = new List <Point> {
                offsetPointsTmp [0], offsetPointsTmp [1], originalPoints.ElementAt(3), originalPoints.ElementAt(2)
            };

            //3号区
            offsetPointsTmp = MathEx.TranslatePoints(new List <Point> {
                originalPoints.ElementAt(0), originalPoints.ElementAt(1), originalPoints.ElementAt(2)
            }, area3OffsetDis);
            areasPoints[3] = new List <Point> {
                originalPoints.ElementAt(0), originalPoints.ElementAt(1), originalPoints.ElementAt(2), offsetPointsTmp[2], offsetPointsTmp[1], offsetPointsTmp[0]
            };

            //4号区
            offsetPointsTmp = MathEx.TranslatePoints(new List <Point> {
                originalPoints.ElementAt(3), originalPoints.ElementAt(4), originalPoints.ElementAt(5)
            }, area4OffsetDis);
            areasPoints[4] = new List <Point> {
                originalPoints.ElementAt(3), originalPoints.ElementAt(4), originalPoints.ElementAt(5), offsetPointsTmp[2], offsetPointsTmp[1], offsetPointsTmp[0]
            };

            mainAreaPoints = new List <Point>
            {
                areasPoints[0][3], areasPoints[3][5], areasPoints[3][4],
                areasPoints[3][3], areasPoints[2][0], areasPoints[2][1],
                areasPoints[4][5], areasPoints[4][4], areasPoints[4][3],
                areasPoints[0][2]
            };

            int i = 1;

            foreach (var points in areasPoints)
            {
                if (points == null)
                {
                    continue;
                }
                var area = new PlaceXmlModel.Area();
                area.Points = new List <PlaceXmlModel.Point>();
                foreach (var p in points)
                {
                    AddPoint2Area(area, p);
                }
                area.Flag = "207010" + i;
                area.Note = "area" + (i - 1);
                examItem.SubAreas.Areas.Add(area);
                i++;
            }

            var areaMain = new PlaceXmlModel.Area();

            areaMain.Points = new List <PlaceXmlModel.Point>();
            foreach (var p in mainAreaPoints)
            {
                AddPoint2Area(areaMain, p);
            }
            areaMain.Flag = "2070100";
            areaMain.Note = "main";
            examItem.Area = areaMain;

            examItem.Name       = "直角转弯";
            examItem.Flag       = "20701";
            examItem.PlaceFlag  = "207";
            examItem.Index      = "001";
            examItem.Cls        = "ZJ";
            examItem.HaveSensor = "false";
            examItem.StartMode  = "0";

            return(examItem);
        }