Fixed bounding box computation for EDIT_POINTS class
This commit is contained in:
parent
0dc11936ad
commit
6c5e5c27e2
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 CERN
|
* Copyright (C) 2014-2017 CERN
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -203,6 +203,43 @@ EDIT_LINE* EDIT_POINTS::Next( const EDIT_LINE& aLine )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const BOX2I EDIT_POINTS::ViewBBox() const
|
||||||
|
{
|
||||||
|
BOX2I box;
|
||||||
|
bool empty = true;
|
||||||
|
|
||||||
|
for( const auto& point : m_points )
|
||||||
|
{
|
||||||
|
if( empty )
|
||||||
|
{
|
||||||
|
box.SetOrigin( point.GetPosition() );
|
||||||
|
empty = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
box.Merge( point.GetPosition() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( const auto& line : m_lines )
|
||||||
|
{
|
||||||
|
if( empty )
|
||||||
|
{
|
||||||
|
box.SetOrigin( line.GetOrigin().GetPosition() );
|
||||||
|
box.SetEnd( line.GetEnd().GetPosition() );
|
||||||
|
empty = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
box.Merge( line.GetOrigin().GetPosition() );
|
||||||
|
box.Merge( line.GetEnd().GetPosition() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
{
|
{
|
||||||
auto gal = aView->GetGAL();
|
auto gal = aView->GetGAL();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 CERN
|
* Copyright (C) 2014-2017 CERN
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -493,10 +493,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
///> @copydoc VIEW_ITEM::ViewBBox()
|
///> @copydoc VIEW_ITEM::ViewBBox()
|
||||||
virtual const BOX2I ViewBBox() const override
|
virtual const BOX2I ViewBBox() const override;
|
||||||
{
|
|
||||||
return m_parent->ViewBBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
///> @copydoc VIEW_ITEM::ViewDraw()
|
///> @copydoc VIEW_ITEM::ViewDraw()
|
||||||
virtual void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
virtual void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||||
|
|
Loading…
Reference in New Issue