本文整理汇总了C++中EDA_RECT::GetBottom方法的典型用法代码示例。如果您正苦于以下问题:C++ EDA_RECT::GetBottom方法的具体用法?C++ EDA_RECT::GetBottom怎么用?C++ EDA_RECT::GetBottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDA_RECT
的用法示例。
在下文中一共展示了EDA_RECT::GetBottom方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TransformBoundingBoxWithClearanceToPolygon
void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(
SHAPE_POLY_SET* aCornerBuffer, int aClearanceValue ) const
{
// Oh dear. When in UTF-8 mode, wxString puts string iterators in a linked list, and
// that linked list is not thread-safe.
std::lock_guard<std::mutex> guard( m_mutex );
if( GetText().Length() == 0 )
return;
wxPoint corners[4]; // Buffer of polygon corners
EDA_RECT rect = GetTextBox( -1 );
rect.Inflate( aClearanceValue );
corners[0].x = rect.GetOrigin().x;
corners[0].y = rect.GetOrigin().y;
corners[1].y = corners[0].y;
corners[1].x = rect.GetRight();
corners[2].x = corners[1].x;
corners[2].y = rect.GetBottom();
corners[3].y = corners[2].y;
corners[3].x = corners[0].x;
aCornerBuffer->NewOutline();
for( int ii = 0; ii < 4; ii++ )
{
// Rotate polygon
RotatePoint( &corners[ii].x, &corners[ii].y, GetTextPos().x, GetTextPos().y, GetTextAngle() );
aCornerBuffer->Append( corners[ii].x, corners[ii].y );
}
}
示例2: estimateComponentInsertionPosition
wxPoint BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition()
{
wxPoint bestPosition;
if( !m_board->IsEmpty() )
{
// Position new components below any existing board features.
EDA_RECT bbox = m_board->ComputeBoundingBox( true );
if( bbox.GetWidth() || bbox.GetHeight() )
{
bestPosition.x = bbox.Centre().x;
bestPosition.y = bbox.GetBottom() + Millimeter2iu( 10 );
}
}
else
{
// Position new components in the center of the page when the board is empty.
wxSize pageSize = m_board->GetPageSettings().GetSizeIU();
bestPosition.x = pageSize.GetWidth() / 2;
bestPosition.y = pageSize.GetHeight() / 2;
}
return bestPosition;
}
示例3: genModuleOnRoutingMatrix
/* Place module on Routing matrix.
*/
void genModuleOnRoutingMatrix( MODULE* Module )
{
int ox, oy, fx, fy;
int layerMask;
D_PAD* Pad;
EDA_RECT fpBBox = Module->GetBoundingBox();
fpBBox.Inflate( RoutingMatrix.m_GridRouting / 2 );
ox = fpBBox.GetX();
fx = fpBBox.GetRight();
oy = fpBBox.GetY();
fy = fpBBox.GetBottom();
if( ox < RoutingMatrix.m_BrdBox.GetX() )
ox = RoutingMatrix.m_BrdBox.GetX();
if( ox > RoutingMatrix.m_BrdBox.GetRight() )
ox = RoutingMatrix.m_BrdBox.GetRight();
if( fx < RoutingMatrix.m_BrdBox.GetX() )
fx = RoutingMatrix.m_BrdBox.GetX();
if( fx > RoutingMatrix.m_BrdBox.GetRight() )
fx = RoutingMatrix.m_BrdBox.GetRight();
if( oy < RoutingMatrix.m_BrdBox.GetY() )
oy = RoutingMatrix.m_BrdBox.GetY();
if( oy > RoutingMatrix.m_BrdBox.GetBottom() )
oy = RoutingMatrix.m_BrdBox.GetBottom();
if( fy < RoutingMatrix.m_BrdBox.GetY() )
fy = RoutingMatrix.m_BrdBox.GetY();
if( fy > RoutingMatrix.m_BrdBox.GetBottom() )
fy = RoutingMatrix.m_BrdBox.GetBottom();
layerMask = 0;
if( Module->GetLayer() == LAYER_N_FRONT )
layerMask = LAYER_FRONT;
if( Module->GetLayer() == LAYER_N_BACK )
layerMask = LAYER_BACK;
TraceFilledRectangle( ox, oy, fx, fy, layerMask,
CELL_is_MODULE, WRITE_OR_CELL );
// Trace pads + clearance areas.
for( Pad = Module->Pads(); Pad != NULL; Pad = Pad->Next() )
{
int margin = (RoutingMatrix.m_GridRouting / 2) + Pad->GetClearance();
::PlacePad( Pad, CELL_is_MODULE, margin, WRITE_OR_CELL );
}
// Trace clearance.
int margin = ( RoutingMatrix.m_GridRouting * Module->GetPadCount() ) / GAIN;
CreateKeepOutRectangle( ox, oy, fx, fy, margin, KEEP_OUT_MARGIN, layerMask );
}
示例4: TransformBoundingBoxWithClearanceToPolygon
/**
* Function TransformBoundingBoxWithClearanceToPolygon
* Convert the text bounding box to a rectangular polygon
* Used in filling zones calculations
* Circles and arcs are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon
* @param aClearanceValue = the clearance around the text bounding box
*/
void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue ) const
{
if( GetText().Length() == 0 )
return;
wxPoint corners[4]; // Buffer of polygon corners
EDA_RECT rect = GetTextBox( -1 );
rect.Inflate( aClearanceValue );
corners[0].x = rect.GetOrigin().x;
corners[0].y = rect.GetOrigin().y;
corners[1].y = corners[0].y;
corners[1].x = rect.GetRight();
corners[2].x = corners[1].x;
corners[2].y = rect.GetBottom();
corners[3].y = corners[2].y;
corners[3].x = corners[0].x;
aCornerBuffer.NewOutline();
for( int ii = 0; ii < 4; ii++ )
{
// Rotate polygon
RotatePoint( &corners[ii].x, &corners[ii].y, m_Pos.x, m_Pos.y, m_Orient );
aCornerBuffer.Append( corners[ii].x, corners[ii].y );
}
}
示例5: GetBoundingBox
const EDA_RECT DIMENSION::GetBoundingBox() const
{
EDA_RECT bBox;
int xmin, xmax, ymin, ymax;
bBox = m_Text.GetTextBox( -1 );
xmin = bBox.GetX();
xmax = bBox.GetRight();
ymin = bBox.GetY();
ymax = bBox.GetBottom();
xmin = std::min( xmin, m_crossBarO.x );
xmin = std::min( xmin, m_crossBarF.x );
ymin = std::min( ymin, m_crossBarO.y );
ymin = std::min( ymin, m_crossBarF.y );
xmax = std::max( xmax, m_crossBarO.x );
xmax = std::max( xmax, m_crossBarF.x );
ymax = std::max( ymax, m_crossBarO.y );
ymax = std::max( ymax, m_crossBarF.y );
xmin = std::min( xmin, m_featureLineGO.x );
xmin = std::min( xmin, m_featureLineGF.x );
ymin = std::min( ymin, m_featureLineGO.y );
ymin = std::min( ymin, m_featureLineGF.y );
xmax = std::max( xmax, m_featureLineGO.x );
xmax = std::max( xmax, m_featureLineGF.x );
ymax = std::max( ymax, m_featureLineGO.y );
ymax = std::max( ymax, m_featureLineGF.y );
xmin = std::min( xmin, m_featureLineDO.x );
xmin = std::min( xmin, m_featureLineDF.x );
ymin = std::min( ymin, m_featureLineDO.y );
ymin = std::min( ymin, m_featureLineDF.y );
xmax = std::max( xmax, m_featureLineDO.x );
xmax = std::max( xmax, m_featureLineDF.x );
ymax = std::max( ymax, m_featureLineDO.y );
ymax = std::max( ymax, m_featureLineDF.y );
bBox.SetX( xmin );
bBox.SetY( ymin );
bBox.SetWidth( xmax - xmin + 1 );
bBox.SetHeight( ymax - ymin + 1 );
bBox.Normalize();
return bBox;
}
示例6: GetMinHeight
int SCH_SHEET::GetMinHeight() const
{
int height = MIN_SHEET_HEIGHT;
for( size_t i = 0; i < m_pins.size(); i++ )
{
int edge = m_pins[i].GetEdge();
EDA_RECT pinRect = m_pins[i].GetBoundingBox();
// Make sure pin is on top or bottom side of sheet.
if( edge == SCH_SHEET_PIN::SHEET_RIGHT_SIDE || edge == SCH_SHEET_PIN::SHEET_LEFT_SIDE )
{
if( height < pinRect.GetBottom() - m_pos.y )
height = pinRect.GetBottom() - m_pos.y;
}
else
{
if( height < pinRect.GetHeight() )
height = pinRect.GetHeight();
for( size_t j = 0; j < m_pins.size(); j++ )
{
// Check for pin directly above or below the current pin.
if( (i == j) || (m_pins[i].GetPosition().x != m_pins[j].GetPosition().x) )
continue;
if( height < pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight() )
{
height = pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight();
break;
}
}
}
}
return height;
}
示例7: DrawPage
//.........这里部分代码省略.........
offset += center;
}
GRResetPenAndBrush( dc );
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
EDA_RECT tmp = *panel->GetClipBox();
// Set clip box to the max size
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
screen->m_IsPrinting = true;
EDA_COLOR_T bg_color = g_DrawBgColor;
// Print frame reference, if reqquested, before
if( m_PrintParams.m_Print_Black_and_White )
GRForceBlackPen( true );
if( m_PrintParams.PrintBorderAndTitleBlock() )
m_Parent->DrawWorkSheet( dc, screen, m_PrintParams.m_PenDefaultSize,
IU_PER_MILS, titleblockFilename );
if( printMirror )
{
// To plot mirror, we reverse the x axis, and modify the plot x origin
dc->SetAxisOrientation( false, false);
/* Plot offset x is moved by the x plot area size in order to have
* the old draw area in the new draw area, because the draw origin has not moved
* (this is the upper left corner) but the X axis is reversed, therefore the plotting area
* is the x coordinate values from - PlotAreaSize.x to 0 */
int x_dc_offset = PlotAreaSizeInPixels.x;
x_dc_offset = KiROUND( x_dc_offset * userscale );
dc->SetDeviceOrigin( x_dc_offset, 0 );
wxLogTrace( tracePrinting, wxT( "Device origin: x=%d, y=%d" ),
x_dc_offset, 0 );
panel->SetClipBox( EDA_RECT( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ),
panel->GetClipBox()->GetSize() ) );
}
// screen->m_DrawOrg = offset;
dc->SetLogicalOrigin( offset.x, offset.y );
wxLogTrace( tracePrinting, wxT( "Logical origin: x=%d, y=%d" ),
offset.x, offset.y );
#if defined(wxUSE_LOG_TRACE) && defined( DEBUG )
wxRect paperRect = GetPaperRectPixels();
wxLogTrace( tracePrinting, wxT( "Paper rectangle: left=%d, top=%d, "
"right=%d, bottom=%d" ),
paperRect.GetLeft(), paperRect.GetTop(), paperRect.GetRight(),
paperRect.GetBottom() );
int devLeft = dc->LogicalToDeviceX( drawRect.GetX() );
int devTop = dc->LogicalToDeviceY( drawRect.GetY() );
int devRight = dc->LogicalToDeviceX( drawRect.GetRight() );
int devBottom = dc->LogicalToDeviceY( drawRect.GetBottom() );
wxLogTrace( tracePrinting, wxT( "Final device rectangle: left=%d, top=%d, "
"right=%d, bottom=%d\n" ),
devLeft, devTop, devRight, devBottom );
#endif
g_DrawBgColor = WHITE;
/* when printing in color mode, we use the graphic OR mode that gives the same look as
* the screen but because the background is white when printing, we must use a trick:
* In order to plot on a white background in OR mode we must:
* 1 - Plot all items in black, this creates a local black background
* 2 - Plot in OR mode on black "local" background
*/
if( !m_PrintParams.m_Print_Black_and_White )
{
// Creates a "local" black background
GRForceBlackPen( true );
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer,
printMirror, &m_PrintParams );
GRForceBlackPen( false );
}
else
GRForceBlackPen( true );
#if defined (GERBVIEW)
// In B&W mode, do not force black pen for Gerbview
// because negative objects need a white pen, not a black pen
// B&W mode is handled in print page
GRForceBlackPen( false );
#endif
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror,
&m_PrintParams );
g_DrawBgColor = bg_color;
screen->m_IsPrinting = false;
panel->SetClipBox( tmp );
GRForceBlackPen( false );
}
示例8: HitTest
bool D_PAD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT arect = aRect;
arect.Normalize();
arect.Inflate( aAccuracy );
wxPoint shapePos = ShapePos();
EDA_RECT shapeRect;
int r;
EDA_RECT bb = GetBoundingBox();
wxPoint endCenter;
int radius;
if( !arect.Intersects( bb ) )
return false;
// This covers total containment for all test cases
if( arect.Contains( bb ) )
return true;
switch( GetShape() )
{
case PAD_SHAPE_CIRCLE:
return arect.IntersectsCircle( GetPosition(), GetBoundingRadius() );
case PAD_SHAPE_RECT:
shapeRect.SetOrigin( shapePos );
shapeRect.Inflate( m_Size.x / 2, m_Size.y / 2 );
return arect.Intersects( shapeRect, m_Orient );
case PAD_SHAPE_OVAL:
// Circlular test if dimensions are equal
if( m_Size.x == m_Size.y )
return arect.IntersectsCircle( shapePos, GetBoundingRadius() );
shapeRect.SetOrigin( shapePos );
// Horizontal dimension is greater
if( m_Size.x > m_Size.y )
{
radius = m_Size.y / 2;
shapeRect.Inflate( m_Size.x / 2 - radius, radius );
endCenter = wxPoint( m_Size.x / 2 - radius, 0 );
RotatePoint( &endCenter, m_Orient );
// Test circular ends
if( arect.IntersectsCircle( shapePos + endCenter, radius ) ||
arect.IntersectsCircle( shapePos - endCenter, radius ) )
{
return true;
}
}
else
{
radius = m_Size.x / 2;
shapeRect.Inflate( radius, m_Size.y / 2 - radius );
endCenter = wxPoint( 0, m_Size.y / 2 - radius );
RotatePoint( &endCenter, m_Orient );
// Test circular ends
if( arect.IntersectsCircle( shapePos + endCenter, radius ) ||
arect.IntersectsCircle( shapePos - endCenter, radius ) )
{
return true;
}
}
// Test rectangular portion between rounded ends
if( arect.Intersects( shapeRect, m_Orient ) )
{
return true;
}
break;
case PAD_SHAPE_TRAPEZOID:
/* Trapezoid intersection tests:
* A) Any points of rect inside trapezoid
* B) Any points of trapezoid inside rect
* C) Any sides of trapezoid cross rect
*/
{
wxPoint poly[4];
BuildPadPolygon( poly, wxSize( 0, 0 ), 0 );
wxPoint corners[4];
corners[0] = wxPoint( arect.GetLeft(), arect.GetTop() );
corners[1] = wxPoint( arect.GetRight(), arect.GetTop() );
corners[2] = wxPoint( arect.GetRight(), arect.GetBottom() );
corners[3] = wxPoint( arect.GetLeft(), arect.GetBottom() );
for( int i=0; i<4; i++ )
//.........这里部分代码省略.........
示例9: genDrillMapFile
//.........这里部分代码省略.........
break;
case PCB_DIMENSION_T:
case PCB_TARGET_T:
case PCB_MARKER_T: // do not draw
default:
break;
}
}
int x, y;
int plotX, plotY, TextWidth;
int intervalle = 0;
char line[1024];
wxString msg;
int textmarginaftersymbol = KiROUND( 2 * IU_PER_MM );
// Set Drill Symbols width
plotter->SetDefaultLineWidth( 0.2 * IU_PER_MM / scale );
plotter->SetCurrentLineWidth( -1 );
// Plot board outlines and drill map
plotDrillMarks( plotter );
// Print a list of symbols used.
int charSize = 3 * IU_PER_MM; // text size in IUs
double charScale = 1.0 / scale; // real scale will be 1/scale,
// because the global plot scale is scale
TextWidth = KiROUND( (charSize * charScale) / 10.0 ); // Set text width (thickness)
intervalle = KiROUND( charSize * charScale ) + TextWidth;
// Trace information.
plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
plotY = bbbox.GetBottom() + intervalle;
// Plot title "Info"
wxString Text = wxT( "Drill Map:" );
plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0,
wxSize( KiROUND( charSize * charScale ),
KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
{
DRILL_TOOL& tool = m_toolListBuffer[ii];
if( tool.m_TotalCount == 0 )
continue;
plotY += intervalle;
int plot_diam = KiROUND( tool.m_Diameter );
x = KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
y = KiROUND( plotY + charSize * charScale );
plotter->Marker( wxPoint( x, y ), plot_diam, ii );
// List the diameter of each drill in mm and inches.
sprintf( line, "%2.2fmm / %2.3f\" ",
diameter_in_mm( tool.m_Diameter ),
diameter_in_inches( tool.m_Diameter ) );
msg = FROM_UTF8( line );
// Now list how many holes and ovals are associated with each drill.
if( ( tool.m_TotalCount == 1 )
示例10: FillZoneAreasWithSegments
int ZONE_CONTAINER::FillZoneAreasWithSegments()
{
int ics, ice;
int count = 0;
std::vector <int> x_coordinates;
bool error = false;
int istart, iend; // index of the starting and the endif corner of one filled area in m_FilledPolysList
int margin = m_ZoneMinThickness * 2 / 10;
int minwidth = Mils2iu( 2 );
margin = std::max ( minwidth, margin );
int step = m_ZoneMinThickness - margin;
step = std::max( step, minwidth );
// Read all filled areas in m_FilledPolysList
m_FillSegmList.clear();
istart = 0;
int end_list = m_FilledPolysList.GetCornersCount()-1;
for( int ic = 0; ic <= end_list; ic++ )
{
CPolyPt* corner = &m_FilledPolysList[ic];
if ( corner->end_contour || (ic == end_list) )
{
iend = ic;
EDA_RECT rect = CalculateSubAreaBoundaryBox( istart, iend );
// Calculate the y limits of the zone
int refy = rect.GetY();
int endy = rect.GetBottom();
for( ; refy < endy; refy += step )
{
// find all intersection points of an infinite line with polyline sides
x_coordinates.clear();
for( ics = istart, ice = iend; ics <= iend; ice = ics, ics++ )
{
if ( m_FilledPolysList[ice].m_utility )
continue;
int seg_startX = m_FilledPolysList[ics].x;
int seg_startY = m_FilledPolysList[ics].y;
int seg_endX = m_FilledPolysList[ice].x;
int seg_endY = m_FilledPolysList[ice].y;
/* Trivial cases: skip if ref above or below the segment to test */
if( ( seg_startY > refy ) && (seg_endY > refy ) )
continue;
// segment below ref point, or its Y end pos on Y coordinate ref point: skip
if( ( seg_startY <= refy ) && (seg_endY <= refy ) )
continue;
/* at this point refy is between seg_startY and seg_endY
* see if an horizontal line at Y = refy is intersecting this segment
*/
// calculate the x position of the intersection of this segment and the
// infinite line this is more easier if we move the X,Y axis origin to
// the segment start point:
seg_endX -= seg_startX;
seg_endY -= seg_startY;
double newrefy = (double) (refy - seg_startY);
double intersec_x;
if ( seg_endY == 0 ) // horizontal segment on the same line: skip
continue;
// Now calculate the x intersection coordinate of the horizontal line at
// y = newrefy and the segment from (0,0) to (seg_endX,seg_endY) with the
// horizontal line at the new refy position the line slope is:
// slope = seg_endY/seg_endX; and inv_slope = seg_endX/seg_endY
// and the x pos relative to the new origin is:
// intersec_x = refy/slope = refy * inv_slope
// Note: because horizontal segments are already tested and skipped, slope
// exists (seg_end_y not O)
double inv_slope = (double)seg_endX / seg_endY;
intersec_x = newrefy * inv_slope;
x_coordinates.push_back((int) intersec_x + seg_startX);
}
// A line scan is finished: build list of segments
// Sort intersection points by increasing x value:
// So 2 consecutive points are the ends of a segment
sort( x_coordinates.begin(), x_coordinates.end(), SortByXValues );
// Create segments
if ( !error && ( x_coordinates.size() & 1 ) != 0 )
{ // An even number of coordinates is expected, because a segment has 2 ends.
// An if this algorithm always works, it must always find an even count.
wxString msg = wxT("Fill Zone: odd number of points at y = ");
msg << refy;
wxMessageBox(msg );
error = true;
}
//.........这里部分代码省略.........