Fix GetBoundingBox hiding overloaded virtual

This commit is contained in:
Chris Pavlina 2016-09-30 01:31:48 -04:00
parent c9fec4a4ed
commit 9547dd4e52
7 changed files with 18 additions and 13 deletions

View File

@ -431,7 +431,7 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
/* Enable this to draw the bounding box around the component to validate
* the bounding box calculations. */
#if 0
EDA_RECT bBox = GetBoundingBox( aMulti, aConvert );
EDA_RECT bBox = GetUnitBoundingBox( aMulti, aConvert );
bBox.RevertYAxis();
bBox = aTransform.TransformCoordinate( bBox );
bBox.Move( aOffset );
@ -1158,7 +1158,7 @@ bool LIB_PART::LoadFootprints( LINE_READER& aLineReader, wxString& aErrorMsg )
}
const EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const
const EDA_RECT LIB_PART::GetUnitBoundingBox( int aUnit, int aConvert ) const
{
EDA_RECT bBox;
bool initialized = false;

View File

@ -291,7 +291,7 @@ public:
* if aConvert == 0 Convert is non used
* Invisible fields are not taken in account
**/
const EDA_RECT GetBoundingBox( int aUnit, int aConvert ) const;
const EDA_RECT GetUnitBoundingBox( int aUnit, int aConvert ) const;
/**
* Function GetBodyBoundingBox
@ -304,6 +304,11 @@ public:
**/
const EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert ) const;
const EDA_RECT GetBoundingBox() const override
{
return GetUnitBoundingBox( 0, 0 );
}
/**
* Function SaveDateAndTime
* write the date and time of part to \a aFile in the format:

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -344,7 +344,7 @@ void DIALOG_CHOOSE_COMPONENT::renderPreview( LIB_PART* aComponent, int aUnit )
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
// Find joint bounding box for everything we are about to draw.
EDA_RECT bBox = aComponent->GetBoundingBox( aUnit, m_deMorganConvert );
EDA_RECT bBox = aComponent->GetUnitBoundingBox( aUnit, m_deMorganConvert );
const double xscale = (double) dc_size.x / bBox.GetWidth();
const double yscale = (double) dc_size.y / bBox.GetHeight();
const double scale = std::min( xscale, yscale ) * 0.85;

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2015 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2015-2016 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2015-2016 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -222,7 +222,7 @@ void DIALOG_RESCUE_EACH::renderPreview( LIB_PART* aComponent, int aUnit, wxPanel
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
// Find joint bounding box for everything we are about to draw.
EDA_RECT bBox = aComponent->GetBoundingBox( aUnit, /* deMorganConvert */ 1 );
EDA_RECT bBox = aComponent->GetUnitBoundingBox( aUnit, /* deMorganConvert */ 1 );
const double xscale = (double) dc_size.x / bBox.GetWidth();
const double yscale = (double) dc_size.y / bBox.GetHeight();
const double scale = std::min( xscale, yscale ) * 0.85;

View File

@ -5,7 +5,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -102,7 +102,7 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave;
wxSize componentSize = part->GetBoundingBox( m_unit, m_convert ).GetSize();
wxSize componentSize = part->GetUnitBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );

View File

@ -369,7 +369,7 @@ double LIB_EDIT_FRAME::BestZoom()
if( part )
{
EDA_RECT boundingBox = part->GetBoundingBox( m_unit, m_convert );
EDA_RECT boundingBox = part->GetUnitBoundingBox( m_unit, m_convert );
dx = boundingBox.GetWidth();
dy = boundingBox.GetHeight();

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -298,7 +298,7 @@ double LIB_VIEW_FRAME::BestZoom()
wxSize size = m_canvas->GetClientSize();
EDA_RECT boundingBox = part->GetBoundingBox( m_unit, m_convert );
EDA_RECT boundingBox = part->GetUnitBoundingBox( m_unit, m_convert );
// Reserve a 10% margin around component bounding box.
double margin_scale_factor = 0.8;