Ejemplo n.º 1
0
 /// <summary>
 /// Display the perimeter
 /// </summary>
 /// <param name="g"></param>
 /// <param name="t"></param>
 public void Render(System.Drawing.Graphics g, WorldTransform t)
 {
     foreach (ArbiterPerimeterWaypoint apw in this.PerimeterPoints.Values)
     {
         DrawingUtility.DrawColoredControlLine(DrawingUtility.ColorArbiterPerimiter, System.Drawing.Drawing2D.DashStyle.Dash, apw.Position, apw.NextPerimeterPoint.Position, g, t);
     }
 }
Ejemplo n.º 2
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            Color c = DrawingUtility.ColorToolAngle;

            if (this.p1 != null && this.p2 != null && this.p3 != null)
            {
                Coordinates p2p1 = this.p1.Value - this.p2.Value;
                Coordinates p2p3 = this.p3.Value - this.p2.Value;

                double angleTmp = (p2p1.Dot(p2p3) / (p2p1.Length * p2p3.Length));
                angleTmp = Math.Acos(angleTmp);
                double angleDeg = angleTmp * 180.0 / Math.PI;

                //double angleDeg = p2p1.ToDegrees() - p2p3.ToDegrees();
                string angle = angleDeg.ToString("F6") + " deg";

                DrawingUtility.DrawControlPoint(this.p1.Value, c, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                DrawingUtility.DrawControlPoint(this.p2.Value, c, angle, ContentAlignment.TopCenter, ControlPointStyle.SmallCircle, g, t);
                DrawingUtility.DrawControlPoint(this.p3.Value, c, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid, this.p1.Value, this.p2.Value, g, t);
                DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid, this.p2.Value, this.p3.Value, g, t);
            }
            else if (this.p1 != null && this.p2 != null)
            {
                DrawingUtility.DrawControlPoint(this.p1.Value, c, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                DrawingUtility.DrawControlPoint(this.p2.Value, c, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid, this.p1.Value, this.p2.Value, g, t);
            }
        }
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            if (t.ShouldDraw(this.GetBoundingBox(t)))
            {
                DrawingUtility.DrawColoredControlLine(
                    DrawingUtility.ColorArbiterInterconnect,
                    System.Drawing.Drawing2D.DashStyle.DashDot,
                    this.initialWaypoint.Position,
                    this.finalWaypoint.Position,
                    g, t);

                if (this.InitialGeneric is ArbiterWaypoint && ((ArbiterWaypoint)this.InitialGeneric).WaypointId.LaneId.WayId.Number == 1)
                {
                    DrawingUtility.DrawControlPolygon(this.TurnPolygon, Color.DarkBlue, System.Drawing.Drawing2D.DashStyle.DashDot, g, t);

                    if (this.InnerCoordinates.Count > 1)
                    {
                        DrawingUtility.DrawControlPoint(this.InnerCoordinates[1], Color.DarkBlue, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                    }
                }
                else
                {
                    DrawingUtility.DrawControlPolygon(this.TurnPolygon, Color.DarkGreen, System.Drawing.Drawing2D.DashStyle.DashDot, g, t);

                    if (this.InnerCoordinates.Count > 1)
                    {
                        DrawingUtility.DrawControlPoint(this.InnerCoordinates[1], Color.DarkGreen, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            //if ((t.WorldLowerLeft.X < this.Final.Position.X && t.WorldLowerLeft.Y < this.Final.Position.Y && t.WorldUpperRight.X > this.Final.Position.X && t.WorldUpperRight.Y > this.Final.Position.Y) ||
            //	(t.WorldLowerLeft.X < this.Initial.Position.X && t.WorldLowerLeft.Y < this.Initial.Position.Y && t.WorldUpperRight.X > this.Initial.Position.X && t.WorldUpperRight.Y > this.Initial.Position.Y))
            if (t.ShouldDraw(this.GetBoundingBox(t)))
            {
                Color c;

                if (DrawingUtility.DrawArbiterLanePartitionWays && this.Lane.Way.WayId.Number == 1)
                {
                    c = DrawingUtility.ColorArbiterLanePartitionWay1;

                    DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid,
                                                          this.Initial.Position, this.Final.Position, g, t);
                }
                else if (DrawingUtility.DrawArbiterLanePartitionWays && this.Lane.Way.WayId.Number == 2)
                {
                    c = DrawingUtility.ColorArbiterLanePartitionWay2;

                    DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid,
                                                          this.Initial.Position, this.Final.Position, g, t);
                }
                else if (this.selected == SelectionType.SingleSelected)
                {
                    c = Color.Red;

                    DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid,
                                                          this.Initial.Position, this.Final.Position, g, t);
                }
                else
                {
                    if (this.Type == PartitionType.Normal)
                    {
                        c = DrawingUtility.ColorArbiterLanePartitionDefault;
                        DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid,
                                                              this.Initial.Position, this.Final.Position, g, t);
                    }
                    else if (this.Type == PartitionType.Sparse)
                    {
                        c = Color.Black;
                        DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Dash,
                                                              this.Initial.Position, this.Final.Position, g, t);
                    }
                    else
                    {
                        c = Color.DarkOrange;
                        DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Dot,
                                                              this.Initial.Position, this.Final.Position, g, t);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            if (this.Initial != null && this.Current != null)
            {
                DrawingUtility.DrawControlPoint(this.Initial.Value, DrawingUtility.ColorToolRuler, null, System.Drawing.ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t);
                DrawingUtility.DrawControlPoint(this.Current.Value, DrawingUtility.ColorToolRuler, null, System.Drawing.ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t);

                DrawingUtility.DrawColoredControlLine(DrawingUtility.ColorToolRuler, System.Drawing.Drawing2D.DashStyle.Solid,
                                                      this.Initial.Value, this.Current.Value, g, t);

                Coordinates dir   = this.Current.Value - this.Initial.Value;
                Coordinates final = this.Initial.Value + dir.Normalize(dir.Length / 2.0);

                string label = dir.Length.ToString("F6") + " m";

                DrawingUtility.DrawControlPoint(final, DrawingUtility.ColorToolRuler, label, System.Drawing.ContentAlignment.BottomCenter, ControlPointStyle.None, g, t);
            }
        }
Ejemplo n.º 6
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            if (this.Mode == ZoneToolboxMode.StayOut)
            {
                if (this.WrappingHelpers.Count > 0)
                {
                    for (int i = 0; i < this.WrappingHelpers.Count; i++)
                    {
                        DrawingUtility.DrawControlPoint(this.WrappingHelpers[i], Color.SteelBlue, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);

                        if (i + 1 < this.WrappingHelpers.Count)
                        {
                            DrawingUtility.DrawColoredControlLine(Color.SteelBlue, System.Drawing.Drawing2D.DashStyle.Solid,
                                                                  this.WrappingHelpers[i], this.WrappingHelpers[i + 1], g, t);
                        }
                    }

                    if (this.WrappingHelpers.Count > 0)
                    {
                        DrawingUtility.DrawColoredControlLine(Color.SteelBlue, System.Drawing.Drawing2D.DashStyle.Solid,
                                                              this.WrappingHelpers[this.WrappingHelpers.Count - 1], this.CurrentMouse, g, t);
                    }
                }
            }
            else if (this.Mode == ZoneToolboxMode.NavNodes)
            {
                if (this.rightClickNode != null)
                {
                    DrawingUtility.DrawControlPoint(this.rightClickNode.Position, Color.Red, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                }
                else if (this.rightClickEdge != null)
                {
                    DrawingUtility.DrawColoredArrowControlLine(Color.Red, System.Drawing.Drawing2D.DashStyle.Solid,
                                                               this.rightClickEdge.Start.Position, this.rightClickEdge.End.Position, g, t);
                }

                if (this.PreviousNode != null)
                {
                    DrawingUtility.DrawColoredArrowControlLine(Color.DarkBlue, System.Drawing.Drawing2D.DashStyle.Solid,
                                                               this.PreviousNode.Position, this.CurrentMouse, g, t);
                }
            }
        }
Ejemplo n.º 7
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            ArbiterInformation tmpInfo = information;

            if (tmpInfo != null)
            {
                lock (tmpInfo)
                {
                    if (tmpInfo.Route1 != null && tmpInfo.Route1.RoutePlan != null && DrawingUtility.DrawNavigationBestRoute)
                    {
                        Color c = DrawingUtility.ColorNavigationBest;

                        for (int j = 0; j < tmpInfo.Route1.RoutePlan.Count; j++)
                        {
                            if (j == 0 && RemoraCommon.Communicator.GetVehicleState() != null)
                            {
                                DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid, RemoraCommon.Communicator.GetVehicleState().Position, tmpInfo.Route1.RoutePlan[j], g, t);
                            }
                            else if (RemoraCommon.Communicator.GetVehicleState() != null)
                            {
                                DrawingUtility.DrawColoredControlLine(c, System.Drawing.Drawing2D.DashStyle.Solid, tmpInfo.Route1.RoutePlan[j - 1], tmpInfo.Route1.RoutePlan[j], g, t);
                            }
                        }
                    }


                    foreach (ArbiterInformationDisplayObject aido in tmpInfo.DisplayObjects)
                    {
                        if (aido.Type == ArbiterInformationDisplayObjectType.uTurnPolygon)
                        {
                            Polygon p = (Polygon)aido.DisplayObject;
                            if (p.Count > 1)
                            {
                                for (int i = 1; i < p.Count; i++)
                                {
                                    DrawingUtility.DrawColoredControlLine(Color.Orange, System.Drawing.Drawing2D.DashStyle.Solid, p[i - 1], p[i], g, t);
                                }

                                DrawingUtility.DrawColoredControlLine(Color.Orange, System.Drawing.Drawing2D.DashStyle.Solid, p[0], p[p.Count - 1], g, t);
                            }
                        }
                        else if (aido.Type == ArbiterInformationDisplayObjectType.leftBound)
                        {
                            LineList ll = (LineList)aido.DisplayObject;
                            if (ll.Count > 1)
                            {
                                for (int i = 1; i < ll.Count; i++)
                                {
                                    DrawingUtility.DrawColoredControlLine(Color.Blue, System.Drawing.Drawing2D.DashStyle.Solid, ll[i - 1], ll[i], g, t);
                                }
                            }
                        }
                        else if (aido.Type == ArbiterInformationDisplayObjectType.rightBound)
                        {
                            LineList ll = (LineList)aido.DisplayObject;
                            if (ll.Count > 1)
                            {
                                for (int i = 1; i < ll.Count; i++)
                                {
                                    DrawingUtility.DrawColoredControlLine(Color.Red, System.Drawing.Drawing2D.DashStyle.Solid, ll[i - 1], ll[i], g, t);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            if (this.trackedCluster.targetClass == SceneEstimatorTargetClass.TARGET_CLASS_CARLIKE)
            {
                bool clusterStopped = this.trackedCluster.isStopped;
                bool occluded       = ((this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_OCCLUDED_FULL && clusterStopped) ||
                                       (this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_OCCLUDED_PART && clusterStopped));

                Color c = this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_ACTIVE ?
                          DrawingUtility.ColorSimTrafficCar :
                          DrawingUtility.ColorSimDeletedCar;

                if (occluded)
                {
                    c = Color.Chocolate;
                }
                else if ((this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_OCCLUDED_FULL && !clusterStopped) ||
                         (this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_OCCLUDED_PART && !clusterStopped))
                {
                    occluded = true;
                    c        = Color.DarkOrange;
                }

                if (this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_ACTIVE &&
                    this.trackedCluster.isStopped && this.trackedCluster.speedValid)
                {
                    c = Color.Red;
                }
                else if (this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_ACTIVE &&
                         this.trackedCluster.isStopped && !this.trackedCluster.speedValid)
                {
                    c = Color.SkyBlue;
                }

                bool draw = this.trackedCluster.statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_ACTIVE || occluded ?
                            DrawingUtility.DrawSimCars :
                            DrawingUtility.DrawSimCars && DrawingUtility.DrawSimCarDeleted;

                if (draw)
                {
                    Coordinates heading      = (new Coordinates(1, 0)).Rotate(this.trackedCluster.absoluteHeading).Normalize(3.0);
                    Coordinates headingCoord = this.trackedCluster.closestPoint + heading;

                    if (trackedCluster.headingValid)
                    {
                        DrawingUtility.DrawColoredControlLine(Color.Blue, DashStyle.Solid, this.trackedCluster.closestPoint, headingCoord, g, t);
                    }

                    if (DrawingUtility.DrawSimCarId)
                    {
                        DrawingUtility.DrawControlPoint(
                            this.trackedCluster.closestPoint,
                            c,
                            this.trackedCluster.id.ToString(),
                            ContentAlignment.TopLeft,
                            ControlPointStyle.LargeBox,
                            g, t);

                        DrawingUtility.DrawControlPoint(
                            this.trackedCluster.closestPoint,
                            c,
                            this.trackedCluster.speed.ToString("f1"),
                            ContentAlignment.BottomLeft,
                            ControlPointStyle.LargeBox,
                            g, t);

                        DrawingUtility.DrawControlPoint(
                            this.trackedCluster.closestPoint,
                            c,
                            this.PartitionIdString(),
                            ContentAlignment.BottomRight,
                            ControlPointStyle.LargeBox,
                            g, t);
                    }
                    else
                    {
                        DrawingUtility.DrawControlPoint(
                            this.trackedCluster.closestPoint,
                            c,
                            null,
                            ContentAlignment.MiddleCenter,
                            ControlPointStyle.LargeBox,
                            g, t);
                    }
                }
            }
        }
 public void Render(System.Drawing.Graphics g, WorldTransform t)
 {
     DrawingUtility.DrawColoredControlLine(DrawingUtility.ColorArbiterParkingSpot, System.Drawing.Drawing2D.DashStyle.Solid,
                                           this.NormalWaypoint.Position, this.Checkpoint.Position, g, t);
 }
Ejemplo n.º 10
0
 public void Render(System.Drawing.Graphics g, WorldTransform t)
 {
     DrawingUtility.DrawColoredControlLine(DrawingUtility.ColorArbiterUserPartition, System.Drawing.Drawing2D.DashStyle.Dash,
                                           this.InitialGeneric.Position, this.FinalGeneric.Position, g, t);
 }