public void Render(System.Drawing.Graphics g, RndfEditor.Display.Utilities.WorldTransform t)
        {
            // draw the sparse polygon of the selected
            if (this.Toolbox.Partition != null)
            {
                DrawingUtility.DrawControlPolygon(
                    this.Toolbox.Partition.SparsePolygon,
                    Color.DarkSeaGreen, System.Drawing.Drawing2D.DashStyle.Solid, g, t);

                foreach (Coordinates c in this.Toolbox.Partition.SparsePolygon)
                {
                    DrawingUtility.DrawControlPoint(c, Color.DarkSeaGreen, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallX, g, t);
                }

                foreach (Coordinates c in this.Toolbox.tmpPolyCoords)
                {
                    DrawingUtility.DrawControlPoint(c, Color.DarkViolet, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                }

                if (this.Toolbox.tmpPolyCoords.Count > 1)
                {
                    for (int i = 0; i < this.Toolbox.tmpPolyCoords.Count - 1; i++)
                    {
                        DrawingUtility.DrawControlLine(this.Toolbox.tmpPolyCoords[i], this.Toolbox.tmpPolyCoords[i + 1], g, t, null, Color.DarkViolet);
                    }
                }
            }
        }
        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);
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Renders the lane splint
        /// </summary>
        /// <param name="g"></param>
        /// <param name="t"></param>
        /// <remarks>TODO: set lane spline</remarks>
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            Color c = DrawingUtility.ColorArbiterLaneSpline;

            if (DrawingUtility.DisplayArbiterLanes)
            {
                Coordinates cp = t.GetWorldPoint(new PointF(t.ScreenSize.Width / 2, t.ScreenSize.Height / 2));
                Coordinates lp = this.LanePath().GetClosestPoint(cp).Location;
                string      s  = this.LaneId.ToString();
                DrawingUtility.DrawControlLabel(lp, Color.DarkBlue, s, ContentAlignment.MiddleCenter, ControlPointStyle.None, g, t);
            }

            bool displayPolygon = false;

            switch (this.LaneId.Number)
            {
            case 1:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon1;
                break;

            case 2:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon2;
                break;

            case 3:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon3;
                break;

            case 4:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon4;
                break;
            }

            if (displayPolygon && this.LanePolygon != null)
            {
                // show intersection polygon
                HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterLanePolygon, Color.White);

                // populate polygon
                List <PointF> polyPoints = new List <PointF>();
                foreach (Coordinates lpp in this.LanePolygon.points)
                {
                    polyPoints.Add(DrawingUtility.ToPointF(lpp));
                }

                // draw poly and fill
                g.FillPolygon(hBrush1, polyPoints.ToArray());

                DrawingUtility.DrawControlPolygon(this.LanePolygon, DrawingUtility.ColorArbiterLanePolygon, System.Drawing.Drawing2D.DashStyle.Solid, g, t);
            }

            if (DrawingUtility.DisplayArbiterLanePath)
            {
                DrawingUtility.DrawControlLine(this.laneLinePath, g, t, new Pen(Color.MediumVioletRed), Color.MediumVioletRed);
            }
        }
Exemple #4
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            // show intersection safetyzone if supposed to show safety zone (polygon red hatch)
            if (DrawingUtility.DrawArbiterSafetyZones)
            {
                // show intersection polygon
                HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterSafetyZone, Color.White);

                // populate polygon
                List <PointF> polyPoints = new List <PointF>();
                foreach (Coordinates c in this.IntersectionPolygon.points)
                {
                    polyPoints.Add(DrawingUtility.ToPointF(c));
                }

                // draw poly and fill
                g.FillPolygon(hBrush1, polyPoints.ToArray());
            }

            // render stopped exits
            foreach (ArbiterStoppedExit ase in this.StoppedExits)
            {
                ase.Render(g, t);
            }

            // draw intersection polygon
            DrawingUtility.DrawControlPolygon(this.IntersectionPolygon,
                                              DrawingUtility.ColorArbiterIntersection,
                                              DashStyle.DashDotDot,
                                              g, t);

            // show incoming lane points (disjoint from exits)
            foreach (KeyValuePair <ArbiterLane, LinePath.PointOnPath> pop in this.IncomingLanePoints)
            {
                DrawingUtility.DrawControlPoint(pop.Key.LanePath().GetPoint(pop.Value), DrawingUtility.ColorArbiterIntersectionIncomingLanePoints, null,
                                                ContentAlignment.MiddleCenter, ControlPointStyle.SmallX, g, t);
            }

            // show all entries
            foreach (ITraversableWaypoint aw in this.AllEntries.Values)
            {
                DrawingUtility.DrawControlPoint(aw.Position, DrawingUtility.ColorArbiterIntersectionEntries, null,
                                                ContentAlignment.MiddleCenter, ControlPointStyle.LargeCircle, g, t);
            }

            // show all exits
            foreach (ITraversableWaypoint aw in this.AllExits.Values)
            {
                DrawingUtility.DrawControlPoint(aw.Position, DrawingUtility.ColorArbiterIntersectionExits, null,
                                                ContentAlignment.MiddleCenter, ControlPointStyle.LargeCircle, g, t);
            }

            // draw center point
            DrawingUtility.DrawControlPoint(this.Center, DrawingUtility.ColorArbiterIntersection, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeX, g, t);
        }
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            if (DrawingUtility.DrawArbiterZoneMap)
            {
                foreach (Polygon p in this.StayOutAreas)
                {
                    DrawingUtility.DrawControlPolygon(p, Color.SteelBlue, System.Drawing.Drawing2D.DashStyle.Solid, g, t);
                    foreach (Coordinates c in p)
                    {
                        DrawingUtility.DrawControlPoint(c, Color.SteelBlue, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                    }
                }

                foreach (INavigableNode nn in this.NavigationNodes)
                {
                    DrawingUtility.DrawControlPoint(nn.Position, Color.DarkOrange, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallCircle, g, t);
                }

                foreach (NavigableEdge ne in this.NavigableEdges)
                {
                    DrawingUtility.DrawColoredArrowControlLine(Color.DarkBlue, System.Drawing.Drawing2D.DashStyle.Solid, ne.Start.Position, ne.End.Position, g, t);
                }
            }
        }
Exemple #6
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            Polygon     p      = new Polygon();
            Coordinates tCoord = new Coordinates();
            Coordinates loc    = RemoraCommon.Communicator.GetVehicleState().Position;

            // body transformation matrix
            Matrix bodyTrans = new Matrix();

            bodyTrans.Rotate((float)(RemoraCommon.Communicator.GetVehicleState().Heading.ToDegrees()));
            bodyTrans.Translate((float)loc.X, (float)loc.Y, MatrixOrder.Append);

            // save original world transformation matrix
            Matrix origTrans = g.Transform.Clone();

            bodyTrans.Multiply(g.Transform, MatrixOrder.Append);

            // set the new transform
            g.Transform = bodyTrans;

            if (DrawingUtility.DrawSimObstacles)
            {
                if (untrackedClusters != null && untrackedClusters.clusters != null)
                {
                    for (int i = 0; i < untrackedClusters.clusters.Length; i++)
                    {
                        if (untrackedClusters.clusters[i].points.Length > 4)
                        {
                            tCoord = untrackedClusters.clusters[i].points[0];
                            if (Math.Abs(tCoord.X) < 60 && Math.Abs(tCoord.Y) < 60)
                            {
                                p = Polygon.GrahamScan(new List <Coordinates>(untrackedClusters.clusters[i].points));
                                DrawingUtility.DrawControlPolygon(p, Color.Purple, DashStyle.Solid, g, t);
                            }
                        }
                    }
                }
            }

            if (DrawingUtility.DrawSimCars)
            {
                if (trackedClusters != null && trackedClusters.clusters != null)
                {
                    for (int i = 0; i < trackedClusters.clusters.Length; i++)
                    {
                        Color c;

                        if (this.trackedClusters.clusters[i].statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_ACTIVE)
                        {
                            if (this.trackedClusters.clusters[i].targetClass == SceneEstimatorTargetClass.TARGET_CLASS_CARLIKE)
                            {
                                if (this.trackedClusters.clusters[i].isStopped)
                                {
                                    c = Color.Red;
                                }
                                else
                                {
                                    c = DrawingUtility.ColorSimTrafficCar;
                                }
                            }
                            else
                            {
                                c = Color.Pink;
                            }
                        }
                        else
                        {
                            c = DrawingUtility.ColorSimDeletedCar;
                        }

                        bool draw = this.trackedClusters.clusters[i].statusFlag == SceneEstimatorTargetStatusFlag.TARGET_STATE_ACTIVE ?
                                    DrawingUtility.DrawSimCars :
                                    DrawingUtility.DrawSimCars && DrawingUtility.DrawSimCarDeleted;

                        if (draw)
                        {
                            if (trackedClusters.clusters[i].relativePoints.Length > 2)
                            {
                                tCoord = trackedClusters.clusters[i].relativePoints[0];
                                if (Math.Abs(tCoord.X) < t.ScreenSize.Width / 1.5 && Math.Abs(tCoord.Y) < t.ScreenSize.Height / 1.5)
                                {
                                    p = Polygon.GrahamScan(new List <Coordinates>(trackedClusters.clusters[i].relativePoints));
                                    DrawingUtility.DrawControlPolygon(p, c, DashStyle.Solid, g, t);
                                }
                            }
                        }
                    }
                }
            }

            g.Transform = origTrans;
        }