示例#1
0
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 );
}
bool CDrawingObject::setParam(DrawinObjectParamName paramID, const CSimpleVariant &val)
{
	switch (paramID)
	{
		case DOP_COLOR:
			SetColor( val.GetColorVal() );
			return true;
		case DOP_HALOCOLOR:
			SetHaloColor( val.GetColorVal() );
			return true;
		case DOP_THICKNESS:
			SetThickness( val.GetFloatVal() );
			return true;
		case DOP_ROTATION:
			SetRotation( val.GetFloatVal() );
			return true;
		case DOP_ISSOLID:
			IsSolid( val.GetBoolVal() );
			return true;
		case DOP_HATCHED:
			DrawStippled( val.GetBoolVal() );
			return true;
		case DOP_WIDTH:
			setWidth(val.GetFloatVal());
			return true;
		case DOP_HEIGHT:
			setHeight(val.GetFloatVal());
			return true;
		case DOP_CENTER:
			SetCenter(val.GetPointfVal());
			return true;
	}

	return false;
}
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
    BOARD_ITEM( parent, PCB_MODULE_TEXT_T ),
    EDA_TEXT()
{
    MODULE* module = static_cast<MODULE*>( m_Parent );

    m_Type = text_type;
    m_unlocked = false;

    // Set text thickness to a default value
    SetThickness( Millimeter2iu( 0.15 ) );
    SetLayer( F_SilkS );

    // Set position and give a default layer if a valid parent footprint exists
    if( module && ( module->Type() == PCB_MODULE_T ) )
    {
        SetTextPos( module->GetPosition() );

        if( IsBackLayer( module->GetLayer() ) )
        {
            SetLayer( B_SilkS );
            SetMirrored( true );
        }
    }

    SetDrawCoord();
}
示例#4
0
void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset )
{
    COLOR4D     color = GetLayerColor( m_Layer );
    int         linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
    EDA_RECT*   clipbox = panel? panel->GetClipBox() : NULL;

    linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );

    wxPoint text_offset = aOffset + GetSchematicTextOffset();

    int savedWidth = GetThickness();
    SetThickness( linewidth );              // Set the minimum width

    EDA_TEXT::Draw( clipbox, DC, text_offset, color, GR_DEFAULT_DRAWMODE );

    SetThickness( savedWidth );
}
示例#5
0
CPolyLineDrawing::CPolyLineDrawing(int Thickness, COLORREF lineColor, COLORREF fillColor, CPoint startpt)
{
	vXYpoints.push_back(startpt);
	SetType("PolyLine");
	SetThickness(Thickness);
	SetLineColor(lineColor);
	SetFillColor(fillColor);
}
void CDrawingObject::_init(DrawingObjectType type)
{
	SetType(type);
	SetRotation(0);
	IsSolid(true);
	DrawHalo(true);
	DrawStippled(false);
	SetThickness(1.5f);
	SetHaloColor(floatColor(1.0f, 1.0f, 1.0f));
	m_bSelected = false;
	m_pParent = nullptr;
}
示例#7
0
void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset )
{
    static std::vector <wxPoint> Poly;
    COLOR4D color = GetLayerColor( m_Layer );
    wxPoint text_offset = aOffset + GetSchematicTextOffset();

    int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();

    linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );

    int save_width = GetThickness();
    SetThickness( linewidth );

    EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
    EDA_TEXT::Draw( clipbox, DC, text_offset, color, GR_DEFAULT_DRAWMODE );

    SetThickness( save_width );   // restore initial value

    CreateGraphicShape( Poly, GetTextPos() + aOffset );
    GRPoly( clipbox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
}