本文整理汇总了C++中TEXTE_MODULE::GetThickness方法的典型用法代码示例。如果您正苦于以下问题:C++ TEXTE_MODULE::GetThickness方法的具体用法?C++ TEXTE_MODULE::GetThickness怎么用?C++ TEXTE_MODULE::GetThickness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEXTE_MODULE
的用法示例。
在下文中一共展示了TEXTE_MODULE::GetThickness方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TransformGraphicTextWithClearanceToPolygonSet
// Same as function TransformGraphicShapesWithClearanceToPolygonSet but
// this only render text
void MODULE::TransformGraphicTextWithClearanceToPolygonSet(
PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError ) const
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
for( EDA_ITEM* item = GraphicalItemsList(); item != NULL; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
if( text->GetLayer() == aLayer && text->IsVisible() )
texts.push_back( text );
break;
}
case PCB_MODULE_EDGE_T:
// This function does not render this
break;
default:
break;
}
}
// Convert texts sur modules
if( Reference().GetLayer() == aLayer && Reference().IsVisible() )
texts.push_back( &Reference() );
if( Value().GetLayer() == aLayer && Value().IsVisible() )
texts.push_back( &Value() );
prms.m_cornerBuffer = &aCornerBuffer;
for( unsigned ii = 0; ii < texts.size(); ii++ )
{
TEXTE_MODULE *textmod = texts[ii];
prms.m_textWidth = textmod->GetThickness() + ( 2 * aInflateValue );
prms.m_error = aError;
wxSize size = textmod->GetTextSize();
if( textmod->IsMirrored() )
size.x = -size.x;
DrawGraphicText( NULL, NULL, textmod->GetTextPos(), BLACK,
textmod->GetShownText(), textmod->GetDrawRotation(), size,
textmod->GetHorizJustify(), textmod->GetVertJustify(),
textmod->GetThickness(), textmod->IsItalic(),
true, addTextSegmToPoly, &prms );
}
}
示例2: ResetTextSize
void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
{
wxSize newSize;
int newThickness;
if( aItem->Type() == PCB_TEXT_T )
{
newSize = GetDesignSettings().m_PcbTextSize;
newThickness = GetDesignSettings().m_PcbTextWidth;
TEXTE_PCB* text = static_cast<TEXTE_PCB*>( aItem );
// Exit if there's nothing to do
if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
return;
SaveCopyInUndoList( text, UR_CHANGED );
text->SetTextSize( newSize );
text->SetThickness( newThickness );
}
else if( aItem->Type() == PCB_MODULE_TEXT_T )
{
newSize = GetDesignSettings().m_ModuleTextSize;
newThickness = GetDesignSettings().m_ModuleTextWidth;
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem );
// Exit if there's nothing to do
if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
return;
SaveCopyInUndoList( text->GetParent(), UR_CHANGED );
text->SetTextSize( newSize );
text->SetThickness( newThickness );
}
else
return;
if( aDC )
m_canvas->Refresh();
OnModify();
}
示例3: ResetModuleTextSizes
void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
bool aValue, bool aOthers )
{
BOARD_COMMIT commit( this );
int modTextWidth = GetDesignSettings().m_ModuleTextWidth;
const wxSize& modTextSize = GetDesignSettings().m_ModuleTextSize;
bool modified = false;
// Change fields of footprints with fpid matching the filter
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
if( !aFilter.IsEmpty() )
{
if( ! WildCompareString( aFilter, FROM_UTF8( module->GetFPID().Format().c_str() ),
false ) )
continue;
}
if( aRef )
{
TEXTE_MODULE* item = &module->Reference();
if( item->GetTextSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
commit.Modify( item );
item->SetThickness( modTextWidth );
item->SetTextSize( modTextSize );
modified = true;
}
}
if( aValue )
{
TEXTE_MODULE* item = &module->Value();
if( item->GetTextSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
commit.Modify( item );
item->SetThickness( modTextWidth );
item->SetTextSize( modTextSize );
modified = true;
}
}
if( aOthers )
{
// Go through all other module text fields
for( BOARD_ITEM* boardItem = module->GraphicalItemsList(); boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
TEXTE_MODULE* item = static_cast<TEXTE_MODULE*>( boardItem );
if( item->GetTextSize() != GetDesignSettings().m_ModuleTextSize
|| item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
commit.Modify( item );
item->SetThickness( modTextWidth );
item->SetTextSize( modTextSize );
modified = true;
}
}
}
}
}
if( modified )
{
commit.Push( "Reset module text size" );
GetCanvas()->Refresh();
}
}
示例4: initDlg
void DialogEditModuleText::initDlg( )
{
SetFocus();
wxString msg;
if( m_module )
{
wxString format = m_ModuleInfoText->GetLabel();
msg.Printf( format,
GetChars( m_module->GetReference() ),
GetChars( m_module->GetValue() ),
m_module->GetOrientation() / 10.0 );
}
else
{
msg.Empty();
}
m_ModuleInfoText->SetLabel( msg );
switch( m_currentText->GetType() )
{
case TEXTE_MODULE::TEXT_is_VALUE:
m_TextDataTitle->SetLabel( _( "Value:" ) );
break;
case TEXTE_MODULE::TEXT_is_DIVERS:
m_TextDataTitle->SetLabel( _( "Text:" ) );
break;
default:
m_TextDataTitle->SetLabel( _( "Reference:" ) );
break;
}
m_Name->SetValue( m_currentText->GetText() );
m_Style->SetSelection( m_currentText->IsItalic() ? 1 : 0 );
AddUnitSymbol( *m_SizeXTitle );
PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->GetSize().x );
AddUnitSymbol( *m_SizeYTitle );
PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->GetSize().y );
AddUnitSymbol( *m_PosXTitle );
PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x );
AddUnitSymbol( *m_PosYTitle );
PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y );
AddUnitSymbol( *m_WidthTitle );
PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() );
double text_orient = m_currentText->GetOrientation();
NORMALIZE_ANGLE_90( text_orient );
if( (text_orient != 0) )
m_Orient->SetSelection( 1 );
if( !m_currentText->IsVisible() )
m_Show->SetSelection( 1 );;
}
示例5: ResetModuleTextSizes
void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
bool aValue, bool aOthers )
{
MODULE* module;
BOARD_ITEM* boardItem;
ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
PICKED_ITEMS_LIST undoItemList;
unsigned int ii;
// Prepare undo list
for( module = GetBoard()->m_Modules; module; module = module->Next() )
{
itemWrapper.SetItem( module );
if( ! aFilter.IsEmpty() )
{
if( ! WildCompareString( aFilter, FROM_UTF8( module->GetFPID().Format().c_str() ),
false ) )
continue;
}
if( aRef )
{
TEXTE_MODULE *item = &module->Reference();
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
undoItemList.PushItem( itemWrapper );
}
}
if( aValue )
{
TEXTE_MODULE *item = &module->Value();
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
undoItemList.PushItem( itemWrapper );
}
}
if( aOthers )
{
// Go through all other module text fields
for( boardItem = module->GraphicalItems(); boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
TEXTE_MODULE *item = static_cast<TEXTE_MODULE*>( boardItem );
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize
|| item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
undoItemList.PushItem( itemWrapper );
}
}
}
}
}
// Exit if there's nothing to do
if( !undoItemList.GetCount() )
return;
SaveCopyInUndoList( undoItemList, UR_CHANGED );
// Apply changes to modules in the undo list
for( ii = 0; ii < undoItemList.GetCount(); ii++ )
{
module = (MODULE*) undoItemList.GetPickedItem( ii );
if( aRef )
{
module->Reference().SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->Reference().SetSize( GetDesignSettings().m_ModuleTextSize );
}
if( aValue )
{
module->Value().SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->Value().SetSize( GetDesignSettings().m_ModuleTextSize );
}
if( aOthers )
{
for( boardItem = module->GraphicalItems(); boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
TEXTE_MODULE *item = static_cast<TEXTE_MODULE*>( boardItem );
item->SetThickness( GetDesignSettings().m_ModuleTextWidth );
item->SetSize( GetDesignSettings().m_ModuleTextSize );
}
}
}
}
//.........这里部分代码省略.........
示例6: TransformGraphicShapesWithClearanceToPolygonSet
/* generate shapes of graphic items (outlines) on layer aLayer as polygons,
* and adds these polygons to aCornerBuffer
* aCornerBuffer = the buffer to store polygons
* aInflateValue = a value to inflate shapes
* aCircleToSegmentsCount = number of segments to approximate a circle
* aCorrectionFactor = the correction to apply to the circle radius
* to generate the polygon.
* if aCorrectionFactor = 1.0, the polygon is inside the circle
* the radius of circle approximated by segments is
* initial radius * aCorrectionFactor
*/
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
int aCircleToSegmentsCountForTexts )
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
EDGE_MODULE* outline;
for( EDA_ITEM* item = GraphicalItems(); item != NULL; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
if( text->GetLayer() == aLayer && text->IsVisible() )
texts.push_back( text );
break;
}
case PCB_MODULE_EDGE_T:
outline = (EDGE_MODULE*) item;
if( outline->GetLayer() != aLayer )
break;
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer,
0,
aCircleToSegmentsCount,
aCorrectionFactor );
break;
default:
break;
}
}
// Convert texts sur modules
if( Reference().GetLayer() == aLayer && Reference().IsVisible() )
texts.push_back( &Reference() );
if( Value().GetLayer() == aLayer && Value().IsVisible() )
texts.push_back( &Value() );
s_cornerBuffer = &aCornerBuffer;
// To allow optimization of circles approximated by segments,
// aCircleToSegmentsCountForTexts, when not 0, is used.
// if 0 (default value) the aCircleToSegmentsCount is used
s_textCircle2SegmentCount = aCircleToSegmentsCountForTexts ?
aCircleToSegmentsCountForTexts : aCircleToSegmentsCount;
for( unsigned ii = 0; ii < texts.size(); ii++ )
{
TEXTE_MODULE *textmod = texts[ii];
s_textWidth = textmod->GetThickness() + ( 2 * aInflateValue );
wxSize size = textmod->GetSize();
if( textmod->IsMirrored() )
size.x = -size.x;
DrawGraphicText( NULL, NULL, textmod->GetTextPosition(), BLACK,
textmod->GetShownText(), textmod->GetDrawRotation(), size,
textmod->GetHorizJustify(), textmod->GetVertJustify(),
textmod->GetThickness(), textmod->IsItalic(),
true, addTextSegmToPoly );
}
}