本文整理汇总了C++中D_PAD::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ D_PAD::GetPosition方法的具体用法?C++ D_PAD::GetPosition怎么用?C++ D_PAD::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类D_PAD
的用法示例。
在下文中一共展示了D_PAD::GetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testUnconnected
void DRC::testUnconnected()
{
if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
wxClientDC dc( m_pcbEditorFrame->GetCanvas() );
m_pcbEditorFrame->Compile_Ratsnest( &dc, true );
}
if( m_pcb->GetRatsnestsCount() == 0 )
return;
wxString msg;
for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii )
{
RATSNEST_ITEM& rat = m_pcb->m_FullRatsnest[ii];
if( (rat.m_Status & CH_ACTIF) == 0 )
continue;
D_PAD* padStart = rat.m_PadStart;
D_PAD* padEnd = rat.m_PadEnd;
msg = padStart->GetSelectMenuText() + wxT( " net " ) + padStart->GetNetname();
DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS,
msg,
padEnd->GetSelectMenuText(),
padStart->GetPosition(), padEnd->GetPosition() );
m_unconnected.push_back( uncItem );
}
}
示例2: build_pad_testpoints
/* Extract the D356 record from the modules (pads) */
static void build_pad_testpoints( BOARD *aPcb,
std::vector <D356_RECORD>& aRecords )
{
wxPoint origin = aPcb->GetAuxOrigin();
for( MODULE *module = aPcb->m_Modules;
module; module = module->Next() )
{
for( D_PAD *pad = module->Pads(); pad; pad = pad->Next() )
{
D356_RECORD rk;
rk.access = compute_pad_access_code( aPcb, pad->GetLayerSet() );
// It could be a mask only pad, we only handle pads with copper here
if( rk.access != -1 )
{
rk.netname = pad->GetNetname();
rk.refdes = module->GetReference();
pad->StringPadName( rk.pin );
rk.midpoint = false; // XXX MAYBE need to be computed (how?)
const wxSize& drill = pad->GetDrillSize();
rk.drill = std::min( drill.x, drill.y );
rk.hole = (rk.drill != 0);
rk.smd = pad->GetAttribute() == PAD_ATTRIB_SMD;
rk.mechanical = (pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED);
rk.x_location = pad->GetPosition().x - origin.x;
rk.y_location = origin.y - pad->GetPosition().y;
rk.x_size = pad->GetSize().x;
// Rule: round pads have y = 0
if( pad->GetShape() == PAD_SHAPE_CIRCLE )
rk.y_size = 0;
else
rk.y_size = pad->GetSize().y;
rk.rotation = -KiROUND( pad->GetOrientation() ) / 10;
if( rk.rotation < 0 ) rk.rotation += 360;
// the value indicates which sides are *not* accessible
rk.soldermask = 3;
if( pad->GetLayerSet()[F_Mask] )
rk.soldermask &= ~1;
if( pad->GetLayerSet()[B_Mask] )
rk.soldermask &= ~2;
aRecords.push_back( rk );
}
}
}
}
示例3: SearchTracksConnectedToPads
/* Explores the list of pads
* Adds to m_PadsConnected member of each track the pad(s) connected to
* Adds to m_TracksConnected member of each pad the track(s) connected to
* D_PAD::m_TracksConnected is cleared before adding items
* TRACK::m_PadsConnected is not cleared
*/
void CONNECTIONS::SearchTracksConnectedToPads( bool add_to_padlist, bool add_to_tracklist)
{
std::vector<CONNECTED_POINT*> candidates;
for( unsigned ii = 0; ii < m_sortedPads.size(); ii++ )
{
D_PAD * pad = m_sortedPads[ii];
pad->m_TracksConnected.clear();
candidates.clear();
CollectItemsNearTo( candidates, pad->GetPosition(), pad->GetBoundingRadius() );
// add this pad to track.m_PadsConnected, if it is connected
for( unsigned jj = 0; jj < candidates.size(); jj++ )
{
CONNECTED_POINT* cp_item = candidates[jj];
if( !( pad->GetLayerSet() & cp_item->GetTrack()->GetLayerSet() ).any() )
continue;
if( pad->HitTest( cp_item->GetPoint() ) )
{
if( add_to_padlist )
cp_item->GetTrack()->m_PadsConnected.push_back( pad );
if( add_to_tracklist )
pad->m_TracksConnected.push_back( cp_item->GetTrack() );
}
}
}
}
示例4: MarkItemsInBloc
/* Mark items inside rect.
* Items are inside rect when an end point is inside rect
*/
int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
{
EDA_ITEM* item;
int ItemsCount = 0;
wxPoint pos;
D_PAD* pad;
if( module == NULL )
return 0;
pad = module->Pads();
for( ; pad != NULL; pad = pad->Next() )
{
pad->ClearFlags( SELECTED );
pos = pad->GetPosition();
if( Rect.Contains( pos ) )
{
pad->SetFlags( SELECTED );
ItemsCount++;
}
}
item = module->GraphicalItems();
for( ; item != NULL; item = item->Next() )
{
item->ClearFlags( SELECTED );
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
if( ((EDGE_MODULE*)item )->HitTest( Rect ) )
{
item->SetFlags( SELECTED );
ItemsCount++;
}
break;
case PCB_MODULE_TEXT_T:
pos = ( (TEXTE_MODULE*) item )->GetTextPosition();
if( Rect.Contains( pos ) )
{
item->SetFlags( SELECTED );
ItemsCount++;
}
break;
default:
break;
}
}
return ItemsCount;
}
示例5: MoveMarkedItems
/* Move marked items, at new position = old position + offset
*/
void MoveMarkedItems( MODULE* module, wxPoint offset )
{
EDA_ITEM* item;
if( module == NULL )
return;
if( module->Reference().IsSelected() )
module->Reference().Move( offset );
if( module->Value().IsSelected() )
module->Value().Move( offset );
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:
static_cast<TEXTE_MODULE*>( item )->Move( 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:
;
}
}
ClearMarkItems( module );
}
示例6: BuildPadsCandidatesList
void CONNECTIONS::BuildPadsCandidatesList()
{
m_candidates.clear();
m_candidates.reserve( m_sortedPads.size() );
for( unsigned ii = 0; ii < m_sortedPads.size(); ii++ )
{
D_PAD * pad = m_sortedPads[ii];
CONNECTED_POINT candidate( pad, pad->GetPosition() );
m_candidates.push_back( candidate );
}
}
示例7: 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();
}
}
示例8: PlotDrillMarks
void BRDITEMS_PLOTTER::PlotDrillMarks()
{
/* If small drills marks were requested prepare a clamp value to pass
to the helper function */
int small_drill = (GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) ?
SMALL_DRILL : 0;
/* In the filled trace mode drill marks are drawn white-on-black to scrape
the underlying pad. This works only for drivers supporting color change,
obviously... it means that:
- PS, SVG and PDF output is correct (i.e. you have a 'donut' pad)
- In HPGL you can't see them
- In gerbers you can't see them, too. This is arguably the right thing to
do since having drill marks and high speed drill stations is a sure
recipe for broken tools and angry manufacturers. If you *really* want them
you could start a layer with negative polarity to scrape the film.
- In DXF they go into the 'WHITE' layer. This could be useful.
*/
if( GetMode() == FILLED )
m_plotter->SetColor( WHITE );
for( TRACK *pts = m_board->m_Track; pts != NULL; pts = pts->Next() )
{
const VIA* via = dyn_cast<const VIA*>( pts );
if( via )
plotOneDrillMark( PAD_DRILL_CIRCLE, via->GetStart(),
wxSize( via->GetDrillValue(), 0 ),
wxSize( via->GetWidth(), 0 ), 0, small_drill );
}
for( MODULE *Module = m_board->m_Modules; Module != NULL; Module = Module->Next() )
{
for( D_PAD *pad = Module->Pads(); pad != NULL; pad = pad->Next() )
{
if( pad->GetDrillSize().x == 0 )
continue;
plotOneDrillMark( pad->GetDrillShape(),
pad->GetPosition(), pad->GetDrillSize(),
pad->GetSize(), pad->GetOrientation(),
small_drill );
}
}
if( GetMode() == FILLED )
m_plotter->SetColor( GetColor() );
}
示例9: AddPad
/* Add a new pad to aModule.
*/
void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
{
m_Pcb->m_Status_Pcb = 0;
aModule->SetLastEditTime();
D_PAD* pad = new D_PAD( aModule );
// Add the new pad to end of the module pad list.
aModule->Pads().PushBack( pad );
// Update the pad properties,
// and keep NETINFO_LIST::ORPHANED as net info
// which is the default when nets cannot be handled.
Import_Pad_Settings( pad, false );
pad->SetPosition( GetCrossHairPosition() );
// Set the relative pad position
// ( pad position for module orient, 0, and relative to the module position)
wxPoint pos0 = pad->GetPosition() - aModule->GetPosition();
RotatePoint( &pos0, -aModule->GetOrientation() );
pad->SetPos0( pos0 );
/* NPTH pads take empty pad number (since they can't be connected),
* other pads get incremented from the last one edited */
wxString padName;
if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
{
padName = GetNextPadName( GetDesignSettings()
.m_Pad_Master.GetPadName() );
}
pad->SetPadName( padName );
GetDesignSettings().m_Pad_Master.SetPadName( padName );
aModule->CalculateBoundingBox();
SetMsgPanel( pad );
if( draw )
m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
}
示例10: SetPosition
void MODULE::SetPosition( const wxPoint& newpos )
{
wxPoint delta = newpos - m_Pos;
m_Pos += delta;
m_Reference->SetTextPosition( m_Reference->GetTextPosition() + delta );
m_Value->SetTextPosition( m_Value->GetTextPosition() + delta );
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
pad->SetPosition( pad->GetPosition() + delta );
}
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) item;
pt_edgmod->SetDrawCoord();
break;
}
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
text->SetTextPosition( text->GetTextPosition() + delta );
break;
}
default:
wxMessageBox( wxT( "Draw type undefined." ) );
break;
}
}
CalculateBoundingBox();
}
示例11: wxASSERT
void DRC::testPad2Pad()
{
std::vector<D_PAD*> sortedPads;
m_pcb->GetSortedPadListByXthenYCoord( sortedPads );
// find the max size of the pads (used to stop the test)
int max_size = 0;
for( unsigned i = 0; i < sortedPads.size(); ++i )
{
D_PAD* pad = sortedPads[i];
// GetBoundingRadius() is the radius of the minimum sized circle fully containing the pad
int radius = pad->GetBoundingRadius();
if( radius > max_size )
max_size = radius;
}
// Test the pads
D_PAD** listEnd = &sortedPads[ sortedPads.size() ];
for( unsigned i = 0; i< sortedPads.size(); ++i )
{
D_PAD* pad = sortedPads[i];
int x_limit = max_size + pad->GetClearance() +
pad->GetBoundingRadius() + pad->GetPosition().x;
if( !doPadToPadsDrc( pad, &sortedPads[i], listEnd, x_limit ) )
{
wxASSERT( m_currentMarker );
m_pcb->Add( m_currentMarker );
m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
m_currentMarker = 0;
}
}
}
示例12: TestForCopperIslandAndRemoveInsulatedIslands
void ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb )
{
if( m_FilledPolysList.GetCornersCount() == 0 )
return;
// Build a list of points connected to the net:
// list of coordinates of pads and vias on this layer and on this net.
std::vector <wxPoint> listPointsCandidates;
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
{
if( !pad->IsOnLayer( GetLayer() ) )
continue;
if( pad->GetNet() != GetNet() )
continue;
listPointsCandidates.push_back( pad->GetPosition() );
}
}
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{
if( !track->IsOnLayer( GetLayer() ) )
continue;
if( track->GetNet() != GetNet() )
continue;
listPointsCandidates.push_back( track->GetStart() );
if( track->Type() != PCB_VIA_T )
listPointsCandidates.push_back( track->GetEnd() );
}
// test if a point is inside
unsigned indexstart = 0, indexend;
bool connected = false;
for( indexend = 0; indexend < m_FilledPolysList.GetCornersCount(); indexend++ )
{
if( m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found
{
EDA_RECT bbox = CalculateSubAreaBoundaryBox( indexstart, indexend );
for( unsigned ic = 0; ic < listPointsCandidates.size(); ic++ )
{
// test if this area is connected to a board item:
wxPoint pos = listPointsCandidates[ic];
if( !bbox.Contains( pos ) )
continue;
if( TestPointInsidePolygon( m_FilledPolysList, indexstart, indexend,
pos.x, pos.y ) )
{
connected = true;
break;
}
}
if( connected ) // this polygon is connected: analyse next polygon
{
indexstart = indexend + 1; // indexstart points the first point of the next polygon
connected = false;
}
else // Not connected: remove this polygon
{
m_FilledPolysList.DeleteCorners( indexstart, indexend );
indexend = indexstart; /* indexstart points the first point of the next polygon
* because the current poly is removed */
}
}
}
}
示例13: RotateMarkedItems
/** Rotate marked items, refer to a rotation point at position offset
* Note: because this function is used in global transform,
* if force_all is true, all items will be rotated
*/
void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
{
#define ROTATE( z ) RotatePoint( (&z), offset, 900 )
if( module == NULL )
return;
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
{
if( !pad->IsSelected() && !force_all )
continue;
wxPoint pos = pad->GetPosition();
ROTATE( pos );
pad->SetPosition( pos );
pad->SetPos0( pad->GetPosition() );
pad->SetOrientation( pad->GetOrientation() + 900 );
}
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
{
if( !item->IsSelected() && !force_all)
continue;
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
wxPoint tmp = em->GetStart();
ROTATE( tmp );
em->SetStart( tmp );
em->SetStart0( tmp );
tmp = em->GetEnd();
ROTATE( tmp );
em->SetEnd( tmp );
em->SetEnd0( tmp );
}
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
wxPoint pos = tm->GetTextPosition();
ROTATE( pos );
tm->SetTextPosition( pos );
tm->SetPos0( tm->GetTextPosition() );
tm->SetOrientation( tm->GetOrientation() + 900 );
}
break;
default:
;
}
item->ClearFlags();
}
}
示例14: 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();
}
}
示例15: Build_Holes_List
//.........这里部分代码省略.........
if( track->Type() != PCB_VIA_T )
continue;
SEGVIA* via = (SEGVIA*) track;
hole_value = via->GetDrillValue();
if( hole_value == 0 )
continue;
new_hole.m_Tool_Reference = -1; // Flag value for Not initialized
new_hole.m_Hole_Orient = 0;
new_hole.m_Hole_Diameter = hole_value;
new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter;
new_hole.m_Hole_Shape = 0; // hole shape: round
new_hole.m_Hole_Pos = via->m_Start;
via->ReturnLayerPair( &new_hole.m_Hole_Top_Layer, &new_hole.m_Hole_Bottom_Layer );
// ReturnLayerPair return params with m_Hole_Bottom_Layer < m_Hole_Top_Layer
if( (new_hole.m_Hole_Bottom_Layer > aFirstLayer) && (aFirstLayer >= 0) )
continue;
if( (new_hole.m_Hole_Top_Layer < aLastLayer) && (aLastLayer >= 0) )
continue;
if( aExcludeThroughHoles && (new_hole.m_Hole_Bottom_Layer == LAYER_N_BACK)
&& (new_hole.m_Hole_Top_Layer == LAYER_N_FRONT) )
continue;
aHoleListBuffer.push_back( new_hole );
}
}
// build hole list for pads (assumed always through holes)
if( !aExcludeThroughHoles || aGenerateNPTH_list )
{
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
// Read and analyse pads
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
if( ! aGenerateNPTH_list && pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
continue;
if( aGenerateNPTH_list && pad->GetAttribute() != PAD_HOLE_NOT_PLATED )
continue;
if( pad->GetDrillSize().x == 0 )
continue;
new_hole.m_Hole_NotPlated = (pad->GetAttribute() == PAD_HOLE_NOT_PLATED);
new_hole.m_Tool_Reference = -1; // Flag is: Not initialized
new_hole.m_Hole_Orient = pad->GetOrientation();
new_hole.m_Hole_Shape = 0; // hole shape: round
new_hole.m_Hole_Diameter = std::min( pad->GetDrillSize().x, pad->GetDrillSize().y );
new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter;
if( pad->GetDrillShape() != PAD_CIRCLE )
new_hole.m_Hole_Shape = 1; // oval flag set
new_hole.m_Hole_Size = pad->GetDrillSize();
new_hole.m_Hole_Pos = pad->GetPosition(); // hole position
new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK;
new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes
aHoleListBuffer.push_back( new_hole );
}
}
}
// Sort holes per increasing diameter value
sort( aHoleListBuffer.begin(), aHoleListBuffer.end(), CmpHoleDiameterValue );
// build the tool list
int LastHole = -1; /* Set to not initialised (this is a value not used
* for aHoleListBuffer[ii].m_Hole_Diameter) */
DRILL_TOOL new_tool( 0 );
unsigned jj;
for( unsigned ii = 0; ii < aHoleListBuffer.size(); ii++ )
{
if( aHoleListBuffer[ii].m_Hole_Diameter != LastHole )
{
new_tool.m_Diameter = ( aHoleListBuffer[ii].m_Hole_Diameter );
aToolListBuffer.push_back( new_tool );
LastHole = new_tool.m_Diameter;
}
jj = aToolListBuffer.size();
if( jj == 0 )
continue; // Should not occurs
aHoleListBuffer[ii].m_Tool_Reference = jj; // Tool value Initialized (value >= 1)
aToolListBuffer.back().m_TotalCount++;
if( aHoleListBuffer[ii].m_Hole_Shape )
aToolListBuffer.back().m_OvalCount++;
}
}