Loading common/gr_basic.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -1163,6 +1163,9 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] ) if( ! ClipBox ) return true; if( n <= 0 ) return false; int Xmin, Xmax, Ymin, Ymax; Xmin = Xmax = Points[0].x; Loading gerbview/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ### set(GERBVIEW_SRCS block.cpp class_aperture_macro.cpp class_GERBER.cpp class_gerber_draw_item.cpp class_gerbview_layer_widget.cpp Loading gerbview/class_gerber_draw_item.cpp +16 −13 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent ) : m_Shape = GBR_SEGMENT; m_Flashed = false; m_DCode = 0; m_UnitsMetric = false; } Loading @@ -70,6 +71,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) : m_Flashed = aSource.m_Flashed; m_DCode = aSource.m_DCode; m_PolyCorners = aSource.m_PolyCorners; m_UnitsMetric = aSource.m_UnitsMetric; } Loading Loading @@ -176,7 +178,7 @@ bool GERBER_DRAW_ITEM::Save( FILE* aFile ) const /*********************************************************************/ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset ) /*********************************************************************/ { Loading @@ -203,9 +205,9 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, color = brd->GetLayerColor( GetLayer() ); if( draw_mode & GR_SURBRILL ) if( aDrawMode & GR_SURBRILL ) { if( draw_mode & GR_AND ) if( aDrawMode & GR_AND ) color &= ~HIGHT_LIGHT_FLAG; else color |= HIGHT_LIGHT_FLAG; Loading @@ -214,7 +216,7 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, color = ColorRefs[color & MASKCOLOR].m_LightColor; } GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( aDC, aDrawMode ); isFilled = DisplayOpt.DisplayPcbTrackFill ? true : false; Loading @@ -224,7 +226,7 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, isFilled = (g_DisplayPolygonsModeSketch == false); if( m_Flags & DRAW_ERASED ) isFilled = true; DrawGbrPoly( &panel->m_ClipBox, DC, color, aOffset, isFilled ); DrawGbrPoly( &aPanel->m_ClipBox, aDC, color, aOffset, isFilled ); break; case GBR_CIRCLE: Loading @@ -236,14 +238,14 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, if( !isFilled ) { // draw the border of the pen's path using two circles, each as narrow as possible GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, radius - halfPenWidth, 0, color ); GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, radius + halfPenWidth, 0, color ); } else // Filled mode { GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, radius, m_Size.x, color ); } break; Loading @@ -251,13 +253,13 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, case GBR_ARC: if( !isFilled ) { GRArc1( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRArc1( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_ArcCentre.x, m_ArcCentre.y, 0, color ); } else { GRArc1( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRArc1( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_ArcCentre.x, m_ArcCentre.y, m_Size.x, color ); Loading @@ -268,17 +270,18 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, case GBR_SPOT_RECT: case GBR_SPOT_OVAL: case GBR_SPOT_POLY: case GBR_SPOT_MACRO: isFilled = DisplayOpt.DisplayPadFill ? true : false; d_codeDescr->DrawFlashedShape( &panel->m_ClipBox, DC, color, d_codeDescr->DrawFlashedShape( this, &aPanel->m_ClipBox, aDC, color, m_Start, isFilled ); break; case GBR_SEGMENT: if( !isFilled ) GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCSegm( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_Size.x, color ); else GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x, GRFillCSegm( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_Size.x, color ); break; Loading gerbview/class_gerber_draw_item.h +3 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ */ #include "base_struct.h" #include "class_board_item.h" /* Shapes id for basic shapes ( .m_Shape member ) */ enum Gbr_Basic_Shapes { Loading Loading @@ -57,6 +58,8 @@ private: public: bool m_UnitsMetric; /* store here the gerber units (inch/mm). * Used only to calculate aperture macros shapes sizes */ int m_Shape; // Shape and type of this gerber item wxPoint m_Start; // Line or arc start point or position of the shape // for flashed items Loading gerbview/dcode.cpp +22 −13 Original line number Diff line number Diff line Loading @@ -96,10 +96,11 @@ const wxChar* D_CODE::ShowApertureType( APERTURE_T aType ) return ret; } /** Function Read_D_Code_File * Can be useful only with old RS274D Gerber file format. * Is not needed with RS274X files format. * These files need an auxiliary DCode file description. Ther is no defined file format for this. * These files need an auxiliary DCode file description. There is no defined file format for this. * This function read a file format I needed a long time ago. * reads in a dcode file assuming ALSPCB file format with ';' indicating comments. * Format is like CSV but with optional ';' delineated comments: Loading Loading @@ -291,15 +292,18 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() * Draw the dcode shape for flashed items. * When an item is flashed, the DCode shape is the shape of the item */ void D_CODE::DrawFlashedShape( EDA_Rect* aClipBox, wxDC* aDC, int aColor, void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_Rect* aClipBox, wxDC* aDC, int aColor, wxPoint aShapePos, bool aFilledShape ) { int radius; switch( m_Shape ) { case APT_MACRO: GetMacro()->DrawApertureMacroShape( aParent, aClipBox, aDC, aColor, aShapePos, aFilledShape); break; case APT_MACRO: // TODO: current a round shape case APT_CIRCLE: radius = m_Size.x >> 1; if( !aFilledShape ) Loading Loading @@ -439,6 +443,7 @@ void D_CODE::ConvertShapeToPolygon() { wxPoint initialpos; wxPoint currpos;; m_PolyCorners.clear(); switch( m_Shape ) Loading Loading @@ -530,6 +535,7 @@ void D_CODE::ConvertShapeToPolygon() case APT_POLYGON: currpos.x = m_Size.x >> 1; // first point is on X axis initialpos = currpos; // rs274x said: m_EdgesCount = 3 ... 12 if( m_EdgesCount < 3 ) m_EdgesCount = 3; Loading @@ -541,6 +547,7 @@ void D_CODE::ConvertShapeToPolygon() RotatePoint( &currpos, ii * 3600 / m_EdgesCount ); m_PolyCorners.push_back( currpos ); } addHoleToPolygon( m_PolyCorners, m_DrillShape, m_Drill, initialpos ); if( m_Rotation ) // vertical oval, rotate polygon. { Loading @@ -561,6 +568,7 @@ void D_CODE::ConvertShapeToPolygon() } } // The helper function for D_CODE::ConvertShapeToPolygon(). // Add a hole to a polygon static void addHoleToPolygon( std::vector<wxPoint>& aBuffer, Loading @@ -569,6 +577,7 @@ static void addHoleToPolygon( std::vector<wxPoint>& aBuffer, wxPoint aAnchorPos ) { wxPoint currpos; if( aHoleShape == APT_DEF_ROUND_HOLE ) // build a round hole { for( int ii = 0; ii <= SEGS_CNT; ii++ ) Loading Loading
common/gr_basic.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -1163,6 +1163,9 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] ) if( ! ClipBox ) return true; if( n <= 0 ) return false; int Xmin, Xmax, Ymin, Ymax; Xmin = Xmax = Points[0].x; Loading
gerbview/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ### set(GERBVIEW_SRCS block.cpp class_aperture_macro.cpp class_GERBER.cpp class_gerber_draw_item.cpp class_gerbview_layer_widget.cpp Loading
gerbview/class_gerber_draw_item.cpp +16 −13 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent ) : m_Shape = GBR_SEGMENT; m_Flashed = false; m_DCode = 0; m_UnitsMetric = false; } Loading @@ -70,6 +71,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) : m_Flashed = aSource.m_Flashed; m_DCode = aSource.m_DCode; m_PolyCorners = aSource.m_PolyCorners; m_UnitsMetric = aSource.m_UnitsMetric; } Loading Loading @@ -176,7 +178,7 @@ bool GERBER_DRAW_ITEM::Save( FILE* aFile ) const /*********************************************************************/ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset ) /*********************************************************************/ { Loading @@ -203,9 +205,9 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, color = brd->GetLayerColor( GetLayer() ); if( draw_mode & GR_SURBRILL ) if( aDrawMode & GR_SURBRILL ) { if( draw_mode & GR_AND ) if( aDrawMode & GR_AND ) color &= ~HIGHT_LIGHT_FLAG; else color |= HIGHT_LIGHT_FLAG; Loading @@ -214,7 +216,7 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, color = ColorRefs[color & MASKCOLOR].m_LightColor; } GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( aDC, aDrawMode ); isFilled = DisplayOpt.DisplayPcbTrackFill ? true : false; Loading @@ -224,7 +226,7 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, isFilled = (g_DisplayPolygonsModeSketch == false); if( m_Flags & DRAW_ERASED ) isFilled = true; DrawGbrPoly( &panel->m_ClipBox, DC, color, aOffset, isFilled ); DrawGbrPoly( &aPanel->m_ClipBox, aDC, color, aOffset, isFilled ); break; case GBR_CIRCLE: Loading @@ -236,14 +238,14 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, if( !isFilled ) { // draw the border of the pen's path using two circles, each as narrow as possible GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, radius - halfPenWidth, 0, color ); GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, radius + halfPenWidth, 0, color ); } else // Filled mode { GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, radius, m_Size.x, color ); } break; Loading @@ -251,13 +253,13 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, case GBR_ARC: if( !isFilled ) { GRArc1( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRArc1( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_ArcCentre.x, m_ArcCentre.y, 0, color ); } else { GRArc1( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRArc1( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_ArcCentre.x, m_ArcCentre.y, m_Size.x, color ); Loading @@ -268,17 +270,18 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, case GBR_SPOT_RECT: case GBR_SPOT_OVAL: case GBR_SPOT_POLY: case GBR_SPOT_MACRO: isFilled = DisplayOpt.DisplayPadFill ? true : false; d_codeDescr->DrawFlashedShape( &panel->m_ClipBox, DC, color, d_codeDescr->DrawFlashedShape( this, &aPanel->m_ClipBox, aDC, color, m_Start, isFilled ); break; case GBR_SEGMENT: if( !isFilled ) GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCSegm( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_Size.x, color ); else GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x, GRFillCSegm( &aPanel->m_ClipBox, aDC, m_Start.x, m_Start.y, m_End.x, m_End.y, m_Size.x, color ); break; Loading
gerbview/class_gerber_draw_item.h +3 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ */ #include "base_struct.h" #include "class_board_item.h" /* Shapes id for basic shapes ( .m_Shape member ) */ enum Gbr_Basic_Shapes { Loading Loading @@ -57,6 +58,8 @@ private: public: bool m_UnitsMetric; /* store here the gerber units (inch/mm). * Used only to calculate aperture macros shapes sizes */ int m_Shape; // Shape and type of this gerber item wxPoint m_Start; // Line or arc start point or position of the shape // for flashed items Loading
gerbview/dcode.cpp +22 −13 Original line number Diff line number Diff line Loading @@ -96,10 +96,11 @@ const wxChar* D_CODE::ShowApertureType( APERTURE_T aType ) return ret; } /** Function Read_D_Code_File * Can be useful only with old RS274D Gerber file format. * Is not needed with RS274X files format. * These files need an auxiliary DCode file description. Ther is no defined file format for this. * These files need an auxiliary DCode file description. There is no defined file format for this. * This function read a file format I needed a long time ago. * reads in a dcode file assuming ALSPCB file format with ';' indicating comments. * Format is like CSV but with optional ';' delineated comments: Loading Loading @@ -291,15 +292,18 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() * Draw the dcode shape for flashed items. * When an item is flashed, the DCode shape is the shape of the item */ void D_CODE::DrawFlashedShape( EDA_Rect* aClipBox, wxDC* aDC, int aColor, void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_Rect* aClipBox, wxDC* aDC, int aColor, wxPoint aShapePos, bool aFilledShape ) { int radius; switch( m_Shape ) { case APT_MACRO: GetMacro()->DrawApertureMacroShape( aParent, aClipBox, aDC, aColor, aShapePos, aFilledShape); break; case APT_MACRO: // TODO: current a round shape case APT_CIRCLE: radius = m_Size.x >> 1; if( !aFilledShape ) Loading Loading @@ -439,6 +443,7 @@ void D_CODE::ConvertShapeToPolygon() { wxPoint initialpos; wxPoint currpos;; m_PolyCorners.clear(); switch( m_Shape ) Loading Loading @@ -530,6 +535,7 @@ void D_CODE::ConvertShapeToPolygon() case APT_POLYGON: currpos.x = m_Size.x >> 1; // first point is on X axis initialpos = currpos; // rs274x said: m_EdgesCount = 3 ... 12 if( m_EdgesCount < 3 ) m_EdgesCount = 3; Loading @@ -541,6 +547,7 @@ void D_CODE::ConvertShapeToPolygon() RotatePoint( &currpos, ii * 3600 / m_EdgesCount ); m_PolyCorners.push_back( currpos ); } addHoleToPolygon( m_PolyCorners, m_DrillShape, m_Drill, initialpos ); if( m_Rotation ) // vertical oval, rotate polygon. { Loading @@ -561,6 +568,7 @@ void D_CODE::ConvertShapeToPolygon() } } // The helper function for D_CODE::ConvertShapeToPolygon(). // Add a hole to a polygon static void addHoleToPolygon( std::vector<wxPoint>& aBuffer, Loading @@ -569,6 +577,7 @@ static void addHoleToPolygon( std::vector<wxPoint>& aBuffer, wxPoint aAnchorPos ) { wxPoint currpos; if( aHoleShape == APT_DEF_ROUND_HOLE ) // build a round hole { for( int ii = 0; ii <= SEGS_CNT; ii++ ) Loading