47 std::vector<FP_3DMODEL>* aParentModelList ) :
49 m_previewPane( nullptr ),
52 m_currentCamera( m_trackBallCamera ),
54 m_boardThickness( aFrame, nullptr, m_boardThicknessCtrl, m_boardThicknessUnits )
92 wxSpinButton* spinButtonList[] =
99 for( wxSpinButton* button : spinButtonList )
100 button->SetRange(INT_MIN, INT_MAX );
112 aFrame->
Prj().Get3DCacheManager() );
141 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
147 aFrame->Connect( EDA_EVT_UNITS_CHANGED,
158 wxSize borderFix = wxSize( 4, 4 );
190 wxCHECK_RET(
m_previewPane, wxT(
"Cannot load settings to null canvas" ) );
207 aTarget.r = aColor.
r;
208 aTarget.g = aColor.
g;
209 aTarget.b = aColor.
b;
210 aTarget.a = aColor.
a;
263 return wxString::Format( wxT(
"%.4f" ),
270 return wxString::Format( wxT(
"%.2f%s" ),
282 aValue /= 25.4 / 1e3;
284 return wxString::Format( wxT(
"%.6f%s" ),
317 xscale->ChangeValue( wxEmptyString );
318 yscale->ChangeValue( wxEmptyString );
319 zscale->ChangeValue( wxEmptyString );
321 xrot->ChangeValue( wxEmptyString );
322 yrot->ChangeValue( wxEmptyString );
323 zrot->ChangeValue( wxEmptyString );
325 xoff->ChangeValue( wxEmptyString );
326 yoff->ChangeValue( wxEmptyString );
327 zoff->ChangeValue( wxEmptyString );
401 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
403 wxTextCtrl * textCtrl =
xscale;
411 textCtrl->GetValue() );
414 curr_value = std::max( 1/
MAX_SCALE, curr_value );
415 curr_value = std::min( curr_value,
MAX_SCALE );
423 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
424 wxTextCtrl* textCtrl =
xrot;
432 textCtrl->GetValue() );
444 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
446 wxTextCtrl * textCtrl =
xoff;
454 double curr_value_mm =
456 textCtrl->GetValue() )
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 );
474 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
478 if( event.ShiftDown( ) )
481 if( event.GetWheelRotation() >= 0 )
485 textCtrl->GetValue() );
488 curr_value = std::max( 1/
MAX_SCALE, curr_value );
489 curr_value = std::min( curr_value,
MAX_SCALE );
497 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
501 if( event.ShiftDown( ) )
504 if( event.GetWheelRotation() >= 0 )
508 textCtrl->GetValue() );
520 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
524 if( event.ShiftDown( ) )
531 if( event.ShiftDown( ) )
535 if( event.GetWheelRotation() >= 0 )
539 textCtrl->GetValue() )
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 );
583 if( aReloadRequired )
constexpr EDA_IU_SCALE pcbIUScale
constexpr EDA_IU_SCALE unityScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
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
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)
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.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
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.
Implement a canvas based on a wxGLCanvas.
void SetProjectionMode(int aMode)
void SetInfoBar(WX_INFOBAR *aInfoBar)
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.
VECTOR3D m_Offset
3D model offset (mm)
VECTOR3D m_Rotation
3D model rotation (degrees)
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
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.
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.
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
static const int * GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode)
Get a list of attributes to pass to wxGLCanvas.
Class PANEL_PREVIEW_3D_MODEL_BASE.
wxSpinButton * m_spinYrot
wxSpinButton * m_spinZrot
wxBitmapButton * m_bpvFront
wxBitmapButton * m_bpUpdate
wxBitmapButton * m_bpvTop
wxBitmapButton * m_bpvBack
wxSpinButton * m_spinXscale
wxSpinButton * m_spinYscale
wxSpinButton * m_spinXrot
wxBoxSizer * m_SizerPanelView
wxSpinButton * m_spinZoffset
wxBitmapButton * m_bpvLeft
wxStaticText * m_previewLabel
wxSpinButton * m_spinXoffset
wxBitmapButton * m_bpvRight
wxBitmapButton * m_bpvBottom
wxSpinButton * m_spinYoffset
wxSpinButton * m_spinZscale
wxBitmapButton * m_bpvISO
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...
~PANEL_PREVIEW_3D_MODEL()
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)
BOARD_ADAPTER m_boardAdapter
PANEL_PREVIEW_3D_MODEL(wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
EDA_3D_CANVAS * m_previewPane
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
FOOTPRINT * m_dummyFootprint
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.
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...
A modified version of the wxInfoBar class that allows us to:
@ LAYER_3D_SOLDERMASK_TOP
@ LAYER_3D_BACKGROUND_TOP
@ LAYER_3D_SOLDERMASK_BOTTOM
@ LAYER_3D_SILKSCREEN_TOP
@ LAYER_3D_BACKGROUND_BOTTOM
@ LAYER_3D_SILKSCREEN_BOTTOM
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.
wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
wxFont GetStatusFont(wxWindow *aWindow)
Declaration of the cogl_att_list class.
static double rotationFromString(const wxString &aValue)
Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.
#define OFFSET_INCREMENT_MM_FINE
#define OFFSET_INCREMENT_MIL
#define ROTATION_INCREMENT_WHEEL_FINE
#define ROTATION_INCREMENT_WHEEL
#define OFFSET_INCREMENT_MM
#define ROTATION_INCREMENT
#define OFFSET_INCREMENT_MIL_FINE
#define SCALE_INCREMENT_FINE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
int moving_speed_multiplier
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".