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 (const LIB_RECTANGLE *aRect, int aLayer)
 
void draw (LIB_PIN *aPin, int aLayer)
 
void draw (const LIB_CIRCLE *aCircle, int aLayer)
 
void draw (const LIB_PART *aPart, int, bool aDrawFields=true, int aUnit=0, int aConvert=0)
 
void draw (const LIB_ARC *aArc, int aLayer)
 
void draw (const LIB_POLYLINE *aLine, int aLayer)
 
void draw (const LIB_FIELD *aField, int aLayer)
 
void draw (const LIB_TEXT *aText, int aLayer)
 
void draw (const LIB_BEZIER *aCurve, int aLayer)
 
void draw (SCH_COMPONENT *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, bool aDrawingShadows)
 
void drawDanglingSymbol (const wxPoint &aPos, 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 fillIfSelection (int aLayer)
 
void triLine (const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
 
void strokeText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 

Private Attributes

SCH_RENDER_SETTINGS m_schSettings
 
SCHEMATICm_schematic
 

Detailed Description

Contains methods for drawing schematic-specific items.

Definition at line 133 of file sch_painter.h.

Constructor & Destructor Documentation

◆ SCH_PAINTER()

KIGFX::SCH_PAINTER::SCH_PAINTER ( GAL aGal)

Definition at line 160 of file sch_painter.cpp.

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

Member Function Documentation

◆ 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 170 of file sch_painter.cpp.

171 {
172  const auto item = dynamic_cast<const EDA_ITEM*>( aItem );
173 
174  if( !item )
175  return false;
176 
177 #ifdef CONNECTIVITY_DEBUG
178 
179  auto sch_item = dynamic_cast<const SCH_ITEM*>( item );
180  auto conn = sch_item ? sch_item->Connection( *g_CurrentSheet ) : nullptr;
181 
182  if( conn )
183  {
184  auto pos = item->GetBoundingBox().Centre();
185  auto label = conn->Name( true );
186 
190  m_gal->SetLineWidth( Mils2ui( 2 ) );
191  m_gal->SetGlyphSize( VECTOR2D( Mils2ui( 20 ), Mils2ui( 20 ) ) );
192  m_gal->StrokeText( conn->Name( true ), pos, 0.0, 0 );
193  }
194 
195 #endif
196 
198  {
199  BOX2I box = item->GetBoundingBox();
200 
201  if( item->Type() == SCH_COMPONENT_T )
202  box = static_cast<const SCH_COMPONENT*>( item )->GetBodyBoundingBox();
203 
204  m_gal->SetIsFill( false );
205  m_gal->SetIsStroke( true );
206  m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
207  COLOR4D( 0.2, 0.2, 0.2, 1 ) );
208  m_gal->SetLineWidth( Mils2iu( 3 ) );
209  m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
210  }
211 
212  switch( item->Type() )
213  {
238 
239  default: return false;
240  }
241 
242  return false;
243 }
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
const Vec GetEnd() const
Definition: box2.h:195
Define a symbol library graphical text item.
Definition: lib_text.h:39
Field object used in symbol libraries.
Definition: lib_field.h:59
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:622
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.
Define a library symbol object.
Definition: lib_symbol.h:93
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
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.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
bool m_DrawBoundingBoxes
Draw GAL bounding boxes in painters.
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)
Schematic symbol object.
Definition: sch_symbol.h:78
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:193
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
Define a bezier curve graphic body item.
Definition: lib_bezier.h:34
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References KIGFX::GAL::DrawRectangle(), ADVANCED_CFG::GetCfg(), BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, HANDLE_ITEM, LIB_ARC_T, LIB_BEZIER_T, LIB_CIRCLE_T, LIB_FIELD_T, LIB_PART_T, LIB_PIN_T, LIB_POLYLINE_T, LIB_RECTANGLE_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_COMPONENT_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_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/21]

void KIGFX::SCH_PAINTER::draw ( const LIB_RECTANGLE aRect,
int  aLayer 
)
private

Definition at line 521 of file sch_painter.cpp.

522 {
523  if( !isUnitAndConversionShown( aRect ) )
524  return;
525 
526  if( setDeviceColors( aRect, aLayer ) )
527  {
528  fillIfSelection( aLayer );
529  m_gal->DrawRectangle( mapCoords( aRect->GetPosition() ), mapCoords( aRect->GetEnd() ) );
530  }
531 }
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
wxPoint GetEnd() const
Definition: lib_rectangle.h:82
bool setDeviceColors(const LIB_ITEM *aItem, int aLayer)
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
void fillIfSelection(int aLayer)
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
static VECTOR2D mapCoords(const wxPoint &aCoord)
wxPoint GetPosition() const override
Definition: lib_rectangle.h:69

References KIGFX::GAL::DrawRectangle(), fillIfSelection(), LIB_RECTANGLE::GetEnd(), LIB_RECTANGLE::GetPosition(), isUnitAndConversionShown(), KIGFX::PAINTER::m_gal, KIGFX::mapCoords(), and setDeviceColors().

Referenced by draw().

◆ draw() [2/21]

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

Definition at line 758 of file sch_painter.cpp.

759 {
760  if( !isUnitAndConversionShown( aPin ) )
761  return;
762 
763  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
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( aPin->HasFlag( IS_DANGLING ) && aPin->IsPowerConnection() )
780  drawPinDanglingSymbol( pos, drawingShadows );
781 
782  return;
783  }
784  }
785 
786  VECTOR2I p0;
787  VECTOR2I dir;
788  int len = aPin->GetLength();
789  int orient = aPin->GetOrientation();
790 
791  switch( orient )
792  {
793  case PIN_UP:
794  p0 = VECTOR2I( pos.x, pos.y - len );
795  dir = VECTOR2I( 0, 1 );
796  break;
797 
798  case PIN_DOWN:
799  p0 = VECTOR2I( pos.x, pos.y + len );
800  dir = VECTOR2I( 0, -1 );
801  break;
802 
803  case PIN_LEFT:
804  p0 = VECTOR2I( pos.x - len, pos.y );
805  dir = VECTOR2I( 1, 0 );
806  break;
807 
808  default:
809  case PIN_RIGHT:
810  p0 = VECTOR2I( pos.x + len, pos.y );
811  dir = VECTOR2I( -1, 0 );
812  break;
813  }
814 
815  VECTOR2D pc;
816 
817  m_gal->SetIsStroke( true );
818  m_gal->SetIsFill( false );
819  m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
821  m_gal->SetFontBold( false );
822  m_gal->SetFontUnderlined( false );
823  m_gal->SetFontItalic( false );
824 
825  const int radius = externalPinDecoSize( *aPin );
826  const int diam = radius*2;
827  const int clock_size = internalPinDecoSize( *aPin );
828 
829  if( aPin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
830  {
831  m_gal->DrawLine( p0, pos );
832 
833  m_gal->DrawLine( pos + VECTOR2D( -1, -1 ) * TARGET_PIN_RADIUS,
834  pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
835  m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
836  pos + VECTOR2D( -1, 1 ) * TARGET_PIN_RADIUS );
837 
838  aPin->ClearFlags( IS_DANGLING ); // PIN_NC pin type is always not connected and dangling.
839  }
840  else
841  {
842  switch( aPin->GetShape() )
843  {
845  m_gal->DrawLine( p0, pos );
846  break;
847 
849  m_gal->DrawCircle( p0 + dir * radius, radius );
850  m_gal->DrawLine( p0 + dir * ( diam ), pos );
851  break;
852 
854  pc = p0 - dir * clock_size ;
855 
856  triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
857  pc,
858  p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
859 
860  m_gal->DrawCircle( p0 + dir * radius, radius );
861  m_gal->DrawLine( p0 + dir * ( diam ), pos );
862  break;
863 
866  pc = p0 - dir * clock_size ;
867 
868  triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
869  pc,
870  p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
871 
872  if( !dir.y )
873  {
874  triLine( p0 + VECTOR2D(dir.x, 0) * diam,
875  p0 + VECTOR2D(dir.x, -1) * diam,
876  p0 );
877  }
878  else /* MapX1 = 0 */
879  {
880  triLine( p0 + VECTOR2D( 0, dir.y) * diam,
881  p0 + VECTOR2D(-1, dir.y) * diam,
882  p0 );
883  }
884 
885  m_gal->DrawLine( p0, pos );
886  break;
887 
889  m_gal->DrawLine( p0, pos );
890 
891  if( !dir.y )
892  {
893  triLine( p0 + VECTOR2D( 0, clock_size ),
894  p0 + VECTOR2D( -dir.x * clock_size, 0 ),
895  p0 + VECTOR2D( 0, -clock_size ) );
896  }
897  else
898  {
899  triLine( p0 + VECTOR2D( clock_size, 0 ),
900  p0 + VECTOR2D( 0, -dir.y * clock_size ),
901  p0 + VECTOR2D( -clock_size, 0 ) );
902  }
903  break;
904 
906  m_gal->DrawLine( p0, pos );
907 
908  if( !dir.y )
909  {
910  triLine( p0 + VECTOR2D(dir.x, 0) * diam,
911  p0 + VECTOR2D(dir.x, -1) * diam,
912  p0 );
913  }
914  else /* MapX1 = 0 */
915  {
916  triLine( p0 + VECTOR2D( 0, dir.y) * diam,
917  p0 + VECTOR2D(-1, dir.y) * diam,
918  p0 );
919  }
920  break;
921 
922  case GRAPHIC_PINSHAPE::OUTPUT_LOW: // IEEE symbol "Active Low Output"
923  m_gal->DrawLine( p0, pos );
924 
925  if( !dir.y ) // Horizontal pin
926  m_gal->DrawLine( p0 - VECTOR2D( 0, diam ), p0 + VECTOR2D( dir.x, 0 ) * diam );
927  else // Vertical pin
928  m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
929  break;
930 
931  case GRAPHIC_PINSHAPE::NONLOGIC: // NonLogic pin symbol
932  m_gal->DrawLine( p0, pos );
933 
934  m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,
935  p0 + VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius );
936  m_gal->DrawLine( p0 - VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius,
937  p0 + VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius );
938  break;
939  }
940  }
941 
942 
943  if( aPin->HasFlag( IS_DANGLING ) && ( aPin->IsVisible() || aPin->IsPowerConnection() ) )
944  drawPinDanglingSymbol( pos, drawingShadows );
945 
946  LIB_PART* libEntry = aPin->GetParent();
947 
948  // Draw the labels
949  if( drawingShadows && ( libEntry->Type() == LIB_PART_T || libEntry->IsSelected() )
951  return;
952 
953  int textOffset = libEntry->GetPinNameOffset();
954 
955  float nameLineWidth = getLineWidth( aPin, drawingShadows );
956  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, aPin->GetNameTextSize(), false );
957  float numLineWidth = getLineWidth( aPin, drawingShadows );
958  numLineWidth = Clamp_Text_PenSize( numLineWidth, aPin->GetNumberTextSize(), false );
959 
960  #define PIN_TEXT_MARGIN 4.0
961 
962  // Four locations around a pin where text can be drawn
963  enum { INSIDE = 0, OUTSIDE, ABOVE, BELOW };
964  int size[4] = { 0, 0, 0, 0 };
965  float thickness[4] = { numLineWidth, numLineWidth, numLineWidth, numLineWidth };
966  COLOR4D colour[4];
967  wxString text[4];
968 
969  // TextOffset > 0 means pin NAMES on inside, pin NUMBERS above and nothing below
970  if( textOffset )
971  {
972  size [INSIDE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
973  thickness[INSIDE] = nameLineWidth;
974  colour [INSIDE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
975  text [INSIDE] = aPin->GetName();
976 
977  size [ABOVE] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
978  thickness[ABOVE] = numLineWidth;
979  colour [ABOVE] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
980  text [ABOVE] = aPin->GetNumber();
981  }
982  // Otherwise pin NAMES go above and pin NUMBERS go below
983  else
984  {
985  size [ABOVE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
986  thickness[ABOVE] = nameLineWidth;
987  colour [ABOVE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
988  text [ABOVE] = aPin->GetName();
989 
990  size [BELOW] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
991  thickness[BELOW] = numLineWidth;
992  colour [BELOW] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
993  text [BELOW] = aPin->GetNumber();
994  }
995 
997  {
998  size [OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, Millimeter2iu( 0.7 ) );
999  thickness[OUTSIDE] = float( size[OUTSIDE] ) / 6.0F;
1000  colour [OUTSIDE] = getRenderColor( aPin, LAYER_NOTES, drawingShadows );
1001  text [OUTSIDE] = aPin->GetElectricalTypeName();
1002  }
1003 
1004  if( !aPin->IsVisible() )
1005  {
1006  for( COLOR4D& c : colour )
1007  c = getRenderColor( aPin, LAYER_HIDDEN, drawingShadows );
1008  }
1009 
1010  int insideOffset = textOffset;
1011  int outsideOffset = 10;
1012  float lineThickness = (float) m_schSettings.GetDefaultPenWidth();
1013  float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[ABOVE] + lineThickness ) / 2.0;
1014  float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[BELOW] + lineThickness ) / 2.0;
1015 
1016  if( drawingShadows )
1017  {
1018  for( float& t : thickness )
1019  t += getShadowWidth();
1020 
1021  insideOffset -= KiROUND( getShadowWidth() / 2 );
1022  outsideOffset -= KiROUND( getShadowWidth() / 2 );
1023  }
1024 
1025  #define SET_DC( i ) \
1026  m_gal->SetGlyphSize( VECTOR2D( size[i], size[i] ) ); \
1027  m_gal->SetLineWidth( thickness[i] ); \
1028  m_gal->SetStrokeColor( colour[i] )
1029 
1030  switch( orient )
1031  {
1032  case PIN_LEFT:
1033  if( size[INSIDE] )
1034  {
1035  SET_DC( INSIDE );
1038  strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 );
1039  }
1040  if( size[OUTSIDE] )
1041  {
1042  SET_DC( OUTSIDE );
1045  strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 );
1046  }
1047  if( size[ABOVE] )
1048  {
1049  SET_DC( ABOVE );
1052  strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
1053  }
1054  if( size[BELOW] )
1055  {
1056  SET_DC( BELOW );
1059  strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
1060  }
1061  break;
1062 
1063  case PIN_RIGHT:
1064  if( size[INSIDE] )
1065  {
1066  SET_DC( INSIDE );
1070  strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 );
1071  }
1072  if( size[OUTSIDE] )
1073  {
1074  SET_DC( OUTSIDE );
1077  strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 );
1078  }
1079  if( size[ABOVE] )
1080  {
1081  SET_DC( ABOVE );
1084  strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
1085  }
1086  if( size[BELOW] )
1087  {
1088  SET_DC( BELOW );
1091  strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
1092  }
1093  break;
1094 
1095  case PIN_DOWN:
1096  if( size[INSIDE] )
1097  {
1098  SET_DC( INSIDE );
1101  strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2 );
1102  }
1103  if( size[OUTSIDE] )
1104  {
1105  SET_DC( OUTSIDE );
1108  strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2 );
1109  }
1110  if( size[ABOVE] )
1111  {
1112  SET_DC( ABOVE );
1115  strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
1116  }
1117  if( size[BELOW] )
1118  {
1119  SET_DC( BELOW );
1122  strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
1123  }
1124  break;
1125 
1126  case PIN_UP:
1127  if( size[INSIDE] )
1128  {
1129  SET_DC( INSIDE );
1132  strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2 );
1133  }
1134  if( size[OUTSIDE] )
1135  {
1136  SET_DC( OUTSIDE );
1139  strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2 );
1140  }
1141  if( size[ABOVE] )
1142  {
1143  SET_DC( ABOVE );
1146  strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
1147  }
1148  if( size[BELOW] )
1149  {
1150  SET_DC( BELOW );
1153  strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
1154  }
1155  break;
1156 
1157  default:
1158  wxFAIL_MSG( "Unknown pin orientation" );
1159  }
1160 }
bool IsSelected() const
Definition: eda_item.h:173
void drawPinDanglingSymbol(const VECTOR2I &aPos, bool aDrawingShadows)
int GetOrientation() const
Definition: lib_pin.h:77
LIB_PART * GetParent() const
Definition: lib_item.h:147
GRAPHIC_PINSHAPE GetShape() const
Definition: lib_pin.h:80
int color
Definition: DXF_plotter.cpp:60
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
Definition: lib_pin.h:50
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
float getShadowWidth() const
EESCHEMA_SETTINGS * eeconfig()
#define SET_DC(i)
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:186
virtual void SetLineWidth(float aLineWidth)
Set the line width.
void SetFontBold(const bool aBold)
Set bold property of current font.
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:69
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
wxString const GetElectricalTypeName() const
Definition: lib_pin.h:94
const wxString & GetName() const
Definition: lib_pin.h:108
Define a library symbol object.
Definition: lib_symbol.h:93
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
void triLine(const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
Text appears outside the dimension line (default)
bool IsVisible() const
Definition: lib_pin.h:99
int GetNameTextSize() const
Definition: lib_pin.h:126
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.
int GetPinNameOffset() const
Definition: lib_symbol.h:557
wxPoint GetPosition() const override
Definition: lib_pin.h:210
int externalPinDecoSize(const LIB_PIN &aPin)
const wxString & GetNumber() const
Definition: lib_pin.h:117
ELECTRICAL_PINTYPE GetType() const
Definition: lib_pin.h:86
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:83
int internalPinDecoSize(const LIB_PIN &aPin)
bool ShowPinNumbers() const
Definition: lib_symbol.h:573
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:68
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:38
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:204
int GetDefaultPenWidth() const
#define IS_DANGLING
indicates a pin is dangling
Definition: eda_item.h:137
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.
#define PIN_TEXT_MARGIN
static constexpr int Millimeter2iu(double mm)
bool ShowPinNames() const
Definition: lib_symbol.h:565
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:206
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References Clamp_Text_PenSize(), EDA_ITEM::ClearFlags(), 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::GetName(), LIB_PIN::GetNameTextSize(), LIB_PIN::GetNumber(), LIB_PIN::GetNumberTextSize(), LIB_PIN::GetOrientation(), LIB_ITEM::GetParent(), LIB_PART::GetPinNameOffset(), LIB_PIN::GetPosition(), getRenderColor(), getShadowWidth(), LIB_PIN::GetShape(), 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_HIDDEN, LAYER_NOTES, LAYER_PIN, LAYER_PINNAM, LAYER_PINNUM, LAYER_SELECTION_SHADOWS, LIB_PART_T, LINE, KIGFX::PAINTER::m_gal, m_schSettings, EESCHEMA_SETTINGS::m_Selection, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenPins, KIGFX::SCH_RENDER_SETTINGS::m_ShowPinsElectricalType, KIGFX::mapCoords(), Millimeter2iu(), NONLOGIC, OUTPUT_LOW, OUTSIDE, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PT_NC, SET_DC, KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), LIB_PART::ShowPinNames(), LIB_PART::ShowPinNumbers(), strokeText(), TARGET_PIN_RADIUS, text, triLine(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ draw() [3/21]

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

Definition at line 534 of file sch_painter.cpp.

535 {
536  if( !isUnitAndConversionShown( aCircle ) )
537  return;
538 
539  if( setDeviceColors( aCircle, aLayer ) )
540  {
541  fillIfSelection( aLayer );
542  m_gal->DrawCircle( mapCoords( aCircle->GetPosition() ), aCircle->GetRadius() );
543  }
544 }
bool setDeviceColors(const LIB_ITEM *aItem, int aLayer)
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
wxPoint GetPosition() const override
Definition: lib_circle.h:68
void fillIfSelection(int aLayer)
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
int GetRadius() const
Definition: lib_circle.h:84
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.

References KIGFX::GAL::DrawCircle(), fillIfSelection(), LIB_CIRCLE::GetPosition(), LIB_CIRCLE::GetRadius(), isUnitAndConversionShown(), KIGFX::PAINTER::m_gal, KIGFX::mapCoords(), and setDeviceColors().

◆ draw() [4/21]

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

Definition at line 415 of file sch_painter.cpp.

416 {
417  if( !aUnit )
418  aUnit = m_schSettings.m_ShowUnit;
419 
420  if( !aConvert )
421  aConvert = m_schSettings.m_ShowConvert;
422 
423  std::unique_ptr< LIB_PART > tmpPart;
424  const LIB_PART* drawnPart = aPart;
425 
426  if( aPart->IsAlias() )
427  {
428  tmpPart = aPart->Flatten();
429  drawnPart = tmpPart.get();
430  }
431 
432  for( const LIB_ITEM& item : drawnPart->GetDrawItems() )
433  {
434  if( !aDrawFields && item.Type() == LIB_FIELD_T )
435  continue;
436 
437  if( aUnit && item.GetUnit() && aUnit != item.GetUnit() )
438  continue;
439 
440  if( aConvert && item.GetConvert() && aConvert != item.GetConvert() )
441  continue;
442 
443  Draw( &item, aLayer );
444  }
445 }
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.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:62
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:469
Define a library symbol object.
Definition: lib_symbol.h:93
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:334
bool IsAlias() const
Definition: lib_symbol.h:168
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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

◆ draw() [5/21]

void KIGFX::SCH_PAINTER::draw ( const LIB_ARC aArc,
int  aLayer 
)
private

This accounts for an oddity in the old library format, where the symbol is overdefined. The previous draw (based on wxwidgets) used start point and end point and always drew counter-clockwise. The new GAL draw takes center, radius and start/end angles. All of these points were stored in the file, so we need to mimic the swapping of start/end points rather than using the stored angles in order to properly map edge cases.

todo(v6): Remove this hack when we update the file format and do translation on loading.

Definition at line 547 of file sch_painter.cpp.

548 {
549  if( !isUnitAndConversionShown( aArc ) )
550  return;
551 
552  if( setDeviceColors( aArc, aLayer ) )
553  {
554  int sai = aArc->GetFirstRadiusAngle();
555  int eai = aArc->GetSecondRadiusAngle();
556 
567  if( !TRANSFORM().MapAngles( &sai, &eai ) )
568  {
569  LIB_ARC new_arc( *aArc );
570 
571  new_arc.SetStart( aArc->GetEnd() );
572  new_arc.SetEnd( aArc->GetStart() );
573  new_arc.CalcRadiusAngles();
574  sai = new_arc.GetFirstRadiusAngle();
575  eai = new_arc.GetSecondRadiusAngle();
576  TRANSFORM().MapAngles( &sai, &eai );
577  }
578 
579  double sa = (double) sai * M_PI / 1800.0;
580  double ea = (double) eai * M_PI / 1800.0 ;
581 
582  VECTOR2D pos = mapCoords( aArc->GetPosition() );
583 
584  m_gal->DrawArc( pos, aArc->GetRadius(), sa, ea );
585  }
586 }
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
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
int GetSecondRadiusAngle() const
Definition: lib_arc.h:90
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
wxPoint GetStart() const
Definition: lib_arc.h:92
static VECTOR2D mapCoords(const wxPoint &aCoord)
int GetRadius() const
Definition: lib_arc.h:84
wxPoint GetEnd() const
Definition: lib_arc.h:95
int GetFirstRadiusAngle() const
Definition: lib_arc.h:87
bool MapAngles(int *aAngle1, int *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:81
wxPoint GetPosition() const override
Definition: lib_arc.h:71

References LIB_ARC::CalcRadiusAngles(), KIGFX::GAL::DrawArc(), LIB_ARC::GetEnd(), LIB_ARC::GetFirstRadiusAngle(), LIB_ARC::GetPosition(), LIB_ARC::GetRadius(), LIB_ARC::GetSecondRadiusAngle(), LIB_ARC::GetStart(), isUnitAndConversionShown(), KIGFX::PAINTER::m_gal, TRANSFORM::MapAngles(), KIGFX::mapCoords(), setDeviceColors(), LIB_ARC::SetEnd(), and LIB_ARC::SetStart().

◆ draw() [6/21]

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

Definition at line 589 of file sch_painter.cpp.

590 {
591  if( !isUnitAndConversionShown( aLine ) )
592  return;
593 
594  if( setDeviceColors( aLine, aLayer ) )
595  {
596  const std::vector<wxPoint>& pts = aLine->GetPolyPoints();
597  std::deque<VECTOR2D> vtx;
598 
599  for( auto p : pts )
600  vtx.push_back( mapCoords( p ) );
601 
602  fillIfSelection( aLayer );
603  m_gal->DrawPolygon( vtx );
604  }
605 }
bool setDeviceColors(const LIB_ITEM *aItem, int aLayer)
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
void fillIfSelection(int aLayer)
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
const std::vector< wxPoint > & GetPolyPoints() const
Definition: lib_polyline.h:54
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.

References KIGFX::GAL::DrawPolygon(), fillIfSelection(), LIB_POLYLINE::GetPolyPoints(), isUnitAndConversionShown(), KIGFX::PAINTER::m_gal, KIGFX::mapCoords(), and setDeviceColors().

◆ draw() [7/21]

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

Definition at line 608 of file sch_painter.cpp.

609 {
610  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
611 
612  if( drawingShadows && !aField->IsSelected() )
613  return;
614 
615  if( !isUnitAndConversionShown( aField ) )
616  return;
617 
618  // Must check layer as fields are sometimes drawn by their parent rather than
619  // directly from the view.
620  int layers[KIGFX::VIEW::VIEW_MAX_LAYERS];
621  int layers_count;
622  bool foundLayer = false;
623 
624  aField->ViewGetLayers( layers, layers_count );
625 
626  for( int i = 0; i < layers_count; ++i )
627  {
628  if( layers[i] == aLayer )
629  foundLayer = true;
630  }
631 
632  if( !foundLayer )
633  return;
634 
635  COLOR4D color = getRenderColor( aField, aLayer, drawingShadows );
636 
637  if( !( aField->IsVisible() || aField->IsForceVisible() ) )
638  {
640  color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows );
641  else
642  return;
643  }
644 
645  m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
646  m_gal->SetIsFill( false );
647  m_gal->SetIsStroke( true );
649 
650  auto pos = mapCoords( aField->GetPosition() );
651 
652  if( drawingShadows && eeconfig()->m_Selection.text_as_box )
653  {
654  EDA_RECT boundaryBox = aField->GetBoundingBox();
655 
656  m_gal->SetIsFill( true );
658  m_gal->SetLineWidth( m_gal->GetLineWidth() * 0.5 );
659  boundaryBox.RevertYAxis();
660 
661  m_gal->DrawRectangle( mapCoords( boundaryBox.GetPosition() ),
662  mapCoords( boundaryBox.GetEnd() ) );
663  }
664  else
665  {
666  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
667  m_gal->SetFontItalic( aField->IsItalic() );
668 
671 
672  double orient = aField->GetTextAngleRadians();
673 
674  strokeText( aField->GetText(), pos, orient );
675  }
676 
677  // Draw the umbilical line
678  if( aField->IsMoving() && m_schSettings.m_ShowUmbilicals )
679  {
681  m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
682  m_gal->DrawLine( pos, wxPoint( 0, 0 ) );
683  }
684 }
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.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsSelected() const
Definition: eda_item.h:173
wxPoint GetPosition() const override
Definition: lib_field.h:180
bool IsVisible() const
Definition: eda_text.h:193
bool IsMoving() const
Definition: eda_item.h:170
int color
Definition: DXF_plotter.cpp:60
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:313
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:203
EESCHEMA_SETTINGS * eeconfig()
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:700
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:187
const wxPoint GetEnd() const
Definition: eda_rect.h:108
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:338
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
const wxSize & GetTextSize() const
Definition: eda_text.h:245
const wxPoint GetPosition() const
Definition: eda_rect.h:107
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.
double GetTextAngleRadians() const
Definition: eda_text.h:184
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
bool IsForceVisible() const
Definition: eda_item.h:256
Handle the component boundary box.
Definition: eda_rect.h:42
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:133
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References color, KIGFX::GAL::DrawLine(), KIGFX::GAL::DrawRectangle(), KIGFX::eeconfig(), LIB_FIELD::GetBoundingBox(), EDA_RECT::GetEnd(), EDA_TEXT::GetHorizJustify(), KIGFX::GAL::GetLineWidth(), EDA_RECT::GetPosition(), LIB_FIELD::GetPosition(), getRenderColor(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextSize(), getTextThickness(), EDA_TEXT::GetVertJustify(), EDA_ITEM::IsForceVisible(), EDA_TEXT::IsItalic(), EDA_ITEM::IsMoving(), EDA_ITEM::IsSelected(), isUnitAndConversionShown(), EDA_TEXT::IsVisible(), LAYER_HIDDEN, 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::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(), EESCHEMA_SETTINGS::SELECTION::text_as_box, KIGFX::VIEW::VIEW_MAX_LAYERS, and LIB_FIELD::ViewGetLayers().

◆ draw() [8/21]

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

Definition at line 687 of file sch_painter.cpp.

688 {
689  if( !isUnitAndConversionShown( aText ) )
690  return;
691 
692  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
693 
694  if( drawingShadows && !aText->IsSelected() )
695  return;
696 
697  COLOR4D color = getRenderColor( aText, LAYER_DEVICE, drawingShadows );
698 
699  if( !aText->IsVisible() )
700  {
702  color = getRenderColor( aText, LAYER_HIDDEN, drawingShadows );
703  else
704  return;
705  }
706 
707  EDA_RECT bBox = aText->GetBoundingBox();
708  bBox.RevertYAxis();
709  VECTOR2D pos = mapCoords( bBox.Centre() );
710  double orient = aText->GetTextAngleRadians();
711 
714  m_gal->SetLineWidth( getTextThickness( aText, drawingShadows ) );
715  m_gal->SetIsFill( false );
716  m_gal->SetIsStroke( true );
718  m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
719  m_gal->SetFontBold( aText->IsBold() );
720  m_gal->SetFontItalic( aText->IsItalic() );
721  m_gal->SetFontUnderlined( false );
722  strokeText( aText->GetText(), pos, orient );
723 }
bool IsBold() const
Definition: eda_text.h:190
bool IsSelected() const
Definition: eda_item.h:173
bool IsVisible() const
Definition: eda_text.h:193
int color
Definition: DXF_plotter.cpp:60
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: eda_rect.h:203
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:187
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
const wxSize & GetTextSize() const
Definition: eda_text.h:245
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.
double GetTextAngleRadians() const
Definition: eda_text.h:184
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
const EDA_RECT GetBoundingBox() const override
Definition: lib_text.cpp:356
Handle the component boundary box.
Definition: eda_rect.h:42
wxPoint Centre() const
Definition: eda_rect.h:60
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:133
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

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() [9/21]

void KIGFX::SCH_PAINTER::draw ( const LIB_BEZIER aCurve,
int  aLayer 
)
private

Definition at line 1163 of file sch_painter.cpp.

1164 {
1165  if( !isUnitAndConversionShown( aCurve ) )
1166  return;
1167 
1168  if( setDeviceColors( aCurve, aLayer ) )
1169  {
1170  BEZIER_POLY poly ( aCurve->GetPoints() );
1171  std::vector<wxPoint> pts;
1172  std::deque<VECTOR2D> pts_xformed;
1173  poly.GetPoly( pts );
1174 
1175  for( const wxPoint &p : pts )
1176  pts_xformed.push_back( mapCoords( p ) );
1177 
1178  m_gal->DrawPolygon( pts_xformed );
1179  }
1180 }
void GetPoly(std::vector< wxPoint > &aOutput, int aMinSegLen=0)
Convert a Bezier curve to a polygon.
bool setDeviceColors(const LIB_ITEM *aItem, int aLayer)
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
const std::vector< wxPoint > & GetPoints() const
Definition: lib_bezier.h:64
static VECTOR2D mapCoords(const wxPoint &aCoord)
Bezier curves to polygon converter.
Definition: bezier_curves.h:36
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.

References KIGFX::GAL::DrawPolygon(), LIB_BEZIER::GetPoints(), BEZIER_POLY::GetPoly(), isUnitAndConversionShown(), KIGFX::PAINTER::m_gal, KIGFX::mapCoords(), and setDeviceColors().

◆ draw() [10/21]

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

Definition at line 1433 of file sch_painter.cpp.

1434 {
1435  int unit = aSymbol->GetUnitSelection( &m_schematic->CurrentSheet() );
1436  int convert = aSymbol->GetConvert();
1437 
1438  // Use dummy part if the actual couldn't be found (or couldn't be locked).
1439  LIB_PART* originalPart = aSymbol->GetPartRef() ? aSymbol->GetPartRef().get() : dummy();
1440  LIB_PINS originalPins;
1441  originalPart->GetPins( originalPins, unit, convert );
1442 
1443  // Copy the source so we can re-orient and translate it.
1444  LIB_PART tempPart( *originalPart );
1445  LIB_PINS tempPins;
1446  tempPart.GetPins( tempPins, unit, convert );
1447 
1448  tempPart.SetFlags( aSymbol->GetFlags() );
1449 
1450  orientPart( &tempPart, aSymbol->GetOrientation() );
1451 
1452  for( auto& tempItem : tempPart.GetDrawItems() )
1453  {
1454  tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
1455  tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) );
1456  }
1457 
1458  // Copy the pin info from the symbol to the temp pins
1459  for( unsigned i = 0; i < tempPins.size(); ++ i )
1460  {
1461  SCH_PIN* symbolPin = aSymbol->GetPin( originalPins[ i ] );
1462  LIB_PIN* tempPin = tempPins[ i ];
1463 
1464  tempPin->ClearFlags();
1465  tempPin->SetFlags( symbolPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
1466 
1467  tempPin->SetName( symbolPin->GetName() );
1468  tempPin->SetType( symbolPin->GetType() );
1469  tempPin->SetShape( symbolPin->GetShape() );
1470 
1471  if( symbolPin->IsDangling() )
1472  tempPin->SetFlags( IS_DANGLING );
1473  }
1474 
1475  draw( &tempPart, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
1476 
1477  // The fields are SCH_COMPONENT-specific so don't need to be copied/oriented/translated
1478  for( const SCH_FIELD& field : aSymbol->GetFields() )
1479  draw( &field, aLayer );
1480 }
void draw(const LIB_RECTANGLE *aRect, int aLayer)
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
SCHEMATIC * m_schematic
Definition: sch_painter.h:201
int GetOrientation()
Get the display symbol orientation.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:56
void SetShape(GRAPHIC_PINSHAPE aShape)
Definition: lib_pin.h:81
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape.
bool IsDangling() const override
Definition: sch_pin.h:84
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:701
int GetUnit() const
Definition: sch_symbol.h:195
void SetType(ELECTRICAL_PINTYPE aType)
Definition: lib_pin.h:87
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:203
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:695
Define a library symbol object.
Definition: lib_symbol.h:93
GRAPHIC_PINSHAPE GetShape() const
Definition: sch_pin.cpp:97
std::unique_ptr< LIB_PART > & GetPartRef()
Definition: sch_symbol.h:164
static VECTOR2D mapCoords(const wxPoint &aCoord)
static void orientPart(LIB_PART *part, int orientation)
void SetName(const wxString &aName)
Definition: lib_pin.h:109
ELECTRICAL_PINTYPE GetType() const
Definition: sch_pin.cpp:88
wxPoint GetPosition() const override
Definition: sch_symbol.h:641
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:204
#define IS_DANGLING
indicates a pin is dangling
Definition: eda_item.h:137
int GetConvert() const
Definition: sch_symbol.h:223
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:119
STATUS_FLAGS GetFlags() const
Definition: eda_item.h:205
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:521
wxString GetName() const
Definition: sch_pin.cpp:79
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
Definition: sch_symbol.cpp:830

References EDA_ITEM::ClearFlags(), convert, SCHEMATIC::CurrentSheet(), draw(), KIGFX::dummy(), SCH_COMPONENT::GetConvert(), LIB_PART::GetDrawItems(), SCH_COMPONENT::GetFields(), EDA_ITEM::GetFlags(), SCH_PIN::GetName(), SCH_COMPONENT::GetOrientation(), SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetPin(), LIB_PART::GetPins(), SCH_COMPONENT::GetPosition(), SCH_PIN::GetShape(), SCH_PIN::GetType(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitSelection(), IS_DANGLING, SCH_PIN::IsDangling(), m_schematic, KIGFX::mapCoords(), KIGFX::orientPart(), EDA_ITEM::SetFlags(), LIB_PIN::SetName(), LIB_PIN::SetShape(), and LIB_PIN::SetType().

◆ draw() [11/21]

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

Definition at line 1199 of file sch_painter.cpp.

1200 {
1201  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1202 
1203  if( drawingShadows && !aJct->IsSelected() )
1204  return;
1205 
1206  COLOR4D color = getRenderColor( aJct, aJct->GetLayer(), drawingShadows );
1207 
1208  int junctionSize = aJct->GetDiameter() / 2;
1209 
1210  if( junctionSize > 1 )
1211  {
1212  m_gal->SetIsStroke( drawingShadows );
1213  m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1215  m_gal->SetIsFill( !drawingShadows );
1216  m_gal->SetFillColor( color );
1217  m_gal->DrawCircle( aJct->GetPosition(), junctionSize );
1218  }
1219 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
bool IsSelected() const
Definition: eda_item.h:173
int color
Definition: DXF_plotter.cpp:60
int GetDiameter() 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.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
wxPoint GetPosition() const override
Definition: sch_junction.h:92
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:272
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
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.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References color, KIGFX::GAL::DrawCircle(), SCH_JUNCTION::GetDiameter(), 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() [12/21]

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

Definition at line 1483 of file sch_painter.cpp.

1484 {
1485  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1486 
1487  if( drawingShadows && !aField->IsSelected() )
1488  return;
1489 
1490  aLayer = aField->GetLayer();
1491 
1492  COLOR4D color = getRenderColor( aField, aLayer, drawingShadows );
1493 
1494  if( !( aField->IsVisible() || aField->IsForceVisible() ) )
1495  {
1497  color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows );
1498  else
1499  return;
1500  }
1501 
1502  if( aField->IsVoid() )
1503  return;
1504 
1505  if( drawingShadows && aField->GetParent()->IsSelected()
1507  {
1508  return;
1509  }
1510 
1511  bool underline = false;
1512 
1513  if( aField->IsHypertext() && ( aField->GetFlags() & IS_ROLLOVER ) > 0
1514  && !drawingShadows && !aField->IsMoving() )
1515  {
1516  color = PUREBLUE;
1517  underline = true;
1518  }
1519 
1520  // Calculate the text orientation according to the parent orientation.
1521  int orient = (int) aField->GetTextAngle();
1522 
1523  if( aField->GetParent() && aField->GetParent()->Type() == SCH_COMPONENT_T )
1524  {
1525  if( static_cast<SCH_COMPONENT*>( aField->GetParent() )->GetTransform().y1 )
1526  {
1527  // Rotate symbol 90 degrees.
1528  if( orient == TEXT_ANGLE_HORIZ )
1529  orient = TEXT_ANGLE_VERT;
1530  else
1531  orient = TEXT_ANGLE_HORIZ;
1532  }
1533  }
1534 
1535  /*
1536  * Calculate the text justification, according to the symbol orientation/mirror.
1537  * This is a bit complicated due to cumulative calculations:
1538  * - numerous cases (mirrored or not, rotation)
1539  * - the DrawGraphicText function recalculate also H and H justifications according to the
1540  * text orientation.
1541  * - when symbol is mirrored, the text is not mirrored and justifications are complicated
1542  * to calculate so the easier way is to use no justifications (centered text) and use
1543  * GetBoundingBox to know the text coordinate considered as centered
1544  */
1545  EDA_RECT boundaryBox = aField->GetBoundingBox();
1546  wxPoint textpos = boundaryBox.Centre();
1547 
1549  m_gal->SetIsStroke( true );
1550 
1551  if( drawingShadows && eeconfig()->m_Selection.text_as_box )
1552  {
1553  m_gal->SetIsFill( true );
1554  m_gal->SetFillColor( color );
1555  m_gal->SetLineWidth( m_gal->GetLineWidth() * 0.5 );
1556  boundaryBox.RevertYAxis();
1557 
1558  m_gal->DrawRectangle( mapCoords( boundaryBox.GetPosition() ),
1559  mapCoords( boundaryBox.GetEnd() ) );
1560  }
1561  else
1562  {
1565  m_gal->SetIsFill( false );
1566  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
1567  m_gal->SetFontBold( aField->IsBold() );
1568  m_gal->SetFontItalic( aField->IsItalic() );
1569  m_gal->SetFontUnderlined( underline );
1570  m_gal->SetTextMirrored( aField->IsMirrored() );
1571  m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
1572 
1573  strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0 );
1574  }
1575 
1576  // Draw the umbilical line
1577  if( aField->IsMoving() )
1578  {
1579  wxPoint parentPos = aField->GetParentPosition();
1580 
1582  m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
1583  m_gal->DrawLine( textpos, parentPos );
1584  }
1585 }
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:50
bool IsBold() const
Definition: eda_text.h:190
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:196
bool IsSelected() const
Definition: eda_item.h:173
bool IsVisible() const
Definition: eda_text.h:193
bool IsMoving() const
Definition: eda_item.h:170
int color
Definition: DXF_plotter.cpp:60
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_field.h:90
double GetTextAngle() const
Definition: eda_text.h:181
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.
Definition: eda_item.h:130
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:203
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:104
bool IsVoid() const
Definition: sch_field.cpp:321
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:187
const wxPoint GetEnd() const
Definition: eda_rect.h:108
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
const wxSize & GetTextSize() const
Definition: eda_text.h:245
const wxPoint GetPosition() const
Definition: eda_rect.h:107
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
EDA_ITEM * GetParent() const
Definition: eda_item.h:165
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
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.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:272
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
bool IsForceVisible() const
Definition: eda_item.h:256
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:262
Handle the component boundary box.
Definition: eda_rect.h:42
wxPoint Centre() const
Definition: eda_rect.h:60
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
#define TEXT_ANGLE_VERT
Definition: eda_text.h:51
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
wxPoint GetParentPosition() const
Definition: sch_field.cpp:723
STATUS_FLAGS GetFlags() const
Definition: eda_item.h:205
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

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_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_COMPONENT_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() [13/21]

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

Definition at line 1301 of file sch_painter.cpp.

1302 {
1303  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1304 
1305  if( drawingShadows && !aText->IsSelected() )
1306  return;
1307 
1308  switch( aText->Type() )
1309  {
1310  case SCH_SHEET_PIN_T: aLayer = LAYER_SHEETLABEL; break;
1311  case SCH_HIER_LABEL_T: aLayer = LAYER_HIERLABEL; break;
1312  case SCH_GLOBAL_LABEL_T: aLayer = LAYER_GLOBLABEL; break;
1313  case SCH_LABEL_T: aLayer = LAYER_LOCLABEL; break;
1314  default: aLayer = LAYER_NOTES; break;
1315  }
1316 
1317  COLOR4D color = getRenderColor( aText, aLayer, drawingShadows );
1318 
1319  if( m_schematic )
1320  {
1321  SCH_CONNECTION* conn = aText->Connection();
1322 
1323  if( conn && conn->IsBus() )
1324  color = getRenderColor( aText, LAYER_BUS, drawingShadows );
1325  }
1326 
1327  if( !( aText->IsVisible() || aText->IsForceVisible() ) )
1328  {
1330  color = getRenderColor( aText, LAYER_HIDDEN, drawingShadows );
1331  else
1332  return;
1333  }
1334 
1335  m_gal->SetIsFill( false );
1336  m_gal->SetIsStroke( true );
1337  m_gal->SetLineWidth( getTextThickness( aText, drawingShadows ) );
1339  m_gal->SetTextAttributes( aText );
1340  m_gal->SetFontUnderlined( false );
1341 
1342  VECTOR2D text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset( &m_schSettings );
1343  wxString shownText( aText->GetShownText() );
1344 
1345  if( drawingShadows )
1346  {
1348  {
1349  EDA_RECT bBox = aText->GetBoundingBox();
1350 
1351  m_gal->SetIsFill( true );
1352  m_gal->SetFillColor( color );
1353  m_gal->SetLineWidth( m_gal->GetLineWidth() * 0.5 );
1354  bBox.RevertYAxis();
1355 
1356  m_gal->DrawRectangle( mapCoords( bBox.GetPosition() ), mapCoords( bBox.GetEnd() ) );
1357  return;
1358  }
1359 
1360  switch( aText->GetLabelSpinStyle() )
1361  {
1362  case LABEL_SPIN_STYLE::LEFT: text_offset.x += getShadowWidth() / 2; break;
1363  case LABEL_SPIN_STYLE::UP: text_offset.y += getShadowWidth() / 2; break;
1364  case LABEL_SPIN_STYLE::RIGHT: text_offset.x -= getShadowWidth() / 2; break;
1365  case LABEL_SPIN_STYLE::BOTTOM: text_offset.y -= getShadowWidth() / 2; break;
1366  }
1367  }
1368 
1369  if( !shownText.IsEmpty() )
1370  {
1371  strokeText( shownText, text_offset, aText->GetTextAngleRadians() );
1372  }
1373 
1374  if( aText->IsDangling() )
1375  {
1376  drawDanglingSymbol( aText->GetTextPos(), Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
1377  drawingShadows );
1378  }
1379 
1380 }
bool IsDangling() const override
Definition: sch_text.h:284
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
SCHEMATIC * m_schematic
Definition: sch_painter.h:201
float GetLineWidth() const
Get the line width.
void drawDanglingSymbol(const wxPoint &aPos, int aWidth, bool aDrawingShadows)
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsSelected() const
Definition: eda_item.h:173
virtual void SetTextAttributes(const EDA_TEXT *aText)
Loads attributes of the given text (bold/italic/underline/mirrored and so on).
bool IsVisible() const
Definition: eda_text.h:193
int color
Definition: DXF_plotter.cpp:60
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:203
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:176
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.
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:131
const wxPoint GetEnd() const
Definition: eda_rect.h:108
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
#define DANGLING_SYMBOL_SIZE
const wxPoint GetPosition() const
Definition: eda_rect.h:107
void strokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:215
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_text.cpp:463
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:508
double GetTextAngleRadians() const
Definition: eda_text.h:184
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsForceVisible() const
Definition: eda_item.h:256
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:254
bool IsBus() const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

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_TEXT::IsDangling(), EDA_ITEM::IsForceVisible(), EDA_ITEM::IsSelected(), EDA_TEXT::IsVisible(), LAYER_BUS, 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() [14/21]

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

Definition at line 1626 of file sch_painter.cpp.

1627 {
1628  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1629 
1630  if( drawingShadows && !aLabel->IsSelected() )
1631  return;
1632 
1633  COLOR4D color = getRenderColor( aLabel, LAYER_SHEETLABEL, drawingShadows );
1634 
1635  if( m_schematic )
1636  {
1637  SCH_CONNECTION* conn = aLabel->Connection();
1638 
1639  if( conn && conn->IsBus() )
1640  color = getRenderColor( aLabel, LAYER_BUS, drawingShadows );
1641  }
1642 
1643  std::vector<wxPoint> pts;
1644  std::deque<VECTOR2D> pts2;
1645 
1646  aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
1647 
1648  for( auto p : pts )
1649  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1650 
1651  m_gal->SetIsFill( true );
1653  m_gal->SetIsStroke( true );
1654  m_gal->SetLineWidth( getTextThickness( aLabel, drawingShadows ) );
1656  m_gal->DrawPolyline( pts2 );
1657 
1658  draw( static_cast<const SCH_TEXT*>( aLabel ), aLayer );
1659 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
void draw(const LIB_RECTANGLE *aRect, int aLayer)
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
SCHEMATIC * m_schematic
Definition: sch_painter.h:201
bool IsSelected() const
Definition: eda_item.h:173
int color
Definition: DXF_plotter.cpp:60
float getTextThickness(const SCH_TEXT *aItem, bool aDrawingShadows) const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
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:131
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
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:1460
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:254
bool IsBus() const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References color, SCH_ITEM::Connection(), SCH_HIERLABEL::CreateGraphicShape(), draw(), KIGFX::GAL::DrawPolyline(), KIGFX::RENDER_SETTINGS::GetLayerColor(), getRenderColor(), EDA_TEXT::GetTextPos(), getTextThickness(), SCH_CONNECTION::IsBus(), EDA_ITEM::IsSelected(), LAYER_BUS, LAYER_SCHEMATIC_BACKGROUND, LAYER_SELECTION_SHADOWS, LAYER_SHEETLABEL, 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() [15/21]

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

Definition at line 1588 of file sch_painter.cpp.

1589 {
1590  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1591 
1592  if( !drawingShadows || aLabel->IsSelected() )
1593  {
1594  COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows );
1595 
1596  std::vector<wxPoint> pts;
1597  std::deque<VECTOR2D> pts2;
1598 
1599  aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
1600 
1601  for( const wxPoint& p : pts )
1602  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1603 
1604  // The text is drawn inside the graphic shape.
1605  // On Cairo the graphic shape is filled by the background before drawing the text.
1606  // However if the text is selected, it is draw twice: first on LAYER_SELECTION_SHADOWS
1607  // and second on the text layer. The second must not erase the first drawing.
1608  bool fillBg = ( aLayer == LAYER_SELECTION_SHADOWS ) || !aLabel->IsSelected();
1609  m_gal->SetIsFill( fillBg );
1611  m_gal->SetIsStroke( true );
1612  m_gal->SetLineWidth( getTextThickness( aLabel, drawingShadows ) );
1614  m_gal->DrawPolyline( pts2 );
1615 
1616  draw( static_cast<SCH_TEXT*>( aLabel ), aLayer );
1617  }
1618 
1619  if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children || !aLabel->IsSelected() )
1620  {
1621  draw( aLabel->GetIntersheetRefs(), aLayer );
1622  }
1623 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
void draw(const LIB_RECTANGLE *aRect, int aLayer)
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
bool IsSelected() const
Definition: eda_item.h:173
int color
Definition: DXF_plotter.cpp:60
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:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
SCH_FIELD * GetIntersheetRefs()
Definition: sch_text.h:459
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:1231
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows) const
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

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_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() [16/21]

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

Definition at line 1662 of file sch_painter.cpp.

1663 {
1664  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1665 
1666  if( aLayer == LAYER_HIERLABEL || aLayer == LAYER_SELECTION_SHADOWS )
1667  {
1668  for( SCH_SHEET_PIN* sheetPin : aSheet->GetPins() )
1669  {
1670  if( drawingShadows && !aSheet->IsSelected() && !sheetPin->IsSelected() )
1671  continue;
1672 
1673  if( drawingShadows && aSheet->IsSelected()
1675  {
1676  break;
1677  }
1678 
1679  int width = std::max( aSheet->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
1680  wxPoint initial_pos = sheetPin->GetTextPos();
1681  wxPoint offset_pos = initial_pos;
1682 
1683  // For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2
1684  switch( sheetPin->GetEdge() )
1685  {
1686  case SHEET_TOP_SIDE: offset_pos.y += KiROUND( width / 2.0 ); break;
1687  case SHEET_BOTTOM_SIDE: offset_pos.y -= KiROUND( width / 2.0 ); break;
1688  case SHEET_RIGHT_SIDE: offset_pos.x -= KiROUND( width / 2.0 ); break;
1689  case SHEET_LEFT_SIDE: offset_pos.x += KiROUND( width / 2.0 ); break;
1690  default: break;
1691  }
1692 
1693  sheetPin->SetTextPos( offset_pos );
1694  draw( static_cast<SCH_HIERLABEL*>( sheetPin ), aLayer );
1695  m_gal->DrawLine( offset_pos, initial_pos );
1696  sheetPin->SetTextPos( initial_pos );
1697  }
1698  }
1699 
1700  VECTOR2D pos = aSheet->GetPosition();
1701  VECTOR2D size = aSheet->GetSize();
1702 
1703  if( aLayer == LAYER_SHEET_BACKGROUND )
1704  {
1706  m_gal->SetIsFill( true );
1707  m_gal->SetIsStroke( false );
1708 
1709  m_gal->DrawRectangle( pos, pos + size );
1710  }
1711 
1712  if( aLayer == LAYER_SHEET || aLayer == LAYER_SELECTION_SHADOWS )
1713  {
1714  m_gal->SetStrokeColor( getRenderColor( aSheet, LAYER_SHEET, drawingShadows ) );
1715  m_gal->SetIsStroke( true );
1716  m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
1717  m_gal->SetIsFill( false );
1718 
1719  m_gal->DrawRectangle( pos, pos + size );
1720 
1721  if( drawingShadows && !eeconfig()->m_Selection.draw_selected_children && aSheet->IsSelected() )
1722  return;
1723 
1724  for( const SCH_FIELD& field : aSheet->GetFields() )
1725  draw( &field, aLayer );
1726  }
1727 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
void draw(const LIB_RECTANGLE *aRect, int aLayer)
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsSelected() const
Definition: eda_item.h:173
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:88
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
int GetPenWidth() const override
Definition: sch_sheet.cpp:509
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
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:184
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
wxSize GetSize() const
Definition: sch_sheet.h:105
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:68
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:199

References 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, KIGFX::PAINTER::m_gal, m_schSettings, EESCHEMA_SETTINGS::m_Selection, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), SHEET_BOTTOM_SIDE, SHEET_LEFT_SIDE, SHEET_RIGHT_SIDE, and SHEET_TOP_SIDE.

◆ draw() [17/21]

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

Definition at line 1730 of file sch_painter.cpp.

1731 {
1732  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1733 
1734  if( drawingShadows && !aNC->IsSelected() )
1735  return;
1736 
1737  m_gal->SetIsStroke( true );
1738  m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
1739  m_gal->SetStrokeColor( getRenderColor( aNC, LAYER_NOCONNECT, drawingShadows ) );
1740  m_gal->SetIsFill( false );
1741 
1742  VECTOR2D p = aNC->GetPosition();
1743  int delta = std::max( aNC->GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
1744 
1745  m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
1746  m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );
1747 }
bool IsSelected() const
Definition: eda_item.h:173
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:622
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
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:199

References 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() [18/21]

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

Definition at line 1838 of file sch_painter.cpp.

1839 {
1840  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1841 
1842  if( drawingShadows && !aMarker->IsSelected() )
1843  return;
1844 
1845  COLOR4D color = getRenderColor( aMarker, aMarker->GetColorLayer(), drawingShadows );
1846 
1847  m_gal->Save();
1848  m_gal->Translate( aMarker->GetPosition() );
1849  m_gal->SetIsFill( !drawingShadows );
1850  m_gal->SetFillColor( color );
1851  m_gal->SetIsStroke( drawingShadows );
1852  m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
1854 
1855  SHAPE_LINE_CHAIN polygon;
1856  aMarker->ShapeToPolygon( polygon );
1857 
1858  m_gal->DrawPolygon( polygon );
1859  m_gal->Restore();
1860 }
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:173
wxPoint GetPosition() const override
Definition: sch_marker.h:101
int color
Definition: DXF_plotter.cpp:60
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.
SHAPE_LINE_CHAIN.
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:98

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() [19/21]

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

Definition at line 1793 of file sch_painter.cpp.

1794 {
1795  m_gal->Save();
1796  m_gal->Translate( aBitmap->GetPosition() );
1797 
1798  // When the image scale factor is not 1.0, we need to modify the actual as the image scale
1799  // factor is similar to a local zoom
1800  double img_scale = aBitmap->GetImageScale();
1801 
1802  if( img_scale != 1.0 )
1803  m_gal->Scale( VECTOR2D( img_scale, img_scale ) );
1804 
1805  if( aLayer == LAYER_DRAW_BITMAPS )
1806  {
1807  m_gal->DrawBitmap( *aBitmap->GetImage() );
1808  }
1809 
1810  if( aLayer == LAYER_SELECTION_SHADOWS )
1811  {
1812  if( aBitmap->IsSelected() || aBitmap->IsBrightened() )
1813  {
1814  COLOR4D color = getRenderColor( aBitmap, LAYER_DRAW_BITMAPS, true );
1815  m_gal->SetIsStroke( true );
1818  m_gal->SetIsFill( false );
1819 
1820  // Draws a bounding box.
1821  VECTOR2D bm_size( aBitmap->GetSize() );
1822  // bm_size is the actual image size in UI.
1823  // but m_gal scale was previously set to img_scale
1824  // so recalculate size relative to this image size.
1825  bm_size.x /= img_scale;
1826  bm_size.y /= img_scale;
1827  VECTOR2D origin( -bm_size.x / 2.0, -bm_size.y / 2.0 );
1828  VECTOR2D end = origin + bm_size;
1829 
1830  m_gal->DrawRectangle( origin, end );
1831  }
1832  }
1833 
1834  m_gal->Restore();
1835 }
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsSelected() const
Definition: eda_item.h:173
to handle and draw images bitmaps
int color
Definition: DXF_plotter.cpp:60
virtual void DrawBitmap(const BITMAP_BASE &aBitmap)
Draw a bitmap image.
bool IsBrightened() const
Definition: eda_item.h:176
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:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
BITMAP_BASE * GetImage() const
Definition: sch_bitmap.h:54
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:98

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() [20/21]

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

Definition at line 1222 of file sch_painter.cpp.

1223 {
1224  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1225 
1226  if( drawingShadows && !aLine->IsSelected() )
1227  return;
1228 
1229  COLOR4D color = getRenderColor( aLine, aLine->GetLayer(), drawingShadows );
1230  float width = getLineWidth( aLine, drawingShadows );
1231  PLOT_DASH_TYPE lineStyle = aLine->GetEffectiveLineStyle();
1232 
1233  m_gal->SetIsStroke( true );
1235  m_gal->SetLineWidth( width );
1236 
1237  if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
1238  {
1239  m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() );
1240  }
1241  else
1242  {
1243  VECTOR2D start = aLine->GetStartPoint();
1244  VECTOR2D end = aLine->GetEndPoint();
1245 
1246  EDA_RECT clip( (wxPoint)start, wxSize( end.x - start.x, end.y - start.y ) );
1247  clip.Normalize();
1248 
1249  double theta = atan2( end.y - start.y, end.x - start.x );
1250  double strokes[] = { 1.0, DASH_GAP_LEN( width ), 1.0, DASH_GAP_LEN( width ) };
1251 
1252  switch( lineStyle )
1253  {
1254  default:
1255  case PLOT_DASH_TYPE::DASH:
1256  strokes[0] = strokes[2] = DASH_MARK_LEN( width );
1257  break;
1258  case PLOT_DASH_TYPE::DOT:
1259  strokes[0] = strokes[2] = DOT_MARK_LEN( width );
1260  break;
1262  strokes[0] = DASH_MARK_LEN( width );
1263  strokes[2] = DOT_MARK_LEN( width );
1264  break;
1265  }
1266 
1267  for( size_t i = 0; i < 10000; ++i )
1268  {
1269  // Calculations MUST be done in doubles to keep from accumulating rounding
1270  // errors as we go.
1271  VECTOR2D next( start.x + strokes[ i % 4 ] * cos( theta ),
1272  start.y + strokes[ i % 4 ] * sin( theta ) );
1273 
1274  // Drawing each segment can be done rounded to ints.
1275  wxPoint segStart( KiROUND( start.x ), KiROUND( start.y ) );
1276  wxPoint segEnd( KiROUND( next.x ), KiROUND( next.y ) );
1277 
1278  if( ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
1279  break;
1280  else if( i % 2 == 0 )
1281  m_gal->DrawLine( segStart, segEnd );
1282 
1283  start = next;
1284  }
1285  }
1286 
1287  if( aLine->IsStartDangling() && aLine->IsWire() )
1288  {
1289  drawDanglingSymbol( aLine->GetStartPoint(), getLineWidth( aLine, drawingShadows ),
1290  drawingShadows );
1291  }
1292 
1293  if( aLine->IsEndDangling() && aLine->IsWire() )
1294  {
1295  drawDanglingSymbol( aLine->GetEndPoint(), getLineWidth( aLine, drawingShadows ),
1296  drawingShadows );
1297  }
1298 }
CITER next(CITER it)
Definition: ptree.cpp:126
void drawDanglingSymbol(const wxPoint &aPos, int aWidth, bool aDrawingShadows)
wxPoint GetStartPoint() const
Definition: sch_line.h:90
bool IsWire() const
Return true if the line is a wire.
Definition: sch_line.cpp:922
bool IsSelected() const
Definition: eda_item.h:173
int color
Definition: DXF_plotter.cpp:60
#define DASH_MARK_LEN(aLineWidth)
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.
bool IsEndDangling() const
Definition: sch_line.h:200
#define DOT_MARK_LEN(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:272
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
PLOT_DASH_TYPE GetEffectiveLineStyle() const
Definition: sch_line.cpp:257
bool IsStartDangling() const
Definition: sch_line.h:199
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:68
#define DASH_GAP_LEN(aLineWidth)
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:98
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_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() [21/21]

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

Definition at line 1750 of file sch_painter.cpp.

1751 {
1752  SCH_LINE line;
1753  bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
1754 
1755  if( drawingShadows && !aEntry->IsSelected() )
1756  return;
1757 
1758  line.SetLayer( aEntry->Type() == SCH_BUS_WIRE_ENTRY_T ? LAYER_WIRE : LAYER_BUS );
1759 
1760  if( aEntry->IsSelected() )
1761  line.SetSelected();
1762  else if( aEntry->IsBrightened() )
1763  line.SetBrightened();
1764 
1765  line.SetStartPoint( aEntry->GetPosition() );
1766  line.SetEndPoint( aEntry->GetEnd() );
1767  line.SetStroke( aEntry->GetStroke() );
1768 
1769  COLOR4D color = getRenderColor( aEntry, LAYER_WIRE, drawingShadows );
1770 
1771  if( aEntry->Type() == SCH_BUS_BUS_ENTRY_T )
1772  color = getRenderColor( aEntry, LAYER_BUS, drawingShadows );
1773 
1774  line.SetLineColor( color );
1775  line.SetLineStyle( aEntry->GetStrokeStyle() );
1776 
1777  draw( &line, aLayer );
1778 
1779  m_gal->SetIsFill( false );
1780  m_gal->SetIsStroke( true );
1781  m_gal->SetLineWidth( drawingShadows ? getShadowWidth() : 1.0F );
1782 
1783  if( aEntry->IsDanglingStart() )
1784  m_gal->DrawCircle( aEntry->GetPosition(),
1785  aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) );
1786 
1787  if( aEntry->IsDanglingEnd() )
1788  m_gal->DrawCircle( aEntry->GetEnd(),
1789  aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) );
1790 }
void draw(const LIB_RECTANGLE *aRect, int aLayer)
#define TARGET_BUSENTRY_RADIUS
Definition: sch_bus_entry.h:36
bool IsSelected() const
Definition: eda_item.h:173
virtual STROKE_PARAMS GetStroke() const override
Definition: sch_bus_entry.h:69
int color
Definition: DXF_plotter.cpp:60
void SetBrightened()
Definition: eda_item.h:180
bool IsBrightened() const
Definition: eda_item.h:176
float getShadowWidth() const
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.
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:94
PLOT_DASH_TYPE GetStrokeStyle() const
void SetLineStyle(const PLOT_DASH_TYPE aStyle)
Definition: sch_line.cpp:239
bool IsDanglingStart() const
Definition: sch_bus_entry.h:47
void SetSelected()
Definition: eda_item.h:179
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:91
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
Definition: sch_item.h:279
#define F(x, y, z)
Definition: md5_hash.cpp:15
void SetLineColor(const COLOR4D &aColor)
Definition: sch_line.cpp:189
virtual int GetPenWidth() const
Definition: sch_item.h:289
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: sch_line.h:125
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
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
wxPoint GetEnd() const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98
wxPoint GetPosition() const override

References color, draw(), KIGFX::GAL::DrawCircle(), F, SCH_BUS_ENTRY_BASE::GetEnd(), SCH_ITEM::GetPenWidth(), SCH_BUS_ENTRY_BASE::GetPosition(), getRenderColor(), getShadowWidth(), 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_SELECTION_SHADOWS, LAYER_WIRE, KIGFX::PAINTER::m_gal, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, EDA_ITEM::SetBrightened(), SCH_LINE::SetEndPoint(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), SCH_ITEM::SetLayer(), SCH_LINE::SetLineColor(), SCH_LINE::SetLineStyle(), KIGFX::GAL::SetLineWidth(), EDA_ITEM::SetSelected(), SCH_LINE::SetStartPoint(), SCH_LINE::SetStroke(), TARGET_BUSENTRY_RADIUS, and EDA_ITEM::Type().

◆ drawDanglingSymbol()

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

Definition at line 1185 of file sch_painter.cpp.

1186 {
1187  wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
1188  aWidth + Mils2iu( DANGLING_SYMBOL_SIZE /2 ) );
1189 
1190  m_gal->SetIsStroke( true );
1191  m_gal->SetIsFill( false );
1192  m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth()
1194 
1195  m_gal->DrawRectangle( aPos - radius, aPos + radius );
1196 }
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.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
#define DANGLING_SYMBOL_SIZE
float GetDanglineSymbolThickness() const
Definition: sch_painter.h:99
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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

Referenced by draw().

◆ drawPinDanglingSymbol()

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

Definition at line 747 of file sch_painter.cpp.

748 {
749  m_gal->SetIsFill( false );
750  m_gal->SetIsStroke( true );
751  m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth()
753 
755 }
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.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
float GetDanglineSymbolThickness() const
Definition: sch_painter.h:99
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:38
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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

Referenced by draw().

◆ externalPinDecoSize()

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

Definition at line 737 of file sch_painter.cpp.

738 {
741 
742  return aPin.GetNumberTextSize() / 2;
743 }
int GetNumberTextSize() const
Definition: lib_pin.h:129
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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

Referenced by draw().

◆ fillIfSelection()

void KIGFX::SCH_PAINTER::fillIfSelection ( int  aLayer)
private

Definition at line 514 of file sch_painter.cpp.

515 {
516  if( aLayer == LAYER_SELECTION_SHADOWS && eeconfig()->m_Selection.fill_shapes )
517  m_gal->SetIsFill( true );
518 }
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 SetIsFill(bool aIsFillEnabled)
Enable/disable fill.

References KIGFX::eeconfig(), LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, and KIGFX::GAL::SetIsFill().

Referenced by draw().

◆ getLineWidth() [1/2]

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

Definition at line 339 of file sch_painter.cpp.

340 {
341  float width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
342 
343  if( aItem->IsSelected() && aDrawingShadows )
344  width += getShadowWidth();
345 
346  return width;
347 }
virtual int GetPenWidth() const =0
bool IsSelected() const
Definition: eda_item.h:173
float getShadowWidth() const
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), LIB_ITEM::GetPenWidth(), 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 350 of file sch_painter.cpp.

351 {
352  wxCHECK( aItem, static_cast<float>( m_schSettings.m_DefaultWireThickness ) );
353 
354  float width = (float) aItem->GetPenWidth();
355 
356  if( aItem->IsSelected() && aDrawingShadows )
357  width += getShadowWidth();
358 
359  return std::max( width, 1.0f );
360 }
bool IsSelected() const
Definition: eda_item.h:173
float getShadowWidth() const
virtual int GetPenWidth() const
Definition: sch_item.h:289
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

References SCH_ITEM::GetPenWidth(), getShadowWidth(), EDA_ITEM::IsSelected(), KIGFX::SCH_RENDER_SETTINGS::m_DefaultWireThickness, and m_schSettings.

◆ getRenderColor()

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

Definition at line 276 of file sch_painter.cpp.

277 {
279 
280  if( aItem->Type() == SCH_LINE_T )
281  {
282  COLOR4D lineColor = static_cast<const SCH_LINE*>( aItem )->GetLineColor();
283 
284  if( lineColor != COLOR4D::UNSPECIFIED )
285  color = lineColor;
286  }
287  else if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
288  {
289  COLOR4D busEntryColor = static_cast<const SCH_BUS_WIRE_ENTRY*>( aItem )->GetStrokeColor();
290 
291  if( busEntryColor != COLOR4D::UNSPECIFIED )
292  color = busEntryColor;
293  }
294  else if( aItem->Type() == SCH_JUNCTION_T )
295  {
296  COLOR4D junctionColor = static_cast<const SCH_JUNCTION*>( aItem )->GetJunctionColor();
297 
298  if( junctionColor != COLOR4D::UNSPECIFIED )
299  color = junctionColor;
300  }
301  else if( aItem->Type() == SCH_SHEET_T )
302  {
303  SCH_SHEET* sheet = (SCH_SHEET*) aItem;
304 
306  color = m_schSettings.GetLayerColor( aLayer );
307  else if( aLayer == LAYER_SHEET )
308  color = sheet->GetBorderColor();
309  else if( aLayer == LAYER_SHEET_BACKGROUND )
310  color = sheet->GetBackgroundColor();
311 
312  if( color == COLOR4D::UNSPECIFIED )
313  color = m_schSettings.GetLayerColor( aLayer );
314  }
315 
316  if( aItem->IsBrightened() && !aDrawingShadows ) // Selection disambiguation, etc.
317  {
319 
320  if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND )
321  color = color.WithAlpha( 0.2 );
322  }
323  else if( aItem->IsSelected() )
324  {
325  if( aDrawingShadows )
327  }
328 
330  || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() != LIB_FIELD_T ) )
331  {
332  color = color.Darken( 0.5f );
333  }
334 
335  return color;
336 }
bool IsSelected() const
Definition: eda_item.h:173
int color
Definition: DXF_plotter.cpp:60
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
KIGFX::COLOR4D GetBorderColor() const
Definition: sch_sheet.h:111
bool IsBrightened() const
Definition: eda_item.h:176
KIGFX::COLOR4D GetBackgroundColor() const
Definition: sch_sheet.h:114
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:364
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

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 142 of file sch_painter.h.

143  {
144  return &m_schSettings;
145  }
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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 266 of file sch_painter.cpp.

267 {
268  const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
269 
270  // For best visuals the selection width must be a cross between the zoom level and the
271  // default line width.
272  return (float) std::fabs( matrix.GetScale().x * 2.75 ) + Mils2iu( eeconfig()->m_Selection.thickness );
273 }
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:269
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 363 of file sch_painter.cpp.

364 {
365  float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
366 
367  if( aItem->IsSelected() && aDrawingShadows )
368  width += getShadowWidth();
369 
370  return width;
371 }
bool IsSelected() const
Definition: eda_item.h:173
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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 374 of file sch_painter.cpp.

375 {
376  float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
377 
378  if( aItem->IsSelected() && aDrawingShadows )
379  width += getShadowWidth();
380 
381  return width;
382 }
bool IsSelected() const
Definition: eda_item.h:173
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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 385 of file sch_painter.cpp.

386 {
387  float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
389 
390  if( aItem->IsSelected() && aDrawingShadows )
391  width += getShadowWidth();
392 
393  return width;
394 }
bool IsSelected() const
Definition: eda_item.h:173
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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 397 of file sch_painter.cpp.

398 {
399  float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
401 
402  if( aItem->IsSelected() && aDrawingShadows )
403  width += getShadowWidth();
404 
405  return width;
406 }
bool IsSelected() const
Definition: eda_item.h:173
float getShadowWidth() const
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
int GetDefaultPenWidth() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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 726 of file sch_painter.cpp.

727 {
730 
731  return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
732 }
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:199

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 246 of file sch_painter.cpp.

247 {
248  if( m_schSettings.m_ShowUnit // showing a specific unit
249  && aItem->GetUnit() // item is unit-specific
250  && aItem->GetUnit() != m_schSettings.m_ShowUnit )
251  {
252  return false;
253  }
254 
255  if( m_schSettings.m_ShowConvert // showing a specific conversion
256  && aItem->GetConvert() // item is conversion-specific
257  && aItem->GetConvert() != m_schSettings.m_ShowConvert )
258  {
259  return false;
260  }
261 
262  return true;
263 }
int GetUnit() const
Definition: lib_item.h:260
int GetConvert() const
Definition: lib_item.h:263
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:199

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 461 of file sch_painter.cpp.

462 {
463  switch( aLayer )
464  {
466  if( aItem->IsSelected() )
467  {
468  m_gal->SetIsFill( false );
469  m_gal->SetIsStroke( true );
470  m_gal->SetLineWidth( getLineWidth( aItem, true ) );
471  m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, true ) );
472  m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, true ) );
473  return true;
474  }
475 
476  return false;
477 
480  {
481  COLOR4D fillColor = getRenderColor( aItem, LAYER_DEVICE_BACKGROUND, false );
482 
484  m_gal->SetFillColor( fillColor );
485  m_gal->SetIsStroke( false );
486  return true;
487  }
488 
489  return false;
490 
491  case LAYER_DEVICE:
493  m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
494 
495  if( aItem->GetPenWidth() > 0 || aItem->GetFillMode() == FILL_TYPE::NO_FILL )
496  {
497  m_gal->SetIsStroke( true );
498  m_gal->SetLineWidth( getLineWidth( aItem, false ) );
499  m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
500  }
501  else
502  {
503  m_gal->SetIsStroke( false );
504  }
505 
506  return true;
507 
508  default:
509  return false;
510  }
511 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual int GetPenWidth() const =0
bool IsSelected() const
Definition: eda_item.h:173
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.
FILL_TYPE GetFillMode() const
Definition: lib_item.h:266
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.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR, LIB_ITEM::GetFillMode(), getLineWidth(), LIB_ITEM::GetPenWidth(), getRenderColor(), EDA_ITEM::IsSelected(), LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, LAYER_SELECTION_SHADOWS, KIGFX::PAINTER::m_gal, NO_FILL, 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 147 of file sch_painter.h.

148  {
149  m_schematic = aSchematic;
150  }
SCHEMATIC * m_schematic
Definition: sch_painter.h:201

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, aPosition, 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
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, and KIGFX::GAL::StrokeText().

Referenced by draw().

◆ triLine()

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

Definition at line 454 of file sch_painter.cpp.

455 {
456  m_gal->DrawLine( a, b );
457  m_gal->DrawLine( b, c );
458 }
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 201 of file sch_painter.h.

Referenced by draw(), and SetSchematic().

◆ m_schSettings


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