2015-12-08 07:31:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-07-19 17:35:25 +00:00
|
|
|
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
2020-04-17 21:33:23 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2015-12-08 07:31:57 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-03-26 14:05:20 +00:00
|
|
|
#ifndef BOARD_ADAPTER_H
|
|
|
|
#define BOARD_ADAPTER_H
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-03-25 13:13:03 +00:00
|
|
|
#include <array>
|
2015-12-08 07:31:57 +00:00
|
|
|
#include <vector>
|
|
|
|
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
|
|
|
|
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer.h"
|
|
|
|
#include "../3d_rendering/3d_render_raytracing/shapes3D/cbbox.h"
|
|
|
|
#include "../3d_rendering/ccamera.h"
|
2016-07-19 17:35:25 +00:00
|
|
|
#include "../3d_enums.h"
|
|
|
|
#include "../3d_cache/3d_cache.h"
|
2020-04-17 21:33:23 +00:00
|
|
|
#include "../common_ogl/cogl_att_list.h"
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
|
|
|
#include <class_pad.h>
|
|
|
|
#include <class_track.h>
|
|
|
|
#include <wx/gdicmn.h>
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <pcb_base_frame.h>
|
2015-12-08 07:31:57 +00:00
|
|
|
#include <class_pcb_text.h>
|
|
|
|
#include <class_drawsegment.h>
|
2017-02-01 13:52:17 +00:00
|
|
|
#include <class_dimension.h>
|
2015-12-08 07:31:57 +00:00
|
|
|
#include <class_zone.h>
|
2016-07-19 17:35:25 +00:00
|
|
|
#include <class_module.h>
|
|
|
|
#include <reporter.h>
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
class COLOR_SETTINGS;
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
/// A type that stores a container of 2d objects for each layer id
|
2017-03-13 03:19:33 +00:00
|
|
|
typedef std::map< PCB_LAYER_ID, CBVHCONTAINER2D *> MAP_CONTAINER_2D;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/// A type that stores polysets for each layer id
|
2017-03-13 03:19:33 +00:00
|
|
|
typedef std::map< PCB_LAYER_ID, SHAPE_POLY_SET *> MAP_POLY;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/// This defines the range that all coord will have to be rendered.
|
|
|
|
/// It will use this value to convert to a normalized value between
|
|
|
|
/// -(RANGE_SCALE_3D/2) .. +(RANGE_SCALE_3D/2)
|
|
|
|
#define RANGE_SCALE_3D 8.0f
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-03-26 14:05:20 +00:00
|
|
|
* Class BOARD_ADAPTER
|
2015-12-08 07:31:57 +00:00
|
|
|
* Helper class to handle information needed to display 3D board
|
|
|
|
*/
|
2020-03-26 14:05:20 +00:00
|
|
|
class BOARD_ADAPTER
|
2015-12-08 07:31:57 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2020-03-26 14:05:20 +00:00
|
|
|
BOARD_ADAPTER();
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-03-26 14:05:20 +00:00
|
|
|
~BOARD_ADAPTER();
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
|
|
|
* @brief Set3DCacheManager - Update the Cache manager pointer
|
|
|
|
* @param aCachePointer: the pointer to the 3d cache manager
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
void Set3DCacheManager( S3D_CACHE *aCachePointer ) noexcept
|
|
|
|
{
|
|
|
|
m_3d_model_manager = aCachePointer;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get3DCacheManager - Return the 3d cache manager pointer
|
|
|
|
* @return
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
S3D_CACHE *Get3DCacheManager( ) const noexcept
|
|
|
|
{
|
|
|
|
return m_3d_model_manager;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
/**
|
|
|
|
* @brief GetFlag - get a configuration status of a flag
|
|
|
|
* @param aFlag: the flag to get the status
|
|
|
|
* @return true if flag is set, false if not
|
|
|
|
*/
|
|
|
|
bool GetFlag( DISPLAY3D_FLG aFlag ) const ;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief SetFlag - set the status of a flag
|
|
|
|
* @param aFlag: the flag to get the status
|
|
|
|
* @param aState: status to set
|
|
|
|
*/
|
|
|
|
void SetFlag( DISPLAY3D_FLG aFlag, bool aState );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Is3DLayerEnabled - Check if a layer is enabled
|
|
|
|
* @param aLayer: layer ID to get status
|
|
|
|
* @return true if layer should be displayed, false if not
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
bool Is3DLayerEnabled( PCB_LAYER_ID aLayer ) const;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
|
|
|
* @brief ShouldModuleBeDisplayed - Test if module should be displayed in
|
|
|
|
* relation to attributs and the flags
|
|
|
|
* @return true if module should be displayed, false if not
|
|
|
|
*/
|
|
|
|
bool ShouldModuleBeDisplayed( MODULE_ATTR_T aModuleAttributs ) const;
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
/**
|
|
|
|
* @brief SetBoard - Set current board to be rendered
|
|
|
|
* @param aBoard: board to process
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
void SetBoard( BOARD *aBoard ) noexcept
|
|
|
|
{
|
|
|
|
m_board = aBoard;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetBoard - Get current board to be rendered
|
|
|
|
* @return BOARD pointer
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const BOARD *GetBoard() const noexcept
|
|
|
|
{
|
|
|
|
return m_board;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-04-16 16:11:21 +00:00
|
|
|
void SetColorSettings( COLOR_SETTINGS* aSettings ) noexcept
|
|
|
|
{
|
|
|
|
m_colors = aSettings;
|
|
|
|
}
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
/**
|
|
|
|
* @brief InitSettings - Function to be called by the render when it need to
|
|
|
|
* reload the settings for the board.
|
2020-06-03 23:00:40 +00:00
|
|
|
* @param aStatusReporter: the pointer for the status reporter
|
|
|
|
* @param aWarningReporter: pointer for the warning reporter
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
2020-06-03 23:00:40 +00:00
|
|
|
void InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningReporter );
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief BiuTo3Dunits - Board integer units To 3D units
|
2015-12-08 07:31:57 +00:00
|
|
|
* @return the conversion factor to transform a position from the board to 3d units
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
double BiuTo3Dunits() const noexcept
|
|
|
|
{
|
|
|
|
return m_biuTo3Dunits;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetBBox3DU - Get the bbox of the pcb board
|
2016-07-19 17:35:25 +00:00
|
|
|
* @return the board bbox in 3d units
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const CBBOX &GetBBox3DU() const noexcept
|
|
|
|
{
|
|
|
|
return m_boardBoundingBox;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetEpoxyThickness3DU - Get the current epoxy thickness
|
|
|
|
* @return thickness in 3d unities
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetEpoxyThickness3DU() const noexcept
|
|
|
|
{
|
|
|
|
return m_epoxyThickness3DU;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetNonCopperLayerThickness3DU - Get the current non copper layers thickness
|
|
|
|
* @return thickness in 3d unities of non copperlayers
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetNonCopperLayerThickness3DU() const noexcept
|
|
|
|
{
|
|
|
|
return m_nonCopperLayerThickness3DU;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetCopperThickness3DU - Get the current copper layer thickness
|
|
|
|
* @return thickness in 3d unities of copperlayers
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetCopperThickness3DU() const noexcept
|
|
|
|
{
|
|
|
|
return m_copperThickness3DU;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetCopperThicknessBIU - Get the current copper layer thickness
|
|
|
|
* @return thickness in board unities
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
int GetCopperThicknessBIU() const noexcept;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief GetBoardSizeBIU - Get the board size
|
|
|
|
* @return size in BIU unities
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
wxSize GetBoardSizeBIU() const noexcept
|
|
|
|
{
|
|
|
|
return m_boardSize;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief GetBoardPosBIU - Get the board size
|
|
|
|
* @return size in BIU unities
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
wxPoint GetBoardPosBIU() const noexcept
|
|
|
|
{
|
|
|
|
return m_boardPos;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief GetBoardCenter - the board center position in 3d units
|
|
|
|
* @return board center vector position in 3d units
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const SFVEC3F &GetBoardCenter3DU() const noexcept
|
|
|
|
{
|
|
|
|
return m_boardCenter;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetModulesZcoord3DIU - Get the position of the module in 3d integer units
|
|
|
|
* considering if it is flipped or not.
|
|
|
|
* @param aIsFlipped: true for use in modules on Front (top) layer, false
|
|
|
|
* if module is on back (bottom) layer
|
|
|
|
* @return the Z position of 3D shapes, in 3D integer units
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
|
|
|
float GetModulesZcoord3DIU( bool aIsFlipped ) const ;
|
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief GridGet - get the current grid
|
|
|
|
* @return space type of the grid
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
GRID3D_TYPE GridGet() const noexcept
|
|
|
|
{
|
|
|
|
return m_3D_grid_type;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GridSet - set the current grid
|
|
|
|
* @param aGridType = the type space of the grid
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
void GridSet( GRID3D_TYPE aGridType ) noexcept
|
|
|
|
{
|
|
|
|
m_3D_grid_type = aGridType;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-04-17 21:33:23 +00:00
|
|
|
/**
|
|
|
|
* @brief GridGet - get the current antialiasing mode value
|
|
|
|
* @return antialiasing mode value
|
|
|
|
*/
|
|
|
|
ANTIALIASING_MODE AntiAliasingGet() const { return m_antialiasing_mode; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief AntiAliasingSet - set the current antialiasing mode value
|
|
|
|
* @param aAAmode = antialiasing mode value
|
|
|
|
*/
|
|
|
|
void AntiAliasingSet( ANTIALIASING_MODE aAAmode ) { m_antialiasing_mode = aAAmode; }
|
2020-06-03 23:00:40 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
|
|
|
* @brief RenderEngineSet
|
|
|
|
* @param aRenderEngine = the render engine mode selected
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
void RenderEngineSet( RENDER_ENGINE aRenderEngine ) noexcept
|
|
|
|
{
|
|
|
|
m_render_engine = aRenderEngine;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief RenderEngineGet
|
|
|
|
* @return render engine on use
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
RENDER_ENGINE RenderEngineGet() const noexcept
|
|
|
|
{
|
|
|
|
return m_render_engine;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief MaterialModeSet
|
|
|
|
* @param aMaterialMode = the render material mode
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
void MaterialModeSet( MATERIAL_MODE aMaterialMode ) noexcept
|
|
|
|
{
|
|
|
|
m_material_mode = aMaterialMode;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief MaterialModeGet
|
|
|
|
* @return material rendering mode
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
MATERIAL_MODE MaterialModeGet() const noexcept
|
|
|
|
{
|
|
|
|
return m_material_mode;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetBoardPoly - Get the current polygon of the epoxy board
|
|
|
|
* @return the shape polygon
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const SHAPE_POLY_SET &GetBoardPoly() const noexcept
|
|
|
|
{
|
|
|
|
return m_board_poly;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetLayerColor - get the technical color of a layer
|
|
|
|
* @param aLayerId: the layer to get the color information
|
|
|
|
* @return the color in SFVEC3F format
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
SFVEC3F GetLayerColor( PCB_LAYER_ID aLayerId ) const;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetItemColor - get the technical color of a layer
|
|
|
|
* @param aItemId: the item id to get the color information
|
|
|
|
* @return the color in SFVEC3F format
|
|
|
|
*/
|
|
|
|
SFVEC3F GetItemColor( int aItemId ) const;
|
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
|
|
|
* @brief GetColor
|
|
|
|
* @param aColor: the color mapped
|
|
|
|
* @return the color in SFVEC3F format
|
|
|
|
*/
|
2017-02-20 16:57:41 +00:00
|
|
|
SFVEC3F GetColor( COLOR4D aColor ) const;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
/**
|
|
|
|
* @brief GetLayerTopZpos3DU - Get the top z position
|
|
|
|
* @param aLayerId: layer id
|
|
|
|
* @return position in 3D unities
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetLayerTopZpos3DU( PCB_LAYER_ID aLayerId ) const noexcept
|
2020-03-24 01:01:23 +00:00
|
|
|
{
|
|
|
|
return m_layerZcoordTop[aLayerId];
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetLayerBottomZpos3DU - Get the bottom z position
|
|
|
|
* @param aLayerId: layer id
|
|
|
|
* @return position in 3D unities
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetLayerBottomZpos3DU( PCB_LAYER_ID aLayerId ) const noexcept
|
2020-03-24 01:01:23 +00:00
|
|
|
{
|
|
|
|
return m_layerZcoordBottom[aLayerId];
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetMapLayers - Get the map of container that have the objects per layer
|
|
|
|
* @return the map containers of this board
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const MAP_CONTAINER_2D &GetMapLayers() const noexcept
|
|
|
|
{
|
|
|
|
return m_layers_container2D;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetMapLayersHoles -Get the map of container that have the holes per layer
|
|
|
|
* @return the map containers of holes from this board
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const MAP_CONTAINER_2D &GetMapLayersHoles() const noexcept
|
|
|
|
{
|
|
|
|
return m_layers_holes2D;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief GetThroughHole_Outer - Get the inflated ThroughHole container
|
2015-12-08 07:31:57 +00:00
|
|
|
* @return a container with holes
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const CBVHCONTAINER2D &GetThroughHole_Outer() const noexcept
|
|
|
|
{
|
|
|
|
return m_through_holes_outer;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetThroughHole_Outer_poly -
|
|
|
|
* @return
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const SHAPE_POLY_SET &GetThroughHole_Outer_poly() const noexcept
|
|
|
|
{
|
|
|
|
return m_through_outer_holes_poly;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetThroughHole_Outer_poly_NPTH -
|
|
|
|
* @return
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const SHAPE_POLY_SET &GetThroughHole_Outer_poly_NPTH() const noexcept
|
2020-03-24 01:01:23 +00:00
|
|
|
{
|
|
|
|
return m_through_outer_holes_poly_NPTH;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetThroughHole_Vias_Outer -
|
|
|
|
* @return a container with via THT holes only
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const CBVHCONTAINER2D &GetThroughHole_Vias_Outer() const noexcept
|
|
|
|
{
|
|
|
|
return m_through_holes_vias_outer;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetThroughHole_Vias_Inner -
|
|
|
|
* @return a container with via THT holes only
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const CBVHCONTAINER2D &GetThroughHole_Vias_Inner() const noexcept
|
|
|
|
{
|
|
|
|
return m_through_holes_vias_inner;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-19 17:35:25 +00:00
|
|
|
* @brief GetThroughHole_Vias_Outer_poly -
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const SHAPE_POLY_SET &GetThroughHole_Vias_Outer_poly() const noexcept
|
2020-03-24 01:01:23 +00:00
|
|
|
{
|
|
|
|
return m_through_outer_holes_vias_poly;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetThroughHole_Vias_Inner_poly -
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const SHAPE_POLY_SET &GetThroughHole_Vias_Inner_poly() const noexcept
|
2020-03-24 01:01:23 +00:00
|
|
|
{
|
|
|
|
return m_through_inner_holes_vias_poly;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetThroughHole_Inner - Get the ThroughHole container
|
2015-12-08 07:31:57 +00:00
|
|
|
* @return a container with holes
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const CBVHCONTAINER2D &GetThroughHole_Inner() const noexcept
|
|
|
|
{
|
|
|
|
return m_through_holes_inner;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
|
|
|
* @brief GetThroughHole_Inner_poly -
|
|
|
|
* @return
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const SHAPE_POLY_SET &GetThroughHole_Inner_poly() const noexcept
|
|
|
|
{
|
|
|
|
return m_through_inner_holes_poly;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetStats_Nr_Vias - Get statistics of the nr of vias
|
|
|
|
* @return number of vias
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
unsigned int GetStats_Nr_Vias() const noexcept
|
|
|
|
{
|
|
|
|
return m_stats_nr_vias;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetStats_Nr_Holes - Get statistics of the nr of holes
|
|
|
|
* @return number of holes
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
unsigned int GetStats_Nr_Holes() const noexcept
|
|
|
|
{
|
|
|
|
return m_stats_nr_holes;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
|
|
|
* @brief GetStats_Med_Via_Hole_Diameter3DU - Average diameter of the via holes
|
|
|
|
* @return dimension in 3D units
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetStats_Med_Via_Hole_Diameter3DU() const noexcept
|
|
|
|
{
|
|
|
|
return m_stats_via_med_hole_diameter;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetStats_Med_Hole_Diameter3DU - Average diameter of holes
|
|
|
|
* @return dimension in 3D units
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetStats_Med_Hole_Diameter3DU() const noexcept
|
|
|
|
{
|
|
|
|
return m_stats_hole_med_diameter;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetStats_Med_Track_Width - Average width of the tracks
|
|
|
|
* @return dimensions in 3D units
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
float GetStats_Med_Track_Width() const noexcept
|
|
|
|
{
|
|
|
|
return m_stats_track_med_width;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
|
|
|
* @brief GetNrSegmentsCircle
|
2017-06-25 09:26:04 +00:00
|
|
|
* @param aDiameter3DU: diameter in 3DU
|
2016-07-19 17:35:25 +00:00
|
|
|
* @return number of sides that should be used in that circle
|
|
|
|
*/
|
|
|
|
unsigned int GetNrSegmentsCircle( float aDiameter3DU ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetNrSegmentsCircle
|
2018-03-22 19:15:34 +00:00
|
|
|
* @param aDiameterBIU: diameter in board internal units
|
2016-07-19 17:35:25 +00:00
|
|
|
* @return number of sides that should be used in that circle
|
|
|
|
*/
|
2018-03-22 19:15:34 +00:00
|
|
|
unsigned int GetNrSegmentsCircle( int aDiameterBIU ) const;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetCircleCorrectionFactor - computes a angle correction
|
|
|
|
* factor used when creating circles
|
|
|
|
* @param aNrSides: the number of segments sides of the circle
|
|
|
|
* @return a factor to apply to contour creation
|
|
|
|
*/
|
|
|
|
double GetCircleCorrectionFactor( int aNrSides ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GetPolyMap - Get maps of polygons's layers
|
|
|
|
* @return the map with polygons's layers
|
|
|
|
*/
|
2020-04-16 16:11:21 +00:00
|
|
|
const MAP_POLY &GetPolyMap() const noexcept
|
|
|
|
{
|
|
|
|
return m_layers_poly;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-04-16 16:11:21 +00:00
|
|
|
const MAP_POLY &GetPolyMapHoles_Inner() const noexcept
|
|
|
|
{
|
|
|
|
return m_layers_inner_holes_poly;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-04-16 16:11:21 +00:00
|
|
|
const MAP_POLY &GetPolyMapHoles_Outer() const noexcept
|
|
|
|
{
|
|
|
|
return m_layers_outer_holes_poly;
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
private:
|
2020-02-03 22:09:14 +00:00
|
|
|
/**
|
|
|
|
* Create the board outline polygon.
|
|
|
|
*
|
|
|
|
* @return false if the outline could not be created
|
|
|
|
*/
|
|
|
|
bool createBoardPolygon();
|
2020-06-03 23:00:40 +00:00
|
|
|
void createLayers( REPORTER* aStatusReporter );
|
2015-12-08 07:31:57 +00:00
|
|
|
void destroyLayers();
|
|
|
|
|
|
|
|
// Helper functions to create the board
|
2020-04-09 08:37:17 +00:00
|
|
|
void createNewTrack( const TRACK* aTrack, CGENERICCONTAINER2D *aDstContainer,
|
|
|
|
int aClearanceValue );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
void createNewPadWithClearance( const D_PAD *aPad,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
2018-04-28 10:41:24 +00:00
|
|
|
wxSize aClearanceValue ) const;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
COBJECT2D *createNewPadDrill( const D_PAD* aPad, int aInflateValue );
|
|
|
|
|
|
|
|
void AddPadsShapesWithClearanceToContainer( const MODULE *aModule,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID aLayerId,
|
2016-07-19 17:35:25 +00:00
|
|
|
int aInflateValue,
|
|
|
|
bool aSkipNPTHPadsWihNoCopper );
|
|
|
|
|
|
|
|
void AddGraphicsShapesWithClearanceToContainer( const MODULE *aModule,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID aLayerId,
|
2016-07-19 17:35:25 +00:00
|
|
|
int aInflateValue );
|
|
|
|
|
|
|
|
void AddShapeWithClearanceToContainer( const TEXTE_PCB *aTextPCB,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID aLayerId,
|
2016-07-19 17:35:25 +00:00
|
|
|
int aClearanceValue );
|
|
|
|
|
|
|
|
void AddShapeWithClearanceToContainer( const DRAWSEGMENT *aDrawSegment,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID aLayerId,
|
2016-07-19 17:35:25 +00:00
|
|
|
int aClearanceValue );
|
|
|
|
|
2017-02-01 13:52:17 +00:00
|
|
|
void AddShapeWithClearanceToContainer( const DIMENSION *aDimension,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID aLayerId,
|
2017-02-01 13:52:17 +00:00
|
|
|
int aClearanceValue );
|
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
void AddSolidAreasShapesToContainer( const ZONE_CONTAINER *aZoneContainer,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID aLayerId );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
void TransformArcToSegments( const wxPoint &aCentre,
|
|
|
|
const wxPoint &aStart,
|
|
|
|
double aArcAngle,
|
|
|
|
int aCircleToSegmentsCount,
|
|
|
|
int aWidth,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
|
|
|
const BOARD_ITEM &aBoardItem );
|
|
|
|
|
|
|
|
void buildPadShapeThickOutlineAsSegments( const D_PAD *aPad,
|
|
|
|
CGENERICCONTAINER2D *aDstContainer,
|
|
|
|
int aWidth );
|
|
|
|
|
|
|
|
// Helper functions to create poly contours
|
|
|
|
void buildPadShapeThickOutlineAsPolygon( const D_PAD *aPad,
|
|
|
|
SHAPE_POLY_SET &aCornerBuffer,
|
|
|
|
int aWidth) const;
|
|
|
|
|
|
|
|
void transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule,
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID aLayer,
|
2016-07-19 17:35:25 +00:00
|
|
|
SHAPE_POLY_SET& aCornerBuffer ) const;
|
|
|
|
|
2019-05-17 13:16:15 +00:00
|
|
|
public:
|
2020-01-22 22:38:30 +00:00
|
|
|
SFVEC3D m_BgColorBot; ///< background bottom color
|
|
|
|
SFVEC3D m_BgColorTop; ///< background top color
|
|
|
|
SFVEC3D m_BoardBodyColor; ///< in realistic mode: FR4 board color
|
|
|
|
SFVEC3D m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
|
|
|
|
SFVEC3D m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
|
|
|
|
SFVEC3D m_SolderPasteColor; ///< in realistic mode: solder paste color
|
|
|
|
SFVEC3D m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
|
|
|
|
SFVEC3D m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
|
|
|
|
SFVEC3D m_CopperColor; ///< in realistic mode: copper color
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-05-17 13:16:15 +00:00
|
|
|
private:
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-03-26 14:05:20 +00:00
|
|
|
BOARD* m_board;
|
|
|
|
S3D_CACHE* m_3d_model_manager;
|
|
|
|
COLOR_SETTINGS* m_colors;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
// Render options
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
std::vector< bool > m_drawFlags;
|
|
|
|
GRID3D_TYPE m_3D_grid_type;
|
|
|
|
RENDER_ENGINE m_render_engine;
|
|
|
|
MATERIAL_MODE m_material_mode;
|
2020-04-17 21:33:23 +00:00
|
|
|
ANTIALIASING_MODE m_antialiasing_mode;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
// Pcb board position
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// center board actual position in board units
|
|
|
|
wxPoint m_boardPos;
|
|
|
|
|
|
|
|
/// board actual size in board units
|
|
|
|
wxSize m_boardSize;
|
|
|
|
|
|
|
|
/// 3d center position of the pcb board in 3d units
|
|
|
|
SFVEC3F m_boardCenter;
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
// Pcb board bounding boxes
|
|
|
|
|
2019-08-20 17:22:30 +00:00
|
|
|
/// 3d bounding box of the pcb board in 3d units
|
2020-03-26 14:05:20 +00:00
|
|
|
CBBOX m_boardBoundingBox;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// It contains polygon contours for each layer
|
|
|
|
MAP_POLY m_layers_poly;
|
|
|
|
|
|
|
|
/// It contains polygon contours for holes of each layer (outer holes)
|
|
|
|
MAP_POLY m_layers_outer_holes_poly;
|
|
|
|
|
|
|
|
/// It contains polygon contours for holes of each layer (inner holes)
|
|
|
|
MAP_POLY m_layers_inner_holes_poly;
|
|
|
|
|
|
|
|
/// It contains polygon contours for (just) non plated through holes (outer cylinder)
|
|
|
|
SHAPE_POLY_SET m_through_outer_holes_poly_NPTH;
|
|
|
|
|
|
|
|
/// It contains polygon contours for through holes (outer cylinder)
|
|
|
|
SHAPE_POLY_SET m_through_outer_holes_poly;
|
|
|
|
|
|
|
|
/// It contains polygon contours for through holes (inner cylinder)
|
|
|
|
SHAPE_POLY_SET m_through_inner_holes_poly;
|
|
|
|
|
|
|
|
/// It contains polygon contours for through holes vias (outer cylinder)
|
|
|
|
SHAPE_POLY_SET m_through_outer_holes_vias_poly;
|
|
|
|
|
|
|
|
/// It contains polygon contours for through holes vias (inner cylinder)
|
|
|
|
SHAPE_POLY_SET m_through_inner_holes_vias_poly;
|
|
|
|
|
|
|
|
/// PCB board outline polygon
|
|
|
|
SHAPE_POLY_SET m_board_poly;
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
// 2D element containers
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// It contains the 2d elements of each layer
|
|
|
|
MAP_CONTAINER_2D m_layers_container2D;
|
|
|
|
|
|
|
|
/// It contains the holes per each layer
|
|
|
|
MAP_CONTAINER_2D m_layers_holes2D;
|
|
|
|
|
|
|
|
/// It contains the list of throughHoles of the board,
|
|
|
|
/// the radius of the hole is inflated with the copper tickness
|
|
|
|
CBVHCONTAINER2D m_through_holes_outer;
|
|
|
|
|
|
|
|
/// It contains the list of throughHoles of the board,
|
|
|
|
/// the radius is the inner hole
|
|
|
|
CBVHCONTAINER2D m_through_holes_inner;
|
|
|
|
|
|
|
|
/// It contains the list of throughHoles vias of the board,
|
|
|
|
/// the radius of the hole is inflated with the copper tickness
|
|
|
|
CBVHCONTAINER2D m_through_holes_vias_outer;
|
|
|
|
|
|
|
|
/// It contains the list of throughHoles vias of the board,
|
|
|
|
/// the radius of the hole
|
|
|
|
CBVHCONTAINER2D m_through_holes_vias_inner;
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
// Layers information
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// Number of copper layers actually used by the board
|
|
|
|
unsigned int m_copperLayersCount;
|
|
|
|
|
|
|
|
/// Normalization scale to convert board internal units to 3D units to
|
|
|
|
/// normalize 3D units between -1.0 and +1.0
|
|
|
|
double m_biuTo3Dunits;
|
|
|
|
|
|
|
|
/// Top (End) Z position of each layer (normalized)
|
2020-03-25 13:13:03 +00:00
|
|
|
std::array<float, PCB_LAYER_ID_COUNT> m_layerZcoordTop;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// Bottom (Start) Z position of each layer (normalized)
|
2020-03-25 13:13:03 +00:00
|
|
|
std::array<float, PCB_LAYER_ID_COUNT> m_layerZcoordBottom;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// Copper thickness (normalized)
|
|
|
|
float m_copperThickness3DU;
|
|
|
|
|
|
|
|
/// Epoxy thickness (normalized)
|
|
|
|
float m_epoxyThickness3DU;
|
|
|
|
|
|
|
|
/// Non copper layers thickness
|
|
|
|
float m_nonCopperLayerThickness3DU;
|
|
|
|
|
|
|
|
/// min factor used for cicle segment approximation calculation
|
|
|
|
float m_calc_seg_min_factor3DU;
|
|
|
|
|
|
|
|
/// max factor used for cicle segment approximation calculation
|
|
|
|
float m_calc_seg_max_factor3DU;
|
|
|
|
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
// Statistics
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// Number of tracks in the board
|
2015-12-08 07:31:57 +00:00
|
|
|
unsigned int m_stats_nr_tracks;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// Track average width
|
2015-12-08 07:31:57 +00:00
|
|
|
float m_stats_track_med_width;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// Nr of vias
|
|
|
|
unsigned int m_stats_nr_vias;
|
|
|
|
|
|
|
|
/// Computed medium diameter of the via holes in 3D units
|
|
|
|
float m_stats_via_med_hole_diameter;
|
|
|
|
|
|
|
|
/// number of holes in the board
|
2015-12-08 07:31:57 +00:00
|
|
|
unsigned int m_stats_nr_holes;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/// Computed medium diameter of the holes in 3D units
|
|
|
|
float m_stats_hole_med_diameter;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Trace mask used to enable or disable the trace output of this class.
|
|
|
|
* The debug output can be turned on by setting the WXTRACE environment variable to
|
|
|
|
* "KI_TRACE_EDA_CINFO3D_VISU". See the wxWidgets documentation on wxLogTrace for
|
|
|
|
* more information.
|
|
|
|
*/
|
|
|
|
static const wxChar *m_logTrace;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-03-24 01:01:23 +00:00
|
|
|
|
2020-03-26 14:05:20 +00:00
|
|
|
class EDA_3D_BOARD_HOLDER
|
2020-03-24 01:01:23 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-03-26 14:05:20 +00:00
|
|
|
virtual BOARD_ADAPTER& GetAdapter() = 0;
|
|
|
|
virtual CCAMERA& GetCurrentCamera() = 0;
|
2020-04-19 00:51:49 +00:00
|
|
|
|
|
|
|
virtual ~EDA_3D_BOARD_HOLDER() {};
|
2020-03-24 01:01:23 +00:00
|
|
|
};
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-03-26 14:05:20 +00:00
|
|
|
#endif // BOARD_ADAPTER_H
|