Commenting and formatting.

This commit is contained in:
Jeff Young 2020-08-18 14:26:22 +01:00
parent 6b0176d577
commit 1cce03acb1
2 changed files with 47 additions and 62 deletions

View File

@ -139,7 +139,7 @@ void ZONE_CONTAINER::InitDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone )
m_ThermalReliefGap = aZone.m_ThermalReliefGap;
m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
m_FillMode = aZone.m_FillMode; // solid vs. hatched
m_hatchThickness = aZone.m_hatchThickness;
m_hatchGap = aZone.m_hatchGap;
m_hatchOrientation = aZone.m_hatchOrientation;
@ -171,7 +171,6 @@ void ZONE_CONTAINER::InitDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone )
m_hv45 = aZone.m_hv45;
m_area = aZone.m_area;
}
@ -272,11 +271,8 @@ void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet )
m_layerSet = aLayerSet;
// Set the single layer parameter.
// For zones that can be on many layers, this parameter does not have
// really meaning and is a bit arbitrary if more than one layer is set.
// But many functions are using it.
// So we need to initialize it to a reasonable value.
// Set the single layer parameter. For zones that can be on many layers, this parameter
// is arbitrary at best, but some code still uses it.
// Priority is F_Cu then B_Cu then to the first selected layer
m_Layer = aLayerSet.Seq()[0];
@ -497,8 +493,7 @@ bool ZONE_CONTAINER::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
{
return arect.Contains( bbox );
}
else // Test for intersection between aBox and the polygon
// For a polygon, using its bounding box has no sense here
else
{
// Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
if( !arect.Intersects( bbox ) )
@ -513,16 +508,12 @@ bool ZONE_CONTAINER::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
// Test if the point is within the rect
if( arect.Contains( ( wxPoint ) vertex ) )
{
return true;
}
// Test if this edge intersects the rect
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
{
return true;
}
}
return false;
}
@ -594,8 +585,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
else
msg = _( "Non-copper Zone" );
// Display Cutout instead of Outline for holes inside a zone
// i.e. when num contour !=0
// Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
// Check whether the selected corner is in a hole; i.e., in any contour but the first one.
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
msg << wxT( " " ) << _( "Cutout" );
@ -754,28 +744,26 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset, int aEdge )
}
void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
void ZONE_CONTAINER::Rotate( const wxPoint& aCentre, double aAngle )
{
wxPoint pos;
aAngle = -DECIDEG2RAD( aAngle );
angle = -DECIDEG2RAD( angle );
m_Poly->Rotate( angle, VECTOR2I( centre ) );
m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
HatchBorder();
/* rotate filled areas: */
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Rotate( angle, VECTOR2I( centre ) );
pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
{
for( SEG& seg : pair.second )
{
wxPoint a( seg.A );
RotatePoint( &a, centre, angle );
RotatePoint( &a, aCentre, aAngle );
seg.A = a;
wxPoint b( seg.B );
RotatePoint( &b, centre, angle );
RotatePoint( &b, aCentre, aAngle );
seg.B = a;
}
}
@ -1266,22 +1254,18 @@ double ZONE_CONTAINER::CalculateFilledArea()
m_area += poly.Outline( i ).Area();
for( int j = 0; j < poly.HoleCount( i ); j++ )
{
m_area -= poly.Hole( i, j ).Area();
}
}
}
return m_area;
}
/* Function TransformOutlinesShapeWithClearanceToPolygon
* Convert the zone filled areas polygons to polygons
* inflated (optional) by max( aClearanceValue, the zone clearance)
* and copy them in aCornerBuffer
* @param aClearance the clearance around outlines
* @param aPreserveCorners an optional set of corners which should not be chamfered/filleted
/**
* Function TransformOutlinesShapeWithClearanceToPolygon
* Convert the filled areas to polygons (optionally inflated by \a aClearance) and copy them
* into \a aCornerBuffer.
*/
void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearance ) const
@ -1308,6 +1292,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon( SHAPE_POLY_SE
aCornerBuffer.Append( polybuffer );
}
//
/********* MODULE_ZONE_CONTAINER **************/
//

View File

@ -447,10 +447,10 @@ public:
/**
* Function Rotate
* Move the outlines
* @param centre = rot centre
* @param angle = in 0.1 degree
* @param aCentre = rot centre
* @param aAngle = in 0.1 degree
*/
void Rotate( const wxPoint& centre, double angle ) override;
void Rotate( const wxPoint& aCentre, double aAngle ) override;
/**
* Function Flip