예제 #1
0
 public void DrawNormalShape(ShapePointInfo shapePointInfos)
 {
     Point[] copyPoints = new Point[shapePointInfos.ShapePoints.Length];
     shapePointInfos.ShapePoints.CopyTo(copyPoints, 0);
     for (int i = 0; i < copyPoints.Length; i++)
     {
         copyPoints[i] = coordinates.ChangeToActual(copyPoints[i]);
     }
     shapePointInfos.ShapePoints = copyPoints;
     shapeDC.DrawNormalShape(shapePointInfos);
 }
예제 #2
0
        //public void EraseNormalShapeSection(Point[] shapePoints,Point[] earsePoints)
        //{
        //    DefaultColor defaultColor = DefaultColor.DefaultColorEx;
        //    Pen drawPen = new Pen(defaultColor.DefaultBackGroundColor);
        //    Color pointColor = defaultColor.DefaultBackGroundColor;
        //    Graphics pe = Graphics.FromImage(bitmap);
        //    for (int i = 1; i < shapePoints.Length; i++)
        //        pe.DrawLine(drawPen, shapePoints[i - 1].X, shapePoints[i - 1].Y, shapePoints[i].X, shapePoints[i].Y);
        //    if (earsePoints != null)
        //    {
        //        for (int i = 0; i < earsePoints.Length; i++)
        //            DrawSinglePoint(pe, earsePoints[i], pointColor);
        //    }
        //    pe.Dispose();
        //}
        public void DrawNormalShape(ShapePointInfo shapePointInfos)
        {
            Point[]      shapePoints  = shapePointInfos.ShapePoints;
            DefaultColor defaultColor = DefaultColor.DefaultColorEx;

            int[]    errorPointIndexs = shapePointInfos.ErrorPointIndexs;
            int[]    warnPointIndexs  = shapePointInfos.WarnPointIndex;
            Pen      drawPen          = new Pen(defaultColor.DefaultShapeColor);
            Graphics pe         = Graphics.FromImage(bitmap);
            Color    pointColor = defaultColor.DefaultShapeColor;

            for (int i = 1; i < shapePoints.Length; i++)
            {
                pointColor    = shapePointInfos.ShapeColor;
                drawPen.Color = defaultColor.DefaultShapeColor;
                if (warnPointIndexs != null)
                {
                    if (Array.IndexOf(warnPointIndexs, i) != -1)
                    {
                        drawPen.Color = defaultColor.DefalultWarnColor;
                    }
                }
                if (errorPointIndexs != null)
                {
                    if (Array.IndexOf(errorPointIndexs, i) != -1)
                    {
                        drawPen.Color = defaultColor.DefaultIrregularColor;
                        pointColor    = defaultColor.DefaultIrregularColor;
                    }
                    else if (Array.IndexOf(errorPointIndexs, i - 1) != -1)
                    {
                        drawPen.Color = defaultColor.DefaultIrregularColor;
                    }
                }
                pe.DrawLine(drawPen, shapePoints[i - 1].X, shapePoints[i - 1].Y, shapePoints[i].X, shapePoints[i].Y);
                if (i == 1)
                {
                    if (errorPointIndexs != null)
                    {
                        if (Array.IndexOf(errorPointIndexs, i - 1) != -1)
                        {
                            pointColor = defaultColor.DefaultIrregularColor;
                        }
                    }
                    DrawSinglePoint(pe, shapePoints[0], pointColor);
                }
                DrawSinglePoint(pe, shapePoints[i], pointColor);
            }
            pe.Dispose();
        }