KiCad PCB EDA Suite
panel_prev_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 <mrluzeiro@ua.pt>
5  * Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
6  * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
7  * Copyright (C) 2015-2017 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 
33 #include <cstdlib>
34 #include <limits.h>
35 #include <bitmaps.h>
36 
37 #include <wx/valnum.h>
38 #include <wx/tglbtn.h>
39 
40 #include "project.h"
41 #include "panel_prev_model.h"
42 #include <class_board.h>
43 
44 
45 PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
46  MODULE* aModuleCopy,
47  COLORS_DESIGN_SETTINGS *aColors,
48  std::vector<S3D_INFO> *aParentInfoList ):
49  PANEL_PREV_3D_BASE( aParent, wxID_ANY )
50  {
51  initPanel();
52 
53  // Initialize the color settings to draw the board and the footprint
54  if( aColors )
55  m_dummyBoard->SetColorsSettings( aColors );
56  else
57  {
58  static COLORS_DESIGN_SETTINGS defaultColors;
59  m_dummyBoard->SetColorsSettings( &defaultColors );
60  }
61 
62  if( NULL != aCacheManager )
63  m_resolver = aCacheManager->GetResolver();
64 
65  m_parentInfoList = aParentInfoList;
66 
67  m_dummyBoard->Add( (MODULE*)aModuleCopy );
68  m_copyModule = aModuleCopy;
69 
70  // Set 3d viewer configuration for preview
72 
73  // Create the 3D canvas
74  m_previewPane = new EDA_3D_CANVAS( this,
78  aCacheManager );
79 
80  m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND );
81 
82  m_previewPane->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler(
84  }
85 
86 
88 {
89  m_previewPane->Disconnect( wxEVT_ENTER_WINDOW,
90  wxMouseEventHandler( PANEL_PREV_3D::onEnterPreviewCanvas ), NULL, this );
91 
92  delete m_settings3Dviewer;
93  delete m_dummyBoard;
94  delete m_previewPane;
95 }
96 
97 
99 {
100  m_resolver = NULL;
101  currentModelFile.clear();
102  m_dummyBoard = new BOARD();
104 
105  // Set the bitmap of 3D view buttons:
106  m_bpvTop->SetBitmap( KiBitmap( axis3d_top_xpm ) );
107  m_bpvFront->SetBitmap( KiBitmap( axis3d_front_xpm ) );
108  m_bpvBack->SetBitmap( KiBitmap( axis3d_back_xpm ) );
109  m_bpvLeft->SetBitmap( KiBitmap( axis3d_left_xpm ) );
110  m_bpvRight->SetBitmap( KiBitmap( axis3d_right_xpm ) );
111  m_bpvBottom->SetBitmap( KiBitmap( axis3d_bottom_xpm ) );
112  m_bpvISO->SetBitmap( KiBitmap( ortho_xpm ) );
113  m_bpUpdate->SetBitmap( KiBitmap( reload_xpm ) );
114 
115  // Set the min and max values of spin buttons (mandatory on Linux)
116  // They are not used, so they are set to min and max 32 bits int values
117  // (the min and max values supported by a wxSpinButton)
118  // It avoids blocking the up or down arrows when reaching this limit after
119  // a few clicks.
120  wxSpinButton* spinButtonList[] =
121  {
125  };
126 
127  for( int ii = 0; ii < 9; ii++ )
128  spinButtonList[ii]->SetRange( INT_MIN, INT_MAX );
129 }
130 
131 
132 
133 
140 static void checkRotation( double& aRotation )
141 {
142  if( aRotation > MAX_ROTATION )
143  {
144  int n = aRotation / MAX_ROTATION;
145  aRotation -= MAX_ROTATION * n;
146  }
147  else if( aRotation < -MAX_ROTATION )
148  {
149  int n = -aRotation / MAX_ROTATION;
150  aRotation += MAX_ROTATION * n;
151  }
152 }
153 
154 static bool validateFloatTextCtrl( wxTextCtrl* aTextCtrl )
155  {
156  if( aTextCtrl == NULL )
157  return false;
158 
159  if( aTextCtrl->GetLineLength(0) == 0 ) // This will skip the got and event with empty field
160  return false;
161 
162  if( aTextCtrl->GetLineLength(0) == 1 )
163  {
164  if( (aTextCtrl->GetLineText(0).compare( "." ) == 0) ||
165  (aTextCtrl->GetLineText(0).compare( "," ) == 0) )
166  return false;
167  }
168 
169  return true;
170 }
171 
172 
173 static void incrementTextCtrl( wxTextCtrl* aTextCtrl, double aInc, double aMinval, double aMaxval )
174 {
175  if( !validateFloatTextCtrl( aTextCtrl ) )
176  return;
177 
178  double curr_value = 0;
179 
180  aTextCtrl->GetValue().ToDouble( &curr_value );
181  curr_value += aInc;
182 
183  if( curr_value > aMaxval )
184  curr_value = aMaxval;
185 
186  if( curr_value < aMinval )
187  curr_value = aMinval;
188 
189  aTextCtrl->SetValue( wxString::Format( "%.4f", curr_value ) );
190 }
191 
192 
193 void PANEL_PREV_3D::SetModelDataIdx( int idx, bool aReloadPreviewModule )
194 {
195  wxASSERT( m_parentInfoList != NULL );
196 
197  if( m_parentInfoList && (idx >= 0) )
198  {
199  wxASSERT( (unsigned int)idx < (*m_parentInfoList).size() );
200 
201  if( (unsigned int)idx < (*m_parentInfoList).size() )
202  {
203  m_currentSelectedIdx = -1; // In case that we receive events on the
204  // next updates, it will set first an
205  // invalid selection
206 
207  const S3D_INFO *aModel = (const S3D_INFO *)&((*m_parentInfoList)[idx]);
208 
209  xscale->SetValue( wxString::Format( "%.4f", aModel->m_Scale.x ) );
210  yscale->SetValue( wxString::Format( "%.4f", aModel->m_Scale.y ) );
211  zscale->SetValue( wxString::Format( "%.4f", aModel->m_Scale.z ) );
212 
213  xrot->SetValue( wxString::Format( "%.2f", aModel->m_Rotation.x ) );
214  yrot->SetValue( wxString::Format( "%.2f", aModel->m_Rotation.y ) );
215  zrot->SetValue( wxString::Format( "%.2f", aModel->m_Rotation.z ) );
216 
217  switch( g_UserUnit )
218  {
219  case MILLIMETRES:
220  xoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.x * 25.4 ) );
221  yoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.y * 25.4 ) );
222  zoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.z * 25.4 ) );
223  break;
224 
225  case INCHES:
226  xoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.x ) );
227  yoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.y ) );
228  zoff->SetValue( wxString::Format( "%.4f", aModel->m_Offset.z ) );
229  break;
230 
231  case DEGREES:
232  case UNSCALED_UNITS:
233  default:
234  wxASSERT(0);
235  }
236 
237  UpdateModelName( aModel->m_Filename );
238 
239  if( aReloadPreviewModule && m_previewPane )
240  {
242 
245  }
246 
247  m_currentSelectedIdx = idx;
248  }
249  }
250 
251  if( m_previewPane )
252  m_previewPane->SetFocus();
253 
254  return;
255 }
256 
257 
258 void PANEL_PREV_3D::ResetModelData( bool aReloadPreviewModule )
259 {
261 
262  xscale->SetValue( wxString::FromDouble( 1.0 ) );
263  yscale->SetValue( wxString::FromDouble( 1.0 ) );
264  zscale->SetValue( wxString::FromDouble( 1.0 ) );
265 
266  xrot->SetValue( wxString::FromDouble( 0.0 ) );
267  yrot->SetValue( wxString::FromDouble( 0.0 ) );
268  zrot->SetValue( wxString::FromDouble( 0.0 ) );
269 
270  xoff->SetValue( wxString::FromDouble( 0.0 ) );
271  yoff->SetValue( wxString::FromDouble( 0.0 ) );
272  zoff->SetValue( wxString::FromDouble( 0.0 ) );
273 
274  // This will update the model on the preview board with the current list of 3d shapes
275  if( aReloadPreviewModule )
276  {
278 
279  if( m_previewPane )
280  {
283  }
284  }
285 
286  if( m_previewPane )
287  m_previewPane->SetFocus();
288 }
289 
290 
291 void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
292 {
293  bool newModel = false;
294 
295  m_modelInfo.m_Filename = aModelName;
296 
297  // if the model name is a directory simply clear the current model
298  if( aModelName.empty() || wxFileName::DirExists( aModelName ) )
299  {
300  currentModelFile.clear();
301  m_modelInfo.m_Filename.clear();
302  }
303  else
304  {
305  wxString newModelFile;
306 
307  if( m_resolver )
308  newModelFile = m_resolver->ResolvePath( aModelName );
309 
310  if( !newModelFile.empty() && newModelFile.Cmp( currentModelFile ) )
311  newModel = true;
312 
313  currentModelFile = newModelFile;
314  }
315 
316  if( currentModelFile.empty() || newModel )
317  {
319 
320  if( m_previewPane )
321  {
323  m_previewPane->Refresh();
324  }
325 
326  if( currentModelFile.empty() )
327  return;
328  }
329  else
330  {
331  if( m_previewPane )
332  m_previewPane->Refresh();
333  }
334 
335  if( m_previewPane )
336  m_previewPane->SetFocus();
337 
338  return;
339 }
340 
341 
342 void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
343 {
344  wxTextCtrl *textCtrl = (wxTextCtrl *)event.GetEventObject();
345 
346  if( textCtrl == NULL )
347  return;
348 
349  if( textCtrl->GetLineLength(0) == 0 ) // This will skip the got and event with empty field
350  return;
351 
352  if( textCtrl->GetLineLength(0) == 1 )
353  if( (textCtrl->GetLineText(0).compare( "." ) == 0) ||
354  (textCtrl->GetLineText(0).compare( "," ) == 0) )
355  return;
356 
357  SGPOINT scale;
358  SGPOINT rotation;
359  SGPOINT offset;
360 
361  getOrientationVars( scale, rotation, offset );
362 
364  m_modelInfo.m_Offset = offset;
365  m_modelInfo.m_Rotation = rotation;
366 
367  if( m_currentSelectedIdx >= 0 )
368  {
369  // This will update the parent list with the new data
370  (*m_parentInfoList)[m_currentSelectedIdx] = m_modelInfo;
371 
372  // It will update the copy model in the preview board
374 
375  // Since the OpenGL render does not need to be reloaded to update the
376  // shapes position, we just request to redraw again the canvas
377  if( m_previewPane )
378  m_previewPane->Refresh();
379  }
380 }
381 
382 
383 void PANEL_PREV_3D::onIncrementRot( wxSpinEvent& event )
384 {
385  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
386 
387  wxTextCtrl * textCtrl = xrot;
388 
389  if( spinCtrl == m_spinYrot )
390  textCtrl = yrot;
391  else if( spinCtrl == m_spinZrot )
392  textCtrl = zrot;
393 
395 }
396 
397 
398 void PANEL_PREV_3D::onDecrementRot( wxSpinEvent& event )
399 {
400  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
401 
402  wxTextCtrl * textCtrl = xrot;
403 
404  if( spinCtrl == m_spinYrot )
405  textCtrl = yrot;
406  else if( spinCtrl == m_spinZrot )
407  textCtrl = zrot;
408 
410 }
411 
412 
413 void PANEL_PREV_3D::onIncrementScale( wxSpinEvent& event )
414 {
415  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
416 
417  wxTextCtrl * textCtrl = xscale;
418 
419  if( spinCtrl == m_spinYscale )
420  textCtrl = yscale;
421  else if( spinCtrl == m_spinZscale )
422  textCtrl = zscale;
423 
425 }
426 
427 
428 void PANEL_PREV_3D::onDecrementScale( wxSpinEvent& event )
429 {
430  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
431 
432  wxTextCtrl * textCtrl = xscale;
433 
434  if( spinCtrl == m_spinYscale )
435  textCtrl = yscale;
436  else if( spinCtrl == m_spinZscale )
437  textCtrl = zscale;
438 
440 }
441 
442 
443 void PANEL_PREV_3D::onIncrementOffset( wxSpinEvent& event )
444 {
445  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
446 
447  wxTextCtrl * textCtrl = xoff;
448 
449  if( spinCtrl == m_spinYoffset )
450  textCtrl = yoff;
451  else if( spinCtrl == m_spinZoffset )
452  textCtrl = zoff;
453 
454  double step = OFFSET_INCREMENT_MM;
455 
456  if( g_UserUnit == INCHES )
457  step = OFFSET_INCREMENT_MIL/1000.0;
458 
459  incrementTextCtrl( textCtrl, step, -MAX_OFFSET, MAX_OFFSET );
460 }
461 
462 
463 void PANEL_PREV_3D::onDecrementOffset( wxSpinEvent& event )
464 {
465  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
466 
467  wxTextCtrl * textCtrl = xoff;
468 
469  if( spinCtrl == m_spinYoffset )
470  textCtrl = yoff;
471  else if( spinCtrl == m_spinZoffset )
472  textCtrl = zoff;
473 
474  double step = OFFSET_INCREMENT_MM;
475 
476  if( g_UserUnit == INCHES )
477  step = OFFSET_INCREMENT_MIL/1000.0;
478 
479  incrementTextCtrl( textCtrl, -step, -MAX_OFFSET, MAX_OFFSET );
480 }
481 
482 
483 void PANEL_PREV_3D::onMouseWheelScale( wxMouseEvent& event )
484 {
485  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
486 
487  double step = SCALE_INCREMENT;
488 
489  if( event.ShiftDown( ) )
490  step = SCALE_INCREMENT_FINE;
491 
492  if( event.GetWheelRotation() >= 0 )
493  step = -step;
494 
495  incrementTextCtrl( textCtrl, step, 1/MAX_SCALE, MAX_SCALE );
496 }
497 
498 
499 void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event )
500 {
501  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
502 
503  wxKeyboardState kbdState;
504 
505  double step = ROTATION_INCREMENT_WHEEL;
506 
507  if( event.ShiftDown( ) )
509 
510  if( event.GetWheelRotation() >= 0 )
511  step = -step;
512 
513  incrementTextCtrl( textCtrl, step, -MAX_ROTATION, MAX_ROTATION );
514 }
515 
516 void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
517 {
518  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
519 
520  double step = OFFSET_INCREMENT_MM;
521  if( event.ShiftDown( ) )
523 
524  if( g_UserUnit == INCHES )
525  {
526  step = OFFSET_INCREMENT_MIL/1000.0;
527  if( event.ShiftDown( ) )
528  step = OFFSET_INCREMENT_MIL_FINE/1000.0;
529  }
530 
531  if( event.GetWheelRotation() >= 0 )
532  step = -step;
533 
534  incrementTextCtrl( textCtrl, step, -MAX_OFFSET, MAX_OFFSET );
535 }
536 
537 void PANEL_PREV_3D::getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGPOINT& aOffset )
538 {
539  if( NULL == xscale || NULL == yscale || NULL == zscale
540  || NULL == xrot || NULL == yrot || NULL == zrot
541  || NULL == xoff || NULL == yoff || NULL == zoff )
542  {
543  return;
544  }
545 
546  xscale->GetValue().ToDouble( &aScale.x );
547  yscale->GetValue().ToDouble( &aScale.y );
548  zscale->GetValue().ToDouble( &aScale.z );
549 
550  xrot->GetValue().ToDouble( &aRotation.x );
551  yrot->GetValue().ToDouble( &aRotation.y );
552  zrot->GetValue().ToDouble( &aRotation.z );
553 
554  checkRotation( aRotation.x );
555  checkRotation( aRotation.y );
556  checkRotation( aRotation.z );
557 
558  xoff->GetValue().ToDouble( &aOffset.x );
559  yoff->GetValue().ToDouble( &aOffset.y );
560  zoff->GetValue().ToDouble( &aOffset.z );
561 
562  switch( g_UserUnit )
563  {
564  case MILLIMETRES:
565  // Convert to Inches. Offset is stored in inches.
566  aOffset.x = aOffset.x / 25.4;
567  aOffset.y = aOffset.y / 25.4;
568  aOffset.z = aOffset.z / 25.4;
569  break;
570 
571  case INCHES:
572  // It is already in Inches
573  break;
574 
575  case DEGREES:
576  case UNSCALED_UNITS:
577  default:
578  wxASSERT(0);
579  }
580 
581  return;
582 }
583 
584 
585 bool PANEL_PREV_3D::ValidateWithMessage( wxString& aErrorMessage )
586 {
587  bool invalidScale = false;
588 
589  for( unsigned int idx = 0; idx < m_parentInfoList->size(); ++idx )
590  {
591  wxString msg;
592  bool addError = false;
593  S3D_INFO& s3dshape = (*m_parentInfoList)[idx];
594 
595  SGPOINT scale = s3dshape.m_Scale;
596 
597  if( 1/MAX_SCALE > scale.x || MAX_SCALE < scale.x )
598  {
599  invalidScale = true;
600  addError = true;
601  msg += _( "Invalid X scale" );
602  }
603 
604  if( 1/MAX_SCALE > scale.y || MAX_SCALE < scale.y )
605  {
606  invalidScale = true;
607  addError = true;
608 
609  if( !msg.IsEmpty() )
610  msg += "\n";
611 
612  msg += _( "Invalid Y scale" );
613  }
614 
615  if( 1/MAX_SCALE > scale.z || MAX_SCALE < scale.z )
616  {
617  invalidScale = true;
618  addError = true;
619 
620  if( !msg.IsEmpty() )
621  msg += "\n";
622 
623  msg += _( "Invalid Z scale" );
624  }
625 
626  if( addError )
627  {
628  msg.Prepend( s3dshape.m_Filename + "\n" );
629 
630  if( !aErrorMessage.IsEmpty() )
631  aErrorMessage += "\n\n";
632 
633  aErrorMessage += msg;
634  }
635  }
636 
637  if( !aErrorMessage.IsEmpty() )
638  {
639  aErrorMessage += "\n\n";
640  aErrorMessage += wxString::Format( "Min value = %.4f and max value = %.4f",
641  1/MAX_SCALE, MAX_SCALE );
642  }
643 
644  return invalidScale == false;
645 }
646 
648 {
649  std::list<S3D_INFO>* draw3D = &m_copyModule->Models();
650  draw3D->clear();
651  draw3D->insert( draw3D->end(), m_parentInfoList->begin(), m_parentInfoList->end() );
652 }
wxBitmapButton * m_bpvTop
void SetColorsSettings(COLORS_DESIGN_SETTINGS *aColorsSettings)
Function SetColorsSettings.
Definition: class_board.h:561
wxBitmapButton * m_bpvBottom
void ResetModelData(bool aReloadPreviewModule=false)
ResetModelData - Clear the values and reload the preview board.
wxSpinButton * m_spinZoffset
Class PANEL_PREV_3D_BASE.
MODULE * m_copyModule
A pointer to a new copy of the original module.
#define OFFSET_INCREMENT_MM_FINE
CINFO3D_VISU * m_settings3Dviewer
The settings that will be used for this 3D viewer canvas.
static const int * GetAttributesList(bool aUseAntiAliasing)
Get a list of attributes to pass to wxGLCanvas.
void onDecrementRot(wxSpinEvent &event) override
double x
Definition: sg_base.h:70
wxSpinButton * m_spinYoffset
void onMouseWheelScale(wxMouseEvent &event) override
wxBitmapButton * m_bpvBack
#define OFFSET_INCREMENT_MM
void onIncrementOffset(wxSpinEvent &event) override
#define SCALE_INCREMENT_FINE
wxBitmapButton * m_bpvLeft
Class BOARD to handle a board.
void getOrientationVars(SGPOINT &aScale, SGPOINT &aRotation, SGPOINT &aOffset)
getOrientationVars - gets the transformation from entries and validate it
void onMouseWheelOffset(wxMouseEvent &event) override
wxBitmapButton * m_bpUpdate
bool ValidateWithMessage(wxString &aErrorMessage)
verify X,Y and Z scale factors are acceptable (> 0.001 and < 1000.0)
static void incrementTextCtrl(wxTextCtrl *aTextCtrl, double aInc, double aMinval, double aMaxval)
Class EDA_3D_CANVAS Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:53
void onDecrementScale(wxSpinEvent &event) override
wxBoxSizer * m_SizerPanelView
double y
Definition: sg_base.h:71
SGPOINT m_Offset
an offset (unit = inch) for the 3D shape
Definition: 3d_info.h:44
std::list< S3D_INFO > & Models()
Definition: class_module.h:150
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
void ReloadRequest(BOARD *aBoard=NULL, S3D_CACHE *aCachePointer=NULL)
#define ROTATION_INCREMENT
int m_currentSelectedIdx
The current selected index of the S3D_INFO list.
wxBitmapButton * m_bpvRight
static bool validateFloatTextCtrl(wxTextCtrl *aTextCtrl)
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
void updateListOnModelCopy()
updateListOnModelCopy - copy the current shape list to the copy of module that is on the preview dumm...
wxSpinButton * m_spinZrot
void SetModelDataIdx(int idx, bool aReloadPreviewModule=false)
SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
Defines a panel which is to be added to a wxFileDialog via SetExtraControl(); The panel shows a previ...
#define SCALE_INCREMENT
S3D_FILENAME_RESOLVER * m_resolver
Used to get the full path name.
wxSpinButton * m_spinXoffset
Definition: common.h:145
void onEnterPreviewCanvas(wxMouseEvent &event)
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
EDA_3D_CANVAS * m_previewPane
The 3D canvas.
Class CINFO3D_VISU Helper class to handle information needed to display 3D board. ...
Definition: cinfo3d_visu.h:70
wxSpinButton * m_spinYrot
void onIncrementRot(wxSpinEvent &event) override
Declaration of the cogl_att_list class.
wxSpinButton * m_spinXrot
wxBitmapButton * m_bpvFront
wxSpinButton * m_spinZscale
wxSpinButton * m_spinXscale
S3D_FILENAME_RESOLVER * GetResolver(void)
Definition: 3d_cache.cpp:739
void onDecrementOffset(wxSpinEvent &event) override
void onMouseWheelRot(wxMouseEvent &event) override
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
PANEL_PREV_3D(wxWindow *aParent, S3D_CACHE *aCacheManager, MODULE *aModuleCopy, COLORS_DESIGN_SETTINGS *aColors, std::vector< S3D_INFO > *aParentInfoList=NULL)
const int scale
#define OFFSET_INCREMENT_MIL_FINE
#define OFFSET_INCREMENT_MIL
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void updateOrientation(wxCommandEvent &event) override
updateOrientation - it will receive the events from editing the fields
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
wxString ResolvePath(const wxString &aFileName)
Function ResolvePath determines the full path of the given file name.
void onIncrementScale(wxSpinEvent &event) override
SGPOINT m_Rotation
an X,Y,Z rotation (unit = degrees) for the 3D shape
Definition: 3d_info.h:43
wxBitmapButton * m_bpvISO
double z
Definition: sg_base.h:72
Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Eeschema, Pcbnew and GerbView...
#define ROTATION_INCREMENT_WHEEL_FINE
#define ROTATION_INCREMENT_WHEEL
#define MAX_OFFSET
#define MAX_ROTATION
SGPOINT m_Scale
scaling factors for the 3D footprint shape
Definition: 3d_info.h:42
S3D_INFO m_modelInfo
Current S3D_INFO that is being edited.
BOARD * m_dummyBoard
A dummy board used to store the copy moduled.
wxString currentModelFile
Used to check if the model file was changed.
static void checkRotation(double &aRotation)
checkRotation Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION aRotation will be normalized between -...
std::vector< S3D_INFO > * m_parentInfoList
A pointer to the parent S3D_INFO list that we will use to copy to the preview module.
void UpdateModelName(wxString const &aModel)
wxSpinButton * m_spinYscale
wxString m_Filename
The 3D shape filename in 3D library.
Definition: 3d_info.h:45