KiCad PCB EDA Suite
Loading...
Searching...
No Matches
geom_test_utils.cpp
Go to the documentation of this file.
1
2
3#include "geom_test_utils.h"
4
5
6std::ostream& boost_test_print_type( std::ostream& os, const SHAPE_LINE_CHAIN& c )
7{
8 os << "SHAPE_LINE_CHAIN: " << c.PointCount() << " points: [\n";
9
10 for( int i = 0; i < c.PointCount(); ++i )
11 {
12 os << " " << i << ": " << c.CPoint( i ) << "\n";
13 }
14
15 os << "]";
16 return os;
17}
18
19std::string toString( const POINT_TYPE& aType )
20{
21 switch( aType )
22 {
23 case PT_NONE: return "PT_NONE";
24 case PT_CENTER: return "PT_CENTER";
25 case PT_END: return "PT_END";
26 case PT_MID: return "PT_MID";
27 case PT_QUADRANT: return "PT_QUADRANT";
28 case PT_CORNER: return "PT_CORNER";
29 case PT_INTERSECTION: return "PT_INTERSECTION";
30 default: return "Unknown POINT_TYPE: " + std::to_string( (int) aType );
31 }
32}
33
34std::ostream& operator<<( std::ostream& os, const TYPED_POINT2I& aPt )
35{
36 os << "TYPED_POINT2I: " << aPt.m_point << " (" << aPt.m_types << ")";
37 return os;
38}
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
std::ostream & operator<<(std::ostream &aStream, const EDA_TEXT &aText)
Definition: eda_text.cpp:1297
std::string toString(const POINT_TYPE &aType)
std::ostream & boost_test_print_type(std::ostream &os, const SHAPE_LINE_CHAIN &c)
POINT_TYPE
Meanings that can be assigned to a point in pure geometric terms.
Definition: point_types.h:38
@ PT_INTERSECTION
The point is an intersection of two (or more) items.
Definition: point_types.h:67
@ PT_CENTER
The point is the center of something.
Definition: point_types.h:46
@ PT_CORNER
The point is a corner of a polygon, rectangle, etc (you may want to infer PT_END from this)
Definition: point_types.h:63
@ PT_NONE
No specific point type.
Definition: point_types.h:42
@ PT_QUADRANT
The point is on a quadrant of a circle (N, E, S, W points).
Definition: point_types.h:58
@ PT_END
The point is at the end of a segment, arc, etc.
Definition: point_types.h:50
@ PT_MID
The point is at the middle of a segment, arc, etc.
Definition: point_types.h:54
VECTOR2I m_point
Definition: point_types.h:77