/// <summary> /// Renders the geometry for the spans along a leg. /// </summary> /// <param name="display">The display to draw to</param> /// <param name="spans">Information about each observed span</param> /// <param name="sections">The geometry that corresponds to each span</param> void DrawSpans(ISpatialDisplay display, SpanInfo[] spans, ILineGeometry[] sections) { Debug.Assert(spans.Length == sections.Length); IDrawStyle solidStyle = EditingController.Current.Style(Color.Magenta); IDrawStyle dottedStyle = new DottedStyle(Color.Magenta); for (int i = 0; i < spans.Length; i++) { ILineGeometry geom = sections[i]; IDrawStyle style = (spans[i].HasLine ? solidStyle : dottedStyle); if (geom is IClockwiseCircularArcGeometry) { style.Render(display, (IClockwiseCircularArcGeometry)geom); } else { style.Render(display, new IPosition[] { geom.Start, geom.End }); } if (spans[i].HasEndPoint) { solidStyle.Render(display, geom.End); } } }
/// <summary> /// Draws the circular arcs that are suitable for the next pointing operation. /// As dotted lines. This is based on the list of circles that are associated /// with the last point that was specified. /// </summary> void DrawCurves() { // Use the circles associated with the last point entered (once the // 2nd point has been defined, that's the one we always use). Circle[] circles = (m_Point2 != null ? m_Cir2 : m_Cir1); if (circles == null) { return; } // Highlight the arcs associated with each circle ISpatialDisplay display = EditingController.Current.ActiveDisplay; IDrawStyle dottedBlack = new DottedStyle(Color.Black); IDrawStyle white = new DrawStyle(Color.White); foreach (Circle c in circles) { foreach (ArcFeature arc in c.Arcs) { if (!arc.IsInactive) { arc.Render(display, white); arc.Render(display, dottedBlack); } } } }
private void listBox_SelectedValueChanged(object sender, EventArgs e) { // If we previously had a selected circle, erase it. ISpatialDisplay display = EditingController.Current.ActiveDisplay; if (m_Select != null) { display.PaintNow(); } /* * // If we previously had a selected circle, erase it. Then * // redraw any attached curved (erasing the highlighting * // may have left attached curves looking in poor shape). * * if ( m_pSelect ) { * m_pSelect->Erase(); * CeLayerList curlayer; * m_pSelect->DrawCurves(curlayer); * } */ // Get the new selection. m_Select = GetSel(); if (m_Select == null) { return; } // ... and highlight it. DottedStyle style = new DottedStyle(); m_Select.Render(display, style); }
/// <summary> /// Draws the limit line (if it contains at least 2 positions) /// </summary> /// <param name="display">The display to draw to</param> internal void Render(ISpatialDisplay display) { if (m_Limit == null || m_Limit.Count == 0 || m_Mouse == null) { return; } // Draw dotted line from the last point on the limit line to the last known mouse position int lastIndex = m_Limit.Count - 1; IPosition last = m_Limit[lastIndex]; DottedStyle dottedLine = new DottedStyle(Color.Gray); dottedLine.Render(display, new IPosition[] { last, m_Mouse }); // If we have two or more positions, draw an additional dotted line to the start of // the limit line. if (m_Limit.Count >= 2) { dottedLine.Render(display, new IPosition[] { m_Mouse, m_Limit[0] }); } // Draw the limit line if (m_Limit.Count > 1) { dottedLine.Render(display, m_Limit.ToArray()); } // Draw any limit line selection if (m_LimSel.Count > 0) { HighlightStyle style = new HighlightStyle(); style.ShowLineEndPoints = false; new SpatialSelection(m_LimSel).Render(display, style); } }
internal override void Paint(PointFeature point) { // If applicable circles are defined, ensure they show if (m_Circles != null) { ISpatialDisplay display = ActiveDisplay; IDrawStyle style = new DottedStyle(Color.Magenta); foreach (Circle c in m_Circles) { c.Render(display, style); } } base.Paint(point); }
internal void Draw() // was Paint { // Nothing to do if parallel points undefined. if (m_South == null || m_North == null) { return; } Debug.Assert(m_Line != null); ISpatialDisplay draw = m_Cmd.ActiveDisplay; IDrawStyle solidStyle = EditingController.Current.Style(Color.Magenta); IDrawStyle dottedStyle = new DottedStyle(); ArcFeature arc = m_Line.GetArcBase(); if (arc != null) { // The parallel portion is solid, while the remaining portion of the circle is dotted. CircularArcGeometry cg = new CircularArcGeometry(arc.Circle.Center, m_South, m_North, arc.IsClockwise); solidStyle.Render(draw, cg); cg.IsClockwise = !cg.IsClockwise; dottedStyle.Render(draw, cg); } else { // What's the bearing from the start to the end of the parallel? double bearing = Geom.BearingInRadians(m_South, m_North); // What's the max length of a diagonal crossing the entire screen? double maxdiag = m_Cmd.MaxDiagonal; // Project to a point below the southern end of the parallel, as // well as a point above the northern end. IPosition below = Geom.Polar(m_South, bearing + Constants.PI, maxdiag); IPosition above = Geom.Polar(m_North, bearing, maxdiag); LineSegmentGeometry.Render(below, m_South, draw, dottedStyle); LineSegmentGeometry.Render(m_South, m_North, draw, solidStyle); LineSegmentGeometry.Render(m_North, above, draw, dottedStyle); // If we have an offset point, draw it in green. if (m_Point != null) { m_Point.Draw(draw, Color.Green); } } }
public void Render(ISpatialDisplay display, IDrawStyle style) { if (this.category == CadastralLineCategory.Radial) { style = new DottedStyle(style.LineColor); } if (m_Center == null) { style.Render(display, this.PositionArray); } else { // radius less than zero may represent a counter-clockwise direction bool isClockwise = (this.radius > 0.0); // Define a circular arc that is assumed to run clockwise. ICircleGeometry circle = new CircleGeometry(m_Center.Geometry, Math.Abs(this.radius)); ICircularArcGeometry arc = new CircularArcGeometry(circle, m_From.Geometry, m_To.Geometry, isClockwise); // Assume clockwise, see what it looks like style.Render(display, arc); } /* * else * { * if (!this.arcLengthSpecified) * throw new ApplicationException("Cannot determine arc direction"); * * // Define a circular arc that is assumed to run clockwise. * CircleGeometry circle = new CircleGeometry(m_Center.Geometry, this.radius); * CircularArcGeometry arc = new CircularArcGeometry(circle, m_From.Geometry, m_To.Geometry, true); * * // Assume clockwise, see what it looks like * new DrawStyle(Color.Red).Render(display, arc); * * //double arcLength = arc.Length.Meters; * //double othLength = circle.Length.Meters; * * //// Get the arc length in meters (TODO: need to access file header to determine how to convert lengths) * //if (Math.Abs(othLength - this.arcLength) < Math.Abs(arcLength - this.arcLength)) * // arc.IsClockwise = false; * } */ }
/// <summary> /// Draws the current state of the edit /// </summary> internal void Draw() { Debug.Assert(m_Line != null); ISpatialDisplay view = ActiveDisplay; // Figure out the positions for the ends of the parallel line (if any) ... // Assume we already know both terminals. IPosition start = m_Term1; IPosition end = m_Term2; // If either one is undefined, but a dialog for it is active, // try to get the terminal from there instead. if (m_TermDial1 != null && start == null) { start = m_TermDial1.TerminalPosition; } if (m_TermDial2 != null && end == null) { end = m_TermDial2.TerminalPosition; } // If they weren't actually defined, use the parallel points instead. if (start == null) { start = m_Par1; } if (end == null) { end = m_Par2; } // If those weren't defined either, try to calculate them now. if (end == null && Calculate()) { start = m_Par1; end = m_Par2; } // Any offset point if (m_OffsetPoint != null) { m_OffsetPoint.Draw(view, Color.Green); } // Everything else should draw in usual command-style colour. IDrawStyle style = EditingController.Current.Style(Color.Magenta); IDrawStyle dottedStyle = new DottedStyle(); // If the reference line is a curve, get the curve info. ArcFeature arc = m_Line.GetArcBase(); if (arc != null) { bool iscw = arc.IsClockwise; // Reverse the direction if necessary. if (m_IsReversed) { iscw = !iscw; } // Draw the parallel line (the rest of the circle being dotted). if (start != null) { CircularArcGeometry parArc = new CircularArcGeometry(arc.Circle, start, end, iscw); style.Render(view, parArc); parArc.IsClockwise = !parArc.IsClockwise; dottedStyle.Render(view, parArc); } } else { // PARALLEL IS STRAIGHT // If we've got something, figure out positions for dotted portion. if (start != null) { // What's the max length of a diagonal crossing the entire screen? double maxdiag = this.MaxDiagonal; // What's the bearing from the start to the end of the parallel? double bearing = Geom.BearingInRadians(start, end); // Project to a point before the start end of the parallel, as // well as a point after the end. IPosition before = Geom.Polar(start, bearing + Constants.PI, maxdiag); IPosition after = Geom.Polar(end, bearing, maxdiag); LineSegmentGeometry.Render(before, start, view, dottedStyle); LineSegmentGeometry.Render(start, end, view, style); LineSegmentGeometry.Render(end, after, view, dottedStyle); } } // Draw terminal positions (if defined). if (m_Term1 != null) { style.Render(view, m_Term1); } if (m_Term2 != null) { style.Render(view, m_Term2); } // The terminal lines. if (m_TermLine1 != null) { m_TermLine1.Render(view, style); } if (m_TermLine2 != null) { m_TermLine2.Render(view, style); } // Do the active dialog last so their stuff draws on top. if (m_ParDial != null) { m_ParDial.Draw(); } if (m_TermDial1 != null) { m_TermDial1.Draw(); } if (m_TermDial2 != null) { m_TermDial2.Draw(); } }