Commit 4a461cd0 authored by jean-pierre charras's avatar jean-pierre charras

3D viewer: shows now the texts of footprints (ref, value and others) when visible.

Fix also other very minor issues.
Realistic mode shows or not the copper thickness (depending on selected option in preferences) to speed up the screen redraw.
parent 9413b305
......@@ -88,8 +88,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
if( bbbox.GetWidth() == 0 && bbbox.GetHeight() == 0 )
{
bbbox.SetWidth( 100 * IU_PER_MM );
bbbox.SetHeight( 100 * IU_PER_MM );
bbbox.SetWidth( Millimeter2iu( 100 ) );
bbbox.SetHeight( Millimeter2iu( 100 ) );
}
m_BoardSettings = &aBoard->GetDesignSettings();
......@@ -131,6 +131,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
// Solder mask and Solder paste have the same Z position
for( ; layer <= LAST_COPPER_LAYER; layer++ )
{
m_LayerZcoord[layer] = m_EpoxyThickness;
......@@ -144,19 +145,19 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
switch( layer_id )
{
case ADHESIVE_N_BACK:
zpos = zpos_copper_back - 4 * zpos_offset;
zpos = zpos_copper_back - 3 * zpos_offset;
break;
case ADHESIVE_N_FRONT:
zpos = zpos_copper_front + 4 * zpos_offset;
zpos = zpos_copper_front + 3 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
zpos = zpos_copper_back - 3 * zpos_offset;
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
zpos = zpos_copper_front + 3 * zpos_offset;
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SOLDERMASK_N_BACK:
......@@ -177,7 +178,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NON_COPPER_LAYER + 5) * zpos_offset;
(layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
break;
}
......
......@@ -148,9 +148,10 @@ public: INFO3D_VISU();
*/
int GetCopperThicknessBIU() const
{
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS )
// || GetFlag( FL_USE_REALISTIC_MODE )
;
return use_thickness ?
KiROUND( m_CopperThickness / m_BiuTo3Dunits )
: 0;
}
......@@ -173,9 +174,10 @@ public: INFO3D_VISU();
*/
int GetNonCopperLayerThicknessBIU() const
{
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS )
// || GetFlag( FL_USE_REALISTIC_MODE )
;
return use_thickness ?
KiROUND( m_NonCopperLayerThickness / m_BiuTo3Dunits )
: 0;
}
......
......@@ -23,6 +23,21 @@
#include <class_edge_mod.h>
#include <convert_basic_shapes_to_polygon.h>
// These variables are parameters used in addTextSegmToPoly.
// But addTextSegmToPoly is a call-back function,
// so we cannot send them as arguments.
int s_textWidth;
int s_textCircle2SegmentCount;
CPOLYGONS_LIST* s_cornerBuffer;
// This is a call back function, used by DrawGraphicText to draw the 3D text shape:
static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
{
TransformRoundedEndsSegmentToPolygon( *s_cornerBuffer,
wxPoint( x0, y0), wxPoint( xf, yf ),
s_textCircle2SegmentCount, s_textWidth );
}
/* generate pads shapes on layer aLayer as polygons,
* and adds these polygons to aCornerBuffer
* aCornerBuffer = the buffer to store polygons
......@@ -91,12 +106,16 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
int aCircleToSegmentsCount,
double aCorrectionFactor )
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
EDGE_MODULE* outline;
for( EDA_ITEM* item = GraphicalItems(); item != NULL; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
if( ((TEXTE_MODULE*)item)->GetLayer() == aLayer )
texts.push_back( (TEXTE_MODULE *) item );
break;
case PCB_MODULE_EDGE_T:
......@@ -153,6 +172,29 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
break;
}
}
// Convert texts sur modules
if( Reference().GetLayer() == aLayer && Reference().IsVisible() )
texts.push_back( &Reference() );
if( Value().GetLayer() == aLayer && Value().IsVisible() )
texts.push_back( &Value() );
s_cornerBuffer = &aCornerBuffer;
s_textCircle2SegmentCount = aCircleToSegmentsCount;
for( unsigned ii = 0; ii < texts.size(); ii++ )
{
TEXTE_MODULE *textmod = texts[ii];
s_textWidth = textmod->GetThickness() + ( 2 * aInflateValue );
DrawGraphicText( NULL, NULL, textmod->GetTextPosition(), BLACK,
textmod->GetText(), textmod->GetDrawRotation(),
textmod->GetSize(),
textmod->GetHorizJustify(), textmod->GetVertJustify(),
textmod->GetThickness(), textmod->IsItalic(),
true, addTextSegmToPoly );
}
}
/* Function TransformSolidAreasShapesToPolygonSet
......@@ -257,20 +299,6 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
* clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0)
*/
// These variables are parameters used in addTextSegmToPoly.
// But addTextSegmToPoly is a call-back function,
// so we cannot send them as arguments.
int s_textWidth;
int s_textCircle2SegmentCount;
CPOLYGONS_LIST* s_cornerBuffer;
// This is a call back function, used by DrawGraphicText to draw the 3D text shape:
static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
{
TransformRoundedEndsSegmentToPolygon( *s_cornerBuffer,
wxPoint( x0, y0), wxPoint( xf, yf ),
s_textCircle2SegmentCount, s_textWidth );
}
void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
CPOLYGONS_LIST& aCornerBuffer,
......@@ -309,7 +337,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
}
else
{
DrawGraphicText( NULL, NULL, GetTextPosition(), (EDA_COLOR_T) color,
DrawGraphicText( NULL, NULL, GetTextPosition(), color,
GetText(), GetOrientation(), size,
GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(),
......
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