Commit 28f55e2a authored by jean-pierre charras's avatar jean-pierre charras

3D-viewer: minor fixes and enhancements

parent 5614ba00
......@@ -168,9 +168,6 @@ static inline void SetGLEpoxyColor( double aTransparency = 1.0 )
// in realistic mode and normal mode.
static inline void SetGLTechLayersColor( LAYER_NUM aLayer )
{
// Generates an epoxy color, near board color
// const double lum = 0.2/255.0;
if( g_Parm_3D_Visu.IsRealisticMode() )
{
switch( aLayer )
......@@ -228,15 +225,12 @@ void EDA_3D_CANVAS::BuildBoard3DView()
// Build a polygon from edge cut items
wxString msg;
if( realistic_mode || g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SHOW_BOARD_BODY] )
if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,
allLayerHoles, &msg ) )
{
if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,
allLayerHoles, &msg ) )
{
msg << wxT("\n\n") <<
_("Unable to calculate the board outlines, will use the outlines boundary box");
wxMessageBox( msg );
}
msg << wxT("\n\n") <<
_("Unable to calculate the board outlines, will use the outlines boundary box");
wxMessageBox( msg );
}
CPOLYGONS_LIST bufferZonesPolys;
......@@ -317,7 +311,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// Draw copper zones
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] )
if( g_Parm_3D_Visu.GetFlag( FL_ZONE ) )
{
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
......@@ -418,7 +412,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// Draw board substrate:
if( bufferPcbOutlines.GetCornersCount() )
if( bufferPcbOutlines.GetCornersCount() &&
( realistic_mode || g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) ) )
{
int copper_thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
// a small offset between substrate and external copper layer to avoid artifacts
......@@ -465,13 +460,16 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// draw graphic items, not on copper layers
KI_POLYGON_SET brdpolysetHoles;
allLayerHoles.ExportTo( brdpolysetHoles );
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
layer++ )
{
if( !Is3DLayerEnabled( layer ) )
continue;
if( layer == EDGE_N && g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SHOW_BOARD_BODY] )
if( layer == EDGE_N && g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
continue;
bufferPolys.RemoveAllContours();
......@@ -547,6 +545,13 @@ void EDA_3D_CANVAS::BuildBoard3DView()
bufferPolys.ExportTo( polyset );
currLayerPolyset -= polyset;
}
// Remove holes from Solder paste layers and siklscreen
else if( layer == SOLDERPASTE_N_BACK || layer == SOLDERPASTE_N_FRONT
|| layer == SILKSCREEN_N_BACK || layer == SILKSCREEN_N_FRONT )
{
bufferPolys.ExportTo( currLayerPolyset );
currLayerPolyset -= brdpolysetHoles;
}
else // usuall layers, merge polys built from each item shape:
{
bufferPolys.ExportTo( polyset );
......@@ -606,7 +611,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
// draw axis
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_AXIS] )
if( g_Parm_3D_Visu.GetFlag( FL_AXIS ) )
{
glEnable( GL_COLOR_MATERIAL );
SetGLColor( WHITE );
......@@ -638,7 +643,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
BuildBoard3DView();
// Draw grid
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] )
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
DrawGrid( g_Parm_3D_Visu.m_3D_Grid );
glEndList();
......@@ -825,7 +830,7 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
// Draw module shape: 3D shape if exists (or module outlines if not exists)
S3D_MASTER* struct3D = m_3D_Drawings;
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] )
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
{
double zpos;
......@@ -921,7 +926,7 @@ void EDA_3D_CANVAS::Draw3DPadHole( D_PAD* aPad )
bool Is3DLayerEnabled( LAYER_NUM aLayer )
{
int flg;
DISPLAY3D_FLG flg;
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
// see if layer needs to be shown
......@@ -930,22 +935,22 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer )
{
case ADHESIVE_N_BACK:
case ADHESIVE_N_FRONT:
flg = g_Parm_3D_Visu.FL_ADHESIVE;
flg = FL_ADHESIVE;
break;
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
flg = g_Parm_3D_Visu.FL_SOLDERPASTE;
flg = FL_SOLDERPASTE;
break;
case SILKSCREEN_N_BACK:
case SILKSCREEN_N_FRONT:
flg = g_Parm_3D_Visu.FL_SILKSCREEN;
flg = FL_SILKSCREEN;
break;
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
flg = g_Parm_3D_Visu.FL_SOLDERMASK;
flg = FL_SOLDERMASK;
break;
case DRAW_N:
......@@ -953,7 +958,7 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer )
if( realistic_mode )
return false;
flg = g_Parm_3D_Visu.FL_COMMENTS;
flg = FL_COMMENTS;
break;
case ECO1_N:
......@@ -961,7 +966,7 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer )
if( realistic_mode )
return false;
flg = g_Parm_3D_Visu.FL_ECO;
flg = FL_ECO;
break;
case LAYER_N_BACK:
......@@ -979,7 +984,7 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer )
}
// if the layer has a flag, return the flag
return g_Parm_3D_Visu.m_DrawFlags[flg] &&
return g_Parm_3D_Visu.GetFlag( flg ) &&
g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer );
}
......
......@@ -154,6 +154,7 @@ void EDA_3D_FRAME::GetSettings()
{
wxString text;
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
class INFO3D_VISU& prms = g_Parm_3D_Visu;
if( config )
{
......@@ -168,22 +169,43 @@ void EDA_3D_FRAME::GetSettings()
config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
class INFO3D_VISU& prms = g_Parm_3D_Visu;
config->Read( keyShowRealisticMode,
&prms.m_DrawFlags[prms.FL_USE_REALISTIC_MODE], false );
config->Read( keyShowAxis, &prms.m_DrawFlags[prms.FL_AXIS], true );
config->Read( keyShowFootprints, &prms.m_DrawFlags[prms.FL_MODULE], true );
config->Read( keyShowCopperThickness,
&prms.m_DrawFlags[prms.FL_USE_COPPER_THICKNESS],
false );
config->Read( keyShowZones, &prms.m_DrawFlags[prms.FL_ZONE], true );
config->Read( keyShowAdhesiveLayers, &prms.m_DrawFlags[prms.FL_ADHESIVE], true );
config->Read( keyShowSilkScreenLayers, &prms.m_DrawFlags[prms.FL_SILKSCREEN], true );
config->Read( keyShowSolderMaskLayers, &prms.m_DrawFlags[prms.FL_SOLDERMASK], true );
config->Read( keyShowSolderPasteLayers, &prms.m_DrawFlags[prms.FL_SOLDERPASTE], true );
config->Read( keyShowCommentsLayer, &prms.m_DrawFlags[prms.FL_COMMENTS], true );
config->Read( keyShowEcoLayers, &prms.m_DrawFlags[prms.FL_ECO], true );
config->Read( keyShowBoardBody, &prms.m_DrawFlags[prms.FL_SHOW_BOARD_BODY], true );
bool tmp;
config->Read( keyShowRealisticMode, &tmp, false );
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
config->Read( keyShowAxis, &tmp, true );
prms.SetFlag( FL_AXIS, tmp );
config->Read( keyShowFootprints, &tmp, true );
prms.SetFlag( FL_MODULE, tmp );
config->Read( keyShowCopperThickness, &tmp, false );
prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
config->Read( keyShowZones, &tmp, true );
prms.SetFlag( FL_ZONE, true );
config->Read( keyShowAdhesiveLayers, &tmp, true );
prms.SetFlag( FL_ADHESIVE, true );
config->Read( keyShowSilkScreenLayers, &tmp, true );
prms.SetFlag( FL_SILKSCREEN, true );
config->Read( keyShowSolderMaskLayers, &tmp, true );
prms.SetFlag( FL_SOLDERMASK, true );
config->Read( keyShowSolderPasteLayers, &tmp, true );
prms.SetFlag( FL_SOLDERPASTE, true );
config->Read( keyShowCommentsLayer, &tmp, true );
prms.SetFlag( FL_COMMENTS, true );
config->Read( keyShowEcoLayers, &tmp, true );
prms.SetFlag( FL_ECO, true );
config->Read( keyShowBoardBody, &tmp, true );
prms.SetFlag( FL_SHOW_BOARD_BODY, true );
}
}
......@@ -200,18 +222,18 @@ void EDA_3D_FRAME::SaveSettings()
config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
class INFO3D_VISU& prms = g_Parm_3D_Visu;
config->Write( keyShowRealisticMode, prms.m_DrawFlags[prms.FL_USE_REALISTIC_MODE] );
config->Write( keyShowAxis, prms.m_DrawFlags[prms.FL_AXIS] );
config->Write( keyShowFootprints, prms.m_DrawFlags[prms.FL_MODULE] );
config->Write( keyShowCopperThickness, prms.m_DrawFlags[prms.FL_USE_COPPER_THICKNESS] );
config->Write( keyShowZones, prms.m_DrawFlags[prms.FL_ZONE] );
config->Write( keyShowAdhesiveLayers, prms.m_DrawFlags[prms.FL_ADHESIVE] );
config->Write( keyShowSilkScreenLayers, prms.m_DrawFlags[prms.FL_SILKSCREEN] );
config->Write( keyShowSolderMaskLayers, prms.m_DrawFlags[prms.FL_SOLDERMASK] );
config->Write( keyShowSolderPasteLayers, prms.m_DrawFlags[prms.FL_SOLDERPASTE] );
config->Write( keyShowCommentsLayer, prms.m_DrawFlags[prms.FL_COMMENTS] );
config->Write( keyShowEcoLayers, prms.m_DrawFlags[prms.FL_ECO] );
config->Write( keyShowBoardBody, prms.m_DrawFlags[prms.FL_SHOW_BOARD_BODY] );
config->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
config->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
config->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
config->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
config->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
config->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
config->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
config->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
config->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
config->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
config->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
config->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
if( IsIconized() )
return;
......@@ -363,62 +385,62 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
return;
case ID_MENU3D_REALISTIC_MODE:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_REALISTIC_MODE] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
NewDisplay();
return;
case ID_MENU3D_SHOW_BOARD_BODY:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SHOW_BOARD_BODY] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
NewDisplay();
return;
case ID_MENU3D_AXIS_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_AXIS] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked );
NewDisplay();
return;
case ID_MENU3D_MODULE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked );
NewDisplay();
return;
case ID_MENU3D_USE_COPPER_THICKNESS:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
NewDisplay();
return;
case ID_MENU3D_ZONE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked );
NewDisplay();
return;
case ID_MENU3D_ADHESIVE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked );
NewDisplay();
return;
case ID_MENU3D_SILKSCREEN_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked );
NewDisplay();
return;
case ID_MENU3D_SOLDER_MASK_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked );
NewDisplay();
return;
case ID_MENU3D_SOLDER_PASTE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked );
NewDisplay();
return;
case ID_MENU3D_COMMENTS_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked );
NewDisplay();
return;
case ID_MENU3D_ECO_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] = isChecked;
g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked );
NewDisplay();
return;
......@@ -448,26 +470,26 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
switch( id )
{
case ID_MENU3D_GRID_NOGRID:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = false;
g_Parm_3D_Visu.SetFlag( FL_GRID, false );
break;
case ID_MENU3D_GRID_10_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true;
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 10.0;
break;
case ID_MENU3D_GRID_5_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true;
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 5.0;
break;
case ID_MENU3D_GRID_2P5_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true;
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 2.5;
break;
case ID_MENU3D_GRID_1_MM:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] = true;
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
g_Parm_3D_Visu.m_3D_Grid = 1.0;
break;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -180,6 +180,8 @@ void EDA_3D_FRAME::CreateMenuBar()
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_SHOW_BOARD_BODY,
_( "Show Board Body" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
......@@ -224,40 +226,40 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
wxMenuItem* item;
// Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_REALISTIC_MODE]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_SHOW_BOARD_BODY );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SHOW_BOARD_BODY]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) );
item = menuBar->FindItem( ID_MENU3D_USE_COPPER_THICKNESS );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_USE_COPPER_THICKNESS ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_MODULE ) );
item = menuBar->FindItem( ID_MENU3D_ZONE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_ZONE ) );
item = menuBar->FindItem( ID_MENU3D_AXIS_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_AXIS]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_AXIS ) );
item = menuBar->FindItem( ID_MENU3D_ADHESIVE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_ADHESIVE ) );
item = menuBar->FindItem( ID_MENU3D_SILKSCREEN_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_SILKSCREEN ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_MASK_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_SOLDERMASK ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_PASTE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_SOLDERPASTE ) );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) );
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO]);
item->Check(g_Parm_3D_Visu.GetFlag( FL_ECO ));
}
void EDA_3D_FRAME::SetToolbars()
......
......@@ -10,6 +10,7 @@ public:
private:
EDA_3D_FRAME* m_parent;
INFO3D_VISU & m_3Dprms;
void initDialog();
......@@ -31,7 +32,7 @@ void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event )
DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
:DIALOG_3D_VIEW_OPTIONS_BASE( parent )
:DIALOG_3D_VIEW_OPTIONS_BASE( parent ), m_3Dprms( g_Parm_3D_Visu )
{
m_parent = parent;
......@@ -55,24 +56,15 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) );
// Check/uncheck checkboxes
m_checkBoxCuThickness->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] );
m_checkBox3Dshapes->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] );
m_checkBoxAreas->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] );
m_checkBoxSilkscreen->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] );
m_checkBoxSolderMask->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] );
m_checkBoxSolderpaste->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] );
m_checkBoxAdhesive->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] );
m_checkBoxComments->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] );
m_checkBoxECO->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] );
m_checkBoxCuThickness->SetValue( m_3Dprms.GetFlag( FL_USE_COPPER_THICKNESS ) );
m_checkBox3Dshapes->SetValue( m_3Dprms.GetFlag( FL_MODULE ) );
m_checkBoxAreas->SetValue( m_3Dprms.GetFlag( FL_ZONE ) );
m_checkBoxSilkscreen->SetValue( m_3Dprms.GetFlag( FL_SILKSCREEN ) );
m_checkBoxSolderMask->SetValue( m_3Dprms.GetFlag( FL_SOLDERMASK ) );
m_checkBoxSolderpaste->SetValue( m_3Dprms.GetFlag( FL_SOLDERPASTE ) );
m_checkBoxAdhesive->SetValue( m_3Dprms.GetFlag( FL_ADHESIVE ) );
m_checkBoxComments->SetValue( m_3Dprms.GetFlag( FL_COMMENTS ) );
m_checkBoxECO->SetValue( m_3Dprms.GetFlag( FL_ECO ) );
}
void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
......@@ -105,24 +97,16 @@ void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
{
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] =
m_checkBoxCuThickness->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] =
m_checkBox3Dshapes->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] =
m_checkBoxAreas->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] =
m_checkBoxSilkscreen->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] =
m_checkBoxSolderMask->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] =
m_checkBoxSolderpaste->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] =
m_checkBoxAdhesive->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] =
m_checkBoxComments->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] =
m_checkBoxECO->GetValue();
m_3Dprms.SetFlag( FL_USE_COPPER_THICKNESS,
m_checkBoxCuThickness->GetValue() );
m_3Dprms.SetFlag( FL_MODULE, m_checkBox3Dshapes->GetValue() );
m_3Dprms.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
m_3Dprms.SetFlag( FL_SILKSCREEN, m_checkBoxSilkscreen->GetValue() );
m_3Dprms.SetFlag( FL_SOLDERMASK, m_checkBoxSolderMask->GetValue() );
m_3Dprms.SetFlag( FL_SOLDERPASTE, m_checkBoxSolderpaste->GetValue() );
m_3Dprms.SetFlag( FL_ADHESIVE, m_checkBoxAdhesive->GetValue() );
m_3Dprms.SetFlag( FL_COMMENTS, m_checkBoxComments->GetValue() );
m_3Dprms.SetFlag( FL_ECO, m_checkBoxECO->GetValue( ) );
EndModal( wxID_OK );
}
......@@ -68,10 +68,10 @@ INFO3D_VISU::INFO3D_VISU()
// default all special item layers Visible
for( ii = 0; ii < FL_LAST; ii++ )
m_DrawFlags[ii] = true;
m_drawFlags[ii] = true;
m_DrawFlags[FL_GRID] = false;
m_DrawFlags[FL_USE_COPPER_THICKNESS] = false;
SetFlag( FL_GRID, false );
SetFlag( FL_USE_COPPER_THICKNESS, false );
}
......@@ -164,7 +164,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
break;
case SOLDERMASK_N_FRONT:
zpos = zpos_copper_front + 2 * zpos_offset;
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SILKSCREEN_N_BACK:
......
......@@ -63,27 +63,27 @@ public: S3D_COLOR()
};
/* information needed to display 3D board */
enum DISPLAY3D_FLG {
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_ADHESIVE, FL_SILKSCREEN, FL_SOLDERMASK, FL_SOLDERPASTE,
FL_COMMENTS, FL_ECO,
FL_GRID,
FL_USE_COPPER_THICKNESS,
FL_SHOW_BOARD_BODY,
FL_USE_REALISTIC_MODE,
FL_LAST
};
class INFO3D_VISU
{
public:
enum DISPLAY3D_FLG {
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_ADHESIVE, FL_SILKSCREEN, FL_SOLDERMASK, FL_SOLDERPASTE,
FL_COMMENTS, FL_ECO,
FL_GRID,
FL_USE_COPPER_THICKNESS,
FL_SHOW_BOARD_BODY,
FL_USE_REALISTIC_MODE,
FL_LAST
};
double m_Beginx, m_Beginy; // position of mouse (used in drag commands)
double m_Quat[4]; // orientation of 3D view
double m_Rot[4]; // rotation parameters of 3D view
double m_Zoom; // 3D zoom value
double m_3D_Grid; // 3D grid value, in mm
S3D_COLOR m_BgColor;
bool m_DrawFlags[FL_LAST]; // Enable/disable flags (see DISPLAY3D_FLG list)
wxPoint m_BoardPos; // center board actual position in board units
wxSize m_BoardSize; // board actual size in board units
int m_CopperLayersCount; // Number of copper layers actually used by the board
......@@ -100,10 +100,18 @@ private:
double m_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
bool m_drawFlags[FL_LAST]; // Enable/disable flags (see DISPLAY3D_FLG list)
public: INFO3D_VISU();
~INFO3D_VISU();
// Accessors
bool GetFlag( DISPLAY3D_FLG aFlag ) const { return m_drawFlags[aFlag]; }
bool SetFlag( DISPLAY3D_FLG aFlag, bool aState )
{
return m_drawFlags[aFlag] = aState;
}
/**
* Function InitSettings
* Initialize info 3D Parameters from aBoard
......@@ -135,13 +143,13 @@ public: INFO3D_VISU();
* note: the thickness (Z size) of the copper is not the thickness
* of the layer (the thickness of the layer is the epoxy thickness / layer count)
*
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set,
* Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set,
* and normal mode, returns 0
*/
int GetCopperThicknessBIU() const
{
bool use_copper_thickness = m_DrawFlags[FL_USE_COPPER_THICKNESS] ||
m_DrawFlags[FL_USE_REALISTIC_MODE];
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
KiROUND( m_CopperThickness / m_BiuTo3Dunits )
: 0;
......@@ -161,12 +169,12 @@ public: INFO3D_VISU();
* @return the thickness (Z size) of a technical layer,
* in Board Internal Units
*
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
* Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
*/
int GetNonCopperLayerThicknessBIU() const
{
bool use_copper_thickness = m_DrawFlags[FL_USE_COPPER_THICKNESS] ||
m_DrawFlags[FL_USE_REALISTIC_MODE];
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
KiROUND( m_NonCopperLayerThickness / m_BiuTo3Dunits )
: 0;
......@@ -177,7 +185,7 @@ public: INFO3D_VISU();
* @return the thickness (Z size) of the copper or a technical layer,
* in Board Internal Units, depending on the layer id
*
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
* Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
*/
int GetLayerObjectThicknessBIU( int aLayerId) const
{
......@@ -186,7 +194,7 @@ public: INFO3D_VISU();
GetCopperThicknessBIU();
}
bool IsRealisticMode() { return m_DrawFlags[FL_USE_REALISTIC_MODE]; }
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
};
extern INFO3D_VISU g_Parm_3D_Visu;
......
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