本文整理汇总了C++中EDA_RECT::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ EDA_RECT::GetSize方法的具体用法?C++ EDA_RECT::GetSize怎么用?C++ EDA_RECT::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDA_RECT
的用法示例。
在下文中一共展示了EDA_RECT::GetSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Show
bool DIALOG_SHIM::Show( bool show )
{
bool ret;
const char* hash_key;
if( m_hash_key.size() )
{
// a special case like EDA_LIST_DIALOG, which has multiple uses.
hash_key = m_hash_key.c_str();
}
else
{
hash_key = typeid(*this).name();
}
// Show or hide the window. If hiding, save current position and size.
// If showing, use previous position and size.
if( show )
{
wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
ret = wxDialog::Show( show );
// classname is key, returns a zeroed out default EDA_RECT if none existed before.
EDA_RECT r = class_map[ hash_key ];
if( r.GetSize().x != 0 && r.GetSize().y != 0 )
SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
}
else
{
// Save the dialog's position & size before hiding, using classname as key
EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
class_map[ hash_key ] = r;
ret = wxDialog::Show( show );
}
return ret;
}
示例2: GetSolderMaskMargin
const BOX2I D_PAD::ViewBBox() const
{
// Bounding box includes soldermask too
int solderMaskMargin = GetSolderMaskMargin();
VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() );
EDA_RECT bbox = GetBoundingBox();
// Look for the biggest possible bounding box
int xMargin = std::max( solderMaskMargin, solderPasteMargin.x );
int yMargin = std::max( solderMaskMargin, solderPasteMargin.y );
return BOX2I( VECTOR2I( bbox.GetOrigin() ) - VECTOR2I( xMargin, yMargin ),
VECTOR2I( bbox.GetSize() ) + VECTOR2I( 2 * xMargin, 2 * yMargin ) );
}
示例3: GetFootprintRect
const BOX2I MODULE::ViewBBox() const
{
EDA_RECT fpRect = GetFootprintRect();
return BOX2I( VECTOR2I( fpRect.GetOrigin() ), VECTOR2I( fpRect.GetSize() ) );
}
示例4: idf_export_outline
//.........这里部分代码省略.........
// if there is no outline then use the bounding box
if( lines.empty() )
{
goto UseBoundingBox;
}
// get the board outline and write it out
// note: we do not use a try/catch block here since we intend
// to simply ignore unclosed loops and continue processing
// until we're out of segments to process
outline = new IDF_OUTLINE;
IDF3::GetOutline( lines, *outline );
if( outline->empty() )
goto UseBoundingBox;
aIDFBoard.AddBoardOutline( outline );
outline = NULL;
// get all cutouts and write them out
while( !lines.empty() )
{
if( !outline )
outline = new IDF_OUTLINE;
IDF3::GetOutline( lines, *outline );
if( outline->empty() )
{
outline->Clear();
continue;
}
aIDFBoard.AddBoardOutline( outline );
outline = NULL;
}
return;
UseBoundingBox:
// clean up if necessary
while( !lines.empty() )
{
delete lines.front();
lines.pop_front();
}
if( outline )
outline->Clear();
else
outline = new IDF_OUTLINE;
// fetch a rectangular bounding box for the board;
// there is always some uncertainty in the board dimensions
// computed via ComputeBoundingBox() since this depends on the
// individual module entities.
EDA_RECT bbbox = aPcb->ComputeBoundingBox( true );
// convert to mm and compensate for an assumed LINE_WIDTH line thickness
double x = ( bbbox.GetOrigin().x + LINE_WIDTH / 2 ) * scale + offX;
double y = ( bbbox.GetOrigin().y + LINE_WIDTH / 2 ) * scale + offY;
double dx = ( bbbox.GetSize().x - LINE_WIDTH ) * scale;
double dy = ( bbbox.GetSize().y - LINE_WIDTH ) * scale;
double px[4], py[4];
px[0] = x;
py[0] = y;
px[1] = x;
py[1] = y + dy;
px[2] = x + dx;
py[2] = y + dy;
px[3] = x + dx;
py[3] = y;
IDF_POINT p1, p2;
p1.x = px[3];
p1.y = py[3];
p2.x = px[0];
p2.y = py[0];
outline->push( new IDF_SEGMENT( p1, p2 ) );
for( int i = 1; i < 4; ++i )
{
p1.x = px[i - 1];
p1.y = py[i - 1];
p2.x = px[i];
p2.y = py[i];
outline->push( new IDF_SEGMENT( p1, p2 ) );
}
aIDFBoard.AddBoardOutline( outline );
}
示例5: GetBoundingBox
const BOX2I GERBER_DRAW_ITEM::ViewBBox() const
{
EDA_RECT bbox = GetBoundingBox();
return BOX2I( VECTOR2I( bbox.GetOrigin() ),
VECTOR2I( bbox.GetSize() ) );
}
示例6: AppendBoardFile
//.........这里部分代码省略.........
if( bboxInit )
bbox = track->GetBoundingBox();
else
bbox.Merge( track->GetBoundingBox() );
bboxInit = false;
}
if( module )
module = module->Next();
else
module = GetBoard()->m_Modules;
for( ; module; module = module->Next() )
{
module->SetFlags( IS_MOVED );
picker.SetItem( module );
undoListPicker.PushItem( picker );
blockitemsList.PushItem( picker );
if( bboxInit )
bbox = module->GetBoundingBox();
else
bbox.Merge( module->GetBoundingBox() );
bboxInit = false;
}
if( drawing )
drawing = drawing->Next();
else
drawing = GetBoard()->m_Drawings;
for( ; drawing; drawing = drawing->Next() )
{
drawing->SetFlags( IS_MOVED );
picker.SetItem( drawing );
undoListPicker.PushItem( picker );
blockitemsList.PushItem( picker );
if( bboxInit )
bbox = drawing->GetBoundingBox();
else
bbox.Merge( drawing->GetBoundingBox() );
bboxInit = false;
}
for( ZONE_CONTAINER* zone = GetBoard()->GetArea( zonescount ); zone;
zone = GetBoard()->GetArea( zonescount ) )
{
zone->SetFlags( IS_MOVED );
picker.SetItem( zone );
undoListPicker.PushItem( picker );
blockitemsList.PushItem( picker );
zonescount++;
if( bboxInit )
bbox = zone->GetBoundingBox();
else
bbox.Merge( zone->GetBoundingBox() );
bboxInit = false;
}
SaveCopyInUndoList( undoListPicker, UR_NEW );
// we should not ask PLUGINs to do these items:
int copperLayerCount = GetBoard()->GetCopperLayerCount();
if( copperLayerCount > initialCopperLayerCount )
GetBoard()->SetCopperLayerCount( copperLayerCount );
// Enable all used layers, and make them visible:
LSET enabledLayers = GetBoard()->GetEnabledLayers();
enabledLayers |= initialEnabledLayers;
GetBoard()->SetEnabledLayers( enabledLayers );
GetBoard()->SetVisibleLayers( enabledLayers );
ReCreateLayerBox();
ReFillLayerWidget();
if( IsGalCanvasActive() )
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() );
GetBoard()->BuildListOfNets();
GetBoard()->SynchronizeNetsAndNetClasses();
SetStatusText( wxEmptyString );
BestZoom();
// Finish block move command:
wxPoint cpos = GetNearestGridPosition( bbox.Centre() );
blockmove.SetOrigin( bbox.GetOrigin() );
blockmove.SetSize( bbox.GetSize() );
blockmove.SetLastCursorPosition( cpos );
HandleBlockEnd( NULL );
return true;
}
示例7: initializePlotter
/** Set up most plot options for plotting a board (especially the viewport)
* Important thing:
* page size is the 'drawing' page size,
* paper size is the physical page size
*/
static void initializePlotter( PLOTTER *aPlotter, BOARD * aBoard,
PCB_PLOT_PARAMS *aPlotOpts )
{
PAGE_INFO pageA4( wxT( "A4" ) );
const PAGE_INFO& pageInfo = aBoard->GetPageSettings();
const PAGE_INFO* sheet_info;
double paperscale; // Page-to-paper ratio
wxSize paperSizeIU;
wxSize pageSizeIU( pageInfo.GetSizeIU() );
bool autocenter = false;
/* Special options: to fit the sheet to an A4 sheet replace
the paper size. However there is a difference between
the autoscale and the a4paper option:
- Autoscale fits the board to the paper size
- A4paper fits the original paper size to an A4 sheet
- Both of them fit the board to an A4 sheet
*/
if( aPlotOpts->GetA4Output() ) // Fit paper to A4
{
sheet_info = &pageA4;
paperSizeIU = pageA4.GetSizeIU();
paperscale = (double) paperSizeIU.x / pageSizeIU.x;
autocenter = true;
}
else
{
sheet_info = &pageInfo;
paperSizeIU = pageSizeIU;
paperscale = 1;
// Need autocentering only if scale is not 1:1
autocenter = (aPlotOpts->GetScale() != 1.0);
}
EDA_RECT bbox = aBoard->ComputeBoundingBox();
wxPoint boardCenter = bbox.Centre();
wxSize boardSize = bbox.GetSize();
double compound_scale;
/* Fit to 80% of the page if asked; it could be that the board is empty,
* in this case regress to 1:1 scale */
if( aPlotOpts->GetAutoScale() && boardSize.x > 0 && boardSize.y > 0 )
{
double xscale = (paperSizeIU.x * 0.8) / boardSize.x;
double yscale = (paperSizeIU.y * 0.8) / boardSize.y;
compound_scale = std::min( xscale, yscale ) * paperscale;
}
else
compound_scale = aPlotOpts->GetScale() * paperscale;
/* For the plot offset we have to keep in mind the auxiliary origin
too: if autoscaling is off we check that plot option (i.e. autoscaling
overrides auxiliary origin) */
wxPoint offset( 0, 0);
if( autocenter )
{
offset.x = KiROUND( boardCenter.x - ( paperSizeIU.x / 2.0 ) / compound_scale );
offset.y = KiROUND( boardCenter.y - ( paperSizeIU.y / 2.0 ) / compound_scale );
}
else
{
if( aPlotOpts->GetUseAuxOrigin() )
offset = aBoard->GetAuxOrigin();
}
/* Configure the plotter object with all the stuff computed and
most of that taken from the options */
aPlotter->SetPageSettings( *sheet_info );
aPlotter->SetViewport( offset, IU_PER_DECIMILS, compound_scale,
aPlotOpts->GetMirror() );
aPlotter->SetDefaultLineWidth( aPlotOpts->GetLineWidth() );
aPlotter->SetCreator( wxT( "PCBNEW" ) );
aPlotter->SetColorMode( false ); // default is plot in Black and White.
aPlotter->SetTextMode( aPlotOpts->GetTextMode() );
}