本文整理汇总了C++中TEXTE_MODULE::GetPos0方法的典型用法代码示例。如果您正苦于以下问题:C++ TEXTE_MODULE::GetPos0方法的具体用法?C++ TEXTE_MODULE::GetPos0怎么用?C++ TEXTE_MODULE::GetPos0使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEXTE_MODULE
的用法示例。
在下文中一共展示了TEXTE_MODULE::GetPos0方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveAnchorPosition
void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
{
/* Move the reference point of the footprint
* the footprints elements (pads, outlines, edges .. ) are moved
* but:
* - the footprint position is not modified.
* - the relative (local) coordinates of these items are modified
*/
wxPoint footprintPos = GetPosition();
/* Update the relative coordinates:
* The coordinates are relative to the anchor point.
* Calculate deltaX and deltaY from the anchor. */
wxPoint moveVector = aMoveVector;
RotatePoint( &moveVector, -GetOrientation() );
// Update of the reference and value.
m_Reference->SetPos0( m_Reference->GetPos0() + moveVector );
m_Reference->SetDrawCoord();
m_Value->SetPos0( m_Value->GetPos0() + moveVector );
m_Value->SetDrawCoord();
// Update the pad local coordinates.
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
{
pad->SetPos0( pad->GetPos0() + moveVector );
pad->SetPosition( pad->GetPos0() + footprintPos );
}
// Update the draw element coordinates.
for( EDA_ITEM* item = GraphicalItems(); item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
edge->m_Start0 += moveVector;
edge->m_End0 += moveVector;
edge->SetDrawCoord();
break;
}
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
text->SetPos0( text->GetPos0() + moveVector );
text->SetDrawCoord();
break;
}
default:
break;
}
}
CalculateBoundingBox();
}
示例2: MoveMarkedItems
/* Move marked items, at new position = old position + offset
*/
void MoveMarkedItems( MODULE* module, wxPoint offset )
{
EDA_ITEM* item;
if( module == NULL )
return;
D_PAD* pad = module->Pads();
for( ; pad != NULL; pad = pad->Next() )
{
if( !pad->IsSelected() )
continue;
pad->SetPosition( pad->GetPosition() + offset );
pad->SetPos0( pad->GetPos0() + offset );
}
item = module->GraphicalItems();
for( ; item != NULL; item = item->Next() )
{
if( !item->IsSelected() )
continue;
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tm->Offset( offset );
tm->SetPos0( tm->GetPos0() + offset );
}
break;
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
em->SetStart( em->GetStart() + offset );
em->SetEnd( em->GetEnd() + offset );
em->SetStart0( em->GetStart0() + offset );
em->SetEnd0( em->GetEnd0() + offset );
}
break;
default:
;
}
item->ClearFlags();
}
}
示例3: MirrorMarkedItems
/** Mirror marked items, refer to a Vertical axis at position offset
* Note: because this function is used in global transform,
* if force_all is true, all items will be mirrored
*/
void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all )
{
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
wxPoint tmp;
wxSize tmpz;
if( module == NULL )
return;
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
{
// Skip pads not selected, i.e. not inside the block to mirror:
if( !pad->IsSelected() && !force_all )
continue;
tmp = pad->GetPosition();
SETMIRROR( tmp.x );
pad->SetPosition( tmp );
pad->SetX0( pad->GetPosition().x );
tmp = pad->GetOffset();
NEGATE( tmp.x );
pad->SetOffset( tmp );
tmpz = pad->GetDelta();
NEGATE( tmpz.x );
pad->SetDelta( tmpz );
pad->SetOrientation( 1800 - pad->GetOrientation() );
}
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
{
// Skip items not selected, i.e. not inside the block to mirror:
if( !item->IsSelected() && !force_all )
continue;
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
tmp = em->GetStart0();
SETMIRROR( tmp.x );
em->SetStart0( tmp );
em->SetStartX( tmp.x );
tmp = em->GetEnd0();
SETMIRROR( tmp.x );
em->SetEnd0( tmp );
em->SetEndX( tmp.x );
em->SetAngle( -em->GetAngle() );
}
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tmp = tm->GetTextPosition();
SETMIRROR( tmp.x );
tm->SetTextPosition( tmp );
tmp.y = tm->GetPos0().y;
tm->SetPos0( tmp );
}
break;
default:
break;
}
item->ClearFlags();
}
}
示例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: CreateComponentsSection
/* Creates the section $COMPONENTS (Footprints placement)
* Bottom side components are difficult to handle: shapes must be mirrored or
* flipped, silk layers need to be handled correctly and so on. Also it seems
* that *noone* follows the specs...
*/
static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
{
fputs( "$COMPONENTS\n", aFile );
int cu_count = aPcb->GetCopperLayerCount();
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
const char* mirror;
const char* flip;
double fp_orient = module->GetOrientation();
if( module->GetFlag() )
{
mirror = "0";
flip = "FLIP";
NEGATE_AND_NORMALIZE_ANGLE_POS( fp_orient );
}
else
{
mirror = "0";
flip = "0";
}
fprintf( aFile, "\nCOMPONENT %s\n",
TO_UTF8( module->GetReference() ) );
fprintf( aFile, "DEVICE %s_%s\n",
TO_UTF8( module->GetReference() ),
TO_UTF8( module->GetValue() ) );
fprintf( aFile, "PLACE %g %g\n",
MapXTo( module->GetPosition().x ),
MapYTo( module->GetPosition().y ) );
fprintf( aFile, "LAYER %s\n",
(module->GetFlag()) ? "BOTTOM" : "TOP" );
fprintf( aFile, "ROTATION %g\n",
fp_orient / 10.0 );
fprintf( aFile, "SHAPE %s %s %s\n",
TO_UTF8( module->GetReference() ),
mirror, flip );
// Text on silk layer: RefDes and value (are they actually useful?)
TEXTE_MODULE *textmod = &module->Reference();
for( int ii = 0; ii < 2; ii++ )
{
double txt_orient = textmod->GetOrientation();
std::string layer = GenCADLayerName( cu_count, module->GetFlag() ? B_SilkS : F_SilkS );
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
textmod->GetPos0().x / SCALE_FACTOR,
-textmod->GetPos0().y / SCALE_FACTOR,
textmod->GetSize().x / SCALE_FACTOR,
txt_orient / 10.0,
mirror,
layer.c_str(),
TO_UTF8( textmod->GetText() ) );
// Please note, the width is approx
fprintf( aFile, " 0 0 %g %g\n",
( textmod->GetSize().x * textmod->GetLength() ) / SCALE_FACTOR,
textmod->GetSize().y / SCALE_FACTOR );
textmod = &module->Value(); // Dirty trick for the second iteration
}
// The SHEET is a 'generic description' for referencing the component
fprintf( aFile, "SHEET \"RefDes: %s, Value: %s\"\n",
TO_UTF8( module->GetReference() ),
TO_UTF8( module->GetValue() ) );
}
fputs( "$ENDCOMPONENTS\n\n", aFile );
}