Esempio n. 1
0
 public static void BottomCartesian
     (this CorImage image
     )
 {
     image.Graphics.ScaleTransform(1.0F, -1.0F);
     image.Graphics.TranslateTransform(image.Width / 2, -image.Height);
 }
        public void Draw
            (CorImage image
            , bool drawStartEndCircles = false
            )
        {
            float lineWidth = LineWidth < 1 ? 1 : LineWidth;

            image
            .DrawLine
                (Color
                , lineWidth
                , PosVector.Start
                , PosVector.End
                )
            ;
            if (drawStartEndCircles)
            {
                image
                .DrawCircle
                    (PosVector.Start
                    , 100
                    , lineWidth
                    , Color
                    )
                ;
                image
                .DrawCircle
                    (PosVector.End
                    , 100
                    , lineWidth
                    , Color
                    )
                ;
            }
        }
Esempio n. 3
0
 private static void CircleStart
     (CorImage image
     , NavUnit navUnit
     , Color color
     )
 {
     image
     .DrawArc
         (color
         , 1
         , navUnit.XFrom - 3
         , navUnit.YFrom - 3
         , 6
         , 6
         , 0
         , 360
         )
     ;
 }
Esempio n. 4
0
        public static void Draw
            (this List <NavUnit> navUnitList
            , CorImage image
            , float lineWidth
            , CurveType curveType
            , ColorGradientFactory cgf
            )
        {
            cImage = image;
            for (int i = 0; i < navUnitList.Count; i++)
            {
                Color   color   = cgf.ColorAtPercent((0F + i) / (navUnitList.Count - 1F) * 100F);
                NavUnit navUnit = navUnitList[i];
                switch (navUnit.Quadrant)
                {
                case Quadrant.EastToEast:
                case Quadrant.SouthToSouth:
                case Quadrant.WestToWest:
                case Quadrant.NorthToNorth:
                    image
                    .DrawLine
                        (color
                        , lineWidth
                        , navUnit.XFrom
                        , navUnit.YFrom
                        , navUnit.XTo
                        , navUnit.YTo
                        )
                    ;
                    break;

                case Quadrant.EastToSouth:
                case Quadrant.EastToNorth:
                case Quadrant.SouthToWest:                         // ok
                case Quadrant.SouthToEast:
                case Quadrant.WestToNorth:                         // pk
                case Quadrant.WestToSouth:
                case Quadrant.NorthToEast:                         // ok
                case Quadrant.NorthToWest:
                    switch (curveType)
                    {
                    case CurveType.Curve:
                        image
                        .DrawArc
                            (color
                            , lineWidth
                            , navUnit.XFrom + navUnit.XLength * navUnit.XOffset
                            , navUnit.YFrom + navUnit.YLength * navUnit.YOffset
                            , navUnit.XLength * 2
                            , navUnit.YLength * 2
                            , navUnit.StartAngle
                            , navUnit.SweepAngle
                            )
                        ;
                        break;

                    case CurveType.Line:
                        image
                        .DrawLine
                            (color
                            , lineWidth
                            , navUnit.XFrom
                            , navUnit.YFrom
                            , navUnit.XTo
                            , navUnit.YTo
                            )
                        ;
                        break;

                    case CurveType.Square:
                        switch (navUnit.StartDirection)
                        {
                        case Direction.East:
                        case Direction.West:
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom
                                , navUnit.YFrom
                                , navUnit.XTo
                                , navUnit.YFrom
                                )
                            ;
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XTo
                                , navUnit.YFrom
                                , navUnit.XTo
                                , navUnit.YTo
                                )
                            ;
                            break;

                        case Direction.South:
                        case Direction.North:
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom
                                , navUnit.YFrom
                                , navUnit.XFrom
                                , navUnit.YTo
                                )
                            ;
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom
                                , navUnit.YTo
                                , navUnit.XTo
                                , navUnit.YTo
                                )
                            ;
                            break;

                        default:
                            break;
                        }
                        break;

                    case CurveType.Rose:
                        switch (navUnit.StartDirection)
                        {
                        case Direction.South:
                        case Direction.North:
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom
                                , navUnit.YTo
                                , navUnit.XFrom
                                , navUnit.YTo
                                )
                            ;
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XTo
                                , navUnit.YFrom
                                , navUnit.XTo
                                , navUnit.YTo
                                )
                            ;
                            break;

                        case Direction.East:
                        case Direction.West:
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom
                                , navUnit.YFrom
                                , navUnit.XTo
                                , navUnit.YTo
                                )
                            ;
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom
                                , navUnit.YTo
                                , navUnit.XTo
                                , navUnit.YTo
                                )
                            ;
                            break;

                        default:
                            break;
                        }
                        break;

                    case CurveType.ZigZag:
                        //ConDeb
                        //	.Print
                        //	("{0,5} ".FormatWith(navUnit.StartDirection)
                        //	+ navUnit.Quadrant
                        //	)
                        //	;
                        switch (navUnit.StartDirection)
                        {
                        case Direction.South:
                        case Direction.North:
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom                                                         // zz
                                , navUnit.YTo
                                , navUnit.XTo
                                , navUnit.YTo
                                )
                            ;
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom                                                          // zz working
                                , navUnit.YFrom
                                , navUnit.XFrom
                                , navUnit.YTo
                                )
                            ;
                            break;

                        case Direction.East:
                        case Direction.West:
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom                                                          // zz
                                , navUnit.YFrom
                                , navUnit.XFrom
                                , navUnit.YTo
                                )
                            ;
                            image
                            .DrawLine
                                (color
                                , lineWidth
                                , navUnit.XFrom                                                          // zz
                                , navUnit.YTo
                                , navUnit.XTo
                                , navUnit.YTo
                                )
                            ;
                            break;

                        default:
                            break;
                        }
                        //image
                        //	.Save
                        //	(@"d:\numbers\philip\newphilip"
                        //	+ curveType.ToString()
                        //	+ "4"
                        //	+ "11111111.gif"
                        //	, ImageFormat.Gif
                        //	)
                        //	;
                        break;

                    default:
                        break;
                    }
                    break;

                default:
                    break;
                }
            }
        }