15% rendering optimization in PCB_TRACK::ViewGetLOD.
This commit is contained in:
parent
8268234aa1
commit
13ce2ebf46
|
@ -137,6 +137,12 @@ wxString BOARD_CONNECTED_ITEM::GetShortNetname() const
|
|||
}
|
||||
|
||||
|
||||
wxString BOARD_CONNECTED_ITEM::GetUnescapedShortNetname() const
|
||||
{
|
||||
return m_netinfo ? m_netinfo->GetUnescapedShortNetname() : wxString();
|
||||
}
|
||||
|
||||
|
||||
static struct BOARD_CONNECTED_ITEM_DESC
|
||||
{
|
||||
BOARD_CONNECTED_ITEM_DESC()
|
||||
|
|
|
@ -124,6 +124,11 @@ public:
|
|||
*/
|
||||
wxString GetShortNetname() const;
|
||||
|
||||
/**
|
||||
* @return the unescaped short netname.
|
||||
*/
|
||||
wxString GetUnescapedShortNetname() const;
|
||||
|
||||
/**
|
||||
* Return an item's "own" clearance in internal units.
|
||||
*
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <gr_basic.h>
|
||||
#include <netclass.h>
|
||||
#include <board_item.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
|
||||
|
||||
|
@ -123,6 +124,11 @@ public:
|
|||
*/
|
||||
const wxString& GetShortNetname() const { return m_shortNetname; }
|
||||
|
||||
/**
|
||||
* @return the unescaped short netname.
|
||||
*/
|
||||
const wxString& GetUnescapedShortNetname() const { return m_unescapedShortNetname; }
|
||||
|
||||
/**
|
||||
* @return true if the net was not labelled by the user.
|
||||
*/
|
||||
|
@ -133,8 +139,8 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the long netname to \a aNetName, and the short netname to the last token in
|
||||
* the long netname's path.
|
||||
* Set the long netname to \a aNetName, the short netname to the last token in
|
||||
* the long netname's path, and the unescaped short netname.
|
||||
*/
|
||||
void SetNetname( const wxString& aNewName )
|
||||
{
|
||||
|
@ -144,6 +150,8 @@ public:
|
|||
m_shortNetname = aNewName.AfterLast( '/' );
|
||||
else
|
||||
m_shortNetname = aNewName;
|
||||
|
||||
m_unescapedShortNetname = UnescapeString( m_shortNetname );
|
||||
}
|
||||
|
||||
bool IsCurrent() const { return m_isCurrent; }
|
||||
|
@ -172,9 +180,10 @@ public:
|
|||
private:
|
||||
friend class NETINFO_LIST;
|
||||
|
||||
int m_netCode; ///< A number equivalent to the net name.
|
||||
wxString m_netname; ///< Full net name like /sheet/subsheet/vout used by Eeschema.
|
||||
wxString m_shortNetname; ///< short net name, like vout from /sheet/subsheet/vout.
|
||||
int m_netCode; ///< A number equivalent to the net name.
|
||||
wxString m_netname; ///< Full net name like /sheet/subsheet/vout used by Eeschema.
|
||||
wxString m_shortNetname; ///< Short net name, like vout from /sheet/subsheet/vout.
|
||||
wxString m_unescapedShortNetname; ///< Unescaped short net name.
|
||||
|
||||
std::shared_ptr<NETCLASS> m_netClass;
|
||||
|
||||
|
|
|
@ -685,7 +685,7 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
|
|||
|
||||
ClipLine( &clipBox, visibleSeg.A.x, visibleSeg.A.y, visibleSeg.B.x, visibleSeg.B.y );
|
||||
|
||||
wxString netName = UnescapeString( aTrack->GetShortNetname() );
|
||||
wxString netName = aTrack->GetUnescapedShortNetname();
|
||||
size_t num_char = netName.size();
|
||||
|
||||
// Check if the track is long enough to have a netname displayed
|
||||
|
@ -904,7 +904,7 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer )
|
|||
// the netname
|
||||
VECTOR2D textpos( 0.0, 0.0 );
|
||||
|
||||
wxString netname = UnescapeString( aVia->GetShortNetname() );
|
||||
wxString netname = aVia->GetUnescapedShortNetname();
|
||||
|
||||
int topLayer = aVia->TopLayer() + 1;
|
||||
int bottomLayer = std::min( aVia->BottomLayer() + 1, board->GetCopperLayerCount() );
|
||||
|
@ -1088,13 +1088,13 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
|||
padNumber = UnescapeString( aPad->GetNumber() );
|
||||
|
||||
if( dynamic_cast<CVPCB_SETTINGS*>( viewer_settings() ) )
|
||||
netname = UnescapeString( aPad->GetShortNetname() );
|
||||
netname = aPad->GetUnescapedShortNetname();
|
||||
}
|
||||
|
||||
if( displayOpts )
|
||||
{
|
||||
if( displayOpts->m_NetNames == 1 || displayOpts->m_NetNames == 3 )
|
||||
netname = UnescapeString( aPad->GetShortNetname() );
|
||||
netname = aPad->GetUnescapedShortNetname();
|
||||
|
||||
if( aPad->IsNoConnectPad() )
|
||||
netname = wxT( "x" );
|
||||
|
|
|
@ -701,7 +701,7 @@ double PCB_TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
|||
}
|
||||
|
||||
// Pick the approximate size of the netname (square chars)
|
||||
wxString netName = UnescapeString( GetShortNetname() );
|
||||
wxString netName = GetUnescapedShortNetname();
|
||||
size_t num_chars = netName.size();
|
||||
|
||||
if( GetLength() < num_chars * GetWidth() )
|
||||
|
|
Loading…
Reference in New Issue