Cleanup.
Formatting. Naming conventions. Use of auto. Use of STL cover types.
This commit is contained in:
parent
0f48522342
commit
930c4e5582
|
@ -39,6 +39,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
|
#include <wx/debug.h>
|
||||||
|
|
||||||
using namespace KIGFX;
|
using namespace KIGFX;
|
||||||
|
|
||||||
|
@ -171,10 +172,9 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
|
||||||
|
|
||||||
if( (int) usedBuffers() >= maxBuffers )
|
if( (int) usedBuffers() >= maxBuffers )
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error( "Cannot create more framebuffers. OpenGL rendering backend "
|
||||||
"Cannot create more framebuffers. OpenGL rendering "
|
"requires at least 3 framebuffers. You may try to update/change "
|
||||||
"backend requires at least 3 framebuffers. You may try to update/change "
|
"your graphic drivers." );
|
||||||
"your graphic drivers." );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glGetIntegerv( GL_MAX_TEXTURE_SIZE, (GLint*) &maxTextureSize );
|
glGetIntegerv( GL_MAX_TEXTURE_SIZE, (GLint*) &maxTextureSize );
|
||||||
|
@ -218,46 +218,35 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
|
||||||
{
|
{
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
||||||
throw std::runtime_error( "The framebuffer attachment points are incomplete." );
|
throw std::runtime_error( "The framebuffer attachment points are incomplete." );
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
||||||
throw std::runtime_error( "No images attached to the framebuffer." );
|
throw std::runtime_error( "No images attached to the framebuffer." );
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
||||||
throw std::runtime_error( "The framebuffer does not have at least one "
|
throw std::runtime_error( "The framebuffer does not have at least one "
|
||||||
"image attached to it." );
|
"image attached to it." );
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
||||||
throw std::runtime_error( "The framebuffer read buffer is incomplete." );
|
throw std::runtime_error( "The framebuffer read buffer is incomplete." );
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||||
throw std::runtime_error(
|
throw std::runtime_error( "The combination of internal formats of the attached "
|
||||||
"The combination of internal formats of the attached "
|
"images violates an implementation-dependent set of "
|
||||||
"images violates an implementation-dependent set of restrictions." );
|
"restrictions." );
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
|
||||||
throw std::runtime_error( "GL_RENDERBUFFER_SAMPLES is not the same for "
|
throw std::runtime_error( "GL_RENDERBUFFER_SAMPLES is not the same for "
|
||||||
"all attached renderbuffers" );
|
"all attached renderbuffers" );
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
|
||||||
throw std::runtime_error( "Framebuffer incomplete layer targets errors." );
|
throw std::runtime_error( "Framebuffer incomplete layer targets errors." );
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
||||||
throw std::runtime_error( "Framebuffer attachments have different dimensions" );
|
throw std::runtime_error( "Framebuffer attachments have different dimensions" );
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error( "Unknown error occurred when creating the framebuffer." );
|
throw std::runtime_error( "Unknown error occurred when creating the framebuffer." );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearBuffer( COLOR4D::BLACK );
|
ClearBuffer( COLOR4D::BLACK );
|
||||||
|
@ -275,15 +264,15 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
|
||||||
|
|
||||||
GLenum OPENGL_COMPOSITOR::GetBufferTexture( unsigned int aBufferHandle )
|
GLenum OPENGL_COMPOSITOR::GetBufferTexture( unsigned int aBufferHandle )
|
||||||
{
|
{
|
||||||
assert( aBufferHandle > 0 && aBufferHandle <= usedBuffers() );
|
wxASSERT( aBufferHandle > 0 && aBufferHandle <= usedBuffers() );
|
||||||
return m_buffers[aBufferHandle - 1].textureTarget;
|
return m_buffers[aBufferHandle - 1].textureTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
|
void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
wxASSERT( m_initialized );
|
||||||
assert( aBufferHandle <= usedBuffers() );
|
wxASSERT( aBufferHandle <= usedBuffers() );
|
||||||
|
|
||||||
// Either unbind the FBO for direct rendering, or bind the one with target textures
|
// Either unbind the FBO for direct rendering, or bind the one with target textures
|
||||||
bindFb( aBufferHandle == DIRECT_RENDERING ? DIRECT_RENDERING : m_mainFbo );
|
bindFb( aBufferHandle == DIRECT_RENDERING ? DIRECT_RENDERING : m_mainFbo );
|
||||||
|
@ -307,7 +296,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::ClearBuffer( const COLOR4D& aColor )
|
void OPENGL_COMPOSITOR::ClearBuffer( const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
wxASSERT( m_initialized );
|
||||||
|
|
||||||
glClearColor( aColor.r, aColor.g, aColor.b, 0.0f );
|
glClearColor( aColor.r, aColor.g, aColor.b, 0.0f );
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||||
|
@ -334,9 +323,9 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aSourceHandle, unsigned int aDestHandle )
|
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aSourceHandle, unsigned int aDestHandle )
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
wxASSERT( m_initialized );
|
||||||
assert( aSourceHandle != 0 && aSourceHandle <= usedBuffers() );
|
wxASSERT( aSourceHandle != 0 && aSourceHandle <= usedBuffers() );
|
||||||
assert( aDestHandle <= usedBuffers() );
|
wxASSERT( aDestHandle <= usedBuffers() );
|
||||||
|
|
||||||
// Switch to the destination buffer and blit the scene
|
// Switch to the destination buffer and blit the scene
|
||||||
SetBuffer( aDestHandle );
|
SetBuffer( aDestHandle );
|
||||||
|
@ -388,7 +377,7 @@ void OPENGL_COMPOSITOR::Present()
|
||||||
void OPENGL_COMPOSITOR::bindFb( unsigned int aFb )
|
void OPENGL_COMPOSITOR::bindFb( unsigned int aFb )
|
||||||
{
|
{
|
||||||
// Currently there are only 2 valid FBOs
|
// Currently there are only 2 valid FBOs
|
||||||
assert( aFb == DIRECT_RENDERING || aFb == m_mainFbo );
|
wxASSERT( aFb == DIRECT_RENDERING || aFb == m_mainFbo );
|
||||||
|
|
||||||
if( m_curFbo != aFb )
|
if( m_curFbo != aFb )
|
||||||
{
|
{
|
||||||
|
@ -401,14 +390,12 @@ void OPENGL_COMPOSITOR::bindFb( unsigned int aFb )
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::clean()
|
void OPENGL_COMPOSITOR::clean()
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
wxASSERT( m_initialized );
|
||||||
|
|
||||||
bindFb( DIRECT_RENDERING );
|
bindFb( DIRECT_RENDERING );
|
||||||
|
|
||||||
for( OPENGL_BUFFERS::const_iterator it = m_buffers.begin(); it != m_buffers.end(); ++it )
|
for( const OPENGL_BUFFER& buffer : m_buffers )
|
||||||
{
|
glDeleteTextures( 1, &buffer.textureTarget );
|
||||||
glDeleteTextures( 1, &it->textureTarget );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_buffers.clear();
|
m_buffers.clear();
|
||||||
|
|
||||||
|
@ -426,10 +413,8 @@ int OPENGL_COMPOSITOR::GetAntialiasSupersamplingFactor() const
|
||||||
{
|
{
|
||||||
switch ( m_currentAntialiasingMode )
|
switch ( m_currentAntialiasingMode )
|
||||||
{
|
{
|
||||||
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING:
|
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING: return 2;
|
||||||
return 2;
|
default: return 1;
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,6 +423,6 @@ VECTOR2D OPENGL_COMPOSITOR::GetAntialiasRenderingOffset() const
|
||||||
switch( m_currentAntialiasingMode )
|
switch( m_currentAntialiasingMode )
|
||||||
{
|
{
|
||||||
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING: return VECTOR2D( 0.5, -0.5 );
|
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING: return VECTOR2D( 0.5, -0.5 );
|
||||||
default: return VECTOR2D( 0, 0 );
|
default: return VECTOR2D( 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ int checkGlError( const std::string& aInfo, const char* aFile, int aLine, bool a
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||||
errorMsg = "The combination of internal formats of the attached images violates an "
|
errorMsg = "The combination of internal formats of the attached images violates "
|
||||||
"implementation dependent set of restrictions.";
|
"an implementation dependent set of restrictions.";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
|
||||||
errorMsg =
|
errorMsg = "GL_RENDERBUFFER_SAMPLES is not the same for all attached render "
|
||||||
"GL_RENDERBUFFER_SAMPLES is not the same for all attached render buffers.";
|
"buffers.";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
|
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
|
||||||
|
@ -140,16 +140,20 @@ int checkGlError( const std::string& aInfo, const char* aFile, int aLine, bool a
|
||||||
if( aThrow )
|
if( aThrow )
|
||||||
{
|
{
|
||||||
wxLogTrace( traceGalOpenGlError, wxT( "Throwing exception for glGetError() '%s' "
|
wxLogTrace( traceGalOpenGlError, wxT( "Throwing exception for glGetError() '%s' "
|
||||||
"in file '%s' on line %d." ), errorMsg,
|
"in file '%s' on line %d." ),
|
||||||
aFile, aLine );
|
errorMsg,
|
||||||
|
aFile,
|
||||||
|
aLine );
|
||||||
|
|
||||||
throw std::runtime_error( (const char*) errorMsg.char_str() );
|
throw std::runtime_error( (const char*) errorMsg.char_str() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg = wxString::Format( wxT( "glGetError() '%s' in file '%s' on line %d." ),
|
||||||
|
errorMsg,
|
||||||
|
aFile,
|
||||||
|
aLine );
|
||||||
|
|
||||||
msg.Printf( wxT( "glGetError() '%s' in file '%s' on line %d." ),
|
|
||||||
errorMsg, aFile, aLine );
|
|
||||||
DisplayErrorMessage( nullptr, "OpenGL Error", errorMsg );
|
DisplayErrorMessage( nullptr, "OpenGL Error", errorMsg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,14 @@ EDIT_POINT* EDIT_POINTS::FindPoint( const VECTOR2I& aLocation, KIGFX::VIEW *aVie
|
||||||
|
|
||||||
if( m_allowPoints )
|
if( m_allowPoints )
|
||||||
{
|
{
|
||||||
for( auto& point : m_points )
|
for( EDIT_POINT& point : m_points )
|
||||||
{
|
{
|
||||||
if( point.WithinPoint( aLocation, size ) )
|
if( point.WithinPoint( aLocation, size ) )
|
||||||
return &point;
|
return &point;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto& line : m_lines )
|
for( EDIT_LINE& line : m_lines )
|
||||||
{
|
{
|
||||||
if( line.WithinPoint( aLocation, size ) )
|
if( line.WithinPoint( aLocation, size ) )
|
||||||
return &line;
|
return &line;
|
||||||
|
@ -244,8 +244,7 @@ const BOX2I EDIT_POINTS::ViewBBox() const
|
||||||
|
|
||||||
void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
{
|
{
|
||||||
auto gal = aView->GetGAL();
|
KIGFX::GAL* gal = aView->GetGAL();
|
||||||
|
|
||||||
KIGFX::RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
|
KIGFX::RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
|
||||||
KIGFX::COLOR4D drawColor = settings->GetLayerColor( LAYER_AUX_ITEMS );
|
KIGFX::COLOR4D drawColor = settings->GetLayerColor( LAYER_AUX_ITEMS );
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,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) 2013-2017 CERN
|
* Copyright (C) 2013-2017 CERN
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -119,7 +120,7 @@ bool SELECTION::HasType( KICAD_T aType ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const KIGFX::VIEW_GROUP::ITEMS SELECTION::updateDrawList() const
|
const std::vector<KIGFX::VIEW_ITEM*> SELECTION::updateDrawList() const
|
||||||
{
|
{
|
||||||
std::vector<VIEW_ITEM*> items;
|
std::vector<VIEW_ITEM*> items;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
deleteGroups();
|
deleteGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getFlags() const
|
int GetFlags() const
|
||||||
{
|
{
|
||||||
return m_flags;
|
return m_flags;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there was no entry for the given layer - create one
|
// If there was no entry for the given layer - create one
|
||||||
GroupPair* newGroups = new GroupPair[m_groupsSize + 1];
|
std::pair<int, int>* newGroups = new std::pair<int, int>[m_groupsSize + 1];
|
||||||
|
|
||||||
if( m_groupsSize > 0 )
|
if( m_groupsSize > 0 )
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
m_groups = newGroups;
|
m_groups = newGroups;
|
||||||
newGroups[m_groupsSize++] = GroupPair( aLayer, aGroup );
|
newGroups[m_groupsSize++] = { aLayer, aGroup };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +177,8 @@ private:
|
||||||
{
|
{
|
||||||
new_layer = aReorderMap.at( orig_layer );
|
new_layer = aReorderMap.at( orig_layer );
|
||||||
}
|
}
|
||||||
catch( const std::out_of_range& ) {}
|
catch( const std::out_of_range& )
|
||||||
|
{}
|
||||||
|
|
||||||
m_groups[i].first = new_layer;
|
m_groups[i].first = new_layer;
|
||||||
}
|
}
|
||||||
|
@ -226,22 +227,16 @@ private:
|
||||||
return m_flags == VISIBLE;
|
return m_flags == VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIEW* m_view; ///< Current dynamic view the item is assigned to.
|
||||||
|
int m_flags; ///< Visibility flags
|
||||||
|
int m_requiredUpdate; ///< Flag required for updating
|
||||||
|
int m_drawPriority; ///< Order to draw this item in a layer, lowest first
|
||||||
|
|
||||||
VIEW* m_view; ///< Current dynamic view the item is assigned to.
|
std::pair<int, int>* m_groups; ///< layer_number:group_id pairs for each layer the
|
||||||
int m_flags; ///< Visibility flags
|
///< item occupies.
|
||||||
int m_requiredUpdate; ///< Flag required for updating
|
int m_groupsSize;
|
||||||
int m_drawPriority; ///< Order to draw this item in a layer, lowest first
|
|
||||||
|
|
||||||
///< Helper for storing cached items group ids
|
std::vector<int> m_layers; /// Stores layer numbers used by the item.
|
||||||
typedef std::pair<int, int> GroupPair;
|
|
||||||
|
|
||||||
///< Indexes of cached GAL display lists corresponding to the item (for every layer it.
|
|
||||||
///< occupies)(in the std::pair "first" stores layer number, "second" stores group id).
|
|
||||||
GroupPair* m_groups;
|
|
||||||
int m_groupsSize;
|
|
||||||
|
|
||||||
/// Stores layer numbers used by the item.
|
|
||||||
std::vector<int> m_layers;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -415,7 +410,7 @@ struct QUERY_VISITOR
|
||||||
|
|
||||||
bool operator()( VIEW_ITEM* aItem )
|
bool operator()( VIEW_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( aItem->viewPrivData()->getFlags() & VISIBLE )
|
if( aItem->viewPrivData()->GetFlags() & VISIBLE )
|
||||||
m_cont.push_back( VIEW::LAYER_ITEM_PAIR( aItem, m_layer ) );
|
m_cont.push_back( VIEW::LAYER_ITEM_PAIR( aItem, m_layer ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -733,7 +728,7 @@ struct VIEW::UPDATE_COLOR_VISITOR
|
||||||
{
|
{
|
||||||
// Obtain the color that should be used for coloring the item
|
// Obtain the color that should be used for coloring the item
|
||||||
const COLOR4D color = painter->GetSettings()->GetColor( aItem, layer );
|
const COLOR4D color = painter->GetSettings()->GetColor( aItem, layer );
|
||||||
int group = aItem->viewPrivData()->getGroup( layer );
|
int group = aItem->viewPrivData()->getGroup( layer );
|
||||||
|
|
||||||
if( group >= 0 )
|
if( group >= 0 )
|
||||||
gal->ChangeGroupColor( group, color );
|
gal->ChangeGroupColor( group, color );
|
||||||
|
@ -787,7 +782,7 @@ void VIEW::UpdateAllLayersColor()
|
||||||
for( int i = 0; i < layers_count; ++i )
|
for( int i = 0; i < layers_count; ++i )
|
||||||
{
|
{
|
||||||
const COLOR4D color = m_painter->GetSettings()->GetColor( item, layers[i] );
|
const COLOR4D color = m_painter->GetSettings()->GetColor( item, layers[i] );
|
||||||
int group = viewData->getGroup( layers[i] );
|
int group = viewData->getGroup( layers[i] );
|
||||||
|
|
||||||
if( group >= 0 )
|
if( group >= 0 )
|
||||||
m_gal->ChangeGroupColor( group, color );
|
m_gal->ChangeGroupColor( group, color );
|
||||||
|
@ -946,8 +941,8 @@ struct VIEW::DRAW_ITEM_VISITOR
|
||||||
wxCHECK( aItem->viewPrivData(), false );
|
wxCHECK( aItem->viewPrivData(), false );
|
||||||
|
|
||||||
// Conditions that have to be fulfilled for an item to be drawn
|
// Conditions that have to be fulfilled for an item to be drawn
|
||||||
bool drawCondition = aItem->viewPrivData()->isRenderable() &&
|
bool drawCondition = aItem->viewPrivData()->isRenderable()
|
||||||
aItem->ViewGetLOD( layer, view ) < view->m_scale;
|
&& aItem->ViewGetLOD( layer, view ) < view->m_scale;
|
||||||
if( !drawCondition )
|
if( !drawCondition )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -962,15 +957,21 @@ struct VIEW::DRAW_ITEM_VISITOR
|
||||||
void deferredDraw()
|
void deferredDraw()
|
||||||
{
|
{
|
||||||
if( reverseDrawOrder )
|
if( reverseDrawOrder )
|
||||||
|
{
|
||||||
std::sort( drawItems.begin(), drawItems.end(),
|
std::sort( drawItems.begin(), drawItems.end(),
|
||||||
[]( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
|
[]( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool
|
||||||
|
{
|
||||||
return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
|
return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
std::sort( drawItems.begin(), drawItems.end(),
|
std::sort( drawItems.begin(), drawItems.end(),
|
||||||
[]( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
|
[]( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool
|
||||||
|
{
|
||||||
return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
|
return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for( VIEW_ITEM* item : drawItems )
|
for( VIEW_ITEM* item : drawItems )
|
||||||
view->draw( item, layer );
|
view->draw( item, layer );
|
||||||
|
@ -1147,11 +1148,13 @@ void VIEW::Redraw()
|
||||||
rect.Normalize();
|
rect.Normalize();
|
||||||
BOX2I recti( rect.GetPosition(), rect.GetSize() );
|
BOX2I recti( rect.GetPosition(), rect.GetSize() );
|
||||||
|
|
||||||
// The view rtree uses integer positions. Large screens can overflow
|
// The view rtree uses integer positions. Large screens can overflow this size so in
|
||||||
// this size so in this case, simply set the rectangle to the full rtree
|
// this case, simply set the rectangle to the full rtree.
|
||||||
if( rect.GetWidth() > std::numeric_limits<int>::max() ||
|
if( rect.GetWidth() > std::numeric_limits<int>::max()
|
||||||
rect.GetHeight() > std::numeric_limits<int>::max() )
|
|| rect.GetHeight() > std::numeric_limits<int>::max() )
|
||||||
|
{
|
||||||
recti.SetMaximum();
|
recti.SetMaximum();
|
||||||
|
}
|
||||||
|
|
||||||
redrawRect( recti );
|
redrawRect( recti );
|
||||||
|
|
||||||
|
@ -1214,13 +1217,9 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
|
||||||
// updateLayers updates geometry too, so we do not have to update both of them at the
|
// updateLayers updates geometry too, so we do not have to update both of them at the
|
||||||
// same time
|
// same time
|
||||||
if( aUpdateFlags & LAYERS )
|
if( aUpdateFlags & LAYERS )
|
||||||
{
|
|
||||||
updateLayers( aItem );
|
updateLayers( aItem );
|
||||||
}
|
|
||||||
else if( aUpdateFlags & GEOMETRY )
|
else if( aUpdateFlags & GEOMETRY )
|
||||||
{
|
|
||||||
updateBbox( aItem );
|
updateBbox( aItem );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int layers[VIEW_MAX_LAYERS], layers_count;
|
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||||
|
@ -1376,11 +1375,10 @@ bool VIEW::areRequiredLayersEnabled( int aLayerId ) const
|
||||||
|
|
||||||
std::set<int>::const_iterator it, it_end;
|
std::set<int>::const_iterator it, it_end;
|
||||||
|
|
||||||
for( it = m_layers.at( aLayerId ).requiredLayers.begin(),
|
for( int layer : m_layers.at( aLayerId ).requiredLayers )
|
||||||
it_end = m_layers.at( aLayerId ).requiredLayers.end(); it != it_end; ++it )
|
|
||||||
{
|
{
|
||||||
// That is enough if just one layer is not enabled
|
// That is enough if just one layer is not enabled
|
||||||
if( !m_layers.at( *it ).visible || !areRequiredLayersEnabled( *it ) )
|
if( !m_layers.at( layer ).visible || !areRequiredLayersEnabled( layer ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,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) 2013 CERN
|
* Copyright (C) 2013 CERN
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* @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
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <algorithm>
|
#include <core/kicad_algo.h>
|
||||||
#include <view/view_group.h>
|
#include <view/view_group.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <painter.h>
|
#include <painter.h>
|
||||||
|
@ -61,14 +62,7 @@ void VIEW_GROUP::Add( VIEW_ITEM* aItem )
|
||||||
|
|
||||||
void VIEW_GROUP::Remove( VIEW_ITEM* aItem )
|
void VIEW_GROUP::Remove( VIEW_ITEM* aItem )
|
||||||
{
|
{
|
||||||
for( auto iter = m_groupItems.begin(); iter != m_groupItems.end(); ++iter )
|
alg::delete_matching( m_groupItems, aItem );
|
||||||
{
|
|
||||||
if( aItem == *iter )
|
|
||||||
{
|
|
||||||
m_groupItems.erase( iter );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +96,7 @@ const BOX2I VIEW_GROUP::ViewBBox() const
|
||||||
{
|
{
|
||||||
bb = m_groupItems[0]->ViewBBox();
|
bb = m_groupItems[0]->ViewBBox();
|
||||||
|
|
||||||
for( auto item : m_groupItems )
|
for( VIEW_ITEM* item : m_groupItems )
|
||||||
bb.Merge( item->ViewBBox() );
|
bb.Merge( item->ViewBBox() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +198,7 @@ void VIEW_GROUP::FreeItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const VIEW_GROUP::ITEMS VIEW_GROUP::updateDrawList() const
|
const std::vector<VIEW_ITEM*> VIEW_GROUP::updateDrawList() const
|
||||||
{
|
{
|
||||||
return m_groupItems;
|
return m_groupItems;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,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) 2013-2016 CERN
|
* Copyright (C) 2013-2016 CERN
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -22,8 +23,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gal/definitions.h>
|
|
||||||
|
|
||||||
#include <view/view_item.h>
|
#include <view/view_item.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,9 @@ struct VIEW_OVERLAY::COMMAND_LINE : public VIEW_OVERLAY::COMMAND
|
||||||
struct VIEW_OVERLAY::COMMAND_RECTANGLE : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_RECTANGLE : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_RECTANGLE( const VECTOR2D& aP0, const VECTOR2D& aP1 ) :
|
COMMAND_RECTANGLE( const VECTOR2D& aP0, const VECTOR2D& aP1 ) :
|
||||||
m_p0( aP0 ), m_p1( aP1 )
|
m_p0( aP0 ),
|
||||||
{}
|
m_p1( aP1 )
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -78,7 +79,8 @@ struct VIEW_OVERLAY::COMMAND_CIRCLE : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_CIRCLE( const VECTOR2D& aCenter, double aRadius ) :
|
COMMAND_CIRCLE( const VECTOR2D& aCenter, double aRadius ) :
|
||||||
m_center(aCenter),
|
m_center(aCenter),
|
||||||
m_radius(aRadius) {}
|
m_radius(aRadius)
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -114,7 +116,8 @@ struct VIEW_OVERLAY::COMMAND_ARC : public VIEW_OVERLAY::COMMAND
|
||||||
struct VIEW_OVERLAY::COMMAND_POLYGON : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_POLYGON : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_POLYGON( const std::deque<VECTOR2D>& aPointList ) :
|
COMMAND_POLYGON( const std::deque<VECTOR2D>& aPointList ) :
|
||||||
m_pointList( aPointList ) {}
|
m_pointList( aPointList )
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -128,7 +131,8 @@ struct VIEW_OVERLAY::COMMAND_POLYGON : public VIEW_OVERLAY::COMMAND
|
||||||
struct VIEW_OVERLAY::COMMAND_POLY_POLYGON : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_POLY_POLYGON : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_POLY_POLYGON( const SHAPE_POLY_SET& aPolySet ) :
|
COMMAND_POLY_POLYGON( const SHAPE_POLY_SET& aPolySet ) :
|
||||||
m_polySet( aPolySet ) {}
|
m_polySet( aPolySet )
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -161,7 +165,8 @@ struct VIEW_OVERLAY::COMMAND_POINT_POLYGON : public VIEW_OVERLAY::COMMAND
|
||||||
struct VIEW_OVERLAY::COMMAND_SET_STROKE : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_SET_STROKE : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_SET_STROKE( bool aIsStroke ) :
|
COMMAND_SET_STROKE( bool aIsStroke ) :
|
||||||
m_isStroke( aIsStroke ) {}
|
m_isStroke( aIsStroke )
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -175,7 +180,8 @@ struct VIEW_OVERLAY::COMMAND_SET_STROKE : public VIEW_OVERLAY::COMMAND
|
||||||
struct VIEW_OVERLAY::COMMAND_SET_FILL : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_SET_FILL : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_SET_FILL( bool aIsFill ) :
|
COMMAND_SET_FILL( bool aIsFill ) :
|
||||||
m_isFill( aIsFill ) {}
|
m_isFill( aIsFill )
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -190,7 +196,8 @@ struct VIEW_OVERLAY::COMMAND_SET_COLOR : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_SET_COLOR( bool aIsStroke, const COLOR4D& aColor ) :
|
COMMAND_SET_COLOR( bool aIsStroke, const COLOR4D& aColor ) :
|
||||||
m_isStroke( aIsStroke ),
|
m_isStroke( aIsStroke ),
|
||||||
m_color( aColor ) {}
|
m_color( aColor )
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -200,15 +207,16 @@ struct VIEW_OVERLAY::COMMAND_SET_COLOR : public VIEW_OVERLAY::COMMAND
|
||||||
aView->GetGAL()->SetFillColor( m_color );
|
aView->GetGAL()->SetFillColor( m_color );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool m_isStroke;
|
bool m_isStroke;
|
||||||
COLOR4D m_color;
|
COLOR4D m_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct VIEW_OVERLAY::COMMAND_SET_WIDTH : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_SET_WIDTH : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_SET_WIDTH( double aWidth ) :
|
COMMAND_SET_WIDTH( double aWidth ) :
|
||||||
m_width( aWidth ) {}
|
m_width( aWidth )
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -222,7 +230,8 @@ struct VIEW_OVERLAY::COMMAND_SET_WIDTH : public VIEW_OVERLAY::COMMAND
|
||||||
struct VIEW_OVERLAY::COMMAND_GLYPH_SIZE : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_GLYPH_SIZE : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_GLYPH_SIZE( const VECTOR2D aSize ) :
|
COMMAND_GLYPH_SIZE( const VECTOR2D aSize ) :
|
||||||
m_size( aSize ) {};
|
m_size( aSize )
|
||||||
|
{ };
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -235,11 +244,11 @@ struct VIEW_OVERLAY::COMMAND_GLYPH_SIZE : public VIEW_OVERLAY::COMMAND
|
||||||
|
|
||||||
struct VIEW_OVERLAY::COMMAND_BITMAP_TEXT : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_BITMAP_TEXT : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_BITMAP_TEXT( const wxString& aText, const VECTOR2D& aPosition,
|
COMMAND_BITMAP_TEXT( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle ) :
|
||||||
double aRotationAngle ) :
|
|
||||||
m_text( aText ),
|
m_text( aText ),
|
||||||
m_pos( aPosition ),
|
m_pos( aPosition ),
|
||||||
m_angle (aRotationAngle) {};
|
m_angle (aRotationAngle)
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void Execute( VIEW* aView ) const override
|
virtual void Execute( VIEW* aView ) const override
|
||||||
{
|
{
|
||||||
|
@ -264,7 +273,7 @@ VIEW_OVERLAY::~VIEW_OVERLAY()
|
||||||
|
|
||||||
void VIEW_OVERLAY::releaseCommands()
|
void VIEW_OVERLAY::releaseCommands()
|
||||||
{
|
{
|
||||||
for( auto cmd : m_commands )
|
for( VIEW_OVERLAY::COMMAND* cmd : m_commands )
|
||||||
delete cmd;
|
delete cmd;
|
||||||
|
|
||||||
m_commands.clear();
|
m_commands.clear();
|
||||||
|
@ -288,7 +297,7 @@ const BOX2I VIEW_OVERLAY::ViewBBox() const
|
||||||
|
|
||||||
void VIEW_OVERLAY::ViewDraw( int aLayer, VIEW* aView ) const
|
void VIEW_OVERLAY::ViewDraw( int aLayer, VIEW* aView ) const
|
||||||
{
|
{
|
||||||
for( const auto& cmd : m_commands )
|
for( const VIEW_OVERLAY::COMMAND* cmd : m_commands )
|
||||||
cmd->Execute( aView );
|
cmd->Execute( aView );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,10 +332,9 @@ void VIEW_OVERLAY::Polyline( const SHAPE_LINE_CHAIN& aPolyLine )
|
||||||
{
|
{
|
||||||
SetIsStroke( true );
|
SetIsStroke( true );
|
||||||
SetIsFill( false );
|
SetIsFill( false );
|
||||||
|
|
||||||
for( int i = 0; i < aPolyLine.SegmentCount(); i++ )
|
for( int i = 0; i < aPolyLine.SegmentCount(); i++ )
|
||||||
{
|
|
||||||
Line( aPolyLine.CSegment( i ) );
|
Line( aPolyLine.CSegment( i ) );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,8 +362,8 @@ void VIEW_OVERLAY::Circle( const VECTOR2D& aCenterPoint, double aRadius )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void VIEW_OVERLAY::Arc( const VECTOR2D& aCenterPoint,
|
void VIEW_OVERLAY::Arc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle,
|
||||||
double aRadius, double aStartAngle, double aEndAngle )
|
double aEndAngle )
|
||||||
{
|
{
|
||||||
m_commands.push_back( new COMMAND_ARC( aCenterPoint, aRadius, aStartAngle, aEndAngle ) );
|
m_commands.push_back( new COMMAND_ARC( aCenterPoint, aRadius, aStartAngle, aEndAngle ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,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) 2013-2017 CERN
|
* Copyright (C) 2013-2017 CERN
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -171,7 +172,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool HasType( KICAD_T aType ) const;
|
bool HasType( KICAD_T aType ) const;
|
||||||
|
|
||||||
virtual const VIEW_GROUP::ITEMS updateDrawList() const override;
|
virtual const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
|
||||||
|
|
||||||
bool HasReferencePoint() const
|
bool HasReferencePoint() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -645,13 +645,6 @@ public:
|
||||||
m_dirtyTargets[i] = false;
|
m_dirtyTargets[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an item to a list of items that are going to be refreshed upon the next frame rendering.
|
|
||||||
*
|
|
||||||
* @param aItem is the item to be refreshed.
|
|
||||||
*/
|
|
||||||
void MarkForUpdate( VIEW_ITEM* aItem );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through the list of items that asked for updating and updates them.
|
* Iterate through the list of items that asked for updating and updates them.
|
||||||
*/
|
*/
|
||||||
|
@ -689,14 +682,6 @@ public:
|
||||||
m_useDrawPriority = aFlag;
|
m_useDrawPriority = aFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if draw order is reversed
|
|
||||||
*/
|
|
||||||
bool IsDrawOrderReversed() const
|
|
||||||
{
|
|
||||||
return m_reverseDrawOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only takes effect if UseDrawPriority is true.
|
* Only takes effect if UseDrawPriority is true.
|
||||||
*
|
*
|
||||||
|
@ -831,40 +816,30 @@ protected:
|
||||||
std::vector<EDA_ITEM *> m_ownedItems;
|
std::vector<EDA_ITEM *> m_ownedItems;
|
||||||
|
|
||||||
///< Whether to use rendering order modifier or not.
|
///< Whether to use rendering order modifier or not.
|
||||||
bool m_enableOrderModifier;
|
bool m_enableOrderModifier;
|
||||||
|
|
||||||
///< The set of possible displayed layers and its properties.
|
///< The set of possible displayed layers and its properties.
|
||||||
std::vector<VIEW_LAYER> m_layers;
|
std::vector<VIEW_LAYER> m_layers;
|
||||||
|
|
||||||
///< Sorted list of pointers to members of m_layers.
|
///< Sorted list of pointers to members of m_layers.
|
||||||
std::vector<VIEW_LAYER*> m_orderedLayers;
|
std::vector<VIEW_LAYER*> m_orderedLayers;
|
||||||
|
|
||||||
///< Flat list of all items.
|
///< Flat list of all items.
|
||||||
std::shared_ptr<std::vector<VIEW_ITEM*>> m_allItems;
|
std::shared_ptr<std::vector<VIEW_ITEM*>> m_allItems;
|
||||||
|
|
||||||
///< The set of layers that are displayed on the top.
|
///< The set of layers that are displayed on the top.
|
||||||
std::set<unsigned int> m_topLayers;
|
std::set<unsigned int> m_topLayers;
|
||||||
|
|
||||||
///< Center point of the VIEW (the point at which we are looking at).
|
///< Center point of the VIEW (the point at which we are looking at).
|
||||||
VECTOR2D m_center;
|
VECTOR2D m_center;
|
||||||
|
|
||||||
///< Scale of displayed VIEW_ITEMs.
|
double m_scale;
|
||||||
double m_scale;
|
BOX2D m_boundary;
|
||||||
|
double m_minScale;
|
||||||
|
double m_maxScale;
|
||||||
|
|
||||||
///< View boundaries.
|
bool m_mirrorX;
|
||||||
BOX2D m_boundary;
|
bool m_mirrorY;
|
||||||
|
|
||||||
///< Scale lower limit.
|
|
||||||
double m_minScale;
|
|
||||||
|
|
||||||
///< Scale upper limit.
|
|
||||||
double m_maxScale;
|
|
||||||
|
|
||||||
///< Horizontal flip flag.
|
|
||||||
bool m_mirrorX;
|
|
||||||
|
|
||||||
///< Vertical flip flag.
|
|
||||||
bool m_mirrorY;
|
|
||||||
|
|
||||||
///< PAINTER contains information how do draw items.
|
///< PAINTER contains information how do draw items.
|
||||||
PAINTER* m_painter;
|
PAINTER* m_painter;
|
||||||
|
|
|
@ -51,22 +51,16 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of stored items.
|
* Return the number of stored items.
|
||||||
*
|
|
||||||
* @return Number of stored items.
|
|
||||||
*/
|
*/
|
||||||
virtual unsigned int GetSize() const;
|
virtual unsigned int GetSize() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an item to the group.
|
* Add an item to the group.
|
||||||
*
|
|
||||||
* @param aItem is the item to be added.
|
|
||||||
*/
|
*/
|
||||||
virtual void Add( VIEW_ITEM* aItem );
|
virtual void Add( VIEW_ITEM* aItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an item from the group.
|
* Remove an item from the group.
|
||||||
*
|
|
||||||
* @param aItem is the item to be removed.
|
|
||||||
*/
|
*/
|
||||||
virtual void Remove( VIEW_ITEM* aItem );
|
virtual void Remove( VIEW_ITEM* aItem );
|
||||||
|
|
||||||
|
@ -79,8 +73,6 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the bounding box for all stored items covering all its layers.
|
* Return the bounding box for all stored items covering all its layers.
|
||||||
*
|
|
||||||
* @return The current bounding box
|
|
||||||
*/
|
*/
|
||||||
virtual const BOX2I ViewBBox() const override;
|
virtual const BOX2I ViewBBox() const override;
|
||||||
|
|
||||||
|
@ -102,8 +94,6 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set layer used to draw the group.
|
* Set layer used to draw the group.
|
||||||
*
|
|
||||||
* @param aLayer is the layer used for drawing.
|
|
||||||
*/
|
*/
|
||||||
inline virtual void SetLayer( int aLayer )
|
inline virtual void SetLayer( int aLayer )
|
||||||
{
|
{
|
||||||
|
@ -116,15 +106,11 @@ public:
|
||||||
void FreeItems();
|
void FreeItems();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::vector<VIEW_ITEM*> ITEMS;
|
virtual const std::vector<VIEW_ITEM*> updateDrawList() const;
|
||||||
|
|
||||||
virtual const ITEMS updateDrawList() const;
|
protected:
|
||||||
|
int m_layer;
|
||||||
///< Layer on which the group is drawn.
|
std::vector<VIEW_ITEM*> m_groupItems;
|
||||||
int m_layer;
|
|
||||||
|
|
||||||
///< Container for storing VIEW_ITEMs.
|
|
||||||
ITEMS m_groupItems;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace KIGFX
|
} // namespace KIGFX
|
||||||
|
|
|
@ -2,7 +2,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) 2013-2016 CERN
|
* Copyright (C) 2013-2016 CERN
|
||||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -24,11 +24,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file view_item.h
|
|
||||||
* @brief VIEW_ITEM class definition.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __VIEW_ITEM_H
|
#ifndef __VIEW_ITEM_H
|
||||||
#define __VIEW_ITEM_H
|
#define __VIEW_ITEM_H
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2013-2017 CERN
|
* Copyright (C) 2013-2017 CERN
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
* Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2017-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -24,8 +24,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
|
|
||||||
|
@ -84,7 +82,7 @@ EDA_ITEM* PCB_SELECTION::GetTopLeftItem( bool aFootprintsOnly ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const KIGFX::VIEW_GROUP::ITEMS PCB_SELECTION::updateDrawList() const
|
const std::vector<KIGFX::VIEW_ITEM*> PCB_SELECTION::updateDrawList() const
|
||||||
{
|
{
|
||||||
std::vector<VIEW_ITEM*> items;
|
std::vector<VIEW_ITEM*> items;
|
||||||
|
|
||||||
|
|
|
@ -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) 2019 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2019-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +33,7 @@ class PCB_SELECTION : public SELECTION
|
||||||
public:
|
public:
|
||||||
EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override;
|
EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override;
|
||||||
|
|
||||||
const KIGFX::VIEW_GROUP::ITEMS updateDrawList() const override;
|
const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
|
||||||
|
|
||||||
const LSET GetSelectionLayers();
|
const LSET GetSelectionLayers();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue