KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_preview_3d_model.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016 Mario Luzeiro <[email protected]>
5 * Copyright (C) 2015 Cirilo Bernardo <[email protected]>
6 * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
7 * Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
30#include <tool/tool_manager.h>
34#include <base_units.h>
35#include <bitmaps.h>
36#include <board.h>
38#include <dpi_scaling_common.h>
39#include <lset.h>
40#include <pgm_base.h>
41#include <project_pcb.h>
44#include <widgets/wx_infobar.h>
48
50 FOOTPRINT* aFootprint,
51 std::vector<FP_3DMODEL>* aParentModelList ) :
52 PANEL_PREVIEW_3D_MODEL_BASE( aParent, wxID_ANY ),
53 m_parentFrame( aFrame ),
54 m_previewPane( nullptr ),
55 m_infobar( nullptr ),
56 m_boardAdapter(),
57 m_currentCamera( m_trackBallCamera ),
58 m_trackBallCamera( 2 * RANGE_SCALE_3D )
59{
61
62 m_dummyBoard = new BOARD();
63
64 m_dummyBoard->SetProject( &aFrame->Prj(), true );
65
66 // This board will only be used to hold a footprint for viewing
67 m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
68
69 m_bodyStyleShowAll = true;
70
71 BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
73 dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
76 dummy_board_stackup.RemoveAll();
77 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
78
79 m_selected = -1;
80
81 m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
82
83 // Set the bitmap of 3D view buttons:
84 m_bpvTop->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_top ) );
85 m_bpvFront->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_front ) );
86 m_bpvBack->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_back ) );
87 m_bpvLeft->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_left ) );
88 m_bpvRight->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_right ) );
89 m_bpvBottom->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_bottom ) );
90 m_bpvISO->SetBitmap( KiBitmapBundle( BITMAPS::ortho ) );
91 m_bpvBodyStyle->SetBitmap( KiBitmapBundle( BITMAPS::axis3d ) );
92 m_bpUpdate->SetBitmap( KiBitmapBundle( BITMAPS::reload ) );
93 m_bpSettings->SetBitmap( KiBitmapBundle( BITMAPS::options_3drender ) );
94
95 // Set the min and max values of spin buttons (mandatory on Linux)
96 // They are not used, so they are set to min and max 32 bits int values
97 // (the min and max values supported by a wxSpinButton)
98 // It avoids blocking the up or down arrows when reaching this limit after
99 // a few clicks.
100 wxSpinButton* spinButtonList[] =
101 {
105 };
106
107 for( wxSpinButton* button : spinButtonList )
108 button->SetRange(INT_MIN, INT_MAX );
109
110 m_parentModelList = aParentModelList;
111
112 m_dummyFootprint = new FOOTPRINT( *aFootprint );
114
115 // Ensure the footprint is shown like in Fp editor: rot 0, not flipped
116 // to avoid mistakes when setting the3D shape position/rotation
119
121
122
124
125 // Create the 3D canvas
126 m_previewPane = new EDA_3D_CANVAS( this,
127 OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
129 PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
130
133 m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options
134
135 loadSettings();
136
137 // Create the manager
139 m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
140
144
145 // Register tools
148
149 // Run the viewer control tool, it is supposed to be always active
150 m_toolManager->InvokeTool( "3DViewer.Control" );
151
152 m_infobar = new WX_INFOBAR( this );
154
155 m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 );
156 m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
157
158 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
159 {
160 Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
161 this );
162 }
163
164 aFrame->Connect( EDA_EVT_UNITS_CHANGED,
165 wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
166 nullptr, this );
167}
168
169
171{
172 // Restore the 3D viewer Render settings, that can be modified by the panel tools
175
176 delete m_dummyBoard;
177 delete m_previewPane;
178}
179
180
181void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
182{
183 if( !m_toolDispatcher )
184 aEvent.Skip();
185 else
187}
188
189
191{
192 wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
193
194 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
195
196 // TODO(JE) use all control options
198
200
201 if( cfg )
202 {
203 // Save the 3D viewer render settings, to restore it after closing the preview
205
206 m_boardAdapter.m_Cfg = cfg;
207
211
212 // Ensure the board body is always shown, and do not use the settings of the 3D viewer
220 }
221}
222
223
229static double rotationFromString( const wxString& aValue )
230{
232
233 if( rotation > MAX_ROTATION )
234 {
235 int n = KiROUND( rotation / MAX_ROTATION );
236 rotation -= MAX_ROTATION * n;
237 }
238 else if( rotation < -MAX_ROTATION )
239 {
240 int n = KiROUND( -rotation / MAX_ROTATION );
241 rotation += MAX_ROTATION * n;
242 }
243
244 return rotation;
245}
246
247
249{
250 return wxString::Format( wxT( "%.4f" ),
251 aValue );
252}
253
254
256{
257 // Sigh. Did we really need differentiated +/- 0.0?
258 if( aValue == -0.0 )
259 aValue = 0.0;
260
261 return wxString::Format( wxT( "%.2f%s" ),
262 aValue,
263 EDA_UNIT_UTILS::GetText( EDA_UNITS::DEGREES ) );
264}
265
266
268{
269 // Convert from internal units (mm) to user units
270 if( m_userUnits == EDA_UNITS::INCHES )
271 aValue /= 25.4;
272 else if( m_userUnits == EDA_UNITS::MILS )
273 aValue /= 25.4 / 1e3;
274
275 return wxString::Format( wxT( "%.6f%s" ),
276 aValue,
278}
279
280
282{
283 if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
284 {
285 m_selected = idx;
286 const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
287
288 // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
289 // don't want to generate wxEVT_GRID_CELL_CHANGED events.
290 xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
291 yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
292 zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
293
294 // Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI
295 // to match the rest of KiCad
296 xrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.x ) );
297 yrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.y ) );
298 zrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.z ) );
299
300 xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
301 yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
302 zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
303
304 m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
305 }
306 else
307 {
308 m_selected = -1;
309
310 xscale->ChangeValue( wxEmptyString );
311 yscale->ChangeValue( wxEmptyString );
312 zscale->ChangeValue( wxEmptyString );
313
314 xrot->ChangeValue( wxEmptyString );
315 yrot->ChangeValue( wxEmptyString );
316 zrot->ChangeValue( wxEmptyString );
317
318 xoff->ChangeValue( wxEmptyString );
319 yoff->ChangeValue( wxEmptyString );
320 zoff->ChangeValue( wxEmptyString );
321
322 m_opacity->SetValue( 100 );
323 }
324}
325
326
327void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
328{
329 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
330 {
331 // Write settings back to the parent
332 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
333
335 pcbIUScale, EDA_UNITS::UNSCALED, xscale->GetValue() );
337 pcbIUScale, EDA_UNITS::UNSCALED, yscale->GetValue() );
339 pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
340
341 // Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI
342 // to match the rest of KiCad
343 modelInfo->m_Rotation.x = -rotationFromString( xrot->GetValue() );
344 modelInfo->m_Rotation.y = -rotationFromString( yrot->GetValue() );
345 modelInfo->m_Rotation.z = -rotationFromString( zrot->GetValue() );
346
348 xoff->GetValue() )
351 yoff->GetValue() )
354 zoff->GetValue() )
356
357 // Update the dummy footprint for the preview
358 UpdateDummyFootprint( false );
359 }
360}
361
362
363void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
364{
365 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
366 {
367 // Write settings back to the parent
368 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
369
370 modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
371
372 // Update the dummy footprint for the preview
373 UpdateDummyFootprint( false );
374 }
375}
376
377
378void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
379{
380 // turn ON or OFF options to show the board body if OFF, soder paste, soldermask
381 // and board body are hidden, to allows a good view of the 3D model and its pads.
383
384 if( !cfg )
385 return;
386
388
394
396 m_previewPane->Refresh();
397}
398
399
400void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
401{
403 int thickness = bds.GetBoardThickness();
404
405 WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "3D Preview Options" ), _( "Board thickness:" ),
406 thickness );
407
408 if( dlg.ShowModal() != wxID_OK )
409 return;
410
411 bds.SetBoardThickness( dlg.GetValue() );
412
414 boardStackup.RemoveAll();
415 boardStackup.BuildDefaultStackupList( &bds, 2 );
416
417 UpdateDummyFootprint( true );
418
420 m_previewPane->Refresh();
421}
422
423
424void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
425{
426 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
427
428 wxTextCtrl * textCtrl = xscale;
429
430 if( spinCtrl == m_spinYscale )
431 textCtrl = yscale;
432 else if( spinCtrl == m_spinZscale )
433 textCtrl = zscale;
434
435 double step = SCALE_INCREMENT;
436
437 if( wxGetMouseState().ShiftDown( ) )
439
440 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
441 textCtrl->GetValue() );
442
443 curr_value += ( step * aSign );
444 curr_value = std::max( 1/MAX_SCALE, curr_value );
445 curr_value = std::min( curr_value, MAX_SCALE );
446
447 textCtrl->SetValue( formatScaleValue( curr_value ) );
448}
449
450
451void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
452{
453 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
454 wxTextCtrl* textCtrl = xrot;
455
456 if( spinCtrl == m_spinYrot )
457 textCtrl = yrot;
458 else if( spinCtrl == m_spinZrot )
459 textCtrl = zrot;
460
461 double step = ROTATION_INCREMENT;
462
463 if( wxGetMouseState().ShiftDown( ) )
465
466 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
467 textCtrl->GetValue() );
468
469 curr_value += ( step * aSign );
470 curr_value = std::max( -MAX_ROTATION, curr_value );
471 curr_value = std::min( curr_value, MAX_ROTATION );
472
473 textCtrl->SetValue( formatRotationValue( curr_value ) );
474}
475
476
477void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
478{
479 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
480
481 wxTextCtrl * textCtrl = xoff;
482
483 if( spinCtrl == m_spinYoffset )
484 textCtrl = yoff;
485 else if( spinCtrl == m_spinZoffset )
486 textCtrl = zoff;
487
488 double step_mm = OFFSET_INCREMENT_MM;
489
490 if( wxGetMouseState().ShiftDown( ) )
491 step_mm = OFFSET_INCREMENT_MM_FINE;
492
493 if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
494 {
495 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
496
497 if( wxGetMouseState().ShiftDown( ) )
498 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000;;
499 }
500
502 textCtrl->GetValue() )
504
505 curr_value_mm += ( step_mm * aSign );
506 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
507 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
508
509 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
510}
511
512
514{
515 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
516
517 double step = SCALE_INCREMENT;
518
519 if( event.ShiftDown( ) )
521
522 if( event.GetWheelRotation() >= 0 )
523 step = -step;
524
525 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
526 textCtrl->GetValue() );
527
528 curr_value += step;
529 curr_value = std::max( 1/MAX_SCALE, curr_value );
530 curr_value = std::min( curr_value, MAX_SCALE );
531
532 textCtrl->SetValue( formatScaleValue( curr_value ) );
533}
534
535
537{
538 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
539
540 double step = ROTATION_INCREMENT;
541
542 if( event.ShiftDown( ) )
544
545 if( event.GetWheelRotation() >= 0 )
546 step = -step;
547
548 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
549 textCtrl->GetValue() );
550
551 curr_value += step;
552 curr_value = std::max( -MAX_ROTATION, curr_value );
553 curr_value = std::min( curr_value, MAX_ROTATION );
554
555 textCtrl->SetValue( formatRotationValue( curr_value ) );
556}
557
558
560{
561 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
562
563 double step_mm = OFFSET_INCREMENT_MM;
564
565 if( event.ShiftDown( ) )
566 step_mm = OFFSET_INCREMENT_MM_FINE;
567
568 if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
569 {
570 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
571
572 if( event.ShiftDown( ) )
573 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
574 }
575
576 if( event.GetWheelRotation() >= 0 )
577 step_mm = -step_mm;
578
580 textCtrl->GetValue() )
582
583 curr_value_mm += step_mm;
584 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
585 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
586
587 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
588}
589
590
591void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
592{
594 xoff->GetValue() )
597 yoff->GetValue() )
600 zoff->GetValue() )
602
603 PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( aEvent.GetClientData() );
604 m_userUnits = frame->GetUserUnits();
605
606 xoff->SetValue( formatOffsetValue( xoff_mm ) );
607 yoff->SetValue( formatOffsetValue( yoff_mm ) );
608 zoff->SetValue( formatOffsetValue( zoff_mm ) );
609
610 aEvent.Skip();
611}
612
613
615{
616 m_dummyFootprint->Models().clear();
617
618 for( FP_3DMODEL& model : *m_parentModelList )
619 {
620 if( model.m_Show )
621 m_dummyFootprint->Models().push_back( model );
622 }
623
624 if( aReloadRequired )
626
628}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:111
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:66
bool m_IsPreviewer
true if we're in a 3D preview panel, false for the standard 3D viewer
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
EDA_3D_VIEWER_SETTINGS * m_Cfg
bool m_MousewheelPanning
Container for design settings for a BOARD object.
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
void SetBoardThickness(int aThickness)
void SetParentGroup(PCB_GROUP *aGroup)
Definition: board_item.h:92
Manage layers needed to make a physical board.
void RemoveAll()
Delete all items in list and clear the list.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:289
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:982
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:301
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:196
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:874
EDA_3D_ACTIONS.
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
void SetProjectionMode(int aMode)
void SetInfoBar(WX_INFOBAR *aInfoBar)
Definition: eda_3d_canvas.h:79
void SetAnimationEnabled(bool aEnable)
Enable or disable camera animation when switching to a pre-defined view.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void ReloadRequest(BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
void SetMovingSpeedMultiplier(int aMultiplier)
Set the camera animation moving speed multiplier option.
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
EDA_3D_CONTROLLER.
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2415
bool IsFlipped() const
Definition: footprint.h:380
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:209
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:2284
VECTOR2I GetPosition() const override
Definition: footprint.h:213
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:100
double m_Opacity
Definition: footprint.h:101
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:99
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:98
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition: lset.cpp:838
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:845
static const wxGLAttributes GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode, bool aAlpha=false)
Get a list of attributes to pass to wxGLCanvas.
Class PANEL_PREVIEW_3D_MODEL_BASE.
wxString formatOffsetValue(double aValue)
void onMouseWheelRot(wxMouseEvent &event) override
void View3DSettings(wxCommandEvent &event) override
void onOpacitySlider(wxCommandEvent &event) override
void setBodyStyleView(wxCommandEvent &event) override
void onMouseWheelScale(wxMouseEvent &event) override
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender
true if the board body is show
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...
wxString formatScaleValue(double aValue)
void doIncrementRotation(wxSpinEvent &aEvent, double aSign)
void loadSettings()
Load 3D relevant settings from the user configuration.
void OnMenuEvent(wxMenuEvent &aEvent)
The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't ...
void onUnitsChanged(wxCommandEvent &aEvent)
void doIncrementOffset(wxSpinEvent &aEvent, double aSign)
PANEL_PREVIEW_3D_MODEL(wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
void doIncrementScale(wxSpinEvent &aEvent, double aSign)
void updateOrientation(wxCommandEvent &event) override
It will receive the events from editing the fields.
wxString formatRotationValue(double aValue)
void onMouseWheelOffset(wxMouseEvent &event) override
void SetSelectedModel(int idx)
Set the currently selected index in the model list so that the scale/rotation/offset controls can be ...
std::vector< FP_3DMODEL > * m_parentModelList
EDA_UNITS m_userUnits
Index into m_parentInfoList.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
Definition: project_pcb.cpp:77
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
void SetBitmap(const wxBitmapBundle &aBmp)
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:169
ACTIONS * m_actions
Definition: tools_holder.h:168
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
Definition: tool_manager.h:62
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initializes all registered tools.
EDA_UNITS GetUserUnits() const
T y
Definition: vector3.h:63
T z
Definition: vector3.h:64
T x
Definition: vector3.h:62
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
An extension of WX_TEXT_ENTRY_DIALOG that uses UNIT_BINDER to request a dimension (e....
int GetValue()
Returns the value in internal units.
#define _(s)
static constexpr EDA_ANGLE ANGLE_0
Definition: eda_angle.h:401
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:576
KICOMMON_API wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:126
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:130
Declaration of the cogl_att_list class.
static double rotationFromString(const wxString &aValue)
Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.
#define MAX_SCALE
#define MAX_ROTATION
#define MAX_OFFSET
#define OFFSET_INCREMENT_MM_FINE
#define OFFSET_INCREMENT_MIL
#define SCALE_INCREMENT
#define ROTATION_INCREMENT_FINE
#define OFFSET_INCREMENT_MM
#define ROTATION_INCREMENT
#define OFFSET_INCREMENT_MIL_FINE
#define SCALE_INCREMENT_FINE
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
const double IU_PER_MM
Definition: base_units.h:76
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:121