Example #1
0
 public static void Drive
     (this List <NavUnit> navUnitList
     , string map
     , Direction direction
     , float x
     , float y
     , float unitWidth
     , float unitHeight
     )
 {
     foreach (char mapChar in map)
     {
         NavUnit navUnit =
             new NavUnit
                 (direction
                 , x
                 , y
                 , unitWidth
                 , unitHeight
                 )
         ;
         navUnit
         .Drive
             (mapChar.ToString()
             )
         ;
         navUnitList.Add(navUnit);
         x         = navUnit.XTo;
         y         = navUnit.YTo;
         direction = navUnit.EndDirection;
     }
 }
Example #2
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
         )
     ;
 }
Example #3
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;
                }
            }
        }