mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Compare commits
7 Commits
f67a42f089
...
62810ae42d
Author | SHA1 | Date | |
---|---|---|---|
|
62810ae42d | ||
|
5dc6d43f43 | ||
|
98dd5a68eb | ||
|
18b56539a6 | ||
|
9b006c4f3b | ||
|
8035a66152 | ||
|
89f7a96e2c |
@ -17,4 +17,6 @@
|
||||
1.
|
||||
|
||||
# KiCad Version
|
||||
```
|
||||
|
||||
```
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "render_3d_opengl.h"
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <pcb_track.h>
|
||||
#include "../../3d_math.h"
|
||||
#include "convert_basic_shapes_to_polygon.h"
|
||||
#include <lset.h>
|
||||
@ -726,6 +727,54 @@ void RENDER_3D_OPENGL::generateCylinder( const SFVEC2F& aCenter, float aInnerRad
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_OPENGL::generateDisk( const SFVEC2F& aCenter, float aRadius, float aZ,
|
||||
unsigned int aNr_sides_per_circle, TRIANGLE_DISPLAY_LIST* aDstLayer,
|
||||
bool aTop )
|
||||
{
|
||||
const float delta = 2.0f * glm::pi<float>() / (float) aNr_sides_per_circle;
|
||||
|
||||
for( unsigned int i = 0; i < aNr_sides_per_circle; ++i )
|
||||
{
|
||||
float a0 = delta * i;
|
||||
float a1 = delta * ( i + 1 );
|
||||
const SFVEC3F p0( aCenter.x + cosf( a0 ) * aRadius,
|
||||
aCenter.y + sinf( a0 ) * aRadius, aZ );
|
||||
const SFVEC3F p1( aCenter.x + cosf( a1 ) * aRadius,
|
||||
aCenter.y + sinf( a1 ) * aRadius, aZ );
|
||||
const SFVEC3F c( aCenter.x, aCenter.y, aZ );
|
||||
|
||||
if( aTop )
|
||||
aDstLayer->m_layer_top_triangles->AddTriangle( p1, p0, c );
|
||||
else
|
||||
aDstLayer->m_layer_bot_triangles->AddTriangle( p0, p1, c );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_OPENGL::generateDimple( const SFVEC2F& aCenter, float aRadius, float aZ,
|
||||
float aDepth, unsigned int aNr_sides_per_circle,
|
||||
TRIANGLE_DISPLAY_LIST* aDstLayer, bool aTop )
|
||||
{
|
||||
const float delta = 2.0f * glm::pi<float>() / (float) aNr_sides_per_circle;
|
||||
const SFVEC3F c( aCenter.x, aCenter.y, aTop ? aZ - aDepth : aZ + aDepth );
|
||||
|
||||
for( unsigned int i = 0; i < aNr_sides_per_circle; ++i )
|
||||
{
|
||||
float a0 = delta * i;
|
||||
float a1 = delta * ( i + 1 );
|
||||
const SFVEC3F p0( aCenter.x + cosf( a0 ) * aRadius,
|
||||
aCenter.y + sinf( a0 ) * aRadius, aZ );
|
||||
const SFVEC3F p1( aCenter.x + cosf( a1 ) * aRadius,
|
||||
aCenter.y + sinf( a1 ) * aRadius, aZ );
|
||||
|
||||
if( aTop )
|
||||
aDstLayer->m_layer_top_triangles->AddTriangle( p0, p1, c );
|
||||
else
|
||||
aDstLayer->m_layer_bot_triangles->AddTriangle( p1, p0, c );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
{
|
||||
if( !m_boardAdapter.GetBoard() )
|
||||
@ -882,6 +931,63 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
delete layerTriangles;
|
||||
}
|
||||
}
|
||||
|
||||
TRIANGLE_DISPLAY_LIST* frontCover = new TRIANGLE_DISPLAY_LIST( m_boardAdapter.GetViaCount() );
|
||||
TRIANGLE_DISPLAY_LIST* backCover = new TRIANGLE_DISPLAY_LIST( m_boardAdapter.GetViaCount() );
|
||||
|
||||
for( const PCB_TRACK* track : m_boardAdapter.GetBoard()->Tracks() )
|
||||
{
|
||||
if( track->Type() != PCB_VIA_T )
|
||||
continue;
|
||||
|
||||
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
|
||||
|
||||
const float holediameter = via->GetDrillValue() * m_boardAdapter.BiuTo3dUnits();
|
||||
const float hole_radius = holediameter / 2.0f + 2.0 * platingThickness3d;
|
||||
const SFVEC2F center( via->GetStart().x * m_boardAdapter.BiuTo3dUnits(),
|
||||
-via->GetStart().y * m_boardAdapter.BiuTo3dUnits() );
|
||||
unsigned int seg = m_boardAdapter.GetCircleSegmentCount( via->GetDrillValue() );
|
||||
|
||||
PCB_LAYER_ID top_layer, bottom_layer;
|
||||
via->LayerPair( &top_layer, &bottom_layer );
|
||||
float ztop, zbot, dummy;
|
||||
getLayerZPos( top_layer, ztop, dummy );
|
||||
getLayerZPos( bottom_layer, dummy, zbot );
|
||||
|
||||
bool frontCovering = via->GetFrontCoveringMode() == COVERING_MODE::COVERED || via->IsTented( F_Mask );
|
||||
bool backCovering = via->GetBackCoveringMode() == COVERING_MODE::COVERED || via->IsTented( B_Mask );
|
||||
bool frontPlugged = via->GetFrontPluggingMode() == PLUGGING_MODE::PLUGGED;
|
||||
bool backPlugged = via->GetBackPluggingMode() == PLUGGING_MODE::PLUGGED;
|
||||
bool filled = via->GetFillingMode() == FILLING_MODE::FILLED
|
||||
|| via->GetCappingMode() == CAPPING_MODE::CAPPED;
|
||||
|
||||
const float depth = hole_radius * 0.3f;
|
||||
|
||||
if( frontCovering )
|
||||
{
|
||||
if( filled || !frontPlugged )
|
||||
generateDisk( center, hole_radius, ztop, seg, frontCover, true );
|
||||
else
|
||||
generateDimple( center, hole_radius, ztop, depth, seg, frontCover, true );
|
||||
}
|
||||
|
||||
if( backCovering )
|
||||
{
|
||||
if( filled || !backPlugged )
|
||||
generateDisk( center, hole_radius, zbot, seg, backCover, false );
|
||||
else
|
||||
generateDimple( center, hole_radius, zbot, depth, seg, backCover, false );
|
||||
}
|
||||
}
|
||||
|
||||
if( frontCover->m_layer_top_triangles->GetVertexSize() > 0 )
|
||||
m_viaFrontCover = new OPENGL_RENDER_LIST( *frontCover, 0, 0.0f, 0.0f );
|
||||
|
||||
if( backCover->m_layer_bot_triangles->GetVertexSize() > 0 )
|
||||
m_viaBackCover = new OPENGL_RENDER_LIST( *backCover, 0, 0.0f, 0.0f );
|
||||
|
||||
delete frontCover;
|
||||
delete backCover;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,6 +72,8 @@ RENDER_3D_OPENGL::RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdap
|
||||
m_outerViaThroughHoles = nullptr;
|
||||
m_microviaHoles = nullptr;
|
||||
m_padHoles = nullptr;
|
||||
m_viaFrontCover = nullptr;
|
||||
m_viaBackCover = nullptr;
|
||||
|
||||
m_circleTexture = 0;
|
||||
m_grid = 0;
|
||||
@ -947,6 +949,8 @@ void RENDER_3D_OPENGL::freeAllLists()
|
||||
|
||||
DELETE_AND_FREE( m_microviaHoles )
|
||||
DELETE_AND_FREE( m_padHoles )
|
||||
DELETE_AND_FREE( m_viaFrontCover )
|
||||
DELETE_AND_FREE( m_viaBackCover )
|
||||
}
|
||||
|
||||
|
||||
@ -968,6 +972,17 @@ void RENDER_3D_OPENGL::renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPos
|
||||
setLayerMaterial( aLayerID );
|
||||
m_board->SetItIsTransparent( true );
|
||||
m_board->DrawCulled( aShowThickness, solder_mask, via_holes );
|
||||
|
||||
if( aLayerID == F_Mask && m_viaFrontCover )
|
||||
{
|
||||
m_viaFrontCover->ApplyScalePosition( aZPos, 4 * m_boardAdapter.GetNonCopperLayerThickness() );
|
||||
m_viaFrontCover->DrawTop();
|
||||
}
|
||||
else if( aLayerID == B_Mask && m_viaBackCover )
|
||||
{
|
||||
m_viaBackCover->ApplyScalePosition( aZPos, 4 * m_boardAdapter.GetNonCopperLayerThickness() );
|
||||
m_viaBackCover->DrawBot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,14 @@ private:
|
||||
float aZtop, float aZbot, unsigned int aNr_sides_per_circle,
|
||||
TRIANGLE_DISPLAY_LIST* aDstLayer );
|
||||
|
||||
void generateDisk( const SFVEC2F& aCenter, float aRadius, float aZ,
|
||||
unsigned int aNr_sides_per_circle, TRIANGLE_DISPLAY_LIST* aDstLayer,
|
||||
bool aTop );
|
||||
|
||||
void generateDimple( const SFVEC2F& aCenter, float aRadius, float aZ, float aDepth,
|
||||
unsigned int aNr_sides_per_circle, TRIANGLE_DISPLAY_LIST* aDstLayer,
|
||||
bool aTop );
|
||||
|
||||
void generateViasAndPads();
|
||||
|
||||
/**
|
||||
@ -236,6 +244,8 @@ private:
|
||||
|
||||
OPENGL_RENDER_LIST* m_microviaHoles;
|
||||
OPENGL_RENDER_LIST* m_padHoles;
|
||||
OPENGL_RENDER_LIST* m_viaFrontCover;
|
||||
OPENGL_RENDER_LIST* m_viaBackCover;
|
||||
|
||||
// Caches
|
||||
std::map<wxString, MODEL_3D*> m_3dModelMap;
|
||||
|
@ -327,7 +327,9 @@ class INFOBAR_REPORTER : public REPORTER
|
||||
{
|
||||
public:
|
||||
INFOBAR_REPORTER( WX_INFOBAR* aInfoBar ) :
|
||||
REPORTER(), m_messageSet( false ), m_infoBar( aInfoBar ),
|
||||
REPORTER(),
|
||||
m_messageSet( false ),
|
||||
m_infoBar( aInfoBar ),
|
||||
m_severity( RPT_SEVERITY_UNDEFINED )
|
||||
{
|
||||
}
|
||||
|
@ -55,8 +55,8 @@
|
||||
|
||||
#define RESOLVE_PAGE( T, pageIndex ) static_cast<T*>( m_treebook->ResolvePage( pageIndex ) )
|
||||
|
||||
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
|
||||
PAGED_DIALOG( aFrame, _( "Board Setup" ), false, false,
|
||||
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aParent ) :
|
||||
PAGED_DIALOG( aParent ? aParent : aFrame, _( "Board Setup" ), false, false,
|
||||
_( "Import Settings from Another Board..." ), wxSize( 980, 600 ) ),
|
||||
m_frame( aFrame ),
|
||||
m_layers( nullptr ),
|
||||
|
@ -42,7 +42,7 @@ class PANEL_TEXT_VARIABLES;
|
||||
class DIALOG_BOARD_SETUP : public PAGED_DIALOG
|
||||
{
|
||||
public:
|
||||
DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame );
|
||||
DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aWindow = nullptr );
|
||||
~DIALOG_BOARD_SETUP();
|
||||
|
||||
protected:
|
||||
|
@ -303,7 +303,7 @@ void DIALOG_DRC::OnMenu( wxCommandEvent& event )
|
||||
|
||||
void DIALOG_DRC::OnErrorLinkClicked( wxHtmlLinkEvent& event )
|
||||
{
|
||||
m_frame->ShowBoardSetupDialog( _( "Custom Rules" ) );
|
||||
m_frame->ShowBoardSetupDialog( _( "Custom Rules" ), this );
|
||||
}
|
||||
|
||||
|
||||
@ -993,7 +993,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||
}
|
||||
|
||||
case ID_EDIT_SEVERITIES:
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ), this );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1035,7 +1035,7 @@ void DIALOG_DRC::OnIgnoredItemRClick( wxListEvent& event )
|
||||
|
||||
void DIALOG_DRC::OnEditViolationSeverities( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ), this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -527,10 +527,9 @@ void DRC_ENGINE::loadRules( const wxFileName& aPath )
|
||||
void DRC_ENGINE::compileRules()
|
||||
{
|
||||
if( m_logReporter )
|
||||
{
|
||||
m_logReporter->Report( ( wxString::Format( wxT( "Compiling Rules (%d rules): " ),
|
||||
(int) m_rules.size() ) ) );
|
||||
}
|
||||
m_logReporter->Report( wxT( "Compiling Rules" ) );
|
||||
|
||||
REPORTER error_semaphore;
|
||||
|
||||
for( std::shared_ptr<DRC_RULE>& rule : m_rules )
|
||||
{
|
||||
@ -539,9 +538,13 @@ void DRC_ENGINE::compileRules()
|
||||
if( rule->m_Condition && !rule->m_Condition->GetExpression().IsEmpty() )
|
||||
{
|
||||
condition = rule->m_Condition;
|
||||
condition->Compile( nullptr );
|
||||
condition->Compile( &error_semaphore );
|
||||
}
|
||||
|
||||
if( error_semaphore.HasMessageOfSeverity( RPT_SEVERITY_ERROR ) )
|
||||
THROW_PARSE_ERROR( wxT( "Parse error" ), rule->m_Name,
|
||||
TO_UTF8( rule->m_Condition->GetExpression() ), 0, 0 );
|
||||
|
||||
for( const DRC_CONSTRAINT& constraint : rule->m_Constraints )
|
||||
{
|
||||
if( !m_constraintMap.count( constraint.m_Type ) )
|
||||
@ -594,6 +597,8 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
|
||||
}
|
||||
catch( PARSE_ERROR& original_parse_error )
|
||||
{
|
||||
m_rules.clear();
|
||||
|
||||
try // try again with just our implicit rules
|
||||
{
|
||||
loadImplicitRules();
|
||||
|
@ -109,6 +109,7 @@
|
||||
#include <widgets/pcb_net_inspector_panel.h>
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
#include <kiplatform/app.h>
|
||||
#include <kiplatform/ui.h>
|
||||
#include <core/profile.h>
|
||||
#include <math/box2_minmax.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
@ -1466,7 +1467,7 @@ void PCB_EDIT_FRAME::ActivateGalCanvas()
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
|
||||
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, wxWindow* aParent )
|
||||
{
|
||||
static std::mutex dialogMutex; // Local static mutex
|
||||
|
||||
@ -1486,7 +1487,7 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
|
||||
// Make sure everything's up-to-date
|
||||
GetBoard()->BuildListOfNets();
|
||||
|
||||
DIALOG_BOARD_SETUP dlg( this );
|
||||
DIALOG_BOARD_SETUP dlg( this, aParent );
|
||||
|
||||
if( !aInitialPage.IsEmpty() )
|
||||
dlg.SetInitialPage( aInitialPage, wxEmptyString );
|
||||
|
@ -301,7 +301,7 @@ public:
|
||||
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
void ActivateGalCanvas() override;
|
||||
|
||||
void ShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString );
|
||||
void ShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString, wxWindow* aParent = nullptr );
|
||||
|
||||
void PrepareLayerIndicator( bool aForceRebuild = false );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user