KiCad PCB EDA Suite
KIGFX::SCH_PAINTER Class Reference

Contains methods for drawing schematic-specific items. More...

#include <sch_painter.h>

Inheritance diagram for KIGFX::SCH_PAINTER:
KIGFX::PAINTER

Public Member Functions

 SCH_PAINTER (GAL *aGal)
 
virtual bool Draw (const VIEW_ITEM *, int) override
 Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item. More...
 
virtual SCH_RENDER_SETTINGSGetSettings () override
 Return a pointer to current settings that are going to be used when drawing items. More...
 
void SetSchematic (SCHEMATIC *aSchematic)
 
void SetGAL (GAL *aGal)
 Changes Graphics Abstraction Layer used for drawing items for a new one. More...
 

Protected Attributes

GALm_gal
 Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg. More...
 

Private Member Functions

void draw (LIB_PIN *aPin, int aLayer)
 
void draw (const LIB_SHAPE *aCircle, int aLayer)
 
void draw (const LIB_SYMBOL *aSymbol, int, bool aDrawFields=true, int aUnit=0, int aConvert=0)
 
void draw (const LIB_FIELD *aField, int aLayer)
 
void draw (const LIB_TEXT *aText, int aLayer)
 
void draw (SCH_SYMBOL *aSymbol, int aLayer)
 
void draw (const SCH_JUNCTION *aJct, int aLayer)
 
void draw (const SCH_FIELD *aField, int aLayer)
 
void draw (const SCH_TEXT *aText, int aLayer)
 
void draw (SCH_HIERLABEL *aLabel, int aLayer)
 
void draw (SCH_GLOBALLABEL *aLabel, int aLayer)
 
void draw (const SCH_SHEET *aSheet, int aLayer)
 
void draw (const SCH_NO_CONNECT *aNC, int aLayer)
 
void draw (const SCH_MARKER *aMarker, int aLayer)
 
void draw (const SCH_BITMAP *aBitmap, int aLayer)
 
void draw (const SCH_LINE *aLine, int aLayer)
 
void draw (const SCH_BUS_ENTRY_BASE *aEntry, int aLayer)
 
void drawPinDanglingSymbol (const VECTOR2I &aPos, const COLOR4D &aColor, bool aDrawingShadows)
 
void drawDanglingSymbol (const wxPoint &aPos, const COLOR4D &aColor, int aWidth, bool aDrawingShadows)
 
int internalPinDecoSize (const LIB_PIN &aPin)
 
int externalPinDecoSize (const LIB_PIN &aPin)
 
bool isUnitAndConversionShown (const LIB_ITEM *aItem) const
 
float getShadowWidth () const
 
COLOR4D getRenderColor (const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
 
float getLineWidth (const LIB_ITEM *aItem, bool aDrawingShadows) const
 
float getLineWidth (const SCH_ITEM *aItem, bool aDrawingShadows) const
 
float getTextThickness (const SCH_TEXT *aItem, bool aDrawingShadows) const
 
float getTextThickness (const SCH_FIELD *aItem, bool aDrawingShadows) const
 
float getTextThickness (const LIB_FIELD *aItem, bool aDrawingShadows) const
 
float getTextThickness (const LIB_TEXT *aItem, bool aDrawingShadows) const
 
bool setDeviceColors (const LIB_ITEM *aItem, int aLayer)
 
void triLine (const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
 
void strokeText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 
void boxText (const wxString &aText, const VECTOR2D &aPosition, double aAngle)
 

Private Attributes

SCH_RENDER_SETTINGS m_schSettings
 
SCHEMATICm_schematic
 

Detailed Description

Contains methods for drawing schematic-specific items.

Definition at line 130 of file sch_painter.h.

Constructor & Destructor Documentation

◆ SCH_PAINTER()

KIGFX::SCH_PAINTER::SCH_PAINTER ( GAL aGal)

Definition at line 157 of file sch_painter.cpp.

157  :
158  KIGFX::PAINTER( aGal ),
159  m_schematic( nullptr )
160 { }
SCHEMATIC * m_schematic
Definition: sch_painter.h:197
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57

Member Function Documentation

◆ boxText()

void KIGFX::SCH_PAINTER::boxText ( const wxString &  aText,
const VECTOR2D aPosition,
double  aAngle 
)
private

Definition at line 415 of file sch_painter.cpp.

416 {
417  const STROKE_FONT& font = m_gal->GetStrokeFont();
418  VECTOR2D extents = font.ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(),
419  m_gal->GetLineWidth() );
420  EDA_RECT box( (wxPoint) aPosition, wxSize( extents.x, extents.y ) );
421 
423  box.SetX( box.GetX() - ( box.GetWidth() / 2) );
425  box.SetX( box.GetX() - box.GetWidth() );
426 
428  box.SetY( box.GetY() - ( box.GetHeight() / 2) );
430  box.SetY( box.GetY() - box.GetHeight() );
431 
432  box.Normalize(); // Make h and v sizes always >= 0
433  box = box.GetBoundingBoxRotated((wxPoint) aPosition, RAD2DECIDEG( aAngle ) );
434  box.RevertYAxis();
435  m_gal->DrawRectangle( mapCoords( box.GetOrigin() ), mapCoords( box.GetEnd() ) );
436 }
const STROKE_FONT & GetStrokeFont() const
float GetLineWidth() const
Get the line width.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
double RAD2DECIDEG(double rad)
Definition: trigo.h:234
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify() const
Return current text horizontal justification setting.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
const VECTOR2D & GetGlyphSize() const
static VECTOR2D mapCoords(const wxPoint &aCoord)
EDA_TEXT_VJUSTIFY_T GetVerticalJustify() const
Returns current text vertical justification setting.
Handle the component boundary box.
Definition: eda_rect.h:42

References KIGFX::STROKE_FONT::ComputeStringBoundaryLimits(), KIGFX::GAL::DrawRectangle(), EDA_RECT::GetBoundingBoxRotated(), EDA_RECT::GetEnd(), KIGFX::GAL::GetGlyphSize(), EDA_RECT::GetHeight(), KIGFX::GAL::GetHorizontalJustify(), KIGFX::GAL::GetLineWidth(), EDA_RECT::GetOrigin(), KIGFX::GAL::GetStrokeFont(), KIGFX::GAL::GetVerticalJustify(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, KIGFX::PAINTER::m_gal, KIGFX::mapCoords(), EDA_RECT::Normalize(), RAD2DECIDEG(), EDA_RECT::RevertYAxis(), EDA_RECT::SetX(), EDA_RECT::SetY(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by draw().

◆ Draw()

bool KIGFX::SCH_PAINTER::Draw ( const VIEW_ITEM aItem,
int  aLayer 
)
overridevirtual

Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.

Parameters
aItemis an item to be drawn.
aLayertells which layer is currently rendered so that draw functions may know what to draw (eg. for pads there are separate layers for holes, because they have other dimensions then the pad itself.

Implements KIGFX::PAINTER.

Definition at line 167 of file sch_painter.cpp.

168 {
169  const auto item = dynamic_cast<const EDA_ITEM*>( aItem );
170 
171  if( !item )
172  return false;
173 
174 #ifdef CONNECTIVITY_DEBUG
175 
176  auto sch_item = dynamic_cast<const SCH_ITEM*>( item );
177  auto conn = sch_item ? sch_item->Connection( *g_CurrentSheet ) : nullptr;
178 
179  if( conn )
180  {
181  auto pos = item->GetBoundingBox().Centre();
182  auto label = conn->Name( true );
183 
187  m_gal->SetLineWidth( Mils2ui( 2 ) );
188  m_gal->SetGlyphSize( VECTOR2D( Mils2ui( 20 ), Mils2ui( 20 ) ) );
189  m_gal->StrokeText( conn->Name( true ), pos, 0.0, 0 );
190  }
191 
192 #endif
193 
195  {
196  BOX2I box = item->GetBoundingBox();
197 
198  if( item->Type() == SCH_SYMBOL_T )
199  box = static_cast<const SCH_SYMBOL*>( item )->GetBodyBoundingBox();
200 
201  m_gal->SetIsFill( false );
202  m_gal->SetIsStroke( true );
203  m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 )
204  : COLOR4D( 0.2, 0.2, 0.2, 1 ) );
205  m_gal->SetLineWidth( Mils2iu( 3 ) );
206  m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
207  }
208 
209  switch( item->Type() )
210  {
231 
232  default: return false;
233  }
234 
235  return false;
236 }
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
const Vec GetEnd() const
Definition: box2.h:178
Define a symbol library graphical text item.
Definition: lib_text.h:39
Field object used in symbol libraries.
Definition: lib_field.h:59
Define a library symbol object.
Definition: lib_symbol.h:96
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:42
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:40
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool m_DrawBoundingBoxes
Draw GAL bounding boxes in painters.
Schematic symbol object.
Definition: sch_symbol.h:78
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
#define HANDLE_ITEM(type_id, type_name)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
const Vec & GetOrigin() const
Definition: box2.h:176
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::GAL::DrawRectangle(), ADVANCED_CFG::GetCfg(), BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, HANDLE_ITEM, LIB_FIELD_T, LIB_PIN_T, LIB_SHAPE_T, LIB_SYMBOL_T, LIB_TEXT_T, LIGHTRED, ADVANCED_CFG::m_DrawBoundingBoxes, KIGFX::PAINTER::m_gal, SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), and KIGFX::GAL::StrokeText().

Referenced by draw().

◆ draw() [1/17]

void KIGFX::SCH_PAINTER::draw ( LIB_PIN aPin,
int  aLayer 
)
private

Definition at line 756 of file sch_painter.cpp.

757 {
758  if( !isUnitAndConversionShown( aPin ) )
759  return;
760 
761  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
762  bool drawingDangling = aLayer == LAYER_DANGLING;
763  bool isDangling = m_schSettings.m_IsSymbolEditor || aPin->HasFlag( IS_DANGLING );
764 
765  if( drawingShadows && !aPin->IsSelected() )
766  return;
767 
768  VECTOR2I pos = mapCoords( aPin->GetPosition() );
769  COLOR4D color = getRenderColor( aPin, LAYER_PIN, drawingShadows );
770 
771  if( !aPin->IsVisible() )
772  {
774  {
775  color = getRenderColor( aPin, LAYER_HIDDEN, drawingShadows );
776  }
777  else
778  {
779  if( drawingDangling && isDangling && aPin->IsPowerConnection() )
780  drawPinDanglingSymbol( pos, color, drawingShadows );
781 
782  return;
783  }
784  }
785 
786  if( drawingDangling )
787  {
788  if( isDangling )
789  drawPinDanglingSymbol( pos, color, drawingShadows );
790 
791  return;
792  }
793 
794  VECTOR2I p0;
795  VECTOR2I dir;
796  int len = aPin->GetLength();
797  int orient = aPin->GetOrientation();
798 
799  switch( orient )
800  {
801  case PIN_UP:
802  p0 = VECTOR2I( pos.x, pos.y - len );
803  dir = VECTOR2I( 0, 1 );
804  break;
805 
806  case PIN_DOWN:
807  p0 = VECTOR2I( pos.x, pos.y + len );
808  dir = VECTOR2I( 0, -1 );
809  break;
810 
811  case PIN_LEFT:
812  p0 = VECTOR2I( pos.x - len, pos.y );
813  dir = VECTOR2I( 1, 0 );
814  break;
815 
816  default:
817  case PIN_RIGHT:
818  p0 = VECTOR2I( pos.x + len, pos.y );
819  dir = VECTOR2I( -1, 0 );
820  break;
821  }
822 
823  VECTOR2D pc;
824 
825  m_gal->SetIsStroke( true );
826  m_gal->SetIsFill( false );
827  m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
829  m_gal->SetFontBold( false );
830  m_gal->SetFontUnderlined( false );
831  m_gal->SetFontItalic( false );
832 
833  const int radius = externalPinDecoSize( *aPin );
834  const int diam = radius*2;
835  const int clock_size = internalPinDecoSize( *aPin );
836 
837  if( aPin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
838  {
839  m_gal->DrawLine( p0, pos );
840 
841  m_gal->DrawLine( pos + VECTOR2D( -1, -1 ) * TARGET_PIN_RADIUS,
842  pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
843  m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
844  pos + VECTOR2D( -1, 1 ) * TARGET_PIN_RADIUS );
845  }
846  else
847  {
848  switch( aPin->GetShape() )
849  {
851  m_gal->DrawLine( p0, pos );
852  break;
853 
855  m_gal->DrawCircle( p0 + dir * radius, radius );
856  m_gal->DrawLine( p0 + dir * ( diam ), pos );
857  break;
858 
860  pc = p0 - dir * clock_size ;
861 
862  triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
863  pc,
864  p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
865 
866  m_gal->DrawCircle( p0 + dir * radius, radius );
867  m_gal->DrawLine( p0 + dir * ( diam ), pos );
868  break;
869 
872  pc = p0 - dir * clock_size ;
873 
874  triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
875  pc,
876  p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
877 
878  if( !dir.y )
879  {
880  triLine( p0 + VECTOR2D(dir.x, 0) * diam,
881  p0 + VECTOR2D(dir.x, -1) * diam,
882  p0 );
883  }
884  else /* MapX1 = 0 */
885  {
886  triLine( p0 + VECTOR2D( 0, dir.y) * diam,
887  p0 + VECTOR2D(-1, dir.y) * diam,
888  p0 );
889  }
890 
891  m_gal->DrawLine( p0, pos );
892  break;
893 
895  m_gal->DrawLine( p0, pos );
896 
897  if( !dir.y )
898  {
899  triLine( p0 + VECTOR2D( 0, clock_size ),
900  p0 + VECTOR2D( -dir.x * clock_size, 0 ),
901  p0 + VECTOR2D( 0, -clock_size ) );
902  }
903  else
904  {
905  triLine( p0 + VECTOR2D( clock_size, 0 ),
906  p0 + VECTOR2D( 0, -dir.y * clock_size ),
907  p0 + VECTOR2D( -clock_size, 0 ) );
908  }
909  break;
910 
912  m_gal->DrawLine( p0, pos );
913 
914  if( !dir.y )
915  {
916  triLine( p0 + VECTOR2D(dir.x, 0) * diam,
917  p0 + VECTOR2D(dir.x, -1) * diam,
918  p0 );
919  }
920  else /* MapX1 = 0 */
921  {
922  triLine( p0 + VECTOR2D( 0, dir.y) * diam,
923  p0 + VECTOR2D(-1, dir.y) * diam,
924  p0 );
925  }
926  break;
927 
928  case GRAPHIC_PINSHAPE::OUTPUT_LOW: // IEEE symbol "Active Low Output"
929  m_gal->DrawLine( p0, pos );
930 
931  if( !dir.y ) // Horizontal pin
932  m_gal->DrawLine( p0 - VECTOR2D( 0, diam ), p0 + VECTOR2D( dir.x, 0 ) * diam );
933  else // Vertical pin
934  m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
935  break;
936 
937  case GRAPHIC_PINSHAPE::NONLOGIC: // NonLogic pin symbol
938  m_gal->DrawLine( p0, pos );
939 
940  m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,
941  p0 + VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius );
942  m_gal->DrawLine( p0 - VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius,
943  p0 + VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius );
944  break;
945  }
946  }
947 
948  LIB_SYMBOL* libEntry = aPin->GetParent();
949 
950  // Draw the labels
951  if( drawingShadows
952  && ( libEntry->Type() == LIB_SYMBOL_T || libEntry->IsSelected() )
954  {
955  return;
956  }
957 
958  float penWidth = (float) m_schSettings.GetDefaultPenWidth();
959  int textOffset = libEntry->GetPinNameOffset();
960  float nameStrokeWidth = getLineWidth( aPin, drawingShadows );
961  float numStrokeWidth = getLineWidth( aPin, drawingShadows );
962 
963  nameStrokeWidth = Clamp_Text_PenSize( nameStrokeWidth, aPin->GetNameTextSize(), false );
964  numStrokeWidth = Clamp_Text_PenSize( numStrokeWidth, aPin->GetNumberTextSize(), false );
965 
967 
968  // Four locations around a pin where text can be drawn
969  enum { INSIDE = 0, OUTSIDE, ABOVE, BELOW };
970  int size[4] = { 0, 0, 0, 0 };
971  float thickness[4] = { numStrokeWidth, numStrokeWidth, numStrokeWidth, numStrokeWidth };
972  COLOR4D colour[4];
973  wxString text[4];
974 
975  // TextOffset > 0 means pin NAMES on inside, pin NUMBERS above and nothing below
976  if( textOffset )
977  {
978  size [INSIDE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
979  thickness[INSIDE] = nameStrokeWidth;
980  colour [INSIDE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
981  text [INSIDE] = aPin->GetShownName();
982 
983  size [ABOVE] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
984  thickness[ABOVE] = numStrokeWidth;
985  colour [ABOVE] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
986  text [ABOVE] = aPin->GetShownNumber();
987  }
988  // Otherwise pin NAMES go above and pin NUMBERS go below
989  else
990  {
991  size [ABOVE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
992  thickness[ABOVE] = nameStrokeWidth;
993  colour [ABOVE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
994  text [ABOVE] = aPin->GetShownName();
995 
996  size [BELOW] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
997  thickness[BELOW] = numStrokeWidth;
998  colour [BELOW] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
999  text [BELOW] = aPin->GetShownNumber();
1000  }
1001 
1003  {
1004  size [OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, Millimeter2iu( 0.7 ) );
1005  thickness[OUTSIDE] = float( size[OUTSIDE] ) / 6.0F;
1006  colour [OUTSIDE] = getRenderColor( aPin, LAYER_NOTES, drawingShadows );
1007  text [OUTSIDE] = aPin->GetElectricalTypeName();
1008  }
1009 
1010  if( !aPin->IsVisible() )
1011  {
1012  for( COLOR4D& c : colour )
1013  c = getRenderColor( aPin, LAYER_HIDDEN, drawingShadows );
1014  }
1015 
1016  float insideOffset = textOffset - thickness[INSIDE] / 2.0;
1017  float outsideOffset = Mils2iu( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS - thickness[OUTSIDE] / 2.0;
1018  float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[ABOVE] / 2.0;
1019  float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[BELOW] / 2.0;
1020 
1021  if( isDangling )
1022  outsideOffset += TARGET_PIN_RADIUS / 2.0;
1023 
1024  if( drawingShadows )
1025  {
1026  float shadowWidth = getShadowWidth();
1027 
1028  if( eeconfig()->m_Selection.text_as_box )
1029  {
1030  insideOffset -= thickness[INSIDE] / 2.0;
1031  outsideOffset -= thickness[OUTSIDE] / 2.0;
1032  aboveOffset -= thickness[ABOVE] + penWidth;
1033  belowOffset -= thickness[BELOW] + penWidth;
1034  }
1035 
1036  for( float& t : thickness )
1037  t += shadowWidth;
1038 
1039  insideOffset -= shadowWidth / 2.0;
1040  outsideOffset -= shadowWidth / 2.0;
1041  }
1042 
1043  auto setupDC =
1044  [&]( int i )
1045  {
1046  m_gal->SetGlyphSize( VECTOR2D( size[i], size[i] ) );
1047  m_gal->SetIsStroke( !( drawingShadows && eeconfig()->m_Selection.text_as_box ) );
1048  m_gal->SetLineWidth( thickness[i] );
1049  m_gal->SetStrokeColor( colour[i] );
1050  m_gal->SetIsFill( drawingShadows && eeconfig()->m_Selection.text_as_box );
1051  m_gal->SetFillColor( colour[i] );
1052  };
1053 
1054  auto drawText =
1055  [&]( const wxString& aText, const VECTOR2D& aPos, double aAngle )
1056  {
1057  if( aText.IsEmpty() )
1058  return;
1059 
1060  if( drawingShadows && eeconfig()->m_Selection.text_as_box )
1061  boxText( aText, aPos, aAngle );
1062  else
1063  strokeText( aText, aPos, aAngle );
1064  };
1065 
1066  switch( orient )
1067  {
1068  case PIN_LEFT:
1069  if( size[INSIDE] )
1070  {
1071  setupDC( INSIDE );
1074  drawText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 );
1075  }
1076  if( size[OUTSIDE] )
1077  {
1078  setupDC( OUTSIDE );
1081  drawText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 );
1082  }
1083  if( size[ABOVE] )
1084  {
1085  setupDC( ABOVE );
1088  drawText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
1089  }
1090  if( size[BELOW] )
1091  {
1092  setupDC( BELOW );
1095  drawText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
1096  }
1097  break;
1098 
1099  case PIN_RIGHT:
1100  if( size[INSIDE] )
1101  {
1102  setupDC( INSIDE );
1106  drawText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 );
1107  }
1108  if( size[OUTSIDE] )
1109  {
1110  setupDC( OUTSIDE );
1113  drawText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 );
1114  }
1115  if( size[ABOVE] )
1116  {
1117  setupDC( ABOVE );
1120  drawText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
1121  }
1122  if( size[BELOW] )
1123  {
1124  setupDC( BELOW );
1127  drawText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
1128  }
1129  break;
1130 
1131  case PIN_DOWN:
1132  if( size[INSIDE] )
1133  {
1134  setupDC( INSIDE );
1137  drawText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2 );
1138  }
1139  if( size[OUTSIDE] )
1140  {
1141  setupDC( OUTSIDE );
1144  drawText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2 );
1145  }
1146  if( size[ABOVE] )
1147  {
1148  setupDC( ABOVE );
1151  drawText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
1152  }
1153  if( size[BELOW] )
1154  {
1155  setupDC( BELOW );
1158  drawText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
1159  }
1160  break;
1161 
1162  case PIN_UP:
1163  if( size[INSIDE] )
1164  {
1165  setupDC( INSIDE );
1168  drawText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2 );
1169  }
1170  if( size[OUTSIDE] )
1171  {
1172  setupDC( OUTSIDE );
1175  drawText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2 );
1176  }
1177  if( size[ABOVE] )
1178  {
1179  setupDC( ABOVE );
1182  drawText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
1183  }
1184  if( size[BELOW] )
1185  {
1186  setupDC( BELOW );
1189  drawText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
1190  }
1191  break;
1192 
1193  default:
1194  wxFAIL_MSG( wxT( "Unknown pin orientation" ) );
1195  }
1196 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
int GetPinNameOffset() const
Definition: lib_symbol.h:572
wxString GetShownNumber() const
Definition: lib_pin.h:117
bool IsSelected() const
Definition: eda_item.h:122
int GetOrientation() const
Definition: lib_pin.h:75
GRAPHIC_PINSHAPE GetShape() const
Definition: lib_pin.h:78
int color
Definition: DXF_plotter.cpp:57
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:155
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
void SetFontBold(bool aBold)
Set bold property of current font.
bool ShowPinNumbers() const
Definition: lib_symbol.h:588
Text appears outside the dimension line (default)
Definition: lib_pin.h:48
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
Define a library symbol object.
Definition: lib_symbol.h:96
float getShadowWidth() const
EESCHEMA_SETTINGS * eeconfig()
void boxText(const wxString &aText, const VECTOR2D &aPosition, double aAngle)
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
bool IsPowerConnection() const
Return whether this pin forms an implicit power connection: i.e., is hidden and of type POWER_IN.
Definition: lib_pin.h:188
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:67
#define IS_DANGLING
indicates a pin is dangling
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
wxString const GetElectricalTypeName() const
Definition: lib_pin.h:92
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
bool ShowPinNames() const
Definition: lib_symbol.h:580
void triLine(const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
bool IsVisible() const
Definition: lib_pin.h:97
int GetNameTextSize() const
Definition: lib_pin.h:126
wxString GetShownName() const
Definition: lib_pin.cpp:172
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
static VECTOR2D mapCoords(const wxPoint &aCoord)
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
wxPoint GetPosition() const override
Definition: lib_pin.h:212
int externalPinDecoSize(const LIB_PIN &aPin)
ELECTRICAL_PINTYPE GetType() const
Definition: lib_pin.h:84
LIB_SYMBOL * GetParent() const
Definition: lib_item.h:164
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
int GetNumberTextSize() const
Definition: lib_pin.h:129
void SetFontUnderlined(bool aUnderlined)
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
int GetLength() const
Definition: lib_pin.h:81
int internalPinDecoSize(const LIB_PIN &aPin)
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:38
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:36
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
int GetDefaultPenWidth() const
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
not connected (must be left open)
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
static constexpr int Millimeter2iu(double mm)
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
void drawPinDanglingSymbol(const VECTOR2I &aPos, const COLOR4D &aColor, bool aDrawingShadows)
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References boxText(), Clamp_Text_PenSize(), CLOCK, CLOCK_LOW, color, EESCHEMA_SETTINGS::SELECTION::draw_selected_children, KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawLine(), drawPinDanglingSymbol(), KIGFX::eeconfig(), externalPinDecoSize(), FALLING_EDGE_CLOCK, KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), LIB_PIN::GetElectricalTypeName(), LIB_PIN::GetLength(), getLineWidth(), LIB_PIN::GetNameTextSize(), LIB_PIN::GetNumberTextSize(), LIB_PIN::GetOrientation(), LIB_ITEM::GetParent(), LIB_SYMBOL::GetPinNameOffset(), LIB_PIN::GetPosition(), getRenderColor(), getShadowWidth(), LIB_PIN::GetShape(), LIB_PIN::GetShownName(), LIB_PIN::GetShownNumber(), LIB_PIN::GetType(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, EDA_ITEM::HasFlag(), INPUT_LOW, internalPinDecoSize(), INVERTED, INVERTED_CLOCK, IS_DANGLING, LIB_PIN::IsPowerConnection(), EDA_ITEM::IsSelected(), isUnitAndConversionShown(), LIB_PIN::IsVisible(), KiROUND(), LAYER_DANGLING, LAYER_HIDDEN, LAYER_NOTES, LAYER_PIN, LAYER_PINNAM, LAYER_PINNUM, LAYER_SELECTION_SHADOWS, LIB_SYMBOL_T, LINE, KIGFX::PAINTER::m_gal, KIGFX::SCH_RENDER_SETTINGS::m_IsSymbolEditor, m_schSettings, EESCHEMA_SETTINGS::m_Selection, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenPins, KIGFX::SCH_RENDER_SETTINGS::m_ShowPinsElectricalType, KIGFX::SCH_RENDER_SETTINGS::m_TextOffsetRatio, KIGFX::mapCoords(), Millimeter2iu(), NONLOGIC, OUTPUT_LOW, OUTSIDE, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PT_NC, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), LIB_SYMBOL::ShowPinNames(), LIB_SYMBOL::ShowPinNumbers(), strokeText(), TARGET_PIN_RADIUS, text, EESCHEMA_SETTINGS::SELECTION::text_as_box, triLine(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by draw().

◆ draw() [2/17]

void KIGFX::SCH_PAINTER::draw ( const LIB_SHAPE aCircle,
int  aLayer 
)
private

Definition at line 534 of file sch_painter.cpp.

535 {
536  if( !isUnitAndConversionShown( aShape ) )
537  return;
538 
539  if( setDeviceColors( aShape, aLayer ) )
540  {
541  if( aLayer == LAYER_SELECTION_SHADOWS && eeconfig()->m_Selection.fill_shapes )
542  {
543  // Consider a NAND gate. We have no idea which side of the arc is "inside" so
544  // we can't reliably fill.
545 
546  if( aShape->GetShape() == SHAPE_T::ARC )
547  m_gal->SetIsFill( aShape->IsFilled() );
548  else
549  m_gal->SetIsFill( true );
550  }
551 
552  switch( aShape->GetShape() )
553  {
554  case SHAPE_T::ARC:
555  {
556  int startAngle;
557  int endAngle;
558  aShape->CalcArcAngles( startAngle, endAngle );
559 
560  TRANSFORM().MapAngles( &startAngle, &endAngle );
561 
562  m_gal->DrawArc( mapCoords( aShape->GetCenter() ), aShape->GetRadius(),
563  DECIDEG2RAD( startAngle ), DECIDEG2RAD( endAngle ) );
564  }
565  break;
566 
567  case SHAPE_T::CIRCLE:
568  m_gal->DrawCircle( mapCoords( aShape->GetPosition() ), aShape->GetRadius() );
569  break;
570 
571  case SHAPE_T::RECT:
572  m_gal->DrawRectangle( mapCoords( aShape->GetPosition() ),
573  mapCoords( aShape->GetEnd() ) );
574  break;
575 
576  case SHAPE_T::POLY:
577  {
578  const SHAPE_LINE_CHAIN poly = aShape->GetPolyShape().Outline( 0 );
579  std::deque<VECTOR2D> mappedPts;
580 
581  for( const VECTOR2I& pt : poly.CPoints() )
582  mappedPts.push_back( mapCoords( (wxPoint) pt ) );
583 
584  m_gal->DrawPolygon( mappedPts );
585  }
586  break;
587 
588  case SHAPE_T::BEZIER:
589  {
590  std::deque<VECTOR2D> mappedPts;
591 
592  for( const wxPoint& p : aShape->GetBezierPoints() )
593  mappedPts.push_back( mapCoords( p ) );
594 
595  m_gal->DrawPolygon( mappedPts );
596  }
597  break;
598 
599  default:
600  wxFAIL_MSG( wxT( "SCH_PAINTER::draw not implemented for " ) + aShape->SHAPE_T_asString() );
601  }
602  }
603 }
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
Draw an arc.
bool setDeviceColors(const LIB_ITEM *aItem, int aLayer)
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
EESCHEMA_SETTINGS * eeconfig()
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
const std::vector< VECTOR2I > & CPoints() const
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
bool MapAngles(int *aAngle1, int *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:79

References ARC, BEZIER, LIB_SHAPE::CalcArcAngles(), CIRCLE, SHAPE_LINE_CHAIN::CPoints(), DECIDEG2RAD(), KIGFX::GAL::DrawArc(), KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawPolygon(), KIGFX::GAL::DrawRectangle(), KIGFX::eeconfig(), EDA_SHAPE::GetBezierPoints(), LIB_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetPolyShape(), LIB_SHAPE::GetPosition(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetShape(), EDA_SHAPE::IsFilled(), isUnitAndConversionShown(), LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, TRANSFORM::MapAngles(), KIGFX::mapCoords(), SHAPE_POLY_SET::Outline(), POLY, RECT, setDeviceColors(), KIGFX::GAL::SetIsFill(), and EDA_SHAPE::SHAPE_T_asString().

◆ draw() [3/17]

void KIGFX::SCH_PAINTER::draw ( const LIB_SYMBOL aSymbol,
int  aLayer,
bool  aDrawFields = true,
int  aUnit = 0,
int  aConvert = 0 
)
private

Definition at line 446 of file sch_painter.cpp.

447 {
448  if( !aUnit )
449  aUnit = m_schSettings.m_ShowUnit;
450 
451  if( !aConvert )
452  aConvert = m_schSettings.m_ShowConvert;
453 
454  std::unique_ptr< LIB_SYMBOL > tmpSymbol;
455  const LIB_SYMBOL* drawnSymbol = aSymbol;
456 
457  if( aSymbol->IsAlias() )
458  {
459  tmpSymbol = aSymbol->Flatten();
460  drawnSymbol = tmpSymbol.get();
461  }
462 
463  for( const LIB_ITEM& item : drawnSymbol->GetDrawItems() )
464  {
465  if( !aDrawFields && item.Type() == LIB_FIELD_T )
466  continue;
467 
468  if( aUnit && item.GetUnit() && aUnit != item.GetUnit() )
469  continue;
470 
471  if( aConvert && item.GetConvert() && aConvert != item.GetConvert() )
472  continue;
473 
474  Draw( &item, aLayer );
475  }
476 }
virtual bool Draw(const VIEW_ITEM *, int) override
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
bool IsAlias() const
Definition: lib_symbol.h:172
Define a library symbol object.
Definition: lib_symbol.h:96
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:380
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:484
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References Draw(), LIB_SYMBOL::Flatten(), LIB_SYMBOL::GetDrawItems(), LIB_SYMBOL::IsAlias(), LIB_FIELD_T, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowConvert, and KIGFX::SCH_RENDER_SETTINGS::m_ShowUnit.

◆ draw() [4/17]

void KIGFX::SCH_PAINTER::draw ( const LIB_FIELD aField,
int  aLayer 
)
private

Definition at line 606 of file sch_painter.cpp.

607 {
608  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
609 
610  if( drawingShadows && !aField->IsSelected() )
611  return;
612 
613  if( !isUnitAndConversionShown( aField ) )
614  return;
615 
616  // Must check layer as fields are sometimes drawn by their parent rather than
617  // directly from the view.
618  int layers[KIGFX::VIEW::VIEW_MAX_LAYERS];
619  int layers_count;
620  bool foundLayer = false;
621 
622  aField->ViewGetLayers( layers, layers_count );
623 
624  for( int i = 0; i < layers_count; ++i )
625  {
626  if( layers[i] == aLayer )
627  foundLayer = true;
628  }
629 
630  if( !foundLayer )
631  return;
632 
633  COLOR4D color = getRenderColor( aField, aLayer, drawingShadows );
634 
635  if( !( aField->IsVisible() || aField->IsForceVisible() ) )
636  {
638  color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows );
639  else
640  return;
641  }
642 
643  m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
644  m_gal->SetIsFill( false );
645  m_gal->SetIsStroke( true );
647 
648  EDA_RECT bbox = aField->GetBoundingBox();
649  wxPoint textpos = bbox.Centre();
650 
651  if( drawingShadows && eeconfig()->m_Selection.text_as_box )
652  {
653  m_gal->SetIsFill( true );
655  m_gal->SetLineWidth( m_gal->GetLineWidth() * 0.5 );
656  bbox.RevertYAxis();
657 
658  m_gal->DrawRectangle( mapCoords( bbox.GetPosition() ), mapCoords( bbox.GetEnd() ) );
659  }
660  else
661  {
664  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
665  m_gal->SetFontItalic( aField->IsItalic() );
666 
667  strokeText( UnescapeString( aField->GetText() ), textpos, aField->GetTextAngleRadians() );
668  }
669 
670  // Draw the umbilical line
671  if( aField->IsMoving() && m_schSettings.m_ShowUmbilicals )
672  {
674  m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
675  m_gal->DrawLine( textpos, wxPoint( 0, 0 ) );
676  }
677 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
float GetLineWidth() const
Get the line width.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsSelected() const
Definition: eda_item.h:122
bool IsMoving() const
Definition: eda_item.h:119
int color
Definition: DXF_plotter.cpp:57
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_field.cpp:342
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: eda_rect.h:207
EESCHEMA_SETTINGS * eeconfig()
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:711
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsItalic() const
Definition: eda_text.h:201
const wxPoint GetEnd() const
Definition: eda_rect.h:112
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: lib_field.cpp:367
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual bool IsVisible() const
Definition: eda_text.h:207
const wxSize & GetTextSize() const
Definition: eda_text.h:259
const wxPoint GetPosition() const
Definition: eda_rect.h:111
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
static VECTOR2D mapCoords(const wxPoint &aCoord)
void SetFontItalic(bool aItalic)
Set italic property of current font.
wxString UnescapeString(const wxString &aSource)
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
double GetTextAngleRadians() const
Definition: eda_text.h:198
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsForceVisible() const
Definition: eda_item.h:205
Handle the component boundary box.
Definition: eda_rect.h:42
wxPoint Centre() const
Definition: eda_rect.h:64
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References EDA_RECT::Centre(), color, KIGFX::GAL::DrawLine(), KIGFX::GAL::DrawRectangle(), KIGFX::eeconfig(), LIB_FIELD::GetBoundingBox(), EDA_RECT::GetEnd(), KIGFX::GAL::GetLineWidth(), EDA_RECT::GetPosition(), getRenderColor(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextSize(), getTextThickness(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, EDA_ITEM::IsForceVisible(), EDA_TEXT::IsItalic(), EDA_ITEM::IsMoving(), EDA_ITEM::IsSelected(), isUnitAndConversionShown(), EDA_TEXT::IsVisible(), LAYER_HIDDEN, LAYER_SCHEMATIC_ANCHOR, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, KIGFX::SCH_RENDER_SETTINGS::m_ShowUmbilicals, KIGFX::mapCoords(), EDA_RECT::RevertYAxis(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), strokeText(), UnescapeString(), KIGFX::VIEW::VIEW_MAX_LAYERS, and LIB_FIELD::ViewGetLayers().

◆ draw() [5/17]

void KIGFX::SCH_PAINTER::draw ( const LIB_TEXT aText,
int  aLayer 
)
private

Definition at line 680 of file sch_painter.cpp.

681 {
682  if( !isUnitAndConversionShown( aText ) )
683  return;
684 
685  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
686 
687  if( drawingShadows && !aText->IsSelected() )
688  return;
689 
690  COLOR4D color = getRenderColor( aText, LAYER_DEVICE, drawingShadows );
691 
692  if( !aText->IsVisible() )
693  {
695  color = getRenderColor( aText, LAYER_HIDDEN, drawingShadows );
696  else
697  return;
698  }
699 
700  EDA_RECT bBox = aText->GetBoundingBox();
701  bBox.RevertYAxis();
702  VECTOR2D pos = mapCoords( bBox.Centre() );
703  double orient = aText->GetTextAngleRadians();
704 
707  m_gal->SetLineWidth( getTextThickness( aText, drawingShadows ) );
708  m_gal->SetIsFill( false );
709  m_gal->SetIsStroke( true );
711  m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
712  m_gal->SetFontBold( aText->IsBold() );
713  m_gal->SetFontItalic( aText->IsItalic() );
714  m_gal->SetFontUnderlined( false );
715  strokeText( aText->GetText(), pos, orient );
716 }
bool IsBold() const
Definition: eda_text.h:204
bool IsSelected() const
Definition: eda_item.h:122
int color
Definition: DXF_plotter.cpp:57
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
void SetFontBold(bool aBold)
Set bold property of current font.
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: eda_rect.h:207
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsItalic() const
Definition: eda_text.h:201
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual bool IsVisible() const
Definition: eda_text.h:207
const wxSize & GetTextSize() const
Definition: eda_text.h:259
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
static VECTOR2D mapCoords(const wxPoint &aCoord)
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
double GetTextAngleRadians() const
Definition: eda_text.h:198
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void SetFontUnderlined(bool aUnderlined)
const EDA_RECT GetBoundingBox() const override
Definition: lib_text.cpp:377
Handle the component boundary box.
Definition: eda_rect.h:42
wxPoint Centre() const
Definition: eda_rect.h:64
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References EDA_RECT::Centre(), color, LIB_TEXT::GetBoundingBox(), getRenderColor(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextSize(), getTextThickness(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_ITEM::IsSelected(), isUnitAndConversionShown(), EDA_TEXT::IsVisible(), LAYER_DEVICE, LAYER_HIDDEN, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, KIGFX::mapCoords(), EDA_RECT::RevertYAxis(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), and strokeText().

◆ draw() [6/17]

void KIGFX::SCH_PAINTER::draw ( SCH_SYMBOL aSymbol,
int  aLayer 
)
private

Definition at line 1469 of file sch_painter.cpp.

1470 {
1471  int unit = aSymbol->GetUnitSelection( &m_schematic->CurrentSheet() );
1472  int convert = aSymbol->GetConvert();
1473 
1474  // Use dummy symbol if the actual couldn't be found (or couldn't be locked).
1475  LIB_SYMBOL* originalSymbol = aSymbol->GetLibSymbolRef() ?
1476  aSymbol->GetLibSymbolRef().get() : dummy();
1477  LIB_PINS originalPins;
1478  originalSymbol->GetPins( originalPins, unit, convert );
1479 
1480  // Copy the source so we can re-orient and translate it.
1481  LIB_SYMBOL tempSymbol( *originalSymbol );
1482  LIB_PINS tempPins;
1483  tempSymbol.GetPins( tempPins, unit, convert );
1484 
1485  tempSymbol.SetFlags( aSymbol->GetFlags() );
1486 
1487  orientSymbol( &tempSymbol, aSymbol->GetOrientation() );
1488 
1489  for( auto& tempItem : tempSymbol.GetDrawItems() )
1490  {
1491  tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
1492  tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) );
1493  }
1494 
1495  // Copy the pin info from the symbol to the temp pins
1496  for( unsigned i = 0; i < tempPins.size(); ++ i )
1497  {
1498  SCH_PIN* symbolPin = aSymbol->GetPin( originalPins[ i ] );
1499  LIB_PIN* tempPin = tempPins[ i ];
1500 
1501  tempPin->ClearFlags();
1502  tempPin->SetFlags( symbolPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
1503 
1504  tempPin->SetName( symbolPin->GetShownName() );
1505  tempPin->SetType( symbolPin->GetType() );
1506  tempPin->SetShape( symbolPin->GetShape() );
1507 
1508  if( symbolPin->IsDangling() )
1509  tempPin->SetFlags( IS_DANGLING );
1510  }
1511 
1512  draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
1513 
1514  // The fields are SCH_SYMBOL-specific so don't need to be copied/oriented/translated
1515  for( const SCH_FIELD& field : aSymbol->GetFields() )
1516  draw( &field, aLayer );
1517 }
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
SCHEMATIC * m_schematic
Definition: sch_painter.h:197
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:756
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:55
void SetShape(GRAPHIC_PINSHAPE aShape)
Definition: lib_pin.h:79
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:741
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
Define a library symbol object.
Definition: lib_symbol.h:96
bool IsDangling() const override
Definition: sch_pin.h:91
wxString GetShownName() const
Definition: sch_pin.cpp:90
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:165
void SetType(ELECTRICAL_PINTYPE aType)
Definition: lib_pin.h:85
#define IS_DANGLING
indicates a pin is dangling
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:554
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
GRAPHIC_PINSHAPE GetShape() const
Definition: sch_pin.cpp:122
static VECTOR2D mapCoords(const wxPoint &aCoord)
static LIB_SYMBOL * dummy()
Used when a LIB_SYMBOL is not found in library to draw a dummy shape.
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:154
void draw(LIB_PIN *aPin, int aLayer)
static void orientSymbol(LIB_SYMBOL *symbol, int orientation)
void SetName(const wxString &aName)
Definition: lib_pin.h:108
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
Definition: sch_symbol.cpp:870
ELECTRICAL_PINTYPE GetType() const
Definition: sch_pin.cpp:113
wxPoint GetPosition() const override
Definition: sch_symbol.h:645
int GetOrientation()
Get the display symbol orientation.
int GetUnit() const
Definition: sch_symbol.h:196
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:121
int GetConvert() const
Definition: sch_symbol.h:224

References EDA_ITEM::ClearFlags(), convert, SCHEMATIC::CurrentSheet(), draw(), KIGFX::dummy(), SCH_SYMBOL::GetConvert(), LIB_SYMBOL::GetDrawItems(), SCH_SYMBOL::GetFields(), EDA_ITEM::GetFlags(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetOrientation(), SCH_SYMBOL::GetPin(), LIB_SYMBOL::GetPins(), SCH_SYMBOL::GetPosition(), SCH_PIN::GetShape(), SCH_PIN::GetShownName(), SCH_PIN::GetType(), SCH_SYMBOL::GetUnit(), SCH_SYMBOL::GetUnitSelection(), IS_DANGLING, SCH_PIN::IsDangling(), m_schematic, KIGFX::mapCoords(), KIGFX::orientSymbol(), EDA_ITEM::SetFlags(), LIB_PIN::SetName(), LIB_PIN::SetShape(), and LIB_PIN::SetType().

◆ draw() [7/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_JUNCTION aJct,
int  aLayer 
)
private

Definition at line 1219 of file sch_painter.cpp.

1220 {
1221  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1222 
1223  if( drawingShadows && !aJct->IsSelected() )
1224  return;
1225 
1226  COLOR4D color = getRenderColor( aJct, aJct->GetLayer(), drawingShadows );
1227 
1228  int junctionSize = aJct->GetEffectiveDiameter() / 2;
1229 
1230  if( junctionSize > 1 )
1231  {
1232  m_gal->SetIsStroke( drawingShadows );
1233  m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1235  m_gal->SetIsFill( !drawingShadows );
1236  m_gal->SetFillColor( color );
1237  m_gal->DrawCircle( aJct->GetPosition(), junctionSize );
1238  }
1239 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
bool IsSelected() const
Definition: eda_item.h:122
int color
Definition: DXF_plotter.cpp:57
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
wxPoint GetPosition() const override
Definition: sch_junction.h:103
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:259
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
int GetEffectiveDiameter() const
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::DrawCircle(), SCH_JUNCTION::GetEffectiveDiameter(), SCH_ITEM::GetLayer(), getLineWidth(), SCH_JUNCTION::GetPosition(), getRenderColor(), EDA_ITEM::IsSelected(), LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

◆ draw() [8/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_FIELD aField,
int  aLayer 
)
private

Definition at line 1520 of file sch_painter.cpp.

1521 {
1522  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1523 
1524  if( drawingShadows && !aField->IsSelected() )
1525  return;
1526 
1527  aLayer = aField->GetLayer();
1528 
1529  COLOR4D color = getRenderColor( aField, aLayer, drawingShadows );
1530 
1531  if( !( aField->IsVisible() || aField->IsForceVisible() ) )
1532  {
1534  color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows );
1535  else
1536  return;
1537  }
1538 
1539  if( aField->IsVoid() )
1540  return;
1541 
1542  if( drawingShadows && aField->GetParent()->IsSelected()
1544  {
1545  return;
1546  }
1547 
1548  bool underline = false;
1549 
1550  if( aField->IsHypertext() && ( aField->GetFlags() & IS_ROLLOVER ) > 0
1551  && !drawingShadows && !aField->IsMoving() )
1552  {
1553  color = PUREBLUE;
1554  underline = true;
1555  }
1556 
1557  // Calculate the text orientation according to the parent orientation.
1558  int orient = (int) aField->GetTextAngle();
1559 
1560  if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
1561  {
1562  if( static_cast<SCH_SYMBOL*>( aField->GetParent() )->GetTransform().y1 )
1563  {
1564  // Rotate symbol 90 degrees.
1565  if( orient == TEXT_ANGLE_HORIZ )
1566  orient = TEXT_ANGLE_VERT;
1567  else
1568  orient = TEXT_ANGLE_HORIZ;
1569  }
1570  }
1571 
1572  /*
1573  * Calculate the text justification, according to the symbol orientation/mirror.
1574  * This is a bit complicated due to cumulative calculations:
1575  * - numerous cases (mirrored or not, rotation)
1576  * - the DrawGraphicText function recalculate also H and H justifications according to the
1577  * text orientation.
1578  * - when symbol is mirrored, the text is not mirrored and justifications are complicated
1579  * to calculate so the easier way is to use no justifications (centered text) and use
1580  * GetBoundingBox to know the text coordinate considered as centered
1581  */
1582  EDA_RECT bbox = aField->GetBoundingBox();
1583  wxPoint textpos = bbox.Centre();
1584 
1586  m_gal->SetIsStroke( true );
1587 
1588  if( drawingShadows && eeconfig()->m_Selection.text_as_box )
1589  {
1590  m_gal->SetIsFill( true );
1591  m_gal->SetFillColor( color );
1592  m_gal->SetLineWidth( m_gal->GetLineWidth() * 0.5 );
1593  bbox.RevertYAxis();
1594 
1595  m_gal->DrawRectangle( mapCoords( bbox.GetPosition() ), mapCoords( bbox.GetEnd() ) );
1596  }
1597  else
1598  {
1601  m_gal->SetIsFill( false );
1602  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
1603  m_gal->SetFontBold( aField->IsBold() );
1604  m_gal->SetFontItalic( aField->IsItalic() );
1605  m_gal->SetFontUnderlined( underline );
1606  m_gal->SetTextMirrored( aField->IsMirrored() );
1607  m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
1608 
1609  strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0 );
1610  }
1611 
1612  // Draw the umbilical line
1613  if( aField->IsMoving() )
1614  {
1615  wxPoint parentPos = aField->GetParentPosition();
1616 
1618  m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
1619  m_gal->DrawLine( textpos, parentPos );
1620  }
1621 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:71
bool IsBold() const
Definition: eda_text.h:204
float GetLineWidth() const
Get the line width.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsMirrored() const
Definition: eda_text.h:210
bool IsSelected() const
Definition: eda_item.h:122
bool IsMoving() const
Definition: eda_item.h:119
int color
Definition: DXF_plotter.cpp:57
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
void SetFontBold(bool aBold)
Set bold property of current font.
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_field.h:89
double GetTextAngle() const
Definition: eda_text.h:195
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: eda_rect.h:207
EESCHEMA_SETTINGS * eeconfig()
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_field.cpp:105
bool IsVoid() const
Definition: sch_field.cpp:421
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsItalic() const
Definition: eda_text.h:201
const wxPoint GetEnd() const
Definition: eda_rect.h:112
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual bool IsVisible() const
Definition: eda_text.h:207
const wxSize & GetTextSize() const
Definition: eda_text.h:259
const wxPoint GetPosition() const
Definition: eda_rect.h:111
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
static VECTOR2D mapCoords(const wxPoint &aCoord)
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:154
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:259
void SetTextMirrored(bool aMirrored)
Set a mirrored property of text.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsForceVisible() const
Definition: eda_item.h:205
void SetFontUnderlined(bool aUnderlined)
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_field.cpp:305
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.
Handle the component boundary box.
Definition: eda_rect.h:42
wxPoint Centre() const
Definition: eda_rect.h:64
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
#define TEXT_ANGLE_VERT
Definition: eda_text.h:72
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
wxPoint GetParentPosition() const
Definition: sch_field.cpp:858
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References EDA_RECT::Centre(), color, EESCHEMA_SETTINGS::SELECTION::draw_selected_children, KIGFX::GAL::DrawLine(), KIGFX::GAL::DrawRectangle(), KIGFX::eeconfig(), SCH_FIELD::GetBoundingBox(), EDA_RECT::GetEnd(), EDA_ITEM::GetFlags(), SCH_ITEM::GetLayer(), KIGFX::GAL::GetLineWidth(), EDA_ITEM::GetParent(), SCH_FIELD::GetParentPosition(), EDA_RECT::GetPosition(), getRenderColor(), SCH_FIELD::GetShownText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextSize(), getTextThickness(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, IS_ROLLOVER, EDA_TEXT::IsBold(), EDA_ITEM::IsForceVisible(), SCH_FIELD::IsHypertext(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_ITEM::IsMoving(), EDA_ITEM::IsSelected(), EDA_TEXT::IsVisible(), SCH_FIELD::IsVoid(), LAYER_HIDDEN, LAYER_SCHEMATIC_ANCHOR, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_schSettings, EESCHEMA_SETTINGS::m_Selection, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, KIGFX::mapCoords(), PUREBLUE, EDA_RECT::RevertYAxis(), SCH_SYMBOL_T, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextMirrored(), KIGFX::GAL::SetVerticalJustify(), strokeText(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, and EDA_ITEM::Type().

◆ draw() [9/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_TEXT aText,
int  aLayer 
)
private

Definition at line 1328 of file sch_painter.cpp.

1329 {
1330  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1331  bool drawingDangling = aLayer == LAYER_DANGLING;
1332 
1333  if( drawingShadows && !aText->IsSelected() )
1334  return;
1335 
1336  switch( aText->Type() )
1337  {
1338  case SCH_SHEET_PIN_T: aLayer = LAYER_SHEETLABEL; break;
1339  case SCH_HIER_LABEL_T: aLayer = LAYER_HIERLABEL; break;
1340  case SCH_GLOBAL_LABEL_T: aLayer = LAYER_GLOBLABEL; break;
1341  case SCH_LABEL_T: aLayer = LAYER_LOCLABEL; break;
1342  default: aLayer = LAYER_NOTES; break;
1343  }
1344 
1345  COLOR4D color = getRenderColor( aText, aLayer, drawingShadows );
1346 
1347  if( m_schematic )
1348  {
1349  SCH_CONNECTION* conn = nullptr;
1350 
1351  if( !aText->IsConnectivityDirty() )
1352  conn = aText->Connection();
1353 
1354  if( conn && conn->IsBus() )
1355  color = getRenderColor( aText, LAYER_BUS, drawingShadows );
1356  }
1357 
1358  if( !( aText->IsVisible() || aText->IsForceVisible() ) )
1359  {
1361  color = getRenderColor( aText, LAYER_HIDDEN, drawingShadows );
1362  else
1363  return;
1364  }
1365 
1366  if( drawingDangling )
1367  {
1368  if( aText->IsDangling() )
1369  {
1370  drawDanglingSymbol( aText->GetTextPos(), color, Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
1371  drawingShadows );
1372  }
1373 
1374  return;
1375  }
1376 
1377  m_gal->SetIsFill( false );
1378  m_gal->SetIsStroke( true );
1379  m_gal->SetLineWidth( getTextThickness( aText, drawingShadows ) );
1381 
1382  VECTOR2D text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset( &m_schSettings );
1383  wxString shownText( aText->GetShownText() );
1384 
1385  if( drawingShadows )
1386  {
1388  {
1389  EDA_RECT bBox = aText->GetBoundingBox();
1390 
1391  m_gal->SetIsFill( true );
1392  m_gal->SetFillColor( color );
1393  m_gal->SetLineWidth( m_gal->GetLineWidth() * 0.5 );
1394  bBox.RevertYAxis();
1395 
1396  m_gal->DrawRectangle( mapCoords( bBox.GetPosition() ), mapCoords( bBox.GetEnd() ) );
1397  return;
1398  }
1399 
1400  switch( aText->GetLabelSpinStyle() )
1401  {
1402  case LABEL_SPIN_STYLE::LEFT: text_offset.x += getShadowWidth() / 2; break;
1403  case LABEL_SPIN_STYLE::UP: text_offset.y += getShadowWidth() / 2; break;
1404  case LABEL_SPIN_STYLE::RIGHT: text_offset.x -= getShadowWidth() / 2; break;
1405  case LABEL_SPIN_STYLE::BOTTOM: text_offset.y -= getShadowWidth() / 2; break;
1406  }
1407  }
1408 
1409  if( !shownText.IsEmpty() )
1410  {
1411  m_gal->SetTextAttributes( aText );
1412  m_gal->SetFontUnderlined( false );
1413 
1414  strokeText( shownText, text_offset, aText->GetTextAngleRadians() );
1415  }
1416 }
bool IsDangling() const override
Definition: sch_text.h:230
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
SCHEMATIC * m_schematic
Definition: sch_painter.h:197
float GetLineWidth() const
Get the line width.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsSelected() const
Definition: eda_item.h:122
virtual void SetTextAttributes(const EDA_TEXT *aText)
Loads attributes of the given text (bold/italic/underline/mirrored and so on).
int color
Definition: DXF_plotter.cpp:57
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: eda_rect.h:207
float getShadowWidth() const
virtual wxPoint GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_text.cpp:258
EESCHEMA_SETTINGS * eeconfig()
bool IsConnectivityDirty() const
Definition: sch_item.h:413
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:138
void drawDanglingSymbol(const wxPoint &aPos, const COLOR4D &aColor, int aWidth, bool aDrawingShadows)
const wxPoint GetEnd() const
Definition: eda_rect.h:112
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
virtual bool IsVisible() const
Definition: eda_text.h:207
const wxPoint GetPosition() const
Definition: eda_rect.h:111
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:159
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_text.cpp:555
static VECTOR2D mapCoords(const wxPoint &aCoord)
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_text.cpp:600
double GetTextAngleRadians() const
Definition: eda_text.h:198
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsForceVisible() const
Definition: eda_item.h:205
void SetFontUnderlined(bool aUnderlined)
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Handle the component boundary box.
Definition: eda_rect.h:42
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
bool IsBus() const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References LABEL_SPIN_STYLE::BOTTOM, color, SCH_ITEM::Connection(), DANGLING_SYMBOL_SIZE, drawDanglingSymbol(), KIGFX::GAL::DrawRectangle(), KIGFX::eeconfig(), SCH_TEXT::GetBoundingBox(), EDA_RECT::GetEnd(), SCH_TEXT::GetLabelSpinStyle(), KIGFX::GAL::GetLineWidth(), EDA_RECT::GetPosition(), getRenderColor(), SCH_TEXT::GetSchematicTextOffset(), getShadowWidth(), SCH_TEXT::GetShownText(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextPos(), getTextThickness(), SCH_CONNECTION::IsBus(), SCH_ITEM::IsConnectivityDirty(), SCH_TEXT::IsDangling(), EDA_ITEM::IsForceVisible(), EDA_ITEM::IsSelected(), EDA_TEXT::IsVisible(), LAYER_BUS, LAYER_DANGLING, LAYER_GLOBLABEL, LAYER_HIDDEN, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NOTES, LAYER_SELECTION_SHADOWS, LAYER_SHEETLABEL, LABEL_SPIN_STYLE::LEFT, KIGFX::PAINTER::m_gal, m_schematic, m_schSettings, EESCHEMA_SETTINGS::m_Selection, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, KIGFX::mapCoords(), EDA_RECT::RevertYAxis(), LABEL_SPIN_STYLE::RIGHT, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextAttributes(), strokeText(), EESCHEMA_SETTINGS::SELECTION::text_as_box, EDA_ITEM::Type(), LABEL_SPIN_STYLE::UP, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ draw() [10/17]

void KIGFX::SCH_PAINTER::draw ( SCH_HIERLABEL aLabel,
int  aLayer 
)
private

Definition at line 1663 of file sch_painter.cpp.

1664 {
1665  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1666 
1667  if( drawingShadows && !aLabel->IsSelected() )
1668  return;
1669 
1670  COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows );
1671 
1672  if( m_schematic )
1673  {
1674  SCH_CONNECTION* conn = nullptr;
1675 
1676  if( !aLabel->IsConnectivityDirty() )
1677  conn = aLabel->Connection();
1678 
1679  if( conn && conn->IsBus() )
1680  color = getRenderColor( aLabel, LAYER_BUS, drawingShadows );
1681  }
1682 
1683  std::vector<wxPoint> pts;
1684  std::deque<VECTOR2D> pts2;
1685 
1686  aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
1687 
1688  for( const wxPoint& p : pts )
1689  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1690 
1691  m_gal->SetIsFill( true );
1693  m_gal->SetIsStroke( true );
1694  m_gal->SetLineWidth( getTextThickness( aLabel, drawingShadows ) );
1696  m_gal->DrawPolyline( pts2 );
1697 
1698  draw( static_cast<const SCH_TEXT*>( aLabel ), aLayer );
1699 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
SCHEMATIC * m_schematic
Definition: sch_painter.h:197
bool IsSelected() const
Definition: eda_item.h:122
int color
Definition: DXF_plotter.cpp:57
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
bool IsConnectivityDirty() const
Definition: sch_item.h:413
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:138
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< wxPoint > &aPoints, const wxPoint &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.cpp:1625
void draw(LIB_PIN *aPin, int aLayer)
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
bool IsBus() const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, SCH_ITEM::Connection(), SCH_HIERLABEL::CreateGraphicShape(), draw(), KIGFX::GAL::DrawPolyline(), KIGFX::RENDER_SETTINGS::GetLayerColor(), getRenderColor(), EDA_TEXT::GetTextPos(), getTextThickness(), SCH_CONNECTION::IsBus(), SCH_ITEM::IsConnectivityDirty(), EDA_ITEM::IsSelected(), LAYER_BUS, LAYER_HIERLABEL, LAYER_SCHEMATIC_BACKGROUND, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, m_schematic, m_schSettings, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

◆ draw() [11/17]

void KIGFX::SCH_PAINTER::draw ( SCH_GLOBALLABEL aLabel,
int  aLayer 
)
private

Definition at line 1624 of file sch_painter.cpp.

1625 {
1626  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1627 
1628  if( !drawingShadows || aLabel->IsSelected() )
1629  {
1630  COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows );
1631 
1632  std::vector<wxPoint> pts;
1633  std::deque<VECTOR2D> pts2;
1634 
1635  aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
1636 
1637  for( const wxPoint& p : pts )
1638  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1639 
1640  // The text is drawn inside the graphic shape.
1641  // On Cairo the graphic shape is filled by the background before drawing the text.
1642  // However if the text is selected, it is draw twice: first on LAYER_SELECTION_SHADOWS
1643  // and second on the text layer. The second must not erase the first drawing.
1644  bool fillBg = ( ( aLayer == LAYER_SELECTION_SHADOWS ) || !aLabel->IsSelected() )
1645  && aLayer != LAYER_DANGLING;
1646  m_gal->SetIsFill( fillBg );
1648  m_gal->SetIsStroke( true );
1649  m_gal->SetLineWidth( getTextThickness( aLabel, drawingShadows ) );
1651  m_gal->DrawPolyline( pts2 );
1652 
1653  draw( static_cast<SCH_TEXT*>( aLabel ), aLayer );
1654  }
1655 
1656  if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children || !aLabel->IsSelected() )
1657  {
1658  draw( aLabel->GetIntersheetRefs(), aLayer );
1659  }
1660 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
bool IsSelected() const
Definition: eda_item.h:122
int color
Definition: DXF_plotter.cpp:57
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
EESCHEMA_SETTINGS * eeconfig()
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
void draw(LIB_PIN *aPin, int aLayer)
SCH_FIELD * GetIntersheetRefs()
Definition: sch_text.h:415
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< wxPoint > &aPoints, const wxPoint &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.cpp:1344
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, SCH_GLOBALLABEL::CreateGraphicShape(), draw(), KIGFX::GAL::DrawPolyline(), KIGFX::eeconfig(), SCH_GLOBALLABEL::GetIntersheetRefs(), KIGFX::RENDER_SETTINGS::GetLayerColor(), getRenderColor(), EDA_TEXT::GetTextPos(), getTextThickness(), EDA_ITEM::IsSelected(), LAYER_DANGLING, LAYER_GLOBLABEL, LAYER_SCHEMATIC_BACKGROUND, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

◆ draw() [12/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_SHEET aSheet,
int  aLayer 
)
private

Definition at line 1702 of file sch_painter.cpp.

1703 {
1704  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1705 
1706  if( aLayer == LAYER_HIERLABEL || aLayer == LAYER_SELECTION_SHADOWS )
1707  {
1708  for( SCH_SHEET_PIN* sheetPin : aSheet->GetPins() )
1709  {
1710  if( drawingShadows && !aSheet->IsSelected() && !sheetPin->IsSelected() )
1711  continue;
1712 
1713  if( drawingShadows && aSheet->IsSelected()
1715  {
1716  break;
1717  }
1718 
1719  int width = std::max( aSheet->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
1720  wxPoint initial_pos = sheetPin->GetTextPos();
1721  wxPoint offset_pos = initial_pos;
1722 
1723  // For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2
1724  switch( sheetPin->GetSide() )
1725  {
1726  case SHEET_SIDE::TOP: offset_pos.y += KiROUND( width / 2.0 ); break;
1727  case SHEET_SIDE::BOTTOM: offset_pos.y -= KiROUND( width / 2.0 ); break;
1728  case SHEET_SIDE::RIGHT: offset_pos.x -= KiROUND( width / 2.0 ); break;
1729  case SHEET_SIDE::LEFT: offset_pos.x += KiROUND( width / 2.0 ); break;
1730  default: break;
1731  }
1732 
1733  sheetPin->SetTextPos( offset_pos );
1734  draw( static_cast<SCH_HIERLABEL*>( sheetPin ), aLayer );
1735  m_gal->DrawLine( offset_pos, initial_pos );
1736  sheetPin->SetTextPos( initial_pos );
1737  }
1738  }
1739 
1740  VECTOR2D pos = aSheet->GetPosition();
1741  VECTOR2D size = aSheet->GetSize();
1742 
1743  if( aLayer == LAYER_SHEET_BACKGROUND )
1744  {
1746  m_gal->SetIsFill( true );
1747  m_gal->SetIsStroke( false );
1748 
1749  m_gal->DrawRectangle( pos, pos + size );
1750  }
1751 
1752  if( aLayer == LAYER_SHEET || aLayer == LAYER_SELECTION_SHADOWS )
1753  {
1754  m_gal->SetStrokeColor( getRenderColor( aSheet, LAYER_SHEET, drawingShadows ) );
1755  m_gal->SetIsStroke( true );
1756  m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
1757  m_gal->SetIsFill( false );
1758 
1759  m_gal->DrawRectangle( pos, pos + size );
1760 
1761  if( drawingShadows && !eeconfig()->m_Selection.draw_selected_children && aSheet->IsSelected() )
1762  return;
1763 
1764  for( const SCH_FIELD& field : aSheet->GetFields() )
1765  draw( &field, aLayer );
1766  }
1767 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsSelected() const
Definition: eda_item.h:122
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
EESCHEMA_SETTINGS * eeconfig()
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:90
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
int GetPenWidth() const override
Definition: sch_sheet.cpp:567
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
wxPoint GetPosition() const override
Definition: sch_sheet.h:379
void draw(LIB_PIN *aPin, int aLayer)
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:183
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
wxSize GetSize() const
Definition: sch_sheet.h:104
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
int GetDefaultPenWidth() const
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References BOTTOM, draw(), EESCHEMA_SETTINGS::SELECTION::draw_selected_children, KIGFX::GAL::DrawLine(), KIGFX::GAL::DrawRectangle(), KIGFX::eeconfig(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), SCH_SHEET::GetFields(), getLineWidth(), SCH_SHEET::GetPenWidth(), SCH_SHEET::GetPins(), SCH_SHEET::GetPosition(), getRenderColor(), SCH_SHEET::GetSize(), EDA_ITEM::IsSelected(), KiROUND(), LAYER_HIERLABEL, LAYER_SELECTION_SHADOWS, LAYER_SHEET, LAYER_SHEET_BACKGROUND, LEFT, KIGFX::PAINTER::m_gal, m_schSettings, EESCHEMA_SETTINGS::m_Selection, RIGHT, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), and TOP.

◆ draw() [13/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_NO_CONNECT aNC,
int  aLayer 
)
private

Definition at line 1770 of file sch_painter.cpp.

1771 {
1772  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1773 
1774  if( drawingShadows && !aNC->IsSelected() )
1775  return;
1776 
1777  m_gal->SetIsStroke( true );
1778  m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
1779  m_gal->SetStrokeColor( getRenderColor( aNC, LAYER_NOCONNECT, drawingShadows ) );
1780  m_gal->SetIsFill( false );
1781 
1782  VECTOR2D p = aNC->GetPosition();
1783  int delta = std::max( aNC->GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
1784 
1785  m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
1786  m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );
1787 }
bool IsSelected() const
Definition: eda_item.h:122
wxPoint GetPosition() const override
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
int GetSize() const
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
int GetDefaultPenWidth() const
constexpr int delta
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References delta, KIGFX::GAL::DrawLine(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), getLineWidth(), SCH_NO_CONNECT::GetPosition(), getRenderColor(), SCH_NO_CONNECT::GetSize(), EDA_ITEM::IsSelected(), LAYER_NOCONNECT, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

◆ draw() [14/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_MARKER aMarker,
int  aLayer 
)
private

Definition at line 1889 of file sch_painter.cpp.

1890 {
1891  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1892 
1893  if( drawingShadows && !aMarker->IsSelected() )
1894  return;
1895 
1896  COLOR4D color = getRenderColor( aMarker, aMarker->GetColorLayer(), drawingShadows );
1897 
1898  m_gal->Save();
1899  m_gal->Translate( aMarker->GetPosition() );
1900  m_gal->SetIsFill( !drawingShadows );
1901  m_gal->SetFillColor( color );
1902  m_gal->SetIsStroke( drawingShadows );
1903  m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
1905 
1906  SHAPE_LINE_CHAIN polygon;
1907  aMarker->ShapeToPolygon( polygon );
1908 
1909  m_gal->DrawPolygon( polygon );
1910  m_gal->Restore();
1911 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
SCH_LAYER_ID GetColorLayer() const
Definition: sch_marker.cpp:122
bool IsSelected() const
Definition: eda_item.h:122
wxPoint GetPosition() const override
Definition: sch_marker.h:101
int color
Definition: DXF_plotter.cpp:57
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void Restore()
Restore the context.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
virtual void Save()
Save the context.
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::DrawPolygon(), SCH_MARKER::GetColorLayer(), getLineWidth(), SCH_MARKER::GetPosition(), getRenderColor(), EDA_ITEM::IsSelected(), LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, KIGFX::GAL::Restore(), KIGFX::GAL::Save(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), MARKER_BASE::ShapeToPolygon(), and KIGFX::GAL::Translate().

◆ draw() [15/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_BITMAP aBitmap,
int  aLayer 
)
private

Definition at line 1844 of file sch_painter.cpp.

1845 {
1846  m_gal->Save();
1847  m_gal->Translate( aBitmap->GetPosition() );
1848 
1849  // When the image scale factor is not 1.0, we need to modify the actual as the image scale
1850  // factor is similar to a local zoom
1851  double img_scale = aBitmap->GetImageScale();
1852 
1853  if( img_scale != 1.0 )
1854  m_gal->Scale( VECTOR2D( img_scale, img_scale ) );
1855 
1856  if( aLayer == LAYER_DRAW_BITMAPS )
1857  {
1858  m_gal->DrawBitmap( *aBitmap->GetImage() );
1859  }
1860 
1861  if( aLayer == LAYER_SELECTION_SHADOWS )
1862  {
1863  if( aBitmap->IsSelected() || aBitmap->IsBrightened() )
1864  {
1865  COLOR4D color = getRenderColor( aBitmap, LAYER_DRAW_BITMAPS, true );
1866  m_gal->SetIsStroke( true );
1869  m_gal->SetIsFill( false );
1870 
1871  // Draws a bounding box.
1872  VECTOR2D bm_size( aBitmap->GetSize() );
1873  // bm_size is the actual image size in UI.
1874  // but m_gal scale was previously set to img_scale
1875  // so recalculate size relative to this image size.
1876  bm_size.x /= img_scale;
1877  bm_size.y /= img_scale;
1878  VECTOR2D origin( -bm_size.x / 2.0, -bm_size.y / 2.0 );
1879  VECTOR2D end = origin + bm_size;
1880 
1881  m_gal->DrawRectangle( origin, end );
1882  }
1883  }
1884 
1885  m_gal->Restore();
1886 }
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsSelected() const
Definition: eda_item.h:122
int color
Definition: DXF_plotter.cpp:57
virtual void DrawBitmap(const BITMAP_BASE &aBitmap)
Draw a bitmap image.
bool IsBrightened() const
Definition: eda_item.h:125
wxPoint GetPosition() const override
Definition: sch_bitmap.h:136
float getShadowWidth() const
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
wxSize GetSize() const
Definition: sch_bitmap.cpp:125
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
BITMAP_BASE * GetImage() const
Definition: sch_bitmap.h:54
to handle and draw images bitmaps
Definition: layer_ids.h:230
virtual void Scale(const VECTOR2D &aScale)
Scale the context.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void Restore()
Restore the context.
double GetImageScale() const
Definition: sch_bitmap.h:66
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
virtual void Save()
Save the context.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::DrawBitmap(), KIGFX::GAL::DrawRectangle(), SCH_BITMAP::GetImage(), SCH_BITMAP::GetImageScale(), SCH_BITMAP::GetPosition(), getRenderColor(), getShadowWidth(), SCH_BITMAP::GetSize(), EDA_ITEM::IsBrightened(), EDA_ITEM::IsSelected(), LAYER_DRAW_BITMAPS, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, KIGFX::GAL::Restore(), KIGFX::GAL::Save(), KIGFX::GAL::Scale(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::Translate(), and VECTOR2< T >::x.

◆ draw() [16/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_LINE aLine,
int  aLayer 
)
private

Definition at line 1242 of file sch_painter.cpp.

1243 {
1244  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1245  bool drawingDangling = aLayer == LAYER_DANGLING;
1246 
1247  if( drawingShadows && !aLine->IsSelected() )
1248  return;
1249 
1250  COLOR4D color = getRenderColor( aLine, aLine->GetLayer(), drawingShadows );
1251  float width = getLineWidth( aLine, drawingShadows );
1252  PLOT_DASH_TYPE lineStyle = aLine->GetEffectiveLineStyle();
1253 
1254  if( drawingDangling || drawingShadows )
1255  {
1256  if( aLine->IsStartDangling() && aLine->IsWire() )
1257  {
1259  getLineWidth( aLine, drawingShadows ), drawingShadows );
1260  }
1261 
1262  if( aLine->IsEndDangling() && aLine->IsWire() )
1263  {
1265  getLineWidth( aLine, drawingShadows ), drawingShadows );
1266  }
1267 
1268  if( drawingDangling )
1269  return;
1270  }
1271 
1272  m_gal->SetIsStroke( true );
1274  m_gal->SetLineWidth( width );
1275 
1276  if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
1277  {
1278  m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() );
1279  }
1280  else
1281  {
1282  VECTOR2D start = aLine->GetStartPoint();
1283  VECTOR2D end = aLine->GetEndPoint();
1284 
1285  EDA_RECT clip( (wxPoint)start, wxSize( end.x - start.x, end.y - start.y ) );
1286  clip.Normalize();
1287 
1288  double theta = atan2( end.y - start.y, end.x - start.x );
1289  double strokes[] = { 1.0, dash_gap_len( width ), 1.0, dash_gap_len( width ) };
1290 
1291  switch( lineStyle )
1292  {
1293  default:
1294  case PLOT_DASH_TYPE::DASH:
1295  strokes[0] = strokes[2] = dash_mark_len( width );
1296  break;
1297  case PLOT_DASH_TYPE::DOT:
1298  strokes[0] = strokes[2] = dot_mark_len( width );
1299  break;
1301  strokes[0] = dash_mark_len( width );
1302  strokes[2] = dot_mark_len( width );
1303  break;
1304  }
1305 
1306  for( size_t i = 0; i < 10000; ++i )
1307  {
1308  // Calculations MUST be done in doubles to keep from accumulating rounding
1309  // errors as we go.
1310  VECTOR2D next( start.x + strokes[ i % 4 ] * cos( theta ),
1311  start.y + strokes[ i % 4 ] * sin( theta ) );
1312 
1313  // Drawing each segment can be done rounded to ints.
1314  wxPoint segStart( KiROUND( start.x ), KiROUND( start.y ) );
1315  wxPoint segEnd( KiROUND( next.x ), KiROUND( next.y ) );
1316 
1317  if( ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
1318  break;
1319  else if( i % 2 == 0 )
1320  m_gal->DrawLine( segStart, segEnd );
1321 
1322  start = next;
1323  }
1324  }
1325 }
CITER next(CITER it)
Definition: ptree.cpp:126
wxPoint GetStartPoint() const
Definition: sch_line.h:90
bool IsWire() const
Return true if the line is a wire.
Definition: sch_line.cpp:972
bool IsSelected() const
Definition: eda_item.h:122
int color
Definition: DXF_plotter.cpp:57
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
bool ClipLine(const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
void drawDanglingSymbol(const wxPoint &aPos, const COLOR4D &aColor, int aWidth, bool aDrawingShadows)
constexpr double dot_mark_len(double aLineWidth)
Dashed and dotted line patterns.
bool IsEndDangling() const
Definition: sch_line.h:212
constexpr double dash_gap_len(double aLineWidth)
PLOT_DASH_TYPE
Dashed line types.
Definition: plotter.h:104
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:259
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
PLOT_DASH_TYPE GetEffectiveLineStyle() const
Definition: sch_line.cpp:287
bool IsStartDangling() const
Definition: sch_line.h:211
Handle the component boundary box.
Definition: eda_rect.h:42
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
constexpr double dash_mark_len(double aLineWidth)
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References ClipLine(), color, DASH, dash_gap_len(), dash_mark_len(), DASHDOT, DOT, dot_mark_len(), drawDanglingSymbol(), KIGFX::GAL::DrawLine(), FIRST_TYPE, SCH_LINE::GetEffectiveLineStyle(), SCH_LINE::GetEndPoint(), SCH_ITEM::GetLayer(), getLineWidth(), getRenderColor(), SCH_LINE::GetStartPoint(), SCH_LINE::IsEndDangling(), EDA_ITEM::IsSelected(), SCH_LINE::IsStartDangling(), SCH_LINE::IsWire(), KiROUND(), LAYER_DANGLING, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, next(), EDA_RECT::Normalize(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ draw() [17/17]

void KIGFX::SCH_PAINTER::draw ( const SCH_BUS_ENTRY_BASE aEntry,
int  aLayer 
)
private

Definition at line 1790 of file sch_painter.cpp.

1791 {
1792  SCH_LAYER_ID layer = aEntry->Type() == SCH_BUS_WIRE_ENTRY_T ? LAYER_WIRE : LAYER_BUS;
1793  SCH_LINE line( wxPoint(), layer );
1794  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1795  bool drawingDangling = aLayer == LAYER_DANGLING;
1796 
1797  if( drawingShadows && !aEntry->IsSelected() )
1798  return;
1799 
1800  if( aEntry->IsSelected() )
1801  line.SetSelected();
1802  else if( aEntry->IsBrightened() )
1803  line.SetBrightened();
1804 
1805  line.SetStartPoint( aEntry->GetPosition() );
1806  line.SetEndPoint( aEntry->GetEnd() );
1807  line.SetStroke( aEntry->GetStroke() );
1808  line.SetLineWidth( getLineWidth( aEntry, drawingShadows ) );
1809 
1810  COLOR4D color = getRenderColor( aEntry, LAYER_WIRE, drawingShadows );
1811 
1812  if( aEntry->Type() == SCH_BUS_BUS_ENTRY_T )
1813  color = getRenderColor( aEntry, LAYER_BUS, drawingShadows );
1814 
1815  if( drawingDangling )
1816  {
1817  m_gal->SetIsFill( false );
1818  m_gal->SetIsStroke( true );
1819  m_gal->SetStrokeColor( color.Brightened( 0.3 ) );
1821 
1822  if( aEntry->IsDanglingStart() )
1823  {
1824  m_gal->DrawCircle( aEntry->GetPosition(),
1825  aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) );
1826  }
1827 
1828  if( aEntry->IsDanglingEnd() )
1829  {
1830  m_gal->DrawCircle( aEntry->GetEnd(),
1831  aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) );
1832  }
1833  }
1834  else
1835  {
1836  line.SetLineColor( color );
1837  line.SetLineStyle( aEntry->GetStrokeStyle() );
1838 
1839  draw( &line, aLayer );
1840  }
1841 }
#define TARGET_BUSENTRY_RADIUS
Definition: sch_bus_entry.h:36
bool IsSelected() const
Definition: eda_item.h:122
virtual STROKE_PARAMS GetStroke() const override
Definition: sch_bus_entry.h:81
int color
Definition: DXF_plotter.cpp:57
bool IsBrightened() const
Definition: eda_item.h:125
bool IsDanglingEnd() const
Definition: sch_bus_entry.h:48
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
PLOT_DASH_TYPE GetStrokeStyle() const
bool IsDanglingStart() const
Definition: sch_bus_entry.h:47
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:335
float GetDanglineSymbolThickness() const
Definition: sch_painter.h:95
virtual int GetPenWidth() const
Definition: sch_item.h:276
void draw(LIB_PIN *aPin, int aLayer)
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
wxPoint GetEnd() const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
wxPoint GetPosition() const override

References color, draw(), KIGFX::GAL::DrawCircle(), KIGFX::SCH_RENDER_SETTINGS::GetDanglineSymbolThickness(), SCH_BUS_ENTRY_BASE::GetEnd(), getLineWidth(), SCH_ITEM::GetPenWidth(), SCH_BUS_ENTRY_BASE::GetPosition(), getRenderColor(), SCH_BUS_ENTRY_BASE::GetStroke(), SCH_BUS_ENTRY_BASE::GetStrokeStyle(), EDA_ITEM::IsBrightened(), SCH_BUS_ENTRY_BASE::IsDanglingEnd(), SCH_BUS_ENTRY_BASE::IsDanglingStart(), EDA_ITEM::IsSelected(), LAYER_BUS, LAYER_DANGLING, LAYER_SELECTION_SHADOWS, LAYER_WIRE, KIGFX::PAINTER::m_gal, m_schSettings, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, EDA_ITEM::SetBrightened(), SCH_LINE::SetEndPoint(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), SCH_LINE::SetLineColor(), SCH_LINE::SetLineStyle(), SCH_LINE::SetLineWidth(), KIGFX::GAL::SetLineWidth(), EDA_ITEM::SetSelected(), SCH_LINE::SetStartPoint(), SCH_LINE::SetStroke(), KIGFX::GAL::SetStrokeColor(), TARGET_BUSENTRY_RADIUS, and EDA_ITEM::Type().

◆ drawDanglingSymbol()

void KIGFX::SCH_PAINTER::drawDanglingSymbol ( const wxPoint &  aPos,
const COLOR4D aColor,
int  aWidth,
bool  aDrawingShadows 
)
private

Definition at line 1201 of file sch_painter.cpp.

1203 {
1204  wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
1205  aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) );
1206 
1207  // Dangling symbols must be drawn in a slightly different colour so they can be seen when
1208  // they overlap with a junction dot.
1209  m_gal->SetStrokeColor( aColor.Brightened( 0.3 ) );
1210  m_gal->SetIsStroke( true );
1211  m_gal->SetIsFill( false );
1212  m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth()
1214 
1215  m_gal->DrawRectangle( aPos - radius, aPos + radius );
1216 }
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
float getShadowWidth() const
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition: color4d.h:278
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
float GetDanglineSymbolThickness() const
Definition: sch_painter.h:95
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References KIGFX::COLOR4D::Brightened(), DANGLING_SYMBOL_SIZE, KIGFX::GAL::DrawRectangle(), KIGFX::SCH_RENDER_SETTINGS::GetDanglineSymbolThickness(), getShadowWidth(), KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

Referenced by draw().

◆ drawPinDanglingSymbol()

void KIGFX::SCH_PAINTER::drawPinDanglingSymbol ( const VECTOR2I aPos,
const COLOR4D aColor,
bool  aDrawingShadows 
)
private

Definition at line 740 of file sch_painter.cpp.

742 {
743  // Dangling symbols must be drawn in a slightly different colour so they can be seen when
744  // they overlap with a junction dot.
745  m_gal->SetStrokeColor( aColor.Brightened( 0.3 ) );
746 
747  m_gal->SetIsFill( false );
748  m_gal->SetIsStroke( true );
749  m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth()
751 
753 }
float getShadowWidth() const
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition: color4d.h:278
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
float GetDanglineSymbolThickness() const
Definition: sch_painter.h:95
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:36
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References KIGFX::COLOR4D::Brightened(), KIGFX::GAL::DrawCircle(), KIGFX::SCH_RENDER_SETTINGS::GetDanglineSymbolThickness(), getShadowWidth(), KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), and TARGET_PIN_RADIUS.

Referenced by draw().

◆ externalPinDecoSize()

int KIGFX::SCH_PAINTER::externalPinDecoSize ( const LIB_PIN aPin)
private

Definition at line 730 of file sch_painter.cpp.

731 {
734 
735  return aPin.GetNumberTextSize() / 2;
736 }
int GetNumberTextSize() const
Definition: lib_pin.h:129
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References LIB_PIN::GetNumberTextSize(), KIGFX::SCH_RENDER_SETTINGS::m_PinSymbolSize, and m_schSettings.

Referenced by draw().

◆ getLineWidth() [1/2]

float KIGFX::SCH_PAINTER::getLineWidth ( const LIB_ITEM aItem,
bool  aDrawingShadows 
) const
private

Definition at line 333 of file sch_painter.cpp.

334 {
335  float width = (float) aItem->GetEffectivePenWidth( &m_schSettings );
336 
337  if( aItem->IsSelected() && aDrawingShadows )
338  width += getShadowWidth();
339 
340  return width;
341 }
bool IsSelected() const
Definition: eda_item.h:122
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:153
float getShadowWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References LIB_ITEM::GetEffectivePenWidth(), getShadowWidth(), EDA_ITEM::IsSelected(), and m_schSettings.

Referenced by draw(), and setDeviceColors().

◆ getLineWidth() [2/2]

float KIGFX::SCH_PAINTER::getLineWidth ( const SCH_ITEM aItem,
bool  aDrawingShadows 
) const
private

Definition at line 344 of file sch_painter.cpp.

345 {
346  wxCHECK( aItem, static_cast<float>( Mils2iu( DEFAULT_WIRE_WIDTH_MILS ) ) );
347 
348  float width = (float) aItem->GetPenWidth();
349 
350  if( aItem->IsSelected() && aDrawingShadows )
351  width += getShadowWidth();
352 
353  return std::max( width, 1.0f );
354 }
bool IsSelected() const
Definition: eda_item.h:122
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
float getShadowWidth() const
virtual int GetPenWidth() const
Definition: sch_item.h:276

References DEFAULT_WIRE_WIDTH_MILS, SCH_ITEM::GetPenWidth(), getShadowWidth(), and EDA_ITEM::IsSelected().

◆ getRenderColor()

COLOR4D KIGFX::SCH_PAINTER::getRenderColor ( const EDA_ITEM aItem,
int  aLayer,
bool  aDrawingShadows 
) const
private

Definition at line 270 of file sch_painter.cpp.

271 {
273 
274  if( aItem->Type() == SCH_LINE_T )
275  {
276  COLOR4D lineColor = static_cast<const SCH_LINE*>( aItem )->GetLineColor();
277 
278  if( lineColor != COLOR4D::UNSPECIFIED )
279  color = lineColor;
280  }
281  else if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
282  {
283  COLOR4D busEntryColor = static_cast<const SCH_BUS_WIRE_ENTRY*>( aItem )->GetStrokeColor();
284 
285  if( busEntryColor != COLOR4D::UNSPECIFIED )
286  color = busEntryColor;
287  }
288  else if( aItem->Type() == SCH_JUNCTION_T )
289  {
290  COLOR4D junctionColor = static_cast<const SCH_JUNCTION*>( aItem )->GetJunctionColor();
291 
292  if( junctionColor != COLOR4D::UNSPECIFIED )
293  color = junctionColor;
294  }
295  else if( aItem->Type() == SCH_SHEET_T )
296  {
297  SCH_SHEET* sheet = (SCH_SHEET*) aItem;
298 
300  color = m_schSettings.GetLayerColor( aLayer );
301  else if( aLayer == LAYER_SHEET )
302  color = sheet->GetBorderColor();
303  else if( aLayer == LAYER_SHEET_BACKGROUND )
304  color = sheet->GetBackgroundColor();
305 
306  if( color == COLOR4D::UNSPECIFIED )
307  color = m_schSettings.GetLayerColor( aLayer );
308  }
309 
310  if( aItem->IsBrightened() && !aDrawingShadows ) // Selection disambiguation, etc.
311  {
313 
314  if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND )
315  color = color.WithAlpha( 0.2 );
316  }
317  else if( aItem->IsSelected() )
318  {
319  if( aDrawingShadows )
321  }
322 
324  || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() != LIB_FIELD_T ) )
325  {
326  color = color.Darken( 0.5f );
327  }
328 
329  return color;
330 }
bool IsSelected() const
Definition: eda_item.h:122
int color
Definition: DXF_plotter.cpp:57
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
KIGFX::COLOR4D GetBorderColor() const
Definition: sch_sheet.h:110
bool IsBrightened() const
Definition: eda_item.h:125
KIGFX::COLOR4D GetBackgroundColor() const
Definition: sch_sheet.h:113
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition: color4d.h:390
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, SCH_SHEET::GetBackgroundColor(), SCH_SHEET::GetBorderColor(), KIGFX::RENDER_SETTINGS::GetLayerColor(), EDA_ITEM::IsBrightened(), EDA_ITEM::IsSelected(), LAYER_BRIGHTENED, LAYER_DEVICE_BACKGROUND, LAYER_SELECTION_SHADOWS, LAYER_SHEET, LAYER_SHEET_BACKGROUND, LIB_FIELD_T, KIGFX::SCH_RENDER_SETTINGS::m_OverrideItemColors, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowDisabled, KIGFX::SCH_RENDER_SETTINGS::m_ShowGraphicsDisabled, SCH_BUS_WIRE_ENTRY_T, SCH_JUNCTION_T, SCH_LINE_T, SCH_SHEET_T, EDA_ITEM::Type(), and KIGFX::COLOR4D::UNSPECIFIED.

Referenced by draw(), and setDeviceColors().

◆ GetSettings()

virtual SCH_RENDER_SETTINGS* KIGFX::SCH_PAINTER::GetSettings ( )
inlineoverridevirtual

Return a pointer to current settings that are going to be used when drawing items.

Returns
Current rendering settings.

Implements KIGFX::PAINTER.

Definition at line 139 of file sch_painter.h.

140  {
141  return &m_schSettings;
142  }
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References m_schSettings.

Referenced by SCH_EDITOR_CONTROL::ToggleHiddenFields(), and SCH_EDITOR_CONTROL::ToggleHiddenPins().

◆ getShadowWidth()

float KIGFX::SCH_PAINTER::getShadowWidth ( ) const
private

Definition at line 259 of file sch_painter.cpp.

260 {
261  const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
262 
263  // For best visuals the selection width must be a cross between the zoom level and the
264  // default line width.
265  return (float) std::fabs( matrix.GetScale().x * 2.75 ) +
266  Mils2iu( eeconfig()->m_Selection.thickness );
267 }
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
EESCHEMA_SETTINGS * eeconfig()
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:265
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101

References KIGFX::eeconfig(), MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetScreenWorldMatrix(), KIGFX::PAINTER::m_gal, EESCHEMA_SETTINGS::m_Selection, EESCHEMA_SETTINGS::SELECTION::thickness, and VECTOR2< T >::x.

Referenced by draw(), drawDanglingSymbol(), drawPinDanglingSymbol(), getLineWidth(), and getTextThickness().

◆ getTextThickness() [1/4]

float KIGFX::SCH_PAINTER::getTextThickness ( const SCH_TEXT aItem,
bool  aDrawingShadows 
) const
private

Definition at line 357 of file sch_painter.cpp.

358 {
359  float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
360 
361  if( aItem->IsSelected() && aDrawingShadows )
362  width += getShadowWidth();
363 
364  return width;
365 }
bool IsSelected() const
Definition: eda_item.h:122
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), EDA_TEXT::GetEffectiveTextPenWidth(), getShadowWidth(), EDA_ITEM::IsSelected(), and m_schSettings.

Referenced by draw().

◆ getTextThickness() [2/4]

float KIGFX::SCH_PAINTER::getTextThickness ( const SCH_FIELD aItem,
bool  aDrawingShadows 
) const
private

Definition at line 368 of file sch_painter.cpp.

369 {
370  float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
371 
372  if( aItem->IsSelected() && aDrawingShadows )
373  width += getShadowWidth();
374 
375  return width;
376 }
bool IsSelected() const
Definition: eda_item.h:122
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), EDA_TEXT::GetEffectiveTextPenWidth(), getShadowWidth(), EDA_ITEM::IsSelected(), and m_schSettings.

◆ getTextThickness() [3/4]

float KIGFX::SCH_PAINTER::getTextThickness ( const LIB_FIELD aItem,
bool  aDrawingShadows 
) const
private

Definition at line 379 of file sch_painter.cpp.

380 {
381  float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
383 
384  if( aItem->IsSelected() && aDrawingShadows )
385  width += getShadowWidth();
386 
387  return width;
388 }
bool IsSelected() const
Definition: eda_item.h:122
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), EDA_TEXT::GetEffectiveTextPenWidth(), getShadowWidth(), EDA_ITEM::IsSelected(), and m_schSettings.

◆ getTextThickness() [4/4]

float KIGFX::SCH_PAINTER::getTextThickness ( const LIB_TEXT aItem,
bool  aDrawingShadows 
) const
private

Definition at line 391 of file sch_painter.cpp.

392 {
393  float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
395 
396  if( aItem->IsSelected() && aDrawingShadows )
397  width += getShadowWidth();
398 
399  return width;
400 }
bool IsSelected() const
Definition: eda_item.h:122
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), EDA_TEXT::GetEffectiveTextPenWidth(), getShadowWidth(), EDA_ITEM::IsSelected(), and m_schSettings.

◆ internalPinDecoSize()

int KIGFX::SCH_PAINTER::internalPinDecoSize ( const LIB_PIN aPin)
private

Definition at line 719 of file sch_painter.cpp.

720 {
723 
724  return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
725 }
int GetNameTextSize() const
Definition: lib_pin.h:126
int GetNumberTextSize() const
Definition: lib_pin.h:129
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References LIB_PIN::GetNameTextSize(), LIB_PIN::GetNumberTextSize(), KIGFX::SCH_RENDER_SETTINGS::m_PinSymbolSize, and m_schSettings.

Referenced by draw().

◆ isUnitAndConversionShown()

bool KIGFX::SCH_PAINTER::isUnitAndConversionShown ( const LIB_ITEM aItem) const
private

Definition at line 239 of file sch_painter.cpp.

240 {
241  if( m_schSettings.m_ShowUnit // showing a specific unit
242  && aItem->GetUnit() // item is unit-specific
243  && aItem->GetUnit() != m_schSettings.m_ShowUnit )
244  {
245  return false;
246  }
247 
248  if( m_schSettings.m_ShowConvert // showing a specific conversion
249  && aItem->GetConvert() // item is conversion-specific
250  && aItem->GetConvert() != m_schSettings.m_ShowConvert )
251  {
252  return false;
253  }
254 
255  return true;
256 }
int GetUnit() const
Definition: lib_item.h:266
int GetConvert() const
Definition: lib_item.h:269
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:195

References LIB_ITEM::GetConvert(), LIB_ITEM::GetUnit(), m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowConvert, and KIGFX::SCH_RENDER_SETTINGS::m_ShowUnit.

Referenced by draw().

◆ setDeviceColors()

bool KIGFX::SCH_PAINTER::setDeviceColors ( const LIB_ITEM aItem,
int  aLayer 
)
private

Definition at line 479 of file sch_painter.cpp.

480 {
481  const EDA_SHAPE* shape = dynamic_cast<const EDA_SHAPE*>( aItem );
482 
483  switch( aLayer )
484  {
486  if( aItem->IsSelected() )
487  {
488  m_gal->SetIsFill( false );
489  m_gal->SetIsStroke( true );
490  m_gal->SetLineWidth( getLineWidth( aItem, true ) );
491  m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, true ) );
492  m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, true ) );
493  return true;
494  }
495 
496  return false;
497 
499  if( shape && shape->GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
500  {
501  COLOR4D fillColor = getRenderColor( aItem, LAYER_DEVICE_BACKGROUND, false );
502 
504  m_gal->SetFillColor( fillColor );
505  m_gal->SetIsStroke( false );
506  return true;
507  }
508 
509  return false;
510 
511  case LAYER_DEVICE:
512  m_gal->SetIsFill( shape && shape->GetFillType() == FILL_T::FILLED_SHAPE );
513  m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
514 
515  if( aItem->GetPenWidth() >= 0 || !shape || !shape->IsFilled() )
516  {
517  m_gal->SetIsStroke( true );
518  m_gal->SetLineWidth( getLineWidth( aItem, false ) );
519  m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
520  }
521  else
522  {
523  m_gal->SetIsStroke( false );
524  }
525 
526  return true;
527 
528  default:
529  return false;
530  }
531 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual int GetPenWidth() const =0
bool IsSelected() const
Definition: eda_item.h:122
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsFilled() const
Definition: eda_shape.h:90
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
float getLineWidth(const LIB_ITEM *aItem, bool aDrawingShadows) const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
FILL_T GetFillType() const
Definition: eda_shape.h:88
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR, EDA_SHAPE::GetFillType(), getLineWidth(), LIB_ITEM::GetPenWidth(), getRenderColor(), EDA_SHAPE::IsFilled(), EDA_ITEM::IsSelected(), LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

Referenced by draw().

◆ SetGAL()

void KIGFX::PAINTER::SetGAL ( GAL aGal)
inlineinherited

Changes Graphics Abstraction Layer used for drawing items for a new one.

Parameters
aGalis the new GAL instance.

Definition at line 75 of file painter.h.

76  {
77  m_gal = aGal;
78  }
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101

References KIGFX::PAINTER::m_gal.

◆ SetSchematic()

void KIGFX::SCH_PAINTER::SetSchematic ( SCHEMATIC aSchematic)
inline

Definition at line 144 of file sch_painter.h.

145  {
146  m_schematic = aSchematic;
147  }
SCHEMATIC * m_schematic
Definition: sch_painter.h:197

References m_schematic.

◆ strokeText()

void KIGFX::SCH_PAINTER::strokeText ( const wxString &  aText,
const VECTOR2D aPosition,
double  aRotationAngle 
)
private

Definition at line 409 of file sch_painter.cpp.

410 {
411  m_gal->StrokeText( aText, VECTOR2D( aPosition.x, aPosition.y ), aAngle );
412 }
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.

References KIGFX::PAINTER::m_gal, KIGFX::GAL::StrokeText(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by draw().

◆ triLine()

void KIGFX::SCH_PAINTER::triLine ( const VECTOR2D a,
const VECTOR2D b,
const VECTOR2D c 
)
private

Definition at line 439 of file sch_painter.cpp.

440 {
441  m_gal->DrawLine( a, b );
442  m_gal->DrawLine( b, c );
443 }
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101

References KIGFX::GAL::DrawLine(), and KIGFX::PAINTER::m_gal.

Referenced by draw().

Member Data Documentation

◆ m_gal

GAL* KIGFX::PAINTER::m_gal
protectedinherited

◆ m_schematic

SCHEMATIC* KIGFX::SCH_PAINTER::m_schematic
private

Definition at line 197 of file sch_painter.h.

Referenced by draw(), and SetSchematic().

◆ m_schSettings


The documentation for this class was generated from the following files: