PCB_TEXTBOX, create 3D shape: fix incorrect transform of the box, round 2:
when the box is a polygon (rotated rect by a non cardinal angle) the polygon is not filled, so the shape is just a set of thick segments. So we cannot use PCB_TEXTBOX::TransformShapeToPolygon to create the 3D view Fixes #16072 https://gitlab.com/kicad/code/kicad/-/issues/16072
This commit is contained in:
parent
0904231000
commit
abcbba5635
|
@ -50,6 +50,7 @@
|
||||||
#include <dialogs/dialog_color_picker.h>
|
#include <dialogs/dialog_color_picker.h>
|
||||||
|
|
||||||
class COLOR_SETTINGS;
|
class COLOR_SETTINGS;
|
||||||
|
class PCB_TEXTBOX;
|
||||||
|
|
||||||
/// A type that stores a container of 2d objects for each layer id
|
/// A type that stores a container of 2d objects for each layer id
|
||||||
typedef std::map<PCB_LAYER_ID, BVH_CONTAINER_2D*> MAP_CONTAINER_2D_BASE;
|
typedef std::map<PCB_LAYER_ID, BVH_CONTAINER_2D*> MAP_CONTAINER_2D_BASE;
|
||||||
|
@ -372,6 +373,9 @@ private:
|
||||||
void addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aDstContainer,
|
void addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aDstContainer,
|
||||||
const BOARD_ITEM* aOwner );
|
const BOARD_ITEM* aOwner );
|
||||||
|
|
||||||
|
void addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aContainer,
|
||||||
|
const BOARD_ITEM* aOwner );
|
||||||
|
|
||||||
void addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aDstContainer,
|
void addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aDstContainer,
|
||||||
PCB_LAYER_ID aLayerId );
|
PCB_LAYER_ID aLayerId );
|
||||||
|
|
||||||
|
|
|
@ -713,6 +713,32 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aContainer,
|
||||||
|
const BOARD_ITEM* aOwner )
|
||||||
|
{
|
||||||
|
addText( aTextBox, aContainer, aOwner );
|
||||||
|
|
||||||
|
if( !aTextBox->IsBorderEnabled() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// We cannot use PCB_TEXTBOX::TransformShapeToPolygon because it convert the textbox
|
||||||
|
// as filled polygon even if there's no background colour.
|
||||||
|
// So for polygon, we use PCB_SHAPE::TransformShapeToPolygon
|
||||||
|
|
||||||
|
if( aTextBox->GetShape() == SHAPE_T::RECTANGLE )
|
||||||
|
addShape( static_cast<const PCB_SHAPE*>( aTextBox ), aContainer, aOwner );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHAPE_POLY_SET polyList;
|
||||||
|
|
||||||
|
aTextBox->PCB_SHAPE::TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0,
|
||||||
|
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||||
|
|
||||||
|
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aContainer,
|
void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aContainer,
|
||||||
PCB_LAYER_ID aLayerId )
|
PCB_LAYER_ID aLayerId )
|
||||||
{
|
{
|
||||||
|
|
|
@ -619,9 +619,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXTBOX_T:
|
case PCB_TEXTBOX_T:
|
||||||
addText( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
|
||||||
|
|
||||||
if( static_cast<PCB_TEXTBOX*>( item )->IsBorderEnabled() )
|
|
||||||
addShape( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
addShape( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -836,11 +833,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXTBOX_T:
|
case PCB_TEXTBOX_T:
|
||||||
addText( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
|
||||||
|
|
||||||
if( static_cast<PCB_TEXTBOX*>( item )->IsBorderEnabled() )
|
|
||||||
addShape( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
addShape( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_DIM_ALIGNED_T:
|
case PCB_DIM_ALIGNED_T:
|
||||||
|
|
Loading…
Reference in New Issue