Formatting.

This commit is contained in:
Jeff Young 2020-12-30 19:05:48 +00:00
parent e060ee2a53
commit 0e3c9de684
1 changed files with 29 additions and 76 deletions

View File

@ -67,7 +67,8 @@ public:
* Constructor * Constructor
* Makes an empty line. * Makes an empty line.
*/ */
LINE() : LINK_HOLDER( LINE_T ) LINE() :
LINK_HOLDER( LINE_T )
{ {
m_hasVia = false; m_hasVia = false;
m_width = 1; // Dummy value m_width = 1; // Dummy value
@ -81,11 +82,11 @@ public:
* Copies properties (net, layers, etc.) from a base line and replaces the shape * Copies properties (net, layers, etc.) from a base line and replaces the shape
* by another * by another
**/ **/
LINE( const LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) LINE( const LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) :
: LINK_HOLDER( aBase ), LINK_HOLDER( aBase ),
m_line( aLine ), m_line( aLine ),
m_width( aBase.m_width ), m_width( aBase.m_width ),
m_snapThreshhold( aBase.m_snapThreshhold ) m_snapThreshhold( aBase.m_snapThreshhold )
{ {
m_net = aBase.m_net; m_net = aBase.m_net;
m_layers = aBase.m_layers; m_layers = aBase.m_layers;
@ -134,52 +135,19 @@ public:
} }
///> Returns the shape of the line ///> Returns the shape of the line
const SHAPE* Shape() const override const SHAPE* Shape() const override { return &m_line; }
{
return &m_line;
}
///> Modifiable accessor to the underlying shape ///> Modifiable accessor to the underlying shape
SHAPE_LINE_CHAIN& Line() SHAPE_LINE_CHAIN& Line() { return m_line; }
{ const SHAPE_LINE_CHAIN& CLine() const { return m_line; }
return m_line;
}
///> Const accessor to the underlying shape int SegmentCount() const { return m_line.SegmentCount(); }
const SHAPE_LINE_CHAIN& CLine() const int PointCount() const { return m_line.PointCount(); }
{ int ArcCount() const { return m_line.ArcCount(); }
return m_line;
}
///> Returns the number of segments in the line
int SegmentCount() const
{
return m_line.SegmentCount();
}
///> Returns the number of points in the line
int PointCount() const
{
return m_line.PointCount();
}
///> Returns the number of arcs in the line
int ArcCount() const
{
return m_line.ArcCount();
}
///> Returns the aIdx-th point of the line ///> Returns the aIdx-th point of the line
const VECTOR2I& CPoint( int aIdx ) const const VECTOR2I& CPoint( int aIdx ) const { return m_line.CPoint( aIdx ); }
{ const SEG CSegment( int aIdx ) const { return m_line.CSegment( aIdx ); }
return m_line.CPoint( aIdx );
}
///> Returns the aIdx-th segment of the line
const SEG CSegment( int aIdx ) const
{
return m_line.CSegment( aIdx );
}
///> Sets line width ///> Sets line width
void SetWidth( int aWidth ) void SetWidth( int aWidth )
@ -189,10 +157,7 @@ public:
} }
///> Returns line width ///> Returns line width
int Width() const int Width() const { return m_width; }
{
return m_width;
}
///> Returns true if the line is geometrically identical as line aOther ///> Returns true if the line is geometrically identical as line aOther
bool CompareGeometry( const LINE& aOther ); bool CompareGeometry( const LINE& aOther );
@ -210,21 +175,15 @@ public:
///> Returns the number of corners of angles specified by mask aAngles. ///> Returns the number of corners of angles specified by mask aAngles.
int CountCorners( int aAngles ) const; int CountCorners( int aAngles ) const;
///> Calculates a line thightly wrapping a convex hull ///> Calculates a line thightly wrapping a convex hull of an obstacle object (aObstacle).
///> of an obstacle object (aObstacle).
///> aPrePath = path from origin to the obstacle ///> aPrePath = path from origin to the obstacle
///> aWalkaroundPath = path around the obstacle ///> aWalkaroundPath = path around the obstacle
///> aPostPath = past from obstacle till the end ///> aPostPath = past from obstacle till the end
///> aCW = whether to walk around in clockwise or counter-clockwise direction. ///> aCW = whether to walk around in clockwise or counter-clockwise direction.
bool Walkaround( SHAPE_LINE_CHAIN aObstacle, bool Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, SHAPE_LINE_CHAIN& aWalk,
SHAPE_LINE_CHAIN& aPre, SHAPE_LINE_CHAIN& aPost, bool aCw ) const;
SHAPE_LINE_CHAIN& aWalk,
SHAPE_LINE_CHAIN& aPost,
bool aCw ) const;
bool Walkaround( const SHAPE_LINE_CHAIN& aObstacle, bool Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPath, bool aCw ) const;
SHAPE_LINE_CHAIN& aPath,
bool aCw ) const;
bool Is45Degree() const; bool Is45Degree() const;
@ -275,26 +234,20 @@ private:
void dragSegmentFree( const VECTOR2I& aP, int aIndex ); void dragSegmentFree( const VECTOR2I& aP, int aIndex );
void dragCornerFree( const VECTOR2I& aP, int aIndex ); void dragCornerFree( const VECTOR2I& aP, int aIndex );
VECTOR2I snapToNeighbourSegments( VECTOR2I snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP,
const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP, int aIndex ) const; int aIndex ) const;
VECTOR2I snapDraggedCorner( VECTOR2I snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP,
const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP, int aIndex ) const; int aIndex ) const;
///> The actual shape of the line SHAPE_LINE_CHAIN m_line; ///> The actual shape of the line
SHAPE_LINE_CHAIN m_line; int m_width; ///> our width
///> our width
int m_width;
///> If true, the line ends with a via int m_snapThreshhold; ///> Width to smooth out jagged segments
bool m_hasVia;
///> Width to smooth out jagged segments bool m_hasVia; ///> Optional via at the end point
int m_snapThreshhold; VIA m_via;
///> Via at the end point, if m_hasVia == true
VIA m_via;
}; };
} }