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

131  :
132  KIGFX::PAINTER (aGal)
133 { }
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 140 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().

141 {
142  auto item2 = static_cast<const EDA_ITEM*>( aItem );
143  auto item = const_cast<EDA_ITEM*>( item2 );
144 
146 
147  switch( item->Type() )
148  {
173 
174  default: return false;
175  }
176 
177  return false;
178 }
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:69
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:69
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:165
void KIGFX::SCH_PAINTER::draw ( LIB_RECTANGLE aRect,
int  aLayer 
)
private

Definition at line 308 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().

309 {
310  if( !isUnitAndConversionShown( aRect ) )
311  return;
312 
313  if( setColors( aRect, aLayer ) )
314  m_gal->DrawRectangle( mapCoords( aRect->GetPosition() ), mapCoords( aRect->GetEnd() ) );
315 
316 }
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 482 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(), 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, KIGFX::selectedBrightening(), 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.

483 {
484  if( aLayer != LAYER_DEVICE )
485  return;
486 
487  if( !isUnitAndConversionShown( aPin ) )
488  return;
489 
490  if( aPin->IsMoving() )
491  isMoving = true;
492 
494  VECTOR2I pos = mapCoords( aPin->GetPosition() );
495 
496  if( isMoving )
497  color = selectedBrightening( color );
498 
499  if( !aPin->IsVisible() )
500  {
502  {
504  }
505  else
506  {
507  if( isDangling && aPin->IsPowerConnection() )
508  drawPinDanglingSymbol( m_gal, pos, color );
509 
510  return;
511  }
512  }
513 
514  VECTOR2I p0, dir;
515  int len = aPin->GetLength();
516  int width = aPin->GetPenSize();
517  int shape = aPin->GetShape();
518  int orient = aPin->GetOrientation();
519 
520  switch( orient )
521  {
522  case PIN_UP:
523  p0 = VECTOR2I( pos.x, pos.y - len );
524  dir = VECTOR2I(0, 1);
525  break;
526  case PIN_DOWN:
527  p0 = VECTOR2I( pos.x, pos.y + len );
528  dir = VECTOR2I(0, -1);
529  break;
530  case PIN_LEFT:
531  p0 = VECTOR2I( pos.x - len, pos.y );
532  dir = VECTOR2I(1, 0);
533  break;
534  case PIN_RIGHT:
535  p0 = VECTOR2I( pos.x + len, pos.y );
536  dir = VECTOR2I(-1, 0);
537  break;
538  }
539 
540  VECTOR2D pc;
541 
542  m_gal->SetIsStroke( true );
543  m_gal->SetIsFill( false );
544  m_gal->SetLineWidth( width );
545  m_gal->SetStrokeColor( color );
546  m_gal->SetFontBold( false );
547  m_gal->SetFontItalic( false );
548 
549  const int radius = ExternalPinDecoSize( *aPin );
550  const int diam = radius*2;
551  const int clock_size = InternalPinDecoSize( *aPin );
552 
553  if( shape == PINSHAPE_INVERTED )
554  {
555  m_gal->DrawCircle( p0 + dir * radius, radius );
556  m_gal->DrawLine( p0 + dir * ( diam ), pos );
557  }
558  else if( shape == PINSHAPE_FALLING_EDGE_CLOCK )
559  {
560  pc = p0 + dir * clock_size ;
561 
562  triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
563  pc,
564  p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
565 
566  m_gal->DrawLine( pos, pc );
567  }
568  else
569  {
570  m_gal->DrawLine( p0, pos );
571  }
572 
573  if( shape == PINSHAPE_CLOCK )
574  {
575  if (!dir.y)
576  {
577  triLine( p0 + VECTOR2D( 0, clock_size ),
578  p0 + VECTOR2D( -dir.x * clock_size, 0 ),
579  p0 + VECTOR2D( 0, -clock_size ) );
580  }
581  else
582  {
583  triLine( p0 + VECTOR2D( clock_size, 0 ),
584  p0 + VECTOR2D( 0, -dir.y * clock_size ),
585  p0 + VECTOR2D( -clock_size, 0 ) );
586  }
587  }
588 
589  if( shape == PINSHAPE_INPUT_LOW )
590  {
591  if(!dir.y)
592  {
593  triLine( p0 + VECTOR2D(dir.x, 0) * diam,
594  p0 + VECTOR2D(dir.x, -1) * diam,
595  p0 );
596  }
597  else /* MapX1 = 0 */
598  {
599  triLine( p0 + VECTOR2D( 0, dir.y) * diam,
600  p0 + VECTOR2D(-1, dir.y) * diam,
601  p0 );
602  }
603  }
604 
605  if( shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
606  {
607  if( !dir.y ) // Horizontal pin
608  m_gal->DrawLine( p0 - VECTOR2D( 0, diam ), p0 + VECTOR2D( dir.x, 0 ) * diam );
609  else // Vertical pin
610  m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
611  }
612 
613  if( shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
614  {
615  m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,
616  p0 + VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius );
617  m_gal->DrawLine( p0 - VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius,
618  p0 + VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius );
619  }
620 
621  if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol
622  {
623  m_gal->DrawLine( pos + VECTOR2D( -1, -1 ) * TARGET_PIN_RADIUS,
624  pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
625  m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
626  pos + VECTOR2D( -1, 1 ) * TARGET_PIN_RADIUS );
627  }
628 
629  if( isDangling && ( aPin->IsVisible() || aPin->IsPowerConnection() ) )
630  drawPinDanglingSymbol( m_gal, pos, color );
631 
632  // Draw the labels
633 
634  LIB_PART* libEntry = aPin->GetParent();
635  int textOffset = libEntry->GetPinNameOffset();
636 
637  int nameLineWidth = aPin->GetPenSize();
638  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, aPin->GetNameTextSize(), false );
639  int numLineWidth = aPin->GetPenSize();
640  numLineWidth = Clamp_Text_PenSize( numLineWidth, aPin->GetNumberTextSize(), false );
641 
642  #define PIN_TEXT_MARGIN 4
643 
644  // Four locations around a pin where text can be drawn
645  enum { INSIDE = 0, OUTSIDE, ABOVE, BELOW };
646  int size[4] = { 0, 0, 0, 0 };
647  int thickness[4] = { numLineWidth, numLineWidth, numLineWidth, numLineWidth };
648  COLOR4D colour[4];
649  wxString text[4];
650 
651  // TextOffset > 0 means pin NAMES on inside, pin NUMBERS above and nothing below
652  if( textOffset )
653  {
654  size [INSIDE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
655  thickness[INSIDE] = nameLineWidth;
657  text [INSIDE] = aPin->GetName();
658 
659  size [ABOVE] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
660  thickness[ABOVE] = numLineWidth;
661  colour [ABOVE] = m_schSettings.GetLayerColor( LAYER_PINNUM );
662  text [ABOVE] = aPin->GetNumber();
663  }
664  // Otherwise pin NAMES go above and pin NUMBERS go below
665  else
666  {
667  size [ABOVE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
668  thickness[ABOVE] = nameLineWidth;
669  colour [ABOVE] = m_schSettings.GetLayerColor( LAYER_PINNAM );
670  text [ABOVE] = aPin->GetName();
671 
672  size [BELOW] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
673  thickness[BELOW] = numLineWidth;
674  colour [BELOW] = m_schSettings.GetLayerColor( LAYER_PINNUM );
675  text [BELOW] = aPin->GetNumber();
676  }
677 
679  {
680  size [OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, Millimeter2iu( 0.7 ) );
681  thickness[OUTSIDE] = size[OUTSIDE] / 6;
683  text [OUTSIDE] = aPin->GetElectricalTypeName();
684  }
685 
686  if( !aPin->IsVisible() )
687  {
688  for( COLOR4D& c : colour )
690  }
691  else if( isMoving )
692  {
693  for( COLOR4D& c : colour )
694  c = selectedBrightening( c );
695  }
696 
697  int insideOffset = textOffset;
698  int outsideOffset = 10;
699  int aboveOffset = PIN_TEXT_MARGIN + ( thickness[ABOVE] + GetDefaultLineThickness() ) / 2;
700  int belowOffset = PIN_TEXT_MARGIN + ( thickness[BELOW] + GetDefaultLineThickness() ) / 2;
701 
702  #define SET_DC( i ) \
703  m_gal->SetGlyphSize( VECTOR2D( size[i], size[i] ) ); \
704  m_gal->SetLineWidth( thickness[i] ); \
705  m_gal->SetStrokeColor( colour[i] );
706 
707  switch( orient )
708  {
709  case PIN_LEFT:
710  if( size[INSIDE] )
711  {
712  SET_DC( INSIDE );
715  m_gal->StrokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 );
716  }
717  if( size[OUTSIDE] )
718  {
719  SET_DC( OUTSIDE );
722  m_gal->StrokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 );
723  }
724  if( size[ABOVE] )
725  {
726  SET_DC( ABOVE );
729  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
730  }
731  if( size[BELOW] )
732  {
733  SET_DC( BELOW );
736  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
737  }
738  break;
739 
740  case PIN_RIGHT:
741  if( size[INSIDE] )
742  {
743  SET_DC( INSIDE );
747  m_gal->StrokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 );
748  }
749  if( size[OUTSIDE] )
750  {
751  SET_DC( OUTSIDE );
754  m_gal->StrokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 );
755  }
756  if( size[ABOVE] )
757  {
758  SET_DC( ABOVE );
761  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
762  }
763  if( size[BELOW] )
764  {
765  SET_DC( BELOW );
768  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
769  }
770  break;
771 
772  case PIN_DOWN:
773  if( size[INSIDE] )
774  {
775  SET_DC( INSIDE );
778  m_gal->StrokeText ( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2);
779  }
780  if( size[OUTSIDE] )
781  {
782  SET_DC( OUTSIDE );
785  m_gal->StrokeText ( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2);
786  }
787  if( size[ABOVE] )
788  {
789  SET_DC( ABOVE );
792  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
793  }
794  if( size[BELOW] )
795  {
796  SET_DC( BELOW );
799  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
800  }
801  break;
802 
803  case PIN_UP:
804  if( size[INSIDE] )
805  {
806  SET_DC( INSIDE );
809  m_gal->StrokeText ( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2);
810  }
811  if( size[OUTSIDE] )
812  {
813  SET_DC( OUTSIDE );
816  m_gal->StrokeText ( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2);
817  }
818  if( size[ABOVE] )
819  {
820  SET_DC( ABOVE );
823  m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
824  }
825  if( size[BELOW] )
826  {
827  SET_DC( BELOW );
830  m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
831  }
832  break;
833 
834  default:
835  wxFAIL_MSG( "Unknown pin orientation" );
836  }
837 }
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.
bool ShowPinNumbers()
LIB_PART * GetParent() const
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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 319 of file sch_painter.cpp.

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

320 {
321  if( !isUnitAndConversionShown( aCircle ) )
322  return;
323 
324  if( setColors( aCircle, aLayer ) )
325  m_gal->DrawCircle( mapCoords( aCircle->GetPosition() ), aCircle->GetRadius() );
326 }
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 201 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.

203 {
204  if( !aUnit )
205  aUnit = m_schSettings.m_ShowUnit;
206 
207  if( !aConvert )
208  aConvert = m_schSettings.m_ShowConvert;
209 
210  size_t pinIndex = 0;
211 
212  for( auto& item : aComp->GetDrawItems() )
213  {
214  if( !aDrawFields && item.Type() == LIB_FIELD_T )
215  continue;
216 
217  if( aUnit && item.GetUnit() && aUnit != item.GetUnit() )
218  continue;
219 
220  if( aConvert && item.GetConvert() && aConvert != item.GetConvert() )
221  continue;
222 
223  if( item.Type() == LIB_PIN_T )
224  {
225  auto pin = static_cast<LIB_PIN*>( &item );
226  bool dangling = true;
227 
228  if( danglingPinFlags && pinIndex < danglingPinFlags->size() )
229  dangling = (*danglingPinFlags)[ pinIndex ];
230 
231  draw( pin, aLayer, dangling, aComp->IsMoving() );
232  pinIndex++;
233  }
234  else
235  Draw( &item, aLayer );
236  }
237 }
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 240 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.

241 {
242  LIB_PART* comp = aAlias->GetPart();
243 
244  draw( comp, aLayer, false );
245 
246  LIB_FIELDS fields;
247  comp->GetFields( fields );
248 
249  if( !aAlias->IsRoot() )
250  {
251  fields[ VALUE ].SetText( aAlias->GetName() );
252  fields[ DATASHEET ].SetText( aAlias->GetDocFileName() );
253  }
254 
255  for( LIB_FIELD& field : fields )
256  draw( &field, aLayer );
257 }
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 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:259
void draw(LIB_RECTANGLE *, int)
#define VALUE
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 329 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().

330 {
331  if( !isUnitAndConversionShown( aArc ) )
332  return;
333 
334  int sai = aArc->GetFirstRadiusAngle();
335  int eai = aArc->GetSecondRadiusAngle();
336 
337  if( TRANSFORM().MapAngles( &sai, &eai ) )
338  std::swap( sai, eai );
339 
340  double sa = (double) sai * M_PI / 1800.0;
341  double ea = (double) eai * M_PI / 1800.0 ;
342 
343  VECTOR2D pos = mapCoords( aArc->GetPosition() );
344 
345  if( setColors( aArc, aLayer ) )
346  m_gal->DrawArc( pos, aArc->GetRadius(), sa, ea );
347 }
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 350 of file sch_painter.cpp.

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

351 {
352  if( !isUnitAndConversionShown( aLine ) )
353  return;
354 
355  const std::vector<wxPoint>& pts = aLine->GetPolyPoints();
356  std::deque<VECTOR2D> vtx;
357 
358  for( auto p : pts )
359  vtx.push_back( mapCoords( p ) );
360 
361  if( setColors( aLine, aLayer ) )
362  m_gal->DrawPolygon( vtx );
363 }
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 366 of file sch_painter.cpp.

References color, KIGFX::GAL::DrawLine(), LIB_FIELD::GetDefaultColor(), EDA_TEXT::GetHorizJustify(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LIB_ITEM::GetParent(), 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::selectedBrightening(), 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().

367 {
368  // Must check layer as fields are sometimes drawn by their parent rather than
369  // directly from the view.
370  int layers[KIGFX::VIEW::VIEW_MAX_LAYERS], layers_count;
371  aField->ViewGetLayers( layers, layers_count );
372 
373  if( aLayer != layers[0] )
374  return;
375 
376  if( !isUnitAndConversionShown( aField ) )
377  return;
378 
379  COLOR4D color = aField->GetDefaultColor();
380 
381  if( aField->IsMoving() || ( aField->GetParent() && aField->GetParent()->IsMoving() ) )
382  color = selectedBrightening( color );
383 
384  if( !aField->IsVisible() )
385  {
388  else
389  return;
390  }
391 
392  int linewidth = aField->GetPenSize();
393 
394  m_gal->SetLineWidth( linewidth );
395  m_gal->SetIsFill( false );
396  m_gal->SetIsStroke( true );
397  m_gal->SetStrokeColor( color );
398  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
399 
401  m_gal->SetVerticalJustify( aField->GetVertJustify( ) );
402 
403  auto pos = mapCoords( aField->GetPosition() );
404  double orient = aField->GetTextAngleRadians();
405 
406  m_gal->StrokeText( aField->GetText(), pos, orient );
407 
408  // Draw the umbilical line
409  if( aField->IsMoving() && m_schSettings.m_ShowUmbilicals )
410  {
412  m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
413  m_gal->DrawLine( pos, wxPoint( 0, 0 ) );
414  }
415 }
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:221
int color
Definition: DXF_plotter.cpp:62
COLOR4D GetDefaultColor() override
Definition: lib_field.cpp:416
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:699
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.
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:403
LIB_PART * GetParent() const
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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:166
bool isUnitAndConversionShown(const LIB_ITEM *aItem)
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
int GetPenSize() const override
Definition: lib_field.cpp:110
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 418 of file sch_painter.cpp.

References EDA_RECT::Centre(), color, LIB_TEXT::GetBoundingBox(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LIB_ITEM::GetParent(), 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(), EDA_ITEM::IsMoving(), 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::selectedBrightening(), 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().

419 {
420  if( !isUnitAndConversionShown( aText ) )
421  return;
422 
424 
425  if( aText->IsMoving() || ( aText->GetParent() && aText->GetParent()->IsMoving() ) )
426  color = selectedBrightening( color );
427 
428  if( !aText->IsVisible() )
429  {
432  else
433  return;
434  }
435 
436  int linewidth = aText->GetPenSize();
437  EDA_RECT bBox = aText->GetBoundingBox();
438  bBox.RevertYAxis();
439  VECTOR2D pos = mapCoords( bBox.Centre() );
440  double orient = aText->GetTextAngleRadians();
441 
444  m_gal->SetLineWidth( linewidth );
445  m_gal->SetIsFill( false );
446  m_gal->SetIsStroke( true );
447  m_gal->SetStrokeColor( color );
448  m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
449  m_gal->SetFontBold( aText->IsBold() );
450  m_gal->SetFontItalic( aText->IsItalic() );
451  m_gal->StrokeText( aText->GetText(), pos, orient );
452 }
void SetFontItalic(const bool aItalic)
Set italic property of current font.
bool IsMoving() const
Definition: base_struct.h:221
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.
LIB_PART * GetParent() const
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void KIGFX::SCH_PAINTER::draw ( SCH_COMPONENT aComp,
int  aLayer 
)
private

Definition at line 1039 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(), IS_MOVED, EDA_ITEM::IsMoving(), and KIGFX::orientComponent().

1040 {
1041  PART_SPTR part = aComp->GetPartRef().lock();
1042 
1043  // Use dummy part if the actual couldn't be found (or couldn't be locked).
1044  // In either case copy it so we can re-orient and translate it.
1045  std::unique_ptr<LIB_PART> temp( new LIB_PART( part ? *part.get() : *dummy() ) );
1046 
1047  if( aComp->IsMoving() )
1048  temp->SetFlags( IS_MOVED );
1049 
1050  orientComponent( temp.get(), aComp->GetOrientation() );
1051 
1052  for( auto& item : temp->GetDrawItems() )
1053  {
1054  auto rp = aComp->GetPosition();
1055  auto ip = item.GetPosition();
1056  item.Move( wxPoint( rp.x + ip.x, ip.y - rp.y ) );
1057  }
1058 
1059  draw( temp.get(), aLayer, false,
1060  aComp->GetUnit(), aComp->GetConvert(), aComp->GetDanglingPinFlags() );
1061 
1062  // The fields are SCH_COMPONENT-specific and so don't need to be copied/
1063  // oriented/translated.
1064  std::vector<SCH_FIELD*> fields;
1065  aComp->GetFields( fields, false );
1066 
1067  for( SCH_FIELD* field : fields )
1068  {
1069  if( !field->IsMoving() )
1070  draw( field, aLayer );
1071  }
1072 }
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.
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
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
Define a library symbol object.
int GetUnit() const
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 854 of file sch_painter.cpp.

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

855 {
857 
858  if( aJct->GetState( BRIGHTENED ) )
860  else if( aJct->IsMoving() )
861  color = selectedBrightening( color );
862 
863  m_gal->SetIsStroke(true);
864  m_gal->SetIsFill(true);
865  m_gal->SetStrokeColor( color );
866  m_gal->SetFillColor( color );
868 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
bool IsMoving() const
Definition: base_struct.h:221
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 SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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 1075 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(), 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::selectedBrightening(), 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.

1076 {
1077  COLOR4D color;
1078  SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) aField->GetParent();
1079 
1080  switch( aField->GetId() )
1081  {
1082  case REFERENCE: color = m_schSettings.GetLayerColor( LAYER_REFERENCEPART ); break;
1083  case VALUE: color = m_schSettings.GetLayerColor( LAYER_VALUEPART ); break;
1084  default: color = m_schSettings.GetLayerColor( LAYER_FIELDS ); break;
1085  }
1086 
1087  if( aField->IsMoving() || ( aField->GetParent() && aField->GetParent()->IsMoving() ) )
1088  color = selectedBrightening( color );
1089 
1090  if( !aField->IsVisible() )
1091  {
1094  else
1095  return;
1096  }
1097 
1098  if( aField->IsVoid() )
1099  return;
1100 
1101  // Calculate the text orientation according to the component orientation.
1102  int orient = (int) aField->GetTextAngle();
1103 
1104  if( parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
1105  {
1106  if( orient == TEXT_ANGLE_HORIZ )
1107  orient = TEXT_ANGLE_VERT;
1108  else
1109  orient = TEXT_ANGLE_HORIZ;
1110  }
1111 
1112  /* Calculate the text justification, according to the component
1113  * orientation/mirror this is a bit complicated due to cumulative
1114  * calculations:
1115  * - numerous cases (mirrored or not, rotation)
1116  * - the DrawGraphicText function recalculate also H and H justifications
1117  * according to the text orientation.
1118  * - When a component is mirrored, the text is not mirrored and
1119  * justifications are complicated to calculate
1120  * so the more easily way is to use no justifications ( Centered text )
1121  * and use GetBoundaryBox to know the text coordinate considered as centered
1122  */
1123  EDA_RECT boundaryBox = aField->GetBoundingBox();
1124  wxPoint textpos = boundaryBox.Centre();
1125  int lineWidth = aField->GetPenSize();
1126 
1129  m_gal->SetStrokeColor( color );
1130  m_gal->SetIsFill( false );
1131  m_gal->SetIsStroke( true );
1132  m_gal->SetGlyphSize( VECTOR2D( aField->GetTextSize() ) );
1133  m_gal->SetFontBold( aField->IsBold() );
1134  m_gal->SetFontItalic( aField->IsItalic() );
1135  m_gal->SetTextMirrored( aField->IsMirrored() );
1136  m_gal->SetLineWidth( lineWidth );
1137  m_gal->StrokeText( aField->GetFullyQualifiedText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI/2 : 0 );
1138 
1139  // Draw the umbilical line
1140  if( aField->IsMoving() )
1141  {
1143  m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
1144  m_gal->DrawLine( textpos, parentComponent->GetPosition() );
1145  }
1146 }
#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.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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:69
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.
#define VALUE
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 944 of file sch_painter.cpp.

References BRIGHTENED, color, KIGFX::drawDanglingSymbol(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_TEXT::GetPenSize(), SCH_TEXT::GetSchematicTextOffset(), EDA_TEXT::GetShownText(), EDA_ITEM::GetState(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextPos(), SCH_TEXT::IsDangling(), EDA_ITEM::IsMoving(), 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::selectedBrightening(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextAttributes(), KIGFX::GAL::StrokeText(), and EDA_ITEM::Type().

945 {
946  COLOR4D color;
947 
948  switch( aText->Type() )
949  {
953  case SCH_LABEL_T: color = m_schSettings.GetLayerColor( LAYER_LOCLABEL ); break;
954  default: color = m_schSettings.GetLayerColor( LAYER_NOTES ); break;
955  }
956 
957  if( aText->GetState( BRIGHTENED ) )
959  if( aText->IsMoving() )
960  color = selectedBrightening( color );
961 
962  if( !aText->IsVisible() )
963  {
966  else
967  return;
968  }
969 
970  if( aText->IsDangling() )
971  drawDanglingSymbol( m_gal, aText->GetTextPos() );
972 
973  wxPoint text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset();
974  int linewidth = aText->GetPenSize();
975  wxString shownText( aText->GetShownText() );
976 
977  if( !shownText.IsEmpty() )
978  {
979  m_gal->SetIsFill( false );
980  m_gal->SetIsStroke( true );
981  m_gal->SetStrokeColor( color );
982  m_gal->SetTextAttributes( aText );
983  m_gal->SetLineWidth( linewidth );
984  m_gal->StrokeText( shownText, text_offset, aText->GetTextAngleRadians() );
985  }
986 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
bool IsMoving() const
Definition: base_struct.h:221
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
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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 1177 of file sch_painter.cpp.

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

1178 {
1180  int width = aLabel->GetThickness() ? aLabel->GetThickness() : GetDefaultLineThickness();
1181 
1182  if( aLabel->GetState( BRIGHTENED ) )
1184  if( aLabel->IsMoving() )
1185  color = selectedBrightening( color );
1186 
1187  std::vector<wxPoint> pts;
1188  std::deque<VECTOR2D> pts2;
1189 
1190  aLabel->CreateGraphicShape( pts, aLabel->GetTextPos() );
1191 
1192  for( auto p : pts )
1193  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1194 
1195  m_gal->SetIsFill( false );
1196  m_gal->SetIsStroke( true );
1197  m_gal->SetLineWidth( width );
1198  m_gal->SetStrokeColor( color );
1199  m_gal->DrawPolyline( pts2 );
1200 
1201  draw( static_cast<SCH_TEXT*>( aLabel ), aLayer );
1202 }
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
bool IsMoving() const
Definition: base_struct.h:221
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
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
#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 1149 of file sch_painter.cpp.

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

1150 {
1152  int width = aLabel->GetThickness() ? aLabel->GetThickness() : GetDefaultLineThickness();
1153 
1154  if( aLabel->GetState( BRIGHTENED ) )
1156  if( aLabel->IsMoving() )
1157  color = selectedBrightening( color );
1158 
1159  std::vector<wxPoint> pts;
1160  std::deque<VECTOR2D> pts2;
1161 
1162  aLabel->CreateGraphicShape( pts, aLabel->GetTextPos() );
1163 
1164  for( auto p : pts )
1165  pts2.emplace_back( VECTOR2D( p.x, p.y ) );
1166 
1167  m_gal->SetIsFill( false );
1168  m_gal->SetIsStroke( true );
1169  m_gal->SetLineWidth( width );
1170  m_gal->SetStrokeColor( color );
1171  m_gal->DrawPolyline( pts2 );
1172 
1173  draw( static_cast<SCH_TEXT*>( aLabel ), aLayer );
1174 }
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
bool IsMoving() const
Definition: base_struct.h:221
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
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
#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 1204 of file sch_painter.cpp.

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

1205 {
1206  VECTOR2D pos = aSheet->GetPosition();
1207  VECTOR2D size = aSheet->GetSize();
1208 
1209  if( aLayer == LAYER_SHEET_BACKGROUND )
1210  {
1211  m_gal->SetIsStroke( false );
1212 
1213  if( aSheet->IsMoving() ) // Gives a filled background when moving for a better look
1214  {
1215  // Select a fill color working well with black and white background color,
1216  // both in Opengl and Cairo
1217  m_gal->SetFillColor( COLOR4D( 0.1, 0.5, 0.5, 0.3 ) );
1218  m_gal->SetIsFill( true );
1219  }
1220  else
1221  {
1222  // Could be modified later, when sheets can have their own fill color
1223  return;
1224  }
1225 
1226  m_gal->DrawRectangle( pos, pos + size );
1227  }
1228  else if( aLayer == LAYER_SHEET )
1229  {
1231  m_gal->SetIsStroke( true );
1232 
1233  m_gal->SetIsFill( false );
1234  m_gal->SetLineWidth( aSheet->GetPenSize() );
1235 
1236  m_gal->DrawRectangle( pos, pos + size );
1237 
1238  VECTOR2D pos_sheetname = aSheet->GetSheetNamePosition();
1239  VECTOR2D pos_filename = aSheet->GetFileNamePosition();
1240  double nameAngle = 0.0;
1241 
1242  if( aSheet->IsVerticalOrientation() )
1243  nameAngle = -M_PI/2;
1244 
1246 
1247  auto text = wxT( "Sheet: " ) + aSheet->GetName();
1248 
1251 
1252  auto txtSize = aSheet->GetSheetNameSize();
1253 
1254  m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) );
1255  m_gal->SetFontBold( false );
1256  m_gal->SetFontItalic( false );
1257 
1258  m_gal->StrokeText( text, pos_sheetname, nameAngle );
1259 
1260  txtSize = aSheet->GetFileNameSize();
1261  m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) );
1264 
1265  text = wxT( "File: " ) + aSheet->GetFileName();
1266  m_gal->StrokeText( text, pos_filename, nameAngle );
1267 
1268  for( auto& sheetPin : aSheet->GetPins() )
1269  {
1270  if( !sheetPin.IsMoving() )
1271  draw( static_cast<SCH_HIERLABEL*>( &sheetPin ), aLayer );
1272  }
1273  }
1274 }
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
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:661
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 1277 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().

1278 {
1279  int delta = aNC->GetSize() / 2;
1280  int width = GetDefaultLineThickness();
1281 
1283  m_gal->SetIsStroke( true );
1284  m_gal->SetIsFill( false );
1285  m_gal->SetLineWidth( width );
1286 
1287  VECTOR2D p = aNC->GetPosition();
1288 
1289  m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
1290  m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );
1291 }
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 1342 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, MARKER_BASE::m_ScalingFactor, m_schSettings, MARKER_BASE::MARKER_SEVERITY_ERROR, KIGFX::GAL::Restore(), KIGFX::GAL::Save(), scale, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), and KIGFX::GAL::Translate().

1343 {
1344  const int scale = aMarker->m_ScalingFactor;
1345 
1346  // If you are changing this, update the bounding box as well
1347  const VECTOR2D arrow[] =
1348  {
1349  VECTOR2D( 0 * scale, 0 * scale ),
1350  VECTOR2D( 8 * scale, 1 * scale ),
1351  VECTOR2D( 4 * scale, 3 * scale ),
1352  VECTOR2D( 13 * scale, 8 * scale ),
1353  VECTOR2D( 9 * scale, 9 * scale ),
1354  VECTOR2D( 8 * scale, 13 * scale ),
1355  VECTOR2D( 3 * scale, 4 * scale ),
1356  VECTOR2D( 1 * scale, 8 * scale ),
1357  VECTOR2D( 0 * scale, 0 * scale )
1358  };
1359 
1361 
1364 
1365  m_gal->Save();
1366  m_gal->Translate( aMarker->GetPosition() );
1367  m_gal->SetFillColor( color );
1368  m_gal->SetIsFill( true );
1369  m_gal->SetIsStroke( false );
1370  m_gal->DrawPolygon( arrow, sizeof( arrow ) / sizeof( VECTOR2D ) );
1371  m_gal->Restore();
1372 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_marker.h:106
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:152
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size)
Definition: marker_base.h:55
const int scale
virtual void Restore()
Restore the context.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
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 1324 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().

1325 {
1326  m_gal->Save();
1327  m_gal->Translate( aBitmap->GetPosition() );
1328 
1329  // When the image scale factor is not 1.0, we need to modify the actual
1330  // as the image scale factor is similar to a local zoom
1331  double img_scale = aBitmap->GetImageScale();
1332 
1333  if( img_scale != 1.0 )
1334  m_gal->Scale( VECTOR2D( img_scale, img_scale ) );
1335 
1336  m_gal->DrawBitmap( *aBitmap->GetImage() );
1337 
1338  m_gal->Restore();
1339 }
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 871 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(), SCH_LINE::GetPenSize(), SCH_LINE::GetStartPoint(), EDA_ITEM::GetState(), i, SCH_LINE::IsEndDangling(), EDA_ITEM::IsMoving(), 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::selectedBrightening(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

872 {
873  COLOR4D color = aLine->GetLineColor();
874 
875  if( aLine->GetState( BRIGHTENED ) )
877  else if( aLine->IsMoving() )
878  color = selectedBrightening( color );
879 
880  int width = aLine->GetPenSize();
881 
882  m_gal->SetIsStroke( true );
883  m_gal->SetStrokeColor(color);
884  m_gal->SetLineWidth( width );
885 
886  if( aLine->GetLineStyle() <= PLOTDASHTYPE_SOLID )
887  {
888  m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() );
889  }
890  else
891  {
892  VECTOR2D start = aLine->GetStartPoint();
893  VECTOR2D end = aLine->GetEndPoint();
894 
895  EDA_RECT clip( wxPoint( start.x, start.y ), wxSize( end.x - start.x, end.y - start.y ) );
896  clip.Normalize();
897 
898  double theta = atan2( end.y - start.y, end.x - start.x );
899  double strokes[] = { 1.0, DASH_GAP_LEN( width ), 1.0, DASH_GAP_LEN( width ) };
900 
901  switch( aLine->GetLineStyle() )
902  {
903  default:
904  case PLOTDASHTYPE_DASH:
905  strokes[0] = strokes[2] = DASH_MARK_LEN( width );
906  break;
907  case PLOTDASHTYPE_DOT:
908  strokes[0] = strokes[2] = DOT_MARK_LEN( width );
909  break;
911  strokes[0] = DASH_MARK_LEN( width );
912  strokes[2] = DOT_MARK_LEN( width );
913  break;
914  }
915 
916  for( size_t i = 0; i < 10000; ++i )
917  {
918  // Calculations MUST be done in doubles to keep from accumulating rounding
919  // errors as we go.
920  VECTOR2D next( start.x + strokes[ i % 4 ] * cos( theta ),
921  start.y + strokes[ i % 4 ] * sin( theta ) );
922 
923  // Drawing each segment can be done rounded to ints.
924  wxPoint segStart( KiROUND( start.x ), KiROUND( start.y ) );
925  wxPoint segEnd( KiROUND( next.x ), KiROUND( next.y ) );
926 
927  if( ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
928  break;
929  else if( i % 2 == 0 )
930  m_gal->DrawLine( segStart, segEnd );
931 
932  start = next;
933  }
934  }
935 
936  if( aLine->IsStartDangling() )
938 
939  if( aLine->IsEndDangling() )
941 }
CITER next(CITER it)
Definition: ptree.cpp:130
bool IsMoving() const
Definition: base_struct.h:221
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
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 COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
#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 1294 of file sch_painter.cpp.

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

1295 {
1296  COLOR4D color = aEntry->Type() == SCH_BUS_BUS_ENTRY_T ?
1299 
1300  if( aEntry->IsMoving() )
1301  color = selectedBrightening( color );
1302 
1303  m_gal->SetStrokeColor( color );
1304  m_gal->SetIsStroke( true );
1305  m_gal->SetLineWidth( aEntry->GetPenSize() );
1306  m_gal->SetIsFill( false );
1307 
1308  VECTOR2D pos = aEntry->GetPosition();
1309  VECTOR2D endPos = aEntry->m_End();
1310 
1311  m_gal->DrawLine( pos, endPos );
1312 
1313  // Draw dangling symbols:
1314  m_gal->SetLineWidth ( 1.0 );
1315 
1316  if( aEntry->IsDanglingStart() )
1318 
1319  if( aEntry->IsDanglingEnd() )
1321 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
#define TARGET_BUSENTRY_RADIUS
Definition: sch_bus_entry.h:35
bool IsMoving() const
Definition: base_struct.h:221
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.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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 181 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().

182 {
183  if( m_schSettings.m_ShowUnit // showing a specific unit
184  && aItem->GetUnit() // item is unit-specific
185  && aItem->GetUnit() != m_schSettings.m_ShowUnit )
186  {
187  return false;
188  }
189 
190  if( m_schSettings.m_ShowConvert // showing a specific conversion
191  && aItem->GetConvert() // item is conversion-specific
192  && aItem->GetConvert() != m_schSettings.m_ShowConvert )
193  {
194  return false;
195  }
196 
197  return true;
198 }
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 273 of file sch_painter.cpp.

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

Referenced by draw().

274 {
275  if( aLayer == LAYER_DEVICE_BACKGROUND && aItem->GetFillMode() == FILLED_WITH_BG_BODYCOLOR )
276  {
278 
279  if( aItem->IsMoving() || ( aItem->GetParent() && aItem->GetParent()->IsMoving() ) )
280  color = selectedBrightening( color );
281 
282  m_gal->SetIsFill( true );
283  m_gal->SetFillColor( color );
284 
285  m_gal->SetIsStroke( false );
286  return true;
287  }
288  else if( aLayer == LAYER_DEVICE )
289  {
291 
292  if( aItem->IsMoving() || ( aItem->GetParent() && aItem->GetParent()->IsMoving() ) )
293  color = selectedBrightening( color );
294 
295  m_gal->SetIsStroke( true );
296  m_gal->SetStrokeColor( color );
297  m_gal->SetLineWidth( aItem->GetPenSize() );
298 
299  m_gal->SetIsFill( aItem->GetFillMode() == FILLED_SHAPE );
300  m_gal->SetFillColor( color );
301  return true;
302  }
303 
304  return false;
305 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
bool IsMoving() const
Definition: base_struct.h:221
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.
LIB_PART * GetParent() const
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
static COLOR4D selectedBrightening(const COLOR4D &aColor)
Definition: sch_painter.cpp:87
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 266 of file sch_painter.cpp.

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

Referenced by draw().

267 {
268  m_gal->DrawLine( a, b );
269  m_gal->DrawLine( b, c );
270 }
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: