47 std::vector<FP_3DMODEL>* aParentModelList ) :
49 m_previewPane( nullptr ),
52 m_currentCamera( m_trackBallCamera ),
54 m_boardThickness( aFrame, nullptr, m_boardThicknessCtrl, m_boardThicknessUnits )
88 wxSpinButton* spinButtonList[] =
95 for( wxSpinButton* button : spinButtonList )
96 button->SetRange(INT_MIN, INT_MAX );
108 aFrame->
Prj().Get3DCacheManager() );
137 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
150 wxSize borderFix = wxSize( 4, 4 );
182 wxCHECK_RET(
m_previewPane, wxT(
"Cannot load settings to null canvas" ) );
199 aTarget.r = aColor.
r;
200 aTarget.g = aColor.
g;
201 aTarget.b = aColor.
b;
202 aTarget.a = aColor.
a;
274 aValue /= 25.4 / 1e3;
309 xscale->ChangeValue( wxEmptyString );
310 yscale->ChangeValue( wxEmptyString );
311 zscale->ChangeValue( wxEmptyString );
313 xrot->ChangeValue( wxEmptyString );
314 yrot->ChangeValue( wxEmptyString );
315 zrot->ChangeValue( wxEmptyString );
317 xoff->ChangeValue( wxEmptyString );
318 yoff->ChangeValue( wxEmptyString );
319 zoff->ChangeValue( wxEmptyString );
393 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
395 wxTextCtrl * textCtrl =
xscale;
403 textCtrl->GetValue() );
406 curr_value = std::max( 1/
MAX_SCALE, curr_value );
407 curr_value = std::min( curr_value,
MAX_SCALE );
415 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
416 wxTextCtrl* textCtrl =
xrot;
424 textCtrl->GetValue() );
436 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
438 wxTextCtrl * textCtrl =
xoff;
446 double curr_value_mm =
455 curr_value_mm += ( step_mm * aSign );
456 curr_value_mm = std::max( -
MAX_OFFSET, curr_value_mm );
457 curr_value_mm = std::min( curr_value_mm,
MAX_OFFSET );
465 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
469 if( event.ShiftDown( ) )
472 if( event.GetWheelRotation() >= 0 )
476 textCtrl->GetValue() );
479 curr_value = std::max( 1/
MAX_SCALE, curr_value );
480 curr_value = std::min( curr_value,
MAX_SCALE );
488 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
492 if( event.ShiftDown( ) )
495 if( event.GetWheelRotation() >= 0 )
499 textCtrl->GetValue() );
511 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
515 if( event.ShiftDown( ) )
522 if( event.ShiftDown( ) )
526 if( event.GetWheelRotation() >= 0 )
530 textCtrl->GetValue() )
533 curr_value_mm += step_mm;
534 curr_value_mm = std::max( -
MAX_OFFSET, curr_value_mm );
535 curr_value_mm = std::min( curr_value_mm,
MAX_OFFSET );
551 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.
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 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
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 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.
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
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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".