diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 878f8d469a..161349068e 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -793,7 +793,11 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList, } } - // Draw copper zones + // Draw copper zones. Note: + // * if the holes are removed from copper zones + // the polygons are stored in bufferPolys (which contains all other polygons) + // * if the holes are NOT removed from copper zones + // the polygons are stored in bufferZonesPolys if( isEnabled( FL_ZONE ) ) { for( int ii = 0; ii < pcb->GetAreaCount(); ii++ ) @@ -844,13 +848,13 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList, // Add polygons, without holes bufferPolys.ExportTo( currLayerPolyset ); - // Add holes in polygon list + // Add through holes (created only once) in current polygon holes list currLayerHoles.Append( allLayerHoles ); if( currLayerHoles.GetCornersCount() > 0 ) currLayerHoles.ExportTo( polysetHoles ); - // Merge polygons, remove holes + // Merge polygons, and remove holes currLayerPolyset -= polysetHoles; int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer ); @@ -866,40 +870,39 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList, SetGLColor( color ); } - glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) ); - bufferPolys.RemoveAllContours(); bufferPolys.ImportFrom( currLayerPolyset ); - Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos, - thickness, + + // If holes are removed from copper zones, bufferPolys contains all polygons + // to draw (tracks+zones+texts). + glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) ); + Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos, thickness, GetPrm3DVisu().m_BiuTo3Dunits, useTextures ); - if( isEnabled( FL_USE_COPPER_THICKNESS ) == true ) + // If holes are not removed from copper zones (for calculation time reasons, + // the zone polygons are stored in bufferZonesPolys and have to be drawn now: + if( bufferZonesPolys.GetCornersCount() ) { - thickness -= ( 0.04 * IU_PER_MM ); + glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) ); + Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos, thickness, + GetPrm3DVisu().m_BiuTo3Dunits, useTextures ); } - glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) ); - - if( bufferZonesPolys.GetCornersCount() ) - Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos, - thickness, - GetPrm3DVisu().m_BiuTo3Dunits, useTextures ); throughHolesListBuilt = true; } - if ( !isEnabled( FL_SHOW_BOARD_BODY ) || - isEnabled( FL_USE_COPPER_THICKNESS ) ) + if( !isEnabled( FL_SHOW_BOARD_BODY ) || isEnabled( FL_USE_COPPER_THICKNESS ) ) { setGLCopperColor(); // Draw vias holes (vertical cylinders) for( const TRACK* track = pcb->m_Track; track; track = track->Next() ) { - const VIA *via = dynamic_cast(track); - - if( via ) + if( track->Type() == PCB_VIA_T ) + { + const VIA *via = static_cast(track); draw3DViaHole( via ); + } } // Draw pads holes (vertical cylinders) diff --git a/3d-viewer/3d_draw_basic_functions.cpp b/3d-viewer/3d_draw_basic_functions.cpp index 1cfc738353..d396bba20b 100644 --- a/3d-viewer/3d_draw_basic_functions.cpp +++ b/3d-viewer/3d_draw_basic_functions.cpp @@ -245,12 +245,11 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList, gluDeleteTess( tess ); if( aThickness == 0 ) - { return; - } // Build the 3D data : vertical side - Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos - (aThickness / 2.0), true, aBiuTo3DUnits ); + Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos - (aThickness / 2.0), + true, aBiuTo3DUnits ); } @@ -294,7 +293,7 @@ void Draw3D_ZaxisCylinder( wxPoint aCenterPos, int aRadius, if( aHeight ) { - + // Draw the vertical outer side Draw3D_VerticalPolygonalCylinder( outer_cornerBuffer, aHeight, aZpos, false, aBiuTo3DUnits ); diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 7f36cf18ab..0565f20fbb 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -435,16 +435,15 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() NETLIST_OBJECT* candidate; // Pass 1: find the best name for labelled nets: - item = NULL; candidate = NULL; for( unsigned ii = 0; ii <= size(); ii++ ) { - if( ii == size() ) // last item already found - netcode = -2; + if( ii == size() ) // last item already tested + item = NULL; else item = GetItem( ii ); - if( netcode != item->GetNet() ) // End of net found + if( !item || netcode != item->GetNet() ) // End of net found { if( candidate ) // One or more labels exists, find the best { @@ -452,7 +451,7 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() GetItem( jj )->SetNetNameCandidate( candidate ); } - if( netcode == -2 ) + if( item == NULL ) break; netcode = item->GetNet(); @@ -512,8 +511,10 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() { if( ii < list.size() ) item = list.GetItem( ii ); + else + item = NULL; - if( netcode != item->GetNet() || ii >= list.size() ) // End of net found + if( !item || netcode != item->GetNet() ) // End of net found { if( candidate ) { @@ -524,7 +525,7 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet() } } - if( ii >= list.size() ) + if( !item ) break; netcode = item->GetNet(); diff --git a/eeschema/sch_collectors.h b/eeschema/sch_collectors.h index 4a6ee3c1e7..e427a17808 100644 --- a/eeschema/sch_collectors.h +++ b/eeschema/sch_collectors.h @@ -260,6 +260,7 @@ public: m_foundIndex = 0; SetForceSearch( false ); m_sheetPath = NULL; + m_lib_hash = 0; } void Empty() diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 3cddf198e0..85dbc70167 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -119,6 +119,12 @@ public: class NETINFO_MAPPING { public: + NETINFO_MAPPING() + { + m_board = NULL; + } + + /** * Function SetBoard * Sets a BOARD object that is used to prepare the net code map. diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index a3da95ff95..5ea61648a2 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1677,7 +1677,8 @@ void PCB_BASE_EDIT_FRAME::createArray() case PCB_TEXT_T: { EDA_TEXT* text = dynamic_cast( new_item ); - text->SetText( array_opts->InterpolateNumberIntoString( ptN, cachedString ) ); + if( text ) + text->SetText( array_opts->InterpolateNumberIntoString( ptN, cachedString ) ); break; } diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h index cf75e0ff1f..1d2aca6659 100644 --- a/pcbnew/router/pns_line.h +++ b/pcbnew/router/pns_line.h @@ -67,6 +67,7 @@ public: { m_segmentRefs = NULL; m_hasVia = false; + m_width = 1; // Dummy value } PNS_LINE( const PNS_LINE& aOther ) ; diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index 1417e59c21..44525ddf21 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.h @@ -35,7 +35,11 @@ class PNS_VIA : public PNS_ITEM public: PNS_VIA() : PNS_ITEM( VIA ) - {} + { + m_diameter = 2; // Dummy value + m_drill = 0; + m_viaType = VIA_THROUGH; + } PNS_VIA( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) : diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index a9caceb7ef..12ec6c3e7a 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -950,7 +950,8 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) case PCB_TEXT_T: { EDA_TEXT* text = dynamic_cast( newItem ); - text->SetText( array_opts->InterpolateNumberIntoString( ptN, cachedString ) ); + if( text ) + text->SetText( array_opts->InterpolateNumberIntoString( ptN, cachedString ) ); originalItemsModified = true; break;