Dimensions for footprints.

Fixes https://gitlab.com/kicad/code/kicad/issues/8441
This commit is contained in:
Jeff Young 2021-12-04 23:52:00 +00:00
parent b84a85f648
commit fa908e1f98
42 changed files with 539 additions and 299 deletions

View File

@ -55,27 +55,36 @@
#include <wx/log.h> #include <wx/log.h>
#include <macros.h> #include <macros.h>
// These variables are parameters used in addTextSegmToContainer.
// But addTextSegmToContainer is a call-back function, struct CALLBACK_DATA
// so we cannot send them as arguments. {
static int s_textWidth; const BOARD_ITEM* m_BoardItem;
static CONTAINER_2D_BASE* s_dstcontainer = nullptr; CONTAINER_2D_BASE* m_Container;
static float s_biuTo3Dunits; int m_TextWidth;
static const BOARD_ITEM* s_boardItem = nullptr; float m_BiuTo3Dunits;
};
// This is a call back function, used by GRText to draw the 3D text shape: // This is a call back function, used by GRText to draw the 3D text shape:
void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData ) void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
{ {
const SFVEC2F start3DU( x0 * s_biuTo3Dunits, -y0 * s_biuTo3Dunits ); CALLBACK_DATA* data = static_cast<CALLBACK_DATA*>( aData );
const SFVEC2F end3DU ( xf * s_biuTo3Dunits, -yf * s_biuTo3Dunits );
const SFVEC2F start3DU( x0 * data->m_BiuTo3Dunits, -y0 * data->m_BiuTo3Dunits );
const SFVEC2F end3DU ( xf * data->m_BiuTo3Dunits, -yf * data->m_BiuTo3Dunits );
if( Is_segment_a_circle( start3DU, end3DU ) ) if( Is_segment_a_circle( start3DU, end3DU ) )
s_dstcontainer->Add( new FILLED_CIRCLE_2D( start3DU, ( s_textWidth / 2 ) * s_biuTo3Dunits, {
*s_boardItem) ); data->m_Container->Add( new FILLED_CIRCLE_2D( start3DU,
data->m_TextWidth * data->m_BiuTo3Dunits / 2,
*data->m_BoardItem ) );
}
else else
s_dstcontainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, s_textWidth * s_biuTo3Dunits, {
*s_boardItem ) ); data->m_Container->Add( new ROUND_SEGMENT_2D( start3DU, end3DU,
data->m_TextWidth * data->m_BiuTo3Dunits,
*data->m_BoardItem ) );
}
} }
@ -90,10 +99,11 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_TEXT* aText, CONTAINER_2D_B
if( aText->IsMirrored() ) if( aText->IsMirrored() )
size.x = -size.x; size.x = -size.x;
s_boardItem = (const BOARD_ITEM *) &aText; CALLBACK_DATA callbackData;
s_dstcontainer = aDstContainer; callbackData.m_BoardItem = aText;
s_textWidth = aText->GetEffectiveTextPenWidth() + ( 2 * aClearanceValue ); callbackData.m_Container = aDstContainer;
s_biuTo3Dunits = m_biuTo3Dunits; callbackData.m_TextWidth = aText->GetEffectiveTextPenWidth() + ( 2 * aClearanceValue );
callbackData.m_BiuTo3Dunits = m_biuTo3Dunits;
// not actually used, but needed by GRText // not actually used, but needed by GRText
const COLOR4D dummy_color; const COLOR4D dummy_color;
@ -105,7 +115,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_TEXT* aText, CONTAINER_2D_B
GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(), GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(),
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(), aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
penWidth, aText->IsItalic(), isBold, addTextSegmToContainer ); penWidth, aText->IsItalic(), isBold, addTextSegmToContainer, &callbackData );
} }
@ -165,7 +175,6 @@ void BOARD_ADAPTER::addFootprintShapesWithClearance( const FOOTPRINT* aFootprint
PCB_LAYER_ID aLayerId, int aInflateValue ) PCB_LAYER_ID aLayerId, int aInflateValue )
{ {
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
FP_SHAPE* outline;
for( BOARD_ITEM* item : aFootprint->GraphicalItems() ) for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{ {
@ -177,20 +186,33 @@ void BOARD_ADAPTER::addFootprintShapesWithClearance( const FOOTPRINT* aFootprint
if( text->GetLayer() == aLayerId && text->IsVisible() ) if( text->GetLayer() == aLayerId && text->IsVisible() )
texts.push_back( text ); texts.push_back( text );
}
break;
break;
}
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_LEADER_T:
{
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
if( dimension->GetLayer() == aLayerId )
addShapeWithClearance( dimension, aDstContainer, aLayerId, 0 );
break;
}
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
{ {
outline = (FP_SHAPE*) item; FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
if( outline->GetLayer() != aLayerId ) if( shape->GetLayer() == aLayerId )
break; addShapeWithClearance( (const PCB_SHAPE*) shape, aDstContainer, aLayerId, 0 );
addShapeWithClearance( (const PCB_SHAPE*) outline, aDstContainer, aLayerId, 0 ); break;
} }
break;
default: default:
break; break;
@ -204,13 +226,14 @@ void BOARD_ADAPTER::addFootprintShapesWithClearance( const FOOTPRINT* aFootprint
if( aFootprint->Value().GetLayer() == aLayerId && aFootprint->Value().IsVisible() ) if( aFootprint->Value().GetLayer() == aLayerId && aFootprint->Value().IsVisible() )
texts.push_back( &aFootprint->Value() ); texts.push_back( &aFootprint->Value() );
s_boardItem = (const BOARD_ITEM *)&aFootprint->Value();
s_dstcontainer = aDstContainer;
s_biuTo3Dunits = m_biuTo3Dunits;
for( FP_TEXT* text : texts ) for( FP_TEXT* text : texts )
{ {
s_textWidth = text->GetEffectiveTextPenWidth() + ( 2 * aInflateValue ); CALLBACK_DATA callbackData;
callbackData.m_BoardItem = &aFootprint->Value();
callbackData.m_Container = aDstContainer;
callbackData.m_BiuTo3Dunits = m_biuTo3Dunits;
callbackData.m_TextWidth = text->GetEffectiveTextPenWidth() + ( 2 * aInflateValue );
wxSize size = text->GetTextSize(); wxSize size = text->GetTextSize();
bool isBold = text->IsBold(); bool isBold = text->IsBold();
int penWidth = text->GetEffectiveTextPenWidth(); int penWidth = text->GetEffectiveTextPenWidth();
@ -220,7 +243,7 @@ void BOARD_ADAPTER::addFootprintShapesWithClearance( const FOOTPRINT* aFootprint
GRText( nullptr, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(), GRText( nullptr, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(), size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
isBold, addTextSegmToContainer ); isBold, addTextSegmToContainer, &callbackData );
} }
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -66,12 +66,22 @@ void BOARD_ADAPTER::transformFPShapesToPolygon( const FOOTPRINT* aFootprint, PCB
{ {
if( item->Type() == PCB_FP_SHAPE_T ) if( item->Type() == PCB_FP_SHAPE_T )
{ {
FP_SHAPE* outline = (FP_SHAPE*) item; FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
if( outline->GetLayer() == aLayer ) if( shape->GetLayer() == aLayer )
{ {
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0, shape->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
ARC_HIGH_DEF, ERROR_INSIDE ); ARC_HIGH_DEF, ERROR_INSIDE );
}
}
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
{
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
if( dimension->GetLayer() == aLayer )
{
dimension->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
} }
} }
} }

View File

@ -309,65 +309,70 @@ static struct EDA_ITEM_DESC
{ {
ENUM_MAP<KICAD_T>::Instance() ENUM_MAP<KICAD_T>::Instance()
.Undefined( TYPE_NOT_INIT ) .Undefined( TYPE_NOT_INIT )
.Map( NOT_USED, wxT( "<not used>" ) ) .Map( NOT_USED, wxT( "<not used>" ) )
.Map( SCREEN_T, _HKI( "Screen" ) ) .Map( SCREEN_T, _HKI( "Screen" ) )
.Map( PCB_FOOTPRINT_T, _HKI( "Footprint" ) ) .Map( PCB_FOOTPRINT_T, _HKI( "Footprint" ) )
.Map( PCB_PAD_T, _HKI( "Pad" ) ) .Map( PCB_PAD_T, _HKI( "Pad" ) )
.Map( PCB_SHAPE_T, _HKI( "Graphic" ) ) .Map( PCB_SHAPE_T, _HKI( "Graphic" ) )
.Map( PCB_TEXT_T, _HKI( "Text" ) ) .Map( PCB_TEXT_T, _HKI( "Text" ) )
.Map( PCB_FP_TEXT_T, _HKI( "Text" ) ) .Map( PCB_FP_TEXT_T, _HKI( "Text" ) )
.Map( PCB_FP_SHAPE_T, _HKI( "Graphic" ) ) .Map( PCB_FP_SHAPE_T, _HKI( "Graphic" ) )
.Map( PCB_FP_ZONE_T, _HKI( "Zone" ) ) .Map( PCB_FP_DIM_ALIGNED_T, _HKI( "Dimension" ) )
.Map( PCB_TRACE_T, _HKI( "Track" ) ) .Map( PCB_FP_DIM_ORTHOGONAL_T, _HKI( "Dimension" ) )
.Map( PCB_VIA_T, _HKI( "Via" ) ) .Map( PCB_FP_DIM_CENTER_T, _HKI( "Dimension" ) )
.Map( PCB_MARKER_T, _HKI( "Marker" ) ) .Map( PCB_FP_DIM_RADIAL_T, _HKI( "Dimension" ) )
.Map( PCB_DIM_ALIGNED_T, _HKI( "Dimension" ) ) .Map( PCB_FP_DIM_LEADER_T, _HKI( "Leader" ) )
.Map( PCB_DIM_ORTHOGONAL_T, _HKI( "Dimension" ) ) .Map( PCB_FP_ZONE_T, _HKI( "Zone" ) )
.Map( PCB_DIM_CENTER_T, _HKI( "Dimension" ) ) .Map( PCB_TRACE_T, _HKI( "Track" ) )
.Map( PCB_DIM_RADIAL_T, _HKI( "Dimension" ) ) .Map( PCB_VIA_T, _HKI( "Via" ) )
.Map( PCB_DIM_LEADER_T, _HKI( "Leader" ) ) .Map( PCB_MARKER_T, _HKI( "Marker" ) )
.Map( PCB_TARGET_T, _HKI( "Target" ) ) .Map( PCB_DIM_ALIGNED_T, _HKI( "Dimension" ) )
.Map( PCB_ZONE_T, _HKI( "Zone" ) ) .Map( PCB_DIM_ORTHOGONAL_T, _HKI( "Dimension" ) )
.Map( PCB_ITEM_LIST_T, _HKI( "ItemList" ) ) .Map( PCB_DIM_CENTER_T, _HKI( "Dimension" ) )
.Map( PCB_NETINFO_T, _HKI( "NetInfo" ) ) .Map( PCB_DIM_RADIAL_T, _HKI( "Dimension" ) )
.Map( PCB_GROUP_T, _HKI( "Group" ) ) .Map( PCB_DIM_LEADER_T, _HKI( "Leader" ) )
.Map( PCB_TARGET_T, _HKI( "Target" ) )
.Map( PCB_ZONE_T, _HKI( "Zone" ) )
.Map( PCB_ITEM_LIST_T, _HKI( "ItemList" ) )
.Map( PCB_NETINFO_T, _HKI( "NetInfo" ) )
.Map( PCB_GROUP_T, _HKI( "Group" ) )
.Map( SCH_MARKER_T, _HKI( "Marker" ) ) .Map( SCH_MARKER_T, _HKI( "Marker" ) )
.Map( SCH_JUNCTION_T, _HKI( "Junction" ) ) .Map( SCH_JUNCTION_T, _HKI( "Junction" ) )
.Map( SCH_NO_CONNECT_T, _HKI( "No-Connect Flag" ) ) .Map( SCH_NO_CONNECT_T, _HKI( "No-Connect Flag" ) )
.Map( SCH_BUS_WIRE_ENTRY_T, _HKI( "Wire Entry" ) ) .Map( SCH_BUS_WIRE_ENTRY_T, _HKI( "Wire Entry" ) )
.Map( SCH_BUS_BUS_ENTRY_T, _HKI( "Bus Entry" ) ) .Map( SCH_BUS_BUS_ENTRY_T, _HKI( "Bus Entry" ) )
.Map( SCH_LINE_T, _HKI( "Line" ) ) .Map( SCH_LINE_T, _HKI( "Line" ) )
.Map( SCH_BITMAP_T, _HKI( "Bitmap" ) ) .Map( SCH_BITMAP_T, _HKI( "Bitmap" ) )
.Map( SCH_TEXT_T, _HKI( "Text" ) ) .Map( SCH_TEXT_T, _HKI( "Text" ) )
.Map( SCH_LABEL_T, _HKI( "Net Label" ) ) .Map( SCH_LABEL_T, _HKI( "Net Label" ) )
.Map( SCH_NETCLASS_FLAG_T, _HKI( "Net Class Flag" ) ) .Map( SCH_NETCLASS_FLAG_T, _HKI( "Net Class Flag" ) )
.Map( SCH_GLOBAL_LABEL_T, _HKI( "Global Label" ) ) .Map( SCH_GLOBAL_LABEL_T, _HKI( "Global Label" ) )
.Map( SCH_HIER_LABEL_T, _HKI( "Hierarchical Label" ) ) .Map( SCH_HIER_LABEL_T, _HKI( "Hierarchical Label" ) )
.Map( SCH_FIELD_T, _HKI( "Field" ) ) .Map( SCH_FIELD_T, _HKI( "Field" ) )
.Map( SCH_SYMBOL_T, _HKI( "Symbol" ) ) .Map( SCH_SYMBOL_T, _HKI( "Symbol" ) )
.Map( SCH_PIN_T, _HKI( "Pin" ) ) .Map( SCH_PIN_T, _HKI( "Pin" ) )
.Map( SCH_SHEET_PIN_T, _HKI( "Sheet Pin" ) ) .Map( SCH_SHEET_PIN_T, _HKI( "Sheet Pin" ) )
.Map( SCH_SHEET_T, _HKI( "Sheet" ) ) .Map( SCH_SHEET_T, _HKI( "Sheet" ) )
// Synthetic search tokens don't need to be included... // Synthetic search tokens don't need to be included...
//.Map( SCH_FIELD_LOCATE_REFERENCE_T, _HKI( "Field Locate Reference" ) ) //.Map( SCH_FIELD_LOCATE_REFERENCE_T, _HKI( "Field Locate Reference" ) )
//.Map( SCH_FIELD_LOCATE_VALUE_T, _HKI( "Field Locate Value" ) ) //.Map( SCH_FIELD_LOCATE_VALUE_T, _HKI( "Field Locate Value" ) )
//.Map( SCH_FIELD_LOCATE_FOOTPRINT_T, _HKI( "Field Locate Footprint" ) ) //.Map( SCH_FIELD_LOCATE_FOOTPRINT_T, _HKI( "Field Locate Footprint" ) )
.Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) ) .Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) )
.Map( LIB_SYMBOL_T, _HKI( "Symbol" ) ) .Map( LIB_SYMBOL_T, _HKI( "Symbol" ) )
.Map( LIB_ALIAS_T, _HKI( "Alias" ) ) .Map( LIB_ALIAS_T, _HKI( "Alias" ) )
.Map( LIB_SHAPE_T, _HKI( "Graphic" ) ) .Map( LIB_SHAPE_T, _HKI( "Graphic" ) )
.Map( LIB_TEXT_T, _HKI( "Text" ) ) .Map( LIB_TEXT_T, _HKI( "Text" ) )
.Map( LIB_PIN_T, _HKI( "Pin" ) ) .Map( LIB_PIN_T, _HKI( "Pin" ) )
.Map( LIB_FIELD_T, _HKI( "Symbol Field" ) ) .Map( LIB_FIELD_T, _HKI( "Symbol Field" ) )
.Map( GERBER_LAYOUT_T, _HKI( "Gerber Layout" ) ) .Map( GERBER_LAYOUT_T, _HKI( "Gerber Layout" ) )
.Map( GERBER_DRAW_ITEM_T, _HKI( "Draw Item" ) ) .Map( GERBER_DRAW_ITEM_T, _HKI( "Draw Item" ) )
.Map( GERBER_IMAGE_T, _HKI( "Image" ) ); .Map( GERBER_IMAGE_T, _HKI( "Image" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDA_ITEM ); REGISTER_TYPE( EDA_ITEM );

View File

@ -85,28 +85,33 @@ enum KICAD_T
SCREEN_T, ///< not really an item, used to identify a screen SCREEN_T, ///< not really an item, used to identify a screen
// Items in pcb // Items in pcb
PCB_FOOTPRINT_T, ///< class FOOTPRINT, a footprint PCB_FOOTPRINT_T, ///< class FOOTPRINT, a footprint
PCB_PAD_T, ///< class PAD, a pad in a footprint PCB_PAD_T, ///< class PAD, a pad in a footprint
PCB_SHAPE_T, ///< class PCB_SHAPE, a segment not on copper layers PCB_SHAPE_T, ///< class PCB_SHAPE, a segment not on copper layers
PCB_TEXT_T, ///< class PCB_TEXT, text on a layer PCB_TEXT_T, ///< class PCB_TEXT, text on a layer
PCB_FP_TEXT_T, ///< class FP_TEXT, text in a footprint PCB_FP_TEXT_T, ///< class FP_TEXT, text in a footprint
PCB_FP_SHAPE_T, ///< class FP_SHAPE, a footprint edge PCB_FP_SHAPE_T, ///< class FP_SHAPE, a footprint edge
PCB_FP_ZONE_T, ///< class ZONE, managed by a footprint PCB_FP_DIM_ALIGNED_T, ///< class PCB_DIM_ALIGNED, a linear dimension (graphic item)
PCB_TRACE_T, ///< class PCB_TRACK, a track segment (segment on a copper layer) PCB_FP_DIM_LEADER_T, ///< class PCB_DIM_LEADER, a leader dimension (graphic item)
PCB_VIA_T, ///< class PCB_VIA, a via (like a track segment on a copper layer) PCB_FP_DIM_CENTER_T, ///< class PCB_DIM_CENTER, a center point marking (graphic item)
PCB_ARC_T, ///< class PCB_ARC, an arc track segment on a copper layer PCB_FP_DIM_RADIAL_T, ///< class PCB_DIM_RADIAL, a radius or diameter dimension
PCB_MARKER_T, ///< class PCB_MARKER, a marker used to show something PCB_FP_DIM_ORTHOGONAL_T, ///< class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
PCB_DIMENSION_T, ///< class PCB_DIMENSION_BASE: abstract dimension meta-type PCB_FP_ZONE_T, ///< class ZONE, managed by a footprint
PCB_DIM_ALIGNED_T, ///< class PCB_DIM_ALIGNED, a linear dimension (graphic item) PCB_TRACE_T, ///< class PCB_TRACK, a track segment (segment on a copper layer)
PCB_DIM_LEADER_T, ///< class PCB_DIM_LEADER, a leader dimension (graphic item) PCB_VIA_T, ///< class PCB_VIA, a via (like a track segment on a copper layer)
PCB_DIM_CENTER_T, ///< class PCB_DIM_CENTER, a center point marking (graphic item) PCB_ARC_T, ///< class PCB_ARC, an arc track segment on a copper layer
PCB_DIM_RADIAL_T, ///< class PCB_DIM_RADIAL, a radius or diameter dimension PCB_MARKER_T, ///< class PCB_MARKER, a marker used to show something
PCB_DIM_ORTHOGONAL_T, ///< class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y PCB_DIMENSION_T, ///< class PCB_DIMENSION_BASE: abstract dimension meta-type
PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item) PCB_DIM_ALIGNED_T, ///< class PCB_DIM_ALIGNED, a linear dimension (graphic item)
PCB_ZONE_T, ///< class ZONE, a copper pour area PCB_DIM_LEADER_T, ///< class PCB_DIM_LEADER, a leader dimension (graphic item)
PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items PCB_DIM_CENTER_T, ///< class PCB_DIM_CENTER, a center point marking (graphic item)
PCB_NETINFO_T, ///< class NETINFO_ITEM, a description of a net PCB_DIM_RADIAL_T, ///< class PCB_DIM_RADIAL, a radius or diameter dimension
PCB_GROUP_T, ///< class PCB_GROUP, a set of BOARD_ITEMs PCB_DIM_ORTHOGONAL_T, ///< class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item)
PCB_ZONE_T, ///< class ZONE, a copper pour area
PCB_ITEM_LIST_T , ///< class BOARD_ITEM_LIST, a list of board items
PCB_NETINFO_T, ///< class NETINFO_ITEM, a description of a net
PCB_GROUP_T, ///< class PCB_GROUP, a set of BOARD_ITEMs
PCB_LOCATE_STDVIA_T, PCB_LOCATE_STDVIA_T,
PCB_LOCATE_UVIA_T, PCB_LOCATE_UVIA_T,
@ -264,6 +269,11 @@ constexpr KICAD_T BaseType( const KICAD_T aType )
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
return PCB_DIMENSION_T; return PCB_DIMENSION_T;
default: default:
@ -389,6 +399,10 @@ constexpr bool IsPcbnewType( const KICAD_T aType )
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:

View File

@ -309,10 +309,6 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
PCB_VIA_T, PCB_VIA_T,
PCB_TRACE_T, PCB_TRACE_T,
PCB_ARC_T, PCB_ARC_T,
// PCB_PAD_T, Can't be at board level
// PCB_FP_TEXT_T, Can't be at board level
// PCB_FP_SHAPE_T, Can't be at board level
// PCB_FP_ZONE_T, Can't be at board level
PCB_FOOTPRINT_T, PCB_FOOTPRINT_T,
PCB_ZONE_T, PCB_ZONE_T,
EOT EOT
@ -1230,6 +1226,11 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_PAD_T: case PCB_PAD_T:
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
// this calls FOOTPRINT::Visit() on each footprint. // this calls FOOTPRINT::Visit() on each footprint.
@ -1244,6 +1245,11 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_PAD_T: case PCB_PAD_T:
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
continue; continue;

View File

@ -175,6 +175,11 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
else if( boardItem->Type() == PCB_PAD_T || else if( boardItem->Type() == PCB_PAD_T ||
boardItem->Type() == PCB_FP_TEXT_T || boardItem->Type() == PCB_FP_TEXT_T ||
boardItem->Type() == PCB_FP_SHAPE_T || boardItem->Type() == PCB_FP_SHAPE_T ||
boardItem->Type() == PCB_FP_DIM_ALIGNED_T ||
boardItem->Type() == PCB_FP_DIM_LEADER_T ||
boardItem->Type() == PCB_FP_DIM_CENTER_T ||
boardItem->Type() == PCB_FP_DIM_RADIAL_T ||
boardItem->Type() == PCB_FP_DIM_ORTHOGONAL_T ||
boardItem->Type() == PCB_FP_ZONE_T ) boardItem->Type() == PCB_FP_ZONE_T )
{ {
wxASSERT( boardItem->GetParent() && wxASSERT( boardItem->GetParent() &&
@ -217,6 +222,11 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
case PCB_PAD_T: case PCB_PAD_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
// This level can only handle footprint children in the footprint editor as // This level can only handle footprint children in the footprint editor as
// only in that case has the entire footprint (and all its children) already // only in that case has the entire footprint (and all its children) already
@ -447,6 +457,11 @@ EDA_ITEM* BOARD_COMMIT::parentObject( EDA_ITEM* aItem ) const
case PCB_PAD_T: case PCB_PAD_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
return aItem->GetParent(); return aItem->GetParent();

View File

@ -106,6 +106,11 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = {
const KICAD_T GENERAL_COLLECTOR::FootprintItems[] = { const KICAD_T GENERAL_COLLECTOR::FootprintItems[] = {
PCB_FP_TEXT_T, PCB_FP_TEXT_T,
PCB_FP_SHAPE_T, PCB_FP_SHAPE_T,
PCB_FP_DIM_ALIGNED_T,
PCB_FP_DIM_ORTHOGONAL_T,
PCB_FP_DIM_CENTER_T,
PCB_FP_DIM_RADIAL_T,
PCB_FP_DIM_LEADER_T,
PCB_PAD_T, PCB_PAD_T,
PCB_FP_ZONE_T, PCB_FP_ZONE_T,
PCB_GROUP_T, PCB_GROUP_T,
@ -144,6 +149,11 @@ const KICAD_T GENERAL_COLLECTOR::Dimensions[] = {
PCB_DIM_ORTHOGONAL_T, PCB_DIM_ORTHOGONAL_T,
PCB_DIM_CENTER_T, PCB_DIM_CENTER_T,
PCB_DIM_RADIAL_T, PCB_DIM_RADIAL_T,
PCB_FP_DIM_ALIGNED_T,
PCB_FP_DIM_LEADER_T,
PCB_FP_DIM_ORTHOGONAL_T,
PCB_FP_DIM_CENTER_T,
PCB_FP_DIM_RADIAL_T,
EOT EOT
}; };
@ -287,6 +297,16 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
shape = static_cast<PCB_SHAPE*>( item ); shape = static_cast<PCB_SHAPE*>( item );
break; break;
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
footprint = static_cast<FOOTPRINT*>( item->GetParent() );
// Fallthrough to get the zone as well
KI_FALLTHROUGH;
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:

View File

@ -54,6 +54,7 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
switch( m_dimension->Type() ) switch( m_dimension->Type() )
{ {
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_LEADER_T:
// Hide the main format controls and keep the leader controls shown // Hide the main format controls and keep the leader controls shown
m_sizerFormat->GetStaticBox()->Hide(); m_sizerFormat->GetStaticBox()->Hide();
m_sizerCenter->GetStaticBox()->Hide(); m_sizerCenter->GetStaticBox()->Hide();
@ -66,7 +67,8 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_cbTextPositionMode->Hide(); m_cbTextPositionMode->Hide();
break; break;
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_FP_DIM_CENTER_T:
m_sizerLeader->GetStaticBox()->Hide(); m_sizerLeader->GetStaticBox()->Hide();
m_sizerFormat->GetStaticBox()->Hide(); m_sizerFormat->GetStaticBox()->Hide();
m_sizerText->GetStaticBox()->Hide(); m_sizerText->GetStaticBox()->Hide();

View File

@ -473,7 +473,9 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
// Go through all other footprint items // Go through all other footprint items
for( BOARD_ITEM* boardItem : fp->GraphicalItems() ) for( BOARD_ITEM* boardItem : fp->GraphicalItems() )
{ {
if( boardItem->Type() == PCB_FP_TEXT_T ) KICAD_T itemType = boardItem->Type();
if( itemType == PCB_FP_TEXT_T )
{ {
// We are guaranteed to always get an EDA_TEXT in this statement, but we must // We are guaranteed to always get an EDA_TEXT in this statement, but we must
// use the dynamic_cast to move through the type tree anyway. // use the dynamic_cast to move through the type tree anyway.
@ -486,7 +488,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
else if( m_otherFields->GetValue() ) else if( m_otherFields->GetValue() )
visitItem( commit, boardItem ); visitItem( commit, boardItem );
} }
else if( boardItem->Type() == PCB_FP_SHAPE_T ) else if( itemType == PCB_FP_SHAPE_T || BaseType( itemType ) == PCB_DIMENSION_T )
{ {
if( m_footprintGraphics->GetValue() ) if( m_footprintGraphics->GetValue() )
visitItem( commit, boardItem ); visitItem( commit, boardItem );

View File

@ -194,7 +194,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
{ {
if( (item->GetLayerSet() & aLayers).any() ) if( (item->GetLayerSet() & aLayers).any() )
{ {
if( typeMask[PCB_DIMENSION_T] && BaseType( item->Type() ) == PCB_DIMENSION_T ) if( typeMask[ PCB_DIMENSION_T ] && BaseType( item->Type() ) == PCB_DIMENSION_T )
{ {
if( !aFunc( item ) ) if( !aFunc( item ) )
return n; return n;
@ -280,7 +280,14 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
{ {
if( (dwg->GetLayerSet() & aLayers).any() ) if( (dwg->GetLayerSet() & aLayers).any() )
{ {
if( typeMask[ PCB_FP_TEXT_T ] && dwg->Type() == PCB_FP_TEXT_T ) if( typeMask[ PCB_DIMENSION_T ] && BaseType( dwg->Type() ) == PCB_DIMENSION_T )
{
if( !aFunc( dwg ) )
return n;
n++;
}
else if( typeMask[ PCB_FP_TEXT_T ] && dwg->Type() == PCB_FP_TEXT_T )
{ {
if( !aFunc( dwg ) ) if( !aFunc( dwg ) )
return n; return n;

View File

@ -192,8 +192,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run()
static const std::vector<KICAD_T> itemTypes = { static const std::vector<KICAD_T> itemTypes = {
PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, PCB_SHAPE_T, PCB_FP_SHAPE_T, PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, PCB_SHAPE_T, PCB_FP_SHAPE_T,
PCB_TEXT_T, PCB_FP_TEXT_T, PCB_DIMENSION_T, PCB_DIM_ALIGNED_T, PCB_DIM_LEADER_T, PCB_TEXT_T, PCB_FP_TEXT_T, PCB_DIMENSION_T
PCB_DIM_CENTER_T, PCB_DIM_RADIAL_T, PCB_DIM_ORTHOGONAL_T
}; };
forEachGeometryItem( itemTypes, LSET::AllCuMask(), countItems ); forEachGeometryItem( itemTypes, LSET::AllCuMask(), countItems );

View File

@ -99,24 +99,12 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run()
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_TEXT_ON_EDGECUTS ) if( !m_drcEngine->IsErrorLimitExceeded( DRCE_TEXT_ON_EDGECUTS )
&& item->GetLayer() == Edge_Cuts ) && item->GetLayer() == Edge_Cuts )
{ {
switch( item->Type() ) if( item->Type() == PCB_TEXT_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
{
case PCB_TEXT_T:
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
{ {
std::shared_ptr<DRC_ITEM> drc = DRC_ITEM::Create( DRCE_TEXT_ON_EDGECUTS ); std::shared_ptr<DRC_ITEM> drc = DRC_ITEM::Create( DRCE_TEXT_ON_EDGECUTS );
drc->SetItems( item ); drc->SetItems( item );
reportViolation( drc, item->GetPosition() ); reportViolation( drc, item->GetPosition() );
} }
break;
default:
break;
}
} }
if( m_drcEngine->IsErrorLimitExceeded( DRCE_ALLOWED_ITEMS ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_ALLOWED_ITEMS ) )

View File

@ -178,8 +178,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
static const std::vector<KICAD_T> itemTypes = { static const std::vector<KICAD_T> itemTypes = {
PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, PCB_SHAPE_T, PCB_FP_SHAPE_T, PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, PCB_SHAPE_T, PCB_FP_SHAPE_T,
PCB_TEXT_T, PCB_FP_TEXT_T, PCB_DIMENSION_T, PCB_DIM_ALIGNED_T, PCB_DIM_LEADER_T, PCB_TEXT_T, PCB_FP_TEXT_T, PCB_DIMENSION_T
PCB_DIM_CENTER_T, PCB_DIM_RADIAL_T, PCB_DIM_ORTHOGONAL_T
}; };
forEachGeometryItem( itemTypes, LSET::AllLayersMask(), countItems ); forEachGeometryItem( itemTypes, LSET::AllLayersMask(), countItems );

View File

@ -140,8 +140,11 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
ShowDimensionPropertiesDialog( static_cast<PCB_DIMENSION_BASE*>( aItem ) ); {
DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
dlg.ShowQuasiModal();
break; break;
}
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
ShowTextPropertiesDialog( aItem ); ShowTextPropertiesDialog( aItem );
@ -168,13 +171,3 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
} }
} }
void PCB_EDIT_FRAME::ShowDimensionPropertiesDialog( PCB_DIMENSION_BASE* aDimension )
{
if( aDimension == nullptr )
return;
DIALOG_DIMENSION_PROPERTIES dlg( this, aDimension );
dlg.ShowQuasiModal();
}

View File

@ -197,16 +197,16 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts ); BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );
itemplotter.SetLayerSet( Edge_Cuts ); itemplotter.SetLayerSet( Edge_Cuts );
for( auto PtStruct : m_pcb->Drawings() ) for( BOARD_ITEM* item : m_pcb->Drawings() )
{ {
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case PCB_SHAPE_T: case PCB_SHAPE_T:
itemplotter.PlotPcbShape( (PCB_SHAPE*) PtStruct ); itemplotter.PlotPcbShape( (PCB_SHAPE*) item );
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
itemplotter.PlotPcbText( (PCB_TEXT*) PtStruct ); itemplotter.PlotPcbText( (PCB_TEXT*) item );
break; break;
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:

View File

@ -36,10 +36,10 @@
#include <fp_shape.h> #include <fp_shape.h>
#include <macros.h> #include <macros.h>
#include <pad.h> #include <pad.h>
#include <pcb_text.h>
#include <pcb_marker.h> #include <pcb_marker.h>
#include <pcb_group.h> #include <pcb_group.h>
#include <pcb_track.h> #include <pcb_track.h>
#include <pcb_dimension.h>
#include <footprint.h> #include <footprint.h>
#include <zone.h> #include <zone.h>
#include <view/view.h> #include <view/view.h>
@ -511,6 +511,11 @@ void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
wxASSERT( static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS ); wxASSERT( static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS );
KI_FALLTHROUGH; KI_FALLTHROUGH;
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
if( aMode == ADD_MODE::APPEND ) if( aMode == ADD_MODE::APPEND )
m_drawings.push_back( aBoardItem ); m_drawings.push_back( aBoardItem );
@ -566,6 +571,11 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode )
"Please report this bug: Invalid remove operation on required text" ); "Please report this bug: Invalid remove operation on required text" );
KI_FALLTHROUGH; KI_FALLTHROUGH;
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
for( auto it = m_drawings.begin(); it != m_drawings.end(); ++it ) for( auto it = m_drawings.begin(); it != m_drawings.end(); ++it )
{ {
@ -762,7 +772,7 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
for( BOARD_ITEM* item : m_drawings ) for( BOARD_ITEM* item : m_drawings )
{ {
if( item->Type() == PCB_FP_SHAPE_T ) if( item->Type() == PCB_FP_SHAPE_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
area.Merge( item->GetBoundingBox() ); area.Merge( item->GetBoundingBox() );
} }
@ -805,12 +815,18 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
if( ( m_value->IsVisible() && valueLayerIsVisible ) if( ( m_value->IsVisible() && valueLayerIsVisible )
|| aIncludeInvisibleText || noDrawItems ) || aIncludeInvisibleText
|| noDrawItems )
{
area.Merge( m_value->GetBoundingBox() ); area.Merge( m_value->GetBoundingBox() );
}
if( ( m_reference->IsVisible() && refLayerIsVisible ) if( ( m_reference->IsVisible() && refLayerIsVisible )
|| aIncludeInvisibleText || noDrawItems ) || aIncludeInvisibleText
|| noDrawItems )
{
area.Merge( m_reference->GetBoundingBox() ); area.Merge( m_reference->GetBoundingBox() );
}
} }
if( board ) if( board )
@ -851,7 +867,7 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
for( BOARD_ITEM* item : m_drawings ) for( BOARD_ITEM* item : m_drawings )
{ {
if( item->Type() == PCB_FP_SHAPE_T ) if( item->Type() == PCB_FP_SHAPE_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
{ {
item->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF, item->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
ERROR_OUTSIDE ); ERROR_OUTSIDE );
@ -1225,6 +1241,11 @@ SEARCH_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData, const KICAD
// Intentionally fall through since m_Drawings can hold PCB_FP_SHAPE_T also // Intentionally fall through since m_Drawings can hold PCB_FP_SHAPE_T also
KI_FALLTHROUGH; KI_FALLTHROUGH;
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
result = IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, p ); result = IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, p );
@ -1235,6 +1256,11 @@ SEARCH_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData, const KICAD
{ {
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
continue; continue;
default: default:
@ -1583,6 +1609,14 @@ void FOOTPRINT::SetPosition( const wxPoint& aPos )
break; break;
} }
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_LEADER_T:
item->Move( delta );
break;
default: default:
wxMessageBox( wxT( "Draw type undefined." ) ); wxMessageBox( wxT( "Draw type undefined." ) );
break; break;
@ -1794,6 +1828,21 @@ BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootpr
break; break;
} }
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
{
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( aItem->Duplicate() );
if( aAddToFootprint )
Add( dimension );
new_item = dimension;
break;
}
case PCB_GROUP_T: case PCB_GROUP_T:
new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate(); new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate();
break; break;

View File

@ -1149,6 +1149,11 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
CURRENT_EDIT_TOOL( PCB_ACTIONS::drawPolygon ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawPolygon );
CURRENT_EDIT_TOOL( PCB_ACTIONS::drawRuleArea ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawRuleArea );
CURRENT_EDIT_TOOL( PCB_ACTIONS::placeText ); CURRENT_EDIT_TOOL( PCB_ACTIONS::placeText );
CURRENT_EDIT_TOOL( PCB_ACTIONS::drawAlignedDimension );
CURRENT_EDIT_TOOL( PCB_ACTIONS::drawOrthogonalDimension );
CURRENT_EDIT_TOOL( PCB_ACTIONS::drawCenterDimension );
CURRENT_EDIT_TOOL( PCB_ACTIONS::drawRadialDimension );
CURRENT_EDIT_TOOL( PCB_ACTIONS::drawLeader );
CURRENT_EDIT_TOOL( PCB_ACTIONS::setAnchor ); CURRENT_EDIT_TOOL( PCB_ACTIONS::setAnchor );
CURRENT_EDIT_TOOL( PCB_ACTIONS::gridSetOrigin ); CURRENT_EDIT_TOOL( PCB_ACTIONS::gridSetOrigin );

View File

@ -37,6 +37,8 @@
#include <widgets/appearance_controls.h> #include <widgets/appearance_controls.h>
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
#include <pcb_layer_box_selector.h> #include <pcb_layer_box_selector.h>
#include <pcb_dimension.h>
#include <dialogs/dialog_dimension_properties.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -192,6 +194,17 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
ShowGraphicItemPropertiesDialog( aItem ); ShowGraphicItemPropertiesDialog( aItem );
break; break;
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
{
DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
dlg.ShowQuasiModal();
break;
}
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
{ {
ZONE* zone = static_cast<ZONE*>( aItem ); ZONE* zone = static_cast<ZONE*>( aItem );

View File

@ -177,15 +177,22 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool ); ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
placeMenu->Add( PCB_ACTIONS::placePad ); placeMenu->Add( PCB_ACTIONS::placePad );
placeMenu->Add( PCB_ACTIONS::drawRuleArea );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::placeText );
placeMenu->Add( PCB_ACTIONS::drawLine ); placeMenu->Add( PCB_ACTIONS::drawLine );
placeMenu->Add( PCB_ACTIONS::drawArc ); placeMenu->Add( PCB_ACTIONS::drawArc );
placeMenu->Add( PCB_ACTIONS::drawRectangle ); placeMenu->Add( PCB_ACTIONS::drawRectangle );
placeMenu->Add( PCB_ACTIONS::drawCircle ); placeMenu->Add( PCB_ACTIONS::drawCircle );
placeMenu->Add( PCB_ACTIONS::drawPolygon ); placeMenu->Add( PCB_ACTIONS::drawPolygon );
placeMenu->Add( PCB_ACTIONS::drawRuleArea ); placeMenu->Add( PCB_ACTIONS::placeText );
placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::drawAlignedDimension );
placeMenu->Add( PCB_ACTIONS::drawOrthogonalDimension );
placeMenu->Add( PCB_ACTIONS::drawCenterDimension );
placeMenu->Add( PCB_ACTIONS::drawRadialDimension );
placeMenu->Add( PCB_ACTIONS::drawLeader );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::setAnchor ); placeMenu->Add( PCB_ACTIONS::setAnchor );

View File

@ -316,12 +316,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
placeMenu->Add( muwaveSubmenu ); placeMenu->Add( muwaveSubmenu );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::placeText );
placeMenu->Add( PCB_ACTIONS::drawLine ); placeMenu->Add( PCB_ACTIONS::drawLine );
placeMenu->Add( PCB_ACTIONS::drawArc ); placeMenu->Add( PCB_ACTIONS::drawArc );
placeMenu->Add( PCB_ACTIONS::drawRectangle ); placeMenu->Add( PCB_ACTIONS::drawRectangle );
placeMenu->Add( PCB_ACTIONS::drawCircle ); placeMenu->Add( PCB_ACTIONS::drawCircle );
placeMenu->Add( PCB_ACTIONS::drawPolygon ); placeMenu->Add( PCB_ACTIONS::drawPolygon );
placeMenu->Add( PCB_ACTIONS::placeText );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::drawAlignedDimension ); placeMenu->Add( PCB_ACTIONS::drawAlignedDimension );

View File

@ -344,11 +344,16 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer )
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_ARC_T: case PCB_ARC_T:
case PCB_DIMENSION_T:
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_LEADER_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_ZONE_T: case PCB_ZONE_T:
aItem->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0, Millimeter2iu( 0.1 ), aItem->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0, Millimeter2iu( 0.1 ),
ERROR_INSIDE ); ERROR_INSIDE );

View File

@ -27,7 +27,6 @@
#include <bitmaps.h> #include <bitmaps.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <base_units.h> #include <base_units.h>
#include <board.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <pcb_dimension.h> #include <pcb_dimension.h>
#include <pcb_text.h> #include <pcb_text.h>
@ -37,7 +36,6 @@
#include <settings/color_settings.h> #include <settings/color_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <trigo.h> #include <trigo.h>
#include <i18n_utility.h>
PCB_DIMENSION_BASE::PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) : PCB_DIMENSION_BASE::PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) :
@ -159,15 +157,10 @@ DIM_UNITS_MODE PCB_DIMENSION_BASE::GetUnitsMode() const
{ {
switch( m_units ) switch( m_units )
{ {
case EDA_UNITS::MILLIMETRES:
return DIM_UNITS_MODE::MILLIMETRES;
case EDA_UNITS::MILS:
return DIM_UNITS_MODE::MILS;
default: default:
case EDA_UNITS::INCHES: case EDA_UNITS::INCHES: return DIM_UNITS_MODE::INCHES;
return DIM_UNITS_MODE::INCHES; case EDA_UNITS::MILLIMETRES: return DIM_UNITS_MODE::MILLIMETRES;
case EDA_UNITS::MILS: return DIM_UNITS_MODE::MILS;
} }
} }
} }
@ -179,21 +172,10 @@ void PCB_DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode )
switch( aMode ) switch( aMode )
{ {
case DIM_UNITS_MODE::INCHES: case DIM_UNITS_MODE::INCHES: m_units = EDA_UNITS::INCHES; break;
m_units = EDA_UNITS::INCHES; case DIM_UNITS_MODE::MILS: m_units = EDA_UNITS::MILS; break;
break; case DIM_UNITS_MODE::MILLIMETRES: m_units = EDA_UNITS::MILLIMETRES; break;
case DIM_UNITS_MODE::AUTOMATIC: m_autoUnits = true; break;
case DIM_UNITS_MODE::MILS:
m_units = EDA_UNITS::MILS;
break;
case DIM_UNITS_MODE::MILLIMETRES:
m_units = EDA_UNITS::MILLIMETRES;
break;
case DIM_UNITS_MODE::AUTOMATIC:
m_autoUnits = true;
break;
} }
} }
@ -324,7 +306,7 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms(); ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
units = aFrame->GetUserUnits(); units = aFrame->GetUserUnits();
if( Type() == PCB_DIM_CENTER_T ) if( Type() == PCB_DIM_CENTER_T || Type() == PCB_FP_DIM_CENTER_T )
{ {
wxPoint startCoord = originTransforms.ToDisplayAbs( GetStart() ); wxPoint startCoord = originTransforms.ToDisplayAbs( GetStart() );
wxString start = wxString::Format( "@(%s, %s)", wxString start = wxString::Format( "@(%s, %s)",
@ -553,7 +535,7 @@ EDA_ITEM* PCB_DIM_ALIGNED::Clone() const
void PCB_DIM_ALIGNED::SwapData( BOARD_ITEM* aImage ) void PCB_DIM_ALIGNED::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_DIM_ALIGNED_T ); wxASSERT( aImage->Type() == Type() );
m_shapes.clear(); m_shapes.clear();
static_cast<PCB_DIM_ALIGNED*>( aImage )->m_shapes.clear(); static_cast<PCB_DIM_ALIGNED*>( aImage )->m_shapes.clear();
@ -720,8 +702,8 @@ void PCB_DIM_ALIGNED::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_P
} }
PCB_DIM_ORTHOGONAL::PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent ) : PCB_DIM_ORTHOGONAL::PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent, bool aInFP ) :
PCB_DIM_ALIGNED( aParent, PCB_DIM_ORTHOGONAL_T ) PCB_DIM_ALIGNED( aParent, aInFP ? PCB_FP_DIM_ORTHOGONAL_T : PCB_DIM_ORTHOGONAL_T )
{ {
// To preserve look of old dimensions, initialize extension height based on default arrow length // To preserve look of old dimensions, initialize extension height based on default arrow length
m_extensionHeight = static_cast<int>( m_arrowLength * std::sin( DEG2RAD( s_arrowAngle ) ) ); m_extensionHeight = static_cast<int>( m_arrowLength * std::sin( DEG2RAD( s_arrowAngle ) ) );
@ -737,7 +719,7 @@ EDA_ITEM* PCB_DIM_ORTHOGONAL::Clone() const
void PCB_DIM_ORTHOGONAL::SwapData( BOARD_ITEM* aImage ) void PCB_DIM_ORTHOGONAL::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_DIM_ORTHOGONAL_T ); wxASSERT( aImage->Type() == Type() );
m_shapes.clear(); m_shapes.clear();
static_cast<PCB_DIM_ORTHOGONAL*>( aImage )->m_shapes.clear(); static_cast<PCB_DIM_ORTHOGONAL*>( aImage )->m_shapes.clear();
@ -950,8 +932,8 @@ void PCB_DIM_ORTHOGONAL::Rotate( const wxPoint& aRotCentre, double aAngle )
} }
PCB_DIM_LEADER::PCB_DIM_LEADER( BOARD_ITEM* aParent ) : PCB_DIM_LEADER::PCB_DIM_LEADER( BOARD_ITEM* aParent, bool aInFP ) :
PCB_DIMENSION_BASE( aParent, PCB_DIM_LEADER_T ), PCB_DIMENSION_BASE( aParent, aInFP ? PCB_FP_DIM_LEADER_T : PCB_DIM_LEADER_T ),
m_textBorder( DIM_TEXT_BORDER::NONE ) m_textBorder( DIM_TEXT_BORDER::NONE )
{ {
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX; m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
@ -970,7 +952,7 @@ EDA_ITEM* PCB_DIM_LEADER::Clone() const
void PCB_DIM_LEADER::SwapData( BOARD_ITEM* aImage ) void PCB_DIM_LEADER::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_DIM_LEADER_T ); wxASSERT( aImage->Type() == Type() );
m_shapes.clear(); m_shapes.clear();
static_cast<PCB_DIM_LEADER*>( aImage )->m_shapes.clear(); static_cast<PCB_DIM_LEADER*>( aImage )->m_shapes.clear();
@ -1098,8 +1080,8 @@ void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
} }
PCB_DIM_RADIAL::PCB_DIM_RADIAL( BOARD_ITEM* aParent ) : PCB_DIM_RADIAL::PCB_DIM_RADIAL( BOARD_ITEM* aParent, bool aInFP ) :
PCB_DIMENSION_BASE( aParent, PCB_DIM_RADIAL_T ) PCB_DIMENSION_BASE( aParent, aInFP ? PCB_FP_DIM_RADIAL_T : PCB_DIM_RADIAL_T )
{ {
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX; m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
m_overrideTextEnabled = false; m_overrideTextEnabled = false;
@ -1118,7 +1100,7 @@ EDA_ITEM* PCB_DIM_RADIAL::Clone() const
void PCB_DIM_RADIAL::SwapData( BOARD_ITEM* aImage ) void PCB_DIM_RADIAL::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_DIM_RADIAL_T ); wxASSERT( aImage->Type() == Type() );
m_shapes.clear(); m_shapes.clear();
static_cast<PCB_DIM_RADIAL*>( aImage )->m_shapes.clear(); static_cast<PCB_DIM_RADIAL*>( aImage )->m_shapes.clear();
@ -1230,8 +1212,8 @@ void PCB_DIM_RADIAL::updateGeometry()
} }
PCB_DIM_CENTER::PCB_DIM_CENTER( BOARD_ITEM* aParent ) : PCB_DIM_CENTER::PCB_DIM_CENTER( BOARD_ITEM* aParent, bool aInFP ) :
PCB_DIMENSION_BASE( aParent, PCB_DIM_CENTER_T ) PCB_DIMENSION_BASE( aParent, aInFP ? PCB_FP_DIM_CENTER_T : PCB_DIM_CENTER_T )
{ {
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX; m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
m_overrideTextEnabled = true; m_overrideTextEnabled = true;
@ -1246,7 +1228,7 @@ EDA_ITEM* PCB_DIM_CENTER::Clone() const
void PCB_DIM_CENTER::SwapData( BOARD_ITEM* aImage ) void PCB_DIM_CENTER::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_DIM_CENTER_T ); wxASSERT( aImage->Type() == Type() );
std::swap( *static_cast<PCB_DIM_CENTER*>( this ), *static_cast<PCB_DIM_CENTER*>( aImage ) ); std::swap( *static_cast<PCB_DIM_CENTER*>( this ), *static_cast<PCB_DIM_CENTER*>( aImage ) );
} }

View File

@ -250,7 +250,7 @@ public:
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer, void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc, int aClearance, int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const override; bool aIgnoreLineWidth = false ) const override;
#if defined(DEBUG) #if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
@ -344,7 +344,7 @@ protected:
class PCB_DIM_ALIGNED : public PCB_DIMENSION_BASE class PCB_DIM_ALIGNED : public PCB_DIMENSION_BASE
{ {
public: public:
PCB_DIM_ALIGNED( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIM_ALIGNED_T ); PCB_DIM_ALIGNED( BOARD_ITEM* aParent, KICAD_T aType );
// Do not create a copy constructor & operator=. // Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate. // The ones generated by the compiler are adequate.
@ -353,7 +353,8 @@ public:
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
return aItem && PCB_DIM_ALIGNED_T == aItem->Type(); return aItem && ( aItem->Type() == PCB_DIM_ALIGNED_T
|| aItem->Type() == PCB_FP_DIM_ALIGNED_T );
} }
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
@ -431,13 +432,14 @@ public:
VERTICAL // Aligned with y-axis VERTICAL // Aligned with y-axis
}; };
PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent ); PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent, bool aInFP = false );
~PCB_DIM_ORTHOGONAL() = default; ~PCB_DIM_ORTHOGONAL() = default;
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
return aItem && PCB_DIM_ORTHOGONAL_T == aItem->Type(); return aItem && ( aItem->Type() == PCB_DIM_ORTHOGONAL_T
|| aItem->Type() == PCB_FP_DIM_ORTHOGONAL_T );
} }
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
@ -495,11 +497,12 @@ private:
class PCB_DIM_RADIAL : public PCB_DIMENSION_BASE class PCB_DIM_RADIAL : public PCB_DIMENSION_BASE
{ {
public: public:
PCB_DIM_RADIAL( BOARD_ITEM* aParent ); PCB_DIM_RADIAL( BOARD_ITEM* aParent, bool aInFP = false );
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
return aItem && PCB_DIM_RADIAL_T == aItem->Type(); return aItem && ( aItem->Type() == PCB_DIM_RADIAL_T
|| aItem->Type() == PCB_FP_DIM_RADIAL_T );
} }
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
@ -545,11 +548,12 @@ private:
class PCB_DIM_LEADER : public PCB_DIMENSION_BASE class PCB_DIM_LEADER : public PCB_DIMENSION_BASE
{ {
public: public:
PCB_DIM_LEADER( BOARD_ITEM* aParent ); PCB_DIM_LEADER( BOARD_ITEM* aParent, bool aInFP = false );
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
return aItem && PCB_DIM_LEADER_T == aItem->Type(); return aItem && ( aItem->Type() == PCB_DIM_LEADER_T
|| aItem->Type() == PCB_FP_DIM_LEADER_T );
} }
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
@ -585,11 +589,12 @@ private:
class PCB_DIM_CENTER : public PCB_DIMENSION_BASE class PCB_DIM_CENTER : public PCB_DIMENSION_BASE
{ {
public: public:
PCB_DIM_CENTER( BOARD_ITEM* aParent ); PCB_DIM_CENTER( BOARD_ITEM* aParent, bool aInFP = false );
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
return aItem && PCB_DIM_CENTER_T == aItem->Type(); return aItem && ( aItem->Type() == PCB_DIM_CENTER_T
|| aItem->Type() == PCB_FP_DIM_CENTER_T );
} }
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;

View File

@ -577,7 +577,6 @@ public:
// Properties dialogs // Properties dialogs
void ShowTargetOptionsDialog( PCB_TARGET* aTarget ); void ShowTargetOptionsDialog( PCB_TARGET* aTarget );
void ShowDimensionPropertiesDialog( PCB_DIMENSION_BASE* aDimension );
void InstallNetlistFrame(); void InstallNetlistFrame();
/** /**

View File

@ -470,9 +470,6 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
break; break;
case PCB_ZONE_T: case PCB_ZONE_T:
draw( static_cast<const ZONE*>( item ), aLayer );
break;
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
draw( static_cast<const ZONE*>( item ), aLayer ); draw( static_cast<const ZONE*>( item ), aLayer );
break; break;
@ -482,6 +479,11 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
draw( static_cast<const PCB_DIMENSION_BASE*>( item ), aLayer ); draw( static_cast<const PCB_DIMENSION_BASE*>( item ), aLayer );
break; break;

View File

@ -531,10 +531,20 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
{ {
for( const BOARD_ITEM* item : aFootprint->GraphicalItems() ) for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
{ {
const FP_SHAPE* shape = dynamic_cast<const FP_SHAPE*>( item ); if( item->Type() == PCB_FP_SHAPE_T )
{
const FP_SHAPE* shape = static_cast<const FP_SHAPE*>( item );
if( shape && m_layerMask[ shape->GetLayer() ] ) if( m_layerMask[ shape->GetLayer() ] )
PlotFootprintGraphicItem( shape ); PlotFootprintGraphicItem( shape );
}
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
{
const PCB_DIMENSION_BASE* dimension = static_cast<const PCB_DIMENSION_BASE*>( item );
if( m_layerMask[ dimension->GetLayer() ] )
PlotDimension( dimension );
}
} }
} }

View File

@ -1083,7 +1083,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
wxPoint referencePoint0 = aElem.referencePoint.at( 0 ); wxPoint referencePoint0 = aElem.referencePoint.at( 0 );
wxPoint referencePoint1 = aElem.referencePoint.at( 1 ); wxPoint referencePoint1 = aElem.referencePoint.at( 1 );
PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board ); PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board, PCB_DIM_ALIGNED_T );
m_board->Add( dimension, ADD_MODE::APPEND ); m_board->Add( dimension, ADD_MODE::APPEND );
dimension->SetPrecision( aElem.textprecision ); dimension->SetPrecision( aElem.textprecision );

View File

@ -1391,7 +1391,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions()
} }
else else
{ {
dimension = new PCB_DIM_ALIGNED( m_board ); dimension = new PCB_DIM_ALIGNED( m_board, PCB_DIM_ALIGNED_T );
} }
m_board->Add( dimension, ADD_MODE::APPEND ); m_board->Add( dimension, ADD_MODE::APPEND );
@ -1439,7 +1439,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions()
if( csDim.Line.Style == DIMENSION::LINE::STYLE::INTERNAL ) if( csDim.Line.Style == DIMENSION::LINE::STYLE::INTERNAL )
{ {
// "internal" is a simple double sided arrow from start to end (no extension lines) // "internal" is a simple double sided arrow from start to end (no extension lines)
PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board ); PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board, PCB_DIM_ALIGNED_T );
m_board->Add( dimension, ADD_MODE::APPEND ); m_board->Add( dimension, ADD_MODE::APPEND );
applyDimensionSettings( csDim, dimension ); applyDimensionSettings( csDim, dimension );

View File

@ -988,7 +988,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER ) if( layer != UNDEFINED_LAYER )
{ {
const BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings(); const BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board ); PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board, PCB_DIM_ALIGNED_T );
m_board->Add( dimension, ADD_MODE::APPEND ); m_board->Add( dimension, ADD_MODE::APPEND );
if( d.dimensionType ) if( d.dimensionType )

View File

@ -781,7 +781,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
break; break;
case T_dimension: case T_dimension:
item = parseDIMENSION(); item = parseDIMENSION( m_board, false );
m_board->Add( item, ADD_MODE::BULK_APPEND ); m_board->Add( item, ADD_MODE::BULK_APPEND );
bulkAddedItems.push_back( item ); bulkAddedItems.push_back( item );
break; break;
@ -2803,7 +2803,7 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT()
} }
PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION() PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP )
{ {
wxCHECK_MSG( CurTok() == T_dimension, nullptr, wxCHECK_MSG( CurTok() == T_dimension, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as DIMENSION." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as DIMENSION." ) );
@ -2832,7 +2832,8 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION()
if( token == T_width ) if( token == T_width )
{ {
isLegacyDimension = true; isLegacyDimension = true;
dimension = std::make_unique<PCB_DIM_ALIGNED>( nullptr ); dimension = std::make_unique<PCB_DIM_ALIGNED>( aParent, aInFP ? PCB_FP_DIM_ALIGNED_T
: PCB_DIM_ALIGNED_T );
dimension->SetLineThickness( parseBoardUnits( "dimension width value" ) ); dimension->SetLineThickness( parseBoardUnits( "dimension width value" ) );
NeedRIGHT(); NeedRIGHT();
} }
@ -2844,23 +2845,24 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION()
switch( NextTok() ) switch( NextTok() )
{ {
case T_aligned: case T_aligned:
dimension = std::make_unique<PCB_DIM_ALIGNED>( nullptr ); dimension = std::make_unique<PCB_DIM_ALIGNED>( aParent, aInFP ? PCB_FP_DIM_ALIGNED_T
: PCB_DIM_ALIGNED_T );
break; break;
case T_orthogonal: case T_orthogonal:
dimension = std::make_unique<PCB_DIM_ORTHOGONAL>( nullptr ); dimension = std::make_unique<PCB_DIM_ORTHOGONAL>( aParent, aInFP );
break; break;
case T_leader: case T_leader:
dimension = std::make_unique<PCB_DIM_LEADER>( nullptr ); dimension = std::make_unique<PCB_DIM_LEADER>( aParent, aInFP );
break; break;
case T_center: case T_center:
dimension = std::make_unique<PCB_DIM_CENTER>( nullptr ); dimension = std::make_unique<PCB_DIM_CENTER>( aParent, aInFP );
break; break;
case T_radial: case T_radial:
dimension = std::make_unique<PCB_DIM_RADIAL>( nullptr ); dimension = std::make_unique<PCB_DIM_RADIAL>( aParent, aInFP );
break; break;
default: default:
@ -2929,9 +2931,11 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION()
case T_height: case T_height:
{ {
wxCHECK_MSG( dimension->Type() == PCB_DIM_ALIGNED_T || wxCHECK_MSG( dimension->Type() == PCB_DIM_ALIGNED_T
dimension->Type() == PCB_DIM_ORTHOGONAL_T, nullptr, || dimension->Type() == PCB_DIM_ORTHOGONAL_T
wxT( "Invalid height token" ) ); || dimension->Type() == PCB_FP_DIM_ALIGNED_T
|| dimension->Type() == PCB_FP_DIM_ORTHOGONAL_T,
nullptr, wxT( "Invalid height token" ) );
PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dimension.get() ); PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dimension.get() );
aligned->SetHeight( parseBoardUnits( "dimension height value" ) ); aligned->SetHeight( parseBoardUnits( "dimension height value" ) );
NeedRIGHT(); NeedRIGHT();
@ -2940,8 +2944,9 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION()
case T_leader_length: case T_leader_length:
{ {
wxCHECK_MSG( dimension->Type() == PCB_DIM_RADIAL_T, nullptr, wxCHECK_MSG( dimension->Type() == PCB_DIM_RADIAL_T
wxT( "Invalid leader_length token" ) ); || dimension->Type() == PCB_FP_DIM_RADIAL_T,
nullptr, wxT( "Invalid leader_length token" ) );
PCB_DIM_RADIAL* radial = static_cast<PCB_DIM_RADIAL*>( dimension.get() ); PCB_DIM_RADIAL* radial = static_cast<PCB_DIM_RADIAL*>( dimension.get() );
radial->SetLeaderLength( parseBoardUnits( "dimension leader length value" ) ); radial->SetLeaderLength( parseBoardUnits( "dimension leader length value" ) );
NeedRIGHT(); NeedRIGHT();
@ -2950,8 +2955,9 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION()
case T_orientation: case T_orientation:
{ {
wxCHECK_MSG( dimension->Type() == PCB_DIM_ORTHOGONAL_T, nullptr, wxCHECK_MSG( dimension->Type() == PCB_DIM_ORTHOGONAL_T
wxT( "Invalid orientation token" ) ); || dimension->Type() == PCB_FP_DIM_ORTHOGONAL_T,
nullptr, wxT( "Invalid orientation token" ) );
PCB_DIM_ORTHOGONAL* ortho = static_cast<PCB_DIM_ORTHOGONAL*>( dimension.get() ); PCB_DIM_ORTHOGONAL* ortho = static_cast<PCB_DIM_ORTHOGONAL*>( dimension.get() );
int orientation = parseInt( "orthogonal dimension orientation" ); int orientation = parseInt( "orthogonal dimension orientation" );
@ -3503,6 +3509,13 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
break; break;
} }
case T_dimension:
{
PCB_DIMENSION_BASE* dimension = parseDIMENSION( footprint.get(), true );
footprint->Add( dimension, ADD_MODE::APPEND );
break;
}
case T_pad: case T_pad:
{ {
PAD* pad = parsePAD( footprint.get() ); PAD* pad = parsePAD( footprint.get() );

View File

@ -174,7 +174,7 @@ private:
PCB_SHAPE* parsePCB_SHAPE(); PCB_SHAPE* parsePCB_SHAPE();
PCB_TEXT* parsePCB_TEXT(); PCB_TEXT* parsePCB_TEXT();
PCB_DIMENSION_BASE* parseDIMENSION(); PCB_DIMENSION_BASE* parseDIMENSION( BOARD_ITEM* aParent, bool aInFP );
// Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. // Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = nullptr ); FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = nullptr );

View File

@ -405,6 +405,11 @@ void PCB_PLUGIN::Format( const BOARD_ITEM* aItem, int aNestLevel ) const
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
format( static_cast<const PCB_DIMENSION_BASE*>( aItem ), aNestLevel ); format( static_cast<const PCB_DIMENSION_BASE*>( aItem ), aNestLevel );
break; break;
@ -711,15 +716,15 @@ void PCB_PLUGIN::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel )
if( aDimension->IsLocked() ) if( aDimension->IsLocked() )
m_out->Print( 0, " locked" ); m_out->Print( 0, " locked" );
if( aDimension->Type() == PCB_DIM_ALIGNED_T ) if( aligned )
m_out->Print( 0, " (type aligned)" ); m_out->Print( 0, " (type aligned)" );
else if( aDimension->Type() == PCB_DIM_LEADER_T ) else if( leader )
m_out->Print( 0, " (type leader)" ); m_out->Print( 0, " (type leader)" );
else if( aDimension->Type() == PCB_DIM_CENTER_T ) else if( center )
m_out->Print( 0, " (type center)" ); m_out->Print( 0, " (type center)" );
else if (aDimension->Type() == PCB_DIM_RADIAL_T ) else if( radial )
m_out->Print( 0, " (type radial)" ); m_out->Print( 0, " (type radial)" );
else if( aDimension->Type() == PCB_DIM_ORTHOGONAL_T ) else if( ortho )
m_out->Print( 0, " (type orthogonal)" ); m_out->Print( 0, " (type orthogonal)" );
else else
wxFAIL_MSG( wxT( "Cannot format unknown dimension type!" ) ); wxFAIL_MSG( wxT( "Cannot format unknown dimension type!" ) );

View File

@ -106,7 +106,8 @@ class PCB_TEXT;
//#define SEXPR_BOARD_FILE_VERSION 20211226 // Add radial dimension //#define SEXPR_BOARD_FILE_VERSION 20211226 // Add radial dimension
//#define SEXPR_BOARD_FILE_VERSION 20211227 // Add thermal relief spoke angle overrides //#define SEXPR_BOARD_FILE_VERSION 20211227 // Add thermal relief spoke angle overrides
//#define SEXPR_BOARD_FILE_VERSION 20211228 // Add allow_soldermask_bridges footprint attribute //#define SEXPR_BOARD_FILE_VERSION 20211228 // Add allow_soldermask_bridges footprint attribute
#define SEXPR_BOARD_FILE_VERSION 20211229 // Stroke formatting //#define SEXPR_BOARD_FILE_VERSION 20211229 // Stroke formatting
#define SEXPR_BOARD_FILE_VERSION 20211230 // Dimensions in footprints
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
#define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting #define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting

View File

@ -2615,9 +2615,10 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
void LEGACY_PLUGIN::loadDIMENSION() void LEGACY_PLUGIN::loadDIMENSION()
{ {
std::unique_ptr<PCB_DIM_ALIGNED> dim = std::make_unique<PCB_DIM_ALIGNED>( m_board ); std::unique_ptr<PCB_DIM_ALIGNED> dim = std::make_unique<PCB_DIM_ALIGNED>( m_board,
wxPoint crossBarO; PCB_DIM_ALIGNED_T );
wxPoint crossBarF; wxPoint crossBarO;
wxPoint crossBarF;
char* line; char* line;

View File

@ -30,7 +30,7 @@
#include <tools/pcb_selection_tool.h> #include <tools/pcb_selection_tool.h>
#include <pcb_layer_box_selector.h> #include <pcb_layer_box_selector.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/wupdlock.h>
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
{ {
@ -146,6 +146,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
{ {
wxWindowUpdateLocker dummy( this );
if( m_drawToolBar ) if( m_drawToolBar )
{ {
m_drawToolBar->ClearToolbar(); m_drawToolBar->ClearToolbar();
@ -157,17 +159,33 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->SetAuiManager( &m_auimgr ); m_drawToolBar->SetAuiManager( &m_auimgr );
} }
// Groups contained on this toolbar
static ACTION_GROUP* dimensionGroup = nullptr;
if( !dimensionGroup )
{
dimensionGroup = new ACTION_GROUP( "group.pcbDimensions",
{ &PCB_ACTIONS::drawAlignedDimension,
&PCB_ACTIONS::drawOrthogonalDimension,
&PCB_ACTIONS::drawCenterDimension,
&PCB_ACTIONS::drawRadialDimension,
&PCB_ACTIONS::drawLeader } );
}
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddScaledSeparator( this ); m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PCB_ACTIONS::placePad, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::placePad, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawRuleArea, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawRuleArea, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddGroup( dimensionGroup, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddScaledSeparator( this ); m_drawToolBar->AddScaledSeparator( this );

View File

@ -746,6 +746,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
PCB_SELECTION preview; // A VIEW_GROUP that serves as a preview for the new item(s) PCB_SELECTION preview; // A VIEW_GROUP that serves as a preview for the new item(s)
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::DIMENSION ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::DIMENSION );
int step = SET_ORIGIN; int step = SET_ORIGIN;
KICAD_T t = PCB_DIMENSION_T;
m_view->Add( &preview ); m_view->Add( &preview );
@ -884,26 +885,28 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
if( originalEvent.IsAction( &PCB_ACTIONS::drawAlignedDimension ) ) if( originalEvent.IsAction( &PCB_ACTIONS::drawAlignedDimension ) )
{ {
dimension = new PCB_DIM_ALIGNED( m_board ); dimension = new PCB_DIM_ALIGNED( m_frame->GetModel(),
m_isFootprintEditor ? PCB_FP_DIM_ALIGNED_T
: PCB_DIM_ALIGNED_T );
setMeasurementAttributes( dimension ); setMeasurementAttributes( dimension );
} }
else if( originalEvent.IsAction( &PCB_ACTIONS::drawOrthogonalDimension ) ) else if( originalEvent.IsAction( &PCB_ACTIONS::drawOrthogonalDimension ) )
{ {
dimension = new PCB_DIM_ORTHOGONAL( m_board ); dimension = new PCB_DIM_ORTHOGONAL( m_frame->GetModel(), m_isFootprintEditor );
setMeasurementAttributes( dimension ); setMeasurementAttributes( dimension );
} }
else if( originalEvent.IsAction( &PCB_ACTIONS::drawCenterDimension ) ) else if( originalEvent.IsAction( &PCB_ACTIONS::drawCenterDimension ) )
{ {
dimension = new PCB_DIM_CENTER( m_board ); dimension = new PCB_DIM_CENTER( m_frame->GetModel(), m_isFootprintEditor );
} }
else if( originalEvent.IsAction( &PCB_ACTIONS::drawRadialDimension ) ) else if( originalEvent.IsAction( &PCB_ACTIONS::drawRadialDimension ) )
{ {
dimension = new PCB_DIM_RADIAL( m_board ); dimension = new PCB_DIM_RADIAL( m_frame->GetModel(), m_isFootprintEditor );
setMeasurementAttributes( dimension ); setMeasurementAttributes( dimension );
} }
else if( originalEvent.IsAction( &PCB_ACTIONS::drawLeader ) ) else if( originalEvent.IsAction( &PCB_ACTIONS::drawLeader ) )
{ {
dimension = new PCB_DIM_LEADER( m_board ); dimension = new PCB_DIM_LEADER( m_frame->GetModel(), m_isFootprintEditor );
dimension->Text().SetPosition( wxPoint( cursorPos ) ); dimension->Text().SetPosition( wxPoint( cursorPos ) );
} }
else else
@ -911,6 +914,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
wxFAIL_MSG( "Unhandled action in DRAWING_TOOL::DrawDimension" ); wxFAIL_MSG( "Unhandled action in DRAWING_TOOL::DrawDimension" );
} }
t = dimension->Type();
dimension->SetLayer( layer ); dimension->SetLayer( layer );
dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) ); dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->Text().SetTextThickness( boardSettings.GetTextThickness( layer ) ); dimension->Text().SetTextThickness( boardSettings.GetTextThickness( layer ) );
@ -944,9 +949,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
break; break;
} }
if( dimension->Type() == PCB_DIM_CENTER_T if( t == PCB_DIM_CENTER_T || t == PCB_DIM_RADIAL_T || t == PCB_DIM_LEADER_T
|| dimension->Type() == PCB_DIM_RADIAL_T || t == PCB_FP_DIM_CENTER_T || t == PCB_FP_DIM_RADIAL_T || t == PCB_FP_DIM_LEADER_T )
|| dimension->Type() == PCB_DIM_LEADER_T )
{ {
// No separate height step // No separate height step
++step; ++step;
@ -966,7 +970,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
commit.Add( dimension ); commit.Add( dimension );
commit.Push( _( "Draw a dimension" ) ); commit.Push( _( "Draw a dimension" ) );
if( dimension->Type() == PCB_DIM_LEADER_T ) if( t == PCB_DIM_LEADER_T || t == PCB_FP_DIM_LEADER_T )
{ {
// Run the edit immediately to set the leader text // Run the edit immediately to set the leader text
m_toolMgr->RunAction( PCB_ACTIONS::properties, true, dimension ); m_toolMgr->RunAction( PCB_ACTIONS::properties, true, dimension );
@ -991,10 +995,10 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
case SET_END: case SET_END:
dimension->SetEnd( (wxPoint) cursorPos ); dimension->SetEnd( (wxPoint) cursorPos );
if( Is45Limited() || dimension->Type() == PCB_DIM_CENTER_T ) if( Is45Limited() || t == PCB_DIM_CENTER_T || t == PCB_FP_DIM_CENTER_T )
constrainDimension( dimension ); constrainDimension( dimension );
if( dimension->Type() == PCB_DIM_ORTHOGONAL_T ) if( t == PCB_DIM_ORTHOGONAL_T || t == PCB_FP_DIM_ORTHOGONAL_T )
{ {
PCB_DIM_ORTHOGONAL* ortho = static_cast<PCB_DIM_ORTHOGONAL*>( dimension ); PCB_DIM_ORTHOGONAL* ortho = static_cast<PCB_DIM_ORTHOGONAL*>( dimension );
@ -1007,7 +1011,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
ortho->SetOrientation( vert ? PCB_DIM_ORTHOGONAL::DIR::VERTICAL ortho->SetOrientation( vert ? PCB_DIM_ORTHOGONAL::DIR::VERTICAL
: PCB_DIM_ORTHOGONAL::DIR::HORIZONTAL ); : PCB_DIM_ORTHOGONAL::DIR::HORIZONTAL );
} }
else if( dimension->Type() == PCB_DIM_RADIAL_T ) else if( t == PCB_DIM_RADIAL_T || t == PCB_FP_DIM_RADIAL_T )
{ {
PCB_DIM_RADIAL* radialDim = static_cast<PCB_DIM_RADIAL*>( dimension ); PCB_DIM_RADIAL* radialDim = static_cast<PCB_DIM_RADIAL*>( dimension );
wxPoint textOffset( radialDim->GetArrowLength() * 10, 0 ); wxPoint textOffset( radialDim->GetArrowLength() * 10, 0 );
@ -1018,7 +1022,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
radialDim->Text().SetPosition( radialDim->GetKnee() + textOffset ); radialDim->Text().SetPosition( radialDim->GetKnee() + textOffset );
radialDim->Update(); radialDim->Update();
} }
else if( dimension->Type() == PCB_DIM_LEADER_T ) else if( t == PCB_DIM_LEADER_T || t == PCB_FP_DIM_LEADER_T )
{ {
wxPoint textOffset( dimension->GetArrowLength() * 10, 0 ); wxPoint textOffset( dimension->GetArrowLength() * 10, 0 );
@ -1032,7 +1036,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
break; break;
case SET_HEIGHT: case SET_HEIGHT:
if( dimension->Type() == PCB_DIM_ALIGNED_T ) if( t == PCB_DIM_ALIGNED_T || t == PCB_FP_DIM_ALIGNED_T )
{ {
PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dimension ); PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dimension );
@ -1044,7 +1048,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
aligned->SetHeight( height ); aligned->SetHeight( height );
aligned->Update(); aligned->Update();
} }
else if( dimension->Type() == PCB_DIM_ORTHOGONAL_T ) else if( t == PCB_DIM_ORTHOGONAL_T || t == PCB_FP_DIM_ORTHOGONAL_T )
{ {
PCB_DIM_ORTHOGONAL* ortho = static_cast<PCB_DIM_ORTHOGONAL*>( dimension ); PCB_DIM_ORTHOGONAL* ortho = static_cast<PCB_DIM_ORTHOGONAL*>( dimension );

View File

@ -977,6 +977,14 @@ int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
std::vector<BOARD_ITEM*> itemsToSel; std::vector<BOARD_ITEM*> itemsToSel;
itemsToSel.reserve( aItems.size() ); itemsToSel.reserve( aItems.size() );
auto updateDimensionUnits =
[this]( PCB_DIMENSION_BASE* dimension )
{
// Dimensions need to have their units updated if they are automatic
if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC )
dimension->SetUnits( frame()->GetUserUnits() );
};
for( BOARD_ITEM* item : aItems ) for( BOARD_ITEM* item : aItems )
{ {
if( aIsNew ) if( aIsNew )
@ -988,33 +996,23 @@ int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
} }
// Update item attributes if needed // Update item attributes if needed
switch( item->Type() ) if( BaseType( item->Type() ) == PCB_DIMENSION_T )
{ {
case PCB_DIMENSION_T: updateDimensionUnits( static_cast<PCB_DIMENSION_BASE*>( item ) );
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
{
// Dimensions need to have their units updated if they are automatic
PCB_DIMENSION_BASE* dim = static_cast<PCB_DIMENSION_BASE*>( item );
if( dim->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC )
dim->SetUnits( frame()->GetUserUnits() );
break;
} }
else if( item->Type() == PCB_FOOTPRINT_T )
{
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
case PCB_FOOTPRINT_T:
// Update the footprint path with the new KIID path if the footprint is new // Update the footprint path with the new KIID path if the footprint is new
if( aIsNew ) if( aIsNew )
static_cast<FOOTPRINT*>( item )->SetPath( KIID_PATH() ); footprint->SetPath( KIID_PATH() );
break; for( BOARD_ITEM* dwg : footprint->GraphicalItems() )
{
default: if( BaseType( dwg->Type() ) == PCB_DIMENSION_T )
break; updateDimensionUnits( static_cast<PCB_DIMENSION_BASE*>( item ) );
}
} }
// We only need to add the items that aren't inside a group currently selected // We only need to add the items that aren't inside a group currently selected

View File

@ -652,6 +652,8 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_ORTHOGONAL_T:
{ {
const PCB_DIM_ALIGNED* dim = static_cast<const PCB_DIM_ALIGNED*>( aItem ); const PCB_DIM_ALIGNED* dim = static_cast<const PCB_DIM_ALIGNED*>( aItem );
addAnchor( dim->GetCrossbarStart(), CORNER | SNAPPABLE, aItem ); addAnchor( dim->GetCrossbarStart(), CORNER | SNAPPABLE, aItem );
@ -662,6 +664,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
} }
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_FP_DIM_CENTER_T:
{ {
const PCB_DIM_CENTER* dim = static_cast<const PCB_DIM_CENTER*>( aItem ); const PCB_DIM_CENTER* dim = static_cast<const PCB_DIM_CENTER*>( aItem );
addAnchor( dim->GetStart(), CORNER | SNAPPABLE, aItem ); addAnchor( dim->GetStart(), CORNER | SNAPPABLE, aItem );
@ -680,6 +683,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
} }
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_FP_DIM_RADIAL_T:
{ {
const PCB_DIM_RADIAL* radialDim = static_cast<const PCB_DIM_RADIAL*>( aItem ); const PCB_DIM_RADIAL* radialDim = static_cast<const PCB_DIM_RADIAL*>( aItem );
addAnchor( radialDim->GetStart(), CORNER | SNAPPABLE, aItem ); addAnchor( radialDim->GetStart(), CORNER | SNAPPABLE, aItem );
@ -690,6 +694,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
} }
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_LEADER_T:
{ {
const PCB_DIM_LEADER* leader = static_cast<const PCB_DIM_LEADER*>( aItem ); const PCB_DIM_LEADER* leader = static_cast<const PCB_DIM_LEADER*>( aItem );
addAnchor( leader->GetStart(), CORNER | SNAPPABLE, aItem ); addAnchor( leader->GetStart(), CORNER | SNAPPABLE, aItem );

View File

@ -299,6 +299,8 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_ORTHOGONAL_T:
{ {
const PCB_DIM_ALIGNED* dimension = static_cast<const PCB_DIM_ALIGNED*>( aItem ); const PCB_DIM_ALIGNED* dimension = static_cast<const PCB_DIM_ALIGNED*>( aItem );
@ -323,6 +325,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
} }
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_FP_DIM_CENTER_T:
{ {
const PCB_DIM_CENTER* dimension = static_cast<const PCB_DIM_CENTER*>( aItem ); const PCB_DIM_CENTER* dimension = static_cast<const PCB_DIM_CENTER*>( aItem );
@ -336,6 +339,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
} }
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_FP_DIM_RADIAL_T:
{ {
const PCB_DIM_RADIAL* dimension = static_cast<const PCB_DIM_RADIAL*>( aItem ); const PCB_DIM_RADIAL* dimension = static_cast<const PCB_DIM_RADIAL*>( aItem );
@ -355,6 +359,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
} }
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_LEADER_T:
{ {
const PCB_DIM_LEADER* dimension = static_cast<const PCB_DIM_LEADER*>( aItem ); const PCB_DIM_LEADER* dimension = static_cast<const PCB_DIM_LEADER*>( aItem );
@ -1340,6 +1345,7 @@ void PCB_POINT_EDITOR::updateItem() const
} }
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_FP_DIM_ALIGNED_T:
{ {
PCB_DIM_ALIGNED* dimension = static_cast<PCB_DIM_ALIGNED*>( item ); PCB_DIM_ALIGNED* dimension = static_cast<PCB_DIM_ALIGNED*>( item );
@ -1404,6 +1410,7 @@ void PCB_POINT_EDITOR::updateItem() const
} }
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
{ {
PCB_DIM_ORTHOGONAL* dimension = static_cast<PCB_DIM_ORTHOGONAL*>( item ); PCB_DIM_ORTHOGONAL* dimension = static_cast<PCB_DIM_ORTHOGONAL*>( item );
@ -1469,6 +1476,7 @@ void PCB_POINT_EDITOR::updateItem() const
} }
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_FP_DIM_CENTER_T:
{ {
PCB_DIM_CENTER* dimension = static_cast<PCB_DIM_CENTER*>( item ); PCB_DIM_CENTER* dimension = static_cast<PCB_DIM_CENTER*>( item );
@ -1483,6 +1491,7 @@ void PCB_POINT_EDITOR::updateItem() const
} }
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_FP_DIM_RADIAL_T:
{ {
PCB_DIM_RADIAL* dimension = static_cast<PCB_DIM_RADIAL*>( item ); PCB_DIM_RADIAL* dimension = static_cast<PCB_DIM_RADIAL*>( item );
@ -1531,6 +1540,7 @@ void PCB_POINT_EDITOR::updateItem() const
} }
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_LEADER_T:
{ {
PCB_DIM_LEADER* dimension = static_cast<PCB_DIM_LEADER*>( item ); PCB_DIM_LEADER* dimension = static_cast<PCB_DIM_LEADER*>( item );
@ -1780,6 +1790,8 @@ void PCB_POINT_EDITOR::updatePoints()
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_ORTHOGONAL_T:
{ {
const PCB_DIM_ALIGNED* dimension = static_cast<const PCB_DIM_ALIGNED*>( item ); const PCB_DIM_ALIGNED* dimension = static_cast<const PCB_DIM_ALIGNED*>( item );
@ -1792,6 +1804,7 @@ void PCB_POINT_EDITOR::updatePoints()
} }
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_FP_DIM_CENTER_T:
{ {
const PCB_DIM_CENTER* dimension = static_cast<const PCB_DIM_CENTER*>( item ); const PCB_DIM_CENTER* dimension = static_cast<const PCB_DIM_CENTER*>( item );
@ -1801,6 +1814,7 @@ void PCB_POINT_EDITOR::updatePoints()
} }
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_FP_DIM_RADIAL_T:
{ {
const PCB_DIM_RADIAL* dimension = static_cast<const PCB_DIM_RADIAL*>( item ); const PCB_DIM_RADIAL* dimension = static_cast<const PCB_DIM_RADIAL*>( item );
@ -1812,6 +1826,7 @@ void PCB_POINT_EDITOR::updatePoints()
} }
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_LEADER_T:
{ {
const PCB_DIM_LEADER* dimension = static_cast<const PCB_DIM_LEADER*>( item ); const PCB_DIM_LEADER* dimension = static_cast<const PCB_DIM_LEADER*>( item );
@ -1919,6 +1934,7 @@ EDIT_POINT PCB_POINT_EDITOR::get45DegConstrainer() const
break; break;
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_FP_DIM_ALIGNED_T:
{ {
// Constraint for crossbar // Constraint for crossbar
if( isModified( m_editPoints->Point( DIM_START ) ) ) if( isModified( m_editPoints->Point( DIM_START ) ) )
@ -1934,6 +1950,7 @@ EDIT_POINT PCB_POINT_EDITOR::get45DegConstrainer() const
} }
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_FP_DIM_CENTER_T:
{ {
if( isModified( m_editPoints->Point( DIM_END ) ) ) if( isModified( m_editPoints->Point( DIM_END ) ) )
return m_editPoints->Point( DIM_START ); return m_editPoints->Point( DIM_START );
@ -1942,6 +1959,7 @@ EDIT_POINT PCB_POINT_EDITOR::get45DegConstrainer() const
} }
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_FP_DIM_RADIAL_T:
{ {
if( isModified( m_editPoints->Point( DIM_TEXT ) ) ) if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
return m_editPoints->Point( DIM_KNEE ); return m_editPoints->Point( DIM_KNEE );

View File

@ -1596,6 +1596,11 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
if( layer == Edge_Cuts ) if( layer == Edge_Cuts )
include = aFilterOptions.includeBoardOutlineLayer; include = aFilterOptions.includeBoardOutlineLayer;
else else
@ -1748,6 +1753,11 @@ bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem, bool aMultiSelect
case PCB_DIM_RADIAL_T: case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
if( !m_filter.dimensions ) if( !m_filter.dimensions )
return false; return false;

View File

@ -137,7 +137,9 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent )
{ {
for( BOARD_ITEM* item : fp->GraphicalItems() ) for( BOARD_ITEM* item : fp->GraphicalItems() )
{ {
if( item->Type() == PCB_FP_SHAPE_T ) KICAD_T t = item->Type();
if( t == PCB_FP_SHAPE_T || BaseType( t ) == PCB_DIMENSION_T )
view()->Update( item, KIGFX::REPAINT ); view()->Update( item, KIGFX::REPAINT );
} }
} }

View File

@ -69,12 +69,17 @@ public:
switch( aType ) switch( aType )
{ {
case PCB_FOOTPRINT_T: return new FOOTPRINT( &m_board ); case PCB_FOOTPRINT_T: return new FOOTPRINT( &m_board );
case PCB_PAD_T: return new PAD( &m_footprint ); case PCB_PAD_T: return new PAD( &m_footprint );
case PCB_SHAPE_T: return new PCB_SHAPE( &m_board ); case PCB_SHAPE_T: return new PCB_SHAPE( &m_board );
case PCB_TEXT_T: return new PCB_TEXT( &m_board ); case PCB_TEXT_T: return new PCB_TEXT( &m_board );
case PCB_FP_TEXT_T: return new FP_TEXT( &m_footprint ); case PCB_FP_TEXT_T: return new FP_TEXT( &m_footprint );
case PCB_FP_SHAPE_T: return new FP_SHAPE( &m_footprint ); case PCB_FP_SHAPE_T: return new FP_SHAPE( &m_footprint );
case PCB_FP_DIM_ALIGNED_T: return new PCB_DIM_ALIGNED( &m_footprint, PCB_FP_DIM_ALIGNED_T );
case PCB_FP_DIM_LEADER_T: return new PCB_DIM_LEADER( &m_footprint, true );
case PCB_FP_DIM_CENTER_T: return new PCB_DIM_CENTER( &m_footprint, true );
case PCB_FP_DIM_RADIAL_T: return new PCB_DIM_RADIAL( &m_footprint, true );
case PCB_FP_DIM_ORTHOGONAL_T: return new PCB_DIM_ORTHOGONAL( &m_footprint, true );
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
{ {
FP_ZONE* fpZone = new FP_ZONE( &m_footprint ); FP_ZONE* fpZone = new FP_ZONE( &m_footprint );
@ -87,16 +92,16 @@ public:
return fpZone; return fpZone;
} }
case PCB_TRACE_T: return new PCB_TRACK( &m_board ); case PCB_TRACE_T: return new PCB_TRACK( &m_board );
case PCB_VIA_T: return new PCB_VIA( &m_board ); case PCB_VIA_T: return new PCB_VIA( &m_board );
case PCB_ARC_T: return new PCB_ARC( &m_board ); case PCB_ARC_T: return new PCB_ARC( &m_board );
case PCB_MARKER_T: return new PCB_MARKER( m_drcItem, wxPoint( 0, 0 ) ); case PCB_MARKER_T: return new PCB_MARKER( m_drcItem, wxPoint( 0, 0 ) );
case PCB_DIM_ALIGNED_T: return new PCB_DIM_ALIGNED( &m_board ); case PCB_DIM_ALIGNED_T: return new PCB_DIM_ALIGNED( &m_board, PCB_DIM_ALIGNED_T );
case PCB_DIM_LEADER_T: return new PCB_DIM_LEADER( &m_board ); case PCB_DIM_LEADER_T: return new PCB_DIM_LEADER( &m_board );
case PCB_DIM_CENTER_T: return new PCB_DIM_CENTER( &m_board ); case PCB_DIM_CENTER_T: return new PCB_DIM_CENTER( &m_board );
case PCB_DIM_RADIAL_T: return new PCB_DIM_RADIAL( &m_board ); case PCB_DIM_RADIAL_T: return new PCB_DIM_RADIAL( &m_board );
case PCB_DIM_ORTHOGONAL_T: return new PCB_DIM_ORTHOGONAL( &m_board ); case PCB_DIM_ORTHOGONAL_T: return new PCB_DIM_ORTHOGONAL( &m_board );
case PCB_TARGET_T: return new PCB_TARGET( &m_board ); case PCB_TARGET_T: return new PCB_TARGET( &m_board );
case PCB_ZONE_T: case PCB_ZONE_T:
{ {
ZONE* zone = new ZONE( &m_board ); ZONE* zone = new ZONE( &m_board );