public void Render(IGraphics g, WorldTransform wt) { LinePath path = line; if (path == null) { return; } PointF[] pts = Utility.ToPointF(path); IPen p = g.CreatePen(); p.Color = color; p.Width = nom_pixel_width / wt.Scale; g.DrawLines(p, pts); p.Dispose(); if (labelPoints) { for (int i = 0; i < path.Count; i++) { DrawingUtility.DrawControlPoint(g, path[i], Color.Black, i.ToString(), ContentAlignment.MiddleRight, ControlPointStyle.SmallX, wt); } } }
public void Render(IGraphics g, WorldTransform wt) { if (avoidanceDetails == null) { return; } if (drawBoundPoints) { PointF vehicleLoc = Utility.ToPointF(Services.VehicleStateService.Location); g.GoToVehicleCoordinates(vehicleLoc, (float)Services.VehicleStateService.Heading + (float)Math.PI / 2.0f); for (int i = 0; i < avoidanceDetails.smoothingDetails.leftBounds.Length; i++) { BoundInformation b = avoidanceDetails.smoothingDetails.leftBounds[i]; DrawingUtility.DrawControlPoint(g, b.point, Color.Blue, null, ContentAlignment.MiddleRight, ControlPointStyle.LargeX, wt); } for (int i = 0; i < avoidanceDetails.smoothingDetails.rightBounds.Length; i++) { BoundInformation b = avoidanceDetails.smoothingDetails.rightBounds[i]; DrawingUtility.DrawControlPoint(g, b.point, Color.Red, null, ContentAlignment.MiddleRight, ControlPointStyle.LargeX, wt); } g.ComeBackFromVehicleCoordinates(); } }
public void Render(IGraphics g, WorldTransform wt) { Polygon curPoly = poly; if (curPoly == null) { return; } IPen pen = g.CreatePen(); pen.Width = nom_pixel_width / wt.Scale; pen.Color = color; if (drawFilled) { g.FillPolygon(Color.FromArgb(100, color), Utility.ToPointF(curPoly)); } g.DrawPolygon(pen, Utility.ToPointF(curPoly)); if (drawCentroid) { DrawingUtility.DrawControlPoint(g, curPoly.GetCentroid(), color, null, ContentAlignment.BottomCenter, ControlPointStyle.LargeX, wt); } pen.Dispose(); }
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); } } } }
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) { Color c; if (selected == SelectionType.SingleSelected) { c = DrawingUtility.ColorArbiterParkingSpotWaypointSelected; } else if (this.isCheckpoint) { c = DrawingUtility.ColorArbiterParkingSpotWaypointCheckpoint; } else { c = DrawingUtility.ColorArbiterParkingSpotWaypoint; } if (DrawingUtility.DisplayArbiterWaypointCheckpointId && this.isCheckpoint) { DrawingUtility.DrawControlPoint(this.position, DrawingUtility.ColorDisplayArbiterCheckpoint, this.checkpointId.ToString(), ContentAlignment.TopCenter, ControlPointStyle.SmallCircle, g, t); } if (DrawingUtility.DisplayArbiterParkingSpotWaypointId) { DrawingUtility.DrawControlPoint(this.position, c, this.WaypointId.ToString(), ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } else { DrawingUtility.DrawControlPoint(this.position, c, null, ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } }
public void Render(System.Drawing.Graphics g, WorldTransform t) { Color c = DrawingUtility.ColorArbiterPerimeterWaypoint; if (selected == SelectionType.SingleSelected) { c = DrawingUtility.ColorArbiterPerimeterWaypointSelected; } else if (this.IsExit) { c = Color.Red; } else if (this.IsEntry) { c = Color.Blue; } if (DrawingUtility.DisplayArbiterPerimeterWaypointId) { DrawingUtility.DrawControlPoint(this.position, c, this.WaypointId.ToString(), ContentAlignment.BottomCenter, ControlPointStyle.SmallBox, g, t); } else { DrawingUtility.DrawControlPoint(this.position, c, null, ContentAlignment.BottomCenter, ControlPointStyle.SmallBox, g, t); } }
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(IGraphics g, WorldTransform wt) { if (location.IsNaN) { return; } DrawingUtility.DrawControlPoint(g, location, color, label, labelAlignment, style, wt); }
private void DrawRuler(IGraphics g, WorldTransform transform, Coordinates start, Coordinates end) { // determine what alignment to use Coordinates diff = end - start; ContentAlignment align; if (diff.X > 0 && diff.Y > 0) { align = ContentAlignment.MiddleRight; } else if (diff.X < 0 && diff.Y > 0) { align = ContentAlignment.MiddleLeft; } else if (diff.X < 0 && diff.Y < 0) { align = ContentAlignment.MiddleLeft; } else if (diff.X > 0 && diff.Y < 0) { align = ContentAlignment.MiddleRight; } else if (diff.X == 0 && diff.Y > 0) { align = ContentAlignment.MiddleRight; } else if (diff.X == 0 && diff.Y < 0) { align = ContentAlignment.MiddleRight; } else if (diff.X < 0 && diff.Y == 0) { align = ContentAlignment.MiddleLeft; } else if (diff.X > 0 && diff.Y == 0) { align = ContentAlignment.MiddleRight; } else { align = ContentAlignment.MiddleRight; } double dist = diff.VectorLength; string label = dist.ToString("F2") + " m, (" + end.X.ToString("F1") + "," + end.Y.ToString("F1") + ")"; using (IPen pen = g.CreatePen()) { pen.Color = Color.DarkRed; pen.Width = 1.5f / transform.Scale; g.DrawLine(pen, Utility.ToPointF(start), Utility.ToPointF(end)); } DrawingUtility.DrawControlPoint(g, start, Color.DarkRed, null, ContentAlignment.BottomRight, ControlPointStyle.LargeCircle, transform); DrawingUtility.DrawControlPoint(g, end, Color.DarkRed, label, align, ControlPointStyle.LargeCircle, transform); }
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) { // default color Color c = DrawingUtility.ColorSimObstacles; // check selection if (this.selected == SelectionType.SingleSelected) { c = DrawingUtility.ColorSimSelectedObstacle; } else if (this.isBlockage) { c = DrawingUtility.ColorSimObstacleBlockage; } // draw box // width of drawing float penWidth = nomPixelWidth / t.Scale; // body rectangle RectangleF bodyRect = new RectangleF((float)(-(float)this.Width / 2), (-(float)this.Length / 2), (float)Width, (float)Length); // body transformation matrix Matrix bodyTrans = new Matrix(); bodyTrans.Rotate((float)(this.Heading.ToDegrees() - 90)); bodyTrans.Translate((float)Position.X, (float)Position.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; // make a new pen and draw obstacle body using (Pen p = new Pen(c, penWidth)) { g.DrawRectangle(p, bodyRect.X, bodyRect.Y, bodyRect.Width, bodyRect.Height); } // return to normal transformation g.Transform = origTrans; // draw id if (DrawingUtility.DrawSimObstacleIds) { DrawingUtility.DrawControlLabel(this.Position, c, this.ObstacleId.ToString(), ContentAlignment.MiddleCenter, ControlPointStyle.SmallX, g, t); } else { DrawingUtility.DrawControlPoint(this.Position, c, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallX, g, t); } }
public void Render(IGraphics g, WorldTransform wt) { if (points == null) { return; } for (int i = 0; i < points.Length; i++) { DrawingUtility.DrawControlPoint(g, points[i], color, null, ContentAlignment.BottomCenter, style, wt); } }
public void Render(System.Drawing.Graphics g, WorldTransform t) { Color c = DrawingUtility.ColorRndfEditorTemporaryPoint; foreach (KeyValuePair <string, Coordinates> point in Points) { if (!DrawingUtility.DrawRndfEditorTemporaryPointId) { DrawingUtility.DrawControlPoint(point.Value, c, null, ContentAlignment.TopCenter, ControlPointStyle.SmallCircle, g, t); } else { DrawingUtility.DrawControlPoint(point.Value, c, point.Key, ContentAlignment.TopCenter, ControlPointStyle.SmallCircle, g, t); } } }
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); } }
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); } } }
public void Render(System.Drawing.Graphics g, WorldTransform t) { //if (t.WorldLowerLeft.X < this.Position.X && t.WorldLowerLeft.Y < this.position.Y && t.WorldUpperRight.X > this.position.X && t.WorldUpperRight.Y > this.position.Y) if (t.ShouldDraw(this.GetBoundingBox(t))) { Color c; if (this.isCheckpoint && this.IsStop) { c = DrawingUtility.ColorArbiterWaypointStopCheckpoint; } else if (this.isCheckpoint) { c = DrawingUtility.ColorArbiterWaypointCheckpoint; } else if (this.IsStop) { c = DrawingUtility.ColorArbiterWaypointStop; } else { c = DrawingUtility.ColorArbiterWaypoint; } if (this.isCheckpoint && DrawingUtility.DisplayArbiterWaypointCheckpointId) { DrawingUtility.DrawControlPoint(this.position, DrawingUtility.ColorDisplayArbiterCheckpoint, this.checkpointId.ToString(), ContentAlignment.TopCenter, ControlPointStyle.SmallCircle, g, t); } if (DrawingUtility.DisplayArbiterWaypointId) { DrawingUtility.DrawControlPoint(this.position, c, this.WaypointId.ToString(), ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } else { DrawingUtility.DrawControlPoint(this.position, c, null, ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } } }
public void Render(System.Drawing.Graphics g, WorldTransform t) { Color c; if (this.selected == SelectionType.NotSelected) { c = DrawingUtility.ColorArbiterUserWaypoint; } else { c = DrawingUtility.ColorArbiterUserWaypointSelected; } if (DrawingUtility.DisplayArbiterWaypointId) { DrawingUtility.DrawControlPoint(this.position, c, this.WaypointId.ToString(), ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } else { DrawingUtility.DrawControlPoint(this.position, c, null, ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, 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); } } }
/// <summary> /// What happens when we paint /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { // clear the background e.Graphics.Clear(BackColor); // center on tracked vehicle if exists if (this.tracked != null) { // Get the offset. Point point = new Point(this.ClientRectangle.Width / 2, this.ClientRectangle.Height / 2); // get screen po of vehicle PointF screenCarPos = this.transform.GetScreenPoint(this.tracked.Position); // Calculate change in Position double deltaX = ((double)screenCarPos.X) - point.X; double deltaY = ((double)screenCarPos.Y) - point.Y; // Update the world Coordinates tempCenter = WorldTransform.CenterPoint; tempCenter.X += deltaX / WorldTransform.Scale; tempCenter.Y -= deltaY / WorldTransform.Scale; WorldTransform.CenterPoint = tempCenter; } // save the graphics state GraphicsState gs = e.Graphics.Save(); // set the drawing modes e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //.HighSpeed;//.HighQuality; e.Graphics.CompositingQuality = CompositingQuality.HighSpeed; //.HighQuality; e.Graphics.InterpolationMode = InterpolationMode.Bilinear; //.Bicubic; e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; // set the transform e.Graphics.Transform = transform.GetTransform(); // paint the display objects foreach (IDisplayObject obj in displayObjects) { // check if we should display the object if (obj.ShouldDraw()) { // render each object obj.Render(e.Graphics, transform); } } // render ai vehicle if (!this.DesignMode && this.aiVehicle != null && this.aiVehicle.State != null && this.aiVehicle.ShouldDraw()) { this.aiVehicle.Render(e.Graphics, transform); } // render ai information if (!this.DesignMode && RemoraCommon.aiInformation.ShouldDraw()) { RemoraCommon.aiInformation.Render(e.Graphics, transform); } // render current tool if (!this.DesignMode && this.CurrentEditorTool != null && this.CurrentEditorTool.ShouldDraw()) { this.CurrentEditorTool.Render(e.Graphics, transform); } // render current tool if (!this.DesignMode && this.SecondaryEditorTool != null && this.SecondaryEditorTool.ShouldDraw()) { this.SecondaryEditorTool.Render(e.Graphics, transform); } // render observed vehicles if (!this.DesignMode && RemoraCommon.Communicator.GetObservedVehicles() != null) { SceneEstimatorTrackedClusterCollection setcc = RemoraCommon.Communicator.GetObservedVehicles(); for (int i = 0; i < setcc.clusters.Length; i++) { SensedVehicleDisplay svd = new SensedVehicleDisplay(setcc.clusters[i]); svd.Render(e.Graphics, this.WorldTransform); } } if (!this.DesignMode) { // render driver side sick VehicleState state = RemoraCommon.Communicator.GetVehicleState(); if (state != null) { Coordinates dvec = state.Front - state.Position; Coordinates driverVec = dvec.Rotate90(); SideObstacles dsobs = RemoraCommon.Communicator.GetSideObstacles(SideObstacleSide.Driver); if (dsobs != null) { foreach (SideObstacle so in dsobs.obstacles) { if (so.height > 0.7) { Coordinates cVec = state.Position + driverVec.Normalize(so.distance); DrawingUtility.DrawControlPoint(cVec, Color.Black, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeX, e.Graphics, this.WorldTransform); } } } // render driver side sick Coordinates pvec = state.Front - state.Position; Coordinates passVec = dvec.RotateM90(); SideObstacles psobs = RemoraCommon.Communicator.GetSideObstacles(SideObstacleSide.Passenger); if (psobs != null) { foreach (SideObstacle so in psobs.obstacles) { if (so.height > 0.7) { Coordinates cVec = state.Position + passVec.Normalize(so.distance); DrawingUtility.DrawControlPoint(cVec, Color.Black, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeX, e.Graphics, this.WorldTransform); } } } } } // render observed obstacles if (!this.DesignMode && RemoraCommon.Communicator.GetVehicleState() != null && RemoraCommon.RoadNetwork != null) { // set and render obstacleDisplay.untrackedClusters = RemoraCommon.Communicator.GetObservedObstacles(); obstacleDisplay.trackedClusters = RemoraCommon.Communicator.GetObservedVehicles(); obstacleDisplay.Render(e.Graphics, this.WorldTransform); } // restore the graphics state e.Graphics.Restore(gs); }
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) { if (!this.snapToWaypoints || this.roadNetwork == null) { if (this.Current != null) { LLACoord lla = GpsTools.XyToLlaDegrees(Current, projection); string locString = Current.X.ToString("F6") + ", " + Current.Y.ToString("F6") + "\n" + lla.lat.ToString("F6") + ", " + lla.lon.ToString("F6") + "\n" + GpsTools.LlaDegreesToArcMinSecs(lla); DrawingUtility.DrawControlPoint(this.Current, DrawingUtility.ColorToolPointAnalysis, locString, ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } if (Save != null && Save.Count > 0) { foreach (Coordinates tmp in Save) { LLACoord lla = GpsTools.XyToLlaDegrees(tmp, projection); string locString = tmp.X.ToString("F6") + ", " + tmp.Y.ToString("F6") + "\n" + lla.lat.ToString("F6") + ", " + lla.lon.ToString("F6") + "\n" + GpsTools.LlaDegreesToArcMinSecs(lla); DrawingUtility.DrawControlPoint(tmp, DrawingUtility.ColorToolPointAnalysis, locString, ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } } } else { if (this.Current != null) { Coordinates c = this.Current; double minDist = Double.MaxValue; Coordinates?closest = null; foreach (IArbiterWaypoint iaw in this.roadNetwork.ArbiterWaypoints.Values) { double d = iaw.Position.DistanceTo(c); if (d < minDist && ((IDisplayObject)iaw).HitTest(c, (float)0.2, wt, DrawingUtility.DefaultFilter).Hit) { minDist = d; closest = iaw.Position; } } if (closest != null) { c = closest.Value; } LLACoord lla = GpsTools.XyToLlaDegrees(c, projection); string locString = c.X.ToString("F6") + ", " + c.Y.ToString("F6") + "\n" + lla.lat.ToString("F6") + ", " + lla.lon.ToString("F6") + "\n" + GpsTools.LlaDegreesToArcMinSecs(lla); DrawingUtility.DrawControlPoint(c, DrawingUtility.ColorToolPointAnalysis, locString, ContentAlignment.BottomCenter, ControlPointStyle.SmallCircle, g, t); } } }
public void Render(IGraphics g, WorldTransform wt) { List <InternalTrackedCluster> trackedClusters = this.trackedClusters; float vehicleHeading = (float)Services.VehicleStateService.Heading; PointF vehiclePos = Utility.ToPointF(Services.VehicleStateService.Location); g.GoToVehicleCoordinates(vehiclePos, vehicleHeading + (float)Math.PI / 2.0f); SizeF boxSize = new SizeF(2 * point_box_size, 2 * point_box_size); foreach (InternalTrackedCluster cluster in trackedClusters) { // determine cluster color Color clusterColor; switch (cluster.targetClass) { case SceneEstimatorTargetClass.TARGET_CLASS_CARLIKE: clusterColor = carlikeColor; break; case SceneEstimatorTargetClass.TARGET_CLASS_NOTCARLIKE: clusterColor = notcarColor; break; case SceneEstimatorTargetClass.TARGET_CLASS_UNKNOWN: default: clusterColor = unknownColor; break; } if (cluster.targetStatus == SceneEstimatorTargetStatusFlag.TARGET_STATE_DELETED) { clusterColor = Color.FromArgb(deleted_alpha, clusterColor); } if (drawPoints) { // render the points IPen pen = g.CreatePen(); pen.Color = clusterColor; pen.Width = nominal_pixel_size / wt.Scale; for (int j = 0; j < cluster.points.Length; j++) { g.DrawRectangle(pen, new RectangleF(cluster.points[j], boxSize)); } } if (drawPolygon) { IPen pen = g.CreatePen(); pen.Color = clusterColor; pen.Width = nominal_pixel_size / wt.Scale; g.DrawPolygon(pen, Utility.ToPointF(cluster.polygon)); } // if we're stopped, draw an x at the center of the polygon if (cluster.isStopped) { DrawingUtility.DrawControlPoint(g, cluster.polygon.GetCentroid(), Color.Red, null, ContentAlignment.BottomCenter, ControlPointStyle.LargeX, wt); } else { // draw a vector pointing from the centroid of the polygon out } } g.ComeBackFromVehicleCoordinates(); }
public void Render(System.Drawing.Graphics g, WorldTransform t) { // width of drawing float penWidth = nomPixelWidth / t.Scale; // body rectangle RectangleF bodyRect = new RectangleF((float)(-this.Width / 2), -rearOffset, (float)Width, (float)Length); // body transformation matrix Matrix bodyTrans = new Matrix(); bodyTrans.Rotate((float)(this.Heading.ToDegrees() - 90)); bodyTrans.Translate((float)Position.X, (float)Position.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; // make a new pen and draw wheels using (Pen p = new Pen(color, penWidth)) { DrawRectangle(g, p, bodyRect); // build the transform for the rear wheels // do the left wheel Matrix wheelTransform = bodyTrans.Clone(); wheelTransform.Translate(-wheelOffset, 0, MatrixOrder.Prepend); g.Transform = wheelTransform; g.FillRectangle(Brushes.White, wheelRectL); DrawRectangle(g, p, wheelRectL); // do the right wheel wheelTransform = bodyTrans.Clone(); wheelTransform.Translate(wheelOffset, 0, MatrixOrder.Prepend); g.Transform = wheelTransform; g.FillRectangle(Brushes.White, wheelRectR); DrawRectangle(g, p, wheelRectR); // do the front wheels // do the left wheel wheelTransform = bodyTrans.Clone(); wheelTransform.Translate(-wheelOffset, wheelbase, MatrixOrder.Prepend); wheelTransform.Rotate(steeringAngle * 180 / (float)Math.PI, MatrixOrder.Prepend); g.Transform = wheelTransform; g.FillRectangle(Brushes.White, wheelRectL); DrawRectangle(g, p, wheelRectL); // do the right wheel wheelTransform = bodyTrans.Clone(); wheelTransform.Translate(wheelOffset, wheelbase, MatrixOrder.Prepend); wheelTransform.Rotate(steeringAngle * 180 / (float)Math.PI, MatrixOrder.Prepend); g.Transform = wheelTransform; g.FillRectangle(Brushes.White, wheelRectR); DrawRectangle(g, p, wheelRectR); } // return to normal transformation g.Transform = origTrans; // draw car center point DrawingUtility.DrawControlPoint(this.Position, this.color, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeX, g, t); // check if should draw id if (DrawingUtility.DrawSimCarId) { // get length double idOffset = this.Length / 2; if (this.RearAxleType == RearAxleType.Center) { idOffset = this.Length / 3; } // get label position Coordinates labelPosition = this.Position + this.Heading.Normalize(idOffset); // draw label DrawingUtility.DrawControlLabel(labelPosition, this.color, this.Id, ContentAlignment.MiddleCenter, ControlPointStyle.None, g, t); } }