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
29#include <tool/tool_manager.h>
33#include <base_units.h>
34#include <bitmaps.h>
35#include <board.h>
37#include <gal/dpi_scaling.h>
38#include <pgm_base.h>
41#include <widgets/wx_infobar.h>
44
46 FOOTPRINT* aFootprint,
47 std::vector<FP_3DMODEL>* aParentModelList ) :
48 PANEL_PREVIEW_3D_MODEL_BASE( aParent, wxID_ANY ),
49 m_previewPane( nullptr ),
50 m_infobar( nullptr ),
51 m_boardAdapter(),
52 m_currentCamera( m_trackBallCamera ),
53 m_trackBallCamera( 2 * RANGE_SCALE_3D ),
54 m_boardThickness( aFrame, nullptr, m_boardThicknessCtrl, m_boardThicknessUnits )
55{
56 m_userUnits = aFrame->GetUserUnits();
57
58 m_dummyBoard = new BOARD();
59
60 m_dummyBoard->SetProject( &aFrame->Prj(), true );
61
62 // This board will only be used to hold a footprint for viewing
63 m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
64
65 BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
67 dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
70 dummy_board_stackup.RemoveAll();
71 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
72
73 m_selected = -1;
74
75 m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
76
77 // Set the bitmap of 3D view buttons:
78 m_bpvTop->SetBitmap( KiBitmap( BITMAPS::axis3d_top ) );
79 m_bpvFront->SetBitmap( KiBitmap( BITMAPS::axis3d_front ) );
80 m_bpvBack->SetBitmap( KiBitmap( BITMAPS::axis3d_back ) );
81 m_bpvLeft->SetBitmap( KiBitmap( BITMAPS::axis3d_left ) );
82 m_bpvRight->SetBitmap( KiBitmap( BITMAPS::axis3d_right ) );
83 m_bpvBottom->SetBitmap( KiBitmap( BITMAPS::axis3d_bottom ) );
84 m_bpvISO->SetBitmap( KiBitmap( BITMAPS::ortho ) );
85 m_bpUpdate->SetBitmap( KiBitmap( BITMAPS::reload ) );
86
87 // Set the min and max values of spin buttons (mandatory on Linux)
88 // They are not used, so they are set to min and max 32 bits int values
89 // (the min and max values supported by a wxSpinButton)
90 // It avoids blocking the up or down arrows when reaching this limit after
91 // a few clicks.
92 wxSpinButton* spinButtonList[] =
93 {
97 };
98
99 for( wxSpinButton* button : spinButtonList )
100 button->SetRange(INT_MIN, INT_MAX );
101
102 m_parentModelList = aParentModelList;
103
104 m_dummyFootprint = new FOOTPRINT( *aFootprint );
107
108 // Create the 3D canvas
109 m_previewPane = new EDA_3D_CANVAS( this,
110 OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
112 aFrame->Prj().Get3DCacheManager() );
113
116 m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options
117
118 loadSettings();
119
120 // Create the manager
122 m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
123
127
128 // Register tools
131
132 // Run the viewer control tool, it is supposed to be always active
133 m_toolManager->InvokeTool( "3DViewer.Control" );
134
135 m_infobar = new WX_INFOBAR( this );
137
138 m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 );
139 m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
140
141 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
142 {
143 Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
144 this );
145 }
146
147 aFrame->Connect( EDA_EVT_UNITS_CHANGED,
148 wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
149 nullptr, this );
150
151#ifdef __WXOSX__
152 // Call layout once to get the proper button sizes after the bitmaps have been set
153 Layout();
154
155 // The rounded-button style used has a small border on the left/right sides.
156 // This is automatically fixed in wx for buttons with a bitmap < 20, but not
157 // when the bitmap is set to be 26x26.
158 wxSize borderFix = wxSize( 4, 4 );
159
160 m_bpvTop->SetMinSize( m_bpvTop->GetSize() + borderFix );
161 m_bpvFront->SetMinSize( m_bpvFront->GetSize() + borderFix );
162 m_bpvBack->SetMinSize( m_bpvBack->GetSize() + borderFix );
163 m_bpvLeft->SetMinSize( m_bpvLeft->GetSize() + borderFix );
164 m_bpvRight->SetMinSize( m_bpvRight->GetSize() + borderFix );
165 m_bpvBottom->SetMinSize( m_bpvBottom->GetSize() + borderFix );
166 m_bpvISO->SetMinSize( m_bpvISO->GetSize() + borderFix );
167 m_bpUpdate->SetMinSize( m_bpUpdate->GetSize() + borderFix );
168#endif
169}
170
171
173{
174 delete m_dummyBoard;
175 delete m_previewPane;
176}
177
178
179void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
180{
181 if( !m_toolDispatcher )
182 aEvent.Skip();
183 else
185}
186
187
189{
190 wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
191
192 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
193
194 const DPI_SCALING dpi{ settings, this };
195 m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
196
197 // TODO(JE) use all control options
199
200 COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
201
202 if( colors )
203 {
204 auto set =
205 [] ( const COLOR4D& aColor, SFVEC4F& aTarget )
206 {
207 aTarget.r = aColor.r;
208 aTarget.g = aColor.g;
209 aTarget.b = aColor.b;
210 aTarget.a = aColor.a;
211 };
212
222 }
223
224 EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
225
226 if( cfg )
227 {
228 m_boardAdapter.m_Cfg = cfg;
229
233 }
234}
235
236
242static double rotationFromString( const wxString& aValue )
243{
245
246 if( rotation > MAX_ROTATION )
247 {
248 int n = KiROUND( rotation / MAX_ROTATION );
249 rotation -= MAX_ROTATION * n;
250 }
251 else if( rotation < -MAX_ROTATION )
252 {
253 int n = KiROUND( -rotation / MAX_ROTATION );
254 rotation += MAX_ROTATION * n;
255 }
256
257 return rotation;
258}
259
260
262{
263 return wxString::Format( wxT( "%.4f" ),
264 aValue );
265}
266
267
269{
270 return wxString::Format( wxT( "%.2f%s" ),
271 aValue,
272 EDA_UNIT_UTILS::GetText( EDA_UNITS::DEGREES ) );
273}
274
275
277{
278 // Convert from internal units (mm) to user units
279 if( m_userUnits == EDA_UNITS::INCHES )
280 aValue /= 25.4;
281 else if( m_userUnits == EDA_UNITS::MILS )
282 aValue /= 25.4 / 1e3;
283
284 return wxString::Format( wxT( "%.6f%s" ),
285 aValue,
287}
288
289
291{
292 if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
293 {
294 m_selected = idx;
295 const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
296
297 // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
298 // don't want to generate wxEVT_GRID_CELL_CHANGED events.
299 xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
300 yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
301 zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
302
303 xrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.x ) );
304 yrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.y ) );
305 zrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.z ) );
306
307 xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
308 yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
309 zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
310
311 m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
312 }
313 else
314 {
315 m_selected = -1;
316
317 xscale->ChangeValue( wxEmptyString );
318 yscale->ChangeValue( wxEmptyString );
319 zscale->ChangeValue( wxEmptyString );
320
321 xrot->ChangeValue( wxEmptyString );
322 yrot->ChangeValue( wxEmptyString );
323 zrot->ChangeValue( wxEmptyString );
324
325 xoff->ChangeValue( wxEmptyString );
326 yoff->ChangeValue( wxEmptyString );
327 zoff->ChangeValue( wxEmptyString );
328
329 m_opacity->SetValue( 100 );
330 }
331
334}
335
336
337void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
338{
339 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
340 {
341 // Write settings back to the parent
342 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
343
345 pcbIUScale, EDA_UNITS::UNSCALED, xscale->GetValue() );
347 pcbIUScale, EDA_UNITS::UNSCALED, yscale->GetValue() );
349 pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
350
351 modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
352 modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
353 modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
354
356 xoff->GetValue() )
359 yoff->GetValue() )
362 zoff->GetValue() )
364
365 // Update the dummy footprint for the preview
366 UpdateDummyFootprint( false );
367 }
368}
369
370
371void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
372{
373 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
374 {
375 // Write settings back to the parent
376 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
377
378 modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
379
380 // Update the dummy footprint for the preview
381 UpdateDummyFootprint( false );
382 }
383}
384
385
387{
390
392 dummy_board_stackup.RemoveAll();
393 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
394
395 UpdateDummyFootprint( true );
396}
397
398
399void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
400{
401 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
402
403 wxTextCtrl * textCtrl = xscale;
404
405 if( spinCtrl == m_spinYscale )
406 textCtrl = yscale;
407 else if( spinCtrl == m_spinZscale )
408 textCtrl = zscale;
409
410 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
411 textCtrl->GetValue() );
412
413 curr_value += ( SCALE_INCREMENT * aSign );
414 curr_value = std::max( 1/MAX_SCALE, curr_value );
415 curr_value = std::min( curr_value, MAX_SCALE );
416
417 textCtrl->SetValue( formatScaleValue( curr_value ) );
418}
419
420
421void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
422{
423 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
424 wxTextCtrl* textCtrl = xrot;
425
426 if( spinCtrl == m_spinYrot )
427 textCtrl = yrot;
428 else if( spinCtrl == m_spinZrot )
429 textCtrl = zrot;
430
431 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
432 textCtrl->GetValue() );
433
434 curr_value += ( ROTATION_INCREMENT * aSign );
435 curr_value = std::max( -MAX_ROTATION, curr_value );
436 curr_value = std::min( curr_value, MAX_ROTATION );
437
438 textCtrl->SetValue( formatRotationValue( curr_value ) );
439}
440
441
442void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
443{
444 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
445
446 wxTextCtrl * textCtrl = xoff;
447
448 if( spinCtrl == m_spinYoffset )
449 textCtrl = yoff;
450 else if( spinCtrl == m_spinZoffset )
451 textCtrl = zoff;
452
453 double step_mm = OFFSET_INCREMENT_MM;
454 double curr_value_mm =
456 textCtrl->GetValue() )
458
459 if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
460 {
461 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
462 }
463
464 curr_value_mm += ( step_mm * aSign );
465 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
466 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
467
468 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
469}
470
471
473{
474 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
475
476 double step = SCALE_INCREMENT;
477
478 if( event.ShiftDown( ) )
480
481 if( event.GetWheelRotation() >= 0 )
482 step = -step;
483
484 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
485 textCtrl->GetValue() );
486
487 curr_value += step;
488 curr_value = std::max( 1/MAX_SCALE, curr_value );
489 curr_value = std::min( curr_value, MAX_SCALE );
490
491 textCtrl->SetValue( formatScaleValue( curr_value ) );
492}
493
494
496{
497 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
498
499 double step = ROTATION_INCREMENT_WHEEL;
500
501 if( event.ShiftDown( ) )
503
504 if( event.GetWheelRotation() >= 0 )
505 step = -step;
506
507 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
508 textCtrl->GetValue() );
509
510 curr_value += step;
511 curr_value = std::max( -MAX_ROTATION, curr_value );
512 curr_value = std::min( curr_value, MAX_ROTATION );
513
514 textCtrl->SetValue( formatRotationValue( curr_value ) );
515}
516
517
519{
520 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
521
522 double step_mm = OFFSET_INCREMENT_MM;
523
524 if( event.ShiftDown( ) )
525 step_mm = OFFSET_INCREMENT_MM_FINE;
526
527 if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
528 {
529 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
530
531 if( event.ShiftDown( ) )
532 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
533 }
534
535 if( event.GetWheelRotation() >= 0 )
536 step_mm = -step_mm;
537
539 textCtrl->GetValue() )
541
542 curr_value_mm += step_mm;
543 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
544 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
545
546 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
547}
548
549
550void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
551{
553 xoff->GetValue() )
556 yoff->GetValue() )
559 zoff->GetValue() )
561
562 PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( aEvent.GetClientData() );
563 m_userUnits = frame->GetUserUnits();
564
565 xoff->SetValue( formatOffsetValue( xoff_mm ) );
566 yoff->SetValue( formatOffsetValue( yoff_mm ) );
567 zoff->SetValue( formatOffsetValue( zoff_mm ) );
568
569 aEvent.Skip();
570}
571
572
574{
575 m_dummyFootprint->Models().clear();
576
577 for( FP_3DMODEL& model : *m_parentModelList )
578 {
579 if( model.m_Show )
580 m_dummyFootprint->Models().push_back( model );
581 }
582
583 if( aReloadRequired )
585
587}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:106
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:62
SFVEC4F m_BgColorTop
background top color
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
SFVEC4F m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
bool m_IsPreviewer
true if the board adaptater is living in a 3D preview panel, false for the standard 3D viewer
SFVEC4F m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
SFVEC4F m_CopperColor
in realistic mode: copper color
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
EDA_3D_VIEWER_SETTINGS * m_Cfg
SFVEC4F m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
SFVEC4F m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
SFVEC4F m_BoardBodyColor
in realistic mode: FR4 board color
bool m_MousewheelPanning
SFVEC4F m_BgColorBot
background bottom color
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:84
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:270
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:796
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:282
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:178
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:728
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:37
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.
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:186
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:95
double m_Opacity
Definition: footprint.h:96
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:94
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:93
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
double r
Red component.
Definition: color4d.h:375
double g
Green component.
Definition: color4d.h:376
double a
Alpha component.
Definition: color4d.h:378
double b
Blue component.
Definition: color4d.h:377
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:895
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:902
static const int * GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode)
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 onOpacitySlider(wxCommandEvent &event) override
void onMouseWheelScale(wxMouseEvent &event) override
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)
UNIT_BINDER m_boardThickness
Index into m_parentInfoList.
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 ...
void updateBoardThickness(wxCommandEvent &event) override
std::vector< FP_3DMODEL > * m_parentModelList
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.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
ACTIONS * m_actions
Definition: tools_holder.h:171
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:55
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
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
T y
Definition: vector3.h:62
T z
Definition: vector3.h:63
T x
Definition: vector3.h:61
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
@ LAYER_3D_SOLDERMASK_TOP
Definition: layer_ids.h:448
@ LAYER_3D_COPPER
Definition: layer_ids.h:444
@ LAYER_3D_BACKGROUND_TOP
Definition: layer_ids.h:442
@ LAYER_3D_SOLDERMASK_BOTTOM
Definition: layer_ids.h:447
@ LAYER_3D_BOARD
Definition: layer_ids.h:443
@ LAYER_3D_SILKSCREEN_TOP
Definition: layer_ids.h:446
@ LAYER_3D_SOLDERPASTE
Definition: layer_ids.h:449
@ LAYER_3D_BACKGROUND_BOTTOM
Definition: layer_ids.h:441
@ LAYER_3D_SILKSCREEN_BOTTOM
Definition: layer_ids.h:445
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:445
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:101
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:132
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 ROTATION_INCREMENT_WHEEL_FINE
#define ROTATION_INCREMENT_WHEEL
#define SCALE_INCREMENT
#define OFFSET_INCREMENT_MM
#define ROTATION_INCREMENT
#define OFFSET_INCREMENT_MIL_FINE
#define SCALE_INCREMENT_FINE
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:115
const double IU_PER_MM
Definition: base_units.h:77
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:85
glm::vec4 SFVEC4F
Definition: xv3d_types.h:46