KiCad PCB EDA Suite
KIGFX::SCH_PAINTER Class Reference

Class SCH_PAINTER 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
 Function Draw Takes an instance of VIEW_ITEM and passes it to a function that know how to draw the item. More...
 
virtual void ApplySettings (const RENDER_SETTINGS *aSettings) override
 Function ApplySettings Loads colors and display modes settings that are going to be used when drawing items. More...
 
virtual SCH_RENDER_SETTINGSGetSettings () override
 Function GetSettings Returns pointer to current settings that are going to be used when drawing items. More...
 
void SetGAL (GAL *aGal)
 Function SetGAL 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...
 
COLOR4D m_brightenedColor
 Color of brightened item frame. More...
 

Private Member Functions

void draw (LIB_RECTANGLE *, int)
 
void draw (LIB_PIN *, int, bool isDangling=true, bool isMoving=false)
 
void draw (LIB_CIRCLE *, int)
 
void draw (LIB_ITEM *, int)
 
void draw (LIB_PART *, int, bool aDrawFields=true, int aUnit=0, int aConvert=0, std::vector< bool > *danglingPinFlags=nullptr)
 
void draw (LIB_ALIAS *, int)
 
void draw (LIB_ARC *, int)
 
void draw (LIB_POLYLINE *, int)
 
void draw (LIB_FIELD *, int)
 
void draw (LIB_TEXT *, int)
 
void draw (SCH_COMPONENT *, int)
 
void draw (SCH_JUNCTION *, int)
 
void draw (SCH_FIELD *, int)
 
void draw (SCH_TEXT *, int)
 
void draw (SCH_LABEL *, int)
 
void draw (SCH_HIERLABEL *, int)
 
void draw (SCH_GLOBALLABEL *, int)
 
void draw (SCH_SHEET *, int)
 
void draw (SCH_SHEET_PIN *, int)
 
void draw (SCH_NO_CONNECT *, int)
 
void draw (SCH_MARKER *, int)
 
void draw (SCH_BITMAP *, int)
 
void draw (SCH_LINE *, int)
 
void draw (SCH_BUS_ENTRY_BASE *aEntry, int aLayer)
 
bool isUnitAndConversionShown (const LIB_ITEM *aItem)
 
bool setColors (const LIB_ITEM *aItem, int aLayer)
 
void triLine (const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
 

Private Attributes

SCH_RENDER_SETTINGS m_schSettings
 

Detailed Description

Class SCH_PAINTER Contains methods for drawing schematic-specific items.

Definition at line 112 of file sch_painter.h.

Constructor & Destructor Documentation

KIGFX::SCH_PAINTER::SCH_PAINTER ( GAL aGal)

Definition at line 151 of file sch_painter.cpp.

151  :
152  KIGFX::PAINTER (aGal)
153 { }
Class PAINTER contains all the knowledge about how to draw graphical object onto any particular outpu...
Definition: painter.h:308

Member Function Documentation

virtual void KIGFX::SCH_PAINTER::ApplySettings ( const RENDER_SETTINGS aSettings)
inlineoverridevirtual

Function ApplySettings Loads colors and display modes settings that are going to be used when drawing items.

Parameters
aSettingsare settings to be applied.

Implements KIGFX::PAINTER.

Definition at line 121 of file sch_painter.h.

122  {
123  m_schSettings = *static_cast<const SCH_RENDER_SETTINGS*>( aSettings );
124  }
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
bool KIGFX::SCH_PAINTER::Draw ( const VIEW_ITEM aItem,
int  aLayer 
)
overridevirtual

Function Draw Takes an instance of VIEW_ITEM and passes it to a function that know 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 160 of file sch_painter.cpp.

References HANDLE_ITEM, KIGFX::SCH_RENDER_SETTINGS::ImportLegacyColors(), LIB_ALIAS_T, LIB_ARC_T, LIB_CIRCLE_T, LIB_FIELD_T, LIB_PART_T, LIB_PIN_T, LIB_POLYLINE_T, LIB_RECTANGLE_T, LIB_TEXT_T, m_schSettings, SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_COMPONENT_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIERARCHICAL_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, and SCH_TEXT_T.

Referenced by draw().

161 {
162  auto item2 = static_cast<const EDA_ITEM*>( aItem );
163  auto item = const_cast<EDA_ITEM*>( item2 );
164 
166 
167  switch( item->Type() )
168  {
193 
194  default: return false;
195  }
196 
197  return false;
198 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
Part library alias object definition.
Define a symbol library graphical text item.
Definition: lib_text.h:44
Field object used in symbol libraries.
Definition: lib_field.h:59
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:41
Define a library symbol object.
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
Segment description base class to describe items which have 2 end points (track, wire, draw line ...)
Definition: sch_line.h:41
#define HANDLE_ITEM(type_id, type_name)
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings) override
Function ImportLegacyColors Loads a list of color settings for layers.
Definition: sch_painter.cpp:74
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
void KIGFX::SCH_PAINTER::draw ( LIB_RECTANGLE aRect,
int  aLayer 
)
private

Definition at line 322 of file sch_painter.cpp.

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

Referenced by draw().

323 {
324  if( !isUnitAndConversionShown( aRect ) )
325  return;
326 
327  if( setColors( aRect, aLayer ) )
328  m_gal->DrawRectangle( mapCoords( aRect->GetPosition() ), mapCoords( aRect->GetEnd() ) );
329 
330 }
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool setColors(const LIB_ITEM *aItem, int aLayer)
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
wxPoint GetEnd() const
static VECTOR2D mapCoords(const wxPoint &aCoord)
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_rectangle.h:91
void KIGFX::SCH_PAINTER::draw ( LIB_PIN aPin,
int  aLayer,
bool  isDangling = true,
bool  isMoving = false 
)
private

Definition at line 490 of file sch_painter.cpp.

References Clamp_Text_PenSize(), color, KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawLine(), KIGFX::drawPinDanglingSymbol(), KIGFX::ExternalPinDecoSize(), GetDefaultLineThickness(), LIB_PIN::GetElectricalTypeName(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LIB_PIN::GetLength(), LIB_PIN::GetName(), LIB_PIN::GetNameTextSize(), LIB_PIN::GetNumber(), LIB_PIN::GetNumberTextSize(), LIB_PIN::GetOrientation(), KIGFX::getOverlayColor(), LIB_ITEM::GetParent(), LIB_PIN::GetPenSize(), LIB_PART::GetPinNameOffset(), LIB_PIN::GetPosition(), 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, INSIDE, KIGFX::InternalPinDecoSize(), EDA_ITEM::IsMoving(), LIB_PIN::IsPowerConnection(), isUnitAndConversionShown(), LIB_PIN::IsVisible(), LAYER_DEVICE, LAYER_HIDDEN, LAYER_NOTES, LAYER_PIN, LAYER_PINNAM, LAYER_PINNUM, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenPins, KIGFX::SCH_RENDER_SETTINGS::m_ShowPinsElectricalType, KIGFX::mapCoords(), max, OUTSIDE, PIN_DOWN, PIN_LEFT, PIN_NC, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PINSHAPE_CLOCK, PINSHAPE_FALLING_EDGE_CLOCK, PINSHAPE_INPUT_LOW, PINSHAPE_INVERTED, PINSHAPE_NONLOGIC, PINSHAPE_OUTPUT_LOW, SET_DC, KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), LIB_PART::ShowPinNames(), LIB_PART::ShowPinNumbers(), KIGFX::GAL::StrokeText(), TARGET_PIN_RADIUS, triLine(), VECTOR2< T >::x, and VECTOR2< T >::y.

491 {
492  if( aLayer != LAYER_DEVICE )
493  return;
494 
495  if( !isUnitAndConversionShown( aPin ) )
496  return;
497 
498  if( aPin->IsMoving() )
499  isMoving = true;
500 
501  VECTOR2I pos = mapCoords( aPin->GetPosition() );
502 
504 
505  if( !aPin->IsVisible() )
506  {
508  {
510  }
511  else
512  {
513  if( isDangling && aPin->IsPowerConnection() )
514  drawPinDanglingSymbol( m_gal, pos, color );
515 
516  return;
517  }
518  }
519 
520  VECTOR2I p0, dir;
521  int len = aPin->GetLength();
522  int width = aPin->GetPenSize();
523  int shape = aPin->GetShape();
524  int orient = aPin->GetOrientation();
525 
526  switch( orient )
527  {
528  case PIN_UP:
529  p0 = VECTOR2I( pos.x, pos.y - len );
530  dir = VECTOR2I(0, 1);
531  break;
532  case PIN_DOWN:
533  p0 = VECTOR2I( pos.x, pos.y + len );
534  dir = VECTOR2I(0, -1);
535  break;
536  case PIN_LEFT:
537  p0 = VECTOR2I( pos.x - len, pos.y );
538  dir = VECTOR2I(1, 0);
539  break;
540  case PIN_RIGHT:
541  p0 = VECTOR2I( pos.x + len, pos.y );
542  dir = VECTOR2I(-1, 0);
543  break;
544  }
545 
546  VECTOR2D pc;
547 
548  m_gal->SetIsStroke( true );
549  m_gal->SetIsFill( false );
550  m_gal->SetLineWidth( width );
551  m_gal->SetStrokeColor( color );
552  m_gal->SetFontBold( false );
553  m_gal->SetFontItalic( false );
554 
555  const int radius = ExternalPinDecoSize( *aPin );
556  const int diam = radius*2;
557  const int clock_size = InternalPinDecoSize( *aPin );
558 
559  if( shape == PINSHAPE_INVERTED )
560  {
561  m_gal->DrawCircle( p0 + dir * radius, radius );
562  m_gal->DrawLine( p0 + dir * ( diam ), pos );
563  }
564  else if( shape == PINSHAPE_FALLING_EDGE_CLOCK )
565  {
566  pc = p0 + dir * clock_size ;
567 
568  triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
569  pc,
570  p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
571 
572  m_gal->DrawLine( pos, pc );
573  }
574  else
575  {
576  m_gal->DrawLine( p0, pos );
577  }
578 
579  if( shape == PINSHAPE_CLOCK )
580  {
581  if (!dir.y)
582  {
583  triLine( p0 + VECTOR2D( 0, clock_size ),
584  p0 + VECTOR2D( -dir.x * clock_size, 0 ),
585  p0 + VECTOR2D( 0, -clock_size ) );
586  }
587  else
588  {
589  triLine( p0 + VECTOR2D( clock_size, 0 ),
590  p0 + VECTOR2D( 0, -dir.y * clock_size ),
591  p0 + VECTOR2D( -clock_size, 0 ) );
592  }
593  }
594 
595  if( shape == PINSHAPE_INPUT_LOW )
596  {
597  if(!dir.y)
598  {
599  triLine( p0 + VECTOR2D(dir.x, 0) * diam,
600  p0 + VECTOR2D(dir.x, -1) * diam,
601  p0 );
602  }
603  else /* MapX1 = 0 */
604  {
605  triLine( p0 + VECTOR2D( 0, dir.y) * diam,
606  p0 + VECTOR2D(-1, dir.y) * diam,
607  p0 );
608  }
609  }
610 
611  if( shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
612  {
613  if( !dir.y ) // Horizontal pin
614  m_gal->DrawLine( p0 - VECTOR2D( 0, diam ), p0 + VECTOR2D( dir.x, 0 ) * diam );
615  else // Vertical pin
616  m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
617  }
618 
619  if( shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
620  {
621  m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,
622  p0 + VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius );
623  m_gal->DrawLine( p0 - VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius,
624  p0 + VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius );
625  }
626 
627  if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol
628  {
629  m_gal->DrawLine( pos + VECTOR2D( -1, -1 ) * TARGET_PIN_RADIUS,
630  pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
631  m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
632  pos + VECTOR2D( -1, 1 ) * TARGET_PIN_RADIUS );
633  }
634 
635  if( isDangling && ( aPin->IsVisible() || aPin->IsPowerConnection() ) )
636  drawPinDanglingSymbol( m_gal, pos, color );
637 
638  // Draw the labels
639 
640  LIB_PART* libEntry = aPin->GetParent();
641  int textOffset = libEntry->GetPinNameOffset();
642 
643  int nameLineWidth = aPin->GetPenSize();
644  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, aPin->GetNameTextSize(), false );
645  int numLineWidth = aPin->GetPenSize();
646  numLineWidth = Clamp_Text_PenSize( numLineWidth, aPin->GetNumberTextSize(), false );
647 
648  #define PIN_TEXT_MARGIN 4
649 
650  // Four locations around a pin where text can be drawn
651  enum { INSIDE = 0, OUTSIDE, ABOVE, BELOW };
652  int size[4] = { 0, 0, 0, 0 };
653  int thickness[4] = { numLineWidth, numLineWidth, numLineWidth, numLineWidth };
654  COLOR4D colour[4];
655  wxString text[4];
656 
657  // TextOffset > 0 means pin NAMES on inside, pin NUMBERS above and nothing below
658  if( textOffset )
659  {
660  size [INSIDE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
661  thickness[INSIDE] = nameLineWidth;
663  text [INSIDE] = aPin->GetName();
664 
665  size [ABOVE] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
666  thickness[ABOVE] = numLineWidth;
667  colour [ABOVE] = m_schSettings.GetLayerColor( LAYER_PINNUM );
668  text [ABOVE] = aPin->GetNumber();
669  }
670  // Otherwise pin NAMES go above and pin NUMBERS go below
671  else
672  {
673  size [ABOVE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
674  thickness[ABOVE] = nameLineWidth;
675  colour [ABOVE] = m_schSettings.GetLayerColor( LAYER_PINNAM );
676  text [ABOVE] = aPin->GetName();
677 
678  size [BELOW] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
679  thickness[BELOW] = numLineWidth;
680  colour [BELOW] = m_schSettings.GetLayerColor( LAYER_PINNUM );
681  text [BELOW] = aPin->GetNumber();
682  }
683 
685  {
686  size [OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, Millimeter2iu( 0.7 ) );
687  thickness[OUTSIDE] = size[OUTSIDE] / 6;
689  text [OUTSIDE] = aPin->GetElectricalTypeName();
690  }
691 
692  if( !aPin->IsVisible() )
693  {
694  for( COLOR4D& c : colour )
696  }
697  else if( isMoving )
698  {
699  for( COLOR4D& c : colour )
700  c = getOverlayColor( aPin, c, false );
701  }
702 
703  int insideOffset = textOffset;
704  int outsideOffset = 10;
705  int aboveOffset = PIN_TEXT_MARGIN + ( thickness[ABOVE] + GetDefaultLineThickness() ) / 2;
706  int belowOffset = PIN_TEXT_MARGIN + ( thickness[BELOW] + GetDefaultLineThickness() ) / 2;
707 
708  #define SET_DC( i ) \
709  m_gal->SetGlyphSize( VECTOR2D( size[i], size[i] ) ); \
710  m_gal->SetLineWidth( thickness[i] ); \
711  m_gal->SetStrokeColor( colour[i] );
712 
713  switch( orient )
714  {
715  case PIN_LEFT:
716  if( size[INSIDE] )
717  {
718  SET_DC( INSIDE );
721  m_gal->StrokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 );
722  }
723  if( size[OUTSIDE] )
724  {
725  SET_DC( OUTSIDE );
728  m_gal->StrokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 );
729  }
730  if( size[ABOVE] )
731  {
732  SET_DC( ABOVE );
735  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
736  }
737  if( size[BELOW] )
738  {
739  SET_DC( BELOW );
742  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
743  }
744  break;
745 
746  case PIN_RIGHT:
747  if( size[INSIDE] )
748  {
749  SET_DC( INSIDE );
753  m_gal->StrokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 );
754  }
755  if( size[OUTSIDE] )
756  {
757  SET_DC( OUTSIDE );
760  m_gal->StrokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 );
761  }
762  if( size[ABOVE] )
763  {
764  SET_DC( ABOVE );
767  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
768  }
769  if( size[BELOW] )
770  {
771  SET_DC( BELOW );
774  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
775  }
776  break;
777 
778  case PIN_DOWN:
779  if( size[INSIDE] )
780  {
781  SET_DC( INSIDE );
784  m_gal->StrokeText ( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2);
785  }
786  if( size[OUTSIDE] )
787  {
788  SET_DC( OUTSIDE );
791  m_gal->StrokeText ( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2);
792  }
793  if( size[ABOVE] )
794  {
795  SET_DC( ABOVE );
798  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
799  }
800  if( size[BELOW] )
801  {
802  SET_DC( BELOW );
805  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
806  }
807  break;
808 
809  case PIN_UP:
810  if( size[INSIDE] )
811  {
812  SET_DC( INSIDE );
815  m_gal->StrokeText ( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2);
816  }
817  if( size[OUTSIDE] )
818  {
819  SET_DC( OUTSIDE );
822  m_gal->StrokeText ( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2);
823  }
824  if( size[ABOVE] )
825  {
826  SET_DC( ABOVE );
829  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
830  }
831  if( size[BELOW] )
832  {
833  SET_DC( BELOW );
836  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
837  }
838  break;
839 
840  default:
841  wxFAIL_MSG( "Unknown pin orientation" );
842  }
843 }
void SetFontItalic(const bool aItalic)
Set italic property of current font.
bool IsMoving() const
Definition: base_struct.h:221
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
int GetPinNameOffset()
int color
Definition: DXF_plotter.cpp:62
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
static int InternalPinDecoSize(const LIB_PIN &aPin)
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:275
Definition: lib_pin.h:55
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
int GetNameTextSize() const
Definition: lib_pin.h:192
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
int GetOrientation() const
Definition: lib_pin.h:221
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
#define SET_DC(i)
int GetNumberTextSize() const
Definition: lib_pin.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
const wxString & GetNumber() const
Definition: lib_pin.h:194
virtual void SetLineWidth(float aLineWidth)
Set the line width.
const wxString & GetName() const
Definition: lib_pin.h:166
static int ExternalPinDecoSize(const LIB_PIN &aPin)
bool ShowPinNames()
int GetPenSize() const override
Definition: lib_pin.cpp:564
void SetFontBold(const bool aBold)
Set bold property of current font.
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
bool ShowPinNumbers()
LIB_PART * GetParent() const
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
ELECTRICAL_PINTYPE GetType() const
Get the electrical type of the pin.
Definition: lib_pin.h:251
Define a library symbol object.
static void drawPinDanglingSymbol(GAL *aGal, const VECTOR2I &aPos, const COLOR4D &aColor)
#define OUTSIDE
void triLine(const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:362
static VECTOR2D mapCoords(const wxPoint &aCoord)
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:463
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
#define max(a, b)
Definition: auxiliary.h:86
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:43
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:368
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
#define INSIDE
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
#define PIN_TEXT_MARGIN
int GetLength()
Definition: lib_pin.h:301
GRAPHIC_PINSHAPE GetShape() const
Definition: lib_pin.h:235
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( LIB_CIRCLE aCircle,
int  aLayer 
)
private

Definition at line 333 of file sch_painter.cpp.

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

334 {
335  if( !isUnitAndConversionShown( aCircle ) )
336  return;
337 
338  if( setColors( aCircle, aLayer ) )
339  m_gal->DrawCircle( mapCoords( aCircle->GetPosition() ), aCircle->GetRadius() );
340 }
bool setColors(const LIB_ITEM *aItem, int aLayer)
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_circle.h:86
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
static VECTOR2D mapCoords(const wxPoint &aCoord)
int GetRadius() const
Definition: lib_circle.h:103
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
void KIGFX::SCH_PAINTER::draw ( LIB_ITEM ,
int   
)
private
void KIGFX::SCH_PAINTER::draw ( LIB_PART aComp,
int  aLayer,
bool  aDrawFields = true,
int  aUnit = 0,
int  aConvert = 0,
std::vector< bool > *  danglingPinFlags = nullptr 
)
private

Definition at line 221 of file sch_painter.cpp.

References Draw(), draw(), LIB_PART::GetDrawItems(), EDA_ITEM::IsMoving(), LIB_FIELD_T, LIB_PIN_T, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowConvert, and KIGFX::SCH_RENDER_SETTINGS::m_ShowUnit.

223 {
224  if( !aUnit )
225  aUnit = m_schSettings.m_ShowUnit;
226 
227  if( !aConvert )
228  aConvert = m_schSettings.m_ShowConvert;
229 
230  size_t pinIndex = 0;
231 
232  for( auto& item : aComp->GetDrawItems() )
233  {
234  if( !aDrawFields && item.Type() == LIB_FIELD_T )
235  continue;
236 
237  if( aUnit && item.GetUnit() && aUnit != item.GetUnit() )
238  continue;
239 
240  if( aConvert && item.GetConvert() && aConvert != item.GetConvert() )
241  continue;
242 
243  if( item.Type() == LIB_PIN_T )
244  {
245  auto pin = static_cast<LIB_PIN*>( &item );
246  bool dangling = true;
247 
248  if( danglingPinFlags && pinIndex < danglingPinFlags->size() )
249  dangling = (*danglingPinFlags)[ pinIndex ];
250 
251  draw( pin, aLayer, dangling, aComp->IsMoving() );
252  pinIndex++;
253  }
254  else
255  Draw( &item, aLayer );
256  }
257 }
virtual bool Draw(const VIEW_ITEM *, int) override
Function Draw Takes an instance of VIEW_ITEM and passes it to a function that know how to draw the it...
bool IsMoving() const
Definition: base_struct.h:221
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
void draw(LIB_RECTANGLE *, int)
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
void KIGFX::SCH_PAINTER::draw ( LIB_ALIAS aAlias,
int  aLayer 
)
private

Definition at line 260 of file sch_painter.cpp.

References DATASHEET, draw(), LIB_ALIAS::GetDocFileName(), LIB_PART::GetFields(), LIB_ALIAS::GetName(), LIB_ALIAS::GetPart(), LIB_ALIAS::IsRoot(), and VALUE.

261 {
262  LIB_PART* comp = aAlias->GetPart();
263 
264  draw( comp, aLayer, false );
265 
266  LIB_FIELDS fields;
267  comp->GetFields( fields );
268 
269  if( !aAlias->IsRoot() )
270  {
271  fields[ VALUE ].SetText( aAlias->GetName() );
272  fields[ DATASHEET ].SetText( aAlias->GetDocFileName() );
273  }
274 
275  for( LIB_FIELD& field : fields )
276  draw( &field, aLayer );
277 }
name of datasheet
Field object used in symbol libraries.
Definition: lib_field.h:59
bool IsRoot() const override
For symbols having aliases, IsRoot() indicates the principal item.
#define VALUE
Define a library symbol object.
LIB_PART * GetPart() const
Get the shared LIB_PART.
const wxString & GetDocFileName() const
const wxString & GetName() const override
std::vector< LIB_FIELD > LIB_FIELDS
Definition: lib_field.h:261
void draw(LIB_RECTANGLE *, int)
void GetFields(LIB_FIELDS &aList)
Return a list of fields within this part.
void KIGFX::SCH_PAINTER::draw ( LIB_ARC aArc,
int  aLayer 
)
private

Definition at line 343 of file sch_painter.cpp.

References KIGFX::GAL::DrawArc(), LIB_ARC::GetFirstRadiusAngle(), LIB_ARC::GetPosition(), LIB_ARC::GetRadius(), LIB_ARC::GetSecondRadiusAngle(), isUnitAndConversionShown(), KIGFX::PAINTER::m_gal, KIGFX::mapCoords(), and setColors().

344 {
345  if( !isUnitAndConversionShown( aArc ) )
346  return;
347 
348  int sai = aArc->GetFirstRadiusAngle();
349  int eai = aArc->GetSecondRadiusAngle();
350 
351  if( TRANSFORM().MapAngles( &sai, &eai ) )
352  std::swap( sai, eai );
353 
354  double sa = (double) sai * M_PI / 1800.0;
355  double ea = (double) eai * M_PI / 1800.0 ;
356 
357  VECTOR2D pos = mapCoords( aArc->GetPosition() );
358 
359  if( setColors( aArc, aLayer ) )
360  m_gal->DrawArc( pos, aArc->GetRadius(), sa, ea );
361 }
bool setColors(const LIB_ITEM *aItem, int aLayer)
int GetSecondRadiusAngle() const
Definition: lib_arc.h:146
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
Draw an arc.
int GetFirstRadiusAngle() const
Definition: lib_arc.h:142
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
int GetRadius() const
Definition: lib_arc.h:138
static VECTOR2D mapCoords(const wxPoint &aCoord)
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_arc.h:121
void KIGFX::SCH_PAINTER::draw ( LIB_POLYLINE aLine,
int  aLayer 
)
private

Definition at line 364 of file sch_painter.cpp.

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

365 {
366  if( !isUnitAndConversionShown( aLine ) )
367  return;
368 
369  const std::vector<wxPoint>& pts = aLine->GetPolyPoints();
370  std::deque<VECTOR2D> vtx;
371 
372  for( auto p : pts )
373  vtx.push_back( mapCoords( p ) );
374 
375  if( setColors( aLine, aLayer ) )
376  m_gal->DrawPolygon( vtx );
377 }
bool setColors(const LIB_ITEM *aItem, int aLayer)
const std::vector< wxPoint > & GetPolyPoints() const
Definition: lib_polyline.h:68
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
void KIGFX::SCH_PAINTER::draw ( LIB_FIELD aField,
int  aLayer 
)
private

Definition at line 380 of file sch_painter.cpp.

References color, KIGFX::GAL::DrawLine(), LIB_FIELD::GetDefaultColor(), EDA_TEXT::GetHorizJustify(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), LIB_FIELD::GetPenSize(), LIB_FIELD::GetPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), EDA_ITEM::IsMoving(), isUnitAndConversionShown(), LIB_FIELD::IsVisible(), LAYER_HIDDEN, KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, KIGFX::SCH_RENDER_SETTINGS::m_ShowUmbilicals, KIGFX::mapCoords(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), KIGFX::GAL::StrokeText(), KIGFX::VIEW::VIEW_MAX_LAYERS, and LIB_FIELD::ViewGetLayers().

381 {
382  // Must check layer as fields are sometimes drawn by their parent rather than
383  // directly from the view.
384  int layers[KIGFX::VIEW::VIEW_MAX_LAYERS], layers_count;
385  aField->ViewGetLayers( layers, layers_count );
386 
387  if( aLayer != layers[0] )
388  return;
389 
390  if( !isUnitAndConversionShown( aField ) )
391  return;
392 
393  auto color = getOverlayColor( aField, aField->GetDefaultColor(), false );
394 
395  if( !aField->IsVisible() )
396  {
399  else
400  return;
401  }
402 
403  int linewidth = aField->GetPenSize();
404 
405  m_gal->SetLineWidth( linewidth );
406  m_gal->SetIsFill( false );
407  m_gal->SetIsStroke( true );
409  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
410 
412  m_gal->SetVerticalJustify( aField->GetVertJustify( ) );
413 
414  auto pos = mapCoords( aField->GetPosition() );
415  double orient = aField->GetTextAngleRadians();
416 
417  m_gal->StrokeText( aField->GetText(), pos, orient );
418 
419  // Draw the umbilical line
420  if( aField->IsMoving() && m_schSettings.m_ShowUmbilicals )
421  {
423  m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
424  m_gal->DrawLine( pos, wxPoint( 0, 0 ) );
425  }
426 }
bool IsMoving() const
Definition: base_struct.h:221
float m_outlineWidth
Line width used when drawing outlines.
Definition: painter.h:287
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_field.h:223
int color
Definition: DXF_plotter.cpp:62
COLOR4D GetDefaultColor() override
Definition: lib_field.cpp:424
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:203
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:712
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on...
Definition: lib_field.cpp:411
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
static VECTOR2D mapCoords(const wxPoint &aCoord)
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:204
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsVisible() const
Definition: lib_field.h:168
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
int GetPenSize() const override
Definition: lib_field.cpp:118
const wxSize & GetTextSize() const
Definition: eda_text.h:228
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
double GetTextAngleRadians() const
Definition: eda_text.h:180
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( LIB_TEXT aText,
int  aLayer 
)
private

Definition at line 429 of file sch_painter.cpp.

References EDA_RECT::Centre(), color, LIB_TEXT::GetBoundingBox(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), LIB_TEXT::GetPenSize(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), isUnitAndConversionShown(), EDA_TEXT::IsVisible(), LAYER_DEVICE, LAYER_HIDDEN, 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::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), and KIGFX::GAL::StrokeText().

430 {
431  if( !isUnitAndConversionShown( aText ) )
432  return;
433 
434  auto color = getOverlayColor( aText, m_schSettings.GetLayerColor( LAYER_DEVICE ), false );
435 
436  if( !aText->IsVisible() )
437  {
440  else
441  return;
442  }
443 
444  int linewidth = aText->GetPenSize();
445  EDA_RECT bBox = aText->GetBoundingBox();
446  bBox.RevertYAxis();
447  VECTOR2D pos = mapCoords( bBox.Centre() );
448  double orient = aText->GetTextAngleRadians();
449 
452  m_gal->SetLineWidth( linewidth );
453  m_gal->SetIsFill( false );
454  m_gal->SetIsStroke( true );
456  m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
457  m_gal->SetFontBold( aText->IsBold() );
458  m_gal->SetFontItalic( aText->IsItalic() );
459  m_gal->StrokeText( aText->GetText(), pos, orient );
460 }
void SetFontItalic(const bool aItalic)
Set italic property of current font.
bool IsItalic() const
Definition: eda_text.h:183
int color
Definition: DXF_plotter.cpp:62
void RevertYAxis()
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size) ...
Definition: eda_rect.h:144
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
bool IsBold() const
Definition: eda_text.h:186
virtual void SetLineWidth(float aLineWidth)
Set the line width.
void SetFontBold(const bool aBold)
Set bold property of current font.
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
wxPoint Centre() const
Definition: eda_rect.h:60
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
static VECTOR2D mapCoords(const wxPoint &aCoord)
int GetPenSize() const override
Definition: lib_text.cpp:213
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
const EDA_RECT GetBoundingBox() const override
Definition: lib_text.cpp:312
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
bool IsVisible() const
Definition: eda_text.h:189
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
const wxSize & GetTextSize() const
Definition: eda_text.h:228
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
double GetTextAngleRadians() const
Definition: eda_text.h:180
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
void KIGFX::SCH_PAINTER::draw ( SCH_COMPONENT aComp,
int  aLayer 
)
private

Definition at line 1046 of file sch_painter.cpp.

References draw(), KIGFX::dummy(), SCH_COMPONENT::GetConvert(), SCH_COMPONENT::GetDanglingPinFlags(), SCH_COMPONENT::GetFields(), SCH_COMPONENT::GetOrientation(), SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetPosition(), SCH_COMPONENT::GetUnit(), HIGHLIGHTED, IS_MOVED, EDA_ITEM::IsHighlighted(), EDA_ITEM::IsMoving(), SCH_COMPONENT::IsPinHighlighted(), LIB_PIN_T, KIGFX::orientComponent(), and EDA_ITEM::SetFlags().

1047 {
1048  PART_SPTR part = aComp->GetPartRef().lock();
1049 
1050  // Use dummy part if the actual couldn't be found (or couldn't be locked).
1051  // In either case copy it so we can re-orient and translate it.
1052  std::unique_ptr<LIB_PART> temp( new LIB_PART( part ? *part.get() : *dummy() ) );
1053 
1054  if( aComp->IsMoving() )
1055  temp->SetFlags( IS_MOVED );
1056 
1057  if( aComp->IsHighlighted() )
1058  temp->SetFlags( HIGHLIGHTED );
1059 
1060  orientComponent( temp.get(), aComp->GetOrientation() );
1061 
1062  for( auto& item : temp->GetDrawItems() )
1063  {
1064  auto rp = aComp->GetPosition();
1065  auto ip = item.GetPosition();
1066  item.Move( wxPoint( rp.x + ip.x, ip.y - rp.y ) );
1067 
1068  if( item.Type() == LIB_PIN_T )
1069  {
1070  auto pin = static_cast<LIB_PIN*>( &item );
1071  if( aComp->IsPinHighlighted( pin ) )
1072  {
1073  pin->SetFlags( HIGHLIGHTED );
1074  }
1075  }
1076  }
1077 
1078  draw( temp.get(), aLayer, false,
1079  aComp->GetUnit(), aComp->GetConvert(), aComp->GetDanglingPinFlags() );
1080 
1081  // The fields are SCH_COMPONENT-specific and so don't need to be copied/
1082  // oriented/translated.
1083  std::vector<SCH_FIELD*> fields;
1084  aComp->GetFields( fields, false );
1085 
1086  for( SCH_FIELD* field : fields )
1087  {
1088  if( !field->IsMoving() )
1089  draw( field, aLayer );
1090  }
1091 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
bool IsMoving() const
Definition: base_struct.h:221
PART_REF & GetPartRef()
std::vector< bool > * GetDanglingPinFlags()
int GetOrientation()
Get the display symbol orientation.
bool IsHighlighted() const
Definition: base_struct.h:226
static void orientComponent(LIB_PART *part, int orientation)
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
int GetConvert() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
Define a library symbol object.
int GetUnit() const
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
bool IsPinHighlighted(const LIB_PIN *aPin)
wxPoint GetPosition() const override
Function GetPosition.
void draw(LIB_RECTANGLE *, int)
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113
void KIGFX::SCH_PAINTER::draw ( SCH_JUNCTION aJct,
int  aLayer 
)
private

Definition at line 860 of file sch_painter.cpp.

References BRIGHTENED, color, KIGFX::GAL::DrawCircle(), SCH_JUNCTION::GetEffectiveSymbolSize(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), SCH_JUNCTION::GetPosition(), EDA_ITEM::GetState(), LAYER_BRIGHTENED, LAYER_JUNCTION, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), and KIGFX::GAL::SetStrokeColor().

861 {
863 
864  if( aJct->GetState( BRIGHTENED ) )
866  else
867  color = getOverlayColor( aJct, color, false );
868 
869  m_gal->SetIsStroke(true);
870  m_gal->SetIsFill(true);
871  m_gal->SetStrokeColor( color );
872  m_gal->SetFillColor( color );
874 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
int color
Definition: DXF_plotter.cpp:62
int GetState(int type) const
Definition: base_struct.h:240
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_junction.h:103
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
static int GetEffectiveSymbolSize()
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_FIELD aField,
int  aLayer 
)
private

Definition at line 1094 of file sch_painter.cpp.

References EDA_RECT::Centre(), color, KIGFX::GAL::DrawLine(), SCH_FIELD::GetBoundingBox(), SCH_FIELD::GetFullyQualifiedText(), SCH_FIELD::GetId(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), EDA_ITEM::GetParent(), SCH_FIELD::GetPenSize(), SCH_COMPONENT::GetPosition(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextSize(), SCH_COMPONENT::GetTransform(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_ITEM::IsMoving(), EDA_TEXT::IsVisible(), SCH_FIELD::IsVoid(), LAYER_FIELDS, LAYER_HIDDEN, LAYER_REFERENCEPART, LAYER_VALUEPART, KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, REFERENCE, KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextMirrored(), KIGFX::GAL::SetVerticalJustify(), KIGFX::GAL::StrokeText(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, VALUE, and TRANSFORM::y1.

1095 {
1096  COLOR4D color;
1097  SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) aField->GetParent();
1098 
1099  switch( aField->GetId() )
1100  {
1101  case REFERENCE: color = m_schSettings.GetLayerColor( LAYER_REFERENCEPART ); break;
1102  case VALUE: color = m_schSettings.GetLayerColor( LAYER_VALUEPART ); break;
1103  default: color = m_schSettings.GetLayerColor( LAYER_FIELDS ); break;
1104  }
1105 
1106  color = getOverlayColor( aField, color, false );
1107 
1108  if( !aField->IsVisible() )
1109  {
1112  else
1113  return;
1114  }
1115 
1116  if( aField->IsVoid() )
1117  return;
1118 
1119  // Calculate the text orientation according to the component orientation.
1120  int orient = (int) aField->GetTextAngle();
1121 
1122  if( parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
1123  {
1124  if( orient == TEXT_ANGLE_HORIZ )
1125  orient = TEXT_ANGLE_VERT;
1126  else
1127  orient = TEXT_ANGLE_HORIZ;
1128  }
1129 
1130  /* Calculate the text justification, according to the component
1131  * orientation/mirror this is a bit complicated due to cumulative
1132  * calculations:
1133  * - numerous cases (mirrored or not, rotation)
1134  * - the DrawGraphicText function recalculate also H and H justifications
1135  * according to the text orientation.
1136  * - When a component is mirrored, the text is not mirrored and
1137  * justifications are complicated to calculate
1138  * so the more easily way is to use no justifications ( Centered text )
1139  * and use GetBoundaryBox to know the text coordinate considered as centered
1140  */
1141  EDA_RECT boundaryBox = aField->GetBoundingBox();
1142  wxPoint textpos = boundaryBox.Centre();
1143  int lineWidth = aField->GetPenSize();
1144 
1147  m_gal->SetStrokeColor( color );
1148  m_gal->SetIsFill( false );
1149  m_gal->SetIsStroke( true );
1150  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
1151  m_gal->SetFontBold( aField->IsBold() );
1152  m_gal->SetFontItalic( aField->IsItalic() );
1153  m_gal->SetTextMirrored( aField->IsMirrored() );
1154  m_gal->SetLineWidth( lineWidth );
1155  m_gal->StrokeText( aField->GetFullyQualifiedText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI/2 : 0 );
1156 
1157  // Draw the umbilical line
1158  if( aField->IsMoving() )
1159  {
1161  m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
1162  m_gal->DrawLine( textpos, parentComponent->GetPosition() );
1163  }
1164 }
#define TEXT_ANGLE_HORIZ
void SetFontItalic(const bool aItalic)
Set italic property of current font.
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_field.cpp:101
bool IsMoving() const
Definition: base_struct.h:221
TRANSFORM & GetTransform() const
bool IsItalic() const
Definition: eda_text.h:183
float m_outlineWidth
Line width used when drawing outlines.
Definition: painter.h:287
#define TEXT_ANGLE_VERT
int GetId() const
Definition: sch_field.h:87
const wxString GetFullyQualifiedText() const
Function GetFullyQualifiedText returns the fully qualified field text by allowing for the part suffix...
Definition: sch_field.cpp:80
int color
Definition: DXF_plotter.cpp:62
EDA_ITEM * GetParent() const
Definition: base_struct.h:211
bool IsVoid() const
Function IsVoid returns true if the field is either empty or holds "~".
Definition: sch_field.h:116
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
Field Reference of part, i.e. "IC21".
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
bool IsBold() const
Definition: eda_text.h:186
double GetTextAngle() const
Definition: eda_text.h:177
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int y1
Definition: transform.h:49
void SetFontBold(const bool aBold)
Set bold property of current font.
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
#define VALUE
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
wxPoint Centre() const
Definition: eda_rect.h:60
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_field.cpp:252
bool IsMirrored() const
Definition: eda_text.h:192
bool IsVisible() const
Definition: eda_text.h:189
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
wxPoint GetPosition() const override
Function GetPosition.
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
const wxSize & GetTextSize() const
Definition: eda_text.h:228
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_TEXT aText,
int  aLayer 
)
private

Definition at line 950 of file sch_painter.cpp.

References BRIGHTENED, color, KIGFX::drawDanglingSymbol(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), SCH_TEXT::GetPenSize(), SCH_TEXT::GetSchematicTextOffset(), EDA_TEXT::GetShownText(), EDA_ITEM::GetState(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextPos(), SCH_TEXT::IsDangling(), EDA_TEXT::IsVisible(), LAYER_BRIGHTENED, LAYER_GLOBLABEL, LAYER_HIDDEN, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NOTES, LAYER_SHEETLABEL, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::SCH_RENDER_SETTINGS::m_ShowHiddenText, SCH_GLOBAL_LABEL_T, SCH_HIERARCHICAL_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextAttributes(), KIGFX::GAL::StrokeText(), and EDA_ITEM::Type().

951 {
952  COLOR4D color;
953 
954  switch( aText->Type() )
955  {
959  case SCH_LABEL_T: color = m_schSettings.GetLayerColor( LAYER_LOCLABEL ); break;
960  default: color = m_schSettings.GetLayerColor( LAYER_NOTES ); break;
961  }
962 
963  if( aText->GetState( BRIGHTENED ) )
965 
966  color = getOverlayColor( aText, color, false );
967 
968  if( !aText->IsVisible() )
969  {
972  else
973  return;
974  }
975 
976  m_gal->SetStrokeColor( color );
977 
978  if( aText->IsDangling() )
979  drawDanglingSymbol( m_gal, aText->GetTextPos() );
980 
981  wxPoint text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset();
982  int linewidth = aText->GetPenSize();
983  wxString shownText( aText->GetShownText() );
984 
985  if( !shownText.IsEmpty() )
986  {
987  m_gal->SetIsFill( false );
988  m_gal->SetIsStroke( true );
989  m_gal->SetTextAttributes( aText );
990  m_gal->SetLineWidth( linewidth );
991  m_gal->StrokeText( shownText, text_offset, aText->GetTextAngleRadians() );
992  }
993 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
virtual bool IsDangling() const override
Definition: sch_text.h:177
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
virtual int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_text.cpp:289
virtual void SetTextAttributes(const EDA_TEXT *aText)
Loads attributes of the given text (bold/italic/underline/mirrored and so on).
int color
Definition: DXF_plotter.cpp:62
int GetState(int type) const
Definition: base_struct.h:240
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:148
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsVisible() const
Definition: eda_text.h:189
virtual wxPoint GetSchematicTextOffset() const
Definition: sch_text.cpp:144
double GetTextAngleRadians() const
Definition: eda_text.h:180
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
static void drawDanglingSymbol(GAL *aGal, const wxPoint &aPos)
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_LABEL ,
int   
)
private
void KIGFX::SCH_PAINTER::draw ( SCH_HIERLABEL aLabel,
int  aLayer 
)
private

Definition at line 1195 of file sch_painter.cpp.

References BRIGHTENED, color, SCH_HIERLABEL::CreateGraphicShape(), draw(), KIGFX::GAL::DrawPolyline(), GetDefaultLineThickness(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), EDA_ITEM::GetState(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetThickness(), LAYER_BRIGHTENED, LAYER_SHEETLABEL, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

1196 {
1198  int width = aLabel->GetThickness() ? aLabel->GetThickness() : GetDefaultLineThickness();
1199 
1200  if( aLabel->GetState( BRIGHTENED ) )
1202 
1203  color = getOverlayColor( aLabel, color, false );
1204 
1205  std::vector<wxPoint> pts;
1206  std::deque<VECTOR2D> pts2;
1207 
1208  aLabel->CreateGraphicShape( pts, aLabel->GetTextPos() );
1209 
1210  for( auto p : pts )
1211  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1212 
1213  m_gal->SetIsFill( false );
1214  m_gal->SetIsStroke( true );
1215  m_gal->SetLineWidth( width );
1216  m_gal->SetStrokeColor( color );
1217  m_gal->DrawPolyline( pts2 );
1218 
1219  draw( static_cast<SCH_TEXT*>( aLabel ), aLayer );
1220 }
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
int color
Definition: DXF_plotter.cpp:62
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
int GetState(int type) const
Definition: base_struct.h:240
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:167
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
void CreateGraphicShape(std::vector< wxPoint > &aPoints, const wxPoint &Pos) override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.cpp:1096
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void draw(LIB_RECTANGLE *, int)
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_GLOBALLABEL aLabel,
int  aLayer 
)
private

Definition at line 1167 of file sch_painter.cpp.

References BRIGHTENED, color, SCH_GLOBALLABEL::CreateGraphicShape(), draw(), KIGFX::GAL::DrawPolyline(), GetDefaultLineThickness(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), EDA_ITEM::GetState(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetThickness(), LAYER_BRIGHTENED, LAYER_GLOBLABEL, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

1168 {
1170  int width = aLabel->GetThickness() ? aLabel->GetThickness() : GetDefaultLineThickness();
1171 
1172  if( aLabel->GetState( BRIGHTENED ) )
1174 
1175  color = getOverlayColor( aLabel, color, false );
1176 
1177  std::vector<wxPoint> pts;
1178  std::deque<VECTOR2D> pts2;
1179 
1180  aLabel->CreateGraphicShape( pts, aLabel->GetTextPos() );
1181 
1182  for( auto p : pts )
1183  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1184 
1185  m_gal->SetIsFill( false );
1186  m_gal->SetIsStroke( true );
1187  m_gal->SetLineWidth( width );
1188  m_gal->SetStrokeColor( color );
1189  m_gal->DrawPolyline( pts2 );
1190 
1191  draw( static_cast<SCH_TEXT*>( aLabel ), aLayer );
1192 }
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
int color
Definition: DXF_plotter.cpp:62
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
int GetState(int type) const
Definition: base_struct.h:240
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:167
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
void CreateGraphicShape(std::vector< wxPoint > &aPoints, const wxPoint &aPos) override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.cpp:835
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void draw(LIB_RECTANGLE *, int)
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_SHEET aSheet,
int  aLayer 
)
private

Definition at line 1222 of file sch_painter.cpp.

References draw(), KIGFX::GAL::DrawLine(), KIGFX::GAL::DrawRectangle(), SCH_SHEET::GetFileName(), SCH_SHEET::GetFileNamePosition(), SCH_SHEET::GetFileNameSize(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_SHEET::GetName(), SCH_SHEET::GetPenSize(), SCH_SHEET::GetPins(), SCH_SHEET::GetPosition(), SCH_SHEET::GetSheetNamePosition(), SCH_SHEET::GetSheetNameSize(), SCH_SHEET::GetSize(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_TOP, EDA_ITEM::IsMoving(), SCH_SHEET::IsVerticalOrientation(), LAYER_HIERLABEL, LAYER_SHEET, LAYER_SHEET_BACKGROUND, LAYER_SHEETFILENAME, LAYER_SHEETNAME, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetVerticalJustify(), SCH_SHEET_PIN::SHEET_BOTTOM_SIDE, SCH_SHEET_PIN::SHEET_LEFT_SIDE, SCH_SHEET_PIN::SHEET_RIGHT_SIDE, SCH_SHEET_PIN::SHEET_TOP_SIDE, and KIGFX::GAL::StrokeText().

1223 {
1224  VECTOR2D pos = aSheet->GetPosition();
1225  VECTOR2D size = aSheet->GetSize();
1226 
1227  if( aLayer == LAYER_SHEET_BACKGROUND )
1228  {
1229  m_gal->SetIsStroke( false );
1230 
1231  if( aSheet->IsMoving() ) // Gives a filled background when moving for a better look
1232  {
1233  // Select a fill color working well with black and white background color,
1234  // both in Opengl and Cairo
1235  m_gal->SetFillColor( COLOR4D( 0.1, 0.5, 0.5, 0.3 ) );
1236  m_gal->SetIsFill( true );
1237  }
1238  else
1239  {
1240  // Could be modified later, when sheets can have their own fill color
1241  return;
1242  }
1243 
1244  m_gal->DrawRectangle( pos, pos + size );
1245  }
1246  else if( aLayer == LAYER_SHEET )
1247  {
1249  m_gal->SetIsStroke( true );
1250 
1251  m_gal->SetIsFill( false );
1252  m_gal->SetLineWidth( aSheet->GetPenSize() );
1253 
1254  m_gal->DrawRectangle( pos, pos + size );
1255 
1256  VECTOR2D pos_sheetname = aSheet->GetSheetNamePosition();
1257  VECTOR2D pos_filename = aSheet->GetFileNamePosition();
1258  double nameAngle = 0.0;
1259 
1260  if( aSheet->IsVerticalOrientation() )
1261  nameAngle = -M_PI/2;
1262 
1264 
1265  auto text = wxT( "Sheet: " ) + aSheet->GetName();
1266 
1269 
1270  auto txtSize = aSheet->GetSheetNameSize();
1271 
1272  m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) );
1273  m_gal->SetFontBold( false );
1274  m_gal->SetFontItalic( false );
1275 
1276  m_gal->StrokeText( text, pos_sheetname, nameAngle );
1277 
1278  txtSize = aSheet->GetFileNameSize();
1279  m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) );
1282 
1283  text = wxT( "File: " ) + aSheet->GetFileName();
1284  m_gal->StrokeText( text, pos_filename, nameAngle );
1285  }
1286  else if( aLayer == LAYER_HIERLABEL )
1287  {
1288  for( auto& sheetPin : aSheet->GetPins() )
1289  {
1290  if( !sheetPin.IsMoving() )
1291  {
1292  // For aesthetic reasons, the SHEET_PIN is drawn with a small offset
1293  // of width / 2
1294  int width = aSheet->GetPenSize();
1295  wxPoint initial_pos = sheetPin.GetTextPos();
1296  wxPoint offset_pos = initial_pos;
1297 
1298  switch( sheetPin.GetEdge() )
1299  {
1300  case SCH_SHEET_PIN::SHEET_TOP_SIDE: offset_pos.y -= width / 2; break;
1301  case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: offset_pos.y += width / 2; break;
1302  case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: offset_pos.x -= width / 2; break;
1303  case SCH_SHEET_PIN::SHEET_LEFT_SIDE: offset_pos.x += width / 2; break;
1304  default: break;
1305  }
1306 
1307  sheetPin.SetTextPos( offset_pos );
1308  draw( static_cast<SCH_HIERLABEL*>( &sheetPin ), aLayer );
1309  m_gal->DrawLine( offset_pos, initial_pos );
1310  sheetPin.SetTextPos( initial_pos );
1311  }
1312  }
1313  }
1314 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
void SetFontItalic(const bool aItalic)
Set italic property of current font.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool IsMoving() const
Definition: base_struct.h:221
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:334
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:383
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int GetSheetNameSize() const
Definition: sch_sheet.h:271
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
int GetFileNameSize() const
Definition: sch_sheet.h:275
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_sheet.h:547
wxString GetFileName(void) const
Return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:662
wxPoint GetFileNamePosition()
Definition: sch_sheet.cpp:408
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
wxPoint GetSheetNamePosition()
Definition: sch_sheet.cpp:389
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:221
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
void draw(LIB_RECTANGLE *, int)
wxString GetName() const
Definition: sch_sheet.h:267
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
wxSize GetSize()
Definition: sch_sheet.h:281
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_SHEET_PIN ,
int   
)
private
void KIGFX::SCH_PAINTER::draw ( SCH_NO_CONNECT aNC,
int  aLayer 
)
private

Definition at line 1317 of file sch_painter.cpp.

References delta, KIGFX::GAL::DrawLine(), GetDefaultLineThickness(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_NO_CONNECT::GetPosition(), SCH_NO_CONNECT::GetSize(), LAYER_NOCONNECT, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

1318 {
1319  int delta = aNC->GetSize() / 2;
1320  int width = GetDefaultLineThickness();
1321 
1323  m_gal->SetIsStroke( true );
1324  m_gal->SetIsFill( false );
1325  m_gal->SetLineWidth( width );
1326 
1327  VECTOR2D p = aNC->GetPosition();
1328 
1329  m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
1330  m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );
1331 }
wxPoint GetPosition() const override
Function GetPosition.
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
static const int delta[8][2]
Definition: solve.cpp:112
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
int GetSize() const
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
void KIGFX::SCH_PAINTER::draw ( SCH_MARKER aMarker,
int  aLayer 
)
private

Definition at line 1381 of file sch_painter.cpp.

References color, KIGFX::GAL::DrawPolygon(), MARKER_BASE::GetErrorLevel(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_MARKER::GetPosition(), LAYER_ERC_ERR, LAYER_ERC_WARN, KIGFX::PAINTER::m_gal, m_schSettings, MARKER_BASE::MARKER_SEVERITY_ERROR, KIGFX::GAL::Restore(), KIGFX::GAL::Save(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), MARKER_BASE::ShapeToPolygon(), and KIGFX::GAL::Translate().

1382 {
1383  SHAPE_LINE_CHAIN polygon;
1384  aMarker->ShapeToPolygon( polygon );
1385 
1387 
1390 
1391  m_gal->Save();
1392  m_gal->Translate( aMarker->GetPosition() );
1393  m_gal->SetFillColor( color );
1394  m_gal->SetIsFill( true );
1395  m_gal->SetIsStroke( false );
1396  m_gal->DrawPolygon( polygon );
1397  m_gal->Restore();
1398 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon) const
Returns the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to th...
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_marker.h:102
int color
Definition: DXF_plotter.cpp:62
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
MARKER_SEVERITY GetErrorLevel() const
Definition: marker_base.h:176
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void Restore()
Restore the context.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
Class SHAPE_LINE_CHAIN.
virtual void Save()
Save the context.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_BITMAP aBitmap,
int  aLayer 
)
private

Definition at line 1363 of file sch_painter.cpp.

References KIGFX::GAL::DrawBitmap(), SCH_BITMAP::GetImage(), SCH_BITMAP::GetImageScale(), SCH_BITMAP::GetPosition(), KIGFX::PAINTER::m_gal, KIGFX::GAL::Restore(), KIGFX::GAL::Save(), KIGFX::GAL::Scale(), and KIGFX::GAL::Translate().

1364 {
1365  m_gal->Save();
1366  m_gal->Translate( aBitmap->GetPosition() );
1367 
1368  // When the image scale factor is not 1.0, we need to modify the actual
1369  // as the image scale factor is similar to a local zoom
1370  double img_scale = aBitmap->GetImageScale();
1371 
1372  if( img_scale != 1.0 )
1373  m_gal->Scale( VECTOR2D( img_scale, img_scale ) );
1374 
1375  m_gal->DrawBitmap( *aBitmap->GetImage() );
1376 
1377  m_gal->Restore();
1378 }
virtual void DrawBitmap(const BITMAP_BASE &aBitmap)
Draw a bitmap image.
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_bitmap.h:157
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
BITMAP_BASE * GetImage()
Definition: sch_bitmap.h:65
virtual void Scale(const VECTOR2D &aScale)
Scale the context.
double GetImageScale() const
Definition: sch_bitmap.h:94
virtual void Restore()
Restore the context.
virtual void Save()
Save the context.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
void KIGFX::SCH_PAINTER::draw ( SCH_LINE aLine,
int  aLayer 
)
private

Definition at line 877 of file sch_painter.cpp.

References BRIGHTENED, ClipLine(), color, DASH_GAP_LEN, DASH_MARK_LEN, DOT_MARK_LEN, KIGFX::drawDanglingSymbol(), KIGFX::GAL::DrawLine(), SCH_LINE::GetEndPoint(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_LINE::GetLineColor(), SCH_LINE::GetLineStyle(), KIGFX::getOverlayColor(), SCH_LINE::GetPenSize(), SCH_LINE::GetStartPoint(), EDA_ITEM::GetState(), i, SCH_LINE::IsEndDangling(), SCH_LINE::IsStartDangling(), KiROUND(), LAYER_BRIGHTENED, KIGFX::PAINTER::m_gal, m_schSettings, next(), EDA_RECT::Normalize(), PLOTDASHTYPE_DASH, PLOTDASHTYPE_DASHDOT, PLOTDASHTYPE_DOT, PLOTDASHTYPE_SOLID, KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), VECTOR2< T >::x, and VECTOR2< T >::y.

878 {
879  COLOR4D color = aLine->GetLineColor();
880 
881  if( aLine->GetState( BRIGHTENED ) )
883 
884  color = getOverlayColor( aLine, color, false );
885 
886  int width = aLine->GetPenSize();
887 
888  m_gal->SetIsStroke( true );
889  m_gal->SetStrokeColor(color);
890  m_gal->SetLineWidth( width );
891 
892  if( aLine->GetLineStyle() <= PLOTDASHTYPE_SOLID )
893  {
894  m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() );
895  }
896  else
897  {
898  VECTOR2D start = aLine->GetStartPoint();
899  VECTOR2D end = aLine->GetEndPoint();
900 
901  EDA_RECT clip( wxPoint( start.x, start.y ), wxSize( end.x - start.x, end.y - start.y ) );
902  clip.Normalize();
903 
904  double theta = atan2( end.y - start.y, end.x - start.x );
905  double strokes[] = { 1.0, DASH_GAP_LEN( width ), 1.0, DASH_GAP_LEN( width ) };
906 
907  switch( aLine->GetLineStyle() )
908  {
909  default:
910  case PLOTDASHTYPE_DASH:
911  strokes[0] = strokes[2] = DASH_MARK_LEN( width );
912  break;
913  case PLOTDASHTYPE_DOT:
914  strokes[0] = strokes[2] = DOT_MARK_LEN( width );
915  break;
917  strokes[0] = DASH_MARK_LEN( width );
918  strokes[2] = DOT_MARK_LEN( width );
919  break;
920  }
921 
922  for( size_t i = 0; i < 10000; ++i )
923  {
924  // Calculations MUST be done in doubles to keep from accumulating rounding
925  // errors as we go.
926  VECTOR2D next( start.x + strokes[ i % 4 ] * cos( theta ),
927  start.y + strokes[ i % 4 ] * sin( theta ) );
928 
929  // Drawing each segment can be done rounded to ints.
930  wxPoint segStart( KiROUND( start.x ), KiROUND( start.y ) );
931  wxPoint segEnd( KiROUND( next.x ), KiROUND( next.y ) );
932 
933  if( ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
934  break;
935  else if( i % 2 == 0 )
936  m_gal->DrawLine( segStart, segEnd );
937 
938  start = next;
939  }
940  }
941 
942  if( aLine->IsStartDangling() )
944 
945  if( aLine->IsEndDangling() )
947 }
CITER next(CITER it)
Definition: ptree.cpp:130
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
COLOR4D GetLineColor() const
Definition: sch_line.cpp:243
int color
Definition: DXF_plotter.cpp:62
#define DASH_MARK_LEN(aLineWidth)
wxPoint GetEndPoint() const
Definition: sch_line.h:80
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
int GetState(int type) const
Definition: base_struct.h:240
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
wxPoint GetStartPoint() const
Definition: sch_line.h:76
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
#define DOT_MARK_LEN(aLineWidth)
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
int GetLineStyle() const
Definition: sch_line.cpp:269
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.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsEndDangling() const
Definition: sch_line.h:162
size_t i
Definition: json11.cpp:597
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
#define DASH_GAP_LEN(aLineWidth)
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_line.cpp:296
bool IsStartDangling() const
Definition: sch_line.h:161
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
static void drawDanglingSymbol(GAL *aGal, const wxPoint &aPos)
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_BUS_ENTRY_BASE aEntry,
int  aLayer 
)
private

Definition at line 1334 of file sch_painter.cpp.

References color, KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawLine(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), SCH_ITEM::GetPenSize(), SCH_BUS_ENTRY_BASE::GetPosition(), SCH_BUS_ENTRY_BASE::IsDanglingEnd(), SCH_BUS_ENTRY_BASE::IsDanglingStart(), LAYER_BUS, LAYER_WIRE, SCH_BUS_ENTRY_BASE::m_End(), KIGFX::PAINTER::m_gal, m_schSettings, SCH_BUS_BUS_ENTRY_T, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), TARGET_BUSENTRY_RADIUS, and EDA_ITEM::Type().

1335 {
1336  COLOR4D color = aEntry->Type() == SCH_BUS_BUS_ENTRY_T ?
1339 
1340  color = getOverlayColor( aEntry, color, false );
1341 
1342  m_gal->SetStrokeColor( color );
1343  m_gal->SetIsStroke( true );
1344  m_gal->SetLineWidth( aEntry->GetPenSize() );
1345  m_gal->SetIsFill( false );
1346 
1347  VECTOR2D pos = aEntry->GetPosition();
1348  VECTOR2D endPos = aEntry->m_End();
1349 
1350  m_gal->DrawLine( pos, endPos );
1351 
1352  // Draw dangling symbols:
1353  m_gal->SetLineWidth ( 1.0 );
1354 
1355  if( aEntry->IsDanglingStart() )
1357 
1358  if( aEntry->IsDanglingEnd() )
1360 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
#define TARGET_BUSENTRY_RADIUS
Definition: sch_bus_entry.h:35
bool IsDanglingEnd() const
Definition: sch_bus_entry.h:52
int color
Definition: DXF_plotter.cpp:62
wxPoint m_End() const
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
bool IsDanglingStart() const
Definition: sch_bus_entry.h:51
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
virtual int GetPenSize() const
Function GetPenSize virtual pure.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
wxPoint GetPosition() const override
Function GetPosition.
virtual SCH_RENDER_SETTINGS* KIGFX::SCH_PAINTER::GetSettings ( )
inlineoverridevirtual

Function GetSettings Returns pointer to current settings that are going to be used when drawing items.

Returns
Current rendering settings.

Implements KIGFX::PAINTER.

Definition at line 127 of file sch_painter.h.

Referenced by SCH_EDIT_FRAME::OnSelectOptionToolbar().

128  {
129  return &m_schSettings;
130  }
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
bool KIGFX::SCH_PAINTER::isUnitAndConversionShown ( const LIB_ITEM aItem)
private

Definition at line 201 of file sch_painter.cpp.

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().

202 {
203  if( m_schSettings.m_ShowUnit // showing a specific unit
204  && aItem->GetUnit() // item is unit-specific
205  && aItem->GetUnit() != m_schSettings.m_ShowUnit )
206  {
207  return false;
208  }
209 
210  if( m_schSettings.m_ShowConvert // showing a specific conversion
211  && aItem->GetConvert() // item is conversion-specific
212  && aItem->GetConvert() != m_schSettings.m_ShowConvert )
213  {
214  return false;
215  }
216 
217  return true;
218 }
int GetUnit() const
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
int GetConvert() const
bool KIGFX::SCH_PAINTER::setColors ( const LIB_ITEM aItem,
int  aLayer 
)
private

Definition at line 293 of file sch_painter.cpp.

References color, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR, LIB_ITEM::GetFillMode(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::getOverlayColor(), LIB_ITEM::GetPenSize(), LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, KIGFX::PAINTER::m_gal, m_schSettings, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

Referenced by draw().

294 {
295  if( aLayer == LAYER_DEVICE_BACKGROUND && aItem->GetFillMode() == FILLED_WITH_BG_BODYCOLOR )
296  {
298 
299  m_gal->SetIsFill( true );
300  m_gal->SetFillColor( color );
301 
302  m_gal->SetIsStroke( false );
303  return true;
304  }
305  else if( aLayer == LAYER_DEVICE )
306  {
307  COLOR4D color = getOverlayColor( aItem, m_schSettings.GetLayerColor( LAYER_DEVICE ), false );
308 
309  m_gal->SetIsStroke( true );
310  m_gal->SetStrokeColor( color );
311  m_gal->SetLineWidth( aItem->GetPenSize() );
312 
313  m_gal->SetIsFill( aItem->GetFillMode() == FILLED_SHAPE );
314  m_gal->SetFillColor( color );
315  return true;
316  }
317 
318  return false;
319 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
FILL_T GetFillMode() const
int color
Definition: DXF_plotter.cpp:62
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
Definition: painter.h:219
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
static const COLOR4D getOverlayColor(const EDA_ITEM *aItem, const COLOR4D &aColor, bool aOnBackgroundLayer)
Definition: sch_painter.cpp:91
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual int GetPenSize() const =0
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::PAINTER::SetGAL ( GAL aGal)
inlineinherited

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

Parameters
aGalis the new GAL instance.

Definition at line 328 of file painter.h.

329  {
330  m_gal = aGal;
331  }
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
void KIGFX::SCH_PAINTER::triLine ( const VECTOR2D a,
const VECTOR2D b,
const VECTOR2D c 
)
private

Definition at line 286 of file sch_painter.cpp.

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

Referenced by draw().

287 {
288  m_gal->DrawLine( a, b );
289  m_gal->DrawLine( b, c );
290 }
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:360

Member Data Documentation

COLOR4D KIGFX::PAINTER::m_brightenedColor
protectedinherited

Color of brightened item frame.

Definition at line 363 of file painter.h.

GAL* KIGFX::PAINTER::m_gal
protectedinherited

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

DrawLine, DrawCircle, etc.)

Definition at line 360 of file painter.h.

Referenced by draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), setColors(), and triLine().

SCH_RENDER_SETTINGS KIGFX::SCH_PAINTER::m_schSettings
private

Definition at line 165 of file sch_painter.h.

Referenced by Draw(), draw(), isUnitAndConversionShown(), and setColors().


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