pcbnew: Optimized zone filling algorithm: code cleanup
This commit is contained in:
parent
d1d9e57b86
commit
8df299a6bc
|
@ -478,7 +478,6 @@ include( CheckFindPackageResult )
|
||||||
find_package( OpenMP )
|
find_package( OpenMP )
|
||||||
|
|
||||||
if( OPENMP_FOUND )
|
if( OPENMP_FOUND )
|
||||||
message( "FOUND OPENMP" )
|
|
||||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
||||||
add_definitions( -DUSE_OPENMP )
|
add_definitions( -DUSE_OPENMP )
|
||||||
|
|
|
@ -1513,6 +1513,7 @@ void OPENGL_GAL::drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRa
|
||||||
Restore();
|
Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
|
void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
|
||||||
{
|
{
|
||||||
currentManager->Shader( SHADER_NONE );
|
currentManager->Shader( SHADER_NONE );
|
||||||
|
|
|
@ -659,8 +659,6 @@ void SHAPE_POLY_SET::importTree( PolyTree* tree )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Polygon fracturing code. Work in progress.
|
|
||||||
|
|
||||||
struct FractureEdge
|
struct FractureEdge
|
||||||
{
|
{
|
||||||
FractureEdge( bool connected, SHAPE_LINE_CHAIN* owner, int index ) :
|
FractureEdge( bool connected, SHAPE_LINE_CHAIN* owner, int index ) :
|
||||||
|
|
|
@ -65,7 +65,9 @@ class SHAPE_POLY_SET : public SHAPE
|
||||||
|
|
||||||
struct TRI
|
struct TRI
|
||||||
{
|
{
|
||||||
TRI(){};
|
TRI()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int a, b, c;
|
int a, b, c;
|
||||||
};
|
};
|
||||||
|
@ -810,6 +812,8 @@ class SHAPE_POLY_SET : public SHAPE
|
||||||
///> For aFastMode meaning, see function booleanOp
|
///> For aFastMode meaning, see function booleanOp
|
||||||
void Fracture( POLYGON_MODE aFastMode );
|
void Fracture( POLYGON_MODE aFastMode );
|
||||||
|
|
||||||
|
///> Converts a single outline slitted ("fractured") polygon into a set ouf outlines
|
||||||
|
///> with holes.
|
||||||
void Unfracture( POLYGON_MODE aFastMode );
|
void Unfracture( POLYGON_MODE aFastMode );
|
||||||
|
|
||||||
///> Returns true if the polygon set has any holes.
|
///> Returns true if the polygon set has any holes.
|
||||||
|
|
|
@ -120,10 +120,10 @@ public:
|
||||||
|
|
||||||
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
|
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
|
||||||
|
|
||||||
void SetLayerSet( LSET aLayerSet );
|
void SetLayerSet( LSET aLayerSet );
|
||||||
|
|
||||||
virtual LSET GetLayerSet() const override;
|
virtual LSET GetLayerSet() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Draw
|
* Function Draw
|
||||||
* Draws the zone outline.
|
* Draws the zone outline.
|
||||||
|
@ -180,22 +180,22 @@ public:
|
||||||
* Function IsOnCopperLayer
|
* Function IsOnCopperLayer
|
||||||
* @return true if this zone is on a copper layer, false if on a technical layer
|
* @return true if this zone is on a copper layer, false if on a technical layer
|
||||||
*/
|
*/
|
||||||
bool IsOnCopperLayer() const;
|
bool IsOnCopperLayer() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function CommonLayerExist
|
||||||
|
* Test if this zone shares a common layer with the given layer set
|
||||||
|
*/
|
||||||
|
bool CommonLayerExists( const LSET aLayerSet ) const;
|
||||||
|
|
||||||
|
virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
|
||||||
|
|
||||||
|
virtual PCB_LAYER_ID GetLayer() const override;
|
||||||
|
|
||||||
|
virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
|
||||||
|
|
||||||
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Function CommonLayerExist
|
|
||||||
* Test if this zone shares a common layer with the given layer set
|
|
||||||
*/
|
|
||||||
bool CommonLayerExists( const LSET aLayerSet ) const;
|
|
||||||
|
|
||||||
virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
|
|
||||||
|
|
||||||
virtual PCB_LAYER_ID GetLayer() const override;
|
|
||||||
|
|
||||||
virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
|
|
||||||
|
|
||||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
|
||||||
|
|
||||||
/// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
|
/// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
|
||||||
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
|
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
|
||||||
int GetFillMode() const { return m_FillMode; }
|
int GetFillMode() const { return m_FillMode; }
|
||||||
|
@ -599,9 +599,9 @@ public:
|
||||||
* returns a reference to the list of filled polygons.
|
* returns a reference to the list of filled polygons.
|
||||||
* @return Reference to the list of filled polygons.
|
* @return Reference to the list of filled polygons.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//TODO - This should be called for each layer on which the zone exists
|
//TODO - This should be called for each layer on which the zone exists
|
||||||
|
|
||||||
const SHAPE_POLY_SET& GetFilledPolysList() const
|
const SHAPE_POLY_SET& GetFilledPolysList() const
|
||||||
{
|
{
|
||||||
return m_FilledPolysList;
|
return m_FilledPolysList;
|
||||||
|
@ -735,6 +735,7 @@ public:
|
||||||
|
|
||||||
const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
|
const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||||
#endif
|
#endif
|
||||||
|
@ -749,8 +750,8 @@ private:
|
||||||
int m_cornerSmoothingType;
|
int m_cornerSmoothingType;
|
||||||
unsigned int m_cornerRadius;
|
unsigned int m_cornerRadius;
|
||||||
|
|
||||||
LSET m_layerSet;
|
LSET m_layerSet;
|
||||||
|
|
||||||
/* Priority: when a zone outline is inside and other zone, if its priority is higher
|
/* Priority: when a zone outline is inside and other zone, if its priority is higher
|
||||||
* the other zone priority, it will be created inside.
|
* the other zone priority, it will be created inside.
|
||||||
* if priorities are equal, a DRC error is set
|
* if priorities are equal, a DRC error is set
|
||||||
|
@ -815,7 +816,6 @@ private:
|
||||||
HATCH_STYLE m_hatchStyle; // hatch style, see enum above
|
HATCH_STYLE m_hatchStyle; // hatch style, see enum above
|
||||||
int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
|
int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
|
||||||
std::vector<SEG> m_HatchLines; // hatch lines
|
std::vector<SEG> m_HatchLines; // hatch lines
|
||||||
|
|
||||||
std::vector<int> m_insulatedIslands;
|
std::vector<int> m_insulatedIslands;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -293,11 +293,11 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
||||||
{
|
{
|
||||||
std::mutex cnListLock;
|
std::mutex cnListLock;
|
||||||
|
|
||||||
//PROF_COUNTER cnt("search");
|
|
||||||
int totalDirtyCount = 0;
|
int totalDirtyCount = 0;
|
||||||
|
|
||||||
if( m_lastSearchWithZones != aIncludeZones )
|
if( m_lastSearchWithZones != aIncludeZones )
|
||||||
|
@ -627,7 +627,6 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
|
||||||
CN_ITEM* head = nullptr;
|
CN_ITEM* head = nullptr;
|
||||||
CLUSTERS clusters;
|
CLUSTERS clusters;
|
||||||
|
|
||||||
|
|
||||||
if( isDirty() )
|
if( isDirty() )
|
||||||
searchConnections( includeZones );
|
searchConnections( includeZones );
|
||||||
|
|
||||||
|
@ -837,6 +836,7 @@ void CN_CONNECTIVITY_ALGO::PropagateNets()
|
||||||
propagateConnections();
|
propagateConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands )
|
void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands )
|
||||||
{
|
{
|
||||||
if( aZone->GetFilledPolysList().IsEmpty() )
|
if( aZone->GetFilledPolysList().IsEmpty() )
|
||||||
|
|
|
@ -1144,33 +1144,6 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone, int aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gal->DrawPolygon( polySet );
|
m_gal->DrawPolygon( polySet );
|
||||||
|
|
||||||
#if 0
|
|
||||||
for( int i = 0; i < polySet.OutlineCount(); i++ )
|
|
||||||
{
|
|
||||||
const SHAPE_LINE_CHAIN& outline = polySet.COutline( i );
|
|
||||||
// fixme: GAL drawing API that accepts SHAPEs directly (this fiddling with double<>int conversion
|
|
||||||
// is just a performance hog)
|
|
||||||
|
|
||||||
for( int j = 0; j < outline.PointCount(); j++ )
|
|
||||||
corners.push_back ( (VECTOR2D) outline.CPoint( j ) );
|
|
||||||
|
|
||||||
corners.push_back( (VECTOR2D) outline.CPoint( 0 ) );
|
|
||||||
|
|
||||||
if( displayMode == PCB_RENDER_SETTINGS::DZ_SHOW_FILLED )
|
|
||||||
{
|
|
||||||
m_gal->DrawPolygon( corners );
|
|
||||||
m_gal->DrawPolyline( corners );
|
|
||||||
}
|
|
||||||
else if( displayMode == PCB_RENDER_SETTINGS::DZ_SHOW_OUTLINED )
|
|
||||||
{
|
|
||||||
m_gal->DrawPolyline( corners );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
corners.clear();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue