fix incorrect initialization of VIEW::m_boundary.

This parameter defines the working area (full page) size.

The fix is not perfect, because it does not take in account the page size.
However it is similar to the "old" initialization, before Eeschema GAL.
In Eeschema, a reasonable boundary size is used.
This commit is contained in:
jean-pierre charras 2018-11-18 20:04:17 +01:00
parent 65a967dca1
commit c539d6e0be
3 changed files with 26 additions and 1 deletions

View File

@ -294,7 +294,16 @@ VIEW::VIEW( bool aIsDynamic ) :
m_nextDrawPriority( 0 ),
m_reverseDrawOrder( false )
{
m_boundary.SetMaximum();
// Set m_boundary to define the max area size. The default area size
// is defined here as the max value of a int.
// this is a default value acceptable for Pcbnew and Gerbview, but too large for Eeschema.
// So in eeschema a call to SetBoundary() with a smaller value will be needed.
typedef std::numeric_limits<int> coord_limits;
double pos = coord_limits::lowest() / 2 + coord_limits::epsilon();
double size = coord_limits::max() - coord_limits::epsilon();
m_boundary.SetOrigin( pos, pos );
m_boundary.SetSize( size, size );
m_allItems.reset( new std::vector<VIEW_ITEM*> );
m_allItems->reserve( 32768 );

View File

@ -44,6 +44,12 @@ namespace KIGFX {
SCH_VIEW::SCH_VIEW( bool aIsDynamic ) :
VIEW( aIsDynamic )
{
// Set m_boundary to define the max working area size. The default value
// is acceptable for Pcbnew and Gerbview, but too large for Eeschema.
// So we have to use a smaller value.
// A better size could be a size depending on the worksheet size.
m_boundary.SetOrigin( -Millimeter2iu( 3200.0 ), -Millimeter2iu( 2000.0 ) );
m_boundary.SetSize( Millimeter2iu( 6400.0 ), Millimeter2iu( 4000.0 ) );
}

View File

@ -37,6 +37,16 @@ namespace KIGFX {
PCB_VIEW::PCB_VIEW( bool aIsDynamic ) :
VIEW( aIsDynamic )
{
// Set m_boundary to define the max area size. The default value
// is acceptable for Pcbnew and Gerbview.
// However, ensure this area has the right size (max size allowed by integer coordinates)
// in case of the default value is changed.
// Could be a size depending on the worksheet size.
typedef std::numeric_limits<int> coord_limits;
double pos = coord_limits::lowest() / 2 + coord_limits::epsilon();
double size = coord_limits::max() - coord_limits::epsilon();
m_boundary.SetOrigin( pos, pos );
m_boundary.SetSize( size, size );
}