void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color ) { if( m_MultilineAllowed ) { std::vector<wxPoint> positions; wxArrayString strings; wxStringSplit( GetShownText(), strings, '\n' ); positions.reserve( strings.Count() ); GetPositionsOfLinesOfMultilineText(positions, strings.Count() ); for( unsigned ii = 0; ii < strings.Count(); ii++ ) { wxString& txt = strings.Item( ii ); drawOneLineOfText( aClipBox, aDC, aOffset, aColor, aDrawMode, aFillMode, txt, positions[ii] ); } } else drawOneLineOfText( aClipBox, aDC, aOffset, aColor, aDrawMode, aFillMode, GetShownText(), m_Pos ); // Draw text anchor, if requested if( aAnchor_color != UNSPECIFIED_COLOR ) { GRDrawAnchor( aClipBox, aDC, m_Pos.x + aOffset.x, m_Pos.y + aOffset.y, DIM_ANCRE_TEXTE, aAnchor_color ); } }
void SCH_TEXT::Plot( PLOTTER* aPlotter ) { static std::vector <wxPoint> Poly; COLOR4D color = GetLayerColor( GetLayer() ); int tmp = GetThickness(); int thickness = GetPenSize(); // Two thicknesses are set here: // The first is for EDA_TEXT, which controls the interline spacing based on text thickness // The second is for the output that sets the actual stroke size SetThickness( thickness ); aPlotter->SetCurrentLineWidth( thickness ); if( IsMultilineAllowed() ) { std::vector<wxPoint> positions; wxArrayString strings_list; wxStringSplit( GetShownText(), strings_list, '\n' ); positions.reserve( strings_list.Count() ); GetPositionsOfLinesOfMultilineText(positions, (int) strings_list.Count() ); for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) { wxPoint textpos = positions[ii] + GetSchematicTextOffset(); wxString& txt = strings_list.Item( ii ); aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(), GetVertJustify(), thickness, IsItalic(), IsBold() ); } } else { wxPoint textpos = GetTextPos() + GetSchematicTextOffset(); aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(), GetHorizJustify(), GetVertJustify(), thickness, IsItalic(), IsBold() ); } // Draw graphic symbol for global or hierarchical labels CreateGraphicShape( Poly, GetTextPos() ); aPlotter->SetCurrentLineWidth( GetPenSize() ); if( Poly.size() ) aPlotter->PlotPoly( Poly, NO_FILL ); SetThickness( tmp ); }
void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor ) const { wxSize size = GetSize(); if( IsMirrored() ) size.x = -size.x; s_cornerBuffer = &aCornerBuffer; s_textWidth = GetThickness() + ( 2 * aClearanceValue ); s_textCircle2SegmentCount = aCircleToSegmentsCount; EDA_COLOR_T color = BLACK; // not actually used, but needed by DrawGraphicText if( IsMultilineAllowed() ) { wxArrayString strings_list; wxStringSplit( GetShownText(), strings_list, '\n' ); std::vector<wxPoint> positions; positions.reserve( strings_list.Count() ); GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() ); for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) { wxString txt = strings_list.Item( ii ); DrawGraphicText( NULL, NULL, positions[ii], color, txt, GetOrientation(), size, GetHorizJustify(), GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToPoly ); } } else { DrawGraphicText( NULL, NULL, GetTextPosition(), color, GetShownText(), GetOrientation(), size, GetHorizJustify(), GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToPoly ); } }
void SCH_TEXT::Plot( PLOTTER* aPlotter ) { static std::vector <wxPoint> Poly; EDA_COLOR_T color = GetLayerColor( GetLayer() ); wxPoint textpos = m_Pos + GetSchematicTextOffset(); int thickness = GetPenSize(); aPlotter->SetCurrentLineWidth( thickness ); if( m_MultilineAllowed ) { std::vector<wxPoint> positions; wxArrayString strings_list; wxStringSplit( GetShownText(), strings_list, '\n' ); positions.reserve( strings_list.Count() ); GetPositionsOfLinesOfMultilineText(positions, strings_list.Count() ); for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) { wxString& txt = strings_list.Item( ii ); aPlotter->Text( positions[ii], color, txt, m_Orient, m_Size, m_HJustify, m_VJustify, thickness, m_Italic, m_Bold ); } } else { aPlotter->Text( textpos, color, GetShownText(), m_Orient, m_Size, m_HJustify, m_VJustify, thickness, m_Italic, m_Bold ); } /* Draw graphic symbol for global or hierarchical labels */ CreateGraphicShape( Poly, m_Pos ); aPlotter->SetCurrentLineWidth( GetPenSize() ); if( Poly.size() ) aPlotter->PlotPoly( Poly, NO_FILL ); }
void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuffer ) const { wxSize size = GetSize(); if( IsMirrored() ) NEGATE( size.x ); s_cornerBuffer = &aCornerBuffer; EDA_COLOR_T color = BLACK; // not actually used, but needed by DrawGraphicText if( IsMultilineAllowed() ) { wxArrayString* list = wxStringSplit( GetText(), '\n' ); std::vector<wxPoint> positions; positions.reserve( list->Count() ); GetPositionsOfLinesOfMultilineText( positions, list->Count() ); for( unsigned ii = 0; ii < list->Count(); ii++ ) { wxString txt = list->Item( ii ); DrawGraphicText( NULL, NULL, positions[ii], color, txt, GetOrientation(), size, GetHorizJustify(), GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToBuffer ); } delete list; } else { DrawGraphicText( NULL, NULL, GetTextPosition(), color, GetText(), GetOrientation(), size, GetHorizJustify(), GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToBuffer ); } }