Commit c519eea1 authored by jean-pierre charras's avatar jean-pierre charras

3D viewer: fix (the fix is not perfect) a minor issue in zone rendering:...

3D viewer: fix (the fix is not perfect) a minor issue in zone rendering: copper thickness was not good when the option 'Show Holes in Zones" was OFF, and "Show Copper Thickness" ON.
Fix a few coverity minor warnings.
parent cec0a956
......@@ -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,41 +870,40 @@ 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,
GetPrm3DVisu().m_BiuTo3Dunits, useTextures );
if( isEnabled( FL_USE_COPPER_THICKNESS ) == true )
{
thickness -= ( 0.04 * IU_PER_MM );
}
// 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 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() )
Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos,
thickness,
{
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
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<const VIA*>(track);
if( via )
if( track->Type() == PCB_VIA_T )
{
const VIA *via = static_cast<const VIA*>(track);
draw3DViaHole( via );
}
}
// Draw pads holes (vertical cylinders)
for( const MODULE* module = pcb->m_Modules; module; module = module->Next() )
......
......@@ -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 );
}
......
......@@ -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();
......
......@@ -260,6 +260,7 @@ public:
m_foundIndex = 0;
SetForceSearch( false );
m_sheetPath = NULL;
m_lib_hash = 0;
}
void Empty()
......
......@@ -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.
......
......@@ -1677,6 +1677,7 @@ void PCB_BASE_EDIT_FRAME::createArray()
case PCB_TEXT_T:
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( new_item );
if( text )
text->SetText( array_opts->InterpolateNumberIntoString( ptN, cachedString ) );
break;
......
......@@ -67,6 +67,7 @@ public:
{
m_segmentRefs = NULL;
m_hasVia = false;
m_width = 1; // Dummy value
}
PNS_LINE( const PNS_LINE& aOther ) ;
......
......@@ -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 ) :
......
......@@ -950,6 +950,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
case PCB_TEXT_T:
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( newItem );
if( text )
text->SetText( array_opts->InterpolateNumberIntoString( ptN, cachedString ) );
originalItemsModified = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment