Use board maxError value, and return SH_ARC for unfilled circle.

This commit is contained in:
Jeff Young 2021-07-21 16:40:14 +01:00
parent 2bc86fa0a8
commit 92e589b398
3 changed files with 10 additions and 9 deletions

View File

@ -35,13 +35,12 @@
#include "../3d_rendering/raytracing/shapes2D/round_segment_2d.h" #include "../3d_rendering/raytracing/shapes2D/round_segment_2d.h"
#include "../3d_rendering/raytracing/shapes2D/triangle_2d.h" #include "../3d_rendering/raytracing/shapes2D/triangle_2d.h"
#include <board_adapter.h> #include <board_adapter.h>
#include <board.h>
#include <footprint.h> #include <footprint.h>
#include <pad.h> #include <pad.h>
#include <pcb_text.h> #include <pcb_text.h>
#include <fp_shape.h> #include <fp_shape.h>
#include <board_design_settings.h>
#include <zone.h> #include <zone.h>
#include <string_utils.h>
#include <fp_text.h> #include <fp_text.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <trigo.h> #include <trigo.h>
@ -54,7 +53,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <wx/log.h> #include <wx/log.h>
#include <macros.h>
// These variables are parameters used in addTextSegmToContainer. // These variables are parameters used in addTextSegmToContainer.
// But addTextSegmToContainer is a call-back function, // But addTextSegmToContainer is a call-back function,
@ -310,6 +309,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
const wxSize& aClearanceValue ) const const wxSize& aClearanceValue ) const
{ {
SHAPE_POLY_SET poly; SHAPE_POLY_SET poly;
int maxError = GetBoard()->GetDesignSettings().m_MaxError;
wxSize clearance = aClearanceValue; wxSize clearance = aClearanceValue;
// Our shape-based builder can't handle negative or differing x:y clearance values (the // Our shape-based builder can't handle negative or differing x:y clearance values (the
@ -329,7 +329,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
PAD dummy( *aPad ); PAD dummy( *aPad );
dummy.SetSize( dummySize ); dummy.SetSize( dummySize );
dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0, ARC_HIGH_DEF, ERROR_INSIDE ); dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
clearance = { 0, 0 }; clearance = { 0, 0 };
} }
else else
@ -400,7 +400,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
case SH_ARC: case SH_ARC:
{ {
SHAPE_ARC* arc = (SHAPE_ARC*) shape; SHAPE_ARC* arc = (SHAPE_ARC*) shape;
SHAPE_LINE_CHAIN l = arc->ConvertToPolyline(); SHAPE_LINE_CHAIN l = arc->ConvertToPolyline( maxError );
for( int i = 0; i < l.SegmentCount(); i++ ) for( int i = 0; i < l.SegmentCount(); i++ )
{ {
@ -429,8 +429,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
break; break;
default: default:
wxFAIL_MSG( "BOARD_ADAPTER::createPadWithClearance no implementation for " UNIMPLEMENTED_FOR( SHAPE_TYPE_asString( shape->Type() ) );
+ SHAPE_TYPE_asString( shape->Type() ) );
break; break;
} }
} }

View File

@ -2064,6 +2064,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
else else
arcAngleDeciDeg = NormalizeAngleNeg( arcAngleDeciDeg ); arcAngleDeciDeg = NormalizeAngleNeg( arcAngleDeciDeg );
// JEY TODO: Load as arc...
SHAPE_ARC tempArc( centerPoint, startPoint, arcAngleDeciDeg / 10.0 ); SHAPE_ARC tempArc( centerPoint, startPoint, arcAngleDeciDeg / 10.0 );
SHAPE_LINE_CHAIN arcSegments = tempArc.ConvertToPolyline( Millimeter2iu( 0.1 ) ); SHAPE_LINE_CHAIN arcSegments = tempArc.ConvertToPolyline( Millimeter2iu( 0.1 ) );

View File

@ -93,7 +93,7 @@ public:
return; return;
std::vector<SHAPE*> subshapes; std::vector<SHAPE*> subshapes;
std::shared_ptr<SHAPE> shape = aItem->GetEffectiveShape( ToLAYER_ID( aLayer ) ); std::shared_ptr<SHAPE> shape = aItem->GetEffectiveShape( aLayer );
subshapes.clear(); subshapes.clear();
if( shape->HasIndexableSubshapes() ) if( shape->HasIndexableSubshapes() )