mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Hatched circle shape: fix incorrect clipping of hatches.
- Fix size of converted polygon in Pcbnew - Fix approximation of converted polygon in Eeschema: one cannot use ARC_HIGH_DEF as error in Eeschema because this value is defined for Pcbnew, and not suitable in Eeschema.
This commit is contained in:
parent
484c35c44f
commit
8480b27042
@ -355,6 +355,15 @@ wxString EDA_SHAPE::SHAPE_T_asString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int EDA_SHAPE::GetArcToSegMaxErrorIU( bool aHighDefinition ) const
|
||||||
|
{
|
||||||
|
// Returning ARC_HIGH_DEF or ARC_LOW_DEF is suitable only for
|
||||||
|
// Pcbnew calculations
|
||||||
|
// For other cases a GetArcToSegMaxErrorIU() must be probably override this one
|
||||||
|
return aHighDefinition ? ARC_HIGH_DEF : ARC_LOW_DEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_SHAPE::setPosition( const VECTOR2I& aPos )
|
void EDA_SHAPE::setPosition( const VECTOR2I& aPos )
|
||||||
{
|
{
|
||||||
move( aPos - getPosition() );
|
move( aPos - getPosition() );
|
||||||
@ -609,8 +618,8 @@ void EDA_SHAPE::UpdateHatching() const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::CIRCLE:
|
case SHAPE_T::CIRCLE:
|
||||||
TransformCircleToPolygon( shapeBuffer, getCenter(), GetRadius() + GetWidth(),
|
TransformCircleToPolygon( shapeBuffer, getCenter(), GetRadius(),
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
GetArcToSegMaxErrorIU(), ERROR_INSIDE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
|
@ -49,6 +49,14 @@ EDA_ITEM* SCH_SHAPE::Clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SCH_SHAPE::GetArcToSegMaxErrorIU( bool aHighDefinition ) const
|
||||||
|
{
|
||||||
|
// Returns the equivalent of ARC_HIGH_DEF or ARC_LOW_DEF in eeschema IU
|
||||||
|
return aHighDefinition ?
|
||||||
|
schIUScale.mmToIU( ARC_HIGH_DEF_MM ) : schIUScale.mmToIU( ARC_LOW_DEF_MM );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SHAPE::swapData( SCH_ITEM* aItem )
|
void SCH_SHAPE::swapData( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
SCH_ITEM::SwapFlags( aItem );
|
SCH_ITEM::SwapFlags( aItem );
|
||||||
|
@ -76,6 +76,14 @@ public:
|
|||||||
return GetHatchLineWidth() * 40;
|
return GetHatchLineWidth() * 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a suitable value for error approximation when converting arc/circle to segments
|
||||||
|
* this value is in internal units
|
||||||
|
* @param aHightDef = true for high definition
|
||||||
|
* high def = similar to ARC_HIGH_DEF but in Eeschema IU, low def = similar to ARC_LOW_DEF
|
||||||
|
*/
|
||||||
|
int GetArcToSegMaxErrorIU( bool aHighDefinition = true ) const override;
|
||||||
|
|
||||||
void SetFilled( bool aFilled ) override;
|
void SetFilled( bool aFilled ) override;
|
||||||
|
|
||||||
const BOX2I GetBoundingBox() const override;
|
const BOX2I GetBoundingBox() const override;
|
||||||
|
@ -112,14 +112,19 @@ constexpr EDA_IU_SCALE drawSheetIUScale = EDA_IU_SCALE( PL_IU_PER_MM );
|
|||||||
constexpr EDA_IU_SCALE schIUScale = EDA_IU_SCALE( SCH_IU_PER_MM );
|
constexpr EDA_IU_SCALE schIUScale = EDA_IU_SCALE( SCH_IU_PER_MM );
|
||||||
constexpr EDA_IU_SCALE unityScale = EDA_IU_SCALE( 1 );
|
constexpr EDA_IU_SCALE unityScale = EDA_IU_SCALE( 1 );
|
||||||
|
|
||||||
|
// Allowed error to approximate an arg by segments, in millimeters
|
||||||
|
constexpr double ARC_LOW_DEF_MM = 0.02;
|
||||||
|
constexpr double ARC_HIGH_DEF_MM = 0.005;
|
||||||
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
// The max error is the distance between the middle of a segment, and the circle
|
// The max error is the distance between the middle of a segment, and the circle
|
||||||
// for circle/arc to segment approximation.
|
// for circle/arc to segment approximation.
|
||||||
// Warning: too small values can create very long calculation time in zone filling
|
// Warning: too small values can create very long calculation time in zone filling
|
||||||
// 0.05 to 0.005 mm are reasonable values
|
// 0.05 to 0.005 mm are reasonable values
|
||||||
|
|
||||||
constexpr int ARC_LOW_DEF = pcbIUScale.mmToIU( 0.02 );
|
// Allowed error to approximate an arg by segments, in Pcbnew IU
|
||||||
constexpr int ARC_HIGH_DEF = pcbIUScale.mmToIU( 0.005 );
|
constexpr int ARC_LOW_DEF = pcbIUScale.mmToIU( ARC_LOW_DEF_MM );
|
||||||
|
constexpr int ARC_HIGH_DEF = pcbIUScale.mmToIU( ARC_HIGH_DEF_MM );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _BASE_UNITS_H_
|
#endif // _BASE_UNITS_H_
|
||||||
|
@ -381,6 +381,14 @@ public:
|
|||||||
return makeEffectiveShapes( aEdgeOnly );
|
return makeEffectiveShapes( aEdgeOnly );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a suitable value for error approximation when converting arc/circle to segments
|
||||||
|
* this value is in internal units
|
||||||
|
* @param aHightDef = true for high definition
|
||||||
|
* for boards, high def = ARC_HIGH_DEF, low def = ARC_LOW_DEF
|
||||||
|
*/
|
||||||
|
virtual int GetArcToSegMaxErrorIU( bool aHighDefinition = true ) const;
|
||||||
|
|
||||||
void ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
|
void ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
|
||||||
|
|
||||||
void SetLength( const double& aLength );
|
void SetLength( const double& aLength );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user