41 static inline wxPoint
twoPointVector(
const wxPoint &startPoint,
const wxPoint &endPoint )
43 return endPoint - startPoint;
61 int mindist = std::max( aAccuracy +
GetPenWidth() / 2,
63 wxPoint relativePosition = aRefPoint;
65 relativePosition.y = -relativePosition.y;
83 double crossProductStart =
CrossProduct( centerStartVector, centerRelativePositionVector );
84 double crossProductEnd =
CrossProduct( centerEndVector, centerRelativePositionVector );
88 if(
CrossProduct( startEndVector, startRelativePositionVector ) < 0 )
90 std::swap( crossProductStart, crossProductEnd );
97 ( crossProductStart <= 0 && crossProductEnd >= 0 );
170 wxPoint offset = aPosition -
m_Pos;
179 m_Pos.x -= aCenter.x;
181 m_Pos.x += aCenter.x;
197 else if(
m_t1 < -3600 ||
m_t2 < -3600 )
206 m_Pos.y -= aCenter.y;
208 m_Pos.y += aCenter.y;
224 else if(
m_t1 < -3600 ||
m_t2 < -3600 )
233 int rot_angle = aRotateCCW ? -900 : 900;
244 else if(
m_t1 < -3600 ||
m_t2 < -3600 )
256 wxASSERT( aPlotter !=
NULL );
273 if( !already_filled || pen_size > 0 )
297 bool forceNoFill = static_cast<bool>( aData );
304 wxPoint pos1, pos2, posc;
312 bool swap = aTransform.
MapAngles( &pt1, &pt2 );
316 std::swap( pos1.x, pos2.x );
317 std::swap( pos1.y, pos2.y );
324 GRArc1(
nullptr, DC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penWidth,
color );
338 int minX, minY, maxX, maxY, angleStart, angleEnd;
340 wxPoint nullPoint, startPos, endPos, centerPos;
344 if( ( normStart == nullPoint ) || ( normEnd == nullPoint ) || (
m_Radius == 0 ) )
355 std::swap( endPos.x, startPos.x );
356 std::swap( endPos.y, startPos.y );
360 minX = std::min( startPos.x, endPos.x );
361 minY = std::min( startPos.y, endPos.y );
362 maxX = std::max( startPos.x, endPos.x );
363 maxY = std::max( startPos.y, endPos.y );
366 if( angleStart == 0 )
370 if( angleStart > angleEnd )
373 if( angleStart <= 900 && angleEnd >= 900 )
376 if( angleStart <= 1800 && angleEnd >= 1800 )
379 if( angleStart <= 2700 && angleEnd >= 2700 )
382 if( angleStart <= 3600 && angleEnd >= 3600 )
386 rect.
SetEnd( maxX, maxY );
402 aList.emplace_back(
_(
"Line Width" ), msg );
404 msg.Printf( wxT(
"(%d, %d, %d, %d)" ), bBox.
GetOrigin().x,
407 aList.emplace_back(
_(
"Bounding Box" ), msg );
433 #define sq( x ) pow( x, 2 ) 461 double chordBefore =
sq( v.x ) +
sq( v.y );
469 double chordAfter =
sq( v.x ) +
sq( v.y );
470 double ratio = chordAfter / chordBefore;
485 m_Radius = int( ( chordA + chordB ) / 2.0 ) + 1;
511 double chordAngle =
ArcTangente( chordVector.y, chordVector.x );
517 m_Pos = c1Test.x > 0 ? c2 : c1;
580 double startAngle = static_cast<double>(
m_t1 ) / 10.0;
581 double endAngle = static_cast<double>(
m_t2 ) / 10.0;
583 if( endAngle < startAngle )
586 double midPointAngle = ( ( endAngle - startAngle ) / 2.0 ) + startAngle;
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
void Rotate(const wxPoint &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
static wxPoint twoPointVector(const wxPoint &startPoint, const wxPoint &endPoint)
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) override
Plot the draw item using the plot object.
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
PNG memory record (file in memory).
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
Print the item to aDC.
Implementation of conversion functions that require both schematic and board internal units.
virtual void SetColor(COLOR4D color)=0
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetOrigin(const wxPoint &pos)
bool IntersectsCircleEdge(const wxPoint &aCenter, const int aRadius, const int aWidth) const
Test for intersection between this rect and the edge (radius) of a circle.
void CalcRadiusAngles()
Calculate the radius and angle of an arc using the start, end, and center points.
EDA_RECT Common(const EDA_RECT &aRect) const
Return the area that is common with another rectangle.
virtual void Arc(const wxPoint ¢re, double StAngle, double EndAngle, int rayon, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)
Generic fallback: arc rendered as a polyline.
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
VECTOR2I CalcMidPoint() const
Calculate the arc mid point using the arc start and end angles and radius length.
void RotatePoint(int *pX, int *pY, double angle)
void NORMALIZE_ANGLE_POS(T &Angle)
The base class for create windows for drawing purpose.
FILL_TYPE m_fill
The body fill type.
bool Contains(const wxPoint &aPoint) const
The base class for drawable items used by schematic library components.
void MirrorVertical(const wxPoint &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
const wxPoint GetEnd() const
FILL_TYPE GetFillMode() const
COMPARE_FLAGS
The list of flags used by the compare function.
const wxPoint GetOrigin() const
void SetEnd(int x, int y)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
#define MINIMUM_SELECTION_DISTANCE
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Define a library symbol object.
void MoveTo(const wxPoint &aPosition) override
Move a draw object to aPosition.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
double CrossProduct(const wxPoint &vectorA, const wxPoint &vectorB)
Determine the cross product.
wxDC * GetPrintDC() const
#define STRUCT_DELETED
flag indication structures to be erased
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
const BITMAP_OPAQUE add_arc_xpm[1]
void CalcEdit(const wxPoint &aPosition) override
Calculates the attributes of an item at aPosition when it is being edited.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
void GRFilledArc(EDA_RECT *ClipBox, wxDC *DC, int x, int y, double StAngle, double EndAngle, int r, int width, COLOR4D Color, COLOR4D BgColor)
void MirrorHorizontal(const wxPoint &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Base plotter engine class.
int GetWidth() const override
RENDER_SETTINGS * RenderSettings()
TRANSFORM DefaultTransform
double DEG2RAD(double deg)
int GetPenWidth() const override
LIB_ARC(LIB_PART *aParent)
bool HitTestPoints(const wxPoint &pointA, const wxPoint &pointB, double threshold)
Test, if two points are near each other.
void Offset(const wxPoint &aOffset) override
Set the drawing object by aOffset from the current position.
Handle the component boundary box.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
A base class for most all the KiCad significant classes used in schematics and boards.
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
int GetDefaultPenWidth() const
int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const override
Provide the draw object specific comparison called by the == and < operators.
int GetMinPenWidth() const
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
double ArcTangente(int dy, int dx)
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Message panel definition file.
void BeginEdit(const wxPoint aStartPoint) override
Begin drawing a component library draw item at aPosition.
virtual int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const
Provide the draw object specific comparison called by the == and < operators.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Returns the type of object.
wxPoint GetPosition() const override
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
A color representation with 4 components: red, green, blue, alpha.