49 m_Width( Millimeter2iu( 0.2 ) ), m_Unit(
INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this )
117 if( newAngle >= 3600 )
120 if( newAngle > 900 && newAngle < 2700 )
152 #define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y ) 202 if( featureLine.
Cross( crossBar ) > 0 )
211 const int arrowz = Mils2iu( 50 );
213 int measure, deltax, deltay;
214 int arrow_up_X = 0, arrow_up_Y = 0;
215 int arrow_dw_X = 0, arrow_dw_Y = 0;
217 double angle, angle_f;
230 measure =
KiROUND( hypot( deltax, deltay ) );
232 angle = atan2( (
double)deltay, (
double)deltax );
240 hx =
abs(
KiROUND( ( (
double) deltay * hx ) / measure ) );
241 hy =
abs(
KiROUND( ( (
double) deltax * hy ) / measure ) );
255 angle_f = angle +
DEG2RAD( 27.5 );
256 arrow_up_X = wxRound( arrowz * cos( angle_f ) );
257 arrow_up_Y = wxRound( arrowz * sin( angle_f ) );
258 angle_f = angle -
DEG2RAD( 27.5 );
259 arrow_dw_X = wxRound( arrowz * cos( angle_f ) );
260 arrow_dw_Y = wxRound( arrowz * sin( angle_f ) );
288 arrowz * sin(
DEG2RAD( 27.5 ) ) ) );
297 radius = ( std::copysign( 1.0,
m_Height ) * ii );
303 textPos.
x -=
KiROUND( radius * sin( angle ) );
304 textPos.
y +=
KiROUND( radius * cos( angle ) );
312 if( newAngle > 900 && newAngle < 2700 )
317 if( !aDoNotChangeText )
341 bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill :
FILLED;
442 int xmin, xmax, ymin, ymax;
491 text.Printf( _(
"Dimension \"%s\" on %s" ),
500 return add_dimension_xpm;
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
KICAD_T Type() const
Function Type()
void Offset(const wxPoint &aOffset)
void SetTextAngle(double aAngle)
void Mirror(const wxPoint &axis_pos)
Function Mirror Mirror the Dimension , relative to a given horizontal axis the text is not mirrored...
void SetPosition(const wxPoint &aPos) override
PNG memory record (file in memory).
TEXTE_PCB class definition.
void SetText(const wxString &NewText)
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
const wxPoint & GetTextPos() const
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
Implementation of conversion functions that require both schematic and board internal units...
int m_Height
length of feature lines
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
bool Contains(const wxPoint &aPoint) const
Function Contains.
DIMENSION(BOARD_ITEM *aParent)
Class BOARD to handle a board.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
const wxString GetText() const
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void SetTextPos(const wxPoint &aPoint)
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aColorMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
double RAD2DECIDEG(double rad)
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
int m_Shape
Currently always 0.
void RotatePoint(int *pX, int *pY, double angle)
void NORMALIZE_ANGLE_POS(T &Angle)
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
double GetTextAngle() const
int GetThickness() const
Function GetThickness returns pen width.
This file contains miscellaneous commonly used macros and functions.
DIMENSION class definition.
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
void SetOrigin(const wxPoint &aOrigin)
Function SetOrigin Sets a new origin of the crossbar line.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false) const
Function GetTextBox useful in multiline texts to calculate the full text or a line area (for zones fi...
T EuclideanNorm() const
Destructor.
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Function TextHitTest Test if aPoint is within the bounds of this object.
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
PCB_GENERAL_SETTINGS & Settings()
const wxString & GetText() const
Function GetText returns the string associated with the text object.
void SetEnd(const wxPoint &aEnd)
Function SetEnd Sets a new end of the crossbar line.
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
EDA_DRAW_FRAME * GetParent() const
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect...
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
class DIMENSION, a dimension (graphic item)
COLORS_DESIGN_SETTINGS & Colors()
void AdjustDimensionDetails(bool aDoNotChangeText=false)
Function AdjustDimensionDetails Calculate coordinates of segments used to draw the dimension...
extended_type Cross(const VECTOR2< T > &aVector) const
Function Cross() computes cross product of self with aVector.
void Normalize()
Function Normalize ensures that the height ant width are positive.
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
double DEG2RAD(double deg)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
void Move(const wxPoint &offset) override
Function Move.
void SetHeight(int aHeight)
Function SetHeight Sets the length of feature lines.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
Class EDA_RECT handles the component boundary box.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
int GetTextHeight() const
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
const wxPoint GetPosition() const override
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
void UpdateHeight()
Function UpdateHeight Updates stored height basing on points coordinates.
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
int m_Value
value of PCB dimensions.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
virtual void SetText(const wxString &aText)